PikeAero::CMachine Class Reference

#include <cmachine.h>

Collaboration diagram for PikeAero::CMachine:

Collaboration graph
[legend]

Public Types

typedef short bit16
typedef int bit32
typedef long long bit64
typedef char bit8

Public Member Functions

 CMachine ()
 Constructor. Do simple memory initialization, do more complex initialization in initialize().

Static Public Member Functions

static ubit32 align32 (ubit32 p)
static CConfigurationconfig (CMachine::bit32 n=-1)
static ubit32 configIndex ()
static ubit16 crc16 (ubit8 *buf, ubit32 size, ubit16 crc=0)
static ubit16 crc16 (ubit8 ch, ubit16 crc=0)
static ubit32 crc32 (ubit8 *buf, ubit32 size, ubit32 crc=0)
static ubit32 crc32 (ubit8 ch, ubit32 crc=0)
static void disableVector (CMachine::InterruptVector vector)
 set interrupt vector mask - disabling interrupts to that vector.
static void enableVector (CMachine::InterruptVector vector)
 clear interrupt vector mask - enables interrupts to that vector.
static const ubit8firmwareVersion ()
static ubit32 fMCLK ()
static ubit32 fOSC ()
static double fpMCLK ()
static void initialize ()
 MCU Initialization.
static void initializeConfig ()
 Initialize the configuration records.
static bool installVectorIRQ (CMachine::InterruptVector vector, CObject *object)
 Install an IRQ interrupt handler object at an interrupt vector.
static bool installVectorSWI (CObject *object)
 Install an SWI interrupt handler object.
static void irq (CMachine::InterruptVector vector)
 Interrupt Request Vector Service Routine - initiates the irq method on all listening objects.
static ubit32 machineId ()
static void memswap (void *s1, void *s2, bit32 n)
 In-place, swap bytes between two memory location.
static void memswapw (void **s1, void *s2, bit32 n)
 In-place, swap words between two memory location.
static CMutexmutexBSPI2 ()
static ubit32 numberOfConfigs ()
static bool removeVectorIRQ (CObject *object)
 Remove an IRQ interrupt handler object by it's CObject* pointer.
static bool removeVectorSWI (CObject *object)
 Remove an SWI interrupt handler object by it's CObject* pointer.
static void resetVectorIRQCount ()
 public accessor to reset vectored irq counter.
static void resetWatchDog ()
static ubit32 setConfig (CMachine::bit32 n)
static void swi ()
 Software Interrupt.
static ubit32 tick ()
static ubit32 vectorIRQCount ()
 public accessor to vectored irq count.

Static Private Member Functions

static void initializeCFG ()
 Initialize system configuration and peripheral clocks (CFG).
static void initializeCMU ()
 Initialize the clock monitor unit (CMU).
static void initializeCRC ()
static void initializeEIC ()
 Initialize the Enhanced Interrupt Controller Module (EIC).
static void initializeGPIO ()
 Initialize the GPIO peripherals according to their functions.
static void initializeGPIOPins (GPIO_TypeDef *GPIOx, CMachine::ubit16 pins, CMachine::ubit16 mode)
 Initializes the GPIOx peripheral according to the specified parameters in the GPIO_InitTypeDef structure.
static void initializePRCCU ()
 Initialize the Power, reset and clock control unit (PRCCU).
static void initializeWDG ()
 Initialize the watchdog timer.
static void lockCMU ()
static void unlockCMU ()

Static Private Attributes

static CMutex mBSPI2Mutex
static CConfigurationmConfiguration [MAX_CONFIGS]
static ubit32 mConfigurationIndex
static CObjectListmVectorIRQ []
static ubit32 mVectorIRQCount
static CObjectmVectorSWI

Detailed Description

Definition at line 47 of file cmachine.h.


Member Typedef Documentation

32 bits - signed

Definition at line 153 of file cmachine.h.

64 bits - signed

Definition at line 152 of file cmachine.h.

typedef long long PikeAero::CMachine::bit64

define standard word sizes....

Definition at line 151 of file cmachine.h.

16 bits - signed

Definition at line 154 of file cmachine.h.

typedef float PikeAero::CMachine::real

8 bits - unsigned volatile

Definition at line 163 of file cmachine.h.

typedef unsigned short PikeAero::CMachine::ubit16

32 bits - unsigned

Definition at line 157 of file cmachine.h.

typedef unsigned int PikeAero::CMachine::ubit32

64 bits - unsigned

Definition at line 156 of file cmachine.h.

typedef unsigned long long PikeAero::CMachine::ubit64

8 bits - signed

Definition at line 155 of file cmachine.h.

typedef unsigned char PikeAero::CMachine::ubit8

16 bits - unsigned

Definition at line 158 of file cmachine.h.

typedef volatile unsigned short PikeAero::CMachine::vubit16

32 bits - unsigned volatile

Definition at line 161 of file cmachine.h.

typedef volatile unsigned int PikeAero::CMachine::vubit32

64 bits - unsigned volatile

Definition at line 160 of file cmachine.h.

typedef volatile unsigned long long PikeAero::CMachine::vubit64

8 bits - unsigned

Definition at line 159 of file cmachine.h.

typedef volatile unsigned char PikeAero::CMachine::vubit8

16 bits - unsigned volatile

Definition at line 162 of file cmachine.h.


Member Enumeration Documentation

Enumerator:
FaultNone 
FaultNoMemory  all is well
FaultSysClock  memory allocation failure
FaultNULLPtr  system clockfailure
FaultEngineStop  a null pointer was encountered
FaultFuelPressureLow  engine stop
FaultFuelPressureHigh  low fuel pressure

Definition at line 52 of file cmachine.h.

00053         {
00054             FaultNone               =   0,          /** all is well */
00055             FaultNoMemory,                          /** memory allocation failure */
00056             FaultSysClock,                          /** system clockfailure */
00057             FaultNULLPtr,                           /** a null pointer was encountered */
00058 
00059             FaultEngineStop         = 100,          /** engine stop */
00060             FaultFuelPressureLow,                   /** low fuel pressure */
00061             FaultFuelPressureHigh,                  /** high fuel pressure */
00062         } FaultCode;

Interrupt vectors enumerated...

Enumerator:
Vector_CMU_PRCCU 
Vector_INT1 
Vector_INT2 
Vector_INT3 
Vector_INT4 
Vector_INT5 
Vector_INT6 
Vector_INT7 
Vector_INT8 
Vector_INT9 
Vector_INT10 
Vector_INT11 
Vector_INT12 
Vector_INT13 
Vector_INT14 
Vector_INT15 
Vector_DMA 
Vector_TIM1  DMA Error
Vector_TIM2 
Vector_TIM3 
Vector_TIM4 
Vector_TB0 
Vector_TB1 
Vector_TB2 
Vector_TIM5 
Vector_TIM6 
Vector_TIM7 
Vector_TIM8 
Vector_TIM9 
Vector_Reserved0 
Vector_Reserved1 
Vector_UART2 
Vector_UART3 
Vector_FLASH 
Vector_PWM0 
Vector_PWM1 
Vector_PWM2 
Vector_PWM3 
Vector_PWM4 
Vector_PWM5 
Vector_WIU 
Vector_WDG_WUT 
Vector_BSPI0 
Vector_BSPI1 
Vector_BSPI2 
Vector_UART0 
Vector_UART1 
Vector_I2C0_ITEER 
Vector_I2C1_ITERR 
Vector_Reserved2 
Vector_Reserved3 
Vector_I2C0_ITDDC 
Vector_I2C1_ITDDC 
Vector_Reserved4 
Vector_Reserved5 
Vector_CAN0 
Vector_CAN1 
Vector_CAN2 
Vector_DMA0 
Vector_DMA1 
Vector_DMA2 
Vector_DMA3 
Vector_ADC 
Vector_RTC 
Vector_INT0 
Vector_TIM0  FIQ0 : INT0 - External Interrupt 0
Vector_SWI  FIQ1 : TIM0 - Timer 0 Global Interrupt SWI

