/* Initialize LCD in memory mapped mode and touch panel */ void LCD_InitializeLCD(void) { TOUCH_Config_TypeDef touch_init = TOUCH_INIT_DEFAULT; int i; /* If we are in BC_UIF_AEM_EFM state, we can redraw graphics */ if (DVK_readRegister(&BC_REGISTER->UIF_AEM) == BC_UIF_AEM_EFM) { /* If we're not BC_ARB_CTRL_EBI state, we need to reconfigure display controller */ if ((DVK_readRegister(&BC_REGISTER->ARB_CTRL) != BC_ARB_CTRL_EBI) || runOnce) { /* Configure for EBI mode and reset display */ DVK_displayControl(DVK_Display_EBI); DVK_displayControl(DVK_Display_ResetAssert); DVK_displayControl(DVK_Display_PowerDisable); /* Short delay */ for (i = 0; i < 10000; i++) ; /* Configure display for Direct Drive + SPI mode */ DVK_displayControl(DVK_Display_Mode8080); DVK_displayControl(DVK_Display_PowerEnable); DVK_displayControl(DVK_Display_ResetRelease); runOnce = false; } } touch_init.oversampling = adcOvsRateSel32; TOUCH_Init(&touch_init); TOUCH_RegisterUpcall(LCD_TOUCH_Upcall); }
/**************************************************************************//** * @brief Get status of bush buttons * @return Status of push buttons *****************************************************************************/ uint16_t DVK_getPushButtons(void) { uint16_t pb = 0; uint16_t aemState; /* Check state */ aemState = DVK_readRegister(BC_AEMSTATE); /* Read pushbutton status */ if ( aemState == BC_AEMSTATE_EFM ) { pb = (~(DVK_readRegister(BC_PUSHBUTTON))) & 0x000f; } return pb; }
/**************************************************************************//** * @brief Get joystick button status * @return Joystick controller status *****************************************************************************/ uint16_t DVK_getJoystick(void) { uint16_t joyStick = 0; uint16_t aemState; /* Check state */ aemState = DVK_readRegister(BC_AEMSTATE); /* Read pushbutton status */ if ( aemState == BC_AEMSTATE_EFM ) { joyStick = (~(DVK_readRegister(BC_JOYSTICK))) & 0x001f; } return joyStick; }
/**************************************************************************//** * @brief Disable EFM32 access to peripheral on DVK board * @param peri Peripheral to disable *****************************************************************************/ void DVK_disablePeripheral(DVKPeripheral peri) { uint16_t bit; uint16_t tmp; /* Calculate which bit to set */ bit = (uint16_t) peri; /* Read peripheral control register */ tmp = DVK_readRegister(BC_PERCTRL); /* Disable peripheral */ tmp &= ~(bit); /* Special case for RS232, if enabled disable shutdown */ if ((peri == DVK_RS232A) || (peri == DVK_RS232B)) { /* Set shutdown bit */ tmp |= (BC_PERCTRL_RS232_SHUTDOWN); } /* Special case for IRDA */ if (peri == DVK_IRDA) { /* Set shutdown bit */ tmp |= (BC_PERCTRL_IRDA_SHUTDOWN); } DVK_writeRegister(BC_PERCTRL, tmp); }
/**************************************************************************//** * @brief Clear interrupts * @param flags Board control interrupt flags, BC_INTEN_<something> *****************************************************************************/ void DVK_clearInterruptFlags(uint16_t flags) { uint16_t tmp; tmp = DVK_readRegister(&BC_REGISTER->INTFLAG); tmp &= ~(flags); DVK_writeRegister(&BC_REGISTER->INTFLAG, tmp); }
/**************************************************************************//** * @brief Get dipswitch status * The DIP switches are free for user programmable purposes * @return Joystick controller status *****************************************************************************/ uint16_t DVK_getDipSwitch(void) { uint16_t tmp; tmp = (~(DVK_readRegister(BC_DIPSWITCH))) & 0x00ff; return tmp; }
/**************************************************************************//** * @brief Get joystick button status * @return Joystick controller status *****************************************************************************/ uint16_t DVK_getJoystick(void) { uint16_t joyStick = 0; joyStick = ~(DVK_readRegister(&BC_REGISTER->UIF_JOYSTICK)) & 0x001f; return joyStick; }
/**************************************************************************//** * @brief Get status of push buttons on kit * * @return * Button state, each bit representing each push button PB0-PB4 *****************************************************************************/ uint16_t DVK_getPushButtons(void) { uint16_t tmp; tmp = DVK_readRegister(&BC_REGISTER->UIF_PB); return (~tmp) & 0x000F; }
/**************************************************************************//** * @brief Enable "Control" buttons/joystick/dip switch interrupts * @param flags Board control interrupt flags, BC_INTEN_<something> *****************************************************************************/ void DVK_enableInterrupt(uint16_t flags) { uint16_t tmp; /* Add flags to interrupt enable register */ tmp = DVK_readRegister(BC_INTEN); tmp |= flags; DVK_writeRegister(BC_INTEN, tmp); }
/**************************************************************************//** * @brief TFT initialize or reinitialize to Address Mapped Mode * Assumes EBI has been configured correctly in DVK_init(DVK_Init_EBI) * * @return true if we should redraw into buffer, false if BC has control * over display *****************************************************************************/ bool TFT_AddressMappedInit(void) { bool ret; EMSTATUS status; uint32_t i, freq; /* If we are in BC_UIF_AEM_EFM state, we can redraw graphics */ if (DVK_readRegister(&BC_REGISTER->UIF_AEM) == BC_UIF_AEM_EFM) { /* If we're not BC_ARB_CTRL_EBI state, we need to reconfigure display controller */ if ((DVK_readRegister(&BC_REGISTER->ARB_CTRL) != BC_ARB_CTRL_EBI) || runOnce) { /* Configure for EBI mode and reset display */ DVK_displayControl(DVK_Display_EBI); DVK_displayControl(DVK_Display_ResetAssert); DVK_displayControl(DVK_Display_PowerDisable); /* Short reset delay */ freq = SystemCoreClockGet(); for (i = 0; i < (freq / 100); i++) { __NOP(); } /* Configure display for Direct Drive + SPI mode */ DVK_displayControl(DVK_Display_Mode8080); DVK_displayControl(DVK_Display_PowerEnable); DVK_displayControl(DVK_Display_ResetRelease); /* Initialize graphics - abort on failure */ status = DMD_init(BC_SSD2119_BASE, BC_SSD2119_BASE + 2); if ((status != DMD_OK) && (status != DMD_ERROR_DRIVER_ALREADY_INITIALIZED)) while (1) ; /* Make sure display is configured with correct rotation */ if ((status == DMD_OK)) DMD_flipDisplay(1, 1); runOnce = false; } ret = true; } else { ret = false; } return ret; }
/**************************************************************************//** * @brief Disable "Control" buttons/joystick/dip switch interrupts * @param flags Board control interrupt flags, BC_INTEN_<something> *****************************************************************************/ void DVK_disableInterrupt(uint16_t flags) { uint16_t tmp; /* Clear flags from interrupt enable register */ tmp = DVK_readRegister(BC_INTEN); flags = ~(flags); tmp &= flags; DVK_writeRegister(BC_INTEN, tmp); }
/**************************************************************************//** * @brief Configure display control * @param option Options for configuring display control. *****************************************************************************/ void DVK_displayControl(DVK_Display_TypeDef option) { uint16_t tmp; switch (option) { case DVK_Display_EBI: DVK_writeRegister(&BC_REGISTER->ARB_CTRL, BC_ARB_CTRL_EBI); break; case DVK_Display_SPI: DVK_writeRegister(&BC_REGISTER->ARB_CTRL, BC_ARB_CTRL_SPI); break; case DVK_Display_BC: DVK_writeRegister(&BC_REGISTER->ARB_CTRL, BC_ARB_CTRL_BC); break; case DVK_Display_PowerEnable: tmp = DVK_readRegister(&BC_REGISTER->DISPLAY_CTRL); tmp |= (BC_DISPLAY_CTRL_POWER_ENABLE); DVK_writeRegister(&BC_REGISTER->DISPLAY_CTRL, tmp); break; case DVK_Display_PowerDisable: tmp = DVK_readRegister(&BC_REGISTER->DISPLAY_CTRL); tmp &= ~(BC_DISPLAY_CTRL_POWER_ENABLE); DVK_writeRegister(&BC_REGISTER->DISPLAY_CTRL, tmp); break; case DVK_Display_ResetAssert: tmp = DVK_readRegister(&BC_REGISTER->DISPLAY_CTRL); tmp |= (BC_DISPLAY_CTRL_RESET); DVK_writeRegister(&BC_REGISTER->DISPLAY_CTRL, tmp); break; case DVK_Display_ResetRelease: tmp = DVK_readRegister(&BC_REGISTER->DISPLAY_CTRL); tmp &= ~(BC_DISPLAY_CTRL_RESET); DVK_writeRegister(&BC_REGISTER->DISPLAY_CTRL, tmp); break; case DVK_Display_Mode8080: tmp = DVK_readRegister(&BC_REGISTER->DISPLAY_CTRL); tmp &= ~(BC_DISPLAY_CTRL_MODE_GENERIC); DVK_writeRegister(&BC_REGISTER->DISPLAY_CTRL, tmp); break; case DVK_Display_ModeGeneric: tmp = DVK_readRegister(&BC_REGISTER->DISPLAY_CTRL); tmp |= (BC_DISPLAY_CTRL_MODE_GENERIC); DVK_writeRegister(&BC_REGISTER->DISPLAY_CTRL, tmp); break; default: /* Unknown command */ while (1) ; } }
/**************************************************************************//** * @brief Get board LED configuration * * @return * 16 bits of LED status *****************************************************************************/ uint16_t DVK_getLEDs(void) { return DVK_readRegister(&BC_REGISTER->UIF_LEDS); }
/**************************************************************************//** * @brief Read interrupt flags * @return Returns currently triggered interrupts *****************************************************************************/ uint16_t DVK_getInterruptFlags(void) { return DVK_readRegister(&BC_REGISTER->INTFLAG); }
/***************************************************************************//** * @brief * Initialize LCD device * * @details * * @note * ******************************************************************************/ void efm32_spiLcd_init(void) { struct efm32_usart_device_t *usart; rt_uint32_t flag; DMD_DisplayGeometry *geometry; rt_uint32_t ret; do { USART_InitSync_TypeDef init = USART_INITSYNC_DEFAULT; /* Find SPI device */ lcd = rt_device_find(LCD_USING_DEVICE_NAME); if (lcd == RT_NULL) { lcd_debug("LCD err: Can't find %s!\n", LCD_USING_DEVICE_NAME); break; } lcd_debug("LCD: Find device %s\n", LCD_USING_DEVICE_NAME); /* Config CS pin */ usart = (struct efm32_usart_device_t *)(lcd->user_data); if (!(usart->state & USART_STATE_AUTOCS)) { GPIO_PinModeSet(LCD_CS_PORT, LCD_CS_PIN, gpioModePushPull, 1); lcdAutoCs = false; } /* TFT initialize or reinitialize. Assumes EBI has been configured correctly in DVK_init(DVK_Init_EBI) */ rt_uint32_t freq = SystemCoreClockGet(); rt_uint32_t i; rt_bool_t warning = RT_FALSE; /* If we are in BC_UIF_AEM_EFM state, we can redraw graphics */ while (DVK_readRegister(&BC_REGISTER->UIF_AEM) != BC_UIF_AEM_EFM) { if (!warning) { lcd_debug("LCD: Please press AEM button!!!\n"); warning = RT_TRUE; } } lcd_debug("LCD: Got LCD control\n"); /* If we're not BC_ARB_CTRL_EBI state, we need to reconfigure display controller */ if (DVK_readRegister(&BC_REGISTER->ARB_CTRL) != BC_ARB_CTRL_EBI) { lcd_debug("LCD: Set to EBI mode\n"); /* Configure for EBI mode and reset display */ DVK_displayControl(DVK_Display_EBI); DVK_displayControl(DVK_Display_ResetAssert); DVK_displayControl(DVK_Display_PowerDisable); /* Short delay */ freq = SystemCoreClockGet(); for(i = 0; i < (freq / 100); i++) { __NOP(); } #if defined(LCD_MAPPED) /* Configure display for address mapped method + 3-wire SPI mode */ DVK_displayControl(DVK_Display_Mode8080); DVK_displayControl(DVK_Display_PowerEnable); DVK_displayControl(DVK_Display_ResetRelease); /* Initialize graphics - abort on failure */ ret = DMD_init(BC_SSD2119_BASE, BC_SSD2119_BASE + 2); if (ret == DMD_OK) { /* Make sure display is configured with correct rotation */ DMD_flipDisplay(1, 1); } else if (ret != DMD_ERROR_DRIVER_ALREADY_INITIALIZED) { lcd_debug("LCD err: driver init failed %x\n", ret); break; } #elif defined(LCD_DIRECT) /* Configure TFT direct drive method from EBI BANK2 */ const EBI_TFTInit_TypeDef tftInit = { ebiTFTBank2, /* Select EBI Bank 2 */ ebiTFTWidthHalfWord, /* Select 2-byte (16-bit RGB565) increments */ ebiTFTColorSrcMem, /* Use memory as source for mask/blending */ ebiTFTInterleaveUnlimited, /* Unlimited interleaved accesses */ ebiTFTFrameBufTriggerVSync, /* VSYNC as frame buffer update trigger */ false, /* Drive DCLK from negative edge of internal clock */ ebiTFTMBDisabled, /* No masking and alpha blending enabled */ ebiTFTDDModeExternal, /* Drive from external memory */ ebiActiveLow, /* CS Active Low polarity */ ebiActiveHigh, /* DCLK Active High polarity */ ebiActiveLow, /* DATAEN Active Low polarity */ ebiActiveLow, /* HSYNC Active Low polarity */ ebiActiveLow, /* VSYNC Active Low polarity */ 320, /* Horizontal size in pixels */ 1, /* Horizontal Front Porch */ 30, /* Horizontal Back Porch */ 2, /* Horizontal Synchronization Pulse Width */ 240, /* Vertical size in pixels */ 1, /* Vertical Front Porch */ 4, /* Vertical Back Porch */ 2, /* Vertical Synchronization Pulse Width */ 0x0000, /* Frame Address pointer offset to EBI memory base */ 4, /* DCLK Period */ 0, /* DCLK Start cycles */ 0, /* DCLK Setup cycles */ 0, /* DCLK Hold cycles */ }; DVK_enablePeripheral(DVK_TFT); /* Configure display for Direct Drive + 3-wire SPI mode */ DVK_displayControl(DVK_Display_ModeGeneric); DVK_displayControl(DVK_Display_PowerEnable); DVK_displayControl(DVK_Display_ResetRelease); /* Configure GPIO for EBI and TFT */ /* EBI TFT DCLK/Dot Clock */ GPIO_PinModeSet(gpioPortA, 8, gpioModePushPull, 0); /* EBI TFT DATAEN */ GPIO_PinModeSet(gpioPortA, 9, gpioModePushPull, 0); /* EBI TFT VSYNC */ GPIO_PinModeSet(gpioPortA, 10, gpioModePushPull, 0); /* EBI TFT HSYNC */ GPIO_PinModeSet(gpioPortA, 11, gpioModePushPull, 0); /* Initialize display */ DMD_init(0, (rt_uint32_t)EBI_BankAddress(EBI_BANK2)); /* Configure EBI TFT direct drive */ EBI_TFTInit(&tftInit); #endif } /* Get LCD geometry */ ret = DMD_getDisplayGeometry(&geometry); if (ret != DMD_OK) { lcd_debug("LCD err: get geometry failed!\n"); break; } /* Init LCD info */ flag = RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_DMA_TX; lcd_info.pixel_format = RTGRAPHIC_PIXEL_FORMAT_RGB565P; lcd_info.bits_per_pixel = 16; lcd_info.width = geometry->xSize; lcd_info.height = geometry->ySize; #if defined(LCD_MAPPED) lcd_info.framebuffer = RT_NULL; efm32_spiLcd_register(&lcd_device, LCD_DEVICE_NAME, flag, (void *)&lcd_ops); #elif defined(LCD_DIRECT) lcd_info.framebuffer = (rt_uint8_t *)EBI_BankAddress(EBI_BANK2); efm32_spiLcd_register(&lcd_device, LCD_DEVICE_NAME, flag, RT_NULL); #endif /* Set clipping area */ ret = DMD_setClippingArea(0, 0, geometry->xSize, geometry->ySize); if (ret != DMD_OK) { lcd_debug("LCD err: set clipping area failed!\n"); break; } /* Read device code */ rt_uint16_t code = 0xFFFF; #if defined(LCD_MAPPED) code = DMDIF_readDeviceCode(); #endif /* Set as rtgui graphic driver */ rtgui_graphic_set_device(&lcd_device); lcd_debug("LCD: H/W init OK!\n"); return; } while(0); lcd_debug("LCD err: H/W init failed!\n"); }
/**************************************************************************//** * @brief Get dipswitch status * The DIP switches are free for user programmable purposes * @return Dip switch *****************************************************************************/ uint16_t DVK_getDipSwitch(void) { return DVK_readRegister(&BC_REGISTER->UIF_DIP) & 0x000f; }
/**************************************************************************//** * @brief Read interrupt flags * @return Returns currently triggered interrupts *****************************************************************************/ uint16_t DVK_getInterruptFlags(void) { return DVK_readRegister(BC_INTFLAG); }
/**************************************************************************//** * @brief Get status of user LEDs * @return Status of 16 user leds, bit 1 = on, bit 0 = off *****************************************************************************/ uint16_t DVK_getLEDs(void) { return DVK_readRegister(BC_LED); }
/**************************************************************************//** * @brief DK3750 Peripheral Access Control * Enable or disable access to on-board peripherals through switches * and SPI switch where applicable. Turn off conflicting peripherals when * enabling another. * @param[in] perf * Which peripheral to configure * @param[in] enable * If true, sets up access to peripheral, if false disables it *****************************************************************************/ void DVK_peripheralAccess(DVK_Peripheral_TypeDef perf, bool enable) { uint16_t perfControl; perfControl = DVK_readRegister(&BC_REGISTER->PERICON); /* Enable or disable the specificed peripheral by setting board control switch */ if (enable) { switch (perf) { case DVK_RS232_SHUTDOWN: perfControl |= (1 << BC_PERICON_RS232_SHUTDOWN_SHIFT); break; case DVK_RS232_UART: perfControl &= ~(1 << BC_PERICON_RS232_SHUTDOWN_SHIFT); perfControl &= ~(1 << BC_PERICON_RS232_LEUART_SHIFT); perfControl |= (1 << BC_PERICON_RS232_UART_SHIFT); break; case DVK_RS232_LEUART: perfControl &= ~(1 << BC_PERICON_RS232_SHUTDOWN_SHIFT); perfControl &= ~(1 << BC_PERICON_RS232_UART_SHIFT); perfControl |= (1 << BC_PERICON_RS232_LEUART_SHIFT); break; case DVK_I2C: perfControl |= (1 << BC_PERICON_I2C_SHIFT); break; case DVK_ETH: /* Enable SPI interface */ DVK_spiControl(DVK_SPI_Ethernet); /* Enable Ethernet analog switches */ perfControl |= (1 << BC_PERICON_I2S_ETH_SHIFT); perfControl |= (1 << BC_PERICON_I2S_ETH_SEL_SHIFT); /* Disable Analog Diff Input - pins PD0 and PD1 is shared */ perfControl &= ~(1 << BC_PERICON_ANALOG_DIFF_SHIFT); /* Disable Touch Inputs - pin PD3 is shared */ perfControl &= ~(1 << BC_PERICON_TOUCH_SHIFT); /* Disable Analog SE Input - pin PD2 is shared */ perfControl &= ~(1 << BC_PERICON_ANALOG_SE_SHIFT); break; case DVK_I2S: /* Direct SPI interface to I2S DAC */ DVK_spiControl(DVK_SPI_Audio); /* Also make surea Audio out is connected for I2S operation */ perfControl |= (1 << BC_PERICON_AUDIO_OUT_SHIFT); perfControl |= (1 << BC_PERICON_AUDIO_OUT_SEL_SHIFT); perfControl |= (1 << BC_PERICON_I2S_ETH_SHIFT); perfControl &= ~(1 << BC_PERICON_I2S_ETH_SEL_SHIFT); /* Disable Analog Diff Input - pins PD0 and PD1 is shared */ perfControl &= ~(1 << BC_PERICON_ANALOG_DIFF_SHIFT); /* Disable Touch Inputs - pin PD3 is shared */ perfControl &= ~(1 << BC_PERICON_TOUCH_SHIFT); /* Disable Analog SE Input - pin PD2 is shared */ perfControl &= ~(1 << BC_PERICON_ANALOG_SE_SHIFT); break; case DVK_TRACE: perfControl |= (1 << BC_PERICON_TRACE_SHIFT); break; case DVK_TOUCH: perfControl |= (1 << BC_PERICON_TOUCH_SHIFT); /* Disconnect SPI switch, pin PD3 is shared */ perfControl &= ~(1 << BC_PERICON_I2S_ETH_SHIFT); perfControl &= ~(1 << BC_PERICON_I2S_ETH_SEL_SHIFT); DVK_spiControl(DVK_SPI_OFF); break; case DVK_AUDIO_IN: perfControl |= (1 << BC_PERICON_AUDIO_IN_SHIFT); break; case DVK_AUDIO_OUT: perfControl &= ~(1 << BC_PERICON_AUDIO_OUT_SEL_SHIFT); perfControl |= (1 << BC_PERICON_AUDIO_OUT_SHIFT); break; case DVK_ANALOG_DIFF: perfControl |= (1 << BC_PERICON_ANALOG_DIFF_SHIFT); /* Disconnect SPI switch, pin PD0 and PD1 is shared */ perfControl &= ~(1 << BC_PERICON_I2S_ETH_SHIFT); perfControl &= ~(1 << BC_PERICON_I2S_ETH_SEL_SHIFT); DVK_spiControl(DVK_SPI_OFF); break; case DVK_ANALOG_SE: perfControl |= (1 << BC_PERICON_ANALOG_SE_SHIFT); /* Disconnect SPI switch, pin PD2 is shared */ perfControl &= ~(1 << BC_PERICON_I2S_ETH_SHIFT); perfControl &= ~(1 << BC_PERICON_I2S_ETH_SEL_SHIFT); DVK_spiControl(DVK_SPI_OFF); break; case DVK_MICROSD: perfControl |= (1 << BC_PERICON_SPI_SHIFT); break; case DVK_TFT: /* Enable SPI to SSD2119 */ DVK_spiControl(DVK_SPI_Display); /* Enable SPI analog switch */ perfControl |= (1 << BC_PERICON_I2S_ETH_SHIFT); /* Disable Analog Diff Input - pins D0 and D1 is shared */ perfControl &= ~(1 << BC_PERICON_ANALOG_DIFF_SHIFT); /* Disable Touch Inputs - pin D3 is shared */ perfControl &= ~(1 << BC_PERICON_TOUCH_SHIFT); /* Disable Analog SE Input - pin D2 is shared */ perfControl &= ~(1 << BC_PERICON_ANALOG_SE_SHIFT); break; } } else { switch (perf) { case DVK_RS232_SHUTDOWN: perfControl &= ~(1 << BC_PERICON_RS232_SHUTDOWN_SHIFT); break; case DVK_RS232_UART: perfControl |= (1 << BC_PERICON_RS232_SHUTDOWN_SHIFT); perfControl &= ~(1 << BC_PERICON_RS232_UART_SHIFT); break; case DVK_RS232_LEUART: perfControl |= (1 << BC_PERICON_RS232_SHUTDOWN_SHIFT); perfControl &= ~(1 << BC_PERICON_RS232_LEUART_SHIFT); break; case DVK_I2C: perfControl &= ~(1 << BC_PERICON_I2C_SHIFT); break; case DVK_ETH: /* Disable SPI interface */ perfControl &= ~(1 << BC_PERICON_I2S_ETH_SHIFT); perfControl &= ~(1 << BC_PERICON_I2S_ETH_SEL_SHIFT); DVK_spiControl(DVK_SPI_OFF); break; case DVK_I2S: /* Disable SPI interface and audio out */ perfControl &= ~(1 << BC_PERICON_AUDIO_OUT_SHIFT); perfControl &= ~(1 << BC_PERICON_AUDIO_OUT_SEL_SHIFT); perfControl &= ~(1 << BC_PERICON_I2S_ETH_SHIFT); perfControl &= ~(1 << BC_PERICON_I2S_ETH_SEL_SHIFT); DVK_spiControl(DVK_SPI_OFF); break; case DVK_TRACE: perfControl &= ~(1 << BC_PERICON_TRACE_SHIFT); break; case DVK_TOUCH: perfControl &= ~(1 << BC_PERICON_TOUCH_SHIFT); break; case DVK_AUDIO_IN: perfControl &= ~(1 << BC_PERICON_AUDIO_IN_SHIFT); break; case DVK_AUDIO_OUT: perfControl &= ~(1 << BC_PERICON_AUDIO_OUT_SEL_SHIFT); perfControl &= ~(1 << BC_PERICON_AUDIO_OUT_SHIFT); break; case DVK_ANALOG_DIFF: perfControl &= ~(1 << BC_PERICON_ANALOG_DIFF_SHIFT); break; case DVK_ANALOG_SE: perfControl &= ~(1 << BC_PERICON_ANALOG_SE_SHIFT); break; case DVK_MICROSD: perfControl &= ~(1 << BC_PERICON_SPI_SHIFT); break; case DVK_TFT: /* Disable SPI interface */ perfControl &= ~(1 << BC_PERICON_I2S_ETH_SHIFT); perfControl &= ~(1 << BC_PERICON_I2S_ETH_SEL_SHIFT); DVK_spiControl(DVK_SPI_OFF); break; } } /* Write back register */ DVK_writeRegister(&BC_REGISTER->PERICON, perfControl); }