Align code style (#40)
- Mutex -> Mutex* - Cleanup enum names - Other small changes
This commit is contained in:
parent
9327d61427
commit
e0db8767c7
@ -133,5 +133,5 @@ const SdCard tdeck_sdcard = {
|
|||||||
.mount = &sdcard_init_and_mount,
|
.mount = &sdcard_init_and_mount,
|
||||||
.unmount = &sdcard_unmount,
|
.unmount = &sdcard_unmount,
|
||||||
.is_mounted = &sdcard_is_mounted,
|
.is_mounted = &sdcard_is_mounted,
|
||||||
.mount_behaviour = SDCARD_MOUNT_BEHAVIOUR_AT_BOOT
|
.mount_behaviour = SdcardMountBehaviourAtBoot
|
||||||
};
|
};
|
||||||
|
|||||||
@ -75,5 +75,5 @@ const SdCard twodotfour_sdcard = {
|
|||||||
.mount = &sdcard_mount,
|
.mount = &sdcard_mount,
|
||||||
.unmount = &sdcard_unmount,
|
.unmount = &sdcard_unmount,
|
||||||
.is_mounted = &sdcard_is_mounted,
|
.is_mounted = &sdcard_is_mounted,
|
||||||
.mount_behaviour = SDCARD_MOUNT_BEHAVIOUR_ANYTIME
|
.mount_behaviour = SdcardMountBehaviourAnytime
|
||||||
};
|
};
|
||||||
|
|||||||
@ -6,11 +6,11 @@
|
|||||||
- Show a warning screen when a user plugs in the SD card on a device that only supports mounting at boot.
|
- Show a warning screen when a user plugs in the SD card on a device that only supports mounting at boot.
|
||||||
- Try out Waveshare S3 120MHz mode for PSRAM (see "enabling 120M PSRAM is necessary" in [docs](https://www.waveshare.com/wiki/ESP32-S3-Touch-LCD-4.3#Other_Notes))
|
- Try out Waveshare S3 120MHz mode for PSRAM (see "enabling 120M PSRAM is necessary" in [docs](https://www.waveshare.com/wiki/ESP32-S3-Touch-LCD-4.3#Other_Notes))
|
||||||
- T-Deck has random sdcard SPI crashes due to sharing bus with screen SPI: make it use the LVGL lock for sdcard operations?
|
- T-Deck has random sdcard SPI crashes due to sharing bus with screen SPI: make it use the LVGL lock for sdcard operations?
|
||||||
|
- Wi-Fi connect app should show info about connection result
|
||||||
|
|
||||||
# Core Ideas
|
# Core Ideas
|
||||||
- Make a HAL? It would mainly be there to support PC development. It's a lot of effort for supporting what's effectively a dev-only feature.
|
- Make a HAL? It would mainly be there to support PC development. It's a lot of effort for supporting what's effectively a dev-only feature.
|
||||||
- Support for displays with different DPI. Consider the layer-based system like on Android.
|
- Support for displays with different DPI. Consider the layer-based system like on Android.
|
||||||
- Display orientation support for Display app
|
|
||||||
- If present, use LED to show boot status
|
- If present, use LED to show boot status
|
||||||
- 2 wire speaker support
|
- 2 wire speaker support
|
||||||
- tt_app_start() and similar functions as proxies for Loader app start/stop/etc.
|
- tt_app_start() and similar functions as proxies for Loader app start/stop/etc.
|
||||||
@ -22,10 +22,11 @@
|
|||||||
- Light/dark mode selection in Display settings app.
|
- Light/dark mode selection in Display settings app.
|
||||||
|
|
||||||
# App Ideas
|
# App Ideas
|
||||||
- Chip 8 emulator
|
- File viewer (images, text... binary?)
|
||||||
- Discord bot
|
|
||||||
- BadUSB
|
|
||||||
- IR transceiver app
|
|
||||||
- GPIO status viewer
|
- GPIO status viewer
|
||||||
- BlueTooth keyboard app
|
- BlueTooth keyboard app
|
||||||
|
- Chip 8 emulator
|
||||||
|
- BadUSB
|
||||||
|
- Discord bot
|
||||||
|
- IR transceiver app
|
||||||
- Investigate CSI https://stevenmhernandez.github.io/ESP32-CSI-Tool/
|
- Investigate CSI https://stevenmhernandez.github.io/ESP32-CSI-Tool/
|
||||||
@ -7,9 +7,9 @@
|
|||||||
// region BundleEntry
|
// region BundleEntry
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
BUNDLE_ENTRY_TYPE_BOOL,
|
BundleEntryTypeBool,
|
||||||
BUNDLE_ENTRY_TYPE_INT32,
|
BundleEntryTypeInt32,
|
||||||
BUNDLE_ENTRY_TYPE_STRING,
|
BundleEntryTypeString,
|
||||||
} BundleEntryType;
|
} BundleEntryType;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -23,21 +23,21 @@ typedef struct {
|
|||||||
|
|
||||||
BundleEntry* bundle_entry_alloc_bool(bool value) {
|
BundleEntry* bundle_entry_alloc_bool(bool value) {
|
||||||
BundleEntry* entry = malloc(sizeof(BundleEntry));
|
BundleEntry* entry = malloc(sizeof(BundleEntry));
|
||||||
entry->type = BUNDLE_ENTRY_TYPE_BOOL;
|
entry->type = BundleEntryTypeBool;
|
||||||
entry->bool_value = value;
|
entry->bool_value = value;
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
BundleEntry* bundle_entry_alloc_int32(int32_t value) {
|
BundleEntry* bundle_entry_alloc_int32(int32_t value) {
|
||||||
BundleEntry* entry = malloc(sizeof(BundleEntry));
|
BundleEntry* entry = malloc(sizeof(BundleEntry));
|
||||||
entry->type = BUNDLE_ENTRY_TYPE_INT32;
|
entry->type = BundleEntryTypeInt32;
|
||||||
entry->int32_value = value;
|
entry->int32_value = value;
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
BundleEntry* bundle_entry_alloc_string(const char* text) {
|
BundleEntry* bundle_entry_alloc_string(const char* text) {
|
||||||
BundleEntry* entry = malloc(sizeof(BundleEntry));
|
BundleEntry* entry = malloc(sizeof(BundleEntry));
|
||||||
entry->type = BUNDLE_ENTRY_TYPE_STRING;
|
entry->type = BundleEntryTypeString;
|
||||||
entry->string_ptr = malloc(strlen(text) + 1);
|
entry->string_ptr = malloc(strlen(text) + 1);
|
||||||
strcpy(entry->string_ptr, text);
|
strcpy(entry->string_ptr, text);
|
||||||
return entry;
|
return entry;
|
||||||
@ -46,7 +46,7 @@ BundleEntry* bundle_entry_alloc_string(const char* text) {
|
|||||||
BundleEntry* bundle_entry_alloc_copy(BundleEntry* source) {
|
BundleEntry* bundle_entry_alloc_copy(BundleEntry* source) {
|
||||||
BundleEntry* entry = malloc(sizeof(BundleEntry));
|
BundleEntry* entry = malloc(sizeof(BundleEntry));
|
||||||
entry->type = source->type;
|
entry->type = source->type;
|
||||||
if (source->type == BUNDLE_ENTRY_TYPE_STRING) {
|
if (source->type == BundleEntryTypeString) {
|
||||||
entry->string_ptr = malloc(strlen(source->string_ptr) + 1);
|
entry->string_ptr = malloc(strlen(source->string_ptr) + 1);
|
||||||
strcpy(entry->string_ptr, source->string_ptr);
|
strcpy(entry->string_ptr, source->string_ptr);
|
||||||
} else {
|
} else {
|
||||||
@ -56,7 +56,7 @@ BundleEntry* bundle_entry_alloc_copy(BundleEntry* source) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void bundle_entry_free(BundleEntry* entry) {
|
void bundle_entry_free(BundleEntry* entry) {
|
||||||
if (entry->type == BUNDLE_ENTRY_TYPE_STRING) {
|
if (entry->type == BundleEntryTypeString) {
|
||||||
free(entry->string_ptr);
|
free(entry->string_ptr);
|
||||||
}
|
}
|
||||||
free(entry);
|
free(entry);
|
||||||
@ -129,19 +129,19 @@ const char* tt_bundle_get_string(Bundle bundle, const char* key) {
|
|||||||
bool tt_bundle_has_bool(Bundle bundle, const char* key) {
|
bool tt_bundle_has_bool(Bundle bundle, const char* key) {
|
||||||
BundleData* data = (BundleData*)bundle;
|
BundleData* data = (BundleData*)bundle;
|
||||||
BundleEntry** entry = BundleDict_get(data->dict, key);
|
BundleEntry** entry = BundleDict_get(data->dict, key);
|
||||||
return (entry != NULL) && ((*entry)->type == BUNDLE_ENTRY_TYPE_BOOL);
|
return (entry != NULL) && ((*entry)->type == BundleEntryTypeBool);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool tt_bundle_has_int32(Bundle bundle, const char* key) {
|
bool tt_bundle_has_int32(Bundle bundle, const char* key) {
|
||||||
BundleData* data = (BundleData*)bundle;
|
BundleData* data = (BundleData*)bundle;
|
||||||
BundleEntry** entry = BundleDict_get(data->dict, key);
|
BundleEntry** entry = BundleDict_get(data->dict, key);
|
||||||
return (entry != NULL) && ((*entry)->type == BUNDLE_ENTRY_TYPE_INT32);
|
return (entry != NULL) && ((*entry)->type == BundleEntryTypeInt32);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool tt_bundle_has_string(Bundle bundle, const char* key) {
|
bool tt_bundle_has_string(Bundle bundle, const char* key) {
|
||||||
BundleData* data = (BundleData*)bundle;
|
BundleData* data = (BundleData*)bundle;
|
||||||
BundleEntry** entry = BundleDict_get(data->dict, key);
|
BundleEntry** entry = BundleDict_get(data->dict, key);
|
||||||
return (entry != NULL) && ((*entry)->type == BUNDLE_ENTRY_TYPE_STRING);
|
return (entry != NULL) && ((*entry)->type == BundleEntryTypeString);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool tt_bundle_opt_bool(Bundle bundle, const char* key, bool* out) {
|
bool tt_bundle_opt_bool(Bundle bundle, const char* key, bool* out) {
|
||||||
@ -149,7 +149,7 @@ bool tt_bundle_opt_bool(Bundle bundle, const char* key, bool* out) {
|
|||||||
BundleEntry** entry_ptr = BundleDict_get(data->dict, key);
|
BundleEntry** entry_ptr = BundleDict_get(data->dict, key);
|
||||||
if (entry_ptr != NULL) {
|
if (entry_ptr != NULL) {
|
||||||
BundleEntry* entry = *entry_ptr;
|
BundleEntry* entry = *entry_ptr;
|
||||||
if (entry->type == BUNDLE_ENTRY_TYPE_BOOL) {
|
if (entry->type == BundleEntryTypeBool) {
|
||||||
*out = entry->bool_value;
|
*out = entry->bool_value;
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -165,7 +165,7 @@ bool tt_bundle_opt_int32(Bundle bundle, const char* key, int32_t* out) {
|
|||||||
BundleEntry** entry_ptr = BundleDict_get(data->dict, key);
|
BundleEntry** entry_ptr = BundleDict_get(data->dict, key);
|
||||||
if (entry_ptr != NULL) {
|
if (entry_ptr != NULL) {
|
||||||
BundleEntry* entry = *entry_ptr;
|
BundleEntry* entry = *entry_ptr;
|
||||||
if (entry->type == BUNDLE_ENTRY_TYPE_INT32) {
|
if (entry->type == BundleEntryTypeInt32) {
|
||||||
*out = entry->int32_value;
|
*out = entry->int32_value;
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -181,7 +181,7 @@ bool tt_bundle_opt_string(Bundle bundle, const char* key, char** out) {
|
|||||||
BundleEntry** entry_ptr = BundleDict_get(data->dict, key);
|
BundleEntry** entry_ptr = BundleDict_get(data->dict, key);
|
||||||
if (entry_ptr != NULL) {
|
if (entry_ptr != NULL) {
|
||||||
BundleEntry* entry = *entry_ptr;
|
BundleEntry* entry = *entry_ptr;
|
||||||
if (entry->type == BUNDLE_ENTRY_TYPE_STRING) {
|
if (entry->type == BundleEntryTypeString) {
|
||||||
*out = entry->string_ptr;
|
*out = entry->string_ptr;
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -197,7 +197,7 @@ void tt_bundle_put_bool(Bundle bundle, const char* key, bool value) {
|
|||||||
BundleEntry** entry_handle = BundleDict_get(data->dict, key);
|
BundleEntry** entry_handle = BundleDict_get(data->dict, key);
|
||||||
if (entry_handle != NULL) {
|
if (entry_handle != NULL) {
|
||||||
BundleEntry* entry = *entry_handle;
|
BundleEntry* entry = *entry_handle;
|
||||||
tt_assert(entry->type == BUNDLE_ENTRY_TYPE_BOOL);
|
tt_assert(entry->type == BundleEntryTypeBool);
|
||||||
entry->bool_value = value;
|
entry->bool_value = value;
|
||||||
} else {
|
} else {
|
||||||
BundleEntry* entry = bundle_entry_alloc_bool(value);
|
BundleEntry* entry = bundle_entry_alloc_bool(value);
|
||||||
@ -210,7 +210,7 @@ void tt_bundle_put_int32(Bundle bundle, const char* key, int32_t value) {
|
|||||||
BundleEntry** entry_handle = BundleDict_get(data->dict, key);
|
BundleEntry** entry_handle = BundleDict_get(data->dict, key);
|
||||||
if (entry_handle != NULL) {
|
if (entry_handle != NULL) {
|
||||||
BundleEntry* entry = *entry_handle;
|
BundleEntry* entry = *entry_handle;
|
||||||
tt_assert(entry->type == BUNDLE_ENTRY_TYPE_INT32);
|
tt_assert(entry->type == BundleEntryTypeInt32);
|
||||||
entry->int32_value = value;
|
entry->int32_value = value;
|
||||||
} else {
|
} else {
|
||||||
BundleEntry* entry = bundle_entry_alloc_int32(value);
|
BundleEntry* entry = bundle_entry_alloc_int32(value);
|
||||||
@ -223,7 +223,7 @@ void tt_bundle_put_string(Bundle bundle, const char* key, const char* value) {
|
|||||||
BundleEntry** entry_handle = BundleDict_get(data->dict, key);
|
BundleEntry** entry_handle = BundleDict_get(data->dict, key);
|
||||||
if (entry_handle != NULL) {
|
if (entry_handle != NULL) {
|
||||||
BundleEntry* entry = *entry_handle;
|
BundleEntry* entry = *entry_handle;
|
||||||
tt_assert(entry->type == BUNDLE_ENTRY_TYPE_STRING);
|
tt_assert(entry->type == BundleEntryTypeString);
|
||||||
if (entry->string_ptr != NULL) {
|
if (entry->string_ptr != NULL) {
|
||||||
free(entry->string_ptr);
|
free(entry->string_ptr);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -197,8 +197,8 @@ void tt_delay_us(uint32_t microseconds) {
|
|||||||
|
|
||||||
Platform tt_get_platform() {
|
Platform tt_get_platform() {
|
||||||
#ifdef ESP_PLATFORM
|
#ifdef ESP_PLATFORM
|
||||||
return PLATFORM_ESP;
|
return PlatformEsp;
|
||||||
#else
|
#else
|
||||||
return PLATFORM_PC;
|
return PlatformPc;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,8 +7,8 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
PLATFORM_ESP,
|
PlatformEsp,
|
||||||
PLATFORM_PC
|
PlatformPc
|
||||||
} Platform;
|
} Platform;
|
||||||
|
|
||||||
/** Check if CPU is in IRQ or kernel running and IRQ is masked
|
/** Check if CPU is in IRQ or kernel running and IRQ is masked
|
||||||
|
|||||||
@ -13,15 +13,15 @@
|
|||||||
|
|
||||||
static char tt_loglevel_to_prefix(LogLevel level) {
|
static char tt_loglevel_to_prefix(LogLevel level) {
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case LOG_LEVEL_ERROR:
|
case LogLevelError:
|
||||||
return 'E';
|
return 'E';
|
||||||
case LOG_LEVEL_WARNING:
|
case LogLevelWarning:
|
||||||
return 'W';
|
return 'W';
|
||||||
case LOG_LEVEL_INFO:
|
case LogLevelInfo:
|
||||||
return 'I';
|
return 'I';
|
||||||
case LOG_LEVEL_DEBUG:
|
case LogLevelDebug:
|
||||||
return 'D';
|
return 'D';
|
||||||
case LOG_LEVEL_TRACE:
|
case LogLevelTrace:
|
||||||
return 'T';
|
return 'T';
|
||||||
default:
|
default:
|
||||||
return '?';
|
return '?';
|
||||||
@ -30,15 +30,15 @@ static char tt_loglevel_to_prefix(LogLevel level) {
|
|||||||
|
|
||||||
static const char* tt_loglevel_to_colour(LogLevel level) {
|
static const char* tt_loglevel_to_colour(LogLevel level) {
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case LOG_LEVEL_ERROR:
|
case LogLevelError:
|
||||||
return "\033[1;31m";
|
return "\033[1;31m";
|
||||||
case LOG_LEVEL_WARNING:
|
case LogLevelWarning:
|
||||||
return "\033[33m";
|
return "\033[33m";
|
||||||
case LOG_LEVEL_INFO:
|
case LogLevelInfo:
|
||||||
return "\033[32m";
|
return "\033[32m";
|
||||||
case LOG_LEVEL_DEBUG:
|
case LogLevelDebug:
|
||||||
return "\033[1;37m";
|
return "\033[1;37m";
|
||||||
case LOG_LEVEL_TRACE:
|
case LogLevelTrace:
|
||||||
return "\033[37m";
|
return "\033[37m";
|
||||||
default:
|
default:
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@ -27,23 +27,23 @@ extern "C" {
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
LOG_LEVEL_ERROR,
|
LogLevelError,
|
||||||
LOG_LEVEL_WARNING,
|
LogLevelWarning,
|
||||||
LOG_LEVEL_INFO,
|
LogLevelInfo,
|
||||||
LOG_LEVEL_DEBUG,
|
LogLevelDebug,
|
||||||
LOG_LEVEL_TRACE
|
LogLevelTrace
|
||||||
} LogLevel;
|
} LogLevel;
|
||||||
|
|
||||||
void tt_log(LogLevel level, const char* tag, const char* format, ...);
|
void tt_log(LogLevel level, const char* tag, const char* format, ...);
|
||||||
|
|
||||||
#define TT_LOG_E(tag, format, ...) \
|
#define TT_LOG_E(tag, format, ...) \
|
||||||
tt_log(LOG_LEVEL_ERROR, tag, format, ##__VA_ARGS__)
|
tt_log(LogLevelError, tag, format, ##__VA_ARGS__)
|
||||||
#define TT_LOG_W(tag, format, ...) \
|
#define TT_LOG_W(tag, format, ...) \
|
||||||
tt_log(LOG_LEVEL_WARNING, tag, format, ##__VA_ARGS__)
|
tt_log(LogLevelWarning, tag, format, ##__VA_ARGS__)
|
||||||
#define TT_LOG_I(tag, format, ...) \
|
#define TT_LOG_I(tag, format, ...) \
|
||||||
tt_log(LOG_LEVEL_INFO, tag, format, ##__VA_ARGS__)
|
tt_log(LogLevelInfo, tag, format, ##__VA_ARGS__)
|
||||||
#define TT_LOG_D(tag, format, ...) \
|
#define TT_LOG_D(tag, format, ...) \
|
||||||
tt_log(LOG_LEVEL_DEBUG, tag, format, ##__VA_ARGS__)
|
tt_log(LogLevelDebug, tag, format, ##__VA_ARGS__)
|
||||||
#define TT_LOG_T(tag, format, ...) \
|
#define TT_LOG_T(tag, format, ...) \
|
||||||
tt_log(LOG_LEVEL_TRACE, tag, format, ##__VA_ARGS__)
|
tt_log(LOG_LEVEL_TRACE, tag, format, ##__VA_ARGS__)
|
||||||
|
|
||||||
|
|||||||
@ -33,7 +33,7 @@ void tt_mutex_info(Mutex mutex, const char* label) {
|
|||||||
#define tt_mutex_info(mutex, text)
|
#define tt_mutex_info(mutex, text)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Mutex tt_mutex_alloc(MutexType type) {
|
Mutex* tt_mutex_alloc(MutexType type) {
|
||||||
tt_assert(!TT_IS_IRQ_MODE());
|
tt_assert(!TT_IS_IRQ_MODE());
|
||||||
MutexData* data = malloc(sizeof(MutexData));
|
MutexData* data = malloc(sizeof(MutexData));
|
||||||
|
|
||||||
@ -52,10 +52,10 @@ Mutex tt_mutex_alloc(MutexType type) {
|
|||||||
|
|
||||||
tt_check(data->handle != NULL);
|
tt_check(data->handle != NULL);
|
||||||
tt_mutex_info(data, "alloc ");
|
tt_mutex_info(data, "alloc ");
|
||||||
return (Mutex)data;
|
return (Mutex*)data;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tt_mutex_free(Mutex mutex) {
|
void tt_mutex_free(Mutex* mutex) {
|
||||||
tt_assert(!TT_IS_IRQ_MODE());
|
tt_assert(!TT_IS_IRQ_MODE());
|
||||||
tt_assert(mutex);
|
tt_assert(mutex);
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ void tt_mutex_free(Mutex mutex) {
|
|||||||
free(data);
|
free(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
TtStatus tt_mutex_acquire(Mutex mutex, uint32_t timeout) {
|
TtStatus tt_mutex_acquire(Mutex* mutex, uint32_t timeout) {
|
||||||
tt_assert(mutex);
|
tt_assert(mutex);
|
||||||
tt_assert(!TT_IS_IRQ_MODE());
|
tt_assert(!TT_IS_IRQ_MODE());
|
||||||
MutexData* data = (MutexData*)mutex;
|
MutexData* data = (MutexData*)mutex;
|
||||||
@ -101,7 +101,7 @@ TtStatus tt_mutex_acquire(Mutex mutex, uint32_t timeout) {
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
TtStatus tt_mutex_release(Mutex mutex) {
|
TtStatus tt_mutex_release(Mutex* mutex) {
|
||||||
tt_assert(mutex);
|
tt_assert(mutex);
|
||||||
assert(!TT_IS_IRQ_MODE());
|
assert(!TT_IS_IRQ_MODE());
|
||||||
MutexData* data = (MutexData*)mutex;
|
MutexData* data = (MutexData*)mutex;
|
||||||
@ -129,7 +129,7 @@ TtStatus tt_mutex_release(Mutex mutex) {
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
ThreadId tt_mutex_get_owner(Mutex mutex) {
|
ThreadId tt_mutex_get_owner(Mutex* mutex) {
|
||||||
tt_assert(mutex != NULL);
|
tt_assert(mutex != NULL);
|
||||||
tt_assert(!TT_IS_IRQ_MODE());
|
tt_assert(!TT_IS_IRQ_MODE());
|
||||||
MutexData* data = (MutexData*)mutex;
|
MutexData* data = (MutexData*)mutex;
|
||||||
|
|||||||
@ -16,7 +16,7 @@ typedef enum {
|
|||||||
MutexTypeRecursive,
|
MutexTypeRecursive,
|
||||||
} MutexType;
|
} MutexType;
|
||||||
|
|
||||||
typedef void* Mutex;
|
typedef void Mutex;
|
||||||
|
|
||||||
/** Allocate Mutex
|
/** Allocate Mutex
|
||||||
*
|
*
|
||||||
@ -24,13 +24,13 @@ typedef void* Mutex;
|
|||||||
*
|
*
|
||||||
* @return pointer to Mutex instance
|
* @return pointer to Mutex instance
|
||||||
*/
|
*/
|
||||||
Mutex tt_mutex_alloc(MutexType type);
|
Mutex* tt_mutex_alloc(MutexType type);
|
||||||
|
|
||||||
/** Free Mutex
|
/** Free Mutex
|
||||||
*
|
*
|
||||||
* @param mutex The Mutex instance
|
* @param mutex The Mutex instance
|
||||||
*/
|
*/
|
||||||
void tt_mutex_free(Mutex mutex);
|
void tt_mutex_free(Mutex* mutex);
|
||||||
|
|
||||||
/** Acquire mutex
|
/** Acquire mutex
|
||||||
*
|
*
|
||||||
@ -39,7 +39,7 @@ void tt_mutex_free(Mutex mutex);
|
|||||||
*
|
*
|
||||||
* @return The status.
|
* @return The status.
|
||||||
*/
|
*/
|
||||||
TtStatus tt_mutex_acquire(Mutex mutex, uint32_t timeout);
|
TtStatus tt_mutex_acquire(Mutex* mutex, uint32_t timeout);
|
||||||
|
|
||||||
/** Release mutex
|
/** Release mutex
|
||||||
*
|
*
|
||||||
@ -47,7 +47,7 @@ TtStatus tt_mutex_acquire(Mutex mutex, uint32_t timeout);
|
|||||||
*
|
*
|
||||||
* @return The status.
|
* @return The status.
|
||||||
*/
|
*/
|
||||||
TtStatus tt_mutex_release(Mutex mutex);
|
TtStatus tt_mutex_release(Mutex* mutex);
|
||||||
|
|
||||||
/** Get mutex owner thread id
|
/** Get mutex owner thread id
|
||||||
*
|
*
|
||||||
@ -55,7 +55,7 @@ TtStatus tt_mutex_release(Mutex mutex);
|
|||||||
*
|
*
|
||||||
* @return The thread identifier.
|
* @return The thread identifier.
|
||||||
*/
|
*/
|
||||||
ThreadId tt_mutex_get_owner(Mutex mutex);
|
ThreadId tt_mutex_get_owner(Mutex* mutex);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,7 @@ LIST_DEF(PubSubSubscriptionList, PubSubSubscription, M_POD_OPLIST);
|
|||||||
|
|
||||||
struct PubSub {
|
struct PubSub {
|
||||||
PubSubSubscriptionList_t items;
|
PubSubSubscriptionList_t items;
|
||||||
Mutex mutex;
|
Mutex* mutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
PubSub* tt_pubsub_alloc() {
|
PubSub* tt_pubsub_alloc() {
|
||||||
|
|||||||
@ -12,7 +12,7 @@ extern "C" {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PubSubSubscription* wifi_subscription;
|
PubSubSubscription* wifi_subscription;
|
||||||
Mutex mutex;
|
Mutex* mutex;
|
||||||
WifiConnectState state;
|
WifiConnectState state;
|
||||||
WifiConnectView view;
|
WifiConnectView view;
|
||||||
bool view_enabled;
|
bool view_enabled;
|
||||||
|
|||||||
@ -10,7 +10,7 @@ extern "C" {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PubSubSubscription* wifi_subscription;
|
PubSubSubscription* wifi_subscription;
|
||||||
Mutex mutex;
|
Mutex* mutex;
|
||||||
WifiManageState state;
|
WifiManageState state;
|
||||||
WifiManageView view;
|
WifiManageView view;
|
||||||
bool view_enabled;
|
bool view_enabled;
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/** @brief Locking mechanism for modifying the Wifi instance */
|
/** @brief Locking mechanism for modifying the Wifi instance */
|
||||||
Mutex mutex;
|
Mutex* mutex;
|
||||||
/** @brief The public event bus */
|
/** @brief The public event bus */
|
||||||
PubSub* pubsub;
|
PubSub* pubsub;
|
||||||
/** @brief The internal message queue */
|
/** @brief The internal message queue */
|
||||||
|
|||||||
@ -15,7 +15,7 @@ static void hash_reset_all();
|
|||||||
|
|
||||||
// region Hash
|
// region Hash
|
||||||
|
|
||||||
static Mutex hash_mutex = NULL;
|
static Mutex* hash_mutex = NULL;
|
||||||
static int8_t hash_index = -1;
|
static int8_t hash_index = -1;
|
||||||
static uint32_t hashes[TT_WIFI_CREDENTIALS_LIMIT] = { 0 };
|
static uint32_t hashes[TT_WIFI_CREDENTIALS_LIMIT] = { 0 };
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@ App tt_app_alloc(const AppManifest* manifest, Bundle* _Nullable parameters) {
|
|||||||
AppData* data = malloc(sizeof(AppData));
|
AppData* data = malloc(sizeof(AppData));
|
||||||
*data = (AppData) {
|
*data = (AppData) {
|
||||||
.mutex = tt_mutex_alloc(MutexTypeNormal),
|
.mutex = tt_mutex_alloc(MutexTypeNormal),
|
||||||
.state = APP_STATE_INITIAL,
|
.state = AppStateInitial,
|
||||||
.flags = tt_app_get_flags_default(manifest->type),
|
.flags = tt_app_get_flags_default(manifest->type),
|
||||||
.manifest = manifest,
|
.manifest = manifest,
|
||||||
.parameters = parameters,
|
.parameters = parameters,
|
||||||
|
|||||||
@ -8,11 +8,11 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
APP_STATE_INITIAL, // App is being activated in loader
|
AppStateInitial, // App is being activated in loader
|
||||||
APP_STATE_STARTED, // App is in memory
|
AppStateStarted, // App is in memory
|
||||||
APP_STATE_SHOWING, // App view is created
|
AppStateShowing, // App view is created
|
||||||
APP_STATE_HIDING, // App view is destroyed
|
AppStateHiding, // App view is destroyed
|
||||||
APP_STATE_STOPPED // App is not in memory
|
AppStateStopped // App is not in memory
|
||||||
} AppState;
|
} AppState;
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
|
|||||||
@ -11,7 +11,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Mutex mutex;
|
Mutex* mutex;
|
||||||
const AppManifest* manifest;
|
const AppManifest* manifest;
|
||||||
AppState state;
|
AppState state;
|
||||||
/** @brief Memory marker at start of app, to detect memory leaks */
|
/** @brief Memory marker at start of app, to detect memory leaks */
|
||||||
|
|||||||
@ -21,7 +21,7 @@ DICT_DEF2(AppManifestDict, const char*, M_CSTR_DUP_OPLIST, const AppManifest*, M
|
|||||||
}
|
}
|
||||||
|
|
||||||
AppManifestDict_t app_manifest_dict;
|
AppManifestDict_t app_manifest_dict;
|
||||||
Mutex hash_mutex = NULL;
|
Mutex* hash_mutex = NULL;
|
||||||
|
|
||||||
void tt_app_manifest_registry_init() {
|
void tt_app_manifest_registry_init() {
|
||||||
tt_assert(hash_mutex == NULL);
|
tt_assert(hash_mutex == NULL);
|
||||||
|
|||||||
@ -66,7 +66,7 @@ bool files_data_set_entries_for_path(FilesData* data, const char* path) {
|
|||||||
* ESP32 does not have a root directory, so we have to create it manually.
|
* ESP32 does not have a root directory, so we have to create it manually.
|
||||||
* We'll add the NVS Flash partitions and the binding for the sdcard.
|
* We'll add the NVS Flash partitions and the binding for the sdcard.
|
||||||
*/
|
*/
|
||||||
if (tt_get_platform() == PLATFORM_ESP && strcmp(path, "/") == 0) {
|
if (tt_get_platform() == PlatformEsp && strcmp(path, "/") == 0) {
|
||||||
int dir_entries_count = 3;
|
int dir_entries_count = 3;
|
||||||
struct dirent** dir_entries = malloc(sizeof(struct dirent*) * 3);
|
struct dirent** dir_entries = malloc(sizeof(struct dirent*) * 3);
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#define TAG "sdcard"
|
#define TAG "sdcard"
|
||||||
|
|
||||||
static Mutex mutex = NULL;
|
static Mutex* mutex = NULL;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const SdCard* sdcard;
|
const SdCard* sdcard;
|
||||||
@ -59,16 +59,11 @@ bool tt_sdcard_mount(const SdCard* sdcard) {
|
|||||||
|
|
||||||
SdcardState tt_sdcard_get_state() {
|
SdcardState tt_sdcard_get_state() {
|
||||||
if (data.context == NULL) {
|
if (data.context == NULL) {
|
||||||
return SDCARD_STATE_UNMOUNTED;
|
return SdcardStateUnmounted;
|
||||||
|
} else if (data.sdcard->is_mounted(data.context)) {
|
||||||
|
return SdcardStateMounted;
|
||||||
} else {
|
} else {
|
||||||
// TODO: Side-effects are not great - consider refactoring this, so:
|
return SdcardStateError;
|
||||||
// Consider making tt_sdcard_get_status() that can return an error state
|
|
||||||
// The sdcard service can then auto-dismount
|
|
||||||
if (data.sdcard->is_mounted(data.context)) {
|
|
||||||
return SDCARD_STATE_MOUNTED;
|
|
||||||
} else {
|
|
||||||
return SDCARD_STATE_ERROR;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -13,14 +13,14 @@ typedef void (*SdcardUnmount)(void* context);
|
|||||||
typedef bool (*SdcardIsMounted)(void* context);
|
typedef bool (*SdcardIsMounted)(void* context);
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SDCARD_STATE_MOUNTED,
|
SdcardStateMounted,
|
||||||
SDCARD_STATE_UNMOUNTED,
|
SdcardStateUnmounted,
|
||||||
SDCARD_STATE_ERROR,
|
SdcardStateError,
|
||||||
} SdcardState;
|
} SdcardState;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SDCARD_MOUNT_BEHAVIOUR_AT_BOOT, /** Only mount at boot */
|
SdcardMountBehaviourAtBoot, /** Only mount at boot */
|
||||||
SDCARD_MOUNT_BEHAVIOUR_ANYTIME /** Mount/dismount any time */
|
SdcardMountBehaviourAnytime /** Mount/dismount any time */
|
||||||
} SdcardMountBehaviour;
|
} SdcardMountBehaviour;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
#include "service_manifest.h"
|
#include "service_manifest.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Mutex mutex;
|
Mutex* mutex;
|
||||||
const ServiceManifest* manifest;
|
const ServiceManifest* manifest;
|
||||||
void* data;
|
void* data;
|
||||||
} ServiceData;
|
} ServiceData;
|
||||||
|
|||||||
@ -25,8 +25,8 @@ DICT_DEF2(ServiceInstanceDict, const char*, M_CSTR_DUP_OPLIST, const ServiceData
|
|||||||
|
|
||||||
static ServiceManifestDict_t service_manifest_dict;
|
static ServiceManifestDict_t service_manifest_dict;
|
||||||
static ServiceInstanceDict_t service_instance_dict;
|
static ServiceInstanceDict_t service_instance_dict;
|
||||||
static Mutex manifest_mutex = NULL;
|
static Mutex* manifest_mutex = NULL;
|
||||||
static Mutex instance_mutex = NULL;
|
static Mutex* instance_mutex = NULL;
|
||||||
|
|
||||||
void tt_service_registry_init() {
|
void tt_service_registry_init() {
|
||||||
tt_assert(manifest_mutex == NULL);
|
tt_assert(manifest_mutex == NULL);
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
struct Gui {
|
struct Gui {
|
||||||
// Thread and lock
|
// Thread and lock
|
||||||
Thread* thread;
|
Thread* thread;
|
||||||
Mutex mutex;
|
Mutex* mutex;
|
||||||
|
|
||||||
// Layers and Canvas
|
// Layers and Canvas
|
||||||
lv_obj_t* lvgl_parent;
|
lv_obj_t* lvgl_parent;
|
||||||
|
|||||||
@ -109,15 +109,15 @@ PubSub* loader_get_pubsub() {
|
|||||||
|
|
||||||
static const char* app_state_to_string(AppState state) {
|
static const char* app_state_to_string(AppState state) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case APP_STATE_INITIAL:
|
case AppStateInitial:
|
||||||
return "initial";
|
return "initial";
|
||||||
case APP_STATE_STARTED:
|
case AppStateStarted:
|
||||||
return "started";
|
return "started";
|
||||||
case APP_STATE_SHOWING:
|
case AppStateShowing:
|
||||||
return "showing";
|
return "showing";
|
||||||
case APP_STATE_HIDING:
|
case AppStateHiding:
|
||||||
return "hiding";
|
return "hiding";
|
||||||
case APP_STATE_STOPPED:
|
case AppStateStopped:
|
||||||
return "stopped";
|
return "stopped";
|
||||||
default:
|
default:
|
||||||
return "?";
|
return "?";
|
||||||
@ -137,33 +137,33 @@ static void app_transition_to_state(App app, AppState state) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case APP_STATE_INITIAL:
|
case AppStateInitial:
|
||||||
tt_app_set_state(app, APP_STATE_INITIAL);
|
tt_app_set_state(app, AppStateInitial);
|
||||||
break;
|
break;
|
||||||
case APP_STATE_STARTED:
|
case AppStateStarted:
|
||||||
if (manifest->on_start != NULL) {
|
if (manifest->on_start != NULL) {
|
||||||
manifest->on_start(app);
|
manifest->on_start(app);
|
||||||
}
|
}
|
||||||
tt_app_set_state(app, APP_STATE_STARTED);
|
tt_app_set_state(app, AppStateStarted);
|
||||||
break;
|
break;
|
||||||
case APP_STATE_SHOWING:
|
case AppStateShowing:
|
||||||
gui_show_app(
|
gui_show_app(
|
||||||
app,
|
app,
|
||||||
manifest->on_show,
|
manifest->on_show,
|
||||||
manifest->on_hide
|
manifest->on_hide
|
||||||
);
|
);
|
||||||
tt_app_set_state(app, APP_STATE_SHOWING);
|
tt_app_set_state(app, AppStateShowing);
|
||||||
break;
|
break;
|
||||||
case APP_STATE_HIDING:
|
case AppStateHiding:
|
||||||
gui_hide_app();
|
gui_hide_app();
|
||||||
tt_app_set_state(app, APP_STATE_HIDING);
|
tt_app_set_state(app, AppStateHiding);
|
||||||
break;
|
break;
|
||||||
case APP_STATE_STOPPED:
|
case AppStateStopped:
|
||||||
if (manifest->on_stop) {
|
if (manifest->on_stop) {
|
||||||
manifest->on_stop(app);
|
manifest->on_stop(app);
|
||||||
}
|
}
|
||||||
tt_app_set_data(app, NULL);
|
tt_app_set_data(app, NULL);
|
||||||
tt_app_set_state(app, APP_STATE_STOPPED);
|
tt_app_set_state(app, AppStateStopped);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -187,16 +187,16 @@ LoaderStatus loader_do_start_app_with_manifest(
|
|||||||
App app = tt_app_alloc(manifest, bundle);
|
App app = tt_app_alloc(manifest, bundle);
|
||||||
tt_assert(loader_singleton->app_stack[loader_singleton->app_stack_index] == NULL);
|
tt_assert(loader_singleton->app_stack[loader_singleton->app_stack_index] == NULL);
|
||||||
loader_singleton->app_stack[loader_singleton->app_stack_index] = app;
|
loader_singleton->app_stack[loader_singleton->app_stack_index] = app;
|
||||||
app_transition_to_state(app, APP_STATE_INITIAL);
|
app_transition_to_state(app, AppStateInitial);
|
||||||
app_transition_to_state(app, APP_STATE_STARTED);
|
app_transition_to_state(app, AppStateStarted);
|
||||||
|
|
||||||
// We might have to hide the previous app first
|
// We might have to hide the previous app first
|
||||||
if (previous_index != -1) {
|
if (previous_index != -1) {
|
||||||
App previous_app = loader_singleton->app_stack[previous_index];
|
App previous_app = loader_singleton->app_stack[previous_index];
|
||||||
app_transition_to_state(previous_app, APP_STATE_HIDING);
|
app_transition_to_state(previous_app, AppStateHiding);
|
||||||
}
|
}
|
||||||
|
|
||||||
app_transition_to_state(app, APP_STATE_SHOWING);
|
app_transition_to_state(app, AppStateShowing);
|
||||||
|
|
||||||
loader_unlock();
|
loader_unlock();
|
||||||
|
|
||||||
@ -240,8 +240,8 @@ static void loader_do_stop_app() {
|
|||||||
|
|
||||||
// Stop current app
|
// Stop current app
|
||||||
App app_to_stop = loader_singleton->app_stack[current_app_index];
|
App app_to_stop = loader_singleton->app_stack[current_app_index];
|
||||||
app_transition_to_state(app_to_stop, APP_STATE_HIDING);
|
app_transition_to_state(app_to_stop, AppStateHiding);
|
||||||
app_transition_to_state(app_to_stop, APP_STATE_STOPPED);
|
app_transition_to_state(app_to_stop, AppStateStopped);
|
||||||
|
|
||||||
tt_app_free(app_to_stop);
|
tt_app_free(app_to_stop);
|
||||||
loader_singleton->app_stack[current_app_index] = NULL;
|
loader_singleton->app_stack[current_app_index] = NULL;
|
||||||
@ -254,7 +254,7 @@ static void loader_do_stop_app() {
|
|||||||
// Resume previous app
|
// Resume previous app
|
||||||
tt_assert(loader_singleton->app_stack[loader_singleton->app_stack_index] != NULL);
|
tt_assert(loader_singleton->app_stack[loader_singleton->app_stack_index] != NULL);
|
||||||
App app_to_resume = loader_singleton->app_stack[loader_singleton->app_stack_index];
|
App app_to_resume = loader_singleton->app_stack[loader_singleton->app_stack_index];
|
||||||
app_transition_to_state(app_to_resume, APP_STATE_SHOWING);
|
app_transition_to_state(app_to_resume, AppStateShowing);
|
||||||
|
|
||||||
loader_unlock();
|
loader_unlock();
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@ struct Loader {
|
|||||||
Thread* thread;
|
Thread* thread;
|
||||||
PubSub* pubsub;
|
PubSub* pubsub;
|
||||||
MessageQueue* queue;
|
MessageQueue* queue;
|
||||||
Mutex mutex;
|
Mutex* mutex;
|
||||||
int8_t app_stack_index;
|
int8_t app_stack_index;
|
||||||
App app_stack[APP_STACK_SIZE];
|
App app_stack[APP_STACK_SIZE];
|
||||||
};
|
};
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
static int32_t sdcard_task(TT_UNUSED void* context);
|
static int32_t sdcard_task(TT_UNUSED void* context);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Mutex mutex;
|
Mutex* mutex;
|
||||||
Thread* thread;
|
Thread* thread;
|
||||||
SdcardState last_state;
|
SdcardState last_state;
|
||||||
int8_t statusbar_icon_id;
|
int8_t statusbar_icon_id;
|
||||||
@ -65,14 +65,14 @@ static int32_t sdcard_task(void* context) {
|
|||||||
|
|
||||||
SdcardState new_state = tt_sdcard_get_state();
|
SdcardState new_state = tt_sdcard_get_state();
|
||||||
|
|
||||||
if (new_state == SDCARD_STATE_ERROR) {
|
if (new_state == SdcardStateError) {
|
||||||
TT_LOG_W(TAG, "Sdcard error - unmounting. Did you eject the card in an unsafe manner?");
|
TT_LOG_W(TAG, "Sdcard error - unmounting. Did you eject the card in an unsafe manner?");
|
||||||
tt_sdcard_unmount();
|
tt_sdcard_unmount();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new_state != data->last_state) {
|
if (new_state != data->last_state) {
|
||||||
TT_LOG_I(TAG, "State change %d -> %d", data->last_state, new_state);
|
TT_LOG_I(TAG, "State change %d -> %d", data->last_state, new_state);
|
||||||
if (new_state == SDCARD_STATE_MOUNTED) {
|
if (new_state == SdcardStateMounted) {
|
||||||
tt_statusbar_icon_set_image(data->statusbar_icon_id, TT_ASSETS_ICON_SDCARD);
|
tt_statusbar_icon_set_image(data->statusbar_icon_id, TT_ASSETS_ICON_SDCARD);
|
||||||
} else {
|
} else {
|
||||||
tt_statusbar_icon_set_image(data->statusbar_icon_id, TT_ASSETS_ICON_SDCARD_ALERT);
|
tt_statusbar_icon_set_image(data->statusbar_icon_id, TT_ASSETS_ICON_SDCARD_ALERT);
|
||||||
|
|||||||
@ -18,7 +18,7 @@ typedef struct {
|
|||||||
} StatusbarIcon;
|
} StatusbarIcon;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Mutex mutex;
|
Mutex* mutex;
|
||||||
PubSub* pubsub;
|
PubSub* pubsub;
|
||||||
StatusbarIcon icons[STATUSBAR_ICON_LIMIT];
|
StatusbarIcon icons[STATUSBAR_ICON_LIMIT];
|
||||||
} StatusbarData;
|
} StatusbarData;
|
||||||
|
|||||||
@ -3,13 +3,13 @@
|
|||||||
#include "mutex.h"
|
#include "mutex.h"
|
||||||
|
|
||||||
static int thread_with_mutex_parameter(void* parameter) {
|
static int thread_with_mutex_parameter(void* parameter) {
|
||||||
Mutex mutex = (Mutex)parameter;
|
Mutex* mutex = (Mutex*)parameter;
|
||||||
tt_mutex_acquire(mutex, TtWaitForever);
|
tt_mutex_acquire(mutex, TtWaitForever);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("a mutex can block a thread") {
|
TEST_CASE("a mutex can block a thread") {
|
||||||
Mutex mutex = tt_mutex_alloc(MutexTypeNormal);
|
Mutex* mutex = tt_mutex_alloc(MutexTypeNormal);
|
||||||
tt_mutex_acquire(mutex, TtWaitForever);
|
tt_mutex_acquire(mutex, TtWaitForever);
|
||||||
|
|
||||||
Thread* thread = tt_thread_alloc_ex(
|
Thread* thread = tt_thread_alloc_ex(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user