Skip to content

Commit

Permalink
Be consistent with SRAM bank numbering (0-1, not 1-2)
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyparrish committed Oct 1, 2024
1 parent a948b03 commit 373800b
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 44 deletions.
6 changes: 3 additions & 3 deletions firmware/fast-gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

#if defined(ARDUINO_ARCH_RP2040) // e.g. Raspberry Pi Pico (W)

#define SRAM_PIN__WRITE_BANK_1 12
#define SRAM_PIN__WRITE_BANK_2 13
#define SRAM_PIN__WRITE_BANK_0 12
#define SRAM_PIN__WRITE_BANK_1 13

#define SRAM_PIN__ADDR_RESET 15
#define SRAM_PIN__ADDR_CLOCK 20
Expand Down Expand Up @@ -56,8 +56,8 @@

#else

#define SRAM_PIN__WRITE_BANK_0 0
#define SRAM_PIN__WRITE_BANK_1 0
#define SRAM_PIN__WRITE_BANK_2 0

#define SRAM_PIN__ADDR_RESET 0
#define SRAM_PIN__ADDR_CLOCK 0
Expand Down
6 changes: 3 additions & 3 deletions firmware/sram.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ static inline void sram_write_word(uint16_t word_data) {

void sram_init() {
// Set output modes on all SRAM pins.
pinMode(SRAM_PIN__WRITE_BANK_0, OUTPUT);
pinMode(SRAM_PIN__WRITE_BANK_1, OUTPUT);
pinMode(SRAM_PIN__WRITE_BANK_2, OUTPUT);
pinMode(SRAM_PIN__ADDR_RESET, OUTPUT);
pinMode(SRAM_PIN__ADDR_CLOCK, OUTPUT);
pinMode(SRAM_PIN__DATA_NEXT_BIT, OUTPUT);
Expand All @@ -60,8 +60,8 @@ void sram_init() {
FAST_SET(SRAM_PIN__DATA_WRITE);

// Set other outputs low by default.
FAST_CLEAR(SRAM_PIN__WRITE_BANK_0);
FAST_CLEAR(SRAM_PIN__WRITE_BANK_1);
FAST_CLEAR(SRAM_PIN__WRITE_BANK_2);
FAST_CLEAR(SRAM_PIN__ADDR_CLOCK);
FAST_CLEAR(SRAM_PIN__DATA_NEXT_BIT);
FAST_CLEAR(SRAM_PIN__DATA_CLOCK);
Expand All @@ -72,7 +72,7 @@ void sram_init() {
void sram_start_bank(int bank) {
sram_flush_and_release_bank();

active_bank_pin = bank ? SRAM_PIN__WRITE_BANK_2 : SRAM_PIN__WRITE_BANK_1;
active_bank_pin = bank ? SRAM_PIN__WRITE_BANK_1 : SRAM_PIN__WRITE_BANK_0;
FAST_SET(active_bank_pin);

// Reset the write address to 0.
Expand Down
4 changes: 2 additions & 2 deletions hardware/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ The stacking boards are:
- These host the SRAM itself, and the buffers that allow it to be
alternately controlled by the Sega or the microcontroller. This is the
most complex. A solder jumper on the board selects whether it responds as
bank 1 or bank 2.
bank 0 or bank 1.
- When ordering this through JLCPCB:
- The following parts could easily be populated by hand if you wish:
- J1 & J2 (stacking headers, 2x26 and 2x21 pins respectively)
- The following **must** be soldered by hand:
- JP1 and JP2 are solder jumpers that must be closed on each board; to
set bank 1, bridge center to left on both jumpers; to set bank 2,
set bank 0, bridge center to left on both jumpers; to set bank 1,
bridge center to right on both jumpers (also indicated on silkscreen)
- `microcontroller`: Microcontroller Board
- This hosts the microcontroller, registers, sync token, and buffers to send
Expand Down
8 changes: 4 additions & 4 deletions hardware/kinetoscope-header-internal.kicad_sch
Original file line number Diff line number Diff line change
Expand Up @@ -1463,7 +1463,7 @@
(pin passive line
(at 17.78 -5.08 180)
(length 2.54)
(name "SRAM_DIS_1"
(name "SRAM_DIS_0"
(effects
(font
(size 1.27 1.27)
Expand Down Expand Up @@ -1661,7 +1661,7 @@
(pin passive line
(at 17.78 -7.62 180)
(length 2.54)
(name "SRAM_DIS_2"
(name "SRAM_DIS_1"
(effects
(font
(size 1.27 1.27)
Expand Down Expand Up @@ -5558,7 +5558,7 @@
)
(uuid "57a88da8-613e-47f6-9b56-50c9e2936f6c")
)
(hierarchical_label "SRAM_DIS_2"
(hierarchical_label "SRAM_DIS_1"
(shape passive)
(at 227.33 49.53 0)
(fields_autoplaced yes)
Expand All @@ -5582,7 +5582,7 @@
)
(uuid "62a0af4a-8b7f-4955-b697-aa030e879023")
)
(hierarchical_label "SRAM_DIS_1"
(hierarchical_label "SRAM_DIS_0"
(shape passive)
(at 227.33 46.99 0)
(fields_autoplaced yes)
Expand Down
4 changes: 2 additions & 2 deletions hardware/libraries/symbols/kinetoscope-cart-header.kicad_sym
Original file line number Diff line number Diff line change
Expand Up @@ -1457,7 +1457,7 @@
(pin passive line
(at 17.78 -5.08 180)
(length 2.54)
(name "SRAM_DIS_1"
(name "SRAM_DIS_0"
(effects
(font
(size 1.27 1.27)
Expand Down Expand Up @@ -1655,7 +1655,7 @@
(pin passive line
(at 17.78 -7.62 180)
(length 2.54)
(name "SRAM_DIS_2"
(name "SRAM_DIS_1"
(effects
(font
(size 1.27 1.27)
Expand Down
16 changes: 8 additions & 8 deletions hardware/microcontroller.kicad_pcb
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@
(net 24 "/kinetoscope-header-internal/SEGA_A4")
(net 25 "/kinetoscope-header-internal/SEGA_A11")
(net 26 "/kinetoscope-header-internal/SEGA_A17")
(net 27 "/SRAM_DIS_1")
(net 28 "/SRAM_DIS_2")
(net 27 "/SRAM_DIS_0")
(net 28 "/SRAM_DIS_1")
(net 29 "/kinetoscope-header-internal/SEGA_A22")
(net 30 "/kinetoscope-header-internal/SEGA_D12")
(net 31 "/kinetoscope-header-internal/SEGA_A21")
Expand Down Expand Up @@ -12830,8 +12830,8 @@
(drill 1)
(layers "*.Cu" "*.Mask")
(remove_unused_layers no)
(net 27 "/SRAM_DIS_1")
(pinfunction "SRAM_DIS_1")
(net 27 "/SRAM_DIS_0")
(pinfunction "SRAM_DIS_0")
(pintype "passive")
(uuid "78b4b8ae-2d9d-4525-9f47-a095972d8c00")
)
Expand All @@ -12841,8 +12841,8 @@
(drill 1)
(layers "*.Cu" "*.Mask")
(remove_unused_layers no)
(net 28 "/SRAM_DIS_2")
(pinfunction "SRAM_DIS_2")
(net 28 "/SRAM_DIS_1")
(pinfunction "SRAM_DIS_1")
(pintype "passive")
(uuid "b76a59b6-5cce-4f9d-b2fd-89a388b0933e")
)
Expand Down Expand Up @@ -17255,7 +17255,7 @@
(drill 1)
(layers "*.Cu" "*.Mask")
(remove_unused_layers no)
(net 27 "/SRAM_DIS_1")
(net 27 "/SRAM_DIS_0")
(pinfunction "GP12")
(pintype "passive")
(uuid "228c38e5-0736-4437-b7b2-e80c703fe559")
Expand All @@ -17266,7 +17266,7 @@
(drill 1)
(layers "*.Cu" "*.Mask")
(remove_unused_layers no)
(net 28 "/SRAM_DIS_2")
(net 28 "/SRAM_DIS_1")
(pinfunction "GP13")
(pintype "passive")
(uuid "003fc1b7-f515-4979-b3c0-b416078ec299")
Expand Down
12 changes: 6 additions & 6 deletions hardware/microcontroller.kicad_sch
Original file line number Diff line number Diff line change
Expand Up @@ -4389,7 +4389,7 @@
)
(uuid "1cd60674-764c-48af-8c72-18a059c4fc89")
)
(label "SRAM_DIS_1"
(label "SRAM_DIS_0"
(at 24.13 156.21 180)
(fields_autoplaced yes)
(effects
Expand Down Expand Up @@ -4543,7 +4543,7 @@
)
(uuid "48096a2c-d096-4e97-abae-1ca3c9b00729")
)
(label "SRAM_DIS_1"
(label "SRAM_DIS_0"
(at 35.56 88.9 180)
(fields_autoplaced yes)
(effects
Expand Down Expand Up @@ -4950,7 +4950,7 @@
)
(uuid "b3064596-2f23-48b8-b19f-be861e2b0da0")
)
(label "SRAM_DIS_2"
(label "SRAM_DIS_1"
(at 35.56 91.44 180)
(fields_autoplaced yes)
(effects
Expand Down Expand Up @@ -5247,7 +5247,7 @@
)
(uuid "eb20dc20-816e-4371-8dc3-efa5c48b6780")
)
(label "SRAM_DIS_2"
(label "SRAM_DIS_1"
(at 24.13 158.75 180)
(fields_autoplaced yes)
(effects
Expand Down Expand Up @@ -10147,7 +10147,7 @@
)
(uuid "6b4575e2-a7da-4f67-8ca7-f82d9304e897")
)
(pin "SRAM_DIS_2" passive
(pin "SRAM_DIS_1" passive
(at 33.02 158.75 180)
(effects
(font
Expand All @@ -10157,7 +10157,7 @@
)
(uuid "68c241c4-745f-4a4f-a1f4-3010418ece04")
)
(pin "SRAM_DIS_1" passive
(pin "SRAM_DIS_0" passive
(at 33.02 156.21 180)
(effects
(font
Expand Down
18 changes: 9 additions & 9 deletions hardware/sram-bank.kicad_pcb
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,14 @@
(net 54 "/kinetoscope-header-internal/SEGA_A22")
(net 55 "/SEGA_D6")
(net 56 "/SEGA_D1")
(net 57 "/SRAM_DIS_2")
(net 57 "/SRAM_DIS_1")
(net 58 "/SRAM_W_A11")
(net 59 "/SRAM_W_A3")
(net 60 "/SRAM_W_A1")
(net 61 "/SEGA_D0")
(net 62 "/SRAM_D_IN12")
(net 63 "/SEGA_A12")
(net 64 "/SRAM_DIS_1")
(net 64 "/SRAM_DIS_0")
(net 65 "/SRAM_D_IN14")
(net 66 "/SEGA_A17")
(net 67 "/SEGA_A5")
Expand Down Expand Up @@ -14607,7 +14607,7 @@
(at -1.3 0)
(size 1 0.5)
(layers "F.Cu" "F.Mask")
(net 64 "/SRAM_DIS_1")
(net 64 "/SRAM_DIS_0")
(pinfunction "A")
(pintype "passive")
(zone_connect 2)
Expand Down Expand Up @@ -14652,7 +14652,7 @@
(at 1.3 0)
(size 1 0.5)
(layers "F.Cu" "F.Mask")
(net 57 "/SRAM_DIS_2")
(net 57 "/SRAM_DIS_1")
(pinfunction "B")
(pintype "passive")
(zone_connect 2)
Expand Down Expand Up @@ -17877,8 +17877,8 @@
(drill 1)
(layers "*.Cu" "*.Mask")
(remove_unused_layers no)
(net 64 "/SRAM_DIS_1")
(pinfunction "SRAM_DIS_1")
(net 64 "/SRAM_DIS_0")
(pinfunction "SRAM_DIS_0")
(pintype "passive")
(uuid "3dac3dba-5c3f-4c69-af2a-513ff8511a59")
)
Expand All @@ -17888,8 +17888,8 @@
(drill 1)
(layers "*.Cu" "*.Mask")
(remove_unused_layers no)
(net 57 "/SRAM_DIS_2")
(pinfunction "SRAM_DIS_2")
(net 57 "/SRAM_DIS_1")
(pinfunction "SRAM_DIS_1")
(pintype "passive")
(uuid "811b3a1b-1c95-4298-9421-8696cf8487e9")
)
Expand Down Expand Up @@ -18964,7 +18964,7 @@
)
)
)
(gr_text "--o bank 1\no-- bank 2"
(gr_text "--o bank 0\no-- bank 1"
(at 49 28 0)
(layer "F.SilkS")
(uuid "ff5ec38f-dec0-48ca-bc6a-68fc7aac87d1")
Expand Down
14 changes: 7 additions & 7 deletions hardware/sram-bank.kicad_sch
Original file line number Diff line number Diff line change
Expand Up @@ -2326,7 +2326,7 @@
)
(uuid "1ad68464-c13a-4f31-a463-2a50e5cea37d")
)
(text "These two jumpers need to be soldered the same way.\ne.g.:\n\nSRAM_DIS = SRAM_DIS_1 and ~{SRAM_CE} = ~{SRAM_CE_1}\n\nor\n\nSRAM_DIS = SRAM_DIS_2 and ~{SRAM_CE} = ~{SRAM_CE_2}\n\nThis determines whether the board responds as\nbank 1 (2MB - 3MB range) or bank 2 (3MB - 4MB range)."
(text "These two jumpers need to be soldered the same way.\ne.g.:\n\nSRAM_DIS = SRAM_DIS_0 and ~{SRAM_CE} = ~{SRAM_CE_1}\n\nor\n\nSRAM_DIS = SRAM_DIS_1 and ~{SRAM_CE} = ~{SRAM_CE_2}\n\nThis determines whether the board responds as\nbank 0 (2MB - 3MB range) or bank 1 (3MB - 4MB range)."
(exclude_from_sim no)
(at 17.78 183.896 0)
(effects
Expand Down Expand Up @@ -2924,7 +2924,7 @@
)
(uuid "7758da0f-6f21-441a-9041-c6084993ba02")
)
(label "SRAM_DIS_2"
(label "SRAM_DIS_1"
(at 261.62 124.46 0)
(fields_autoplaced yes)
(effects
Expand Down Expand Up @@ -2957,7 +2957,7 @@
)
(uuid "7ce4a0be-ff56-4e5d-a29d-aa1de152b8a1")
)
(label "SRAM_DIS_1"
(label "SRAM_DIS_0"
(at 261.62 121.92 0)
(fields_autoplaced yes)
(effects
Expand Down Expand Up @@ -3034,7 +3034,7 @@
)
(uuid "8feeb3ab-06cf-4a1f-9b42-18b19ae35a0c")
)
(label "SRAM_DIS_1"
(label "SRAM_DIS_0"
(at 87.63 181.61 180)
(fields_autoplaced yes)
(effects
Expand Down Expand Up @@ -3078,7 +3078,7 @@
)
(uuid "b239083f-6144-4fb6-b345-35845484ceae")
)
(label "SRAM_DIS_2"
(label "SRAM_DIS_1"
(at 100.33 181.61 0)
(fields_autoplaced yes)
(effects
Expand Down Expand Up @@ -6177,7 +6177,7 @@
)
(uuid "a8dce3ba-4f5d-4dba-9f49-ac5b9b02e07a")
)
(pin "SRAM_DIS_2" passive
(pin "SRAM_DIS_1" passive
(at 259.08 124.46 0)
(effects
(font
Expand All @@ -6187,7 +6187,7 @@
)
(uuid "6c5e11ad-b452-4d2a-9901-bb528ae7eb02")
)
(pin "SRAM_DIS_1" passive
(pin "SRAM_DIS_0" passive
(at 259.08 121.92 0)
(effects
(font
Expand Down

0 comments on commit 373800b

Please sign in to comment.