no-OS
stm32_i3c.h
Go to the documentation of this file.
1 /***************************************************************************/
39 #ifndef STM32_I3C_H_
40 #define STM32_I3C_H_
41 
42 #include <stdint.h>
43 #include "no_os_i3c.h"
44 #include "stm32_hal.h"
45 
46 #define STM32_I3C_TP_PID(x) (x >> 16)
47 
54  I3C_HandleTypeDef *hi3c;
56  I3C_XferTypeDef xfer;
58  I3C_CCCInfoTypeDef ccc_info;
59 };
60 
67  I3C_DeviceConfTypeDef dev_conf;
68 };
69 
76  I3C_HandleTypeDef *hi3c;
77 };
78 
82 extern struct no_os_i3c_bus_desc *i3c_table [];
83 
87 extern const struct no_os_i3c_platform_ops stm32_i3c_ops;
88 
89 #endif // STM32_I3C_H_
stm32_i3c_conf_irq
int stm32_i3c_conf_irq(struct no_os_i3c_bus_desc *desc, uint8_t irq, bool en)
Configure I3C interrupts.
Definition: stm32_i3c.c:566
no_os_memswap64
void no_os_memswap64(void *buf, uint32_t bytes, uint32_t step)
no_os_alloc.h
HAL_I3C_CtrlTxCpltCallback
void HAL_I3C_CtrlTxCpltCallback(I3C_HandleTypeDef *hi3c)
Controller Transmit Complete callback.
Definition: stm32_i3c.c:119
no_os_i3c_ccc_info::ibi_payload
uint32_t ibi_payload
Definition: no_os_i3c.h:170
NO_OS_I3C_CCC_GETBCR
#define NO_OS_I3C_CCC_GETBCR
Definition: no_os_i3c.h:114
NO_OS_I3C_BCR_IBI_PAYLOAD
#define NO_OS_I3C_BCR_IBI_PAYLOAD(bcr)
Definition: no_os_i3c.h:136
no_os_i3c_bus_desc::irq_events
uint8_t irq_events
Definition: no_os_i3c.h:222
NO_OS_I3C_MAX_BUS_NUMBER
#define NO_OS_I3C_MAX_BUS_NUMBER
Definition: no_os_i3c.h:54
stm32_i3c_init_bus
int stm32_i3c_init_bus(struct no_os_i3c_bus_desc *desc, const struct no_os_i3c_bus_init_param *param)
Initialize the I3C bus.
Definition: stm32_i3c.c:205
no_os_i3c_bus_desc::ccc_info
struct no_os_i3c_ccc_info ccc_info
Definition: no_os_i3c.h:224
STM32_I3C_TP_PID
#define STM32_I3C_TP_PID(x)
Definition: stm32_i3c.h:46
no_os_i3c_desc::bus
struct no_os_i3c_bus_desc * bus
Definition: no_os_i3c.h:296
HAL_I3C_ErrorCallback
void HAL_I3C_ErrorCallback(I3C_HandleTypeDef *hi3c)
Definition: stm32_i3c.c:133
stm32_i3c_read
int stm32_i3c_read(struct no_os_i3c_desc *desc, uint8_t *data, uint8_t data_len)
I3C private read transaction as bus.
Definition: stm32_i3c.c:461
no_os_i3c_desc
Structure holding I3C device descriptor.
Definition: no_os_i3c.h:278
stm32_i3c_send_ccc
int stm32_i3c_send_ccc(struct no_os_i3c_bus_desc *desc, uint8_t addr, uint8_t id, bool rnw, bool defining, uint8_t *data, uint8_t size)
Send CCC as bus. Retrieve data is only valid for unicast commands. Multi frames are not supported suc...
Definition: stm32_i3c.c:323
no_os_i3c_addr_set_status
void no_os_i3c_addr_set_status(struct no_os_i3c_bus_desc *desc, uint8_t addr, enum no_os_i3c_slot_status status)
Set status of an address.
Definition: no_os_i3c.c:600
stm32_i3c_remove
int stm32_i3c_remove(struct no_os_i3c_desc *desc)
Free the resources allocated by stm32_i3c_init().
Definition: stm32_i3c.c:274
HAL_I3C_CtrlMultipleXferCpltCallback
void HAL_I3C_CtrlMultipleXferCpltCallback(I3C_HandleTypeDef *hi3c)
Definition: stm32_i3c.c:141
no_os_i3c.h
Header file of I3C Interface.
i3c_table
struct no_os_i3c_bus_desc * i3c_table[NO_OS_I3C_MAX_BUS_NUMBER+1]
i3c_table contains the pointers towards the I3C buses.
Definition: no_os_i3c.c:51
stm32_i3c_device_desc
STM32 platform specific I3C device descriptor.
Definition: stm32_i3c.h:65
no_os_calloc
void * no_os_calloc(size_t nitems, size_t size)
Allocate memory and return a pointer to it, set memory to 0.
Definition: chibios_alloc.c:54
no_os_i3c_bus_desc
Structure holding I3C bus descriptor.
Definition: no_os_i3c.h:200
no_os_i3c_desc::extra
void * extra
Definition: no_os_i3c.h:290
stm32_i3c_bus_desc::ccc_info
I3C_CCCInfoTypeDef ccc_info
Definition: stm32_i3c.h:58
no_os_i3c_bus_desc::extra
void * extra
Definition: no_os_i3c.h:230
no_os_i3c_ccc_info::ibi_payload_len
uint32_t ibi_payload_len
Definition: no_os_i3c.h:168
NO_OS_I3C_BCR_DEVICE_ROLE
#define NO_OS_I3C_BCR_DEVICE_ROLE(bcr)
Definition: no_os_i3c.h:137
stm32_i3c_init_param
Structure holding the initialization parameters I3C bus.
Definition: stm32_i3c.h:74
stm32_i3c_init_param::hi3c
I3C_HandleTypeDef * hi3c
Definition: stm32_i3c.h:76
no_os_i3c_bus_init_param
Structure holding the parameters for I3C initialization.
Definition: no_os_i3c.h:237
no_os_i3c_bus_init_param::device_id
const uint32_t device_id
Definition: no_os_i3c.h:239
stm32_i3c_bus_desc::xfer
I3C_XferTypeDef xfer
Definition: stm32_i3c.h:56
stm32_i3c_device_desc::dev_conf
I3C_DeviceConfTypeDef dev_conf
Definition: stm32_i3c.h:67
NO_OS_I3C_IRQ_CR
#define NO_OS_I3C_IRQ_CR
Definition: no_os_i3c.h:131
stm32_i3c_ops
const struct no_os_i3c_platform_ops stm32_i3c_ops
STM32 specific I3C platform ops structure.
Definition: stm32_i3c.c:734
no_os_i3c_bus_desc::async_irq
bool async_irq
Definition: no_os_i3c.h:226
stm32_i3c_get_ccc_info
int stm32_i3c_get_ccc_info(struct no_os_i3c_bus_desc *desc, uint8_t irq)
Update I3C CCC info.
Definition: stm32_i3c.c:607
HAL_I3C_CtrlDAACpltCallback
void HAL_I3C_CtrlDAACpltCallback(I3C_HandleTypeDef *hi3c)
Controller dynamic address assignment Complete callback.
Definition: stm32_i3c.c:113
DISABLE
#define DISABLE
Definition: ad77681.h:340
stm32_i3c_bus_desc
STM32 platform specific I3C bus descriptor.
Definition: stm32_i3c.h:52
no_os_i3c_bus_desc::devs
struct no_os_i3c_desc * devs[NO_OS_I3C_MAX_DEV_NUMBER]
Definition: no_os_i3c.h:220
no_os_i3c_bus_desc::daa_candidates
struct no_os_i3c_daa_lut daa_candidates[NO_OS_I3C_MAX_DEV_NUMBER]
Definition: no_os_i3c.h:216
no_os_i3c_send_direct_ccc
int no_os_i3c_send_direct_ccc(struct no_os_i3c_desc *desc, uint32_t ccc, uint8_t *data)
Send CCC to device device.
Definition: no_os_i3c.c:388
HAL_I3C_NotifyCallback
void HAL_I3C_NotifyCallback(I3C_HandleTypeDef *hi3c, uint32_t eventId)
Definition: stm32_i3c.c:149
stm32_i3c_ops
const struct no_os_i3c_platform_ops stm32_i3c_ops
stm32 platform specific I3C platform ops structure.
Definition: stm32_i3c.c:734
NO_OS_I3C_IRQ_HJ
#define NO_OS_I3C_IRQ_HJ
Definition: no_os_i3c.h:130
stm32_i3c_remove_bus
int stm32_i3c_remove_bus(struct no_os_i3c_bus_desc *desc)
Deinit I3C bus and free resources allocated by stm32_i3c_init_bus().
Definition: stm32_i3c.c:292
no_os_i3c_desc::addr
uint8_t addr
Definition: no_os_i3c.h:282
i3c_table
struct no_os_i3c_bus_desc * i3c_table[]
i3c_table contains the pointers towards the I3C buses.
Definition: no_os_i3c.c:51
stm32_i3c_write_and_read
int stm32_i3c_write_and_read(struct no_os_i3c_desc *desc, uint8_t *tx_data, uint8_t tx_data_len, uint8_t *rx_data, uint8_t rx_data_len)
I3C private write and read transaction as bus.
Definition: stm32_i3c.c:503
no_os_i3c_addr_get_free
uint8_t no_os_i3c_addr_get_free(struct no_os_i3c_bus_desc *desc, uint8_t start_addr)
Get a free address.
Definition: no_os_i3c.c:579
no_os_free
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:69
stm32_i3c.h
Header file for the stm32 I3C driver.
NO_OS_I3C_BCR_IBI_REQUEST_CAPABLE
#define NO_OS_I3C_BCR_IBI_REQUEST_CAPABLE(bcr)
Definition: no_os_i3c.h:135
NULL
#define NULL
Definition: wrapper.h:64
no_os_i3c_init_param
Structure holding the parameters for I3C initialization. Works like a device tree,...
Definition: no_os_i3c.h:261
no_os_i3c_ccc_info::ibi_cr_addr
uint32_t ibi_cr_addr
Definition: no_os_i3c.h:166
HAL_I3C_CtrlRxCpltCallback
void HAL_I3C_CtrlRxCpltCallback(I3C_HandleTypeDef *hi3c)
Controller Reception Complete callback.
Definition: stm32_i3c.c:126
NO_OS_I3C_BCAST_ADDR
#define NO_OS_I3C_BCAST_ADDR
Definition: no_os_i3c.h:59
stm32_i3c_init
int stm32_i3c_init(struct no_os_i3c_desc *desc, const struct no_os_i3c_init_param *param)
Initialize the I3C device.
Definition: stm32_i3c.c:176
stm32_i3c_is_dev_ready
int stm32_i3c_is_dev_ready(struct no_os_i3c_desc *desc)
Check if I3C device is ready.
Definition: stm32_i3c.c:545
stm32_i3c_bus_desc::hi3c
I3C_HandleTypeDef * hi3c
Definition: stm32_i3c.h:54
NO_OS_I3C_IRQ_IBI
#define NO_OS_I3C_IRQ_IBI
Definition: no_os_i3c.h:129
no_os_i3c_daa_lut::pid
uint64_t pid
Definition: no_os_i3c.h:182
no_os_i3c_desc::is_i3c
bool is_i3c
Definition: no_os_i3c.h:284
no_os_util.h
Header file of utility functions.
no_os_i3c_bus_desc::daa_unknown
struct no_os_i3c_daa_lut daa_unknown[NO_OS_I3C_MAX_DEV_NUMBER]
Definition: no_os_i3c.h:218
no_os_i3c_call_irq
int no_os_i3c_call_irq(struct no_os_i3c_bus_desc *desc)
Non-blocking I3C interrupt. Since a payload is always retrieved with it, also update the no_os_i3c_cc...
Definition: no_os_i3c.c:543
stm32_i3c_do_daa
int stm32_i3c_do_daa(struct no_os_i3c_bus_desc *desc, bool rstdaa)
Do I3C DAA to assign the dynamic addresses.
Definition: stm32_i3c.c:249
NO_OS_I3C_ADDR_SLOT_I3C_DEV
@ NO_OS_I3C_ADDR_SLOT_I3C_DEV
Definition: no_os_i3c.h:156
no_os_i3c_platform_ops
Structure holding I3C function pointers that point to the platform specific function.
Definition: no_os_i3c.h:304
stm32_hal.h
stm32_i3c_write
int stm32_i3c_write(struct no_os_i3c_desc *desc, uint8_t *data, uint8_t data_len)
I3C private write transaction as bus.
Definition: stm32_i3c.c:419
no_os_i3c_platform_ops::i3c_ops_init_bus
int(* i3c_ops_init_bus)(struct no_os_i3c_bus_desc *, const struct no_os_i3c_bus_init_param *)
Definition: no_os_i3c.h:306
errno.h
Error macro definition for ARM Compiler.
no_os_i3c_bus_desc::num_devs_unknown
uint8_t num_devs_unknown
Definition: no_os_i3c.h:206
NO_OS_I3C_MAX_DEV_NUMBER
#define NO_OS_I3C_MAX_DEV_NUMBER
Definition: no_os_i3c.h:55
HAL_I3C_TgtReqDynamicAddrCallback
void HAL_I3C_TgtReqDynamicAddrCallback(I3C_HandleTypeDef *hi3c, uint64_t targetPayload)
I3C target request a dynamic address callback. When called, assigns a dynamic address to the target.
Definition: stm32_i3c.c:61
no_os_i3c_bus_init_param::extra
void * extra
Definition: no_os_i3c.h:247