blob: ebafed5028468947b8dd8797c2983992572ab3b5 [file] [log] [blame]
#include "hal.h"
#include "PlatformCommon.h"
CS_REGISTER_PAIR_S lcd_key_pins[] =
{
(int *) (APPS_PAD_BASE | 0x00d8), 0xA001, 0x0, // GPIO126, LCD BL
#ifndef CONFIG_SPI_LCD_3WIRE
(int *) (APPS_PAD_BASE | 0x0134), 0x1000, 0x0, // GPIO22, LCD RS
#endif
(int *) (APPS_PAD_BASE | 0x013c), 0x1000, 0x0, // GPIO24, LCD RESET
/* spi */
(int *) (APPS_PAD_BASE | 0x0160), 0x1001, 0x0, // GPIO33, SPI SCL
(int *) (APPS_PAD_BASE | 0x0164), 0x1001, 0x0, // GPIO34, SPI CS
(int *) (APPS_PAD_BASE | 0x016c), 0x1001, 0x0, // GPIO36, SPI TX
0x0,0x0,0x0 // termination
};
void gpio_direction_output(int gpio, int value)
{
const unsigned int offset[] = {0, 4, 8, 0x100};
unsigned int gpio_base;
int bank = GPIO_TO_REG(gpio);
gpio_base = GPIO0_BASE + offset[bank];
*(VUINT_T *)(gpio_base + GPIO_SDR) |= GPIO_TO_BIT(gpio);
if (value)
*(VUINT_T *)(gpio_base + GPIO_PSR) |= GPIO_TO_BIT(gpio);
else
*(VUINT_T *)(gpio_base + GPIO_PCR) |= GPIO_TO_BIT(gpio);
}
void asr_lcd_init(void)
{
ConfigRegWrite(lcd_key_pins);
SPI_Clk_Init();
spi_lcd_init();
}