Chinaunix首页 | 论坛 | 博客
  • 博客访问: 453496
  • 博文数量: 150
  • 博客积分: 2706
  • 博客等级: 少校
  • 技术积分: 1200
  • 用 户 组: 普通用户
  • 注册时间: 2009-11-09 11:41
文章分类

全部博文(150)

文章存档

2012年(7)

2011年(6)

2010年(68)

2009年(69)

我的朋友

分类: 嵌入式

2009-12-02 15:30:05

mx3_3stack.c中有关于reset的内容,包括lcd数据结构定义以及其中的lcd的reset成员的具体函数体的定义。
关于lcd数据结构的定义,
static struct mxc_lcd_platform_data lcd_data = {
       .io_reg = "VGEN",
#ifdef CONFIG_FB_MXC_CLAA_WVGA_SYNC_PANEL
       .core_reg = "GPO1",
#else
       .core_reg = "VMMC1",
#endif
       .reset = lcd_reset,
};
 
mx3_3stack.c中关于reset的具体代码,
static void lcd_reset(void)
{
       /* ensure that LCDIO(1.8V) has been turn on */
       /* active reset line GPIO */
       mxc_request_iomux(MX31_PIN_LCS1, OUTPUTCONFIG_GPIO, INPUTCONFIG_NONE);
       mxc_set_gpio_dataout(MX31_PIN_LCS1, 0);
       mxc_set_gpio_direction(MX31_PIN_LCS1, 0);
       /* do reset */
       msleep(10);           /* tRES >= 100us */
       mxc_set_gpio_dataout(MX31_PIN_LCS1, 1);
       msleep(60);
#ifdef CONFIG_FB_MXC_CLAA_WVGA_SYNC_PANEL
       mxc_set_gpio_dataout(MX31_PIN_LCS1, 0);
#endif
}
 
其中上边是用的几个定义函数如mxc_request_iomux在文件iomux.c中
int mxc_request_iomux(iomux_pin_name_t pin, iomux_pin_cfg_t cfg)
{
       int ret = iomux_config_mux(pin, cfg);
       if (GPIO_TO_PORT(IOMUX_TO_GPIO(pin)) < GPIO_PORT_NUM) {
              if (((cfg & (~MUX_CONFIG_SION)) == MUX_CONFIG_GPIO) ||
                  (((cfg & (~MUX_CONFIG_SION)) == MUX_CONFIG_FUNC) &&
                   ((pin == MX35_PIN_GPIO1_0) || (pin == MX35_PIN_GPIO1_1) ||
                    (pin == MX35_PIN_GPIO2_0) || (pin == MX35_PIN_GPIO3_0))))
                     ret |= mxc_request_gpio(pin);
       }
       return ret;
}
由函数可以看出来,调用函数mxc_request_iomux,只要输入pin的名称和所要设置的pin的状态,该函数会自动的把状态设置完成。
而pin的定义在mx31_pins.h中,如下,
typedef enum iomux_pins {
       MX31_PIN_CSPI3_MISO = _MXC_BUILD_NON_GPIO_PIN(0, 3, 1, 2),
       MX31_PIN_CSPI3_SCLK = _MXC_BUILD_NON_GPIO_PIN(0, 2, 1, 1),
       。。。。。。。。。。。。。。。。。。。。。。太多了,省略。。。。
       MX31_PIN_GPIO1_0 = _MXC_BUILD_GPIO_PIN(0, 0, 80, 3, 108, 1),
       MX31_PIN_GPIO1_1 = _MXC_BUILD_GPIO_PIN(0, 1, 80, 2, 108, 0),
       MX31_PIN_GPIO1_2 = _MXC_BUILD_GPIO_PIN(0, 2, 80, 1, 107, 2),
       MX31_PIN_GPIO1_3 = _MXC_BUILD_GPIO_PIN(0, 3, 80, 0, 107, 1),
       MX31_PIN_CAPTURE = _MXC_BUILD_GPIO_PIN(0, 7, 81, 3, 109, 2),
       MX31_PIN_COMPARE = _MXC_BUILD_GPIO_PIN(0, 8, 81, 2, 109, 1),
       MX31_PIN_WATCHDOG_RST = _MXC_BUILD_NON_GPIO_PIN(81, 1, 109, 0),
       MX31_PIN_PWMO = _MXC_BUILD_GPIO_PIN(0, 9, 81, 0, 108, 2),
} iomux_pin_name_t;
 
而pin的输入输出的定义在iomux.h中,如下:
enum iomux_output_config {
       OUTPUTCONFIG_GPIO = 0,      /*!< used as GPIO */
       OUTPUTCONFIG_FUNC,    /*!< used as function */
       OUTPUTCONFIG_ALT1,     /*!< used as alternate function 1 */
       OUTPUTCONFIG_ALT2,     /*!< used as alternate function 2 */
       OUTPUTCONFIG_ALT3,     /*!< used as alternate function 3 */
       OUTPUTCONFIG_ALT4,     /*!< used as alternate function 4 */
       OUTPUTCONFIG_ALT5,     /*!< used as alternate function 5 */
       OUTPUTCONFIG_ALT6      /*!< used as alternate function 6 */
};
 
/*!
 * various IOMUX input functions
 */
enum iomux_input_config {
       INPUTCONFIG_NONE = 0, /*!< not configured for input */
       INPUTCONFIG_GPIO = 1 << 0, /*!< used as GPIO */
       INPUTCONFIG_FUNC = 1 << 1, /*!< used as function */
       INPUTCONFIG_ALT1 = 1 << 2,  /*!< used as alternate function 1 */
       INPUTCONFIG_ALT2 = 1 << 3   /*!< used as alternate function 2 */
};
 
这样可知,换不同的针脚进行reset控制时,只需要,把lcd_reset(void)函数中的
MX31_PIN_LCS1换为typedef enum iomux_pins中定义的pin的名字就可以了。
 
另外讲一点,关于液晶屏处的模拟和数字电压可以修改如下。
mxcfb_epson_vga.c   中修改如下:
regulator_set_voltage(io_reg, 1800000);应改为regulator_set_voltage(io_reg, 2800000)
有以上可以知道,只需修改上边函数中的数值就可以了。

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/beny610/archive/2008/12/25/3601876.aspx
阅读(1587) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~