| | 161 | nrk_setup_ports (); |
|---|
| | 162 | nrk_setup_uart (UART_BAUDRATE_115K2); |
|---|
| | 163 | |
|---|
| | 164 | nrk_init (); |
|---|
| | 165 | |
|---|
| | 166 | nrk_led_clr (0); |
|---|
| | 167 | nrk_led_clr (1); |
|---|
| | 168 | nrk_led_clr (2); |
|---|
| | 169 | nrk_led_clr (3); |
|---|
| | 170 | |
|---|
| | 171 | nrk_time_set (0, 0); |
|---|
| | 172 | |
|---|
| | 173 | bmac_task_config (); |
|---|
| | 174 | |
|---|
| | 175 | nrk_create_taskset (); |
|---|
| | 176 | nrk_start (); |
|---|
| | 177 | |
|---|
| | 178 | return 0; |
|---|
| | 179 | } |
|---|
| | 180 | |
|---|
| | 181 | void tx_task () |
|---|
| | 182 | { |
|---|
| | 183 | // Get the signal for UART RX |
|---|
| | 184 | //uart_rx_signal=nrk_uart_rx_signal_get(); |
|---|
| | 185 | // Register your task to wakeup on RX Data |
|---|
| | 186 | //if(uart_rx_signal==NRK_ERROR) nrk_kprintf( PSTR("Get Signal ERROR!\r\n") ); |
|---|
| | 187 | //nrk_signal_register(uart_rx_signal); |
|---|
| | 188 | |
|---|
| | 189 | //printf ("tx_task PID=%d\r\n", nrk_get_pid ()); |
|---|
| | 190 | |
|---|
| | 191 | // Wait until the tx_task starts up bmac |
|---|
| | 192 | // This should be called by all tasks using bmac that |
|---|
| | 193 | // do not call bmac_init()... |
|---|
| | 194 | bmac_init (26); |
|---|
| | 195 | |
|---|
| | 196 | bmac_encryption_set_key(aes_key,16); |
|---|
| | 197 | bmac_encryption_enable(); |
|---|
| | 198 | |
|---|
| | 199 | bmac_rx_pkt_set_buffer (rx_buf, RF_MAX_PAYLOAD_SIZE); |
|---|
| | 200 | |
|---|
| | 201 | //nrk_kprintf (PSTR ("bmac_started()\r\n")); |
|---|
| | 202 | bmac_set_cca_thresh (-45); |
|---|
| | 203 | |
|---|
| | 204 | check_period.secs = 0; |
|---|
| | 205 | check_period.nano_secs = 100 * NANOS_PER_MS; |
|---|
| | 206 | val = bmac_set_rx_check_rate (check_period); |
|---|
| | 207 | |
|---|
| | 208 | // Get and register the tx_done_signal if you want to |
|---|
| | 209 | // do non-blocking transmits |
|---|
| | 210 | tx_done_signal = bmac_get_tx_done_signal (); |
|---|
| | 211 | nrk_signal_register (tx_done_signal); |
|---|
| | 212 | |
|---|
| | 213 | rx_signal = bmac_get_rx_pkt_signal (); |
|---|
| | 214 | nrk_signal_register (rx_signal); |
|---|
| | 215 | |
|---|
| | 216 | cnt = 0; |
|---|
| | 217 | |
|---|
| | 218 | while (1) |
|---|
| | 219 | { |
|---|
| | 220 | nrk_kprintf(PSTR("\r\n*************************************************************\r\n")); |
|---|
| | 221 | nrk_kprintf(PSTR(" PHOENIX WIRELESS UPDATE SYSTEM \r\n")); |
|---|
| | 222 | nrk_kprintf(PSTR("*************************************************************\r\n")); |
|---|
| | 223 | nrk_kprintf(PSTR("Press 'p' : To PING Nodes in Vicinity \r\n")); |
|---|
| | 224 | nrk_kprintf(PSTR("Press 'u' : To Begin Node Update \r\n")); |
|---|
| | 225 | nrk_kprintf(PSTR(" \r\n")); |
|---|
| | 226 | nrk_kprintf(PSTR("*************************************************************\r\n")); |
|---|
| | 227 | |
|---|
| | 228 | printf("Enter Choice: "); |
|---|
| | 229 | |
|---|
| | 230 | //sm=nrk_event_wait(SIG(uart_rx_signal)); |
|---|
| | 231 | |
|---|
| | 232 | //if(sm != SIG(uart_rx_signal)) |
|---|
| | 233 | //{ |
|---|
| | 234 | // nrk_kprintf( PSTR("UART signal error\r\n") ); |
|---|
| | 235 | // while(1); |
|---|
| | 236 | //} |
|---|
| | 237 | // Wait for UART signal |
|---|
| | 238 | while(1) |
|---|
| | 239 | { |
|---|
| | 240 | if(nrk_uart_data_ready(NRK_DEFAULT_UART)!=0) |
|---|
| | 241 | { |
|---|
| | 242 | // Read Character |
|---|
| | 243 | c=getchar(); |
|---|
| | 244 | printf( "%c\r\n",c); |
|---|
| | 245 | break; |
|---|
| | 246 | } |
|---|
| | 247 | timeout.secs = 0; |
|---|
| | 248 | timeout.nano_secs = 20 * NANOS_PER_MS; |
|---|
| | 249 | nrk_wait(timeout); |
|---|
| | 250 | } |
|---|
| | 251 | // Choose mode |
|---|
| | 252 | switch(c){ |
|---|
| | 253 | case 'p': |
|---|
| | 254 | programState = PING; |
|---|
| | 255 | break; |
|---|
| | 256 | case 'u': |
|---|
| | 257 | getDestMac(); |
|---|
| | 258 | phoenix_init(); |
|---|
| | 259 | programState = UPDATE; |
|---|
| | 260 | break; |
|---|
| | 261 | default: |
|---|
| | 262 | programState = NONE; |
|---|
| | 263 | nrk_kprintf(PSTR("Invalid Command! Please Try Again\r\n")); |
|---|
| | 264 | } |
|---|
| | 265 | |
|---|
| | 266 | // Reset c |
|---|
| | 267 | c = 0; |
|---|
| | 268 | |
|---|
| | 269 | nrk_wait_until_next_period(); |
|---|
| | 270 | |
|---|
| | 271 | // Execute protocol |
|---|
| | 272 | switch(programState) |
|---|
| | 273 | { |
|---|
| | 274 | case PING: |
|---|
| | 275 | pingMode(); |
|---|
| | 276 | break; |
|---|
| | 277 | case UPDATE: |
|---|
| | 278 | updateMode(); |
|---|
| | 279 | break; |
|---|
| | 280 | case NONE:;// Do nothing |
|---|
| | 281 | break; |
|---|
| | 282 | default: |
|---|
| | 283 | nrk_kprintf(PSTR("Invalid Program State\r\n")); |
|---|
| | 284 | break; |
|---|
| | 285 | } |
|---|
| | 286 | nrk_wait_until_next_period (); |
|---|
| | 287 | } |
|---|
| | 288 | } |
|---|
| | 289 | |
|---|
| | 290 | void phoenix_init() |
|---|
| | 291 | { |
|---|
| 127 | | |
|---|
| 128 | | nrk_setup_ports (); |
|---|
| 129 | | nrk_setup_uart (UART_BAUDRATE_115K2); |
|---|
| 130 | | |
|---|
| 131 | | nrk_init (); |
|---|
| 132 | | |
|---|
| 133 | | nrk_led_clr (0); |
|---|
| 134 | | nrk_led_clr (1); |
|---|
| 135 | | nrk_led_clr (2); |
|---|
| 136 | | nrk_led_clr (3); |
|---|
| 137 | | |
|---|
| 138 | | nrk_time_set (0, 0); |
|---|
| 139 | | |
|---|
| 140 | | bmac_task_config (); |
|---|
| 141 | | |
|---|
| 142 | | nrk_create_taskset (); |
|---|
| 143 | | nrk_start (); |
|---|
| 144 | | |
|---|
| 145 | | return 0; |
|---|
| 146 | | } |
|---|
| 147 | | |
|---|
| 148 | | void tx_task () |
|---|
| 149 | | { |
|---|
| 150 | | nrk_sig_t tx_done_signal; |
|---|
| 151 | | nrk_sig_t rx_signal; |
|---|
| 152 | | nrk_time_t check_period; |
|---|
| 153 | | nrk_time_t timeout; |
|---|
| 154 | | nrk_sig_mask_t my_sigs; |
|---|
| 155 | | |
|---|
| 156 | | printf ("tx_task PID=%d\r\n", nrk_get_pid ()); |
|---|
| 157 | | |
|---|
| 158 | | |
|---|
| 159 | | // Wait until the tx_task starts up bmac |
|---|
| 160 | | // This should be called by all tasks using bmac that |
|---|
| 161 | | // do not call bmac_init()... |
|---|
| 162 | | bmac_init (26); |
|---|
| 163 | | |
|---|
| 164 | | bmac_encryption_set_key(aes_key,16); |
|---|
| 165 | | bmac_encryption_enable(); |
|---|
| 166 | | |
|---|
| 167 | | bmac_rx_pkt_set_buffer (rx_buf, RF_MAX_PAYLOAD_SIZE); |
|---|
| 168 | | |
|---|
| | 303 | } |
|---|
| | 304 | |
|---|
| | 305 | //*************************PING MODE************************************************ |
|---|
| | 306 | void getDestMac() |
|---|
| | 307 | { |
|---|
| | 308 | |
|---|
| | 309 | mac_addr[0] = '\0'; |
|---|
| | 310 | |
|---|
| | 311 | nrk_kprintf(PSTR("\r\n*************************************************************\r\n")); |
|---|
| | 312 | nrk_kprintf(PSTR(" Please Enter Address of Node to Program \r\n")); |
|---|
| | 313 | nrk_kprintf(PSTR(" MAC (Subnet + Dest) 4 Bytes Hex E.g. 00000004 \r\n")); |
|---|
| | 314 | nrk_kprintf(PSTR("*************************************************************\r\n")); |
|---|
| | 315 | printf("Enter MAC:"); |
|---|
| | 316 | |
|---|
| | 317 | charCount = 0; |
|---|
| | 318 | |
|---|
| | 319 | // Enter Mac |
|---|
| | 320 | do |
|---|
| | 321 | { |
|---|
| | 322 | // Wait for UART signal |
|---|
| | 323 | while(1) |
|---|
| | 324 | { |
|---|
| | 325 | if(nrk_uart_data_ready(NRK_DEFAULT_UART)!=0) |
|---|
| | 326 | { |
|---|
| | 327 | while(nrk_uart_data_ready(NRK_DEFAULT_UART)!=0) |
|---|
| | 328 | { |
|---|
| | 329 | charCount++; |
|---|
| | 330 | // Read Character |
|---|
| | 331 | c=getchar(); |
|---|
| | 332 | printf( "%c",c); |
|---|
| | 333 | sprintf(mac_addr,"%s%c",mac_addr,c); |
|---|
| | 334 | } |
|---|
| | 335 | break; |
|---|
| | 336 | } |
|---|
| | 337 | timeout.secs = 0; |
|---|
| | 338 | timeout.nano_secs = 20 * NANOS_PER_MS; |
|---|
| | 339 | nrk_wait(timeout); |
|---|
| | 340 | } |
|---|
| | 341 | }while(charCount < 8); |
|---|
| | 342 | |
|---|
| | 343 | |
|---|
| | 344 | buffer0[0]=mac_addr[0]; buffer0[1]=mac_addr[1]; buffer0[3]='\0'; |
|---|
| | 345 | buffer1[0]=mac_addr[2]; buffer1[1]=mac_addr[3]; buffer1[3]='\0'; |
|---|
| | 346 | buffer2[0]=mac_addr[4]; buffer2[1]=mac_addr[5]; buffer2[3]='\0'; |
|---|
| | 347 | buffer3[0]=mac_addr[6]; buffer3[1]=mac_addr[7]; buffer3[3]='\0'; |
|---|
| | 348 | val=sscanf( buffer0,"%x",&dest_mac[3]); |
|---|
| | 349 | val+=sscanf( buffer1,"%x",&dest_mac[2]); |
|---|
| | 350 | val+=sscanf( buffer2,"%x",&dest_mac[1]); |
|---|
| | 351 | val+=sscanf( buffer3,"%x",&dest_mac[0]); |
|---|
| | 352 | |
|---|
| | 353 | |
|---|
| | 354 | nrk_kprintf(PSTR("\r\n*************************************************************\r\n")); |
|---|
| | 355 | nrk_kprintf(PSTR(" Node MAC Accepted \r\n")); |
|---|
| | 356 | printf(" Initiating Update for Node 0 x %X %X %X %X \r\n", dest_mac[3],dest_mac[2],dest_mac[1], dest_mac[0]); |
|---|
| | 357 | nrk_kprintf(PSTR("*************************************************************\r\n")); |
|---|
| | 358 | |
|---|
| | 359 | } |
|---|
| | 360 | |
|---|
| | 361 | |
|---|
| | 362 | void pingMode() |
|---|
| | 363 | { |
|---|
| | 364 | |
|---|
| | 365 | // Broadcast for ping |
|---|
| 172 | | |
|---|
| 173 | | nrk_kprintf (PSTR ("bmac_started()\r\n")); |
|---|
| 174 | | bmac_set_cca_thresh (-45); |
|---|
| | 369 | |
|---|
| | 370 | uint8_t i; |
|---|
| | 371 | |
|---|
| | 372 | // Build a TX packet by hand... |
|---|
| | 373 | p2p_pkt.pkt_type = PING_PKT; |
|---|
| | 374 | // set as p2p packet (no US_MASK or DS_MASK) |
|---|
| | 375 | p2p_pkt.ctrl_flags = MOBILE_MASK; // | DEBUG_FLAG ; |
|---|
| | 376 | p2p_pkt.ack_retry= 0x00; |
|---|
| | 377 | p2p_pkt.ttl = 1; |
|---|
| | 378 | p2p_pkt.subnet_mac[0] = 1; |
|---|
| | 379 | p2p_pkt.subnet_mac[1] = 2; |
|---|
| | 380 | p2p_pkt.subnet_mac[2] = 3; |
|---|
| | 381 | p2p_pkt.src_mac = my_mac; |
|---|
| | 382 | p2p_pkt.last_hop_mac = my_mac; |
|---|
| | 383 | p2p_pkt.dst_mac = BROADCAST; |
|---|
| | 384 | p2p_pkt.buf=tx_buf; |
|---|
| | 385 | p2p_pkt.buf_len = P2P_PAYLOAD_START; |
|---|
| | 386 | p2p_pkt.seq_num = cnt; |
|---|
| | 387 | p2p_pkt.priority = 0; |
|---|
| | 388 | |
|---|
| | 389 | // p2p_pkt.payload[0]=my_mac; |
|---|
| | 390 | // p2p_pkt.payload_len=1; |
|---|
| | 391 | // ping_p2p_generate(&p2p_pkt); |
|---|
| | 392 | |
|---|
| | 393 | nrk_led_set (BLUE_LED); |
|---|
| 180 | | // Get and register the tx_done_signal if you want to |
|---|
| 181 | | // do non-blocking transmits |
|---|
| 182 | | tx_done_signal = bmac_get_tx_done_signal (); |
|---|
| 183 | | nrk_signal_register (tx_done_signal); |
|---|
| 184 | | |
|---|
| 185 | | rx_signal = bmac_get_rx_pkt_signal (); |
|---|
| 186 | | nrk_signal_register (rx_signal); |
|---|
| 187 | | |
|---|
| 188 | | cnt = 0; |
|---|
| 189 | | |
|---|
| 190 | | while (1) |
|---|
| | 399 | // Pack data structure values in buffer before transmit |
|---|
| | 400 | pack_peer_2_peer_packet(&p2p_pkt); |
|---|
| | 401 | // For blocking transmits, use the following function call. |
|---|
| | 402 | val = bmac_tx_pkt (p2p_pkt.buf, p2p_pkt.buf_len); |
|---|
| | 403 | |
|---|
| | 404 | check_period.secs = 0; |
|---|
| | 405 | check_period.nano_secs = FAST_CHECK_RATE * NANOS_PER_MS; |
|---|
| | 406 | val = bmac_set_rx_check_rate (check_period); |
|---|
| | 407 | #ifdef TXT_DEBUG |
|---|
| | 408 | nrk_kprintf (PSTR ("\r\nPING Packet Sent. Waiting for Replies...\r\n\n")); |
|---|
| | 409 | #endif |
|---|
| | 410 | nrk_led_clr (BLUE_LED); |
|---|
| | 411 | nrk_led_clr(GREEN_LED); |
|---|
| | 412 | |
|---|
| | 413 | // Wait for packets or timeout |
|---|
| | 414 | nrk_time_get (&start); |
|---|
| | 415 | |
|---|
| | 416 | while (1) { |
|---|
| | 417 | |
|---|
| | 418 | timeout.secs = PING_WAIT_SECS; |
|---|
| | 419 | timeout.nano_secs = 0; |
|---|
| | 420 | |
|---|
| | 421 | // Wait until an RX packet is received |
|---|
| | 422 | //val = bmac_wait_until_rx_pkt (); |
|---|
| | 423 | nrk_set_next_wakeup (timeout); |
|---|
| | 424 | my_sigs = nrk_event_wait (SIG (rx_signal) | SIG (nrk_wakeup_signal)); |
|---|
| | 425 | |
|---|
| | 426 | |
|---|
| | 427 | if (my_sigs == 0) |
|---|
| | 428 | nrk_kprintf (PSTR ("Error calling nrk_event_wait()\r\n")); |
|---|
| | 429 | if (my_sigs & SIG (rx_signal)) { |
|---|
| | 430 | // Get the RX packet |
|---|
| | 431 | local_rx_buf = bmac_rx_pkt_get (&len, &rssi); |
|---|
| | 432 | // Check the packet type from raw buffer before unpacking |
|---|
| | 433 | if ((local_rx_buf[CTRL_FLAGS] & (DS_MASK | US_MASK)) == 0) { |
|---|
| | 434 | // Set the buffer |
|---|
| | 435 | p2p_pkt.buf=local_rx_buf; |
|---|
| | 436 | p2p_pkt.buf_len=len; |
|---|
| | 437 | p2p_pkt.rssi=rssi; |
|---|
| | 438 | unpack_peer_2_peer_packet(&p2p_pkt); |
|---|
| | 439 | if (p2p_pkt.dst_mac == my_mac || p2p_pkt.dst_mac == BROADCAST) { |
|---|
| | 440 | nrk_led_set(GREEN_LED); |
|---|
| | 441 | // Packet arrived and is good to go |
|---|
| | 442 | printf( "Mac: %x%x%x",p2p_pkt.subnet_mac[0], p2p_pkt.subnet_mac[1], p2p_pkt.subnet_mac[2]); |
|---|
| | 443 | printf( "%x ",p2p_pkt.src_mac); |
|---|
| | 444 | printf( "| RSSI: %d ",p2p_pkt.rssi); |
|---|
| | 445 | printf( "| Type: %d \r\n",p2p_pkt.pkt_type); |
|---|
| | 446 | } |
|---|
| | 447 | } |
|---|
| | 448 | // Release the RX buffer so future packets can arrive |
|---|
| | 449 | bmac_rx_pkt_release (); |
|---|
| | 450 | } |
|---|
| | 451 | nrk_time_get (¤t); |
|---|
| | 452 | if (start.secs + PING_WAIT_SECS < current.secs) |
|---|
| | 453 | break; |
|---|
| | 454 | } |
|---|
| | 455 | nrk_kprintf (PSTR ("\r\nDone Waiting for Response...\r\n")); |
|---|
| | 456 | nrk_led_clr(GREEN_LED); |
|---|
| | 457 | } |
|---|
| | 458 | |
|---|
| | 459 | //**************************UPDATE MODE*********************************************************** |
|---|
| | 460 | |
|---|
| | 461 | // Run update Mode Protocol |
|---|
| | 462 | void updateMode() |
|---|
| | 463 | { |
|---|
| | 464 | // Set destination |
|---|
| | 465 | val=bmac_addr_decode_set_my_mac(((uint16_t)my_subnet_mac<<8)|my_mac); |
|---|
| | 466 | val=bmac_addr_decode_dest_mac(((uint16_t)dest_mac[1]<<8)|dest_mac[0]); |
|---|
| | 467 | bmac_addr_decode_enable(); |
|---|
| | 468 | |
|---|
| | 469 | while(programState == UPDATE) |
|---|
| 228 | | // Wait for packets or timeout |
|---|
| 229 | | #ifdef TXT_DEBUG |
|---|
| 230 | | nrk_kprintf (PSTR ("\r\nExpecting Reply\r\n")); |
|---|
| 231 | | #endif |
|---|
| 232 | | |
|---|
| 233 | | timeout.secs = REPLY_WAIT_SECS; |
|---|
| 234 | | timeout.nano_secs = REPLY_WAIT_NANOSECS; |
|---|
| 235 | | |
|---|
| 236 | | nrk_set_next_wakeup (timeout); |
|---|
| 237 | | //bmac_wait_until_rx_pkt (); |
|---|
| 238 | | my_sigs = nrk_event_wait (SIG (rx_signal) | SIG (nrk_wakeup_signal)); |
|---|
| 239 | | |
|---|
| 240 | | if (my_sigs == 0) |
|---|
| 241 | | nrk_kprintf (PSTR ("Error calling nrk_event_wait()\r\n")); |
|---|
| 242 | | if (my_sigs & SIG (rx_signal)) { |
|---|
| | 511 | // Wait for packets or timeout |
|---|
| | 512 | #ifdef TXT_DEBUG |
|---|
| | 513 | nrk_kprintf (PSTR ("\r\nExpecting Reply\r\n")); |
|---|
| | 514 | #endif |
|---|
| | 515 | timeout.secs = REPLY_WAIT_SECS; |
|---|
| | 516 | timeout.nano_secs = REPLY_WAIT_NANOSECS; |
|---|
| | 517 | |
|---|
| | 518 | nrk_set_next_wakeup (timeout); |
|---|
| | 519 | my_sigs = nrk_event_wait (SIG (rx_signal) | SIG (nrk_wakeup_signal)); |
|---|
| | 520 | |
|---|
| | 521 | if (my_sigs == 0) |
|---|
| | 522 | nrk_kprintf (PSTR ("Error calling nrk_event_wait()\r\n")); |
|---|
| | 523 | if (my_sigs & SIG (rx_signal)) |
|---|
| | 524 | { |
|---|
| 244 | | local_rx_buf = bmac_rx_pkt_get (&len, &rssi); |
|---|
| 245 | | nrk_led_clr (ORANGE_LED); |
|---|
| 246 | | #ifdef TXT_DEBUG |
|---|
| 247 | | nrk_kprintf (PSTR ("Recieved Reply\r\n")); |
|---|
| 248 | | #endif |
|---|
| 249 | | // Check if INIT Success |
|---|
| 250 | | // Release the RX buffer inside |
|---|
| 251 | | if (txState == INIT){ |
|---|
| 252 | | initStatus(); |
|---|
| 253 | | } |
|---|
| 254 | | else if (txState == START){ |
|---|
| 255 | | initStatus(); |
|---|
| 256 | | } |
|---|
| 257 | | else |
|---|
| 258 | | bmac_rx_pkt_release (); |
|---|
| 259 | | } |
|---|
| 260 | | else { |
|---|
| 261 | | #ifdef TXT_DEBUG |
|---|
| 262 | | nrk_kprintf (PSTR ("Timed Out Waiting for response...\r\n")); |
|---|
| 263 | | #endif |
|---|
| 264 | | } |
|---|
| 265 | | } |
|---|
| 266 | | //*********************************************************** |
|---|
| 267 | | nrk_wait_until_next_period (); |
|---|
| 268 | | } |
|---|
| 269 | | } |
|---|
| | 526 | local_rx_buf = bmac_rx_pkt_get (&len, &rssi); |
|---|
| | 527 | nrk_led_clr (ORANGE_LED); |
|---|
| | 528 | #ifdef TXT_DEBUG |
|---|
| | 529 | nrk_kprintf (PSTR ("Recieved Reply\r\n")); |
|---|
| | 530 | #endif |
|---|
| | 531 | // Handle recieved packet |
|---|
| | 532 | updateReplyRecieved(); |
|---|
| | 533 | } |
|---|
| | 534 | else |
|---|
| | 535 | { |
|---|
| | 536 | #ifdef TXT_DEBUG |
|---|
| | 537 | nrk_kprintf (PSTR ("Timed Out Waiting for response...\r\n")); |
|---|
| | 538 | #endif |
|---|
| | 539 | } |
|---|
| | 540 | } |
|---|
| | 541 | nrk_wait_until_next_period(); |
|---|
| | 542 | } |
|---|
| | 543 | } |
|---|
| | 544 | |
|---|
| | 545 | |
|---|
| | 546 | // Update Protocol reply recieved |
|---|
| | 547 | void updateReplyRecieved() |
|---|
| | 548 | { |
|---|
| | 549 | // Check if INIT Success |
|---|
| | 550 | // Release the RX buffer inside |
|---|
| | 551 | if (txState == INIT){ |
|---|
| | 552 | initStatus(); |
|---|
| | 553 | } |
|---|
| | 554 | else if (txState == START){ |
|---|
| | 555 | startStatus(); |
|---|
| | 556 | } |
|---|
| | 557 | else |
|---|
| | 558 | bmac_rx_pkt_release (); |
|---|
| | 559 | } |
|---|
| | 560 | |
|---|