diff options
author | Jörg Hohensohn <hohensoh@rockbox.org> | 2003-11-30 11:37:43 +0000 |
---|---|---|
committer | Jörg Hohensohn <hohensoh@rockbox.org> | 2003-11-30 11:37:43 +0000 |
commit | 6a4e4c87c24455e18bbd77565cb3e993ee350618 (patch) | |
tree | 6f2ceac4da97aa63ff8deef939bd3cc2d56d3466 /flash/uart_boot/uart.h | |
parent | 014c4fa1f8d56850cfd504a90221c293e4a158f6 (diff) | |
download | rockbox-6a4e4c87c24455e18bbd77565cb3e993ee350618.tar.gz rockbox-6a4e4c87c24455e18bbd77565cb3e993ee350618.zip |
source code for all my flash stuff, now finally in cvs
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4083 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'flash/uart_boot/uart.h')
-rw-r--r-- | flash/uart_boot/uart.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/flash/uart_boot/uart.h b/flash/uart_boot/uart.h new file mode 100644 index 0000000000..46b082c497 --- /dev/null +++ b/flash/uart_boot/uart.h @@ -0,0 +1,56 @@ +// A general definition for the required UART functionality. +// This will be used to gain platform abstraction. + +#ifndef _UART_H +#define _UART_H + +// data types + +typedef void* tUartHandle; +#define INVALID_UART_HANDLE (tUartHandle)-1 + +typedef enum +{ + eNOPARITY, + eODDPARITY, + eEVENPARITY, + eMARKPARITY, + eSPACEPARITY, +} tParity; + +typedef enum +{ + eONESTOPBIT, + eONE5STOPBITS, + eTWOSTOPBITS, +} tStopBits; + + +// prototypes + +tUartHandle UartOpen( // returns NULL on error + char* szPortName); // COMx for windows + +bool UartConfig( // returns true on success, false on error + tUartHandle handle, // the handle returned from UartOpen() + long lBaudRate, // must be one of the "standard" baudrates + tParity nParity, // what kind of parity + tStopBits nStopBits, // how many stop bits + int nByteSize); // size of the "payload", can be 5 to 8 + +long UartWrite( // returns how much data was actually transmitted + tUartHandle handle, // the handle returned from UartOpen() + unsigned char* pData, // pointer to the data to be transmitted + long lSize); // how many bytes + +long UartRead( // returns how much data was actually received + tUartHandle handle, // the handle returned from UartOpen() + unsigned char* pBuffer, // pointer to the destination + long lSize); // how many bytes to read (pBuffer must have enough room) + + +void UartClose(tUartHandle handle); + + + +#endif // _UART_H
\ No newline at end of file |