Definition at line 74 of file cmachine.h.

00075         {
00076 
00077             Vector_CMU_PRCCU=0,
00078             Vector_INT1,
00079             Vector_INT2,
00080             Vector_INT3,
00081             Vector_INT4,
00082             Vector_INT5,
00083             Vector_INT6,
00084             Vector_INT7,
00085             Vector_INT8,
00086             Vector_INT9,
00087             Vector_INT10,
00088             Vector_INT11,
00089             Vector_INT12,
00090             Vector_INT13,
00091             Vector_INT14,
00092             Vector_INT15,
00093 
00094             Vector_DMA,                                     /** DMA Error */
00095             Vector_TIM1,
00096             Vector_TIM2,
00097             Vector_TIM3,
00098             Vector_TIM4,
00099             Vector_TB0,
00100             Vector_TB1,
00101             Vector_TB2,
00102             Vector_TIM5,
00103             Vector_TIM6,
00104             Vector_TIM7,
00105             Vector_TIM8,
00106             Vector_TIM9,
00107             Vector_Reserved0,
00108             Vector_Reserved1,
00109             Vector_UART2,
00110 
00111             Vector_UART3,
00112             Vector_FLASH,
00113             Vector_PWM0,
00114             Vector_PWM1,
00115             Vector_PWM2,
00116             Vector_PWM3,
00117             Vector_PWM4,
00118             Vector_PWM5,
00119             Vector_WIU,
00120             Vector_WDG_WUT,
00121             Vector_BSPI0,
00122             Vector_BSPI1,
00123             Vector_BSPI2,
00124             Vector_UART0,
00125             Vector_UART1,
00126             Vector_I2C0_ITEER,
00127 
00128             Vector_I2C1_ITERR,
00129             Vector_Reserved2,
00130             Vector_Reserved3,
00131             Vector_I2C0_ITDDC,
00132             Vector_I2C1_ITDDC,
00133             Vector_Reserved4,
00134             Vector_Reserved5,
00135             Vector_CAN0,
00136             Vector_CAN1,
00137             Vector_CAN2,
00138             Vector_DMA0,
00139             Vector_DMA1,
00140             Vector_DMA2,
00141             Vector_DMA3,
00142             Vector_ADC,
00143             Vector_RTC,
00144 
00145             Vector_INT0,                                    /** FIQ0 : INT0 - External Interrupt 0 */
00146             Vector_TIM0,                                    /** FIQ1 : TIM0 - Timer 0 Global Interrupt */
00147             Vector_SWI                                      /** SWI **/
00148         } InterruptVector;

Enumerator:
WatchDocTimerReset 
DeviceInputReset  machine was reset by watchdog
PowerOnReset  machine was reset by reset input

Definition at line 64 of file cmachine.h.

00065         {
00066             WatchDocTimerReset  =   0x20,           /** machine was reset by watchdog */
00067             DeviceInputReset    =   0x40,           /** machine was reset by reset input */
00068             PowerOnReset        =   0x80,           /** machine was reset by power on */
00069         } ResetMode;


Constructor & Destructor Documentation

PikeAero::CMachine::CMachine (  ) 

Constructor. Do simple memory initialization, do more complex initialization in initialize().

Definition at line 80 of file cmachine.cpp.

References mVectorSWI.

00081 {
00082     mVectorSWI = static_cast<CObject*>(NULL);
00083 }


Member Function Documentation

static ubit32 PikeAero::CMachine::align32 ( ubit32  p  )  [inline, static]

Definition at line 192 of file cmachine.h.

Referenced by PikeAero::CConfiguration::commitVLD().

00192 {return ((p & 0x3) == 0) ? p : ((p + 0x4) & ~0x3);} /** align on 32 bit boundary */

Here is the caller graph for this function:

static CConfiguration* PikeAero::CMachine::config ( CMachine::bit32  n = -1  )  [inline, static]

static ubit32 PikeAero::CMachine::configIndex (  )  [inline, static]

Definition at line 177 of file cmachine.h.

References mConfigurationIndex.

Referenced by PikeAero::CCommandHandler::commandWHICH().

00177 {return mConfigurationIndex;}

Here is the caller graph for this function:

CMachine::ubit16 PikeAero::CMachine::crc16 ( ubit8 buf,
ubit32  size,
ubit16  crc = 0 
) [static]

Calculates a new CRC-16 value based on the previous value of the CRC and the next buffer of the data to be checked.

Definition at line 741 of file cmachine.cpp.

References crc16().

00742 {
00743     while ( size-- )
00744     {
00745         crc = crc16( *buf++, crc );
00746     }
00747     return crc;
00748 }

Here is the call graph for this function:

CMachine::ubit16 PikeAero::CMachine::crc16 ( ubit8  ch,
ubit16  crc = 0 
) [static]

Core CRC functions

Calculates a new CRC-16 value based on the previous value of the CRC and the next byte of the data to be checked.

Definition at line 732 of file cmachine.cpp.

References crcTable16.

Referenced by crc16().

00733 {
00734     ubit32 short_ch = 0x00ff & (ubit16)ch;
00735     return (crc >> 8) ^ crcTable16[ (crc ^ short_ch) & 0xff ];
00736 }

Here is the caller graph for this function:

CMachine::ubit32 PikeAero::CMachine::crc32 ( ubit8 buf,
ubit32  size,
ubit32  crc = 0 
) [static]

Calculates a new CRC-32 value based on the previous value of the CRC and the next buffer of the data to be checked.

Definition at line 763 of file cmachine.cpp.

References crc32().

00764 {
00765     while ( size-- )
00766     {
00767         crc = crc32( *buf++, crc );
00768     }
00769     return crc;
00770 }

Here is the call graph for this function:

CMachine::ubit32 PikeAero::CMachine::crc32 ( ubit8  ch,
ubit32  crc = 0 
) [static]

Calculates a new CRC-32 value based on the previous value of the CRC and the next byte of the data to be checked.

Definition at line 754 of file cmachine.cpp.

References crcTable32.

Referenced by crc32().

00755 {
00756     ubit32 long_ch = 0x000000ffL & (ubit32)ch;
00757     return (crc >> 8) ^ crcTable32[ (crc ^ long_ch) & 0xff ];
00758 }

Here is the caller graph for this function:

void PikeAero::CMachine::disableVector ( CMachine::InterruptVector  vector  )  [static]

set interrupt vector mask - disabling interrupts to that vector.

2 FIQs

Definition at line 582 of file cmachine.cpp.

References EIC.

00583 {
00584     if ( static_cast<ubit32>(vector) < 32 )
00585     {
00586         EIC->IER0 &= ~(static_cast<ubit32>(1<<static_cast<ubit32>(vector)));
00587     }
00588     else if ( static_cast<ubit32>(vector) >= 32 && static_cast<ubit32>(vector) < 64 )
00589     {
00590         EIC->IER1 &= ~(static_cast<ubit32>(1<<(static_cast<ubit32>(vector)-32)));
00591     }
00592     else if ( static_cast<ubit32>(vector) >= 64 && static_cast<ubit32>(vector) < 66 )
00593     {
00594         /** 2 FIQs */
00595         EIC->FIER &= ~( ( 1 << ( static_cast<ubit32>(vector) - 64 ) ) & 0x03 );
00596         EIC->FIR &= ~( ( 1 << ( static_cast<ubit32>(vector) - 64 ) ) & 0x03 );
00597     }
00598 }

