mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-02-18 19:03:16 +00:00
- Add kernel support for SPI driver - Add kernel support for UART driver - Implemented ESP32 UART kernel driver - Update existing UART-related code in Tactility to use new kernel driver - Remove UART from tt::hal::Configuration - Remove tt_hal_uart functionality but keep functions for now - Update devicetrees for UART changes - Kernel mutex and recursive mutex: improved locking API design - Other kernel improvements - Added device_exists_of_type() and device_find_by_name()
73 lines
2.0 KiB
C
73 lines
2.0 KiB
C
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
#pragma once
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
|
|
#include <tactility/freertos/freertos.h>
|
|
#include <tactility/error.h>
|
|
|
|
struct Device;
|
|
|
|
/**
|
|
* @brief API for SPI controller drivers.
|
|
*/
|
|
struct SpiControllerApi {
|
|
/**
|
|
* @brief Locks the SPI controller.
|
|
* @param[in] device the SPI controller device
|
|
* @retval ERROR_NONE when the operation was successful
|
|
*/
|
|
error_t (*lock)(struct Device* device);
|
|
|
|
/**
|
|
* @brief Tries to lock the SPI controller.
|
|
* @param[in] device the SPI controller device
|
|
* @param[in] timeout the maximum time to wait for the lock
|
|
* @retval ERROR_NONE when the operation was successful
|
|
* @retval ERROR_TIMEOUT when the operation timed out
|
|
*/
|
|
error_t (*try_lock)(struct Device* device, TickType_t timeout);
|
|
|
|
/**
|
|
* @brief Unlocks the SPI controller.
|
|
* @param[in] device the SPI controller device
|
|
* @retval ERROR_NONE when the operation was successful
|
|
*/
|
|
error_t (*unlock)(struct Device* device);
|
|
};
|
|
|
|
/**
|
|
* @brief Locks the SPI controller using the specified controller.
|
|
* @param[in] device the SPI controller device
|
|
* @retval ERROR_NONE when the operation was successful
|
|
*/
|
|
error_t spi_controller_lock(struct Device* device);
|
|
|
|
/**
|
|
* @brief Tries to lock the SPI controller using the specified controller.
|
|
* @param[in] device the SPI controller device
|
|
* @param[in] timeout the maximum ticks to wait for the lock
|
|
* @retval ERROR_NONE when the operation was successful
|
|
* @retval ERROR_TIMEOUT when the operation timed out
|
|
*/
|
|
error_t spi_controller_try_lock(struct Device* device, TickType_t timeout);
|
|
|
|
/**
|
|
* @brief Unlocks the SPI controller using the specified controller.
|
|
* @param[in] device the SPI controller device
|
|
* @retval ERROR_NONE when the operation was successful
|
|
*/
|
|
error_t spi_controller_unlock(struct Device* device);
|
|
|
|
extern const struct DeviceType SPI_CONTROLLER_TYPE;
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|