From 899ed08033c1a4ce18beb76b9b5c75d80c8a55d3 Mon Sep 17 00:00:00 2001 From: Stephen White Date: Sat, 25 Jan 2020 12:04:05 +1100 Subject: [PATCH] Adaptation for Raspberry 1B with 26GPI/Os #166 --- Makefile.rules | 8 +++++++- src/iec_bus.h | 51 +++++++++++++++++++++++++++++++++++++++++++++++++- src/rpi-gpio.h | 5 +++++ 3 files changed, 62 insertions(+), 2 deletions(-) diff --git a/Makefile.rules b/Makefile.rules index 1fe4669..dceced9 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -12,10 +12,16 @@ AS = $(CC) LD = $(PREFIX)ld AR = $(PREFIX)ar +#Changed RASPPI = 1 to Raspberry 1B (26 IOports) A.Buch 02.Jan. 2020 +#Added RASPPI = 1+ to Rasüberry 1B+ (40 I/OPorts) + ifeq ($(strip $(RASPPI)),0) ARCH ?= -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DRPIZERO=1 -DEXPERIMENTALZERO=1 CFLAGS += -DRPIZERO=1 -DRASPPI=1 else ifeq ($(strip $(RASPPI)),1) +ARCH ?= -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DEXPERIMENTALZERO=1 +CFLAGS += -DRASPPI=1 +else ifeq ($(strip $(RASPPI)),1+) ARCH ?= -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DRPIBPLUS=1 CFLAGS += -DRPIBPLUS=1 -DRASPPI=1 else ifeq ($(strip $(RASPPI)),2) @@ -25,7 +31,7 @@ else ifeq ($(strip $(RASPPI)),3) ARCH ?= -march=armv8-a+crc -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard -marm -DRPI3=1 CFLAGS += -DRPI3=1 else -$(error RASPPI must be one of: 0, 1, 2, 3) +$(error RASPPI must be one of: 0, 1, 1+, 2, 3) endif AFLAGS += $(ARCH) diff --git a/src/iec_bus.h b/src/iec_bus.h index b549b0a..841fb73 100644 --- a/src/iec_bus.h +++ b/src/iec_bus.h @@ -74,7 +74,7 @@ // SRQ is a little bit different. // The 1581 does not pull it high. Only the 128 pulls it high. // - +#if defined(HAS_40PINS) enum PIGPIO { // Original Non-split lines @@ -116,6 +116,55 @@ enum PIGPIO PIGPIO_IN_CLOCK = 26, // 37 PIGPIO_IN_BUTTON1 = 27 // 13 Common }; +#else +//Added GPIO bindings for Raspberry 1B (only 26 I/O ports) +enum PIGPIO +{ + // Original Non-split lines + PIGPIO_ATN = 2, // 3 + PIGPIO_DATA = 18, // 12 + PIGPIO_CLOCK = 17, // 11 + PIGPIO_SRQ = 19, // 35 not connected yet + PIGPIO_RESET = 3, // 5 + + + // Pinout for those that want to split the lines (and the common ones like buttons, sound and LED) + // Funktion = GPIO // Hardware PIN + // 0 IDSC // 28 + // 1 IDSD // 27 + // 2 I2C_SDA // 3 + // 3 I2C_CLK // 5 + PIGPIO_IN_BUTTON4 = 4, // 07 Common + //GPIO = 5, // 29 Common + //PIGPIO_OUT_RESET = 6, // 31 + PIGPIO_OUT_SPI0_RS = 6, // 31 not connected yet + // 7 SPI0_CS1 // 26 + PIGPIO_IN_BUTTON5 = 8, // 24 changed for Raspberry 1 A.Buch 02.Jan.2020 + PIGPIO_IN_RESET = 9, // 21 changed for Raspberry 1 A.Buch 02.Jan.2020 + PIGPIO_IN_CLOCK = 10, // 19 changed for Raspberry 1 A.Buch 02.Jan.2020 + PIGPIO_OUT_LED = 11, // 23 changed for Raspberry 1 A.Buch 02.Jan.2020 + PIGPIO_OUT_ATN = 12, // 32 not connected yet + PIGPIO_OUT_SOUND = 13, // 33 GPIO 13 is not connected at all with Raspberry 1 Layout + // 14 TX // 8 + // 15 RX // 10 + //GPIO = 16, // 36 Common + PIGPIO_OUT_CLOCK = 17, // 11 + PIGPIO_OUT_DATA = 18, // 12 + PIGPIO_OUT_SRQ = 19, // 35 not connected yet + //GPIO 20, // 38 + PIGPIO_IN_SRQ = 21, // 40 not connected yet + PIGPIO_IN_BUTTON2 = 22, // 15 Common + PIGPIO_IN_BUTTON3 = 23, // 16 Common + PIGPIO_IN_ATN = 24, // 18 + PIGPIO_IN_DATA = 25, // 22 + //GPIO 26, // 37 + PIGPIO_IN_BUTTON1 = 27 // 13 Common + //PIGPIO_OUT_SOUND = 45 // ToDo internal GPIO connected with audio out left. To change for sound with Raspberry 1 A.Buch + // gives yet an overflow A.Buch 03. Jan. 2020. Sound is still disabled by EXPERIMENTALZERO +}; +#endif + + enum PIGPIOMasks { diff --git a/src/rpi-gpio.h b/src/rpi-gpio.h index 2808363..79f0d67 100644 --- a/src/rpi-gpio.h +++ b/src/rpi-gpio.h @@ -42,6 +42,11 @@ #define LED_ON() do { RPI_GpioBase->GPCLR0[1] = (1 << LED_GPIO_BIT); } while(0) #define LED_OFF() do { RPI_GpioBase->GPSET0[1] = (1 << LED_GPIO_BIT); } while(0) #elif defined(RPI3) +// Added LED for Rasberry 1B (26 I/OPorts) according to enum PIGPIO in iec_bus.h A.Buch 02 Jan. 2020 +#elif defined(RASPPI) + #define LED_GPIO_BIT 11 + #define LED_ON() do { RPI_GpioBase->GPSET0[1] = (1 << LED_GPIO_BIT); } while(0) + #define LED_OFF() do { RPI_GpioBase->GPCLR0[0] = (1 << LED_GPIO_BIT); } while(0) #else #define LED_GPIO_BIT 16 #define LED_ON() do { RPI_GpioBase->GPSET0[1] = (1 << LED_GPIO_BIT); } while(0)