dev_8253.cc Source File
Back to the index.
Go to the documentation of this file.
56 #define DEV_8253_LENGTH 4
77 static void timer0_tick(
struct timer *
t,
void *
extra)
103 uint64_t idata = 0, odata = 0;
110 switch (relative_addr) {
119 d->
counter[relative_addr] &= 0xff00;
120 d->
counter[relative_addr] |= (idata & 0xff);
123 d->
counter[relative_addr] &= 0x00ff;
124 d->
counter[relative_addr] |= ((idata&0xff)<<8);
125 if (d->
counter[relative_addr] != 0)
126 d->
hz[relative_addr] = (int) (
128 d->
counter[relative_addr] + 0.5);
130 d->
hz[relative_addr] = 0;
131 debug(
"[ 8253: counter %i set to %i (%i Hz) "
132 "]\n", relative_addr, d->
counter[
133 relative_addr], d->
hz[relative_addr]);
134 switch (relative_addr) {
135 case 0:
if (d->
timer0 == NULL)
137 d->
hz[0], timer0_tick, d);
142 case 1:
fatal(
"TODO: DMA refresh?\n");
144 case 2:
fatal(
"TODO: 8253 tone generation?\n");
148 default:
fatal(
"[ 8253: huh? writing to counter"
149 " %i but neither from msb nor lsb? ]\n",
157 odata = d->
counter[relative_addr] & 0xff;
160 odata = (d->
counter[relative_addr] >> 8) & 0xff;
162 default:
fatal(
"[ 8253: huh? reading from counter"
163 " %i but neither from msb nor lsb? ]\n",
181 debug(
"[ 8253: attempt to select counter 3,"
182 " which doesn't exist. ]\n");
188 debug(
"[ 8253: select=%i mode=0x%x ",
191 switch (idata & 0x30) {
204 fatal(
"[ 8253: BCD not yet implemented ]\n");
208 debug(
"[ 8253: read; can this actually happen? ]\n");
214 fatal(
"[ 8253: unimplemented write to address 0x%x"
215 " data=0x%02x ]\n", (
int)relative_addr, (
int)idata);
217 fatal(
"[ 8253: unimplemented read from address 0x%x "
218 "]\n", (
int)relative_addr);
struct timer * timer_add(double freq, void(*timer_tick)(struct timer *timer, void *extra), void *extra)
int * pending_timer_interrupts
#define INTERRUPT_CONNECT(name, istruct)
#define INTERRUPT_ASSERT(istruct)
int pending_interrupts_timer0
void memory_device_register(struct memory *mem, const char *, uint64_t baseaddr, uint64_t len, int(*f)(struct cpu *, struct memory *, uint64_t, unsigned char *, size_t, int, void *), void *extra, int flags, unsigned char *dyntrans_data)
void machine_add_tickfunction(struct machine *machine, void(*func)(struct cpu *, void *), void *extra, int clockshift)
#define I8253_TIMER_RATEGEN
void fatal(const char *fmt,...)
struct isa_pic_data isa_pic_data
uint64_t memory_readmax64(struct cpu *cpu, unsigned char *buf, int len)
#define I8253_TIMER_CNTR2
void timer_update_frequency(struct timer *t, double new_freq)
#define I8253_TIMER_16BIT
#define I8253_TIMER_CNTR1
void memory_writemax64(struct cpu *cpu, unsigned char *buf, int len, uint64_t data)
#define I8253_TIMER_CNTR0
#define CHECK_ALLOCATION(ptr)
Generated on Tue Aug 25 2020 19:25:06 for GXemul by
1.8.18