dev_pcc2.cc Source File
Back to the index.
Go to the documentation of this file.
59 #define INTERRUPT_LEVEL_MASK 0x07
61 #define PCC_TIMER_TICK_HZ 100.0
62 #define DEV_PCC2_TICK_SHIFT 14
81 static uint32_t read32(
unsigned char *p)
86 for (i=0; i<
sizeof(x); i++) {
95 static void write32(
unsigned char *p, uint32_t x)
99 for (i=0; i<
sizeof(x); i++) {
100 p[
sizeof(x) - 1 - i] = x;
106 static void pcc_timer_tick(
struct timer *
t,
void *
extra)
113 uint32_t count1, count2, compare1, compare2;
114 int interrupt1 = 0, interrupt2 = 0;
124 uint32_t old_count1 = count1;
128 if ((old_count1 < compare1 && count1 >= compare1) ||
129 (old_count1 < compare1 && count1 < old_count1)) {
133 while (count1 >= compare1) {
142 if ((int32_t) old_count1 >= 0 && (int32_t) count1 < 0) {
151 uint32_t old_count2 = count2;
154 if ((old_count2 < compare2 && count2 >= compare2) ||
155 (old_count2 < compare2 && count2 < old_count2)) {
158 while (count2 >= compare2) {
166 if ((int32_t) old_count2 >= 0 && (int32_t) count2 < 0) {
185 static void reassert_interrupts(
struct pcc2_data *d)
193 fatal(
"pcc2: C040 interrupt assertions... TODO\n");
256 assert ?
"ASSERT" :
"no assert");
296 default:
fatal(
"[ pcctwo_interrupt_common: TODO: line = %i ]\n",
301 reassert_interrupts(d);
318 reassert_interrupts(d);
336 switch (relative_addr) {
341 fatal(
"[ IGNORING write to read-only PCCTWO_CHIPID/"
342 "CHIPREV register ]\n");
348 fatal(
"TODO: pcc2: non-byte reads and writes of "
354 reassert_interrupts(d);
360 fatal(
"TODO: pcc2: non-byte reads and writes of "
367 fatal(
"[ pcc2: HUH? write to PCCTWO_VECBASE"
368 " with value 0x%02x. ]\n", (
int) idata);
382 fatal(
"TODO: pcc2: non-byte reads and writes of "
383 "PCCTWO_PSCALEADJ\n");
387 fatal(
"[ pcc2: write to PSCALEADJ ignored (value "
388 "0x%02x) ]\n", (
int)idata);
395 fatal(
"TODO: pcc2: non-byte reads and writes of "
409 fatal(
"[ pcc2: HUH? write to PCCTWO_TxCTL"
410 " with value 0x%02x. ]\n", (
int) idata);
417 fatal(
"TODO: pcc2: non-byte reads and writes of "
423 d->
pcctwo_reg[relative_addr] |= (idata & 0x17);
446 fatal(
"[ pcc2: HUH? write to PCCTWO_TxICR"
447 " with value 0x%02x. ]\n", (
int) idata);
449 reassert_interrupts(d);
455 fatal(
"TODO: pcc2: non-byte reads and writes of "
465 fatal(
"TODO: pcc2: non-byte reads and writes of "
472 fatal(
"[ pcc2: HUH? write to PCCTWO_SCCICR"
473 " with value 0x%02x. ]\n", (
int) idata);
474 reassert_interrupts(d);
480 fatal(
"TODO: pcc2: non-byte reads and writes of "
487 fatal(
"[ pcc2: HUH? write to PCCTWO_SCCTX"
488 " with value 0x%02x. ]\n", (
int) idata);
489 reassert_interrupts(d);
495 fatal(
"TODO: pcc2: non-byte reads and writes of "
502 fatal(
"[ pcc2: HUH? write to PCCTWO_SCCRX"
503 " with value 0x%02x. ]\n", (
int) idata);
504 reassert_interrupts(d);
511 reassert_interrupts(d);
516 fatal(
"TODO: pcc2: non-byte reads and writes of "
523 fatal(
"[ pcc2: HUH? write to PCCTWO_SCSIICR"
524 " with value 0x%02x. ]\n", (
int) idata);
525 reassert_interrupts(d);
531 fatal(
"TODO: pcc2: non-byte reads and writes of "
536 fatal(
"[ pcc2: HUH? Write attempt to PCCTWO_IPL. ]\n");
540 fatal(
"pcc2: IPL == 0 on read!\n");
548 fatal(
"TODO: pcc2: non-byte reads and writes of "
554 reassert_interrupts(d);
559 debug(
"[ pcc2: unimplemented %s offset 0x%x",
560 writeflag ==
MEM_WRITE?
"write to" :
"read from",
561 (
int) relative_addr);
563 debug(
": 0x%x", (
int)idata);
578 fatal(
"[ pcc2: write to mvme187_iack? ]\n");
582 debug(
"[ pcc2: mvme187_iack level %i => vector 0x%02x ]\n",
583 (
int)(relative_addr >> 2), (
int)odata);
618 for (i=0; i<16; i++) {
621 snprintf(n,
sizeof(n),
"%s.pcc2.%i",
624 memset(&templ, 0,
sizeof(templ));
639 M187_IACK, 32, dev_mvme187_iack_access, (
void *)d,
struct timer * timer_add(double freq, void(*timer_tick)(struct timer *timer, void *extra), void *extra)
#define INTERRUPT_CONNECT(name, istruct)
#define INTERRUPT_ASSERT(istruct)
int pending_timer2_interrupts
void(* interrupt_deassert)(struct interrupt *)
addr & if(addr >=0x24 &&page !=NULL)
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)
#define DEV_PCC2_TICK_SHIFT
int pending_timer1_interrupts
void machine_add_tickfunction(struct machine *machine, void(*func)(struct cpu *, void *), void *extra, int clockshift)
uint8_t pcctwo_reg[PCC2_SIZE]
void fatal(const char *fmt,...)
uint64_t memory_readmax64(struct cpu *cpu, unsigned char *buf, int len)
void pcctwo_interrupt_common(struct interrupt *interrupt, int assert)
#define PCC_TIMER_TICK_HZ
#define INTERRUPT_DEASSERT(istruct)
void(* interrupt_assert)(struct interrupt *)
void interrupt_handler_register(struct interrupt *templ)
void memory_writemax64(struct cpu *cpu, unsigned char *buf, int len, uint64_t data)
#define INTERRUPT_LEVEL_MASK
#define CHECK_ALLOCATION(ptr)
Generated on Tue Mar 24 2020 14:04:48 for GXemul by
1.8.17