ATMEL PLC PHY TX Test Console Application.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
#include <string.h>
#include "FreeRTOS.h"
#include "task.h"
#include "board.h"
#include "asf.h"
#include "math.h"
#include "atpl230.h"
#include "atpl230_version.h"
#include "conf_atpl230.h"
#include "phy_embedded_app.h"
#include "conf_example.h"
Macros | |
#define | mainMONITOR_BLOCK_TIME (1000 / portTICK_RATE_MS) |
#define | mainMONITOR_TIMER_RATE (500 / portTICK_RATE_MS) |
#define | MENU_CONSOLE "\n\rPHY-Console>" |
#define | MENU_COUPLING |
#define | MENU_DATA_MODE |
#define | MENU_HEADER |
#define | MENU_IMPEDANCE |
#define | MENU_MODE |
#define | MENU_SCHEME |
#define | STRING_EOL "\r" |
#define | STRING_HEADER |
#define | WATCHDOG_1s 1000000 |
#define | WATCHDOG_5s 5000000 |
Functions | |
static void | auto_impedance_mode (void) |
Auto impedance mode. More... | |
static void | configure_dbg_console (void) |
Configure UART console. More... | |
static void | display_config (void) |
Display current information. More... | |
static void | execute_tx_test (void) |
Execute TX test. More... | |
static void | fill_msg_fixed (void) |
Fill data message in fixed mode. More... | |
static void | fill_msg_manual (void) |
Fill data message in manual mode. More... | |
static void | fill_msg_random (void) |
Fill data message in random mode. More... | |
static void | fix_impedance_mode (uint8_t uc_impedance) |
Fix impedance mode. More... | |
static void | get_data_len (void) |
Get Length of data to transmit. More... | |
static void | get_impedance_mode (void) |
Get Autodetect Impedance mode. More... | |
static void | get_transmission_att_level (void) |
Get ID of attenuation level. More... | |
static void | get_transmission_buffer_id (void) |
Get ID of transmission buffer. More... | |
static void | get_transmission_channel (void) |
Get ID of channel in transmission. More... | |
static void | get_transmission_coupling (void) |
Get ID of coupling board. More... | |
static void | get_transmission_data (void) |
Get Transmission Data. More... | |
static void | get_transmission_disable_rx (void) |
Get disable RX configuration. More... | |
static void | get_transmission_mode (void) |
Get Transmission Mode. More... | |
static void | get_transmission_period (void) |
Get Period of transmission. More... | |
static void | get_transmission_scheme (void) |
Get scheme of modulation. More... | |
static uint8_t | load_config (void) |
Get configuration parameters from GPBR. More... | |
int | main (void) |
Main code entry point.0. More... | |
static void | prvProcessMonitorTasks (xTimerHandle pxTimer) |
Display scheduler activity led. More... | |
static void | prvSetupHardware (void) |
Configure the hardware. More... | |
static void | save_config (uint8_t cmd_start_mode) |
Set configuration parameters in GPBR. More... | |
void | vApplicationIdleHook (void) |
void | vApplicationMallocFailedHook (void) |
void | vApplicationStackOverflowHook (xTaskHandle pxTask, signed char *pcTaskName) |
void | vApplicationTickHook (void) |
Variables | |
uint8_t | ucv_tx_data_buffer [512] |
static txPhyEmbeddedConfig_t | xAppPhyCfgTx |
#define mainMONITOR_BLOCK_TIME (1000 / portTICK_RATE_MS) |
Referenced by main().
#define mainMONITOR_TIMER_RATE (500 / portTICK_RATE_MS) |
Referenced by main().
#define MENU_CONSOLE "\n\rPHY-Console>" |
Referenced by display_config(), fill_msg_fixed(), fill_msg_manual(), fill_msg_random(), get_impedance_mode(), get_transmission_att_level(), get_transmission_buffer_id(), get_transmission_channel(), get_transmission_coupling(), get_transmission_disable_rx(), get_transmission_mode(), get_transmission_period(), get_transmission_scheme(), and main().
#define MENU_COUPLING |
Referenced by get_transmission_coupling().
#define MENU_DATA_MODE |
Referenced by get_transmission_data().
#define MENU_HEADER |
Referenced by main().
#define MENU_IMPEDANCE |
Referenced by get_impedance_mode().
#define MENU_MODE |
Referenced by get_transmission_mode().
#define MENU_SCHEME |
Referenced by get_transmission_scheme().
#define STRING_EOL "\r" |
#define STRING_HEADER |
Referenced by main().
#define WATCHDOG_1s 1000000 |
#define WATCHDOG_5s 5000000 |
Referenced by main().
|
static |
Auto impedance mode.
References HI_STATE, txPhyEmbeddedConfig_t::uc_autodetect, and txPhyEmbeddedConfig_t::uc_impedance.
Referenced by get_impedance_mode().
|
static |
Configure UART console.
References uart_rs232_options::baudrate, CONF_UART, CONF_UART_BAUDRATE, CONF_UART_ID, CONF_UART_PARITY, stdio_serial_init(), and sysclk_enable_peripheral_clock().
Referenced by main().
|
static |
Display current information.
References ATPLCOUP000_v1, ATPLCOUP000_v2, ATPLCOUP001_v1, ATPLCOUP002_v1, ATPLCOUP002_v2, ATPLCOUP003_v1, ATPLCOUP004_v1, ATPLCOUP005_v1, ATPLCOUP006_v1, xPhyMsgTx_t::att_level, xPhyMsgTx_t::data_len, xPhyMsgTx_t::disable_rx, HI_STATE, LO_STATE, MENU_CONSOLE, xPhyMsgTx_t::mode, MODE_TYPE_A, MODE_TYPE_B, MODE_TYPE_BC, PROTOCOL_D8PSK, PROTOCOL_D8PSK_VTB, PROTOCOL_DBPSK, PROTOCOL_DBPSK_ROBO, PROTOCOL_DBPSK_VTB, PROTOCOL_DQPSK, PROTOCOL_DQPSK_ROBO, PROTOCOL_DQPSK_VTB, xPhyMsgTx_t::scheme, txPhyEmbeddedConfig_t::uc_autodetect, xPhyMsgTx_t::uc_buff_id, txPhyEmbeddedConfig_t::uc_channel, txPhyEmbeddedConfig_t::uc_coupling, txPhyEmbeddedConfig_t::uc_impedance, txPhyEmbeddedConfig_t::ul_tx_period, VLO_STATE, and txPhyEmbeddedConfig_t::xPhyMsg.
Referenced by main().
|
static |
|
static |
Fill data message in fixed mode.
References ADDR_APP_PHY_MESSAGE_DATA, xPhyMsgTx_t::data_buf, xPhyMsgTx_t::data_len, flash_erase_page(), flash_unlock(), flash_write(), MENU_CONSOLE, ucv_tx_data_buffer, and txPhyEmbeddedConfig_t::xPhyMsg.
Referenced by get_transmission_data(), and main().
|
static |
Fill data message in manual mode.
References ADDR_APP_PHY_MESSAGE_DATA, CONSOLE_UART, xPhyMsgTx_t::data_buf, xPhyMsgTx_t::data_len, flash_erase_page(), flash_unlock(), flash_write(), MENU_CONSOLE, uart_read(), ucv_tx_data_buffer, wdt_restart(), and txPhyEmbeddedConfig_t::xPhyMsg.
Referenced by get_transmission_data().
|
static |
Fill data message in random mode.
References ADDR_APP_PHY_MESSAGE_DATA, xPhyMsgTx_t::data_buf, xPhyMsgTx_t::data_len, flash_erase_page(), flash_unlock(), flash_write(), MENU_CONSOLE, pmc_enable_periph_clk(), ucv_tx_data_buffer, and txPhyEmbeddedConfig_t::xPhyMsg.
Referenced by get_transmission_data().
|
static |
Fix impedance mode.
References txPhyEmbeddedConfig_t::uc_autodetect, and txPhyEmbeddedConfig_t::uc_impedance.
Referenced by get_impedance_mode().
|
static |
Get Length of data to transmit.
References CONSOLE_UART, xPhyMsgTx_t::data_len, uart_read(), wdt_restart(), and txPhyEmbeddedConfig_t::xPhyMsg.
Referenced by get_transmission_data().
|
static |
Get Autodetect Impedance mode.
References auto_impedance_mode(), CONSOLE_UART, fix_impedance_mode(), HI_STATE, LO_STATE, MENU_CONSOLE, MENU_IMPEDANCE, uart_read(), VLO_STATE, and wdt_restart().
Referenced by main().
|
static |
Get ID of attenuation level.
References xPhyMsgTx_t::att_level, CONSOLE_UART, MENU_CONSOLE, uart_read(), wdt_restart(), and txPhyEmbeddedConfig_t::xPhyMsg.
Referenced by main().
|
static |
Get ID of transmission buffer.
References CONSOLE_UART, MENU_CONSOLE, uart_read(), xPhyMsgTx_t::uc_buff_id, wdt_restart(), and txPhyEmbeddedConfig_t::xPhyMsg.
Referenced by main().
|
static |
Get ID of channel in transmission.
References CONSOLE_UART, MENU_CONSOLE, uart_read(), txPhyEmbeddedConfig_t::uc_channel, and wdt_restart().
Referenced by main().
|
static |
Get ID of coupling board.
References ATPLCOUP000_v1, ATPLCOUP000_v2, ATPLCOUP001_v1, ATPLCOUP002_v1, ATPLCOUP002_v2, ATPLCOUP003_v1, ATPLCOUP004_v1, ATPLCOUP005_v1, ATPLCOUP006_v1, CONSOLE_UART, MENU_CONSOLE, MENU_COUPLING, uart_read(), txPhyEmbeddedConfig_t::uc_coupling, and wdt_restart().
Referenced by main().
|
static |
Get Transmission Data.
References CONSOLE_UART, fill_msg_fixed(), fill_msg_manual(), fill_msg_random(), get_data_len(), MENU_DATA_MODE, uart_read(), and wdt_restart().
Referenced by main().
|
static |
Get disable RX configuration.
References CONSOLE_UART, xPhyMsgTx_t::disable_rx, MENU_CONSOLE, uart_read(), wdt_restart(), and txPhyEmbeddedConfig_t::xPhyMsg.
Referenced by main().
|
static |
Get Transmission Mode.
References CONSOLE_UART, MENU_CONSOLE, MENU_MODE, xPhyMsgTx_t::mode, MODE_TYPE_A, MODE_TYPE_B, MODE_TYPE_BC, uart_read(), wdt_restart(), and txPhyEmbeddedConfig_t::xPhyMsg.
Referenced by main().
|
static |
Get Period of transmission.
References CONSOLE_UART, MENU_CONSOLE, uart_read(), txPhyEmbeddedConfig_t::ul_tx_period, and wdt_restart().
Referenced by main().
|
static |
Get scheme of modulation.
References CONSOLE_UART, MENU_CONSOLE, MENU_SCHEME, xPhyMsgTx_t::scheme, uart_read(), wdt_restart(), and txPhyEmbeddedConfig_t::xPhyMsg.
Referenced by main().
|
static |
Get configuration parameters from GPBR.
References ADDR_APP_PHY_MESSAGE_DATA, xPhyMsgTx_t::att_level, xPhyMsgTx_t::data_len, xPhyMsgTx_t::disable_rx, GPBR0, GPBR1, GPBR2, gpbr_read(), xPhyMsgTx_t::mode, PHY_APP_CMD_DEFAULT_MODE, PHY_APP_CMD_MENU_START_MODE, PHY_APP_CMD_TX_START_MODE, xPhyMsgTx_t::scheme, txPhyEmbeddedConfig_t::uc_autodetect, xPhyMsgTx_t::uc_buff_id, txPhyEmbeddedConfig_t::uc_channel, txPhyEmbeddedConfig_t::uc_coupling, txPhyEmbeddedConfig_t::uc_impedance, ucv_tx_data_buffer, txPhyEmbeddedConfig_t::ul_tx_period, and txPhyEmbeddedConfig_t::xPhyMsg.
Referenced by main().
int main | ( | void | ) |
Main code entry point.0.
References atpl230Cfg, atpl230Cfg_t::atplCoupling, xPhyMsgTx_t::att_level, BOARD_FREQ_SLCK_XTAL, configASSERT, configure_dbg_console(), CONSOLE_UART, xPhyMsgTx_t::data_buf, xPhyMsgTx_t::data_len, xPhyMsgTx_t::disable_rx, display_config(), execute_tx_test(), fill_msg_fixed(), get_impedance_mode(), get_transmission_att_level(), get_transmission_buffer_id(), get_transmission_channel(), get_transmission_coupling(), get_transmission_data(), get_transmission_disable_rx(), get_transmission_mode(), get_transmission_period(), get_transmission_scheme(), load_config(), mainMONITOR_BLOCK_TIME, mainMONITOR_TIMER_RATE, MENU_CONSOLE, MENU_HEADER, xPhyMsgTx_t::mode, MODE_TYPE_A, pdTRUE, PHY_APP_CMD_DEFAULT_MODE, PHY_APP_CMD_TX_START_MODE, phy_get_cfg_param(), PHY_ID_CFG_AUTODETECT_BRANCH, PHY_ID_CFG_IMPEDANCE, phy_init(), PHY_TX_SCHEDULING_MODE_RELATIVE, PROTOCOL_DBPSK_VTB, prvProcessMonitorTasks(), prvSetupHardware(), save_config(), xPhyMsgTx_t::scheme, STRING_HEADER, xPhyMsgTx_t::tdelay, xPhyMsgTx_t::tmode, atpl230Cfg_t::txrxChannel, uart_read(), txPhyEmbeddedConfig_t::uc_autodetect, xPhyMsgTx_t::uc_buff_id, txPhyEmbeddedConfig_t::uc_channel, txPhyEmbeddedConfig_t::uc_coupling, txPhyEmbeddedConfig_t::uc_impedance, ucv_tx_data_buffer, txPhyEmbeddedConfig_t::ul_tx_period, WATCHDOG_5s, wdt_get_timeout_value(), wdt_init(), wdt_restart(), txPhyEmbeddedConfig_t::xPhyMsg, xTimerCreate(), and xTimerStart.
|
static |
|
static |
Configure the hardware.
References board_init(), FLASH_ACCESS_MODE_128, flash_init(), IOPORT_DIR_OUTPUT, IOPORT_PIN_LEVEL_LOW, IOPORT_PIOA, IOPORT_PIOB, IOPORT_PIOC, ioport_set_port_dir(), ioport_set_port_level(), LED_Toggle, and sysclk_init().
Referenced by main().
|
static |
Set configuration parameters in GPBR.
References xPhyMsgTx_t::att_level, xPhyMsgTx_t::data_len, xPhyMsgTx_t::disable_rx, GPBR0, GPBR1, GPBR2, gpbr_write(), xPhyMsgTx_t::mode, xPhyMsgTx_t::scheme, txPhyEmbeddedConfig_t::uc_autodetect, xPhyMsgTx_t::uc_buff_id, txPhyEmbeddedConfig_t::uc_channel, txPhyEmbeddedConfig_t::uc_coupling, txPhyEmbeddedConfig_t::uc_impedance, txPhyEmbeddedConfig_t::ul_tx_period, and txPhyEmbeddedConfig_t::xPhyMsg.
Referenced by main().
void vApplicationIdleHook | ( | void | ) |
Referenced by portTASK_FUNCTION().
void vApplicationMallocFailedHook | ( | void | ) |
References taskDISABLE_INTERRUPTS.
Referenced by pvPortMalloc().
void vApplicationStackOverflowHook | ( | xTaskHandle | pxTask, |
signed char * | pcTaskName | ||
) |
References taskDISABLE_INTERRUPTS.
void vApplicationTickHook | ( | void | ) |
Referenced by vTaskIncrementTick().
uint8_t ucv_tx_data_buffer[512] |
Referenced by fill_msg_fixed(), fill_msg_manual(), fill_msg_random(), load_config(), and main().
|
static |