mbgtools-lx  4.2.8
mbgserio.h File Reference
#include <mbg_tgt.h>
#include <mbg_tmo.h>
#include <mbgerror.h>
#include <stdlib.h>
#include <string.h>
#include <termios.h>

Go to the source code of this file.

Data Structures

struct  _MBG_STR_LIST
 
struct  MBGSERIO_DEV
 

Macros

#define _USE_SELECT_FOR_SERIAL_IO   1
 
#define _ext   extern
 
#define DEFAULT_SERIAL_DEVICE_NAME   "/dev/ttyS0"
 
#define DEFAULT_SERIAL_DEVICE_NAME_2   "/dev/ttyS1"
 

Typedefs

typedef struct _MBG_STR_LIST MBG_STR_LIST
 

Functions

int mbgserio_close (MBGSERIO_DEV **pp_mdev)
 Close a serial port specified by a MBGSERIO_DEV structure. More...
 
int mbgserio_open (MBGSERIO_DEV **pp_mdev, const char *dev_name)
 Open a serial port and set up a MBGSERIO_DEV structure. More...
 
int mbgserio_setup_port_str_list (MBG_STR_LIST **list, int max_devs)
 
void mbgserio_free_str_list (MBG_STR_LIST *list)
 
int mbgserio_set_parms (MBGSERIO_DEV *mdev, uint32_t baud_rate, const char *framing)
 
int mbgserio_read (MBGSERIO_DEV *mdev, void *buffer, unsigned int count)
 
int mbgserio_write (MBGSERIO_DEV *mdev, const void *buffer, unsigned int count)
 
void mbgserio_flush_tx (MBGSERIO_DEV *mdev)
 
int mbgserio_read_wait (MBGSERIO_DEV *mdev, void *buffer, uint count)
 

Macro Definition Documentation

◆ _ext

#define _ext   extern

Definition at line 77 of file mbgserio.h.

◆ _USE_SELECT_FOR_SERIAL_IO

#define _USE_SELECT_FOR_SERIAL_IO   1

Definition at line 66 of file mbgserio.h.

◆ DEFAULT_SERIAL_DEVICE_NAME

#define DEFAULT_SERIAL_DEVICE_NAME   "/dev/ttyS0"

Definition at line 94 of file mbgserio.h.

◆ DEFAULT_SERIAL_DEVICE_NAME_2

#define DEFAULT_SERIAL_DEVICE_NAME_2   "/dev/ttyS1"

Definition at line 95 of file mbgserio.h.

Typedef Documentation

◆ MBG_STR_LIST

typedef struct _MBG_STR_LIST MBG_STR_LIST

Function Documentation

◆ mbgserio_close()

int mbgserio_close ( MBGSERIO_DEV **  pp_mdev)

Close a serial port specified by a MBGSERIO_DEV structure.

After the port has been closed the buffer which had been allocated for the MBGSERIO_DEV structure is freed, and the pointer to that buffer is set to NULL.

Parameters
[in,out]pp_mdevAddress of a pointer to the control structure including the port handle
Returns
One of the MBG_RETURN_CODES

Referenced by mbgextio_close_connection().

◆ mbgserio_flush_tx()

void mbgserio_flush_tx ( MBGSERIO_DEV mdev)

◆ mbgserio_free_str_list()

void mbgserio_free_str_list ( MBG_STR_LIST list)

◆ mbgserio_open()

int mbgserio_open ( MBGSERIO_DEV **  pp_mdev,
const char *  dev_name 
)

Open a serial port and set up a MBGSERIO_DEV structure.

Parameters
[in,out]pp_mdevAddress of a pointer to a MBGSERIO_DEV device control structure allocated and set up by this call. Set to NULL on error.
[in]dev_nameDevice name of the port to be opened.
Returns
One of the MBG_RETURN_CODES

Referenced by dev_open_finish_setup().

◆ mbgserio_read()

int mbgserio_read ( MBGSERIO_DEV mdev,
void *  buffer,
unsigned int  count 
)

◆ mbgserio_read_wait()

int mbgserio_read_wait ( MBGSERIO_DEV mdev,
void *  buffer,
uint  count 
)

◆ mbgserio_set_parms()

int mbgserio_set_parms ( MBGSERIO_DEV mdev,
uint32_t  baud_rate,
const char *  framing 
)
Returns
One of the MBG_RETURN_CODES

Referenced by dev_open_finish_setup().

◆ mbgserio_setup_port_str_list()

int mbgserio_setup_port_str_list ( MBG_STR_LIST **  list,
int  max_devs 
)

◆ mbgserio_write()

int mbgserio_write ( MBGSERIO_DEV mdev,
const void *  buffer,
unsigned int  count 
)