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_mcps_purge_conf (uint8_t msduHandle, uint8_t status) |
Callback function that must be implemented by application (NHLE) for MAC service MCPS-PURGE.confirm. More... | |
void | usr_mlme_associate_conf (uint16_t AssocShortAddress, uint8_t status) |
Callback function that must be implemented by application (NHLE) for MAC service MLME-ASSOCIATE.confirm. More... | |
void | usr_mlme_associate_ind (uint64_t DeviceAddress, uint8_t CapabilityInformation) |
Callback function that must be implemented by application (NHLE) for MAC service MLME-ASSOCIATE.indication. More... | |
void | usr_mlme_beacon_notify_ind (uint8_t BSN, wpan_pandescriptor_t *PANDescriptor, uint8_t PendAddrSpec, uint8_t *AddrList, uint8_t sduLength, uint8_t *sdu) |
Callback function that must be implemented by application (NHLE) for MAC service MLME-BEACON-NOTIFY.indication. More... | |
void | usr_mlme_comm_status_ind (wpan_addr_spec_t *SrcAddrSpec, wpan_addr_spec_t *DstAddrSpec, uint8_t status) |
Callback function that must be implemented by application (NHLE) for MAC service MLME-COMM-STATUS.indication. More... | |
void | usr_mlme_disassociate_conf (uint8_t status, wpan_addr_spec_t *DeviceAddrSpec) |
Callback function that must be implemented by application (NHLE) for MAC service MLME-DISASSOCIATE.confirm. More... | |
void | usr_mlme_disassociate_ind (uint64_t DeviceAddress, uint8_t DisassociateReason) |
Callback function that must be implemented by application (NHLE) for MAC service MLME-DISASSOCIATE.indication. More... | |
void | usr_mlme_get_conf (uint8_t status, uint8_t PIBAttribute, void *PIBAttributeValue) |
Callback function that must be implemented by application (NHLE) for MAC service MLME-GET.confirm. More... | |
void | usr_mlme_gts_conf (gts_char_t GtsChar, uint8_t status) |
void | usr_mlme_gts_ind (uint16_t DeviceAddr, gts_char_t GtsChar) |
void | usr_mlme_orphan_ind (uint64_t OrphanAddress) |
Callback function that must be implemented by application (NHLE) for MAC service MLME-ORPHAN.indication. More... | |
void | usr_mlme_poll_conf (uint8_t status) |
Callback function that must be implemented by application (NHLE) for MAC service MLME-POLL.confirm. 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_rx_enable_conf (uint8_t status) |
Callback function that must be implemented by application (NHLE) for MAC service MLME-RX-ENABLE.confirm. More... | |
void | usr_mlme_scan_conf (uint8_t status, uint8_t ScanType, uint8_t ChannelPage, uint32_t UnscannedChannels, uint8_t ResultListSize, void *ResultList) |
Callback function that must be implemented by application (NHLE) for MAC service MLME-SCAN.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_start_conf (uint8_t status) |
Callback function that must be implemented by application (NHLE) for MAC service MLME-START.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_count, head, SIO_BUF_COUNT, sio_tx_buf, and SOT.
Referenced by usr_mcps_data_conf(), usr_mcps_data_ind(), usr_mcps_purge_conf(), usr_mlme_associate_conf(), usr_mlme_associate_ind(), usr_mlme_beacon_notify_ind(), usr_mlme_comm_status_ind(), usr_mlme_disassociate_conf(), usr_mlme_disassociate_ind(), usr_mlme_get_conf(), usr_mlme_gts_conf(), usr_mlme_gts_ind(), usr_mlme_orphan_ind(), usr_mlme_poll_conf(), usr_mlme_reset_conf(), usr_mlme_rx_enable_conf(), usr_mlme_scan_conf(), usr_mlme_set_conf(), usr_mlme_start_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_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, 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.
Referenced by process_incoming_sio_data(), and serial_data_handler().
|
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().