📄 osapi-os-core.h
字号:
/*** File: osapi-os-core.h**** Author: Ezra Yeheksli -Code 582/Raytheon**** Purpose: Contains functions prototype definitions and variables declarations** for the OS Abstraction Layer, Core OS module**** $Revision: 1.20 $ **** $Date: 2005/07/06 18:04:47 $**** $Log: osapi-os-core.h,v $** Revision 1.20 2005/07/06 18:04:47 nyanchik** I had to change all of the memory functions to return int32 from uint32 because I noticed they were returning OS return codes. I also updated the API document.**** Revision 1.19 2005/07/05 18:34:55 nyanchik** fixed issues found in code walkthrogh. Also removed the OS_Info* functions that are going in the BSP**** Revision 1.18 2005/06/15 16:43:48 nyanchik** added extra parenthesis for the .h file # defines**** Revision 1.17 2005/06/07 16:49:31 nyanchik** changed returns code for osapi.c to all int32 from uint32**** Revision 1.15 2005/06/02 18:04:24 nyanchik** *** empty log message ******* Revision 1.3 2005/04/01 13:09:54 nyanchik** Fixed timeout problem in OS_QueueGet by chaning timeout to int32 from unit32**** Revision 1.2 2005/03/23 13:04:34 nyanchik** Updated with the OS*GetInfoProtoTypes**** Revision 1.1 2005/03/15 18:26:32 nyanchik** *** empty log message ********* Date Written:**** */#ifndef _osapi_core_#define _osapi_core_#include "osapi.h"/*difines constants for OS_BinSemCreate for state of semaphore */#define OS_SEM_FULL 1#define OS_SEM_EMPTY 0/* tables for the properties of objects *//*tasks */typedef struct{ char name [OS_MAX_API_NAME]; uint32 creator; uint32 stack_size; uint32 priority;}OS_task_prop_t; /* queues */typedef struct{ char name [OS_MAX_API_NAME]; uint32 creator;}OS_queue_prop_t;/* Binary Semaphores */typedef struct{ char name [OS_MAX_API_NAME]; uint32 creator;}OS_bin_sem_prop_t;/* Mutexes */typedef struct{ char name [OS_MAX_API_NAME]; uint32 creator;}OS_mut_sem_prop_t;/* struct for OS_GetLocalTime() */typedef struct { uint32 seconds; uint32 microsecs;}OS_time_t; /* This typedef is for the OS_GetErrorName function, to ensure * everyone is making an array of the same length */typedef char os_err_name_t[35];/*** Exported Functions*//*** Initialization of API*/void OS_API_Init (void);/*** Task API*/int32 OS_TaskCreate (uint32 *task_id, const char *task_name, const void *function_pointer, const uint32 *stack_pointer, uint32 stack_size, uint32 priority, uint32 flags);int32 OS_TaskDelete (uint32 task_id); int32 OS_TaskDelay (uint32 millisecond);int32 OS_TaskSetPriority (uint32 task_id, uint32 new_priority);int32 OS_TaskRegister (void);uint32 OS_TaskGetId (void);int32 OS_TaskGetIdByName (uint32 *task_id, const char *task_name);int32 OS_TaskGetInfo (uint32 task_id, OS_task_prop_t *task_prop); /* ** Release 3 note:** Task Loader function** This function is used to load a module into RAM from a file system. It returns the start address which should be passed into the OS_TaskCreate function. The auto_start parameter will allow the modules "startup code" to run automatically. This will help keepcompatability with Posix process based systems.*/int32 OS_TaskLoad (char *path, uint32 *start_address, uint32 auto_start, uint32 flags);/*** Message Queue API*//*** Queue Create now has the Queue ID returned to the caller.*/int32 OS_QueueCreate (uint32 *queue_id, const char *queue_name, uint32 queue_depth, uint32 data_size, uint32 flags);int32 OS_QueueDelete (uint32 queue_id);int32 OS_QueueGet (uint32 queue_id, void *data, uint32 size, uint32 *size_copied, int32 timeout);int32 OS_QueuePut (uint32 queue_id, void *data, uint32 size, uint32 flags);int32 OS_QueueGetIdByName (uint32 *queue_id, const char *queue_name);int32 OS_QueueGetInfo (uint32 queue_id, OS_queue_prop_t *queue_prop);/*** Semaphore API*/int32 OS_BinSemCreate (uint32 *sem_id, const char *sem_name, uint32 sem_initial_value, uint32 options);int32 OS_BinSemGive (uint32 sem_id);int32 OS_BinSemTake (uint32 sem_id);int32 OS_BinSemTimedWait (uint32 sem_id, uint32 msecs);int32 OS_BinSemDelete (uint32 sem_id);int32 OS_BinSemGetIdByName (uint32 *sem_id, const char *sem_name);int32 OS_BinSemGetInfo (uint32 sem_id, OS_bin_sem_prop_t *bin_prop);/*** Mutex API*/int32 OS_MutSemCreate (uint32 *sem_id, const char *sem_name, uint32 options);int32 OS_MutSemGive (uint32 sem_id);int32 OS_MutSemTake (uint32 sem_id);int32 OS_MutSemDelete (uint32 sem_id); int32 OS_MutSemGetIdByName (uint32 *sem_id, const char *sem_name); int32 OS_MutSemGetInfo (uint32 sem_id, OS_mut_sem_prop_t *mut_prop);/*** OS Time/Tick related API*/int32 OS_Milli2Ticks (uint32 milli_seconds);int32 OS_Tick2Micros (void);int32 OS_GetLocalTime (OS_time_t *time_struct);/*** Exception API*/int32 OS_ExcAttachHandler (uint32 ExceptionNumber, void (*ExceptionHandler)(uint32, uint32 *,uint32), int32 parameter);int32 OS_ExcEnable (int32 ExceptionNumber);int32 OS_ExcDisable (int32 ExceptionNumber);/*** Floating Point Unit API*/int32 OS_FPUExcAttachHandler (uint32 ExceptionNumber, void * ExceptionHandler , int32 parameter);int32 OS_FPUExcEnable (int32 ExceptionNumber);int32 OS_FPUExcDisable (int32 ExceptionNumber);int32 OS_FPUExcFPUMask (uint32 mask);int32 OS_FPUExcGetMask (uint32 *mask);/*** Interrupt API*/int32 OS_IntAttachHandler (uint32 InterruptNumber, void * InerruptHandler , int32 parameter);int32 OS_IntEnableAll (void);int32 OS_IntDisableAll (void);int32 OS_IntSetMask (uint32 mask);int32 OS_IntGetMask (uint32 *mask);int32 OS_IntAck (int32 InterruptNumber);/*** Shared memory API */int32 OS_ShmCreateSegment (uint32 *segment_id, char *segment_name, uint32 segment_size);int32 OS_ShmAttachSegment (uint32 segment_id, uint32 *address);/*** API for a useful debugging function*/int32 OS_GetErrorName (uint32 error_num, os_err_name_t* err_name);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -