Loading...
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 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | /* * * Copyright (C) Eicon Technology Corporation, 2000. * * Eicon File Revision : 1.7 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ /* Main internal include file for Diva Server driver */ #if !defined(ADAPTER_H) #define ADAPTER_H #include "sys.h" #include "idi.h" #include "divas.h" #undef ID_MASK #include "pc.h" #define XMOREC 0x1f #define XMOREF 0x20 #define XBUSY 0x40 #define RMORE 0x80 /* structure for all information we have to keep on a per */ /* adapater basis */ typedef struct adapter_s ADAPTER; struct adapter_s { void * io; byte IdTable[256]; byte ReadyInt; byte (* ram_in)(ADAPTER * a, void * adr); word (* ram_inw)(ADAPTER * a, void * adr); void (* ram_in_buffer)(ADAPTER * a, void * adr, void * P, word length); void (* ram_look_ahead)(ADAPTER * a, PBUFFER * RBuffer, ENTITY * e); void (* ram_out)(ADAPTER * a, void * adr, byte data); void (* ram_outw)(ADAPTER * a, void * adr, word data); void (* ram_out_buffer)(ADAPTER * a, void * adr, void * P, word length); void (* ram_inc)(ADAPTER * a, void * adr); }; typedef struct card card_t; typedef int card_load_fn_t(card_t *card, dia_load_t *load); typedef int card_config_fn_t(card_t *card, dia_config_t *config); typedef int card_start_fn_t(card_t *card, byte *channels); typedef int card_reset_fn_t(card_t *card); typedef int card_mem_get_fn_t(card_t *card, mem_block_t *mem_block); #define MAX_PENTITIES 256 /* Number of entities primary adapter */ #define MAX_ENTITIES 16 /* Number of entities standard adapter */ typedef struct e_info_s E_INFO; struct e_info_s { ENTITY *e; /* entity pointer */ byte next; /* chaining index */ word assign_ref; /* assign reference */ }; /* DIVA card info (details hidden from user) */ typedef struct ux_diva_card_s ux_diva_card_t; /* card info */ struct card { ADAPTER a; /* per-adapter information */ dia_card_t cfg; /* card configuration */ int state; /* State of the adapter */ dword serial_no; /* serial number */ int test_int_pend; /* set for interrupt testing */ ux_diva_card_t *hw; /* O/S-specific handle */ card_reset_fn_t *card_reset; /* call this to reset card */ card_load_fn_t *card_load; /* call this to load card */ card_config_fn_t *card_config; /* call this to config card */ card_start_fn_t *card_start; /* call this to start card */ card_mem_get_fn_t *card_mem_get; /* call this to get card memory */ E_INFO *e_tbl; /* table of ENTITY pointers */ byte e_head; /* list of active ENTITIES */ byte e_tail; /* list of active ENTITIES */ int e_count; /* # of active ENTITIES */ int e_max; /* total # of ENTITIES */ byte assign; /* assign queue entry */ PBUFFER RBuffer; /* Copy of receive lookahead buffer */ int log_types; /* bit-mask of active logs */ word xlog_offset; /* offset to XLOG buffer on card */ void (*out)(ADAPTER *a); byte (*dpc)(ADAPTER * a); byte (*test_int)(ADAPTER * a); void (*clear_int)(ADAPTER * a); void (*reset_int)(card_t *c); int is_live; int (*card_isr)(card_t *card); int int_pend; /* interrupt pending */ long interrupt_reentered; long dpc_reentered; int set_xlog_request; } ; /* card information */ #define MAX_CARDS 20 /* max number of cards on a system */ extern card_t DivasCards[]; extern int DivasCardNext; extern dia_config_t DivasCardConfigs[]; extern byte DivasFlavourConfig[]; /*------------------------------------------------------------------*/ /* public functions of IDI common code */ /*------------------------------------------------------------------*/ void DivasOut(ADAPTER * a); byte DivasDpc(ADAPTER * a); byte DivasTestInt(ADAPTER * a); void DivasClearInt(ADAPTER * a); /*------------------------------------------------------------------*/ /* public functions of configuration platform-specific code */ /*------------------------------------------------------------------*/ int DivasConfigGet(dia_card_t *card); /*------------------------------------------------------------------*/ /* public functions of LOG related code */ /*------------------------------------------------------------------*/ void DivasXlogReq(int card_num); int DivasXlogRetrieve(card_t *card); void DivasLog(dia_log_t *log); void DivasLogIdi(card_t *card, ENTITY *e, int request); /*------------------------------------------------------------------*/ /* public functions to initialise cards for each type supported */ /*------------------------------------------------------------------*/ int DivasPriInit(card_t *card, dia_card_t *cfg); int DivasBriInit(card_t *card, dia_card_t *cfg); int Divas4BriInit(card_t *card, dia_card_t *cfg); void DivasBriPatch(card_t *card); /*------------------------------------------------------------------*/ /* public functions of log common code */ /*------------------------------------------------------------------*/ extern char *DivasLogFifoRead(void); extern void DivasLogFifoWrite(char *entry, int length); extern int DivasLogFifoEmpty(void); extern int DivasLogFifoFull(void); extern void DivasLogAdd(void *buffer, int length); /*------------------------------------------------------------------*/ /* public functions of misc. platform-specific code */ /*------------------------------------------------------------------*/ int DivasDpcSchedule(void); void DivasDoDpc(void *); void DivasDoRequestDpc(void *pData); int DivasScheduleRequestDpc(void); /* table of IDI request functions */ extern IDI_CALL DivasIdiRequest[]; /* * intialisation entry point */ int DivasInit(void); /* * Get information on the number and type of cards present */ extern int DivasCardsDiscover(void); /* * initialise a new card */ int DivasCardNew(dia_card_t *card); /* * configure specified card */ int DivasCardConfig(dia_config_t *config); /* * load specified binary code onto card */ int DivasCardLoad(dia_load_t *load); /* * start specified card running */ int DivasCardStart(int card_id); /* * ISR for card * Returns 0 if specified card was interrupting */ int DivasIsr(void *arg); /* * Get number of active cards */ int DivasGetNum(void); /* * Get list of active cards */ int DivasGetList(dia_card_list_t *card_list); /* definitions common to several card types */ #define DIVAS_SHARED_OFFSET (0x1000) #endif /* ADAPTER_H */ |