 |
Xyris
0.5
|
|
int | vprintf (const char *fmt, va_list args) |
|
int | printf (const char *format,...) |
|
void | init (uint16_t com_id) |
|
size_t | read (char *buf, size_t count) |
|
size_t | write (const char *buf, size_t count) |
|
int | close () |
|
◆ close()
Closes the serial input buffer and frees all of the data contained within.
- Returns
- int Returns 0 on success and -1 on error. Errno is set appropriately.
Definition at line 168 of file rs232.cpp.
◆ init()
void RS232::init |
( |
uint16_t |
com_id | ) |
|
Activates the RS232 serial driver.
Definition at line 112 of file rs232.cpp.
115 rs_232_port_base = com_id;
135 " | |/ /_ _______(_)____ _ _|__ /\n"
136 " | / / / / ___/ / ___/ | | / //_ <\n"
137 " / / /_/ / / / (__ ) | |/ /__/ /\n"
138 "/_/|_\\__, /_/ /_/____/ |___/____/\n"
141 "Xyris Serial Output Debugger\n\n");
◆ printf()
int RS232::printf |
( |
const char * |
format, |
|
|
|
... |
|
) |
| |
Prints a formatted string to serial output.
- Parameters
-
format | Format string |
... | Arguments |
- Returns
- int Number of characters printed
Definition at line 86 of file rs232.cpp.
91 va_start(args, format);
92 ret_val =
vprintf(format, args);
◆ read()
size_t RS232::read |
( |
char * |
buf, |
|
|
size_t |
count |
|
) |
| |
Reads bytes from the serial buffer.
- Parameters
-
buf | Buffer to hold the serial input |
count | Number of bytes to read |
- Returns
- char* Returns the number of bytes read.
Definition at line 144 of file rs232.cpp.
148 for (
size_t idx = 0; idx < count && !ring.IsEmpty(); idx++) {
149 buf[idx] = ring.Dequeue();
◆ vprintf()
int RS232::vprintf |
( |
const char * |
fmt, |
|
|
va_list |
args |
|
) |
| |
Prints a formatted string to serial output using a va_list of arguments.
- Parameters
-
fmt | Format string |
args | Arguments list |
- Returns
- int Number of characters printed
Definition at line 79 of file rs232.cpp.
◆ write()
size_t RS232::write |
( |
const char * |
buf, |
|
|
size_t |
count |
|
) |
| |
Write bytes to the serial device.
- Parameters
-
buf | Buffer containing bytes to write |
count | Number of bytes to write |
- Returns
- size_t Returns number of bytes written
Definition at line 156 of file rs232.cpp.
159 while (is_transmit_empty() == 0);
161 for (
size_t idx = 0; idx < count; idx++) {
bool unlock()
Release the mutex.
#define RS_232_MODEM_CONTROL_REG
void registerHandler(uint8_t interrupt, InterruptHandler_t handler)
bool lock()
Aquire the mutex.
int vprintf(const char *fmt, va_list args)
Prints a formatted string to serial output using a va_list of arguments.
#define RS_232_INTERRUPT_ENABLE_REG
static bool addWriter(LogWriter writer)
#define RS_232_INTERRUPT_IDENTIFICATION_REG
static void Print(const char *fmt,...)
void writeByte(uint16_t port, uint8_t data)
Writes a byte (8 bits) to the CPU bus at a given port address.
int printf_helper(const char *fmt, va_list args, printf_cb_fnptr_t fn, void *ptr)
Perform all printf operations on the format string using the provided argument list and uses the call...
#define RS_232_LINE_CONTROL_REG