Path: blob/master/drivers/isdn/hardware/eicon/io.h
15115 views
1/*2*3Copyright (c) Eicon Networks, 2002.4*5This source file is supplied for the use with6Eicon Networks range of DIVA Server Adapters.7*8Eicon File Revision : 2.19*10This program is free software; you can redistribute it and/or modify11it under the terms of the GNU General Public License as published by12the Free Software Foundation; either version 2, or (at your option)13any later version.14*15This program is distributed in the hope that it will be useful,16but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY17implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.18See the GNU General Public License for more details.19*20You should have received a copy of the GNU General Public License21along with this program; if not, write to the Free Software22Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.23*24*/25#ifndef __DIVA_XDI_COMMON_IO_H_INC__ /* { */26#define __DIVA_XDI_COMMON_IO_H_INC__27/*28maximum = 16 adapters29*/30#define DI_MAX_LINKS MAX_ADAPTER31#define ISDN_MAX_NUM_LEN 6032/* --------------------------------------------------------------------------33structure for quadro card management (obsolete for34systems that do provide per card load event)35-------------------------------------------------------------------------- */36typedef struct {37dword Num ;38DEVICE_NAME DeviceName[4] ;39PISDN_ADAPTER QuadroAdapter[4] ;40} ADAPTER_LIST_ENTRY, *PADAPTER_LIST_ENTRY ;41/* --------------------------------------------------------------------------42Special OS memory support structures43-------------------------------------------------------------------------- */44#define MAX_MAPPED_ENTRIES 845typedef struct {46void * Address;47dword Length;48} ADAPTER_MEMORY ;49/* --------------------------------------------------------------------------50Configuration of XDI clients carried by XDI51-------------------------------------------------------------------------- */52#define DIVA_XDI_CAPI_CFG_1_DYNAMIC_L1_ON 0x0153#define DIVA_XDI_CAPI_CFG_1_GROUP_POPTIMIZATION_ON 0x0254typedef struct _diva_xdi_capi_cfg {55byte cfg_1;56} diva_xdi_capi_cfg_t;57/* --------------------------------------------------------------------------58Main data structure kept per adapter59-------------------------------------------------------------------------- */60struct _ISDN_ADAPTER {61void (* DIRequest)(PISDN_ADAPTER, ENTITY *) ;62int State ; /* from NT4 1.srv, a good idea, but a poor achievement */63int Initialized ;64int RegisteredWithDidd ;65int Unavailable ; /* callback function possible? */66int ResourcesClaimed ;67int PnpBiosConfigUsed ;68dword Logging ;69dword features ;70char ProtocolIdString[80] ;71/*72remember mapped memory areas73*/74ADAPTER_MEMORY MappedMemory[MAX_MAPPED_ENTRIES] ;75CARD_PROPERTIES Properties ;76dword cardType ;77dword protocol_id ; /* configured protocol identifier */78char protocol_name[8] ; /* readable name of protocol */79dword BusType ;80dword BusNumber ;81dword slotNumber ;82dword slotId ;83dword ControllerNumber ; /* for QUADRO cards only */84PISDN_ADAPTER MultiMaster ; /* for 4-BRI card only - use MultiMaster or QuadroList */85PADAPTER_LIST_ENTRY QuadroList ; /* for QUADRO card only */86PDEVICE_OBJECT DeviceObject ;87dword DeviceId ;88diva_os_adapter_irq_info_t irq_info;89dword volatile IrqCount ;90int trapped ;91dword DspCodeBaseAddr ;92dword MaxDspCodeSize ;93dword downloadAddr ;94dword DspCodeBaseAddrTable[4] ; /* add. for MultiMaster */95dword MaxDspCodeSizeTable[4] ; /* add. for MultiMaster */96dword downloadAddrTable[4] ; /* add. for MultiMaster */97dword MemoryBase ;98dword MemorySize ;99byte __iomem *Address ;100byte __iomem *Config ;101byte __iomem *Control ;102byte __iomem *reset ;103byte __iomem *port ;104byte __iomem *ram ;105byte __iomem *cfg ;106byte __iomem *prom ;107byte __iomem *ctlReg ;108struct pc_maint *pcm ;109diva_os_dependent_devica_name_t os_name;110byte Name[32] ;111dword serialNo ;112dword ANum ;113dword ArchiveType ; /* ARCHIVE_TYPE_NONE ..._SINGLE ..._USGEN ..._MULTI */114char *ProtocolSuffix ; /* internal protocolfile table */115char Archive[32] ;116char Protocol[32] ;117char AddDownload[32] ; /* Dsp- or other additional download files */118char Oad1[ISDN_MAX_NUM_LEN] ;119char Osa1[ISDN_MAX_NUM_LEN] ;120char Oad2[ISDN_MAX_NUM_LEN] ;121char Osa2[ISDN_MAX_NUM_LEN] ;122char Spid1[ISDN_MAX_NUM_LEN] ;123char Spid2[ISDN_MAX_NUM_LEN] ;124byte nosig ;125byte BriLayer2LinkCount ; /* amount of TEI's that adapter will support in P2MP mode */126dword Channels ;127dword tei ;128dword nt2 ;129dword TerminalCount ;130dword WatchDog ;131dword Permanent ;132dword BChMask ; /* B channel mask for unchannelized modes */133dword StableL2 ;134dword DidLen ;135dword NoOrderCheck ;136dword ForceLaw; /* VoiceCoding - default:0, a-law: 1, my-law: 2 */137dword SigFlags ;138dword LowChannel ;139dword NoHscx30 ;140dword ProtVersion ;141dword crc4 ;142dword L1TristateOrQsig ; /* enable Layer 1 Tristate (bit 2)Or Qsig params (bit 0,1)*/143dword InitialDspInfo ;144dword ModemGuardTone ;145dword ModemMinSpeed ;146dword ModemMaxSpeed ;147dword ModemOptions ;148dword ModemOptions2 ;149dword ModemNegotiationMode ;150dword ModemModulationsMask ;151dword ModemTransmitLevel ;152dword FaxOptions ;153dword FaxMaxSpeed ;154dword Part68LevelLimiter ;155dword UsEktsNumCallApp ;156byte UsEktsFeatAddConf ;157byte UsEktsFeatRemoveConf ;158byte UsEktsFeatCallTransfer ;159byte UsEktsFeatMsgWaiting ;160byte QsigDialect;161byte ForceVoiceMailAlert;162byte DisableAutoSpid;163byte ModemCarrierWaitTimeSec;164byte ModemCarrierLossWaitTimeTenthSec;165byte PiafsLinkTurnaroundInFrames;166byte DiscAfterProgress;167byte AniDniLimiter[3];168byte TxAttenuation; /* PRI/E1 only: attenuate TX signal */169word QsigFeatures;170dword GenerateRingtone ;171dword SupplementaryServicesFeatures;172dword R2Dialect;173dword R2CasOptions;174dword FaxV34Options;175dword DisabledDspMask;176dword AdapterTestMask;177dword DspImageLength;178word AlertToIn20mSecTicks;179word ModemEyeSetup;180byte R2CtryLength;181byte CCBSRelTimer;182byte *PcCfgBufferFile;/* flexible parameter via file */183byte *PcCfgBuffer ; /* flexible parameter via multistring */184diva_os_dump_file_t dump_file; /* dump memory to file at lowest irq level */185diva_os_board_trace_t board_trace ; /* traces from the board */186diva_os_spin_lock_t isr_spin_lock;187diva_os_spin_lock_t data_spin_lock;188diva_os_soft_isr_t req_soft_isr;189diva_os_soft_isr_t isr_soft_isr;190diva_os_atomic_t in_dpc;191PBUFFER RBuffer; /* Copy of receive lookahead buffer */192word e_max;193word e_count;194E_INFO *e_tbl;195word assign; /* list of pending ASSIGNs */196word head; /* head of request queue */197word tail; /* tail of request queue */198ADAPTER a ; /* not a separate structure */199void (* out)(ADAPTER * a) ;200byte (* dpc)(ADAPTER * a) ;201byte (* tst_irq)(ADAPTER * a) ;202void (* clr_irq)(ADAPTER * a) ;203int (* load)(PISDN_ADAPTER) ;204int (* mapmem)(PISDN_ADAPTER) ;205int (* chkIrq)(PISDN_ADAPTER) ;206void (* disIrq)(PISDN_ADAPTER) ;207void (* start)(PISDN_ADAPTER) ;208void (* stop)(PISDN_ADAPTER) ;209void (* rstFnc)(PISDN_ADAPTER) ;210void (* trapFnc)(PISDN_ADAPTER) ;211dword (* DetectDsps)(PISDN_ADAPTER) ;212void (* os_trap_nfy_Fnc)(PISDN_ADAPTER, dword) ;213diva_os_isr_callback_t diva_isr_handler;214dword sdram_bar; /* must be 32 bit */215dword fpga_features;216volatile int pcm_pending;217volatile void * pcm_data;218diva_xdi_capi_cfg_t capi_cfg;219dword tasks;220void *dma_map;221int (*DivaAdapterTestProc)(PISDN_ADAPTER);222void *AdapterTestMemoryStart;223dword AdapterTestMemoryLength;224const byte* cfg_lib_memory_init;225dword cfg_lib_memory_init_length;226};227/* ---------------------------------------------------------------------228Entity table229--------------------------------------------------------------------- */230struct e_info_s {231ENTITY * e;232byte next; /* chaining index */233word assign_ref; /* assign reference */234};235/* ---------------------------------------------------------------------236S-cards shared ram structure for loading237--------------------------------------------------------------------- */238struct s_load {239byte ctrl;240byte card;241byte msize;242byte fill0;243word ebit;244word elocl;245word eloch;246byte reserved[20];247word signature;248byte fill[224];249byte b[256];250};251#define PR_RAM ((struct pr_ram *)0)252#define RAM ((struct dual *)0)253/* ---------------------------------------------------------------------254platform specific conversions255--------------------------------------------------------------------- */256extern void * PTR_P(ADAPTER * a, ENTITY * e, void * P);257extern void * PTR_X(ADAPTER * a, ENTITY * e);258extern void * PTR_R(ADAPTER * a, ENTITY * e);259extern void CALLBACK(ADAPTER * a, ENTITY * e);260extern void set_ram(void * * adr_ptr);261/* ---------------------------------------------------------------------262ram access functions for io mapped cards263--------------------------------------------------------------------- */264byte io_in(ADAPTER * a, void * adr);265word io_inw(ADAPTER * a, void * adr);266void io_in_buffer(ADAPTER * a, void * adr, void * P, word length);267void io_look_ahead(ADAPTER * a, PBUFFER * RBuffer, ENTITY * e);268void io_out(ADAPTER * a, void * adr, byte data);269void io_outw(ADAPTER * a, void * adr, word data);270void io_out_buffer(ADAPTER * a, void * adr, void * P, word length);271void io_inc(ADAPTER * a, void * adr);272void bri_in_buffer (PISDN_ADAPTER IoAdapter, dword Pos,273void *Buf, dword Len);274int bri_out_buffer (PISDN_ADAPTER IoAdapter, dword Pos,275void *Buf, dword Len, int Verify);276/* ---------------------------------------------------------------------277ram access functions for memory mapped cards278--------------------------------------------------------------------- */279byte mem_in(ADAPTER * a, void * adr);280word mem_inw(ADAPTER * a, void * adr);281void mem_in_buffer(ADAPTER * a, void * adr, void * P, word length);282void mem_look_ahead(ADAPTER * a, PBUFFER * RBuffer, ENTITY * e);283void mem_out(ADAPTER * a, void * adr, byte data);284void mem_outw(ADAPTER * a, void * adr, word data);285void mem_out_buffer(ADAPTER * a, void * adr, void * P, word length);286void mem_inc(ADAPTER * a, void * adr);287void mem_in_dw (ADAPTER *a, void *addr, dword* data, int dwords);288void mem_out_dw (ADAPTER *a, void *addr, const dword* data, int dwords);289/* ---------------------------------------------------------------------290functions exported by io.c291--------------------------------------------------------------------- */292extern IDI_CALL Requests[MAX_ADAPTER] ;293extern void DIDpcRoutine (struct _diva_os_soft_isr* psoft_isr,294void* context);295extern void request (PISDN_ADAPTER, ENTITY *) ;296/* ---------------------------------------------------------------------297trapFn helpers, used to recover debug trace from dead card298--------------------------------------------------------------------- */299typedef struct {300word *buf ;301word cnt ;302word out ;303} Xdesc ;304extern void dump_trap_frame (PISDN_ADAPTER IoAdapter, byte __iomem *exception) ;305extern void dump_xlog_buffer (PISDN_ADAPTER IoAdapter, Xdesc *xlogDesc) ;306/* --------------------------------------------------------------------- */307#endif /* } __DIVA_XDI_COMMON_IO_H_INC__ */308309310