- Main Page
- Modules
- Data Structures
- Files

# Bottom Halfs
[User API: Nano Layer]

## Defines
#define | nosBottomHalfUnregister(number) nosBottomHalfRegister(number, NULL, NULL)
## Functions
NANOEXT VAR_t | nosBottomHalfRegister (UVAR_t number, NOSBHFUNC_t func, void *arg)
NANOEXT void | nosBottomHalfStart (UVAR_t number)

## Detailed Description

Note: This API is part of the nano layer

Interrupt service routines can be divided into to halfs: the top and the bottom half. The top half is that piece of code, that is directly executed when the processor gets an hardware interrupt signalled. This code is usually executed with globally disabled interrupts. Thus, a second interrupt that happens while the first interrupt is still serviced, will be delayed until the processor has left the currently running ISR again. To minimize interrupt delay, only the critical part of the ISR (the top half) is executed at interrupt level, all non critical code is executed at task level (bottom half). Because the bottom half is interruptable, critical interrupts won't be delayed too much.

## Define Documentation

#define nosBottomHalfUnregister | ( | number |  | ) | nosBottomHalfRegister(number, NULL, NULL)

  | Bottom half function. Unregisters a bottom half. Parameters:
  | number | Number of the bottom half to unregister. Must be between 0 and NOS_MAX_BOTTOMHALFS - 1.
Returns: Zero on success. Nonzero values denote an error. Note: NOSCFG_FEATURE_BOTTOMHALF must be defined to 1 to enable bottom half support. See also: nosBottomHalfRegister

## Function Documentation

NANOEXT VAR_t nosBottomHalfRegister | ( | UVAR_t | number,
|  | NOSBHFUNC_t | func,
|  | void * | arg
| ) |

  | Bottom half function. Registers a new bottom half. Parameters:
  | number | Number of the bottom half. Must be between 0 and NOS_MAX_BOTTOMHALFS - 1.
  | func | pointer to the bottom half function that shall be executed when the bottom half is triggered.
  | arg | optional argument passed to function func.
Returns: Zero on success. Nonzero values denote an error. Note: To unregister a bottom half function again, you may call this function with funcptr = NULL, or alternatively, you can use the macro nosBottomHalfUnregister. NOSCFG_FEATURE_BOTTOMHALF must be defined to 1 to enable bottom half support. Important! A bottom half function is not allowed to block, that means such a function must not call functions that may block (for example, this functions are nosTaskSleep, nosSemaGet, nosSemaWait, nosMutexLock). See also: nosBottomHalfUnregister, nosBottomHalfStart

NANOEXT void nosBottomHalfStart | ( | UVAR_t | number | ) |

  | Bottom half function. Triggers a bottom half function. The bottom half is executed when the interrupt level is left. Parameters:
  | number | Number of the bottom half. Must be between 0 and NOS_MAX_BOTTOMHALFS - 1.
Note: This function is called by the top half of an interrupt service routine. The ISR that calls this function does not need to call c_pos_intEnter before. NOSCFG_FEATURE_BOTTOMHALF must be defined to 1 to enable bottom half support. See also: nosBottomHalfRegister, nosBottomHalfUnregister