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)
 Pulls the data from UART when activated. 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 uint8_t* get_next_tx_buffer ( void  )
static

get the new buffer for next transmission through serial

Returns
unsigned integer pointer to buf

References buf_count, head, NULL, SIO_BUF_COUNT, sio_tx_buf, SOT, and tail.

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 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.

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().