git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1107 35acf78f-673a-0410-8e92-d51de3d6d3f4
parent
4682722567
commit
6cb018ac39
|
@ -92,7 +92,7 @@ SRC = ${PORTSRC} \
|
||||||
../../os/io/serial.c \
|
../../os/io/serial.c \
|
||||||
../../os/io/platforms/AVR/serial_lld.c \
|
../../os/io/platforms/AVR/serial_lld.c \
|
||||||
../../os/various/evtimer.c \
|
../../os/various/evtimer.c \
|
||||||
board.c main.c
|
lcd.c board.c main.c
|
||||||
|
|
||||||
|
|
||||||
# List C++ source files here. (C dependencies are automatically generated.)
|
# List C++ source files here. (C dependencies are automatically generated.)
|
||||||
|
|
|
@ -55,7 +55,7 @@ static const SerialDriverConfig default_config = {
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
||||||
static void set_error(uint8_t sra, SerialDriver *sdp) {
|
static void set_error(uint8_t sra, SerialDriver *sdp) {
|
||||||
dflags_t sts = 0;
|
sdflags_t sts = 0;
|
||||||
|
|
||||||
if (sra & (1 << DOR))
|
if (sra & (1 << DOR))
|
||||||
sts |= SD_OVERRUN_ERROR;
|
sts |= SD_OVERRUN_ERROR;
|
||||||
|
@ -78,7 +78,7 @@ static void notify1(void) {
|
||||||
* @brief USART0 initialization.
|
* @brief USART0 initialization.
|
||||||
* @param[in] config the architecture-dependent serial driver configuration
|
* @param[in] config the architecture-dependent serial driver configuration
|
||||||
*/
|
*/
|
||||||
void usart0_init(SerialDriverConfig *config) {
|
void usart0_init(const SerialDriverConfig *config) {
|
||||||
|
|
||||||
UBRR0L = config->brr;
|
UBRR0L = config->brr;
|
||||||
UBRR0H = config->brr >> 8;
|
UBRR0H = config->brr >> 8;
|
||||||
|
@ -108,7 +108,7 @@ static void notify2(void) {
|
||||||
* @brief USART1 initialization.
|
* @brief USART1 initialization.
|
||||||
* @param[in] config the architecture-dependent serial driver configuration
|
* @param[in] config the architecture-dependent serial driver configuration
|
||||||
*/
|
*/
|
||||||
void usart1_init(SerialDriverConfig *config) {
|
void usart1_init(const SerialDriverConfig *config) {
|
||||||
|
|
||||||
UBRR1L = config->brr;
|
UBRR1L = config->brr;
|
||||||
UBRR1H = config->brr >> 8;
|
UBRR1H = config->brr >> 8;
|
||||||
|
@ -140,9 +140,9 @@ CH_IRQ_HANDLER(USART0_RX_vect) {
|
||||||
|
|
||||||
sra = UCSR0A;
|
sra = UCSR0A;
|
||||||
if (sra & ((1 << DOR) | (1 << UPE) | (1 << FE)))
|
if (sra & ((1 << DOR) | (1 << UPE) | (1 << FE)))
|
||||||
set_error(sra, &SER1);
|
set_error(sra, &SD1);
|
||||||
chSysLockFromIsr();
|
chSysLockFromIsr();
|
||||||
sdIncomingDataI(&SER1, UDR0);
|
sdIncomingDataI(&SD1, UDR0);
|
||||||
chSysUnlockFromIsr();
|
chSysUnlockFromIsr();
|
||||||
|
|
||||||
CH_IRQ_EPILOGUE();
|
CH_IRQ_EPILOGUE();
|
||||||
|
@ -173,9 +173,9 @@ CH_IRQ_HANDLER(USART1_RX_vect) {
|
||||||
|
|
||||||
sra = UCSR1A;
|
sra = UCSR1A;
|
||||||
if (sra & ((1 << DOR) | (1 << UPE) | (1 << FE)))
|
if (sra & ((1 << DOR) | (1 << UPE) | (1 << FE)))
|
||||||
set_error(sra, &SER2);
|
set_error(sra, &SD2);
|
||||||
chSysLockFromIsr();
|
chSysLockFromIsr();
|
||||||
sdIncomingDataI(&SER2, UDR1);
|
sdIncomingDataI(&SD2, UDR1);
|
||||||
chSysUnlockFromIsr();
|
chSysUnlockFromIsr();
|
||||||
|
|
||||||
CH_IRQ_EPILOGUE();
|
CH_IRQ_EPILOGUE();
|
||||||
|
@ -187,7 +187,7 @@ CH_IRQ_HANDLER(USART1_UDRE_vect) {
|
||||||
CH_IRQ_PROLOGUE();
|
CH_IRQ_PROLOGUE();
|
||||||
|
|
||||||
chSysLockFromIsr();
|
chSysLockFromIsr();
|
||||||
b = sdRequestDataI(&SER2);
|
b = sdRequestDataI(&SD2);
|
||||||
chSysUnlockFromIsr();
|
chSysUnlockFromIsr();
|
||||||
if (b < Q_OK)
|
if (b < Q_OK)
|
||||||
UCSR1B &= ~(1 << UDRIE);
|
UCSR1B &= ~(1 << UDRIE);
|
||||||
|
@ -207,11 +207,11 @@ CH_IRQ_HANDLER(USART1_UDRE_vect) {
|
||||||
*/
|
*/
|
||||||
void sd_lld_init(void) {
|
void sd_lld_init(void) {
|
||||||
|
|
||||||
#if USE_MSP430_USART0
|
#if USE_AVR_USART0
|
||||||
sdObjectInit(&COM1, NULL, notify1);
|
sdObjectInit(&SD1, NULL, notify1);
|
||||||
#endif
|
#endif
|
||||||
#if USE_MSP430_USART1
|
#if USE_AVR_USART1
|
||||||
sdObjectInit(&COM2, NULL, notify2);
|
sdObjectInit(&SD2, NULL, notify2);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue