/*!
* \file
* <!--
- * Copyright (C) 1999,2003 Bernardo Innocenti <bernie@develer.com>
- * Copyright (C) 2003 Develer S.r.l. (http://www.develer.com/)
+ * Copyright 2003,2004 Develer S.r.l. (http://www.develer.com/)
+ * Copyright 1999,2003 Bernardo Innocenti <bernie@develer.com>
* All Rights Reserved.
* -->
*
/*
* $Log$
- * Revision 1.1 2004/05/23 18:10:11 bernie
- * Import drv/ modules.
- *
- * Revision 1.5 2004/04/04 17:44:51 aleph
- * Move event.h from mware to kern dir
- *
- * Revision 1.4 2004/03/24 15:03:45 bernie
- * Use explicit include paths; clean Doxygen comments
- *
- * Revision 1.3 2004/03/03 18:27:44 bernie
- * Fixed race conds with IRQ when fiddling with I/O ports
- *
- * Revision 1.2 2003/12/18 18:15:24 aleph
- * Use new IRQ disable/enable reentrant macros
- *
- * Revision 1.1 2003/12/13 23:53:37 aleph
- * Add buzzer driver
+ * Revision 1.2 2004/05/23 18:21:53 bernie
+ * Trim CVS logs and cleanup header info.
*
*/
/*!
* \file
- * Copyright (C) 1999,2003 Bernardo Innocenti <bernie@develer.com>
- * Copyright (C) 2003 Develer S.r.l. (http://www.develer.com/)
+ * <!--
+ * Copyright 2003 Develer S.r.l. (http://www.develer.com/)
+ * Copyright 1999,2003 Bernardo Innocenti <bernie@develer.com>
* All Rights Reserved.
+ * -->
*
* \version $Id$
*
/*
* $Log$
- * Revision 1.1 2004/05/23 18:10:11 bernie
- * Import drv/ modules.
- *
- * Revision 1.1 2003/12/13 23:53:37 aleph
- * Add buzzer driver
+ * Revision 1.2 2004/05/23 18:21:53 bernie
+ * Trim CVS logs and cleanup header info.
*
*/
-#ifndef BUZZER_H
-#define BUZZER_H
+#ifndef DRV_BUZZER_H
+#define DRV_BUZZER_H
extern void buz_init(void);
extern void buz_beep(time_t time);
extern void buz_repeat_start(time_t duration, time_t interval);
extern void buz_repeat_stop(void);
-#endif /* BUZZER_H */
+#endif /* DRV_BUZZER_H */
-/*
+/*!
* \file
* <!--
* Copyright 2003,2004 Develer S.r.l. (http://www.develer.com/)
*/
/*
+ * $Log$
+ * Revision 1.2 2004/05/23 18:21:53 bernie
+ * Trim CVS logs and cleanup header info.
+ *
*/
#include "kdebug.h"
-/*
+/*!
* \file
* <!--
* Copyright 2003,2004 Develer S.r.l. (http://www.develer.com/)
/*
* $Log$
+ * Revision 1.2 2004/05/23 18:21:53 bernie
+ * Trim CVS logs and cleanup header info.
+ *
* Revision 1.1 2004/05/23 18:10:11 bernie
* Import drv/ modules.
*
/*!
* \file
* <!--
- * Copyright 2000 Bernardo Innocenti <bernie@codewiz.org>
* Copyright 2003,2004 Develer S.r.l. (http://www.develer.com/)
+ * Copyright 2000 Bernardo Innocenti <bernie@codewiz.org>
* All Rights Reserved.
* -->
*
/*
* $Log$
- * Revision 1.1 2004/05/23 18:10:11 bernie
- * Import drv/ modules.
- *
- * Revision 1.5 2004/05/14 12:47:26 rasky
- * Importato nuovo supporto seriale per AVR da Stefano
- *
- * Revision 1.4 2004/04/29 16:40:23 rasky
- * Durante i busy loop della seriale, chiama la proc_switch() per cambiare processo
- *
- * Revision 1.3 2004/04/21 17:38:24 rasky
- * New application
- *
- * Revision 1.16 2004/04/03 18:30:49 aleph
- * Move timeout defines in config, private define in .c
- *
- * Revision 1.15 2004/03/29 17:01:02 aleph
- * Add function to set serial parity, fix it when ser_open is used
- *
- * Revision 1.14 2004/03/29 16:19:33 aleph
- * Add ser_cleanup function; Various code improvements
+ * Revision 1.2 2004/05/23 18:21:53 bernie
+ * Trim CVS logs and cleanup header info.
*
- * Revision 1.13 2004/03/24 15:48:53 bernie
- * Remove Copyright messages from Doxygen output
*/
#include <mware/formatwr.h>
/*!
* \file
* <!--
- * Copyright 2000 Bernardo Innocenti <bernie@codewiz.org>
* Copyright 2003,2004 Develer S.r.l. (http://www.develer.com/)
+ * Copyright 2000 Bernardo Innocenti <bernie@codewiz.org>
* All Rights Reserved.
* -->
*
/*
* $Log$
- * Revision 1.1 2004/05/23 18:10:11 bernie
- * Import drv/ modules.
- *
- * Revision 1.2 2004/04/21 17:38:24 rasky
- * New application
- *
- * Revision 1.16 2004/04/03 18:30:49 aleph
- * Move timeout defines in config, private define in .c
- *
- * Revision 1.15 2004/03/29 17:01:02 aleph
- * Add function to set serial parity, fix it when ser_open is used
- *
- * Revision 1.14 2004/03/29 16:19:33 aleph
- * Add ser_cleanup function; Various code improvements
- *
- * Revision 1.13 2004/03/24 15:22:27 aleph
- * Removed subdirs -I, fix header inclusion, move config.h in board_kf, kctrl
- *
- * Revision 1.12 2004/03/17 17:30:30 bernie
- * Add GCC format checks to printf()-like functions.
- *
- * Revision 1.11 2004/03/16 23:06:42 aleph
- * Doc fix
+ * Revision 1.2 2004/05/23 18:21:53 bernie
+ * Trim CVS logs and cleanup header info.
*
- * Revision 1.10 2004/03/12 18:46:53 bernie
- * ser_read(): New function.
- *
- * Revision 1.9 2004/03/11 18:11:51 bernie
- * Cosmetic fixes
*/
-#ifndef SER_H
-#define SER_H
+#ifndef DRV_SER_H
+#define DRV_SER_H
#include "compiler.h"
#include <mware/fifobuf.h>
#elif defined(__AVR_ATmega103__)
SER_UART0,
SER_SPI,
-
+
#elif defined (__m56800__)
SER_UART0,
- SER_UART1,
-
+ SER_UART1,
+
#else
#error unknown architecture
#endif
/*! Holds the flags defined above. Will be 0 when no errors have occurred. */
REGISTER uint16_t status;
-
+
/*! Low-level interface to hardware. */
struct SerialHardware* hw;
-
};
extern void ser_settimeouts(struct Serial *port, time_t rxtimeout, time_t txtimeout);
#endif
-/**
- * @name Additional functions implemented as macros
+/*!
+ * \name Additional functions implemented as macros
*
- * @{
+ * \{
*/
#define ser_getstatus(h) ((h)->status)
#define ser_setstatus(h, x) ((h)->status = (x))
-/* @} */
+/* \} */
-#endif /* SER_H */
+#endif /* DRV_SER_H */
-/**
+/*!
* \file
* <!--
* Copyright 2000 Bernardo Innocenti <bernie@codewiz.org>
- * Copyright 2003, 2004 Develer S.r.l. (http://www.develer.com/)
+ * Copyright 2003,2004 Develer S.r.l. (http://www.develer.com/)
* All Rights Reserved.
* -->
*
/*
* $Log$
- * Revision 1.1 2004/05/23 18:10:11 bernie
- * Import drv/ modules.
- *
- * Revision 1.30 2004/05/19 17:06:11 bernie
- * Serial TX fill mode
- *
- * Revision 1.29 2004/05/16 19:16:46 aleph
- * Serial always transmitting, first try
- *
- * Revision 1.28 2004/05/14 12:09:00 aleph
- * Fix TX port pull-ups
- *
- * Revision 1.27 2004/05/08 13:56:02 aleph
- * Adapt avr serial driver to new design
- *
- * Revision 1.25 2004/04/28 13:42:16 aleph
- * Serial port fixes
- *
- * Revision 1.24 2004/04/08 14:17:27 bernie
- * Change serial to disable TX when not sending data
+ * Revision 1.2 2004/05/23 18:21:53 bernie
+ * Trim CVS logs and cleanup header info.
*
- * Revision 1.23 2004/04/03 20:39:41 aleph
- * Remove strobe
- *
- * Revision 1.22 2004/03/29 17:01:02 aleph
- * Add function to set serial parity, fix it when ser_open is used
*/
#include "ser.h"
#ifdef __AVR_ATmega103__
/* Macro for ATmega103 compatibility */
- #define UCSR0B UCR
- #define UDR0 UDR
- #define UCSR0A USR
+ #define UCSR0B UCR
+ #define UDR0 UDR
+ #define UCSR0A USR
#define UBRR0L UBRR
#else
- #define UCR UCSR0B
- #define UDR UDR0
- #define USR UCSR0A
+ #define UCR UCSR0B
+ #define UDR UDR0
+ #define USR UCSR0A
#endif
/* Send data only if the SPI is not already transmitting */
if (!spi_sending && !fifo_isempty(&ser_handles[SER_SPI].txfifo))
{
- SPDR = fifo_pop(&ser_handles[SER_SPI].txfifo);
+ SPDR = fifo_pop(&ser_handles[SER_SPI].txfifo);
spi_sending = true;
}
{
UCSRB &= ~TXCIE;
ReceiveMode();
- UCSRB = RXCIE | RXEN | TXEN; //Abilito l'Interrupt in ricezione e RX e TX
+ UCSRB = RXCIE | RXEN | TXEN; //Abilito l'Interrupt in ricezione e RX e TX
}
*/
-static const struct SerialHardwareVT UART0_VT =
+static const struct SerialHardwareVT UART0_VT =
{
.init = uart0_init,
.cleanup = uart0_cleanup,
.enabletxirq = uart0_enabletxirq,
};
-static const struct SerialHardwareVT UART1_VT =
+static const struct SerialHardwareVT UART1_VT =
{
.init = uart1_init,
.cleanup = uart1_cleanup,
.enabletxirq = uart1_enabletxirq,
};
-static const struct SerialHardwareVT SPI_VT =
+static const struct SerialHardwareVT SPI_VT =
{
.init = spi_init,
.cleanup = spi_cleanup,
static struct AvrSerial UARTDescs[SER_CNT] =
{
- {
- .hw = { .table = &UART0_VT },
- },
-
- {
- .hw = { .table = &UART1_VT },
- },
-
- {
- .hw = { .table = &SPI_VT },
- },
+ {
+ .hw = { .table = &UART0_VT },
+ },
+
+ {
+ .hw = { .table = &UART1_VT },
+ },
+
+ {
+ .hw = { .table = &SPI_VT },
+ },
};
struct SerialHardware* ser_hw_getdesc(int unit)
-/**
+/*!
* \file
- * Copyright (C) 2003 Develer S.r.l. (http://www.develer.com/)
+ * <!--
+ * Copyright (C) 2003,2004 Develer S.r.l. (http://www.develer.com/)
* All Rights Reserved.
+ * -->
*
* \version $Id$
*
* \author Stefano Fedrigo <aleph@develer.com>
+ * \author Giovanni Bajo <rasky@develer.com>
*
* \brief DSP5680x CPU specific serial I/O driver
*/
-#include <DSP56F807.H>
-#include <drv/kdebug.h>
-#include <hw.h>
+/*
+ * $Log$
+ * Revision 1.2 2004/05/23 18:21:53 bernie
+ * Trim CVS logs and cleanup header info.
+ *
+ */
+
#include "ser.h"
#include "ser_p.h"
+#include <drv/kdebug.h>
+#include <hw.h>
+#include <DSP56F807.H>
// GPIO E is shared with SPI (in DSP56807). Pins 0&1 are TXD0 and RXD0. To use
// the serial, we need to disable the GPIO functions on them.
{
volatile struct REG_SCI_STRUCT* regs = hw->regs;
- hw->serial->status |= regs->SR & (SERRF_PARITYERROR |
- SERRF_RXSROVERRUN |
- SERRF_FRAMEERROR |
+ hw->serial->status |= regs->SR & (SERRF_PARITYERROR |
+ SERRF_RXSROVERRUN |
+ SERRF_FRAMEERROR |
SERRF_NOISEERROR);
-
+
if (fifo_isfull(&hw->serial->rxfifo))
hw->serial->status |= SERRF_RXFIFOOVERRUN;
else
fifo_push(&hw->serial->rxfifo, regs->DR);
-
+
// Writing anything to the status register clear the
// error bits.
regs->SR = 0;
// Clear status register (IRQ/status flags)
(void)regs->SR;
regs->SR = 0;
-
+
// Clear data register
(void)regs->DR;
-
+
// Set priorities for both IRQs
irq_setpriority(hw->irq_tx, IRQ_PRIORITY_SCI_TX);
irq_setpriority(hw->irq_rx, IRQ_PRIORITY_SCI_RX);
// Activate the RX error interrupts, and RX/TX transmissions
regs->CR = REG_SCI_CR_TE | REG_SCI_CR_RE;
enable_rx_irq_bare(regs);
-
+
// Disable GPIO pins for TX and RX lines
REG_GPIO_SERIAL->PER |= REG_GPIO_SERIAL_MASK;
static struct SCI SCIDescs[2] =
{
- {
- .hw = { .table = &SCI_VT },
- .regs = ®_SCI[0],
- .irq_rx = IRQ_SCI0_RECEIVER_FULL,
- .irq_tx = IRQ_SCI0_TRANSMITTER_READY,
- },
-
- {
- .hw = { .table = &SCI_VT },
+ {
+ .hw = { .table = &SCI_VT },
+ .regs = ®_SCI[0],
+ .irq_rx = IRQ_SCI0_RECEIVER_FULL,
+ .irq_tx = IRQ_SCI0_TRANSMITTER_READY,
+ },
+
+ {
+ .hw = { .table = &SCI_VT },
.regs = ®_SCI[1],
- .irq_rx = IRQ_SCI1_RECEIVER_FULL,
- .irq_tx = IRQ_SCI1_TRANSMITTER_READY,
- },
+ .irq_rx = IRQ_SCI1_RECEIVER_FULL,
+ .irq_tx = IRQ_SCI1_TRANSMITTER_READY,
+ },
};
-/**
+/*!
* \file
- * Copyright (C) 2000 Bernardo Innocenti <bernie@codewiz.org>
+ * <!--
* Copyright (C) 2003 Develer S.r.l. (http://www.develer.com/)
+ * Copyright (C) 2000 Bernardo Innocenti <bernie@codewiz.org>
* All Rights Reserved.
+ * -->
*
* \version $Id$
*
/*
* $Log$
- * Revision 1.1 2004/05/23 18:10:11 bernie
- * Import drv/ modules.
- *
- * Revision 1.1 2003/11/20 22:30:21 aleph
- * Add serial driver
+ * Revision 1.2 2004/05/23 18:21:53 bernie
+ * Trim CVS logs and cleanup header info.
*
*/
-/**
+/*!
* \file
+ * <!--
* Copyright (C) 2003,2004 Develer S.r.l. (http://www.develer.com/)
* All Rights Reserved.
+ * -->
*
* \brief Hardware dependent serial driver (interface)
*
/*
* $Log$
- * Revision 1.1 2004/05/23 18:10:11 bernie
- * Import drv/ modules.
- *
- * Revision 1.1 2004/05/14 12:47:26 rasky
- * Importato nuovo supporto seriale per AVR da Stefano
- *
- * Revision 1.3 2004/05/08 13:59:08 aleph
- * Fix header guard
- *
- * Revision 1.2 2004/05/08 13:58:36 aleph
- * Add log comment
+ * Revision 1.2 2004/05/23 18:21:53 bernie
+ * Trim CVS logs and cleanup header info.
*
*/
-#ifndef _DRV_SER_P_H
-#define _DRV_SER_P_H
+#ifndef DRV_SER_P_H
+#define DRV_SER_P_H
struct SerialHardware;
struct Serial;
struct SerialHardware* ser_hw_getdesc(int unit);
-#endif // _DRV_SER_P_H
+#endif /* DRV_SER_P_H */