FreeCalypso > hg > fc-magnetite
comparison src/g23m-fad/tcpip/include/rv_general.h @ 174:90eb61ecd093
src/g23m-fad: initial import from TCS3.2/LoCosto
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Wed, 12 Oct 2016 05:40:46 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 173:bf64d785238a | 174:90eb61ecd093 |
|---|---|
| 1 /** | |
| 2 * @file rv_general.h | |
| 3 * | |
| 4 * Definitions that are shared between S/W entities | |
| 5 * in the Riviera Environment. | |
| 6 * | |
| 7 * @author David Lamy-Charrier (d-lamy@ti.com) | |
| 8 * @version 0.1 | |
| 9 */ | |
| 10 | |
| 11 /* | |
| 12 * Revision History: | |
| 13 * | |
| 14 * Date Author Modification | |
| 15 * ------------------------------------------------------------------- | |
| 16 * 03/12/1999 Create. | |
| 17 * 12/03/1999 Christian Livadiotti Replaced: | |
| 18 * #define ARRAY_TO_STREAM(p, a, l) {register int i; for | |
| 19 * (i = 0; i < l; i++) *p++ = (UINT8) a[i];} | |
| 20 * by the following to change convention of array writing. | |
| 21 * 12/08/1999 Pascal Pompei Add STREAM_TO_ARRAY | |
| 22 * 11/20/2001 Vincent Oberle - Changed T_RV_RETURN to T_RV_RETURN_PATH | |
| 23 * Keep compatibility with a define | |
| 24 * - Documentation cleaning | |
| 25 * 06/03/2002 Vincent Oberle Added __RV_CRITICAL | |
| 26 * | |
| 27 * (C) Copyright 2002 by Texas Instruments Incorporated, All Rights Reserved | |
| 28 */ | |
| 29 #ifndef _RV_GENERAL_H_ | |
| 30 #define _RV_GENERAL_H_ | |
| 31 | |
| 32 #include "general.h" | |
| 33 #include "rv_trace.h" | |
| 34 | |
| 35 /** | |
| 36 * Task IDentifiers: A-M-E-N-D-E-D! | |
| 37 * 0: Reserved for RVM, | |
| 38 * RVTEST_MENU_TASK_ID: 'Test Selection Menu', | |
| 39 * DUMMY_TASK_ID: 'Dummy' task. | |
| 40 * MAX - 1: Trace task (refer to rvf_target.h). | |
| 41 */ | |
| 42 #define RVTEST_MENU_TASK_ID (0x0A) | |
| 43 #define DUMMY_TASK_ID (0x0B) | |
| 44 | |
| 45 /** | |
| 46 * Returned parameter values. [Perhaps, a memory level WARNING could be added] */ | |
| 47 typedef enum { | |
| 48 RV_OK = 0, | |
| 49 RV_NOT_SUPPORTED = -2, | |
| 50 RV_NOT_READY = -3, | |
| 51 RV_MEMORY_WARNING = -4, | |
| 52 RV_MEMORY_ERR = -5, | |
| 53 RV_MEMORY_REMAINING = -6, | |
| 54 RV_INTERNAL_ERR = -9, | |
| 55 RV_INVALID_PARAMETER = -10, | |
| 56 RV_NOT_INITIALISED = -51 | |
| 57 } T_RV_RET; | |
| 58 | |
| 59 /** | |
| 60 * Unique ADDRess IDentifier of any SWE. (T_RVF_ADDR_ID is deprecated) | |
| 61 */ | |
| 62 typedef UINT8 T_RVF_G_ADDR_ID; | |
| 63 #define T_RVF_ADDR_ID T_RVF_G_ADDR_ID | |
| 64 | |
| 65 /** | |
| 66 * Return path type. | |
| 67 * | |
| 68 * T_RV_RETURN_PATH is the new name for the return path type. | |
| 69 * It is introduced to avoid the confusion with the return value | |
| 70 * type. Use this one. | |
| 71 */ | |
| 72 typedef struct | |
| 73 { | |
| 74 T_RVF_ADDR_ID addr_id; | |
| 75 void (*callback_func)(void *); | |
| 76 } T_RV_RETURN_PATH; | |
| 77 | |
| 78 // Deprecated. For backward compatibility only. | |
| 79 #define T_RV_RETURN T_RV_RETURN_PATH | |
| 80 | |
| 81 /** | |
| 82 * Mark used to indicate that a function should be loadable. | |
| 83 * For instance: | |
| 84 * char __RV_CRITICAL xxx_do_something (char toto, int bill) { | |
| 85 * .. | |
| 86 */ | |
| 87 #ifndef __RV_CRITICAL | |
| 88 #define __RV_CRITICAL | |
| 89 #endif | |
| 90 | |
| 91 /** | |
| 92 * Generic header of messages used in Riviera. | |
| 93 */ | |
| 94 typedef struct { | |
| 95 UINT32 msg_id; | |
| 96 void (*callback_func)(void *); | |
| 97 T_RVF_ADDR_ID src_addr_id; | |
| 98 T_RVF_ADDR_ID dest_addr_id; | |
| 99 } T_RV_HDR; | |
| 100 | |
| 101 #define RV_HDR_SIZE (sizeof (T_RV_HDR)) | |
| 102 | |
| 103 /** | |
| 104 * Macros to get and put bytes to and from a stream (Little Endian format). | |
| 105 */ | |
| 106 #define UINT32_TO_STREAM(p, u32) {*(p)++ = (UINT8)(u32); *(p)++ = (UINT8)((u32) >> 8); *(p)++ = (UINT8)((u32) >> 16); *(p)++ = (UINT8)((u32) >> 24);} | |
| 107 #define UINT24_TO_STREAM(p, u24) {*(p)++ = (UINT8)(u24); *(p)++ = (UINT8)((u24) >> 8); *(p)++ = (UINT8)((u24) >> 16);} | |
| 108 #define UINT16_TO_STREAM(p, u16) {*(p)++ = (UINT8)(u16); *(p)++ = (UINT8)((u16) >> 8);} | |
| 109 #define UINT8_TO_STREAM(p, u8) {*(p)++ = (UINT8)(u8);} | |
| 110 | |
| 111 #define ARRAY_TO_STREAM(p, a, l) {register INT32 i; for (i = l-1; i >= 0; i--) *(p)++ = (UINT8) a[i];} | |
| 112 | |
| 113 #define STREAM_TO_UINT8(u8, p) {u8 = *(p); (p) += 1;} | |
| 114 #define STREAM_TO_UINT16(u16, p) {u16 = (UINT16)(*(p) + (*((p) + 1) << 8)); (p) += 2;} | |
| 115 #define STREAM_TO_UINT32(u32, p) {u32 = (UINT32)(*(p) + (*((p) + 1) << 8) + (*((p) + 2) << 16) + (*((p) + 3) << 24)); (p) += 4;} | |
| 116 | |
| 117 #define STREAM_TO_ARRAY(a, p, l) {register INT32 i; for (i = l-1; i >= 0; i--) a[i] = *(UINT8*)(p)++ ;} | |
| 118 | |
| 119 /** | |
| 120 * Macros to get and put bytes to and from a stream (Big Endian format). | |
| 121 */ | |
| 122 #define UINT32_TO_BE_STREAM(p, u32) {*(p)++ = (UINT8)((u32) >> 24); *(p)++ = (UINT8)((u32) >> 16); *(p)++ = (UINT8)((u32) >> 8); *(p)++ = (UINT8)(u32); } | |
| 123 #define UINT24_TO_BE_STREAM(p, u24) {*(p)++ = (UINT8)((u24) >> 16); *(p)++ = (UINT8)((u24) >> 8); *(p)++ = (UINT8)(u24);} | |
| 124 #define UINT16_TO_BE_STREAM(p, u16) {*(p)++ = (UINT8)((u16) >> 8); *(p)++ = (UINT8)(u16);} | |
| 125 #define UINT8_TO_BE_STREAM(p, u8) {*(p)++ = (UINT8)(u8);} | |
| 126 | |
| 127 #define ARRAY_TO_BE_STREAM(p, a, l) {register INT32 i; for (i = 0; i < l; i++) *(p)++ = (UINT8) a[i];} | |
| 128 | |
| 129 #define BE_STREAM_TO_UINT8(u8, p) {u8 = (UINT8)(*(p)); (p) += 1;} | |
| 130 #define BE_STREAM_TO_UINT16(u16, p) {u16 = (UINT16)(((*(p)) << 8) + (*((p) + 1))); (p) += 2;} | |
| 131 #define BE_STREAM_TO_UINT32(u32, p) {u32 = (UINT32)((*((p) + 3)) + ((*((p) + 2)) << 8) + ((*((p) + 1)) << 16) + ((*(p)) << 24)); (p) += 4;} | |
| 132 #define BE_STREAM_TO_ARRAY(a, p, l) {register INT32 i; for (i = 0; i < l; i++) a[i] = *(UINT8*)(p)++;} | |
| 133 | |
| 134 /** | |
| 135 * Macros to get minimum and maximum between 2 numbers. | |
| 136 */ | |
| 137 #define Min(a,b) ((a)<(b)?(a):(b)) | |
| 138 #define Max(a,b) ((a)<(b)?(b):(a)) | |
| 139 | |
| 140 /** | |
| 141 * Macro to get minimum between 3 numbers. | |
| 142 */ | |
| 143 #define Min3(a,b,c) (Min(Min(a,b),c)) | |
| 144 | |
| 145 /** | |
| 146 * Common Bluetooth field definitions. | |
| 147 */ | |
| 148 | |
| 149 // Device address. | |
| 150 #define BD_ADDR_LEN (6) | |
| 151 typedef UINT8 T_BD_ADDR[BD_ADDR_LEN]; | |
| 152 | |
| 153 // Link Key. | |
| 154 #define LINK_KEY_LEN (16) | |
| 155 typedef UINT8 T_LINK_KEY[LINK_KEY_LEN]; | |
| 156 | |
| 157 // Pin Code (upto 128 bits) MSB is 0. | |
| 158 #define PIN_CODE_LEN (16) | |
| 159 typedef UINT8 T_PIN_CODE[PIN_CODE_LEN]; | |
| 160 | |
| 161 // Class Of Device. | |
| 162 #define DEV_CLASS_LEN (3) | |
| 163 typedef UINT8 T_DEV_CLASS[DEV_CLASS_LEN]; | |
| 164 | |
| 165 // Device name. | |
| 166 #define BD_NAME_LEN (248) | |
| 167 typedef UINT8 T_BD_NAME[BD_NAME_LEN]; | |
| 168 | |
| 169 // Event Mask. | |
| 170 #define EVENT_MASK_LEN (8) | |
| 171 typedef UINT8 T_EVENT_MASK[EVENT_MASK_LEN]; | |
| 172 | |
| 173 // IAC as passed to Inquiry (LAP). | |
| 174 #define LAP_LEN (3) | |
| 175 typedef UINT8 T_LAP[LAP_LEN]; | |
| 176 typedef UINT8 T_INQ_LAP[LAP_LEN]; | |
| 177 | |
| 178 #define RAND_NUM_LEN (16) | |
| 179 typedef UINT8 T_RAND_NUM[RAND_NUM_LEN]; | |
| 180 | |
| 181 // Authenticated ciphering offset. | |
| 182 #define ACO_LEN (12) | |
| 183 typedef UINT8 T_ACO[ACO_LEN]; | |
| 184 | |
| 185 // Ciphering offset number. | |
| 186 #define COF_LEN (12) | |
| 187 typedef UINT8 T_COF[COF_LEN]; | |
| 188 | |
| 189 // Pointer type used to handle received data that L2CAP set in a chained buffer list. | |
| 190 typedef UINT8 T_RV_BUFFER; | |
| 191 | |
| 192 #endif /* _RV_GENERAL_H_ */ | |
| 193 |
