This file implements a serial interface. More...
#include "sbgInterface.h"
Go to the source code of this file.
Macros | |
#define | SBG_IF_SERIAL_RX_BUFFER_SIZE (4096u) |
#define | SBG_IF_SERIAL_TX_BUFFER_SIZE (4096u) |
Functions | |
SbgErrorCode | sbgInterfaceSerialChangeBaudrate (SbgInterface *pHandle, uint32 baudRate) |
SbgErrorCode | sbgInterfaceSerialCreate (SbgInterface *pHandle, const char *deviceName, uint32 baudRate) |
SbgErrorCode | sbgInterfaceSerialDestroy (SbgInterface *pHandle) |
SbgErrorCode | sbgInterfaceSerialFlush (SbgInterface *pHandle) |
SbgErrorCode | sbgInterfaceSerialRead (SbgInterface *pHandle, void *pBuffer, size_t *pReadBytes, size_t bytesToRead) |
SbgErrorCode | sbgInterfaceSerialWrite (SbgInterface *pHandle, const void *pBuffer, size_t bytesToWrite) |
This file implements a serial interface.
Copyright (C) 2007-2013, SBG Systems SAS. All rights reserved.
This source code is intended for use only by SBG Systems SAS and those that have explicit written permission to use it from SBG Systems SAS.
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
Definition in file sbgInterfaceSerial.h.
#define SBG_IF_SERIAL_RX_BUFFER_SIZE (4096u) |
Define the reception buffer size for the serial port.
Definition at line 37 of file sbgInterfaceSerial.h.
#define SBG_IF_SERIAL_TX_BUFFER_SIZE (4096u) |
Define the transmission buffer size for the serial port.
Definition at line 36 of file sbgInterfaceSerial.h.
SbgErrorCode sbgInterfaceSerialChangeBaudrate | ( | SbgInterface * | pHandle, |
uint32 | baudRate | ||
) |
Change the serial interface baud rate immediatly.
[in] | handle | Valid handle on an initialized interface. |
[in] | baudRate | The new baudrate to apply in bps. |
Definition at line 300 of file sbgInterfaceSerialUnix.c.
SbgErrorCode sbgInterfaceSerialCreate | ( | SbgInterface * | pHandle, |
const char * | deviceName, | ||
uint32 | baudRate | ||
) |
Initialize a serial interface for read and write operations.
[in] | pHandle | Pointer on an allocated interface instance to initialize. |
[in] | deviceName | Serial interface location (COM21 , /dev/ttys0, depending on platform). |
[in] | baudRate | Serial interface baud rate in bps. |
Definition at line 83 of file sbgInterfaceSerialUnix.c.
SbgErrorCode sbgInterfaceSerialDestroy | ( | SbgInterface * | pHandle | ) |
Destroy an interface initialized using sbgInterfaceSerialCreate.
[in] | pInterface | Valid handle on an initialized interface. |
Definition at line 228 of file sbgInterfaceSerialUnix.c.
SbgErrorCode sbgInterfaceSerialFlush | ( | SbgInterface * | pHandle | ) |
Flush the RX and TX buffers (remove all old data)
[in] | handle | Valid handle on an initialized interface. |
Definition at line 262 of file sbgInterfaceSerialUnix.c.
SbgErrorCode sbgInterfaceSerialRead | ( | SbgInterface * | pHandle, |
void * | pBuffer, | ||
size_t * | pReadBytes, | ||
size_t | bytesToRead | ||
) |
Try to read some data from an interface.
[in] | pHandle | Valid handle on an initialized interface. |
[in] | pBuffer | Pointer on an allocated buffer that can hold at least bytesToRead bytes of data. |
[out] | pReadBytes | Pointer on an uint32 used to return the number of read bytes. |
[in] | bytesToRead | Number of bytes we would like to read. |
Definition at line 433 of file sbgInterfaceSerialUnix.c.
SbgErrorCode sbgInterfaceSerialWrite | ( | SbgInterface * | pHandle, |
const void * | pBuffer, | ||
size_t | bytesToWrite | ||
) |
Try to write some data to an interface.
[in] | pHandle | Valid handle on an initialized interface. |
[in] | pBuffer | Pointer on an allocated buffer that contains the data to write |
[in] | bytesToWrite | Number of bytes we would like to write. |
Definition at line 371 of file sbgInterfaceSerialUnix.c.