1 /*
2 * cycx_cfm.h	Cyclom 2X WAN Link Driver.
3 *		Definitions for the Cyclom 2X Firmware Module (CFM).
4 *
5 * Author:	Arnaldo Carvalho de Melo <acme@conectiva.com.br>
6 *
7 * Copyright:	(c) 1998-2003 Arnaldo Carvalho de Melo
8 *
9 * Based on sdlasfm.h by Gene Kozin <74604.152@compuserve.com>
10 *
11 *		This program is free software; you can redistribute it and/or
12 *		modify it under the terms of the GNU General Public License
13 *		as published by the Free Software Foundation; either version
14 *		2 of the License, or (at your option) any later version.
15 * ============================================================================
16 * 1998/08/08	acme		Initial version.
17 */
18 #ifndef	_CYCX_CFM_H
19 #define	_CYCX_CFM_H
20 
21 /* Defines */
22 
23 #define	CFM_VERSION	2
24 #define	CFM_SIGNATURE	"CFM - Cyclades CYCX Firmware Module"
25 
26 /* min/max */
27 #define	CFM_IMAGE_SIZE	0x20000	/* max size of CYCX code image file */
28 #define	CFM_DESCR_LEN	256	/* max length of description string */
29 #define	CFM_MAX_CYCX	1	/* max number of compatible adapters */
30 #define	CFM_LOAD_BUFSZ	0x400	/* buffer size for reset code (buffer_load) */
31 
32 /* Firmware Commands */
33 #define GEN_POWER_ON	0x1280
34 
35 #define GEN_SET_SEG	0x1401	/* boot segment setting. */
36 #define GEN_BOOT_DAT	0x1402	/* boot data. */
37 #define GEN_START	0x1403	/* board start. */
38 #define GEN_DEFPAR	0x1404	/* buffer length for boot. */
39 
40 /* Adapter Types */
41 #define CYCX_2X		2
42 /* for now only the 2X is supported, no plans to support 8X or 16X */
43 #define CYCX_8X		8
44 #define CYCX_16X	16
45 
46 #define	CFID_X25_2X	5200
47 
48 /**
49  *	struct cycx_fw_info - firmware module information.
50  *	@codeid - firmware ID
51  *	@version - firmware version number
52  *	@adapter - compatible adapter types
53  *	@memsize - minimum memory size
54  *	@reserved - reserved
55  *	@startoffs - entry point offset
56  *	@winoffs - dual-port memory window offset
57  *	@codeoffs - code load offset
58  *	@codesize - code size
59  *	@dataoffs - configuration data load offset
60  *	@datasize - configuration data size
61  */
62 struct cycx_fw_info {
63 	unsigned short	codeid;
64 	unsigned short	version;
65 	unsigned short	adapter[CFM_MAX_CYCX];
66 	unsigned long	memsize;
67 	unsigned short	reserved[2];
68 	unsigned short	startoffs;
69 	unsigned short	winoffs;
70 	unsigned short	codeoffs;
71 	unsigned long	codesize;
72 	unsigned short	dataoffs;
73 	unsigned long	datasize;
74 };
75 
76 /**
77  *	struct cycx_firmware - CYCX firmware file structure
78  *	@signature - CFM file signature
79  *	@version - file format version
80  *	@checksum - info + image
81  *	@reserved - reserved
82  *	@descr - description string
83  *	@info - firmware module info
84  *	@image - code image (variable size)
85  */
86 struct cycx_firmware {
87 	char		    signature[80];
88 	unsigned short	    version;
89 	unsigned short	    checksum;
90 	unsigned short	    reserved[6];
91 	char		    descr[CFM_DESCR_LEN];
92 	struct cycx_fw_info info;
93 	unsigned char	    image[0];
94 };
95 
96 struct cycx_fw_header {
97 	unsigned long  reset_size;
98 	unsigned long  data_size;
99 	unsigned long  code_size;
100 };
101 #endif	/* _CYCX_CFM_H */
102