2023-01-19 21:14:02 -05:00
|
|
|
//$file${.::dpp.hpp} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
|
|
|
//
|
|
|
|
// Model: dpp_mpu.qm
|
|
|
|
// File: ${.::dpp.hpp}
|
|
|
|
//
|
|
|
|
// This code has been generated by QM 5.3.0 <www.state-machine.com/qm>.
|
|
|
|
// DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost.
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
//
|
|
|
|
// This generated code is open source software: you can redistribute it under
|
|
|
|
// the terms of the GNU General Public License as published by the Free
|
|
|
|
// Software Foundation.
|
|
|
|
//
|
|
|
|
// This code 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.
|
|
|
|
//
|
|
|
|
// NOTE:
|
|
|
|
// Alternatively, this generated code may be distributed 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.
|
|
|
|
//
|
|
|
|
// Contact information:
|
|
|
|
// <www.state-machine.com/licensing>
|
|
|
|
// <info@state-machine.com>
|
|
|
|
//
|
|
|
|
//$endhead${.::dpp.hpp} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
#ifndef DPP_HPP_
|
|
|
|
#define DPP_HPP_
|
|
|
|
|
|
|
|
//$declare${Shared} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
|
|
|
namespace APP {
|
|
|
|
|
|
|
|
//${Shared::AppSignals} ......................................................
|
|
|
|
enum AppSignals : QP::QSignal {
|
|
|
|
EAT_SIG = QP::Q_USER_SIG, // published by Table to let a Philo eat
|
|
|
|
DONE_SIG, // published by Philo when done eating
|
|
|
|
PAUSE_SIG, // published by BSP to pause the application
|
|
|
|
SERVE_SIG, // published by BSP to serve re-start serving forks
|
|
|
|
TEST_SIG, // published by BSP to test the application
|
|
|
|
MAX_PUB_SIG, // the last published signal
|
|
|
|
|
|
|
|
TIMEOUT_SIG, // posted by time event to Philo
|
|
|
|
HUNGRY_SIG, // posted by hungry Philo to Table
|
|
|
|
MAX_SIG // the last signal
|
|
|
|
};
|
|
|
|
|
|
|
|
//${Shared::produce_sig_dict} ................................................
|
|
|
|
#ifdef Q_SPY
|
|
|
|
inline void produce_sig_dict() {
|
|
|
|
QS_SIG_DICTIONARY(EAT_SIG, nullptr);
|
|
|
|
QS_SIG_DICTIONARY(DONE_SIG, nullptr);
|
|
|
|
QS_SIG_DICTIONARY(PAUSE_SIG, nullptr);
|
|
|
|
QS_SIG_DICTIONARY(SERVE_SIG, nullptr);
|
|
|
|
QS_SIG_DICTIONARY(TEST_SIG, nullptr);
|
|
|
|
|
|
|
|
QS_SIG_DICTIONARY(TIMEOUT_SIG, nullptr);
|
|
|
|
QS_SIG_DICTIONARY(HUNGRY_SIG, nullptr);
|
|
|
|
}
|
|
|
|
#endif // def Q_SPY
|
|
|
|
|
|
|
|
//${Shared::N_PHILO} .........................................................
|
|
|
|
constexpr std::uint8_t N_PHILO {5};
|
|
|
|
|
|
|
|
//${Shared::TableEvt} ........................................................
|
|
|
|
class TableEvt : public QP::QEvt {
|
|
|
|
public:
|
|
|
|
std::uint8_t philoId;
|
|
|
|
|
|
|
|
public:
|
|
|
|
constexpr TableEvt(
|
|
|
|
QP::QSignal sig,
|
|
|
|
std::uint8_t id)
|
|
|
|
: QEvt(sig),
|
|
|
|
philoId(id)
|
|
|
|
{}
|
|
|
|
|
|
|
|
#ifdef QEVT_DYN_CTOR
|
|
|
|
TableEvt(std::uint8_t id)
|
|
|
|
: QEvt(QP::QEvt::DYNAMIC),
|
|
|
|
philoId(id)
|
|
|
|
{}
|
|
|
|
#endif // def QEVT_DYN_CTOR
|
|
|
|
}; // class TableEvt
|
|
|
|
|
|
|
|
//${Shared::AO_Philo[N_PHILO]} ...............................................
|
|
|
|
extern QP::QActive * const AO_Philo[N_PHILO];
|
|
|
|
|
|
|
|
//${Shared::Philo_ctor} ......................................................
|
|
|
|
void Philo_ctor(
|
|
|
|
std::uint_fast8_t const id,
|
|
|
|
std::uint8_t * const sto,
|
|
|
|
std::uint32_t const size,
|
|
|
|
void const * const mpu = nullptr);
|
|
|
|
|
|
|
|
//${Shared::AO_Table} ........................................................
|
|
|
|
extern QP::QActive * const AO_Table;
|
|
|
|
|
|
|
|
//${Shared::Table_ctor} ......................................................
|
|
|
|
void Table_ctor(
|
|
|
|
std::uint8_t * const sto,
|
|
|
|
std::uint32_t const size,
|
|
|
|
void const * const mpu = nullptr);
|
|
|
|
|
|
|
|
} // namespace APP
|
|
|
|
//$enddecl${Shared} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
#ifdef QXK_HPP_
|
|
|
|
//$declare${Shared-TH} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
|
|
|
namespace APP {
|
|
|
|
|
|
|
|
//${Shared-TH::TH_XThread1} ..................................................
|
|
|
|
extern QP::QXThread * const TH_XThread1;
|
|
|
|
|
|
|
|
//${Shared-TH::XThread1_ctor} ................................................
|
|
|
|
void XThread1_ctor(
|
|
|
|
std::uint8_t * const sto,
|
|
|
|
std::uint32_t const size,
|
|
|
|
void const * const mpu = nullptr);
|
|
|
|
|
|
|
|
//${Shared-TH::TH_XThread2} ..................................................
|
|
|
|
extern QP::QXThread * const TH_XThread2;
|
|
|
|
|
|
|
|
//${Shared-TH::XThread2_ctor} ................................................
|
|
|
|
void XThread2_ctor(
|
|
|
|
std::uint8_t * const sto,
|
|
|
|
std::uint32_t const size,
|
|
|
|
void const * const mpu = nullptr);
|
|
|
|
|
|
|
|
//${Shared-TH::TH_sema} ......................................................
|
|
|
|
// NOTE: kernel objects can be allocated outside any memory regions
|
|
|
|
// accessible to the threads.
|
|
|
|
extern QP::QXSemaphore TH_sema;
|
|
|
|
|
|
|
|
//${Shared-TH::TH_mutex} .....................................................
|
|
|
|
// NOTE: kernel objects can be allocated outside any memory regions
|
|
|
|
// accessible to the threads.
|
|
|
|
extern QP::QXMutex TH_mutex;
|
|
|
|
|
2023-12-14 16:55:58 -05:00
|
|
|
//${Shared-TH::TH_obj_dict} ..................................................
|
|
|
|
#ifdef Q_SPY
|
|
|
|
void TH_obj_dict();
|
|
|
|
#endif // def Q_SPY
|
|
|
|
|
2023-01-19 21:14:02 -05:00
|
|
|
} // namespace APP
|
|
|
|
//$enddecl${Shared-TH} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
#endif // QXK_HPP_
|
|
|
|
|
|
|
|
#endif // DPP_HPP_
|