void PikeAero::CMachine::enableVector ( CMachine::InterruptVector  vector  )  [static]

clear interrupt vector mask - enables interrupts to that vector.

Low 32 IRQs

Hi 32 IRQs

2 FIQs

Definition at line 559 of file cmachine.cpp.

References EIC.

Referenced by initializeEIC().

00560 {
00561     if ( static_cast<ubit32>(vector) < 32 )
00562     {
00563         /** Low 32 IRQs */
00564         EIC->IER0 |= static_cast<ubit32>(1<<static_cast<ubit32>(vector));
00565     }
00566     else if ( static_cast<ubit32>(vector) >= 32 && static_cast<ubit32>(vector) < 64 )
00567     {
00568         /** Hi 32 IRQs */
00569         EIC->IER1 |= static_cast<ubit32>(1<<(static_cast<ubit32>(vector)-32));
00570     }
00571     else if ( static_cast<ubit32>(vector) >= 64 && static_cast<ubit32>(vector) < 66 )
00572     {
00573         /** 2 FIQs */
00574         EIC->FIER |= ( ( 1 << ( static_cast<ubit32>(vector) - 64 ) ) & 0x03 );
00575         EIC->FIR |= ( ( 1 << ( static_cast<ubit32>(vector) - 64 ) ) & 0x03 );
00576     }
00577 }

Here is the caller graph for this function:

static const ubit8* PikeAero::CMachine::firmwareVersion (  )  [inline, static]

Misc. Status

Definition at line 168 of file cmachine.h.

Referenced by PikeAero::CTaskConsole::monitor().

00168 {return (const ubit8*)"1.1a";}

Here is the caller graph for this function:

CMachine::ubit32 PikeAero::CMachine::fMCLK (  )  [static]

Returns:
the fMCLK frequency in Hz.

Get the value of the fMCLK to CPU and peripherals

Depending on the status of the DIV2_EN bit get the CLOCK2 value

DIV2_EN bit is reset

Set CLOCK2 value equal to CLOCK1

fMCLK is derived from CLOCK2 instead of CLOCK2/16

Get the PLL Multiplication and the Division Factor

return the value of the Main Clock MCLK

CSU_CKSEL bit Reset

Set the MCLK value to CLOCK2

Set the MCLK value to CLOCK2 / 16

Definition at line 134 of file cmachine.cpp.

References CMU, CMU_CKSEL0, PRCCU, PRCCU_CK2_16, PRCCU_CSU_CKSEL, PRCCU_DIV2, RCCU_OSC_MAIN, and RCCU_OSC_RC.

Referenced by fpMCLK(), PikeAero::CTaskConsole::monitor(), PikeAero::CCommunicationUART::setBaud(), PikeAero::CSPI::setFrequency(), and PikeAero::CBinaryInputOutputTimer::setFrequency().

00135 {
00136     ubit32  Tmp=0;
00137     ubit32  CLOCK1=0;
00138     ubit32  CLOCK2=0;
00139     ubit8   MUL_Factor=1;
00140     ubit8   DIV_Factor=1;
00141 
00142     if((CMU->CTRL & CMU_CKSEL0) == CMU_CKSEL0)
00143     {
00144         CLOCK1 = RCCU_OSC_MAIN ;
00145     }
00146     else
00147     {
00148         CLOCK1 = RCCU_OSC_RC;
00149     }
00150 
00151     /** Get the value of the fMCLK to CPU and peripherals */
00152     /** Depending on the status of the DIV2_EN bit get the CLOCK2 value  */
00153     if((PRCCU->CFR & PRCCU_DIV2) != 0)
00154     {
00155         CLOCK2 = CLOCK1 / 2;  /* Set CLOCK2 value to Half CLOCK1 */
00156     }
00157     else /** DIV2_EN bit is reset */
00158     {
00159         /** Set CLOCK2 value equal to CLOCK1 */
00160         CLOCK2 =  CLOCK1;
00161     }
00162 
00163     /** fMCLK is derived from CLOCK2 instead of CLOCK2/16 */
00164     if((PRCCU->CFR & PRCCU_CK2_16) != 0)
00165     {
00166         if ((PRCCU->CFR & PRCCU_CSU_CKSEL) !=0 )
00167         {
00168             /** Get the PLL Multiplication and the Division Factor */
00169             Tmp = PRCCU->PLLCR;
00170             MUL_Factor =  ((Tmp & 0x30) >> 4);
00171             switch (MUL_Factor)
00172             {
00173                 case 0: MUL_Factor = 20; break;
00174                 case 1: MUL_Factor = 12; break;
00175                 case 2: MUL_Factor = 28; break;
00176                 case 3: MUL_Factor = 16; break;
00177             }
00178             DIV_Factor = (Tmp& 0x07) +1;
00179             /** return the value of the Main Clock MCLK*/
00180             return(CLOCK2 * MUL_Factor / DIV_Factor) ;
00181         }
00182         else /** CSU_CKSEL bit Reset */
00183         {
00184             /** Set the MCLK value to CLOCK2  */
00185             return CLOCK2;
00186         }
00187     }
00188     /** Set the MCLK value to CLOCK2 / 16  */
00189     return (CLOCK2 /16) ;
00190 }

Here is the caller graph for this function:

CMachine::ubit32 PikeAero::CMachine::fOSC (  )  [static]

Returns:
the measured frequency.

Start a clock frequency measurement

Wait until the measure is ready in FDISP register

Return Measured frequency bits

Definition at line 121 of file cmachine.cpp.

References CMU, and CMU_SFM.

00122 {
00123     /** Start a clock frequency measurement */
00124     CMU->CTRL |= CMU_SFM;
00125     /** Wait until the measure is ready in FDISP register */
00126     while( ( CMU->CTRL & CMU_SFM ) != 0x0000 );
00127     /** Return Measured frequency bits */
00128     return( CMU->FDISP );
00129 }

static double PikeAero::CMachine::fpMCLK (  )  [inline, static]

Definition at line 172 of file cmachine.h.

References fMCLK().

Referenced by PikeAero::CTimeBase::CTimeBase(), and PikeAero::CTaskTimeBase::set().

00172 {return static_cast<double>(1.0/fMCLK()) * 1000000000.0;} // fMCLK period in nanoseconds

Here is the call graph for this function:

Here is the caller graph for this function:

void PikeAero::CMachine::initialize (  )  [static]

MCU Initialization.

32 bits - signed floating point

Do all hardware initialization under assumtion that we're coming out of hardware reset. Install main system tasks. Interrupts are left disabled.

Initialize the Enhanced Interrupt Controller...

Interrupts are now disabled...

initialize major subsystems...

heap needs to be initialized before we start to do anythign fancy.

initialize configuration

Watchdog active from here on...

Definition at line 92 of file cmachine.cpp.

References disableInterrupts, initializeCFG(), initializeCMU(), initializeConfig(), initializeEIC(), initializeGPIO(), initializePRCCU(), initializeWDG(), resetVectorIRQCount(), and startEIC.

Referenced by main().

