24#ifndef COMPONENT_HANDLER_SE050_HANDLER_H_
25#define COMPONENT_HANDLER_SE050_HANDLER_H_
32#include "base/BaseGpio.h"
33#include "base/BaseI2c.h"
35#include "core/hf-core-drivers/external/hf-se050-driver/inc/se050_device.hpp"
36#include "core/hf-core-drivers/external/hf-se050-driver/inc/se050_i2c_transport_interface.hpp"
69 [[nodiscard]] se050::Error
I2cWrite(
const std::uint8_t* tx, std::size_t tx_len,
70 std::uint32_t timeout_ms)
noexcept;
78 [[nodiscard]] se050::Error
I2cRead(std::uint8_t* rx, std::size_t rx_len,
79 std::uint32_t timeout_ms)
noexcept;
90 [[nodiscard]] se050::Error
Transceive(
const std::uint8_t* tx, std::size_t tx_len, std::uint8_t* rx,
91 std::size_t rx_cap, std::size_t* rx_len_out,
92 std::uint32_t timeout_ms)
noexcept;
102 [[nodiscard]]
bool HoldBus(std::uint32_t timeout_ms) noexcept;
155 BaseGpio* reset_gpio =
nullptr, RtosMutex* bus_mutex =
nullptr)
noexcept;
CRTP adapter mapping BaseI2c primitives to se050::I2cTransceiveInterface.
Definition Se050Handler.h:52
void ReleaseBus() noexcept
Definition Se050Handler.cpp:232
se050::Error Transceive(const std::uint8_t *tx, std::size_t tx_len, std::uint8_t *rx, std::size_t rx_cap, std::size_t *rx_len_out, std::uint32_t timeout_ms) noexcept
Combined write-then-read (T=1oI2C frame).
Definition Se050Handler.cpp:148
se050::Error I2cWrite(const std::uint8_t *tx, std::size_t tx_len, std::uint32_t timeout_ms) noexcept
Write bytes on I²C.
Definition Se050Handler.cpp:67
bool HoldBus(std::uint32_t timeout_ms) noexcept
Hold the I²C bus across a T=1 APDU (Write/Read pairs). Nested I2cWrite/Read skip lock.
Definition Se050Handler.cpp:210
HalI2cSe050Comm(BaseI2c &i2c, BaseGpio *reset_gpio) noexcept
Construct the CRTP I²C adapter.
Definition Se050Handler.h:59
se050::Error HardwareReset() noexcept
Definition Se050Handler.cpp:193
se050::Error I2cRead(std::uint8_t *rx, std::size_t rx_len, std::uint32_t timeout_ms) noexcept
Read bytes on I²C.
Definition Se050Handler.cpp:110
bool BusHeld() const noexcept
Definition Se050Handler.h:104
bool EnsureInitialized() noexcept
Definition Se050Handler.h:61
BaseI2c & i2c_
Definition Se050Handler.h:107
void delay_ms_impl(std::uint32_t ms) noexcept
Definition Se050Handler.cpp:208
BaseGpio * reset_gpio_
Definition Se050Handler.h:108
bool bus_held_
Definition Se050Handler.h:109
Thread-safe façade around se050::Device<HalI2cSe050Comm>.
Definition Se050Handler.h:144
bool EnsureInitialized() noexcept
Initialize I²C, pulse optional reset GPIO, run T=1 warm reset, SELECT applet, and verify with GetVers...
Definition Se050Handler.cpp:255
bool IsPresent() const noexcept
Definition Se050Handler.h:170
RtosMutex * bus_mutex_
Definition Se050Handler.h:188
Se050Handler(Se050Handler &&)=delete
se050::Device< HalI2cSe050Comm > DeviceType
Definition Se050Handler.h:146
DeviceType & GetDevice() noexcept
Direct access to the full se050::Device API (lock externally if needed).
Definition Se050Handler.h:175
DeviceType device_
Definition Se050Handler.h:183
Se050Handler & operator=(const Se050Handler &)=delete
const Se050HandlerConfig & Config() const noexcept
Definition Se050Handler.h:162
bool EnsureInitializedLocked() noexcept
Definition Se050Handler.cpp:263
Se050HandlerConfig config_
Definition Se050Handler.h:181
RtosMutex private_mutex_
Definition Se050Handler.h:187
const DeviceType & GetDevice() const noexcept
Definition Se050Handler.h:176
Se050Handler(const Se050Handler &)=delete
std::atomic< bool > initialized_
Definition Se050Handler.h:185
Se050Handler & operator=(Se050Handler &&)=delete
HalI2cSe050Comm comm_
Definition Se050Handler.h:182
Runtime tuning for one SE050 instance on a BaseI2c device.
Definition Se050Handler.h:117
std::uint32_t apdu_timeout_ms
Timeout for management / crypto APDUs (GetVersion, GetRandom, …).
Definition Se050Handler.h:119
bool skip_chip_warm_reset
When true, skip ChipWarmReset (caller already did T=1 warm-reset + ATR).
Definition Se050Handler.h:125
std::uint32_t t1_inter_frame_delay_ms
Inter-frame delay before reading a T=1 response (ms).
Definition Se050Handler.h:123
std::uint32_t warm_reset_timeout_ms
T=1 warm-reset S-block exchange timeout.
Definition Se050Handler.h:121