/* LCPU MMIO device access */ #ifndef LCPU_MMIO_H #define LCPU_MMIO_H typedef struct { /* Header registers for the Wire device */ uint32_t nrInputs; uint32_t nrOutputs; } LCPU_WireDevice_Header; #define LCPU_WIRE_BASE 0x11310000 #define LCPU_WIRE_IO_BASE WIRE_BASE + sizeof(LCPU_WireDevice_Header) #define LCPU_WIRE_OUTPUT_BASE WIRE_IO_BASE + (WIRE_HEADER->nrInputs * sizeof(uint32_t)) #define LCPU_WIRE_HEADER ((volatile LCPU_WireDevice_Header*)WIRE_BASE) /* retrieve wire input [i] */ #define LCPU_WIRE_INPUT(i) *(volatile const uint32_t*)(WIRE_IO_BASE + (i * sizeof(uint32_t))) /* set wire output [i] */ #define LCPU_WIRE_OUTPUT(i) *(volatile uint32_t*)(WIRE_OUTPUT_BASE + (i * sizeof(uint32_t))) /* syscon device */ #define LCPU_SYSCON *(volatile uint32_t*)0x11100000 /* UART device */ #define LCPU_UART_BASE 0x10000000 #define LCPU_UART_DATA *(volatile uint32_t*)UART_BASE #define LCPU_UART_STATUS UART_DATA /* syscon helpers */ #define LCPU_REBOOT() LCPU_SYSCON = 0x7777; #define LCPU_SHUTDOWN() LCPU_SYSCON = 0x5555; #endif