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
|
/****************************************************************************
*
* SYS_IRQ.C
*
* FastMAC Plus based NDIS3 miniport driver. This module contains helper
* routines used by the FTK to handle interrupts.
*
* Copyright (c) Madge Networks Ltd 1991-1994
*
* COMPANY CONFIDENTIAL
*
* Created: MF
* Major modifications: PBA 21/06/1994
*
****************************************************************************/
#include <ndis.h>
#include "ftk_defs.h"
#include "ftk_intr.h"
#include "ftk_extr.h"
#include "ndismod.h"
/****************************************************************************
*
* Function - sys_enable_irq_channel
*
* Parameters - adapter_handle -> FTK adapter handle.
* interrupt_number -> Interrupt number to enable (unused).
*
* Purpose - Register an IRQ with the NDIS3 wrapper so that
* MadgeInterruptServiceRoutine() gets called on the
* IRQ and MadgeDeferredProcessingRoutine() as the DPR.
*
* Returns - TRUE on success or FALSE on failure.
*
****************************************************************************/
WBOOLEAN
sys_enable_irq_channel(ADAPTER_HANDLE adapter_handle, WORD interrupt_number);
#pragma FTK_INIT_FUNCTION(sys_enable_irq_channel)
WBOOLEAN
sys_enable_irq_channel(ADAPTER_HANDLE adapter_handle, WORD interrupt_number)
{
PMADGE_ADAPTER ndisAdap;
NDIS_STATUS status;
ndisAdap = PMADGE_ADAPTER_FROM_ADAPTER_HANDLE(adapter_handle);
//
// Register with the NDIS3 wrapper.
//
status = NdisMRegisterInterrupt(
&ndisAdap->Interrupt,
ndisAdap->UsedInISR.MiniportHandle,
(UINT) ndisAdap->UsedInISR.InterruptNumber,
(UINT) ndisAdap->UsedInISR.InterruptNumber,
TRUE, // We want ISRs.
ndisAdap->UsedInISR.InterruptShared,
ndisAdap->UsedInISR.InterruptMode
);
//
// If it didn't work then write an entry to the event log.
//
if (status != NDIS_STATUS_SUCCESS)
{
NdisWriteErrorLogEntry(
ndisAdap->UsedInISR.MiniportHandle,
NDIS_ERROR_CODE_INTERRUPT_CONNECT,
2,
inFtk,
MADGE_ERRMSG_INIT_INTERRUPT
);
return FALSE;
}
return TRUE;
}
/****************************************************************************
*
* Function - sys_disable_irq_channel
*
* Parameters - adapter_handle -> FTK adapter handle.
* interrupt_number -> Interrupt number to disable (unused).
*
* Purpose - De-register an IRQ with the NDIS3 wrapper.
*
* Returns - Nothing.
*
****************************************************************************/
void
sys_disable_irq_channel(ADAPTER_HANDLE adapter_handle, WORD interrupt_number)
{
PMADGE_ADAPTER ndisAdap;
ndisAdap = PMADGE_ADAPTER_FROM_ADAPTER_HANDLE(adapter_handle);
//
// De-register with the NDIS3 wrapper.
//
NdisMDeregisterInterrupt(&ndisAdap->Interrupt);
}
/******** End of SYS_IRQ.C ************************************************/
|