Car DVD Setup Module User Manual -...
Transcript of Car DVD Setup Module User Manual -...
Car DVD Setup Module User Manual V0.2 – Jan 31, 2008
19, Innovation First Road • Science Park • Hsin-Chu • Taiwan 300 • R.O.C.
Tel: 886-3-578-6005 Fax: 886-3-578-4418 Web: www.sunplus.com
© Sunplus Technology Co., Ltd. PAGE 1 V0.2 – Jan 31, 2008
Important Notice
SUNPLUS TECHNOLOGY CO. reserves the right to change this documentation without prior notice. Information
provided by SUNPLUS TECHNOLOGY CO. is believed to be accurate and reliable. However, SUNPLUS
TECHNOLOGY CO. makes no warranty for any errors which may appear in this document. Contact SUNPLUS
TECHNOLOGY CO. to obtain the latest version of device specifications before placing your order. No
responsibility is assumed by SUNPLUS TECHNOLOGY CO. for any infringement of patent or other rights of third
parties which may result from its use. In addition, SUNPLUS products are not authorized for use as critical
components in life support systems or aviation systems, where a malfunction or failure of the product may
reasonably be expected to result in significant injury to the user, without the express written approval of Sunplus.
© Sunplus Technology Co., Ltd. PAGE 2 V0.2 – Jan 31, 2008
Revision History
Revision Date By Remark Page Number(s)
V 0.1 2008/01/04 Wangmin Firs Edition 20
V0.2 2008/01/31 Wangmin Add “How to add a new setup item” (page11-17) 36
© Sunplus Technology Co., Ltd. PAGE 3 V0.2 – Jan 31, 2008
Table of Content
PAGE
1 Introduction................................................................................................................................5
1.1 General Description...............................................................................................................5 2 Data Struct Introduce ................................................................................................................5
2.1 数据存储结构:.....................................................................................................................5
2.2 线索(Clue)查找结构:.........................................................................................................6
2.3 Setup Menu操作结构 .............................................................................................................7
2.4 Setup_TreeNode ...................................................................................................................7 3 Struct Design Explain ...............................................................................................................8
3.1 Setup_Node_xxx ...................................................................................................................8
3.2 Setup_Clue............................................................................................................................8
3.3 Setup_Node_xxx与Setup_Clue之间的关系 ...........................................................................8
4 How To Add A New Setup Item ..............................................................................................10
4.1 Introduce .............................................................................................................................10
4.2 Methods...............................................................................................................................10 5 User Interface Function...........................................................................................................17
5.1 Get_SetupTreeRoot ............................................................................................................17
5.2 Get_SetupTreeNode ...........................................................................................................17
5.3 Set_SetupTreeNode_DirectionAttribute_Direction ..............................................................18
5.4 Set_SetupTreeNode_DirectionAttribute_NodeType ............................................................19
5.5 Get_SetupTreeNode_DirectionAttribute ..............................................................................20
5.6 Get_SetupTreeNode_Parent ...............................................................................................21
5.7 Get_SetupTreeNode_FristChild ..........................................................................................22
5.8 Get_SetupTreeNode_PrevBrother ......................................................................................23
5.9 Get_SetupTreeNode_NextBrother ......................................................................................24
5.10 Traverse_SetupTree_FristChildPageDraw........................................................................25
5.11 Traverse_SetupTree_AllChildDraw ...................................................................................26
5.12 Traverse_SetupTree_LevelDraw.......................................................................................27
5.13 Traverse_SetupTree_Brother_EndIDDraw........................................................................27
5.14 Traverse_SetupTree_EndNodeIDDraw.............................................................................28
5.15 Get_PageFristNodeID .......................................................................................................29
5.16 Is_MultiPageBrother_SetupTree .......................................................................................30
5.17 Traverse_SetupTree_Brother_LevelDraw .........................................................................30
© Sunplus Technology Co., Ltd. PAGE 4 V0.2 – Jan 31, 2008
5.18 Traverse_SetupTree_BrotherParent_LevelDraw...............................................................31
5.19 Traverse_SetupTree_BrotherChild_LevelDraw .................................................................31
5.20 Is_FristPage_SetupTree....................................................................................................32
5.21 Is_LastPage_SetupTree....................................................................................................33
5.22 Traverse_SetupTree_PrevBrotherPage_Draw..................................................................33
5.23 Traverse_SetupTree_NextBrotherPage_Draw..................................................................34
5.24 Car_Setup_Exe .................................................................................................................35 6 Limits and Suggestions ..........................................................................................................36
© Sunplus Technology Co., Ltd. PAGE 5 V0.2 – Jan 31, 2008
1 Introduction
1.1 General Description
This guide describes the functionality and user API of Setup Module for SPHE8202T CAR DVD system.
2 Data Struct Introduce
2.1 数据存储结构:
Struct: Typedef struct {
SETUP_BUTTON button_position; void (*Draw_Node)( Setup_Node *pSetup_Node); //draw setup node itself
void (*Touch_Execute_Function)(UINT32 gEvent_ID); //execute function when //touch key
int ParentNode_ID; // The parent node’s ID in gSetup_Node[] int ChildClue_ID; // The frist child’s ID in the gSetup_Clue[], help us to find out
//the other child node of the gSetup_Node[] UINT8 DrawArea; //This node is drawn in which area of the screen: Dir area?
File Area? RootNode? }Setup_Node_Constant;
Typedef struct {
UINT16 Direction_Attribute; //IR response flag }Setup_Node_Inconstant
Setup_Node_Constant *gSetup_Node_Constant [MAX_SETUP_NODE];
Setup_Node_Inconstant gSetup_Node_Inconstant [MAX_SETUP_NODE];
Attribute Introduce SETUP_BUTTON button_position: 存储当前 node的 Setup按键的响应范围。 void (*Draw_Node) ( Setup_Node *pSetup_Node):
画制当前 Setup Node的 UI。 void (*Touch_Execute_Function)(UINT32 gEvent_ID):
当在该 Node的响应范围内 Touch或 HL在该项上时按下 Select键,执行该项功能。 int ParentNode_ID:
当前 Node的双亲 Node在 gSetup_Node[]中的位置。 int ChildClue_ID:
当前 Node的孩子 Node的线索(Clue)在 gSetup_Clue[]中的 ID。通过这个 Clue链,我们可以找到当前 Node的所有孩子 Node在整个 gSetup_Node[]中位置。
UINT8 DrawArea:
© Sunplus Technology Co., Ltd. PAGE 6 V0.2 – Jan 31, 2008
当前 Node画制在屏幕左边区域,还是在右边区域。 UINT16 Direction_Attribute:
Bit0:上键 enable位 Bit1:下键 enable位 Bit2:左键 enable位 Bit3:右键 enable位 Bit4:Select键 enable位 Bit5、6:上键寻找 ParentNode(00)?ChildNode(01)?BortherNode(10)? Bit7、8:下键寻找 ParentNode(00)?ChildNode(01)?BortherNode(10)? Bit9、10:左键寻找 ParentNode(00)?ChildNode(01)?BortherNode(10)? Bit11、12:右键寻找 ParentNode(00)?ChildNode(01)?BortherNode(10)? Bit13、14:Select键寻找 ParentNode(00)?ChildNode(01)?BortherNode(10)?
注意: Setup_Node_Constant 中放的全都是程序运行中不会改变的属性;Setup_Node_Inconstant中方的全都是程序运行中会改变其值的属性。
Setup_Node_xxx gSetup_Node_xxx[MAX_SETUP_NODE]数组说明: 用来存储所有的 Setup Node信息。gSetup_Node_Constant []和 gSetup_Node_Inconstant [] 的大小相同。gSetup_Node_Constant []存储的是每个 Const 属性 Node 结构体的地址,而gSetup_Node_Constant []本身也是一个 Const类型的指针数组;gSetup_Node_Inconstant []是存储在 Sdram中的全局数组,存储每一个 Node可变的属性值。
2.2 线索(Clue)查找结构:
Struct: Typedef struct { int SetupNode_ID; //The index of this Clue’s Node in gSetup_Node[] int PrevBrotherClue_ID; //Prev Brother Clue index of this node in gSetup_Clue[] int NextBrotherClue_ID; //Next Brother Clue index of this node in gSetup_Clue[] }Setup_Clue;
Setup_Clue *gSetup_Clue[MAX_SETUP_NODE];
Attribute Introduce: int SetupNode_ID: 当前 Clue所代表的 Node在 gSetup_Node[]中的位置。 int PrevBrotherClue_ID:
当前这个 Clue的前一个兄弟 Clue,亦即当前这个 Clue所代表的 Node的前一个兄弟 Node的 Clue在 gSetup_Clue[]的位置。
int NextBrotherClue_ID: 当前这个 Clue的下一个兄弟 Clue,亦即当前这个 Clue所代表的 Node的下一个兄
弟 Node的 Clue在 gSetup_Clue[]的位置。
Setup_Clue gSetup_Clue[MAX_SETUP_NODE]:
© Sunplus Technology Co., Ltd. PAGE 7 V0.2 – Jan 31, 2008
gSetup_Clue[]的大小比 gSetup_Node[]的少一个元素,因为每一个 gSetup_Node[]的Node(除 Root Node外)在 gSetup_Clue[]中都有对应的 Clue去存储这个 Node的兄弟Node线索,通过这个线索我们可以快速的查找到这个 Node的前一个兄弟 Node和下一个兄弟 Node;
Setup_Node.ChildClue_ID 属性将当前 Node 的第一个孩子 Node 的 Clue 在gSetup_Clue[]中的位置记录下来,再结合 Setup_Clue 结构体的线索记录,我们就可以方便的将当前 Node的所有孩子 Node遍历一边。
2.3 Setup Menu操作结构
Struct: Typedef struct {
int HL_NodeID; //Current Highlight Setup Node ID UINT16 CurrentDirPage_LastNodeID; //For current node page operation UINT16 CurrentFilePage_LastNodeID; //For current node page operation
}Setup_Handle;
Attribute Introduce:
该结构体是用来存储一些即时操作和参考的全局变量,用一个结构体来统一管理。 int HL_NodeID:
当前 Highlight项的 Node ID UINT16 CurrentDirPage_LastNodeID:
屏幕左边区域显示的 Node 项可能会大过一页可显示的上限,所以需要分页,这里存储当前页的最后一个 Node的 ID号。方便在翻页时查找需要的信息。
UINT16 CurrentFilePage_LastNodeID:
屏幕右边区域显示的 Node 项可能会大过一页可显示的上限,所以需要分页,这里存储当前页的最后一个 Node的 ID号。方便翻页时查找需要的信息。
2.4 Setup_TreeNode
Struct: typedef struct {
Setup_Node_Inconstant *pSetup_Node_Inconstant; //Node's inconstant part Setup_Node_Constant *pSetup_Node_Constant; //Node's constant part
}Setup_TreeNode;
Attribute Introduce: 该结构体是用来统一管理 gSetup_Node_Constant []和 gSetup_Node_Inconstant []两个数
组的,将分散在两个数组里属于同一个 Node 的属性地址放在一起管理。在有关树的操作中就是先将被操作的 Node 的 gSetup_Node_Constant [NodeID]和 gSetup_Node_Inconstant [NodeID]的地址给了 Setup_TreeNode来管理。
Setup_Node_Inconstant *pSetup_Node_Inconstant:
© Sunplus Technology Co., Ltd. PAGE 8 V0.2 – Jan 31, 2008
当前操作 Node的可变属性指针。 Setup_Node_Constant *pSetup_Node_Constant:
当前操作 Node的不可变属性指针。
3 Struct Design Explain
3.1 Setup_Node_xxx
SYSTEM
TIME
NTSC/PAL
ASPECT
PICTURE ADJUST
PANEL
RADIO AREA
AM 8:30
TIME FORMAT
整个setup menu就是一个树形结构
可以看出来整个 setup menu就是一个树形结构,因此考虑采用某种存储方式来体现这种结 构,并添加索引方便查找以实现 setup menu的操作。因此我们数据结构的设计要满足这个要求。
我们把每一个设置项当作一个数据单元,例如 system是一个数据单元,time是一个数据单
元,Time Format是一个数据单元⋯⋯ 为了方便存储和管理,使用线性空间存储所有的数据单元,即数组 setup_node[]。
3.2 Setup_Clue
考虑到 Touch应用时,需要快速的查找到树中某个结点的双亲或者孩子,我们需要一些线索设计来方便查找动作。
这个线索设计我们采用数据结构中树的存储结构中的一种:双亲孩子表示法。 这种表示法会在 setup_node[]中的每个 node记录该 node的双亲 node在 setup_node[]中的位
置;
这种表示法会在每个 node有一个属性指向另一个数组 setup_clue[],在这个数组中记录它的孩子 node在 setup_node[]中的位置。
3.3 Setup_Node_xxx与 Setup_Clue之间的关系
以下图为一个例子,我们对整个 Setup_Node_xxx和 Setup_Clue数据结构设计做个示例:
© Sunplus Technology Co., Ltd. PAGE 9 V0.2 – Jan 31, 2008
SYSTEM
TIME
NTSC/PAL
AM 8:30
TIME FORMAT
AUDIO OUT
KEY
Aux in
SPEAKER
假设该 setup menu是一个有只有两大项的 setup menu,SYSTEM项下有两项功能选择,SPEAKER
项下有三项功能选择。如上图所示。
整个 setup menu 的数据结构核心为两个数组结点存储数组 setup_node[]和线索数组setup_clue[]。下图是它们的使用示例,以及两个数组之间的联系。
RootMax P Max Setup_Node[1] 0 Setup_Node[6]
SYSTEM0 P
TIME1 P
NTSC/PAL1 P = 0
AM 8:302 P = 0
TIME FORMAT2 P = 0
SPEAKER0 P
AUDIO OUT6 P = 0
KEY6 P = 0
Setup_Node[] Setup_Clue[]
Setup_Node[0]
Setup_Node[1]
Setup_Node[2]
Setup_Node[3]
Setup_Node[4]
Setup_Node[5]
Setup_Node[6]
Setup_Node[7]
Setup_Node[8]
1 Max
Max Setup_Node[2] 2 Setup_Node[3]3 Max
Max Setup_Node[4] 4 Setup_Node[5]5 Max
Max Setup_Node[7]
6 Setup_Node[8]
7
8
7 Setup_Node[9] Max
Aux in6 P = 0Setup_Node[9]
© Sunplus Technology Co., Ltd. PAGE 10 V0.2 – Jan 31, 2008
1 (S Y S T E M )Max 1
6 (S P E A K E R )0 Max
2 (T IM E )Max 3
3 (N T S C /P A L )2 Max
4 (A M 8 :3 0 )Max 5
5 (T IM EF O R M A T )4 Max
7 (A U D IO O U T )Max 7
8 (K E Y )6 8
9 (A u x in )7 Max
Setup_Clue[0]
Setup_Clue[1]
Setup_Clue[2]
Setup_Clue[3]
Setup_Clue[4]
Setup_Clue[5]
Setup_Clue[6]
Setup_Clue[7]
Setup_Clue[8]
Setup_Clue[]
树的双亲表示法说明:
假设以一组连续的空间存储树的结点,同时在每个结点中附设一个指示器指示其双亲结点在链
表中的位置。(Setup_Node[]的 parent_id属性)
树的孩子表示法说明: 把每个结点的孩子结点排列起来,看成是一个线性表,且以单链表作存储结构,则 n 个结点有
n个孩子链表(叶子的孩子链表为空表)。而 n个头指针又组成线性表,为了便于查找,可采用顺序存储结构。
因此双亲孩子表示法,就是两者的组合,只是将孩子表示法中的单链表改为线性存储的空间,
即数组(gSetup_Clue[])存储每个结点的孩子链表信息。
4 How To Add A New Setup Item
4.1 Introduce
了解了 Setup的结构后,可以看出来,每一个 Setup Item都有自己的 Node来描述它的属性和行为,而这些 Node又互不干扰,修改一个 Node的属性或行为都不会影响到其他 Node。从而保证了各自的独立性。下面举例教你如何新增一个 Setup Item。
4.2 Methods
如下的 Setup下
© Sunplus Technology Co., Ltd. PAGE 11 V0.2 – Jan 31, 2008
SYSTEM
NTSC/PAL
AUDIO OUT
KEY
Aux in
SPEAKER
我们在 System下添加一个 Adjust,如下:
SYSTEM
NTSC/PAL
AUDIO OUT
KEY
Aux in
Adjust
SPEAKER
1.添加 Setup_Node_Constant结构体变量并初始化在 car_setup_node_xxx.c中:
const Setup_Node_Constant gRootNode =
{
{1,1,1,1},//SETUP_BUTTON
RootNode_Draw,
RootNode_TouchExecute,
SETUP_NODE_MAX,
SETUP_CLUE_SYSTEM,
SETUP_NULL_AREA,
};
///////////////////////////////SYSTEM SET
const Setup_Node_Constant gSystemNode =
{
{58,134,292,42},//SETUP_BUTTON
© Sunplus Technology Co., Ltd. PAGE 12 V0.2 – Jan 31, 2008
SystemNode_Draw,
SystemNode_TouchExecute,
SETUP_NODE_ROOT,
SETUP_CLUE_SYSTEM_NTSCPAL,
SETUP_DIR_AREA,
};
///////////////////SYSTEM SET-->NTSC/PAL SET
const Setup_Node_Constant gSystemNTSCPALNode =
{
{370,134,290,42},//SETUP_BUTTON
SystemNTSCPALNode_Draw,
SystemNTSCPALNode_TouchExecute,
SETUP_NODE_SYSTEM,
SETUP_CLUE_SYSTEM_NTSCPAL_NTSC,
SETUP_FILE_AREA,
};
///////////////////SYSTEM SET-->Adjust
const Setup_Node_Constant gSystemAdjustNode=
{
{370,178,290,42},//SETUP_BUTTON
SystemAdjustNode_Draw,
SystemAdjustNode_TouchExecute,
SETUP_NODE_SYSTEM,
SETUP_CLUE_MAX,
SETUP_FILE_AREA,
};
SETUP_BUTTON代表的是 Adjust Node画制在屏幕的哪个位置。
SystemAdjustNode_Draw 是 Adjust Node 的画制函数地址,请注意,要在
SystemAdjustNode_Draw()函数中将 Adjust Node的 Touch函数插入到 Touch队列中。
SystemAdjustNode_TouchExecute是 user点击 Adjust时,需要执行的动作函数地址。
© Sunplus Technology Co., Ltd. PAGE 13 V0.2 – Jan 31, 2008
SETUP_NODE_SYSTEM是 Adjust Node的父 Node的在 gSetup_Node_Constant []中的位置。
SETUP_CLUE_SYSTEM_ADJUST_BRIGHTNESS 是 Adjust Node 的第一个孩子在gSetup_Clue []中的位置。
SETUP_FILE_AREA说明该 Node显示在左边列表区域。
2. 添加 Setup_Clue结构体变量并初始化在 car_setup_node_xxx.c中:
const Setup_Clue gSystemClue =
{
SETUP_NODE_SYSTEM,
SETUP_CLUE_MAX,
SETUP_CLUE_DISC,
};
///////////////////SYSTEM SET-->NTSC/PAL SET
const Setup_Clue gSystemNTSCPALClue =
{
SETUP_NODE_SYSTEM_NTSCPAL,
SETUP_CLUE_MAX,
SETUP_CLUE_SYSTEM_ADJUST,
};
const Setup_Clue gSystemAdjustClue=
{
SETUP_NODE_SYSTEM_ADJUST,
SETUP_CLUE_SYSTEM_NTSCPAL,
SETUP_CLUE_MAX,
};
SETUP_NODE_SYSTEM_ADJUST是 Adjust Node在 gSetup_Node_Constant []中的位置。
SETUP_CLUE_SYSTEM_NTSCPAL是 Adjust Node的前一个兄弟在 gSetup_Clue[]中的位
© Sunplus Technology Co., Ltd. PAGE 14 V0.2 – Jan 31, 2008
置。
SETUP_CLUE_MAX是 Adjust Node代表该 Node没有兄弟。
3. gSystemAdjustNode 和 gSystemAdjustClue 的地址都放在 gSetup_Node_Constant []和gSetup_Clue[]中。这样我们就需要知道它们在这两个数组中的位置,我们在 car_setup_node_xxx.h中声明了两个枚举分别对应gSystemAdjustNode在gSetup_Node_Constant []、gSystemAdjustClue在 gSetup_Clue[]中的位置:
enum
{
SETUP_NODE_ROOT = 0,
SETUP_NODE_SYSTEM, //1
SETUP_NODE_SYSTEM_NTSCPAL, //2
SETUP_NODE_SYSTEM_ADJUST, //3
……
}
enum
{
SETUP_CLUE_SYSTEM = 0,
SETUP_CLUE_SYSTEM_NTSCPAL, //1
SETUP_CLUE_SYSTEM_ADJUST, //2
……
}
因此 gSystemAdjustNode 和 gSystemAdjustClue 在 gSetup_Node_Constant []和gSetup_Clue[]中的位置分别如下:
Setup_Node_Constant *gSetup_Node_Constant[SETUP_NODE_MAX] =
{
(Setup_Node_Constant*)(&gRootNode), // SETUP_NODE_ROOT
(Setup_Node_Constant*)(&gSystemNode), // SETUP_NODE_SYSTEM
(Setup_Node_Constant*)(&gSystemNTSCPALNode),// SETUP_NODE_SYSTEM_NTSCPAL
(Setup_Node_Constant*)(&gSystemAdjustNode),// SETUP_NODE_SYSTEM_ADJUST
……
© Sunplus Technology Co., Ltd. PAGE 15 V0.2 – Jan 31, 2008
}
Setup_Clue *gSetup_Clue[SETUP_NODE_MAX] =
{
(Setup_Clue*)(&gSystemClue), // SETUP_CLUE_SYSTEM
(Setup_Clue*)(&gSystemNTSCPALClue), // SETUP_CLUE_SYSTEM_NTSCPAL
(Setup_Clue*)(&gSystemAdjustClue), // SETUP_CLUE_SYSTEM_ADJUST
……
}
注意 1:SETUP_CLUE_SYSTEM_ADJUST的值必须与 gSystemAdjustClue在 gSetup_Clue[]中的位置一致。同理 SETUP_NODE_SYSTEM_ADJUST 的值也必须与 gSystemAdjustNode 在gSetup_Node_Constant[]中的位置一致。
注意 2:gSystemAdjustClue和 gSystemAdjustNode中的有关父 Node和兄弟 Node的位置信息一定要根据实际情况初始化对,即它们在 gSetup_Node_Constant[]和 gSetup_Clue[]中的位置一致。
4. 在 car_setup_node_function_xxx.c 中 声 明 SystemAdjustNode_Draw ( ) 和
SystemAdjustNode_TouchExecute()函数。
5. 在 car_setup_exe.c中 Car_Setup_Exe()中添加 Adjust Node的执行函数,示例如下:
void Car_Setup_Exe(BYTE index, BYTE value, BYTE record)
{
switch(index)
{
case SETUP_VA_TV_SYS:
Car_Setup_Exe_TV_SYS(value,record);
break;
case SETUP_VA_SSAVER:
Car_Setup_Exe_SSAVER(value,record);
break;
……
case SETUP_VA_BRIGHTNESS:
© Sunplus Technology Co., Ltd. PAGE 16 V0.2 – Jan 31, 2008
Car_Setup_Exe_BRIGHTNESS(value,record);
break;
case SETUP_VA_CONTRAST:
Car_Setup_Exe_CONTRAST(value,record);
break;
case SETUP_VA_HUE:
Car_Setup_Exe_HUE(value,record);
break;
case SETUP_VA_SATURATION:
Car_Setup_Exe_SATURATION(value,record);
break;
……
}
}
SETUP_VA_BRIGHTNESS 等代表的是对应的 Value 存储在 24c0x 中的位置。它们定义在Car_setup_VA.h中。
6. 在 car_setup_node_xxx.c 中 Set_Default_Val[MAX_SETUP_VA]设置 Setup 中各个功能的默认设置。将功能 Value 存储在 SETUP_VA_xxx 对应的位置上,其 Value 则定义在car_setup_node_ValueMap_standard.h中。
const BYTE Set_Default_Val[MAX_SETUP_VA]=
{
SETUP_VAL_NTSC, // TV_SYS
SETUP_VAL_SAVER_ON, // SSAVER
……
6, // SETUP_VA_BRIGHTNESS
6, // SETUP_VA_CONTRAST
6, // SETUP_VA_HUE
0, // SETUP_VA_SATURATION
……
}
© Sunplus Technology Co., Ltd. PAGE 17 V0.2 – Jan 31, 2008
以上说明中,car_setup_node_function_xxx.c、car_setup_node_xxx.c、car_setup_node_xxx.h文件在 Sunplus 的 Release code 中由 car_setup_node_function_standard.c、car_setup_node_ standard.c、car_setup_node_ standard.h来实现,这是 Sunplus公版 Code的定义。建议客户另建立这三个文件在 car_setup_node.c、car_setup_node.h替代(include)它们。
5 User Interface Function
5.1 Get_SetupTreeRoot
Get SetupTree’s Root Node.
Function Required Header
Get_SetupTreeRoot car_setup_tree.h
int Get_SetupTreeRoot(Setup_TreeNode *pSetup_TreeNode);
Parameter
pSetup_TreeNode
Pointer to the target node’s struct content
Return Values
Errors
Example
#include " car_setup_tree.h "
int main(void) {
Setup_TreeNode gSetup_TreeNode;
Int iRes = 0;
iRes = Get_SetupTreeRoot(&gSetup_TreeNode);
if(gSetup_TreeNode.pSetup_Node_Constant->Draw_Node) gSetup_TreeNode.pSetup_Node_Constant->Draw_Node(gSetup_TreeNode.pSetup_Node_Inconstant,gSetup_TreeNode.pSetup_Node_Constant);
}
5.2 Get_SetupTreeNode
Get target node of setup tree according to NodeID.
© Sunplus Technology Co., Ltd. PAGE 18 V0.2 – Jan 31, 2008
Function Required Header
Get_SetupTreeNode car_setup_tree.h
int Get_SetupTreeNode(Setup_TreeNode *pSetup_TreeNode, UINT32 SetupArrayID)
Parameter
pSetup_TreeNode
Pointer to the target node’s struct content
SetupArrayID
The index of the target Node in the setup_node_xxx[].
Return Values
Errors
Example
#include " car_setup_tree.h "
Void main()
{
Setup_TreeNode gSetup_TreeNode;
Int iRes = 0;
iRes = Get_SetupTreeNode (&gSetup_TreeNode,1);
if(gSetup_TreeNode.pSetup_Node_Constant->Draw_Node) gSetup_TreeNode.pSetup_Node_Constant->Draw_Node(gSetup_TreeNode.pSetup_Node_Inconstant,gSetup_TreeNode.pSetup_Node_Constant);
}
5.3 Set_SetupTreeNode_DirectionAttribute_Direction
Set target tree node’s DirectionAttribute’s IR direction.
Function Required Header
Set_SetupTreeNode_DirectionAttribute_Direction car_setup_tree.h
int Set_SetupTreeNode_DirectionAttribute_Direction(Setup_TreeNode *pSetup_TreeNode, UINT16 DirectionEnable, UINT8 SetOrClear);
Parameter
pSetup_TreeNode
Pointer to the target node’s struct content.
© Sunplus Technology Co., Ltd. PAGE 19 V0.2 – Jan 31, 2008
DirectionEnable
Direction set value
SetOrClear
Set value or clear value flag
SETUP_DIRECTIONATTRIBUTE_CLEAR: clear
SETUP_DIRECTIONATTRIBUTE_SET: Set
Return values
Errors
Example
#include " car_setup_tree.h "
int main()
{
Setup_TreeNode gSetup_TreeNode;
Int iRes = 0;
iRes = Get_SetupTreeNode (&gSetup_TreeNode,1);
if(!iRes)
{
iRes = Set_SetupTreeNode_DirectionAttribute_Direction(&gSetup_TreeNode, SETUP_DIRECTION_UP,SETUP_DIRECTIONATTRIBUTE_SET);
}
}
5.4 Set_SetupTreeNode_DirectionAttribute_NodeType
Set target tree node’s DirectionAttribute’s IR direction node type
Function Required Header
Set_SetupTreeNode_DirectionAttribute_NodeType car_setup_tree.h
int Set_SetupTreeNode_DirectionAttribute_NodeType(Setup_TreeNode *pSetup_TreeNode, UINT16 NodeType, UINT16 NodeType_Mask, UINT8 SetOrClear);
Parameter
pSetup_TreeNode
© Sunplus Technology Co., Ltd. PAGE 20 V0.2 – Jan 31, 2008
Pointer to the target node’s struct content.
NodeType
NodeType set value
SetOrClear
Set value or clear value flag
SETUP_DIRECTIONATTRIBUTE_CLEAR: clear
SETUP_DIRECTIONATTRIBUTE_SET: Set
NodeType_Mask
The position of the NodeType will be set.
Return values
Errors
Example
#include " car_setup_tree.h "
int main()
{
Setup_TreeNode gSetup_TreeNode;
Int iRes = 0;
iRes = Get_SetupTreeNode (&gSetup_TreeNode,1);
if(!iRes)
{
iRes = Set_SetupTreeNode_DirectionAttribute_NodeType(&gSetup_TreeNode, SETUP_DIRECTION_UP_PARENT, SETUP_DIRECTION_UPNODE_MASK,SETUP_DIRECTIONATTRIBUTE_SET);
}
}
5.5 Get_SetupTreeNode_DirectionAttribute
Get gSetup_Node_Inconstant[i].DirectionAttribute
Function Required Header
Get_SetupTreeNode_DirectionAttribute car_setup_tree.h
UINT16 Get_SetupTreeNode_DirectionAttribute(Setup_TreeNode *pSetup_TreeNode);
© Sunplus Technology Co., Ltd. PAGE 21 V0.2 – Jan 31, 2008
Parameter
pSetup_TreeNode
Pointer to the target node’s struct content.
Return values
Errors
Example
#include " car_setup_tree.h "
int main()
{
Setup_TreeNode gSetup_TreeNode;
Int iRes = 0;
iRes = Get_SetupTreeNode (&gSetup_TreeNode,1);
if(!iRes)
{
iRes = Get_SetupTreeNode_DirectionAttribute (&gSetup_TreeNode);
}
}
5.6 Get_SetupTreeNode_Parent
Get Parent Setup Tree Node of current Tree Node.
Function Required Header
Get_SetupTreeNode_Parent car_setup_tree.h
Int Get_SetupTreeNode_Parent(Setup_TreeNode *pSetup_TreeNode_Current,Setup_TreeNode *pSetup_TreeNode_Parent);
Parameter
pSetup_TreeNode_Current
Pointer to the current node’s struct content.
pSetup_TreeNode_Parent
Pointer to the current node’s Parent node’s struct content.
Return values
© Sunplus Technology Co., Ltd. PAGE 22 V0.2 – Jan 31, 2008
Errors
Example
#include " car_setup_tree.h "
int main()
{
Setup_TreeNode gHLSetup_TreeNode;
Setup_TreeNode gSetup_TreeNode_Parent;
if(!Get_SetupTreeNode(&gHLSetup_TreeNode, gSetup_Handle.HL_Node_ID))
{ if(!Get_SetupTreeNode_Parent(&gHLSetup_TreeNode,&gSetup_TreeNode_Parent))
{
……
}
}
}
5.7 Get_SetupTreeNode_FristChild
Get Frist child Setup Tree Node of current Tree Node.
Function Required Header
Get_SetupTreeNode_FristChild car_setup_tree.h
int Get_SetupTreeNode_FristChild(Setup_TreeNode *pSetup_TreeNode_Current,Setup_TreeNode *pSetup_TreeNode_Child)
Parameter
pSetup_TreeNode_Current
Pointer to the current node’s struct content.
pSetup_TreeNode_ Child
Pointer to the current node’s Frist Child node’s struct content.
Return values
Errors
© Sunplus Technology Co., Ltd. PAGE 23 V0.2 – Jan 31, 2008
Example
#include " car_setup_tree.h "
int main()
{
Setup_TreeNode gHLSetup_TreeNode;
Setup_TreeNode gSetup_TreeNode_Child;
if(!Get_SetupTreeNode(&gHLSetup_TreeNode,gSetup_Handle.HL_Node_ID))
{
if(!Get_SetupTreeNode_FristChild(&gHLSetup_TreeNode, &gSetup_TreeNode_Child))
{
……
}
}
}
5.8 Get_SetupTreeNode_PrevBrother
Get Prev Brother Setup Tree Node of current Tree Node.
Function Required Header
Get_SetupTreeNode_PrevBrother car_setup_tree.h
int Get_SetupTreeNode_PrevBrother(Setup_TreeNode *pSetup_TreeNode_Current,Setup_TreeNode *pSetup_TreeNode_PrevBrother)
Parameter
pSetup_TreeNode_Current
Pointer to the current node’s struct content.
pSetup_TreeNode_PrevBrother
Pointer to the current node’s Prev Brother node’s struct content.
Return values
Errors
Example
#include " car_setup_tree.h "
© Sunplus Technology Co., Ltd. PAGE 24 V0.2 – Jan 31, 2008
int main()
{
Setup_TreeNode gHLSetup_TreeNode;
Setup_TreeNode gSetup_TreeNode_PrevBrother;
if(!Get_SetupTreeNode(&gHLSetup_TreeNode,gSetup_Handle.HL_Node_ID))
{
if(!Get_SetupTreeNode_PrevBrother (&gHLSetup_TreeNode, & gSetup_TreeNode_PrevBrother))
{
……
}
}
}
5.9 Get_SetupTreeNode_NextBrother
Get Next Brother Setup Tree Node of current Tree Node
Function Required Header
Get_SetupTreeNode_NextBrother car_setup_tree.h
int Get_SetupTreeNode_NextBrother(Setup_TreeNode *pSetup_TreeNode_Current,Setup_TreeNode *pSetup_TreeNode_NextBrother)
Parameter
pSetup_TreeNode_Current
Pointer to the current node’s struct content.
pSetup_TreeNode_NextBrother
Pointer to the current node’s Next Brother node’s struct content.
Return values
Errors
Example
#include " car_setup_tree.h "
int main()
{
© Sunplus Technology Co., Ltd. PAGE 25 V0.2 – Jan 31, 2008
Setup_TreeNode gHLSetup_TreeNode;
Setup_TreeNode gSetup_TreeNode_NextBrother;
if(!Get_SetupTreeNode(&gHLSetup_TreeNode,gSetup_Handle.HL_Node_ID))
{
if(!Get_SetupTreeNode_NextBrother (&gHLSetup_TreeNode, & gSetup_TreeNode_NextBrother))
{
……
}
}
}
5.10 Traverse_SetupTree_FristChildPageDraw
Draw the node's Frist page children.
Function Required Header
Traverse_SetupTree_FristChildPageDraw car_setup_tree.h
int Traverse_SetupTree_FristChildPageDraw(Setup_TreeNode *pSetup_TreeNode_Parent)
Parameter
pSetup_TreeNode_Parent
Pointer to the parent node’s struct content.
Return values
Errors
Example
#include " car_setup_tree.h "
int main()
{
Setup_TreeNode gHLSetup_TreeNode;
Setup_TreeNode gSetup_TreeNode_NextBrother;
Int iRes = 0;
© Sunplus Technology Co., Ltd. PAGE 26 V0.2 – Jan 31, 2008
if(!Get_SetupTreeNode(&gHLSetup_TreeNode,gSetup_Handle.HL_Node_ID))
{
iRes = Traverse_SetupTree_FristChildPageDraw(&gHLSetup_TreeNode);
}
}
5.11 Traverse_SetupTree_AllChildDraw
Draw the node's children.
Function Required Header
Traverse_SetupTree_AllChildDraw car_setup_tree.h
int Traverse_SetupTree_AllChildDraw(Setup_TreeNode *pSetup_TreeNode_Parent)
Parameter
pSetup_TreeNode_Parent
Pointer to the parent node’s struct content.
Return values
Errors
Example
#include " car_setup_tree.h "
int main()
{
Setup_TreeNode gHLSetup_TreeNode;
Setup_TreeNode gSetup_TreeNode_NextBrother;
Int iRes = 0;
if(!Get_SetupTreeNode(&gHLSetup_TreeNode,gSetup_Handle.HL_Node_ID))
{
iRes = Traverse_SetupTree_AllChildDraw (&gHLSetup_TreeNode);
}
}
© Sunplus Technology Co., Ltd. PAGE 27 V0.2 – Jan 31, 2008
5.12 Traverse_SetupTree_LevelDraw
Draw the node and its child
Function Required Header
Traverse_SetupTree_LevelDraw car_setup_tree.h
int Traverse_SetupTree_LevelDraw(Setup_TreeNode *pStartSetup_TreeNode, int Level)
Parameter
pStartSetup_TreeNode
Pointer to the start node’s struct content.
Level
Will be draw how many levels
Return values
Errors
Example
#include " car_setup_tree.h "
int main()
{
Setup_TreeNode gHLSetup_TreeNode;
Setup_TreeNode gSetup_TreeNode_NextBrother;
Int iRes = 0;
if(!Get_SetupTreeNode(&gHLSetup_TreeNode,gSetup_Handle.HL_Node_ID))
{
iRes = Traverse_SetupTree_LevelDraw (&gHLSetup_TreeNode,1);
}
}
5.13 Traverse_SetupTree_Brother_EndIDDraw
Draw the node itself level and end at EndID node.
Function Required Header
Traverse_SetupTree_Brother_EndIDDraw car_setup_tree.h
© Sunplus Technology Co., Ltd. PAGE 28 V0.2 – Jan 31, 2008
int Traverse_SetupTree_Brother_EndIDDraw(UINT16 StartBrotherID,UINT16 EndBrotherID)
Parameter
StartBrotherID
Start brother Node ID.
EndBrotherID
End brother Node ID
Return values
Errors
Example
#include " car_setup_tree.h "
int main()
{
Int iRes = 0;
iRes = Traverse_SetupTree_Brother_EndIDDraw(SETUP_NODE_SYSTEM_NTSCPAL, SETUP_NODE_SYSTEM_PANNEL);
}
5.14 Traverse_SetupTree_EndNodeIDDraw
Draw the node and its child. Judged by EndNodeID,
Function Required Header
Traverse_SetupTree_EndNodeIDDraw car_setup_tree.h
int Traverse_SetupTree_EndNodeIDDraw(Setup_TreeNode *pStartSetup_TreeNode, UINT16 EndNodeID)
Parameter
pStartSetup_TreeNode
Pointer to the start node’s struct content.
EndNodeID
End brother Node ID.
Return values
© Sunplus Technology Co., Ltd. PAGE 29 V0.2 – Jan 31, 2008
Errors
Example
#include " car_setup_tree.h "
int main()
{
Int iRes = 0;
Setup_TreeNode gHLSetup_TreeNode;
if(!Get_SetupTreeNode(&gHLSetup_TreeNode,1))
{
iRes = Traverse_SetupTree_EndNodeIDDraw (&gHLSetup_TreeNode, SETUP_NODE_SYSTEM_PANNEL);
}
}
5.15 Get_PageFristNodeID
Get the NodeID's PageFristNodeID,
Function Required Header
Get_PageFristNodeID car_setup_tree.h
UINT16 Get_PageFristNodeID(UINT16 NodeID)
Parameter
NodeID
Current node ID.
Return values
Errors
Example
#include " car_setup_tree.h "
int main()
{
UINT16 PageFristNodeID = 0;
PageFristNodeID = Get_PageFristNodeID(SETUP_NODE_SYSTEM_PANNEL);
}
© Sunplus Technology Co., Ltd. PAGE 30 V0.2 – Jan 31, 2008
5.16 Is_MultiPageBrother_SetupTree
Judge whether current node's brother number is larger than MAX_SETUP_PAGE_ITEM
Function Required Header
Is_MultiPageBrother_SetupTree car_setup_tree.h
int Is_MultiPageBrother_SetupTree(UINT16 StartBrotherID)
Parameter
StartBrotherID
Current node ID.
Return values
0: Multi pages
1: Just one page
Example
#include " car_setup_tree.h "
int main()
{
Int iRes = 0;
iRes = Is_MultiPageBrother_SetupTree (SETUP_NODE_SYSTEM_PANNEL);
}
5.17 Traverse_SetupTree_Brother_LevelDraw
Draw the node itself level. Only one page when current level has multi page
Function Required Header
Traverse_SetupTree_Brother_LevelDraw car_setup_tree.h
int Traverse_SetupTree_Brother_LevelDraw(UINT16 StartBrotherID)
Parameter
StartBrotherID
Target page start brother node ID.
Return values
Errors
Example
© Sunplus Technology Co., Ltd. PAGE 31 V0.2 – Jan 31, 2008
#include " car_setup_tree.h "
int main()
{
Int iRes = 0;
UINT16 StartBrotherID = SETUP_NODE_MAX;
StartBrotherID = Get_PageFristNodeID(SETUP_NODE_SYSTEM_NTSCPAL_NTSC);
iRes=Traverse_SetupTree_Brother_LevelDraw (StartBrotherID);
}
5.18 Traverse_SetupTree_BrotherParent_LevelDraw
Draw the node itself level and its parent's level. Only one page when current level has multi page
Function Required Header
Traverse_SetupTree_BrotherParent_LevelDraw car_setup_tree.h
int Traverse_SetupTree_BrotherParent_LevelDraw(UINT16 SelfNodeID)
Parameter
SelfNodeID
Target node ID.
Return values
Errors
Example
#include " car_setup_tree.h "
int main()
{
Int iRes = 0;
iRes = Traverse_SetupTree_BrotherParent_LevelDraw(SETUP_NODE_SYSTEM_NTSCPAL);
}
5.19 Traverse_SetupTree_BrotherChild_LevelDraw
Draw the node itself level and its child's level.... Only one page when current level has multi page
© Sunplus Technology Co., Ltd. PAGE 32 V0.2 – Jan 31, 2008
Function Required Header
Traverse_SetupTree_BrotherChild_LevelDraw car_setup_tree.h
int Traverse_SetupTree_BrotherChild_LevelDraw(UINT16 SelfNodeID)
Parameter
SelfNodeID
Target node ID.
Return values
Errors
Example
#include " car_setup_tree.h "
int main()
{
Int iRes = 0;
iRes = Traverse_SetupTree_BrotherChild_LevelDraw (SETUP_NODE_SYSTEM);
}
5.20 Is_FristPage_SetupTree
Judge whether current page is the frist page
Function Required Header
Is_FristPage_SetupTree car_setup_tree.h
UINT16 Is_FristPage_SetupTree(UINT16 CurrentPage_StartBrotherID)
Parameter
CurrentPage_StartBrotherID
Current page start brother node ID.
Return values
==SETUP_CLUE_MAX : Current page is the frist page
<SETUP_CLUE_MAX: The prev page's last node clue id
Example
#include " car_setup_tree.h "
int main()
© Sunplus Technology Co., Ltd. PAGE 33 V0.2 – Jan 31, 2008
{
UINT16 PageStartNodeID = SETUP_NODE_MAX;
UINT16 ChildClue = SETUP_CLUE_MAX;
PageStartNodeID= Get_PageFristNodeID(gSetup_Handle.CurrentFilePage_LastNodeID);
ChildClue = Is_FristPage_SetupTree(PageStartNodeID);
}
5.21 Is_LastPage_SetupTree
Judge whether current page is the last page
Function Required Header
Is_LastPage_SetupTree car_setup_tree.h
UINT16 Is_LastPage_SetupTree(UINT16 CurrentPage_LastBrotherID)
Parameter
CurrentPage_LastBrotherID
Current page last brother node ID.
Return values
==SETUP_CLUE_MAX : Current page is the frist page
<SETUP_CLUE_MAX: The next page's frist node clue id
Example
#include " car_setup_tree.h "
int main()
{
UINT16 ChildClue = SETUP_CLUE_MAX;
ChildClue = Is_LastPage_SetupTree(gSetup_Handle.CurrentDirPage_LastNodeID);
}
5.22 Traverse_SetupTree_PrevBrotherPage_Draw
Draw current page's prev page. Should be used with Is_FristPage_SetupTree() together to make sure the ChildClueID is right
Function Required Header
Traverse_SetupTree_PrevBrotherPage_Draw car_setup_tree.h
© Sunplus Technology Co., Ltd. PAGE 34 V0.2 – Jan 31, 2008
int Traverse_SetupTree_PrevBrotherPage_Draw(UINT16 ChildClueID)
Parameter
ChildClueID
Prev page’s last node’s ClueID.
Return values
Errors
Example
#include " car_setup_tree.h "
int main()
{
UINT16 PageStartNodeID = SETUP_NODE_MAX;
UINT16 ChildClue = SETUP_CLUE_MAX;
PageStartNodeID = Get_PageFristNodeID(gSetup_Handle.CurrentDirPage_LastNodeID);
ChildClue = Is_FristPage_SetupTree(PageStartNodeID);
if(ChildClue < SETUP_CLUE_MAX)
{
iRes = Traverse_SetupTree_PrevBrotherPage_Draw(ChildClue);
}
}
5.23 Traverse_SetupTree_NextBrotherPage_Draw
Draw current page's next page. Should be used with Is_LastPage_SetupTree() together to make sure the ChildClueID is right
Function Required Header
Traverse_SetupTree_NextBrotherPage_Draw car_setup_tree.h
int Traverse_SetupTree_NextBrotherPage_Draw(UINT16 ChildClueID)
Parameter
ChildClueID
Next page’s Frist node’s ClueID.
Return values
Errors
© Sunplus Technology Co., Ltd. PAGE 35 V0.2 – Jan 31, 2008
Example
#include " car_setup_tree.h "
int main()
{
int iRes = 0;
UINT16 ChildClue = SETUP_CLUE_MAX;
if(gEvent_ID == SHORT_PRESS)
{
if(gSetup_Handle.CurrentDirPage_LastNodeID < SETUP_NODE_MAX)
{
ChildClue = Is_LastPage_SetupTree(gSetup_Handle.CurrentDirPage_LastNodeID);
if(ChildClue < SETUP_CLUE_MAX)
{
iRes = Traverse_SetupTree_NextBrotherPage_Draw(ChildClue);
}
}
}
}
5.24 Car_Setup_Exe
Execute and storage every setup functions here
Function Required Header
Car_Setup_Exe car_setup_exe.h
void Car_Setup_Exe(BYTE index, BYTE value, BYTE record)
Parameter
index
Stroage position of the value. The index of Setup_Value[]
value
The value for Setup_Value[index] and execute.
record
© Sunplus Technology Co., Ltd. PAGE 36 V0.2 – Jan 31, 2008
The value of Setup_Value[index] record or not flag.
Can used for executing setup function without record.
Return values
None
Example
#include " car_setup_exe.h "
int main()
{
Car_Setup_Exe(SETUP_VA_AUDIO_LANG, 0, RECORD_VALUE);
}
6 Limits and Suggestions
Some limits exist in this Setup module. We list them as following.