Exemple #1
0
static void btn1_event_handler(nrf_drv_gpiote_pin_t pin
		, nrf_gpiote_polarity_t action) {
    QS_BEGIN(TRACE_SDK_EVT, NULL)
        QS_U8(0, 1);
        QS_U8(0, BSP_readButton());
    QS_END() QS_START_TX();
}
Exemple #2
0
/**@brief Function for handling advertising events.
 *
 * @details This function is called for advertising events that are passed to the application.
 *
 * @param[in] ble_adv_evt  Advertising event.
 */
static void on_adv_evt(ble_adv_evt_t ble_adv_evt)
{
    uint32_t err_code;
    QS_BEGIN(TRACE_ADV_EVT, &l_SD)
        QS_U8(0, ble_adv_evt);
    QS_END() QS_START_TX();

    switch (ble_adv_evt) {
	case BLE_ADV_EVT_IDLE:
		BSP_stop();
		break;

	case BLE_ADV_EVT_WHITELIST_REQUEST:
	{
		ble_gap_whitelist_t whitelist;
		ble_gap_addr_t    * p_whitelist_addr[BLE_GAP_WHITELIST_ADDR_MAX_COUNT];
		ble_gap_irk_t     * p_whitelist_irk[BLE_GAP_WHITELIST_IRK_MAX_COUNT];

		whitelist.addr_count = BLE_GAP_WHITELIST_ADDR_MAX_COUNT;
		whitelist.irk_count  = BLE_GAP_WHITELIST_IRK_MAX_COUNT;
		whitelist.pp_addrs   = p_whitelist_addr;
		whitelist.pp_irks    = p_whitelist_irk;

		err_code = dm_whitelist_create(&m_app_handle, &whitelist);
		APP_ERROR_CHECK(err_code);

		err_code = ble_advertising_whitelist_reply(&whitelist);
		APP_ERROR_CHECK(err_code);
		break;
	}
    }
}
Exemple #3
0
/**@brief Function for handling the Device Manager events.
 *
 * @param[in] p_evt  Data associated to the Device Manager event.
 */
static uint32_t device_manager_evt_handler(dm_handle_t const * p_handle,
                                           dm_event_t const  * p_evt,
                                           ret_code_t          event_result)
{
    QS_BEGIN(TRACE_DM_EVT, &l_SD)
        QS_U8(0, p_evt->event_id);
    QS_END() QS_START_TX();

    uint32_t err_code;

    switch (p_evt->event_id)
    {
        case DM_EVT_CONNECTION:
            m_peer_handle = (*p_handle);
            err_code      = app_timer_start(m_sec_req_timer_id, SECURITY_REQUEST_DELAY, NULL);
            APP_ERROR_CHECK(err_code);
            break;

        case DM_EVT_LINK_SECURED:
            err_code = ble_db_discovery_start(&m_ble_db_discovery,
                                              p_evt->event_param.p_gap_param->conn_handle);
            APP_ERROR_CHECK(err_code);
            break;

        default:
            break;

    }
    return NRF_SUCCESS;
}
Exemple #4
0
//............................................................................
void BSP::displayPhilStat(uint8_t n, char const *stat) {
    // exercise the FPU with some floating point computations
    float volatile x;
    x = 3.1415926F;
    x = x + 2.7182818F;

    if (stat[0] == 'h') {
        LED_GPIO_PORT->BSRRL = LED3_PIN; // turn LED on
    }
    else {
        LED_GPIO_PORT->BSRRH = LED3_PIN; // turn LED off
    }
    if (stat[0] == 'e') {
        LED_GPIO_PORT->BSRRL = LED5_PIN; // turn LED on
    }
    else {
        LED_GPIO_PORT->BSRRH = LED5_PIN; // turn LED on
    }
    (void)n; // unused parameter (in all but Spy build configuration)

    QS_BEGIN(PHILO_STAT, AO_Philo[n]) // application-specific record begin
        QS_U8(1, n);  // Philosopher number
        QS_STR(stat); // Philosopher status
    QS_END()
}
Exemple #5
0
/**@brief Function for handling the application's BLE stack events.
 *
 * @param[in] p_ble_evt  Bluetooth stack event.
 */
