git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1476 35acf78f-673a-0410-8e92-d51de3d6d3f4

This commit is contained in:
gdisirio 2009-12-29 12:29:57 +00:00
parent 86e45e167e
commit 58d50c17cd
4 changed files with 41 additions and 18 deletions

View File

@ -28,23 +28,23 @@
#include "hal.h"
/*===========================================================================*/
/* Low Level Driver exported variables. */
/* Driver exported variables. */
/*===========================================================================*/
/*===========================================================================*/
/* Low Level Driver local variables. */
/* Driver local variables. */
/*===========================================================================*/
/*===========================================================================*/
/* Low Level Driver local functions. */
/* Driver local functions. */
/*===========================================================================*/
/*===========================================================================*/
/* Low Level Driver interrupt handlers. */
/* Driver interrupt handlers. */
/*===========================================================================*/
/*===========================================================================*/
/* Low Level Driver exported functions. */
/* Driver exported functions. */
/*===========================================================================*/
/**

View File

@ -43,6 +43,10 @@
/* Driver data structures and types. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver macros. */
/*===========================================================================*/
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/

View File

@ -29,31 +29,42 @@
#if CH_HAL_USE_SERIAL || defined(__DOXYGEN__)
#if USE_AVR_USART0 || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver exported variables. */
/*===========================================================================*/
/**
* @brief USART0 serial driver identifier.
* @note The name does not follow the convention used in the other ports
* (COMn) because a name conflict with the AVR headers.
*/
#if USE_AVR_USART0 || defined(__DOXYGEN__)
SerialDriver SD1;
#endif
#if USE_AVR_USART1 || defined(__DOXYGEN__)
/**
* @brief USART1 serial driver identifier.
* @note The name does not follow the convention used in the other ports
* (COMn) because a name conflict with the AVR headers.
*/
#if USE_AVR_USART1 || defined(__DOXYGEN__)
SerialDriver SD2;
#endif
/** @brief Driver default configuration.*/
/*===========================================================================*/
/* Driver local variables. */
/*===========================================================================*/
/**
* @brief Driver default configuration.
*/
static const SerialDriverConfig default_config = {
UBRR(DEFAULT_USART_BITRATE),
(1 << UCSZ1) | (1 << UCSZ0)
};
/*===========================================================================*/
/* Low Level Driver local functions. */
/* Driver local functions. */
/*===========================================================================*/
static void set_error(uint8_t sra, SerialDriver *sdp) {
@ -131,7 +142,7 @@ static void usart1_deinit(void) {
#endif
/*===========================================================================*/
/* Low Level Driver interrupt handlers. */
/* Driver interrupt handlers. */
/*===========================================================================*/
#if USE_AVR_USART0 || defined(__DOXYGEN__)
@ -201,7 +212,7 @@ CH_IRQ_HANDLER(USART1_UDRE_vect) {
#endif /* USE_AVR_USART1 */
/*===========================================================================*/
/* Low Level Driver exported functions. */
/* Driver exported functions. */
/*===========================================================================*/
/**

View File

@ -29,6 +29,10 @@
#if CH_HAL_USE_SERIAL || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
@ -74,7 +78,7 @@
#endif
/*===========================================================================*/
/* Unsupported event flags and custom events. */
/* Derived constants and error checks. */
/*===========================================================================*/
/*===========================================================================*/
@ -119,12 +123,6 @@ struct _serial_driver_data {
uint8_t ob[SERIAL_BUFFERS_SIZE];
};
/**
* @brief Macro for baud rate computation.
* @note Make sure the final baud rate is within tolerance.
*/
#define UBRR(b) ((F_CPU / (b << 4)) - 1)
/**
* @brief AVR Serial Driver configuration structure.
* @details An instance of this structure must be passed to @p sdStart()
@ -135,6 +133,16 @@ typedef struct {
uint8_t csrc;
} SerialDriverConfig;
/*===========================================================================*/
/* Driver macros. */
/*===========================================================================*/
/**
* @brief Macro for baud rate computation.
* @note Make sure the final baud rate is within tolerance.
*/
#define UBRR(b) ((F_CPU / (b << 4)) - 1)
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/