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
  */
41
  */
42
 
42
 
43
 static uint16_t pnic_command_quiet ( struct pnic *pnic, uint16_t command,
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
 				     void *output, uint16_t output_max_length,
45
 				     void *output, uint16_t output_max_length,
46
 				     uint16_t *output_length ) {
46
 				     uint16_t *output_length ) {
47
 	uint16_t status;
47
 	uint16_t status;
82
 }
82
 }
83
 
83
 
84
 static uint16_t pnic_command ( struct pnic *pnic, uint16_t command,
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
 			       void *output, uint16_t output_max_length,
86
 			       void *output, uint16_t output_max_length,
87
 			       uint16_t *output_length ) {
87
 			       uint16_t *output_length ) {
88
 	uint16_t status = pnic_command_quiet ( pnic, command,
88
 	uint16_t status = pnic_command_quiet ( pnic, command,
186
 /**************************************************************************
186
 /**************************************************************************
187
 OPEN - Open network device
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
 	return 0;
197
 	return 0;
191
 }
198
 }
192
 
199
 
193
 /**************************************************************************
200
 /**************************************************************************
194
 CLOSE - Close network device
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