예제 #1
0
void display_init(void)
{
	int i;

	/* put LCD controller into reset */
	gpio_config_pin(LCD_RESET_PORT, LCD_RESET_PIN, GPIO_GPIOFN, 1, 0, 
			!LCD_nRESET_LEVEL);
	for(i = 0; i < 1000; i++); /* give it some time... */
	/* take LCD controller out of reset */
	gpio_set_val(LCD_RESET_PORT, LCD_RESET_PIN, LCD_nRESET_LEVEL);

	/* set up PVD (LCD interface) IO pins */
	for(i = 0; i < NUM_PVD_PINS; i++)
		gpio_config_pin(pvd_ports[i], pvd_pins[i], GPIO_ALT1, 1, 0, 0);
#ifdef CPU_MF2530F
	/* LCD interface PDE signal */
	gpio_config_pin(GPIO_PORT_A, 24, GPIO_ALT1, 1, 0, 0);
#endif

	/* bring up the display controller */
	dpc_init();

	/* bring up the Multi-Layer Controller */
	mlc_init();
}
예제 #2
0
/* 
 * turn on the backlight 
 */
void display_backlight(int board_id)
{
	gpio_config_pin(GPIO_PORT_A, 30, GPIO_GPIOFN, 1, 0, 1);
#if defined CONFIG_MACH_ME_LF1000 || defined CONFIG_MACH_LF_LF1000
#ifdef DISPLAY_BACKLIGHT_PWM
	pwm_init(board_id);
#else
	gpio_config_pin(GPIO_PORT_A, 31, GPIO_GPIOFN, 1, 0, 0);
#endif
#endif
}
예제 #3
0
static int load_board_id(void)
{
	u32 id, scratch;
#if defined CONFIG_MACH_ME_LF1000 || defined CONFIG_MACH_ME_MP2530F
	id = 0;
#else
	int i;

	/* make pins inputs */
	for(i = GPIO_CFG_HIGH; i >= GPIO_CFG_LOW; i--)
		gpio_config_pin(GPIO_CFG_PORT, i, GPIO_GPIOFN, 0, 0, 0);

	/* read pins */
	for(id = 0, i = GPIO_CFG_HIGH; i >= GPIO_CFG_LOW; i--)
		id = (id << 1) + gpio_get_val(GPIO_CFG_PORT, i);
#endif /* CONFIG_MACH_LF_LF1000 */

	/* save into scratchpad register */
	scratch = gpio_get_scratchpad();
	scratch &= ~(BIT_MASK(GPIO_CFG_HIGH-GPIO_CFG_LOW+1) <<
			SCRATCH_BOARD_ID_POS);
	scratch |= (id<<SCRATCH_BOARD_ID_POS);
	gpio_set_scratchpad(scratch);
	return id;
}	
int GPIOPinOutput::readPin(){
    __s32 r;
    int rval = gpio_config_pin(I2C_GPIO_ADDR, m_pin, 0);
    r=gpio_rd_reg(I2C_GPIO_ADDR, REG_CONFIG);

    r = gpio_rd_reg_bit(I2C_GPIO_ADDR, REG_OUTPUT, m_pin);
    return r;
}
int GPIOPinOutput::writeToPin(int val){
    __s32 r;
    int rval = gpio_config_pin(I2C_GPIO_ADDR, m_pin, 0);
    r=gpio_rd_reg(I2C_GPIO_ADDR, REG_CONFIG);
    printf("Config Register = 0x%02x\n", r);

    int test = gpio_wr_pin(I2C_GPIO_ADDR, m_pin, val);
    r=gpio_rd_reg(I2C_GPIO_ADDR, REG_OUTPUT);
    printf("Output Register = 0x%02x\n", r);
    return r;
}
void GPIOPinInput::readPin()
{
    //Set pin as an output
    __s32 r;
    gpio_config_pin(I2C_GPIO_ADDR, m_pin, 1);
    r=gpio_rd_reg(I2C_GPIO_ADDR, REG_CONFIG);

    r = gpio_rd_reg_bit(I2C_GPIO_ADDR, REG_INPUT, m_pin);
    if (m_state != r)
        setState(r);
}
GPIOPinInput::GPIOPinInput(QDeclarativeItem *parent) :
    QDeclarativeItem(parent)
{
    gpio_config_pin(I2C_GPIO_ADDR, m_pin, 1);
    setState(gpio_rd_reg_bit(I2C_GPIO_ADDR, REG_INPUT, m_pin));

    if (m_pollPin)
    {
        QTimer *timer = new QTimer(this);
        connect(timer, SIGNAL(timeout()), this, SLOT(readPin()));
        timer->start(10);
    }
}
예제 #8
0
static void load_cart_id(void)
{
	u32 scratch;
	u32 id = 0;
	int i;

	for(i = GPIO_CART_CFG_HIGH; i >= GPIO_CART_CFG_LOW; i--)
		gpio_config_pin(GPIO_CART_CFG_PORT, i, GPIO_GPIOFN, 0, 0, 0);

	for(i = GPIO_CART_CFG_HIGH; i >= GPIO_CART_CFG_LOW; i--)
		id = (id<<1) + gpio_get_val(GPIO_CART_CFG_PORT, i);

	/* save into scratchpad register */
	scratch = gpio_get_scratchpad();
	scratch &= ~(BIT_MASK(GPIO_CART_CFG_HIGH-GPIO_CART_CFG_LOW+1) <<
			SCRATCH_CART_ID_POS);
	scratch |= (id<<SCRATCH_CART_ID_POS);
	gpio_set_scratchpad(scratch);
}