mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-02-18 19:03:16 +00:00
Fixes
This commit is contained in:
parent
9d96053d22
commit
c1ac194218
@ -24,7 +24,7 @@ Driver tlora_pager_driver = {
|
|||||||
.api = nullptr,
|
.api = nullptr,
|
||||||
.device_type = nullptr,
|
.device_type = nullptr,
|
||||||
.owner = &device_module,
|
.owner = &device_module,
|
||||||
.driver_private = nullptr
|
.internal = nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,9 +44,9 @@ static DriverLedger& get_ledger() {
|
|||||||
|
|
||||||
#define ledger get_ledger()
|
#define ledger get_ledger()
|
||||||
|
|
||||||
#define get_driver_private(driver) static_cast<DriverInternal*>(driver->internal)
|
#define get_driver_internal(driver) static_cast<DriverInternal*>(driver->internal)
|
||||||
#define driver_lock(driver) mutex_lock(&get_driver_private(driver)->mutex);
|
#define driver_lock(driver) mutex_lock(&get_driver_internal(driver)->mutex);
|
||||||
#define driver_unlock(driver) mutex_unlock(&get_driver_private(driver)->mutex);
|
#define driver_unlock(driver) mutex_unlock(&get_driver_internal(driver)->mutex);
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
@ -65,14 +65,14 @@ error_t driver_destruct(Driver* driver) {
|
|||||||
driver_unlock(driver);
|
driver_unlock(driver);
|
||||||
return ERROR_NOT_ALLOWED;
|
return ERROR_NOT_ALLOWED;
|
||||||
}
|
}
|
||||||
if (get_driver_private(driver)->use_count != 0 || get_driver_private(driver)->destroying) {
|
if (get_driver_internal(driver)->use_count != 0 || get_driver_internal(driver)->destroying) {
|
||||||
driver_unlock(driver);
|
driver_unlock(driver);
|
||||||
return ERROR_INVALID_STATE;
|
return ERROR_INVALID_STATE;
|
||||||
}
|
}
|
||||||
get_driver_private(driver)->destroying = true;
|
get_driver_internal(driver)->destroying = true;
|
||||||
|
|
||||||
driver_unlock(driver);
|
driver_unlock(driver);
|
||||||
delete get_driver_private(driver);
|
delete get_driver_internal(driver);
|
||||||
driver->internal = nullptr;
|
driver->internal = nullptr;
|
||||||
|
|
||||||
return ERROR_NONE;
|
return ERROR_NONE;
|
||||||
@ -146,7 +146,7 @@ error_t driver_bind(Driver* driver, Device* device) {
|
|||||||
driver_lock(driver);
|
driver_lock(driver);
|
||||||
|
|
||||||
error_t error = ERROR_NONE;
|
error_t error = ERROR_NONE;
|
||||||
if (get_driver_private(driver)->destroying || !device_is_added(device)) {
|
if (get_driver_internal(driver)->destroying || !device_is_added(device)) {
|
||||||
error = ERROR_INVALID_STATE;
|
error = ERROR_INVALID_STATE;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -158,7 +158,7 @@ error_t driver_bind(Driver* driver, Device* device) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get_driver_private(driver)->use_count++;
|
get_driver_internal(driver)->use_count++;
|
||||||
driver_unlock(driver);
|
driver_unlock(driver);
|
||||||
|
|
||||||
LOG_I(TAG, "bound %s to %s", driver->name, device->name);
|
LOG_I(TAG, "bound %s to %s", driver->name, device->name);
|
||||||
@ -174,7 +174,7 @@ error_t driver_unbind(Driver* driver, Device* device) {
|
|||||||
driver_lock(driver);
|
driver_lock(driver);
|
||||||
|
|
||||||
error_t error = ERROR_NONE;
|
error_t error = ERROR_NONE;
|
||||||
if (get_driver_private(driver)->destroying || !device_is_added(device)) {
|
if (get_driver_internal(driver)->destroying || !device_is_added(device)) {
|
||||||
error = ERROR_INVALID_STATE;
|
error = ERROR_INVALID_STATE;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -186,7 +186,7 @@ error_t driver_unbind(Driver* driver, Device* device) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get_driver_private(driver)->use_count--;
|
get_driver_internal(driver)->use_count--;
|
||||||
driver_unlock(driver);
|
driver_unlock(driver);
|
||||||
|
|
||||||
LOG_I(TAG, "unbound %s from %s", driver->name, device->name);
|
LOG_I(TAG, "unbound %s from %s", driver->name, device->name);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
project(tests)
|
project(tests)
|
||||||
|
|
||||||
set(DOCTESTINC ${PROJECT_SOURCE_DIR}/Include)
|
set(DOCTESTINC ${PROJECT_SOURCE_DIR}/Doctest/Include)
|
||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
add_subdirectory(TactilityCore)
|
add_subdirectory(TactilityCore)
|
||||||
|
|||||||
@ -4,16 +4,12 @@ enable_language(C CXX ASM)
|
|||||||
|
|
||||||
set(CMAKE_CXX_COMPILER g++)
|
set(CMAKE_CXX_COMPILER g++)
|
||||||
|
|
||||||
file(GLOB_RECURSE TEST_SOURCES ${PROJECT_SOURCE_DIR}/*.cpp)
|
file(GLOB_RECURSE TEST_SOURCES ${PROJECT_SOURCE_DIR}/Source/*.cpp)
|
||||||
add_executable(TactilityTests EXCLUDE_FROM_ALL ${TEST_SOURCES})
|
add_executable(TactilityTests EXCLUDE_FROM_ALL ${TEST_SOURCES})
|
||||||
|
|
||||||
target_include_directories(TactilityTests PRIVATE
|
target_include_directories(TactilityTests PRIVATE ${DOCTESTINC})
|
||||||
${DOCTESTINC}
|
|
||||||
)
|
|
||||||
|
|
||||||
add_test(NAME TactilityTests
|
add_test(NAME TactilityTests COMMAND TactilityTests)
|
||||||
COMMAND TactilityTests
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(TactilityTests PRIVATE
|
target_link_libraries(TactilityTests PRIVATE
|
||||||
Tactility
|
Tactility
|
||||||
|
|||||||
@ -4,16 +4,12 @@ enable_language(C CXX ASM)
|
|||||||
|
|
||||||
set(CMAKE_CXX_COMPILER g++)
|
set(CMAKE_CXX_COMPILER g++)
|
||||||
|
|
||||||
file(GLOB_RECURSE TEST_SOURCES ${PROJECT_SOURCE_DIR}/*.cpp)
|
file(GLOB_RECURSE TEST_SOURCES ${PROJECT_SOURCE_DIR}/Source/*.cpp)
|
||||||
add_executable(TactilityCoreTests EXCLUDE_FROM_ALL ${TEST_SOURCES})
|
add_executable(TactilityCoreTests EXCLUDE_FROM_ALL ${TEST_SOURCES})
|
||||||
|
|
||||||
target_include_directories(TactilityCoreTests PRIVATE
|
target_include_directories(TactilityCoreTests PRIVATE ${DOCTESTINC})
|
||||||
${DOCTESTINC}
|
|
||||||
)
|
|
||||||
|
|
||||||
add_test(NAME TactilityCoreTests
|
add_test(NAME TactilityCoreTests COMMAND TactilityCoreTests)
|
||||||
COMMAND TactilityCoreTests
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(TactilityCoreTests PUBLIC
|
target_link_libraries(TactilityCoreTests PUBLIC
|
||||||
TactilityCore
|
TactilityCore
|
||||||
|
|||||||
@ -4,16 +4,12 @@ enable_language(C CXX ASM)
|
|||||||
|
|
||||||
set(CMAKE_CXX_COMPILER g++)
|
set(CMAKE_CXX_COMPILER g++)
|
||||||
|
|
||||||
file(GLOB_RECURSE TEST_SOURCES ${PROJECT_SOURCE_DIR}/*.cpp)
|
file(GLOB_RECURSE TEST_SOURCES ${PROJECT_SOURCE_DIR}/Source/*.cpp)
|
||||||
add_executable(TactilityFreeRtosTests EXCLUDE_FROM_ALL ${TEST_SOURCES})
|
add_executable(TactilityFreeRtosTests EXCLUDE_FROM_ALL ${TEST_SOURCES})
|
||||||
|
|
||||||
target_include_directories(TactilityFreeRtosTests PRIVATE
|
target_include_directories(TactilityFreeRtosTests PRIVATE ${DOCTESTINC})
|
||||||
${DOCTESTINC}
|
|
||||||
)
|
|
||||||
|
|
||||||
add_test(NAME TactilityFreeRtosTests
|
add_test(NAME TactilityFreeRtosTests COMMAND TactilityFreeRtosTests)
|
||||||
COMMAND TactilityFreeRtosTests
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(TactilityFreeRtosTests PUBLIC
|
target_link_libraries(TactilityFreeRtosTests PUBLIC
|
||||||
TactilityFreeRtos
|
TactilityFreeRtos
|
||||||
|
|||||||
@ -4,7 +4,7 @@ enable_language(C CXX ASM)
|
|||||||
|
|
||||||
set(CMAKE_CXX_COMPILER g++)
|
set(CMAKE_CXX_COMPILER g++)
|
||||||
|
|
||||||
file(GLOB_RECURSE TEST_SOURCES ${PROJECT_SOURCE_DIR}/*.cpp)
|
file(GLOB_RECURSE TEST_SOURCES ${PROJECT_SOURCE_DIR}/Source/*.cpp)
|
||||||
add_executable(TactilityKernelTests EXCLUDE_FROM_ALL ${TEST_SOURCES})
|
add_executable(TactilityKernelTests EXCLUDE_FROM_ALL ${TEST_SOURCES})
|
||||||
|
|
||||||
target_include_directories(TactilityKernelTests PRIVATE ${DOCTESTINC})
|
target_include_directories(TactilityKernelTests PRIVATE ${DOCTESTINC})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user