Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
bsp.cpp@0:7225ff529d1c, 2011-04-27 (annotated)
- Committer:
- t_lark
- Date:
- Wed Apr 27 17:11:08 2011 +0000
- Revision:
- 0:7225ff529d1c
.00000001
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| t_lark | 0:7225ff529d1c | 1 | ////////////////////////////////////////////////////////////////////////////// |
| t_lark | 0:7225ff529d1c | 2 | // Model: Network.qm |
| t_lark | 0:7225ff529d1c | 3 | // File: ./bsp.cpp |
| t_lark | 0:7225ff529d1c | 4 | // |
| t_lark | 0:7225ff529d1c | 5 | // This file has been generated automatically by QP Modeler (QM). |
| t_lark | 0:7225ff529d1c | 6 | // DO NOT EDIT THIS FILE MANUALLY. |
| t_lark | 0:7225ff529d1c | 7 | // |
| t_lark | 0:7225ff529d1c | 8 | // Please visit www.state-machine.com/qm for more information. |
| t_lark | 0:7225ff529d1c | 9 | ////////////////////////////////////////////////////////////////////////////// |
| t_lark | 0:7225ff529d1c | 10 | #include "qp_port.h" |
| t_lark | 0:7225ff529d1c | 11 | #include "network.h" |
| t_lark | 0:7225ff529d1c | 12 | #include "bsp.h" |
| t_lark | 0:7225ff529d1c | 13 | #include "LPC17xx.h" |
| t_lark | 0:7225ff529d1c | 14 | |
| t_lark | 0:7225ff529d1c | 15 | Q_DEFINE_THIS_FILE |
| t_lark | 0:7225ff529d1c | 16 | |
| t_lark | 0:7225ff529d1c | 17 | // Local-scope objects ------------------------------------------------------- |
| t_lark | 0:7225ff529d1c | 18 | enum ISR_Priorities { // ISR priorities starting from the highest urgency |
| t_lark | 0:7225ff529d1c | 19 | GPIOPORTA_PRIO, |
| t_lark | 0:7225ff529d1c | 20 | SYSTICK_PRIO, |
| t_lark | 0:7225ff529d1c | 21 | // ... |
| t_lark | 0:7225ff529d1c | 22 | }; |
| t_lark | 0:7225ff529d1c | 23 | |
| t_lark | 0:7225ff529d1c | 24 | #define LED_PORT LPC_GPIO1 |
| t_lark | 0:7225ff529d1c | 25 | #define LED1_BIT (1U << 18) |
| t_lark | 0:7225ff529d1c | 26 | #define LED2_BIT (1U << 20) |
| t_lark | 0:7225ff529d1c | 27 | #define LED3_BIT (1U << 21) |
| t_lark | 0:7225ff529d1c | 28 | #define LED4_BIT (1U << 23) |
| t_lark | 0:7225ff529d1c | 29 | |
| t_lark | 0:7225ff529d1c | 30 | #ifdef Q_SPY |
| t_lark | 0:7225ff529d1c | 31 | #include "mbed.h" // mbed is used only for the built-in serial |
| t_lark | 0:7225ff529d1c | 32 | |
| t_lark | 0:7225ff529d1c | 33 | QSTimeCtr l_tickTime; |
| t_lark | 0:7225ff529d1c | 34 | QSTimeCtr l_tickPeriod; |
| t_lark | 0:7225ff529d1c | 35 | |
| t_lark | 0:7225ff529d1c | 36 | #define QSPY_BAUD_RATE 115200 |
| t_lark | 0:7225ff529d1c | 37 | |
| t_lark | 0:7225ff529d1c | 38 | enum AppRecords { // application-specific trace records |
| t_lark | 0:7225ff529d1c | 39 | PELICAN_STAT = QS_USER, |
| t_lark | 0:7225ff529d1c | 40 | IO_STAT |
| t_lark | 0:7225ff529d1c | 41 | }; |
| t_lark | 0:7225ff529d1c | 42 | |
| t_lark | 0:7225ff529d1c | 43 | Serial l_qspy(USBTX, USBRX); |
| t_lark | 0:7225ff529d1c | 44 | #endif |
| t_lark | 0:7225ff529d1c | 45 | |
| t_lark | 0:7225ff529d1c | 46 | //............................................................................ |
| t_lark | 0:7225ff529d1c | 47 | extern "C" void SysTick_Handler(void) { |
| t_lark | 0:7225ff529d1c | 48 | QK_ISR_ENTRY(); // inform the QK kernel of entering the ISR |
| t_lark | 0:7225ff529d1c | 49 | |
| t_lark | 0:7225ff529d1c | 50 | #ifdef Q_SPY |
| t_lark | 0:7225ff529d1c | 51 | uint32_t volatile dummy = SysTick->CTRL; // clear the COUNTFLAG in SysTick |
| t_lark | 0:7225ff529d1c | 52 | l_tickTime += l_tickPeriod; // account for the clock rollover |
| t_lark | 0:7225ff529d1c | 53 | #endif |
| t_lark | 0:7225ff529d1c | 54 | |
| t_lark | 0:7225ff529d1c | 55 | QF::tick(); // process all armed time events |
| t_lark | 0:7225ff529d1c | 56 | |
| t_lark | 0:7225ff529d1c | 57 | QK_ISR_EXIT(); // inform the QK kernel of exiting the ISR |
| t_lark | 0:7225ff529d1c | 58 | } |
| t_lark | 0:7225ff529d1c | 59 | |
| t_lark | 0:7225ff529d1c | 60 | //............................................................................ |
| t_lark | 0:7225ff529d1c | 61 | static N4S2 l_N4S2; |
| t_lark | 0:7225ff529d1c | 62 | |
| t_lark | 0:7225ff529d1c | 63 | |
| t_lark | 0:7225ff529d1c | 64 | DigitalIn N4S2 :: geomSenses[N_FACES] = {(p17), (p18), (p19), (p20)}; |
| t_lark | 0:7225ff529d1c | 65 | DigitalOut N4S2 :: geomTxs[S_FACES] = {(p21), (p22)}; |
| t_lark | 0:7225ff529d1c | 66 | |
| t_lark | 0:7225ff529d1c | 67 | SerialHalfDuplex N4S2 :: sPort1(p9,p10);//common n bus |
| t_lark | 0:7225ff529d1c | 68 | SerialHalfDuplex N4S2 :: sPort2(p13,p14);//common n bus |
| t_lark | 0:7225ff529d1c | 69 | SerialHalfDuplex N4S2 :: sPorts[S_FACES] = {sPort1,sPort2}; //seg ports |
| t_lark | 0:7225ff529d1c | 70 | SerialHalfDuplex N4S2 :: nPort(p28,p27);//common n bus |
| t_lark | 0:7225ff529d1c | 71 | |
| t_lark | 0:7225ff529d1c | 72 | DigitalOut N4S2 :: sPort1ETx(p11); |
| t_lark | 0:7225ff529d1c | 73 | DigitalOut N4S2 :: sPort2ETx(p12); |
| t_lark | 0:7225ff529d1c | 74 | DigitalOut N4S2 :: nPortETx(p29); |
| t_lark | 0:7225ff529d1c | 75 | DigitalOut N4S2 :: sPortETxs[S_FACES] = {sPort1ETx, sPort2ETx}; |
| t_lark | 0:7225ff529d1c | 76 | |
| t_lark | 0:7225ff529d1c | 77 | DigitalOut N4S2 :: leds[] = {(LED1), (LED2), (LED3), (LED4)}; |
| t_lark | 0:7225ff529d1c | 78 | |
| t_lark | 0:7225ff529d1c | 79 | |
| t_lark | 0:7225ff529d1c | 80 | //............................................................................ |
| t_lark | 0:7225ff529d1c | 81 | void BSP_init(void) { |
| t_lark | 0:7225ff529d1c | 82 | SystemInit(); // initialize the clocking system |
| t_lark | 0:7225ff529d1c | 83 | |
| t_lark | 0:7225ff529d1c | 84 | // set LED port to output |
| t_lark | 0:7225ff529d1c | 85 | LED_PORT->FIODIR |= (LED1_BIT | LED2_BIT | LED3_BIT | LED4_BIT); |
| t_lark | 0:7225ff529d1c | 86 | |
| t_lark | 0:7225ff529d1c | 87 | // clear the LEDs |
| t_lark | 0:7225ff529d1c | 88 | LED_PORT->FIOCLR = (LED1_BIT | LED2_BIT | LED3_BIT | LED4_BIT); |
| t_lark | 0:7225ff529d1c | 89 | |
| t_lark | 0:7225ff529d1c | 90 | if (QS_INIT((void *)0) == 0) { // initialize the QS software tracing |
| t_lark | 0:7225ff529d1c | 91 | Q_ERROR(); |
| t_lark | 0:7225ff529d1c | 92 | } |
| t_lark | 0:7225ff529d1c | 93 | } |
| t_lark | 0:7225ff529d1c | 94 | //............................................................................ |
| t_lark | 0:7225ff529d1c | 95 | void BSP_signalCars(BSP_CarsSignal sig) { |
| t_lark | 0:7225ff529d1c | 96 | /* |
| t_lark | 0:7225ff529d1c | 97 | switch (sig) { |
| t_lark | 0:7225ff529d1c | 98 | case CARS_RED: |
| t_lark | 0:7225ff529d1c | 99 | LED_PORT->FIOSET = LED1_BIT; // turn the LED1 on |
| t_lark | 0:7225ff529d1c | 100 | LED_PORT->FIOCLR = LED2_BIT | LED3_BIT; // turn the LED2&3 off |
| t_lark | 0:7225ff529d1c | 101 | break; |
| t_lark | 0:7225ff529d1c | 102 | case CARS_YELLOW: |
| t_lark | 0:7225ff529d1c | 103 | LED_PORT->FIOSET = LED2_BIT; // turn the LED2 on |
| t_lark | 0:7225ff529d1c | 104 | LED_PORT->FIOCLR = LED1_BIT | LED3_BIT; // turn the LED1&3 off |
| t_lark | 0:7225ff529d1c | 105 | break; |
| t_lark | 0:7225ff529d1c | 106 | case CARS_GREEN: |
| t_lark | 0:7225ff529d1c | 107 | LED_PORT->FIOSET = LED3_BIT; // turn the LED3 on |
| t_lark | 0:7225ff529d1c | 108 | LED_PORT->FIOCLR = LED1_BIT | LED2_BIT; // turn the LED1&2 off |
| t_lark | 0:7225ff529d1c | 109 | break; |
| t_lark | 0:7225ff529d1c | 110 | case CARS_BLANK: |
| t_lark | 0:7225ff529d1c | 111 | LED_PORT->FIOCLR = LED1_BIT | LED2_BIT | LED3_BIT; //turn all off |
| t_lark | 0:7225ff529d1c | 112 | break; |
| t_lark | 0:7225ff529d1c | 113 | }*/ |
| t_lark | 0:7225ff529d1c | 114 | } |
| t_lark | 0:7225ff529d1c | 115 | //............................................................................ |
| t_lark | 0:7225ff529d1c | 116 | void BSP_signalPeds(BSP_PedsSignal sig) { |
| t_lark | 0:7225ff529d1c | 117 | /* |
| t_lark | 0:7225ff529d1c | 118 | switch (sig) { |
| t_lark | 0:7225ff529d1c | 119 | case PEDS_DONT_WALK: |
| t_lark | 0:7225ff529d1c | 120 | LED_PORT->FIOSET = LED4_BIT; // turn the LED4 on |
| t_lark | 0:7225ff529d1c | 121 | break; |
| t_lark | 0:7225ff529d1c | 122 | case PEDS_WALK: |
| t_lark | 0:7225ff529d1c | 123 | LED_PORT->FIOCLR = LED4_BIT; // turn the LED4 off |
| t_lark | 0:7225ff529d1c | 124 | break; |
| t_lark | 0:7225ff529d1c | 125 | case PEDS_BLANK: |
| t_lark | 0:7225ff529d1c | 126 | LED_PORT->FIOCLR = LED4_BIT; // turn the LED4 off |
| t_lark | 0:7225ff529d1c | 127 | break; |
| t_lark | 0:7225ff529d1c | 128 | }*/ |
| t_lark | 0:7225ff529d1c | 129 | } |
| t_lark | 0:7225ff529d1c | 130 | //............................................................................ |
| t_lark | 0:7225ff529d1c | 131 | void BSP_showState(char const *state) { |
| t_lark | 0:7225ff529d1c | 132 | QS_BEGIN(PELICAN_STAT, AO_Pelican) // application-specific record |
| t_lark | 0:7225ff529d1c | 133 | QS_STR(state); // state string |
| t_lark | 0:7225ff529d1c | 134 | QS_END() |
| t_lark | 0:7225ff529d1c | 135 | } |
| t_lark | 0:7225ff529d1c | 136 | |
| t_lark | 0:7225ff529d1c | 137 | //............................................................................ |
| t_lark | 0:7225ff529d1c | 138 | void BSP_signalSense(BSP_SenseSignal sig) { |
| t_lark | 0:7225ff529d1c | 139 | switch (sig) { |
| t_lark | 0:7225ff529d1c | 140 | case SENSE_1_CON: |
| t_lark | 0:7225ff529d1c | 141 | LED_PORT->FIOSET = LED1_BIT; // turn the LED4 on |
| t_lark | 0:7225ff529d1c | 142 | break; |
| t_lark | 0:7225ff529d1c | 143 | case SENSE_1_DIS: |
| t_lark | 0:7225ff529d1c | 144 | LED_PORT->FIOCLR = LED1_BIT; // turn the LED4 off |
| t_lark | 0:7225ff529d1c | 145 | break; |
| t_lark | 0:7225ff529d1c | 146 | } |
| t_lark | 0:7225ff529d1c | 147 | } |
| t_lark | 0:7225ff529d1c | 148 | |
| t_lark | 0:7225ff529d1c | 149 | //............................................................................ |
| t_lark | 0:7225ff529d1c | 150 | void BSP_chk_io() { |
| t_lark | 0:7225ff529d1c | 151 | QS_BEGIN(IO_STAT, AO_Poll) // application-specific record |
| t_lark | 0:7225ff529d1c | 152 | QS_STR("chk_io_called"); |
| t_lark | 0:7225ff529d1c | 153 | static int prev[4] = {0,0,0,0}; |
| t_lark | 0:7225ff529d1c | 154 | for(int i=0;i<l_N4S2.N_FACES;i++){ |
| t_lark | 0:7225ff529d1c | 155 | int newVal = l_N4S2.geomSenses[i]; |
| t_lark | 0:7225ff529d1c | 156 | if(newVal == 0 && prev[i] !=0){ |
| t_lark | 0:7225ff529d1c | 157 | QF::publish(&sense1_N1_Down_Evt); |
| t_lark | 0:7225ff529d1c | 158 | }else if(newVal != 0 && prev[i] ==0){ |
| t_lark | 0:7225ff529d1c | 159 | QF::publish(&sense1_N1_Up_Evt); |
| t_lark | 0:7225ff529d1c | 160 | } |
| t_lark | 0:7225ff529d1c | 161 | prev[i] = newVal; |
| t_lark | 0:7225ff529d1c | 162 | } |
| t_lark | 0:7225ff529d1c | 163 | QS_END() |
| t_lark | 0:7225ff529d1c | 164 | } |
| t_lark | 0:7225ff529d1c | 165 | |
| t_lark | 0:7225ff529d1c | 166 | //............................................................................ |
| t_lark | 0:7225ff529d1c | 167 | void QF::onStartup(void) { |
| t_lark | 0:7225ff529d1c | 168 | // set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate |
| t_lark | 0:7225ff529d1c | 169 | SysTick_Config(SystemCoreClock / BSP_TICKS_PER_SEC); |
| t_lark | 0:7225ff529d1c | 170 | |
| t_lark | 0:7225ff529d1c | 171 | // set priorities of all interrupts in the system... |
| t_lark | 0:7225ff529d1c | 172 | NVIC_SetPriority(SysTick_IRQn, SYSTICK_PRIO); |
| t_lark | 0:7225ff529d1c | 173 | NVIC_SetPriority(EINT0_IRQn, GPIOPORTA_PRIO); |
| t_lark | 0:7225ff529d1c | 174 | |
| t_lark | 0:7225ff529d1c | 175 | NVIC_EnableIRQ(EINT0_IRQn); |
| t_lark | 0:7225ff529d1c | 176 | } |
| t_lark | 0:7225ff529d1c | 177 | //............................................................................ |
| t_lark | 0:7225ff529d1c | 178 | void QF::onCleanup(void) { |
| t_lark | 0:7225ff529d1c | 179 | } |
| t_lark | 0:7225ff529d1c | 180 | //............................................................................ |
| t_lark | 0:7225ff529d1c | 181 | void QK::onIdle(void) { |
| t_lark | 0:7225ff529d1c | 182 | #ifdef Q_SPY |
| t_lark | 0:7225ff529d1c | 183 | if (l_qspy.writeable()) { |
| t_lark | 0:7225ff529d1c | 184 | QF_INT_LOCK(dummy); |
| t_lark | 0:7225ff529d1c | 185 | uint16_t b = QS::getByte(); |
| t_lark | 0:7225ff529d1c | 186 | QF_INT_UNLOCK(dummy); |
| t_lark | 0:7225ff529d1c | 187 | if (b != QS_EOD) { |
| t_lark | 0:7225ff529d1c | 188 | l_qspy.putc((uint8_t)b); |
| t_lark | 0:7225ff529d1c | 189 | } |
| t_lark | 0:7225ff529d1c | 190 | } |
| t_lark | 0:7225ff529d1c | 191 | #else |
| t_lark | 0:7225ff529d1c | 192 | // put the CPU and peripherals to the low-power mode |
| t_lark | 0:7225ff529d1c | 193 | // you might need to customize the clock management for your application, |
| t_lark | 0:7225ff529d1c | 194 | // see the datasheet for your particular Cortex-M3 MCU. |
| t_lark | 0:7225ff529d1c | 195 | __WFI(); |
| t_lark | 0:7225ff529d1c | 196 | #endif |
| t_lark | 0:7225ff529d1c | 197 | } |
| t_lark | 0:7225ff529d1c | 198 | |
| t_lark | 0:7225ff529d1c | 199 | //............................................................................ |
| t_lark | 0:7225ff529d1c | 200 | void Q_onAssert(char const Q_ROM * const Q_ROM_VAR file, int line) { |
| t_lark | 0:7225ff529d1c | 201 | (void)file; // avoid compiler warning |
| t_lark | 0:7225ff529d1c | 202 | (void)line; // avoid compiler warning |
| t_lark | 0:7225ff529d1c | 203 | QS_BEGIN_(QS_ASSERT, 0, 0) |
| t_lark | 0:7225ff529d1c | 204 | QS_TIME_(); // time stamp |
| t_lark | 0:7225ff529d1c | 205 | QS_U16_((uint16_t)line); // the line number |
| t_lark | 0:7225ff529d1c | 206 | QS_STR_(file); // the file name |
| t_lark | 0:7225ff529d1c | 207 | QS_END_() |
| t_lark | 0:7225ff529d1c | 208 | QS::onFlush(); |
| t_lark | 0:7225ff529d1c | 209 | |
| t_lark | 0:7225ff529d1c | 210 | QF_INT_LOCK(dummy); // make sure that all interrupts are disabled |
| t_lark | 0:7225ff529d1c | 211 | // light up all LEDs |
| t_lark | 0:7225ff529d1c | 212 | LED_PORT->FIOSET = (LED1_BIT | LED2_BIT | LED3_BIT | LED4_BIT); |
| t_lark | 0:7225ff529d1c | 213 | |
| t_lark | 0:7225ff529d1c | 214 | for (;;) { // NOTE: replace the loop with reset for final version |
| t_lark | 0:7225ff529d1c | 215 | } |
| t_lark | 0:7225ff529d1c | 216 | } |
| t_lark | 0:7225ff529d1c | 217 | |
| t_lark | 0:7225ff529d1c | 218 | //---------------------------------------------------------------------------- |
| t_lark | 0:7225ff529d1c | 219 | #ifdef Q_SPY |
| t_lark | 0:7225ff529d1c | 220 | //............................................................................ |
| t_lark | 0:7225ff529d1c | 221 | uint8_t QS::onStartup(void const *arg) { |
| t_lark | 0:7225ff529d1c | 222 | static uint8_t qsBuf[6*256]; // buffer for Quantum Spy |
| t_lark | 0:7225ff529d1c | 223 | initBuf(qsBuf, sizeof(qsBuf)); |
| t_lark | 0:7225ff529d1c | 224 | |
| t_lark | 0:7225ff529d1c | 225 | l_qspy.baud(QSPY_BAUD_RATE); |
| t_lark | 0:7225ff529d1c | 226 | |
| t_lark | 0:7225ff529d1c | 227 | l_tickPeriod = SystemCoreClock / BSP_TICKS_PER_SEC; |
| t_lark | 0:7225ff529d1c | 228 | l_tickTime = l_tickPeriod; // to start the timestamp at zero |
| t_lark | 0:7225ff529d1c | 229 | |
| t_lark | 0:7225ff529d1c | 230 | // setup the QS filters... |
| t_lark | 0:7225ff529d1c | 231 | QS_FILTER_ON(QS_ALL_RECORDS); |
| t_lark | 0:7225ff529d1c | 232 | |
| t_lark | 0:7225ff529d1c | 233 | // QS_FILTER_OFF(QS_QEP_STATE_EMPTY); |
| t_lark | 0:7225ff529d1c | 234 | // QS_FILTER_OFF(QS_QEP_STATE_ENTRY); |
| t_lark | 0:7225ff529d1c | 235 | // QS_FILTER_OFF(QS_QEP_STATE_EXIT); |
| t_lark | 0:7225ff529d1c | 236 | // QS_FILTER_OFF(QS_QEP_STATE_INIT); |
| t_lark | 0:7225ff529d1c | 237 | // QS_FILTER_OFF(QS_QEP_INIT_TRAN); |
| t_lark | 0:7225ff529d1c | 238 | // QS_FILTER_OFF(QS_QEP_INTERN_TRAN); |
| t_lark | 0:7225ff529d1c | 239 | // QS_FILTER_OFF(QS_QEP_TRAN); |
| t_lark | 0:7225ff529d1c | 240 | // QS_FILTER_OFF(QS_QEP_IGNORED); |
| t_lark | 0:7225ff529d1c | 241 | |
| t_lark | 0:7225ff529d1c | 242 | // QS_FILTER_OFF(QS_QF_ACTIVE_ADD); |
| t_lark | 0:7225ff529d1c | 243 | // QS_FILTER_OFF(QS_QF_ACTIVE_REMOVE); |
| t_lark | 0:7225ff529d1c | 244 | // QS_FILTER_OFF(QS_QF_ACTIVE_SUBSCRIBE); |
| t_lark | 0:7225ff529d1c | 245 | // QS_FILTER_OFF(QS_QF_ACTIVE_UNSUBSCRIBE); |
| t_lark | 0:7225ff529d1c | 246 | // QS_FILTER_OFF(QS_QF_ACTIVE_POST_FIFO); |
| t_lark | 0:7225ff529d1c | 247 | // QS_FILTER_OFF(QS_QF_ACTIVE_POST_LIFO); |
| t_lark | 0:7225ff529d1c | 248 | // QS_FILTER_OFF(QS_QF_ACTIVE_GET); |
| t_lark | 0:7225ff529d1c | 249 | // QS_FILTER_OFF(QS_QF_ACTIVE_GET_LAST); |
| t_lark | 0:7225ff529d1c | 250 | // QS_FILTER_OFF(QS_QF_EQUEUE_INIT); |
| t_lark | 0:7225ff529d1c | 251 | // QS_FILTER_OFF(QS_QF_EQUEUE_POST_FIFO); |
| t_lark | 0:7225ff529d1c | 252 | // QS_FILTER_OFF(QS_QF_EQUEUE_POST_LIFO); |
| t_lark | 0:7225ff529d1c | 253 | // QS_FILTER_OFF(QS_QF_EQUEUE_GET); |
| t_lark | 0:7225ff529d1c | 254 | // QS_FILTER_OFF(QS_QF_EQUEUE_GET_LAST); |
| t_lark | 0:7225ff529d1c | 255 | // QS_FILTER_OFF(QS_QF_MPOOL_INIT); |
| t_lark | 0:7225ff529d1c | 256 | // QS_FILTER_OFF(QS_QF_MPOOL_GET); |
| t_lark | 0:7225ff529d1c | 257 | // QS_FILTER_OFF(QS_QF_MPOOL_PUT); |
| t_lark | 0:7225ff529d1c | 258 | // QS_FILTER_OFF(QS_QF_PUBLISH); |
| t_lark | 0:7225ff529d1c | 259 | // QS_FILTER_OFF(QS_QF_NEW); |
| t_lark | 0:7225ff529d1c | 260 | // QS_FILTER_OFF(QS_QF_GC_ATTEMPT); |
| t_lark | 0:7225ff529d1c | 261 | // QS_FILTER_OFF(QS_QF_GC); |
| t_lark | 0:7225ff529d1c | 262 | QS_FILTER_OFF(QS_QF_TICK); |
| t_lark | 0:7225ff529d1c | 263 | // QS_FILTER_OFF(QS_QF_TIMEEVT_ARM); |
| t_lark | 0:7225ff529d1c | 264 | // QS_FILTER_OFF(QS_QF_TIMEEVT_AUTO_DISARM); |
| t_lark | 0:7225ff529d1c | 265 | // QS_FILTER_OFF(QS_QF_TIMEEVT_DISARM_ATTEMPT); |
| t_lark | 0:7225ff529d1c | 266 | // QS_FILTER_OFF(QS_QF_TIMEEVT_DISARM); |
| t_lark | 0:7225ff529d1c | 267 | // QS_FILTER_OFF(QS_QF_TIMEEVT_REARM); |
| t_lark | 0:7225ff529d1c | 268 | // QS_FILTER_OFF(QS_QF_TIMEEVT_POST); |
| t_lark | 0:7225ff529d1c | 269 | QS_FILTER_OFF(QS_QF_INT_LOCK); |
| t_lark | 0:7225ff529d1c | 270 | QS_FILTER_OFF(QS_QF_INT_UNLOCK); |
| t_lark | 0:7225ff529d1c | 271 | QS_FILTER_OFF(QS_QF_ISR_ENTRY); |
| t_lark | 0:7225ff529d1c | 272 | QS_FILTER_OFF(QS_QF_ISR_EXIT); |
| t_lark | 0:7225ff529d1c | 273 | |
| t_lark | 0:7225ff529d1c | 274 | // QS_FILTER_OFF(QS_QK_MUTEX_LOCK); |
| t_lark | 0:7225ff529d1c | 275 | // QS_FILTER_OFF(QS_QK_MUTEX_UNLOCK); |
| t_lark | 0:7225ff529d1c | 276 | // QS_FILTER_OFF(QS_QK_SCHEDULE); |
| t_lark | 0:7225ff529d1c | 277 | |
| t_lark | 0:7225ff529d1c | 278 | return (uint8_t)1; // return success |
| t_lark | 0:7225ff529d1c | 279 | } |
| t_lark | 0:7225ff529d1c | 280 | //............................................................................ |
| t_lark | 0:7225ff529d1c | 281 | void QS::onCleanup(void) { |
| t_lark | 0:7225ff529d1c | 282 | } |
| t_lark | 0:7225ff529d1c | 283 | //............................................................................ |
| t_lark | 0:7225ff529d1c | 284 | QSTimeCtr QS::onGetTime(void) { // invoked with interrupts locked |
| t_lark | 0:7225ff529d1c | 285 | if ((SysTick->CTRL & 0x00000100) == 0) { // COUNTFLAG no set? |
| t_lark | 0:7225ff529d1c | 286 | return l_tickTime - (QSTimeCtr)SysTick->VAL; |
| t_lark | 0:7225ff529d1c | 287 | } |
| t_lark | 0:7225ff529d1c | 288 | else { // the rollover occured, but the SysTick_ISR did not run yet |
| t_lark | 0:7225ff529d1c | 289 | return l_tickTime + l_tickPeriod - (QSTimeCtr)SysTick->VAL; |
| t_lark | 0:7225ff529d1c | 290 | } |
| t_lark | 0:7225ff529d1c | 291 | } |
| t_lark | 0:7225ff529d1c | 292 | //............................................................................ |
| t_lark | 0:7225ff529d1c | 293 | void QS::onFlush(void) { |
| t_lark | 0:7225ff529d1c | 294 | uint16_t b; |
| t_lark | 0:7225ff529d1c | 295 | QF_INT_LOCK(dummy); |
| t_lark | 0:7225ff529d1c | 296 | while ((b = QS::getByte()) != QS_EOD) { |
| t_lark | 0:7225ff529d1c | 297 | while (!l_qspy.writeable()) { // wait until serial port is writable |
| t_lark | 0:7225ff529d1c | 298 | } |
| t_lark | 0:7225ff529d1c | 299 | l_qspy.putc((uint8_t)b); |
| t_lark | 0:7225ff529d1c | 300 | } |
| t_lark | 0:7225ff529d1c | 301 | QF_INT_UNLOCK(dummy); |
| t_lark | 0:7225ff529d1c | 302 | } |
| t_lark | 0:7225ff529d1c | 303 | #endif // Q_SPY |
| t_lark | 0:7225ff529d1c | 304 | //---------------------------------------------------------------------------- |