GaIA BIOS Library
Loading...
Searching...
No Matches
buffered_serial.h File Reference

Buffered access to serial communication ports. More...

#include "serial.h"
#include <stdint.h>
#include <stdbool.h>

Data Structures

struct  ser_ch_data_t
 Serial Channel Data Provides serial buffers. More...

Macros

#define TXBLEN   0x200
 Tx Buffer length.
#define RXBLEN   0x200
 Rx Buffer length.

Functions

ser_ch_data_tbuf_serch_init (uint8_t port_id, uint8_t frame, uint8_t baudrate)
 Initializes the serial channel.
bool buf_serch_deinit (ser_ch_data_t *ch)
 Deinitializes the serial channel.
void buf_serch_chgbaud (ser_ch_data_t *ch, uint8_t baudrate)
 Changes baudrate for the serial channel.
ser_ch_data_tbuf_serch_get (uint8_t ch_id)
 Gets a reference to the serial channel.
bool buf_serch_out_empty (ser_ch_data_t *ch)
 Checks whether the out buffer is empty or not.
bool buf_serch_out_ready (ser_ch_data_t *ch)
 Checks whether ther is room in the out buffer.
bool buf_serch_put_char (ser_ch_data_t *ch, uint16_t c)
 Puts a character in the out buffer.
bool buf_serch_char_ready (ser_ch_data_t *ch)
 Returns true if a character is ready.
uint16_t buf_serch_get_char (ser_ch_data_t *ch)
 Gets e character from buffer.

Detailed Description

Buffered access to serial communication ports.

These functions initialize and access a buffered serial channel. A buffered serial channel is associated to one and only one serial port. A channel provides buffered access to the serial port.

Author
Tecnologix, 2014

Function Documentation

◆ buf_serch_char_ready()

bool buf_serch_char_ready ( ser_ch_data_t * ch)

Returns true if a character is ready.

Parameters
ch- reference to the serial channel.
Returns
true if a character is ready.

◆ buf_serch_chgbaud()

void buf_serch_chgbaud ( ser_ch_data_t * ch,
uint8_t baudrate )

Changes baudrate for the serial channel.

Parameters
ch- reference to the serial channel data structure.
baudrate- the baudrate.

◆ buf_serch_deinit()

bool buf_serch_deinit ( ser_ch_data_t * ch)

Deinitializes the serial channel.

Parameters
ch- reference to the serial channel data structure.
Returns
true if deinitialized correctly, false on error.

◆ buf_serch_get()

ser_ch_data_t * buf_serch_get ( uint8_t ch_id)

Gets a reference to the serial channel.

Parameters
ch_id- serial channel id.
Returns
a reference to the serial channel data structure.

◆ buf_serch_get_char()

uint16_t buf_serch_get_char ( ser_ch_data_t * ch)

Gets e character from buffer.

This function must be called only when gwa_serch_char_ready has previously returned true.

Parameters
ch- reference to the serial channel.
Returns
the read character.

◆ buf_serch_init()

ser_ch_data_t * buf_serch_init ( uint8_t port_id,
uint8_t frame,
uint8_t baudrate )

Initializes the serial channel.

Parameters
port_id- serial port id.
frame- frame type.
baudrate- the baudrate.
Returns
a reference to the serial channel data structure.

◆ buf_serch_out_empty()

bool buf_serch_out_empty ( ser_ch_data_t * ch)

Checks whether the out buffer is empty or not.

Parameters
ch- reference to the serial channel.
Returns
true if the out buffer is empty, false otherwise.

◆ buf_serch_out_ready()

bool buf_serch_out_ready ( ser_ch_data_t * ch)

Checks whether ther is room in the out buffer.

Parameters
ch- reference to the serial channel.
Returns
true if there is room in the out buffer for transmission.

◆ buf_serch_put_char()

bool buf_serch_put_char ( ser_ch_data_t * ch,
uint16_t c )

Puts a character in the out buffer.

Parameters
c- character to be sent.
ch- reference to the serial channel.
Returns
true if the character has been correctly enqueued false otherwise (queue full).