Netcruzer Library API  V2.03
 All Data Structures Files Functions Variables Typedefs Enumerations Macros Groups Pages
nzos_fiber.h File Reference

Netcruzer RTOS Fibers. More...

Go to the source code of this file.

Data Structures

struct  FIBER_TCB_
 
struct  NZOS_FIBER_INFO_
 

Macros

#define __INLINE_FUNCTION__   extern inline __attribute__((always_inline))
 
#define nzosFIBER_LEVELS   ( 2 )
 
#define nzFbrSchedule(pFbrTCB)
 

Typedefs

typedef struct FIBER_TCB_ FIBER_TCB
 
typedef struct NZOS_FIBER_INFO_ NZOS_FIBER_INFO
 

Functions

WORD nzFbrCreate (BYTE level, BOOL highPriority, void(*ptrFiber)(void), FIBER_TCB *fbrTcb)
 

Variables

NZOS_FIBER_INFO zvFbrInfo
 

Detailed Description

Netcruzer RTOS Fibers.

Author
Modtronix Engineering
Compiler:
MPLAB XC16 & XC32 Compilers

Description

Netcruzer RTOS Functions

Configuration

The following defines are used to configure this module, and should be placed in projdefs.h. Note that all items marked [-DEFAULT-] are defaults, and do not have to be placed in projdefs.h if they contain desired configuration! For details, see Project Configuration.

// *********************************************************************
// ----------- RTOS Fiber Configuration (from nzos_fiber.h) ------------
// *********************************************************************
#define nzosFIBER_ENABLE ( 0 )
#define nzosFIBER_LEVELS ( 2 ) //Must be 2,4,6 or 8. Each level has 8 fibers

Software License Agreement

The software supplied herewith is owned by Modtronix Engineering, and is protected under applicable copyright laws. The software supplied herewith is intended and supplied to you, the Company customer, for use solely and exclusively on products manufactured by Modtronix Engineering. The code may be modified and can be used free of charge for commercial and non commercial applications. All rights are reserved. Any use in violation of the foregoing restrictions may subject the user to criminal sanctions under applicable laws, as well as to civil liability for the breach of the terms and conditions of this license.

THIS SOFTWARE IS PROVIDED IN AN 'AS IS' CONDITION. NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.

File History

2014-02-02, David H. (DH):

  • Initial version

Macro Definition Documentation

#define nzFbrSchedule (   pFbrTCB)
Value:
/* Set flag for kernel to indicate fiber must be ran */ \
*((pFbrTCB)->pSchedule) |= (pFbrTCB)->mask; \
/* Schedule the "Netcruzer RTOS Kernel" to run! */ \
NZOS_INT_KERNEL_SET_IF();

Schedule the fiber to run once. This call can be made from an ISR or Task. The fiber will be run as soon as there are no priority 2-7 interrups pending or being executed.

Parameters
pFbrTCBPointer to the Fiber TCB of the fiber to schedule for running.
Returns
Returns NZ_RTOS_SUCCESS (0) if success, else an NZ_FBR_ERR_xx error code
Examples:
sensor_dht11_dht22/main.c.

Function Documentation

WORD nzFbrCreate ( BYTE  level,
BOOL  highPriority,
void(*)(void)  ptrFiber,
FIBER_TCB fbrTcb 
)

Creates a fiber. To run the created fiber, call nzFbrSchedule() function. The nzosFIBER_LEVELS define defines how many Fiber levels there are. Each level has 8 fibers of incementing priority. The higher the level, the higher the priority. So, if the system is configured for 4 levels, there can be a total of 32 (4x8) fibers.

Parameters
levelThe fiber level, a value from 1 to nzosFIBER_LEVELS.
highPriorityTRUE if the created fiber must have the highest priority available in the given level. If FALSE, it will be given the lowest available priority for the given level.
ptrFiberPointer to fiber function.
fbrTcbPointer to FIBER_TCB
Returns
Returns 0 if successful, else the error code (a NZ_FBR_ERR_XX define).
  • 0 = Success
  • NZ_FBR_ERR_CREATE = General error
  • NZ_FBR_ERR_LEVEL_FULL = No space left in given level
  • NZ_FBR_ERR_INVALID_LEVEL = Invalid level given
Examples:
sensor_dht11_dht22/main.c.