# HG changeset patch # User Josef 'Jeff' Sipek # Date 1670791086 18000 # Sun Dec 11 15:38:06 2022 -0500 # Node ID ca149d313328d0a0fb7847a14440cf88caaab149 # Parent ad6a8afa9b749e453cf8c5b9a2ddfd31530a2b10 arch: add PIN_{INPUT,OUTPUT}_* macros These can be used to construct the PORT and DDR register values in more semantically readable way. Signed-off-by: Josef 'Jeff' Sipek diff --git a/arch.h b/arch.h --- a/arch.h +++ b/arch.h @@ -39,6 +39,17 @@ #define STATIC_ASSERT(c) _Static_assert(c, #c) #define mmregs ((volatile struct mmregs_layout * volatile) (void *) 0x0) + +/* + * Macros to construct PORT and DDR register values + */ +#define PIN_INPUT_PORT_Z(bit) 0 +#define PIN_INPUT_PORT_H(bit) (1 << (bit)) +#define PIN_INPUT_DDR(bit) 0 +#define PIN_OUTPUT_PORT_H(bit) (1 << (bit)) +#define PIN_OUTPUT_PORT_L(bit) 0 +#define PIN_OUTPUT_DDR(bit) (1 << (bit)) + #endif #endif