All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
vexcortex.c File Reference

Cortex initialization and system tasks. More...

#include "ch.h"
#include "hal.h"
#include "vex.h"

Data Structures

struct  vexThread
 Link thread with it's event listener. More...
 

Macros

#define MAX_THREAD   20
 Storage for the user threads. More...
 

Functions

void CleanupTask (Thread *tp) __attribute__((weak))
 cleanup a task if it was terminated elsewhere More...
 
void vexTaskRegister (char *name)
 Register a thread so it can be terminated during vexSleep. More...
 
void vexTaskRegisterPersistant (char *name, bool_t p)
 Register a thread so it can be terminated during vexSleep. More...
 
bool_t vexTaskIsRegistered (Thread *tp)
 Check if this thread was already registered. More...
 
bool_t vexTaskPersistentGet (Thread *tp)
 Check if this thread has persistent flag set. More...
 
void vexTaskPersistentSet (Thread *tp, bool_t p)
 Set persistent flag. More...
 
void vexTaskDebug (vexStream *chp, int argc, char *argv[])
 Dump the list of registered tasks. More...
 
void vexTaskEmergencyStop ()
 Stop all tasks. More...
 
void vexSleep (int32_t msec)
 Sleep for given number of ms. More...
 
void vexCortexInit ()
 Initialize the VEX cortex. More...
 
void vexConsoleInit ()
 Initialize the console serial port. More...
 
void vexWatchdogInit ()
 Init watchdog timer. More...
 
void vexWatchdogReload ()
 Reload the IWDG - call several times per second. More...
 
int16_t vexWatchdogResetFlagGet ()
 Check to see if the IWDG was the cause of reset. More...
 

Detailed Description

Cortex initialization and system tasks.

Macro Definition Documentation

#define MAX_THREAD   20

Storage for the user threads.

Function Documentation

void CleanupTask ( Thread *  tp)

cleanup a task if it was terminated elsewhere

Parameters
[in]tpA pointer to a thread
Note
this will not usually be called by the user by by an internal thread
void vexTaskRegister ( char *  name)

Register a thread so it can be terminated during vexSleep.

Parameters
[in]namestring describing the thread
void vexTaskRegisterPersistant ( char *  name,
bool_t  p 
)

Register a thread so it can be terminated during vexSleep.

Parameters
[in]namestring describing the thread
[in]ppersistent flag
bool_t vexTaskIsRegistered ( Thread *  tp)

Check if this thread was already registered.

Parameters
[in]tppointer to the Thread structure
Returns
bool with registration status
bool_t vexTaskPersistentGet ( Thread *  tp)

Check if this thread has persistent flag set.

Parameters
[in]tppointer to the Thread structure
Returns
bool with persistent status
void vexTaskPersistentSet ( Thread *  tp,
bool_t  p 
)

Set persistent flag.

Parameters
[in]tppointer to the Thread structure
[in]ppersistent flag
void vexTaskDebug ( vexStream chp,
int  argc,
char *  argv[] 
)

Dump the list of registered tasks.

Parameters
[in]chpA pointer to a vexStream object
[in]argcThe number of command line arguments
[in]argvAn array of pointers to the command line args
void vexTaskEmergencyStop ( void  )

Stop all tasks.

Call this to stop all tasks that were registered with vexTaskRegister or vexTaskRegisterPersistant. Use as emergency stop, cortex will need rebooting

void vexSleep ( int32_t  msec)

Sleep for given number of ms.

Parameters
[in]msecnumber of ms to sleep

Used as a replacement for chThdSleepMilliseconds so calling thread can be terminated

void vexCortexInit ( void  )

Initialize the VEX cortex.

void vexConsoleInit ( void  )

Initialize the console serial port.

void vexWatchdogInit ( void  )

Init watchdog timer.

void vexWatchdogReload ( void  )
inline

Reload the IWDG - call several times per second.

int16_t vexWatchdogResetFlagGet ( void  )

Check to see if the IWDG was the cause of reset.