blob: ff26c65631d6c551475453e3932dc794b76ddec4 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001
2/*
3 *
Joe Perches475be4d2012-02-19 19:52:38 -08004 Copyright (c) Eicon Networks, 2002.
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 *
Joe Perches475be4d2012-02-19 19:52:38 -08006 This source file is supplied for the use with
7 Eicon Networks range of DIVA Server Adapters.
Linus Torvalds1da177e2005-04-16 15:20:36 -07008 *
Joe Perches475be4d2012-02-19 19:52:38 -08009 Eicon File Revision : 2.1
Linus Torvalds1da177e2005-04-16 15:20:36 -070010 *
Joe Perches475be4d2012-02-19 19:52:38 -080011 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2, or (at your option)
14 any later version.
Linus Torvalds1da177e2005-04-16 15:20:36 -070015 *
Joe Perches475be4d2012-02-19 19:52:38 -080016 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
18 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 See the GNU General Public License for more details.
Linus Torvalds1da177e2005-04-16 15:20:36 -070020 *
Joe Perches475be4d2012-02-19 19:52:38 -080021 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Linus Torvalds1da177e2005-04-16 15:20:36 -070024 *
25 */
26/*
27 * some macros for detailed trace management
28 */
29#include "di_dbg.h"
30/*****************************************************************************/
31#define XMOREC 0x1f
32#define XMOREF 0x20
33#define XBUSY 0x40
34#define RMORE 0x80
35#define DIVA_MISC_FLAGS_REMOVE_PENDING 0x01
36#define DIVA_MISC_FLAGS_NO_RC_CANCELLING 0x02
37#define DIVA_MISC_FLAGS_RX_DMA 0x04
Joe Perches475be4d2012-02-19 19:52:38 -080038/* structure for all information we have to keep on a per */
39/* adapater basis */
Linus Torvalds1da177e2005-04-16 15:20:36 -070040typedef struct adapter_s ADAPTER;
41struct adapter_s {
Joe Perches475be4d2012-02-19 19:52:38 -080042 void *io;
43 byte IdTable[256];
44 byte IdTypeTable[256];
45 byte FlowControlIdTable[256];
46 byte FlowControlSkipTable[256];
47 byte ReadyInt;
48 byte RcExtensionSupported;
49 byte misc_flags_table[256];
50 dword protocol_capabilities;
51 byte (*ram_in)(ADAPTER *a, void *adr);
52 word (*ram_inw)(ADAPTER *a, void *adr);
53 void (*ram_in_buffer)(ADAPTER *a, void *adr, void *P, word length);
54 void (*ram_look_ahead)(ADAPTER *a, PBUFFER *RBuffer, ENTITY *e);
55 void (*ram_out)(ADAPTER *a, void *adr, byte data);
56 void (*ram_outw)(ADAPTER *a, void *adr, word data);
57 void (*ram_out_buffer)(ADAPTER *a, void *adr, void *P, word length);
58 void (*ram_inc)(ADAPTER *a, void *adr);
Linus Torvalds1da177e2005-04-16 15:20:36 -070059#if defined(DIVA_ISTREAM)
Joe Perches475be4d2012-02-19 19:52:38 -080060 dword rx_stream[256];
61 dword tx_stream[256];
62 word tx_pos[256];
63 word rx_pos[256];
64 byte stream_buffer[2512];
65 dword (*ram_offset)(ADAPTER *a);
66 void (*ram_out_dw)(ADAPTER *a,
67 void *addr,
68 const dword *data,
69 int dwords);
70 void (*ram_in_dw)(ADAPTER *a,
71 void *addr,
72 dword *data,
73 int dwords);
74 void (*istream_wakeup)(ADAPTER *a);
Linus Torvalds1da177e2005-04-16 15:20:36 -070075#else
Joe Perches475be4d2012-02-19 19:52:38 -080076 byte stream_buffer[4];
Linus Torvalds1da177e2005-04-16 15:20:36 -070077#endif
78};
79/*------------------------------------------------------------------*/
80/* public functions of IDI common code */
81/*------------------------------------------------------------------*/
Joe Perches475be4d2012-02-19 19:52:38 -080082void pr_out(ADAPTER *a);
83byte pr_dpc(ADAPTER *a);
84byte scom_test_int(ADAPTER *a);
85void scom_clear_int(ADAPTER *a);
Linus Torvalds1da177e2005-04-16 15:20:36 -070086/*------------------------------------------------------------------*/
87/* OS specific functions used by IDI common code */
88/*------------------------------------------------------------------*/
Joe Perches475be4d2012-02-19 19:52:38 -080089void free_entity(ADAPTER *a, byte e_no);
90void assign_queue(ADAPTER *a, byte e_no, word ref);
91byte get_assign(ADAPTER *a, word ref);
92void req_queue(ADAPTER *a, byte e_no);
93byte look_req(ADAPTER *a);
94void next_req(ADAPTER *a);
95ENTITY *entity_ptr(ADAPTER *a, byte e_no);
Linus Torvalds1da177e2005-04-16 15:20:36 -070096#if defined(DIVA_ISTREAM)
97struct _diva_xdi_stream_interface;
Joe Perches475be4d2012-02-19 19:52:38 -080098void diva_xdi_provide_istream_info(ADAPTER *a,
99 struct _diva_xdi_stream_interface *pI);
100void pr_stream(ADAPTER *a);
101int diva_istream_write(void *context,
102 int Id,
103 void *data,
104 int length,
105 int final,
106 byte usr1,
107 byte usr2);
108int diva_istream_read(void *context,
109 int Id,
110 void *data,
111 int max_length,
112 int *final,
113 byte *usr1,
114 byte *usr2);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115#if defined(DIVA_IDI_RX_DMA)
116#include "diva_dma.h"
117#endif
118#endif