add some code

This commit is contained in:
2025-09-05 13:25:11 +08:00
parent 9ff0a99e7a
commit 3cf1229a85
8911 changed files with 2535396 additions and 0 deletions

View File

@@ -0,0 +1,112 @@
#pragma once
#include <stdint.h>
#include "esp_err.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct sscma_client_flasher_t sscma_client_flasher_t; /*!< Type of SSCMA flasher handle */
struct sscma_client_flasher_t
{
/**
* @brief Start flasher transmitter
* @param[in] handle transmitter handle
* @param[in] offset offset
* @return
* - ESP_OK
*/
esp_err_t (*start)(sscma_client_flasher_t *handle, size_t offset);
/**
* @brief Write data to flasher transmitter
* @param[in] handle transmitter handle
* @param[in] data data
* @param[in] len length
* @return
* - ESP_OK
*/
esp_err_t (*write)(sscma_client_flasher_t *handle, const void *data, size_t len);
/**
* @brief Start flasher transmitter
* @param[in] handle transmitter handle
* @return
* - ESP_OK
*/
esp_err_t (*finish)(sscma_client_flasher_t *handle);
/**
* @brief Abort flasher transmitter
* @param[in] handle transmitter handle
* @return
* - ESP_OK
*/
esp_err_t (*abort)(sscma_client_flasher_t *handle);
/**
* @brief Delete flasher transmitter
* @param[in] handle transmitter handle
* @return
* - ESP_OK
*/
esp_err_t (*del)(sscma_client_flasher_t *handle);
};
/**
* Start flasher transmitter
* @param[in] handle transmitter handle
* @param[in] offset offset
* @return
* - ESP_OK
*/
esp_err_t sscma_client_flasher_start(sscma_client_flasher_t *handle, size_t offset);
/**
* Write data to flasher transmitter
* @param[in] handle transmitter handle
* @param[in] data data
* @param[in] len length
* @return
* - ESP_OK
*/
esp_err_t sscma_client_flasher_write(sscma_client_flasher_t *handle, const void *data, size_t len);
/**
* Finish flasher transmitter
* @param[in] handle transmitter handle
* @return
* - ESP_OK
*/
esp_err_t sscma_client_flasher_finish(sscma_client_flasher_t *handle);
/**
* Abort flasher transmitter
* @param[in] handle transmitter handle
* @return
* - ESP_OK
*/
esp_err_t sscma_client_flasher_abort(sscma_client_flasher_t *handle);
/**
* Delete flasher transmitter
* @param[in] handle transmitter handle
* @return
* - ESP_OK
*/
esp_err_t sscma_client_flasher_delete(sscma_client_flasher_t *handle);
/**
* Create xmodem flasher
* @param[in] io io
* @param[out] ret_handle handle
* @return
* - ESP_OK
*/
esp_err_t sscma_client_flasher_xmodem_create(sscma_client_io_t *io, sscma_client_flasher_t **ret_handle);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,82 @@
#pragma once
#include <stdbool.h>
#include "esp_err.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct sscma_client_io_t sscma_client_io_t; /*!< Type of SSCMA client IO */
/**
* @brief SSCMA IO interface
*/
struct sscma_client_io_t
{
/**
* @brief Bus handle
*/
void *handle;
/**
* @brief Destory SCCMA client
*
* @param[in] io SCCMA client handle]
* @return
* - ESP_OK on success
*/
esp_err_t (*del)(sscma_client_io_t *io);
/**
* @brief Write data to SCCMA client
*
* @param[in] io SCCMA client handle
* @param[in] data Data to be written
* @param[in] size Size of data
* @return
* - ESP_ERR_INVALID_ARG if parameter is invalid
* - ESP_ERR_NOT_SUPPORTED if read is not supported by transport
* - ESP_OK on success
*/
esp_err_t (*write)(sscma_client_io_t *io, const void *data, size_t size);
/**
* @brief Read data from SCCMA client
*
* @param[in] io SCCMA client IO handle
* @param[in] data Data to be read
* @param[in] size Size of data
* @return
* - ESP_ERR_INVALID_ARG if parameter is invalid
* - ESP_ERR_NOT_SUPPORTED if read is not supported by transport
* - ESP_OK on success
*
*/
esp_err_t (*read)(sscma_client_io_t *io, void *data, size_t size);
/**
* @brief Get available size of data
*
* @param[in] io SCCMA client IO handle
* @param[out] ret_avail Available size
* @return
* - ESP_ERR_INVALID_ARG if parameter is invalid
* - ESP_ERR_NOT_SUPPORTED if read is not supported by transport
* - ESP_OK
*/
esp_err_t (*available)(sscma_client_io_t *io, size_t *ret_avail);
/**
* @brief Flush data
*
* @param[in] io IO handle
* @return
* - ESP_OK
*/
esp_err_t (*flush)(sscma_client_io_t *io);
};
#ifdef __cplusplus
}
#endif