Microchip® Advanced Software Framework

serial_interface.c File Reference

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 void process_incoming_sio_data ( void  )
inlinestatic

uint8_t buf_count = 0
static
uint8_t data[SIO_RX_BUF_SIZE]
static

This is the length of the message should be transmitted.

Referenced by process_incoming_sio_data(), and serial_data_handler().

uint8_t data_length = 0
static

Referenced by serial_data_handler().

uint8_t head = 0
static
uint8_t rx_index = 0
static
uint8_t sio_rx_buf[SIO_RX_BUF_SIZE]
static

This is the receive buffer of the UART.

Referenced by handle_incoming_msg(), and process_incoming_sio_data().

uint8_t sio_rx_length
static

This is the length of the message should be received.

Referenced by process_incoming_sio_data().

uint8_t* sio_rx_ptr
static

This pointer points to the next free element inside the receive buffer of the UART.

Referenced by process_incoming_sio_data().

volatile uint8_t sio_rx_state
static
uint8_t sio_tx_buf[SIO_BUF_COUNT][SIO_TX_BUF_SIZE]
static

This is the transmit buffer of the UART.

Referenced by get_next_tx_buffer(), and serial_data_handler().