Ioctl.h 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. #ifndef _IOCTL_H_
  2. #define _IOCTL_H_
  3. typedef struct rdmbuffer
  4. {
  5. ULONG Register;
  6. ULONG Length;
  7. }__attribute__((packed)) RDM_BUFFER, *PRDM_BUFFER;
  8. typedef struct wrmbuffer
  9. {
  10. ULONG Register;
  11. ULONG Length;
  12. UCHAR Data[4];
  13. }__attribute__((packed)) WRM_BUFFER, *PWRM_BUFFER;
  14. typedef struct ioctlbuffer
  15. {
  16. void __user *InputBuffer;
  17. ULONG InputLength;
  18. void __user *OutputBuffer;
  19. ULONG OutputLength;
  20. }__attribute__((packed)) IOCTL_BUFFER, *PIOCTL_BUFFER;
  21. typedef struct stGPIOInfo
  22. {
  23. UINT uiGpioNumber ; /* valid numbers 0-15 */
  24. UINT uiGpioValue; /* 1 set ; 0 not set */
  25. }__attribute__((packed))GPIO_INFO,*PGPIO_INFO;
  26. typedef struct stUserThreadReq
  27. {
  28. //0->Inactivate LED thread.
  29. //1->Activate the LED thread
  30. UINT ThreadState;
  31. }__attribute__((packed))USER_THREAD_REQ,*PUSER_THREAD_REQ;
  32. #define LED_THREAD_ACTIVATION_REQ 1
  33. ////********** ioctl codes ***********////
  34. #define BCM_IOCTL 'k'
  35. //1.Control code for CONTROL MESSAGES
  36. #define IOCTL_SEND_CONTROL_MESSAGE _IOW(BCM_IOCTL, 0x801,int)
  37. //2.Control code to write a particular value to a particular register
  38. #define IOCTL_BCM_REGISTER_WRITE _IOW(BCM_IOCTL, 0x802, int) //
  39. //3.
  40. #define IOCTL_BCM_REGISTER_READ _IOR(BCM_IOCTL, 0x803, int) //
  41. //4.Control code to write x number of bytes to common memory
  42. //starting from address y
  43. #define IOCTL_BCM_COMMON_MEMORY_WRITE _IOW(BCM_IOCTL, 0x804, int)//
  44. //5.Control code to write x number of bytes to common memory
  45. //starting from address y
  46. #define IOCTL_BCM_COMMON_MEMORY_READ _IOR(BCM_IOCTL, 0x805, int)//
  47. //6.Control code for CONTROL MESSAGES
  48. #define IOCTL_GET_CONTROL_MESSAGE _IOR(BCM_IOCTL, 0x806, int)//
  49. //7.Control code for FIRMWARE DOWNLOAD
  50. #define IOCTL_BCM_FIRMWARE_DOWNLOAD _IOW(BCM_IOCTL, 0x807, int)//
  51. #define IOCTL_BCM_SET_SEND_VCID _IOW(BCM_IOCTL, 0x808, int)
  52. //9.Control code for TRANSFER MODE SWITCHING
  53. #define IOCTL_BCM_SWITCH_TRANSFER_MODE _IOW(BCM_IOCTL, 0x809, int)
  54. //10.Control code for LINK UP
  55. #define IOCTL_LINK_REQ _IOW(BCM_IOCTL, 0x80A, int)
  56. //11.Control code for RSSI Level Request
  57. #define IOCTL_RSSI_LEVEL_REQ _IOW(BCM_IOCTL, 0x80B, int)
  58. //12.Control code for IDLE MODE CONTROL
  59. #define IOCTL_IDLE_REQ _IOW(BCM_IOCTL, 0x80C, int)
  60. //13.Control code for SS/BS info
  61. #define IOCTL_SS_INFO_REQ _IOW(BCM_IOCTL, 0x80D, int)
  62. #define IOCTL_GET_STATISTICS_POINTER _IOW(BCM_IOCTL, 0x80E, int)
  63. #define IOCTL_CM_REQUEST _IOW(BCM_IOCTL, 0x80F, int)
  64. #define IOCTL_INIT_PARAM_REQ _IOW(BCM_IOCTL, 0x810, int)
  65. #define IOCTL_MAC_ADDR_REQ _IOW(BCM_IOCTL, 0x811, int)
  66. #define IOCTL_MAC_ADDR_RESP _IOWR(BCM_IOCTL, 0x812, int)
  67. #define IOCTL_CLASSIFICATION_RULE _IOW(BCM_IOCTL, 0x813, char)
  68. #define IOCTL_CLOSE_NOTIFICATION _IO(BCM_IOCTL, 0x814)
  69. #define IOCTL_LINK_UP _IO(BCM_IOCTL, 0x815)
  70. #define IOCTL_LINK_DOWN _IO(BCM_IOCTL, 0x816, IOCTL_BUFFER)
  71. #define IOCTL_CHIP_RESET _IO(BCM_IOCTL, 0x816)
  72. #define IOCTL_CINR_LEVEL_REQ _IOW(BCM_IOCTL, 0x817, char)
  73. #define IOCTL_WTM_CONTROL_REQ _IOW(BCM_IOCTL, 0x817,char)
  74. #define IOCTL_BE_BUCKET_SIZE _IOW(BCM_IOCTL, 0x818, unsigned long)
  75. #define IOCTL_RTPS_BUCKET_SIZE _IOW(BCM_IOCTL, 0x819, unsigned long)
  76. #define IOCTL_QOS_THRESHOLD _IOW(BCM_IOCTL, 0x820, unsigned long)
  77. #define IOCTL_DUMP_PACKET_INFO _IO(BCM_IOCTL, 0x821)
  78. #define IOCTL_GET_PACK_INFO _IOR(BCM_IOCTL, 0x823, int)
  79. #define IOCTL_BCM_GET_DRIVER_VERSION _IOR(BCM_IOCTL, 0x829, int)
  80. #define IOCTL_BCM_GET_CURRENT_STATUS _IOW(BCM_IOCTL, 0x828, int)
  81. #define IOCTL_BCM_GPIO_SET_REQUEST _IOW(BCM_IOCTL, 0x82A, int)
  82. #define IOCTL_BCM_GPIO_STATUS_REQUEST _IOW(BCM_IOCTL, 0x82b, int)
  83. #define IOCTL_BCM_GET_DSX_INDICATION _IOR(BCM_IOCTL, 0x854, int)
  84. #define IOCTL_BCM_BUFFER_DOWNLOAD_START _IOW(BCM_IOCTL, 0x855, int)
  85. #define IOCTL_BCM_BUFFER_DOWNLOAD _IOW(BCM_IOCTL, 0x856, int)
  86. #define IOCTL_BCM_BUFFER_DOWNLOAD_STOP _IOW(BCM_IOCTL, 0x857, int)
  87. #define IOCTL_BCM_REGISTER_WRITE_PRIVATE _IOW(BCM_IOCTL, 0x826, char)
  88. #define IOCTL_BCM_REGISTER_READ_PRIVATE _IOW(BCM_IOCTL, 0x827, char)
  89. #define IOCTL_BCM_SET_DEBUG _IOW(BCM_IOCTL, 0x824, IOCTL_BUFFER)
  90. #define IOCTL_BCM_EEPROM_REGISTER_WRITE _IOW(BCM_IOCTL, 0x858, int)
  91. #define IOCTL_BCM_EEPROM_REGISTER_READ _IOR(BCM_IOCTL, 0x859, int)
  92. #define IOCTL_BCM_WAKE_UP_DEVICE_FROM_IDLE _IOR(BCM_IOCTL, 0x860, int)
  93. #define IOCTL_BCM_SET_MAC_TRACING _IOW(BCM_IOCTL, 0x82c, int)
  94. #define IOCTL_BCM_GET_HOST_MIBS _IOW(BCM_IOCTL, 0x853, int)
  95. #define IOCTL_BCM_NVM_READ _IOR(BCM_IOCTL, 0x861, int)
  96. #define IOCTL_BCM_NVM_WRITE _IOW(BCM_IOCTL, 0x862, int)
  97. #define IOCTL_BCM_GET_NVM_SIZE _IOR(BCM_IOCTL, 0x863, int)
  98. #define IOCTL_BCM_CAL_INIT _IOR(BCM_IOCTL, 0x864, int)
  99. #define IOCTL_BCM_BULK_WRM _IOW(BCM_IOCTL, 0x90B, int)
  100. #define IOCTL_BCM_FLASH2X_SECTION_READ _IOR(BCM_IOCTL, 0x865, int)
  101. #define IOCTL_BCM_FLASH2X_SECTION_WRITE _IOW(BCM_IOCTL, 0x866, int)
  102. #define IOCTL_BCM_GET_FLASH2X_SECTION_BITMAP _IOR(BCM_IOCTL,0x867, int)
  103. #define IOCTL_BCM_SET_ACTIVE_SECTION _IOW(BCM_IOCTL,0x868, int)
  104. #define IOCTL_BCM_IDENTIFY_ACTIVE_SECTION _IO(BCM_IOCTL,0x869)
  105. #define IOCTL_BCM_COPY_SECTION _IOW(BCM_IOCTL, 0x870,int)
  106. #define IOCTL_BCM_GET_FLASH_CS_INFO _IOR(BCM_IOCTL, 0x871, int)
  107. #define IOCTL_BCM_SELECT_DSD _IOW(BCM_IOCTL, 0x872, int)
  108. #define IOCTL_BCM_NVM_RAW_READ _IOR(BCM_IOCTL, 0x875, int)
  109. #define IOCTL_BCM_CNTRLMSG_MASK _IOW(BCM_IOCTL, 0x874, int)
  110. #define IOCTL_BCM_GET_DEVICE_DRIVER_INFO _IOR(BCM_IOCTL, 0x877, int)
  111. #define IOCTL_BCM_TIME_SINCE_NET_ENTRY _IOR(BCM_IOCTL, 0x876, int)
  112. #define BCM_LED_THREAD_STATE_CHANGE_REQ _IOW(BCM_IOCTL, 0x878, int)
  113. #define IOCTL_BCM_GPIO_MULTI_REQUEST _IOW(BCM_IOCTL, 0x82D, IOCTL_BUFFER)
  114. #define IOCTL_BCM_GPIO_MODE_REQUEST _IOW(BCM_IOCTL, 0x82E, IOCTL_BUFFER)
  115. typedef enum _BCM_INTERFACE_TYPE
  116. {
  117. BCM_MII,
  118. BCM_CARDBUS,
  119. BCM_USB,
  120. BCM_SDIO,
  121. BCM_PCMCIA
  122. }BCM_INTERFACE_TYPE;
  123. typedef struct _DEVICE_DRIVER_INFO
  124. {
  125. NVM_TYPE u32NVMType;
  126. UINT MaxRDMBufferSize;
  127. BCM_INTERFACE_TYPE u32InterfaceType;
  128. UINT u32DSDStartOffset;
  129. UINT u32RxAlignmentCorrection;
  130. UINT u32Reserved[10];
  131. } DEVICE_DRIVER_INFO;
  132. typedef struct _NVM_READWRITE
  133. {
  134. void __user *pBuffer;
  135. // Data to be written from|read to. Memory should be allocated by the caller.
  136. uint32_t uiOffset;
  137. // offset at which data should be written to or read from.
  138. uint32_t uiNumBytes;
  139. // No. of bytes to be written or read.
  140. bool bVerify;
  141. // Applicable only for write. If set verification of written data will be done.
  142. } NVM_READWRITE,*PNVM_READWRITE;
  143. typedef struct bulkwrmbuffer
  144. {
  145. ULONG Register;
  146. ULONG SwapEndian;
  147. ULONG Values[1];
  148. }BULKWRM_BUFFER,*PBULKWRM_BUFFER;
  149. /***********Structure used for FlashMap2.x *******************************/
  150. /*
  151. * These are Sction present inside the Flash.
  152. * There is sectional RD/WR for flash Map 2.x.
  153. * hence these section will be used in read/write API.
  154. */
  155. typedef enum _FLASH2X_SECTION_VAL
  156. {
  157. NO_SECTION_VAL = 0, //no section is chosen when absolute offset is given for RD/WR
  158. ISO_IMAGE1,
  159. ISO_IMAGE2,
  160. DSD0,
  161. DSD1,
  162. DSD2,
  163. VSA0,
  164. VSA1,
  165. VSA2,
  166. SCSI,
  167. CONTROL_SECTION,
  168. ISO_IMAGE1_PART2,
  169. ISO_IMAGE1_PART3,
  170. ISO_IMAGE2_PART2,
  171. ISO_IMAGE2_PART3,
  172. TOTAL_SECTIONS
  173. }FLASH2X_SECTION_VAL;
  174. /*
  175. * Structure used for READ/WRITE Flash Map2.x
  176. */
  177. typedef struct _FLASH2X_READWRITE
  178. {
  179. FLASH2X_SECTION_VAL Section; //which section has to be read/written
  180. B_UINT32 offset; //Offset within Section.
  181. B_UINT32 numOfBytes; //NOB from the offset
  182. B_UINT32 bVerify;
  183. void __user *pDataBuff; //Buffer for reading/writing
  184. }FLASH2X_READWRITE, *PFLASH2X_READWRITE;
  185. /*
  186. * This structure is used for coping one section to other.
  187. * there are two ways to copy one section to other.
  188. * it NOB =0, complete section will be copied on to other.
  189. * if NOB !=0, only NOB will be copied from the given offset.
  190. */
  191. typedef struct _FLASH2X_COPY_SECTION
  192. {
  193. //Src Section from which Data has to be copied to DstSection
  194. FLASH2X_SECTION_VAL SrcSection;
  195. //Destination Section from where Data has to be coppied.
  196. FLASH2X_SECTION_VAL DstSection;
  197. //Offset within Section. if NOB =0 it will be ignored and data will be coped from offset 0.
  198. B_UINT32 offset;
  199. //NOB from the offset. if NOB = 0 complete src section will be copied to Destination section.
  200. B_UINT32 numOfBytes;
  201. } FLASH2X_COPY_SECTION, *PFLASH2X_COPY_SECTION;
  202. typedef enum _SECTION_TYPE
  203. {
  204. ISO = 0,
  205. VSA = 1,
  206. DSD = 2
  207. } SECTION_TYPE, *PSECTION_TYPE;
  208. /*
  209. * This section provide the complete bitmap of the Flash.
  210. * using this map lib/APP will isssue read/write command.
  211. Fields are defined as :
  212. Bit [0] = section is present //1:present, 0: Not present
  213. * Bit [1] = section is valid //1: valid, 0: not valid
  214. * Bit [2] = Section is R/W //0: RW, 1: RO
  215. * Bit [3] = Section is Active or not 1 means Active, 0->inactive
  216. * Bit [7...3] = Reserved
  217. */
  218. typedef struct _FLASH2X_BITMAP
  219. {
  220. UCHAR ISO_IMAGE1;
  221. UCHAR ISO_IMAGE2;
  222. UCHAR DSD0;
  223. UCHAR DSD1;
  224. UCHAR DSD2;
  225. UCHAR VSA0;
  226. UCHAR VSA1;
  227. UCHAR VSA2;
  228. UCHAR SCSI;
  229. UCHAR CONTROL_SECTION;
  230. //Reserved for future use
  231. UCHAR Reserved0;
  232. UCHAR Reserved1;
  233. UCHAR Reserved2;
  234. }FLASH2X_BITMAP, *PFLASH2X_BITMAP;
  235. //for net entry time check
  236. typedef struct _ST_TIME_ELAPSED_
  237. {
  238. ULONG64 ul64TimeElapsedSinceNetEntry;
  239. UINT32 uiReserved[4]; //By chance if required for future proofing
  240. }ST_TIME_ELAPSED,*PST_TIME_ELAPSED;
  241. enum {
  242. WIMAX_IDX=0, /*To access WiMAX chip GPIO's for GPIO_MULTI_INFO or GPIO_MULTI_MODE*/
  243. HOST_IDX, /*To access Host chip GPIO's for GPIO_MULTI_INFO or GPIO_MULTI_MODE*/
  244. MAX_IDX
  245. };
  246. typedef struct stGPIOMultiInfo
  247. {
  248. UINT uiGPIOCommand; /* 1 for set and 0 for get*/
  249. UINT uiGPIOMask; /* set the correspondig bit to 1 to access GPIO*/
  250. UINT uiGPIOValue; /* 0 or 1; value to be set when command is 1.*/
  251. }__attribute__((packed))GPIO_MULTI_INFO , *PGPIO_MULTI_INFO;
  252. typedef struct stGPIOMultiMode
  253. {
  254. UINT uiGPIOMode; /* 1 for OUT mode, 0 for IN mode*/
  255. UINT uiGPIOMask; /* GPIO mask to set mode*/
  256. }__attribute__((packed))GPIO_MULTI_MODE, *PGPIO_MULTI_MODE;
  257. #endif