[PATCH] Added interrupt handler for SD card
Mudit Jain
muditjain18011995 at gmail.com
Sat Aug 20 16:10:04 UTC 2016
This is in accordance with the information
in the datasheet and has been verified with the
linux source code for RPi
---
c/src/lib/libbsp/arm/raspberrypi/include/irq.h | 1 +
c/src/lib/libbsp/arm/raspberrypi/irq/irq.c | 15 +++++++++++++++
2 files changed, 16 insertions(+)
diff --git a/c/src/lib/libbsp/arm/raspberrypi/include/irq.h b/c/src/lib/libbsp/arm/raspberrypi/include/irq.h
index 8436c2d..e3b4e7d 100644
--- a/c/src/lib/libbsp/arm/raspberrypi/include/irq.h
+++ b/c/src/lib/libbsp/arm/raspberrypi/include/irq.h
@@ -51,6 +51,7 @@
#define BCM2835_IRQ_ID_UART 57
+#define BCM2835_IRQ_ID_SDCARD 62
#define BCM2835_IRQ_ID_TIMER_0 64
#define BCM2835_IRQ_ID_MAILBOX_0 65
#define BCM2835_IRQ_ID_DOORBELL_0 66
diff --git a/c/src/lib/libbsp/arm/raspberrypi/irq/irq.c b/c/src/lib/libbsp/arm/raspberrypi/irq/irq.c
index 7b3b2be..c205ef7 100644
--- a/c/src/lib/libbsp/arm/raspberrypi/irq/irq.c
+++ b/c/src/lib/libbsp/arm/raspberrypi/irq/irq.c
@@ -91,6 +91,11 @@ void bsp_interrupt_dispatch(void)
{
vector = BCM2835_IRQ_ID_SPI;
}
+ /* SD CARD */
+ else if ( BCM2835_REG(BCM2835_IRQ_PENDING2) & BCM2835_BIT(30) )
+ {
+ vector = BCM2835_IRQ_ID_SDCARD;
+ }
if ( vector < 255 )
{
@@ -144,6 +149,11 @@ rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
{
BCM2835_REG(BCM2835_IRQ_ENABLE2) = BCM2835_BIT(22);
}
+ /* SD CARD */
+ else if ( vector == BCM2835_IRQ_ID_SDCARD )
+ {
+ BCM2835_REG(BCM2835_IRQ_ENABLE2) = BCM2835_BIT(30);
+ }
rtems_interrupt_enable(level);
@@ -194,6 +204,11 @@ rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
{
BCM2835_REG(BCM2835_IRQ_DISABLE2) = BCM2835_BIT(22);
}
+ /* SD CARD */
+ else if ( vector == BCM2835_IRQ_ID_SDCARD )
+ {
+ BCM2835_REG(BCM2835_IRQ_DISABLE2) = BCM2835_REG(30);
+ }
rtems_interrupt_enable(level);
--
1.9.1
More information about the devel
mailing list