PikeAero::CTaskSupervisor Class Reference

Implement the supervisor task. Runs the Event queue. Handles exceptions from other tasks. More...

#include <ctasksupervisor.h>

Inheritance diagram for PikeAero::CTaskSupervisor:

Inheritance graph
[legend]
Collaboration diagram for PikeAero::CTaskSupervisor:

Collaboration graph
[legend]

Public Member Functions

 CTaskSupervisor ()
virtual CMachine::bit32 fault ()
virtual CMachine::bit32 init ()
virtual bool iowait ()
void irq (CMachine::InterruptVector v)
 Handle hardware interrupts.
virtual const char * name ()
virtual CMachine::bit32 run ()
 Called periodically by CTaskScheduler to do a piece of work.
virtual CMachine::bit32 start ()
virtual CMachine::bit32 stop ()
 ~CTaskSupervisor ()

Private Member Functions

void monitorPower ()

Private Attributes

CBinaryInputGPIOmPowerFail [2]

Detailed Description

Implement the supervisor task. Runs the Event queue. Handles exceptions from other tasks.

Author:
Michael Sharkey <mike@pikeaero.com>

Definition at line 36 of file ctasksupervisor.h.


Constructor & Destructor Documentation

PikeAero::CTaskSupervisor::CTaskSupervisor (  ) 

Handler for various interrupt sources

Enable the Power Fail Inputs...

Definition at line 28 of file ctasksupervisor.cpp.

References GPIO2, GPIO_PIN_12, GPIO_PIN_13, PikeAero::CMachine::installVectorIRQ(), mPowerFail, PikeAero::CMachine::Vector_CMU_PRCCU, PikeAero::CMachine::Vector_RTC, PikeAero::CMachine::Vector_SWI, and PikeAero::CMachine::Vector_WDG_WUT.

00029  : ITask()
00030  {
00031     /** Handler for various interrupt sources */
00032     CMachine::installVectorIRQ(CMachine::Vector_CMU_PRCCU,this);
00033     CMachine::installVectorIRQ(CMachine::Vector_SWI,this);
00034     CMachine::installVectorIRQ(CMachine::Vector_RTC,this);
00035     CMachine::installVectorIRQ(CMachine::Vector_WDG_WUT,this);
00036 
00037      /** Enable the Power Fail Inputs... */
00038     mPowerFail[0] = new CBinaryInputGPIO( GPIO2, GPIO_PIN_12, false );
00039     mPowerFail[1] = new CBinaryInputGPIO( GPIO2, GPIO_PIN_13, false );
00040 }

Here is the call graph for this function:

PikeAero::CTaskSupervisor::~CTaskSupervisor (  ) 

Definition at line 42 of file ctasksupervisor.cpp.

References stop().

00043 {
00044     stop();
00045 }

Here is the call graph for this function:


Member Function Documentation

CMachine::bit32 PikeAero::CTaskSupervisor::fault (  )  [virtual]

The CTaskScheduler will call the fault() method when a fault code was returned by any of the task's other methods.

Reimplemented from PikeAero::ITask.

Definition at line 95 of file ctasksupervisor.cpp.

00096 {
00097     return 0;
00098 }

CMachine::bit32 PikeAero::CTaskSupervisor::init (  )  [virtual]

called exactly once. perform task initialization such as initializing private variable. other tasks are not guaranteed so do not interract with other tasks at this stage.

Returns:
0 on success.
called exactly once. perform task initialization such as initializing private variable. other tasks are not guaranteed so do not interract with other tasks at this stage.
Returns:
0 on success.

Reimplemented from PikeAero::ITask.

Definition at line 52 of file ctasksupervisor.cpp.

00053 {
00054     return 0;
00055 }

bool PikeAero::CTaskSupervisor::iowait (  )  [virtual]

The CTaskScheduler::iowait() method will call the task's iowait method periodically to test if the task is still in an I/O wait state.

Returns:
true if still waiting on I/O, false otherwise.
The CTaskScheduler::iowait() method will call the task's iowait method periodically to test if the task is still in an I/O wait state.
Returns:
true if still waiting on I/O, false otherwise.

Reimplemented from PikeAero::ITask.

Definition at line 105 of file ctasksupervisor.cpp.

00106 {
00107     return false;
00108 }

void PikeAero::CTaskSupervisor::irq ( CMachine::InterruptVector  v  )  [virtual]

Handle hardware interrupts.

Handle hardware interrupts.

