sigma0.h

00001 #ifndef __L4_SIGMA0_SIGMA0_H
00002 #define __L4_SIGMA0_SIGMA0_H
00003 
00004 #include <l4/sys/compiler.h>
00005 #include <l4/sys/types.h>
00006 
00007 #undef SIGMA0_REQ_MAGIC
00008 #undef SIGMA0_REQ_MASK
00009 
00010 # define SIGMA0_REQ_MAGIC   ~0xFFUL
00011 # define SIGMA0_REQ_MASK    ~0xFFUL
00012 
00013 /* Starting with 0x60 allows to detect components which still use the old
00014  * constants (0x00 ... 0x50) */
00015 #define SIGMA0_REQ_ID_MASK      0xF0
00016 #define SIGMA0_REQ_ID_FPAGE_RAM     0x60
00017 #define SIGMA0_REQ_ID_FPAGE_IOMEM   0x70
00018 #define SIGMA0_REQ_ID_FPAGE_IOMEM_CACHED  0x80
00019 #define SIGMA0_REQ_ID_FPAGE_ANY     0x90
00020 #define SIGMA0_REQ_ID_KIP     0xA0
00021 #define SIGMA0_REQ_ID_TBUF      0xB0
00022 #define SIGMA0_REQ_ID_DEBUG_DUMP    0xC0
00023 
00024 #define SIGMA0_IS_MAGIC_REQ(d1) \
00025   ((d1 & SIGMA0_REQ_MASK) == SIGMA0_REQ_MAGIC)
00026 
00027 #define SIGMA0_REQ(x) \
00028   (SIGMA0_REQ_MAGIC + SIGMA0_REQ_ID_ ## x)
00029 
00030 /* Use these constants in your code! */
00031 #define SIGMA0_REQ_FPAGE_RAM      (SIGMA0_REQ(FPAGE_RAM))
00032 #define SIGMA0_REQ_FPAGE_IOMEM      (SIGMA0_REQ(FPAGE_IOMEM))
00033 #define SIGMA0_REQ_FPAGE_IOMEM_CACHED   (SIGMA0_REQ(FPAGE_IOMEM_CACHED))
00034 #define SIGMA0_REQ_FPAGE_ANY      (SIGMA0_REQ(FPAGE_ANY))
00035 #define SIGMA0_REQ_KIP        (SIGMA0_REQ(KIP))
00036 #define SIGMA0_REQ_TBUF       (SIGMA0_REQ(TBUF))
00037 #define SIGMA0_REQ_DEBUG_DUMP       (SIGMA0_REQ(DEBUG_DUMP))
00038 
00039 EXTERN_C_BEGIN
00040 
00059 int l4sigma0_map_mem(l4_threadid_t pager,
00060          l4_addr_t phys, l4_addr_t virt, l4_addr_t size);
00061 
00081 L4_CV int
00082 l4sigma0_map_iomem(l4_threadid_t pager, l4_addr_t phys,
00083        l4_addr_t virt, l4_addr_t size, int cached);
00104 L4_CV int
00105 l4sigma0_map_anypage(l4_threadid_t pager, l4_addr_t map_area,
00106                      unsigned log2_map_size, l4_addr_t *base);
00107 
00121 L4_CV int
00122 l4sigma0_map_tbuf(l4_threadid_t pager, l4_addr_t virt);
00123 
00133 L4_CV void
00134 l4sigma0_debug_dump(l4_threadid_t pager);
00135 
00142 L4_CV l4_threadid_t
00143 l4sigma0_id(void);
00144 
00152 static inline char const *l4sigma0_map_errstr(int err)
00153 {
00154   switch (err)
00155     {
00156     case  0: return "No error";
00157     case -1: return "Phys, virt or size not aligned";
00158     case -2: return "IPC error";
00159     case -3: return "No fpage received";
00160 #ifndef SIGMA0_REQ_MAGIC
00161     case -4: return "Bad physical address (old protocol only)";
00162 #endif
00163     case -6: return "Superpage requested but smaller flexpage received";
00164     case -7: return "Cannot map I/O memory cacheable (old protocol only)";
00165     default: return "Unknown error";
00166     }
00167 }
00168 
00169 EXTERN_C_END
00170 
00171 #endif /* ! __L4_SIGMA0_SIGMA0_H */

Generated on Wed Apr 11 06:38:27 2012 for SIGMA0 Protocol Bindings by  doxygen 1.5.6