diff --git a/.travis.yml b/.travis.yml index 4e816f1..4d5b01d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,8 +11,8 @@ addons: matrix: include: - env: RASPPI=0 - - env: RASPPI=1Br1 - - env: RASPPI=1Br2 + - env: RASPPI=1BRev1 + - env: RASPPI=1BRev2 - env: RASPPI=1BPlus - env: RASPPI=2 - env: RASPPI=3 diff --git a/Makefile.rules b/Makefile.rules index e519c3d..3f7e2ce 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -3,11 +3,11 @@ ifneq ($(V),1) Q := @ endif -#use RASPPI = 1Br1 Raspberry Pi 1B Rev 1 (26 IOports) (GPIO0/1) -#use RASPPI = 1Br2 Raspberry Pi 1B Rev 2 (26 IOports) (GPIO2/3) -#use RASPPI = 1BPlus to Raspberry Pi 1B+ (40 I/OPorts) +#use RASPPI = 1BRev1 for Raspberry Pi 1B Rev 1 (26 IOports) (GPIO0/1/21) +#use RASPPI = 1BRev2 for Raspberry Pi 1B Rev 2 (26 IOports) (GPIO2/3/27) +#use RASPPI = 1BPlus for Raspberry Pi 1B+ (40 I/OPorts) -RASPPI ?= 3 +RASPPI ?= 1BPlus PREFIX ?= arm-none-eabi- CC = $(PREFIX)gcc @@ -19,15 +19,15 @@ AR = $(PREFIX)ar 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)),1Br1) - ARCH ?= -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DRPI1BR1 -DEXPERIMENTALZERO=1 - CFLAGS += -DRPI1BR1 -DRASPPI=1 -else ifeq ($(strip $(RASPPI)),1Br2) - ARCH ?= -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DRPI1BR2 -DEXPERIMENTALZERO=1 - CFLAGS += -DRPI1BR2 -DRASPPI=1 +else ifeq ($(strip $(RASPPI)),1BRev1) + ARCH ?= -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DRPI1BREV1=1 -DEXPERIMENTALZERO=1 + CFLAGS += -DRPI1BREV1=1 -DRASPPI=1 +else ifeq ($(strip $(RASPPI)),1BRev2) + ARCH ?= -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DRPI1BREV2=1 -DEXPERIMENTALZERO=1 + CFLAGS += -DRPI1BREV2=1 -DRASPPI=1 else ifeq ($(strip $(RASPPI)),1BPlus) - ARCH ?= -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DRPIBPLUS=1 -DEXPERIMENTALZERO=1 - CFLAGS += -DRPIBPLUS=1 -DRASPPI=1 + ARCH ?= -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard -DRPI1BPLUS=1 -DEXPERIMENTALZERO=1 + CFLAGS += -DRPI1BPLUS=1 -DRASPPI=1 else ifeq ($(strip $(RASPPI)),2) ARCH ?= -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -marm -DRPI2=1 -DEXPERIMENTALZERO=1 CFLAGS += -DRPI2=1 @@ -35,7 +35,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, 1Br1, 1Br2, 1BPlus, 2, 3) + $(error RASPPI must be one of: 0, 1BRev1, 1BRev2, 1BPlus, 2, 3) endif AFLAGS += $(ARCH) diff --git a/src/defs.h b/src/defs.h index f21a6fa..c9130d7 100644 --- a/src/defs.h +++ b/src/defs.h @@ -5,7 +5,7 @@ #define PI1581SUPPORT 1 // Indicates a Pi with the 40 pin GPIO connector // so that additional functionality (e.g. test pins) can be enabled -#if defined(RPIZERO) || defined(RPIBPLUS) || defined(RPI2) || defined(RPI3) +#if defined(RPIZERO) || defined(RPI1BPLUS) || defined(RPI2) || defined(RPI3) #define HAS_40PINS #endif diff --git a/src/iec_bus.h b/src/iec_bus.h index 6306f9f..278d649 100644 --- a/src/iec_bus.h +++ b/src/iec_bus.h @@ -80,8 +80,8 @@ enum PIGPIO { // Original Non-split lines PIGPIO_ATN = 2, // 3 - PIGPIO_DATA = 18, // 12 PIGPIO_CLOCK = 17, // 11 + PIGPIO_DATA = 18, // 12 PIGPIO_SRQ = 19, // 35 PIGPIO_RESET = 3, // 5 @@ -123,15 +123,15 @@ enum PIGPIO { // Original Non-split lines // Raspberry Pi 1B Rev 2 has GPIO0/1 in place of GPIO2/3 -#if defined(RPI1BR1) +#if defined(RPI1BREV1) PIGPIO_ATN = 0, // 3 PIGPIO_RESET = 1, // 5 #else PIGPIO_ATN = 2, // 3 PIGPIO_RESET = 3, // 5 #endif - PIGPIO_DATA = 18, // 12 PIGPIO_CLOCK = 17, // 11 + PIGPIO_DATA = 18, // 12 PIGPIO_SRQ = 19, // 35 not connected yet // Pinout for those that want to split the lines (and the common ones like buttons, sound and LED) @@ -145,12 +145,12 @@ enum PIGPIO //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_IN_BUTTON5 = 9, // 21 + PIGPIO_IN_RESET = 20, // 38 + PIGPIO_IN_CLOCK = 10, // 19 + PIGPIO_OUT_LED = 7, // 26 PIGPIO_OUT_ATN = 12, // 32 not connected yet - PIGPIO_OUT_SOUND = 13, // 33 GPIO 13 is not connected at all with Raspberry 1 Layout + PIGPIO_OUT_SOUND = 11, // 23 // 14 TX // 8 // 15 RX // 10 //GPIO = 16, // 36 Common @@ -164,9 +164,11 @@ enum PIGPIO PIGPIO_IN_ATN = 24, // 18 PIGPIO_IN_DATA = 25, // 22 //GPIO 26, // 37 +#if defined(RPI1BREV1) + PIGPIO_IN_BUTTON1 = 21 // 13 Common +#else 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 }; #endif @@ -305,11 +307,13 @@ public: // This means that when any pin is turn to output it will output a 0 and pull lines low (ie an activation state on the IEC bus) // Note: on the IEC bus you never output a 1 you simply tri state and it will be pulled up to a 1 (ie inactive state on the IEC bus) if no one else is pulling it low. - myOutsGPFSEL0 = read32(ARM_GPIO_GPFSEL0); - myOutsGPFSEL1 = read32(ARM_GPIO_GPFSEL1); + //myOutsGPFSEL0 = read32(ARM_GPIO_GPFSEL0); + //myOutsGPFSEL1 = read32(ARM_GPIO_GPFSEL1); - myOutsGPFSEL1 |= (1 << ((PIGPIO_OUT_LED - 10) * 3)); - myOutsGPFSEL1 |= (1 << ((PIGPIO_OUT_SOUND - 10) * 3)); + //myOutsGPFSEL1 |= (1 << ((PIGPIO_OUT_LED - 10) * 3)); + //myOutsGPFSEL1 |= (1 << ((PIGPIO_OUT_SOUND - 10) * 3)); + RPI_SetGpioPinFunction((rpi_gpio_pin_t)PIGPIO_OUT_SOUND, FS_OUTPUT); + RPI_SetGpioPinFunction((rpi_gpio_pin_t)PIGPIO_OUT_LED, FS_OUTPUT); } else { diff --git a/src/rpi-gpio.h b/src/rpi-gpio.h index 5f7bdac..783fe8b 100644 --- a/src/rpi-gpio.h +++ b/src/rpi-gpio.h @@ -41,9 +41,9 @@ #define LED_GPIO_BIT 15 #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) + +// Added LED for Raspberry Pi 1B Rev1/2 (26 I/OPorts) according to enum PIGPIO in iec_bus.h A.Buch 02 Jan. 2020 +#elif defined(RPI1BREV1) || defined (RPI1BREV2) #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) @@ -53,6 +53,7 @@ #define LED_OFF() do { RPI_GpioBase->GPCLR0[0] = (1 << LED_GPIO_BIT); } while(0) #endif + typedef enum { FS_INPUT = 0,