/ components / esp_serial_slave_link / essl_internal.h
essl_internal.h
 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  
15  #pragma once
16  #include <esp_types.h>
17  #include <esp_err.h>
18  
19  /** Context used by the ``esp_serial_slave_link`` component.
20   */
21  struct essl_dev_t {
22      void* args;
23  
24      esp_err_t (*init)(void* ctx, uint32_t wait_ms);
25  
26      esp_err_t (*wait_for_ready)(void *ctx, uint32_t wait_ms);
27      esp_err_t (*update_tx_buffer_num)(void *ctx, uint32_t wait_ms);
28      esp_err_t (*update_rx_data_size)(void *ctx, uint32_t wait_ms);
29      esp_err_t (*send_packet)(void *ctx, const void* start, size_t length, uint32_t wait_ms);
30      esp_err_t (*get_packet)(void *ctx, void* out_data, size_t size, uint32_t wait_ms);
31      esp_err_t (*write_reg)(void *ctx, uint8_t addr, uint8_t value, uint8_t* value_o, uint32_t wait_ms);
32      esp_err_t (*read_reg)(void *ctx, uint8_t add, uint8_t *value_o, uint32_t wait_ms);
33      esp_err_t (*wait_int)(void *ctx, uint32_t wait_ms);
34      esp_err_t (*clear_intr)(void* ctx, uint32_t intr_mask, uint32_t wait_ms);
35      esp_err_t (*get_intr)(void* ctx, uint32_t* intr_raw, uint32_t *intr_st, uint32_t wait_ms);
36      esp_err_t (*set_intr_ena)(void* ctx, uint32_t ena_mask, uint32_t wait_ms);
37      esp_err_t (*get_intr_ena)(void* ctx, uint32_t* ena_mask_o, uint32_t wait_ms);
38      esp_err_t (*send_slave_intr)(void* ctx, uint32_t intr_mask, uint32_t wait_ms);
39  
40      uint32_t (*get_tx_buffer_num)(void *ctx);
41      uint32_t (*get_rx_data_size)(void *ctx);
42      void (*reset_cnt)(void *ctx);
43  };
44  
45  typedef struct essl_dev_t essl_dev_t;