CMU & PRCCU Interrupts

Clear the pending flags before returning

FXME - do stuff here

FXME - do stuff here

Clear the pending flag

Reimplemented from PikeAero::CObject.

Definition at line 113 of file ctasksupervisor.cpp.

References PRCCU, PRCCU_CK2_16_I, PRCCU_LOCK_I, PRCCU_STOP_I, PikeAero::CMachine::Vector_CMU_PRCCU, PikeAero::CMachine::Vector_RTC, PikeAero::CMachine::Vector_SWI, PikeAero::CMachine::Vector_WDG_WUT, WDG, and WDG_EC.

00114 {
00115     /** CMU & PRCCU Interrupts */
00116     switch( v )
00117     {
00118         case CMachine::Vector_CMU_PRCCU:
00119             /** Clear the pending flags before returning */
00120             PRCCU->CFR |= ( PRCCU_STOP_I | PRCCU_CK2_16_I | PRCCU_LOCK_I );
00121             break;
00122         case CMachine::Vector_SWI:
00123             /** FXME - do stuff here */
00124             break;
00125         case CMachine::Vector_RTC:
00126             /** FXME - do stuff here */
00127             break;
00128         case CMachine::Vector_WDG_WUT:
00129             /** Clear the pending flag */
00130             WDG->SR &= ~WDG_EC;
00131             break;
00132     }
00133 }

void PikeAero::CTaskSupervisor::monitorPower (  )  [private]

Monitor the Power Supply...

FIXME - do real power supply failure handling here - try toggling the power supply in question with a one second delay

FIXME - do stuff

Definition at line 138 of file ctasksupervisor.cpp.

References mPowerFail.

Referenced by run().

00139 {
00140     /** FIXME - do real power supply failure handling here - try toggling the power supply in question with a one second delay */
00141     for( CMachine::ubit32 n=0; n < 2; n++ )
00142     {
00143         if ( mPowerFail[n]->active() )
00144         {
00145             /** FIXME - do stuff */
00146         }
00147     }
00148 }

Here is the caller graph for this function:

virtual const char* PikeAero::CTaskSupervisor::name (  )  [inline, virtual]

Returns:
a CString containing an human readable name for the task

Reimplemented from PikeAero::ITask.

Definition at line 43 of file ctasksupervisor.h.

00043 {return "CTaskSupervisor";}

CMachine::bit32 PikeAero::CTaskSupervisor::run (  )  [virtual]

Called periodically by CTaskScheduler to do a piece of work.

called periodically by CTaskScheduler to do a piece of work.

Returns:
0 on success.

0 on success.

dequeue events

monitor the power supply

Reimplemented from PikeAero::ITask.

Definition at line 70 of file ctasksupervisor.cpp.

References PikeAero::CEventQueue::dequeue(), and monitorPower().

00071 {
00072     /** dequeue events */
00073     CEventQueue::dequeue();
00074 
00075     /** monitor the power supply */
00076     monitorPower();
00077 
00078     return 0;
00079 }

Here is the call graph for this function:

CMachine::bit32 PikeAero::CTaskSupervisor::start (  )  [virtual]

called exactly once. all tasks are initialized at this point. called just prior to first call to run()

Returns:
0 on success.
called exactly once. all tasks are initialized at this point. called just prior to first call to run()
Returns:
0 on success.

Reimplemented from PikeAero::ITask.

Definition at line 61 of file ctasksupervisor.cpp.

00062 {
00063     return 0;
00064 }

CMachine::bit32 PikeAero::CTaskSupervisor::stop (  )  [virtual]

The CTaskScheduler will call the stop () method after the task was scheduled for cancelation.

Returns:
0 on success.
CTaskScheduler will call the stop () method after the task was scheduled for cancelation.
Returns:
0 on success.

Reimplemented from PikeAero::ITask.

Definition at line 85 of file ctasksupervisor.cpp.

References PikeAero::CEventQueue::removeListener(), and PikeAero::CEvent::Tick.

Referenced by ~CTaskSupervisor().

00086 {
00087     CEventQueue::removeListener(this,CEvent::Tick);
00088     return 0;
00089 }

Here is the call graph for this function:

Here is the caller graph for this function:


Field Documentation

Definition at line 83 of file ctasksupervisor.h.

Referenced by CTaskSupervisor(), and monitorPower().


The documentation for this class was generated from the following files:

Generated on Sun Oct 25 14:00:28 2009 for stingray3 by  doxygen 1.5.8