// The development board has four LEDs void hal_at91_led (int val) { HAL_ARM_AT91_GPIO_CFG_DIRECTION(AT91_GPIO_PA0, AT91_PIN_OUT); HAL_ARM_AT91_GPIO_CFG_DIRECTION(AT91_GPIO_PA1, AT91_PIN_OUT); HAL_ARM_AT91_GPIO_CFG_DIRECTION(AT91_GPIO_PA2, AT91_PIN_OUT); HAL_ARM_AT91_GPIO_CFG_DIRECTION(AT91_GPIO_PA3, AT91_PIN_OUT); HAL_ARM_AT91_GPIO_CFG_PULLUP(AT91_GPIO_PA0, AT91_PIN_PULLUP_DISABLE); HAL_ARM_AT91_GPIO_CFG_PULLUP(AT91_GPIO_PA1, AT91_PIN_PULLUP_DISABLE); HAL_ARM_AT91_GPIO_CFG_PULLUP(AT91_GPIO_PA2, AT91_PIN_PULLUP_DISABLE); HAL_ARM_AT91_GPIO_CFG_PULLUP(AT91_GPIO_PA3, AT91_PIN_PULLUP_DISABLE); // Set the bits. The logic is inverted HAL_ARM_AT91_GPIO_PUT(AT91_GPIO_PA1, !(val & 1)); HAL_ARM_AT91_GPIO_PUT(AT91_GPIO_PA2, !(val & 2)); HAL_ARM_AT91_GPIO_PUT(AT91_GPIO_PA3, !(val & 4)); HAL_ARM_AT91_GPIO_PUT(AT91_GPIO_PA4, !(val & 8)); }
static void spi_at91_set_npcs(cyg_spi_at91_bus_t *spi_bus,int val) { cyg_uint32 ctr; for(ctr=0;ctr<4;ctr++) { if(spi_bus->cs_en[ctr]) { HAL_ARM_AT91_GPIO_PUT(spi_bus->cs_gpio[ctr], (val & (1<<ctr))); } } }