Update contrib.
2 * Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * e32\personality\example\personality.h
16 * External interface header file for example RTOS personality.
17 * This will be included by the real time application source files.
19 * WARNING: This file contains some APIs which are internal and are subject
20 * to change without notice. Such APIs should therefore not be used
21 * outside the Kernel and Hardware Services package.
31 #ifndef __PERSONALITY_H__
32 #define __PERSONALITY_H__
34 // should be separate C function
35 #define kprintf Kern::Printf
36 #define assert(x) __NK_ASSERT_ALWAYS(x)
38 #if defined(__GCC32__)
39 typedef unsigned long size_t;
40 #elif defined(__CW32__)
41 typedef unsigned int size_t;
42 #elif defined(__ARMCC__)
43 typedef unsigned int size_t;
52 #define BAD_TASK_ID (-100)
53 #define BAD_PRIORITY (-101)
54 #define TIMED_OUT (-102)
55 #define TIMER_IN_USE (-103)
56 #define BAD_ENTRY_POINT (-104)
57 #define BAD_STACK_SIZE (-105)
58 #define OUT_OF_MEMORY (-106)
59 #define BAD_TIMER_ID (-107)
60 #define BAD_TIME_INTERVAL (-108)
61 #define BAD_SEM_ID (-109)
64 /* Task priority range */
65 #define MIN_TASK_PRIORITY 0
66 #define MAX_TASK_PRIORITY 255
69 #define MIN_STACK_SIZE 256
71 /* Special task IDs */
72 #define TASK_ID_ISR (-1)
73 #define TASK_ID_UNKNOWN (-2) /* non-personality layer thread */
76 #define NO_WAIT 0 /* Never block */
77 #define WAIT_FOREVER (-1) /* Never time out */
79 /* Special message IDs */
80 #define MSG_ID_TIMEOUT 0x80000000
82 typedef void (*task_entry)(void);
84 /* Information required to create a task */
85 typedef struct _taskinfo
94 /* Externally supplied table of tasks which will be created at boot time */
95 extern const taskinfo task_list[];
97 /* Memory pool creation info */
98 typedef struct _poolinfo
101 unsigned block_count;
104 /* Externally supplied list of memory pools which will be created at boot time */
105 extern const poolinfo pool_list[];
108 typedef struct _msghdr
110 struct _msghdr* next;
117 extern const int timer_count;
119 typedef struct _timer_msg
127 extern const int semaphore_count;
131 extern int suspend_task(int id); /* call from any thread */
132 extern int resume_task(int id); /* call from any thread */
133 extern int get_task_priority(int id); /* call from any thread */
134 extern int set_task_priority(int id, int priority); /* call from any thread */
135 extern int current_task_id(void); /* call from any thread or ISR */
136 extern void disable_preemption(void); /* call from any thread */
137 extern void enable_preemption(void); /* call from any thread */
138 extern int disable_interrupts(void); /* call from any thread */
139 extern void restore_interrupts(int level); /* call from any thread */
141 /* Memory management */
142 extern void* alloc_mem_block(size_t size); /* call from any thread or ISR */
143 extern void free_mem_block(void* block); /* call from any thread or ISR */
146 extern int send_msg(int task_id, msghdr* msg); /* call from any thread or ISR */
147 extern int recv_msg(msghdr** msgptr, int time_ticks); /* call only from personality layer thread */
150 extern unsigned tick_count(void); /* call from any thread or ISR */
151 extern void delay(int time_interval); /* call from any thread */
152 extern int start_one_shot_timer(int timer_id, int task_id, int time_ticks, void* cookie); /* call from any thread or ISR */
153 extern int start_periodic_timer(int timer_id, int task_id, int initial_time_ticks, int period_ticks, void* cookie); /* call from any thread or ISR */
154 extern int stop_timer(int timer_id); /* call from any thread or ISR */
157 extern int semaphore_wait(int sem_id, int time_ticks); /* call only from personality layer thread */
158 extern int semaphore_signal(int sem_id); /* call from any thread or ISR */
161 extern void init_personality(void); /* call from extension entry point */
163 /* Communication with EPOC */
164 extern void send_to_epoc(msghdr* msgptr);