先上代码
- unsigned nlcmVendorSize;
- void *plcmVendorID;
-
- plcmVendorID =smem_get_entry(SMEM_LCM_VENDOR_ID, &nlcmVendorSize);
- printk(KERN_INFO"\n[LCD_COMP]plcmVendorID=%d\n",*((uint32*)plcmVendorID));
-
- printk(KERN_INFO"[LCD_COMP]Default lcm_vedor=%d\n",lcm_vedor);
- if(plcmVendorID!=NULL)
- {
-
- if( *((uint32*)plcmVendorID)>LCM_VENDOR_ID_MIN && *((uint32*)plcmVendorID)
- {
- if(*((uint32*)plcmVendorID)==LCM_VENDOR_ID_CHENXING)
- {
- lcm_vedor=LCM_VENDOR_ID_CHENXING;
- printk(KERN_INFO"[LCD_COMP]LCM is ChenXing\n");
- }
- else if(*((uint32*)plcmVendorID)==LCM_VENDOR_ID_DJN)
- {
- lcm_vedor=LCM_VENDOR_ID_DJN;
- printk(KERN_INFO"[LCD_COMP]LCM is DJN\n");
- }
- }
- else
- printk(KERN_INFO"[LCD_COMP]Select default lcm\n");
-
- }
- else{
- printk(KERN_INFO"[LCD_COMP]Read SMEM_LCM_VENDOR_ID Fail, Select deault LCM\n");
-
- }
- printk(KERN_INFO"[LCD_CMOP]lcm_vedor=%d\n\n",lcm_vedor);
做lcd“兼容”时,由于lcd的spi没有接sdo,无法从ic读数据,于是只能通过配置不同的efs来做兼容。要从arm9端通过共享内存接口读数
据,出错处理比较多,如可能读不到,可能读错,都需要考虑到。添加的代码如上,经测试发现了个致命的问题:如果modern端efs没有配置,导致无法开
机!(虽然arm9和arm11端代码正常应该一致,为了防止人为疏忽,以防万一,还得查找原因:-( )。最终找到原因,差点吐血:
plcmVendorID =smem_get_entry(SMEM_LCM_VENDOR_ID, &nlcmVendorSize);读取失败,返回0,此时plcmVendorID=0,即此指针不指向任何变量,
千不该万不该,为了调试方便,我在紧随其后加了句测试代码:
- printk(KERN_INFO"\n[LCD_COMP]plcmVendorID=%d\n",*((uint32*)plcmVendorID))
如果plcmVendorID为0这个指针根本不会指向任何变量,但prink却要打印其指向变量的值!!??
解决方法,将这句printk下移放入if(plcmVendorID!=NULL)中,即只有这个指针有指向时才打印!