esp_async_memcpy_priv.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #pragma once
  7. #include <stdint.h>
  8. #include <stdbool.h>
  9. #include "esp_err.h"
  10. #include "esp_etm.h"
  11. #include "esp_async_memcpy.h"
  12. #include "soc/soc_caps.h"
  13. #define ALIGN_DOWN(val, align) ((val) & ~((align) - 1))
  14. #define DEFAULT_TRANSACTION_QUEUE_LENGTH 4
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. typedef enum {
  19. MCP_FSM_IDLE_WAIT, /// intermediate state, for state changes from others to IDLE
  20. MCP_FSM_IDLE,
  21. MCP_FSM_RUN_WAIT, /// intermediate state, for state changes from others to RUN
  22. MCP_FSM_RUN,
  23. } async_memcpy_fsm_t;
  24. typedef struct async_memcpy_context_t async_memcpy_context_t;
  25. struct async_memcpy_context_t {
  26. /// @brief Start a new async memcpy transaction
  27. esp_err_t (*memcpy)(async_memcpy_context_t *ctx, void *dst, void *src, size_t n, async_memcpy_isr_cb_t cb_isr, void *cb_args);
  28. #if SOC_GDMA_SUPPORT_ETM
  29. /// @brief Create ETM event handle of specific event type
  30. esp_err_t (*new_etm_event)(async_memcpy_context_t *ctx, async_memcpy_etm_event_t event_type, esp_etm_event_handle_t *out_event);
  31. #endif // SOC_GDMA_SUPPORT_ETM
  32. /// @brief Delete async memcpy driver context
  33. esp_err_t (*del)(async_memcpy_context_t *ctx);
  34. };
  35. #ifdef __cplusplus
  36. }
  37. #endif