This source file includes following definitions.
- ev_init
- queue_event
- timer_event
- ev_dispatcher
- smt_online
- do_smt_flag
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 #include "h/types.h"
18 #include "h/fddi.h"
19 #include "h/smc.h"
20
21 #ifndef lint
22 static const char ID_sccs[] = "@(#)queue.c 2.9 97/08/04 (C) SK " ;
23 #endif
24
25 #define PRINTF(a,b,c)
26
27
28
29
30 void ev_init(struct s_smc *smc)
31 {
32 smc->q.ev_put = smc->q.ev_get = smc->q.ev_queue ;
33 }
34
35
36
37
38 void queue_event(struct s_smc *smc, int class, int event)
39 {
40 PRINTF("queue class %d event %d\n",class,event) ;
41 smc->q.ev_put->class = class ;
42 smc->q.ev_put->event = event ;
43 if (++smc->q.ev_put == &smc->q.ev_queue[MAX_EVENT])
44 smc->q.ev_put = smc->q.ev_queue ;
45
46 if (smc->q.ev_put == smc->q.ev_get) {
47 SMT_ERR_LOG(smc,SMT_E0137, SMT_E0137_MSG) ;
48 }
49 }
50
51
52
53
54 void timer_event(struct s_smc *smc, u_long token)
55 {
56 PRINTF("timer event class %d token %d\n",
57 EV_T_CLASS(token),
58 EV_T_EVENT(token)) ;
59 queue_event(smc,EV_T_CLASS(token),EV_T_EVENT(token));
60 }
61
62
63
64
65
66
67
68
69 void ev_dispatcher(struct s_smc *smc)
70 {
71 struct event_queue *ev ;
72 int class ;
73
74 ev = smc->q.ev_get ;
75 PRINTF("dispatch get %x put %x\n",ev,smc->q.ev_put) ;
76 while (ev != smc->q.ev_put) {
77 PRINTF("dispatch class %d event %d\n",ev->class,ev->event) ;
78 switch(class = ev->class) {
79 case EVENT_ECM :
80 ecm(smc,(int)ev->event) ;
81 break ;
82 case EVENT_CFM :
83 cfm(smc,(int)ev->event) ;
84 break ;
85 case EVENT_RMT :
86 rmt(smc,(int)ev->event) ;
87 break ;
88 case EVENT_SMT :
89 smt_event(smc,(int)ev->event) ;
90 break ;
91 #ifdef CONCENTRATOR
92 case 99 :
93 timer_test_event(smc,(int)ev->event) ;
94 break ;
95 #endif
96 case EVENT_PCMA :
97 case EVENT_PCMB :
98 default :
99 if (class >= EVENT_PCMA &&
100 class < EVENT_PCMA + NUMPHYS) {
101 pcm(smc,class - EVENT_PCMA,(int)ev->event) ;
102 break ;
103 }
104 SMT_PANIC(smc,SMT_E0121, SMT_E0121_MSG) ;
105 return ;
106 }
107
108 if (++ev == &smc->q.ev_queue[MAX_EVENT])
109 ev = smc->q.ev_queue ;
110
111
112 smc->q.ev_get = ev;
113 }
114 }
115
116
117
118
119
120
121
122
123 u_short smt_online(struct s_smc *smc, int on)
124 {
125 queue_event(smc,EVENT_ECM,on ? EC_CONNECT : EC_DISCONNECT) ;
126 ev_dispatcher(smc) ;
127 return smc->mib.fddiSMTCF_State;
128 }
129
130
131
132
133
134
135
136 #ifdef CONCENTRATOR
137 void do_smt_flag(struct s_smc *smc, char *flag, int value)
138 {
139 #ifdef DEBUG
140 struct smt_debug *deb;
141
142 SK_UNUSED(smc) ;
143
144 #ifdef DEBUG_BRD
145 deb = &smc->debug;
146 #else
147 deb = &debug;
148 #endif
149 if (!strcmp(flag,"smt"))
150 deb->d_smt = value ;
151 else if (!strcmp(flag,"smtf"))
152 deb->d_smtf = value ;
153 else if (!strcmp(flag,"pcm"))
154 deb->d_pcm = value ;
155 else if (!strcmp(flag,"rmt"))
156 deb->d_rmt = value ;
157 else if (!strcmp(flag,"cfm"))
158 deb->d_cfm = value ;
159 else if (!strcmp(flag,"ecm"))
160 deb->d_ecm = value ;
161 printf("smt %d\n",deb->d_smt) ;
162 printf("smtf %d\n",deb->d_smtf) ;
163 printf("pcm %d\n",deb->d_pcm) ;
164 printf("rmt %d\n",deb->d_rmt) ;
165 printf("cfm %d\n",deb->d_cfm) ;
166 printf("ecm %d\n",deb->d_ecm) ;
167 #endif
168 }
169 #endif