示例#1
0
static void gpio_init(void)
{
	/* board led pins */
	__gpio_as_output(0);
	__gpio_as_output(1);
	__gpio_as_output(2);
	__gpio_as_output(3);

	__gpio_as_emc();
	__gpio_as_uart0();
	__gpio_as_uart1();
	__gpio_as_uart2();
	__gpio_as_uart3();
	__gpio_as_scc();
	__gpio_as_lcd_master();
	__gpio_as_usb();
	__gpio_as_eth();
	__gpio_as_pwm();
	__gpio_as_ps2();
	__gpio_as_uprt();

	__gpio_as_output(9);		/* Mem R/B */
	__gpio_as_output(10);		/* M/CPU Select */
	__gpio_as_output(13);		/* LCDM Backlight */
	__gpio_as_output(14);		/* C/D Pin of LCDM */
	__gpio_as_output(88);		/* Beeper */
	__gpio_as_output(89);		/* Cash Box */
//	__gpio_as_output(90);		/* Modem Enable */
//	__gpio_as_output(91);		/* INTA_N, external RTC irq */

	__harb_usb0_uhc(); /* USB port 0 as host */
//	__harb_usb0_udc(); /* USB port 0 as device */
}
示例#2
0
bool _backlight_init(void)
{
    __gpio_as_pwm(BACKLIGHT_PWM);
    __tcu_start_timer_clock(BACKLIGHT_PWM);

    __tcu_stop_counter(BACKLIGHT_PWM);
    __tcu_init_pwm_output_low(BACKLIGHT_PWM);
    __tcu_set_pwm_output_shutdown_graceful(BACKLIGHT_PWM);
    __tcu_disable_pwm_output(BACKLIGHT_PWM);

    __tcu_select_extalclk(BACKLIGHT_PWM);  /* 12 MHz */
    __tcu_select_clk_div64(BACKLIGHT_PWM); /* 187.5 kHz */

    __tcu_mask_half_match_irq(BACKLIGHT_PWM);
    __tcu_mask_full_match_irq(BACKLIGHT_PWM);

    __tcu_set_count(BACKLIGHT_PWM, 0);
    __tcu_set_half_data(BACKLIGHT_PWM, 0);
    __tcu_set_full_data(BACKLIGHT_PWM, 256);

    return true;
}