stst158的個(gè)人空間 http://selenalain.com/space-uid-5764.html [收藏] [復制] [RSS]

博客

李現路:MTK開(kāi)發(fā)中怎么建立一個(gè)獨立的模塊

已有 1912 次閱讀2009-11-28 10:33 |個(gè)人分類(lèi):FPGA培訓|

李現路:MTK開(kāi)發(fā)中怎么建立一個(gè)獨立的模塊   Post By:2009-11-24 10:03:16
 
李現路:MTK開(kāi)發(fā)中怎么建立一個(gè)獨立的模塊
 
具體步驟如下:
1../plutommi/mmi 目錄先建一個(gè)HelloWorld文件夾
文件夾下的子文件夾:Inc,Res,Src
2.在Inc文件夾中放四個(gè)頭文件,四個(gè)頭文件分別以xxxDefs.h,xxxGprot.h
xxxProt.h,xxxTypes.h來(lái)命名
 
3.xxxDefs.h--本模塊用到的資源 ID的定義
  xxxGprot.h--本模塊的對外接口,供模塊外部調用的函數原型在此申明
  xxxProt.h---模塊內部接口,供模塊內部調用的函數原型在此申明
  xxxTypes.h--本模塊用到的一些常量、自定義數據類(lèi)型、結構的定義
 
4.在HelloWorld.c中定義開(kāi)關(guān)(方便我們隨時(shí)調用):
#ifdef __MMI_HELLOWORLD_ENABLED__ , 
  #endif


 我們建立的文件夾里,所有頭文件和源文件的內容如下:
 
          頭文件 HelloWorldGprot.h 的內容如下:
/*************************************************************************/
#ifndef __HELLOWORLD_GPROT_H__
#define __HELLOWORLD_GPROT_H__
#include "PixtelDataTypes.h"
#include "HelloWorldTypes.h"
extern void mmi_HelloWorld_entry(void);
#endif
/*************************************************************************/
 
頭文件 HelloWorldProt.h 的內容的如下:
/*************************************************************************/
#ifndef __HELLOWORLD_GPROT_H__
#define __HELLOWORLD_GPROT_H__
#include "PixtelDataTypes.h"
#include "HelloWorldTypes.h"
extern void mmi_HelloWorld_entry(void);
#endif
/*************************************************************************/
HelloWorldTypes.h, HelloWorldDefs.h 兩個(gè)頭文件的內容為空即可,但是一定要建立文
件,否則后面編譯會(huì )出錯。
HelloWorld.c 的內容如下:
/*************************************************************************/
#include "stdC.h"
#include "MMI_Features.h"
#include "L4Dr.h"
#include "L4Dr1.h"
#include "AllAppGprot.h"
#include "FrameworkStruct.h"
#include "GlobalConstants.h"
#include "EventsGprot.h"
#include "mmiappfnptrs.h"
#include "HistoryGprot.h"
#include "HelloWorldProt.h"
#include "HelloWorldTypes.h"
#include "HelloWorldDefs.h"
#include "MainMenuDef.h"
#include "wgui_categories.h"
#include "Unicodexdcl.h"
void mmi_HelloWorld_exit(void);
void mmi_HelloWorld_entry(void)
{
#ifdef __MMI_HELLOWORLD_ENABLED__
/* 強制退出當前屏幕,之后進(jìn)入到我們的模塊了 */
/* 上電缺省是idle 屏幕,現進(jìn)入MAIN_MENU_SCREENID 屏 */
/* 注意看第二個(gè)參數,這個(gè)是當我們模塊被強制退出時(shí)執行的一些操作 */
EntryNewScreen(MAIN_MENU_SCREENID, mmi_HelloWorld_exit, NULL, NULL);
entry_full_screen(); /* 關(guān)掉屏幕頂部的狀態(tài)條,我們要用整個(gè)屏幕 */
clear_screen(); /* 擦除當前背景 */
gui_move_text_cursor(50, 100); /* 移動(dòng)文本輸出光標 */
gui_set_text_color(UI_COLOR_RED); /* 設置字體顏色 */
gui_print_text(L"Hello, World"); /* 輸出文本到顯示緩沖, 注意是Unicode 編碼 */
/* 刷新屏幕顯示,MMI 用的是雙緩沖繪圖方式,而且需要顯式刷新 */
gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
/* 注冊一個(gè)按鍵處理,右軟鍵彈起時(shí)返回到之前被我們強制退出的模塊 */
SetKeyHandler(GoBackHistory, KEY_RSK, KEY_EVENT_UP);
#endif
}
/* 模塊出口
* 當我們的模塊被其他模塊強制退出時(shí)會(huì )執行這個(gè)函數,
* 這個(gè)函數的常見(jiàn)寫(xiě)法,包括:
* 1、模塊已申請資源的釋放(如果需要的話(huà)),這一步可選
* 2、手動(dòng)把自己壓棧到窗口(實(shí)際是整個(gè)屏)堆棧里面,
* 便于強制我們退出的模塊執行完后重新把我們叫出來(lái)
* 不像Window 的窗口管理是自動(dòng)壓棧的,Pluto MMI 需要手動(dòng)壓棧
* 3、其他一些清理動(dòng)作
*/
void mmi_HelloWorld_exit(void)
{
#ifdef __MMI_HELLOWORLD_ENABLED__
history currHistory;
S16 nHistory = 0;
currHistory.scrnID = MAIN_MENU_SCREENID;
currHistory.entryFuncPtr = mmi_HelloWorld_entry;
pfnUnicodeStrcpy( (S8*)currHistory.inputBuffer, (S8*)&nHistory);
AddHistory(currHistory);
#endif
}
 
5.MainMenu.c放的代碼
 
#ifdef __MMI_HELLOWORLD_ENABLED__
mmi_HelloWorld_entry();
return;
#else
 
.......
 

#endif
 
6.修改相關(guān)的系統文件,使這個(gè)模塊成為成為整個(gè)項目的一部分:
 修改./make/plutommi下的3個(gè)文件:
 plutommi.inc---所有mmi部分的頭文件所在目錄的相對路徑列表
 plutommi.lis---所有mmi部分的源文件(相對路徑)列表
 plutommi.pth---所有mmi部分的源文件所在目錄的相對路徑列表
 
 plutommi.inc里加(頂部):
 plutommi\mmi\HelloWorld\Inc
 
 plutommi.lis里加(頂部):
 plutommi\mmi\HelloWorld\Src\HelloWorld.c
 
 plutommi.pth里加(頂部):
 plutommi\mmi\HelloWorld\Src
 
7.把開(kāi)關(guān)加入系統:
  \plutommi\Customer\CustResource\PLUTO_MMI\MMI_featuresPLUTO.h
  (mmi的配置文件)
 
  [Framework]: Languages 下加:
  #define __MMI_HELLOWORLD_ENABLED__
8.讓模擬器找到頭文件:
  在\plutommi\mmi\GlobalSimulatorPathDef 的頂部添加以下內容:
  /I ".\HelloWorld\Inc"
 
9.在cmd中,在源代碼根目錄下執行命令:make update
  編譯完成后再在vc在運行run
 
  錯誤可在build\NEOTEL25_06B\log找相關(guān)信息

關(guān)于我們  -  服務(wù)條款  -  使用指南  -  站點(diǎn)地圖  -  友情鏈接  -  聯(lián)系我們
電子工程網(wǎng) © 版權所有   京ICP備16069177號 | 京公網(wǎng)安備11010502021702
返回頂部
午夜高清国产拍精品福利|亚洲色精品88色婷婷七月丁香|91久久精品无码一区|99久久国语露脸精品|动漫卡通亚洲综合专区48页