00093 {
00094     /** Initialize the Enhanced Interrupt Controller... */
00095     startEIC();
00096 
00097     /** Interrupts are now disabled... */
00098     disableInterrupts();
00099     resetVectorIRQCount();
00100 
00101     /** initialize major subsystems... */
00102     initializeCMU();                        /* clock monitor */
00103     initializePRCCU();                      /* reset and clock controls */
00104     initializeCFG();                        /* chip configuration */
00105     initializeGPIO();                       /* I/O pin configuration */
00106 
00107     /** heap needs to be initialized before we start to do anythign fancy. */
00108     CMemHeap::initialize();
00109     initializeEIC();                        /* enhanced interrupt controller - needs heap to be already initialized */
00110 
00111     /** initialize configuration */
00112     initializeConfig();
00113 
00114     /** Watchdog active from here on... */
00115     initializeWDG();
00116 }

Here is the call graph for this function:

Here is the caller graph for this function:

void PikeAero::CMachine::initializeCFG (  )  [static, private]

Initialize system configuration and peripheral clocks (CFG).

Setup Peripheral Clock Gate Registers (PCGR0/1) to enable clock to the peripherals

Definition at line 292 of file cmachine.cpp.

References CFG, CFG_PCGR0_ADC, CFG_PCGR0_BSPI1, CFG_PCGR0_BSPI2, CFG_PCGR0_CAN0, CFG_PCGR0_EIC, CFG_PCGR0_PORT0, CFG_PCGR0_PORT1, CFG_PCGR0_PORT2, CFG_PCGR0_PORT3, CFG_PCGR0_PORT4, CFG_PCGR0_PORT5, CFG_PCGR0_PORT6, CFG_PCGR0_PWM0, CFG_PCGR0_PWM1, CFG_PCGR0_PWM2, CFG_PCGR0_PWM3, CFG_PCGR0_PWM4, CFG_PCGR0_PWM5, CFG_PCGR0_RAM, CFG_PCGR0_TB0, CFG_PCGR0_TIM0, CFG_PCGR0_TIM1, CFG_PCGR0_UART0, CFG_PCGR0_UART1, CFG_PCGR0_WUT, CFG_PCGR1_AHB, CFG_PCGR1_DMA0, CFG_PCGR1_DMA1, CFG_PCGR1_DMA2, CFG_PCGR1_DMA3, CFG_PCGR1_NBA, CFG_PCGR1_TB1, CFG_PCGR1_TB2, CFG_PCGR1_TIM2, CFG_PCGR1_TIM3, CFG_PCGR1_TIM4, CFG_PCGR1_TIM5, CFG_PCGR1_TIM6, CFG_PCGR1_TIM7, CFG_PCGR1_TIM8, and CFG_PCGR1_TIM9.

Referenced by initialize().

00293 {
00294     /** Setup Peripheral Clock Gate Registers (PCGR0/1) to enable clock to the peripherals **/
00295     CFG->PCGR0 = (
00296                     CFG_PCGR0_RAM   |
00297                     CFG_PCGR0_UART0 |
00298                     CFG_PCGR0_UART1 |
00299                     CFG_PCGR0_TIM0  |
00300                     CFG_PCGR0_TIM1  |
00301                     CFG_PCGR0_TB0   |
00302                     CFG_PCGR0_CAN0  |
00303                     CFG_PCGR0_PWM0  |
00304                     CFG_PCGR0_PWM1  |
00305                     CFG_PCGR0_PWM2  |
00306                     CFG_PCGR0_PWM3  |
00307                     CFG_PCGR0_PWM4  |
00308                     CFG_PCGR0_PWM5  |
00309                     CFG_PCGR0_BSPI1 |
00310                     CFG_PCGR0_BSPI2 |
00311                     CFG_PCGR0_ADC   |
00312                     CFG_PCGR0_EIC   |
00313                     CFG_PCGR0_WUT   |
00314                     CFG_PCGR0_PORT0 |
00315                     CFG_PCGR0_PORT1 |
00316                     CFG_PCGR0_PORT2 |
00317                     CFG_PCGR0_PORT3 |
00318                     CFG_PCGR0_PORT4 |
00319                     CFG_PCGR0_PORT5 |
00320                     CFG_PCGR0_PORT6
00321                 );
00322 
00323     CFG->PCGR1 = (
00324                     CFG_PCGR1_TIM2  |
00325                     CFG_PCGR1_TIM2  |
00326                     CFG_PCGR1_TIM3  |
00327                     CFG_PCGR1_TIM4  |
00328                     CFG_PCGR1_TIM5  |
00329                     CFG_PCGR1_TIM6  |
00330                     CFG_PCGR1_TIM7  |
00331                     CFG_PCGR1_TIM8  |
00332                     CFG_PCGR1_TIM9  |
00333                     CFG_PCGR1_TB1   |
00334                     CFG_PCGR1_TB2   |
00335                     CFG_PCGR1_DMA0  |
00336                     CFG_PCGR1_DMA1  |
00337                     CFG_PCGR1_DMA2  |
00338                     CFG_PCGR1_DMA3  |
00339                     CFG_PCGR1_NBA   |
00340                     CFG_PCGR1_AHB
00341                 );
00342     CFG->PCGRB0 = 0x00000000;
00343     CFG->PCGRB1 = 0x00000000;
00344     /* Stretch the clocks in emulation mode... */
00345     CFG->PECGR0 = 0xFFFFFFFF;
00346     CFG->PECGR1 = 0xFFFFFFFF;
00347     /* ...except for... */
00348     CFG->PECGR0 &= ~(CFG_PCGR0_UART0|CFG_PCGR0_UART1);
00349     /* UART emulation protection */
00350     CFG->ESPR = 0x7F;
00351 }

Here is the caller graph for this function:

void PikeAero::CMachine::initializeCMU (  )  [static, private]

Initialize the clock monitor unit (CMU).

Select the clock source for CKOUT = Main Oscillator or Backup oscillator Select the clock source for Frequency Meter = PLL output from PRCCU or Main Oscillator Select the clock source for driving the CMU logic = Main Oscillator or Backup oscillator

Initializes RC oscillator control bits

Configure end of count value (longest)

Configure Frequency reference high bits

configure Frequency reference low bits

Set the CMU interrupt mask

Definition at line 195 of file cmachine.cpp.

References CMU, CMU_CKSEL0, CMU_CKSEL1, CMU_CKSEL2, CMU_CRFR, CMU_FLLM, CMU_OLRM, CMU_ROIM, lockCMU(), and unlockCMU().

Referenced by initialize().

00196 {
00197     lockCMU();
00198 
00199     /**
00200     ** Select the clock source for CKOUT = Main Oscillator or Backup oscillator
00201     ** Select the clock source for Frequency Meter = PLL output from PRCCU or Main Oscillator
00202     ** Select the clock source for driving the CMU logic = Main Oscillator or Backup oscillator
00203     */
00204     CMU->CTRL |= ( CMU_CKSEL0 | CMU_CKSEL1 | CMU_CKSEL2 | CMU_CRFR );
00205 
00206     /** Initializes RC oscillator control bits */
00207     CMU->RCCTL = 0x0008;
00208 
00209     /** Configure end of count value (longest) */
00210     CMU->EOCV = 0x00FF;
00211 
00212     /** Configure Frequency reference high bits */
00213     CMU->FRH = 0x0FFF;
00214 
00215     /** configure Frequency reference low bits */
00216     CMU->FRL = 0x0000;
00217 
00218     /** Set the CMU interrupt mask */
00219     CMU->IM = ( CMU_OLRM | CMU_FLLM | CMU_ROIM );
00220 
00221     unlockCMU();
00222 }

