13 #include "../versaloon_include.h"
14 #include "../versaloon.h"
15 #include "../versaloon_internal.h"
22 "usbtousart",
"usbtospi",
"usbtoi2c",
"usbtogpio",
"usbtocan",
"usbtopwm",
23 "usbtoadc",
"usbtodac",
24 "usbtomicrowire",
"usbtoswim",
"usbtodusi",
N_A,
N_A,
N_A,
"usbtopower",
"usbtodelay",
27 "usbtojtagll",
"usbtojtaghl",
"usbtoissp",
"usbtoc2",
"usbtosbw",
28 "usbtolpcicp",
"usbtoswd",
"usbtojtagraw",
38 #define usbtoxxx_get_type_name(type) \
39 types_name[((type) - VERSALOON_USB_TO_XXX_CMD_START) \
40 % ARRAY_SIZE(types_name)]
152 LOG_ERROR(
"%s command 0x%02x failed with 0x%02x",
164 uint8_t processed = 0;
175 if ((tmp->
buff) && (tmp->
size > 0)) {
190 uint8_t processed = 0;
205 LOG_BUG(
"%s command 0x%02x process error",
240 LOG_INFO(
"USB_TO_XXX abilities: 0x%08X:0x%08X:0x%08X",
271 uint8_t poll_nesting_tmp = 0;
273 memset(&context_tmp, 0,
sizeof(context_tmp));
276 LOG_BUG(
"USB_TO_POLL toooooo long");
289 if (poll_nesting_tmp) {
290 uint16_t newlen, oldlen;
314 uint16_t cmdlen, uint16_t retlen, uint8_t *wantbuf,
315 uint16_t wantpos, uint16_t wantlen, uint8_t collect)
419 uint32_t
mask, uint32_t value)
446 for (i = 0; i <
size; i++)
448 for (i = 0; i <
size; i++)
455 uint32_t
mask, uint32_t value)
482 for (i = 0; i <
size; i++)
484 for (i = 0; i <
size; i++)
#define LOG_ERROR(expr ...)
#define LOG_INFO(expr ...)
size_t size
Size of the control block search area.
uint16_t usbtoxxx_buffer_index
uint16_t usbtoxxx_current_cmd_index
uint8_t * usbtoxxx_buffer
uint16_t versaloon_pending_idx
struct versaloon_want_pos_t * pos
versaloon_callback_t callback
uint16_t actual_data_size
struct versaloon_want_pos_t * next
RESULT usbtodelay_delayms(uint16_t ms)
static uint16_t usbtoxxx_current_cmd_index
RESULT usbtodelay_delayus(uint16_t us)
bool usbtoxxx_interface_supported(uint8_t cmd)
RESULT usbtoxxx_init(void)
RESULT usbtopoll_end(void)
static uint16_t usbtoxxx_buffer_index
static uint8_t poll_nesting
static void usbtoxxx_save_context(struct usbtoxxx_context_t *c)
uint8_t usbtoxxx_abilities[USB_TO_XXX_ABILITIES_LEN]
RESULT usbtopoll_checkfail(uint8_t equ, uint16_t offset, uint8_t size, uint32_t mask, uint32_t value)
RESULT usbtoxxx_add_command(uint8_t type, uint8_t cmd, uint8_t *cmdbuf, uint16_t cmdlen, uint16_t retlen, uint8_t *wantbuf, uint16_t wantpos, uint16_t wantlen, uint8_t collect)
static RESULT usbtoxxx_ensure_buffer_size(uint16_t cmdlen)
RESULT usbtopoll_checkok(uint8_t equ, uint16_t offset, uint8_t size, uint32_t mask, uint32_t value)
RESULT usbtopoll_start(uint16_t retry_cnt, uint16_t interval_us)
RESULT usbtodelay_delay(uint16_t dly)
static RESULT usbtoxxx_validate_current_command_type(void)
RESULT usbtoxxx_execute_command(void)
static const char * types_name[96]
RESULT usbtopoll_verifybuff(uint16_t offset, uint16_t size, uint8_t *buff)
static uint8_t collect_cmd
static uint8_t * usbtoxxx_buffer
#define usbtoxxx_get_type_name(type)
static void usbtoxxx_pop_context(struct usbtoxxx_context_t *c)
RESULT usbtoinfo_get_abilities(uint8_t abilities[USB_TO_XXX_ABILITIES_LEN])
static struct usbtoxxx_context_t poll_context
static uint16_t collect_index
RESULT usbtoxxx_fini(void)
#define USB_TO_XXX_ABILITIES_LEN
#define USB_TO_POLL_VERIFYBUFF
#define USB_TO_XXX_CMD_NOT_SUPPORT
#define USB_TO_POLL_CHECKOK
#define USB_TO_POLL_START
#define USB_TO_POLL_CHECKFAIL
void versaloon_free_want_pos(void)
uint16_t versaloon_pending_idx
struct versaloon_pending_t versaloon_pending[VERSALOON_MAX_PENDING_NUMBER]
uint16_t versaloon_buf_size
RESULT versaloon_add_pending(uint8_t type, uint8_t cmd, uint16_t actual_szie, uint16_t want_pos, uint16_t want_size, uint8_t *buffer, uint8_t collect)
RESULT versaloon_send_command(uint16_t out_len, uint16_t *inlen)
#define ERRCODE_INVALID_BUFFER
#define ERRMSG_INVALID_TARGET
#define ERRMSG_INVALID_PARAMETER
#define ERRCODE_FAILURE_OPERATION
#define ERRMSG_INVALID_USAGE
#define ERRMSG_NOT_SUPPORT_BY
#define ERRCODE_INVALID_PARAMETER
#define ERRMSG_FAILURE_OPERATION
#define ERRMSG_INVALID_BUFFER
#define VERSALOON_USB_TO_XXX_CMD_START
#define VERSALOON_USB_TO_XXX_CMD_END
#define VERSALOON_MAX_PENDING_NUMBER