The files multi_uart_tx_conf.h and multi_uart_rx_conf.h must be copied from app_multi_uart_demo\src folder to app_serial_to_ethernet_demo\src folder
UART_RX_CHAN_COUNT
Default value = 8
Define the number of channels that are to be supported, must fit in the port. Also, must be a power of 2 (i.e. 1,2,4,8) - not all channels have to be utilised
UART_TX_CHAN_COUNT
Default value = 8
Define the number of channels that are to be supported, must fit in the port. Also, must be a power of 2 (i.e. 1,2,4,8) - not all channels have to be utilised
UART_RX_MAX_BAUD
Default value = 115200
Define maximum baud rate to be supprted for any of the UART channel
UART_TX_BUF_SIZE
Default value = 8
Define the buffer size in UART word entries - needs to be a power of 2 (i.e. 1,2,4,8,16,32 etc)
The file xtcp_client_conf.h defines configuration fexibility required for XTCP clients in order to use XTCP server functions
UIP_CONF_RECEIVE_WINDOW
Default value = 128
Define window length of TCP packets that the application will receive and process for each TCP packets received from XTCP clients. Note this value will be set as default length of application buffers that will be used to hold UART data collected from XTCP clients.
XTCP_CLIENT_BUF_SIZE
Default value = 650
Define MTU size used for XTCP device packet transmissions
The file udp_discovery.h defines ports used for UDP discovery. This file can set the following defines:
UDP_RECV_BUF_SIZE
Default value = 80
Define length of UDP message buffer which holds the incoming UDP test server request or its corresponding S2E response
INCOMING_UDP_PORT
Default value = 15534
Define incoming UDP port to listen to device discovery requests from UDP test server
OUTGOING_UDP_PORT
Default value = 15533
Define outgoing UDP port in order to send device response to UDP test server
S2E_FIRMWARE_VER
Current value = 1.1.2
Define to specify S2E firmware version. This shall be updated for every release
UART_RX_FLUSH_DELAY
Default value = 20000000
If UART data received is lesser than minimum configured packet size, this defines a minimum wait time to send this data to telnet handler
The file telnet_config.h defines ports used for Telnet socket used for UART configuration.
S2E_TELNET_CONFIG_PORT
Default value = 23
Define to specify telnet port to use for UART configuration
The file srcs2e_flash.h has some constants defined which may be used by other files while accessing flash.
S2E_FLASH_ERROR
Default value = -1
Any errors (like flash not present, wrong flash, unable to write, etc...) while accessing the flash fitted on the board, are represented using this constant.
S2E_FLASH_OK
Default value = 0
All successfull flash operations are represented using this constant.
UART_CONFIG
Default value = 0
To be used as a data type parameter while calling flash routines. This also represents the sector index (relative to webpage image) in the flash where UART configuration must be stored.
IPVER
Default value = 1
To be used as a data type parameter while calling flash routines. This also represents the sector index (relative to webpage image) in the flash where IP configuration must be stored.
FLASH_CMD_SAVE
Default value = 1
Flash command to ‘save’ configuration to flash.
FLASH_CMD_RESTORE
Default value = 2
Flash command to ‘restore’ configuration from flash.
FLASH_DATA_PRESENT
Default value = $
While ‘saving’ settings to flash, this value is written as the first byte. So, on a ‘restore’ command, by reading for this sybol, we would know that some data is present in that sector of flash.
Structure to hold UART configuration details.
Structure Members:
UART Id.
One of valid parity: Odd, Even, Mark, Space, None.
Stop bits configuration: Single or Two.
Polarity setting: Start bit as 1 or 0.
Baud rate of UART channel.
Number of bits each UART character contain.
This function retrieves configuration of each UARTs from flash, and applies it to the base configuration structure of type uart_config_data_t.
Telnet port applicable for corresponding UART is also fetched from flash and applied to repective UART configuration structure. If there is no valid flash configuration, default in-program configuration with following values EvenParity-1StopBit-115200Baud-Start0Polarity-8UARTCharLen is used
Parameters: |
|
---|---|
Returns: | None |
s2e_webserver_init The S2E webserver initialization routine.
Registers all channels used by it.
Parameters: |
|
---|---|
Returns: | none |
This function initializes UART state structure, assigns configured/default telnet ports and listens on these ports, shares UART buffer references to UART handler thread.
Parameters: |
|
---|---|
Returns: | None |
This function initializes UDP discovery state, fetches S2E IP address stored in flash and references to ETH thread in order to configure device IP.
If valid IP is not present in flash, default configured IP defined from ipconfig is used
Parameters: |
|
---|---|
Returns: | None |
This function configures UARTs, initializes application buffers states.
As a part of event handling, this function does the following: (i) handles incoming data from UARTs and stores into appropirate buffers (ii) in case of data transfer transaction, either notifies or acknowledges TCP handler about UART data; otherwise, listens from TCP handler to (a) collect telnet received data to UART (b) share appropriate UART buffer holding UART recived data (iii) in case of UART configuration requests, collects appropriate UART configuration and reconfigures UART for received configuration (iv) sends a data byte from telnet UART buffers in a round robin basis, and notifies current transmit and receive transactions
Parameters: |
|
---|---|
Returns: | None |
This function handles TCP handler thread.
During initialization, IP configuration details stored in flash are retrieved from UDP discovery function and passed on to ETH thread This thread mainly handles (a) all XTCP events and invokes respective sub-function handlers (b) notification messages from UART handler thread for UART data transactions
Parameters: |
|
---|---|
Returns: | None |
This function handles UART configuration requests from telnet configuration client.
It initializes cofnig parse state machine, receives configuration request events, sends response back to the client
Parameters: |
|
---|---|
Returns: | None |
s2e_webserver_event_handler Handles webserver event.
Parameters: |
|
---|---|
Returns: | none |
This function handles XTCP events related to Telnet data communication.
For any event, a correponding UART is mapped from XTCP connection As a part of event handling, this function does the following: (i) for new connections, TCP connection details are stored and telnet parse state machine and TCP ack mode is initialized (ii) for recieve events, data from TCP stack is collected into appropriate UART buffers. Received data is sent to telnet parser server in order to separate application data from telnet protocol. Initiates UART data transaction on c_uart_data channel in order to send data to UART (iii) for send requests initiated by telnet handler, this handler performs either of the following functionality (a) welcome messages are sent to respective telnet clients at the start of each session (b) collect outstanding data from appropriate UART RX active buffer and sends on XTCP connection
Parameters: |
|
---|---|
Returns: | None |
Handles events related to UDP discovery functionality.
Receives S2E identification and IP configuration requests from UDP test server, frames and sends S2E response messages
Parameters: |
|
---|---|
Returns: | None |
s2e_flash The S2E flash thread will keep looking for data (or commands) on the c_flash_data channel.
Parameters: |
|
---|---|
Returns: | none |
send_data_to_flash_thread Send UART configuration data to flash.
Send one configuration at a time. In order to send configuration for all the channels, this routine must be called in a loop; each time sending the current channels config.
Parameters: |
|
---|---|
Returns: | none |
get_data_from_flash_thread Get UART configuration data from flash.
Get one configuration at a time. In order to get configuration for all the channels, this routine must be called in a loop; each time updating the current channels config. Telnet ports for each channel are also updated.
Parameters: |
|
---|---|
Returns: | none |
send_ipconfig_to_flash_thread Send IP configuration data to flash.
Parameters: |
|
---|---|
Returns: | none |
get_ipconfig_from_flash_thread Get IP configuration data from flash.
Parameters: |
|
---|---|
Returns: | none |
send_cmd_to_flash_thread Send command to flash thread.
Parameters: |
|
---|---|
Returns: | none |
get_flash_access_result Get the flash access result after performing certain command.
Parameters: |
|
---|---|
Returns: | int S2E_FLASH_ERROR (or) S2E_FLASH_OK |
This function implements Telnet server functionality.
Mainly extracts application data from XTCP data packets in telnet protocol format.
Parameters: |
|
---|---|
Returns: | Length of application buffer |