//............................................................................ void BSP::displayPhilStat(uint8_t n, char const *stat) { if (stat[0] == 'e') { BSP_LED_On(LED1); } else { BSP_LED_Off(LED1); } QS_BEGIN(PHILO_STAT, AO_Philo[n]) // application-specific record begin QS_U8(1, n); // Philosopher number QS_STR(stat); // Philosopher status QS_END() // application-specific record end }
/*..........................................................................*/ void BSP_displyPhilStat(uint8_t n, char const *stat) { /* turn LED on when eating and off when not eating */ uint8_t on_off = (stat[0] == 'e' ? LED_ON : LED_OFF); switch (n) { case 0: LED04 = on_off; break; case 1: LED05 = on_off; break; case 2: LED06 = on_off; break; case 3: LED07 = on_off; break; case 4: LED08 = on_off; break; default: Q_ERROR(); break; } QS_BEGIN(PHILO_STAT, AO_Philo[n]) /* application-specific record begin */ QS_U8(1, n); /* Philosopher number */ QS_STR(stat); /* Philosopher status */ QS_END() }
//............................................................................ void BSP_displayPhilStat(uint8_t n, char const *stat) { UINT bitmapNum = 0; Q_REQUIRE(n < N_PHILO); switch (stat[0]) { case 't': bitmapNum = 0U; break; case 'h': bitmapNum = 1U; break; case 'e': bitmapNum = 2U; break; default: Q_ERROR(); break; } // set the "segment" # n to the bitmap # 'bitmapNum' l_philos.setSegment((UINT)n, bitmapNum); QS_BEGIN(PHILO_STAT, AO_Philo[n]) // application-specific record begin QS_U8(1, n); // Philosopher number QS_STR(stat); // Philosopher status QS_END() }
/*..........................................................................*/ void BSP_displayPhilStat(uint8_t n, char const *stat) { if (stat[0] == 'h') { LPC_GPIO1->FIOSET = LED_1; /* turn LED on */ } else { LPC_GPIO1->FIOCLR = LED_1; /* turn LED off */ } if (stat[0] == 'e') { LPC_GPIO1->FIOSET = LED_2; /* turn LED on */ } else { LPC_GPIO1->FIOCLR = LED_2; /* turn LED off */ } QS_BEGIN(PHILO_STAT, AO_Philo[n]) /* application-specific record begin */ QS_U8(1, n); /* Philosopher number */ QS_STR(stat); /* Philosopher status */ QS_END() }
/*..........................................................................*/ static void Cache_read(Cache *me, QEvent const *e) { CacheRWEvt *pe = (CacheRWEvt *)e; CacheRWRly *re; int reply = CACHE_READ_REPLY_SIG; re = Q_NEW(CacheRWRly, reply); QS_BEGIN(QS_CACHE_RW, QS_apObj_); QS_U32_HEX(8, pe->sector); QS_U32_HEX(8, pe->track); QS_U32_HEX(4, pe->offset); QS_U32_HEX(4, pe->len); QS_U32_HEX(2, pe->flags); QS_END(); Track_dispatch(pe->conf, e); /* doing a fake bio finish */ re->conf = pe->conf; re->errno = 0; re->buf.bio.bi = pe->buf.bio.bi; QACTIVE_POST(pe->ao, (QEvent *)re, AO_cache); }
/*AO内部打印调试信息*/ void BSP_Trace(u8 eState, QActive* pAO, char* const str) { QS_BEGIN(eState, pAO) /* application-specific record begin */ QS_STR(str); /* Philosopher status */ QS_END() }