00001
00019 #ifndef __RFUSBSTICK_COMMON_INCLUDED
00020 #define __RFUSBSTICK_COMMON_INCLUDED
00021
00022
00023 #define CMD_SIGN_OFF 0x00
00024 #define CMD_SIGN_ON 0x01
00025
00026 #define CMD_GET_PARAMETER 0x02
00027 #define CMD_SET_PARAMETER 0x03
00028 #define CMD_SELF_TEST 0x04
00029 #define CMD_CHECK_STACK_USAGE 0x05
00030 #define CMD_MEMORY_TEST 0x06
00031
00032 #define CMD_SET_MODE 0x07
00033
00034
00035 #define CMD_SET_CHANNEL 0x08
00036 #define CMD_OPEN_STREAM 0x09
00037 #define CMD_CLOSE_STREAM 0x0A
00038 #define CMD_CHANNEL_SCAN 0x0B
00039 #define CMD_CHANNEL_SCAN_STOP 0x0C
00040 #define CMD_INJECT_FRAME 0x0D
00041 #define CMD_JAMMER_ON 0x0E
00042 #define CMD_JAMMER_OFF 0x0F
00043
00044
00045 #define CMD_TRX_READ_REGISTER 0x10
00046 #define CMD_TRX_WRITE_REGISTER 0x11
00047 #define CMD_TRX_READ_FRAME 0x12
00048 #define CMD_TRX_WRITE_FRAME 0x13
00049 #define CMD_TRX_READ_SRAM 0x14
00050 #define CMD_TRX_WRITE_SRAM 0x15
00051 #define CMD_TRX_GET_PIN 0x16
00052 #define CMD_TRX_SET_PIN 0x17
00053
00054
00055
00056 #define CMD_ENTER_BOOT 0x18
00057
00058
00059 #define CMD_MCPS_DATA_REQUEST 0x19
00060 #define CMD_MLME_ASSOCIATE_REQUEST 0x1A
00061 #define CMD_MLME_DISASSOCIATE_REQUEST 0x1B
00062 #define CMD_MLME_SCAN_REQUEST 0x1C
00063 #define CMD_MLME_RX_ENABLE_REQUEST 0x1D
00064 #define CMD_MLME_RX_DISABLE_REQUEST 0x1E
00065 #define CMD_MLME_START_REQUEST 0x1F
00066 #define CMD_MLME_RESET_REQUEST 0x20
00067
00068
00069 #define CMD_SET_LEDS (0x30)
00070 #define CMD_ECHO (0x31)
00071
00072
00073 #define CMD_NLDE_DATA_REQUEST (0x21)
00074 #define CMD_NLME_FORMATION_REQUEST (0x22)
00075 #define CMD_NLME_PERMIT_JOIN_REQUEST (0x23)
00076 #define CMD_NLME_JOIN_REQUEST (0x24)
00077 #define CMD_NLME_LEAVE_REQUEST (0x25)
00078 #define CMD_NLME_DISCOVERY_REQUEST (0x26)
00079 #define CMD_NLME_START_ROUTER_REQUEST (0x27)
00080
00081
00082 #define CMD_SERVER_PING (0x40)
00083 #define CMD_SERVER_ENUM_DEVICES (0x41)
00084 #define CMD_START_UPGRADE (0x42)
00085
00086
00087 #define CMD_BOOT_READ_SIGNATURE (0xB0)
00088 #define CMD_BOOT_GET_VERSION (0xB1)
00089 #define CMD_BOOT_START_APPLICATION (0xB2)
00090 #define CMD_BOOT_ERASE_FLASH (0xB3)
00091 #define CMD_BOOT_ERASE_EEPROM (0xB4)
00092 #define CMD_BOOT_PROG_FLASH (0xB5)
00093 #define CMD_BOOT_READ_FLASH (0xB6)
00094 #define CMD_BOOT_PROG_EEPROM (0xB7)
00095 #define CMD_BOOT_READ_EEPROM (0xB8)
00096 #define CMD_BOOT_READ_LOCKBITS (0xB9)
00097 #define CMD_BOOT_WRITE_LOCKBITS (0xBA)
00098 #define CMD_BOOT_READ_FUSES (0xBB)
00099
00100
00101 #define EVENT_STREAM_AC_DATA 0x50
00102 #define EVENT_SNIFFER_SCAN_COMPLETE 0x51
00103 #define EVENT_SNIFFER_ERROR 0x52
00104 #define EVENT_NWK_DATA 0x53
00105 #define EVENT_NWK_JOIN 0x54
00106 #define EVENT_NWK_LEAVE 0x55
00107
00108
00109 #define CONF_NWK_DATA 0x63
00110 #define CONF_NWK_JOIN 0x64
00111 #define CONF_NWK_LEAVE 0x65
00112 #define CONF_NWK_DISCOVERY 0x66
00113
00114
00115 #define EVENT_UPGRADE_STATUS 0x70
00116
00117
00118 #define RESP_SUCCESS (0x80)
00119 #define RESP_SIGN_ON (0x81)
00120 #define RESP_GET_PARAMETER (0x82)
00121 #define RESP_TRX_READ_REGISTER (0x83)
00122 #define RESP_TRX_READ_FRAME (0x84)
00123 #define RESP_TRX_READ_SRAM (0x85)
00124 #define RESP_TRX_GET_PIN (0x86)
00125 #define RESP_TRX_BUSY (0x87)
00126 #define RESP_ECHO (0x88)
00127
00128
00129 #define RESP_HW_TIMEOUT (0x90)
00130 #define RESP_SYNTAX_ERROR (0x91)
00131 #define RESP_SEMANTIC_ERROR (0x92)
00132 #define RESP_COMMAND_UNKNOWN (0x93)
00133 #define RESP_BUSY_SCANING (0x94)
00134 #define RESP_BUSY_CAPTURING (0x95)
00135 #define RESP_OUT_OF_MEMORY (0x96)
00136 #define RESP_BUSY_JAMMING (0x97)
00137 #define RESP_NOT_INITIALIZED (0x98)
00138 #define RESP_NOT_IMPLEMENTED (0x99)
00139 #define RESP_PRIMITIVE_FAILED (0x9A)
00140 #define RESP_VRT_KERNEL_ERROR (0x9B)
00141 #define RESP_BOOT_PARAM (0x9C)
00142 #define RESP_ERROR_PAYLOAD (0x9D)
00143
00144
00145 #define RESP_SERVER_ENUM_DEVICES (0xF0)
00146
00147
00148 #define PARAM_SW_REV 0xC0
00149 #define PARAM_IEEE_ADDRESS 0xC1
00150
00151
00152 #define SHUT_DOWN (0x00)
00153 #define RESET_ALL (0x01)
00154 #define RESET_USB (0x02)
00155 #define RESET_RF (0x03)
00156
00157
00158 #define PARAM_NWK_MAX_CHILDREN (0x00)
00159 #define PARAM_NWK_MAX_ROUTRES (0x01)
00160 #define PARAM_NWK_MAX_DEPTH (0x02)
00161
00162
00163 #define CMD_MODE_AC (0x00)
00164 #define CMD_MODE_HAL (0x01)
00165 #define CMD_MODE_MAC (0x02)
00166 #define CMD_MODE_NWK (0x03)
00167 #define CMD_MODE_NONE (0x04)
00168
00169
00170 #define CMD_ED_SCAN (0x00)
00171 #define CMD_ACTIVE_SCAN (0x01)
00172 #define CMD_PASSIVE_SCAN (0x02)
00173 #define CMD_ORPHAN_SCAN (0x03)
00174
00175
00176 #define SCAN_VARIANT_ED (0x00)
00177 #define SCAN_VARIANT_PAN_SHORT (0x01)
00178 #define SCAN_VARIANT_PAN_LONG (0x02)
00179
00180
00181 #define TRX_SLP_TR_PIN (0x00)
00182 #define TRX_RST_PIN (0x01)
00183 #define TRX_TST_PIN (0x02)
00184 #define TRX_NMBR_OF_PINS (0x03)
00185 #define TRX_MAX_PIN_VALUE (0x01)
00186
00187
00188 #define CMD_SIGN_OFF_LENGTH (0x02)
00189 #define CMD_SIGN_ON_LENGTH (0x01)
00190 #define CMD_SET_MODE_LENGTH (0x02)
00191
00192 #define CMD_SET_CHANNEL_LENGTH (0x02)
00193 #define CMD_OPEN_STREAM_LENGTH (0x01)
00194 #define CMD_CLOSE_STREAM_LENGTH (0x01)
00195 #define CMD_CHANNEL_SCAN_LENGTH (0x04)
00196 #define CMD_JAMMER_OFF_LENGTH (0x01)
00197
00198 #define CMD_TRX_READ_REGISTER_LENGTH (0x02)
00199 #define CMD_TRX_WRITE_REGISTER_LENGTH (0x03)
00200 #define CMD_TRX_READ_PIN_LENGTH (0x02)
00201 #define CMD_TRX_WRITE_PIN_LENGTH (0x03)
00202
00203 #define CMD_MAC_START_REQUEST_LENGTH (0x05)
00204
00205 #define NMBR_OF_SCAN_TYPES (0x03)
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229 #include <stdint.h>
00230
00231
00232
00233
00234
00235 typedef struct cmd_echo {
00236 uint8_t type;
00237 uint8_t slen;
00238 } cmd_echo_t;
00239
00240 typedef struct cmd_setLeds {
00241 uint8_t type;
00242 uint8_t leds;
00243 } cmd_setLeds_t;
00244
00246 typedef struct CMD_SIGN_OFF_STRUCT_TAG {
00247 uint8_t type;
00248 uint8_t reset_flag;
00249 } cmd_sign_off_t;
00250
00251
00253 typedef struct CMD_GET_PARAMETER_STRUCT_TAG {
00254 uint8_t type;
00255 uint8_t parameter;
00256 } cmd_get_parameter_t;
00257
00258
00260 typedef struct CMD_SET_MODE_STRUCT_TAG {
00261 uint8_t type;
00262 uint8_t mode;
00263 } cmd_set_mode_t;
00264
00265
00267 typedef struct CMD_SET_CHANNEL_STRUCT_TAG {
00268 uint8_t type;
00269 uint8_t channel;
00270 } cmd_set_channel_t;
00271
00272
00274 typedef struct CMD_OPEN_STREAM_STRUCT_TAG {
00275 uint8_t type;
00276 } cmd_open_stream_t;
00277
00278
00280 typedef struct CMD_CLOSE_STREAM_STRUCT_TAG {
00281 uint8_t type;
00282 } cmd_close_stream_t;
00283
00284
00286 typedef struct CMD_CHANNEL_SCAN_STRUCT_TAG {
00287 uint8_t type;
00288 uint8_t channel;
00289 uint8_t scan_type;
00290 uint8_t scan_duration;
00291 } cmd_channel_scan_t;
00292
00293
00295 typedef struct CMD_INJECT_FRAME_STRUCT_TAG {
00296 uint8_t type;
00297 uint8_t length;
00298 uint8_t frame[];
00299 } cmd_inject_frame_t;
00300
00301
00303 typedef struct CMD_JAMMER_ON_STRUCT_TAG {
00304 uint8_t type;
00305 } cmd_jammer_on_t;
00306
00307
00309 typedef struct CMD_JAMMER_OFF_STRUCT_TAG {
00310 uint8_t type;
00311 } cmd_jammer_off_t;
00312
00313
00315 typedef struct CMD_NLDE_DATA_REQUEST_STRUCT_TAG {
00316 uint8_t type;
00317 uint16_t dest_addr;
00318 uint8_t radius;
00319 uint8_t non_member_radius;
00320 uint8_t discovery_route;
00321 uint8_t length;
00322 uint8_t data[];
00323 } cmd_nlde_data_request_t;
00324
00325
00327 typedef struct CMD_NLME_FORMATION_REQUEST_STRUCT_TAG {
00328 uint8_t type;
00329 uint8_t channel;
00330 uint16_t pan_id;
00331 } cmd_nlme_formation_request_t;
00332
00333
00335 typedef struct CMD_NLME_PERMIT_JOINING_REQUEST_STRUCT_TAG {
00336 uint8_t type;
00337 s_bool join_permitted;
00338 } cmd_nlme_permit_joining_request_t;
00339
00340
00342 typedef struct CMD_NLME_JOIN_REQUEST_STRUCT_TAG {
00343 uint8_t type;
00344 uint16_t PANId;
00345 uint8_t RejoinNetwork;
00346 s_bool JoinAsRouter;
00347 uint8_t PowerSource;
00348 s_bool RxOnWhenIdle;
00349 } cmd_nlme_join_request_t;
00350
00351
00353 typedef struct CMD_NLME_LEAVE_REQUEST_STRUCT_TAG {
00354 uint8_t type;
00355 uint64_t device_address;
00356 s_bool remove_children;
00357 s_bool rejoin;
00358 s_bool reuse_address;
00359 s_bool silent;
00360 } cmd_nlme_leave_request_t;
00361
00362
00364 typedef struct CMD_NLME_DISCOVERY_REQUEST_STRUCT_TAG {
00365 uint8_t type;
00366 uint8_t channel;
00367 uint8_t duration;
00368 } cmd_nlme_discovery_request_t;
00369
00370
00372 typedef struct CMD_NLME_START_ROUTER_REQUEST_STRUCT_TAG {
00373 uint8_t type;
00374 } cmd_nlme_router_start_request_t;
00375
00376
00377 #endif // __RFUSBSTICK_COMMON_INCLUDED