1 /* pro_eq.c: Event queue
2
3 Copyright (c) 1997-2003, Tarik Isani (xhomer@isani.org)
4
5 This file is part of Xhomer.
6
7 Xhomer is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License version 2
9 as published by the Free Software Foundation.
10
11 Xhomer is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with Xhomer; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21
22 #ifdef PRO
23 #include "pdp11_defs.h"
24
25 unsigned char PRO_EQ[PRO_EQ_SIZE];
26
27 int pro_eq_ptr; /* pointer to current location in event queue */
28
29 void (*pro_event[PRO_EQ_NUM_EVENTS+1])(void) =
30 {
31 NULL,
32 &pro_clk_eq,
33 &pro_clk_uf_eq,
34 &pro_vid_eq,
35 &pro_vid_cmd_eq,
36 &pro_2661kb_eq,
37 &pro_2661kb_poll_eq,
38 &pro_2661ptr_eq,
39 &pro_2661ptr_poll_eq,
40 &pro_com_eq,
41 &pro_com_poll_eq,
42 &pro_rd_eq
43 };
44
45
46 /* Schedule event */
47
pro_eq_sched(int eventnum,int interval)48 void pro_eq_sched (int eventnum, int interval)
49 {
50 int i, j;
51
52 /* Check for collision with other pending events */
53
54 /* XXX This assumes at most one event of each type
55 can exist in the queue at a time */
56
57 for(i=0; i<PRO_EQ_NUM_EVENTS; i++)
58 {
59 j = (pro_eq_ptr + interval + i) & PRO_EQ_MASK;
60
61 /* Check if queue entry is empty */
62
63 if (PRO_EQ[j] == 0)
64 {
65 PRO_EQ[j] = eventnum;
66 break;
67 }
68 }
69 }
70
71
72 /* Reset */
73
pro_eq_reset()74 void pro_eq_reset ()
75 {
76 /* Initialize event queue */
77
78 memset(&PRO_EQ, 0, sizeof(PRO_EQ));
79
80 pro_eq_ptr = 0;
81 }
82
83 #endif
84