no-OS
|
#include "spi_engine.h"
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <sleep.h>
#include <inttypes.h>
#include "axi_dmac.h"
#include "no_os_axi_io.h"
#include "no_os_error.h"
#include "no_os_alloc.h"
#include "no_os_util.h"
Functions | |
int32_t | spi_engine_write (struct spi_engine_desc *desc, uint32_t reg_addr, uint32_t reg_data) |
Write SPI Engine's axi registers. More... | |
int32_t | spi_engine_read (struct spi_engine_desc *desc, uint32_t reg_addr, uint32_t *reg_data) |
Read SPI Engine's axi registers. More... | |
int32_t | spi_engine_set_transfer_width (struct no_os_spi_desc *desc, uint8_t data_wdith) |
Set width of the transfered word over SPI. More... | |
void | spi_engine_set_speed (struct no_os_spi_desc *desc, uint32_t speed_hz) |
Set SPI engine clock frequency. More... | |
int32_t | spi_engine_init (struct no_os_spi_desc **desc, const struct no_os_spi_init_param *param) |
Initialize the spi engine. More... | |
int32_t | spi_engine_write_and_read (struct no_os_spi_desc *desc, uint8_t *data, uint16_t bytes_number) |
Write/read on the spi interface. More... | |
int32_t | spi_engine_offload_init (struct no_os_spi_desc *desc, const struct spi_engine_offload_init_param *param) |
Initialize the SPI engine's offload module. More... | |
int32_t | spi_engine_offload_transfer (struct no_os_spi_desc *desc, struct spi_engine_offload_message msg, uint32_t no_samples) |
Initiate a SPI transfer in offload mode. More... | |
int32_t | spi_engine_remove (struct no_os_spi_desc *desc) |
Free the resources allocated by no_os_spi_init(). More... | |
Variables | |
const struct no_os_spi_platform_ops | spi_eng_platform_ops |
Spi engine platform specific SPI platform ops structure. More... | |
int32_t spi_engine_init | ( | struct no_os_spi_desc ** | desc, |
const struct no_os_spi_init_param * | param | ||
) |
Initialize the spi engine.
desc | Decriptor containing SPI interface parameters |
param | Structure containing the spi init parameters |
int32_t spi_engine_offload_init | ( | struct no_os_spi_desc * | desc, |
const struct spi_engine_offload_init_param * | param | ||
) |
Initialize the SPI engine's offload module.
desc | Decriptor containing SPI interface parameters |
param | Structure containing the offload init parameters |
int32_t spi_engine_offload_transfer | ( | struct no_os_spi_desc * | desc, |
struct spi_engine_offload_message | msg, | ||
uint32_t | no_samples | ||
) |
Initiate a SPI transfer in offload mode.
desc | Decriptor containing SPI interface parameters |
msg | Offload message that get's to be transferred |
no_samples | Number of time the messages will be transferred |
int32_t spi_engine_read | ( | struct spi_engine_desc * | desc, |
uint32_t | reg_addr, | ||
uint32_t * | reg_data | ||
) |
Read SPI Engine's axi registers.
desc | Decriptor containing SPI Engine's parameters |
reg_addr | The address of the SPI Engine's axi register from where the data where the data will be read |
reg_data | Pointer where the read that will be stored |
int32_t spi_engine_remove | ( | struct no_os_spi_desc * | desc | ) |
Free the resources allocated by no_os_spi_init().
desc | Decriptor containing SPI interface parameters |
void spi_engine_set_speed | ( | struct no_os_spi_desc * | desc, |
uint32_t | speed_hz | ||
) |
Set SPI engine clock frequency.
desc | Decriptor containing SPI Engine's parameters |
speed_hz | SPI engine transfer speed |
int32_t spi_engine_set_transfer_width | ( | struct no_os_spi_desc * | desc, |
uint8_t | data_wdith | ||
) |
Set width of the transfered word over SPI.
desc | Decriptor containing SPI interface parameters |
data_wdith | The desired data width The supported values are:
|
int32_t spi_engine_write | ( | struct spi_engine_desc * | desc, |
uint32_t | reg_addr, | ||
uint32_t | reg_data | ||
) |
Write SPI Engine's axi registers.
desc | Decriptor containing SPI Engine's parameters |
reg_addr | The address of the SPI Engine's axi register where the data will be written |
reg_data | Data that will be written |
int32_t spi_engine_write_and_read | ( | struct no_os_spi_desc * | desc, |
uint8_t * | data, | ||
uint16_t | bytes_number | ||
) |
Write/read on the spi interface.
desc | Decriptor containing SPI interface parameters |
data | Pointer to data buffer |
bytes_number | Number of bytes to transfer |
const struct no_os_spi_platform_ops spi_eng_platform_ops |
Spi engine platform specific SPI platform ops structure.
SPI engine platform ops structure.