HALFRED
0.4.0
|
The IOSerial interface captures the capabilities of a typical serial port (UART, USART, RS-232).
Enumerations | |
enum | IOSERIAL_NumberOfDataBits { IOSERIAL_DATABITS_8, IOSERIAL_DATABITS_5, IOSERIAL_DATABITS_6, IOSERIAL_DATABITS_7, IOSERIAL_DATABITS_9 } |
enum | IOSERIAL_Parity { IOSERIAL_PARITY_NONE, IOSERIAL_PARITY_ODD, IOSERIAL_PARITY_EVEN, IOSERIAL_PARITY_MARK, IOSERIAL_PARITY_SPACE } |
enum | IOSERIAL_NumberOfStopBits { IOSERIAL_STOPBITS_1, IOSERIAL_STOPBITS_1_5, IOSERIAL_STOPBITS_2 } |
enum | IOSERIAL_Handshaking { IOSERIAL_HANDSHAKING_NONE, IOSERIAL_HANDSHAKING_RTS_CTS } |
enum IOSERIAL_Parity |
enum IOSERIAL_Handshaking |
unsigned int IOSERIAL_Enumerate | ( | void | ) |
Enumerates available serial ports. The names of the enumerated devices are available through subsequent calls to IOSERIAL_GetEnumeratedDeviceName.
const char* IOSERIAL_GetEnumeratedDeviceName | ( | unsigned int | index | ) |
Gets the name of an enumerated serial device under given index. This name can be used to create a new IOSerialDevice using IOSERIAL_Create. This function shall be called after IOSERIAL_Enumerate to retrieve the results.
index | enumeration index (0-based) |
IODevice IOSERIAL_Create | ( | const char * | name | ) |
Creates a new IOSerialDevice based on it's system name.
This utility function returns an IOSerialDevice handle of a device, given it's system name. It is targeted mainly at host operating systems, where devices are identified by their names rather than hardware identifiers (as is the case of bare metal applications). The returned IOSerialDevice is uninitialized. Systems that do not support device names will always return NULL.
name | device system name (in ex. "COM3" or "\dev\ttyS0") |
void IOSERIAL_Destroy | ( | IODevice | serial | ) |
Destroys an IOSerialDevice previously returned by the IOSERIAL_Create function. The device should be deinitialized (IODEV_Deinit) prior to being destroyed, otherwise some resources may not be freed or other error might occur.
serial | handle of the IOSerialDevice, returned by IOSERIAL_Create |
Sets baudrate of an IOSerialDevice
serial | IOSerialDevice |
baudrate | baudrate |
References DIAG_DEFAULT_CHANNEL.
uint32_t IOSERIAL_GetBaudrate | ( | IODevice | serial | ) |
Gets the baudrate currently set for the given IOSerialDevice
serial | IOSerialDevice |
References DIAG_DEFAULT_CHANNEL.
HALRESULT IOSERIAL_SetFrameFormat | ( | IODevice | serial, |
IOSERIAL_NumberOfDataBits | data_bits, | ||
IOSERIAL_Parity | parity, | ||
IOSERIAL_NumberOfStopBits | stop | ||
) |
Sets the frame format for the given IOSerialDevice
serial | IOSerialDevice |
data_bits | number of data bits in a frame (see IOSERIAL_NumberOfDataBits) |
parity | parity bit mode (see IOSERIAL_Parity) |
stop | number of stop bits (see IOSERIAL_NumberOfStopBits) |
References DIAG_DEFAULT_CHANNEL.
HALRESULT IOSERIAL_GetFrameFormat | ( | IODevice | serial, |
IOSERIAL_NumberOfDataBits * | data_bits, | ||
IOSERIAL_Parity * | parity, | ||
IOSERIAL_NumberOfStopBits * | stop | ||
) |
Gets the frame format currently set for a given IOSerialDevice.
serial | IOSerialDevice |
data_bits | pointer to a variable where number of data bits in a frame will be stored (see IOSERIAL_NumberOfDataBits) |
parity | pointer to a variable where parity bit mode will be stored (see IOSERIAL_Parity) |
stop | pointer to a variable where number of stop bits will be stored (see IOSERIAL_NumberOfStopBits) |
References DIAG_DEFAULT_CHANNEL.
HALRESULT IOSERIAL_SetHandshaking | ( | IODevice | serial, |
IOSERIAL_Handshaking | handshaking | ||
) |
Sets handshaking mode for a given IOSerialDevice
serial | IOSerialDevice |
handshaking | handshaking mode (see IOSERIAL_Handshaking) |
References DIAG_DEFAULT_CHANNEL.
IOSERIAL_Handshaking IOSERIAL_GetHandshaking | ( | IODevice | serial | ) |
Gets handshaking mode currently set for a given IOSerialDevice
serial | IOSerialDevice |
References DIAG_DEFAULT_CHANNEL, and IOSERIAL_HANDSHAKING_NONE.
Enables the RTS (request to send) signal in a given IOSerialDevice.
serial | IOSerialDevice |
References DIAG_DEFAULT_CHANNEL.
Disables the RTS (request to send) signal in a given IOSerialDevice.
serial | IOSerialDevice |
References DIAG_DEFAULT_CHANNEL.
Sets the RTS (request to send) signal in a given IOSerialDevice.
serial | IOSerialDevice |
rts | RTS signal value (true means RTS is active, false means the RTS is inactive) |
References DIAG_DEFAULT_CHANNEL.
bool IOSERIAL_GetRTS | ( | IODevice | serial | ) |
Gets the RTS (request to send) signal value in a given IOSerialDevice.
serial | IOSerialDevice |
References DIAG_DEFAULT_CHANNEL.
Enables the CTS (clear to send) signal in a given IOSerialDevice.
serial | IOSerialDevice |
References DIAG_DEFAULT_CHANNEL.
Disables the CTS (clear to send) signal in a given IOSerialDevice.
serial | IOSerialDevice |
References DIAG_DEFAULT_CHANNEL.
Sets the CTS (clear to send) signal in a given IOSerialDevice.
serial | IOSerialDevice |
cts | CTS signal value (true means CTS is active, false means the CTS is inactive) |
References DIAG_DEFAULT_CHANNEL.
bool IOSERIAL_GetCTS | ( | IODevice | serial | ) |
Gets the CTS (clear to send) signal value in a given IOSerialDevice.
serial | IOSerialDevice |
References DIAG_DEFAULT_CHANNEL.