tkernel_2/include/tk/sysext.h | bare source | permlink (0.02 seconds) |
1: /* 2: *---------------------------------------------------------------------- 3: * T-Kernel 2.0 Software Package 4: * 5: * Copyright 2011 by Ken Sakamura. 6: * This software is distributed under the latest version of T-License 2.x. 7: *---------------------------------------------------------------------- 8: * 9: * Released by T-Engine Forum(http://www.t-engine.org/) at 2011/05/17. 10: * Modified by TRON Forum(http://www.tron.org/) at 2015/06/01. 11: * 12: *---------------------------------------------------------------------- 13: */ 14: 15: /* 16: * sysext.h 17: * 18: * Definitions related to Extension 19: */ 20: 21: #ifndef __TK_SYSEXT_H__ 22: #define __TK_SYSEXT_H__ 23: 24: #include <basic.h> 25: #include "typedef.h" 26: 27: #include <sys/sysdepend/segment_common.h> 28: 29: #ifdef __cplusplus 30: extern "C" { 31: #endif 32: 33: /* 34: * Memory Cache Control 35: */ 36: IMPORT ER FlushMemCache( void *laddr, INT len, UINT mode ); 37: IMPORT INT SetCacheMode( void *addr, INT len, UINT mode ); 38: IMPORT INT ControlCache( void *addr, INT len, UINT mode ); 39: 40: /* 41: * mode of FlushMemCache() 42: */ 43: #define TCM_ICACHE 0x0001 /* Invalidate instruction cache */ 44: #define TCM_DCACHE 0x0002 /* Flush data cache and then invalidate it */ 45: 46: /* 47: * mode of SetCacheMode() 48: */ 49: #define CM_OFF 0x01 /* cache off */ 50: #define CM_WB 0x02 /* cache on: writeback */ 51: #define CM_WT 0x03 /* cache on: writethrough */ 52: #define CM_CONT 0x10 /* Set up cache only for consecutive physical address range */ 53: 54: /* 55: * mode of ControlCache() 56: */ 57: #define CC_FLUSH 0x01 /* flush cache */ 58: #define CC_INVALIDATE 0x02 /* invaliate cache */ 59: 60: /* 61: * Memory Map Function 62: */ 63: IMPORT ER MapMemory( CONST void *paddr, INT len, UINT attr, void **laddr ); 64: IMPORT ER UnmapMemory( CONST void *laddr ); 65: 66: /* 67: * Obtain the information about the address space 68: */ 69: typedef struct { 70: void *paddr; /* physical address that is mapped to addr */ 71: void *page; /* the physical start address of the page in which addr resides */ 72: INT pagesz; /* page size (in bytes)) */ 73: INT cachesz; /* cache line size (in bytes) */ 74: INT cont; /* the size of the area covered by the consecutive physical addresses (in bytes) */ 75: } T_SPINFO; 76: IMPORT ER GetSpaceInfo( CONST void *addr, INT len, T_SPINFO *pk_spinfo ); 77: 78: /* 79: * Operation on memory access right 80: */ 81: IMPORT INT SetMemoryAccess( CONST void *addr, INT len, UINT mode ); 82: 83: #ifdef __cplusplus 84: } 85: #endif 86: #endif /* __TK_SYSEXT_H__ */