|
Zephyr Project API 4.4.99
A Scalable Open Source RTOS
|
Files | |
| file | tmc6460.h |
| Public API for the TMC6460 FOC gate driver. | |
Data Structures | |
| struct | tmc6460_field |
| Describes a bitfield within a TMC6460 register. More... | |
Functions | |
| int | tmc6460_write (const struct device *dev, uint16_t reg_addr, uint32_t reg_val) |
| Write a value to a TMC6460 register. | |
| int | tmc6460_read (const struct device *dev, uint16_t reg_addr, uint32_t *reg_val) |
| Read a value from a TMC6460 register. | |
| int | tmc6460_rtmi_stream_write (const struct device *dev, uint8_t rtmi_index, uint32_t value) |
| Write a value to an RTMI streamed register slot (UART only). | |
| int | tmc6460_enable (const struct device *dev) |
| Enable the TMC6460 gate driver. | |
| int | tmc6460_disable (const struct device *dev) |
| Disable the TMC6460 gate driver. | |
| int | tmc6460_poll_flag (const struct device *dev, uint16_t reg_addr, uint32_t flag_mask, uint32_t poll_interval_ms, uint32_t timeout_ms) |
| Poll a register until the given flag bits are set or a timeout. | |
| static uint32_t | tmc6460_field_update (uint32_t reg_val, struct tmc6460_field field, uint32_t field_val) |
| Update a bitfield within a register value (in memory only). | |
| static int | tmc6460_field_write (const struct device *dev, struct tmc6460_field field, uint32_t field_val) |
| Read-modify-write a bitfield on the device. | |
| int tmc6460_disable | ( | const struct device * | dev | ) |
#include <tmc6460.h>
Disable the TMC6460 gate driver.
Clears the DRV_EN bit in the MCC_CONFIG_GDRV register, disabling the gate driver output stage. This is a read-modify-write operation so other bits in the register are preserved.
| dev | Pointer to the TMC6460 device. |
| 0 | on success. |
| -EIO | on bus failure. |
| int tmc6460_enable | ( | const struct device * | dev | ) |
#include <tmc6460.h>
Enable the TMC6460 gate driver.
Sets the DRV_EN bit in the MCC_CONFIG_GDRV register, enabling the gate driver output stage. This is a read-modify-write operation so other bits in the register are preserved.
| dev | Pointer to the TMC6460 device. |
| 0 | on success. |
| -EIO | on bus failure. |
|
inlinestatic |
#include <tmc6460.h>
Update a bitfield within a register value (in memory only).
| reg_val | The current register value. |
| field | The field descriptor. |
| field_val | The new field value to insert. |
|
inlinestatic |
#include <tmc6460.h>
Read-modify-write a bitfield on the device.
| dev | Pointer to the TMC6460 device. |
| field | The field descriptor. |
| field_val | The new field value to write. |
| 0 | on success. |
| -errno | on failure. |
| int tmc6460_poll_flag | ( | const struct device * | dev, |
| uint16_t | reg_addr, | ||
| uint32_t | flag_mask, | ||
| uint32_t | poll_interval_ms, | ||
| uint32_t | timeout_ms ) |
#include <tmc6460.h>
Poll a register until the given flag bits are set or a timeout.
Repeatedly reads reg_addr and checks whether all bits in flag_mask are set, sleeping poll_interval_ms between reads. This is a reusable helper for the common "wait for a ready/lock
status bit" pattern (e.g. PLL lock, ADC ready).
| dev | Pointer to the TMC6460 device. |
| reg_addr | 16-bit status register address to poll. |
| flag_mask | Bit mask that must be fully set for success. |
| poll_interval_ms | Delay between reads, in milliseconds (0 for a tight loop). |
| timeout_ms | Maximum time to wait, in milliseconds. |
| 0 | if the flag bits became set. |
| -ETIMEDOUT | if the timeout elapsed first. |
| -EIO | on bus failure. |
#include <tmc6460.h>
Read a value from a TMC6460 register.
| dev | Pointer to the TMC6460 device. |
| reg_addr | 16-bit register address. |
| reg_val | Pointer to store the 32-bit read value. |
| 0 | on success. |
| -errno | on bus failure. |
#include <tmc6460.h>
Write a value to an RTMI streamed register slot (UART only).
Uses the fire-and-forget stream write protocol (sync byte 0x41). This function is only available when CONFIG_TMC6460_UART is enabled.
| dev | Pointer to the TMC6460 device. |
| rtmi_index | RTMI slot index (0..7). |
| value | 32-bit value to stream. |
| 0 | on success. |
| -errno | on failure. |