From 327d426e30af5cc68d9de004b2f21e0aec82f56a Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@6dc7ffe9-61d6-0310-9af1-9938baff3ed1> Date: Sun, 23 Jul 2006 15:45:21 +0000 Subject: - add RC632 Interrupt USB packet generation - use new IRQ priority definitions git-svn-id: https://svn.openpcd.org:2342/trunk@26 6dc7ffe9-61d6-0310-9af1-9938baff3ed1 --- openpcd/firmware/src/pcd_enumerate.c | 4 ++-- openpcd/firmware/src/pcd_enumerate.h | 1 + openpcd/firmware/src/rc632.c | 37 ++++++++++++++++++++++++++---------- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/openpcd/firmware/src/pcd_enumerate.c b/openpcd/firmware/src/pcd_enumerate.c index 241feb3..c21c52e 100644 --- a/openpcd/firmware/src/pcd_enumerate.c +++ b/openpcd/firmware/src/pcd_enumerate.c @@ -246,9 +246,9 @@ AT91PS_CDC AT91F_CDC_Open(AT91PS_UDP pUdp) pCdc->currentConnection = 0; pCdc->currentRcvBank = AT91C_UDP_RX_DATA_BK0; - AT91F_AIC_ConfigureIt(AT91C_BASE_AIC, AT91C_ID_UDP, AT91C_AIC_PRIOR_LOWEST, + AT91F_AIC_ConfigureIt(AT91C_BASE_AIC, AT91C_ID_UDP, + OPENPCD_IRQ_PRIO_UDP, AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL, udp_irq); - //AT91C_AIC_SRCTYPE_INT_POSITIVE_EDGE, udp_irq); AT91F_AIC_EnableIt(AT91C_BASE_AIC, AT91C_ID_UDP); /* End-of-Bus-Reset is always enabled */ diff --git a/openpcd/firmware/src/pcd_enumerate.h b/openpcd/firmware/src/pcd_enumerate.h index f365fb4..d51ffa3 100644 --- a/openpcd/firmware/src/pcd_enumerate.h +++ b/openpcd/firmware/src/pcd_enumerate.h @@ -31,6 +31,7 @@ typedef struct _AT91S_CDC unsigned char currentConfiguration; unsigned char currentConnection; unsigned int currentRcvBank; + void *ep_ctx[4]; } AT91S_CDC, *AT91PS_CDC; //* external function description diff --git a/openpcd/firmware/src/rc632.c b/openpcd/firmware/src/rc632.c index e60e051..4d62b49 100644 --- a/openpcd/firmware/src/rc632.c +++ b/openpcd/firmware/src/rc632.c @@ -7,6 +7,7 @@ #include #include +#include #include "openpcd.h" #include "fifo.h" #include "dbgu.h" @@ -152,7 +153,7 @@ u_int8_t rc632_fifo_read(u_int8_t max_len, u_int8_t *data) } /* RC632 interrupt handling */ - +static struct openpcd_hdr irq_opcdh; static void rc632_irq(void) { @@ -165,7 +166,7 @@ static void rc632_irq(void) if (cause & RC632_INT_LOALERT) { /* FIFO is getting low, refill from virtual FIFO */ - DEBUGP("FIFO low alert "); + DEBUGP("FIFO_low "); #if 0 if (!fifo_available(&rc632.fifo)) return; @@ -174,14 +175,22 @@ static void rc632_irq(void) } if (cause & RC632_INT_HIALERT) { /* FIFO is getting full, empty into virtual FIFO */ - DEBUGP("FIFO high alert "); - /* FIXME */ - } - if (cause & RC632_INT_TIMER) { - /* Timer has expired, signal it to host */ - DEBUGP("Timer alert "); + DEBUGP("FIFO_high "); /* FIXME */ } + /* All interrupts below can be reported directly to the host */ + if (cause & RC632_INT_TIMER) + DEBUGP("Timer "); + if (cause & RC632_INT_IDLE) + DEBUGP("Idle "); + if (cause & RC632_INT_RX) + DEBUGP("RxComplete "); + if (cause & RC632_INT_TX) + DEBUGP("TxComplete "); + + irq_opcdh.val = cause; + + AT91F_UDP_Write(1, &irq_opcdh, sizeof(irq_opcdh)); DEBUGP("\n"); } @@ -219,7 +228,8 @@ void rc632_init(void) //AT91F_SPI_Enable(pSPI); - AT91F_AIC_ConfigureIt(AT91C_BASE_AIC, AT91C_ID_SPI, AT91C_AIC_PRIOR_HIGHEST, + AT91F_AIC_ConfigureIt(AT91C_BASE_AIC, AT91C_ID_SPI, + OPENPCD_IRQ_PRIO_SPI, AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL, &spi_irq); AT91F_AIC_EnableIt(AT91C_BASE_AIC, AT91C_ID_SPI); AT91F_SPI_EnableIt(pSPI, AT91C_SPI_MODF|AT91C_SPI_OVRES); @@ -232,12 +242,19 @@ void rc632_init(void) //AT91F_SPI_Reset(pSPI); /* Register rc632_irq */ - AT91F_AIC_ConfigureIt(AT91C_BASE_AIC, AT91C_ID_IRQ1, AT91C_AIC_PRIOR_LOWEST, + AT91F_AIC_ConfigureIt(AT91C_BASE_AIC, OPENPCD_RC632_IRQ, + OPENPCD_IRQ_PRIO_RC632, AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL, &rc632_irq); AT91F_AIC_EnableIt(AT91C_BASE_AIC, AT91C_ID_IRQ1); AT91F_PIO_CfgOutput(AT91C_BASE_PIOA, OPENPCD_RC632_RESET); + /* initialize static part of openpcd_hdr for USB IRQ reporting */ + irq_opcdh.cmd = OPENPCD_CMD_IRQ; + irq_opcdh.flags = 0x00; + irq_opcdh.reg = 0x07; + irq_opcdh.len = 0x00; + rc632_reset(); }; -- cgit v1.2.3