/[dynamips]/upstream/dynamips-0.2.6-RC3/nmc93c46.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /upstream/dynamips-0.2.6-RC3/nmc93c46.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

upstream/dynamips-0.2.6-RC1/nmc93c46.c revision 2 by dpavlin, Sat Oct 6 16:03:58 2007 UTC upstream/dynamips-0.2.6-RC3/nmc93c46.c revision 4 by dpavlin, Sat Oct 6 16:06:49 2007 UTC
# Line 55  void nmc93c46_check_cs(struct nmc93c46_g Line 55  void nmc93c46_check_cs(struct nmc93c46_g
55  void nmc93c46_check_clk_group(struct nmc93c46_group *g,int group_id,  void nmc93c46_check_clk_group(struct nmc93c46_group *g,int group_id,
56                                u_int old,u_int new)                                u_int old,u_int new)
57  {  {
58       struct cisco_eeprom *eeprom;
59     u_int cmd,op,addr,pos;     u_int cmd,op,addr,pos;
60     u_int clk_bit, din_bit;     u_int clk_bit, din_bit;
    m_uint16_t *data;  
61    
62     clk_bit = g->def[group_id]->clock_bit;     clk_bit = g->def[group_id]->clock_bit;
63     din_bit = g->def[group_id]->din_bit;     din_bit = g->def[group_id]->din_bit;
# Line 122  void nmc93c46_check_clk_group(struct nmc Line 122  void nmc93c46_check_clk_group(struct nmc
122    
123  #if DEBUG_EEPROM  #if DEBUG_EEPROM
124           if (g->state[group_id].dataout_pos == 0)           if (g->state[group_id].dataout_pos == 0)
125              printf("nmc93c46: %s(%d): read addr = %x (%d), data=%4.4x, "              printf("nmc93c46: %s(%d): read addr=%x (%d), val = %4.4x\n",
126                     "val = %4.4x\n",                     g->description,group_id,addr,addr,
                    g->description,group_id,  
                    addr,addr,g->def[group_id]->data[addr],  
127                     g->state[group_id].cmd_val);                     g->state[group_id].cmd_val);
128  #endif  #endif
129                        
130           pos = g->state[group_id].dataout_pos++;           pos = g->state[group_id].dataout_pos++;
131           data = g->def[group_id]->data;           eeprom = g->eeprom[group_id];
132    
133           if ((data != NULL) && (addr < g->def[group_id]->data_len)) {           if (eeprom && eeprom->data && (addr < eeprom->len)) {
134              g->state[group_id].dataout_val = data[addr] & (1 << pos);              g->state[group_id].dataout_val = eeprom->data[addr] & (1 << pos);
135           } else {           } else {
136              /* access out of bounds */              /* access out of bounds */
137              g->state[group_id].dataout_val = (1 << pos);              g->state[group_id].dataout_val = (1 << pos);
# Line 180  u_int nmc93c46_read(struct nmc93c46_grou Line 178  u_int nmc93c46_read(struct nmc93c46_grou
178     res = g->eeprom_reg;     res = g->eeprom_reg;
179    
180     for(i=0;i<g->nr_eeprom;i++) {     for(i=0;i<g->nr_eeprom;i++) {
181          if (!(g->eeprom_reg & (1 << g->def[i]->select_bit)))
182             continue;
183    
184        if (g->state[i].dataout_val)        if (g->state[i].dataout_val)
185           res |= 1 << g->def[i]->dout_bit;           res |= 1 << g->def[i]->dout_bit;
186        else        else

Legend:
Removed from v.2  
changed lines
  Added in v.4

  ViewVC Help
Powered by ViewVC 1.1.26