mirror of https://github.com/ARMmbed/mbed-os.git
1.9 KiB
1.9 KiB
Platform API
Platform API is the base where the 6LoWPAN stack runs. It is the separation between the actual hardware or operating system and the 6LoWPAN stack itself. This is the first layer to study to port the 6LoWPAN stack to a new platform.
The most important parts of Platform API are the timers and critical section functions. These are required for the event-based stack to start up and run.
API Headers
#include arm_hal_interrupt.h
#include arm_hal_timer.h
#include eventOS_scheduler.h
#include arm_hal_random.h
#include arm_hal_aes.h
Table 3-1 lists the scopes of the Platform API functions.
Table 3-1 Scopes of Platform API functions
Scope | API responsibility |
---|---|
Critical section | The 6LoWPAN stack uses the Platform API to signal that a device is about to enter or exit a critical section where interruptions are not tolerated. Functions: platform_enter_critical() platform_exit_critical() |
Idle and sleep functions | The 6LoWPAN stack signals a possible idle or sleep condition. This part of the API is used to manage the power consumption of a processor core and radio drivers. Functions prefixed with: eventOS_scheduler |
Random number generation | The 6LoWPAN stack relies on platform drivers to generate random numbers. Functions prefixed with: platform_random |
Timers | The eventing system requires timers to be implemented on platform drivers. Functions prefixed with: eventOS_event_timer |
AES encryption | To use security on a network layer, AES encryption must be implemented on platform drivers. This allows using hardware encryption where available. ARM supports sample software implementation for platforms without HW encryption. platform_aes_block_encode() |
For more information on Platform API, see the chapter Porting 6LoWPAN Stack.