1 | /* |
---|
2 | * TopfieldVFD.h |
---|
3 | * |
---|
4 | * Created on: Jul 30, 2011 |
---|
5 | * Author: topfi |
---|
6 | */ |
---|
7 | |
---|
8 | #ifndef TOPFIELDVFD_H_ |
---|
9 | #define TOPFIELDVFD_H_ |
---|
10 | |
---|
11 | #ifndef dword |
---|
12 | typedef unsigned long dword; |
---|
13 | #endif |
---|
14 | #ifndef word |
---|
15 | typedef unsigned short word; |
---|
16 | #endif |
---|
17 | #ifndef byte |
---|
18 | typedef unsigned char byte; |
---|
19 | #endif |
---|
20 | |
---|
21 | typedef struct |
---|
22 | { |
---|
23 | word year; |
---|
24 | word month; |
---|
25 | word day; |
---|
26 | word dow; |
---|
27 | char sdow[4]; |
---|
28 | word hour; |
---|
29 | word min; |
---|
30 | word sec; |
---|
31 | dword now; |
---|
32 | } frontpanel_ioctl_time; |
---|
33 | |
---|
34 | typedef struct |
---|
35 | { |
---|
36 | byte bright; |
---|
37 | } frontpanel_ioctl_brightness; |
---|
38 | |
---|
39 | typedef struct |
---|
40 | { |
---|
41 | byte reason; |
---|
42 | } frontpanel_ioctl_bootreason; |
---|
43 | |
---|
44 | typedef struct |
---|
45 | { |
---|
46 | byte onoff; |
---|
47 | } frontpanel_ioctl_irfilter; |
---|
48 | |
---|
49 | typedef struct |
---|
50 | { |
---|
51 | dword Icons1; |
---|
52 | dword Icons2; |
---|
53 | byte BlinkMode; |
---|
54 | } frontpanel_ioctl_icons; |
---|
55 | |
---|
56 | typedef struct |
---|
57 | { |
---|
58 | byte TypematicDelay; |
---|
59 | } frontpanel_ioctl_typematicdelay; |
---|
60 | |
---|
61 | typedef struct |
---|
62 | { |
---|
63 | byte TypematicRate; |
---|
64 | } frontpanel_ioctl_typematicrate; |
---|
65 | |
---|
66 | typedef struct |
---|
67 | { |
---|
68 | byte KeyEmulation; |
---|
69 | } frontpanel_ioctl_keyemulation; |
---|
70 | |
---|
71 | typedef struct |
---|
72 | { |
---|
73 | byte AllCaps; |
---|
74 | } frontpanel_ioctl_allcaps; |
---|
75 | |
---|
76 | typedef struct |
---|
77 | { |
---|
78 | byte ScrollMode; |
---|
79 | byte ScrollPause; |
---|
80 | byte ScrollDelay; |
---|
81 | } frontpanel_ioctl_scrollmode; |
---|
82 | |
---|
83 | #define FRONTPANELGETTIME 0x40003a00 | (sizeof(frontpanel_ioctl_time) << 16) |
---|
84 | #define FRONTPANELSETTIME 0x40003a01 |
---|
85 | #define FRONTPANELSYNCSYSTIME 0x40003a02 |
---|
86 | #define FRONTPANELCLEARTIMER 0x40003a03 |
---|
87 | #define FRONTPANELSETTIMER 0x40003a04 |
---|
88 | #define FRONTPANELBRIGHTNESS 0x40003a05 | (sizeof(frontpanel_ioctl_brightness) << 16) |
---|
89 | #define FRONTPANELIRFILTER1 0x40003a06 |
---|
90 | #define FRONTPANELIRFILTER2 0x40003a07 |
---|
91 | #define FRONTPANELIRFILTER3 0x40003a08 |
---|
92 | #define FRONTPANELIRFILTER4 0x40003a09 |
---|
93 | #define FRONTPANELPOWEROFF 0x40003a0a |
---|
94 | #define FRONTPANELBOOTREASON 0x40003a0b | (sizeof(frontpanel_ioctl_bootreason) << 16) |
---|
95 | #define FRONTPANELCLEAR 0x40003a0c |
---|
96 | #define FRONTPANELTYPEMATICDELAY 0x40003a0d | (sizeof(frontpanel_ioctl_typematicdelay) << 16) |
---|
97 | #define FRONTPANELTYPEMATICRATE 0x40003a0e | (sizeof(frontpanel_ioctl_typematicrate) << 16) |
---|
98 | #define FRONTPANELKEYEMULATION 0x40003a0f | (sizeof(frontpanel_ioctl_keyemulation) << 16) |
---|
99 | #define FRONTPANELREBOOT 0x40003a10 |
---|
100 | #define FRONTPANELSYNCFPTIME 0x40003a11 |
---|
101 | #define FRONTPANELSETGMTOFFSET 0x40003a12 |
---|
102 | #define FRONTPANELRESEND 0x40003a13 |
---|
103 | #define FRONTPANELALLCAPS 0x40003a14 | (sizeof(frontpanel_ioctl_allcaps) << 16) |
---|
104 | #define FRONTPANELSCROLLMODE 0x40003a15 | (sizeof(frontpanel_ioctl_scrollmode) << 16) |
---|
105 | #define FRONTPANELICON 0x40003a20 | (sizeof(frontpanel_ioctl_icons) << 16) |
---|
106 | |
---|
107 | frontpanel_ioctl_icons ioOffOn = {0x00000002,0x00000000,0x0f}; |
---|
108 | frontpanel_ioctl_icons ioOffFlush = {0x00000002,0x00000000,0x06}; |
---|
109 | frontpanel_ioctl_icons ioOffOff = {0x00000002,0x00000000,0x00}; |
---|
110 | |
---|
111 | frontpanel_ioctl_icons ioRec1On = {0x00001000,0x00000000,0x0f}; |
---|
112 | frontpanel_ioctl_icons ioRec2On = {0x00002000,0x00000000,0x0f}; |
---|
113 | frontpanel_ioctl_icons ioRecBothOn = {0x00003000,0x00000000,0x0f}; |
---|
114 | frontpanel_ioctl_icons ioRec1Flush = {0x00001000,0x00000000,0x06}; |
---|
115 | frontpanel_ioctl_icons ioRec2Flush = {0x00002000,0x00000000,0x06}; |
---|
116 | frontpanel_ioctl_icons ioRecBothFlush = {0x00003000,0x00000000,0x06}; |
---|
117 | frontpanel_ioctl_icons ioRec1Off = {0x00001000,0x00000000,0x00}; |
---|
118 | frontpanel_ioctl_icons ioRec2Off = {0x00002000,0x00000000,0x00}; |
---|
119 | frontpanel_ioctl_icons ioRecBothOff = {0x00003000,0x00000000,0x00}; |
---|
120 | |
---|
121 | frontpanel_ioctl_icons ioClockFlush = {0x00000020,0x00000000,0x06}; |
---|
122 | frontpanel_ioctl_icons ioClockOff = {0x00000020,0x00000000,0x00}; |
---|
123 | |
---|
124 | frontpanel_ioctl_icons ioHddClear = {0x00000000,0x00ff8000,0x00}; |
---|
125 | |
---|
126 | frontpanel_ioctl_icons ioCDClear = {0x00000000,0x00001ffe,0x00}; |
---|
127 | |
---|
128 | frontpanel_ioctl_icons ioEthOn = {0x00400000,0x00000000,0x0b}; |
---|
129 | frontpanel_ioctl_icons ioEthOff = {0x00400000,0x00000000,0x00}; |
---|
130 | |
---|
131 | frontpanel_ioctl_icons ioUsbOn = {0x0c000000,0x00000000,0x0f}; |
---|
132 | frontpanel_ioctl_icons ioUsbOff = {0x0c000000,0x00000000,0x00}; |
---|
133 | |
---|
134 | frontpanel_ioctl_icons ioTimeshiftOn = {0x00000080,0x00000000,0x0f}; |
---|
135 | frontpanel_ioctl_icons ioTimeshiftOff = {0x00000080,0x00000000,0x00}; |
---|
136 | |
---|
137 | |
---|
138 | void sendIoctl(unsigned long cmd, void* data) |
---|
139 | { |
---|
140 | char* vfddev = getconfig("vfddev", NULL); |
---|
141 | |
---|
142 | if(status.updatevfd == STOP) return; |
---|
143 | |
---|
144 | m_lock(&status.vfdmutex, 3); |
---|
145 | int fd = open (vfddev, O_WRONLY); |
---|
146 | ioctl(fd, cmd, data); |
---|
147 | close (fd); |
---|
148 | m_unlock(&status.vfdmutex, 3); |
---|
149 | } |
---|
150 | |
---|
151 | void updateRec(int force) |
---|
152 | { |
---|
153 | static int lastRec = -1; |
---|
154 | int curRec = status.recording; |
---|
155 | |
---|
156 | if(force) |
---|
157 | { |
---|
158 | lastRec=-1; |
---|
159 | } |
---|
160 | |
---|
161 | if(lastRec != curRec) |
---|
162 | { |
---|
163 | if(lastRec > curRec) |
---|
164 | { |
---|
165 | sendIoctl(FRONTPANELICON, &ioRecBothOff); |
---|
166 | } |
---|
167 | |
---|
168 | if(curRec == 0) |
---|
169 | { |
---|
170 | sendIoctl(FRONTPANELICON, &ioClockOff); |
---|
171 | } |
---|
172 | else |
---|
173 | { |
---|
174 | if( getconfigint("blinking_clock_during_recording",pluginname)) |
---|
175 | { |
---|
176 | switch(curRec) |
---|
177 | { |
---|
178 | case 1: sendIoctl(FRONTPANELICON, &ioRec1Flush); |
---|
179 | sendIoctl(FRONTPANELICON, &ioClockFlush); |
---|
180 | break; |
---|
181 | case 2: sendIoctl(FRONTPANELICON, &ioRec2Flush); |
---|
182 | sendIoctl(FRONTPANELICON, &ioClockFlush); |
---|
183 | break; |
---|
184 | } |
---|
185 | } |
---|
186 | else |
---|
187 | { |
---|
188 | switch(curRec) |
---|
189 | { |
---|
190 | case 1: sendIoctl(FRONTPANELICON, &ioRec1On); |
---|
191 | break; |
---|
192 | case 2: sendIoctl(FRONTPANELICON, &ioRec2On); |
---|
193 | break; |
---|
194 | } |
---|
195 | } |
---|
196 | } |
---|
197 | lastRec = curRec; |
---|
198 | } |
---|
199 | } |
---|
200 | |
---|
201 | void updateProgress(int force) |
---|
202 | { |
---|
203 | static int lastProgress = -1; |
---|
204 | |
---|
205 | if(force) |
---|
206 | { |
---|
207 | lastProgress=-1; |
---|
208 | } |
---|
209 | |
---|
210 | if(lastProgress==-1) |
---|
211 | { |
---|
212 | // To be done. |
---|
213 | sendIoctl(FRONTPANELICON, &ioCDClear); |
---|
214 | |
---|
215 | lastProgress = 0; |
---|
216 | } |
---|
217 | } |
---|
218 | |
---|
219 | void updateHDD(int force) |
---|
220 | { |
---|
221 | static int lastHDD = -1; |
---|
222 | |
---|
223 | if(force) |
---|
224 | { |
---|
225 | lastHDD=-1; |
---|
226 | } |
---|
227 | |
---|
228 | if(lastHDD==-1) |
---|
229 | { |
---|
230 | // To be done. |
---|
231 | sendIoctl(FRONTPANELICON, &ioHddClear); |
---|
232 | |
---|
233 | lastHDD = 0; |
---|
234 | } |
---|
235 | } |
---|
236 | |
---|
237 | void updateUSB(int force) |
---|
238 | { |
---|
239 | static int lastUSB = -1; |
---|
240 | |
---|
241 | if(force) |
---|
242 | { |
---|
243 | lastUSB=-1; |
---|
244 | } |
---|
245 | |
---|
246 | if(lastUSB==-1) |
---|
247 | { |
---|
248 | // To be done. |
---|
249 | sendIoctl(FRONTPANELICON, &ioUsbOff); |
---|
250 | |
---|
251 | lastUSB = 0; |
---|
252 | } |
---|
253 | } |
---|
254 | |
---|
255 | void updateEth(int force) |
---|
256 | { |
---|
257 | static int lastEth = -1; |
---|
258 | |
---|
259 | if(force) |
---|
260 | { |
---|
261 | lastEth=-1; |
---|
262 | } |
---|
263 | |
---|
264 | if(lastEth==-1) |
---|
265 | { |
---|
266 | // To be done. |
---|
267 | sendIoctl(FRONTPANELICON, &ioEthOff); |
---|
268 | |
---|
269 | lastEth = 0; |
---|
270 | } |
---|
271 | } |
---|
272 | |
---|
273 | void updateTimeshift(int force) |
---|
274 | { |
---|
275 | static int lastTS = -1; |
---|
276 | |
---|
277 | if(force) |
---|
278 | { |
---|
279 | lastTS=-1; |
---|
280 | } |
---|
281 | |
---|
282 | if(lastTS==-1) |
---|
283 | { |
---|
284 | // To be done. |
---|
285 | sendIoctl(FRONTPANELICON, &ioTimeshiftOff); |
---|
286 | |
---|
287 | lastTS = 0; |
---|
288 | } |
---|
289 | } |
---|
290 | |
---|
291 | #endif /* TOPFIELDVFD_H_ */ |
---|