ESOS32
ESOSOn32-bitProcessors
|
Files | |
file | esos_hwxxxx_rs232.c |
Template for creating hardware-specific support for the ESOS32 serial communications service. | |
file | esos_pc_stdio.c |
PC (linux) code to emulating the ESOS32 communications service. Input comes from keyboard, and output is directed to the "terminal". It would not be too hard to modify to actually use a serial port. | |
file | esos_stm32l4_rs232.c |
STM32L4xx hardware support for RS-232 serial communications. | |
file | esos_stm32l4_rs232.c |
STM32L4xx hardware support for RS-232 serial communications. | |
file | esos_comm.h |
Macros | |
#define | __ESOS_HW_SIGNAL_START_TX() __esos_SetSystemFlag(__ESOS_SYS_COMM_TX_ONGOING) |
#define | __ESOS_HW_SIGNAL_STOP_TX() __esos_ClearSystemFlag(__ESOS_SYS_COMM_TX_ONGOING) |
#define | __ESOS_HW_SIGNAL_START_TX() __esos_SetSystemFlag(__ESOS_SYS_COMM_TX_ONGOING) |
#define | __ESOS_HW_SIGNAL_STOP_TX() __esos_ClearSystemFlag(__ESOS_SYS_COMM_TX_ONGOING) |
#define | ESOS_COMM_SYS_USB 0x80 |
#define | ESOS_COMM_SYS_SERIAL 0x00 |
#define | ESOS_COMM_SYS_SERIAL_REV (ESOS_COMM_SYS_SERIAL + 0x01) |
#define | ESOS_SERIAL_OUT_EP_SIZE 64 |
#define | ESOS_SERIAL_IN_EP_SIZE 64 |
#define | DEFAULT_BAUDRATE 57600 |
#define | __ESOS_COMM_TXFIFO_PREP() |
#define | __ESOS_COMM_WRITE_TXFIFO(u8_out) |
#define | GET_ESOS_COMM_IN_DATA_LEN() |
#define | IS_ESOS_COMM_GOT_EXACTLY_DATA_BYTES(x) |
#define | IS_ESOS_COMM_GOT_AT_LEAST_DATA_BYTES(x) |
#define | FLUSH_ESOS_COMM_IN_DATA() |
#define | IS_ESOS_COMM_GOT_IN_DATA() |
#define | PEEK_ESOS_COMM_IN_DATA(x) |
#define | PEEK_ESOS_COMM_IN_LATEST_DATA() |
#define | IS_ESOS_COMM_READY_OUT_DATA() |
#define | ESOS_TASK_WAIT_ON_AVAILABLE_IN_COMM() |
#define | ESOS_TASK_WAIT_ON_AVAILABLE_OUT_COMM() |
#define | ESOS_TASK_SIGNAL_AVAILABLE_IN_COMM() |
#define | ESOS_TASK_SIGNAL_AVAILABLE_OUT_COMM() |
#define | ESOS_TASK_RELEASE_IN_COMM() |
#define | ESOS_TASK_RELEASE_OUT_COMM() |
#define | ESOS_TASK_WAIT_ON_GET_UINT8(u8_in) |
#define | ESOS_TASK_WAIT_ON_GET_U8BUFFER(pau8_in, u8_size) |
#define | ESOS_TASK_WAIT_ON_GET_UINT16(u16_in) |
#define | ESOS_TASK_WAIT_ON_GET_UINT32(u32_in) |
#define | ESOS_TASK_WAIT_ON_GET_STRING(pau8_in) |
#define | ESOS_TASK_WAIT_ON_SEND_UINT8(u8_out) |
#define | ESOS_TASK_WAIT_ON_SEND_UINT8_AS_HEX_STRING(u8_out) |
#define | ESOS_TASK_WAIT_ON_SEND_UINT8_AS_DEC_STRING(u8_out) |
#define | ESOS_TASK_WAIT_ON_SEND_UINT32_AS_HEX_STRING(u32_out) |
#define | ESOS_TASK_WAIT_ON_SEND_STRING(psz_out) |
#define | ESOS_TASK_WAIT_ON_SEND_U8BUFFER(pau8_out, u8_size) |
Functions | |
void | __esos_hw_signal_start_tx (void) |
void | __esos_hw_signal_stop_tx (void) |
void _ISRFAST | _U1TXInterrupt (void) |
void _ISRFAST | _U1RXInterrupt (void) |
void | __esos_hw_enableCommSystem () |
void | __esos_hw_disableCommSystem () |
void | __esos_hw_initCommSystem (uint32_t u32_baudRate) |
uint8_t | esos_GetCommSystemMaxInDataLen (void) |
uint8_t | esos_GetCommSystemMaxOutDataLen (void) |
uint8_t | _esos_hw_GetSerialUartVersion (void) |
ESOS_USER_TASK (__Linux_check_keyboard) | |
uint8_t | kbhit (void) |
void | set_keypress (void) |
void | reset_keypress (void) |
void | __esos_hw_InitCommSystem (void) |
void | HAL_UART_RxCpltCallback (UART_HandleTypeDef *UartHandle) |
void | HAL_UART_TxCpltCallback (UART_HandleTypeDef *UartHandle) |
void | HAL_UART_ErrorCallback (UART_HandleTypeDef *UartHandle) |
void | __esos_configUART1 (uint32_t u32_baudRate) |
void | usart2_isr (void) |
void | __esos_InitCommSystem (void) |
uint8_t | __esos_u8_GetMSBHexCharFromUint8 (uint8_t u8_x) |
uint8_t | __esos_u8_GetLSBHexCharFromUint8 (uint8_t u8_x) |
ESOS_CHILD_TASK (__esos_OutChar, uint8_t u8_c) | |
ESOS_CHILD_TASK (__esos_OutUint8AsDecString, uint8_t u8_x) | |
ESOS_CHILD_TASK (__esos_OutUint8AsHexString, uint8_t u8_x) | |
ESOS_CHILD_TASK (__esos_OutUint32AsHexString, uint32_t u32_x) | |
ESOS_CHILD_TASK (__esos_OutCharBuffer, uint8_t *pu8_out, uint8_t u8_len) | |
ESOS_CHILD_TASK (__esos_getBuffer, uint8_t *pau8_buff, uint8_t u8_size) | |
ESOS_CHILD_TASK (__esos_getString, char *pau8_buff) | |
ESOS_CHILD_TASK (__esos_OutString, char *psz_out) | |
void | __esos_unsafe_PutUint8 (uint8_t u8_c) |
void | __esos_unsafe_PutString (char *psz_in) |
uint8_t | __esos_unsafe_GetUint8 (void) |
uint8_t | esos_GetCommSystemVersion (void) |
Variables | |
struct termios | stored_settings |
uint8_t | u8_uartRXbuf |
uint8_t | u8_uartTXbuf |
UART_HandleTypeDef | st_huart2 |
uint8_t | u8_uartRXbuf |
uint8_t | u8_uartTXbuf |
volatile uint8_t | __esos_comm_tx_buff [ESOS_SERIAL_IN_EP_SIZE] |
volatile uint8_t | __esos_comm_rx_buff [ESOS_SERIAL_OUT_EP_SIZE] |
volatile struct stTask __stChildTaskTx | __stChildTaskRx |
#define __ESOS_COMM_TXFIFO_PREP | ( | ) |
Definition at line 75 of file esos_comm.h.
#define __ESOS_COMM_WRITE_TXFIFO | ( | u8_out | ) |
Definition at line 81 of file esos_comm.h.
#define ESOS_TASK_RELEASE_IN_COMM | ( | ) |
Signals to other requesting tasks that the ESOS "in" stream is being released or made available again by the current task.
Definition at line 257 of file esos_comm.h.
#define ESOS_TASK_RELEASE_OUT_COMM | ( | ) |
Signals to other requesting tasks that the ESOS "out" stream is being released or made available again by the current task.
Definition at line 267 of file esos_comm.h.
#define ESOS_TASK_SIGNAL_AVAILABLE_IN_COMM | ( | ) |
Signals to other requesting tasks that the current task is making the ESOS "in" stream available again.
Definition at line 238 of file esos_comm.h.
#define ESOS_TASK_SIGNAL_AVAILABLE_OUT_COMM | ( | ) |
Signals to other requesting tasks that the current task is making the ESOS "out" stream available again.
Definition at line 246 of file esos_comm.h.
#define ESOS_TASK_WAIT_ON_AVAILABLE_IN_COMM | ( | ) |
Cause the current task to wait (block) until the ESOS "in" stream is available for use.
Definition at line 216 of file esos_comm.h.
#define ESOS_TASK_WAIT_ON_AVAILABLE_OUT_COMM | ( | ) |
Causes the current task to wait (block) until the ESOS "out" stream is available for use. Code will resume once the stream is available for our use. This routine marks the "in" stream in use by the current task.
Definition at line 227 of file esos_comm.h.
#define ESOS_TASK_WAIT_ON_GET_STRING | ( | pau8_in | ) |
Create, spawn and wait on a child task to get a string from the ESOS "in" communications buffer. The incoming string must be zero-terminated (useful when reading from other streaming data devices), or terminated with a newline/return character (useful when reading from terminals/keyboards/etc.) Results are written into the array whose address is passed in
pau8_in | pointer to array in which bytes should be returned |
Definition at line 356 of file esos_comm.h.
#define ESOS_TASK_WAIT_ON_GET_U8BUFFER | ( | pau8_in, | |
u8_size | |||
) |
Create, spawn and wait on a child task to get an array of bytes (uint8s) from the ESOS "in" communications buffer Results are written into the array whose address is passed in
pau8_in | pointer to array in which bytes should be returned |
u8_size | number of bytes to read from "in" stream |
Definition at line 301 of file esos_comm.h.
#define ESOS_TASK_WAIT_ON_GET_UINT16 | ( | u16_in | ) |
Create, spawn and wait on a child task to get a double-byte value (uint16) from the ESOS "in" communications buffer Results are written into the variable which is passed in
u16_in | variable in which data should be returned |
Definition at line 317 of file esos_comm.h.
#define ESOS_TASK_WAIT_ON_GET_UINT32 | ( | u32_in | ) |
Create, spawn and wait on a child task to get a quad-byte value (uint32) from the ESOS "in" communications buffer Results are written into the variable which is passed in
u32_in | variable in which data should be returned |
Definition at line 333 of file esos_comm.h.
#define ESOS_TASK_WAIT_ON_GET_UINT8 | ( | u8_in | ) |
Create, spawn and wait on a child task to get a byte (uint8) from the ESOS "in" communications buffer Results are written into the variable which is passed in
u8_in | variable in which data should be returned |
Definition at line 284 of file esos_comm.h.
#define ESOS_TASK_WAIT_ON_SEND_STRING | ( | psz_out | ) |
Create, spawn and wait on a child task to put a zero-terminated string to the ESOS "out" communications buffer.
psz_out | pointer to the zero-terminated string |
Definition at line 414 of file esos_comm.h.
#define ESOS_TASK_WAIT_ON_SEND_U8BUFFER | ( | pau8_out, | |
u8_size | |||
) |
Create, spawn and wait on a child task to put an array of bytes (uint8s) to the ESOS "out" communications buffer
pau8_out | pointer to beginning of array of bytes to send to "out" stream |
u8_size | number of bytes to send |
Definition at line 426 of file esos_comm.h.
#define ESOS_TASK_WAIT_ON_SEND_UINT32_AS_HEX_STRING | ( | u32_out | ) |
Create, spawn and wait on a child task to put a 32-bit value (uint32) to the ESOS "out" communications buffer as a human-readable hexadecimal string. Results will look like "0x0123BEEF"
u32_out | data to write to "out" stream |
Definition at line 403 of file esos_comm.h.
#define ESOS_TASK_WAIT_ON_SEND_UINT8 | ( | u8_out | ) |
Create, spawn and wait on a child task to put a byte (uint8) to the ESOS "out" communications buffer
u8_out | data to write to "out" stream |
Definition at line 367 of file esos_comm.h.
#define ESOS_TASK_WAIT_ON_SEND_UINT8_AS_DEC_STRING | ( | u8_out | ) |
Create, spawn and wait on a child task to put a byte (uint8) to the ESOS "out" communications buffer as a human-readable decimal string. Results will look like "253"
u8_out | data to write to "out" stream |
Definition at line 392 of file esos_comm.h.
#define ESOS_TASK_WAIT_ON_SEND_UINT8_AS_HEX_STRING | ( | u8_out | ) |
Create, spawn and wait on a child task to put a byte (uint8) to the ESOS "out" communications buffer as a human-readable hexadecimal string. Results will look like "0x4C"
u8_out | data to write to "out" stream |
Definition at line 379 of file esos_comm.h.
#define FLUSH_ESOS_COMM_IN_DATA | ( | ) |
Flushes the "in" communications buffer. All unread data in the "in" communications buffer will be lost.
Definition at line 147 of file esos_comm.h.
#define GET_ESOS_COMM_IN_DATA_LEN | ( | ) |
Evaluates to the number of bytes in the ESOS "in" communications buffer
N | number of bytes current contained in the "in" buffer |
Definition at line 112 of file esos_comm.h.
#define IS_ESOS_COMM_GOT_AT_LEAST_DATA_BYTES | ( | x | ) |
Evaluates to the booelan to determine if "in" communications buffer has at least x bytes
x | number of bytes to check for |
TRUE | if "in" buffer has x bytes or more |
FALSE | otherwise |
Definition at line 136 of file esos_comm.h.
#define IS_ESOS_COMM_GOT_EXACTLY_DATA_BYTES | ( | x | ) |
Evaluates to the booelan to determine if "in" communications buffer has exactly x bytes
x | number of bytes to check for |
TRUE | if "in" buffer has exactly x bytes |
FALSE | otherwise |
Definition at line 124 of file esos_comm.h.
#define IS_ESOS_COMM_GOT_IN_DATA | ( | ) |
Evaluates to the booelan to determine if "in" communications buffer any readable bytes
TRUE | if "in" buffer has some data to read |
FALSE | otherwise |
Definition at line 158 of file esos_comm.h.
#define IS_ESOS_COMM_READY_OUT_DATA | ( | ) |
Evaluates to boolean to that determines whether the "out" system can accept anymore data
TRUE | if "out" communication system buffer has room for 1+ bytes |
FALSE | otherwise |
Definition at line 207 of file esos_comm.h.
#define PEEK_ESOS_COMM_IN_DATA | ( | x | ) |
Evaluates to a "peek" of the x-th data byte in the "in" communications buffer
x | byte in FIFO to "peek" |
data | peeked data byte |
Definition at line 178 of file esos_comm.h.
#define PEEK_ESOS_COMM_IN_LATEST_DATA | ( | ) |
Evaluates to a "peek" of the most recent data byte written to the "in" communications buffer
data | peeked data byte |
Definition at line 196 of file esos_comm.h.
void __esos_configUART1 | ( | uint32_t | u32_baudRate | ) |
Configure the UART. Settings chosen:
u32_baudRate | The baud rate to use. |
Definition at line 145 of file esos_stm32l4_rs232.c.
uint8_t esos_GetCommSystemMaxInDataLen | ( | void | ) |
Returns the size of the ESOS communication systems "in" buffers
uint8_t | Number of bytes |
Definition at line 194 of file esos_hwxxxx_rs232.c.
uint8_t esos_GetCommSystemMaxOutDataLen | ( | void | ) |
Returns the size of the ESOS communication systems "out" buffers
uint8_t | Number of bytes |
Definition at line 222 of file esos_hwxxxx_rs232.c.
uint8_t esos_GetCommSystemVersion | ( | void | ) |
Returns the version number of the ESOS communication systems
verNum | Version number. Exact value and meaning depends on hardware |
void HAL_UART_RxCpltCallback | ( | UART_HandleTypeDef * | UartHandle | ) |
UART ISR callbacks
HAL will call these functions at the conclusion of TX and RX operations
TODO: STM32L4 ISRs below are using the standard STM32 cube priorities. These ISRs have not been incorporated into ESOS's interrupt priority scheme.
Definition at line 93 of file esos_stm32l4_rs232.c.
void usart2_isr | ( | void | ) |
UART ISR callbacks
HAL will call these functions at the conclusion of TX and RX operations
TODO: STM32L4 ISRs below are using the standard STM32 cube priorities. These ISRs have not been incorporated into ESOS's interrupt priority scheme.
Definition at line 95 of file esos_stm32l4_rs232.c.