1/*
2* cycx_drv.h	CYCX Support Module.  Kernel API Definitions.
3*
4* Author:	Arnaldo Carvalho de Melo <acme@conectiva.com.br>
5*
6* Copyright:	(c) 1998-2000 Arnaldo Carvalho de Melo
7*
8* Based on sdladrv.h by Gene Kozin <genek@compuserve.com>
9*
10*		This program is free software; you can redistribute it and/or
11*		modify it under the terms of the GNU General Public License
12*		as published by the Free Software Foundation; either version
13*		2 of the License, or (at your option) any later version.
14* ============================================================================
15* 1999/10/23	acme		cycxhw_t cleanup
16* 1999/01/03	acme		more judicious use of data types...
17*				uclong, ucchar, etc deleted, the u8, u16, u32
18*				types are the portable way to go.
19* 1999/01/03	acme		judicious use of data types... u16, u32, etc
20* 1998/12/26	acme	 	FIXED_BUFFERS, CONF_OFFSET,
21*                               removal of cy_read{bwl}
22* 1998/08/08	acme	 	Initial version.
23*/
24#ifndef	_CYCX_DRV_H
25#define	_CYCX_DRV_H
26
27#define	CYCX_WINDOWSIZE	0x4000	/* default dual-port memory window size */
28#define	GEN_CYCX_INTR	0x02
29#define	RST_ENABLE	0x04
30#define	START_CPU	0x06
31#define	RST_DISABLE	0x08
32#define	FIXED_BUFFERS	0x08
33#define	TEST_PATTERN	0xaa55
34#define	CMD_OFFSET	0x20
35#define CONF_OFFSET     0x0380
36#define	RESET_OFFSET	0x3c00	/* For reset file load */
37#define	DATA_OFFSET	0x0100	/* For code and data files load */
38#define	START_OFFSET	0x3ff0	/* 80186 starts here */
39
40#ifndef MIN
41#define MIN(a,b)	((a) < (b) ? (a) : (b))
42#endif
43
44/* Data Structures */
45/* Adapter hardware configuration. Pointer to this structure is passed to all
46 * APIs.  */
47typedef struct cycxhw {
48	u32 fwid;		/* firmware ID */
49	int irq;		/* interrupt request level */
50	u32 dpmbase;		/* dual-port memory base */
51	u32 dpmsize;		/* dual-port memory size */
52	u32 reserved[5];
53} cycxhw_t;
54
55/* Function Prototypes */
56extern int cycx_setup (cycxhw_t *hw, void *sfm, u32 len);
57extern int cycx_down (cycxhw_t *hw);
58extern int cycx_peek (cycxhw_t *hw, u32 addr, void *buf, u32 len);
59extern int cycx_poke (cycxhw_t *hw, u32 addr, void *buf, u32 len);
60extern int cycx_exec (u32 addr);
61
62extern void cycx_inten (cycxhw_t *hw);
63extern void cycx_intr (cycxhw_t *hw);
64#endif	/* _CYCX_DRV_H */
65