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

This commit is contained in:
gdisirio 2010-07-31 06:46:17 +00:00
parent da5080f92a
commit 8e4fd21b2b
3 changed files with 18 additions and 14 deletions

View File

@ -70,7 +70,7 @@ static const SerialConfig default_config =
{
SERIAL_DEFAULT_BITRATE,
0,
USART_CR2_STOP1_BITS | USART_CR2_LINEN,
USART_CR2_STOP1_BITS,
0
};
@ -121,6 +121,9 @@ static void usart_deinit(USART_TypeDef *u) {
u->CR3 = 0;
}
#if USE_STM32_USART1 || USE_STM32_USART2 || USE_STM32_USART3 || \
((USE_STM32_USART4 || USE_STM32_USART5) && \
(defined(STM32F10X_HD) || defined(STM32F10X_CL)))
/**
* @brief Error handling routine.
*
@ -179,6 +182,7 @@ static void serve_interrupt(SerialDriver *sdp) {
chSysUnlockFromIsr();
}
}
#endif
#if USE_STM32_USART1 || defined(__DOXYGEN__)
static void notify1(void) {

View File

@ -373,10 +373,10 @@ void uart_lld_init(void) {
RCC->APB1RSTR = RCC_APB1RSTR_USART2RST;
RCC->APB1RSTR = 0;
uartObjectInit(&UARTD2);
UARTD1.ud_usart = USART2;
UARTD1.ud_dmarx = STM32_DMA_CHANNEL_6;
UARTD1.ud_dmatx = STM32_DMA_CHANNEL_7;
UARTD1.ud_dmaccr = 0;
UARTD2.ud_usart = USART2;
UARTD2.ud_dmarx = STM32_DMA_CHANNEL_6;
UARTD2.ud_dmatx = STM32_DMA_CHANNEL_7;
UARTD2.ud_dmaccr = 0;
#endif
}
@ -410,7 +410,7 @@ void uart_lld_start(UARTDriver *uartp) {
CORTEX_PRIORITY_MASK(STM32_UART_USART2_IRQ_PRIORITY));
NVICEnableVector(DMA1_Channel7_IRQn,
CORTEX_PRIORITY_MASK(STM32_UART_USART2_IRQ_PRIORITY));
RCC->APB1ENR |= RCC_APB2ENR_USART1EN;
RCC->APB1ENR |= RCC_APB1ENR_USART2EN;
}
#endif

View File

@ -57,7 +57,7 @@ void uartInit(void) {
/**
* @brief Initializes the standard part of a @p UARTDriver structure.
*
* @param[in] uartp pointer to the @p UARTDriver object
* @param[in] uartp pointer to the @p UARTDriver object
*/
void uartObjectInit(UARTDriver *uartp) {
@ -70,7 +70,7 @@ void uartObjectInit(UARTDriver *uartp) {
/**
* @brief Configures and activates the UART peripheral.
*
* @param[in] uartp pointer to the @p UARTDriver object
* @param[in] uartp pointer to the @p UARTDriver object
* @param[in] config pointer to the @p UARTConfig object
*/
void uartStart(UARTDriver *uartp, const UARTConfig *config) {
@ -92,7 +92,7 @@ void uartStart(UARTDriver *uartp, const UARTConfig *config) {
/**
* @brief Deactivates the UART peripheral.
*
* @param[in] uartp pointer to the @p UARTDriver object
* @param[in] uartp pointer to the @p UARTDriver object
*/
void uartStop(UARTDriver *uartp) {
@ -163,13 +163,13 @@ void uartStartSendI(UARTDriver *uartp, size_t n, const void *txbuf) {
* @brief Stops any ongoing transmission.
* @note Stopping a transmission also suppresses the transmission callbacks.
*
* @param[in] uartp pointer to the @p UARTDriver object
* @param[in] uartp pointer to the @p UARTDriver object
*/
void uartStopSend(UARTDriver *uartp) {
chDbgCheck(uartp != NULL, "uartStopSend");
chSysLock()
chSysLock();
chDbgAssert(uartp->ud_state == UART_READY,
"uartStopSend(), #1",
"not active");
@ -186,7 +186,7 @@ void uartStopSend(UARTDriver *uartp) {
* @note Stopping a transmission also suppresses the transmission callbacks.
* @note This function has to be invoked from a lock zone.
*
* @param[in] uartp pointer to the @p UARTDriver object
* @param[in] uartp pointer to the @p UARTDriver object
*/
void uartStopSendI(UARTDriver *uartp) {
@ -255,13 +255,13 @@ void uartStartReceiveI(UARTDriver *uartp, size_t n, void *rxbuf) {
* @brief Stops any ongoing receive operation.
* @note Stopping a receive operation also suppresses the receive callbacks.
*
* @param[in] uartp pointer to the @p UARTDriver object
* @param[in] uartp pointer to the @p UARTDriver object
*/
void uartStopReceive(UARTDriver *uartp) {
chDbgCheck(uartp != NULL, "uartStopReceive");
chSysLock()
chSysLock();
chDbgAssert(uartp->ud_state == UART_READY,
"uartStopReceive(), #1",
"not active");