Commit Graph

63 Commits

Author SHA1 Message Date
wanlei
ee6d3de128 spi_slave: add a flag SPI_SLAVE_NO_RETURN_RESULT to bypass return descriptor from ISR
if using this flag, driver willn't return the trans-done descriptor from ISR, so
`spi_slave_get_trans_result()` shouldn't be called.
besides, callback is the only way to know transaction status in that case, so a
`post_trans_cb` will be checked mandatory.
2022-09-21 11:56:27 +08:00
Armando
f31d88e3fe spi: move spi_common_internal to esp_private 2022-06-24 19:12:13 +08:00
morris
de662b987e driver: fix issue found by coverity scan 2022-03-24 21:36:03 +08:00
Anton Maklakov
68e5d9d585 Remove IRAM_ATTR from any function declarations
IRAM_ATTR expands to a unique section attribute. Applying it to both
declaration and definition results in a section conflict.
2022-03-22 09:58:50 +00:00
Ivan Grokhotkov
cda3c2b92b
driver: spi_slave: make sure CS helpers are in IRAM if the ISR is
Closes https://github.com/espressif/esp-idf/issues/3870
2022-03-14 23:30:51 +01:00
Armando
4dc0d6b2fe adc: support adc dma driver on all chips 2021-12-16 00:19:15 +00:00
Jan Brudný
690974e32f driver: update copyright notice 2021-05-25 17:43:57 +02:00
Armando
9b9ea71ff9 spi: remove HSPI macro on esp32c3 and esp32s3 2021-04-06 13:42:49 +08:00
Armando
889de9ebd9 spi: add enum for spi dma channels 2021-02-22 07:06:05 +00:00
Armando
db3bf8b544 spi: refactor spi_common dma allocator 2021-02-22 07:06:05 +00:00
Armando
c438ad5d72 spi: apply gdma allocator to SPI 2021-02-22 07:06:05 +00:00
Armando
2e670bf6af spi: add dma channel auto-alloc feature on esp32 2021-02-22 07:06:05 +00:00
Angus Gratton
5228d9f9ce esp32c3: Apply one-liner/small changes for ESP32-C3 2020-12-01 10:58:50 +11:00
Angus Gratton
66fb5a29bb Whitespace: Automated whitespace fixes (large commit)
Apply the pre-commit hook whitespace fixes to all files in the repo.

(Line endings, blank lines at end of file, trailing whitespace)
2020-11-11 07:36:35 +00:00
Michael (XIAO Xufeng)
2e90bf6b15 Merge branch 'bugfix/spi_slave_remove_debug_code' into 'master'
spi_slave: remove debug code

Closes IDFGH-4161

See merge request espressif/esp-idf!10975
2020-11-09 12:26:22 +08:00
Armando
f7e91ef6c1 spi: esp32s3 bringup for spi 2020-10-26 11:28:34 +08:00
Armando
5a3cca8f67 spi_slave: remove debug code
Closes https://github.com/espressif/esp-idf/pull/6023
2020-10-26 10:59:33 +08:00
Michael (XIAO Xufeng)
b744c14a8a Merge branch 'bugfix/spi_slave_fix_cs_num_crash' into 'master'
spi_slave: fix crash issue when cs is set to -1

Closes IDFGH-3885

See merge request espressif/esp-idf!10414
2020-10-22 22:36:21 +08:00
Michael (XIAO Xufeng)
647dea9395 soc: combine xxx_caps.h into one soc_caps.h
During HAL layer refactoring and new chip bringup, we have several
caps.h for each part, to reduce the conflicts to minimum. But this is
The capabilities headers will be relataive stable once completely
written (maybe after the featues are supported by drivers).

Now ESP32 and ESP32-S2 drivers are relative stable, making it a good
time to combine all these caps.h into one soc_caps.h

This cleanup also move HAL config and pin config into separated files,
to make the responsibilities of these headers more clear. This is
helpful for the stabilities of soc_caps.h because we want to make it
public some day.
2020-10-17 16:10:15 +08:00
Armando
1393520e78 spi_slave: fix crash issue caused by setting cs to -1
Setting cs num to -1 means cs pin is not connected. But passing the value -1 to the
spicommon_cs_initialize() will lead to program crash caused by "array index out
of bounds". We expect the driver to execute well but the driver should not be in
charge of users' behaviour, so this commit prevents the crash.

https://github.com/espressif/esp-idf/issues/5784
2020-09-30 11:40:52 +08:00
Michael (XIAO Xufeng)
4b95f7efa8 Merge branch 'feature/spi_dma_hal_ll_refactor' into 'master'
spi: refactor DMA ll layer functions

Closes IDFGH-3538 and IDFGH-2555

