Trident IoT SDK
Loading...
Searching...
No Matches
T32CZ20_spi.h
Go to the documentation of this file.
1
16
17#ifndef T32CZ20_SPI_H_
18#define T32CZ20_SPI_H_
19
20#include "tr_hal_platform.h"
21
22
28
29
30#define TR_HAL_NUM_SPI 2
31
32// SPI IDs
33typedef enum
34{
37
39
75
76// this is used to set the SPI mode
77// this enum uses the same values as the chip registers (section 19.4)
85
86
87// used to set the data transfer amount - 8 bits or 32 bits
88// this enum uses the same values as the chip registers (section 19.4)
95
96
97// FIFO sizes - this is a chip limitation
98#define TR_HAL_SPI_TX_FIFO_SIZE 32
99#define TR_HAL_SPI_RX_FIFO_SIZE 32
100
101// for setting the peripheral clock
102#define SPI0_CLK_BIT 20
103#define SPI1_CLK_BIT 21
104#define SPI0_CLK_ENABLE_VALUE 0x100000
105#define SPI1_CLK_ENABLE_VALUE 0x200000
106
112
113#define SPI_INVALID_PIN 0xFF
114
115// TODO: pick defaults here, these were just picked to avoid LEDs and buttons
116#define DEFAULT_SPI_CLK_PIN 22
117#define DEFAULT_SPI_CS_PIN 23
118#define DEFAULT_SPI_IO_0_PIN 28
119#define DEFAULT_SPI_IO_1_PIN 29
120
121
133#ifdef QSPI0_SECURE_EN
134 #define CHIP_MEMORY_MAP_SPI0_BASE (0x50020000UL)
135#else
136 #define CHIP_MEMORY_MAP_SPI0_BASE (0x40020000UL)
137#endif //QSPI0_SECURE_EN
138
139#ifdef QSPI1_SECURE_EN
140 #define CHIP_MEMORY_MAP_SPI1_BASE (0x50021000UL)
141#else
142 #define CHIP_MEMORY_MAP_SPI1_BASE (0x40021000UL)
143#endif //QSPI1_SECURE_EN
144
145
146
150typedef struct
151{
152 // when sending data, write it here
153 __IO uint32_t spi_tx_data; // 0x00
154
155 // received data comes in from this register
156 __I uint32_t spi_rx_data; // 0x04
157
158 // configuration of SPI peripheral, incl Controller/Peripheral setting
159 __IO uint32_t spi_control; // 0x08
160 __IO uint32_t spi_aux_control; // 0x0C
161
162 // in Controller mode, configure the CS pins
163 __IO uint32_t peripheral_select; // 0x10
164
165 // this is used to change the Controller's clock to a different frequency
166 // normally it is 32 MHz, but this can bring it down to 16 Mhz, 8, 5.33, 4, etc
167 __IO uint32_t controller_clock_divider; // 0x14
168
169 // TODO: this is not documented, look into it
170 __IO uint32_t epd_function; // 0x18
171
172 // if running as SPI Controller: configure delay
173 __IO uint32_t controller_delay_setting; // 0x1C
174
175 // interrupt enable/status/clear
176 __IO uint32_t interrupt_enable; // 0x20
177 __I uint32_t interrupt_status; // 0x24
178 __IO uint32_t interrupt_clear; // 0x28
179
180 // enable and disable the SPI peripheral
181 __IO uint32_t spi_enable_disable; // 0x2C
182
183 // status of SPI peripheral
184 __I uint32_t spi_status; // 0x30
185
186 // can read the current levels of the TX and RX FIFOs
187 __I uint32_t tx_fifo_current_level; // 0x34
188 __I uint32_t rx_fifo_current_level; // 0x38
189
190 // reserved space
191 __I uint32_t reserved_1; // 0x3C
192
193 // setup for DMA receive
194 __IO uint32_t DMA_rx_buffer_addr; // 0x40
195 __IO uint32_t DMA_rx_buffer_len; // 0x44
196
197 // setup for DMA transmit
198 __IO uint32_t DMA_tx_buffer_addr; // 0x48
199 __IO uint32_t DMA_tx_buffer_len; // 0x4C
200
201 __I uint32_t DMA_rx_xfer_len_remaining; // 0x50
202 __I uint32_t DMA_tx_xfer_len_remaining; // 0x54
203
204 // using DMA - interrupt enable, status, and DMA RX start and DMA TX start
205 __IO uint32_t DMA_interrupt_enable; // 0x58
206 __IO uint32_t DMA_interrupt_status; // 0x5C
207 __IO uint32_t DMA_rx_enable; // 0x60
208 __IO uint32_t DMA_tx_enable; // 0x64
209
211
212
213// *****************************************************************
214// this orients the SPIx_REGISTERS struct with the correct addresses
215// so referencing a field will now read/write the correct SPI
216// register chip address
217#define SPI0_REGISTERS ((SPI_REGISTERS_T *) CHIP_MEMORY_MAP_SPI0_BASE)
218#define SPI1_REGISTERS ((SPI_REGISTERS_T *) CHIP_MEMORY_MAP_SPI1_BASE)
219
220// *****************************************************************
221// helper defines for SPI STATUS REGISTER (0x30)
222#define SPI_STATUS_TX_IN_PROGRESS 0x01
223#define SPI_STATUS_TX_FIFO_EMPTY 0x04
224#define SPI_STATUS_TX_FIFO_FULL 0x10
225#define SPI_STATUS_RX_FIFO_EMPTY 0x20
226#define SPI_STATUS_RX_FIFO_FULL 0x80
227
228
229// *****************************************************************
230// helper defines for SPI CONTROL REGISTER (0x08)
231
232// bit 0 = set=controller, clear=peripheral
233#define SPI_CONTROL_REG_SET_AS_CONTROLLER 0x01
234#define SPI_CONTROL_REG_SET_AS_PERIPHERAL 0x00
235// bit 1 = cpha (clock phase)
236#define SPI_CONTROL_REG_CPHA_HIGH 0x02
237#define SPI_CONTROL_REG_CPHA_LOW 0x00
238// bit 2 = cpol (clock polarity)
239#define SPI_CONTROL_REG_CPOL_HIGH 0x04
240#define SPI_CONTROL_REG_CPOL_LOW 0x00
241// bit 3 = sdata0or1, set to 0 for controller and 1 for peripheral
242#define SPI_CONTROL_REG_SDATA_FOR_CROSSED 0x08
243// bit 4 = byte swap
244#define SPI_CONTROL_REG_BYTE_SWAP 0x10
245// bit 5 = MSB first
246#define SPI_CONTROL_REG_MSB_FIRST 0x20
247// bit 6 = continuous transfer
248#define SPI_CONTROL_REG_CONTINUOUS_TRANSFER 0x40
249// bit 7 = reserved
250// bit 8 - pre delay enable
251#define SPI_CONTROL_PRE_DELAY_ENABLE 0x100
252// bit 9 - inter delay enable
253#define SPI_CONTROL_INTER_DELAY_ENABLE 0x200
254// bit 10 - post delay enable
255#define SPI_CONTROL_POST_DELAY_ENABLE 0x400
256// bit 14-15 = txf_th
257#define SPI_CONTROL_DMA_THRESHHOLD_4 0x0000
258#define SPI_CONTROL_DMA_THRESHHOLD_8 0x4000
259#define SPI_CONTROL_DMA_THRESHHOLD_16 0x8000
260#define SPI_CONTROL_DMA_THRESHHOLD_24 0xC000
261
262
263// *****************************************************************
264// helper defines for SPI AUX CONTROL REGISTER (0x0C)
265
266// bits 0,1 are SPI MODE
267#define SPI_AUX_CTRL_REG_MODE_MASK 0x03
268
269// bit 2 = setting this bit prevents transmitting
270#define SPI_AUX_CTRL_REG_PREVENT_TX_BIT 0x04
271
272// bit 3 = setting this bit prevents receiving
273// this can be useful to set when transmitting, so you don't receive
274// the bytes you just sent
275#define SPI_AUX_CTRL_REG_PREVENT_RX_BIT 0x08
276
277// bits 4,5,6 = bitsize
278#define SPI_AUX_CTRL_REG_BITSIZE_MASK 0x70
279
280// used to extend the transfer, like if using dual SPI mode and
281// wanting the Controller to be able to receive
282#define SPI_AUX_CTRL_REG_TRANSFER_EXTEND 0x80
283
284
285// *****************************************************************
286// helper defines for SPI INTERRUPT ENABLE REGISTER (0x20)
287// and SPI INTERRUPT STATUS REGISTER (0x24)
288// and SPI INTERRUPT CLEAR REGISTER (0x28)
289#define SPI_INTERRUPT_TX_EMPTY 0x01
290#define SPI_INTERRUPT_RX_FULL 0x08
291#define SPI_INTERRUPT_TRANSFER_DONE 0x10
292#define SPI_INTERRUPT_RX_NOT_EMPTY 0x20
293// all and none
294#define SPI_INTERRUPT_ALL 0x39
295#define SPI_INTERRUPT_NONE 0x00
296
297// *****************************************************************
298// helper defines for SPI PERIPHERAL SELECT REGISTER (0x10)
299// which CS line to select
300#define SPI_PERIPH_SELECT_NONE 0x00
301#define SPI_PERIPH_SELECT_0 0x01
302#define SPI_PERIPH_SELECT_1 0x02
303#define SPI_PERIPH_SELECT_2 0x04
304#define SPI_PERIPH_SELECT_3 0x08
305// polarity for CS lines
306#define SPI_PERIPH_SEL_0_ACTIVE_HIGH 0x100
307#define SPI_PERIPH_SEL_0_ACTIVE_LOW 0x000
308#define SPI_PERIPH_SEL_1_ACTIVE_HIGH 0x200
309#define SPI_PERIPH_SEL_1_ACTIVE_LOW 0x000
310#define SPI_PERIPH_SEL_2_ACTIVE_HIGH 0x400
311#define SPI_PERIPH_SEL_2_ACTIVE_LOW 0x000
312#define SPI_PERIPH_SEL_3_ACTIVE_HIGH 0x800
313#define SPI_PERIPH_SEL_3_ACTIVE_LOW 0x000
314// if CS is set for manual mode, this controls it
315#define SPI_PERIPH_SEL_0_SET_HIGH 0x10000
316#define SPI_PERIPH_SEL_0_SET_LOW 0x00000
317#define SPI_PERIPH_SEL_1_SET_HIGH 0x20000
318#define SPI_PERIPH_SEL_1_SET_LOW 0x00000
319#define SPI_PERIPH_SEL_2_SET_HIGH 0x40000
320#define SPI_PERIPH_SEL_2_SET_LOW 0x00000
321#define SPI_PERIPH_SEL_3_SET_HIGH 0x80000
322#define SPI_PERIPH_SEL_3_SET_LOW 0x00000
323// these set CS for manual mode
324#define SPI_PERIPH_SEL_0_MANUAL_MODE 0x1000000
325#define SPI_PERIPH_SEL_1_MANUAL_MODE 0x2000000
326#define SPI_PERIPH_SEL_2_MANUAL_MODE 0x4000000
327#define SPI_PERIPH_SEL_3_MANUAL_MODE 0x8000000
328
329
330
331// *****************************************************************
332// helper defines for SPI ENABLE DISABLE REGISTER (0x2C)
333#define SPI_ENABLE 0x01
334#define SPI_DISABLE 0x00
335
336// *****************************************************************
337// helper enums for SPI CONTROLLER CLOCK REGISTER (0x14)
338// note: this register has two fields that determine clock
339// the first field can be OFF (32 MHZ) or ON (bit 8 = 0x100 when set)
340// If ON then the 2nd field determines the clock by creating a divider
341// for the 32 MHz clock. It uses bits 0 to 7 (a full byte) to determine
342// the divider like this: ((setting +1) *2)
343// meaning 0 is 0 +1=1 *2 = 2 --> 32 MHz / 2 = 16 MHz
344// meaning 1 is 1 +1=2 *2 = 4 --> 32 MHz / 4 = 8 MHz
345// meaning 3 is 3 +1=4 *2 = 8 --> 32 MHz / 8 = 4 MHz
346// meaning 7 is 7 +1=8 *2 =16 --> 32 MHz / 16= 2 MHz
347// meaning 15 is 15 +1=16 *2 =32 --> 32 MHz / 32= 1 MHz
348// meaning 31 is 31 +1=32 *2 =64 --> 32 MHz / 64= 500 KHz
349// meaning 63 is 63 +1=64 *2 =128--> 32 MHz / 128= 250 KHz
350// meaning 127is 127+1=128*2 =256--> 32 MHz / 256= 125 KHz
351// etc
352// up to 0xFF = 255+1=256*2 = 512 --> 32 MHz / 512 = 1/16th MHz = 62.5 KHz
353//
354// these enums COMBINES the 2 fields so there is only one enum needed
355// to set each clock rate desired in the controller_clock_divider register.
356// This set of enums is NOT exhaustive (there would 256)
370
371
372// *****************************************************************
373// helper defines for SPI DMA INTERRUPT ENABLE REGISTER (0x58)
374#define SPI_DMA_INTERRUPTS_DISABLE 0x00
375#define SPI_DMA_RX_INTERRUPT_ENABLE 0x01
376#define SPI_DMA_TX_INTERRUPT_ENABLE 0x02
377
378// *****************************************************************
379// helper defines for SPI DMA INTERRUPT STATUS REGISTER (0x5C)
380#define SPI_DMA_RX_INTERRUPT_ACTIVE 0x01
381#define SPI_DMA_TX_INTERRUPT_ACTIVE 0x02
382
383// *****************************************************************
384// helper defines for DMA_rx_enable (0x60) and DMA_tx_enable(0x64) REGISTERs
385#define SPI_DMA_ENABLE 0x01
386#define SPI_DMA_DISABLE 0x00
387
388// if using DMA for RX we require a minimum for the buffer
389#define SPI_DMA_RX_BUFF_MINIMUM_SIZE 16
390
391
398
399
405#define TR_HAL_SPI_EVENT_TX_EMPTY 0x00000001
406#define TR_HAL_SPI_EVENT_RX_FULL 0x00000008
407#define TR_HAL_SPI_EVENT_RX_HAS_MORE_DATA 0x00000010
408#define TR_HAL_SPI_EVENT_TRANSFER_DONE 0x00000020
409#define TR_HAL_SPI_EVENT_RX_TO_USER_FX 0x00000040
410#define TR_HAL_SPI_EVENT_RX_READY 0x00000080
411#define TR_HAL_SPI_EVENT_DMA_RX_TO_USER_FX 0x00000100
412#define TR_HAL_SPI_EVENT_DMA_RX_READY 0x00000200
413#define TR_HAL_SPI_EVENT_DMA_TX_COMPLETE 0x00000400
414
415
419
420// prototype for callback from the Trident HAL to the app when a byte is received
421typedef void (*tr_hal_spi_receive_callback_t) (uint8_t num_received_bytes, uint8_t* byte_buffer);
422
423// prototype for callback from the Trident HAL to the app when an event happens
424typedef void (*tr_hal_spi_event_callback_t) (tr_hal_spi_id_t spi_id, uint32_t event_bitmask);
425
426
433typedef struct
434{
435 // **** high level settings ****
436
437 // true=SPI Controller, false=SPI Peripheral
438 // (maps to bit 5 in CONTROL register, and also controls bit 6)
439 bool run_as_controller;
440
441 // Normal SPI, Dual SPI, or Quad SPI
442 tr_hal_spi_mode_t spi_mode;
443
444
445 // **** pins used ****
446
447 // pins to use for the SPI
448 tr_hal_gpio_pin_t clock_pin;
449 // this is also known as SDO
450 tr_hal_gpio_pin_t io_0_pin;
451 // this is also known as SDI
452 tr_hal_gpio_pin_t io_1_pin;
453 // ony valid if spi_mode=TR_HAL_SPI_MODE_QUAD
454 tr_hal_gpio_pin_t io_2_pin;
455 tr_hal_gpio_pin_t io_3_pin;
456
457 // chip select - SPI0 can have up to 4
458 uint8_t num_chip_select_pins;
459 tr_hal_gpio_pin_t chip_select_0;
460 tr_hal_gpio_pin_t chip_select_1;
461 tr_hal_gpio_pin_t chip_select_2;
462 tr_hal_gpio_pin_t chip_select_3;
463
464 // C = SPI Controller, P = SPI Peripheral
465 // normally, SDO on C is wired to SDO on P, and SDI on C is wired to SDI on P
466 // but sometimes these pins are crossed. if the pins are crossed (SDO wired to SDI)
467 // then set this option to TRUE. This controls how the value of sdat0or1 in the
468 // control register is set. If sdo_sdi_pins_crossed=T and the device is a Peripheral
469 // then the sdat0or1 gets set to 1
470 bool sdo_sdi_pins_crossed;
471
472
473 // **** SPI Clock Settings ****
474
475 // NOTE: SPI mode 0 is most common, this is:
476 // CPOL = 0
477 // CPHA = 0
478
479 // (CPOL = CLOCK POLARITY) SPI clock rests high? (maps to bit 4 in CONTROL register)
480 // true=clock rests high, false=clock rests low
481 bool cpol_bit;
482
483 // (CPHA = CLOCK PHASE) first bit on SS (maps to bit 3 in CONTROL register)
484 // true=first TX bit as SS is asserted, false=first TX bit on first clk edge after SS
485 bool cpha_bit;
486
487 // for the Controller only: set the clock speed
488 tr_hal_spi_clock_rate_t controller_clock_rate;
489
490
491 // **** TX/RX settings ****
492
493 // bit size of TX and RX FIFO
494 tr_hal_spi_bit_size_t bit_size;
495
496 // if this is set to false (0) then chip select deasserts after each byte
497 // if this is set to true(1) then chip select STAYS asserted until all bytes are done
498 // most SPI devices getting multiple bytes will expect CS to remain asserted
499 // only matters when run_as_controller=true (maps to bit 0 in CONTROL register)
500 bool continuous_transfer;
501
502 // Byte swap in bitsize = 16/32 bit for TX/RX FIFO
503 bool byte_swap;
504
505 // (MSB/LSB) true=MSB, false=LSB (maps to bit 2 in CONTROL register)
506 bool most_significant_bit_first;
507
508 // do we enable inter transfer delays
509 // only matters when run_as_controller=true (maps to bit 11 in CONTROL register)
510 bool enable_inter_transfer_delay;
511
512 // if enable_inter_transfer_delay=T, this sets the delay
513 uint16_t delay_in_clock_cycles;
514
515
516 // **** DMA settings ****
517
518 bool rx_dma_enabled;
519 bool tx_dma_enabled;
520 // note: RX buffer must STAY allocated
521 uint8_t* rx_dma_buffer;
522 uint16_t rx_dma_buff_length;
523 // note: TX buffers are passed when transmitting
524
525
526 // **** non-DMA transmit ****
527
528 // if transmit is not done with DMA, then the app needs to allocate a
529 // transmit buffer and set a pointer to that transmit buffer here
530 uint8_t* raw_tx_buffer;
531 uint16_t raw_tx_buff_length;
532
533
534 // **** receive and event handler functions ****
535
536 // callback from HAL to App when a byte is received
537 // if the app doesn't want this, then set it to NULL
538 tr_hal_spi_receive_callback_t rx_handler_function;
539
540 // callback from HAL to App when an event happens
541 // if the app doesn't want this, then set it to NULL
542 tr_hal_spi_event_callback_t event_handler_fx;
543
544
545 // **** chip behavior settings ****
546
547
548 // are the chip interrupts enabled?
549 bool enable_chip_interrupts;
550
551 // set the INT priority
552 tr_hal_int_pri_t interrupt_priority;
553
554 // when the device is sleeping, we can choose to DISABLE interrupts,
555 // or leave them enabled which would allow the device to wake on
556 // an interrupt from this peripheral
557 bool wake_on_interrupt;
558
560
561
573
574
580#define SPI_CONFIG_CONTROLLER_NORMAL_MODE \
581 { \
582 .run_as_controller = true, \
583 .spi_mode = TR_HAL_SPI_MODE_NORMAL, \
584 .clock_pin = (tr_hal_gpio_pin_t) { DEFAULT_SPI_CLK_PIN }, \
585 .io_0_pin = (tr_hal_gpio_pin_t) { DEFAULT_SPI_IO_0_PIN }, \
586 .io_1_pin = (tr_hal_gpio_pin_t) { DEFAULT_SPI_IO_1_PIN }, \
587 .io_2_pin = (tr_hal_gpio_pin_t) { SPI_INVALID_PIN }, \
588 .io_3_pin = (tr_hal_gpio_pin_t) { SPI_INVALID_PIN }, \
589 .num_chip_select_pins = 1, \
590 .chip_select_0 = (tr_hal_gpio_pin_t) { DEFAULT_SPI_CS_PIN },\
591 .chip_select_1 = (tr_hal_gpio_pin_t) { SPI_INVALID_PIN }, \
592 .chip_select_2 = (tr_hal_gpio_pin_t) { SPI_INVALID_PIN }, \
593 .chip_select_3 = (tr_hal_gpio_pin_t) { SPI_INVALID_PIN }, \
594 .sdo_sdi_pins_crossed = false, \
595 .cpol_bit = false, \
596 .cpha_bit = false, \
597 .controller_clock_rate = SPI_CTRL_CLOCK_1_MHZ, \
598 .bit_size = TR_HAL_SPI_BIT_SIZE_8, \
599 .continuous_transfer = true, \
600 .byte_swap = false, \
601 .most_significant_bit_first = true, \
602 .enable_inter_transfer_delay = false, \
603 .delay_in_clock_cycles = 0, \
604 .rx_dma_enabled = false, \
605 .tx_dma_enabled = false, \
606 .rx_dma_buffer = NULL, \
607 .rx_dma_buff_length = 0, \
608 .raw_tx_buffer = NULL, \
609 .raw_tx_buff_length = 0, \
610 .rx_handler_function = NULL, \
611 .event_handler_fx = NULL, \
612 .enable_chip_interrupts = true, \
613 .interrupt_priority = TR_HAL_INTERRUPT_PRIORITY_5, \
614 .wake_on_interrupt = false, \
615 }
616
617
622
623// SPI power on/off - these are called from init and uninit - the app should not need to call these
625
627
628
633
634// function for setting the pins for a standard SPI
635// this also checks that the pin choices are VALID for that particular SPI
637 bool is_controller,
638 tr_hal_gpio_pin_t clk_pin,
639 tr_hal_gpio_pin_t chip_select_0_pin,
640 tr_hal_gpio_pin_t sdo_pin,
641 tr_hal_gpio_pin_t sdi_pin);
642
643// *** Quad SPI mode is not currently supported ***
644// function for setting the pins for a quad SPI which requires 2 more pins
645// this also checks that the pin choices are VALID for that particular SPI
653
654// function for setting additional chip select pins beyond the 1 already set
655// either tr_hal_spi_set_standard_pins or ..set_quad_pins needs to have been called
656// this also checks that the pin choices are VALID for that particular SPI
658 uint8_t num_chip_select,
659 tr_hal_gpio_pin_t chip_select_1_pin,
660 tr_hal_gpio_pin_t chip_select_2_pin,
661 tr_hal_gpio_pin_t chip_select_3_pin);
662
663
670 uint32_t* transmit_started,
671 uint32_t* transmit_completed,
672 uint32_t* bytes_received);
673
675
676
678// *** these APIs are experimental and have not been proven to work ***
679// for sending using DUAL mode. start enables contXfer and sets it for dual mode
680// stop puts mode and contXfer back. These modifications happen to the AUX CTRL
681// register
685
686
690
691
692#endif // T32CZ20_SPI_H_
tr_hal_int_pri_t
values and a range checking function for setting the interrupt priority in the Trident HAL APIs
Definition tr_hal_platform.h:34
This file contains the CHIP SPECIFIC types and defines for the T32CZ20.
tr_hal_status_t
Definition tr_hal_common.h:25
tr_hal_spi_bit_size_t
Definition T32CM11_spi.h:89
void(* tr_hal_spi_receive_callback_t)(uint8_t num_received_bytes, uint8_t *byte_buffer)
Definition T32CM11_spi.h:471
tr_hal_spi_mode_t
Normal SPI vs Dual SPI vs Quad SPI modes.
Definition T32CM11_spi.h:78
tr_hal_spi_id_t
Definition T32CM11_spi.h:33
void(* tr_hal_spi_event_callback_t)(tr_hal_spi_id_t spi_id, uint32_t event_bitmask)
Definition T32CM11_spi.h:474
tr_hal_spi_clock_rate_t
Definition T32CM11_spi.h:406
@ TR_HAL_SPI_BIT_SIZE_32
Definition T32CM11_spi.h:91
@ TR_HAL_SPI_BIT_SIZE_8
Definition T32CM11_spi.h:90
@ TR_HAL_SPI_MODE_NORMAL
Definition T32CM11_spi.h:79
@ TR_HAL_SPI_MODE_DUAL
Definition T32CM11_spi.h:80
@ TR_HAL_SPI_MODE_QUAD
Definition T32CM11_spi.h:81
@ SPI_1_ID
Definition T32CM11_spi.h:35
@ SPI_0_ID
Definition T32CM11_spi.h:34
@ SPI_CTRL_CLOCK_250_KHZ
Definition T32CM11_spi.h:414
@ SPI_CTRL_CLOCK_32_MHZ
Definition T32CM11_spi.h:407
@ SPI_CTRL_CLOCK_16_MHZ
Definition T32CM11_spi.h:408
@ SPI_CTRL_CLOCK_125_KHZ
Definition T32CM11_spi.h:415
@ SPI_CTRL_CLOCK_4_MHZ
Definition T32CM11_spi.h:410
@ SPI_CTRL_CLOCK_8_MHZ
Definition T32CM11_spi.h:409
@ SPI_CTRL_CLOCK_500_KHZ
Definition T32CM11_spi.h:413
@ SPI_CTRL_CLOCK_2_MHZ
Definition T32CM11_spi.h:411
@ SPI_CTRL_CLOCK_1_MHZ
Definition T32CM11_spi.h:412
tr_hal_status_t tr_hal_spi_clear_tx_busy(tr_hal_spi_id_t spi_id)
tr_hal_status_t tr_hal_spi_read_stats(tr_hal_spi_id_t spi_id, uint32_t *transmit_started, uint32_t *transmit_completed, uint32_t *bytes_received)
tr_hal_status_t tr_hal_spi_power_off(tr_hal_spi_id_t spi_id)
tr_hal_status_t tr_hal_spi_power_on(tr_hal_spi_id_t spi_id)
SPI_REGISTERS_T * tr_hal_spi_get_register_address(tr_hal_spi_id_t spi_id)
tr_hal_status_t tr_hal_spi_set_standard_pins(tr_hal_spi_id_t spi_id, bool is_controller, tr_hal_gpio_pin_t clk_pin, tr_hal_gpio_pin_t chip_select_0_pin, tr_hal_gpio_pin_t sdo_pin, tr_hal_gpio_pin_t sdi_pin)
tr_hal_status_t tr_hal_spi_set_addl_cs_pins(tr_hal_spi_id_t spi_id, uint8_t num_chip_select, tr_hal_gpio_pin_t chip_select_1_pin, tr_hal_gpio_pin_t chip_select_2_pin, tr_hal_gpio_pin_t chip_select_3_pin)
the struct we use so we can address registers using field names
Definition T32CM11_spi.h:224
__IO uint32_t DMA_tx_buffer_addr
Definition T32CM11_spi.h:270
__IO uint32_t DMA_rx_buffer_len
Definition T32CM11_spi.h:267
__I uint32_t tx_fifo_current_level
Definition T32CM11_spi.h:249
__IO uint32_t DMA_interrupt_enable
Definition T32CM11_spi.h:277
__IO uint32_t epd_function
Definition T32CZ20_spi.h:170
__I uint32_t rx_fifo_current_level
Definition T32CM11_spi.h:250
__I uint32_t spi_status
Definition T32CM11_spi.h:237
__IO uint32_t DMA_rx_buffer_addr
Definition T32CM11_spi.h:266
__I uint32_t interrupt_status
Definition T32CM11_spi.h:245
__IO uint32_t DMA_interrupt_status
Definition T32CM11_spi.h:278
__IO uint32_t interrupt_enable
Definition T32CM11_spi.h:244
__IO uint32_t DMA_tx_buffer_len
Definition T32CM11_spi.h:271
__I uint32_t reserved_1
Definition T32CZ20_spi.h:191
__IO uint32_t DMA_rx_enable
Definition T32CM11_spi.h:279
__IO int32_t interrupt_clear
Definition T32CM11_spi.h:246
__IO uint32_t spi_enable_disable
Definition T32CM11_spi.h:257
__IO uint32_t controller_delay_setting
Definition T32CM11_spi.h:254
__I uint32_t DMA_rx_xfer_len_remaining
Definition T32CM11_spi.h:273
__IO uint32_t DMA_tx_enable
Definition T32CM11_spi.h:280
__I uint32_t DMA_tx_xfer_len_remaining
Definition T32CM11_spi.h:274
pin type
Definition tr_hal_platform.h:23
Definition T32CM11_spi.h:484