void board_led_initialize(void) { /* Configure all LED GPIO lines */ lpc17_configgpio(ZKITARM_LED1); lpc17_configgpio(ZKITARM_LED2); }
void up_relayinit(void) { lpc17_configgpio(NUCLEUS_BMS_RELAY1); lpc17_configgpio(NUCLEUS_BMS_RELAY2); lpc17_configgpio(NUCLEUS_BMS_RELAY3); lpc17_configgpio(NUCLEUS_BMS_RELAY4); }
void lpc17_boardinitialize(void) { /* Enable +5V needed for CAN */ #if defined(CONFIG_LPC17_CAN1) || defined(CONFIG_LPC17_CAN2) lpc17_configgpio(NUCLEUS2G_5V_ENABLE); #else lpc17_configgpio(NUCLEUS2G_5V_DISABLE); #endif /* If UART0 is used, enabled the MAX232 driver */ #ifdef CONFIG_LPC17_UART0 lpc17_configgpio(NUCLEUS2G_232_ENABLE); #else lpc17_configgpio(NUCLEUS2G_232_POWERSAVE); #endif /* Configure SSP chip selects if 1) at least one SSP is enabled, and 2) the weak * function lpc17_sspinitialize() has been brought into the link. */ #if defined(CONFIG_LPC17_SSP0) || defined(CONFIG_LPC17_SSP1) if (lpc17_sspinitialize) { lpc17_sspinitialize(); } #endif /* Configure on-board LEDs if LED support has been selected. */ #ifdef CONFIG_ARCH_LEDS up_ledinit(); #endif }
void weak_function lpc1766stk_sspinitialize(void) { /* Configure the SSP0 chip select GPIOs. Only the Nokia LCD is connected to SSP0 */ #ifdef CONFIG_LPC17_SSP0 ssp_dumpssp0gpio("BEFORE SSP0 Initialization"); lpc17_configgpio(LPC1766STK_LCD_CS); ssp_dumpssp0gpio("AFTER SSP0 Initialization"); #endif /* Configure SSP1 chip select GPIOs. Only the SD/MMC card slot is connected to SSP1 */ #ifdef CONFIG_LPC17_SSP1 ssp_dumpssp0gpio("BEFORE SSP1 Initialization"); lpc17_configgpio(LPC1766STK_MMC_CS); /* Also configure the SD/MMC power GPIO (but leave power off). This really has * nothing to do with SSP, but does belong with other SD/MMC GPIO configuration * settings. */ lpc17_configgpio(LPC1766STK_MMC_PWR); ssp_dumpssp0gpio("AFTER SSP1 Initialization"); #endif #ifdef CONFIG_SPI_CALLBACK /* If there were any CD detect pins for the LPC1766-STK, this is where * they would be configured. */ #endif }
void weak_function lpcxpresso_sspdev_initialize(void) { /* Configure the SPI-based microSD CS GPIO */ ssp_dumpgpio("lpcxpresso_sspdev_initialize() Entry)"); /* Configure card detect and chip select for the SD slot. NOTE: Jumper J55 must * be set correctly for the SD slot chip select. */ #ifdef CONFIG_LPC17_SSP1 (void)lpc17_configgpio(LPCXPRESSO_SD_CS); (void)lpc17_configgpio(LPCXPRESSO_SD_CD); /* Configure chip select for the OLED. For the SPI interface, insert jumpers in * J42, J43, J45 pin1-2 and J46 pin 1-2. */ #ifdef CONFIG_NX_LCDDRIVER (void)lpc17_configgpio(LPCXPRESSO_OLED_CS); #endif #endif ssp_dumpgpio("lpcxpresso_sspdev_initialize() Exit"); }
void board_autoled_initialize(void) { /* Configure LED1-4 GPIOs for output */ lpc17_configgpio(GPIO_LED1); lpc17_configgpio(GPIO_LED2); lpc17_configgpio(GPIO_LED3); lpc17_configgpio(GPIO_LED4); }
void lpc17_ledinit(void) { /* Configure LED1-4 GPIOs for output */ lpc17_configgpio(GPIO_LED1); lpc17_configgpio(GPIO_LED2); lpc17_configgpio(GPIO_LED3); lpc17_configgpio(GPIO_LED4); }
void board_led_initialize(void) { /* Configure all LED GPIO lines */ led_dumpgpio("board_led_initialize() Entry)"); lpc17_configgpio(LINCOLN60_LED1); lpc17_configgpio(LINCOLN60_LED2); led_dumpgpio("board_led_initialize() Exit"); }
void up_ledinit(void) /* Name when invoked via up_boot.c */ #endif { /* Configure all LED GPIO lines */ led_dumpgpio("up_ledinit() Entry)"); lpc17_configgpio(LPC1766STK_LED1); lpc17_configgpio(LPC1766STK_LED2); led_dumpgpio("up_ledinit() Exit"); }
void up_ledinit(void) { /* Configure all LED GPIO lines */ led_dumpgpio("up_ledinit() Entry)"); lpc17_configgpio(MBED_LED1); lpc17_configgpio(MBED_LED2); lpc17_configgpio(MBED_LED3); lpc17_configgpio(MBED_LED4); led_dumpgpio("up_ledinit() Exit"); }
void weak_function zkit_spidev_initialize(void) { /* Configure the SPI-based microSD CS and Card Detect (CD) GPIO */ spi_dumpgpio("zkit_spidev_initialize() Entry)"); /* Configure card detect and chip select for the SD slot. */ (void)lpc17_configgpio(ZKITARM_SD_CS); (void)lpc17_configgpio(ZKITARM_SD_CD); spi_dumpgpio("zkit_spidev_initialize() Exit"); }
FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno) { FAR struct spi_dev_s *spi; FAR struct lcd_dev_s *dev; /* Configure the LCD GPIOs */ lcd_dumpgpio("up_nxdrvinit: On entry"); lpc17_configgpio(LPC1766STK_LCD_RST); lpc17_configgpio(LPC1766STK_LCD_BL); lcd_dumpgpio("up_nxdrvinit: After GPIO setup"); /* Reset the LCD */ lpc17_gpiowrite(LPC1766STK_LCD_RST, false); up_udelay(10); lpc17_gpiowrite(LPC1766STK_LCD_RST, true); up_mdelay(5); /* Configure PWM1 to support the backlight */ nokia_blinitialize(); /* Get the SSP port (configure as a Freescale SPI port) */ spi = up_spiinitialize(0); if (!spi) { glldbg("Failed to initialize SSP port 0\n"); } else { /* Bind the SSP port to the LCD */ dev = nokia_lcdinitialize(spi, devno); if (!dev) { glldbg("Failed to bind SSP port 0 to LCD %d: %d\n", devno); } else { gllvdbg("Bound SSP port 0 to LCD %d\n", devno); /* And turn the LCD on (CONFIG_LCD_MAXPOWER should be 1) */ (void)dev->setpower(dev, CONFIG_LCD_MAXPOWER); return dev; } } return NULL; }
xcpt_t board_button_irq(int id, xcpt_t irqhandler) { xcpt_t rethandler = NULL; irqstate_t flags; int ret; /* Interrupts are supported on KEY5 only */ if (id == BOARD_BUTTON_5) { /* Return the previous value of the interrupt handler */ flags = irqsave(); rethandler = g_oldhandler; g_oldhandler = irqhandler; /* Attach or detach the interrupt handler for KEY5. */ if (irqhandler) { /* Configure KEY5 as an interrupting input */ lpc17_configgpio(ZKITARM_INT_KEY5); /* Attach the new interrupt handler and enable the interrupt */ ret = irq_attach(ZKITARM_KEY5_IRQ, irqhandler); if (ret == OK) { up_enable_irq(ZKITARM_KEY5_IRQ); } } else { /* Disable the interrupt and detach the handler */ up_disable_irq(ZKITARM_KEY5_IRQ); (void)irq_detach(ZKITARM_KEY5_IRQ); /* Configure KEY5 as a non-interrupting input */ lpc17_configgpio(ZKITARM_KEY5); } irqrestore(flags); } return rethandler; }
void weak_function nucleus2g_sspinitialize(void) { /* Configure the SPI-based microSD CS GPIO */ ssp_dumpgpio("nucleus2g_sspinitialize() Entry)"); /* SSP0 connects only to the MMC/SD slot on the Nucleus 1G board. * P0[15]/TXD1/SCK0/SCK MMC_CLK * P0[16]/RXD1/SSEL0/SSEL MMC_CD * P0[17]/CTS1/MISO0/MISO MMC_DATA0 * P0[18]/DCD1/MOSI0/MOSI MMC_MISO * * In SPI mode the MMC/SD DATA3/CD functions as the SPI chip select. */ #ifdef CONFIG_LPC17_SSP0 lpc17_configgpio(NUCLEUS2G_MMCSD_CS); #endif /* SSP1 goes off the Nucleus 2G board to the Babel CAN board along with 3 chip * select pins. However, it is currently not used on that board. */ #ifdef CONFIG_LPC17_SSP1 # warning "SSP1 chip selects not known" #endif ssp_dumpgpio("nucleus2g_sspinitialize() Exit"); }
void board_autoled_initialize(void) { /* Configure all LED GPIO lines */ lpc17_configgpio(C027_LED); g_ncstate = true; }
void up_ledinit(void) { /* Configure all LED GPIO lines */ lpc17_configgpio(LPCXPRESSO_LED); g_ncstate = true; }
FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno) { FAR struct spi_dev_s *spi; FAR struct lcd_dev_s *dev; /* Configure the OLED GPIOs. For the SPI interface, insert jumpers in J42, * J43, J45 pin1-2 and J46 pin 1-2. */ oledcs_dumpgpio("up_nxdrvinit: After OLED CS setup"); oleddc_dumpgpio("up_nxdrvinit: On entry"); (void)lpc17_configgpio(LPCXPRESSO_OLED_POWER); /* OLED 11V power */ (void)lpc17_configgpio(LPCXPRESSO_OLED_DC); /* OLED Command/Data */ oleddc_dumpgpio("up_nxdrvinit: After OLED Power/DC setup"); /* Get the SSI port (configure as a Freescale SPI port) */ spi = up_spiinitialize(1); if (!spi) { glldbg("Failed to initialize SSI port 1\n"); } else { /* Bind the SSI port to the OLED */ dev = ug_initialize(spi, devno); if (!dev) { glldbg("Failed to bind SSI port 1 to OLED %d: %d\n", devno); } else { gllvdbg("Bound SSI port 1 to OLED %d\n", devno); /* And turn the OLED on (dim) */ (void)dev->setpower(dev, UG_POWER_DIM); return dev; } } return NULL; }
static int nsh_sdinitialize(void) { int ret; #ifdef NSH_HAVE_MMCSD_CD /* Configure the SD card detect GPIO */ lpc17_configgpio(GPIO_SD_CD); /* Attach an interrupt handler to get notifications when a card is * inserted or deleted. */ #if NSH_HAVE_MMCSD_CDINT (void)irq_attach(LPC17_IRQ_P0p13, nsh_cdinterrupt); up_enable_irq(LPC17_IRQ_P0p13); #endif #endif /* First, get an instance of the SDIO interface */ g_sdiodev = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO); if (!g_sdiodev) { message("nsh_archinitialize: Failed to initialize SDIO slot %d\n", CONFIG_NSH_MMCSDSLOTNO); return -ENODEV; } /* Now bind the SDIO interface to the MMC/SD driver */ ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, g_sdiodev); if (ret != OK) { message("nsh_archinitialize: " "Failed to bind SDIO to the MMC/SD driver: %d\n", ret); return ret; } /* Check if there is a card in the slot and inform the SDCARD driver. If * we do not support the card detect, then let's assume that there is * one. */ #ifdef NSH_HAVE_MMCSD_CD sdio_mediachange(g_sdiodev, !lpc17_gpioread(GPIO_SD_CD)); #else sdio_mediachange(g_sdiodev, true); #endif return OK; }
void up_buttoninit(void) { int i; /* Configure the GPIO pins as interrupting inputs. */ for (i = 0; i < BOARD_NUM_BUTTONS; i++) { lpc17_configgpio(g_buttoncfg[i]); } }
int board_lcd_initialize(void) { lpc17_configgpio(ZKITARM_OLED_RST); lpc17_configgpio(ZKITARM_OLED_RS); lpc17_gpiowrite(ZKITARM_OLED_RST, 1); lpc17_gpiowrite(ZKITARM_OLED_RS, 1); zkit_sspdev_initialize(); g_spidev = lpc17_sspbus_initialize(0); if (!g_spidev) { glldbg("Failed to initialize SSP port 0\n"); return 0; } lpc17_gpiowrite(ZKITARM_OLED_RST, 0); up_mdelay(1); lpc17_gpiowrite(ZKITARM_OLED_RST, 1); return 1; }
int up_lcdinitialize(void) { lpc17_configgpio(ZKITARM_OLED_RST); lpc17_configgpio(ZKITARM_OLED_RS); lpc17_gpiowrite(ZKITARM_OLED_RST, 1); lpc17_gpiowrite(ZKITARM_OLED_RS, 1); zkit_sspinitialize(); spi = lpc17_sspinitialize(0); if (!spi) { glldbg("Failed to initialize SSP port 0\n"); return 0; } lpc17_gpiowrite(ZKITARM_OLED_RST, 0); up_mdelay(1); lpc17_gpiowrite(ZKITARM_OLED_RST, 1); return 1; }
void board_button_initialize(void) { int i; /* Configure the GPIO pins as interrupting inputs. */ for (i = 0; i < NUM_BUTTONS; i++) { lpc17_configgpio(g_buttoncfg[i]); } }
void board_button_initialize(void) { int i; /* Configure the GPIO pins as inputs. NOTE that EXTI interrupts are * configured for some pins but NOT used in this file */ for (i = 0; i < BOARD_NUM_BUTTONS; i++) { lpc17_configgpio(g_buttons[i]); } }
void weak_function zkit_sspinitialize(void) { /* Configure the SPI-based LCD CS GPIO */ ssp_dumpgpio("zkit_sspinitialize() Entry)"); /* Configure chip select for the LCD. */ #ifdef CONFIG_LPC17_SSP0 #ifdef CONFIG_NX_LCDDRIVER (void)lpc17_configgpio(ZKITARM_OLED_CS); #endif #endif /* CONFIG_LPC17_SSP0 */ ssp_dumpgpio("zkit_sspinitialize() Exit"); }
static void dac_reset(FAR struct dac_dev_s *dev) { irqstate_t flags; uint32_t regval; flags = irqsave(); regval = getreg32(LPC17_SYSCON_PCLKSEL0); regval &= ~SYSCON_PCLKSEL0_DAC_MASK; regval |= (SYSCON_PCLKSEL_CCLK8 << SYSCON_PCLKSEL0_DAC_SHIFT); putreg32(regval, LPC17_SYSCON_PCLKSEL0); //putreg32(DAC_CTRL_DBLBUFEN,LPC17_DAC_CTRL); ? lpc17_configgpio(GPIO_AOUT); irqrestore(flags); }
void board_led_initialize(void) { /* Configure all LED GPIO lines */ led_dumpgpio("board_led_initialize() Entry)"); lpc17_configgpio(NUCLEUS2G_LED1_A); lpc17_configgpio(NUCLEUS2G_LED1_B); lpc17_configgpio(NUCLEUS2G_LED2_A); lpc17_configgpio(NUCLEUS2G_LED2_B); lpc17_configgpio(NUCLEUS2G_HEARTBEAT); lpc17_configgpio(NUCLEUS2G_EXTRA_LED); led_dumpgpio("board_led_initialize() Exit"); }
void lpc17_lowsetup(void) { #ifdef HAVE_UART uint32_t regval; /* Step 1: Enable power for all console UART and disable power for * other UARTs */ regval = getreg32(LPC17_SYSCON_PCONP); regval &= ~(SYSCON_PCONP_PCUART0|SYSCON_PCONP_PCUART1| SYSCON_PCONP_PCUART2|SYSCON_PCONP_PCUART3); #if defined(CONFIG_UART0_SERIAL_CONSOLE) regval |= SYSCON_PCONP_PCUART0; #elif defined(CONFIG_UART1_SERIAL_CONSOLE) regval |= SYSCON_PCONP_PCUART1; #elif defined(CONFIG_UART2_SERIAL_CONSOLE) regval |= SYSCON_PCONP_PCUART2; #elif defined(CONFIG_UART3_SERIAL_CONSOLE) regval |= SYSCON_PCONP_PCUART3; #endif putreg32(regval, LPC17_SYSCON_PCONP); /* Step 2: Enable peripheral clocking for the console UART and disable * clocking for all other UARTs */ regval = getreg32(LPC17_SYSCON_PCLKSEL0); regval &= ~(SYSCON_PCLKSEL0_UART0_MASK|SYSCON_PCLKSEL0_UART1_MASK); #if defined(CONFIG_UART0_SERIAL_CONSOLE) regval |= (CONSOLE_CCLKDIV << SYSCON_PCLKSEL0_UART0_SHIFT); #elif defined(CONFIG_UART1_SERIAL_CONSOLE) regval |= (CONSOLE_CCLKDIV << SYSCON_PCLKSEL0_UART1_SHIFT); #endif putreg32(regval, LPC17_SYSCON_PCLKSEL0); regval = getreg32(LPC17_SYSCON_PCLKSEL1); regval &= ~(SYSCON_PCLKSEL1_UART2_MASK|SYSCON_PCLKSEL1_UART3_MASK); #if defined(CONFIG_UART2_SERIAL_CONSOLE) regval |= (CONSOLE_CCLKDIV << SYSCON_PCLKSEL1_UART2_SHIFT); #elif defined(CONFIG_UART3_SERIAL_CONSOLE) regval |= (CONSOLE_CCLKDIV << SYSCON_PCLKSEL1_UART3_SHIFT); #endif putreg32(regval, LPC17_SYSCON_PCLKSEL1); /* Configure UART pins for the selected CONSOLE */ #if defined(CONFIG_UART0_SERIAL_CONSOLE) lpc17_configgpio(GPIO_UART0_TXD); lpc17_configgpio(GPIO_UART0_RXD); #elif defined(CONFIG_UART1_SERIAL_CONSOLE) lpc17_configgpio(GPIO_UART1_TXD); lpc17_configgpio(GPIO_UART1_RXD); #ifdef CONFIG_UART1_FLOWCONTROL lpc17_configgpio(GPIO_UART1_CTS); lpc17_configgpio(GPIO_UART1_DCD); lpc17_configgpio(GPIO_UART1_DSR); lpc17_configgpio(GPIO_UART1_DTR); lpc17_configgpio(GPIO_UART1_RI); lpc17_configgpio(GPIO_UART1_RTS); #endif #elif defined(CONFIG_UART2_SERIAL_CONSOLE) lpc17_configgpio(GPIO_UART2_TXD); lpc17_configgpio(GPIO_UART2_RXD); irqrestore(flags); #elif defined(CONFIG_UART3_SERIAL_CONSOLE) lpc17_configgpio(GPIO_UART3_TXD); lpc17_configgpio(GPIO_UART3_RXD); #endif /* Configure the console (only) */ #if defined(HAVE_CONSOLE) && !defined(CONFIG_SUPPRESS_UART_CONFIG) /* Clear fifos */ putreg32(UART_FCR_RXRST|UART_FCR_TXRST, CONSOLE_BASE+LPC17_UART_FCR_OFFSET); /* Set trigger */ putreg32(UART_FCR_FIFOEN|UART_FCR_RXTRIGGER_8, CONSOLE_BASE+LPC17_UART_FCR_OFFSET); /* Set up the LCR and set DLAB=1 */ putreg32(CONSOLE_LCR_VALUE|UART_LCR_DLAB, CONSOLE_BASE+LPC17_UART_LCR_OFFSET); /* Set the BAUD divisor */ putreg32(CONSOLE_DL >> 8, CONSOLE_BASE+LPC17_UART_DLM_OFFSET); putreg32(CONSOLE_DL & 0xff, CONSOLE_BASE+LPC17_UART_DLL_OFFSET); /* Clear DLAB */ putreg32(CONSOLE_LCR_VALUE, CONSOLE_BASE+LPC17_UART_LCR_OFFSET); /* Configure the FIFOs */ putreg32(UART_FCR_RXTRIGGER_8|UART_FCR_TXRST|UART_FCR_RXRST|UART_FCR_FIFOEN, CONSOLE_BASE+LPC17_UART_FCR_OFFSET); #endif #endif /* HAVE_UART */ }
void open1788_lcd_initialize(void) { /* Configure the LCD backlight (and turn the backlight off) */ lpc17_configgpio(GPIO_LCD_BL); }