POK(kernelpart)
/home/jaouen/pok_official/pok/trunk/kernel/include/core/syscall.h
Go to the documentation of this file.
00001 /*
00002  *                               POK header
00003  *
00004  * The following file is a part of the POK project. Any modification should
00005  * made according to the POK licence. You CANNOT use this file or a part of
00006  * this file is this part of a file for your own project
00007  *
00008  * For more information on the POK licence, please see our LICENCE FILE
00009  *
00010  * Please follow the coding guidelines described in doc/CODING_GUIDELINES
00011  *
00012  *                                      Copyright (c) 2007-2009 POK team
00013  *
00014  * Created by julien on Thu Jan 15 23:34:13 2009
00015  */
00016 
00017 #ifndef __POK_SYSCALL_H__
00018 #define __POK_SYSCALL_H__
00019 
00020 #include <types.h>
00021 #include <errno.h>
00022 
00023 typedef enum
00024 {
00025    POK_SYSCALL_CONSWRITE                           =  10,
00026    POK_SYSCALL_GETTICK                             =  20,
00027    POK_SYSCALL_INT_NUMBER                          =  42,
00028    POK_SYSCALL_THREAD_CREATE                       =  50,
00029    POK_SYSCALL_THREAD_SLEEP_UNTIL                  =  51,
00030    POK_SYSCALL_THREAD_SLEEP                        =  52,
00031    POK_SYSCALL_THREAD_SUSPEND                      =  53,
00032    POK_SYSCALL_THREAD_RESTART                      =  54,
00033    POK_SYSCALL_THREAD_STOP                         =  55,
00034    POK_SYSCALL_THREAD_PERIOD                       =  56,
00035    POK_SYSCALL_THREAD_STOPSELF                     =  57,
00036    POK_SYSCALL_THREAD_ID                           =  58,
00037    POK_SYSCALL_THREAD_STATUS                       =  59,
00038    POK_SYSCALL_THREAD_SET_PRIORITY                                                               =  60,
00039    POK_SYSCALL_THREAD_RESUME                       =  61,
00040    POK_SYSCALL_THREAD_SUSPEND_TARGET               =  62,
00041    //POK_SYSCALL_THREAD_DEADLINE                     =  63,
00042    //POK_SYSCALL_THREAD_STATE                        =  64,
00043    POK_SYSCALL_THREAD_DELAYED_START                =  65,
00044 #ifdef POK_NEEDS_PORTS_SAMPLING
00045    POK_SYSCALL_MIDDLEWARE_SAMPLING_ID              = 101,
00046    POK_SYSCALL_MIDDLEWARE_SAMPLING_READ            = 102,
00047    POK_SYSCALL_MIDDLEWARE_SAMPLING_STATUS          = 103,
00048    POK_SYSCALL_MIDDLEWARE_SAMPLING_WRITE           = 104,
00049    POK_SYSCALL_MIDDLEWARE_SAMPLING_CREATE          = 105,
00050 #endif
00051 #ifdef POK_NEEDS_PORTS_QUEUEING
00052    POK_SYSCALL_MIDDLEWARE_QUEUEING_CREATE          = 110,
00053    POK_SYSCALL_MIDDLEWARE_QUEUEING_SEND            = 111,
00054    POK_SYSCALL_MIDDLEWARE_QUEUEING_RECEIVE         = 112,
00055    POK_SYSCALL_MIDDLEWARE_QUEUEING_ID              = 113,
00056    POK_SYSCALL_MIDDLEWARE_QUEUEING_STATUS          = 114,
00057 #endif
00058 #ifdef POK_NEEDS_PORTS_VIRTUAL
00059    POK_SYSCALL_MIDDLEWARE_VIRTUAL_CREATE           = 150,
00060    POK_SYSCALL_MIDDLEWARE_VIRTUAL_NB_DESTINATIONS  = 151,
00061    POK_SYSCALL_MIDDLEWARE_VIRTUAL_DESTINATION      = 152,
00062    POK_SYSCALL_MIDDLEWARE_VIRTUAL_GET_GLOBAL       = 153,
00063 #endif
00064 #if defined (POK_NEEDS_LOCKOBJECTS) || defined (POK_NEEDS_MUTEXES) || defined (POK_NEEDS_SEMAPHORES) || defined (POK_NEEDS_EVENTS) || defined (POK_NEEDS_BUFFERS) || defined (POK_NEEDS_BLACKBOARDS)
00065    POK_SYSCALL_LOCKOBJ_CREATE                      = 201,
00066    POK_SYSCALL_LOCKOBJ_OPERATION                   = 202,
00067 #endif
00068 #ifdef POK_NEEDS_ERROR_HANDLING
00069    POK_SYSCALL_ERROR_HANDLER_CREATE                = 301,
00070    POK_SYSCALL_ERROR_HANDLER_SET_READY             = 302,
00071    POK_SYSCALL_ERROR_RAISE_APPLICATION_ERROR       = 303,
00072    POK_SYSCALL_ERROR_GET                           = 304,
00073 #endif
00074 #ifdef POK_NEEDS_PARTITIONS
00075    POK_SYSCALL_PARTITION_SET_MODE                  = 404,
00076    POK_SYSCALL_PARTITION_GET_ID                    = 405,
00077    POK_SYSCALL_PARTITION_GET_PERIOD                = 406,
00078    POK_SYSCALL_PARTITION_GET_DURATION              = 407,
00079    POK_SYSCALL_PARTITION_GET_LOCK_LEVEL            = 408,
00080    POK_SYSCALL_PARTITION_GET_OPERATING_MODE        = 409,
00081    POK_SYSCALL_PARTITION_GET_START_CONDITION       = 410,
00082 #endif
00083 #ifdef POK_NEEDS_IO
00084    POK_SYSCALL_INB                                 = 501,
00085    POK_SYSCALL_OUTB                                = 502,
00086 #endif
00087 #ifdef POK_NEEDS_PCI
00088    POK_SYSCALL_PCI_REGISTER                        = 601,
00089 #endif
00090 } pok_syscall_id_t;
00091 
00092 typedef struct
00093 {
00094    uint32_t             nargs;
00095    uint32_t             arg1;
00096    uint32_t             arg2;
00097    uint32_t             arg3;
00098    uint32_t             arg4;
00099    uint32_t             arg5;
00100 } pok_syscall_args_t;
00101 
00102 typedef struct
00103 {
00104    pok_partition_id_t   partition;
00105    uint32_t             thread;
00106    uint32_t             base_addr;
00107 }pok_syscall_info_t;
00108 
00109 
00110 
00132 pok_ret_t       pok_core_syscall (const pok_syscall_id_t     syscall_id,
00133                               const pok_syscall_args_t*  args,
00134                               const pok_syscall_info_t*  infos);
00135 
00136 /*
00137  * Initiate syscalls.
00138  * This part is defined in low-level layers, each architecture/bsp
00139  * initiate the syscall in a different way.
00140  */
00141 pok_ret_t pok_syscall_init();
00142 
00143 #define POK_CHECK_PTR_OR_RETURN(pid,ptr)        \
00144    if (!POK_CHECK_PTR_IN_PARTITION(pid,ptr))    \
00145 {                                               \
00146    return POK_ERRNO_EINVAL;                                     \
00147 }
00148 
00149 #endif /* __POK_SYSCALL_H__ */