Difference between revisions of "OCEOS/oceos kernel/initialisation"

From wiki
Jump to navigation Jump to search
Line 69: Line 69:
|}
|}
<span style="color:#1b7ac2">'''Returns'''</span><br>
<span style="color:#1b7ac2">'''Returns'''</span><br>
enum DIRECTIVE_STATUS
This function return enum DIRECTIVE_STATUS.<br>
        INVALID_ADDRESS         If Failed on memory initialisation (write to memory)
TARGET ARM:
        UNSATISFIED             If Failed on Log area initialisation
{| class="wikitable"
        SUCCESSFUL              If All OK
|-
  FOR ARM :
! enum DIRECTIVE_STATUS !! Description
        NOT_CONFIGURED         If System frequency is not set or
|-
| INVALID_ADDRESS|| If Failed on memory initialisation (write to memory)
|-
| UNSATISFIED|| If Failed on Log area initialisation
|-
| NOT_CONFIGURED|| If System frequency is not set or
                                 oceos_SysTick_Handler is not in trap table or
                                 oceos_SysTick_Handler is not in trap table or
                                 Timer start called without initialisation (check log)
                                 Timer start called without initialisation (check log)
  FOR SPARC:
|-
        NOT_CONFIGURED         If System timer handler is NULL or
| SUCCESSFUL || If All OK
|}
TARGET SPARC:
{| class="wikitable"
|-
! enum DIRECTIVE_STATUS !! Description
|-
| INVALID_ADDRESS|| If Failed on memory initialisation (write to memory)
|-
| UNSATISFIED|| If Failed on Log area initialisation
|-
| NOT_CONFIGURED|| If System timer handler is NULL or
                                 System frequency is not set
                                 System frequency is not set
        INVALID_ID             If System sub timer ID is not valid
|-
        FAILED_TO_SET_REGISTER If Failed on register write (check log)
| INVALID_ID|| If System sub timer ID is not valid
|-
| FAILED_TO_SET_REGISTER|| If Failed on register write (check log)
|-
| SUCCESSFUL || If All OK
|}
<span style="color:#1b7ac2">'''Example Usage'''</span><br>
<span style="color:#1b7ac2">'''Example Usage'''</span><br>
</blockquote>
</blockquote>

Revision as of 18:08, 11 March 2022

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 File
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 app_config
);

Parameters

Parameter Description
app_config Pointer to configuration struct. struct application_configuration defined in basic_structs.h

Returns
This function return enum DIRECTIVE_STATUS.
TARGET ARM:

enum DIRECTIVE_STATUS Description
INVALID_ADDRESS If Failed on memory initialisation (write to memory)
UNSATISFIED If Failed on Log area initialisation
NOT_CONFIGURED If System frequency is not set or

oceos_SysTick_Handler is not in trap table or Timer start called without initialisation (check log)

SUCCESSFUL If All OK

TARGET SPARC:

enum DIRECTIVE_STATUS Description
INVALID_ADDRESS If Failed on memory initialisation (write to memory)
UNSATISFIED If Failed on Log area initialisation
NOT_CONFIGURED If System timer handler is NULL or

System frequency is not set

INVALID_ID If System sub timer ID is not valid
FAILED_TO_SET_REGISTER If Failed on register write (check log)
SUCCESSFUL If All OK

Example Usage

oceos_init_finish()

Header File
initialisation.h

Description

Prototype

Parameters

Returns

Example Usage

oceos_start()

Header File
initialisation.h

Description

Prototype

Parameters

Returns

Example Usage

oceos_exit()

Header File
initialisation.h

Description

Prototype

Parameters

Returns

Example Usage

oceos_CPU_sleep()

Header File
initialisation.h

Description

Prototype

Parameters

Returns

Example Usage