[BACK]Return to prex.h CVS log [TXT][DIR] Up to [local] / prex-old / include / prex

Annotation of prex-old/include/prex/prex.h, Revision 1.1

1.1     ! nbrk        1: /*
        !             2:  * Copyright (c) 2005-2007, Kohsuke Ohtani
        !             3:  * All rights reserved.
        !             4:  *
        !             5:  * Redistribution and use in source and binary forms, with or without
        !             6:  * modification, are permitted provided that the following conditions
        !             7:  * are met:
        !             8:  * 1. Redistributions of source code must retain the above copyright
        !             9:  *    notice, this list of conditions and the following disclaimer.
        !            10:  * 2. Redistributions in binary form must reproduce the above copyright
        !            11:  *    notice, this list of conditions and the following disclaimer in the
        !            12:  *    documentation and/or other materials provided with the distribution.
        !            13:  * 3. Neither the name of the author nor the names of any co-contributors
        !            14:  *    may be used to endorse or promote products derived from this software
        !            15:  *    without specific prior written permission.
        !            16:  *
        !            17:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
        !            18:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        !            19:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
        !            20:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
        !            21:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        !            22:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
        !            23:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
        !            24:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
        !            25:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
        !            26:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
        !            27:  * SUCH DAMAGE.
        !            28:  */
        !            29:
        !            30: #ifndef _PREX_H
        !            31: #define _PREX_H
        !            32: #ifndef KERNEL
        !            33:
        !            34: #include <conf/config.h>
        !            35:
        !            36: #include <sys/cdefs.h>
        !            37: #include <sys/types.h>
        !            38: #include <sys/param.h>
        !            39: #include <prex/sysinfo.h>
        !            40:
        !            41: /*
        !            42:  * vm_option for task_crate()
        !            43:  */
        !            44: #define VM_NEW         0
        !            45: #define VM_SHARE       1
        !            46: #define VM_COPY                2
        !            47:
        !            48: /*
        !            49:  * attr flags for vm_attribute()
        !            50:  */
        !            51: #define VMA_READ       0x01
        !            52: #define VMA_WRITE      0x02
        !            53: #define VMA_EXEC       0x04
        !            54:
        !            55: /*
        !            56:  * Device open mode for device_open()
        !            57:  */
        !            58: #define DO_RDONLY      0x0
        !            59: #define DO_WRONLY      0x1
        !            60: #define DO_RDWR                0x2
        !            61: #define DO_RWMASK      0x3
        !            62:
        !            63: /*
        !            64:  * Scheduling policy
        !            65:  */
        !            66: #define SCHED_FIFO     0       /* First In First Out */
        !            67: #define SCHED_RR       1       /* Round Robin */
        !            68: #define SCHED_OTHER    2       /* Other */
        !            69:
        !            70: /*
        !            71:  * Synch initializer
        !            72:  */
        !            73: #define MUTEX_INITIALIZER      (mutex_t)0x4d496e69
        !            74: #define COND_INITIALIZER       (cond_t)0x43496e69
        !            75:
        !            76: /*
        !            77:  * System debug service
        !            78:  */
        !            79: #define DCMD_DUMP      0       /* kernel dump */
        !            80: #define DCMD_LOGSIZE   1       /* return log size */
        !            81: #define DCMD_GETLOG    2       /* return message log */
        !            82:
        !            83: /*
        !            84:  * Parameter for DCMD_DUMP
        !            85:  */
        !            86: #define DUMP_THREAD    1
        !            87: #define DUMP_TASK      2
        !            88: #define DUMP_OBJECT    3
        !            89: #define DUMP_TIMER     4
        !            90: #define DUMP_IRQ       5
        !            91: #define DUMP_DEVICE    6
        !            92: #define DUMP_VM                7
        !            93: #define DUMP_MSGLOG    8
        !            94: #define DUMP_TRACE     9
        !            95:
        !            96: __BEGIN_DECLS
        !            97: int    object_create(const char *name, object_t *obj);
        !            98: int    object_destroy(object_t obj);
        !            99: int    object_lookup(const char *name, object_t *obj);
        !           100:
        !           101: int    msg_send(object_t obj, void *msg, size_t size);
        !           102: int    msg_receive(object_t obj, void *msg, size_t size);
        !           103: int    msg_reply(object_t obj, void *msg, size_t size);
        !           104:
        !           105: int    vm_allocate(task_t task, void **addr, size_t size, int anywhere);
        !           106: int    vm_free(task_t task, void *addr);
        !           107: int    vm_attribute(task_t task, void *addr, int attr);
        !           108: int    vm_map(task_t target, void  *addr, size_t size, void **alloc);
        !           109:
        !           110: int    task_create(task_t parent, int vm_option, task_t *child);
        !           111: int    task_terminate(task_t task);
        !           112: task_t  task_self(void);
        !           113: int    task_suspend(task_t task);
        !           114: int    task_resume(task_t task);
        !           115: int    task_name(task_t task, const char *name);
        !           116: int    task_getcap(task_t task, cap_t *cap);
        !           117: int    task_setcap(task_t task, cap_t *cap);
        !           118:
        !           119: int    thread_create(task_t task, thread_t *th);
        !           120: int    thread_terminate(thread_t th);
        !           121: int    thread_load(thread_t th, void (*entry)(void), void *stack);
        !           122: thread_t thread_self(void);
        !           123: void   thread_yield(void);
        !           124: int    thread_suspend(thread_t th);
        !           125: int    thread_resume(thread_t th);
        !           126: int    thread_getprio(thread_t th, int *prio);
        !           127: int    thread_setprio(thread_t th, int prio);
        !           128: int    thread_getpolicy(thread_t th, int *policy);
        !           129: int    thread_setpolicy(thread_t th, int policy);
        !           130:
        !           131: int    timer_sleep(u_long delay, u_long *remain);
        !           132: int    timer_alarm(u_long delay, u_long *remain);
        !           133: int    timer_periodic(thread_t th, u_long start, u_long period);
        !           134: int    timer_waitperiod(void);
        !           135:
        !           136: int    exception_setup(void (*handler)(int, void *));
        !           137: int    exception_return(void *regs);
        !           138: int    exception_raise(task_t task, int excpt);
        !           139: int    exception_wait(int *excpt);
        !           140:
        !           141: int    device_open(const char *name, int mode, device_t *dev);
        !           142: int    device_close(device_t dev);
        !           143: int    device_read(device_t dev, void *buf, size_t *nbyte, int blkno);
        !           144: int    device_write(device_t dev, void *buf, size_t *nbyte, int blkno);
        !           145: int    device_ioctl(device_t dev, int cmd, u_long arg);
        !           146:
        !           147: int    mutex_init(mutex_t *mu);
        !           148: int    mutex_destroy(mutex_t *mu);
        !           149: int    mutex_trylock(mutex_t *mu);
        !           150: int    mutex_lock(mutex_t *mu);
        !           151: int    mutex_unlock(mutex_t *mu);
        !           152:
        !           153: int    cond_init(cond_t *cond);
        !           154: int    cond_destroy(cond_t *cond);
        !           155: int    cond_wait(cond_t *cond, mutex_t *mu);
        !           156: int    cond_signal(cond_t *cond);
        !           157: int    cond_broadcast(cond_t *cond);
        !           158:
        !           159: int    sem_init(sem_t *sem, u_int value);
        !           160: int    sem_destroy(sem_t *sem);
        !           161: int    sem_wait(sem_t *sem, u_long timeout);
        !           162: int    sem_trywait(sem_t *sem);
        !           163: int    sem_post(sem_t *sem);
        !           164: int    sem_getvalue(sem_t *sem, u_int *value);
        !           165:
        !           166: int    sys_info(int type, void *buf);
        !           167: int    sys_log(const char *);
        !           168: void   sys_panic(const char *);
        !           169: int    sys_time(u_long *ticks);
        !           170: int    sys_debug(int cmd, ...);
        !           171:
        !           172: /* wrapper for sys_panic */
        !           173: #ifdef DEBUG
        !           174: void panic(const char *, ...);
        !           175: #else
        !           176: #define panic(fmt...) sys_panic(NULL);
        !           177: #endif
        !           178: __END_DECLS
        !           179:
        !           180: #endif /* KERNEL */
        !           181: #endif /* !_PREX_H */

CVSweb