Uso de RTOS
Macros | Typedefs | Functions
OS_CPU.H File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define OS_STK_GROWTH   0
 
#define BYTE   INT8S
 
#define UBYTE   INT8U
 
#define WORD   INT16S
 
#define UWORD   INT16U
 
#define LONG   INT32S
 
#define ULONG   INT32U
 
#define LOWORD(l)   ((INT16U)(l))
 
#define HIWORD(l)   (INT16U) *( ( (INT16U*) &((INT32U)(w)) ) + 1 )
 
#define LOBYTE(w)   ((INT8U)(w))
 
#define HIBYTE(w)   (INT8U) *( ( (INT8U*) &((INT16U)(w)) ) + 1 )
 
#define OS_CRITICAL_METHOD   3
 
#define OS_ENTER_CRITICAL()
 
#define OS_EXIT_CRITICAL()   if(cpu_sr) INTCONbits.GIEH = 1
 
#define OS_TASK_SW()   OSCtxSw()
 

Typedefs

typedef unsigned char BOOLEAN
 
typedef unsigned char INT8U
 
typedef signed char INT8S
 
typedef unsigned int INT16U
 
typedef signed int INT16S
 
typedef unsigned long INT32U
 
typedef signed long INT32S
 
typedef float FP32
 
typedef double FP64
 
typedef signed short long INT24S
 
typedef unsigned short long INT24U
 
typedef INT8U OS_STK
 
typedef INT8U OS_CPU_SR
 

Functions

void CPUInterruptHook (void)
 INTERRUPT SERVICE ROUTINE HOOK.
 
void OSCtxSw (void)
 Switch the context by calling the function directly, since there are no software interrupts in a PIC18 processor. More...
 

Detailed Description

Author
Nathan Brown

Macro Definition Documentation

◆ BYTE

#define BYTE   INT8S

Define data types for backward compatibility ...

◆ HIBYTE

#define HIBYTE (   w)    (INT8U) *( ( (INT8U*) &((INT16U)(w)) ) + 1 )

HIBYTE

◆ HIWORD

#define HIWORD (   l)    (INT16U) *( ( (INT16U*) &((INT32U)(w)) ) + 1 )

HIWORD

◆ LOBYTE

#define LOBYTE (   w)    ((INT8U)(w))

LOBYTE

◆ LONG

#define LONG   INT32S

Signed 32 bit quantity

◆ LOWORD

#define LOWORD (   l)    ((INT16U)(l))

LOWORD

◆ OS_CRITICAL_METHOD

#define OS_CRITICAL_METHOD   3

HIWORD

◆ OS_ENTER_CRITICAL

#define OS_ENTER_CRITICAL ( )
Value:
cpu_sr = 0; \
if(INTCONbits.GIEH){cpu_sr = 1;}\
INTCONbits.GIEH = 0

◆ OS_STK_GROWTH

#define OS_STK_GROWTH   0

Define stack growth: 1 = Down, 0 = Up

◆ OS_TASK_SW

#define OS_TASK_SW ( )    OSCtxSw()

OsCtxSw()

◆ UBYTE

#define UBYTE   INT8U

... to uC/OS V1.xx. Not actually needed for ...

◆ ULONG

#define ULONG   INT32U

Unsigned 32 bit quantity

◆ UWORD

#define UWORD   INT16U

Unsigned 16 bit quantity

◆ WORD

#define WORD   INT16S

... uC/OS-II.

Typedef Documentation

◆ BOOLEAN

typedef unsigned char BOOLEAN

Boolean

◆ FP32

typedef float FP32

Single precision floating point

◆ FP64

typedef double FP64

Double precision floating point

◆ INT16S

typedef signed int INT16S

Signed 16 bit quantity

◆ INT16U

typedef unsigned int INT16U

Unsigned 16 bit quantity

◆ INT24S

typedef signed short long INT24S

Signed 24 bit quantity

◆ INT24U

typedef unsigned short long INT24U

Unsigned 24 bit quantity

◆ INT32S

typedef signed long INT32S

Signed 32 bit quantity

◆ INT32U

typedef unsigned long INT32U

Unsigned 32 bit quantity

◆ INT8S

typedef signed char INT8S

Signed 8 bit quantity

◆ INT8U

typedef unsigned char INT8U

Unsigned 8 bit quantity

◆ OS_CPU_SR

typedef INT8U OS_CPU_SR

Size of Processor Status Word (PSW)

◆ OS_STK

typedef INT8U OS_STK

Each stack entry is 8-bit wide

Function Documentation

◆ OSCtxSw()

void OSCtxSw ( void  )

Switch the context by calling the function directly, since there are no software interrupts in a PIC18 processor.

TASK LEVEL CONTEXT SWITCH
This function is called when a task makes a higher priority task ready-to-run. /*.

TASK CONTEXT SWITCH

Switch the context by calling the function directly, since there are no software interrupts in a PIC18 processor.

TASK LEVEL CONTEXT SWITCH

Description : This function is called when a task makes a higher priority task ready-to-run.

Arguments : none

Note(s) : 1) Upon entry, OSTCBCur points to the OS_TCB of the task to suspend OSTCBHighRdy points to the OS_TCB of the task to resume

2) The stack frame of the task to resume looks as follows:

                                                                       LOW MEMORY
                        -   19      pdata (lower 8 bits)
                        -   18      pdata (upper 8 bits)
                        -   17      XX (pointed to by FSR1, frame pointer)
                        -   16      STATUS  register
                        -   15      BSR     register
                        -   14      W       register
                        -   13      FSR0L   register
                        -   12      FSR0H   register
                        -   11      FSR2L   register (frame pointer, low)
                        -   10      FSR2H   register (frame pointer, high)
                        -   9       TBLPTRL register
                        -   8       TBLPTRH register
                        -   7       TBLPTRU register
                        -   6       PRODL   register
                        -   5       PRODH   register

                    (end repeating, based on number of items)
                        -   4       TOSL    (top of return stack, low)
                        -   3       TOSH    (top of return stack, high)
                        -   2       TOSU    (top of return stack, upper)
                    (start repeating, based on number of items)

                        -   1       (number of return stack items)

OSTCBHighRdy->OSTCBStkPtr - 0 -—> (free item) HIGH MEMORY