int sam3u_hsmciinit(void) { #ifdef GPIO_MCI_CD sam3u_configgpio(GPIO_MCI_CD); #endif #ifdef GPIO_MCI_WP sam3u_configgpio(GPIO_MCI_WP); #endif return OK; }
void weak_function sam3u_spiinitialize(void) { /* The ZigBee module connects used NPCS0. However, there is not yet any * ZigBee support. */ /* The touchscreen connects using NPCS2 (PC14). */ #if defined(CONFIG_INPUT) && defined(CONFIG_INPUT_ADS7843E) sam3u_configgpio(GPIO_TSC_NPCS2); #endif }
int arch_tcinitialize(int minor) { FAR struct spi_dev_s *dev; int ret; idbg("minor %d\n", minor); DEBUGASSERT(minor == 0); /* Configure and enable the ADS7843E interrupt pin as an input */ (void)sam3u_configgpio(GPIO_TCS_BUSY); (void)sam3u_configgpio(GPIO_TCS_IRQ); /* Configure the PIO interrupt */ sam3u_gpioirq(GPIO_TCS_IRQ); /* Get an instance of the SPI interface */ dev = up_spiinitialize(CONFIG_ADS7843E_SPIDEV); if (!dev) { idbg("Failed to initialize SPI bus %d\n", CONFIG_ADS7843E_SPIDEV); return -ENODEV; } /* Initialize and register the SPI touschscreen device */ ret = ads7843e_register(dev, &g_tscinfo, CONFIG_ADS7843E_DEVMINOR); if (ret < 0) { idbg("Failed to initialize SPI bus %d\n", CONFIG_ADS7843E_SPIDEV); /* up_spiuninitialize(dev); */ return -ENODEV; } return OK; }
void sam3u_lowsetup(void) { uint32_t regval; /* Enable clocking for all selected UART/USARTs */ regval = 0; #ifdef CONFIG_SAM3U_UART regval |= (1 << SAM3U_PID_UART); #endif #ifdef CONFIG_SAM3U_USART0 regval |= (1 << SAM3U_PID_USART0); #endif #ifdef CONFIG_SAM3U_USART1 regval |= (1 << SAM3U_PID_USART1); #endif #ifdef CONFIG_SAM3U_USART2 regval |= (1 << SAM3U_PID_USART2); #endif #ifdef CONFIG_SAM3U_USART3 regval |= (1 << SAM3U_PID_USART3); #endif putreg32(regval, SAM3U_PMC_PCER); /* Configure UART pins for all selected UART/USARTs */ #ifdef CONFIG_SAM3U_UART (void)sam3u_configgpio(GPIO_UART_RXD); (void)sam3u_configgpio(GPIO_UART_TXD); #endif #ifdef CONFIG_SAM3U_USART0 (void)sam3u_configgpio(GPIO_USART0_RXD); (void)sam3u_configgpio(GPIO_USART0_TXD); (void)sam3u_configgpio(GPIO_USART0_CTS); (void)sam3u_configgpio(GPIO_USART0_RTS); #endif #ifdef CONFIG_SAM3U_USART1 (void)sam3u_configgpio(GPIO_USART1_RXD); (void)sam3u_configgpio(GPIO_USART1_TXD); (void)sam3u_configgpio(GPIO_USART1_CTS); (void)sam3u_configgpio(GPIO_USART1_RTS); #endif #ifdef CONFIG_SAM3U_USART2 (void)sam3u_configgpio(GPIO_USART2_RXD); (void)sam3u_configgpio(GPIO_USART2_TXD); (void)sam3u_configgpio(GPIO_USART2_CTS); (void)sam3u_configgpio(GPIO_USART2_RTS); #endif #ifdef CONFIG_SAM3U_USART3 (void)sam3u_configgpio(GPIO_USART3_RXD); (void)sam3u_configgpio(GPIO_USART3_TXD); (void)sam3u_configgpio(GPIO_USART3_CTS); (void)sam3u_configgpio(GPIO_USART3_RTS); #endif #ifdef GPIO_CONSOLE_RXD #endif #ifdef GPIO_CONSOLE_TXD (void)sam3u_configgpio(GPIO_CONSOLE_TXD); #endif #ifdef GPIO_CONSOLE_CTS (void)sam3u_configgpio(GPIO_CONSOLE_CTS); #endif #ifdef GPIO_CONSOLE_RTS (void)sam3u_configgpio(GPIO_CONSOLE_RTS); #endif /* Configure the console (only) */ #if defined(HAVE_CONSOLE) && !defined(CONFIG_SUPPRESS_UART_CONFIG) /* Reset and disable receiver and transmitter */ putreg32((UART_CR_RSTRX|UART_CR_RSTTX|UART_CR_RXDIS|UART_CR_TXDIS), SAM3U_CONSOLE_BASE+SAM3U_UART_CR_OFFSET); /* Disable all interrupts */ putreg32(0xffffffff, SAM3U_CONSOLE_BASE+SAM3U_UART_IDR_OFFSET); /* Set up the mode register */ putreg32(MR_VALUE, SAM3U_CONSOLE_BASE+SAM3U_UART_MR_OFFSET); /* Configure the console baud */ putreg32(((SAM3U_MCK_FREQUENCY + (SAM3U_CONSOLE_BAUD << 3))/(SAM3U_CONSOLE_BAUD << 4)), SAM3U_CONSOLE_BASE+SAM3U_UART_BRGR_OFFSET); /* Enable receiver & transmitter */ putreg32((UART_CR_RXEN|UART_CR_TXEN), SAM3U_CONSOLE_BASE+SAM3U_UART_CR_OFFSET); #endif }
void up_buttoninit(void) { (void)sam3u_configgpio(GPIO_BUTTON1); (void)sam3u_configgpio(GPIO_BUTTON2); }