Skip to content

Commit ed1c99e

Browse files
committed
inter-core FIFOs get handled in sio-core already
1 parent e5994c5 commit ed1c99e

3 files changed

Lines changed: 4 additions & 57 deletions

File tree

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ Features:
206206
- somewhat accurate PIO timings (also, MUCH slower emulation)
207207
- built-in cycle profiler using markers in the code
208208
- Dual Core support (by mingpepe)
209-
- Inter-core FIFO support (incomplete)
210209
- a WIP demo wiring up several RP2040s using an 8 bit bus and gathering debug info, simulating GPIO latency
211210
- this is the runner used for developing the [Connomore64](https://github.com/c1570/Connomore64)
212211
- a lot of dirty hacks and tests not suitable for pushing upstream

src/sio.ts

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ const GPIO_HI_OE_XOR = 0x04c; // QSPI output enable XOR
2626

2727
const GPIO_MASK = 0x3fffffff;
2828

29-
const FIFO_ST = 0x050; // Inter-core FIFO status register
30-
const FIFO_WR = 0x054; // Inter-core FIFO write register
31-
const FIFO_RD = 0x058; // Inter-core FIFO read register
32-
3329
//SPINLOCK
3430
const SPINLOCK_ST = 0x5c;
3531
const SPINLOCK0 = 0x100;
@@ -41,8 +37,6 @@ export class RPSIO {
4137
qspiGpioValue = 0;
4238
qspiGpioOutputEnable = 0;
4339
spinLock = 0;
44-
fifoCore0In: number[] = [];
45-
fifoCore1In: number[] = [];
4640
readonly core0;
4741
readonly core1;
4842

@@ -63,20 +57,6 @@ export class RPSIO {
6357
}
6458
}
6559
switch (offset) {
66-
case FIFO_RD: {
67-
let thisCoreFifo = (core == Core.Core0) ? this.fifoCore0In : this.fifoCore1In;
68-
if(thisCoreFifo.length == 0) {
69-
// FIXME add IRQ support
70-
// console.error("reading from empty FIFO");
71-
}
72-
return thisCoreFifo.shift() || 0;
73-
}
74-
case FIFO_ST: {
75-
let thisCoreFifo = (core == Core.Core0) ? this.fifoCore0In : this.fifoCore1In;
76-
let otherCoreFifo = (core == Core.Core0) ? this.fifoCore1In : this.fifoCore0In;
77-
// FIXME add WOF/ROE support
78-
return (otherCoreFifo.length < 8 ? 2 : 0) | (thisCoreFifo.length > 0 ? 1 : 0);
79-
}
8060
case GPIO_IN:
8161
return this.rp2040.gpioValues;
8262
case GPIO_HI_IN: {
@@ -121,6 +101,7 @@ export class RPSIO {
121101
case SPINLOCK_ST:
122102
return this.spinLock;
123103
}
104+
// Divider, Interpolator, FIFO get handled per core in sio-core
124105
switch (core) {
125106
case Core.Core0:
126107
return this.core0.readUint32(offset);
@@ -138,14 +119,6 @@ export class RPSIO {
138119
const prevGpioValue = this.gpioValue;
139120
const prevGpioOutputEnable = this.gpioOutputEnable;
140121
switch (offset) {
141-
case FIFO_WR:
142-
let otherCoreFifo = (core == Core.Core0) ? this.fifoCore1In : this.fifoCore0In;
143-
if(otherCoreFifo.length == 8) {
144-
console.error("writing to full FIFO");
145-
} else {
146-
otherCoreFifo.push(value);
147-
}
148-
break;
149122
case GPIO_OUT:
150123
this.gpioValue = value & GPIO_MASK;
151124
break;
@@ -195,6 +168,7 @@ export class RPSIO {
195168
this.qspiGpioOutputEnable ^= value & GPIO_MASK;
196169
break;
197170
default:
171+
// Divider, Interpolator, FIFO get handled per core in sio-core
198172
switch (core) {
199173
case Core.Core0:
200174
this.core0.writeUint32(offset, value);

src/sio_rp2350.ts

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ const GPIO_HI_OE_XOR = 0x04c; // GPIO32..47, QSPI, USB output enable XOR
2828

2929
const GPIO_MASK = 0x3fffffff;
3030

31-
const FIFO_ST = 0x050; // Inter-core FIFO status register
32-
const FIFO_WR = 0x054; // Inter-core FIFO write register
33-
const FIFO_RD = 0x058; // Inter-core FIFO read register
34-
3531
//SPINLOCK
3632
const SPINLOCK_ST = 0x5c;
3733
const SPINLOCK0 = 0x100;
@@ -43,8 +39,6 @@ export class RPSIO {
4339
qspiGpioValue = 0;
4440
qspiGpioOutputEnable = 0;
4541
spinLock = 0;
46-
fifoCore0In: number[] = [];
47-
fifoCore1In: number[] = [];
4842
readonly core0;
4943
readonly core1;
5044

@@ -65,20 +59,6 @@ export class RPSIO {
6559
}
6660
}
6761
switch (offset) {
68-
case FIFO_RD: {
69-
let thisCoreFifo = (core == Core.Core0) ? this.fifoCore0In : this.fifoCore1In;
70-
if(thisCoreFifo.length == 0) {
71-
// FIXME add IRQ support
72-
// console.error("reading from empty FIFO");
73-
}
74-
return thisCoreFifo.shift() || 0;
75-
}
76-
case FIFO_ST: {
77-
let thisCoreFifo = (core == Core.Core0) ? this.fifoCore0In : this.fifoCore1In;
78-
let otherCoreFifo = (core == Core.Core0) ? this.fifoCore1In : this.fifoCore0In;
79-
// FIXME add WOF/ROE support
80-
return (otherCoreFifo.length < 8 ? 2 : 0) | (thisCoreFifo.length > 0 ? 1 : 0);
81-
}
8262
case GPIO_IN:
8363
return this.rp2040.gpioValues;
8464
case GPIO_HI_IN: {
@@ -123,6 +103,7 @@ export class RPSIO {
123103
case SPINLOCK_ST:
124104
return this.spinLock;
125105
}
106+
// Divider, Interpolator, FIFO get handled per core in sio-core
126107
switch (core) {
127108
case Core.Core0:
128109
return this.core0.readUint32(offset);
@@ -140,14 +121,6 @@ export class RPSIO {
140121
const prevGpioValue = this.gpioValue;
141122
const prevGpioOutputEnable = this.gpioOutputEnable;
142123
switch (offset) {
143-
case FIFO_WR:
144-
let otherCoreFifo = (core == Core.Core0) ? this.fifoCore1In : this.fifoCore0In;
145-
if(otherCoreFifo.length == 8) {
146-
console.error("writing to full FIFO");
147-
} else {
148-
otherCoreFifo.push(value);
149-
}
150-
break;
151124
case GPIO_OUT:
152125
this.gpioValue = value & GPIO_MASK;
153126
break;
@@ -197,6 +170,7 @@ export class RPSIO {
197170
this.qspiGpioOutputEnable ^= value & GPIO_MASK;
198171
break;
199172
default:
173+
// Divider, Interpolator, FIFO get handled per core in sio-core
200174
switch (core) {
201175
case Core.Core0:
202176
this.core0.writeUint32(offset, value);

0 commit comments

Comments
 (0)