OCEOS/oceos kernel/initialisation

From wiki
Jump to navigation Jump to search

OCEOS Initialization

Introduction

This section describes the OCEOS directives used to in most applications.
The application code (starting at main()) will typically carry out various system self test and initialization routines and set up interrupt/trap handlers, and then use OCEOS

The calls to get OCEOS running are:

  1. oceos_init - Uses oceos_init to Initialize fixed data and start system time and log
  2. oceos_task_create - Create task setting priority, maximum number of jobs, start function, etc.
  3. oceos_init_finish - Complete and check fixed data area
  4. oceos_start - Start the scheduler - will start optional initial task or put CPU in sleep mode waiting for interrupt.

The functions that implement the operations of each task are defined in the application. The start function for each task and optional task tidy up kill function are specified when a task is created.

If mutexes, semaphores, data queues and/or timed actions are required they also are created at step 2.

Note

It is mandatory to create the number of tasks, mutexes, semaphores, and data queues declared in oceos_config.h otherwise oceos_init_finish() will return an error.

In OCEOS all task, mutex and other names are unsigned integers and it is strongly recommended that enumerated types are used for this purpose, so as to provide user friendly names.

It is suggested that these names be defined in the application header that is also used for application function declarations. To avoid possible confusion between names, it is suggested also that all task names start with 't_', all mutex names with 'm_', etc.

API Functions

API Functions
Directive Description main task IRQ handler
oceos_init() Initialize fixed data *
oceos_init_finish() Complete and check fixed data area *
oceos_start() Start the scheduler *
oceos_exit() Start the scheduler * *
oceos_CPU_sleep() Start the scheduler *

oceos_init()

Header
initialisation.h

Description
Initialises OCEOS and must be the first directive used.

Initialises the OCEOS system meta data using the information supplied in the application configuration and prepares for creation of tasks etc.

The values provided in the application configuration are checked as much as possible before being used.

The system log also is created here.

This function sets up sysMetaPtr and init_meta_ptr and must have completed successfully before tasks etc. can be created.

It disables interrupts and leaves them disabled, they will be re-enabled to the previous level after all tasks etc. have been created and oceos_init_finish() has completed successfully.
Prototype

enum DIRECTIVE_STATUS   oceos_init(
    struct application_configuration
);

Parameters

Returns

Example Usage

oceos_init_finish()

Header
initialisation.h

Description

Prototype

Parameters

Returns

Example Usage

oceos_start()

Header
initialisation.h

Description

Prototype

Parameters

Returns

Example Usage

oceos_exit()

Header
initialisation.h

Description

Prototype

Parameters

Returns

Example Usage

oceos_CPU_sleep()

Header
initialisation.h

Description

Prototype

Parameters

Returns

Example Usage