The content of the AR_API.h file for 80x86 CPUs is shown below. This file should provide the definitions, types, and functions illustrated in the example. When defining a new port file, the programmer must perform specific modifications: the value of the AR_TICKS_PER_SECOND constant must be defined, and the TTaskContext structure must be populated with mandatory fields to enable context switching. For further details, please refer to the detailed description of the specific definition, type, or function.
/**************************************************************************** * * Sirius RTOS * AR_API.h - Architecture API * Version 1.00 * * Copyright 2010 by SpaceShadow * All rights reserved! * ***************************************************************************/ /***************************************************************************/ #ifndef AR_API_H #define AR_API_H /***************************************************************************/ /**************************************************************************** * * Includes * ***************************************************************************/ #include "Config.h" #include "AR_Types.h" /**************************************************************************** * * Default configuration * ***************************************************************************/ /* arDeinit function is enabled by default */ #ifndef AR_USE_DEINIT_FUNC #define AR_USE_DEINIT_FUNC 1 #endif /**************************************************************************** * * Definitions * ***************************************************************************/ /* Number of ticks per second for the value returned by arGetTickCount */ #define AR_TICKS_PER_SECOND 1000UL /**************************************************************************** * * Type definitions * ***************************************************************************/ /* Task context structure */ struct TTaskContext { PVOID TaskContext; PVOID StackAddress; }; /* Function callbacks */ typedef void (CALLBACK *TPreemptiveProc)(struct TTaskContext FAR *TaskContext); typedef void (CALLBACK *TTaskStartupProc)(void); /**************************************************************************** * * Functions * ***************************************************************************/ #ifdef __cplusplus extern "C" { #endif BOOL arInit(void); #if AR_USE_DEINIT_FUNC void arDeinit(void); #endif BOOL arLock(void); void arRestore(BOOL PreviousLockState); TIME arGetTickCount(void); #if OS_USED BOOL arSetPreemptiveHandler(TPreemptiveProc PreemptiveProc, SIZE StackSize); void arYield(void); BOOL arCreateTaskContext(struct TTaskContext FAR *TaskContext, TTaskStartupProc TaskStartupProc, SIZE StackSize); BOOL arReleaseTaskContext(struct TTaskContext FAR *TaskContext); void arSavePower(void); #endif #ifdef __cplusplus }; #endif /***************************************************************************/ #endif /* AR_API_H */ /***************************************************************************/