sdio_wrapper.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // SPDX-License-Identifier: Apache-2.0
  2. // Copyright 2015-2021 Espressif Systems (Shanghai) PTE LTD
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. /* Wrapper interfaces for SDMMC to communicated with slave using SDIO */
  16. #ifndef __SDIO_WRAPPER_H_
  17. #define __SDIO_WRAPPER_H_
  18. #include "esp_check.h"
  19. #include "sdmmc_cmd.h"
  20. #define MAX_TRANSPORT_BUFFER_SIZE MAX_SDIO_BUFFER_SIZE
  21. /* Hosted init function to init the SDIO host
  22. * returns a pointer to the sdio context */
  23. void * hosted_sdio_init(void);
  24. /* Hosted SDIO deinit function
  25. * expects a pointer to the sdio context */
  26. esp_err_t hosted_sdio_deinit(void *ctx);
  27. /* Hosted SDIO to initialise the SDIO card */
  28. int hosted_sdio_card_init(void *ctx);
  29. /* Hosted SDIO functions to read / write to slave scratch registers
  30. * and to read / write block data
  31. * If lock_required is true, call will hold a mutex for the duration of the call */
  32. int hosted_sdio_read_reg(uint32_t reg, uint8_t *data, uint16_t size, bool lock_required);
  33. int hosted_sdio_write_reg(uint32_t reg, uint8_t *data, uint16_t size, bool lock_required);
  34. int hosted_sdio_read_block(uint32_t reg, uint8_t *data, uint16_t size, bool lock_required);
  35. int hosted_sdio_write_block(uint32_t reg, uint8_t *data, uint16_t size, bool lock_required);
  36. /* Hosted SDIO function that will block waiting for a SDIO interrupt from the slave
  37. * returns when there is an interrupt or timeout */
  38. int hosted_sdio_wait_slave_intr(uint32_t ticks_to_wait);
  39. #endif