Handles Serial Interface Functionalities.
Copyright (c) 2013-2018 Microchip Technology Inc. and its subsidiaries.
#include <asf.h>
#include "conf_board.h"
#include "avr2025_mac.h"
#include "serial_interface.h"
#include "sio2host.h"
Functions | |
static uint8_t * | get_next_tx_buffer (void) |
get the new buffer for next transmission through serial More... | |
static void | handle_incoming_msg (void) |
Parses the Received Data in the Buffer and Process the Commands accordingly. More... | |
static void | process_incoming_sio_data (void) |
Process data received from SIO. More... | |
void | serial_data_handler (void) |
Function to handle the state machine serial data exchange. More... | |
void | serial_interface_init (void) |
This function does the initialization of the Serial handler state Machine. More... | |
void | usr_mcps_data_conf (uint8_t msduHandle, uint8_t status, uint32_t Timestamp) |
Callback function that must be implemented by application (NHLE) for MAC service MCPS-DATA.confirm. More... | |
void | usr_mcps_data_ind (wpan_addr_spec_t *SrcAddrSpec, wpan_addr_spec_t *DstAddrSpec, uint8_t msduLength, uint8_t *msdu, uint8_t mpduLinkQuality, uint8_t DSN, uint32_t Timestamp, uint8_t SecurityLevel, uint8_t KeyIdMode, uint8_t KeyIndex) |
Callback function that must be implemented by application (NHLE) for MAC service MCPS-DATA.indication. More... | |
void | usr_mlme_reset_conf (uint8_t status) |
Callback function that must be implemented by application (NHLE) for MAC service MLME-RESET.confirm. More... | |
void | usr_mlme_set_conf (uint8_t status, uint8_t PIBAttribute) |
Callback function that must be implemented by application (NHLE) for MAC service MLME-SET.confirm. More... | |
void | usr_mlme_sync_loss_ind (uint8_t LossReason, uint16_t PANId, uint8_t LogicalChannel, uint8_t ChannelPage) |
Callback function that must be implemented by application (NHLE) for MAC service MLME-SYNC-LOSS.indication. More... | |
Variables | |
static uint8_t | buf_count = 0 |
static uint8_t | data [SIO_RX_BUF_SIZE] |
This is the length of the message should be transmitted. More... | |
static uint8_t | data_length = 0 |
static uint8_t | head = 0 |
static uint8_t | rx_index = 0 |
static uint8_t | sio_rx_buf [SIO_RX_BUF_SIZE] |
This is the receive buffer of the UART. More... | |
static uint8_t | sio_rx_length |
This is the length of the message should be received. More... | |
static uint8_t * | sio_rx_ptr |
This pointer points to the next free element inside the receive buffer of the UART. More... | |
static volatile uint8_t | sio_rx_state |
This is the receiver state of the UART. More... | |
static uint8_t | sio_tx_buf [SIO_BUF_COUNT][SIO_TX_BUF_SIZE] |
This is the transmit buffer of the UART. More... | |
|
static |
get the new buffer for next transmission through serial
References buf, buf_count, head, NULL, SIO_BUF_COUNT, sio_tx_buf, and SOT.
Referenced by usr_mcps_data_conf(), usr_mcps_data_ind(), usr_mlme_reset_conf(), usr_mlme_set_conf(), and usr_mlme_sync_loss_ind().
|
static |
Parses the Received Data in the Buffer and Process the Commands accordingly.
References wpan_addr_spec_tag::Addr, wpan_addr_spec_tag::AddrMode, Assert, FCF_SHORT_ADDR, address_field_t::long_address, MAC_INC_FRAME, mac_pib, MAC_PID, MCPS_DATA_REQUEST, MCPS_PURGE_REQUEST, MLME_ASSOCIATE_REQUEST, MLME_ASSOCIATE_RESPONSE, MLME_DISASSOCIATE_REQUEST, MLME_GET_REQUEST, MLME_GTS_REQUEST, MLME_ORPHAN_RESPONSE, MLME_POLL_REQUEST, MLME_RESET_REQUEST, MLME_RX_ENABLE_REQUEST, MLME_SCAN_REQUEST, MLME_SET_REQUEST, MLME_START_REQUEST, MLME_SYNC_REQUEST, NULL, wpan_addr_spec_tag::PANId, address_field_t::short_address, sio_rx_buf, wpan_mcps_data_req(), wpan_mcps_purge_req(), wpan_mlme_associate_req(), wpan_mlme_associate_resp(), wpan_mlme_disassociate_req(), wpan_mlme_get_req(), wpan_mlme_gts_req(), wpan_mlme_orphan_resp(), wpan_mlme_poll_req(), wpan_mlme_reset_req(), wpan_mlme_rx_enable_req(), wpan_mlme_scan_req(), wpan_mlme_set_req(), wpan_mlme_start_req(), and wpan_mlme_sync_req().
Referenced by process_incoming_sio_data().
|
inlinestatic |
Process data received from SIO.
References data, EOT, handle_incoming_msg(), rx_index, sio_rx_buf, sio_rx_length, sio_rx_ptr, sio_rx_state, SOT, UART_RX_STATE_DATA, UART_RX_STATE_EOT, UART_RX_STATE_LENGTH, and UART_RX_STATE_SOT.
Referenced by serial_data_handler().
|
static |
Referenced by get_next_tx_buffer(), and serial_data_handler().
|
static |
This is the length of the message should be transmitted.
|
static |
Referenced by serial_data_handler().
|
static |
Referenced by get_next_tx_buffer(), and serial_data_handler().
|
static |
Referenced by process_incoming_sio_data(), and serial_data_handler().
|
static |
This is the receive buffer of the UART.
Referenced by handle_incoming_msg(), and process_incoming_sio_data().
|
static |
This is the length of the message should be received.
Referenced by process_incoming_sio_data().
|
static |
This pointer points to the next free element inside the receive buffer of the UART.
Referenced by process_incoming_sio_data().
|
static |
This is the receiver state of the UART.
(UART_RX_STATE_SOT, UART_RX_STATE_LENGTH, UART_RX_STATE_DATA, or UART_RX_STATE_EOT)
Referenced by process_incoming_sio_data(), and serial_interface_init().
|
static |
This is the transmit buffer of the UART.
Referenced by get_next_tx_buffer(), and serial_data_handler().