MTK平台手机硬件培训72614共40页文档
- 格式:ppt
- 大小:836.00 KB
- 文档页数:40
Man Machine InterfaceAgendaMTK Software ArchitectureMTK MMI ArchitectureExample to Write an Application Third Party SoftwareToolQ&AMTK Software ArchitectureMTK Software ArchitectureSoftware ArchitectureKAL and OSLDate TypeTask ManagementSoftware ArchitectureSoftware Architecture –abbreviationsRMI: Remote MMI, i.e., PC side, which uses AT commands to communicate with Protocol stack.L4: The adaptation layer between MMI/AT and protocol stack.L4A: Layer 4 Adaptation to translate primitives sent from upper layers to function calls.L4C: Layer 4 Controller, coordinates all L4 modules to serve upper layers.ATCI: AT Command Interpreter.UEM: User Equipments module used to abstract basic device drivers like keypad, LED, GPIO.PHB: Phone Book management.SMU: Security Management (SIM, STK).CSM: Call Service Management (bearer capability handling, CSD/FAX service, CC, SS).RAC: Registration Access Control (GSM/GPRS registration management,PLMN list/selection, RSSI report)SMSAL: SMS Application Layer (message storage, MO/MT messages, CB).TCM: Terminal Context Management (PDP context profiles, context activate/deactivate, relay of packet data), interface to PPP/TCPIP/SNDCP.ENG: Engineer Mode to log information.KAL (Kernel Abstraction Layer)Target Real TimeOperating System GSMHandset Software GSMHandset SoftwareKernel Abstraction Layer (KAL)Target Real Time Operating SystemXTest/DebugFacilitiesPortabilityCommon design philosophyTest/Debug facilitiesEasier code integrationKAL ServicesKALServicesTest / Logging / Simulation facilities Exception handling Resource / MemorymanagementTask management /communication /synchronizationTimer ControlTask-ATask-BReference:KAL_ProgrammingGuide_20041005.pdfSystemServiceUserManual_20050527.pdfOSLNucleus,or other RTOSKALOSLPC simulator –simulate the OSL services on Win32 to facilitate development and debugging MMI task on PC.N.B.to ensure all programs within MMI task can run correctly on PC, use of OSL APIs is MUST.Data TypesGeneral data types:Kal_non_specific_general_types.hKAL specific data types and functions’prototypes: Kal_release.hOSL specific data types used within MMI Tasks: PixtelDataTypes.hTask Management & Identificationmodule_type and task_indx_typeDefined in “Stack_config.h”Used to define index of all modules and all tasksmod_task_g[RPS_TOTAL_STACK_MODULES]Defined in “syscomp_config.c”Used to map MODULE-ID to TASK-IDsys_comp_config_tbl[RPS_TOTAL_STACK_TASKS + 1]Defined in “syscomp_config.c”Used to define information of all tasks, e.g., task’s name, task queue’s name, priority, size of external/internal queue, task creation function, whether to use internal ram.custom_comp_config_tbl[MAX_CUSTOM_TASKS]Used for customer defined modules or tasks.task_info_g[RPS_TOTAL_STACK_TASKS + 1]Global array containing component task information, which will be filled in while callingstack_init_comp_info().module_info_g[MAX_MULTIMOD_TASK_NUM]Global array containing component task information, which will be filled in while callingstack_init_module_info().Task RoutinesTask CommunicationApp_ltlcom.hData structure ofmassage used for inter-layer communicationApp_ltlcom.h Data structure of massage used for inter-layer communication Stack_ltlcom.hMacro and API used to send/free messagesStack_ltlcom.h Macro and API used to send/free messagesTo allocate memory from shared memory pool.Ctrl_buff_pool.hDefine size and number of control buffer (memory pool)To allocate memory from shared memory pool.Ctrl_buff_pool.h Define size and number of control buffer (memory pool)To initialize specificmodule’s parameter pointer and peer buffer pointer before use it. (module_ilm_g [module_id])To initialize specific module’s parameter pointer and peer buffer pointer before use it. (module_ilm_g [module_id])Send message to other taskSend message to other taskTo receive message from external queueTo receive message from external queue To receive message from internal queueTo receive message from internal queue QueueGprot.hUsage of OSL send/receive internal/ external msg.QueueGprot.h Usage of OSL send/receive internal/ external msg.MTK MMI ArchitectureMTK MMI ArchitectureMMI Task structureMMI and L4 Communication MMI Architecture¾FrameworkProvides OS abstractionEvent HandlersHistory ManagerNVRAM AccessFile System Management ¾UI, ResourceMMI DirectoriesTask structureTask struct(sys_comp_config_tbl ):typedef struct {kal_char *comp_name_ptr;kal_char *comp_qname_ptr;kal_uint32 comp_priority;//3-255kal_uint16 comp_stack_size;kal_uint8 comp_ext_qsize;kal_uint8 comp_int_qsize;kal_create_func_ptr comp_create_func;kal_bool comp_internal_ram_stack;} comptask_info_struct;KAL_FALSEmmi_create 100304096TASK_PRIORITY_MMI“MMI Q”"MMI"MMI TaskLayer 4 AdapterExample:MOD_MMI--->MOD_L4Cmmi_frm_sms_send_message( )PRT_MSG_ID_MMI_SMS_SEND_MSG_REQ---------------------------------L4a_callback.cl4a_recv_msg_ft[MSG_ID_MMI_MESSAGE_SUM]_call_MSG_ID_MMI_SMS_SEND_MSG_REQ_( )---------------------------------MOD_L4C--->MOD_SMSALl4c_sms_exe_post_msg_req( )MSG_ID_L4CSMSAL_SEND_REQMMI and L4 Communication(1/3)How To CommunicateSend/Receive messages thru the message Queue .#define OslMsgSendExtQueue msg_send_ext_queue #define OslReceiveMsgExtQ receive_msg_ext_q SetProtocolEventHandler(FuncCB, msg_id);Communication Datatypedef struct ilm_struct{oslModuleType oslSrcId; // Source module ID.oslModuleType oslDestId; // Destination module ID.oslMsgType oslSapId; // service access point.oslMsgType oslMsgId; // message name ID.oslParaType *oslDataPtr; //local parameter bufferoslPeerParaPtr *oslPeerBuffPtr; //peer buffer pointer } ilm_struct;MOD_MMI, MOD_L4C, MMI_L4C_SAP, MSG_ID_XXX, local_para_ptr, peer_buf_ptr, MMIL4CQueueHow to listen a message from MMI Queue: From task create and entry a message loop.OslReadCircularQ(&Message);OslReceiveMsgExtQ(mmi_qid, &mmi_message);How to write a message to MMI Circular Queue: When NVRAM receive other messages.OslWriteCircularQ(&ilm_ptr);How to receive a message from L4C: Register a response message callback.SetProtocolEventHandler(FuncCB, msg_id);How to send a message to L4C:Step1: Construct a local parameter buffer.Step2: Assign required values into local parameter buffer.Step3: Send out the message to the L4C module.OslMsgSendExtQueue(&Message);Message Info = Header info + Data info Local parameter Header info:#define LOCAL_PARA_HDR \kal_uint8ref_count; \kal_uint16msg_len;peer buffer parameter Header info :#define PEER_BUFF_HDR \kal_uint16pdu_len; \kal_uint8ref_count; \kal_uint8 pb_resvered; \kal_uint16free_header_space; \kal_uint16free_tail_space;Local parameter:Header info + Data info:Ex: typedef struct{LOCAL_PARA_HDRkal_uint8volume_type;kal_uint8volume_level;} mmi_eq_set_volume_req_struct;How To Create Local Parameter:Dynamic to allocate memory buffer:OslConstructDataPtr(sizeof(mmi_at_alarm_query_res_req_struct); When to Free Local Parameter:While L4 receive the information, after finishing to process themessage, L4 task will automatically free this buffer.OslFreeDataPtr(sizeof(mmi_at_alarm_query_res_req_struct);Peer buffer parameter:Header info + Data infoEx: typedef struct{PEER_BUFF_HDRvoid *ptr;} mmi_example;How To Create Peer Buffer Parameter: Dynamic to allocate memory buffer:Ps: The MMI did not use this buffer to communicate with L4.construct_peer_buff(pdu_len, header_len, tail_len, direction); When will Free Peer Buffer:While receive the information, after finishing to process the message, L4 task will automatically free this buffer.free_peer_buff(peer_buff);Example –Set VolumeSet a volume request:void SetVolumeLevelReq(volume_type_enum volume_type,U8 volume_level){MYQUEUE Message;mmi_eq_set_volume_req_struct*setVolumeLevelReq;Message.oslMsgId= MSG_ID_MMI_EQ_SET_VOLUME_REQ;//Message ID, reference the l4a.h filesetVolumeLevelReq= OslConstructDataPtr(sizeof(mmi_eq_set_volume_req_struct));//Create local parameter buffersetVolumeLevelReq->volume_type = volume_type;setVolumeLevelReq->volume_level = volume_level;Message.oslDataPtr= (oslParaType*)setVolumeLevelReq; //Local parameter buffer Message.oslPeerBuffPtr= NULL; //Peer parameter bufferMessage.oslSrcId=MOD_MMI; //Send from Source moduleMessage.oslDestId=MOD_L4C; //Send to destination moduleOslMsgSendExtQueue(&Message); //Send to L4 task}MMI Architecture...HandlerFrameworkEvent HandlerFile System ManagementNVRAM AccessOSL WrapperHistory ManagerMMI QueueL4QueueLayer 4 / Network SimulatorUI LayerApplication...Call ManagerInstant MessageVideo CalendarFile ManagerCamera Alarm Function ListCategory ScreensTimer FuncRequest TimerRegister HandlerImageFont ThemeGraphics LibraryGDIInterface Operating System (Nucleus)R e s o u r c e T a b l eKeyPixtel InterfaceCore Functionality Provided by FrameworkOSL wrapper : make MMI code adaptive QueueTimerManagement of event handlerScreen management –History mechanismNVRAM accessFile system managementProvides OS abstractionProvides OS abstractionProvides wrappers to all operating system dependent calls to be made by the application.Queue¾QueueGprot.hTimer¾WrapperGprot.h¾MMIFrameworkComponents.pdfQueueExternal queue(Inter-task queue, mod to mod(In the diff task)) Reseive message:OslReceiveMsgExtQ(receive_msg_ext_q)Send message:OslMsgSendExtQueue(msg_send_ext_queue) Implement: mcu\adaptation\src\stack_ltlcom.cInternal queue(Intra-task queue, mod to mod(In the same task)) Reseive message:receive_msg_int_qSend message:msg_send_int_queueImplement: mcu\adaptation\src\stack_ltlcom.cCircular queue(MMI only, default size 30)Reseive message (From MMI Task):OslReadCircularQSend message (For NVRAM Access):OslWriteCircularQImplement: mcu\plutommi\MMI\Framework\Osl\OslSrc\Queue.cTimer Usage for MMI AppsStack TimerKAL serviceskal _XXX_timer () …Event Schedulerevshed _XXX_event () …L4StartTimer ()L4StopTimer () …OslStartSoftTimer ()OslStopSoftTimer () …MMI AppsEventGprot.h EventGprot.h StartTimer ()StopTimer () …StartMyTimer ()StopMyTimer () …WrapperGprot.h WrapperGprot.h WrapperGprot.hWrapperGprot.h WIN32OslIntStartSoftTimer ()OslIntStopSoftTimer () …L4Dr.hL4Dr.h event_shed.hevent_shed.h stack_timer.h stack_timer.h stack_XXX_timer () …kal_release.hkal_release.hEvent HandlersEvent HandlersRegisters and executes application call backs for various eventsProtocol events¾the basic event¾Indicate by unique protocol event IDKey events¾One kind of protocol eventHighlight events¾Man-made event, base on key event¾Associated with hint infoFramework Layer Layer4/NS MSGSet handlerApplication LayerSet handlerExcClearclearExcprotocolEventHandlereventID entryFuncPtrFigure. Protocol Event HandlerSet Event Handler:void SetProtocolEventHandler(PsFuncPtr funcPtr, U16 eventID){protocolEventHandler[countOfProtocolEvent].eventID= eventID;protocolEventHandler[countOfProtocolEvent].entryFuncPtr= funcPtr;}Execute Event Handler:void ExecuteCurrProtocolHandler(U16 eventID,void* MsgStruct,intmod_src, void* peerBuf){PsExtPeerFuncPtr currFuncPtr=(PsExtPeerFuncPtr)protocolEventHandler[count].entryFuncPtr;(*currFuncPtr)(MsgStruct, mod_src, peerBuf);}Event ID:Seeplutommi\mmi\AsyncEvents\AsyncEventsInc\ProtocolEvent s.hkey downKey repeatLong press key up TYPE CODELayer 4 / NSFramework LayerApplication LayerMSGExcExcExcSet key handlerprotocolEventHandlereventIDentryFuncPtr L4KeyHandleSet key handlerClearClearFigure. Key Event HandlerKey Press Event:Set Key Event Handler:void SetKeyHandler(FuncPtr funcPtr, U16 keyCode, U16 keyType){currKeyFuncPtrs[keyCode][keyType] = funcPtr;}Execute Key Event Handler:void ExecuteCurrKeyHandler(S16 keyCode, S16 keyType){(*currKeyFuncPtrs[keyCode][keyType])}KEY_REPEATKEY_LONG_PRESS KEY_EVENT_UP KEY_EVENT_DOWN KEY TYPEKEY_ENDKEY_SENDKEY_RIGHT _ARROWKEY_WAP | KEY_ENTER |KEY_IPKEY_DOWN_ARROWKEY_LEFT _ARROW KEY_RSKKEY_UP_ARROW KEY_POUNDKEY_0KEY_STARKEY_9KEY_8KEY_7KEY_6KEY_5KEY_4KEY_3KEY_2KEY_1KEY_CLEARKEY_LSKKEY CODEKEY_QUICK_ACS |KEY_CAMERAKEY_VOL_DOWNKEY_VOL_UP L4C QueueSend Key Press MsgProtocol Stack/L4MMI keypad bufApp ScreenRead Key Press MsgCall Event HandlerKey press events flow[keyCode, keyType][keyCode, keyType]ExecuteCurrKeyHandlerRefer files:Keypad_def.c, Kbd_table.hHighlight EventsFigure. Highlight HandlerLayer 4 / NSFramework LayerMSGApplication Layer — Main MenuCategory ScreenBusiness Logicstandard_animated_matrix_highlight_handler_type2ExecuteCurrHiliteHandler_Exthighlight_mainmenu_phonebookRegisterHighlightHandlerregister_fixed_matrix_highlight_handler SetHiliteHandlerMMI_list_highlight_handlerExecute handlerMMI_matrix_highlight_handler MMI_circular_3D_highlight_handlerFunction Entry maxHiliteInfoMMI_fixed_list_menu Menu Control Block MMI_fixed_matrix_menuprotocolEventHandlerL4KeyHandleeventIDentryFuncPtr key downKey repeatLong press key up TYPE CODEHistory ManagerHistory ManagerHelps application maintain screen flow and store intermediate data.typedef struct_historyNode{U16 scrnID;FuncPtr entryFuncPtr;U8 *inputBuffer;U8 *guiBuffer;} historyNode;Structure of history nodeScreen ID -of screen to be savedEntry Function Pointer –to redraw the screenInput Buffer –to save running text data for this screenGUI Buffer –to save UI related information for this screenHistory mechanismEntry new screen function: {EntryNewScreen():ClearAllInterruptEventHandler AddHistory()Entry Function Screen ID Gui Buffer OldExitFunction()ClearAllKeyHandler()Draw screenRegister new key handler}Go back history function:{EntryFunctiondecrement //Delete top screen}Please refer to “EntryNewScreen”Screen History Idle ScreenScreen 1Screen 2Top Screen:Entry Function Screen ID History BufferOther Data History buffer Event Handler Screen ID Exit Function Entry Function Curr Screen Other DataGui buffer Event Handler Screen ID Exit Function Entry Function New Screen delete SetRightSoftkeyFunction(GoBackHistory,KEY_EVENT_UP);History API ListEntryNewScreenU16 newscrnIDFuncPtr newExitHandlerFuncPtr newEntryHandler: NULL, if do not want add the new screen to history later void *peerBufAddHistory50Max capacity of history stack isOther APIDelete nodes from historyDelete ‘N’nodes from historyGo back ‘N’nodes in historyRetrieve history for a screenRetrieve input buffer for screenRetrieve UI buffer for screenDetail please refer to : \plutommi\MMI\Framework\History\HistoryInc\HistoryDef.hNVRAM AccessNVRAM AccessProvides wrappers for data storage and retrieval of data from NVRAM.Value¾ReadValue(nId,pBuffer,nDataType,pError);¾WriteValue(nId,pBuffer,nDataType,pError);Record¾WriteRecord(nFileId,nRecordId,pBuffer,nBufferSize,pError);¾ReadRecord(nFileId,nRecordId,pBuffer,nBufferSize,pError);NVRAM_Configuration_Guide_User.pdfNVRAM_Configuration_Guide_User.pdfFile System ManagementFile System ManagementProvides wrappers for data storage and retrieval of data from File SystemAPI¾Int FS_Open(const WCHAR * FileName, UINT Flag);¾int FS_Close(FS_HANDLE FileHandle);¾int FS_Read(FS_HANDLE FileHandle, void * DataPtr, UINT Length, UINT * Read);¾int FS_Write(FS_HANDLE FileHandle, void * DataPtr, UINT Length, UINT *Written);¾int FS_Seek(FS_HANDLE FileHandle, int Offset, int Whence);¾int FS_Delete(const WCHAR * FileName);¾int FS_GetFileSize(FS_HANDLE FileHandle, UINT * Size);FileSystem_Document_20050216_W05.09.pdfFileSystem_Document_20050216_W05.09.pdfUICategory ScreenCategory FunctionsThe category layer consists of a set of functions that an applicationcan use to define its User Interface.Each Category screen contains the following functions:Function to enter (display)Function to exitFunction to get the size of HistoryFunction to get the HistoryMMI ResourceImage, Audio, Strings, Fonts, Themes, Menu Tree.Category screen mechanismEvery category screen has a set of functions :ShowCategoryXXXScreen¾Register event handler ¾Pre-process UI element ¾Call redraw functionRedrawCategoryXXXScreen¾Draw screen using GDI functionsExitCategoryXXXScreen¾Reset function pointer¾Other operation depend on vary screensGetCategoryXXXHistorySize¾Be used to return the size of gui buffer & input bufferGetCategoryXXXHistory¾Be used to return the data of gui buffer & input bufferGetCategoryXXXData¾Be used to return input bufferExample: GetCategory157Data, GetCategory200Historyset_list_menu_category_history, get_list_menu_category_historyExample:void ShowCategory1Screen (STRING_ID Title,IMAGE_ID TitleIcon,STRING_ID LSKLabel,IMAGE_ID LSKIcon,STRING_ID RSKLabel,IMAGE_ID RSKIcon,INT NumberOfItems,STRING_ID*ListOfItems,BYTE*HistoryBuffer );Screen examplecategory3screencategory1screen category2screen ……ExitCategoryXXXScreen RedrawCategoryXXXScreen GetCategoryXXX1HistorySizeGetCategoryXXXHistory ShowCategoryXXXScreen ……CategoryXXX screen Category ScreenShowCategoryXXXScreen:{Init XXXScreen data;RedrawCategoryXXXScreen;}RedrawCategoryXXXScreen:{draw_title();show_fixed_list();show_left_softkey();show_right_softkey();}pixtel_UI_show_imagepixtel_UI_fill_rectangleCommon Screen:MMI ResourcesImages Audio Strings Fonts ThemesMenu TreeBMP PBM GIF JPEG MPEGimy midi mmf mp3mp4English S.Chinese T.Chinese Thai Arabic …8x913x1415x16ASCII Graphic 13x1411x1223x2415x16128x128128x160176x22096x64C 64x96C MMI Resources (1/5 :classification)Color SchemeButton Scrollbar Edit Icons Foreground BackgroundUI ObjectsImageList Text Font Main-menuSub-menuPhonebookSettings MessagesProfiles GamesCall HistoryServices Organizer MultimediaTitleStringStep 1: add string to ref_list.txtStep 2: add string ID to ENUM associated with appStep 3: using macro ADD_APPLICATION_STRING2Step 4: S8* my_string = GetString(MY_STR_ID);Using APP_BASE to guarantee the uniqueness of string ID ImageStep 1: put images in the folder assigned to appStep 2: add image ID to ENUM associated with appStep 3: using macro ADD_APPLICATION_STRING2Step 4: using image ID directly as parameterUsing APP_BASE to guarantee the uniqueness of image IDMenuParent menuUnique menu item IDHilite function and LSK handlerAssociated with screenAudioSkin LayoutAudio playerCalculatorFMRadioTheme Fonts TOOLS:MCT, MCU\tools\AudioResGen TOOLS:MCT, MCU\tools\AudioResGenMMI Resource (4/5 : Macro)ADD_APPLICATION_STRING2(STR_CAL_MONTH,"M","Chinese month");String ID, Value, DescriptionADD_APPLICATION_IMAGE2(IMG_CAL_ON,CUST_IMG_BASE_PATH"\\\ \EmptyImage.bmp","Icon for On Button.");Image ID, Path, DescriptionADD_APPLICATION_MENUITEM((MENU_CAL_TYPE, /* Menu ID */ORGANIZER_CALENDER_MENU, /* Parent ID*/1, /* Child number*/MENU_ID_CHILD_1, /* Child ID */SHOW, /* Hide or show*/NONMOVEABLE, /* Move attribute*/DISP_LIST, /* Display attribute*/CAL_STRING_LUNAR, /* String ID*/0)); /* ICON ID*/MMI Resource (5/5)World Clock Map Skin LayouterTheme Generator Audio Generator Font Merger,Font Splitter,Font Viewer,Font Customizer Preview Verify ImageMCT TOOL Mcu\tools\AudioResGen\*.*resource_audio.c resource_audio.h resource_audio.obj Audio City_Database.txt, City_Database_Coord.txt,Map, ref_list.txtplutommi\Customer\Images\PLUTO176X220\MainLCD\Video plutommi\Customer\Images\PLUTO176X220\MainLCD\FMRadio plutommi\Customer\Images\PLUTO128X160\MainLCD\Camera plutommi\Customer\Images\ProjectName\MainLCD\AudioPlayer New or old XXX.thm filepluto_large.bdf pluto_medium.bdf Pluto_small.bdf …….IDs: mcu\plutommi\mmi\AppXXX_dir\inc\AppXXXDef.hPopulate:mcu\plutommi\Customer\Res_MMI\Res_AppXXX.c String files : Mcu\\plutommi\Customer\CustResource\ref_list.txt IDs: mcu\plutommi\mmi\AppXXX_dir\inc\AppXXXDef.hPopulate:mcu\plutommi\Customer\Res_MMI\Res_AppXXX.cImage files : Mcu\plutommi\Customer\Images\IDs: mcu\plutommi\mmi\AppXXX_dir\inc\AppXXXDef.hPopulate:mcu\plutommi\Customer\Res_MMI\Res_AppXXX.cPRIMAL FILEStandaloneRes.cgui_wrapper.c CustMiscData.c resource_world_clock_city.c resource_video_skins.c resource_fmradio_skins.c resource_camera_skins.c resource_audply_skins.c themecomponents.h, ThemeRes.cresource_font_jtbl.c FontType.c FontRes.c,L_1_Large.h,L_1_Medium.h……CustMenuRes.c resource_str_jtbl.c CustStrMap.c CustStrRes.c resource_image_jtbl.c CustImgMap.c CustImgRes.c,custimgdatahw.h SOURCE FILEStandaloneRes.objgui_wrapper.obj resource_video_skins.obj resource_world_clock_city.obj resource_fmradio_skins.obj resource_camera_skins.objresource_font_jtbl.objFontType.obj resource_str_jtbl.objCustStrMap.obj resource_image_jtbl.obj CustImgMap.obj CustMiscData.objOtherresource_audply_skins.obj App ResourceThemeRes.objThemesFontRes.objFontsCustMenuTree_Out.c CustMenuTreeID_Out.cCustMenuRes.obj Menusenum_list.hCustResList_out.txtCustStrRes.objStringsCustImgRes.objImagesTEMPORARY FILECOMPONENTCLASS。
、|!_一个人总要走陌生的路,看陌生的风景,听陌生的歌,然后在某个不经意的瞬间,你会发现,原本费尽心机想要忘记的事情真的就这么忘记了..MTK手机驱动培训资料【驱动部门的主要任务】驱动部门的主要任务是调试软件,让软件在硬件上顺利的跑起来。
其中包括各个具体的器件的调试以及一些和底层相关的问题,以及其他不属于mmi部分的问题。
具体的包括:1、LCD的调试:一般LCD厂商在提供样品的时候,都会提供给初始化代码,服务更好的还会提供进入和退出SLEEP的代码,如果厂商不提供的话,就只有看着文档自己写了。
我们的工作一般是调节显示效果以及和厂商沟通,还有就是把厂商给的代码整合进程序里面去。
Lcd驱动程序相关的文件主要包括lcd.c,lcd_sw.h以及lcd_sw_inc.h。
调节LCD的驱动程序,最先要在lcd_sw_inc.h中修改lcd的尺寸,就是LCD_WIDTH 和LCD_HEIGHT,如果有小屏的话还要定义下面的小屏的lcd的尺寸。
然后,根据硬件的设计修改lcd_sw.h中的宏,来确定lcd是使用8位的还是16位的接口,比如使用16位的lcd接口,就定义宏MAIN_LCD_16BIT_MODE。
最后,移植厂商给的初始化代码进入到初始化函数里,还有进入和退出Sleep状态。
进入和退出Sleep状态要求重新进入Sleep状态后屏幕能正常的显示,退出Sleep状态要求LCD 的耗电小于0.1ma。
如果是CSTN的屏幕,那么还有一个对比度的参数需要设定。
有2个对比度的值,一个是在初始化函数中写进去的一个值,还有一个是在nvram_user_config.c中的结构NVRAM_EF_CUST_HW_LEVEL_TBL_DEFAULT中定义。
2、GPIO的设定:GPIO就是General purpose IO pin的意思,是一些能用做一般的功能控制的IO引脚。
MTK 芯片的引脚一般有四个功能选项,可以通过寄存器来控制各个引脚的功能,一般功能0就是表示这个引脚用做GPIO。