TT-System-Firmware APIs 19.10.99
Tenstorrent Firmware
Loading...
Searching...
No Matches
dma_tt_grendel_smc.c File Reference
#include <zephyr/device.h>
#include <zephyr/drivers/dma.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
#include <zephyr/sys/sys_io.h>
#include <platform.h>
Include dependency graph for dma_tt_grendel_smc.c:

Data Structures

struct  dma_grendel_channel_data
struct  dma_grendel_config
struct  dma_grendel_data

Macros

#define DT_DRV_COMPAT   tenstorrent_grendel_smc_dma
#define DMA_REG_STATUS(ch)
#define DMA_REG_NEXT_ID(ch)
#define DMA_REG_DONE(ch)
#define DMA_READ(reg)
#define DMA_READ_CH(reg, ch)
#define DMA_WRITE(reg, val)
#define DMA_GRENDEL_INIT(inst)

Functions

 LOG_MODULE_REGISTER (dma_tt_grendel_smc)
static uint32_t dma_transfer (const struct dma_grendel_config *cfg, uint32_t channel, const struct dma_block_config *block)
static int dma_grendel_config (const struct device *dev, uint32_t channel, struct dma_config *config)
static int dma_grendel_start (const struct device *dev, uint32_t channel)
static int dma_grendel_stop (const struct device *dev, uint32_t channel)
static int dma_grendel_get_status (const struct device *dev, uint32_t channel, struct dma_status *status)
static int dma_grendel_init (const struct device *dev)

Variables

static const struct dma_driver_api dma_grendel_api

Macro Definition Documentation

◆ DMA_GRENDEL_INIT

#define DMA_GRENDEL_INIT ( inst)
Value:
static struct dma_grendel_channel_data \
dma_grendel_channels_##inst[DT_INST_PROP(inst, dma_channels)]; \
\
static const struct dma_grendel_config dma_grendel_config_##inst = { \
.base = DT_INST_REG_ADDR(inst), \
.channels = dma_grendel_channels_##inst, \
.num_channels = DT_INST_PROP(inst, dma_channels), \
}; \
\
static struct dma_grendel_data dma_grendel_data_##inst = {}; \
\
DEVICE_DT_INST_DEFINE(inst, &dma_grendel_init, NULL, &dma_grendel_data_##inst, \
&dma_grendel_config_##inst, POST_KERNEL, CONFIG_DMA_INIT_PRIORITY, \
#define NULL
Definition avs.c:45
static int dma_grendel_init(const struct device *dev)
Definition dma_tt_grendel_smc.c:195
static const struct dma_driver_api dma_grendel_api
Definition dma_tt_grendel_smc.c:211
#define DT_INST_PROP(inst, prop)
#define DT_INST_REG_ADDR(inst)
Definition dma_tt_grendel_smc.c:29
Definition dma_tt_grendel_smc.c:36
uint8_t num_channels
Definition dma_tt_grendel_smc.c:39
Definition dma_tt_grendel_smc.c:42

◆ DMA_READ

#define DMA_READ ( reg)
Value:
sys_read32(cfg->base + SMC_CPU_AXI_DATA_ACCEL_AXI_DMA_CTRL_##reg##_REG_OFFSET)
static ALWAYS_INLINE uint32_t sys_read32(mem_addr_t addr)

◆ DMA_READ_CH

#define DMA_READ_CH ( reg,
ch )
Value:
sys_read32(cfg->base + DMA_REG_##reg(ch))

◆ DMA_REG_DONE

#define DMA_REG_DONE ( ch)
Value:
(SMC_CPU_AXI_DATA_ACCEL_AXI_DMA_CTRL_DONE_0_REG_OFFSET + (ch) * 0x4)

◆ DMA_REG_NEXT_ID

#define DMA_REG_NEXT_ID ( ch)
Value:
(SMC_CPU_AXI_DATA_ACCEL_AXI_DMA_CTRL_NEXT_ID_0_REG_OFFSET + (ch) * 0x8)

◆ DMA_REG_STATUS

#define DMA_REG_STATUS ( ch)
Value:
(SMC_CPU_AXI_DATA_ACCEL_AXI_DMA_CTRL_STATUS_0_REG_OFFSET + (ch) * 0x4)

◆ DMA_WRITE

#define DMA_WRITE ( reg,
val )
Value:
sys_write32((val), cfg->base + SMC_CPU_AXI_DATA_ACCEL_AXI_DMA_CTRL_##reg##_REG_OFFSET)
static ALWAYS_INLINE void sys_write32(uint32_t data, mem_addr_t addr)

◆ DT_DRV_COMPAT

#define DT_DRV_COMPAT   tenstorrent_grendel_smc_dma

Function Documentation

◆ dma_grendel_config()

int dma_grendel_config ( const struct device * dev,
uint32_t channel,
struct dma_config * config )
static

◆ dma_grendel_get_status()

int dma_grendel_get_status ( const struct device * dev,
uint32_t channel,
struct dma_status * status )
static

◆ dma_grendel_init()

int dma_grendel_init ( const struct device * dev)
static

◆ dma_grendel_start()

int dma_grendel_start ( const struct device * dev,
uint32_t channel )
static

◆ dma_grendel_stop()

int dma_grendel_stop ( const struct device * dev,
uint32_t channel )
static

◆ dma_transfer()

uint32_t dma_transfer ( const struct dma_grendel_config * cfg,
uint32_t channel,
const struct dma_block_config * block )
static

◆ LOG_MODULE_REGISTER()

LOG_MODULE_REGISTER ( dma_tt_grendel_smc )

Variable Documentation

◆ dma_grendel_api

const struct dma_driver_api dma_grendel_api
static
Initial value:
= {
.config = dma_grendel_config,
.reload = NULL,
.suspend = NULL,
.resume = NULL,
.get_status = dma_grendel_get_status,
.get_attribute = NULL,
.chan_filter = NULL,
.chan_release = NULL,
}
static int dma_grendel_start(const struct device *dev, uint32_t channel)
Definition dma_tt_grendel_smc.c:113
static int dma_grendel_get_status(const struct device *dev, uint32_t channel, struct dma_status *status)
Definition dma_tt_grendel_smc.c:173
static int dma_grendel_stop(const struct device *dev, uint32_t channel)
Definition dma_tt_grendel_smc.c:165