POK(kernelpart)
/home/jaouen/pok_official/pok/trunk/kernel/include/arch.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 
00025 #ifndef __POK_ARCH_H__
00026 #define __POK_ARCH_H__
00027 
00028 #include <types.h>
00029 #include <errno.h>
00030 
00034 pok_ret_t   pok_arch_init ();
00035 
00039 pok_ret_t   pok_arch_preempt_disable ();
00040 
00044 pok_ret_t   pok_arch_preempt_enable ();
00045 
00049 pok_ret_t   pok_arch_idle ();
00050 
00054 pok_ret_t   pok_arch_event_register (uint8_t vector, void (*handler)(void));
00055 
00056 uint32_t           pok_context_create (uint32_t thread_id,
00057                                 uint32_t stack_size,
00058                                 uint32_t entry);
00059 
00060 void               pok_context_switch (uint32_t* old_sp, uint32_t new_sp);
00061 
00062 void                    pok_context_reset(uint32_t stack_size,
00063                                           uint32_t stack_addr);
00064 
00065 pok_ret_t   pok_create_space (uint8_t partition_id, uint32_t addr, uint32_t size);
00066 
00067 uint32_t           pok_space_base_vaddr (uint32_t addr);
00068 
00069 void        pok_dispatch_space (uint8_t partition_id,
00070                                                     uint32_t user_pc,
00071                                 uint32_t user_sp,
00072                                 uint32_t kernel_sp,
00073                                 uint32_t arg1,
00074                                 uint32_t arg2);
00075 
00079 uint32_t           pok_space_context_create (uint8_t partition_id,
00080                                       uint32_t entry_rel,
00081                                       uint32_t stack_rel,
00082                                       uint32_t arg1,
00083                                       uint32_t arg2);
00084 
00085 
00086 void pok_space_context_restart (uint32_t sp, uint32_t entry, uint32_t user_stack);
00087 
00091 pok_ret_t   pok_space_switch (uint8_t old_partition_id,
00092                               uint8_t new_partition_id);
00093 
00106 uint32_t    pok_thread_stack_addr   (const uint8_t    partition_id,
00107                                      const uint32_t   local_thread_id);
00108 
00109 #ifdef POK_ARCH_PPC
00110 #include <arch/ppc/spinlock.h>
00111 #endif
00112 
00113 #ifdef POK_ARCH_X86
00114 #include <arch/x86/spinlock.h>
00115 #endif
00116 
00117 #ifdef POK_ARCH_SPARC
00118 #include <arch/sparc/spinlock.h>
00119 #endif
00120 
00121 #endif /* !__POK_ARCH_H__ */