*
*
* \author Daniele Basile <asterix@develer.com>
+ * \author Stefano Fedrigo <aleph@develer.com>
*/
#include "hw/hw_ser.h" /* Required for bus macros overrides */
/* PIO is peripheral A */ \
PIOA_ABCDSR1 &= ~(BV(SPI0_SPCK) | BV(SPI0_MOSI) | BV(SPI0_MISO)); \
PIOA_ABCDSR2 &= ~(BV(SPI0_SPCK) | BV(SPI0_MOSI) | BV(SPI0_MISO)); \
- /* Peripheral B for chip select for display */ \
+ /* Peripheral B for chip select for display (FIXME: move away from driver) */ \
PIOA_ABCDSR1 |= BV(30); \
PIOA_ABCDSR2 &= ~BV(30); \
} while (0)
sysirq_setHandler(INT_SPI0, spi0_irq_handler);
PMC_PCER = BV(SPI0_ID);
- /* Enable interrupt on tx buffer empty */
- SPI0_IER = BV(SPI_TXEMPTY);
-
/* Enable SPI */
SPI0_CR = BV(SPI_SPIEN);
{
hw->sending = true;
SPI0_TDR = fifo_pop(&ser_handles[SER_SPI0]->txfifo);
+ /* Enable interrupt on tx buffer empty */
+ SPI0_IER = BV(SPI_TXEMPTY);
}
IRQ_RESTORE(flags);
sysirq_setHandler(INT_SPI1, spi1_irq_dispatcher);
PMC_PCER = BV(SPI1_ID);
- /* Enable interrupt on tx buffer empty */
- SPI1_IER = BV(SPI_TXEMPTY);
-
/* Enable SPI */
SPI1_CR = BV(SPI_SPIEN);
{
hw->sending = true;
SPI1_TDR = fifo_pop(&ser_handles[SER_SPI1]->txfifo);
+ /* Enable interrupt on tx buffer empty */
+ SPI1_IER = BV(SPI_TXEMPTY);
}
IRQ_RESTORE(flags);
if (!fifo_isempty(&ser_handles[SER_SPI0]->txfifo))
SPI0_TDR = fifo_pop(&ser_handles[SER_SPI0]->txfifo);
else
+ {
UARTDescs[SER_SPI0].sending = false;
+ /* Disable interrupt on tx buffer empty */
+ SPI0_IDR = BV(SPI_TXEMPTY);
+ }
SER_INT_ACK;
if (!fifo_isempty(&ser_handles[SER_SPI1]->txfifo))
SPI1_TDR = fifo_pop(&ser_handles[SER_SPI1]->txfifo);
else
+ {
UARTDescs[SER_SPI1].sending = false;
+ /* Disable interrupt on tx buffer empty */
+ SPI1_IDR = BV(SPI_TXEMPTY);
+ }
SER_INT_ACK;