![]() |
SysIo
1.9.0
Embedded Library and tools
|
Ce module fournit les fonctions permettant de contrôler une liaison série.
|
Modules | |
| Interface C++ | |
Classes | |
| struct | xSerialIos |
Functions | |
| bool | bSerialFdIsValid (int fd) |
| Vérifie si le descripteur de fichier est valide. More... | |
| double | dSerialFrameDuration (int fd, size_t ulSize) |
| double | dSerialTermiosFrameDuration (const struct termios *ts, size_t ulSize) |
| eSerialDataBits | eSerialGetDataBits (int fd) |
| eSerialFlow | eSerialGetFlow (int fd) |
| eSerialParity | eSerialGetParity (int fd) |
| eSerialStopBits | eSerialGetStopBits (int fd) |
| speed_t | eSerialIntToSpeed (int baud) |
| int | iSerialDataAvailable (int fd) |
| int | iSerialGetAttr (int fd, xSerialIos *xIos) |
| int | iSerialGetBaudrate (int fd) |
| int | iSerialOpen (const char *device, xSerialIos *xIos) |
| int | iSerialPoll (int fd, int timeout_ms) |
| int | iSerialSetAttr (int fd, const xSerialIos *xIos) |
| int | iSerialSetBaudrate (int fd, int iBaudrate) |
| int | iSerialSetDataBits (int fd, eSerialDataBits eDataBits) |
| int | iSerialSetFlow (int fd, eSerialFlow eNewFlow) |
| int | iSerialSetParity (int fd, eSerialParity eParity) |
| int | iSerialSetStopBits (int fd, eSerialStopBits eStopBits) |
| int | iSerialSpeedToInt (speed_t speed) |
| int | iSerialTermiosGetAttr (const struct termios *ts, xSerialIos *xIos) |
| int | iSerialTermiosGetBaudrate (const struct termios *ts) |
| int | iSerialTermiosGetDataBits (const struct termios *ts) |
| int | iSerialTermiosGetFlow (const struct termios *ts) |
| int | iSerialTermiosGetParity (const struct termios *ts) |
| int | iSerialTermiosGetStopBits (const struct termios *ts) |
| int | iSerialTermiosSetAttr (struct termios *ts, const xSerialIos *xIos) |
| int | iSerialTermiosSetBaudrate (struct termios *ts, int iBaudrate) |
| int | iSerialTermiosSetDataBits (struct termios *ts, eSerialDataBits eDataBits) |
| int | iSerialTermiosSetFlow (struct termios *ts, eSerialFlow eFlow) |
| int | iSerialTermiosSetParity (struct termios *ts, eSerialParity eParity) |
| int | iSerialTermiosSetStopBits (struct termios *ts, eSerialStopBits eStopBits) |
| const char * | sSerialAttrStr (int fd) |
| const char * | sSerialAttrToStr (const xSerialIos *xIos) |
| const char * | sSerialDataBitsToStr (eSerialDataBits eDataBits) |
| const char * | sSerialFlowToStr (eSerialFlow eFlow) |
| const char * | sSerialGetFlowStr (int fd) |
| const char * | sSerialParityToStr (eSerialParity eParity) |
| const char * | sSerialStopBitsToStr (eSerialStopBits eStopBits) |
| const char * | sSerialTermiosToStr (const struct termios *ts) |
| void | vSerialClose (int fd) |
| void | vSerialFlush (int fd) |
Macros | |
| #define | EBADBAUD (-2) |
| Erreur de baudrate. | |
Typedefs | |
| typedef struct xSerialIos | xSerialIos |
Enumerations | |
| enum | eSerialDataBits { SERIAL_DATABIT_5 = 5, SERIAL_DATABIT_6 = 6, SERIAL_DATABIT_7 = 7, SERIAL_DATABIT_8 = 8, SERIAL_DATABIT_UNKNOWN = -1 } |
| Nombre de bits de données. | |
| enum | eSerialFlow { SERIAL_FLOW_NONE = ' ', SERIAL_FLOW_RTSCTS = 'H', SERIAL_FLOW_XONXOFF = 'S', SERIAL_FLOW_RS485_RTS_AFTER_SEND = 'R', SERIAL_FLOW_RS485_RTS_ON_SEND = 'r', SERIAL_FLOW_UNKNOWN = -1 } |
| Type de contrôle de flux. More... | |
| enum | eSerialParity { SERIAL_PARITY_NONE = 'N', SERIAL_PARITY_EVEN = 'E', SERIAL_PARITY_ODD = 'O', SERIAL_PARITY_SPACE = 'S', SERIAL_PARITY_MARK = 'M', SERIAL_PARITY_UNKNOWN = -1 } |
| Parité | |
| enum | eSerialStopBits { SERIAL_STOPBIT_ONE = 1, SERIAL_STOPBIT_TWO = 2, SERIAL_STOPBIT_ONEHALF = 3, SERIAL_STOPBIT_UNKNOWN } |
| Nombre de bits de stop. | |
| typedef struct xSerialIos xSerialIos |
#include <serial.h>
Configuration d'un port série
| enum eSerialFlow |
#include <serial.h>
Type de contrôle de flux.
Definition at line 78 of file include/sysio/serial.h.
| bool bSerialFdIsValid | ( | int | fd | ) |
#include <serial.h>
Vérifie si le descripteur de fichier est valide.
| fd | le descripteur de fichier du port |
| double dSerialFrameDuration | ( | int | fd, |
| size_t | ulSize | ||
| ) |
#include <serial.h>
Durée d'une trame de ulSize octets en secondes
| fd | le descripteur de fichier du port |
| double dSerialTermiosFrameDuration | ( | const struct termios * | ts, |
| size_t | ulSize | ||
| ) |
#include <serial.h>
Durée d'une trame de ulSize octets en secondes
| eSerialDataBits eSerialGetDataBits | ( | int | fd | ) |
#include <serial.h>
Lecture du nombre de bits de données
| xPort | Pointeur sur le port |
| eSerialFlow eSerialGetFlow | ( | int | fd | ) |
#include <serial.h>
Lecture du type de contrôle de flux en cours
| xPort | Pointeur sur le port |
| eSerialParity eSerialGetParity | ( | int | fd | ) |
#include <serial.h>
Lecture de la parité
| xPort | Pointeur sur le port |
| eSerialStopBits eSerialGetStopBits | ( | int | fd | ) |
#include <serial.h>
Lecture du nombre de bits de stop
| xPort | Pointeur sur le port |
| speed_t eSerialIntToSpeed | ( | int | baud | ) |
#include <serial.h>
Constante speed_t associée à une valeur en baud
| int iSerialDataAvailable | ( | int | fd | ) |
#include <serial.h>
Retourne le nombre d'octets en attente de lecture
| fd | le descripteur de fichier du port |
| int iSerialGetAttr | ( | int | fd, |
| xSerialIos * | xIos | ||
| ) |
#include <serial.h>
Lecture de configuration d'un port série
| fd | le descripteur de fichier du port |
| xIos | configuration du port lue |
| int iSerialGetBaudrate | ( | int | fd | ) |
#include <serial.h>
Lecture de la vitesse de transmission
| xPort | Pointeur sur le port |
| int iSerialOpen | ( | const char * | device, |
| xSerialIos * | xIos | ||
| ) |
#include <serial.h>
Ouverture d'un port série
Le port est ouvert en lecture/écriture non bloquante, 8 bits sans parité, 1 bit de stop.
| device | le nom du port à ouvrir (/dev/tty...) |
| xIos | configuration du port |
| int iSerialPoll | ( | int | fd, |
| int | timeout_ms | ||
| ) |
#include <serial.h>
Scrutation en réception du port série
| fd | le descripteur de fichier du port |
| timeout_ms | temps d'attente maximal, une valeur négative pour l'infini |
| int iSerialSetAttr | ( | int | fd, |
| const xSerialIos * | xIos | ||
| ) |
#include <serial.h>
Modification de configuration d'un port série
| fd | le descripteur de fichier du port |
| xIos | configuration du port |
| int iSerialSetBaudrate | ( | int | fd, |
| int | iBaudrate | ||
| ) |
#include <serial.h>
Modification de la vitesse de transmission
| xPort | Pointeur sur le port |
| int iSerialSetDataBits | ( | int | fd, |
| eSerialDataBits | eDataBits | ||
| ) |
#include <serial.h>
Modification du nombre de bits de données
| xPort | Pointeur sur le port |
| int iSerialSetFlow | ( | int | fd, |
| eSerialFlow | eNewFlow | ||
| ) |
#include <serial.h>
Modification du type de contrôle de flux
| xPort | Pointeur sur le port |
| int iSerialSetParity | ( | int | fd, |
| eSerialParity | eParity | ||
| ) |
#include <serial.h>
Modification de la parité
| xPort | Pointeur sur le port |
| int iSerialSetStopBits | ( | int | fd, |
| eSerialStopBits | eStopBits | ||
| ) |
#include <serial.h>
Modification du nombre de bits de stop
| xPort | Pointeur sur le port |
| int iSerialSpeedToInt | ( | speed_t | speed | ) |
#include <serial.h>
Baudrate associée à une constante speed_t
| int iSerialTermiosGetAttr | ( | const struct termios * | ts, |
| xSerialIos * | xIos | ||
| ) |
#include <serial.h>
Lecture de configuration d'un port série d'une structure termios
| ts | structure termios |
| xIos | configuration du port lue |
| int iSerialTermiosGetBaudrate | ( | const struct termios * | ts | ) |
#include <serial.h>
Baudrate d'une structure termios
| int iSerialTermiosGetDataBits | ( | const struct termios * | ts | ) |
#include <serial.h>
Data bits d'une structure termios
| int iSerialTermiosGetFlow | ( | const struct termios * | ts | ) |
#include <serial.h>
Contrôle de flux d'une structure termios La fonction retourne SERIAL_FLOW_NONE si un mode RS485 est en fonction (RS485 non géré par termios).
| int iSerialTermiosGetParity | ( | const struct termios * | ts | ) |
#include <serial.h>
Parité d'une structure termios
| int iSerialTermiosGetStopBits | ( | const struct termios * | ts | ) |
#include <serial.h>
Stop bits d'une structure termios
| int iSerialTermiosSetAttr | ( | struct termios * | ts, |
| const xSerialIos * | xIos | ||
| ) |
#include <serial.h>
Modification de configuration d'un port série d'une structure termios
| ts | structure termios |
| xIos | configuration du port |
| int iSerialTermiosSetBaudrate | ( | struct termios * | ts, |
| int | iBaudrate | ||
| ) |
#include <serial.h>
Modification du baudrate d'une structure termios
| int iSerialTermiosSetDataBits | ( | struct termios * | ts, |
| eSerialDataBits | eDataBits | ||
| ) |
#include <serial.h>
Modification data bits d'une structure termios
| int iSerialTermiosSetFlow | ( | struct termios * | ts, |
| eSerialFlow | eFlow | ||
| ) |
#include <serial.h>
Modification du contrôle de flux d'une structure termios La fonction règle ts à SERIAL_FLOW_NONE si un mode RS485 est demandé (RS485 non géré par termios).
| int iSerialTermiosSetParity | ( | struct termios * | ts, |
| eSerialParity | eParity | ||
| ) |
#include <serial.h>
Modification du parité d'une structure termios
| int iSerialTermiosSetStopBits | ( | struct termios * | ts, |
| eSerialStopBits | eStopBits | ||
| ) |
#include <serial.h>
Modification du stop bits d'une structure termios
| const char* sSerialAttrStr | ( | int | fd | ) |
#include <serial.h>
Chaîne de caractère décrivant la configuration du port
Le format est BBBBBB-DPSF avec :
| fd | le descripteur de fichier du port |
| const char* sSerialAttrToStr | ( | const xSerialIos * | xIos | ) |
#include <serial.h>
Chaîne de caractère décrivant la configuration correspondant aux paramètres
Le format est BBBBBB-DPSF avec :
| const char* sSerialDataBitsToStr | ( | eSerialDataBits | eDataBits | ) |
#include <serial.h>
Chaîne de caractère correspondant à une valeur de bits de données
| const char* sSerialFlowToStr | ( | eSerialFlow | eFlow | ) |
#include <serial.h>
Chaîne de caractère correspondant à une valeur de contrôle de flux
| const char* sSerialGetFlowStr | ( | int | fd | ) |
#include <serial.h>
Lecture du type de contrôle de flux en cours sous forme "lisible"
| fd | le descripteur de fichier du port |
| const char* sSerialParityToStr | ( | eSerialParity | eParity | ) |
#include <serial.h>
Chaîne de caractère correspondant à une valeur de parité
| const char* sSerialStopBitsToStr | ( | eSerialStopBits | eStopBits | ) |
#include <serial.h>
Chaîne de caractère correspondant à une valeur de bits de stop
| const char* sSerialTermiosToStr | ( | const struct termios * | ts | ) |
#include <serial.h>
Chaîne de caractère correspondant à une structure termios
La fonction affiche SERIAL_FLOW_NONE si un mode RS485 est en fonction (RS485 non géré par termios). Le format est BBBBBB-DPSF avec :
| void vSerialClose | ( | int | fd | ) |
#include <serial.h>
Fermeture du port série
Equivaut à un appel de close() en ignorant la valeur retournée, il est donc préférable d'utiliser close() en vérifiant la valeur retournée (c.f. page man 2 close)!
| fd | le descripteur de fichier du port |
| void vSerialFlush | ( | int | fd | ) |
#include <serial.h>
Vide les buffers de réception et de transmission
Le buffer de transmission est transmis, celui de réception est vidé.
| fd | le descripteur de fichier du port |