static void on_ble_evt(ble_evt_t * p_ble_evt)
{
    QS_BEGIN(TRACE_BLE_EVT, &l_SD)
        QS_U8(0, p_ble_evt->header.evt_id);
    QS_END() QS_START_TX();

    uint32_t err_code = NRF_SUCCESS;
    switch (p_ble_evt->header.evt_id) {
	case BLE_GAP_EVT_DISCONNECTED:
		if (p_ble_evt->evt.gap_evt.conn_handle == m_ancs_c.conn_handle) {
			m_ancs_c.conn_handle = BLE_CONN_HANDLE_INVALID;
		}
		break;

	case BLE_GATTS_EVT_TIMEOUT:
		// Disconnect on GATT Server and Client time-out events.
		err_code = sd_ble_gap_disconnect(p_ble_evt->evt.gatts_evt.conn_handle
				, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
		APP_ERROR_CHECK(err_code);
		break;

	case BLE_GATTC_EVT_TIMEOUT:
		// Disconnect on GATT Server and Client time-out events.
		err_code = sd_ble_gap_disconnect(p_ble_evt->evt.gattc_evt.conn_handle
				, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
		APP_ERROR_CHECK(err_code);
		break;
    }
    APP_ERROR_CHECK(err_code);
}
Exemple #6
0
/**@brief Function for handling the Apple Notification Service client.
 *
 * @details This function is called for all events in the Apple Notification client that
 *          are passed to the application.
 *
 * @param[in] p_evt  Event received from the Apple Notification Service client.
 */
static void on_ancs_c_evt(ble_ancs_c_evt_t * p_evt)
{

    uint32_t err_code = NRF_SUCCESS;
    switch (p_evt->evt_type) {
	case BLE_ANCS_C_EVT_DISCOVERY_COMPLETE:
	    QS_BEGIN(TRACE_ANCS_EVT, &l_SD)
	        QS_U8(0, p_evt->evt_type);
	    QS_END() QS_START_TX();

	    err_code = ble_ancs_c_handles_assign(&m_ancs_c,p_evt->conn_handle
				, &p_evt->service);
		APP_ERROR_CHECK(err_code);
#if 0
		apple_notification_setup();
#else
		QACTIVE_POST(AO_ble, ANCS_SIG, p_evt->evt_type);
#endif
		break;

	case BLE_ANCS_C_EVT_NOTIF: {
		struct AncsNotification* status =
				&l_Ble.ancs_status[p_evt->notif.category_id];
		status->flags = p_evt->notif.evt_flags;
		status->category_count = p_evt->notif.category_count;

		QS_BEGIN(TRACE_ANCS_EVT, &l_SD)
	        QS_U8(0, p_evt->evt_type);
			QS_U8(0, p_evt->notif.evt_id);
			QS_MEM((uint8_t*)&status->flags, sizeof(status->flags));
	    QS_END() QS_START_TX();

	    QACTIVE_POST(AO_ble, ANCS_SIG
				, ((uint32_t)p_evt->notif.evt_id << 24) //Add/Mod/Remove
				| 0 // flags might not fit into 8 bits if compiler doesn't pack
				| ((uint16_t)p_evt->notif.category_id << 8)//email, etc
				| p_evt->evt_type);
	}   break;

	//case BLE_ANCS_C_EVT_NOTIF_ATTRIBUTE: //title, message, date, etc
	default:
	    QS_BEGIN(TRACE_ANCS_EVT, &l_SD)
	        QS_U8(0, p_evt->evt_type);
	    QS_END() QS_START_TX();
	    break;
    }
}
Exemple #7
0
/*..........................................................................*/
void BSP_displayPhilStat(uint8_t n, char const *stat) {
    printf("Philosopher %2d is %s\n", (int)n, stat);

    QS_BEGIN(PHILO_STAT, AO_Philo[n])  /* application-specific record begin */
        QS_U8(1, n);                                  /* Philosopher number */
        QS_STR(stat);                                 /* Philosopher status */
    QS_END()
}
Exemple #8
0
/*..........................................................................*/
void BSP_displyPhilStat(uint8_t n, char const *stat) {
    Video_printStrAt(17, 12 + n, VIDEO_FGND_YELLOW, stat);

    QS_BEGIN(PHILO_STAT, AO_Philo[n]) /* application-specific record begin */
        QS_U8(1, n);   /* Philosopher number */
        QS_STR(stat);  /* Philosopher status */
    QS_END()
}
Exemple #9
0
/*..........................................................................*/
void BSP_displayPhilStat(uint8_t n, char const *stat) {
    GPIOF->DATA_Bits[LED_BLUE] = ((stat[0] == 'e') ? LED_BLUE : 0U);

    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) {

    LCD_DisplayChar(Line5, (3*16*n + 5*16), stat[0]);

    QS_BEGIN(PHILO_STAT, AO_Philo[n])  /* application-specific record begin */
        QS_U8(1, n);                                  /* Philosopher number */
        QS_STR(stat);                                 /* Philosopher status */
    QS_END()
}
Exemple #11
0
/*! callback function to execute a user command (to be implemented in BSP) */
void QS_onCommand(uint8_t cmdId, uint32_t param) {
    void assert_failed(char const *module, int loc);
    (void)cmdId;
    (void)param;
    QS_BEGIN(TRACE_QS_CMD, (void *)0) /* application-specific record begin */
        QS_U8(2, cmdId);
        QS_U32(8, param);
    QS_END()
}
Exemple #12
0
//////////////////////////////////////////////////////////////////////////////
// Product: DPP example with emWin/uC/GUI, WITH Window Manager
// Last updated for version 6.2.0
// Last updated on  2018-03-16
//
//                    Q u a n t u m     L e a P s
//                    ---------------------------
//                    innovating embedded systems
//
// Copyright (C) Quantum Leaps, LLC. All rights reserved.
//
// This program is open source software: you can redistribute it and/or
// modify it under the terms of the GNU General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Alternatively, this program may be distributed and modified under the
// terms of Quantum Leaps commercial licenses, which expressly supersede
// the GNU General Public License and are specifically designed for
// licensees interested in retaining the proprietary status of their code.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// Contact information:
// https://www.state-machine.com
// mailto:[email protected]
//////////////////////////////////////////////////////////////////////////////
#include "qpcpp.h"
#include "dpp.h"
#include "bsp.h"

extern "C" {
    #include "GUI.h"
    #include "WM.h"                                   // emWin Windows Manager
    #include "DIALOG.h"
    #include "SIM.h"
}

Q_DEFINE_THIS_FILE

// Active object class -------------------------------------------------------
class Table : public QActive {
private:
    uint8_t m_fork[N_PHILO];
    uint8_t m_isHungry[N_PHILO];

public:
    Table();

private:
    static QState initial(Table *me, QEvt const *e);
    static QState ready  (Table *me, QEvt const *e);
    static QState serving(Table *me, QEvt const *e);
    static QState paused (Table *me, QEvt const *e);
};

#define RIGHT(n_) ((uint8_t)(((n_) + (N_PHILO - 1)) % N_PHILO))
#define LEFT(n_)  ((uint8_t)(((n_) + 1) % N_PHILO))
enum m_forkState { FREE, USED };

// Local objects -------------------------------------------------------------
static Table l_table;                                    // local Table object

#ifdef Q_SPY
    enum QSUserRecords {
        PHILO_STAT = QS_USER,
        TABLE_STAT
    };
    static uint8_t const l_onDialogGUI = 0U;
#endif

// Public-scope objects ------------------------------------------------------
QActive * const AO_Table = &l_table;                    // "opaque" AO pointer


// GUI definition ============================================================
static WM_HWIN l_hDlg;
static WM_CALLBACK *l_cb_WM_HBKWIN;

static const GUI_WIDGET_CREATE_INFO l_dialog[] = {
    { &FRAMEWIN_CreateIndirect, "Dining Philosopher Problem",
        0,  30,  30, 260, 180, FRAMEWIN_CF_MOVEABLE },
    { &TEXT_CreateIndirect, "Philosopher 0",
        GUI_ID_TEXT9,  50,  10, 0, 0, TEXT_CF_LEFT },
    { &TEXT_CreateIndirect, "Philosopher 1",
        GUI_ID_TEXT9,  50,  30, 0, 0, TEXT_CF_LEFT },
    { &TEXT_CreateIndirect, "Philosopher 2",
        GUI_ID_TEXT9,  50,  50, 0, 0, TEXT_CF_LEFT },
    { &TEXT_CreateIndirect, "Philosopher 3",
        GUI_ID_TEXT9,  50,  70, 0, 0, TEXT_CF_LEFT },
    { &TEXT_CreateIndirect, "Philosopher 4",
        GUI_ID_TEXT9,  50,  90, 0, 0, TEXT_CF_LEFT },
    { &TEXT_CreateIndirect, "Table",
        GUI_ID_TEXT9,  50, 110, 0, 0, TEXT_CF_LEFT },

    { &TEXT_CreateIndirect, "thinking",
        GUI_ID_TEXT0, 130,  10, 0, 0, TEXT_CF_LEFT },
    { &TEXT_CreateIndirect, "thinking",
        GUI_ID_TEXT1, 130,  30, 0, 0, TEXT_CF_LEFT },
    { &TEXT_CreateIndirect, "thinking",
        GUI_ID_TEXT2, 130,  50, 0, 0, TEXT_CF_LEFT },
    { &TEXT_CreateIndirect, "thinking",
        GUI_ID_TEXT3, 130,  70, 0, 0, TEXT_CF_LEFT },
    { &TEXT_CreateIndirect, "thinking",
        GUI_ID_TEXT4, 130,  90, 0, 0, TEXT_CF_LEFT },
    { &TEXT_CreateIndirect, "serving",
        GUI_ID_TEXT5, 130, 110, 0, 0, TEXT_CF_LEFT },

    { &BUTTON_CreateIndirect,"PAUSE",
        GUI_ID_BUTTON0,    160, 130, 80, 30 }
};

   //..........................................................................*/
static void onMainWndGUI(WM_MESSAGE* pMsg) {
    switch (pMsg->MsgId) {
        case WM_PAINT: {
            GUI_SetBkColor(GUI_GRAY);
            GUI_Clear();
            GUI_SetColor(GUI_BLACK);
            GUI_SetFont(&GUI_Font24_ASCII);
            GUI_DispStringHCenterAt("Dining Philosophers - Demo", 160, 5);
            break;
        }
        default: {
            WM_DefaultProc(pMsg);
            break;
        }
    }
}
   //..........................................................................*/
static void onDialogGUI(WM_MESSAGE * pMsg) {
    switch (pMsg->MsgId) {
        case WM_INIT_DIALOG: {
            break;
        }
        case WM_NOTIFY_PARENT: {
            switch (pMsg->Data.v) {
                case WM_NOTIFICATION_RELEASED: {     // react only if released */
                    switch (WM_GetId(pMsg->hWinSrc)) {
                        case GUI_ID_BUTTON0: {
                                        // static PAUSE event for the Table AO */
                            static QEvent const pauseEvt = { PAUSE_SIG, 0 };
                            AO_Table->POST(&pauseEvt, &l_onDialogGUI);
                            break;
                        }
                    }
                    break;
                }
            }
            break;
        }
        default: {
            WM_DefaultProc(pMsg);
            break;
        }
    }
}
   //..........................................................................*/
static void displyPhilStat(uint8_t n, char const *stat) {
    TEXT_SetText(WM_GetDialogItem(l_hDlg, GUI_ID_TEXT0 + n), stat);
    WM_Exec();                    // update the screen and invoke WM callbacks */

    QS_BEGIN(PHILO_STAT, AO_Philo[n])     // application-specific record begin */
        QS_U8(1, n);                                     // Philosopher number */
        QS_STR(stat);                                    // Philosopher status */
    QS_END()
}
Exemple #13
0
/*..........................................................................*/
void BSP_displyPhilStat(uint8_t n, char const *stat) {
    if (n < Q_DIM(l_userLED)) {
        ULED_set(n, (stat[0] == 'e') ? ULED_ON : ULED_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()
}
Exemple #14
0
/*..........................................................................*/
void BSP_displayPhilStat(uint8_t n, char const *stat) {
    (void)n;
    (void)stat;
    LED0_toggle();

    QS_BEGIN(PHILO_STAT, AO_Philo[n])  /* application-specific record begin */
        QS_U8(1, n);                                  /* Philosopher number */
        QS_STR(stat);                                 /* Philosopher status */
    QS_END()
}
Exemple #15
0
//............................................................................
void BSP_displyPhilStat(uint8_t n, char const *stat) {
    char str[2];
    str[0] = stat[0];
    str[1] = '\0';
    Display96x16x1StringDraw(str, (3*6*n + 6), 1);

    QS_BEGIN(PHILO_STAT, AO_Philo[n])     // application-specific record begin
        QS_U8(1, n);                                     // Philosopher number
        QS_STR(stat);                                    // Philosopher status
    QS_END()
}
Exemple #16
0
/*! callback function to execute a uesr command (to be implemented in BSP) */
void QS_onCommand(uint8_t cmdId, uint32_t param) {
    (void)cmdId;
    (void)param;
    QS_BEGIN(COMMAND_STAT, (void *)0) /* application-specific record begin */
        QS_U8(2, cmdId);
        QS_U32(8, param);
    QS_END()

    if (cmdId == 10U) {
        Q_onAssert("command", 10);
    }
}
Exemple #17
0
//............................................................................
void BSP_displayPhilStat(uint8_t const n, char_t const * const stat) {
    char_t str[2];
    str[0] = *stat;
    str[1] = '\0';
    Display96x16x1StringDraw(&str[0],
                             (3U*6U*static_cast<uint32_t>(n)) + 6U, 1U);

    QS_BEGIN(PHILO_STAT, AO_Philo[n])     // application-specific record begin
        QS_U8(1U, n);                                    // Philosopher number
        QS_STR(stat);                                    // Philosopher status
    QS_END()
}
/*..........................................................................*/
void BSP_displyPhilStat(uint8_t n, char const Q_ROM *stat) {
    if (stat[0] == (char const)'e') {        /* is this Philosopher eating? */
        LED_ON(n);
    }
    else {                                /* this Philosopher is not eating */
        LED_OFF(n);
    }
    QS_BEGIN(PHILO_STAT, AO_Philo[n])  /* application-specific record begin */
        QS_U8(1, n);                                  /* Philosopher number */
        QS_STR(stat);                                 /* Philosopher status */
    QS_END()
}
Exemple #19
0
//............................................................................
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
}
Exemple #20
0
/*..........................................................................*/
void BSP_displayPhilStat(uint8_t n, char const *stat) {
    if (stat[0] == 'h') { /* is Philo hungry? */
        P1OUT |=  LED1;  /* turn LED1 on */
    }
    else {
        P1OUT &= ~LED1;  /* turn LED1 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()
}
Exemple #21
0
/*..........................................................................*/
void BSP_displayPhilStat(uint8_t n, char const *stat) {
    if (stat[0] == 'h') {
        GPIOA->BSRRL |= LED_LD2;  /* turn LED on  */
    }
    else {
        GPIOA->BSRRH |= LED_LD2;  /* 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()
}
/*..........................................................................*/
void BSP_displyPhilStat(uint8_t n, char const *stat) {
    uint8_t led_status = (stat[0] == 'e' ? LED_ON : LED_OFF);
    switch (n) {
        case 0: LED0 = led_status; break;
        case 1: LED1 = led_status; break;
        case 2: LED2 = led_status; break;
        case 3: LED3 = led_status; 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()
}
Exemple #23
0
/*..........................................................................*/
void BSP_displayPhilStat(uint8_t n, char const *stat) {
    if (stat[0] == 'h') {
        PORTB |= LED_L;
    }
    else {
        PORTB &= ~LED_L;
    }

    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] == 'e') {
        GPIOSetValue(LED_PORT, LED_BIT, LED_ON);                 /* LED on  */
    }
    else {
        GPIOSetValue(LED_PORT, LED_BIT, LED_OFF);                /* 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()
}
/*..........................................................................*/
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()
}
Exemple #26
0
/*..........................................................................*/
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()
}
Exemple #27
0
//............................................................................
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()
}