//**************************************************************************** // Product: DPP example, QUTEST // Last Updated for Version: 5.9.5 // Date of the Last Update: 2017-07-20 // // 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 . // // Contact information: // https://state-machine.com // mailto:info@state-machine.com //**************************************************************************** #include "qpcpp.h" #include "dpp.h" #include "bsp.h" Q_DEFINE_THIS_MODULE("bsp") // namespace DPP ************************************************************* namespace DPP { static uint32_t l_rnd; // random seed // BSP functions ============================================================= void BSP::init(void) { BSP::randomSeed(1234U); Q_ALLEGE(QS_INIT((void *)0)); QS_FUN_DICTIONARY(&BSP::displayPaused); QS_FUN_DICTIONARY(&BSP::random); } //............................................................................ void BSP::displayPhilStat(uint8_t n, char const *stat) { (void)n; (void)stat; } //............................................................................ void BSP::displayPaused(uint8_t paused) { QS_TEST_PROBE_DEF(&BSP::displayPaused) QS_TEST_PROBE( Q_ASSERT_ID(100, 0); ) (void)paused; } //............................................................................ uint32_t BSP::random(void) { // a very cheap pseudo-random-number generator // Some flating point code is to exercise the VFP... float volatile x = 3.1415926F; x = x + 2.7182818F; // "Super-Duper" Linear Congruential Generator (LCG) // LCG(2^32, 3*7*11*13*23, 0, seed) // uint32_t rnd = l_rnd * (3U*7U*11U*13U*23U); l_rnd = rnd; // set for the next time return (rnd >> 8); } //............................................................................ void BSP::randomSeed(uint32_t seed) { l_rnd = seed; } //............................................................................ void BSP::terminate(int16_t result) { (void)result; } } // namespace DPP