|
USB EPROM/Flash Programmer
|
Pico Multi Core Class. More...
#include <multicore.hpp>
Public Types | |
| enum | CoreStatus { csStopped , csRunning , csStarting , csStopping } |
| Defines possible values for CPU core status. More... | |
| typedef void(* | MultiCoreEntry) (MultiCore &) |
| Entry point to second core routine. More... | |
Public Member Functions | |
| MultiCore (MultiCoreEntry entry) | |
| Constructor. More... | |
| ~MultiCore () | |
| Destructor. More... | |
| void | launch () |
| Runs the entry point routine into second CPU core. More... | |
| void | stop () |
| Stops the execution of second CPU core. More... | |
| bool | isRunning () const |
| Return if second CPU core is running. More... | |
| bool | isStopRequested () const |
| Returns if the second CPU core has been requested to stop. More... | |
| CoreStatus | getStatus () const |
| Gets the status of second CPU core. More... | |
| void | putParam (uintptr_t src) |
| Sends a 32-bit parameter to second core routine. More... | |
| uintptr_t | getParam () |
| Receives a 32-bit parameter sent from first core routine. More... | |
| void | lock () |
| Locks execution line (using mutex). More... | |
| void | unlock () |
| Unlocks execution line (using mutex). More... | |
Static Public Member Functions | |
| static void | usleep (uint64_t us) |
| Sleeps the execution of current CPU core for a number of microseconds. More... | |
| static void | msleep (uint32_t ms) |
| Sleeps the execution of current CPU core for a number of milliseconds. More... | |
Pico Multi Core Class.
The purpose of this class is to allow processing on the second CPU core on the board.
| typedef void(* MultiCoreEntry) (MultiCore &) |
Entry point to second core routine.
A valid routine to be used as an entry point for the second CPU core must be of this type.
For example:
void second_core_my_entry(MultiCore& core) { ... }
| enum CoreStatus |
|
explicit |
Constructor.
| entry | Entry point (function) for second CPU core. |
| ~MultiCore | ( | ) |
Destructor.
| void launch | ( | ) |
Runs the entry point routine into second CPU core.
| void stop | ( | ) |
Stops the execution of second CPU core.
| bool isRunning | ( | ) | const |
Return if second CPU core is running.
| bool isStopRequested | ( | ) | const |
Returns if the second CPU core has been requested to stop.
| MultiCore::CoreStatus getStatus | ( | ) | const |
Gets the status of second CPU core.
| void putParam | ( | uintptr_t | src | ) |
Sends a 32-bit parameter to second core routine.
Sends a parameter to second CPU core routine.
Blocks the caller (on first core) until the second core processes this parameter through getParam().
| src | Value to send. |
| uintptr_t getParam | ( | ) |
Receives a 32-bit parameter sent from first core routine.
Receives a parameter sent from first CPU core routine.
Blocks the caller (on second core) until the first core sends one parameter through putParam(uint32_t).
| void lock | ( | ) |
Locks execution line (using mutex).
Protects code of the simultaneous write access (and race conditions).
| void unlock | ( | ) |
Unlocks execution line (using mutex).
Protects code of the simultaneous write access (and race conditions).
|
static |
Sleeps the execution of current CPU core for a number of microseconds.
| us | Number of microseconds to sleep. |
|
static |
Sleeps the execution of current CPU core for a number of milliseconds.
| ms | Number of milliseconds to sleep. |