tizen 2.4 release
[profile/mobile/platform/kernel/u-boot-tm1.git] / arch / arm / include / asm / arch-sc8810 / oscfg.h
1 /******************************************************************************
2  ** File Name:      oscfg.h                                                   *
3  ** Author:         Benjamin.Wang                                             *
4  ** DATE:           11/08/2006                                                *
5  ** Copyright:      2006 Spreadtrum, Incorporated. All Rights Reserved.       *
6  ** Description:    This file is used to do some definition about task        *
7  **                 creation. If static task is created or thread entry is    *
8  **                 defined, you should include this file.                    *
9  ******************************************************************************
10
11  ******************************************************************************
12  **                        Edit History                                       *
13  ** ------------------------------------------------------------------------- *
14  ** DATE           NAME             DESCRIPTION                               *
15  ** 11/08/2006     Benjamin.Wang    Create.                                   *
16  ******************************************************************************/
17
18 #ifndef _OSCFG_H
19 #define _OSCFG_H
20
21 /**---------------------------------------------------------------------------*
22  **                         Dependencies                                      *
23  **---------------------------------------------------------------------------*/
24 #include "os_api.h"
25
26 #ifdef __cplusplus
27     extern   "C"
28     {
29 #endif
30
31 /**---------------------------------------------------------------------------*
32  **                         MACRO Definations                                 *
33  **---------------------------------------------------------------------------*/
34 /* For dynamic malloc task stack mode*/
35 #define DEF_TASK(__name, __prio, __stack_size, __queue_num) \
36 { \
37     void* __name##_STACK_ADDR = (void*)SCI_ALLOC_CONST(((__stack_size >> 2) << 2) + 3); \
38     char* __name##_QUEUE_ADDR = (char*)SCI_ALLOC_CONST(__queue_num * SCI_QUEUE_ITEM_SIZE * 4 + 3); \
39     extern void thread_entry_##__name(uint32, void*); \
40     SCI_ASSERT((__name##_STACK_ADDR != SCI_NULL) && (__name##_QUEUE_ADDR != SCI_NULL)); \
41     __name##_STACK_ADDR = (void*)((((uint32)__name##_STACK_ADDR + 3) >> 2) << 2); \
42     __name##_QUEUE_ADDR = (char*)((((uint32)__name##_QUEUE_ADDR + 3) >> 2) << 2); \
43     SCI_CreateStaticThread(__name, "T_"#__name, thread_entry_##__name, 0, 0, \
44     __name##_STACK_ADDR, __stack_size, __prio, SCI_PREEMPT, "Q_"#__name, \
45     __name##_QUEUE_ADDR, __queue_num, SCI_AUTO_START); \
46 }
47
48 /* For static task stack mode*/
49 /*
50 #define DEF_TASK(__name, __prio, __stack_size, __queue_num) \
51 { \
52     static uint32 __name##_STACK_ADDR[__stack_size >> 2]; \
53     static uint32 __name##_QUEUE_ADDR[__queue_num * SCI_QUEUE_ITEM_SIZE]; \
54     extern void thread_entry_##__name(uint32, void*); \
55     SCI_CreateStaticThread(__name, "T_"#__name, thread_entry_##__name, 0, 0, \
56     __name##_STACK_ADDR, __stack_size, __prio, SCI_PREEMPT, "Q_"#__name, \
57     __name##_QUEUE_ADDR, __queue_num, SCI_AUTO_START); \
58 }
59 */    
60
61 #define STATIC_TASK_DEF_BEGIN(__type) PUBLIC void SCI_CreateTasks##__type(void){ 
62
63 #define STATIC_TASK_DEF_END }
64
65 #define STATIC_TASK_CREATE(__type) \
66 { \
67     extern void SCI_CreateTasks##__type(void); \
68     SCI_CreateTasks##__type(); \
69 }
70
71 #define THREAD_ENTRY(__name) void thread_entry_##__name(uint32 argc, void* argv)
72 /* Thread entry Example:
73  * THREAD_ENTRY(CM) //Entry name(__name) should be the same one as task define.
74  * {
75  *     // Attention: Notice module's initialization order. Avoid system's block.
76  *     while(1)
77  *     {
78  *         //wait event or get signal
79  *     }
80  * }
81  */
82
83 /**---------------------------------------------------------------------------*
84  **                         Data Structures                                   *
85  **---------------------------------------------------------------------------*/
86
87 /**---------------------------------------------------------------------------*
88  **                         Macro Definition                                   *
89  **---------------------------------------------------------------------------*/      
90
91 /**---------------------------------------------------------------------------*
92  **                         Global Variables                                  *
93  **---------------------------------------------------------------------------*/
94  
95 /**---------------------------------------------------------------------------*
96  **                         Constant Variables                                *
97  **---------------------------------------------------------------------------*/
98
99 /**---------------------------------------------------------------------------*
100  **                         Function Prototypes                               *
101  **---------------------------------------------------------------------------*/
102
103 /**---------------------------------------------------------------------------*
104  **                         Compiler Flag                                     *
105  **---------------------------------------------------------------------------*/    
106 #ifdef __cplusplus
107 }
108 #endif
109
110 #endif  // _OSCFG_H
111
112 // End of oscfg.h
113