atsam: Use enumerations for pin mappings

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2019-03-12 12:15:49 -04:00 committed by KevinOConnor
parent 8f541d090e
commit 8b0195f896
2 changed files with 21 additions and 10 deletions

View File

@ -38,8 +38,6 @@ def beaglebone_pins():
return gpios return gpios
MCU_PINS = { MCU_PINS = {
"sam3x8e": port_pins(4, 32), "sam3x8c": port_pins(2, 32),
"sam4s8c": port_pins(3, 32), "sam4e8e" : port_pins(5, 32),
"samd21g18a": port_pins(2, 32), "samd21e18a": port_pins(2, 32), "samd21g18a": port_pins(2, 32), "samd21e18a": port_pins(2, 32),
"samd51g19a": port_pins(2, 32), "samd51j19a": port_pins(3, 32), "samd51g19a": port_pins(2, 32), "samd51j19a": port_pins(3, 32),
"samd51n19a": port_pins(3, 32), "samd51p20a": port_pins(4, 32), "samd51n19a": port_pins(3, 32), "samd51p20a": port_pins(4, 32),

View File

@ -11,15 +11,28 @@
#include "internal.h" // gpio_peripheral #include "internal.h" // gpio_peripheral
#include "sched.h" // sched_shutdown #include "sched.h" // sched_shutdown
DECL_ENUMERATION_RANGE("pin", "PA0", GPIO('A', 0), 32);
DECL_ENUMERATION_RANGE("pin", "PB0", GPIO('B', 0), 32);
#ifdef PIOC
DECL_ENUMERATION_RANGE("pin", "PC0", GPIO('C', 0), 32);
#endif
#ifdef PIOD
DECL_ENUMERATION_RANGE("pin", "PD0", GPIO('D', 0), 32);
#endif
#ifdef PIOE
DECL_ENUMERATION_RANGE("pin", "PE0", GPIO('E', 0), 32);
#endif
static Pio * const digital_regs[] = { static Pio * const digital_regs[] = {
#if CONFIG_MACH_SAM3X8E PIOA, PIOB,
PIOA, PIOB, PIOC, PIOD #ifdef PIOC
#elif CONFIG_MACH_SAM3X8C PIOC,
PIOA, PIOB #endif
#elif CONFIG_MACH_SAM4S8C #ifdef PIOD
PIOA, PIOB, PIOC PIOD,
#elif CONFIG_MACH_SAM4E8E #endif
PIOA, PIOB, PIOC, PIOD, PIOE #ifdef PIOE
PIOE,
#endif #endif
}; };