-
-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- created declaration for PAL events - move declaration from PAL header to to events header - update CMakes to include these - add implementation of bool timer event in ChibiOS - enable bool timer event in interpreter - adjust managed heap size for Discovery4 target - update code formating to improve readability - update managed heap size for ST_STM32F429I_DISCOVERY target Signed-off-by: José Simões <[email protected]>
- Loading branch information
1 parent
a123e0f
commit 0347c48
Showing
9 changed files
with
182 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// Copyright (c) 2017 The nanoFramework project contributors | ||
// Portions Copyright (c) Microsoft Corporation. All rights reserved. | ||
// See LICENSE file in the project root for full license information. | ||
// | ||
|
||
#include <nanoPAL_Events.h> | ||
|
||
__nfweak bool Events_Initialize() | ||
{ | ||
NATIVE_PROFILE_PAL_EVENTS(); | ||
return true; | ||
} | ||
|
||
__nfweak bool Events_Uninitialize() | ||
{ | ||
NATIVE_PROFILE_PAL_EVENTS(); | ||
return true; | ||
} | ||
|
||
__nfweak void Events_SetBoolTimer( bool* timerCompleteFlag, unsigned int millisecondsFromNow ) | ||
{ | ||
NATIVE_PROFILE_PAL_EVENTS(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// | ||
// Copyright (c) 2017 The nanoFramework project contributors | ||
// See LICENSE file in the project root for full license information. | ||
// | ||
|
||
#ifndef _NANOPAL_EVENTS_H_ | ||
#define _NANOPAL_EVENTS_H_ 1 | ||
|
||
#include <nanoWeak.h> | ||
#include <netmf_errors.h> | ||
|
||
// | ||
// !!! KEEP IN SYNC WITH Microsoft.SPOT.Hardware.SleepLevel !!! | ||
// | ||
enum SLEEP_LEVEL | ||
{ | ||
SLEEP_LEVEL__AWAKE = 0x00, | ||
SLEEP_LEVEL__SELECTIVE_OFF = 0x10, | ||
SLEEP_LEVEL__SLEEP = 0x20, | ||
SLEEP_LEVEL__DEEP_SLEEP = 0x30, | ||
SLEEP_LEVEL__OFF = 0x40, | ||
}; | ||
|
||
#define EVENTS_TIMEOUT_INFINITE 0xFFFFFFFF | ||
|
||
#if NATIVE_PROFILE_PAL & NATIVE_PROFILE_PAL_EVENTS__flag | ||
#define NATIVE_PROFILE_PAL_EVENTS() Native_Profiler profiler_obj | ||
#else | ||
#define NATIVE_PROFILE_PAL_EVENTS() | ||
#endif | ||
|
||
// destructive read system event flags | ||
unsigned int Events_Get( unsigned int EventsOfInterest ); | ||
|
||
// non-destructive read system event flags | ||
unsigned int Events_MaskedRead( unsigned int EventsOfInterest ); | ||
|
||
// returns 0 for timeout, non-zero are events that have happened and were asked to be waiting on (non-destructive read) | ||
// timeout limit is about 3034 milliseconds currently | ||
// values greater than this are capped to this | ||
|
||
// sleep relative time into the future, or until a SystemEvent occurs, which occurs first | ||
// timeout is a non-negative number of 1mSec ticks, or -1 (any negative value) to sleep forever until a SystemEvent occurs | ||
|
||
// Events_WaitForEvents(0, n), sleeps for n milliseconds independent of events | ||
// Events_WaitForEvents(0, EVENTS_TIMEOUT_INFINITE) sleeps forever. Don't do that. | ||
// Events_WaitForEvents(flags, EVENTS_TIMEOUT_INFINITE) waits forever for that event. | ||
|
||
unsigned int Events_WaitForEvents ( unsigned int sleepLevel, unsigned int WakeupSystemEvents, unsigned int Timeout_Milliseconds ); | ||
unsigned int Events_WaitForEventsInternal( unsigned int sleepLevel, unsigned int WakeupSystemEvents, unsigned int Timeout_Milliseconds ); | ||
|
||
__inline unsigned int Events_WaitForEvents( unsigned int WakeupSystemEvents, unsigned int Timeout_Milliseconds ) | ||
{ | ||
return Events_WaitForEvents( SLEEP_LEVEL__SLEEP, WakeupSystemEvents, Timeout_Milliseconds ); | ||
} | ||
|
||
__nfweak bool Events_Initialize(); | ||
__nfweak bool Events_Uninitialize(); | ||
__nfweak void Events_SetBoolTimer( bool* timerCompleteFlag, unsigned int millisecondsFromNow ); | ||
|
||
#endif //_NANOPAL_EVENTS_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// | ||
// Copyright (c) 2017 The nanoFramework project contributors | ||
// See LICENSE file in the project root for full license information. | ||
// | ||
|
||
#include <nanoPAL_Events.h> | ||
#include <nanoPAL.h> | ||
#include <target_platform.h> | ||
#include <hal.h> | ||
|
||
// events timer | ||
static virtual_timer_t eventsBoolTimer; | ||
|
||
bool Events_Initialize() | ||
{ | ||
NATIVE_PROFILE_PAL_EVENTS(); | ||
return true; | ||
} | ||
|
||
bool Events_Uninitialize() | ||
{ | ||
NATIVE_PROFILE_PAL_EVENTS(); | ||
|
||
chVTResetI(&eventsBoolTimer); | ||
|
||
return true; | ||
} | ||
|
||
static void local_Events_SetBoolTimer_Callback( void* arg ) | ||
{ | ||
NATIVE_PROFILE_PAL_EVENTS(); | ||
bool* timerCompleteFlag = (bool*)arg; | ||
|
||
*timerCompleteFlag = true; | ||
} | ||
|
||
void Events_SetBoolTimer( bool* timerCompleteFlag, unsigned int millisecondsFromNow ) | ||
{ | ||
NATIVE_PROFILE_PAL_EVENTS(); | ||
|
||
// we assume only 1 can be active, abort previous just in case | ||
chVTResetI(&eventsBoolTimer); | ||
|
||
if(timerCompleteFlag != NULL) | ||
{ | ||
chVTSetI(&eventsBoolTimer, MS2ST(millisecondsFromNow), local_Events_SetBoolTimer_Callback, timerCompleteFlag); | ||
} | ||
} |