Browse Source

Enable/disable interrupts on open/close.

tags/v0.9.3
Michael Brown 17 years ago
parent
commit
a2a0c2eace
1 changed files with 17 additions and 5 deletions
  1. 17
    5
      src/drivers/net/pnic.c

+ 17
- 5
src/drivers/net/pnic.c View File

@@ -41,7 +41,7 @@ struct pnic {
41 41
  */
42 42
 
43 43
 static uint16_t pnic_command_quiet ( struct pnic *pnic, uint16_t command,
44
-				     void *input, uint16_t input_length,
44
+				     const void *input, uint16_t input_length,
45 45
 				     void *output, uint16_t output_max_length,
46 46
 				     uint16_t *output_length ) {
47 47
 	uint16_t status;
@@ -82,7 +82,7 @@ static uint16_t pnic_command_quiet ( struct pnic *pnic, uint16_t command,
82 82
 }
83 83
 
84 84
 static uint16_t pnic_command ( struct pnic *pnic, uint16_t command,
85
-			       void *input, uint16_t input_length,
85
+			       const void *input, uint16_t input_length,
86 86
 			       void *output, uint16_t output_max_length,
87 87
 			       uint16_t *output_length ) {
88 88
 	uint16_t status = pnic_command_quiet ( pnic, command,
@@ -186,15 +186,27 @@ static void pnic_irq ( struct net_device *netdev, irq_action_t action ) {
186 186
 /**************************************************************************
187 187
 OPEN - Open network device
188 188
 ***************************************************************************/
189
-static int pnic_open ( struct net_device *netdev __unused ) {
189
+static int pnic_open ( struct net_device *netdev ) {
190
+	struct pnic *pnic = netdev->priv;
191
+	static const uint8_t enable = 1;
192
+
193
+	/* Enable interrupts */
194
+	pnic_command ( pnic, PNIC_CMD_MASK_IRQ, &enable,
195
+		       sizeof ( enable ), NULL, 0, NULL );
196
+	
190 197
 	return 0;
191 198
 }
192 199
 
193 200
 /**************************************************************************
194 201
 CLOSE - Close network device
195 202
 ***************************************************************************/
196
-static void pnic_close ( struct net_device *netdev __unused ) {
197
-	/* Nothing to do */
203
+static void pnic_close ( struct net_device *netdev ) {
204
+	struct pnic *pnic = netdev->priv;
205
+	static const uint8_t disable = 0;
206
+
207
+	/* Disable interrupts */
208
+	pnic_command ( pnic, PNIC_CMD_MASK_IRQ, &disable,
209
+		       sizeof ( disable ), NULL, 0, NULL );
198 210
 }
199 211
 
200 212
 /**************************************************************************

Loading…
Cancel
Save