|
| 1 | +//$file${.::dpp.h} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv |
| 2 | +// |
| 3 | +// Model: dpp.qm |
| 4 | +// File: ${.::dpp.h} |
| 5 | +// |
| 6 | +// This code has been generated by QM 7.0.0 <www.state-machine.com/qm>. |
| 7 | +// DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. |
| 8 | +// |
| 9 | +// Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved. |
| 10 | +// |
| 11 | +// Q u a n t u m L e a P s |
| 12 | +// ------------------------ |
| 13 | +// Modern Embedded Software |
| 14 | +// |
| 15 | +// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial |
| 16 | +// |
| 17 | +// The QP/C software is dual-licensed under the terms of the open-source GNU |
| 18 | +// General Public License (GPL) or under the terms of one of the closed- |
| 19 | +// source Quantum Leaps commercial licenses. |
| 20 | +// |
| 21 | +// Redistributions in source code must retain this top-level comment block. |
| 22 | +// Plagiarizing this software to sidestep the license obligations is illegal. |
| 23 | +// |
| 24 | +// NOTE: |
| 25 | +// The GPL does NOT permit the incorporation of this code into proprietary |
| 26 | +// programs. Please contact Quantum Leaps for commercial licensing options, |
| 27 | +// which expressly supersede the GPL and are designed explicitly for |
| 28 | +// closed-source distribution. |
| 29 | +// |
| 30 | +// Quantum Leaps contact information: |
| 31 | +// <www.state-machine.com/licensing> |
| 32 | + |
| 33 | +// |
| 34 | +//$endhead${.::dpp.h} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 35 | +#ifndef DPP_H_ |
| 36 | +#define DPP_H_ |
| 37 | + |
| 38 | +//$declare${Shared} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv |
| 39 | + |
| 40 | +//${Shared::AppSignals} ...................................................... |
| 41 | +enum AppSignals { |
| 42 | + EAT_SIG = Q_USER_SIG, // published by Table to let a Philo eat |
| 43 | + DONE_SIG, // published by Philo when done eating |
| 44 | + PAUSE_SIG, // published by BSP to pause the application |
| 45 | + SERVE_SIG, // published by BSP to serve re-start serving forks |
| 46 | + TEST_SIG, // published by BSP to test the application |
| 47 | + MAX_PUB_SIG, // the last published signal |
| 48 | + |
| 49 | + TIMEOUT_SIG, // posted by time event to Philo |
| 50 | + HUNGRY_SIG, // posted by hungry Philo to Table |
| 51 | + MAX_SIG // the last signal |
| 52 | +}; |
| 53 | + |
| 54 | +//${Shared::produce_sig_dict} ................................................ |
| 55 | +#ifdef Q_SPY |
| 56 | +static inline void produce_sig_dict(void) { |
| 57 | + QS_SIG_DICTIONARY(EAT_SIG, (void *)0); |
| 58 | + QS_SIG_DICTIONARY(DONE_SIG, (void *)0); |
| 59 | + QS_SIG_DICTIONARY(PAUSE_SIG, (void *)0); |
| 60 | + QS_SIG_DICTIONARY(SERVE_SIG, (void *)0); |
| 61 | + QS_SIG_DICTIONARY(TEST_SIG, (void *)0); |
| 62 | + |
| 63 | + QS_SIG_DICTIONARY(TIMEOUT_SIG, (void *)0); |
| 64 | + QS_SIG_DICTIONARY(HUNGRY_SIG, (void *)0); |
| 65 | +} |
| 66 | +#endif // def Q_SPY |
| 67 | + |
| 68 | +//${Shared::N_PHILO} ......................................................... |
| 69 | +#define N_PHILO ((uint8_t)5U) |
| 70 | + |
| 71 | +//${Shared::TableEvt} ........................................................ |
| 72 | +typedef struct { |
| 73 | +// protected: |
| 74 | + QEvt super; |
| 75 | + |
| 76 | +// public: |
| 77 | + uint8_t philoId; |
| 78 | +} TableEvt; |
| 79 | + |
| 80 | +// public: |
| 81 | +static inline TableEvt * TableEvt_init(TableEvt * const me, |
| 82 | + uint8_t id) |
| 83 | +{ |
| 84 | + if (me != (TableEvt *)0) { |
| 85 | + me->philoId = id; |
| 86 | + } |
| 87 | + return me; |
| 88 | +} |
| 89 | + |
| 90 | +//${Shared::AO_Philo[N_PHILO]} ............................................... |
| 91 | +extern QActive * const AO_Philo[N_PHILO]; |
| 92 | + |
| 93 | +//${Shared::Philo_ctor} ...................................................... |
| 94 | +void Philo_ctor(uint_fast8_t const id); |
| 95 | + |
| 96 | +//${Shared::AO_Table} ........................................................ |
| 97 | +extern QActive * const AO_Table; |
| 98 | + |
| 99 | +//${Shared::Table_ctor} ...................................................... |
| 100 | +void Table_ctor(void); |
| 101 | +//$enddecl${Shared} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 102 | + |
| 103 | +#ifdef QXK_H_ |
| 104 | + |
| 105 | +extern QXThread * const TH_XThread1; |
| 106 | +void XThread1_ctor(void); |
| 107 | + |
| 108 | +extern QXThread * const TH_XThread2; |
| 109 | +void XThread2_ctor(void); |
| 110 | + |
| 111 | +extern QXSemaphore TH_sema; |
| 112 | +extern QXMutex TH_mutex; |
| 113 | + |
| 114 | +#endif // QXK_H_ |
| 115 | + |
| 116 | +#endif // DPP_H_ |
0 commit comments