2 * Main internal include file for Diva Server driver
4 * Copyright (C) Eicon Technology Corporation, 2000.
6 * Eicon File Revision : 1.7
8 * This software may be used and distributed according to the terms
9 * of the GNU General Public License, incorporated herein by reference.
13 #if !defined(ADAPTER_H)
27 /* structure for all information we have to keep on a per */
30 typedef struct adapter_s ADAPTER;
38 byte (* ram_in)(ADAPTER * a, void * adr);
39 word (* ram_inw)(ADAPTER * a, void * adr);
40 void (* ram_in_buffer)(ADAPTER * a, void * adr, void * P, word length);
41 void (* ram_look_ahead)(ADAPTER * a, PBUFFER * RBuffer, ENTITY * e);
43 void (* ram_out)(ADAPTER * a, void * adr, byte data);
44 void (* ram_outw)(ADAPTER * a, void * adr, word data);
45 void (* ram_out_buffer)(ADAPTER * a, void * adr, void * P, word length);
47 void (* ram_inc)(ADAPTER * a, void * adr);
50 typedef struct card card_t;
52 typedef int card_load_fn_t(card_t *card, dia_load_t *load);
53 typedef int card_config_fn_t(card_t *card, dia_config_t *config);
54 typedef int card_start_fn_t(card_t *card, byte *channels);
55 typedef int card_reset_fn_t(card_t *card);
56 typedef int card_mem_get_fn_t(card_t *card, mem_block_t *mem_block);
58 #define MAX_PENTITIES 256 /* Number of entities primary adapter */
59 #define MAX_ENTITIES 16 /* Number of entities standard adapter */
61 typedef struct e_info_s E_INFO;
65 ENTITY *e; /* entity pointer */
66 byte next; /* chaining index */
67 word assign_ref; /* assign reference */
70 /* DIVA card info (details hidden from user) */
72 typedef struct ux_diva_card_s ux_diva_card_t;
78 ADAPTER a; /* per-adapter information */
79 dia_card_t cfg; /* card configuration */
80 int state; /* State of the adapter */
81 dword serial_no; /* serial number */
82 int test_int_pend; /* set for interrupt testing */
83 ux_diva_card_t *hw; /* O/S-specific handle */
84 card_reset_fn_t *card_reset; /* call this to reset card */
85 card_load_fn_t *card_load; /* call this to load card */
86 card_config_fn_t *card_config; /* call this to config card */
87 card_start_fn_t *card_start; /* call this to start card */
88 card_mem_get_fn_t *card_mem_get; /* call this to get card memory */
89 E_INFO *e_tbl; /* table of ENTITY pointers */
90 byte e_head; /* list of active ENTITIES */
91 byte e_tail; /* list of active ENTITIES */
92 int e_count; /* # of active ENTITIES */
93 int e_max; /* total # of ENTITIES */
94 byte assign; /* assign queue entry */
95 PBUFFER RBuffer; /* Copy of receive lookahead buffer */
96 int log_types; /* bit-mask of active logs */
97 word xlog_offset; /* offset to XLOG buffer on card */
98 void (*out)(ADAPTER *a);
99 byte (*dpc)(ADAPTER * a);
100 byte (*test_int)(ADAPTER * a);
101 void (*clear_int)(ADAPTER * a);
102 void (*reset_int)(card_t *c);
105 int (*card_isr)(card_t *card);
107 int int_pend; /* interrupt pending */
108 long interrupt_reentered;
110 int set_xlog_request;
114 /* card information */
116 #define MAX_CARDS 20 /* max number of cards on a system */
125 dia_config_t DivasCardConfigs[];
128 byte DivasFlavourConfig[];
130 /*------------------------------------------------------------------*/
131 /* public functions of IDI common code */
132 /*------------------------------------------------------------------*/
134 void DivasOut(ADAPTER * a);
135 byte DivasDpc(ADAPTER * a);
136 byte DivasTestInt(ADAPTER * a);
137 void DivasClearInt(ADAPTER * a);
139 /*------------------------------------------------------------------*/
140 /* public functions of configuration platform-specific code */
141 /*------------------------------------------------------------------*/
143 int DivasConfigGet(dia_card_t *card);
145 /*------------------------------------------------------------------*/
146 /* public functions of LOG related code */
147 /*------------------------------------------------------------------*/
149 void DivasXlogReq(int card_num);
150 int DivasXlogRetrieve(card_t *card);
151 void DivasLog(dia_log_t *log);
152 void DivasLogIdi(card_t *card, ENTITY *e, int request);
154 /*------------------------------------------------------------------*/
155 /* public functions to initialise cards for each type supported */
156 /*------------------------------------------------------------------*/
158 int DivasPriInit(card_t *card, dia_card_t *cfg);
160 int DivasBriInit(card_t *card, dia_card_t *cfg);
161 int Divas4BriInit(card_t *card, dia_card_t *cfg);
162 void DivasBriPatch(card_t *card);
164 /*------------------------------------------------------------------*/
165 /* public functions of log common code */
166 /*------------------------------------------------------------------*/
168 extern char *DivasLogFifoRead(void);
169 extern void DivasLogFifoWrite(char *entry, int length);
170 extern int DivasLogFifoEmpty(void);
171 extern int DivasLogFifoFull(void);
172 extern void DivasLogAdd(void *buffer, int length);
174 /*------------------------------------------------------------------*/
175 /* public functions of misc. platform-specific code */
176 /*------------------------------------------------------------------*/
178 int DivasDpcSchedule(void);
179 void DivasDoDpc(void *);
180 void DivasDoRequestDpc(void *pData);
181 int DivasScheduleRequestDpc(void);
183 /* table of IDI request functions */
186 IDI_CALL DivasIdiRequest[];
189 * intialisation entry point
195 * Get information on the number and type of cards present
199 int DivasCardsDiscover(void);
202 * initialise a new card
205 int DivasCardNew(dia_card_t *card);
208 * configure specified card
211 int DivasCardConfig(dia_config_t *config);
214 * load specified binary code onto card
217 int DivasCardLoad(dia_load_t *load);
220 * start specified card running
223 int DivasCardStart(int card_id);
227 * Returns 0 if specified card was interrupting
230 int DivasIsr(void *arg);
233 * Get number of active cards
236 int DivasGetNum(void);
239 * Get list of active cards
242 int DivasGetList(dia_card_list_t *card_list);
244 /* definitions common to several card types */
246 #define DIVAS_SHARED_OFFSET (0x1000)
248 #endif /* ADAPTER_H */