![]() |
Synergy Software Package User's Manual
|
RTOS-integrated Console Framework. More...
Data Structures | |
| struct | sf_console_instance_ctrl_t |
Macros | |
| #define | SF_CONSOLE_CODE_VERSION_MAJOR (2U) |
Functions | |
| ssp_err_t | SF_CONSOLE_Open (sf_console_ctrl_t *const p_api_ctrl, sf_console_cfg_t const *const p_cfg) |
| Initialize console framework and open low-level communication driver. More... | |
| ssp_err_t | SF_CONSOLE_Close (sf_console_ctrl_t *const p_api_ctrl) |
| Close the communications driver. More... | |
| ssp_err_t | SF_CONSOLE_Parse (sf_console_ctrl_t *const p_api_ctrl, sf_console_menu_t const *const p_menu, uint8_t const *const p_input, uint32_t const bytes) |
| Looks for input string in menu, and calls callback function if found. More... | |
| ssp_err_t | SF_CONSOLE_Prompt (sf_console_ctrl_t *const p_api_ctrl, sf_console_menu_t const *const p_menu, UINT const timeout) |
| Prompt the user to input a command. More... | |
| ssp_err_t | SF_CONSOLE_Read (sf_console_ctrl_t *const p_api_ctrl, uint8_t *const p_dest, uint32_t const bytes, uint32_t const timeout) |
| Reads data into the destination byte by byte and echos input to the console. More... | |
| ssp_err_t | SF_CONSOLE_Write (sf_console_ctrl_t *const p_api_ctrl, uint8_t const *const p_src, uint32_t const timeout) |
| Write a NULL terminated string to the console. More... | |
| ssp_err_t | SF_CONSOLE_ArgumentFind (uint8_t const *const p_arg, uint8_t const *const p_str, int32_t *const p_index, int32_t *const p_data) |
| Finds a command line argument in an input string and returns the index of the character immediately following the argument and any string numbers converted to integers. More... | |
| void | SF_CONSOLE_CallbackNextMenu (sf_console_callback_args_t *p_args) |
| Callback provided to continue parsing the next menu down. More... | |
| ssp_err_t | SF_CONSOLE_VersionGet (ssp_version_t *const p_version) |
| Console version get function. More... | |
RTOS-integrated Console Framework.
This is a ThreadX aware console framework implemented using the SSP communications framework.
| #define SF_CONSOLE_CODE_VERSION_MAJOR (2U) |
Version of code that implements the API defined in this file
| ssp_err_t SF_CONSOLE_ArgumentFind | ( | uint8_t const *const | p_arg, |
| uint8_t const *const | p_str, | ||
| int32_t *const | p_index, | ||
| int32_t *const | p_data | ||
| ) |
Finds a command line argument in an input string and returns the index of the character immediately following the argument and any string numbers converted to integers.
| SSP_SUCCESS | Argument found successfully |
| SSP_ERR_ASSERTION | p_arg or p_str is NULL |
| SSP_ERR_INTERNAL | String passed after parsing command is NULL_CODE. |
Search for first letter match at beginning of word.
If the input string matches the input argument, store the index of the character following the argument in p_index and the data at that index in p_data. Then return.
| void SF_CONSOLE_CallbackNextMenu | ( | sf_console_callback_args_t * | p_args | ) |
Callback provided to continue parsing the next menu down.
| [in] | p_args | Pointer to callback arguments to use in the next menu. |
Next level menu is passed in as the user context parameter
Update current menu.
Check to see if the next menu command was input in the remaining string.
| ssp_err_t SF_CONSOLE_Close | ( | sf_console_ctrl_t *const | p_api_ctrl | ) |
Close the communications driver.
| SSP_SUCCESS | Console successfully closed |
| SSP_ERR_ASSERTION | Pointer to control block is NULL |
Close UART driver
| ssp_err_t SF_CONSOLE_Open | ( | sf_console_ctrl_t *const | p_api_ctrl, |
| sf_console_cfg_t const *const | p_cfg | ||
| ) |
Initialize console framework and open low-level communication driver.
| SSP_SUCCESS | Console channel is successfully opened |
| SSP_ERR_ASSERTION | Parameter check failed for one of the following : -Pointer to the control block is NULL -Pointer to the config block is NULL -Pointer p_cfg->p_initial_menu is NULL -Pointer p_cfg->p_comms is NULL -Pointer p_cfg->p_comms->p_api is NULL -Pointer p_cfg->p_comms->p_api->open is NULL |
Open UART driver
Store echo configuration and initial menu in control block
Prompt for input autostart is true
| ssp_err_t SF_CONSOLE_Parse | ( | sf_console_ctrl_t *const | p_api_ctrl, |
| sf_console_menu_t const *const | p_menu, | ||
| uint8_t const *const | p_input, | ||
| uint32_t const | bytes | ||
| ) |
Looks for input string in menu, and calls callback function if found.
| SSP_SUCCESS | Data parsed successfully, command found and callback called. |
| SSP_ERR_UNSUPPORTED | Command not found in the current menu. |
| SSP_ERR_ASSERTION | One or more input parameter pointers are invalid. |
Print help menu if help command is entered
Go back one menu if previous menu command is entered.
Go back to root menu if root menu command is entered.
Look for matching commands, call callback if command found.
| ssp_err_t SF_CONSOLE_Prompt | ( | sf_console_ctrl_t *const | p_api_ctrl, |
| sf_console_menu_t const *const | p_menu, | ||
| UINT const | timeout | ||
| ) |
Prompt the user to input a command.
| SSP_SUCCESS | Received valid command and called callback |
| SSP_ERR_ASSERTION | p_ctrl is NULL |
| SSP_ERR_UNSUPPORTED | Command not found in the current menu. |
Update stored current menu pointer if a new pointer is specified.
Print menu name followed by ">" to prompt for user input.
Lock the console UART framework to reserve exclusive access until the command completes.
Wait for input
Parse input and call associated user callback.
Command is complete, so unlock comms reception.
| ssp_err_t SF_CONSOLE_Read | ( | sf_console_ctrl_t *const | p_api_ctrl, |
| uint8_t *const | p_dest, | ||
| uint32_t const | bytes, | ||
| uint32_t const | timeout | ||
| ) |
Reads data into the destination byte by byte and echos input to the console.
| SSP_SUCCESS | Data read completed successfully |
| SSP_ERR_ASSERTION | Parameter check failed for one of the following : -Pointer p_dest is NULL -Pointer to the control block is NULL -Pointer p_ctrl->p_comms is NULL -Pointer p_ctrl->p_comms->p_api is NULL -Pointer p_ctrl->p_comms->p_api->lock is NULL -Pointer p_ctrl->p_comms->p_api->unlock is NULL |
Lock the communications framework reception until carriage return is received.
Read one byte at a time, checking for carriage returns, backspace, delete, and escape codes.
Unlock the communications framework reception
| ssp_err_t SF_CONSOLE_VersionGet | ( | ssp_version_t *const | p_version | ) |
Console version get function.
| [in] | p_version | Version information stored here. |
| SSP_SUCCESS | Version stored in provided pointer. |
| SSP_ERR_ASSERTION | p_version was null. |
Set version pointer
| ssp_err_t SF_CONSOLE_Write | ( | sf_console_ctrl_t *const | p_api_ctrl, |
| uint8_t const *const | p_src, | ||
| uint32_t const | timeout | ||
| ) |
Write a NULL terminated string to the console.
| SSP_SUCCESS | Data write completed successfully |
| SSP_ERR_ASSERTION | Pointer to the control block is NULL |
| SSP_ERR_INVALID_SIZE | If length passed is zero or length passed is greater than 128U (max value). |
Write null terminated string. Calculate the length. If it isn't longer than the maximum, write the entire string to the console.