summaryrefslogtreecommitdiffstats
path: root/gki
diff options
context:
space:
mode:
authorAndre Eisenbach <andre@broadcom.com>2012-09-18 01:35:44 -0700
committerMatthew Xie <mattx@google.com>2012-09-18 16:26:28 -0700
commit6ef101187774e30ddba6b46bbedef549a42196ad (patch)
treef36eb347f03083671640fbc750171e3b951e0082 /gki
parentf80d3d045eab5f002be4b5e8a3d2d376fdf7581a (diff)
downloadexternal_bluetooth_bluedroid-6ef101187774e30ddba6b46bbedef549a42196ad.zip
external_bluetooth_bluedroid-6ef101187774e30ddba6b46bbedef549a42196ad.tar.gz
external_bluetooth_bluedroid-6ef101187774e30ddba6b46bbedef549a42196ad.tar.bz2
Initual Bluetooth open source release
First release under Apache source license with updated header files and whitespace cleanups. Also fixed file permission to remove executable bit from source files. Change-Id: I7155903edfc2f491c1cbbd0db108f207852caaa0
Diffstat (limited to 'gki')
-rw-r--r--gki/Android.mk8
-rw-r--r--gki/common/gki.h64
-rw-r--r--gki/common/gki_buffer.c100
-rw-r--r--gki/common/gki_common.h30
-rw-r--r--gki/common/gki_debug.c34
-rw-r--r--gki/common/gki_inet.h29
-rw-r--r--gki/common/gki_time.c83
-rw-r--r--gki/ulinux/data_types.h34
-rw-r--r--gki/ulinux/gki_int.h28
-rw-r--r--gki/ulinux/gki_ulinux.c71
10 files changed, 247 insertions, 234 deletions
diff --git a/gki/Android.mk b/gki/Android.mk
index 13a4a95..c76c237 100644
--- a/gki/Android.mk
+++ b/gki/Android.mk
@@ -14,7 +14,7 @@ LOCAL_CFLAGS += -Werror $(bdroid_CFLAGS)
ifeq ($(BOARD_HAVE_BLUETOOTH_BCM),true)
LOCAL_CFLAGS += \
- -DBOARD_HAVE_BLUETOOTH_BCM
+ -DBOARD_HAVE_BLUETOOTH_BCM
endif
LOCAL_PRELINK_MODULE:=false
@@ -22,9 +22,9 @@ LOCAL_SRC_FILES:= \
./ulinux/gki_ulinux.c \
./common/gki_debug.c \
./common/gki_time.c \
- ./common/gki_buffer.c
-
-LOCAL_MODULE := libbt-brcm_gki
+ ./common/gki_buffer.c
+
+LOCAL_MODULE := libbt-brcm_gki
LOCAL_MODULE_TAGS := optional
LOCAL_SHARED_LIBRARIES := libcutils libc
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
diff --git a/gki/common/gki.h b/gki/common/gki.h
index d53ab04..5180dcd 100644
--- a/gki/common/gki.h
+++ b/gki/common/gki.h
@@ -1,14 +1,20 @@
-/****************************************************************************
-**
-** Name gki.h
-**
-** Function This file contains GKI public definitions
-**
-**
-** Copyright (c) 1999-2011, Broadcom Corp., All Rights Reserved.
-** Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 1999-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
#ifndef GKI_H
#define GKI_H
@@ -94,7 +100,7 @@
#if (GKI_NUM_FIXED_BUF_POOLS < 1)
#ifndef GKI_POOL_ID_0
-#define GKI_POOL_ID_0 0
+#define GKI_POOL_ID_0 0
#endif /* ifndef GKI_POOL_ID_0 */
#ifndef GKI_BUF0_SIZE
@@ -107,7 +113,7 @@
#if (GKI_NUM_FIXED_BUF_POOLS < 2)
#ifndef GKI_POOL_ID_1
-#define GKI_POOL_ID_1 0
+#define GKI_POOL_ID_1 0
#endif /* ifndef GKI_POOL_ID_1 */
#ifndef GKI_BUF1_SIZE
@@ -120,7 +126,7 @@
#if (GKI_NUM_FIXED_BUF_POOLS < 3)
#ifndef GKI_POOL_ID_2
-#define GKI_POOL_ID_2 0
+#define GKI_POOL_ID_2 0
#endif /* ifndef GKI_POOL_ID_2 */
#ifndef GKI_BUF2_SIZE
@@ -133,7 +139,7 @@
#if (GKI_NUM_FIXED_BUF_POOLS < 4)
#ifndef GKI_POOL_ID_3
-#define GKI_POOL_ID_3 0
+#define GKI_POOL_ID_3 0
#endif /* ifndef GKI_POOL_ID_4 */
#ifndef GKI_BUF3_SIZE
@@ -146,7 +152,7 @@
#if (GKI_NUM_FIXED_BUF_POOLS < 5)
#ifndef GKI_POOL_ID_4
-#define GKI_POOL_ID_4 0
+#define GKI_POOL_ID_4 0
#endif /* ifndef GKI_POOL_ID_4 */
#ifndef GKI_BUF4_SIZE
@@ -159,7 +165,7 @@
#if (GKI_NUM_FIXED_BUF_POOLS < 6)
#ifndef GKI_POOL_ID_5
-#define GKI_POOL_ID_5 0
+#define GKI_POOL_ID_5 0
#endif /* ifndef GKI_POOL_ID_5 */
#ifndef GKI_BUF5_SIZE
@@ -172,7 +178,7 @@
#if (GKI_NUM_FIXED_BUF_POOLS < 7)
#ifndef GKI_POOL_ID_6
-#define GKI_POOL_ID_6 0
+#define GKI_POOL_ID_6 0
#endif /* ifndef GKI_POOL_ID_6 */
#ifndef GKI_BUF6_SIZE
@@ -185,7 +191,7 @@
#if (GKI_NUM_FIXED_BUF_POOLS < 8)
#ifndef GKI_POOL_ID_7
-#define GKI_POOL_ID_7 0
+#define GKI_POOL_ID_7 0
#endif /* ifndef GKI_POOL_ID_7 */
#ifndef GKI_BUF7_SIZE
@@ -198,7 +204,7 @@
#if (GKI_NUM_FIXED_BUF_POOLS < 9)
#ifndef GKI_POOL_ID_8
-#define GKI_POOL_ID_8 0
+#define GKI_POOL_ID_8 0
#endif /* ifndef GKI_POOL_ID_8 */
#ifndef GKI_BUF8_SIZE
@@ -211,7 +217,7 @@
#if (GKI_NUM_FIXED_BUF_POOLS < 10)
#ifndef GKI_POOL_ID_9
-#define GKI_POOL_ID_9 0
+#define GKI_POOL_ID_9 0
#endif /* ifndef GKI_POOL_ID_9 */
#ifndef GKI_BUF9_SIZE
@@ -224,7 +230,7 @@
#if (GKI_NUM_FIXED_BUF_POOLS < 11)
#ifndef GKI_POOL_ID_10
-#define GKI_POOL_ID_10 0
+#define GKI_POOL_ID_10 0
#endif /* ifndef GKI_POOL_ID_10 */
#ifndef GKI_BUF10_SIZE
@@ -237,7 +243,7 @@
#if (GKI_NUM_FIXED_BUF_POOLS < 12)
#ifndef GKI_POOL_ID_11
-#define GKI_POOL_ID_11 0
+#define GKI_POOL_ID_11 0
#endif /* ifndef GKI_POOL_ID_11 */
#ifndef GKI_BUF11_SIZE
@@ -250,7 +256,7 @@
#if (GKI_NUM_FIXED_BUF_POOLS < 13)
#ifndef GKI_POOL_ID_12
-#define GKI_POOL_ID_12 0
+#define GKI_POOL_ID_12 0
#endif /* ifndef GKI_POOL_ID_12 */
#ifndef GKI_BUF12_SIZE
@@ -263,7 +269,7 @@
#if (GKI_NUM_FIXED_BUF_POOLS < 14)
#ifndef GKI_POOL_ID_13
-#define GKI_POOL_ID_13 0
+#define GKI_POOL_ID_13 0
#endif /* ifndef GKI_POOL_ID_13 */
#ifndef GKI_BUF13_SIZE
@@ -276,7 +282,7 @@
#if (GKI_NUM_FIXED_BUF_POOLS < 15)
#ifndef GKI_POOL_ID_14
-#define GKI_POOL_ID_14 0
+#define GKI_POOL_ID_14 0
#endif /* ifndef GKI_POOL_ID_14 */
#ifndef GKI_BUF14_SIZE
@@ -289,7 +295,7 @@
#if (GKI_NUM_FIXED_BUF_POOLS < 16)
#ifndef GKI_POOL_ID_15
-#define GKI_POOL_ID_15 0
+#define GKI_POOL_ID_15 0
#endif /* ifndef GKI_POOL_ID_15 */
#ifndef GKI_BUF15_SIZE
@@ -324,7 +330,7 @@ typedef struct _tle
/* Define a timer list queue
*/
-typedef struct
+typedef struct
{
TIMER_LIST_ENT *p_first;
TIMER_LIST_ENT *p_last;
@@ -335,7 +341,7 @@ typedef struct
/***********************************************************************
** This queue is a general purpose buffer queue, for application use.
*/
-typedef struct
+typedef struct
{
void *p_first;
void *p_last;
diff --git a/gki/common/gki_buffer.c b/gki/common/gki_buffer.c
index fbf19b8..f474bab 100644
--- a/gki/common/gki_buffer.c
+++ b/gki/common/gki_buffer.c
@@ -1,14 +1,20 @@
-/********************************************************************************
-** *
-** Name gki_buffer.c *
-** *
-** Function this file contains GKI buffer handling functions *
-** *
-** *
-** Copyright (c) 1999-2009, Broadcom Corp., All Rights Reserved. *
-** Proprietary and confidential. *
-** *
-*********************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 1999-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
#include "gki_int.h"
#include <cutils/log.h>
@@ -51,7 +57,7 @@ static void gki_init_free_queue (UINT8 id, UINT16 size, UINT16 total, void *p_me
p_cb->pool_end[id] = (UINT8 *)p_mem + (act_size * total);
}
// btla-specific --
-
+
p_cb->pool_size[id] = act_size;
p_cb->freeq[id].size = (UINT16) tempsize;
@@ -90,9 +96,9 @@ static BOOLEAN gki_alloc_free_queue(UINT8 id)
FREE_QUEUE_T *Q;
tGKI_COM_CB *p_cb = &gki_cb.com;
GKI_TRACE("\ngki_alloc_free_queue in, id:%d \n", (int)id );
-
+
Q = &p_cb->freeq[p_cb->pool_list[id]];
-
+
if(Q->p_first == 0)
{
void* p_mem = GKI_os_malloc((Q->size + BUFFER_PADDING_SIZE) * Q->total);
@@ -105,7 +111,7 @@ static BOOLEAN gki_alloc_free_queue(UINT8 id)
return TRUE;
}
GKI_exception (GKI_ERROR_BUF_SIZE_TOOBIG, "gki_alloc_free_queue: Not enough memory");
- }
+ }
GKI_TRACE("\ngki_alloc_free_queue out failed, id:%d\n", id);
return FALSE;
}
@@ -125,10 +131,10 @@ void gki_dealloc_free_queue(void)
p_cb->freeq[i].max_cnt = 0;
p_cb->freeq[i].p_first = NULL;
p_cb->freeq[i].p_last = NULL;
-
+
p_cb->pool_start[i] = NULL;
p_cb->pool_end[i] = NULL;
- p_cb->pool_size[i] = 0;
+ p_cb->pool_size[i] = 0;
}
}
}
@@ -176,7 +182,7 @@ void gki_buffer_init(void)
}
/* Use default from target.h */
- p_cb->pool_access_mask = GKI_DEF_BUFPOOL_PERM_MASK;
+ p_cb->pool_access_mask = GKI_DEF_BUFPOOL_PERM_MASK;
// btla-specific ++
#if (!defined GKI_USE_DEFERED_ALLOC_BUF_POOLS && (GKI_USE_DYNAMIC_BUFFERS == TRUE))
@@ -389,7 +395,7 @@ void *GKI_getbuf (UINT16 size)
GKI_disable();
/* search the public buffer pools that are big enough to hold the size
- * until a free buffer is found */
+ * until a free buffer is found */
for ( ; i < p_cb->curr_total_no_of_pools; i++)
{
/* Only look at PUBLIC buffer pools (bypass RESTRICTED pools) */
@@ -397,7 +403,7 @@ void *GKI_getbuf (UINT16 size)
continue;
Q = &p_cb->freeq[p_cb->pool_list[i]];
- if(Q->cur_cnt < Q->total)
+ if(Q->cur_cnt < Q->total)
{
// btla-specific ++
#ifdef GKI_USE_DEFERED_ALLOC_BUF_POOLS
@@ -494,7 +500,7 @@ void *GKI_getpoolbuf (UINT8 pool_id)
/* try for free buffers in public pools */
return (GKI_getbuf(p_cb->freeq[pool_id].size));
-
+
}
/*******************************************************************************
@@ -512,7 +518,7 @@ void GKI_freebuf (void *p_buf)
{
FREE_QUEUE_T *Q;
BUFFER_HDR_T *p_hdr;
-
+
#if (GKI_ENABLE_BUF_CORRUPTION_CHECK == TRUE)
if (!p_buf || gki_chk_buf_damage(p_buf))
{
@@ -520,23 +526,23 @@ void GKI_freebuf (void *p_buf)
return;
}
#endif
-
+
p_hdr = (BUFFER_HDR_T *) ((UINT8 *)p_buf - BUFFER_HDR_SIZE);
-
+
if (p_hdr->status != BUF_STATUS_UNLINKED)
{
GKI_exception(GKI_ERROR_FREEBUF_BUF_LINKED, "Freeing Linked Buf");
return;
}
-
+
if (p_hdr->q_id >= GKI_NUM_TOTAL_BUF_POOLS)
{
GKI_exception(GKI_ERROR_FREEBUF_BAD_QID, "Bad Buf QId");
return;
}
-
+
GKI_disable();
-
+
/*
** Release the buffer
*/
@@ -545,16 +551,16 @@ void GKI_freebuf (void *p_buf)
Q->p_last->p_next = p_hdr;
else
Q->p_first = p_hdr;
-
+
Q->p_last = p_hdr;
p_hdr->p_next = NULL;
p_hdr->status = BUF_STATUS_FREE;
p_hdr->task_id = GKI_INVALID_TASK;
if (Q->cur_cnt > 0)
Q->cur_cnt--;
-
+
GKI_enable();
-
+
return;
}
@@ -576,7 +582,7 @@ UINT16 GKI_get_buf_size (void *p_buf)
p_hdr = (BUFFER_HDR_T *)((UINT8 *) p_buf - BUFFER_HDR_SIZE);
- if ((UINT32)p_hdr & 1)
+ if ((UINT32)p_hdr & 1)
return (0);
if (p_hdr->q_id < GKI_NUM_TOTAL_BUF_POOLS)
@@ -1001,7 +1007,7 @@ void *GKI_getnext (void *p_buf)
BOOLEAN GKI_queue_is_empty(BUFFER_Q *p_q)
{
return ((BOOLEAN) (p_q->count == 0));
-}
+}
/*******************************************************************************
**
@@ -1068,10 +1074,10 @@ UINT8 GKI_set_pool_permission(UINT8 pool_id, UINT8 permission)
{
if (permission == GKI_RESTRICTED_POOL)
p_cb->pool_access_mask = (UINT16)(p_cb->pool_access_mask | (1 << pool_id));
-
+
else /* mark the pool as public */
p_cb->pool_access_mask = (UINT16)(p_cb->pool_access_mask & ~(1 << pool_id));
-
+
return (GKI_SUCCESS);
}
else
@@ -1082,7 +1088,7 @@ UINT8 GKI_set_pool_permission(UINT8 pool_id, UINT8 permission)
**
** Function gki_add_to_pool_list
**
-** Description Adds pool to the pool list which is arranged in the
+** Description Adds pool to the pool list which is arranged in the
** order of size
**
** Returns void
@@ -1095,7 +1101,7 @@ static void gki_add_to_pool_list(UINT8 pool_id)
tGKI_COM_CB *p_cb = &gki_cb.com;
/* Find the position where the specified pool should be inserted into the list */
- for(i=0; i < p_cb->curr_total_no_of_pools; i++)
+ for(i=0; i < p_cb->curr_total_no_of_pools; i++)
{
if(p_cb->freeq[pool_id].size <= p_cb->freeq[ p_cb->pool_list[i] ].size)
@@ -1117,7 +1123,7 @@ static void gki_add_to_pool_list(UINT8 pool_id)
**
** Function gki_remove_from_pool_list
**
-** Description Removes pool from the pool list. Called when a pool is deleted
+** Description Removes pool from the pool list. Called when a pool is deleted
**
** Returns void
**
@@ -1126,7 +1132,7 @@ static void gki_remove_from_pool_list(UINT8 pool_id)
{
tGKI_COM_CB *p_cb = &gki_cb.com;
UINT8 i;
-
+
for(i=0; i < p_cb->curr_total_no_of_pools; i++)
{
if(pool_id == p_cb->pool_list[i])
@@ -1184,7 +1190,7 @@ void *GKI_igetpoolbuf (UINT8 pool_id)
return ((void *) ((UINT8 *)p_hdr + BUFFER_HDR_SIZE));
}
- return (NULL);
+ return (NULL);
}
/*******************************************************************************
@@ -1393,13 +1399,13 @@ void GKI_delete_pool (UINT8 pool_id)
{
FREE_QUEUE_T *Q;
tGKI_COM_CB *p_cb = &gki_cb.com;
-
+
if ((pool_id >= GKI_NUM_TOTAL_BUF_POOLS) || (!p_cb->pool_start[pool_id]))
return;
-
+
GKI_disable();
Q = &p_cb->freeq[pool_id];
-
+
if (!Q->cur_cnt)
{
Q->size = 0;
@@ -1408,21 +1414,21 @@ void GKI_delete_pool (UINT8 pool_id)
Q->max_cnt = 0;
Q->p_first = NULL;
Q->p_last = NULL;
-
+
GKI_os_free (p_cb->pool_start[pool_id]);
-
+
p_cb->pool_start[pool_id] = NULL;
p_cb->pool_end[pool_id] = NULL;
p_cb->pool_size[pool_id] = 0;
-
+
gki_remove_from_pool_list(pool_id);
p_cb->curr_total_no_of_pools--;
}
else
GKI_exception(GKI_ERROR_DELETE_POOL_BAD_QID, "Deleting bad pool");
-
+
GKI_enable();
-
+
return;
}
diff --git a/gki/common/gki_common.h b/gki/common/gki_common.h
index 6093abf..9bc5005 100644
--- a/gki/common/gki_common.h
+++ b/gki/common/gki_common.h
@@ -1,14 +1,20 @@
-/****************************************************************************
-**
-** Name gki_common.h
-**
-** Function This file contains GKI private definitions
-**
-**
-** Copyright (c) 1999-2006, Broadcom Corp., All Rights Reserved.
-** Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 1999-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
#ifndef GKI_COMMON_H
#define GKI_COMMON_H
@@ -326,7 +332,7 @@ typedef struct
#if (GKI_DEBUG == TRUE)
UINT16 ExceptionCnt; /* number of GKI exceptions that have happened */
- EXCEPTION_T Exception[GKI_MAX_EXCEPTION];
+ EXCEPTION_T Exception[GKI_MAX_EXCEPTION];
#endif
} tGKI_COM_CB;
diff --git a/gki/common/gki_debug.c b/gki/common/gki_debug.c
index 45b281a..46d7e38 100644
--- a/gki/common/gki_debug.c
+++ b/gki/common/gki_debug.c
@@ -1,14 +1,20 @@
-/****************************************************************************
-**
-** Name gki_debug.c
-**
-** Function this file contains some sample GKI debug aid functions
-**
-**
-** Copyright (c) 1999-2004, WIDCOMM Inc., All Rights Reserved.
-** Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 1999-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
#include "gki_int.h"
@@ -94,7 +100,7 @@ void GKI_PrintBuffer(void)
** Function gki_calc_stack
**
** Description This function tries to calculate the amount of
-** stack used by looking non magic num. Magic num is consider
+** stack used by looking non magic num. Magic num is consider
** the first byte in the stack.
**
** Returns the number of unused byte on the stack. 4 in case of stack overrun
@@ -146,7 +152,7 @@ void GKI_print_task(void)
}
}
-#endif
+#endif
}
@@ -288,7 +294,7 @@ void gki_print_exception(FP_PRINT print)
{
pExp = &gki_cb.com.Exception[i];
print("%d: Type=%d, Task=%d: %s\n", i,
- (INT32)pExp->type, (INT32)pExp->taskid, (INT8 *)pExp->msg);
+ (INT32)pExp->type, (INT32)pExp->taskid, (INT8 *)pExp->msg);
}
}
diff --git a/gki/common/gki_inet.h b/gki/common/gki_inet.h
index 780e9a0..6640931 100644
--- a/gki/common/gki_inet.h
+++ b/gki/common/gki_inet.h
@@ -1,15 +1,20 @@
-/****************************************************************************
-**
-** Name gki_inet.h
-**
-** Function This file contains macros and interfaces for host-to-network
-** conversions used in Internet operations.
-**
-**
-** Copyright (c) 2002-2004, WIDCOMM Inc., All Rights Reserved.
-** Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2002-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
#ifndef GKI_INET_H
#define GKI_INET_H
diff --git a/gki/common/gki_time.c b/gki/common/gki_time.c
index 8121654..a9af8fa 100644
--- a/gki/common/gki_time.c
+++ b/gki/common/gki_time.c
@@ -1,14 +1,21 @@
+/******************************************************************************
+ *
+ * Copyright (C) 1999-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
-/****************************************************************************
-**
-** Name GKI_time.c
-**
-** Function this file contains GKI time related functions
-**
-** Copyright (c) 1999-2011, Broadcom Corp., All Rights Reserved.
-** Proprietary and confidential.
-**
-*****************************************************************************/
#include "gki_int.h"
@@ -50,22 +57,22 @@ void gki_timers_init(void)
{
gki_cb.com.OSWaitTmr [tt] = 0;
-#if (GKI_NUM_TIMERS > 0)
+#if (GKI_NUM_TIMERS > 0)
gki_cb.com.OSTaskTmr0 [tt] = 0;
gki_cb.com.OSTaskTmr0R [tt] = 0;
#endif
-#if (GKI_NUM_TIMERS > 1)
+#if (GKI_NUM_TIMERS > 1)
gki_cb.com.OSTaskTmr1 [tt] = 0;
gki_cb.com.OSTaskTmr1R [tt] = 0;
#endif
-#if (GKI_NUM_TIMERS > 2)
+#if (GKI_NUM_TIMERS > 2)
gki_cb.com.OSTaskTmr2 [tt] = 0;
gki_cb.com.OSTaskTmr2R [tt] = 0;
#endif
-#if (GKI_NUM_TIMERS > 3)
+#if (GKI_NUM_TIMERS > 3)
gki_cb.com.OSTaskTmr3 [tt] = 0;
gki_cb.com.OSTaskTmr3R [tt] = 0;
#endif
@@ -87,7 +94,7 @@ void gki_timers_init(void)
** Function gki_timers_is_timer_running
**
** Description This internal function is called to test if any gki timer are running
-**
+**
**
** Returns TRUE if at least one time is running in the system, FALSE else.
**
@@ -98,28 +105,28 @@ BOOLEAN gki_timers_is_timer_running(void)
for (tt = 0; tt < GKI_MAX_TASKS; tt++)
{
-#if (GKI_NUM_TIMERS > 0)
+#if (GKI_NUM_TIMERS > 0)
if(gki_cb.com.OSTaskTmr0 [tt])
{
return TRUE;
}
#endif
-#if (GKI_NUM_TIMERS > 1)
+#if (GKI_NUM_TIMERS > 1)
if(gki_cb.com.OSTaskTmr1 [tt] )
{
return TRUE;
}
#endif
-#if (GKI_NUM_TIMERS > 2)
+#if (GKI_NUM_TIMERS > 2)
if(gki_cb.com.OSTaskTmr2 [tt] )
{
return TRUE;
}
#endif
-#if (GKI_NUM_TIMERS > 3)
+#if (GKI_NUM_TIMERS > 3)
if(gki_cb.com.OSTaskTmr3 [tt] )
{
return TRUE;
@@ -150,7 +157,7 @@ UINT32 GKI_get_tick_count(void)
**
** Function GKI_ready_to_sleep
**
-** Description This function returns the number of system ticks until the
+** Description This function returns the number of system ticks until the
** next timer will expire. It is typically called by a power
** savings manager to find out how long it can have the system
** sleep before it needs to service the next entry.
@@ -335,9 +342,9 @@ void GKI_stop_timer (UINT8 tnum)
}
GKI_disable();
-
+
if (gki_timers_is_timer_running() == FALSE)
- {
+ {
if (gki_cb.com.p_tick_cb)
{
#if (defined(GKI_DELAY_STOP_SYS_TICK) && (GKI_DELAY_STOP_SYS_TICK > 0))
@@ -417,7 +424,7 @@ void GKI_timer_update (INT32 ticks_since_last_update)
gki_cb.com.OSTicksTilStop -= ticks_since_last_update;
}
#endif
-
+
/* No need to update the ticks if no timeout has occurred */
if (gki_cb.com.OSTicksTilExp > 0)
{
@@ -580,10 +587,10 @@ void GKI_timer_update (INT32 ticks_since_last_update)
**
** Function GKI_timer_queue_empty
**
-** Description This function is called by applications to see whether the timer
+** Description This function is called by applications to see whether the timer
** queue is empty
**
-** Parameters
+** Parameters
**
** Returns BOOLEAN
**
@@ -591,7 +598,7 @@ void GKI_timer_update (INT32 ticks_since_last_update)
BOOLEAN GKI_timer_queue_empty (void)
{
UINT8 tt;
-
+
for (tt = 0; tt < GKI_MAX_TIMER_QUEUES; tt++)
{
if (gki_cb.com.timer_queues[tt])
@@ -606,8 +613,8 @@ BOOLEAN GKI_timer_queue_empty (void)
** Function GKI_timer_queue_register_callback
**
** Description This function is called by applications to register system tick
-** start/stop callback for time queues
-**
+** start/stop callback for time queues
+**
**
** Parameters p_callback - (input) pointer to the system tick callback
**
@@ -617,7 +624,7 @@ BOOLEAN GKI_timer_queue_empty (void)
void GKI_timer_queue_register_callback (SYSTEM_TICK_CBACK *p_callback)
{
gki_cb.com.p_tick_cb = p_callback;
-
+
return;
}
@@ -727,7 +734,7 @@ UINT16 GKI_update_timer_list (TIMER_LIST_Q *p_timer_listq, INT32 num_units_since
p_timer_listq->last_ticks -= num_units_since_last_update;
/* If the last timer has expired set last_ticks to 0 so that other list update
- * functions will calculate correctly
+ * functions will calculate correctly
*/
if (p_timer_listq->last_ticks < 0)
p_timer_listq->last_ticks = 0;
@@ -740,7 +747,7 @@ UINT16 GKI_update_timer_list (TIMER_LIST_Q *p_timer_listq, INT32 num_units_since
**
** Function GKI_get_remaining_ticks
**
-** Description This function is called by an application to get remaining
+** Description This function is called by an application to get remaining
** ticks to expire
**
** Parameters p_timer_listq - (input) pointer to the timer list queue object
@@ -806,7 +813,7 @@ void GKI_add_to_timer_list (TIMER_LIST_Q *p_timer_listq, TIMER_LIST_ENT *p_tle)
UINT32 nr_ticks_total;
UINT8 tt;
TIMER_LIST_ENT *p_temp;
-
+
/* Only process valid tick values */
if (p_tle->ticks >= 0)
{
@@ -821,15 +828,15 @@ void GKI_add_to_timer_list (TIMER_LIST_Q *p_timer_listq, TIMER_LIST_ENT *p_tle)
/* Insert the entry onto the end of the list */
if (p_timer_listq->p_last != NULL)
p_timer_listq->p_last->p_next = p_tle;
-
+
p_tle->p_prev = p_timer_listq->p_last;
}
-
+
p_tle->p_next = NULL;
p_timer_listq->p_last = p_tle;
nr_ticks_total = p_tle->ticks;
p_tle->ticks -= p_timer_listq->last_ticks;
-
+
p_timer_listq->last_ticks = nr_ticks_total;
}
else /* This entry needs to be inserted before the last entry */
@@ -844,7 +851,7 @@ void GKI_add_to_timer_list (TIMER_LIST_Q *p_timer_listq, TIMER_LIST_ENT *p_tle)
p_temp = p_temp->p_next;
}
-
+
/* The new entry is the first in the list */
if (p_temp == p_timer_listq->p_first)
{
@@ -876,7 +883,7 @@ void GKI_add_to_timer_list (TIMER_LIST_Q *p_timer_listq, TIMER_LIST_ENT *p_tle)
if (gki_cb.com.timer_queues[tt] == NULL)
break;
}
- if (tt < GKI_MAX_TIMER_QUEUES)
+ if (tt < GKI_MAX_TIMER_QUEUES)
{
gki_cb.com.timer_queues[tt] = p_timer_listq;
}
@@ -1006,7 +1013,7 @@ void gki_adjust_timer_count (INT32 ticks)
{
/* See if the new timer expires before the current first expiration */
if (gki_cb.com.OSNumOrigTicks == 0 || (ticks < gki_cb.com.OSTicksTilExp && gki_cb.com.OSTicksTilExp > 0))
- {
+ {
gki_cb.com.OSNumOrigTicks = (gki_cb.com.OSNumOrigTicks - gki_cb.com.OSTicksTilExp) + ticks;
gki_cb.com.OSTicksTilExp = ticks;
}
diff --git a/gki/ulinux/data_types.h b/gki/ulinux/data_types.h
index c433b1a..8cd086a 100644
--- a/gki/ulinux/data_types.h
+++ b/gki/ulinux/data_types.h
@@ -1,20 +1,20 @@
-/****************************************************************************
-**
-** Name data_types.h
-** $Header: /Bluetooth/gki/data_types.h 7 9/13/00 11:01a Jjose $
-**
-** Function this file contains common data type definitions used
-** throughout the Widcomm Bluetooth code
-**
-** Date Modification
-** -----------------------
-** 3/12/99 Create
-** 07/27/00 Added nettohs macro for Little Endian
-**
-** Copyright (c) 1999- 2002, Widcomm Inc., All Rights Reserved.
-** Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 1999-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
#ifndef DATA_TYPES_H
#define DATA_TYPES_H
diff --git a/gki/ulinux/gki_int.h b/gki/ulinux/gki_int.h
index 4aaf500..d1cc68c 100644
--- a/gki/ulinux/gki_int.h
+++ b/gki/ulinux/gki_int.h
@@ -1,14 +1,20 @@
-/****************************************************************************
-**
-** Name gki_int.h
-**
-** Function This file contains GKI private definitions
-**
-**
-** Copyright (c) 1999-2010, Widcomm Inc., All Rights Reserved.
-** Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 1999-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
#ifndef GKI_INT_H
#define GKI_INT_H
diff --git a/gki/ulinux/gki_ulinux.c b/gki/ulinux/gki_ulinux.c
index 98e6f84..fabaea1 100644
--- a/gki/ulinux/gki_ulinux.c
+++ b/gki/ulinux/gki_ulinux.c
@@ -2,48 +2,19 @@
*
* Copyright (C) 2009-2012 Broadcom Corporation
*
- * This program is the proprietary software of Broadcom Corporation and/or its
- * licensors, and may only be used, duplicated, modified or distributed
- * pursuant to the terms and conditions of a separate, written license
- * agreement executed between you and Broadcom (an "Authorized License").
- * Except as set forth in an Authorized License, Broadcom grants no license
- * (express or implied), right to use, or waiver of any kind with respect to
- * the Software, and Broadcom expressly reserves all rights in and to the
- * Software and all intellectual property rights therein.
- * IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU HAVE NO RIGHT TO USE THIS
- * SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY NOTIFY BROADCOM AND DISCONTINUE
- * ALL USE OF THE SOFTWARE.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
*
- * Except as expressly set forth in the Authorized License,
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * 1. This program, including its structure, sequence and organization,
- * constitutes the valuable trade secrets of Broadcom, and you shall
- * use all reasonable efforts to protect the confidentiality thereof,
- * and to use this information only in connection with your use of
- * Broadcom integrated circuit products.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
- * 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED
- * "AS IS" AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES,
- * REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY,
- * OR OTHERWISE, WITH RESPECT TO THE SOFTWARE. BROADCOM SPECIFICALLY
- * DISCLAIMS ANY AND ALL IMPLIED WARRANTIES OF TITLE, MERCHANTABILITY,
- * NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES,
- * ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
- * CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING
- * OUT OF USE OR PERFORMANCE OF THE SOFTWARE.
- *
- * 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM
- * OR ITS LICENSORS BE LIABLE FOR
- * (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR EXEMPLARY
- * DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO
- * YOUR USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM
- * HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES; OR
- * (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT ACTUALLY PAID FOR THE
- * SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE
- * LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF
- * ESSENTIAL PURPOSE OF ANY LIMITED REMEDY.
- *
- *****************************************************************************/
+ ******************************************************************************/
/****************************************************************************
**
@@ -791,7 +762,7 @@ void GKI_run (void *p_task_id)
**
** Returns void
**
-** NOTE This function is NOT called by the Widcomm stack and
+** NOTE This function is NOT called by the Broadcom stack and
** profiles. If you want to use it in your own implementation,
** put specific code here.
**
@@ -1015,7 +986,7 @@ UINT8 GKI_send_event (UINT8 task_id, UINT16 event)
**
** Returns GKI_SUCCESS if all OK, else GKI_FAILURE
**
-** NOTE This function is NOT called by the Widcomm stack and
+** NOTE This function is NOT called by the Broadcom stack and
** profiles. If you want to use it in your own implementation,
** put your code here, otherwise you can delete the entire
** body of the function.
@@ -1037,7 +1008,7 @@ UINT8 GKI_isend_event (UINT8 task_id, UINT16 event)
**
** Returns task ID
**
-** NOTE The Widcomm upper stack and profiles may run as a single task.
+** NOTE The Broadcom upper stack and profiles may run as a single task.
** If you only have one GKI task, then you can hard-code this
** function to return a '1'. Otherwise, you should have some
** OS-specific method to determine the current task.
@@ -1257,7 +1228,7 @@ INT8 *GKI_get_time_stamp (INT8 *tbuf)
**
** Returns void
**
-** NOTE This function is NOT called by the Widcomm stack and
+** NOTE This function is NOT called by the Broadcom stack and
** profiles. If your OS has different memory pools, you
** can tell GKI the pool to use by calling this function.
**
@@ -1280,7 +1251,7 @@ void GKI_register_mempool (void *p_mem)
**
** Returns the address of the memory allocated, or NULL if failed
**
-** NOTE This function is called by the Widcomm stack when
+** NOTE This function is called by the Broadcom stack when
** dynamic memory allocation is used. (see dyn_mem.h)
**
*******************************************************************************/
@@ -1300,7 +1271,7 @@ void *GKI_os_malloc (UINT32 size)
**
** Returns void
**
-** NOTE This function is NOT called by the Widcomm stack and
+** NOTE This function is NOT called by the Broadcom stack and
** profiles. It is only called from within GKI if dynamic
**
*******************************************************************************/
@@ -1322,7 +1293,7 @@ void GKI_os_free (void *p_mem)
**
** Returns GKI_SUCCESS if all OK, else GKI_FAILURE
**
-** NOTE This function is NOT called by the Widcomm stack and
+** NOTE This function is NOT called by the Broadcom stack and
** profiles. If you want to implement task suspension capability,
** put specific code here.
**
@@ -1348,7 +1319,7 @@ UINT8 GKI_suspend_task (UINT8 task_id)
**
** Returns GKI_SUCCESS if all OK
**
-** NOTE This function is NOT called by the Widcomm stack and
+** NOTE This function is NOT called by the Broadcom stack and
** profiles. If you want to implement task suspension capability,
** put specific code here.
**
@@ -1374,7 +1345,7 @@ UINT8 GKI_resume_task (UINT8 task_id)
**
** Returns void
**
-** NOTE This function is NOT called by the Widcomm stack and
+** NOTE This function is NOT called by the Broadcom stack and
** profiles. If you want to use it in your own implementation,
** put specific code here to kill a task.
**
@@ -1408,7 +1379,7 @@ void GKI_exit_task (UINT8 task_id)
**
** Returns void
**
-** NOTE This function is NOT called by the Widcomm stack and
+** NOTE This function is NOT called by the Broadcom stack and
** profiles. If you want to use it in your own implementation,
** put code here to tell the OS to disable context switching.
**
@@ -1428,7 +1399,7 @@ void GKI_sched_lock(void)
**
** Returns void
**
-** NOTE This function is NOT called by the Widcomm stack and
+** NOTE This function is NOT called by the Broadcom stack and
** profiles. If you want to use it in your own implementation,
** put code here to tell the OS to re-enable context switching.
**