/[gxemul]/trunk/src/devices/dev_openpic.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 /trunk/src/devices/dev_openpic.c

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

revision 64 by dpavlin, Sat Oct 13 15:43:48 2007 UTC revision 67 by dpavlin, Sun Oct 14 13:46:39 2007 UTC
# Line 82  void openpic_lo_interrupt_deassert(struc Line 82  void openpic_lo_interrupt_deassert(struc
82                  INTERRUPT_DEASSERT(d->cpu_irq);                  INTERRUPT_DEASSERT(d->cpu_irq);
83  }  }
84    
85    #define OPENPIC_MASK                            0x80000000
86    #define OPENPIC_ACTIVITY                        0x40000000      /* Read Only */
87    #define OPENPIC_PRIORITY_MASK                   0x000f0000
88    #define OPENPIC_PRIORITY_SHIFT                  16
89    #define OPENPIC_VECTOR_MASK                     0x000000ff
90    
91    #define OPENPIC_VEC_TIMER       64      /* and up */
92    #define OPENPIC_VEC_IPI         72      /* and up */
93    #define OPENPIC_VEC_SPURIOUS    127
94    
95    #define OPENPIC_NUM_TIMERS      4
96    #define OPENPIC_NUM_IPI         4
97    #define OPENPIC_NUM_PRI         16
98    #define OPENPIC_NUM_VECTORS     256
99    
100  DEVICE_ACCESS(openpic)  DEVICE_ACCESS(openpic)
101  {  {
102  //      struct openpic_data *d = extra;  //      struct openpic_data *d = extra;
103          uint64_t idata = 0, odata = 0;          uint64_t idata = 0, odata = 0, decoded = 0;
104    
105          if (writeflag == MEM_WRITE)          if (writeflag == MEM_WRITE) {
106                  idata = memory_readmax64(cpu, data, len);                  idata = memory_readmax64(cpu, data, len);
107                    decoded =
108                            ( idata & 0x000000ff ) << 24 |
109                            ( idata & 0x0000ff00 ) << 8  |
110                            ( idata & 0x00ff0000 ) >> 8  |
111                            ( idata & 0xff000000 ) >> 24 ;
112    
113                    uint64_t priority,vector, active;
114                    priority = ( decoded & OPENPIC_PRIORITY_MASK ) >> OPENPIC_PRIORITY_SHIFT;
115                    vector   = ( decoded & OPENPIC_VECTOR_MASK );
116                    active   = ( decoded & OPENPIC_ACTIVITY );
117    
118                    debug("[ openpic: WRITE %05x | %08x => %08x | priority: %x vector: 0x%02x %d active: %x ]\n",
119                            (int)relative_addr, (int)idata, (int)decoded, (int)priority, (int)vector, (int)vector, (int)active );
120            }
121    
122          switch (relative_addr) {          switch (relative_addr) {
123    
124            case 0x00:
125                    if (writeflag == MEM_READ) {
126                            // version 1.2
127                            odata = 0x02000000;
128                            fatal("[ openpic: read from "
129                                "offset 0x%x (OpenPIC version) = %x]\n", (int)
130                                relative_addr, (int)odata);
131                    }
132                    fatal("[ openpic: unimplemented write to "
133                        "offset 0x%x: data=0x%x (OpenPIC version) ]\n", (int)
134                        relative_addr, (int)idata);
135                    break;
136    
137  #if 0  #if 0
138  #define INT_STATE_REG_H  (interrupt_reg + 0x00)  #define INT_STATE_REG_H  (interrupt_reg + 0x00)
139  #define INT_ENABLE_REG_H (interrupt_reg + 0x04)  #define INT_ENABLE_REG_H (interrupt_reg + 0x04)
# Line 102  DEVICE_ACCESS(openpic) Line 143  DEVICE_ACCESS(openpic)
143  #define INT_ENABLE_REG_L (interrupt_reg + 0x14)  #define INT_ENABLE_REG_L (interrupt_reg + 0x14)
144  #define INT_CLEAR_REG_L  (interrupt_reg + 0x18)  #define INT_CLEAR_REG_L  (interrupt_reg + 0x18)
145  #define INT_LEVEL_REG_L  (interrupt_reg + 0x1c)  #define INT_LEVEL_REG_L  (interrupt_reg + 0x1c)
 #endif  
146    
 #if 0  
147          case 0x10:          case 0x10:
148                  if (writeflag == MEM_READ)                  if (writeflag == MEM_READ)
149                          odata = d->status_hi & d->enable_hi;                          odata = d->status_hi & d->enable_hi;

Legend:
Removed from v.64  
changed lines
  Added in v.67

  ViewVC Help
Powered by ViewVC 1.1.26