lpcxpresso1549.c (656B)
1 2 #include <fw/io.h> 3 #include <fw/lib.h> 4 #include <arch/hardware.h> 5 6 const u32 gpio_led_red = GPIO_IDX(0, 25); 7 const u32 gpio_led_grn = GPIO_IDX(0, 3); 8 const u32 gpio_led_blu = GPIO_IDX(1, 1); 9 10 void board_debug_led(int on) { 11 gpio_wr(gpio_led_grn, !on); 12 } 13 14 void board_init(void) { 15 /* enable GPIO blocks */ 16 writel(readl(SYSAHBCLKCTRL0) | 17 AHBCC0_GPIO0 | AHBCC0_GPIO1 | AHBCC0_GPIO2, 18 SYSAHBCLKCTRL0); 19 20 /* disable LEDs */ 21 gpio_set(gpio_led_red); 22 gpio_set(gpio_led_grn); 23 gpio_set(gpio_led_blu); 24 25 /* LED GPIOs to OUT */ 26 gpio_cfg_dir(gpio_led_red, GPIO_CFG_OUT); 27 gpio_cfg_dir(gpio_led_grn, GPIO_CFG_OUT); 28 gpio_cfg_dir(gpio_led_blu, GPIO_CFG_OUT); 29 }