no-OS
maxim_spi.h
Go to the documentation of this file.
1 /***************************************************************************/
34 #ifndef MAXIM_SPI_H_
35 #define MAXIM_SPI_H_
36 
37 #include <stdint.h>
38 #include "max32650.h"
39 #include "gpio.h"
40 #include "no_os_spi.h"
41 #include "no_os_dma.h"
42 
46 extern const struct no_os_spi_platform_ops max_spi_ops;
47 
51 };
52 
54  uint32_t num_slaves;
56  mxc_gpio_vssel_t vssel;
58  uint32_t dma_rx_priority;
59  uint32_t dma_tx_priority;
60 };
61 
62 struct max_spi_state {
64  uint32_t cs_delay_first;
65  uint32_t cs_delay_last;
67  uint32_t dma_req_rx;
68  uint32_t dma_req_tx;
69 };
70 
71 #endif
no_os_dma_xfer_desc::irq_priority
uint32_t irq_priority
Definition: no_os_dma.h:91
max_spi_state::dma
struct no_os_dma_desc * dma
Definition: maxim_spi.h:66
max_dma_spi_xfer_data::rx_ch
struct no_os_dma_ch * rx_ch
Definition: maxim_spi.c:64
no_os_alloc.h
MAX_DELAY_SCLK
#define MAX_DELAY_SCLK
Definition: maxim_spi.c:55
no_os_spi_desc::device_id
uint32_t device_id
Definition: no_os_spi.h:196
no_os_spi_init_param::bit_order
enum no_os_spi_bit_order bit_order
Definition: no_os_spi.h:150
max_spi_state
Definition: maxim_spi.h:62
no_os_dma_acquire_channel
int no_os_dma_acquire_channel(struct no_os_dma_desc *, struct no_os_dma_ch **)
Get a free DMA channel.
Definition: no_os_dma.c:184
MAX_DELAY_SCLK
#define MAX_DELAY_SCLK
Definition: maxim_spi.c:55
MAX_DELAY_SCLK
#define MAX_DELAY_SCLK
Definition: maxim_spi.c:55
maxim_spi.h
maxim specific header for SPI driver
SPI_MASTER_MODE
#define SPI_MASTER_MODE
Definition: maxim_spi.c:48
no_os_spi.h
Header file of SPI Interface.
max_spi_state::cs_delay_last
uint32_t cs_delay_last
Definition: maxim_spi.h:65
no_os_dma_init_param
Initialization parameter for the DMA controller.
Definition: no_os_dma.h:171
SPI_MASTER_MODE
#define SPI_MASTER_MODE
Definition: maxim_spi.c:52
SPI_MASTER_MODE
#define SPI_MASTER_MODE
Definition: maxim_spi.c:52
SPI_MASTER_MODE
#define SPI_MASTER_MODE
Definition: maxim_spi.c:47
SPI_MASTER_MODE
#define SPI_MASTER_MODE
Definition: maxim_spi.c:52
max_spi_state::dma_req_tx
uint32_t dma_req_tx
Definition: maxim_spi.h:68
no_os_units.h
Header file of Units.
SPI_SINGLE_MODE
#define SPI_SINGLE_MODE
Definition: maxim_spi.c:53
SPI_SINGLE_MODE
#define SPI_SINGLE_MODE
Definition: maxim_spi.c:53
no_os_spi_msg
Definition: no_os_spi.h:100
no_os_spi_platform_ops
Structure holding SPI function pointers that point to the platform specific function.
Definition: no_os_spi.h:222
SPI_SS_POL_LOW
@ SPI_SS_POL_LOW
Definition: maxim_spi.h:49
no_os_delay.h
Header file of Delay functions.
DEV_TO_MEM
@ DEV_TO_MEM
Definition: no_os_dma.h:52
no_os_spi_msg::cs_delay_last
uint32_t cs_delay_last
Definition: no_os_spi.h:117
no_os_spi_init_param::mode
enum no_os_spi_mode mode
Definition: no_os_spi.h:148
no_os_dma_in_progress
bool no_os_dma_in_progress(struct no_os_dma_desc *, struct no_os_dma_ch *)
Whether or not there is a transfer in progress on a specific channel.
Definition: no_os_dma.c:434
no_os_print_log.h
Print messages helpers.
SPI_SS_POL_HIGH
@ SPI_SS_POL_HIGH
Definition: maxim_spi.h:50
max_spi_init
int32_t max_spi_init(struct no_os_spi_desc **desc, const struct no_os_spi_init_param *param)
Initialize the SPI communication peripheral.
Definition: maxim_spi.c:380
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
SPI_MASTER_MODE
#define SPI_MASTER_MODE
Definition: maxim_spi.c:52
SPI_MASTER_MODE
#define SPI_MASTER_MODE
Definition: maxim_spi.c:52
maxim_spi.h
maxim specific header for SPI driver
no_os_dma_config_xfer
int no_os_dma_config_xfer(struct no_os_dma_desc *, struct no_os_dma_xfer_desc *, uint32_t, struct no_os_dma_ch *)
Acquire a channel and configure the list of transfers.
Definition: no_os_dma.c:242
max_spi_init_param::dma_param
struct no_os_dma_init_param * dma_param
Definition: maxim_spi.h:57
no_os_spi_msg::tx_buff
uint8_t * tx_buff
Definition: no_os_spi.h:102
no_os_spi_init_param::device_id
uint32_t device_id
Definition: no_os_spi.h:142
SPI_SINGLE_MODE
#define SPI_SINGLE_MODE
Definition: maxim_spi.c:53
maxim_spi.h
maxim specific header for SPI driver
max_spi_state::init_param
struct max_spi_init_param * init_param
Definition: maxim_spi.h:63
max_spi_init_param::dma_rx_priority
uint32_t dma_rx_priority
Definition: maxim_spi.h:58
no_os_spi_init_param::chip_select
uint8_t chip_select
Definition: no_os_spi.h:146
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:126
no_os_spi_desc::chip_select
uint8_t chip_select
Definition: no_os_spi.h:200
no_os_field_prep
uint32_t no_os_field_prep(uint32_t mask, uint32_t val)
max_dma_spi_xfer_data::spi
struct no_os_spi_desc * spi
Definition: maxim_spi.c:62
max_dma_spi_xfer_data::tx_ch
struct no_os_dma_ch * tx_ch
Definition: maxim_spi.c:63
max_spi_init_param
Maxim specific SPI initialization parameters.
Definition: maxim_spi.h:53
max_dma_spi_xfer_data::first_xfer_tx
struct no_os_dma_xfer_desc * first_xfer_tx
Definition: maxim_spi.c:67
max_dma_spi_xfer_data::first_xfer_rx
struct no_os_dma_xfer_desc * first_xfer_rx
Definition: maxim_spi.c:68
no_os_dma_ch
Describes the state of a DMA channel.
Definition: no_os_dma.h:107
no_os_spi_msg::rx_buff
uint8_t * rx_buff
Definition: no_os_spi.h:104
no_os_spi_msg::cs_delay_first
uint32_t cs_delay_first
Definition: no_os_spi.h:115
no_os_dma_xfer_desc::dst
uint8_t * dst
Definition: no_os_dma.h:75
no_os_spi_msg::cs_change
uint8_t cs_change
Definition: no_os_spi.h:108
max_dma_spi_xfer_data::cb
void(* cb)(void *)
Definition: maxim_spi.c:71
maxim_spi.h
maxim specific header for SPI driver
max_spi_ops
const struct no_os_spi_platform_ops max_spi_ops
maxim platform specific SPI platform ops structure
Definition: maxim_spi.c:795
no_os_spi_desc::bit_order
enum no_os_spi_bit_order bit_order
Definition: no_os_spi.h:204
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:192
no_os_dma_xfer_desc
It's used to setup a generic DMA transfer.
Definition: no_os_dma.h:71
max_spi_init_param::polarity
enum spi_ss_polarity polarity
Definition: maxim_spi.h:55
no_os_dma_init
int no_os_dma_init(struct no_os_dma_desc **, struct no_os_dma_init_param *)
Initialize the DMA controller.
Definition: no_os_dma.c:90
no_os_dma_xfer_start
int no_os_dma_xfer_start(struct no_os_dma_desc *, struct no_os_dma_ch *)
Acquire a channel and configure the list of transfers.
Definition: no_os_dma.c:356
SPI_SINGLE_MODE
#define SPI_SINGLE_MODE
Definition: maxim_spi.c:49
SPI_SINGLE_MODE
#define SPI_SINGLE_MODE
Definition: maxim_spi.c:48
SPI_SINGLE_MODE
#define SPI_SINGLE_MODE
Definition: maxim_spi.c:53
no_os_spi_msg::bytes_number
uint32_t bytes_number
Definition: no_os_spi.h:106
SPI_SINGLE_MODE
#define SPI_SINGLE_MODE
Definition: maxim_spi.c:53
no_os_spi_desc::extra
void * extra
Definition: no_os_spi.h:212
MAX_DELAY_SCLK
#define MAX_DELAY_SCLK
Definition: maxim_spi.c:51
MAX_DELAY_SCLK
#define MAX_DELAY_SCLK
Definition: maxim_spi.c:55
MAX_DELAY_SCLK
#define MAX_DELAY_SCLK
Definition: maxim_spi.c:55
max_spi_init_param::num_slaves
uint32_t num_slaves
Definition: maxim_spi.h:54
no_os_spi_init_param::max_speed_hz
uint32_t max_speed_hz
Definition: no_os_spi.h:144
maxim_spi.h
maxim specific header for SPI driver
spi_ss_polarity
spi_ss_polarity
Definition: maxim_spi.h:48
no_os_dma_xfer_desc::xfer_type
enum no_os_dma_xfer_type xfer_type
Definition: no_os_dma.h:79
NO_OS_BIT
#define NO_OS_BIT(x)
Definition: no_os_util.h:45
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
max_dma_spi_xfer_data
Definition: maxim_spi.c:61
max_spi_write_and_read
int32_t max_spi_write_and_read(struct no_os_spi_desc *desc, uint8_t *data, uint16_t bytes_number)
Write and read data to/from SPI.
Definition: maxim_spi.c:778
no_os_dma_release_channel
int no_os_dma_release_channel(struct no_os_dma_desc *, struct no_os_dma_ch *)
Free DMA channel.
Definition: no_os_dma.c:216
no_os_udelay
void no_os_udelay(uint32_t usecs)
Wait until usecs microseconds passed.
Definition: aducm3029_delay.c:114
NULL
#define NULL
Definition: wrapper.h:64
maxim_spi.h
maxim specific header for SPI driver
no_os_dma_xfer_desc::src
uint8_t * src
Definition: no_os_dma.h:73
max_spi_transfer
int32_t max_spi_transfer(struct no_os_spi_desc *desc, struct no_os_spi_msg *msgs, uint32_t len)
Write/read multiple messages to/from SPI.
Definition: maxim_spi.c:673
max_spi_ops
const struct no_os_spi_platform_ops max_spi_ops
maxim specific SPI platform ops structure
Definition: maxim_spi.c:795
no_os_platform_spi_delays::cs_delay_first
uint32_t cs_delay_first
Definition: no_os_spi.h:125
no_os_dma_xfer_abort
int no_os_dma_xfer_abort(struct no_os_dma_desc *, struct no_os_dma_ch *)
Abort the ongoing and any other future transfers scheduled for a channel.
Definition: no_os_dma.c:384
no_os_spi_desc::platform_delays
struct no_os_platform_spi_delays platform_delays
Definition: no_os_spi.h:210
true
@ true
Definition: ad5446.h:57
MEM_TO_DEV
@ MEM_TO_DEV
Definition: no_os_dma.h:51
max_spi_init_param::vssel
mxc_gpio_vssel_t vssel
Definition: maxim_spi.h:56
no_os_dma_is_completed
bool no_os_dma_is_completed(struct no_os_dma_desc *, struct no_os_dma_ch *)
Get the state of a DMA channel (free or not).
Definition: no_os_dma.c:417
no_os_spi_desc::max_speed_hz
uint32_t max_speed_hz
Definition: no_os_spi.h:198
NANO
#define NANO
Definition: no_os_units.h:50
spi
struct no_os_spi_desc * spi
Definition: main.c:72
no_os_dma_chan_unlock
int no_os_dma_chan_unlock(struct no_os_dma_ch *)
Unlock a DMA channel, marking it available for acquisition.
Definition: no_os_dma.c:336
no_os_util.h
Header file of utility functions.
max_dma_spi_xfer_data::ctx
void * ctx
Definition: maxim_spi.c:72
no_os_spi_platform_ops::init
int32_t(* init)(struct no_os_spi_desc **, const struct no_os_spi_init_param *)
Definition: no_os_spi.h:224
no_os_platform_spi_delays::cs_delay_last
uint32_t cs_delay_last
Definition: no_os_spi.h:126
no_os_spi_init_param::extra
void * extra
Definition: no_os_spi.h:158
max_spi_init_param::dma_tx_priority
uint32_t dma_tx_priority
Definition: maxim_spi.h:59
pr_warning
#define pr_warning(fmt, args...)
Definition: no_os_print_log.h:97
no_os_spi_desc::mode
enum no_os_spi_mode mode
Definition: no_os_spi.h:202
max_spi_state::cs_delay_first
uint32_t cs_delay_first
Definition: maxim_spi.h:64
maxim_spi.h
maxim specific header for SPI driver
maxim_dma.h
Maxim platform specific header DMA API.
max_spi_state::dma_req_rx
uint32_t dma_req_rx
Definition: maxim_spi.h:67
no_os_dma_xfer_desc::length
uint32_t length
Definition: no_os_dma.h:77
errno.h
Error macro definition for ARM Compiler.
NO_OS_DMA_IRQ
@ NO_OS_DMA_IRQ
Definition: no_os_irq.h:92
no_os_dma.h
Platform independent function definitions and data types for the DMA API.
NO_OS_DIV_ROUND_CLOSEST
#define NO_OS_DIV_ROUND_CLOSEST(x, y)
Definition: no_os_util.h:54
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140
no_os_dma_xfer_desc::periph
enum no_os_irq_peripheral periph
Definition: no_os_dma.h:97
no_os_dma_desc
Describes the state of the DMA controller.
Definition: no_os_dma.h:136
max_spi_remove
int32_t max_spi_remove(struct no_os_spi_desc *desc)
Free the resources allocated by no_os_spi_init().
Definition: maxim_spi.c:454