⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ostype.h

📁 Flash file system
💻 H
字号:
/* ###########################################################################
###  Modified from Intel fdi_type.h
###  -------------------------------------------------------------------------
###
###  Module: OSTYPE.H - This file defines prototypes for ostype.c
###
###  $Date: 09/30/02
###  $Author: gzhu $
###  $NoKeywords $
########################################################################### */

#ifndef ostype_h

#define ostype_h

#include "fdi_err.h"

typedef NU_SEMAPHORE *   SEM_ID;

#define CUSTOM_SEM_MTX

#ifndef CUSTOM_SEM_MTX  
#define SEM_MTX_ID SEM_ID
#else
   typedef  struct
   {
	  NU_TASK * current_task_id;
      WORD wait_count; 
      SEM_ID binary_sem;
      BYTE used; 
      BYTE reserved;
   } SEM_MTX;

   typedef SEM_MTX * SEM_MTX_ID;
#endif
/*E.5.0.598.START*/
/* Semaphore Routine Macros: */
/*
 * TASK_CREATE_DESTROY - If TRUE, FDI can dynamically create and destroy
 * the BKGD_Task and the RECL_Task.  Customers using operating systems that
 * don't allow dynamic creation and destruction of tasks can statically
 * define their tasks.  Test_GSM will create and destroy these two tasks
 * on startup and shutdown if this is FALSE
 */
#define TASK_CREATE_DESTROY TRUE       /* default is TRUE */

/*
 * SEM_CREATE_DESTROY - If TRUE, FDI can dynamically create and destroy
 * the semaphores for background and reclaim.  Customers using operating 
 * systems that don't allow dynamic creation and destruction of semaphores
 * can statically define their semaphores.  Test_GSM will create and destroy
 * these semaphores on startup and shutdown if this is FALSE
 */
#define SEM_CREATE_DESTROY TRUE        /* default is TRUE */

/*
 * Static tasks and dynamic semaphores is not supported at this time.
 * Do not set TASK_CREATE_DESTROY to FALSE and SEM_CREATE_DESTROY to
 * TRUE.
 */

/* 
 * The following macro, OS_MACROS, should initialy be undefined 
 * for stand alone FDI and customer use. Define it only if the following 
 * macros are defined else where.
 */
#if(SEM_CREATE_DESTROY == TRUE)
#ifndef OS_MACROS
extern ERR_CODE SEM_TRY_WAIT(SEM_ID a);
extern ERR_CODE SEM_WAIT(SEM_ID a);
extern ERR_CODE SEM_WAIT_TIME(SEM_ID a, UNSIGNED time_out);
extern ERR_CODE SEM_POST(SEM_ID a);
extern SEM_ID   SEM_BIN_CREATE(void);
extern ERR_CODE SemDestroy(SEM_ID a);

#define SEM_DESTROY(a)					SemDestroy(a); a = NULL

#endif  /*OS_MACROS*/
#endif /* SEM_CREATE_DESTROY */

#ifndef SEM_MTX_CREATE
#ifndef OS_MACROS
#define SEM_MTX_CREATE()               Sem_Mtx_Create()
#define SEM_MTX_POST(a)                Sem_Mtx_Post(a)
#define SEM_MTX_TRY_WAIT(a)            Sem_Mtx_Try_Wait(a)
#define SEM_MTX_WAIT(a)                Sem_Mtx_Wait(a)
#define SEM_MTX_DESTROY(a)             Sem_Mtx_Destroy(a); a = NULL
#define Q_STATIC_SEM_CNT                9
#endif  /*OS_MACROS*/
#endif /*SEM_MTX_CREATE*/

#if (TASK_CREATE_DESTROY == TRUE)
#ifndef OS_MACROS

typedef	void (*TASK_ENTRY)(UNSIGNED, void *);

typedef struct 
{
	NU_TASK		TaskCB;
	VOID *		pStack;
} TASK_INFO;

typedef TASK_INFO * PTASK_INFO;

extern PTASK_INFO					SPAWN(CHAR *Name, 
										  OPTION Priority, 
										  UNSIGNED unused, 
										  UNSIGNED stack_size, 
										  DWORD task_entry);

#define SPAWN_ERROR                 NULL
#define TASK_OPTIONS                0

extern ERR_CODE						TaskDestroy(PTASK_INFO pTaskInfo);

#define TASK_DESTROY(a)				TaskDestroy(a); a = 0

#endif /* OS_MACROS */
#endif /*TASK_CREATE_DESTROY*/

#define FDI_POOL_SIZE					12*1024 / sizeof(UNSIGNED)

ERR_CODE	FDI_Setup(void);
void		FDI_Exit(void);

void *		FDI_Malloc(UNSIGNED size);
ERR_CODE	FDI_Free(void * mem_ptr);

#define Current_Task_Pointer()         NU_Current_Task_Pointer()
/*#define Interupt_Level_Set             intLevelSet*/
#define TaskDelay(a)                   NU_Sleep(a)


#ifndef DISABLE_INTERRUPTS
#define DISABLE_INTERRUPTS(key0, key1) \
		   SysIntDisable(SYS_ALL_INT); \
		   (key1) = (key0)
#endif /* DISABLE_INTERRUPTS */

#ifndef ENABLE_INTERRUPTS
#define ENABLE_INTERRUPTS(key0, key1) \
		   SysIntEnable(SYS_ALL_INT); \
		   (key1) = (key0)
#endif /* ENABLE_INTERRUPTS */

#define PERF_TEST	FALSE


#endif /*ostype_h*/

/*****************************************************************************
* $Log: ostype.h $
* Revision 1.3  2003/01/17 03:36:01  gzhu
* Check in for VTC
* Revision 1.3  2003/01/07 17:12:23  jjs
* Revision 1.2  2003/01/07 11:35:35  jjs
* change defines of SEM_DESTROY & TASK_DESTROY.
*****************************************************************************/




⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -