Loading gki/common/gki.h +1 −244 Original line number Diff line number Diff line Loading @@ -19,16 +19,7 @@ #define GKI_H /* Include platform-specific over-rides */ #if (defined(NFC_STANDALONE) && (NFC_STANDALONE == TRUE)) #include "gki_target.h" #else /* For non-nfc_standalone, include Bluetooth definitions */ #include "bt_target.h" #endif #include "bt_types.h" /* Error codes */ Loading Loading @@ -92,229 +83,12 @@ #define GKI_MAX_TIMER_QUEUES 3 #endif /************************************************************************ ** Macro to determine the pool buffer size based on the GKI POOL ID at compile time. ** Pool IDs index from 0 to GKI_NUM_FIXED_BUF_POOLS - 1 */ #if (GKI_NUM_FIXED_BUF_POOLS < 1) #ifndef GKI_POOL_ID_0 #define GKI_POOL_ID_0 0 #endif /* ifndef GKI_POOL_ID_0 */ #ifndef GKI_BUF0_SIZE #define GKI_BUF0_SIZE 0 #endif /* ifndef GKI_BUF0_SIZE */ #endif /* GKI_NUM_FIXED_BUF_POOLS < 1 */ #if (GKI_NUM_FIXED_BUF_POOLS < 2) #ifndef GKI_POOL_ID_1 #define GKI_POOL_ID_1 0 #endif /* ifndef GKI_POOL_ID_1 */ #ifndef GKI_BUF1_SIZE #define GKI_BUF1_SIZE 0 #endif /* ifndef GKI_BUF1_SIZE */ #endif /* GKI_NUM_FIXED_BUF_POOLS < 2 */ #if (GKI_NUM_FIXED_BUF_POOLS < 3) #ifndef GKI_POOL_ID_2 #define GKI_POOL_ID_2 0 #endif /* ifndef GKI_POOL_ID_2 */ #ifndef GKI_BUF2_SIZE #define GKI_BUF2_SIZE 0 #endif /* ifndef GKI_BUF2_SIZE */ #endif /* GKI_NUM_FIXED_BUF_POOLS < 3 */ #if (GKI_NUM_FIXED_BUF_POOLS < 4) #ifndef GKI_POOL_ID_3 #define GKI_POOL_ID_3 0 #endif /* ifndef GKI_POOL_ID_4 */ #ifndef GKI_BUF3_SIZE #define GKI_BUF3_SIZE 0 #endif /* ifndef GKI_BUF3_SIZE */ #endif /* GKI_NUM_FIXED_BUF_POOLS < 4 */ #if (GKI_NUM_FIXED_BUF_POOLS < 5) #ifndef GKI_POOL_ID_4 #define GKI_POOL_ID_4 0 #endif /* ifndef GKI_POOL_ID_4 */ #ifndef GKI_BUF4_SIZE #define GKI_BUF4_SIZE 0 #endif /* ifndef GKI_BUF4_SIZE */ #endif /* GKI_NUM_FIXED_BUF_POOLS < 5 */ #if (GKI_NUM_FIXED_BUF_POOLS < 6) #ifndef GKI_POOL_ID_5 #define GKI_POOL_ID_5 0 #endif /* ifndef GKI_POOL_ID_5 */ #ifndef GKI_BUF5_SIZE #define GKI_BUF5_SIZE 0 #endif /* ifndef GKI_BUF5_SIZE */ #endif /* GKI_NUM_FIXED_BUF_POOLS < 6 */ #if (GKI_NUM_FIXED_BUF_POOLS < 7) #ifndef GKI_POOL_ID_6 #define GKI_POOL_ID_6 0 #endif /* ifndef GKI_POOL_ID_6 */ #ifndef GKI_BUF6_SIZE #define GKI_BUF6_SIZE 0 #endif /* ifndef GKI_BUF6_SIZE */ #endif /* GKI_NUM_FIXED_BUF_POOLS < 7 */ #if (GKI_NUM_FIXED_BUF_POOLS < 8) #ifndef GKI_POOL_ID_7 #define GKI_POOL_ID_7 0 #endif /* ifndef GKI_POOL_ID_7 */ #ifndef GKI_BUF7_SIZE #define GKI_BUF7_SIZE 0 #endif /* ifndef GKI_BUF7_SIZE */ #endif /* GKI_NUM_FIXED_BUF_POOLS < 8 */ #if (GKI_NUM_FIXED_BUF_POOLS < 9) #ifndef GKI_POOL_ID_8 #define GKI_POOL_ID_8 0 #endif /* ifndef GKI_POOL_ID_8 */ #ifndef GKI_BUF8_SIZE #define GKI_BUF8_SIZE 0 #endif /* ifndef GKI_BUF8_SIZE */ #endif /* GKI_NUM_FIXED_BUF_POOLS < 9 */ #if (GKI_NUM_FIXED_BUF_POOLS < 10) #ifndef GKI_POOL_ID_9 #define GKI_POOL_ID_9 0 #endif /* ifndef GKI_POOL_ID_9 */ #ifndef GKI_BUF9_SIZE #define GKI_BUF9_SIZE 0 #endif /* ifndef GKI_BUF9_SIZE */ #endif /* GKI_NUM_FIXED_BUF_POOLS < 10 */ #if (GKI_NUM_FIXED_BUF_POOLS < 11) #ifndef GKI_POOL_ID_10 #define GKI_POOL_ID_10 0 #endif /* ifndef GKI_POOL_ID_10 */ #ifndef GKI_BUF10_SIZE #define GKI_BUF10_SIZE 0 #endif /* ifndef GKI_BUF10_SIZE */ #endif /* GKI_NUM_FIXED_BUF_POOLS < 11 */ #if (GKI_NUM_FIXED_BUF_POOLS < 12) #ifndef GKI_POOL_ID_11 #define GKI_POOL_ID_11 0 #endif /* ifndef GKI_POOL_ID_11 */ #ifndef GKI_BUF11_SIZE #define GKI_BUF11_SIZE 0 #endif /* ifndef GKI_BUF11_SIZE */ #endif /* GKI_NUM_FIXED_BUF_POOLS < 12 */ #if (GKI_NUM_FIXED_BUF_POOLS < 13) #ifndef GKI_POOL_ID_12 #define GKI_POOL_ID_12 0 #endif /* ifndef GKI_POOL_ID_12 */ #ifndef GKI_BUF12_SIZE #define GKI_BUF12_SIZE 0 #endif /* ifndef GKI_BUF12_SIZE */ #endif /* GKI_NUM_FIXED_BUF_POOLS < 13 */ #if (GKI_NUM_FIXED_BUF_POOLS < 14) #ifndef GKI_POOL_ID_13 #define GKI_POOL_ID_13 0 #endif /* ifndef GKI_POOL_ID_13 */ #ifndef GKI_BUF13_SIZE #define GKI_BUF13_SIZE 0 #endif /* ifndef GKI_BUF13_SIZE */ #endif /* GKI_NUM_FIXED_BUF_POOLS < 14 */ #if (GKI_NUM_FIXED_BUF_POOLS < 15) #ifndef GKI_POOL_ID_14 #define GKI_POOL_ID_14 0 #endif /* ifndef GKI_POOL_ID_14 */ #ifndef GKI_BUF14_SIZE #define GKI_BUF14_SIZE 0 #endif /* ifndef GKI_BUF14_SIZE */ #endif /* GKI_NUM_FIXED_BUF_POOLS < 15 */ #if (GKI_NUM_FIXED_BUF_POOLS < 16) #ifndef GKI_POOL_ID_15 #define GKI_POOL_ID_15 0 #endif /* ifndef GKI_POOL_ID_15 */ #ifndef GKI_BUF15_SIZE #define GKI_BUF15_SIZE 0 #endif /* ifndef GKI_BUF15_SIZE */ #endif /* GKI_NUM_FIXED_BUF_POOLS < 16 */ /* Timer list entry callback type */ typedef void (TIMER_CBACK)(void *p_tle); #ifndef TIMER_PARAM_TYPE #ifdef WIN2000 #define TIMER_PARAM_TYPE void * #else #define TIMER_PARAM_TYPE UINT32 #endif #endif /* Define a timer list entry */ typedef struct _tle Loading Loading @@ -348,8 +122,6 @@ typedef struct UINT16 count; } BUFFER_Q; #define GKI_IS_QUEUE_EMPTY(p_q) ((p_q)->count == 0) /* Task constants */ #ifndef TASKPTR Loading Loading @@ -378,17 +150,9 @@ GKI_API extern UINT8 GKI_get_taskid(void); GKI_API extern void GKI_init(void); GKI_API extern void GKI_shutdown(void); GKI_API extern INT8 *GKI_map_taskname(UINT8); GKI_API extern UINT8 GKI_resume_task(UINT8); GKI_API extern void GKI_run(void *); GKI_API extern void GKI_freeze(void); GKI_API extern void GKI_stop(void); GKI_API extern UINT8 GKI_suspend_task(UINT8); GKI_API extern UINT8 GKI_is_task_running(UINT8); /* memory management */ GKI_API extern void GKI_shiftdown (UINT8 *p_mem, UINT32 len, UINT32 shift_amount); GKI_API extern void GKI_shiftup (UINT8 *p_dest, UINT8 *p_src, UINT32 len); /* To send buffers and events between tasks */ Loading @@ -401,10 +165,6 @@ GKI_API extern UINT8 GKI_send_event (UINT8, UINT16); /* To get and release buffers, change owner and get size */ GKI_API extern void GKI_change_buf_owner (void *, UINT8); GKI_API extern UINT8 GKI_create_pool (UINT16, UINT16, UINT8, void *); GKI_API extern void GKI_delete_pool (UINT8); GKI_API extern void *GKI_find_buf_start (void *); GKI_API extern void GKI_freebuf (void *); GKI_API extern void *GKI_getbuf (UINT16); GKI_API extern UINT16 GKI_get_buf_size (void *); Loading @@ -412,8 +172,6 @@ GKI_API extern void *GKI_getpoolbuf (UINT8); GKI_API extern UINT16 GKI_poolcount (UINT8); GKI_API extern UINT16 GKI_poolfreecount (UINT8); GKI_API extern UINT16 GKI_poolutilization (UINT8); GKI_API extern void GKI_register_mempool (void *p_mem); GKI_API extern UINT8 GKI_set_pool_permission(UINT8, UINT8); /* User buffer queue management Loading Loading @@ -489,4 +247,3 @@ GKI_API extern void GKI_print_task(void); #endif gki/common/gki_buffer.c +0 −206 Original line number Diff line number Diff line Loading @@ -1013,81 +1013,6 @@ BOOLEAN GKI_queue_is_empty(BUFFER_Q *p_q) return ((BOOLEAN) (p_q->count == 0)); } /******************************************************************************* ** ** Function GKI_find_buf_start ** ** Description This function is called with an address inside a buffer, ** and returns the start address ofthe buffer. ** ** The buffer should be one allocated from one of GKI's pools. ** ** Parameters: p_user_area - (input) address of anywhere in a GKI buffer. ** ** Returns void * - Address of the beginning of the specified buffer if successful, ** otherwise NULL if unsuccessful ** *******************************************************************************/ void *GKI_find_buf_start (void *p_user_area) { UINT16 xx, size; UINT32 yy; tGKI_COM_CB *p_cb = &gki_cb.com; UINT8 *p_ua = (UINT8 *)p_user_area; for (xx = 0; xx < GKI_NUM_TOTAL_BUF_POOLS; xx++) { if ((p_ua > p_cb->pool_start[xx]) && (p_ua < p_cb->pool_end[xx])) { yy = (UINT32)(p_ua - p_cb->pool_start[xx]); size = p_cb->pool_size[xx]; yy = (yy / size) * size; return ((void *) (p_cb->pool_start[xx] + yy + sizeof(BUFFER_HDR_T)) ); } } /* If here, invalid address - not in one of our buffers */ GKI_exception (GKI_ERROR_BUF_SIZE_ZERO, "GKI_get_buf_start:: bad addr"); return (NULL); } /******************************************************************************* ** ** Function GKI_set_pool_permission ** ** Description This function is called to set or change the permissions for ** the specified pool ID. ** ** Parameters pool_id - (input) pool ID to be set or changed ** permission - (input) GKI_PUBLIC_POOL or GKI_RESTRICTED_POOL ** ** Returns GKI_SUCCESS if successful ** GKI_INVALID_POOL if unsuccessful ** *******************************************************************************/ UINT8 GKI_set_pool_permission(UINT8 pool_id, UINT8 permission) { tGKI_COM_CB *p_cb = &gki_cb.com; if (pool_id < GKI_NUM_TOTAL_BUF_POOLS) { 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 return (GKI_INVALID_POOL); } /******************************************************************************* ** ** Function gki_add_to_pool_list Loading Loading @@ -1241,27 +1166,6 @@ UINT16 GKI_poolfreecount (UINT8 pool_id) return ((UINT16)(Q->total - Q->cur_cnt)); } /******************************************************************************* ** ** Function GKI_change_buf_owner ** ** Description Called to change the task ownership of a buffer. ** ** Parameters: p_buf - (input) pointer to the buffer ** task_id - (input) task id to change ownership to ** ** Returns void ** *******************************************************************************/ void GKI_change_buf_owner (void *p_buf, UINT8 task_id) { BUFFER_HDR_T *p_hdr = (BUFFER_HDR_T *) ((UINT8 *) p_buf - BUFFER_HDR_SIZE); p_hdr->task_id = task_id; return; } #if (defined(GKI_SEND_MSG_FROM_ISR) && GKI_SEND_MSG_FROM_ISR == TRUE) /******************************************************************************* ** Loading Loading @@ -1326,116 +1230,6 @@ void GKI_isend_msg (UINT8 task_id, UINT8 mbox, void *msg) } #endif /******************************************************************************* ** ** Function GKI_create_pool ** ** Description Called by applications to create a buffer pool. ** ** Parameters: size - (input) length (in bytes) of each buffer in the pool ** count - (input) number of buffers to allocate for the pool ** permission - (input) restricted or public access? ** (GKI_PUBLIC_POOL or GKI_RESTRICTED_POOL) ** p_mem_pool - (input) pointer to an OS memory pool, NULL if not provided ** ** Returns the buffer pool ID, which should be used in calls to ** GKI_getpoolbuf(). If a pool could not be created, this ** function returns 0xff. ** *******************************************************************************/ UINT8 GKI_create_pool (UINT16 size, UINT16 count, UINT8 permission, void *p_mem_pool) { UINT8 xx; UINT32 mem_needed; INT32 tempsize = size; tGKI_COM_CB *p_cb = &gki_cb.com; /* First make sure the size of each pool has a valid size with room for the header info */ if (size > MAX_USER_BUF_SIZE) return (GKI_INVALID_POOL); /* First, look for an unused pool */ for (xx = 0; xx < GKI_NUM_TOTAL_BUF_POOLS; xx++) { if (!p_cb->pool_start[xx]) break; } if (xx == GKI_NUM_TOTAL_BUF_POOLS) return (GKI_INVALID_POOL); /* Ensure an even number of longwords */ tempsize = (INT32)ALIGN_POOL(size); mem_needed = (tempsize + BUFFER_PADDING_SIZE) * count; if (!p_mem_pool) p_mem_pool = GKI_os_malloc(mem_needed); if (p_mem_pool) { /* Initialize the new pool */ gki_init_free_queue (xx, size, count, p_mem_pool); gki_add_to_pool_list(xx); (void) GKI_set_pool_permission (xx, permission); p_cb->curr_total_no_of_pools++; return (xx); } else return (GKI_INVALID_POOL); } /******************************************************************************* ** ** Function GKI_delete_pool ** ** Description Called by applications to delete a buffer pool. The function ** calls the operating specific function to free the actual memory. ** An exception is generated if an error is detected. ** ** Parameters: pool_id - (input) Id of the poll being deleted. ** ** Returns void ** *******************************************************************************/ 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; Q->total = 0; Q->cur_cnt = 0; 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; } /******************************************************************************* ** Loading gki/common/gki_common.h +2 −12 Original line number Diff line number Diff line Loading @@ -52,9 +52,6 @@ ** Misc constants *********************************************************************/ #define GKI_MAX_INT32 (0x7fffffffL) #define GKI_MAX_TIMESTAMP (0xffffffffL) /******************************************************************** ** Buffer Management Data Structures *********************************************************************/ Loading Loading @@ -357,13 +354,6 @@ extern void gki_adjust_timer_count (INT32); extern void gki_dealloc_free_queue(void); #endif extern void OSStartRdy(void); extern void OSCtxSw(void); extern void OSIntCtxSw(void); extern void OSSched(void); extern void OSIntEnter(void); extern void OSIntExit(void); /* Debug aids */ Loading gki/common/gki_time.c +2 −3 Original line number Diff line number Diff line Loading @@ -31,7 +31,6 @@ #define GKI_NO_NEW_TMRS_STARTED (0x7fffffffL) /* Largest signed positive timer count */ #define GKI_UNUSED_LIST_ENTRY (0x80000000L) /* Marks an unused timer list entry (initial value) */ #define GKI_MAX_INT32 (0x7fffffffL) #define GKI_ERROR(fmt, ...) ALOGE ("ERROR : %s: " fmt, __FUNCTION__, ## __VA_ARGS__) Loading Loading @@ -247,12 +246,12 @@ void GKI_start_timer (UINT8 tnum, INT32 ticks, BOOLEAN is_continuous) ** Note that this works when no timers are active since ** both OSNumOrigTicks and OSTicksTilExp are 0. */ if (GKI_MAX_INT32 - (gki_cb.com.OSNumOrigTicks - gki_cb.com.OSTicksTilExp) > ticks) if (INT32_MAX - (gki_cb.com.OSNumOrigTicks - gki_cb.com.OSTicksTilExp) > ticks) { ticks += gki_cb.com.OSNumOrigTicks - gki_cb.com.OSTicksTilExp; } else ticks = GKI_MAX_INT32; ticks = INT32_MAX; switch (tnum) { Loading gki/ulinux/data_types.h +0 −8 Original line number Diff line number Diff line Loading @@ -22,10 +22,6 @@ #include <stdint.h> #include <stdbool.h> #ifndef NULL # define NULL (void *)0 #endif #ifndef FALSE # define FALSE false #endif Loading Loading @@ -54,10 +50,6 @@ typedef UINT32 TIME_STAMP; # define INLINE #endif #ifndef BIG_ENDIAN #define BIG_ENDIAN FALSE #endif #define BCM_STRCPY_S(x1,x2,x3) strcpy((x1),(x3)) #define BCM_STRNCPY_S(x1,x2,x3,x4) strncpy((x1),(x3),(x4)) Loading Loading
gki/common/gki.h +1 −244 Original line number Diff line number Diff line Loading @@ -19,16 +19,7 @@ #define GKI_H /* Include platform-specific over-rides */ #if (defined(NFC_STANDALONE) && (NFC_STANDALONE == TRUE)) #include "gki_target.h" #else /* For non-nfc_standalone, include Bluetooth definitions */ #include "bt_target.h" #endif #include "bt_types.h" /* Error codes */ Loading Loading @@ -92,229 +83,12 @@ #define GKI_MAX_TIMER_QUEUES 3 #endif /************************************************************************ ** Macro to determine the pool buffer size based on the GKI POOL ID at compile time. ** Pool IDs index from 0 to GKI_NUM_FIXED_BUF_POOLS - 1 */ #if (GKI_NUM_FIXED_BUF_POOLS < 1) #ifndef GKI_POOL_ID_0 #define GKI_POOL_ID_0 0 #endif /* ifndef GKI_POOL_ID_0 */ #ifndef GKI_BUF0_SIZE #define GKI_BUF0_SIZE 0 #endif /* ifndef GKI_BUF0_SIZE */ #endif /* GKI_NUM_FIXED_BUF_POOLS < 1 */ #if (GKI_NUM_FIXED_BUF_POOLS < 2) #ifndef GKI_POOL_ID_1 #define GKI_POOL_ID_1 0 #endif /* ifndef GKI_POOL_ID_1 */ #ifndef GKI_BUF1_SIZE #define GKI_BUF1_SIZE 0 #endif /* ifndef GKI_BUF1_SIZE */ #endif /* GKI_NUM_FIXED_BUF_POOLS < 2 */ #if (GKI_NUM_FIXED_BUF_POOLS < 3) #ifndef GKI_POOL_ID_2 #define GKI_POOL_ID_2 0 #endif /* ifndef GKI_POOL_ID_2 */ #ifndef GKI_BUF2_SIZE #define GKI_BUF2_SIZE 0 #endif /* ifndef GKI_BUF2_SIZE */ #endif /* GKI_NUM_FIXED_BUF_POOLS < 3 */ #if (GKI_NUM_FIXED_BUF_POOLS < 4) #ifndef GKI_POOL_ID_3 #define GKI_POOL_ID_3 0 #endif /* ifndef GKI_POOL_ID_4 */ #ifndef GKI_BUF3_SIZE #define GKI_BUF3_SIZE 0 #endif /* ifndef GKI_BUF3_SIZE */ #endif /* GKI_NUM_FIXED_BUF_POOLS < 4 */ #if (GKI_NUM_FIXED_BUF_POOLS < 5) #ifndef GKI_POOL_ID_4 #define GKI_POOL_ID_4 0 #endif /* ifndef GKI_POOL_ID_4 */ #ifndef GKI_BUF4_SIZE #define GKI_BUF4_SIZE 0 #endif /* ifndef GKI_BUF4_SIZE */ #endif /* GKI_NUM_FIXED_BUF_POOLS < 5 */ #if (GKI_NUM_FIXED_BUF_POOLS < 6) #ifndef GKI_POOL_ID_5 #define GKI_POOL_ID_5 0 #endif /* ifndef GKI_POOL_ID_5 */ #ifndef GKI_BUF5_SIZE #define GKI_BUF5_SIZE 0 #endif /* ifndef GKI_BUF5_SIZE */ #endif /* GKI_NUM_FIXED_BUF_POOLS < 6 */ #if (GKI_NUM_FIXED_BUF_POOLS < 7) #ifndef GKI_POOL_ID_6 #define GKI_POOL_ID_6 0 #endif /* ifndef GKI_POOL_ID_6 */ #ifndef GKI_BUF6_SIZE #define GKI_BUF6_SIZE 0 #endif /* ifndef GKI_BUF6_SIZE */ #endif /* GKI_NUM_FIXED_BUF_POOLS < 7 */ #if (GKI_NUM_FIXED_BUF_POOLS < 8) #ifndef GKI_POOL_ID_7 #define GKI_POOL_ID_7 0 #endif /* ifndef GKI_POOL_ID_7 */ #ifndef GKI_BUF7_SIZE #define GKI_BUF7_SIZE 0 #endif /* ifndef GKI_BUF7_SIZE */ #endif /* GKI_NUM_FIXED_BUF_POOLS < 8 */ #if (GKI_NUM_FIXED_BUF_POOLS < 9) #ifndef GKI_POOL_ID_8 #define GKI_POOL_ID_8 0 #endif /* ifndef GKI_POOL_ID_8 */ #ifndef GKI_BUF8_SIZE #define GKI_BUF8_SIZE 0 #endif /* ifndef GKI_BUF8_SIZE */ #endif /* GKI_NUM_FIXED_BUF_POOLS < 9 */ #if (GKI_NUM_FIXED_BUF_POOLS < 10) #ifndef GKI_POOL_ID_9 #define GKI_POOL_ID_9 0 #endif /* ifndef GKI_POOL_ID_9 */ #ifndef GKI_BUF9_SIZE #define GKI_BUF9_SIZE 0 #endif /* ifndef GKI_BUF9_SIZE */ #endif /* GKI_NUM_FIXED_BUF_POOLS < 10 */ #if (GKI_NUM_FIXED_BUF_POOLS < 11) #ifndef GKI_POOL_ID_10 #define GKI_POOL_ID_10 0 #endif /* ifndef GKI_POOL_ID_10 */ #ifndef GKI_BUF10_SIZE #define GKI_BUF10_SIZE 0 #endif /* ifndef GKI_BUF10_SIZE */ #endif /* GKI_NUM_FIXED_BUF_POOLS < 11 */ #if (GKI_NUM_FIXED_BUF_POOLS < 12) #ifndef GKI_POOL_ID_11 #define GKI_POOL_ID_11 0 #endif /* ifndef GKI_POOL_ID_11 */ #ifndef GKI_BUF11_SIZE #define GKI_BUF11_SIZE 0 #endif /* ifndef GKI_BUF11_SIZE */ #endif /* GKI_NUM_FIXED_BUF_POOLS < 12 */ #if (GKI_NUM_FIXED_BUF_POOLS < 13) #ifndef GKI_POOL_ID_12 #define GKI_POOL_ID_12 0 #endif /* ifndef GKI_POOL_ID_12 */ #ifndef GKI_BUF12_SIZE #define GKI_BUF12_SIZE 0 #endif /* ifndef GKI_BUF12_SIZE */ #endif /* GKI_NUM_FIXED_BUF_POOLS < 13 */ #if (GKI_NUM_FIXED_BUF_POOLS < 14) #ifndef GKI_POOL_ID_13 #define GKI_POOL_ID_13 0 #endif /* ifndef GKI_POOL_ID_13 */ #ifndef GKI_BUF13_SIZE #define GKI_BUF13_SIZE 0 #endif /* ifndef GKI_BUF13_SIZE */ #endif /* GKI_NUM_FIXED_BUF_POOLS < 14 */ #if (GKI_NUM_FIXED_BUF_POOLS < 15) #ifndef GKI_POOL_ID_14 #define GKI_POOL_ID_14 0 #endif /* ifndef GKI_POOL_ID_14 */ #ifndef GKI_BUF14_SIZE #define GKI_BUF14_SIZE 0 #endif /* ifndef GKI_BUF14_SIZE */ #endif /* GKI_NUM_FIXED_BUF_POOLS < 15 */ #if (GKI_NUM_FIXED_BUF_POOLS < 16) #ifndef GKI_POOL_ID_15 #define GKI_POOL_ID_15 0 #endif /* ifndef GKI_POOL_ID_15 */ #ifndef GKI_BUF15_SIZE #define GKI_BUF15_SIZE 0 #endif /* ifndef GKI_BUF15_SIZE */ #endif /* GKI_NUM_FIXED_BUF_POOLS < 16 */ /* Timer list entry callback type */ typedef void (TIMER_CBACK)(void *p_tle); #ifndef TIMER_PARAM_TYPE #ifdef WIN2000 #define TIMER_PARAM_TYPE void * #else #define TIMER_PARAM_TYPE UINT32 #endif #endif /* Define a timer list entry */ typedef struct _tle Loading Loading @@ -348,8 +122,6 @@ typedef struct UINT16 count; } BUFFER_Q; #define GKI_IS_QUEUE_EMPTY(p_q) ((p_q)->count == 0) /* Task constants */ #ifndef TASKPTR Loading Loading @@ -378,17 +150,9 @@ GKI_API extern UINT8 GKI_get_taskid(void); GKI_API extern void GKI_init(void); GKI_API extern void GKI_shutdown(void); GKI_API extern INT8 *GKI_map_taskname(UINT8); GKI_API extern UINT8 GKI_resume_task(UINT8); GKI_API extern void GKI_run(void *); GKI_API extern void GKI_freeze(void); GKI_API extern void GKI_stop(void); GKI_API extern UINT8 GKI_suspend_task(UINT8); GKI_API extern UINT8 GKI_is_task_running(UINT8); /* memory management */ GKI_API extern void GKI_shiftdown (UINT8 *p_mem, UINT32 len, UINT32 shift_amount); GKI_API extern void GKI_shiftup (UINT8 *p_dest, UINT8 *p_src, UINT32 len); /* To send buffers and events between tasks */ Loading @@ -401,10 +165,6 @@ GKI_API extern UINT8 GKI_send_event (UINT8, UINT16); /* To get and release buffers, change owner and get size */ GKI_API extern void GKI_change_buf_owner (void *, UINT8); GKI_API extern UINT8 GKI_create_pool (UINT16, UINT16, UINT8, void *); GKI_API extern void GKI_delete_pool (UINT8); GKI_API extern void *GKI_find_buf_start (void *); GKI_API extern void GKI_freebuf (void *); GKI_API extern void *GKI_getbuf (UINT16); GKI_API extern UINT16 GKI_get_buf_size (void *); Loading @@ -412,8 +172,6 @@ GKI_API extern void *GKI_getpoolbuf (UINT8); GKI_API extern UINT16 GKI_poolcount (UINT8); GKI_API extern UINT16 GKI_poolfreecount (UINT8); GKI_API extern UINT16 GKI_poolutilization (UINT8); GKI_API extern void GKI_register_mempool (void *p_mem); GKI_API extern UINT8 GKI_set_pool_permission(UINT8, UINT8); /* User buffer queue management Loading Loading @@ -489,4 +247,3 @@ GKI_API extern void GKI_print_task(void); #endif
gki/common/gki_buffer.c +0 −206 Original line number Diff line number Diff line Loading @@ -1013,81 +1013,6 @@ BOOLEAN GKI_queue_is_empty(BUFFER_Q *p_q) return ((BOOLEAN) (p_q->count == 0)); } /******************************************************************************* ** ** Function GKI_find_buf_start ** ** Description This function is called with an address inside a buffer, ** and returns the start address ofthe buffer. ** ** The buffer should be one allocated from one of GKI's pools. ** ** Parameters: p_user_area - (input) address of anywhere in a GKI buffer. ** ** Returns void * - Address of the beginning of the specified buffer if successful, ** otherwise NULL if unsuccessful ** *******************************************************************************/ void *GKI_find_buf_start (void *p_user_area) { UINT16 xx, size; UINT32 yy; tGKI_COM_CB *p_cb = &gki_cb.com; UINT8 *p_ua = (UINT8 *)p_user_area; for (xx = 0; xx < GKI_NUM_TOTAL_BUF_POOLS; xx++) { if ((p_ua > p_cb->pool_start[xx]) && (p_ua < p_cb->pool_end[xx])) { yy = (UINT32)(p_ua - p_cb->pool_start[xx]); size = p_cb->pool_size[xx]; yy = (yy / size) * size; return ((void *) (p_cb->pool_start[xx] + yy + sizeof(BUFFER_HDR_T)) ); } } /* If here, invalid address - not in one of our buffers */ GKI_exception (GKI_ERROR_BUF_SIZE_ZERO, "GKI_get_buf_start:: bad addr"); return (NULL); } /******************************************************************************* ** ** Function GKI_set_pool_permission ** ** Description This function is called to set or change the permissions for ** the specified pool ID. ** ** Parameters pool_id - (input) pool ID to be set or changed ** permission - (input) GKI_PUBLIC_POOL or GKI_RESTRICTED_POOL ** ** Returns GKI_SUCCESS if successful ** GKI_INVALID_POOL if unsuccessful ** *******************************************************************************/ UINT8 GKI_set_pool_permission(UINT8 pool_id, UINT8 permission) { tGKI_COM_CB *p_cb = &gki_cb.com; if (pool_id < GKI_NUM_TOTAL_BUF_POOLS) { 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 return (GKI_INVALID_POOL); } /******************************************************************************* ** ** Function gki_add_to_pool_list Loading Loading @@ -1241,27 +1166,6 @@ UINT16 GKI_poolfreecount (UINT8 pool_id) return ((UINT16)(Q->total - Q->cur_cnt)); } /******************************************************************************* ** ** Function GKI_change_buf_owner ** ** Description Called to change the task ownership of a buffer. ** ** Parameters: p_buf - (input) pointer to the buffer ** task_id - (input) task id to change ownership to ** ** Returns void ** *******************************************************************************/ void GKI_change_buf_owner (void *p_buf, UINT8 task_id) { BUFFER_HDR_T *p_hdr = (BUFFER_HDR_T *) ((UINT8 *) p_buf - BUFFER_HDR_SIZE); p_hdr->task_id = task_id; return; } #if (defined(GKI_SEND_MSG_FROM_ISR) && GKI_SEND_MSG_FROM_ISR == TRUE) /******************************************************************************* ** Loading Loading @@ -1326,116 +1230,6 @@ void GKI_isend_msg (UINT8 task_id, UINT8 mbox, void *msg) } #endif /******************************************************************************* ** ** Function GKI_create_pool ** ** Description Called by applications to create a buffer pool. ** ** Parameters: size - (input) length (in bytes) of each buffer in the pool ** count - (input) number of buffers to allocate for the pool ** permission - (input) restricted or public access? ** (GKI_PUBLIC_POOL or GKI_RESTRICTED_POOL) ** p_mem_pool - (input) pointer to an OS memory pool, NULL if not provided ** ** Returns the buffer pool ID, which should be used in calls to ** GKI_getpoolbuf(). If a pool could not be created, this ** function returns 0xff. ** *******************************************************************************/ UINT8 GKI_create_pool (UINT16 size, UINT16 count, UINT8 permission, void *p_mem_pool) { UINT8 xx; UINT32 mem_needed; INT32 tempsize = size; tGKI_COM_CB *p_cb = &gki_cb.com; /* First make sure the size of each pool has a valid size with room for the header info */ if (size > MAX_USER_BUF_SIZE) return (GKI_INVALID_POOL); /* First, look for an unused pool */ for (xx = 0; xx < GKI_NUM_TOTAL_BUF_POOLS; xx++) { if (!p_cb->pool_start[xx]) break; } if (xx == GKI_NUM_TOTAL_BUF_POOLS) return (GKI_INVALID_POOL); /* Ensure an even number of longwords */ tempsize = (INT32)ALIGN_POOL(size); mem_needed = (tempsize + BUFFER_PADDING_SIZE) * count; if (!p_mem_pool) p_mem_pool = GKI_os_malloc(mem_needed); if (p_mem_pool) { /* Initialize the new pool */ gki_init_free_queue (xx, size, count, p_mem_pool); gki_add_to_pool_list(xx); (void) GKI_set_pool_permission (xx, permission); p_cb->curr_total_no_of_pools++; return (xx); } else return (GKI_INVALID_POOL); } /******************************************************************************* ** ** Function GKI_delete_pool ** ** Description Called by applications to delete a buffer pool. The function ** calls the operating specific function to free the actual memory. ** An exception is generated if an error is detected. ** ** Parameters: pool_id - (input) Id of the poll being deleted. ** ** Returns void ** *******************************************************************************/ 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; Q->total = 0; Q->cur_cnt = 0; 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; } /******************************************************************************* ** Loading
gki/common/gki_common.h +2 −12 Original line number Diff line number Diff line Loading @@ -52,9 +52,6 @@ ** Misc constants *********************************************************************/ #define GKI_MAX_INT32 (0x7fffffffL) #define GKI_MAX_TIMESTAMP (0xffffffffL) /******************************************************************** ** Buffer Management Data Structures *********************************************************************/ Loading Loading @@ -357,13 +354,6 @@ extern void gki_adjust_timer_count (INT32); extern void gki_dealloc_free_queue(void); #endif extern void OSStartRdy(void); extern void OSCtxSw(void); extern void OSIntCtxSw(void); extern void OSSched(void); extern void OSIntEnter(void); extern void OSIntExit(void); /* Debug aids */ Loading
gki/common/gki_time.c +2 −3 Original line number Diff line number Diff line Loading @@ -31,7 +31,6 @@ #define GKI_NO_NEW_TMRS_STARTED (0x7fffffffL) /* Largest signed positive timer count */ #define GKI_UNUSED_LIST_ENTRY (0x80000000L) /* Marks an unused timer list entry (initial value) */ #define GKI_MAX_INT32 (0x7fffffffL) #define GKI_ERROR(fmt, ...) ALOGE ("ERROR : %s: " fmt, __FUNCTION__, ## __VA_ARGS__) Loading Loading @@ -247,12 +246,12 @@ void GKI_start_timer (UINT8 tnum, INT32 ticks, BOOLEAN is_continuous) ** Note that this works when no timers are active since ** both OSNumOrigTicks and OSTicksTilExp are 0. */ if (GKI_MAX_INT32 - (gki_cb.com.OSNumOrigTicks - gki_cb.com.OSTicksTilExp) > ticks) if (INT32_MAX - (gki_cb.com.OSNumOrigTicks - gki_cb.com.OSTicksTilExp) > ticks) { ticks += gki_cb.com.OSNumOrigTicks - gki_cb.com.OSTicksTilExp; } else ticks = GKI_MAX_INT32; ticks = INT32_MAX; switch (tnum) { Loading
gki/ulinux/data_types.h +0 −8 Original line number Diff line number Diff line Loading @@ -22,10 +22,6 @@ #include <stdint.h> #include <stdbool.h> #ifndef NULL # define NULL (void *)0 #endif #ifndef FALSE # define FALSE false #endif Loading Loading @@ -54,10 +50,6 @@ typedef UINT32 TIME_STAMP; # define INLINE #endif #ifndef BIG_ENDIAN #define BIG_ENDIAN FALSE #endif #define BCM_STRCPY_S(x1,x2,x3) strcpy((x1),(x3)) #define BCM_STRNCPY_S(x1,x2,x3,x4) strncpy((x1),(x3),(x4)) Loading