00001 00010 /* Embedded XINU, Copyright (C) 2007. All rights reserved. */ 00011 00012 #ifndef _KERNEL_H_ 00013 #define _KERNEL_H_ 00014 00015 /* Symbolic constants used throughout Xinu */ 00016 00017 /* Base type definitions */ 00018 typedef unsigned char uchar; 00019 typedef unsigned short ushort; 00020 typedef unsigned long ulong; 00021 typedef unsigned long irqmask; 00023 /* Boolean type and constants */ 00024 typedef char bool; 00025 #define FALSE 0 00026 #define TRUE 1 00028 /* Null constants */ 00029 #define NULL 0 00030 #define EMPTY (-1) 00032 /* Function declaration return types */ 00033 #define syscall long 00034 #define devcall long 00035 #define local static long 00036 #define command long 00037 #define process long 00038 #define interrupt void 00040 /* Universal return constants */ 00041 #define OK 1 00042 #define SYSERR (-1) 00043 #define EOF (-2) 00045 /* Reschedule constants for ready */ 00046 #define RESCHED_YES 1 00047 #define RESCHED_NO 0 00049 /* Configuration information */ 00050 #define RTCLOCK TRUE 00051 #define NPROC 50 00052 #define NSEM 100 00054 /* Assertions */ 00055 #define ASSERT(cond) if ( !(cond) ) return SYSERR 00056 #define ASSERTFUNC(func_call) ASSERT((func_call) == OK) 00057 00058 /* Kernel function prototypes */ 00059 int nulluser(void); 00060 00061 syscall kprintf(char *fmt, ...); 00062 00063 irqmask disable(void); 00064 irqmask restore(irqmask); 00065 irqmask enable(void); 00066 irqmask enable_irq(irqmask); 00067 00068 syscall create(void *, ulong, ushort, char *, ulong, ...); 00069 syscall getpid(void); 00070 syscall kill(int); 00071 syscall ready(long, bool); 00072 syscall resched(void); 00073 syscall sleep(int n); 00074 00075 #endif /* _KERNEL_H_ */