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

This commit is contained in:
gdisirio 2009-02-06 21:28:07 +00:00
parent cfe5d367c2
commit 35b0454ddb
6 changed files with 13 additions and 11 deletions

View File

@ -29,6 +29,8 @@
#ifndef __STM32F10x_MAP_H #ifndef __STM32F10x_MAP_H
#include "stm32lib/stm32f10x_map.h" #include "stm32lib/stm32f10x_map.h"
#endif #endif
#define FALSE 0
#define TRUE (!FALSE)
#define BOARD_OLIMEX_STM32_P103 #define BOARD_OLIMEX_STM32_P103

View File

@ -140,11 +140,11 @@ void sam7x_set_usart(AT91PS_USART u, int speed, int mr) {
u->US_CR = AT91C_US_RSTRX | AT91C_US_RSTTX | AT91C_US_RSTSTA; u->US_CR = AT91C_US_RSTRX | AT91C_US_RSTTX | AT91C_US_RSTSTA;
/* New parameters setup.*/ /* New parameters setup.*/
if (mode & AT91C_US_OVER) if (mr & AT91C_US_OVER)
u->US_BRGR = MCK / (speed * 8); u->US_BRGR = MCK / (speed * 8);
else else
u->US_BRGR = MCK / (speed * 16); u->US_BRGR = MCK / (speed * 16);
u->US_MR = mode; u->US_MR = mr;
u->US_RTOR = 0; u->US_RTOR = 0;
u->US_TTGR = 0; u->US_TTGR = 0;

View File

@ -70,7 +70,7 @@
extern "C" { extern "C" {
#endif #endif
void sam7x_serial_init(int prio0, int prio1); void sam7x_serial_init(int prio0, int prio1);
void sam7x_set_usart(AT91PS_USART u, int speed, int mode); void sam7x_set_usart(AT91PS_USART u, int speed, int mr);
CH_IRQ_HANDLER(UART0IrqHandler); CH_IRQ_HANDLER(UART0IrqHandler);
CH_IRQ_HANDLER(UART1IrqHandler); CH_IRQ_HANDLER(UART1IrqHandler);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -161,8 +161,8 @@ static void OutNotify3(void) {
* @note Must be invoked with interrupts disabled. * @note Must be invoked with interrupts disabled.
* @note Does not reset the I/O queues. * @note Does not reset the I/O queues.
*/ */
void SetUSART(USART_TypeDef *u, uint32_t speed, uint16_t cr1, void stm32_set_usart(USART_TypeDef *u, uint32_t speed, uint16_t cr1,
uint16_t cr2, uint16_t cr3) { uint16_t cr2, uint16_t cr3) {
/* /*
* Baud rate setting. * Baud rate setting.

View File

@ -102,7 +102,7 @@ static void OutNotify1(void) {
* @param ctl The value for the @p U0CTL register. * @param ctl The value for the @p U0CTL register.
* @note Does not reset the I/O queues. * @note Does not reset the I/O queues.
*/ */
void SetUSART0(uint16_t div, uint8_t mod, uint8_t ctl) { void msp430_set_usart0(uint16_t div, uint8_t mod, uint8_t ctl) {
U0CTL = SWRST; /* Resets the USART, it should already be */ U0CTL = SWRST; /* Resets the USART, it should already be */
/* USART init */ /* USART init */
@ -176,7 +176,7 @@ static void OutNotify2(void) {
* @note Must be invoked with interrupts disabled. * @note Must be invoked with interrupts disabled.
* @note Does not reset the I/O queues. * @note Does not reset the I/O queues.
*/ */
void SetUSART1(uint16_t div, uint8_t mod, uint8_t ctl) { void msp430_set_usart1(uint16_t div, uint8_t mod, uint8_t ctl) {
U1CTL = SWRST; /* Resets the USART, it should already be */ U1CTL = SWRST; /* Resets the USART, it should already be */
/* USART init */ /* USART init */
@ -204,12 +204,12 @@ void msp430_serial_init(void) {
/* I/O queues setup.*/ /* I/O queues setup.*/
#if USE_MSP430_USART0 #if USE_MSP430_USART0
chFDDInit(&COM1, ib1, sizeof ib1, NULL, ob1, sizeof ob1, OutNotify1); chFDDInit(&COM1, ib1, sizeof ib1, NULL, ob1, sizeof ob1, OutNotify1);
SetUSART0(UBR(38400), 0, CHAR); msp430_set_usart0(UBR(38400), 0, CHAR);
#endif #endif
#if USE_MSP430_USART1 #if USE_MSP430_USART1
chFDDInit(&COM2, ib2, sizeof ib2, NULL, ob2, sizeof ob2, OutNotify2); chFDDInit(&COM2, ib2, sizeof ib2, NULL, ob2, sizeof ob2, OutNotify2);
SetUSART1(UBR(38400), 0, CHAR); msp430_set_usart1(UBR(38400), 0, CHAR);
#endif #endif
} }

View File

@ -65,8 +65,8 @@
extern "C" { extern "C" {
#endif #endif
void msp430_serial_init(void); void msp430_serial_init(void);
void SetUSART0(uint16_t div, uint8_t mod, uint8_t ctl); void msp430_set_usart0(uint16_t div, uint8_t mod, uint8_t ctl);
void SetUSART1(uint16_t div, uint8_t mod, uint8_t ctl); void msp430_set_usart1(uint16_t div, uint8_t mod, uint8_t ctl);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif