Contiki 2.6

uart.h

Go to the documentation of this file.
00001 /** @file hal/micro/cortexm3/uart.h
00002  * @brief Header for STM32W  uart drivers, supporting IAR's standard library
00003  *        IO routines.
00004  *
00005  * <!--(C) COPYRIGHT 2010 STMicroelectronics. All rights reserved.        -->
00006  */
00007 
00008 #ifndef __UART_MIN_H__
00009 #define __UART_MIN_H__
00010 #ifdef __ICCARM__
00011 #include <yfuns.h>
00012 #endif
00013 
00014 /**
00015  * @brief A list of the possible values for the parity parameter to uartInit()
00016  */
00017 typedef enum
00018 {
00019   PARITY_NONE = 0,
00020   PARITY_ODD = 1,
00021   PARITY_EVEN = 2
00022 } SerialParity;
00023 
00024 /**
00025  * @brief Initialize the UART
00026  * 
00027  * @param baudrate  The baudrate which will be used for communication.
00028  *                  Ex: 115200
00029  *  
00030  * @param databits  The number of data bits used for communication.
00031  *                  Valid values are 7 or 8
00032  * 
00033  * @param parity    The type of parity used for communication.  
00034  *                  See the SerialParity enum for possible values
00035  * 
00036  * @return stopbits The number of stop bits used for communication.
00037  *                  Valid values are 1 or 2
00038  */
00039 void uartInit(int32u baudrate, int8u databits, SerialParity parity, int8u stopbits);
00040 
00041 #ifdef __ICCARM__
00042 /**
00043  * @brief Flush the output stream.  DLib_Config_Full.h defines fflush(), but
00044  * this library includes too much code so we compile with DLib_Config_Normal.h
00045  * instead which does not define fflush().  Therefore, we manually define
00046  * fflush() in the low level UART driver.  This function simply redirects
00047  * to the __write() function with a NULL buffer, triggering a flush.
00048  * 
00049  * @param handle  The output stream.  Should be set to 'stdout' like normal.
00050  *  
00051  * @return Zero, indicating success.
00052  */
00053 size_t fflush(int handle);
00054 
00055 /**
00056  * @brief Define the stdout stream.  Since we compile with DLib_Config_Normal.h
00057  * it does not define 'stdout'.  There is a low-level IO define '_LLIO_STDOUT'
00058  * which is equivalent to stdout.  Therefore, we define 'stdout' to be
00059  * '_LLIO_STDOUT'.
00060  */
00061 #define stdout _LLIO_STDOUT
00062 #endif
00063 /**
00064  * @brief Read the input byte if any. 
00065  */
00066 boolean __io_getcharNonBlocking(int8u *data);
00067 void __io_putchar( char c );
00068 int __io_getchar(void);
00069 void __io_flush( void );
00070 
00071 
00072 #endif //__UART_MIN_H__