essl_internal.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #pragma once
  15. #include <esp_types.h>
  16. #include <esp_err.h>
  17. /** Context used by the ``esp_serial_slave_link`` component.
  18. */
  19. struct essl_dev_t {
  20. void* args;
  21. esp_err_t (*init)(void* ctx, uint32_t wait_ms);
  22. esp_err_t (*wait_for_ready)(void *ctx, uint32_t wait_ms);
  23. esp_err_t (*update_tx_buffer_num)(void *ctx, uint32_t wait_ms);
  24. esp_err_t (*update_rx_data_size)(void *ctx, uint32_t wait_ms);
  25. esp_err_t (*send_packet)(void *ctx, const void* start, size_t length, uint32_t wait_ms);
  26. esp_err_t (*get_packet)(void *ctx, void* out_data, size_t size, uint32_t wait_ms);
  27. esp_err_t (*write_reg)(void *ctx, uint8_t addr, uint8_t value, uint8_t* value_o, uint32_t wait_ms);
  28. esp_err_t (*read_reg)(void *ctx, uint8_t add, uint8_t *value_o, uint32_t wait_ms);
  29. esp_err_t (*wait_int)(void *ctx, uint32_t wait_ms);
  30. esp_err_t (*clear_intr)(void* ctx, uint32_t intr_mask, uint32_t wait_ms);
  31. esp_err_t (*get_intr)(void* ctx, uint32_t* intr_raw, uint32_t *intr_st, uint32_t wait_ms);
  32. esp_err_t (*set_intr_ena)(void* ctx, uint32_t ena_mask, uint32_t wait_ms);
  33. esp_err_t (*get_intr_ena)(void* ctx, uint32_t* ena_mask_o, uint32_t wait_ms);
  34. esp_err_t (*send_slave_intr)(void* ctx, uint32_t intr_mask, uint32_t wait_ms);
  35. uint32_t (*get_tx_buffer_num)(void *ctx);
  36. uint32_t (*get_rx_data_size)(void *ctx);
  37. void (*reset_cnt)(void *ctx);
  38. };
  39. typedef struct essl_dev_t essl_dev_t;