Project restructuring (fixes macOS builds) (#198)
- Create `Include/` folder for all main projects - Fix some issues here and there (found while moving things) - All includes are now in `Tactility/` subfolder and must be included with that prefix. This fixes issues with clashing POSIX headers (e.g. `<semaphore.h>` versus Tactility's `Semaphore.h`)
This commit is contained in:
committed by
GitHub
parent
7856827ecf
commit
c87200a80d
@@ -1,6 +1,6 @@
|
||||
#include "kernel/Kernel.h"
|
||||
#include "CoreDefines.h"
|
||||
#include "RtosCompatTask.h"
|
||||
#include "Tactility/kernel/Kernel.h"
|
||||
#include "Tactility/CoreDefines.h"
|
||||
#include "Tactility/RtosCompatTask.h"
|
||||
|
||||
#ifdef ESP_PLATFORM
|
||||
#include "rom/ets_sys.h"
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef ESP_PLATFORM
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#else
|
||||
#include "FreeRTOS.h"
|
||||
#endif
|
||||
|
||||
namespace tt::kernel {
|
||||
|
||||
/** Recognized platform types */
|
||||
typedef enum {
|
||||
PlatformEsp,
|
||||
PlatformSimulator
|
||||
} Platform;
|
||||
|
||||
/** Check if kernel is running
|
||||
* @return true if the FreeRTOS kernel is running, false otherwise
|
||||
*/
|
||||
bool isRunning();
|
||||
|
||||
/** Lock kernel, pause process scheduling
|
||||
* @warning don't call from ISR context
|
||||
* @return true on success
|
||||
*/
|
||||
bool lock();
|
||||
|
||||
/** Unlock kernel, resume process scheduling
|
||||
* @warning don't call from ISR context
|
||||
* @return true on success
|
||||
*/
|
||||
bool unlock();
|
||||
|
||||
/** Restore kernel lock state
|
||||
* @warning don't call from ISR context
|
||||
* @param[in] lock The lock state
|
||||
* @return true on success
|
||||
*/
|
||||
bool restoreLock(bool lock);
|
||||
|
||||
/** Get kernel systick frequency
|
||||
* @return systick counts per second
|
||||
*/
|
||||
uint32_t getTickFrequency();
|
||||
|
||||
TickType_t getTicks();
|
||||
|
||||
/** Delay execution
|
||||
* @warning don't call from ISR context
|
||||
* Also keep in mind delay is aliased to scheduler timer intervals.
|
||||
* @param[in] ticks The ticks count to pause
|
||||
*/
|
||||
void delayTicks(TickType_t ticks);
|
||||
|
||||
/** Delay until tick
|
||||
* @warning don't call from ISR context
|
||||
* @param[in] ticks The tick until which kerel should delay task execution
|
||||
* @return true on success
|
||||
*/
|
||||
bool delayUntilTick(TickType_t tick);
|
||||
|
||||
/** Convert milliseconds to ticks
|
||||
*
|
||||
* @param[in] milliSeconds time in milliseconds
|
||||
* @return time in ticks
|
||||
*/
|
||||
TickType_t millisToTicks(uint32_t milliSeconds);
|
||||
|
||||
/** Delay in milliseconds
|
||||
* This method uses kernel ticks on the inside, which causes delay to be aliased to scheduler timer intervals.
|
||||
* Real wait time will be between X+ milliseconds.
|
||||
* Special value: 0, will cause task yield.
|
||||
* Also if used when kernel is not running will fall back to delayMicros()
|
||||
* @warning don't call from ISR context
|
||||
* @param[in] milliSeconds milliseconds to wait
|
||||
*/
|
||||
void delayMillis(uint32_t milliSeconds);
|
||||
|
||||
/** Delay in microseconds
|
||||
* Implemented using Cortex DWT counter. Blocking and non aliased.
|
||||
* @param[in] microSeconds microseconds to wait
|
||||
*/
|
||||
void delayMicros(uint32_t microSeconds);
|
||||
|
||||
/** @return the platform that Tactility currently is running on. */
|
||||
Platform getPlatform();
|
||||
|
||||
} // namespace
|
||||
@@ -1,6 +1,6 @@
|
||||
#ifdef ESP_PLATFORM
|
||||
|
||||
#include "PanicHandler.h"
|
||||
#include "Tactility/kernel/PanicHandler.h"
|
||||
|
||||
#include <esp_debug_helpers.h>
|
||||
#include <esp_attr.h>
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
#ifdef ESP_PLATFORM
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#define CRASH_DATA_CALLSTACK_LIMIT 64
|
||||
#define CRASH_DATA_INCLUDES_SP false
|
||||
|
||||
/** Represents a single frame on the callstack. */
|
||||
struct CallstackFrame {
|
||||
uint32_t pc = 0;
|
||||
#if CRASH_DATA_INCLUDES_SP
|
||||
uint32_t sp = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
/** Callstack-related crash data. */
|
||||
struct CrashData {
|
||||
bool callstackCorrupted = false;
|
||||
uint8_t callstackLength = 0;
|
||||
CallstackFrame callstack[CRASH_DATA_CALLSTACK_LIMIT];
|
||||
};
|
||||
|
||||
/** @return the crash data */
|
||||
const CrashData& getRtcCrashData();
|
||||
|
||||
#endif
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "Critical.h"
|
||||
#include "CoreDefines.h"
|
||||
#include "RtosCompatTask.h"
|
||||
#include "Tactility/kernel/critical/Critical.h"
|
||||
|
||||
#include "Tactility/CoreDefines.h"
|
||||
#include "Tactility/RtosCompatTask.h"
|
||||
|
||||
#ifdef ESP_PLATFORM
|
||||
static portMUX_TYPE critical_mutex;
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace tt::kernel::critical {
|
||||
|
||||
struct CriticalInfo {
|
||||
uint32_t isrm;
|
||||
bool fromIsr;
|
||||
bool kernelRunning;
|
||||
};
|
||||
|
||||
/** Enter a critical section
|
||||
* @return info on the status
|
||||
*/
|
||||
CriticalInfo enter();
|
||||
|
||||
/**
|
||||
* Exit a critical section
|
||||
* @param[in] info the info from when the critical section was started
|
||||
*/
|
||||
void exit(CriticalInfo info);
|
||||
|
||||
} // namespace
|
||||
Reference in New Issue
Block a user