This module provides configuration and utils to serialize the PLC PHY layer.
#define IFACE_SERIAL_ENABLE 0x1 |
#define IFACE_SNIFFER_ENABLE 0x2 |
#define SERIAL_IF_PHY_COMMAND_CMD_CFG 4 /* Get reception configuration query */ |
#define SERIAL_IF_PHY_COMMAND_CMD_CFG_RSP 5 /* Get reception configuration response */ |
#define SERIAL_IF_PHY_COMMAND_GET_CFG 0 /* Get reception configuration query */ |
#define SERIAL_IF_PHY_COMMAND_GET_CFG_LIST 11 /* Get parameter list */ |
#define SERIAL_IF_PHY_COMMAND_GET_CFG_LIST_RSP 12 /* Parameter list response */ |
#define SERIAL_IF_PHY_COMMAND_GET_CFG_RSP 1 /* Get reception configuration response */ |
#define SERIAL_IF_PHY_COMMAND_NOISE_REQ 9 /* Set noise capture mode */ |
#define SERIAL_IF_PHY_COMMAND_NOISE_RSP 10 /* Get noise capture */ |
#define SERIAL_IF_PHY_COMMAND_RECEIVE_MSG 8 /* Receive message data */ |
#define SERIAL_IF_PHY_COMMAND_RESET_PHY_LAYER 13 /* Reset phy layer */ |
#define SERIAL_IF_PHY_COMMAND_SEND_MSG 6 /* Send message data */ |
#define SERIAL_IF_PHY_COMMAND_SEND_MSG_RSP 7 /* Send message data response */ |
#define SERIAL_IF_PHY_COMMAND_SET_CFG 2 /* Set reception configuration command */ |
#define SERIAL_IF_PHY_COMMAND_SET_CFG_RSP 3 /* Set reception configuration response */ |
#define TASK_SERIAL_IF_GET_RX_PRIO (tskIDLE_PRIORITY + 1) |
#define TASK_SERIAL_IF_GET_RX_STACK (configMINIMAL_STACK_SIZE * 1) |
#define TASK_SERIAL_IF_GET_TX_RESULT_PRIO (tskIDLE_PRIORITY + 1) |
#define TASK_SERIAL_IF_GET_TX_RESULT_STACK (configMINIMAL_STACK_SIZE * 1) |
static void _memcpy_rev |
( |
uint8_t * |
puc_dst, |
|
|
uint8_t * |
puc_buf, |
|
|
uint16_t |
us_len |
|
) |
| |
|
static |
Memcopy with byte order reversal.
Copies puc_buf[] into puc_dst[], re-ordering the bytes to adapt to the serial communication.
- Parameters
-
puc_dst | Pointer to buffer where the data will be copied |
puc_buf | Pointer to buffer data |
us_len | Length of data to copy |
Referenced by serial_if_api_parser().
static void _serial_if_get_rx_task |
( |
void * |
pvParameters | ) |
|
|
static |
Task to manage the serialization of the reception message through USI.
- Parameters
-
pvParameters | Pointer that will be used as the parameter for the task being created. |
References xPhyMsgRx_t::cinr_avg, xPhyMsgRx_t::data_buf, xPhyMsgRx_t::data_len, xPhyMsgRx_t::evm_header, xPhyMsgRx_t::evm_header_acum, xPhyMsgRx_t::evm_payload, xPhyMsgRx_t::evm_payload_acum, xPhyMsgRx_t::header_type, xPhyMsgRx_t::mode, MODE_NOISE, MODE_TYPE_A, xPhyMsgRx_t::noise_result, phy_get_cfg_param(), PHY_ID_CFG_TXRX_CHANNEL, phy_rx_frame_cb(), x_usi_serial_cmd_params::ptr_buf, xPhyMsgRx_t::rssi_avg, xPhyMsgRx_t::scheme, SERIAL_IF_PHY_COMMAND_NOISE_RSP, SERIAL_IF_PHY_COMMAND_RECEIVE_MSG, xPhyMsgRx_t::uc_buff_id, uc_serial_data_buf, UNUSED, x_usi_serial_cmd_params::us_len, and usi_send_cmd().
Referenced by serial_if_check_rx_msg().
static void _serial_if_get_tx_result_task |
( |
void * |
pvParameters | ) |
|
|
static |
Task to manage the serialization of the result of transmission through USI.
- Parameters
-
pvParameters | Pointer that will be used as the parameter for the task being created. |
References phy_get_cfg_param(), PHY_ID_CFG_TXRX_CHANNEL, phy_tx_frame_result_cb(), x_usi_serial_cmd_params::ptr_buf, xPhyMsgTxResult_t::rms_calc, SERIAL_IF_PHY_COMMAND_SEND_MSG_RSP, xPhyMsgTxResult_t::uc_id_buffer, xPhyMsgTxResult_t::uc_result, UNUSED, x_usi_serial_cmd_params::us_len, and usi_send_cmd().
Referenced by serial_if_check_tx_result().
int8_t Dummy_serial_send_cmd |
( |
void * |
msg | ) |
|
Default serial interface for unused USI.
References UNUSED.
uint8_t serial_if_api_parser |
( |
uint8_t * |
puc_rx_msg, |
|
|
uint16_t |
us_len |
|
) |
| |
Received message.
- Parameters
-
puc_rx_msg | Pointer to the data attached to the connection request |
us_len | Data length of the data attached to the request |
- Return values
-
true | if there is no error |
false | if length is invalid or serial command is wrong |
References _memcpy_rev(), ATPL230_TXRXBUF_NOISECONF_EBN_Msk, ATPL230_TXRXBUF_NOISECONF_FTN_Msk, ATPL230_TXRXBUF_NOISECONF_NS_Msk, xPhyMsgTx_t::att_level, xPhyMsgTx_t::data_buf, xPhyMsgTx_t::data_len, xPhyMsgTx_t::disable_rx, xPhyMsgTx_t::mode, MODE_TYPE_A, PHY_CFG_SUCCESS, PHY_CMD_CFG_OR, phy_cmd_cfg_param(), phy_get_cfg_param(), phy_reset(), PHY_RESET_HARD_TYPE, PHY_RESET_SOFT_TYPE, phy_set_cfg_param(), phy_tx_frame(), x_usi_serial_cmd_params::ptr_buf, REG_ATPL230_TXRXBUF_NOISECONF, REG_ATPL230_TXRXBUF_RECTIME_NOISE1, REG_ATPL230_VHIGH_TIMER_BEACON_REF, xPhyMsgTx_t::scheme, SERIAL_IF_PHY_COMMAND_CMD_CFG, SERIAL_IF_PHY_COMMAND_CMD_CFG_RSP, SERIAL_IF_PHY_COMMAND_GET_CFG, SERIAL_IF_PHY_COMMAND_GET_CFG_LIST, SERIAL_IF_PHY_COMMAND_GET_CFG_LIST_RSP, SERIAL_IF_PHY_COMMAND_GET_CFG_RSP, SERIAL_IF_PHY_COMMAND_NOISE_REQ, SERIAL_IF_PHY_COMMAND_NOISE_RSP, SERIAL_IF_PHY_COMMAND_RESET_PHY_LAYER, SERIAL_IF_PHY_COMMAND_SEND_MSG, SERIAL_IF_PHY_COMMAND_SEND_MSG_RSP, SERIAL_IF_PHY_COMMAND_SET_CFG, SERIAL_IF_PHY_COMMAND_SET_CFG_RSP, xPhyMsgTx_t::tdelay, xPhyMsgTx_t::tmode, xPhyMsgTx_t::uc_buff_id, uc_serial_data_buf, x_usi_serial_cmd_params::us_len, and usi_send_cmd().
Referenced by _process_msg().
void serial_if_check_rx_msg |
( |
void |
| ) |
|
void serial_if_check_tx_result |
( |
void |
| ) |
|
void serial_if_init |
( |
void |
| ) |
|
uint8_t uc_serial_data_buf[808] |
|
static |
uint8_t uc_serial_rsp_buf[808] |
|
static |