diff --git a/interfaces-impl/arch_registers_impl.h b/interfaces-impl/arch_registers_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..f0e2225cfad3a0940fd427ea1e5c92200330b312 --- /dev/null +++ b/interfaces-impl/arch_registers_impl.h @@ -0,0 +1,29 @@ +/* Copyright (c) 2024 Skyward Experimental Rocketry + * Author: Niccolò Betto + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#pragma once + +#ifndef COMPILE_FOR_HOST +#error "Unsupported" +#endif + +#define RCC_SYNC() diff --git a/interfaces-impl/bsp_impl.h b/interfaces-impl/bsp_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..4badd43dafe428492b43f02a65a41bb48a5d79c5 --- /dev/null +++ b/interfaces-impl/bsp_impl.h @@ -0,0 +1,51 @@ +/* Copyright (c) 2024 Skyward Experimental Rocketry + * Author: Niccolò Betto + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#pragma once + +#ifndef COMPILE_FOR_HOST +#error "Unsupported" +#endif + +namespace miosix +{ + +inline void configureSdram() {} + +inline void led1On() {} +inline void led1Off() {} + +inline void led2On() {} +inline void led2Off() {} + +inline void led3On() {} +inline void led3Off() {} + +inline void led4On() {} +inline void led4Off() {} + +inline void ledOn() {} +inline void ledOff() {} + +inline bool sdCardSense() { return true; } + +} // namespace miosix \ No newline at end of file diff --git a/interfaces-impl/gpio_impl.h b/interfaces-impl/gpio_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..1aca3c27d29f36a107e18a353ac4a296e1097c55 --- /dev/null +++ b/interfaces-impl/gpio_impl.h @@ -0,0 +1,43 @@ +/* Copyright (c) 2024 Skyward Experimental Rocketry + * Author: Niccolò Betto + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#pragma once + +#ifndef COMPILE_FOR_HOST +#error "Unsupported" +#endif + +namespace miosix +{ + +class GpioPin +{ +public: + GpioPin(unsigned int p, unsigned char n) {} +}; + +template <unsigned int P, unsigned char N> +class Gpio +{ +}; + +} // namespace miosix diff --git a/interfaces-impl/portability_impl.h b/interfaces-impl/portability_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..0340ac7cef6ee0598c4f6077031c3f2d185335eb --- /dev/null +++ b/interfaces-impl/portability_impl.h @@ -0,0 +1,44 @@ +/* Copyright (c) 2024 Skyward Experimental Rocketry + * Author: Niccolò Betto + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#pragma once + +#include <thread> + +#ifndef COMPILE_FOR_HOST +#error "Unsupported" +#endif + +#define saveContext() +#define restoreContext() + +namespace miosix_private +{ + +inline void doYield() { std::this_thread::yield(); } + +inline void doDisableInterrupts() {} +inline void doEnableInterrupts() {} + +inline bool checkAreInterruptsEnabled() { return true; } + +} // namespace miosix_private \ No newline at end of file diff --git a/kernel/kernel.h b/kernel/kernel.h index af4f1d36df96a9b07508e8173772b7abb4d4937e..1ae02d2a97c8f1edaf8e2db2f6dee05af518bf23 100644 --- a/kernel/kernel.h +++ b/kernel/kernel.h @@ -33,8 +33,12 @@ #include <functional> #include <new> -#include "interfaces/portability.h" -#include "kernel/scheduler/sched_types.h" +#include "scheduler/sched_types.h" + +namespace miosix_private +{ +class FaultData; +} namespace miosix { @@ -173,7 +177,7 @@ public: static bool IRQreportFault(const miosix_private::FaultData &fault); }; -class LowerPriority : public std::binary_function<Thread *, Thread *, bool> +class LowerPriority { public: bool operator()(Thread *a, Thread *b);