Trident IoT SDK
 
Loading...
Searching...
No Matches
T32CM11_spi.h
Go to the documentation of this file.
1
16
17#ifndef T32CM11_SPI_H_
18#define T32CM11_SPI_H_
19
20#include "tr_hal_platform.h"
21
27
28
29#define TR_HAL_NUM_SPI 2
30
31// SPI IDs
32typedef enum
33{
36
38
74
75// this is used to set the SPI mode
76// this enum uses the same values as the chip registers (section 7.4.4)
84
85
86// used to set the data transfer amount - 8 bits or 32 bits
87// this enum uses the same values as the chip registers (section 7.4.4)
94
95// used to set the RX high watermark
96// this enum uses the same values as the chip registers (section 7.4.3)
104
105// used to set the TX high watermark
106// this enum uses the same values as the chip registers (section 7.4.3)
114
115// FIFO sizes - this is a chip limitation
116#define TR_HAL_SPI_TX_FIFO_SIZE 32
117#define TR_HAL_SPI_RX_FIFO_SIZE 32
118
119// for setting the peripheral clock
120#define SPI0_CLK_BIT 20
121#define SPI1_CLK_BIT 21
122#define SPI0_CLK_ENABLE_VALUE 0x100000
123#define SPI1_CLK_ENABLE_VALUE 0x200000
124
144
145#define SPI_INVALID_PIN 0xFF
146
147// SPI0 clock
148#define SPI0_CLK_PIN_OPTION1 6
149#define SPI0_CLK_PIN_OPTION2 28
150// SPI0 SDO == IO0
151#define SPI0_IO0_PIN_OPTION1 8
152#define SPI0_IO0_PIN_OPTION2 30
153// SPI0 SDI == IO1
154#define SPI0_IO1_PIN_OPTION1 9
155#define SPI0_IO1_PIN_OPTION2 31
156// SPI0 IO2
157#define SPI0_IO2_PIN_OPTION1 4
158#define SPI0_IO2_PIN_OPTION2 14
159// SPI0 IO3
160#define SPI0_IO3_PIN_OPTION1 5
161#define SPI0_IO3_PIN_OPTION2 15
162// SPI0 chip select0
163#define SPI0_MAX_CHIP_SELECT_PINS 4
164#define SPI0_CS0_PIN_OPTION1 7
165#define SPI0_CS0_PIN_OPTION2 29
166// SPI0 chip select1
167#define SPI0_CS1_PIN_OPTION1 1
168#define SPI0_CS1_PIN_OPTION2 2
169#define SPI0_CS1_PIN_OPTION3 3
170#define SPI0_CS1_PIN_OPTION4 4
171// SPI0 chip select2
172#define SPI0_CS2_PIN_OPTION1 1
173#define SPI0_CS2_PIN_OPTION2 2
174#define SPI0_CS2_PIN_OPTION3 3
175#define SPI0_CS2_PIN_OPTION4 4
176// SPI0 chip select3
177#define SPI0_CS3_PIN_OPTION1 1
178#define SPI0_CS3_PIN_OPTION2 2
179#define SPI0_CS3_PIN_OPTION3 3
180#define SPI0_CS3_PIN_OPTION4 4
181
182
195
196// SPI1 clock
197#define SPI1_CLK_PIN_OPTION1 28
198// SPI1 SDO == IO0
199#define SPI1_IO0_PIN_OPTION1 30
200// SPI1 SDI == IO1
201#define SPI1_IO1_PIN_OPTION1 31
202// SPI1 chip select
203#define SPI1_MAX_CHIP_SELECT_PINS 1
204#define SPI1_CS0_PIN_OPTION1 29
205
206
216#define CHIP_MEMORY_MAP_SPI0_BASE (0xB0000000UL)
217#define CHIP_MEMORY_MAP_SPI1_BASE (0x80000000UL)
218
219
223typedef struct
224{
225 // when sending data, write it here
226 __IO uint32_t spi_tx_data; // 0x00
227
228 // received data comes in from this register
229 __I uint32_t spi_rx_data; // 0x04
230 __I uint32_t reserved1; // 0x08
231
232 // configuration of SPI peripheral, incl Controller/Peripheral setting
233 __IO uint32_t spi_control; // 0x0C
234 __IO uint32_t spi_aux_control; // 0x10
235
236 // status of SPI peripheral
237 __I uint32_t spi_status; // 0x14
238
239 // peripheral select and polarity (only when running as SPI Controller)
240 __IO uint32_t peripheral_select; // 0x18
241 __IO uint32_t peripheral_select_polarity; // 0x1C
242
243 // interrupt enable/status/clear
244 __IO uint32_t interrupt_enable; // 0x20
245 __I uint32_t interrupt_status; // 0x24
246 __IO int32_t interrupt_clear; // 0x28
247
248 // can read the current levels of the TX and RX FIFOs
249 __I uint32_t tx_fifo_current_level; // 0x2C
250 __I uint32_t rx_fifo_current_level; // 0x30
251 __I uint32_t reserved2; // 0x34
252
253 // if running as SPI Controller: this sets the inter-transfer delay
254 __IO uint32_t controller_delay_setting; // 0x38
255
256 // enable and disable the SPI peripheral
257 __IO uint32_t spi_enable_disable; // 0x3C
258 __IO uint32_t reserved3[4]; // 0x40, 0x44, 0x48, 0x4C
259
260 // this is used to change the Controller's clock to a different frequency
261 // normally it is 32 MHz, but this can bring it down to 16 Mhz, 8, 5.33, 4, etc
262 __IO uint32_t controller_clock_divider; // 0x50
263 __IO uint32_t reserved4[3]; // 0x54, 0x58, 0x5C
264
265 // setup for DMA receive
266 __IO uint32_t DMA_rx_buffer_addr; // 0x60
267 __IO uint32_t DMA_rx_buffer_len; // 0x64
268
269 // setup for DMA transmit
270 __IO uint32_t DMA_tx_buffer_addr; // 0x68
271 __IO uint32_t DMA_tx_buffer_len; // 0x6C
272
273 __I uint32_t DMA_rx_xfer_len_remaining; // 0x70
274 __I uint32_t DMA_tx_xfer_len_remaining; // 0x74
275
276 // using DMA - interrupt enable, status, and DMA RX start and DMA TX start
277 __IO uint32_t DMA_interrupt_enable; // 0x78
278 __IO uint32_t DMA_interrupt_status; // 0x7C
279 __IO uint32_t DMA_rx_enable; // 0x80
280 __IO uint32_t DMA_tx_enable; // 0x84
281
283
284
285// *****************************************************************
286// this orients the SPIx_REGISTERS struct with the correct addresses
287// so referencing a field will now read/write the correct SPI
288// register chip address
289#define SPI0_REGISTERS ((SPI_REGISTERS_T *) CHIP_MEMORY_MAP_SPI0_BASE)
290#define SPI1_REGISTERS ((SPI_REGISTERS_T *) CHIP_MEMORY_MAP_SPI1_BASE)
291
292// *****************************************************************
293// helper defines for SPI STATUS REGISTER (0x14)
294#define SPI_STATUS_TX_IN_PROGRESS 0x01
295#define SPI_STATUS_TX_FIFO_EMPTY 0x04
296#define SPI_STATUS_TX_FIFO_WMARK 0x08
297#define SPI_STATUS_TX_FIFO_FULL 0x10
298#define SPI_STATUS_RX_FIFO_EMPTY 0x20
299#define SPI_STATUS_RX_FIFO_WMARK 0x40
300#define SPI_STATUS_RX_FIFO_FULL 0x80
301
302
303// *****************************************************************
304// helper defines for SPI CONTROL REGISTER (0x0C)
305
306// bit 0 = continuous transfer
307#define SPI_CONTROL_REG_CONTINUOUS_TRANSFER 0x01
308// bit 1 = byte swap
309#define SPI_CONTROL_REG_BYTE_SWAP 0x02
310// bit 2 = MSB first
311#define SPI_CONTROL_REG_MSB_FIRST 0x04
312// bit 3 = cpha (clock phase)
313#define SPI_CONTROL_REG_CPHA_HIGH 0x08
314#define SPI_CONTROL_REG_CPHA_LOW 0x00
315// bit 4 = cpol (clock polarity)
316#define SPI_CONTROL_REG_CPOL_HIGH 0x10
317#define SPI_CONTROL_REG_CPOL_LOW 0x00
318// bit 5 = set=controller, clear=peripheral
319#define SPI_CONTROL_REG_SET_AS_CONTROLLER 0x20
320#define SPI_CONTROL_REG_SET_AS_PERIPHERAL 0x00
321// bit 6 = sdata0or1, set to 0 for controller and 1 for peripheral
322#define SPI_CONTROL_REG_SDATA_FOR_CROSSED 0x40
323// bit 11 = enable controller delay
324#define SPI_CONTROL_REG_ENABLE_CONTROLLER_DELAY 0x800
325// bit 12-13 = receive watermark
326#define SPI_CONTROL_REG_RX_WMARK_MASK 0x3000
327// bit 14-15 = transmit watermark
328#define SPI_CONTROL_REG_TX_WMARK_MASK 0xC000
329
330// *****************************************************************
331// helper defines for SPI AUX CONTROL REGISTER (0x10)
332
333// bits 0,1 are SPI MODE
334#define SPI_AUX_CTRL_REG_MODE_MASK 0x03
335
336// bit 2 = setting this bit prevents transmitting
337#define SPI_AUX_CTRL_REG_PREVENT_TX_BIT 0x04
338
339// bit 3 = setting this bit prevents receiving
340// this can be useful to set when transmitting, so you don't receive
341// the bytes you just sent
342#define SPI_AUX_CTRL_REG_PREVENT_RX_BIT 0x08
343
344// bits 4,5,6 = bitsize
345#define SPI_AUX_CTRL_REG_BITSIZE_MASK 0x70
346
347// used to extend the transfer, like if using dual SPI mode and
348// wanting the Controller to be able to receive
349#define SPI_AUX_CTRL_REG_TRANSFER_EXTEND 0x80
350
351
352// *****************************************************************
353// helper defines for SPI INTERRUPT ENABLE REGISTER (0x20)
354// and SPI INTERRUPT STATUS REGISTER (0x24)
355// and SPI INTERRUPT CLEAR REGISTER (0x28)
356#define SPI_INTERRUPT_TX_EMPTY 0x01
357#define SPI_INTERRUPT_TX_WATERMARK 0x02
358#define SPI_INTERRUPT_RX_WATERMARK 0x04
359#define SPI_INTERRUPT_RX_FULL 0x08
360#define SPI_INTERRUPT_TRANSFER_DONE 0x10
361#define SPI_INTERRUPT_RX_NOT_EMPTY 0x20
362// all and none
363#define SPI_INTERRUPT_ALL 0x3F
364#define SPI_INTERRUPT_NONE 0x00
365
366// *****************************************************************
367// helper defines for SPI PERIPHERAL SELECT REGISTER (0x18)
368#define SPI_PERIPH_SELECT_NONE 0x00
369#define SPI_PERIPH_SELECT_0 0x01
370#define SPI_PERIPH_SELECT_1 0x02
371#define SPI_PERIPH_SELECT_2 0x04
372#define SPI_PERIPH_SELECT_3 0x08
373
374// *****************************************************************
375// helper defines for SPI PERIPHERAL POLARITY REGISTER (0x1C)
376#define SPI_PERIPH_SELECT_CONTROLLER_ACTIVE_LOW 0x00
377#define SPI_PERIPH_SELECT_CONTROLLER_ACTIVE_HIGH 0x0F
378
379// *****************************************************************
380// helper defines for SPI ENABLE DISABLE REGISTER (0x3C)
381#define SPI_ENABLE 0x01
382#define SPI_DISABLE 0x00
383
384// *****************************************************************
385// helper enums for SPI CONTROLLER CLOCK REGISTER (0x50)
386// note: this register has two fields that determine clock
387// the first field can be OFF (32 MHZ) or ON (bit 8 = 0x100 when set)
388// If ON then the 2nd field determines the clock by creating a divider
389// for the 32 MHz clock. It uses bits 0 to 7 (a full byte) to determine
390// the divider like this: ((setting +1) *2)
391// meaning 0 is 0 +1=1 *2 = 2 --> 32 MHz / 2 = 16 MHz
392// meaning 1 is 1 +1=2 *2 = 4 --> 32 MHz / 4 = 8 MHz
393// meaning 3 is 3 +1=4 *2 = 8 --> 32 MHz / 8 = 4 MHz
394// meaning 7 is 7 +1=8 *2 =16 --> 32 MHz / 16= 2 MHz
395// meaning 15 is 15 +1=16 *2 =32 --> 32 MHz / 32= 1 MHz
396// meaning 31 is 31 +1=32 *2 =64 --> 32 MHz / 64= 500 KHz
397// meaning 63 is 63 +1=64 *2 =128--> 32 MHz / 128= 250 KHz
398// meaning 127is 127+1=128*2 =256--> 32 MHz / 256= 125 KHz
399// etc
400// up to 0xFF = 255+1=256*2 = 512 --> 32 MHz / 512 = 1/16th MHz = 62.5 KHz
401//
402// these enums COMBINES the 2 fields so there is only one enum needed
403// to set each clock rate desired in the controller_clock_divider register.
404// This set of enums is NOT exhaustive (there would 256)
418
419
420// *****************************************************************
421// helper defines for SPI DMA INTERRUPT ENABLE REGISTER (0x78)
422#define SPI_DMA_INTERRUPTS_DISABLE 0x00
423#define SPI_DMA_RX_INTERRUPT_ENABLE 0x01
424#define SPI_DMA_TX_INTERRUPT_ENABLE 0x02
425
426// *****************************************************************
427// helper defines for SPI DMA INTERRUPT STATUS REGISTER (0x78)
428#define SPI_DMA_RX_INTERRUPT_ACTIVE 0x01
429#define SPI_DMA_TX_INTERRUPT_ACTIVE 0x02
430
431// *****************************************************************
432// helper defines for DMA_rx_enable (0x80) and DMA_tx_enable(0x84) REGISTERs
433#define SPI_DMA_ENABLE 0x01
434#define SPI_DMA_DISABLE 0x00
435
436// if using DMA for RX we require a minimum for the buffer
437#define SPI_DMA_RX_BUFF_MINIMUM_SIZE 16
438
439
446
447
453#define TR_HAL_SPI_EVENT_TX_EMPTY 0x00000001
454#define TR_HAL_SPI_EVENT_TX_WMARK 0x00000002
455#define TR_HAL_SPI_EVENT_RX_WMARK 0x00000004
456#define TR_HAL_SPI_EVENT_RX_FULL 0x00000008
457#define TR_HAL_SPI_EVENT_RX_HAS_MORE_DATA 0x00000010
458#define TR_HAL_SPI_EVENT_TRANSFER_DONE 0x00000020
459#define TR_HAL_SPI_EVENT_RX_TO_USER_FX 0x00000040
460#define TR_HAL_SPI_EVENT_RX_READY 0x00000080
461#define TR_HAL_SPI_EVENT_DMA_RX_TO_USER_FX 0x00000100
462#define TR_HAL_SPI_EVENT_DMA_RX_READY 0x00000200
463#define TR_HAL_SPI_EVENT_DMA_TX_COMPLETE 0x00000400
464
465
469
470// prototype for callback from the Trident HAL to the app when a byte is received
471typedef void (*tr_hal_spi_receive_callback_t) (uint8_t num_received_bytes, uint8_t* byte_buffer);
472
473// prototype for callback from the Trident HAL to the app when an event happens
474typedef void (*tr_hal_spi_event_callback_t) (tr_hal_spi_id_t spi_id, uint32_t event_bitmask);
475
476
483typedef struct
484{
485 // **** high level settings ****
486
487 // true=SPI Controller, false=SPI Peripheral
488 // (maps to bit 5 in CONTROL register, and also controls bit 6)
490
491 // Normal SPI, Dual SPI, or Quad SPI
493
494
495 // **** pins used ****
496
497 // pins to use for the SPI
499 // this is also known as SDO
501 // this is also known as SDI
503 // ony valid if spi_mode=TR_HAL_SPI_MODE_QUAD
506
507 // chip select - SPI0 can have up to 4
513
514 // C = SPI Controller, P = SPI Peripheral
515 // normally, SDO on C is wired to SDO on P, and SDI on C is wired to SDI on P
516 // but sometimes these pins are crossed. if the pins are crossed (SDO wired to SDI)
517 // then set this option to TRUE. This controls how the value of sdat0or1 in the
518 // control register is set. If sdo_sdi_pins_crossed=T and the device is a Peripheral
519 // then the sdat0or1 gets set to 1
521
522
523 // **** SPI Clock Settings ****
524
525 // NOTE: SPI mode 0 is most common, this is:
526 // CPOL = 0
527 // CPHA = 0
528
529 // (CPOL = CLOCK POLARITY) SPI clock rests high? (maps to bit 4 in CONTROL register)
530 // true=clock rests high, false=clock rests low
532
533 // (CPHA = CLOCK PHASE) first bit on SS (maps to bit 3 in CONTROL register)
534 // true=first TX bit as SS is asserted, false=first TX bit on first clk edge after SS
536
537 // for the Controller only: set the clock speed
539
540
541 // **** TX/RX settings ****
542
543 // bit size of TX and RX FIFO
545
546 // if this is set to false (0) then chip select deasserts after each byte
547 // if this is set to true(1) then chip select STAYS asserted until all bytes are done
548 // most SPI devices getting multiple bytes will expect CS to remain asserted
549 // only matters when run_as_controller=true (maps to bit 0 in CONTROL register)
551
552 // Byte swap in bitsize = 16/32 bit for TX/RX FIFO
554
555 // (MSB/LSB) true=MSB, false=LSB (maps to bit 2 in CONTROL register)
557
558 // do we enable inter transfer delays
559 // only matters when run_as_controller=true (maps to bit 11 in CONTROL register)
561
562 // if enable_inter_transfer_delay=T, this sets the delay
564
565
566 // **** DMA settings ****
567
570 // note: RX buffer must STAY allocated
573 // note: TX buffers are passed when transmitting
574
575
576 // **** non-DMA transmit ****
577
578 // if transmit is not done with DMA, then the app needs to allocate a
579 // transmit buffer and set a pointer to that transmit buffer here
582
583
584 // **** receive and event handler functions ****
585
586 // callback from HAL to App when a byte is received
587 // if the app doesn't want this, then set it to NULL
589
590 // callback from HAL to App when an event happens
591 // if the app doesn't want this, then set it to NULL
593
594
595 // **** chip behavior settings ****
596
597
598 // are the chip interrupts enabled?
600
601 // set the INT priority
603
604 // when the device is sleeping, we can choose to DISABLE interrupts,
605 // or leave them enabled which would allow the device to wake on
606 // an interrupt from this peripheral
608
609 // watermark
612
614
615
627
633#define SPI_CONFIG_CONTROLLER_NORMAL_MODE \
634 { \
635 .run_as_controller = true, \
636 .spi_mode = TR_HAL_SPI_MODE_NORMAL, \
637 .clock_pin = (tr_hal_gpio_pin_t) { SPI0_CLK_PIN_OPTION1 }, \
638 .io_0_pin = (tr_hal_gpio_pin_t) { SPI0_IO0_PIN_OPTION1 }, \
639 .io_1_pin = (tr_hal_gpio_pin_t) { SPI0_IO1_PIN_OPTION1 }, \
640 .io_2_pin = (tr_hal_gpio_pin_t) { SPI_INVALID_PIN }, \
641 .io_3_pin = (tr_hal_gpio_pin_t) { SPI_INVALID_PIN }, \
642 .num_chip_select_pins = 1, \
643 .chip_select_0 = (tr_hal_gpio_pin_t) { SPI0_CS0_PIN_OPTION1 },\
644 .chip_select_1 = (tr_hal_gpio_pin_t) { SPI_INVALID_PIN }, \
645 .chip_select_2 = (tr_hal_gpio_pin_t) { SPI_INVALID_PIN }, \
646 .chip_select_3 = (tr_hal_gpio_pin_t) { SPI_INVALID_PIN }, \
647 .sdo_sdi_pins_crossed = false, \
648 .cpol_bit = false, \
649 .cpha_bit = false, \
650 .controller_clock_rate = SPI_CTRL_CLOCK_1_MHZ, \
651 .bit_size = TR_HAL_SPI_BIT_SIZE_8, \
652 .continuous_transfer = true, \
653 .byte_swap = false, \
654 .most_significant_bit_first = true, \
655 .enable_inter_transfer_delay = false, \
656 .delay_in_clock_cycles = 0, \
657 .rx_dma_enabled = false, \
658 .tx_dma_enabled = false, \
659 .rx_dma_buffer = NULL, \
660 .rx_dma_buff_length = 0, \
661 .raw_tx_buffer = NULL, \
662 .raw_tx_buff_length = 0, \
663 .rx_handler_function = NULL, \
664 .event_handler_fx = NULL, \
665 .enable_chip_interrupts = true, \
666 .interrupt_priority = TR_HAL_INTERRUPT_PRIORITY_5, \
667 .wake_on_interrupt = false, \
668 .transmit_watermark = TR_HAL_SPI_TX_WATERMARK_LEVEL_8, \
669 .receive_watermark = TR_HAL_SPI_RX_WATERMARK_LEVEL_8, \
670 }
671
672
677
678// SPI power on/off - these are called from init and uninit - the app should not need to call these
680
682
683
688
689// function for setting the pins for a standard SPI
690// this also checks that the pin choices are VALID for that particular SPI
692 tr_hal_gpio_pin_t clk_pin,
693 tr_hal_gpio_pin_t chip_select_0_pin,
694 tr_hal_gpio_pin_t sdo_pin,
695 tr_hal_gpio_pin_t sdi_pin);
696
697// *** Quad SPI mode is not currently supported ***
698// function for setting the pins for a quad SPI which requires 2 more pins
699// this also checks that the pin choices are VALID for that particular SPI
707
708// function for setting additional chip select pins beyond the 1 already set
709// either tr_hal_spi_set_standard_pins or ..set_quad_pins needs to have been called
710// this also checks that the pin choices are VALID for that particular SPI
712 uint8_t num_chip_select,
713 tr_hal_gpio_pin_t chip_select_1_pin,
714 tr_hal_gpio_pin_t chip_select_2_pin,
715 tr_hal_gpio_pin_t chip_select_3_pin);
716
717
724 uint32_t* transmit_started,
725 uint32_t* transmit_completed,
726 uint32_t* bytes_received);
727
729
730
732// *** these APIs are experimental and have not been proven to work ***
733// for sending using DUAL mode. start enables contXfer and sets it for dual mode
734// stop puts mode and contXfer back. These modifications happen to the AUX CTRL
735// register
739
740
744
745
746#endif // T32CM11_SPI_H_
This file contains the CHIP SPECIFIC types and defines for the T32CM11.
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
tr_hal_status_t
Definition tr_hal_common.h:25
tr_hal_status_t tr_hal_spi_clear_tx_busy(tr_hal_spi_id_t spi_id)
tr_hal_spi_bit_size_t
Definition T32CM11_spi.h:89
tr_hal_status_t tr_hal_spi_set_standard_pins(tr_hal_spi_id_t spi_id, 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_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)
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_tx_watermark_level_t
Definition T32CM11_spi.h:108
tr_hal_spi_id_t
Definition T32CM11_spi.h:33
tr_hal_status_t tr_hal_spi_power_on(tr_hal_spi_id_t spi_id)
void(* tr_hal_spi_event_callback_t)(tr_hal_spi_id_t spi_id, uint32_t event_bitmask)
Definition T32CM11_spi.h:474
SPI_REGISTERS_T * tr_hal_spi_get_register_address(tr_hal_spi_id_t spi_id)
tr_hal_spi_clock_rate_t
Definition T32CM11_spi.h:406
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)
tr_hal_spi_rx_watermark_level_t
Definition T32CM11_spi.h:98
@ 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
@ TR_HAL_SPI_TX_WATERMARK_LEVEL_16
Definition T32CM11_spi.h:110
@ TR_HAL_SPI_TX_WATERMARK_LEVEL_8
Definition T32CM11_spi.h:109
@ TR_HAL_SPI_TX_WATERMARK_LEVEL_24
Definition T32CM11_spi.h:111
@ 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_SPI_RX_WATERMARK_LEVEL_16
Definition T32CM11_spi.h:100
@ TR_HAL_SPI_RX_WATERMARK_LEVEL_8
Definition T32CM11_spi.h:99
@ TR_HAL_SPI_RX_WATERMARK_LEVEL_24
Definition T32CM11_spi.h:101
tr_hal_spi_bit_size_t
Definition T32CZ20_spi.h:90
tr_hal_spi_mode_t
Normal SPI vs Dual SPI vs Quad SPI modes.
Definition T32CZ20_spi.h:79
tr_hal_spi_clock_rate_t
Definition T32CZ20_spi.h:353
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 spi_control
Definition T32CM11_spi.h:233
__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 spi_aux_control
Definition T32CM11_spi.h:234
__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 controller_clock_divider
Definition T32CM11_spi.h:262
__IO uint32_t DMA_interrupt_status
Definition T32CM11_spi.h:278
__IO uint32_t peripheral_select
Definition T32CM11_spi.h:240
__IO uint32_t interrupt_enable
Definition T32CM11_spi.h:244
__IO uint32_t DMA_tx_buffer_len
Definition T32CM11_spi.h:271
__IO uint32_t spi_tx_data
Definition T32CM11_spi.h:226
__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 peripheral_select_polarity
Definition T32CM11_spi.h:241
__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 spi_rx_data
Definition T32CM11_spi.h:229
__I uint32_t DMA_tx_xfer_len_remaining
Definition T32CM11_spi.h:274
__I uint32_t reserved2
Definition T32CM11_spi.h:251
__I uint32_t reserved1
Definition T32CM11_spi.h:230
pin type
Definition tr_hal_platform.h:23
Definition T32CM11_spi.h:484
tr_hal_gpio_pin_t chip_select_1
Definition T32CM11_spi.h:510
tr_hal_spi_mode_t spi_mode
Definition T32CM11_spi.h:492
bool sdo_sdi_pins_crossed
Definition T32CM11_spi.h:520
bool cpha_bit
Definition T32CM11_spi.h:535
bool tx_dma_enabled
Definition T32CM11_spi.h:569
bool cpol_bit
Definition T32CM11_spi.h:531
tr_hal_gpio_pin_t clock_pin
Definition T32CM11_spi.h:498
tr_hal_spi_tx_watermark_level_t transmit_watermark
Definition T32CM11_spi.h:610
bool byte_swap
Definition T32CM11_spi.h:553
uint8_t * rx_dma_buffer
Definition T32CM11_spi.h:571
bool rx_dma_enabled
Definition T32CM11_spi.h:568
bool continuous_transfer
Definition T32CM11_spi.h:550
uint16_t rx_dma_buff_length
Definition T32CM11_spi.h:572
tr_hal_gpio_pin_t chip_select_0
Definition T32CM11_spi.h:509
bool enable_inter_transfer_delay
Definition T32CM11_spi.h:560
tr_hal_spi_rx_watermark_level_t receive_watermark
Definition T32CM11_spi.h:611
bool run_as_controller
Definition T32CM11_spi.h:489
uint16_t raw_tx_buff_length
Definition T32CM11_spi.h:581
uint16_t delay_in_clock_cycles
Definition T32CM11_spi.h:563
tr_hal_spi_clock_rate_t controller_clock_rate
Definition T32CM11_spi.h:538
bool wake_on_interrupt
Definition T32CM11_spi.h:607
tr_hal_int_pri_t interrupt_priority
Definition T32CM11_spi.h:602
tr_hal_gpio_pin_t io_0_pin
Definition T32CM11_spi.h:500
bool enable_chip_interrupts
Definition T32CM11_spi.h:599
tr_hal_gpio_pin_t io_2_pin
Definition T32CM11_spi.h:504
bool most_significant_bit_first
Definition T32CM11_spi.h:556
tr_hal_gpio_pin_t io_3_pin
Definition T32CM11_spi.h:505
tr_hal_spi_event_callback_t event_handler_fx
Definition T32CM11_spi.h:592
tr_hal_gpio_pin_t io_1_pin
Definition T32CM11_spi.h:502
tr_hal_spi_receive_callback_t rx_handler_function
Definition T32CM11_spi.h:588
tr_hal_gpio_pin_t chip_select_3
Definition T32CM11_spi.h:512
uint8_t num_chip_select_pins
Definition T32CM11_spi.h:508
uint8_t * raw_tx_buffer
Definition T32CM11_spi.h:580
tr_hal_gpio_pin_t chip_select_2
Definition T32CM11_spi.h:511
tr_hal_spi_bit_size_t bit_size
Definition T32CM11_spi.h:544