See merge request espressif/esp-idf!9929
2020-09-23 15:32:41 +08:00
morris
61f89b97c6 bringup esp32-s3 on FPGA 2020-09-22 15:15:03 +08:00
Armando
59e350b195 spi: seperate the pointer for the TX and RX DMA 2020-09-21 20:33:56 +08:00
morris
2917651478 esp_rom: extract common ets apis into esp_rom_sys.h 2020-07-27 15:27:01 +08:00
morris
a4d0033c03 esp_rom: extract common GPIO apis into esp_rom_gpio.h 2020-07-07 11:40:19 +08:00
Michael (XIAO Xufeng)
49a48644e4 spi: allow using esp_flash and spi_master driver on the same bus 2020-03-26 22:08:26 +08:00
Michael (XIAO Xufeng)
7026087dc0 spi: support esp32s2 2020-01-26 17:24:12 +08:00
morris
e30cd361a8 global: rename esp32s2beta to esp32s2 2020-01-22 12:14:38 +08:00
Andrew
1669dc40d1 spi_slave.c:fix DMA channel set to zero which might gets conflict with assert
close #2740
2019-11-26 13:11:48 +08:00
Angus Gratton
496ede9bcd Merge branch 'master' into feature/esp32s2beta_merge 2019-10-15 14:59:27 +11:00
Michael (XIAO Xufeng)
afbe1ba878 spi: move deprecated functions into internal header
Resolves https://github.com/espressif/esp-idf/issues/4132
2019-10-08 11:51:39 +08:00
Angus Gratton
24d26fccde Merge branch 'master' into feature/esp32s2beta_update 2019-08-08 13:44:24 +10:00
Michael (XIAO Xufeng)
17378fd4c2 spi: support new chip esp32s2beta 2019-06-23 12:17:27 +08:00
Michael (XIAO Xufeng)
9b13a04abf spi: multichip support
move hardcoded numbers, etc. into soc files.
create headers for shared types which needs to be documented.

(MINOR CHANGE)
2019-06-22 19:08:47 +08:00
Angus Gratton
90008e3fd6 Merge branch 'feature/spi_driver_support_multi_chip' into 'master'
spi: multichip support

See merge request idf/esp-idf!5234
2019-06-20 16:45:06 +08:00
Michael (XIAO Xufeng)
5c9dc44c49 spi: multichip support
move hardcoded numbers, etc. into soc files.
create headers for shared types which needs to be documented.

(MINOR CHANGE)
2019-06-20 10:38:52 +08:00
Michael (XIAO Xufeng)
1138133a78 spi: fix a possible concurrency issue 2019-06-17 00:16:01 +00:00
suda-morris
84b2f9f14d build and link hello-world for esp32s2beta 2019-06-11 13:07:37 +08:00
Konstantin Kondrashov
399d2d2605 all: Using xxx_periph.h
Using xxx_periph.h in whole IDF instead of xxx_reg.h, xxx_struct.h, xxx_channel.h ... .

Cleaned up header files from unnecessary headers (releated to soc/... headers).
2019-06-03 14:15:08 +08:00
Michael (XIAO Xufeng)
33db6d608e spi_slave: add HAL support 2019-05-20 07:34:34 +00:00
morris
f5b03c9ea3 misc adjustment of esp32 component 2019-04-03 19:57:46 +08:00
morris
c159984264 separate rom from esp32 component to esp_rom
1. separate rom include files and linkscript to esp_rom
2. modefiy "include rom/xxx.h" to "include esp32/rom/xxx.h"
3. Forward compatible
4. update mqtt
2019-03-21 18:51:45 +08:00
michael
58955a79a2 spi_slave: improve the timing configuration
SPI Slave
===========

- Correct the configuration of mode 0~3 using new config in the TRM
- Split the workaround for DMA in mode 0/2 out of normal config, to make it clear.
- Update timing and speed document for the SPI slave.

Resolves https://github.com/espressif/esp-idf/issues/1346, https://github.com/espressif/esp-idf/issues/2393
2019-01-26 00:10:41 +08:00
michael
cfba157fdd spi_slave: add valid check for DMA buffers
The DMA cannot receive data correctly when the buffer address is not
WORD aligned. Currently we only check whether the buffer is in the DRAM
region.

The DMA always write in WORDs, so the length arguments should also be
multiples of 32 bits.

A check is added to see whether the buffer is WORD aligned and has valid
length.
2018-11-26 03:49:26 +00:00
Michael (XIAO Xufeng)
8cddfa35b8 spi: fix the crash when callbacks are not in the IRAM
Introduced in 9c23b8e5 and 4f87a62f. To get higher speed, menuconfig
options are added to put ISR and other functions into the IRAM.  The
interrupt flag ESP_INTR_FLAG_IRAM is also mistakenly set when the ISR is
put into the IRAM. However callbacks, which are wrote by the user, are
called in the master and slave ISR. The user may not be aware of that
these callbacks are not disabled during flash operations. Any cache miss
during flash operation will cause panic.

Essentially IRAM functions and intrrupt flag ESP_INTR_FLAG_IRAM are
different, the latter means not disabling the ISR during flash
operations.  New bus_config flag intr_flags is offered to help set the
interrupt attribute, including priority level, SHARED, IRAM (not
disabled during flash operations).  It introduced a small BREAK to
IDFv3.1 (but the same as IDFv3.0) that the user has to manually set IRAM
flag now (therefore he's aware of the IRAM thing) to void the ISR being
disabled during flash operations.
2018-11-20 13:07:13 +08:00
Michael (XIAO Xufeng)
9b5d0f3322 spi: shown owner of spi host explicitly 2018-10-29 20:22:44 +08:00
Michael (XIAO Xufeng)
90d229eb6d spi_master: speed up polling performance by putting into IRAM 2018-10-25 12:31:45 +08:00
michael
e5ed450d95 spi: move gpio direction config to common func for coinsistence
(MINOR CHANGE)
2018-10-04 14:57:31 +08:00
michael
2d748b5d38 spi_slave: fix the issue rx dma get broken by master unexpected transaction 2018-09-07 12:04:55 +08:00
Michael (XIAO Xufeng)
4f87a62f18 spi_slave: add new menuconfig item to decide whether spi slave should be put into IRAM 2018-08-23 05:21:49 +00:00