-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbsp-csb337-Use-IRQ-extensions-API.patch
133 lines (117 loc) · 4.24 KB
/
bsp-csb337-Use-IRQ-extensions-API.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
From 6886a485301330b1347b89432b2c49287dc41010 Mon Sep 17 00:00:00 2001
From: Vipul Nayyar <[email protected]>
Date: Sun, 7 Jul 2013 15:00:45 +0200
Subject: [PATCH] bsp/csb337: Use IRQ extensions API
Fix warnings.
---
c/src/lib/libbsp/arm/csb337/network/network.c | 53 +++++++++------------------
1 file changed, 17 insertions(+), 36 deletions(-)
diff --git a/c/src/lib/libbsp/arm/csb337/network/network.c b/c/src/lib/libbsp/arm/csb337/network/network.c
index e31bcc0..9e0a4be 100644
--- a/c/src/lib/libbsp/arm/csb337/network/network.c
+++ b/c/src/lib/libbsp/arm/csb337/network/network.c
@@ -22,6 +22,7 @@
#include <errno.h>
#include <rtems/error.h>
+#include <assert.h>
#include <sys/param.h>
#include <sys/mbuf.h>
@@ -83,20 +84,7 @@
#define START_TRANSMIT_EVENT RTEMS_EVENT_2
static void at91rm9200_emac_isr (rtems_irq_hdl_param unused);
-static void at91rm9200_emac_isr_on(const rtems_irq_connect_data *unused);
-static void at91rm9200_emac_isr_off(const rtems_irq_connect_data *unused);
-static int at91rm9200_emac_isr_is_on(const rtems_irq_connect_data *irq);
-
-/* Replace the first value with the clock's interrupt name. */
-rtems_irq_connect_data at91rm9200_emac_isr_data = {
- AT91RM9200_INT_EMAC,
- at91rm9200_emac_isr,
- NULL,
- at91rm9200_emac_isr_on,
- at91rm9200_emac_isr_off,
- at91rm9200_emac_isr_is_on
-};
-
+static void at91rm9200_emac_isr_on(void);
/* use the values defined in linkcmds for our use of SRAM */
extern void * at91rm9200_emac_rxbuf_hdrs;
@@ -209,11 +197,11 @@ static int at91rm9200_emac_ioctl (struct ifnet *ifp,
ioctl_command_t command,
caddr_t data);
-
+#if csb637
/*
* phyread(): Read the PHY
*/
-uint32_t phyread(uint8_t reg)
+static uint32_t phyread(uint8_t reg)
{
EMAC_REG(EMAC_MAN) = (0x01 << 30 /* Start of Frame Delimiter */
| 0x02 << 28 /* Operation, 0x01 = Write, 0x02 = Read */
@@ -234,11 +222,12 @@ uint32_t phyread(uint8_t reg)
return EMAC_REG(EMAC_MAN) & 0xffff;
}
+#endif
/*
* phywrite(): Write the PHY
*/
-void phywrite(uint8_t reg, uint16_t data)
+static void phywrite(uint8_t reg, uint16_t data)
{
EMAC_REG(EMAC_MAN) = (0x01 << 30 /* Start of Frame Delimiter */
| 0x01 << 28 /* Operation, 0x01 = Write, 0x02 = Read */
@@ -358,6 +347,7 @@ void at91rm9200_emac_init(void *arg)
{
at91rm9200_emac_softc_t *sc = arg;
struct ifnet *ifp = &sc->arpcom.ac_if;
+ rtems_status_code status = RTEMS_SUCCESSFUL;
/*
*This is for stuff that only gets done once (at91rm9200_emac_init()
@@ -382,7 +372,15 @@ void at91rm9200_emac_init(void *arg)
AIC_SMR_REG(AIC_SMR_EMAC) = AIC_SMR_PRIOR(EMAC_INT_PRIORITY);
/* install the interrupt handler */
- BSP_install_rtems_irq_handler(&at91rm9200_emac_isr_data);
+ status = rtems_interrupt_handler_install(
+ AT91RM9200_INT_EMAC,
+ "Network",
+ RTEMS_INTERRUPT_UNIQUE,
+ at91rm9200_emac_isr,
+ NULL
+ );
+ assert(status == RTEMS_SUCCESSFUL);
+ at91rm9200_emac_isr_on();
/* EMAC doesn't support promiscuous, so ignore requests */
if (ifp->if_flags & IFF_PROMISC) {
@@ -767,7 +765,7 @@ void at91rm9200_emac_stats (at91rm9200_emac_softc_t *sc)
/* Enables at91rm9200_emac interrupts. */
-static void at91rm9200_emac_isr_on(const rtems_irq_connect_data *unused)
+static void at91rm9200_emac_isr_on(void)
{
/* Enable various TX/RX interrupts */
EMAC_REG(EMAC_IER) = (EMAC_INT_RCOM | /* Receive complete */
@@ -779,23 +777,6 @@ static void at91rm9200_emac_isr_on(const rtems_irq_connect_data *unused)
return;
}
-/* Disables at91rm9200_emac interrupts */
-static void at91rm9200_emac_isr_off(const rtems_irq_connect_data *unused)
-{
- /* disable all various TX/RX interrupts */
- EMAC_REG(EMAC_IDR) = 0xffffffff;
- return;
-}
-
-/* Tests to see if at91rm9200_emac interrupts are enabled, and
- * returns non-0 if so.
- * If interrupt is not enabled, returns 0.
- */
-static int at91rm9200_emac_isr_is_on(const rtems_irq_connect_data *irq)
-{
- return EMAC_REG(EMAC_IMR); /* any interrupts enabled? */
-}
-
/* Driver ioctl handler */
static int
at91rm9200_emac_ioctl (struct ifnet *ifp, ioctl_command_t command, caddr_t data)
--
1.7.11.7