git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1476 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
86e45e167e
commit
58d50c17cd
|
@ -28,23 +28,23 @@
|
||||||
#include "hal.h"
|
#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. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -43,6 +43,10 @@
|
||||||
/* Driver data structures and types. */
|
/* Driver data structures and types. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Driver macros. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* External declarations. */
|
/* External declarations. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
|
@ -29,31 +29,42 @@
|
||||||
|
|
||||||
#if CH_HAL_USE_SERIAL || defined(__DOXYGEN__)
|
#if CH_HAL_USE_SERIAL || defined(__DOXYGEN__)
|
||||||
|
|
||||||
#if USE_AVR_USART0 || defined(__DOXYGEN__)
|
/*===========================================================================*/
|
||||||
|
/* Driver exported variables. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief USART0 serial driver identifier.
|
* @brief USART0 serial driver identifier.
|
||||||
* @note The name does not follow the convention used in the other ports
|
* @note The name does not follow the convention used in the other ports
|
||||||
* (COMn) because a name conflict with the AVR headers.
|
* (COMn) because a name conflict with the AVR headers.
|
||||||
*/
|
*/
|
||||||
|
#if USE_AVR_USART0 || defined(__DOXYGEN__)
|
||||||
SerialDriver SD1;
|
SerialDriver SD1;
|
||||||
#endif
|
#endif
|
||||||
#if USE_AVR_USART1 || defined(__DOXYGEN__)
|
|
||||||
/**
|
/**
|
||||||
* @brief USART1 serial driver identifier.
|
* @brief USART1 serial driver identifier.
|
||||||
* @note The name does not follow the convention used in the other ports
|
* @note The name does not follow the convention used in the other ports
|
||||||
* (COMn) because a name conflict with the AVR headers.
|
* (COMn) because a name conflict with the AVR headers.
|
||||||
*/
|
*/
|
||||||
|
#if USE_AVR_USART1 || defined(__DOXYGEN__)
|
||||||
SerialDriver SD2;
|
SerialDriver SD2;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** @brief Driver default configuration.*/
|
/*===========================================================================*/
|
||||||
|
/* Driver local variables. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Driver default configuration.
|
||||||
|
*/
|
||||||
static const SerialDriverConfig default_config = {
|
static const SerialDriverConfig default_config = {
|
||||||
UBRR(DEFAULT_USART_BITRATE),
|
UBRR(DEFAULT_USART_BITRATE),
|
||||||
(1 << UCSZ1) | (1 << UCSZ0)
|
(1 << UCSZ1) | (1 << UCSZ0)
|
||||||
};
|
};
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Low Level Driver local functions. */
|
/* Driver local functions. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
||||||
static void set_error(uint8_t sra, SerialDriver *sdp) {
|
static void set_error(uint8_t sra, SerialDriver *sdp) {
|
||||||
|
@ -131,7 +142,7 @@ static void usart1_deinit(void) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Low Level Driver interrupt handlers. */
|
/* Driver interrupt handlers. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
||||||
#if USE_AVR_USART0 || defined(__DOXYGEN__)
|
#if USE_AVR_USART0 || defined(__DOXYGEN__)
|
||||||
|
@ -201,7 +212,7 @@ CH_IRQ_HANDLER(USART1_UDRE_vect) {
|
||||||
#endif /* USE_AVR_USART1 */
|
#endif /* USE_AVR_USART1 */
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Low Level Driver exported functions. */
|
/* Driver exported functions. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -29,6 +29,10 @@
|
||||||
|
|
||||||
#if CH_HAL_USE_SERIAL || defined(__DOXYGEN__)
|
#if CH_HAL_USE_SERIAL || defined(__DOXYGEN__)
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Driver constants. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Driver pre-compile time settings. */
|
/* Driver pre-compile time settings. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
@ -74,7 +78,7 @@
|
||||||
#endif
|
#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];
|
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.
|
* @brief AVR Serial Driver configuration structure.
|
||||||
* @details An instance of this structure must be passed to @p sdStart()
|
* @details An instance of this structure must be passed to @p sdStart()
|
||||||
|
@ -135,6 +133,16 @@ typedef struct {
|
||||||
uint8_t csrc;
|
uint8_t csrc;
|
||||||
} SerialDriverConfig;
|
} 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. */
|
/* External declarations. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
Loading…
Reference in New Issue