www.pudn.com > r&s1.10°æ±¾£«Îĵµ.rar > const.h
/*
===============================================================================
| Copyright (C) 2004 RuanHaiShen, All rights reserved.
| SUMMARY:
| Kernel macros define.
|
| DESCRIPTION:
| See http://www.01s.org for documentation, latest information, license
| and contact details.
| email:ruanhaishen@01s.org
=============================================================================*/
#ifndef __CONST_H__
#define __CONST_H__
/*===========================================================================*/
#define RS_VERSION 110
#define SELF_PRIO 0xff /*indicate self priority */
#define TASK_IDLE_PRIO (CFG_MAX_TASKS - 1)
#define TASK_INFO_PRIO (CFG_MAX_TASKS - 2)
#define TASK_QUE_SIZE ((CFG_MAX_TASKS - 1) / ARCH_CPU_BITS + 1)
#define STATE_NONE 0x00 /* tcb is free */
#define STATE_READY 0x01 /* ready to run */
#define STATE_BLOCKED 0x02 /* task blocked */
#define STATE_SUSPEND 0x04 /* task is suspended */
#define STATE_PREREADY 0x08 /* task is suspended from ready */
#define STATE_ZOMBIE 0x10 /* tcb is deformity */
#define STATE_RESERVED 0x20 /* tcb is reserved */
/*===== internal define,you should not change it ============================*/
#define CFG_IPC_EN (CFG_SEMB_EN|CFG_SEM_EN|CFG_MUTEX_EN|CFG_MBOX_EN|CFG_MSGQ_EN)
#define DEBUG CFG_DEBUG
#define UPWARDS 0
#define DOWNWARDS 1
#define LITTLE_ENDIAN 1234
#define BIG_ENDIAN 4321
#define __MPT do { } while (0)
enum {
EOK = 0, /* no error */
EUNKNOW = -127, /* unknow error */
EEXIST, /* already exists */
ENOTEXIST, /* not exists */
EOUTRANGE, /* out of range */
EINVAL, /* invalid argument */
ENAVAIL, /* not available */
EAGAIN, /* not allow operation again*/
ENULL, /* pointer to NULL */
ETIMEOUT, /* time out */
ELOCK, /* schedule lock */
EFULL, /* object is full */
EMMCHK /* memory check error */
};
/*===== you can define these functions for your applications =======*/
#define hook_task_create(prio) __MPT
#define hook_task_delete(prio) __MPT
#define hook_idle_task() __MPT
#define hook_do_tick() __MPT
#define hook_info_task() __MPT
#define hook_schedule(current, next) __MPT
/*===========================================================================*/
#ifndef ARCH_CPU_BITS
#error "Basetype error:Nndefine ARCH_CPU_BITS"
#endif
#if ARCH_CPU_BITS != 8 && ARCH_CPU_BITS != 16 && ARCH_CPU_BITS != 32 && ARCH_CPU_BITS != 64
#error "Basetype error:ARCH_CPU_BITS must be 8,16,32,or 64"
#endif
#ifndef ARCH_STACK_GROW
#error "Basetype error:Nndefine ARCH_STACK_GROW"
#endif
#if ARCH_STACK_GROW != UPWARDS && ARCH_STACK_GROW != DOWNWARDS
#error "Basetype error:ARCH_STACK_GROW must be Up or Down"
#endif
#ifndef ARCH_MM_BYTEORDER
#error "Basetype error:Nndefine ARCH_MM_BYTEORDER"
#endif
#if ARCH_MM_BYTEORDER != LITTLE_ENDIAN && ARCH_MM_BYTEORDER != BIG_ENDIAN
#error "Basetype error:ARCH_MM_BYTEORDER must be LITTLE_ENDIAN or BIG_ENDIAN"
#endif
#ifndef CFG_MAX_TASKS
#error "Configure error:Nndefine CFG_MAX_TASKS"
#endif
#if CFG_MAX_TASKS < 2 || CFG_MAX_TASKS > ARCH_CPU_BITS * 8
#error "Configure error:CFG_MAX_TASKS must from 2 to ARCH_CPU_BITS * 8 (max.256)"
#endif
#ifndef CFG_PRIO_MODE
#error "Configure error:Nndefine CFG_PRIO_MODE"
#endif
#if CFG_PRIO_MODE != 0 && CFG_PRIO_MODE != 1 && CFG_PRIO_MODE != 2
#error "Configure error:CFG_PRIO_MODE must be 0,1,or 2"
#endif
#ifndef CFG_TASK_DEL_EN
#error "Configure error:Nndefine CFG_TASK_DEL_EN"
#endif
#if CFG_TASK_DEL_EN != 0 && CFG_TASK_DEL_EN != 1
#error "Configure error:CFG_TASK_DEL_EN must be 0,or 1"
#endif
#ifndef CFG_TASK_SUS_EN
#error "Configure error:Nndefine CFG_TASK_SUS_EN"
#endif
#if CFG_TASK_SUS_EN != 0 && CFG_TASK_SUS_EN != 1
#error "Configure error:CFG_TASK_SUS_EN must be 0,or 1"
#endif
#ifndef CFG_TASK_NAMESZ
#error "Configure error:Nndefine CFG_TASK_NAMESZ"
#endif
#ifndef CFG_IDLE_STACKSZ
#error "Configure error:Nndefine CFG_IDLE_STACKSZ"
#endif
#if CFG_IDLE_STACKSZ == 0
#error "Configure error:CFG_IDLE_STACKSZ must be > 0"
#endif
#ifndef CFG_TASK_INFO_EN
#error "Configure error:Nndefine CFG_TASK_INFO_EN"
#endif
#if CFG_TASK_INFO_EN != 0 && CFG_TASK_INFO_EN != 1
#error "Configure error:CFG_TASK_INFO_EN must be 0 or 1"
#endif
#ifndef CFG_INFO_STACKSZ
#error "Configure error:Nndefine CFG_INFO_STACKSZ"
#endif
#ifndef CFG_ARG_CHK
#error "Configure error:Nndefine CFG_ARG_CHK"
#endif
#if CFG_ARG_CHK != 0 && CFG_ARG_CHK != 1 && CFG_ARG_CHK != 2
#error "Configure error:CFG_ARG_CHK must be 0,1,or 2"
#endif
#ifndef CFG_TICK_COUNT_EN
#error "Configure error:Nndefine CFG_TICK_COUNT_EN"
#endif
#if CFG_TICK_COUNT_EN != 0 && CFG_TICK_COUNT_EN != 1
#error "Configure error:CFG_TICK_COUNT_EN must be 0,or 1"
#endif
#ifndef CFG_IPC_TIMEOUT_EN
#error "Configure error:Nndefine CFG_IPC_TIMEOUT_EN"
#endif
#if CFG_IPC_TIMEOUT_EN != 0 && CFG_IPC_TIMEOUT_EN != 1
#error "Configure error:CFG_IPC_TIMEOUT_EN must be 0,or 1"
#endif
#ifndef CFG_SEMB_EN
#error "Configure error:Nndefine CFG_SEMB_EN"
#endif
#if CFG_SEMB_EN != 0 && CFG_SEMB_EN != 1
#error "Configure error:CFG_SEMB_EN must be 0 or 1"
#endif
#ifndef CFG_SEM_EN
#error "Configure error:Nndefine CFG_SEM_EN"
#endif
#if CFG_SEM_EN != 0 && CFG_SEM_EN != 1 && CFG_SEM_EN != 2
#error "Configure error:CFG_SEM_EN must be 0,1,or 2"
#endif
#ifndef CFG_MUTEX_EN
#error "Configure error:Nndefine CFG_MUTEX_EN"
#endif
#if CFG_MUTEX_EN != 0 && CFG_MUTEX_EN != 1 && CFG_MUTEX_EN != 2
#error "Configure error:CFG_MUTEX_EN must be 0,1,or 2"
#endif
#ifndef CFG_MBOX_EN
#error "Configure error:Nndefine CFG_MBOX_EN"
#endif
#if CFG_MBOX_EN != 0 && CFG_MBOX_EN != 1
#error "Configure error:CFG_MBOX_EN must be 0 or 1"
#endif
#ifndef CFG_MSGQ_EN
#error "Configure error:Nndefine CFG_MSGQ_EN"
#endif
#if CFG_MSGQ_EN != 0 && CFG_MSGQ_EN != 1
#error "Configure error:CFG_MSGQ_EN must be 0 or 1"
#endif
#ifndef CFG_MM_EN
#error "Configure error:Nndefine CFG_MM_EN"
#endif
#if CFG_MM_EN != 0 && CFG_MM_EN != 1
#error "Configure error:CFG_MM_EN must be 0 or 1"
#endif
#ifndef CFG_MM_BLOCKS
#error "Configure error:Nndefine CFG_MM_BLOCKS"
#endif
#ifndef CFG_DEBUG
#error "Configure error:Nndefine CFG_DEBUG"
#endif
#if CFG_DEBUG != 0 && CFG_DEBUG != 1
#error "Configure error:CFG_DEBUG must be 0,or 1"
#endif
#ifndef CFG_DUMP_BUFSZ
#error "Configure error:Nndefine CFG_DUMP_BUFSZ"
#endif
/* ------------------ */
#if CFG_MSGQ_EN > 0 && CFG_MM_EN == 0
#error "Configure error:CFG_MSGQ_EN requires CFG_MM_EN"
#endif
#if CFG_MUTEX_EN > 0 && CFG_PRIO_MODE < 2
#error "Configure error:CFG_MUTEX_EN requires CFG_PRIO_MODE >= 2"
#endif
/*===========================================================================*/
#endif