osd-contiki/cpu/stm32w108/hal/micro/cortexm3/uart.h

73 lines
2.1 KiB
C
Raw Normal View History

2010-10-25 11:03:38 +02:00
/** @file hal/micro/cortexm3/uart.h
* @brief Header for STM32W uart drivers, supporting IAR's standard library
* IO routines.
*
* <!--(C) COPYRIGHT 2010 STMicroelectronics. All rights reserved. -->
*/
#ifndef UART_MIN_H_
#define UART_MIN_H_
2010-10-25 11:03:38 +02:00
#ifdef __ICCARM__
#include <yfuns.h>
#endif
/**
* @brief A list of the possible values for the parity parameter to uartInit()
*/
typedef enum
{
PARITY_NONE = 0,
PARITY_ODD = 1,
PARITY_EVEN = 2
} SerialParity;
/**
* @brief Initialize the UART
*
2010-10-25 11:03:38 +02:00
* @param baudrate The baudrate which will be used for communication.
* Ex: 115200
*
2010-10-25 11:03:38 +02:00
* @param databits The number of data bits used for communication.
* Valid values are 7 or 8
*
* @param parity The type of parity used for communication.
2010-10-25 11:03:38 +02:00
* See the SerialParity enum for possible values
*
* @param stopbits The number of stop bits used for communication.
2010-10-25 11:03:38 +02:00
* Valid values are 1 or 2
*/
void uartInit(uint32_t baudrate, uint8_t databits, SerialParity parity, uint8_t stopbits);
2010-10-25 11:03:38 +02:00
#ifdef __ICCARM__
/**
* @brief Flush the output stream. DLib_Config_Full.h defines fflush(), but
* this library includes too much code so we compile with DLib_Config_Normal.h
* instead which does not define fflush(). Therefore, we manually define
* fflush() in the low level UART driver. This function simply redirects
* to the __write() function with a NULL buffer, triggering a flush.
*
2010-10-25 11:03:38 +02:00
* @param handle The output stream. Should be set to 'stdout' like normal.
*
2010-10-25 11:03:38 +02:00
* @return Zero, indicating success.
*/
size_t fflush(int handle);
/**
* @brief Define the stdout stream. Since we compile with DLib_Config_Normal.h
* it does not define 'stdout'. There is a low-level IO define '_LLIO_STDOUT'
* which is equivalent to stdout. Therefore, we define 'stdout' to be
* '_LLIO_STDOUT'.
*/
#define stdout _LLIO_STDOUT
#endif
/**
* @brief Read the input byte if any.
2010-10-25 11:03:38 +02:00
*/
boolean __io_getcharNonBlocking(uint8_t *data);
2010-10-25 11:03:38 +02:00
void __io_putchar( char c );
int __io_getchar(void);
void __io_flush( void );
#endif //UART_MIN_H_