DSP

MTK开发笔记

2019-07-13 16:30发布

MTK开发笔记

1. Windows必须安装在C盘,否则会出现modis编译问题。 2. 语言和输入法移植 2.1 资源修改 – 这是我们需要修改的,2.2开始MTK已经帮你做好了。 2.1.1 在plutommiCustomerCustResourcePLUTO_MMI ef_list.txt中添加新语言的字符串资源。 2.1.2 用MCT工具生成新的字库,需要注意的是Language ID必须和ref_list.txt中一致。 2.1.3 输入法资源包括Zi、T9和CStar。 2.1.3.1 Zi a. 新建 vendorinputmethodIprojectPROJECTNAMEv?_official 目录。 b. 将第三方提供的Zi文件拷贝到该目录。 c. 将所有ZI8DatXX.c文件扩展名改成.h文件,并将其包含到IMEResZi.h中。 d. 将输入资源添加到 mtk_gIMELDBArray 数组中。 e. 上面步骤,第三方可能已经提供IMEResZi.h文件。如果提供了就不用这些步骤了。 2.1.3.2 T9 将代码放到下面目录: vendorinputmethodT9projectPROJECTNAMEv?_official 移植比较麻烦,具体参考 : SOP_T9_Input_Method_Resource_Generation_07A.pdf SOP_T9_Input_Method_Resource_Generation_08B.pdf SOP_T9_Input_Method_Resource_Generation_09BV2.pdf 2.1.3.3 CStar不说了 2.2 SSC 有几个文件需要修改。 a. plutommimmiSSCSSCIncSSCStringHandle.h:增加新的SSC码,需要和ref_list.txt、FontRes.c中的一致。 #define SSC_AUTO "*#0000#"   #define SSC_SCHINESE "*#0086#"   #define SSC_TCHINESE "*#0886#"   #define SSC_ENGLISH "*#0044#"   #define SSC_DEFAULT "*#0044#"   #define SSC_SPANISH "*#0034#"   //添加你的SSC码   //#define SSC_XXXXX "*#00XX#"   2.3 plutommimmiSSCSSCIncSSCStringHandle.c:将新的SSC码加入到ssc_table2表中。 SSCStringTableEx ssc_table2[] = { {SSC_AUTO, MMI_FALSE, SSC_STR_ERR_SET_DEFAULT, SSC_SCR_LANGUAGE_DEFAULT_STR_ID}, {SSC_ENGLISH, MMI_FALSE, SSC_STR_ERR_SET_ENGLISH, SSC_SCR_LANGUAGE_ENGLISH_STR_ID}, #if defined(__MMI_LANG_TR_CHINESE__) {SSC_TCHINESE, MMI_FALSE, SSC_STR_ERR_SET_TCHINESE, SSC_SCR_LANGUAGE_TCHINESE_STR_ID}, #endif #if defined(__MMI_LANG_SPANISH__) {SSC_SPANISH, MMI_FALSE, SSC_STR_ERR_SET_SPANISH, SSC_SCR_LANGUAGE_SPANISH_STR_ID}, #endif …… 2.4 mcu\plutommimmiSettingSettingSrcPhoneSetup.c:加到auto_lang_struct 数组中。 static StructAutoLang auto_lang_struct[] = { /* ISO 639 2-alphabet Language Codes */ {CBS2_ZH, SSC_SCHINESE}, {CBS2_TW, SSC_TCHINESE}, {CBS0_ENGLISH, SSC_ENGLISH}, {CBS0_SPANISH, SSC_SPANISH}, {CBS2_TH, SSC_THAI}, {CBS0_FRENCH, SSC_FRENCH}, {CBS0_GERMAN, SSC_GERMAN}, {CBS0_ITALIAN, SSC_ITALIAN},   …… 2.5 MTK代码已经帮你完成,具体参考 SOP_Input_Method_Porting_Guide_07A.pdf SOP_Language_and_Input_Method_Porting_Guide_08A.pdf 3. 如何修改软件版本号? 修改下面文件: makeVerno_.bld 4. 如何修改工程命令?如将默认*#8375#(显示版本号)改成*#8376#。 文件:plutommiCustomerCustResourcePLUTO_MMICustResDefPLUTO.h 修改: #ifdef __MMI_AUTO_LANG_EN__ #define MMI_DEFLANGSSC_FOR_AUTO "*#0044#" #endif #define SSC_SW_VERSION "*#8375#" #define SSC_HW_VERSION "*#357#" //Not used if __MMI_HW_VERSION__ is not turned on #define SSC_ENGINEERING_MODE "*#3646633#" #define SSC_FACTORY_MODE "*#66*#" #define SSC_FACTORY_MODE_AUTOTEST "*#87#" #define SSC_SERIAL_NUMBER "*#33778#" …… 5. 有关SIM Lock代码参考哪些文档? 请参考: 2G-PSPersonalization_Lock_SIM_ME_Lock_After_06A0632MP.pdf 位于:DCCFeature Phone DataSoftware_CustomerStandard Package2G-PS 6. 如果添加一个Task? a. 添加task index和mod id。 文件:customsystemPROJECTNAMEcustom_config.h /************************************************************************* * [Very Important Message] * 1. Component Task Index (Please add before system service) * 2. Customers are allowed to create at most 16 tasks as defined in * configincludestack_config.h (MAX_CUSTOM_TASKS = 16) *************************************************************************/   typedef enum {   INDX_CUSTOM1 = RPS_CUSTOM_TASKS_BEGIN,   INDX_CUSTOM2,   #ifdef __FLAVOR_VENDOR_SDK__   INDX_VS,   #endif   //add your task index here.   //INDX_XXX,   RPS_CUSTOM_TASKS_END   } custom_task_indx_type;   /************************************************************************* * [Very Important Message] * 1. Component task's module id (Please add before system service) * 2. Customers are allowed to create at most 16 task module ID as defined * in configincludestack_config.h (MAX_CUSTOM_MODS = 16) *************************************************************************/   typedef enum {   MOD_CUSTOM1 = MOD_CUSTOM_BEGIN,   MOD_CUSTOM2,   #ifdef __FLAVOR_VENDOR_SDK__   MOD_VS,   #endif   // add module id here.   //MOD_XXX,   MOD_CUSTOM_END   } custom_module_type;   b. 添加mod id和task index的映射。注意位置需要对应。 /************************************************************************* * Global * custom_mod_task_g * * DESCRIPTION * module to task index mapping. * for example: * INDX_CUSTOM1 -> MOD_CUSTOM1 * means module MOD_CUSTOM1 belongs to INDX_CUSTOM1 task * * Please arrange the mapping according to custom_config.h custom_module_type * sequence. * * GLOBALS AFFECTED * *************************************************************************/   custom_task_indx_type custom_mod_task_g[ MAX_CUSTOM_MODS ] =   {   INDX_CUSTOM1, /* MOD_CUSTOM1 */   INDX_CUSTOM2, /* MOD_CUSTOM2 */   #ifdef __FLAVOR_VENDOR_SDK__   INDX_VS,   #endif   //add you task index here.   // INDX_XXX,   INDX_NIL /* Please end with INDX_NIL element */   };   /************************************************************************* * Global * custom_comp_config_tbl * * DESCRIPTION * The array contains system component tasks' configuration information * * GLOBALS AFFECTED * *************************************************************************/   const comptask_info_struct custom_comp_config_tbl[ MAX_CUSTOM_TASKS ] =   {   /* INDX_CUSTOM1 */   {"CUST1", "CUST1 Q", 210, 1024,   #ifdef CUSTOM1_EXIST   custom1_create, KAL_FALSE   #else   NULL, KAL_FALSE   #endif   , 10, 0   },   /* INDX_CUSTOM2 */   {"CUST2", "CUST2 Q", 211, 1024,   #ifdef CUSTOM2_EXIST   custom2_create, KAL_FALSE   #else   NULL, KAL_FALSE   #endif   , 10, 0   },   #ifdef __FLAVOR_VENDOR_SDK__   /* INDX_VS */   {"VS", "VS Q", 212, 1024,   vs_sys_task_001_create, KAL_FALSE, 10, 0   },   #endif   //add your comptask_info_struct here.   //please reference to comptask_info_struct define.   /*INDX_XXX*/   /* {“XXX”, “XXX Q”, 211, 1024, XXX_create, KAL_FALSE } */   };   c. 实现XXX_create。 详细参考代码中的custom1_create函数实现方式。 d. 定义MSG ID。 文件: /* Add customization message id here */   MSG_ID_CUSTOM1_CUSTOM2 = CUSTOM_MSG_CODE_BEGIN,   MSG_ID_CUSTOM2_CUSTOM1,   //add MSG ID here.   //MSG_ID_XXX,   7. 如何添加一个新的NVRAM项? NVRAM根据级别分3种region: MT – 系统,不对用户开放。 MP – 和应用相关的,用户可以读到,写入。 CT – 专门针对用户的,某个客户专用的一般放这里。 步骤如下: a. 定义新的LID,以及size和total数量。 MT: mcuinterfaceps vram_data_items.h 在nvram_lid_core_enum中添加新的LID。 MP: mcu customcommonPLUTO_MMI vram_common_defs.h 在nvram_lid_commapp_enum中添加新的LID。 MP: customappPROJECTNAME vram_user_defs.h 在nvram_lid_cust_enum中添加新的LID。 b. 驱动开发 以下未说明文件的配置在项目make文件上进行:mcumakePROJECTNAME.mak 1. 设置BB PLATFORM = MT6268   # Hardware Platform, MT6208, FPGA, MT6218, MT6218B, MT6219, MT6226, MT6227, MT6228, MT6229 ...etc.   BOARD_VER = BROADMOBI68_09B_BB   # Baseband main board description, SHOULD BE ONE OF THE FOLLOWINGS   #MT6208_EVB,MT6208_CEVB,MT6205_CEVB,ORDNANCE,KLM2003_BB,CHICAGO2003_BB,   # MT6218_MW001, CANNON, MT6218B_EVB, JUPITER_EVB, MT6219_EVB,   # MT6226_EVB, MT6227_EVB, MT6228_EVB, MT6229_EVB   MCU_CLOCK = MCU_245_76M   # MCU clock setting, MCU_13M, MCU_26M, MCU_39M, MCU_52M, MCU_104M   MCU_DCM = DCM_ENABLE   # DCM_ENABLE, DCM_DISABLE   # Dynamic Clock Management   # Available BB chip: MT6217,MT6226,MT6226M,MT6227,MT6228,MT6229...etc.   EXT_CLOCK = EXT_26M   # External clock source setting, EXT_13M, EXT_26M   2. 设置RF Module RF模块: UMTS_RF_MODULE    =  CUSTOM_MT6160 RF_MODULE = AD6546_CUSTOM 晶振类型: AFC_VCXO_TYPE = VCTCXO   # VCTCXO : VCTCXO   # VCXO : VCXO   # VCXO_SC : VCXO with 7 area slope control   # VCXO_TC : VCXO with temperature compensation   # VCXO_SC_TC : VCXO with 7 area slope control & temperature compensation   COM_DEFS_FOR_CUSTOM_MT6160 = MT6160_RF CUSTOM_MT6160   UMTS_BAND_I = TRUE # TRUE, FALSE   UMTS_BAND_II = TRUE # TRUE, FALSE   UMTS_BAND_III = FALSE # TRUE, FALSE   UMTS_BAND_IV = FALSE # TRUE, FALSE   UMTS_BAND_V = TRUE # TRUE, FALSE   UMTS_BAND_VI = FALSE # TRUE, FALSE   UMTS_BAND_VII = FALSE # TRUE, FALSE   UMTS_BAND_VIII = FALSE # TRUE, FALSE   UMTS_BAND_IX = FALSE # TRUE, FALSE   UMTS_BAND_X = FALSE # TRUE, FALSE          驱动代码: mcucustoml1_rf$(RF_MODULE)l1d_custom_rf.h mcucustoml1_rf$(RF_MODULE)m12193.c      3. 设置PMIC – 电源管理模块 PMIC              =  MT6326       # Charge Function, NONE, MT6305 or MT6318 4. 设置LCD LCD_MODULE = BROADMOBI68_09B_LCM   # Based on the LCM solutions (even multiple LCM modules for this project) # SHOULD BE ONE OF THE FOLLOWINGS, based on the LCM # MTKLCM - Mono, 102x64   # MTKLCM_COLOR - Color, 120x160, for MT6218_MW001 or MT6205_CEVB   # ORDNANCELCM - Mono, 112x64   # KLMLCM - Color, 128x128   # INFOLCM - Color, 128x128   # TOPPOLY_LCM - Color, 128x160, for MT6218B_EVB   # SONY_LCM   MAIN_LCD_SIZE = 320X480   # To distinguish the main lcd size.   # We can use it to copy the matching resources, such themecomponents.h, Fontres.c, L_xxx.h, etc, to PLUTO_MMI folder   SUB_LCD_SIZE = NONE   # NONE, 48X64BW, 64X96, 96X64BW, 96X64, 128X128   COM_DEFS_FOR_BROADMOBI68_09B_LCM = BROADMOBI68_09B_LCM TFT_MAINLCD   # TFT_MAINLCD – LCD类型   驱动代码: customdrvLCD$( LCD_MODULE)lcd.c customdrvLCD$( LCD_MODULE)lcd_hw.h customdrvLCD$( LCD_MODULE)lcd_sw.h customdrvLCD$( LCD_MODULE)lcd_sw_inc.h customdrvLCD$( LCD_MODULE)lcd_rnd.h 5. 设置Camera CMOS_SENSOR = OV2655   # OV9640,PAS105,OV9650   # MT9D011,   # 6229 uses 2M sensor - MT9D011   SENSOR_ROTATE = SENSOR_ROTATE_0   # SENSOR_ROTATE_0, SENSOR_ROTATE_90, SENSOR_ROTATE_180, SENSOR_ROTATE_270   HORIZONTAL_CAMERA = TRUE   # FALSE, TRUE   # To enable horizontal camera feature.   # Add HORIZONTAL_CAMERA to global compile option when the value is TRUE.   WEBCAM_SUPPORT = TRUE   # TRUE, FALSE for WEB CAMERA support   SENSOR_TYPE = RAW   # RAW, YUV, DIRECT, NONE   对摄像头Fine Tune直接联系厂商或MTK。 驱动代码: mcucustomdrvcameraPROJECTNAMEcamera_hw.c mcucustomdrvcameraPROJECTNAME camera_tuning_oper.c 6. FM设置 FM_RADIO_CHIP     = MT6188A1       #  NONE ,  TEA5767HN, FM_RADIO_RECORD = FALSE  # TRUE, FALSE 7. TP(Touch Panel)设置 TOUCH_PANEL_SUPPORT = TP_INTERNAL # NONE, MT6301, MT6301B, TP_INTERNAL   TOUCH_PANEL_SHORTCUT_SUPPORT = FALSE   # FALSE, TRUE   # TRUE for touch panel size need to be larger than LCD size   # Support touch panel shortcut functionality   8. MSDC – 大容量设备管理器 设置 MSDC_CARD_SUPPORT_TYPE = MSDC_SD_MMC   # MSDC_SD_MMC for SD/MMC card support   # MSDC_MS for MS card support   # MSDC_MSPRO for MS-PRO card support   # NONE   # MT6218B, MT6217, MT6219 support MSDC   # MT6218, MT6205B, MT6208 don't support MSDC   9. USB设置 USB_SUPPORT = TRUE # MT6218B and MT6219 chip support USB   USB_MULTIPLE_COMPORT_ENABLE = FALSE # TRUE/FALSE. To enable USB multiple com port feature   USB_HS_SUPPORT = TRUE # TRUE, FALSE   USB_COM_PORT_SUPPORT = TRUE # TRUE, FALSE   USB_MASS_STORAGE_SUPPORT = TRUE # TRUE, FALSE   USB_IN_META_SUPPORT = FALSE # TRUE, FALSE   # To enable USB suuport in META mode feature   USB_IN_NORMAL_MODE_SUPPORT = TRUE # TRUE,FALSE   # To enable USB mass storage support in normal mode   USB_DOWNLOAD = NORMAL #NONE or NORMAL or SECURE   # To enable Factory Download/Connection via USB cable   10. Audio Codec – 音频解码器 AMRWB_DECODE = TRUE # TRUE/FALSE   AMRWB_ENCODE = TRUE # TRUE/FALSE   # MT6219 DSP cannot support AMRWB_ENCODE when GPRS connection   DAF_ENCODE = FALSE # TRUE, FALSE   DAF_DECODE = TRUE # TRUE/FALSE   AAC_DECODE = TRUE # TRUE/FALSE   AAC_PLUS_DECODE = TRUE # TRUE/FALSE   AAC_PLUS_PS_DECODE = FALSE # TRUE, FALSE   MMF_DECODE = FALSE # TRUE, FALSE MMF_DECODE support in MT6218B, MT6217, MT6219 and later chip   WMA_DECODE = FALSE # MT6228 support WMA DECODE   11. Image/Viddo Codec – 视频解码 Raw RGB èJPEG/ JPEGèRaw RGB转换,可以是硬件或软件进行解码。 JPG_DECODE    = JPG_HW                # NONE, JPG_SW, JPG_HW. JPG_ENCODE   = JPG_HW                # NONE, JPG_SW, JPG_HW. GIF_DECODE   = TRUE          # TRUE/FALSE PNG_DECODE   = PNG_HW        # NONE, PNG_HW, PNG_SW MJPG_DECODE             = FALSE         # TRUE/FALSE MJPG_ENCODE             = FALSE         # TRUE/FALSE     MP4_DECODE = TRUE  # TRUE, FALSE MP4_ENCODE = TRUE  # TRUE, FALSE 12. BT – 蓝牙 BLUETOOTH_SUPPORT       = BTMTK_MT6612    # NONE, BTMTK, BTMTK_MT6601, BTMTK_MT6612, BTMTK_MT6612, BTMTK_MT6616 BLUETOOTH_VERSION       = BT_VER_30    # NONE, BT_VER_PRE21, BT_VER_21, BT_VER_30 13. IrDa – 红外 IRDA_SUPPORT      =  FALSE       # IRDA support feature 14. MS(Mition Sensor)-加速传感器 MOTION_SENSOR_SUPPORT = NONE  # NONE, KXP84_SPI, KXP84_I2C, KXP74_SPI, MXC6202_I2C, MMA7660_I2C, KXTF9_I2C # For motion sensor function support or not. 15. EMI配置 设备类型为NAND Flash的make文件配置: NAND_FLASH_BOOTING   = ONDEMAND    # NONE, ENFB, ONDEMAND, MIXED, BASIC # NONE: NORXIP Project and it's not NAND FLASH BOOTING # ENFB: MMI Images and string put on THIRD_ROM and dynmaic load into RAM by application. Default for MT6228/29/30 # ONDEMAND: MMI Resource and Some Non-Real-Time App RO put on NAND and on-demand page in. #           ARM9 MMU Required. Default for MT6235/38 # MIXED: Both ENFB and On-Demand Page In mechanism enabled. ARM9 MMU Required. Pick this to support MBA Feature. # BASIC: Nand Flash Booting is turned on, but none of ENFB and ONDEMAND exists. Only ROM and SECONDARY_ROM.     NAND_SUPPORT     =  TRUE     # NAND SUPPORT     SYSTEM_DRIVE_ON_NAND = TRUE   # FALSE : System Drive on NOR flash                                # TRUE : System Drive on NAND flash     FOTA_UPDATE_PACKAGE_ON_NAND = FALSE  # TRUE, FALSE 设备类型为NOR Flash的make文件配置: NAND_FLASH_BOOTING = NONE NAND_SUPPORT = FALSE SYSTEM_DRIVE_ON_NAND = FALSE 文件位置:mcu oolsMemoryDeviceList MemoryDeviceList_XXXX.xls 在数据库文件中查找是否有我们用到的EMI类型型号,如果没有则MTK不支持,如果有则写入EMI配置文件:mcucustomsystemPROJECTNAME custom_memorydevice.h 第一步:设置设备类型。 /* **************************************************************************** Step 1: Specify memory device type and its complete part number Possible memory device type: NOR_RAM_MCP, LPSDRAM, NOR_LPSDRAM_MCP **************************************************************************** */ #define MEMORY_DEVICE_TYPE LPSDRAM #define CS0_PART_NUMBER H8BCS0SI0MBR//EHD013111MA_60 //如果设备类型为NOR_RAM_MCP,则需要如下配置: //#define CS0_PART_NUMBER LRS1828C //#define CS1_PART_NUMBER LRS1828C //CS0和CS1要一致,PART_NUMBER则根据实际通过数据库xls文件查询。 第二步:设置FLASH和RAM访问类型。 /* **************************************************************************** Step 2: Specify access type for NOR_RAM_MCP; for LPSDRAM, just assign UNDEF_ACCESS to both items (NOR_ACCESS_TYPE and RAM_ACCESS_TYPE) Possible access types: ASYNC_ACCESS, SYNC_ACCESS, UNDEF_ACCESS **************************************************************************** */ #define FLASH_ACCESS_TYPE SYNC_ACCESS #define RAM_ACCESS_TYPE SYNC_ACCESS //设置对于LPSDRAM类型来说,这项忽略,不过一般选UNDEF_ACCESS。 第三步:设置NOR_FDM版本,支持大容量的NOR-FLASH /* **************************************************************************** Step 3: FDM Version Choose MTK NOR FDM is upgraded to 5.0 from 2006/Q3 to support large NOR-flash disk (multi-bank), for example, disk space larger than 64blocks. The major difference of NOR FDM 5.0 and NOR FDM 4.0 as below: 1. RAM consumption To manage 32MB INTEL M18 NOR-flash disk, FDM 5.0 consumes 1KB, but FDM 4.0 takes 32KB. 2. Addressable block numbers The addressable space of NOR FDM 5.0 is 65K-1 blocks, but NOR FDM 4.0 is limited at 128-1 blocks. 3. Idle reclaim and manual reclaim are implemented on NOR FDM 5.0. To enable NOR FDM 5.0 on NOR-flash disk, please enable the following definition and customize custom_flash_norfdm5.c; the option is switch on/off at customer site without deliver new library. [REMIND] ======== To manage small disk space, like smaller than 64 blocks, FDM 4.0 is recommended. **************************************************************************** */ //#define __NOR_FDM5__ //由于我们使用LPSDRAM,所以不用定义 //一般大于128个blocks才启用,否则注解掉。 第四步:FAT配置 存储区可划分为代码区和文件存储区,而文件存储去有可分为用户区域和系统区域,系统区域可用来放NVRAM和MMS文件。 文件存储区 用户区域 | 系统区域 | | clip_image001 很多NOR-Flash手机通常不舍用户区域,而NAND Flash一般会设置一定的用户区域。 如果是NOR Booting类型(例子): //文件系统起始位置为14MB处,也就是说代码区域就是从0x0000000~0x0E00000 #define NOR_BOOTING_NOR_FS_BASE_ADDRESS          0x0E00000 //文件系统总的容量2MB,包括用户区域和系统区域 #define NOR_BOOTING_NOR_FS_SIZE                   0x0200000 //用户区域500个SECTORS,每个SECTOR为512Bytes,这样总共用户区域就是0.25MB #define NOR_BOOTING_NOR_FS_FIRST_DRIVE_SECTORS    500 如果是NAND-FLASH Booting类型(例子): //文件系统起始位置为64MB处,也就是说代码区域就是从0x00000000~0x04000000 #define NAND_BOOTING_NAND_FS_BASE_ADDRESS        0x04000000 //文件系统总的容量192MB,包括用户区域和系统区域 #define NAND_BOOTING_NAND_FS_SIZE                 0x0C000000 //用户区域262144个SECTORS,每个SECTOR为512Bytes,这样总共用户区域就是128MB #define NAND_BOOTING_NAND_FS_FIRST_DRIVE_SECTORS  262144 还有一种变态的情况就是,NOR-BOOTING ,但是文件系统是NAND的,这种情况基本较少,不翻译了,将就这看吧: *********************************************************************** Step 5: For NOR-XIP configuration, if 1. "SYSTEM DRIVE ON NAND" or 2. "SYSTEM DRIVE ON NOR" and FOTA "UPDATE PACKAGE ON NAND" feature is enabled. Users are responsible to specify FS (file system) region information on NAND-flash here! Step 1. Start address of FS region on NAND-flash, Step 2. Total FS size on NAND-flash disk Step 3. The first drive (or partition) size of FS region. if no additional drive on NAND-flash disk, it should be 0. For more details, please refer to REMIND 1 and 2. For example, on 128MB NAND-flash, because code is already located on NOR flash, total 128MB NAND-flash space is reserved for NAND-flash disk. Reserve ~110MB for user drive, remain around 15MB for system drive. #define NOR_BOOTING_NAND_FS_BASE_ADDRESS 0x00000000 #define NOR_BOOTING_NAND_FS_SIZE 0x08000000 // 128MB #define NOR_BOOTING_NAND_FS_FIRST_DRIVE_SECTORS 220000 // 110000KB [REMIND] ======== 1. It is special for flash disk which has two drives (or partitions), the first leading is user drive, visible on USB disk, the second may be system drive, and invisible from USB disk. 2. For projects with __UP_PKG_ON_NAND__ defined, NOR_BOOTING_NAND_FS_FIRST_DRIVE_SECTORS will be ignored. That is, NAND flash is allowed to create only one drive (or partition) in this case. 3. For "SYSTEM DRIVE ON NOR" and FOTA "UPDATE PACKAGE ON NAND" configuration, FOTA update package will be located in the top of FS region by default. Auto-Gen will reserve required space automatically. [VERY IMPORTANT NOTICE] ======================= 1. The values in step 1~3 MUST be set if __FS_SYSDRV_ON_NAND__ or __UP_PKG_ON_NAND__ is defined !! 2. The spare area is excluding from the FS SPACE !! 3. Please assign the exact integer value in terms of sectors (one sector equal to 512 Bytes) in NOR_BOOTING_NAND_FS_FIRST_DRIVE_SECTORS. MUST NOT assign as (TOTAL_FS_SIZE - SIZE_OF_SYSTEM_DRIVE), because system will keep some spaces for disk management. **************************************************************************** */ #define NOR_BOOTING_NAND_FS_BASE_ADDRESS          0x00000000 #define NOR_BOOTING_NAND_FS_SIZE                   0x08000000 #define NOR_BOOTING_NAND_FS_FIRST_DRIVE_SECTORS    220000 第五步:从新生成EMI配置和SCATTER文件。     在project.mak文件中SYSGEN_ENABLE= TRUE Make [prject_name] umts emiclean – 先清理emi配置 Make [prject_name] umts sysgen -- 生成emi和scatter 16. 使用DrvTool对GPIO/GPO,EINT,ADC,KEYPAD等进行配置,生产驱动代码。 首先确认: DRV_CUSTOM_TOOL_SUPPORT  = TRUE,否则不能使用DrvTool配置,这个设置将启用__CUST_NEW__宏。 DrvTool的路径为: mcucustomdrvDrv_ToolDrvGen.exe 在工程中,有一个已经配置好的默认驱动配置文件codegen.dws,位于: mcucustomdrvmisc_drvPROJECTNAMEcodegen 16.1 打开DrvTool 首先要保证project.mak文件中:DRV_CUSTOM_TOOL_SUPPORT=TRUE 运行工具,运行界面如下: clip_image002 点击Open按钮打开刚才的codegen.dws,然后单击Edit按钮可进入编辑界面。 16.2 GPIO/GPO设置。 不同的平台有不同GPIO/GPO口数量。如MT6268平台,有99个GPIO口,无GPO口。 切换到GPIO设置页面,界面如下: clip_image004 可设置的GPIO/GPO口如下: GPIO_DIR(方向控制寄存器) 对应Def.Dir 列 GPIO_PULLEN(上位/下拉寄存器) 对应 InPull En 列 GPIO_DINV(输入倒置寄存器) 对应 INV 列 GPIO_DOUT(数据输出寄存器) 对应 Out 列 GPIO_DIN(数据输入寄存器) 对应 In 列 GPIO_MODE(模式设置寄存器) 对应 M0/M1/M2/M3 列 参考硬件工程师提供的GPIO/GPO配置表进行设置。 16.3 设置EINT(外部中断)。 clip_image006 中断有 耳机插入检测中断,触摸屏中断,充电中断等,参考硬件工程师提供的EINT配置表设置EINT。 16.3 ADC设置 clip_image008 ADC有 电池电压通道,充电电流感应电压通道,USB检测通道等,详细参考硬件工程师提供的ADC配置表设置ADC。 16.4 keypad设置 clip_image010 键盘的硬件实现是一个二维矩阵,交叉点代表一个按键。 详细参考硬件工程师提供的键盘矩阵配置表设置按键定义。 17. PWM(脉宽调制)设置-主要用于对屏幕背光灯、按键背光灯、闪光灯等亮度的设置调整。 文件路径:mcucustomappPRJECTNAME vram_user_config.c kal_uint32 const NVRAM_EF_CUST_HW_LEVEL_TBL_DEFAULT[] = {                                           /*屏幕背光灯*/                   200, 20,  /* PWM 1  Level 1 */                   200, 40,  /* PWM 1  Level 2*/                   200, 60,  /* PWM 1  Level 3*/                   200, 80,  /* PWM 1  Level 4*/                   200, 100, /* PWM 1 Level 5 */                                           /*按键背光灯*/                   200, 0,  /* PWM 2  Level 1 */                   200, 0,  /* PWM 2  Level 2*/                   200, 0,  /* PWM 2  Level 3*/                   200, 0,  /* PWM 2  Level 4*/                   200, 0, /* PWM 2 Level 5 */                                           /*闪光灯*/                   200, 20,  /* PWM 3  Level 1 */                   200, 40,  /* PWM 3  Level 2*/                   200, 60,  /* PWM 3  Level 3*/                   200, 80,  /* PWM 3  Level 4*/                   200, 100, /* PWM 3 Level 5 */ //LCD对比度设置。 #if (defined MTKLCM)           34, 35, 36, 37, 38, 39, 40, 41, 42, 43,           44, 45, 46, 47, 48, #elif (defined MTKLCM_COLOR)                   /* Main LCD contrast level 1 ~ 15 */                   148, 149, 150, 151, 152, 153, 154, 155, 156, 158,                   160, 162, 164, 166, 168,    #else                    /* Main LCD contrast level 1 ~ 15 */                   120, 122, 124, 126, 128, 130, 132, 134, 136, 138,                   140, 142, 144, 146, 148,    #endif                         /* Main LCD Bias Param (Reserved) */                   0, 0, 0, 0, 0,                       /* Main LCD Linerate Param (Reserved) */                   0, 0, 0, 0, 0,                       /* Main LCD Temperature Param (Reserved) */                   0, 0, 0, 0, 0,    //子LCD对比度                    /* Sub LCD contrast level 1 ~ 15 */                   20, 22, 24, 26, 28, 30, 32, 34, 36, 38,                   40, 42, 44, 46, 48,                       /* Sub LCD Bias Param (Reserved) */                   0, 0, 0, 0, 0,                       /* Sub LCD Linerate Param (Reserved) */                   0, 0, 0, 0, 0,                       /* Sub LCD Temperature Param (Reserved) */                   0, 0, 0, 0, 0,    //电池电量等级设置。                   /* Battery voltage Level */                   3350000, /* Low Battery Power off */                   3400000, /* Low Battery */                   /* battery level 1 ~ 8 */                   3550000, 3640000, 3740000, 3870000,                   9999999, 9999999, 9999999, 9999999, /*            电池的等级对应下面枚举。文件位于:            mcupsl4includedevice.h      typedef enum {    BATTERY_LOW_POWEROFF = 0,    BATTERY_LOW_TX_PROHIBIT,    BATTERY_LOW_WARNING,    BATTERY_LEVEL_0,    BATTERY_LEVEL_1,    BATTERY_LEVEL_2,    BATTERY_LEVEL_3,    BATTERY_LEVEL_4 = BATTERY_LEVEL_3, /* BATTERY_LEVEL_4 */    BATTERY_LEVEL_5 = BATTERY_LEVEL_3, /* BATTERY_LEVEL_5 */    BATTERY_LEVEL_6 = BATTERY_LEVEL_3, /* BATTERY_LEVEL_6 */    BATTERY_LEVEL_LAST = 9      } battery_level_enum; */ //=======================================================================                   200, 20,  /* PMIC6318 PWM Level 1 */                   200, 50,  /* PMIC6318 PWM Level 2*/                   200, 80,  /* PMIC6318 PWM Level 3*/                   200, 90,  /* PMIC6318 PWM Level 4*/                   200, 100 /* PMIC6318 PWM Level 5 */                  }; 文件路径:mcucustomdrvmisc_drvPROJECTNAMEcustom_hw_default.c kal_uint32 PWM1_Level_Info[PWM_MAX_LEVEL][2] = {    /*Freq,duty*/    {200,20},    /*Level 1*/    {200,40},    /*Level 2*/    {200,60},    /*Level 3*/    {200,80},    /*Level 4*/    {200,100}    /*Level 5*/ };      kal_uint32 PWM2_Level_Info[PWM_MAX_LEVEL][2] = {    /*Freq,duty*/    {200,20},    /*Level 1*/    {200,40},    /*Level 2*/    {200,60},    /*Level 3*/    {200,80},    /*Level 4*/    {200,100}    /*Level 5*/ };      kal_uint32 PWM3_Level_Info[PWM_MAX_LEVEL][2] = {    /*Freq,duty*/    {200,20},    /*Level 1*/    {200,40},    /*Level 2*/    {200,60},    /*Level 3*/    {200,80},    /*Level 4*/    {200,100}    /*Level 5*/ }; // PWM4, 5, 6 for old PWN configuration begin kal_uint32 PWM4_Level_Info[PWM_MAX_LEVEL][2] = {    /*Freq,duty*/    {200,20},    /*Level 1*/    {200,40},    /*Level 2*/    {200,60},    /*Level 3*/    {200,80},    /*Level 4*/    {200,100}    /*Level 5*/ };      // We use PWM5 as LCD backlight // And the LCD backlight component is configured insided to invert the signal from PWM // So we need to invert duty setting for each level kal_uint32 PWM5_Level_Info[PWM_MAX_LEVEL][2] = {    /*Freq,duty*/    {200,80},    /*Level 1*/    {200,60},    /*Level 2*/    {200,40},    /*Level 3*/    {200,20},    /*Level 4*/    {200,0}    /*Level 5*/ }; kal_uint32 PWM6_Level_Info[PWM_MAX_LEVEL][2] = {    /*Freq,duty*/    {200,20},    /*Level 1*/    {200,40},    /*Level 2*/    {200,60},    /*Level 3*/    {200,80},    /*Level 4*/    {200,100}    /*Level 5*/ }; // PWM4, 5, 6 for old PWN configuration end      kal_uint32 Alter_Level_Info[PWM_MAX_LEVEL][2] = {    /*Freq,duty*/    {200,20},    /*Level 1*/    {200,40},    /*Level 2*/    {200,60},    /*Level 3*/    {200,80},    /*Level 4*/    {200,100}    /*Level 5*/ }; 18. clip_image011声音模块设置。 clip_image013 18.1 声音模块和用户之间的数据传输通道用下面宏来定义,文件位置: mcu\interfacel1audiol1audio.h /* -------------------------------- */ /*  Audio Output Device Definition  */ /* -------------------------------- */ #define  L1SP_BUFFER_0        0x01    /* NOTE: Don't use buffer definition directly   * 耳机语音数据/ #define  L1SP_BUFFER_1        0x02    /*       Use speaker definition below           * 手机声音/ #define  L1SP_BUFFER_ST       0x04    /*耳机左右声道声音*/ #define  L1SP_BUFFER_EXT      0x08 #define  L1SP_BUFFER_EXT_G    0x10 #define  L1SP_STEREO2MONO     0x20     /* Do not use this term for speaker definition */ #define  L1SP_BUFFER_ST_M     (L1SP_BUFFER_ST|L1SP_STEREO2MONO) #define  L1SP_EXT_DAC_BUF0    0x40 #define  L1SP_EXT_DAC_BUF1    0x80      #define  L1SP_LNA_0           0  /*手机麦克风数据*/ #define  L1SP_LNA_1           1  /*耳机麦克风*/ #define  L1SP_LNA_FMRR        3 18.2 设置音乐通道,文件路径: mcu\customaudioPROJECTNAMEaudcoeff.c //普通麦克风通道 const unsigned char  L1SP_MICROPHONE1  = L1SP_LNA_0; //耳机模式麦克风通道 const unsigned char  L1SP_MICROPHONE2  = L1SP_LNA_1; //普通听筒通道 const unsigned char  L1SP_SPEAKER1     = L1SP_BUFFER_0; //耳机模式听筒通道 const unsigned char  L1SP_SPEAKER2     = L1SP_BUFFER_ST; //音量放大器输出通道 const unsigned char  L1SP_LOUD_SPEAKER = L1SP_BUFFER_ST_M|L1SP_BUFFER_EXT; 18.3 音量设置,文件路径: mcu\customaudioPROJECTNAME vram_default_audio.c kal_uint8 const NVRAM_EF_CUST_ACOUSTIC_DATA_DEFAULT[] = {…},通过这个数组设置音量增益。 18.4 设置扩音。 文件:mcucustomaudioPROJECTNAMEafe.c 首先要设置正确gpio口,修改如下:                   void AFE_SwitchExtAmplifier( char sw_on ) { ……   //这个变量要在DrvTool中配置,否则没有该变量。   //注意要在__CUST_NEW__宏内。 extern const char gpio_afe_amplifier_pin; if (sw_on) {                       GPO_WriteIO( 1, gpio_afe_amplifier_pin ); } Else {                  GPO_WriteIO( 0, gpio_afe_amplifier_pin ); } …… } 然后:--- 不知道啥东西?? void AFE_Initialize( void ) {    /// AFE_VAC_CON0::VCALI is chip dependent, will be set in l1audioafe2.c    /// immediately after this function is called.    /// set audio output == differential mode.    *AFE_VAC_CON0  = 0x00;    *AFE_VAC_DCON1 = 0x80; } 19. BMT – Battery Management Task – 电池管理任务 下面是充电流程:clip_image015 警告信息出现条件: clip_image017 充电参数设置(上述条件中的个电压等),文件: mcucustomdrvmisc_drvPROJECTNAME chr_parameter.c bmt_customized_struct bmt_custom_chr_def = { …… 1000000,/*ICHARGE_ON_HIGH */ // I > VALUE,over charge!电流过高    20000,/*ICHARGE_ON_LOW*/ // I < VALUE, bad contact charger.连接错误    1000000,/*ICHARGE_OFF_HIGH*/  //??50000// I > VALUE,over charge!电流过高    4050000,/*V_FAST2TOPOFF_THRES*/ V > VALUE, TOP-OFF mode,恒流充电进入恒压充电 /*下面三个值对应不同温度是的ADC电压值,在驱动中用于判断,如果电池电压温度小于-40度,则报连接错误。如果小于0度,则报温度过低,如果45度以上则报温度过高。*/    2500000,/*BATTMP_MINUS_40C*/ // 电池温度40度的(ADC端口)电压值    1469409,/*BATTMP_0C*/ //电池温度0度的(ADC端口)电压值    520042,/*BATTMP_45C*/ //电池温度45度的(ADC端口)电压值 //======================================================================    4500000,/*MAX_VBAT_LI*/ //锂电池,大于这个值,则显示电压过高    5500000,/*MAX_VBAT_NI*/NI电池,大于这个值,则显示电压过高    3400000,/*V_PRE2FAST_THRES*/ //大于3.4v,准备充电模式进入快速充电(横流)模式    250000,/*I_TOPOFF2FAST_THRES*/  /*250ma,TOPOFF->FAST*/    120000,/*I_TOPOFF2FULL_THRES*/   /*120ma,TOPOFF->BATFULL*/电流小于120mA,充满    4110000,/*V_FULL2FAST_THRES*/  /*BATFULL->FAST*///小于4.11V,充满->快速充电模式    414557,/*V_TEMP_FAST2FULL_THRES_NI*/   /*50oC,FAST->BATFULL*/    4050000,/*V_FULL2FAST_THRES_NI*/    600000,/*FAST_ICHARGE_HIGHLEVEL*/  /*600ma,for table search*/    400000,/*FAST_ICHARGE_LOWLEVEL*/   /*400ma,for table search*/    4050000,/*V_PROTECT_HIGH_LI*/    3800000,/*V_PROTECT_LOW_LI*/    6500000,/*VCHARGER_HIGH*/ …… 5,/*ADC_ISENSE_RESISTANCE_FACTOR*//* 1/0.2 = 5 *///这个值计算公式=1/分压电阻,如果分压电阻是0.25,则1/0.25=4 24, /*bmt_measure_discard_time*/ /*24 ticks*/ //ADC_CALIDATA adc_cali_param { { //看实际ADC的量程和ADC位数,计算公式slop=V(单位为uV)/pow(2,n) //如ADC量程为2.8V,位数为10位,则slop=2.8*1000000/1024=2734 //但是我们不会调整这里的值,通过调整adc_volt_factor同样可以达到测试正//确的效果。 5524, // CH0 5524, // CH1 5524, // CH2 5524, // CH3 5524, // CH4 5524, // CH5 5524, // CH6 5524, // CH7 5524 // CH8 }, { //slop_offset,不知道怎么算的。 (23286), // CH0 (23286), // CH1 (23286), // CH2 (23286), // CH3 (23286), // CH4 (23286), // CH5 (23286), // CH6 (23286), // CH7 (23286) // CH8 } }, /*ratio = adc_volt_factor/100*/ //const kal_uint16 adc_volt_factor[ADC_MAX_CHANNEL] { /*- 放大因子主要用于当adc物理端口不能直接测试所需要的电压,然后根据电路 图计算放大因子。如: clip_image018 我们要计算1方框内VBAT的电压值,但是ADC物理端口没有直接连,所以没有办法直接测量,我们只能测试2方框内ADC0处电压,但是根据电路图,可以知道VBAT的电压正好是ADC0处的2倍。所以把放大因子调整为100,到这里,你一定会问,100不是1倍吗,怎么又变成2倍了呢?!!问题就在上面的slop参数,由于我们不调整slop值,但是实际算出的slop值为2734,而当前设置值5524,大概是2倍。所以实际上已经放大了2倍。---- 我研究了很久才弄明白的,这下你弄明白了吧!! PS:你也可以调整上面的slope,而在这里放大因子写200.但是看MTK的参考文档不是这样,不知道为啥。 */ 100, // CH0 – 测试电压的放大因子,100正好是1倍 100, // CH1 50, // CH2 - 50 为 0.5倍。 250, // CH3 100, // CH4 50, // CH5 100, // CH6 50, // CH7 100 // CH8 }, …… } 20. AUX Task-外部设备检测。 文件:customdrvmisc_drvPROJECTNAMEauxmain.c #define UART_ADC 9999999 //============================================================= /* 用来检测设备的Plug-in/out,或者是key_press,key_release. */ #define NORMAL_EARPHONE_ADC_HIGH 9999999 #define NORMAL_EARPHONE_ADC_LOW 500000/*0.5~2.8*/ #define SINGLE_EARPHONE_ADC_HIGH 9999999 #define SINGLE_EARPHONE_ADC_LOW 500000/*0.5~2.8*/ #define SENDKEY_ADC 300000 /*3.0 */ //============================================================= #define POLLING_INTERVAL 50 /*polling interval*/ #define TURN_ON_BIAS_INTERVAL 10 /*measure adc interval*/ #define PLUGIN_DEBOUNCE_TIME 7 /*unit=10ms*/ #define PLUGOUT_DEBOUNCE_TIME 100 #define VOLTAGE_MEASURE_TIME 450 21. USB设置 21.1 设置描述参数/VID_PID。 厂商和表述信息写入USB参数,可以在PC端杯读取到,文件路径: mcu customdrvmisc_drvPROJECTNAMEusb_custom.c /************************************************************     device descriptor parameters *************************************************************/      static const kal_uint16 USB_MANUFACTURER_STRING[] = {   //”Mediatek Inc”长度为12,计算公式(12+1)*2=26=0x1a,前面数字03不能动。     0x031a,     'M',     'e',     'd',     'i',     'a',     'T',     'e',     'k',     ' ',     'I',     'n',     'c' };      static const kal_uint16 USB_PRODUCT_STRING[] = {     0x0310,     'M',     'T',     '6',     '2',     '6',     '8',     ' ' };      VID调整,请看下面定义:       static const USB_DEVICE_PARAM usb_device_param PID以及描述调整,请看下面定义: static const USB_MS_PARAM usb_ms_param static const USB_ACM_PARAM usb_acm_param static const USB_VIDEO_PARAM usb_video_param static const USB_IMAGE_PARAM usb_image_param static const USB_MTP_IMAGE_PARAM usb_mtp_image_param      21.2 USB检测GPIO口设置。 文件: mcu customdrvmisc_drvPROJECTNAMEusb_custom.c /* power control function, enable == KAL_TRUE turn on the power*/ void USB_PowerControl(kal_bool enable) { #ifdef __USB_ENABLE__ #ifdef PMIC_6318_USB_FUNCTION pmic_usb_regulator_enable(enable); #else if (enable == KAL_TRUE) #ifdef __CUST_NEW__ GPIO_WriteIO(1, gpio_usb_enable_pin); //--设置GPIO口 #else GPIO_WriteIO(1,1); #endif else #ifdef __CUST_NEW__ GPIO_WriteIO(0, gpio_usb_enable_pin); //--设置GPIO口 #else GPIO_WriteIO(0,1); #endif #endif /* PMIC_6318_USB_FUNCTION */ #endif /*__USB_ENABLE__*/ } 21.3 Mass Storage存储模式设置。 可设置 MSDC,NOR,NAND等模式,相关的参数分别为:USB_MSDC_drv、USB_NOR_drv和USB_NAND_drv。 文件路径: mcu customdrvmisc_drvPROJECTNAME custom_drv_init.c void custom_usb_ms_init(void) { #ifdef __USB_ENABLE__ #if ((defined(__MSDC_MS__))||(defined(__MSDC_MSPRO__))||(defined(__MSDC_SD_MMC__)) ) #ifdef __SIM_PLUS__ if(g_usb_ms_simplus_exist == KAL_TRUE) { USB_Ms_Register_DiskDriver(&USB_SIMPLUS_drv); } #endif USB_Ms_Register_DiskDriver(&USB_MSDC_drv); // USB_MSDC_drv #endif #ifdef __USB_RAMDISK__ USB_Ms_Register_DiskDriver(&USB_RAM_drv); #endif #if (!defined(__FS_SYSDRV_ON_NAND__) && !defined( _NAND_FLASH_BOOTING_)) if(FS_GetDevPartitions(FS_DEVICE_TYPE_NOR) >= 2) { USB_Ms_Register_DiskDriver(&USB_NOR_drv); // USB_NOR_drv } #endif #ifdef NAND_SUPPORT if(FS_GetDevPartitions(FS_DEVICE_TYPE_NAND) >= 2) { USB_Ms_Register_DiskDriver(&USB_NAND_drv); // USB_NAND_drv } else if (FS_GetDevPartitions(FS_DEVICE_TYPE_NAND) == 1) { #if (!defined(__FS_SYSDRV_ON_NAND__)) USB_Ms_Register_DiskDriver(&USB_NAND_drv); #endif } #endif #endif /*__USB_ENABLE__*/ } 22. UART Llow Control配置 fc_none: no flow control. fc_sw: sw flow control. fc_hw: hw flow control. 文件:mcu customdrvmisc_drvPROJECTNAME uart_def.c UART_flowCtrlMode UART_GetFlowCtrl(UART_PORT uart_port) { UART_flowCtrlMode flow_ctrl; switch(uart_port) { case uart_port1: flow_ctrl = fc_none; break; case uart_port2: flow_ctrl=fc_none; break; #ifdef __UART3_SUPPORT__ case uart_port3: flow_ctrl=fc_none; break; #endif #ifdef __IRDA_SUPPORT__ case uart_port_irda: flow_ctrl=fc_none; break; #endif #ifdef __USB_ENABLE__ case uart_port_usb: flow_ctrl=fc_none; break; #endif #ifdef __BLUETOOTH_SUPPORT__ case uart_port_bluetooth: flow_ctrl=fc_none; break; #endif default: flow_ctrl=fc_none; break; } return(flow_ctrl); } 23. LCD屏幕移植。 a. 参考4. 设置make文件配置LCD。 b. 打开关闭DMA模式。 文件:mcucustomdrvLCD$( LCD_MODULE)lcd_sw.h #if (defined(MT6226)||defined(MT6227)||defined(MT6228)||defined(MT6229)||defined(MT6268T)||defined(MT6230)||defined(MT6235)||defined(MT6235B)||defined(MT6238)||defined(MT6268A)||defined(MT6239)||defined(MT6268)) #define LCD_CMD_DMA_MODE //如果不需要则注解掉。一般打开,这样速度快。 #define LCD_DUMMYADDR 0x90000000 …… c. 设置LCD Bus Width。 #define MAIN_LCD_16BIT_MODE d. 根据LCD参数设置主屏Command/Data Address. #define MAIN_LCD_CMD_ADDR LCD_PARALLEL0_A0_LOW_ADDR #define MAIN_LCD_DATA_ADDR LCD_PARALLEL0_A0_HIGH_ADDR //LCD_PARALLEL0_A0_LOW_ADDR/ LCD_PARALLEL0_A0_HIGH_ADDR在//lcd_if_xxxx_serials_hw.h中被定义,路径位于mcuinterfacehwdrv。具体使用那个文件//里的定义,请参考lcd_if_hw.h文件内容。 e. 设置color format #if (defined(MAIN_LCD_8BIT_MODE)) #define MAIN_LCD_OUTPUT_FORMAT LCM_8BIT_16_BPP_RGB565_1 #elif (defined(MAIN_LCD_9BIT_MODE)) #define MAIN_LCD_OUTPUT_FORMAT LCM_9BIT_18_BPP_RGB666_1 #elif (defined(MAIN_LCD_16BIT_MODE)) #define MAIN_LCD_OUTPUT_FORMAT LCM_16BIT_16_BPP_RGB565_1 #elif (defined(MAIN_LCD_18BIT_MODE)) #define MAIN_LCD_OUTPUT_FORMAT LCM_18BIT_18_BPP_RGB666_1 #endif // LCM_8BIT_16_BPP_RGB565_1这些值在lcd_if.h中被定义。 f. 设置Sub LCD的参数。 #ifdef DUAL_LCD #ifdef SERIAL_SUBLCD #define SUB_LCD_CMD_ADDR LCD_SERIAL0_A0_LOW_ADDR #define SUB_LCD_DATA_ADDR LCD_SERIAL0_A0_HIGH_ADDR #else #define SUB_LCD_CMD_ADDR LCD_PARALLEL1_A0_LOW_ADDR #define SUB_LCD_DATA_ADDR LCD_PARALLEL1_A0_HIGH_ADDR #endif #if (defined(SUB_LCD_8BIT_MODE)) #define SUB_LCD_OUTPUT_FORMAT LCM_8BIT_16_BPP_RGB565_1 #elif (defined(SUB_LCD_9BIT_MODE)) #define SUB_LCD_OUTPUT_FORMAT LCM_9BIT_16_BPP_RGB565_1 #elif (defined(SUB_LCD_16BIT_MODE)) #define SUB_LCD_OUTPUT_FORMAT LCM_16BIT_16_BPP_RGB565_1 #elif (defined(SUB_LCD_18BIT_MODE)) #define SUB_LCD_OUTPUT_FORMAT LCM_18BIT_18_BPP_RGB666_1 #endif #endif g. 设置功能函数。 LCD_Funcs LCD_func_ILI9327 = { LCD_Init_ILI9327, LCD_PWRON_ILI9327, LCD_SetContrast_ILI9327, LCD_ON_ILI9327, LCD_BlockWrite_ILI9327, LCD_Size_ILI9327, LCD_EnterSleep_ILI9327, LCD_ExitSleep_ILI9327, LCD_Partial_On_ILI9327, LCD_Partial_Off_ILI9327, LCD_Partial_line_ILI9327, /*Engineering mode*/ LCD_GetParm_ILI9327, LCD_SetBias_ILI9327, LCD_Contrast_ILI9327, LCD_LineRate_ILI9327, LCD_Temp_Compensate_ILI9327 #ifdef LCM_ROTATE_SUPPORT ,LCD_Set_Scan_Direction_ILI9327 #endif #ifdef LQT_SUPPORT/*Do not remove LQT code segment*/ ,LCD_gamma_test ,LCD_flicker_test #endif }; #ifdef DUAL_LCD LCD_Funcs LCD_func_NT75751 = { LCD_Init_NT75751, LCD_PWRON_NT75751, LCD_SetVoltLevel_NT75751, LCD_ON_NT75751, LCD_BlockWrite_NT75751, LCD_Size_NT75751, LCD_EnterSleep_NT75751, LCD_ExitSleep_NT75751, 0, 0, 0, /*Engineering mode*/ LCD_GetParm_NT75751, LCD_SetBias_NT75751, LCD_Contrast_NT75751, LCD_LineRate_NT75751, LCD_Temp_Compensate_NT75751 #ifdef LCM_ROTATE_SUPPORT ,LCD_Set_Scan_Direction_NT75751 #endif }; void LCD_FunConfig(void) { MainLCD = &LCD_func_ILI9327; #ifdef DUAL_LCD SubLCD = &LCD_func_NT75751; #endif } 24. 摄像头移植。 24.1 参考 5. 设置Camera。 24.2 驱动代码移植,将厂商提供的image_sensor和yuv_sensor代码覆盖原有代码。 24.3 效果调整,请联系厂商或MTK。一般YUV联系厂商,Bayer RGB联系MTK。

热门文章