Here is the call graph for this function:

Here is the caller graph for this function:

void PikeAero::CMachine::initializeConfig (  )  [static]

Initialize the configuration records.

Configuration

Definition at line 775 of file cmachine.cpp.

References mConfiguration, mConfigurationIndex, and numberOfConfigs().

Referenced by initialize().

00776 {
00777     mConfiguration[(mConfigurationIndex=0)] = new CConfiguration();
00778     for( mConfigurationIndex=1; mConfigurationIndex < numberOfConfigs(); mConfigurationIndex++ )
00779     {
00780         mConfiguration[mConfigurationIndex] = new CConfigurationAlternate(mConfigurationIndex-1);
00781     }
00782     mConfigurationIndex=0;
00783 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void PikeAero::CMachine::initializeCRC (  )  [static, private]

void PikeAero::CMachine::initializeEIC (  )  [static, private]

Initialize the Enhanced Interrupt Controller Module (EIC).

Initialize the CObject vectored interrupt table...

Unmask the subsystem interrupt flags.

Enable IRQ.

Definition at line 245 of file cmachine.cpp.

References EIC, EIC_FIQ_EN, EIC_IRQ_EN, enableVector(), MAX_FIQ, MAX_IRQ, mVectorIRQ, Vector_ADC, Vector_BSPI1, Vector_BSPI2, Vector_CAN0, Vector_CMU_PRCCU, Vector_DMA, Vector_DMA0, Vector_DMA1, Vector_DMA2, Vector_DMA3, Vector_FLASH, Vector_PWM0, Vector_PWM1, Vector_PWM2, Vector_PWM3, Vector_PWM4, Vector_PWM5, Vector_TB0, Vector_TB1, Vector_TB2, Vector_TIM0, Vector_TIM1, Vector_TIM2, Vector_TIM3, Vector_TIM4, Vector_TIM5, Vector_TIM6, Vector_TIM7, Vector_TIM8, Vector_TIM9, Vector_UART0, and Vector_UART1.

Referenced by initialize().

00246 {
00247     /** Initialize the CObject vectored interrupt table... */
00248     for ( ubit32 vector=0; vector < (MAX_IRQ+MAX_FIQ); vector++ )
00249     {
00250         mVectorIRQ[vector] = new CObjectList();
00251     }
00252     /** Unmask the subsystem interrupt flags. */
00253     enableVector(Vector_CMU_PRCCU);
00254     enableVector(Vector_FLASH);
00255     enableVector(Vector_ADC);
00256     enableVector(Vector_UART0);
00257     enableVector(Vector_UART1);
00258     enableVector(Vector_BSPI1);
00259     enableVector(Vector_BSPI2);
00260     enableVector(Vector_CAN0);
00261     enableVector(Vector_TB0);
00262     enableVector(Vector_TB1);
00263     enableVector(Vector_TB2);
00264     enableVector(Vector_PWM0);
00265     enableVector(Vector_PWM1);
00266     enableVector(Vector_PWM2);
00267     enableVector(Vector_PWM3);
00268     enableVector(Vector_PWM4);
00269     enableVector(Vector_PWM5);
00270     enableVector(Vector_TIM0);
00271     enableVector(Vector_TIM1);
00272     enableVector(Vector_TIM2);
00273     enableVector(Vector_TIM3);
00274     enableVector(Vector_TIM4);
00275     enableVector(Vector_TIM5);
00276     enableVector(Vector_TIM6);
00277     enableVector(Vector_TIM7);
00278     enableVector(Vector_TIM8);
00279     enableVector(Vector_TIM9);
00280     enableVector(Vector_DMA);
00281     enableVector(Vector_DMA0);
00282     enableVector(Vector_DMA1);
00283     enableVector(Vector_DMA2);
00284     enableVector(Vector_DMA3);
00285     /** Enable IRQ. */
00286     EIC->ICR = ( EIC_IRQ_EN | EIC_FIQ_EN );
00287 }

Here is the call graph for this function:

Here is the caller graph for this function:

void PikeAero::CMachine::initializeGPIO (  )  [static, private]

Initialize the GPIO peripherals according to their functions.

USE EXTREME CARE when modifying this method. Hardware damage can result from carelessness

Initialize all GPIO pins to be HiZ Inputs.

Clear all the GPIO data ports

2 Power Supply Shutdown Outputs (Open Drain)

P/S shutdown is inverted open drain external pullup!! latch 1 before activating the output

2 Power Supply Status Inputs (Pull Up)

latch the pull up bits

2 Fuel Pump Outputs (Push-Pull)

4 Status LED Outputs (Open Drain)

Turn a status LED on

CAN0 Rx/TX pins

UART0 RD/TD Pins

UART1 RD/TD Pins

SPI1

SPI1 SS1/SCK1 Pins

SPI1 MISO1/MOSI1 Pins

SPI1 MCP3208 chip select

SPI2

SPI2 SS2/SCK2 Pins

SPI chip selects, write protect, hold pins

Standby Input Pull Up

CRANK0/CRANK1

CAM0/CAM1

Current Limiting PWM

EFI Outputs Disable pin

EFI0/EFI1/EFI4

EFI2/EFI3/EFI5/EFI6/EFI7

IGN0/IGN1/IGN2/IGN2

Power supply failure inputs -- Pull Up Input

UNCONNECTED PINS -- pull low (all unused latched output bits should be low now) with weak pull up/down configuration

Definition at line 357 of file cmachine.cpp.

References GPIO0, GPIO1, GPIO2, GPIO3, GPIO4, GPIO5, GPIO6, GPIO_AF_OD, GPIO_AF_PP, GPIO_HI_AIN_TRI, GPIO_IN_TRI_TTL, GPIO_INOUT_WP, GPIO_OUT_OD, GPIO_OUT_PP, GPIO_PIN_0, GPIO_PIN_1, GPIO_PIN_10, GPIO_PIN_11, GPIO_PIN_12, GPIO_PIN_13, GPIO_PIN_14, GPIO_PIN_15, GPIO_PIN_2, GPIO_PIN_3, GPIO_PIN_4, GPIO_PIN_5, GPIO_PIN_6, GPIO_PIN_7, GPIO_PIN_8, GPIO_PIN_9, GPIO_PIN_ALL, and initializeGPIOPins().

Referenced by initialize().

00358 {
00359     /** Initialize all GPIO pins to be HiZ Inputs. */
00360     initializeGPIOPins( GPIO0, GPIO_IN_TRI_TTL, GPIO_PIN_ALL );
00361     initializeGPIOPins( GPIO1, GPIO_IN_TRI_TTL, GPIO_PIN_ALL );
00362     initializeGPIOPins( GPIO2, GPIO_IN_TRI_TTL, GPIO_PIN_ALL );
00363     initializeGPIOPins( GPIO3, GPIO_HI_AIN_TRI, GPIO_PIN_ALL ); /* analog */
00364     initializeGPIOPins( GPIO4, GPIO_IN_TRI_TTL, GPIO_PIN_ALL );
00365     initializeGPIOPins( GPIO5, GPIO_IN_TRI_TTL, GPIO_PIN_ALL );
00366     initializeGPIOPins( GPIO6, GPIO_IN_TRI_TTL, GPIO_PIN_ALL );
00367 
00368     /** Clear all the GPIO data ports */
00369     GPIO0->PD=0;
00370     GPIO1->PD=0;
00371     GPIO2->PD=0;
00372     GPIO4->PD=0;
00373     GPIO5->PD=0;
00374     GPIO6->PD=0;
00375 
00376     /**** Power Supply **/
00377     /** 2 Power Supply Shutdown Outputs (Open Drain) */
00378     /** P/S shutdown is inverted open drain external pullup!! latch 1 before activating the output */
00379     GPIO6->PD |= ( GPIO_PIN_6 | GPIO_PIN_7 );
00380     initializeGPIOPins( GPIO6, GPIO_OUT_OD, ( GPIO_PIN_6 | GPIO_PIN_7 ) );
00381     /** 2 Power Supply Status Inputs (Pull Up) */
00382     GPIO5->PD |= ( GPIO_PIN_2 | GPIO_PIN_3 ); /** latch the pull up bits */
00383     initializeGPIOPins( GPIO5, GPIO_INOUT_WP, ( GPIO_PIN_2 | GPIO_PIN_3 ) );
00384 
00385     /** 2 Fuel Pump Outputs (Push-Pull) */
00386     initializeGPIOPins( GPIO1, GPIO_OUT_PP, ( GPIO_PIN_4 | GPIO_PIN_5 ) );
00387 
00388     /** 4 Status LED Outputs (Open Drain) */
00389     initializeGPIOPins( GPIO6, GPIO_OUT_OD, ( GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13 ) );
00390     /** Turn a status LED on */
00391     GPIO6->PD &= ~GPIO_PIN_10;
00392 
00393     /** CAN0 Rx/TX pins */
00394     initializeGPIOPins( GPIO1, GPIO_AF_PP, ( GPIO_PIN_14 | GPIO_PIN_15 ) );
00395 
00396     /**** UART ****/
00397     /** UART0 RD/TD Pins */
00398     initializeGPIOPins( GPIO6, GPIO_AF_PP, GPIO_PIN_9 );
00399     /** UART1 RD/TD Pins */
00400     initializeGPIOPins( GPIO2, GPIO_AF_PP, GPIO_PIN_8 );
00401 
00402     /** SPI1 ****/
00403     /** SPI1 SS1/SCK1 Pins */
00404     initializeGPIOPins( GPIO4, GPIO_AF_PP, (  GPIO_PIN_15 ) );
00405     /** SPI1 MISO1/MOSI1 Pins */
00406     initializeGPIOPins( GPIO5, GPIO_AF_PP, ( GPIO_PIN_0 | GPIO_PIN_1 ) );
00407     /** SPI1 MCP3208 chip select */
00408     initializeGPIOPins( GPIO6, GPIO_INOUT_WP, GPIO_PIN_0 );
00409     GPIO6->PD |= GPIO_PIN_0;
00410 
00411     /** SPI2 ****/
00412     /** SPI2 SS2/SCK2 Pins */
00413     initializeGPIOPins( GPIO5, GPIO_AF_PP, ( GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7) );
00414     /** SPI chip selects, write protect, hold pins */
00415     initializeGPIOPins( GPIO6, GPIO_INOUT_WP, ( GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4 ) );
00416     GPIO6->PD |= ( GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 );
00417     GPIO6->PD &= ~( GPIO_PIN_1 | GPIO_PIN_4 );
00418 
00419     /** Standby Input Pull Up **/
00420     GPIO0->PD |= GPIO_PIN_0;
00421     initializeGPIOPins( GPIO0, GPIO_INOUT_WP, GPIO_PIN_0 );
00422 
00423     /** CRANK0/CRANK1 **/
00424     initializeGPIOPins( GPIO1, GPIO_AF_OD, ( GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13 ) );
00425 
00426     /** CAM0/CAM1 **/
00427     initializeGPIOPins( GPIO0, GPIO_AF_OD, ( GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_12 | GPIO_PIN_13 ) );
00428 
00429     /**** EFI ****/
00430     /** Current Limiting PWM */
00431     initializeGPIOPins( GPIO2, GPIO_AF_PP, ( GPIO_PIN_6 | GPIO_PIN_7 ) );
00432     /** EFI Outputs Disable pin */
00433     initializeGPIOPins( GPIO5, GPIO_AF_PP, ( GPIO_PIN_8 ) );
00434     /** EFI0/EFI1/EFI4 **/
00435     initializeGPIOPins( GPIO1, GPIO_AF_PP, ( GPIO_PIN_0 | GPIO_PIN_7 | GPIO_PIN_8 ) );
00436     /** EFI2/EFI3/EFI5/EFI6/EFI7 **/
00437     initializeGPIOPins( GPIO0, GPIO_AF_PP, ( GPIO_PIN_1 | GPIO_PIN_4 | GPIO_PIN_8 | GPIO_PIN_10 | GPIO_PIN_15 ) );
00438 
00439     /** IGN0/IGN1/IGN2/IGN2 */
00440     initializeGPIOPins( GPIO2, GPIO_AF_PP, ( GPIO_PIN_0 | GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5 ) );
00441 
00442     /** Power supply failure inputs -- Pull Up Input */
00443     GPIO2->PD |= ( GPIO_PIN_12 | GPIO_PIN_13 );
00444     initializeGPIOPins( GPIO2, GPIO_INOUT_WP, ( GPIO_PIN_12 | GPIO_PIN_13 ) );
00445 
00446     /** UNCONNECTED PINS -- pull low (all unused latched output bits should be low now) with weak pull up/down configuration **/
00447     initializeGPIOPins( GPIO0, GPIO_INOUT_WP, ( GPIO_PIN_7 | GPIO_PIN_9 | GPIO_PIN_11 | GPIO_PIN_14 ) );
00448     initializeGPIOPins( GPIO1, GPIO_INOUT_WP, ( GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_6 | GPIO_PIN_9 ) );
00449     initializeGPIOPins( GPIO2, GPIO_INOUT_WP, ( GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_14 | GPIO_PIN_15 ) );
00450     initializeGPIOPins( GPIO4, GPIO_INOUT_WP, ( GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7 | GPIO_PIN_8 | GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_14 ) );
00451     initializeGPIOPins( GPIO5, GPIO_INOUT_WP, ( GPIO_PIN_9 | GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15 )  );
00452     initializeGPIOPins( GPIO6, GPIO_INOUT_WP, ( GPIO_PIN_14 | GPIO_PIN_15 ) );
00453 }

Here is the call graph for this function:

Here is the caller graph for this function:

void PikeAero::CMachine::initializeGPIOPins ( GPIO_TypeDef GPIOx,
CMachine::ubit16  pins,
CMachine::ubit16  mode 
) [static, private]

Initializes the GPIOx peripheral according to the specified parameters in the GPIO_InitTypeDef structure.

GPIOx Mode and Pins Set

Definition at line 458 of file cmachine.cpp.

References GPIO_AF_OD, GPIO_AF_PP, GPIO_HI_AIN_TRI, GPIO_IN_TRI_TTL, GPIO_INOUT_WP, GPIO_OUT_OD, GPIO_OUT_PP, PikeAero::GPIO_TypeDef::PC0, PikeAero::GPIO_TypeDef::PC1, and PikeAero::GPIO_TypeDef::PC2.

Referenced by initializeGPIO().

00459 {
00460     /** GPIOx Mode and Pins Set */
00461     switch (mode)
00462     {
00463         case GPIO_HI_AIN_TRI:
00464             GPIOx->PC0&=~pins;
00465             GPIOx->PC1&=~pins;
00466             GPIOx->PC2&=~pins;
00467             break;
00468 
00469         case GPIO_IN_TRI_TTL:
00470             GPIOx->PC0|=pins;
00471             GPIOx->PC1&=~pins;
00472             GPIOx->PC2&=~pins;
00473             break;
00474 
00475         case GPIO_INOUT_WP:
00476             GPIOx->PC0|=pins;
00477             GPIOx->PC1|=pins;
00478             GPIOx->PC2&=~pins;
00479             break;
00480 
00481         case GPIO_OUT_OD:
00482             GPIOx->PC0&=~pins;
00483             GPIOx->PC1&=~pins;
00484             GPIOx->PC2|=pins;
00485             break;
00486 
00487         case GPIO_OUT_PP:
00488             GPIOx->PC0|=pins;
00489             GPIOx->PC1&=~pins;
00490             GPIOx->PC2|=pins;
00491             break;
00492 
00493         case GPIO_AF_OD:
00494             GPIOx->PC0&=~pins;
00495             GPIOx->PC1|=pins;
00496             GPIOx->PC2|=pins;
00497             break;
00498 
00499         case GPIO_AF_PP:
00500             GPIOx->PC0|=pins;
00501             GPIOx->PC1|=pins;
00502             GPIOx->PC2|=pins;
00503             break;
00504     }
00505 }

Here is the caller graph for this function:

void PikeAero::CMachine::initializePRCCU (  )  [static, private]

Initialize the Power, reset and clock control unit (PRCCU).

subsystem initializers...

Targets fMCLK 32MHz fEXT 2MHz

Voltage Regulator On.

configure the PLL Multiplication Factor x16

Enable PLL by setting CSU_CKSEL bit in PRCCU_CFR register

Wait for PLL lock for roughly one second timeout

Enable PRCCU interrutps

Definition at line 228 of file cmachine.cpp.

References PRCCU, PRCCU_CK2_16, PRCCU_CSU_CKSEL, PRCCU_DIV2, PRCCU_EN_HALT, PRCCU_EN_LOCK, PRCCU_EN_STOP, PRCCU_FREF_RANGE, PRCCU_LOCK, PRCCU_PLLMUL_16, PRCCU_VROFF_REG, and PRCCU_VROK.

Referenced by initialize().

00229 {
00230     /** Voltage Regulator On. */
00231     PRCCU->VRCTR &= ~PRCCU_VROFF_REG;
00232     /** configure the PLL Multiplication Factor x16 */
00233     PRCCU->PLLCR = ( PRCCU_FREF_RANGE | PRCCU_PLLMUL_16 /* | PRCCU_PLLDIV_2 */ );
00234     /** Enable PLL by setting CSU_CKSEL bit in PRCCU_CFR register */
00235     PRCCU->CFR |= ( PRCCU_DIV2 | PRCCU_CK2_16 | PRCCU_CSU_CKSEL );
00236     /** Wait for PLL lock for roughly one second timeout */
00237     for( CMachine::ubit32 timeout = 1000000; timeout && ( (PRCCU->CFR & PRCCU_LOCK) == 0 || (PRCCU->VRCTR & PRCCU_VROK) == 0 ); timeout-- );
00238     /** Enable PRCCU interrutps */
00239     PRCCU->CCR |= ( PRCCU_EN_HALT | PRCCU_EN_STOP | PRCCU_EN_LOCK );
00240 }

Here is the caller graph for this function:

void PikeAero::CMachine::initializeWDG (  )  [static, private]

Initialize the watchdog timer.

Reset timeout bit

256*65535*31/100000 = 520 milliseconds watchdog timeout

watchdog mode

Definition at line 510 of file cmachine.cpp.

References WDG, WDG_CR_SC, WDG_CR_WE, and WDG_MR_ECM.

Referenced by initialize().

00511 {
00512     WDG->MR=0;
00513     WDG->CR=0;
00514 
00515     /** Reset timeout bit */
00516     WDG->SR=WDG_MR_ECM;
00517 
00518     /** 256*65535*31/100000 = 520 milliseconds watchdog timeout */
00519     WDG->PR=0xFF;
00520     WDG->VR=0xFFFF;
00521 
00522     #if 1
00523         /** watchdog mode */
00524         WDG->CR=(WDG_CR_WE|WDG_CR_SC);
00525     #else
00526         /** interrupt mode */
00527         WDG->MR=WDG_MR_ECM;
00528         WDG->CR=WDG_CR_SC;
00529     #endif
00530 }

Here is the caller graph for this function:

bool PikeAero::CMachine::installVectorIRQ ( CMachine::InterruptVector  vector,
CObject object 
) [static]

Install an IRQ interrupt handler object at an interrupt vector.

Parameters:
vector The vector number 0-63
object The object to recieve the interrupt.
Returns:
boolean

Definition at line 606 of file cmachine.cpp.

References PikeAero::CObjectList::append(), disableInterrupts, PikeAero::CObjectList::indexOf(), interruptsEnabled, MAX_FIQ, MAX_IRQ, mVectorIRQ, and setInterrupts.

Referenced by PikeAero::CBinaryInputCapture::CBinaryInputCapture(), PikeAero::CCommunicationUART::CCommunicationUART(), PikeAero::CFuelInjector::CFuelInjector(), PikeAero::CSPI::CSPI(), PikeAero::CTaskAnalogInputADC::CTaskAnalogInputADC(), PikeAero::CTaskSupervisor::CTaskSupervisor(), PikeAero::CTaskTimeBase::CTaskTimeBase(), and PikeAero::CTimeBase::CTimeBase().

00607 {
00608     bool rc=false;
00609     bool irqState = interruptsEnabled();
00610     CObjectList* objectList = mVectorIRQ[vector];
00611     disableInterrupts();
00612     if ( objectList != static_cast<CObjectList*>(NULL) && vector < (MAX_IRQ+MAX_FIQ) )
00613     {
00614         if ( objectList->indexOf(object) < 0 )
00615         {
00616             objectList->append(object);
00617         }
00618         rc=true;
00619     }
00620     setInterrupts(irqState);
00621     return rc;
00622 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool PikeAero::CMachine::installVectorSWI ( CObject object  )  [static]

Install an SWI interrupt handler object.

Parameters:
object The object to recieve the interrupt.
Returns:
boolean

Definition at line 650 of file cmachine.cpp.

References disableInterrupts, interruptsEnabled, mVectorSWI, and setInterrupts.

00651 {
00652     bool irqState = interruptsEnabled();
00653     disableInterrupts();
00654     mVectorSWI=object;
00655     setInterrupts(irqState);
00656     return true;
00657 }

void PikeAero::CMachine::irq ( CMachine::InterruptVector  vector  )  [static]

Interrupt Request Vector Service Routine - initiates the irq method on all listening objects.

align on 32 bit boundary Interrupt vector operations...

Definition at line 535 of file cmachine.cpp.

References PikeAero::CObjectList::at(), PikeAero::CObjectList::count(), PikeAero::CObject::irq(), mVectorIRQ, and mVectorIRQCount.

Referenced by vsr_FIQ(), and vsr_IRQ().

00536 {
00537     CObjectList* objectList = mVectorIRQ[(CMachine::ubit32)vector];
00538     for ( CMachine::ubit32 i=0; i < objectList->count(); i++ )
00539     {
00540         objectList->at(i)->irq(vector);
00541         ++mVectorIRQCount;
00542     }
00543 }

Here is the call graph for this function:

Here is the caller graph for this function:

static void PikeAero::CMachine::lockCMU (  )  [inline, static, private]

Definition at line 232 of file cmachine.h.

References CMU, CMU_KEY1, and CMU_KEY2.

Referenced by initializeCMU().

00233         {
00234             CMU->WE = CMU_KEY1;
00235             CMU->WE = CMU_KEY2;
00236         }

Here is the caller graph for this function:

CMachine::ubit32 PikeAero::CMachine::machineId (  )  [static]

Returns:
the machine identification

Definition at line 724 of file cmachine.cpp.

References CFG.

00725 {
00726     return CFG->DIDR;
00727 }

void PikeAero::CMachine::memswap ( void *  s1,
void *  s2,
bit32  n 
) [static]

In-place, swap bytes between two memory location.

Memory block operations...

Definition at line 692 of file cmachine.cpp.

00693 {
00694     CMachine::ubit8* p1=(CMachine::ubit8*)s1;
00695     CMachine::ubit8* p2=(CMachine::ubit8*)s2;
00696     CMachine::ubit8  t;
00697     while ( n-- )
00698     {
00699         t = *p1;
00700         *p1++ = *p2;
00701         *p2++ = t;
00702     }
00703 }

void PikeAero::CMachine::memswapw ( void **  s1,
void *  s2,
bit32  n 
) [static]

In-place, swap words between two memory location.

Definition at line 708 of file cmachine.cpp.

00709 {
00710     CMachine::ubit32* p1=(CMachine::ubit32*)s1;
00711     CMachine::ubit32* p2=(CMachine::ubit32*)s2;
00712     CMachine::ubit32  t;
00713     while ( n-- )
00714     {
00715         t = *p1;
00716         *p1++ = *p2;
00717         *p2++ = t;
00718     }
00719 }

static CMutex* PikeAero::CMachine::mutexBSPI2 (  )  [inline, static]

Global mutexes...

Definition at line 208 of file cmachine.h.

References mBSPI2Mutex.

Referenced by PikeAero::CSPIEEPROM::_write(), PikeAero::CSPIEEPROM::read(), PikeAero::CSPIAmp::setChanelGain(), PikeAero::CSPIAmp::setChannel(), and PikeAero::CSPIAmp::setGain().

00208 {return &mBSPI2Mutex;}

Here is the caller graph for this function:

static ubit32 PikeAero::CMachine::numberOfConfigs (  )  [inline, static]

bool PikeAero::CMachine::removeVectorIRQ ( CObject object  )  [static]

Remove an IRQ interrupt handler object by it's CObject* pointer.

Parameters:
object The object to recieve the interrupt.
Returns:
boolean

Definition at line 629 of file cmachine.cpp.

References disableInterrupts, interruptsEnabled, MAX_FIQ, MAX_IRQ, mVectorIRQ, PikeAero::CObjectList::remove(), and setInterrupts.

Referenced by PikeAero::CBinaryInputCapture::~CBinaryInputCapture(), PikeAero::CCommunicationUART::~CCommunicationUART(), PikeAero::CFuelInjector::~CFuelInjector(), PikeAero::CSPI::~CSPI(), PikeAero::CTaskAnalogInputADC::~CTaskAnalogInputADC(), PikeAero::CTaskTimeBase::~CTaskTimeBase(), and PikeAero::CTimeBase::~CTimeBase().

00630 {
00631     bool rc=false;
00632     bool irqState = interruptsEnabled();
00633     disableInterrupts();
00634     if ( object !=  static_cast<CObject*>(NULL) )
00635     {
00636         for(ubit32 vector=0; vector < (MAX_IRQ+MAX_FIQ); vector++)
00637         {
00638             mVectorIRQ[vector]->remove(object);
00639         }
00640     }
00641     setInterrupts(irqState);
00642     return rc;
00643 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool PikeAero::CMachine::removeVectorSWI ( CObject object  )  [static]

Remove an SWI interrupt handler object by it's CObject* pointer.

Parameters:
object The object to recieve the interrupt.
Returns:
boolean

Definition at line 664 of file cmachine.cpp.

References disableInterrupts, interruptsEnabled, mVectorSWI, and setInterrupts.

00665 {
00666     bool irqState = interruptsEnabled();
00667     disableInterrupts();
00668     mVectorSWI=static_cast<CObject*>(NULL);
00669     setInterrupts(irqState);
00670     return true;
00671 }

void PikeAero::CMachine::resetVectorIRQCount (  )  [static]

public accessor to reset vectored irq counter.

Definition at line 676 of file cmachine.cpp.

References mVectorIRQCount.

Referenced by initialize(), and PikeAero::CTaskAggregator::perSecond().

00677 {
00678     mVectorIRQCount = 0;
00679 }

Here is the caller graph for this function:

static void PikeAero::CMachine::resetWatchDog (  )  [inline, static]

static ubit32 PikeAero::CMachine::setConfig ( CMachine::bit32  n  )  [inline, static]

Definition at line 178 of file cmachine.h.

References mConfigurationIndex, and numberOfConfigs().

Referenced by PikeAero::CCommandHandler::commandOPEN().

00178 {return (n >= 0 && n < numberOfConfigs()) ? (mConfigurationIndex=n) : mConfigurationIndex;}

Here is the call graph for this function:

Here is the caller graph for this function:

void PikeAero::CMachine::swi (  )  [static]

Software Interrupt.

Definition at line 548 of file cmachine.cpp.

References PikeAero::CObject::irq(), mVectorSWI, and Vector_SWI.

Referenced by vsr_SWI().

00549 {
00550     if ( mVectorSWI != static_cast<CObject*>(NULL) )
00551     {
00552         mVectorSWI->irq(Vector_SWI);
00553     }
00554 }

Here is the call graph for this function:

Here is the caller graph for this function:

static ubit32 PikeAero::CMachine::tick (  )  [inline, static]

Time Base and Runtime

Definition at line 211 of file cmachine.h.

Referenced by main().

00211 {return 100000;}/** tick rate (100000 microseconds) or (100 milliseconds) or (1/10th second) **/

Here is the caller graph for this function:

static void PikeAero::CMachine::unlockCMU (  )  [inline, static, private]

Definition at line 238 of file cmachine.h.

References CMU, CMU_KEY1, and CMU_KEY2.

Referenced by initializeCMU().

00239         {
00240             CMU->WE = (CMU_KEY1|CMU_KEY2);
00241         }

Here is the caller graph for this function:

CMachine::ubit32 PikeAero::CMachine::vectorIRQCount (  )  [static]

public accessor to vectored irq count.

Definition at line 684 of file cmachine.cpp.

References mVectorIRQCount.

Referenced by PikeAero::CTaskAggregator::perSecond().

00685 {
00686     return mVectorIRQCount;
00687 }

Here is the caller graph for this function:


Field Documentation

Definition at line 217 of file cmachine.h.

Referenced by mutexBSPI2().

Definition at line 218 of file cmachine.h.

Referenced by config(), and initializeConfig().

Definition at line 219 of file cmachine.h.

Referenced by config(), configIndex(), initializeConfig(), and setConfig().

tick rate (100000 microseconds) or (100 milliseconds) or (1/10th second)

Definition at line 214 of file cmachine.h.

Referenced by initializeEIC(), installVectorIRQ(), irq(), and removeVectorIRQ().

Definition at line 216 of file cmachine.h.

Referenced by irq(), resetVectorIRQCount(), and vectorIRQCount().

Definition at line 215 of file cmachine.h.

Referenced by CMachine(), installVectorSWI(), removeVectorSWI(), and swi().


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

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