/[dynamips]/trunk/nmc93cX6.h
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/nmc93cX6.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 12 - (show annotations)
Sat Oct 6 16:45:40 2007 UTC (11 years, 7 months ago) by dpavlin
File MIME type: text/plain
File size: 2391 byte(s)
make working copy

1 /*
2 * Cisco router simulation platform.
3 * Copyright (c) 2005,2006 Christophe Fillot.
4 *
5 * NMC93C46/NMC93C56 Serial EEPROM.
6 */
7
8 #ifndef __NMC93CX6_H__
9 #define __NMC93CX6_H__
10
11 #include <sys/types.h>
12 #include "utils.h"
13 #include "cisco_eeprom.h"
14
15 /* EEPROM types */
16 enum {
17 EEPROM_TYPE_NMC93C46,
18 EEPROM_TYPE_NMC93C56,
19 };
20
21 /* EEPROM data bit order */
22 enum {
23 EEPROM_DORD_NORMAL = 0,
24 EEPROM_DORD_REVERSED,
25 };
26
27 /* EEPROM debugging */
28 enum {
29 EEPROM_DEBUG_DISABLED = 0,
30 EEPROM_DEBUG_ENABLED,
31 };
32
33 /* EEPROM DOUT default status */
34 enum {
35 EEPROM_DOUT_HIGH = 0,
36 EEPROM_DOUT_KEEP,
37 };
38
39 /* 8 groups with 4 differents bits (clock,select,data_in,data_out) */
40 #define NMC93CX6_MAX_EEPROM_PER_GROUP 16
41
42 /* NMC93C46 EEPROM command bit length */
43 #define NMC93C46_CMD_BITLEN 9
44
45 /* NMC93C56 EEPROM command bit length */
46 #define NMC93C56_CMD_BITLEN 11
47
48 /* NMC93C46 EEPROM data bit length */
49 #define NMC93CX6_CMD_DATALEN 16
50
51 /* NMC93C46 EEPROM commands: SB (1) OP(2) Address(6/9) */
52 #define NMC93CX6_CMD_CONTROL (0x1 | 0x0)
53 #define NMC93CX6_CMD_WRDS (0x1 | 0x0 | 0x00)
54 #define NMC93CX6_CMD_ERASE_ALL (0x1 | 0x0 | 0x08)
55 #define NMC93CX6_CMD_WRITE_ALL (0x1 | 0x0 | 0x10)
56 #define NMC93CX6_CMD_WREN (0x1 | 0x0 | 0x18)
57 #define NMC93CX6_CMD_READ (0x1 | 0x2)
58 #define NMC93CX6_CMD_WRITE (0x1 | 0x4)
59 #define NMC93CX6_CMD_ERASE (0x1 | 0x6)
60
61 struct nmc93cX6_eeprom_def {
62 u_int clock_bit;
63 u_int select_bit;
64 u_int din_bit;
65 u_int dout_bit;
66 };
67
68 struct nmc93cX6_eeprom_state {
69 u_int cmd_len;
70 u_int cmd_val;
71 u_int state;
72 u_int dataout_pos;
73 u_int dataout_val;
74 };
75
76 struct nmc93cX6_group {
77 u_int eeprom_type;
78 u_int nr_eeprom;
79 u_int eeprom_reg;
80 u_int reverse_data;
81 u_int dout_status;
82 int debug;
83 char *description;
84 const struct nmc93cX6_eeprom_def *def[NMC93CX6_MAX_EEPROM_PER_GROUP];
85 struct nmc93cX6_eeprom_state state[NMC93CX6_MAX_EEPROM_PER_GROUP];
86 struct cisco_eeprom *eeprom[NMC93CX6_MAX_EEPROM_PER_GROUP];
87 };
88
89 /* Handle write */
90 void nmc93cX6_write(struct nmc93cX6_group *g,u_int data);
91
92 /* Returns the TRUE if the EEPROM is active */
93 u_int nmc93cX6_is_active(struct nmc93cX6_group *g,u_int group_id);
94
95 /* Returns the DOUT bit value */
96 u_int nmc93cX6_get_dout(struct nmc93cX6_group *g,u_int group_id);
97
98 /* Handle read */
99 u_int nmc93cX6_read(struct nmc93cX6_group *p);
100
101 #endif /* __NMC93CX6_H__ */

  ViewVC Help
Powered by ViewVC 1.1.26