OCEOSmp/blank
Next Section
Logging directives
Introduction
Log Area Features (for details of other areas see oceos_areas.h)
The system log area holds the system log and the records of the present and previous values of the system state variable.
It is set up initially as an array of 32-bit words that starts at a 32-bit aligned address provided by the application developer.
It is recommended that this address be in non-volatile RAM memory if this is available to allow information be preserved across power-up cycles.
OCEOS preserves log area information across resets as far as possible.
The system log itself is a circular buffer of struct log entry. Older entries are overwritten by new entries once all entries are in use.
The application developer can specify a function to be called when 3/4 of log entries are in use. This function is called again only after 3/4 of log entries have been read and the log has again become 3/4 full.
The read and write indices are stored in the log area and if equal indicate that the log is empty.
As with other OCEOS data areas, the log area starts with a header
- a 32-bit word holding a constant OCEOS_VERSION
- a 32-bit word holding the log area size in 32-bit words
- a 32-bit word, the system status variable
- a 32-bit word, the system status mask
- a 32-bit word, the accumulated system status
- a 32-bit word, the previous system status mask
- a 32-bit word, the log control, that gives whether the log full function was called
- the read index
- the write index
- an array of struct log_entry making up the system log itself
- ending with a 32-bit constant END_SENTINEL
The system fixed meta structure at sysMetaPtr provides
- system_log_ptr the start address of the log area
- logEntries the number of log entries
- logCreated flag indicating log was created successfully
- logFullFunction user defined function, called when the log becomes 3/4 full (or NULL if not used)
Log Entry Types and Structure
/***************************************************************************** * LOG ENTRY TYPES * * A log entry type is an 8-bit number. * Values from 0 to 127 can be defined by the application. * Values from 128 to 255 are used by OCEOS as below. * * * NOTE: Add new log types at the end for backward compatibility */ enum LOG_ENTRY_TYPE{ LOG_SYS_OK = 0x80U, LOG_OCEOS_ABORT, // when exiting from oceos_start LOG_LOG_NOT_VALID_ENTRY, // used to initialise log and when log empty LOG_INIT_TASK_START_FAIL, // initial task passed to oceos_start failed LOG_DEADLINE_MISSED, // task deadline missed LOG_JOB_NOT_ACTIVE, // cpu_terminate but job not active, absurd LOG_JOB_NOT_FREE, // job guarded but not free LOG_JOBS_INC_FAILED, // pending jobs increment failed LOG_JOB_NOT_GUARDED, // paranoia LOG_CS_LOG_SPIN_FAIL, // oceos_CPU_sleep, trying to update CS log LOG_MUTEX_ALREADY_HELD, // oceos_mutex_wait, code returned, not needed LOG_MUTEX_INCORRECT_ORDER, // oceos_mutex_wait LOG_MUTEX_EXIT_HOLDING, // task exits holding one or more mutexes LOG_MUTEX_EXIT_NONE, // __oceos_tasks_remove_mutexes called but no mutex held LOG_SEMAPHORE_PENDING_REMOVE_FAIL, // timed_action.c LOG_SEMAPHORE_PENDING_QUEUE_FULL, // __oceos_semaphore_add_pend LOG_SEMAPHORE_SPIN_FAILED, // trying to access semaphore LOG_DATAQ_PENDING_QUEUE_FULL, LOG_DATAQ_PENDING_REMOVE_FAIL, LOG_DATAQ_SPIN_FAILED, LOG_TIMED_ACTION_TIMER_NULL, LOG_TIMED_ACTION_INVALID, LOG_TIMED_ACTION_BAD_INDEX, LOG_TIMED_ACTION_MISSED, LOG_TIMED_ACTION_Q_EMPTY, LOG_TIMED_ACTION_REMOVE_FAIL, LOG_TIMED_ACTION_BAD_JOB_ID, LOG_TIMED_Q_SPIN_FAIL, LOG_SYSTEM_ERROR, LOG_ATOMICINC_FAILED, LOG_PENDING_PRI_UPDATE_FAILED, LOG_KILL_TASK_INVALID_ID, // Tried to kill task with invalid ID LOG_OCEOS_EXIT_REQUEST, // oceos_exit command was called LOG_RWMUTEX_NOT_RETURNED, LOG_RWMUTEX_NOT_HIGHEST }; /***************************************************************************** * Structures */ /** * Log entry structure */ struct log_entry{ U64_t time64; unsigned int entry_cpu :8; unsigned int entry_type :8; unsigned int entry_note :16; // not used at present U32_t entry_comment; }__attribute__ ((aligned (8)));blank_function()
Header File
header.h
Description
This function does xyz...Prototype
S32_t oceosmp_blank( U32_t param );Parameters
Parameter Description param parameter to function Returns
This function returns an S32_t with a value of OCEOS_SUCCESS (zero) or return code bits set as defined in the table below.
Error bit Description Error_name description Example Usage
S32_t status, param; ... // Do xyz status = oceosmp_blank(param));