Lines Matching refs:entity
296 struct usb_dfu_entity *entity = usb_dfu_get_entity(0); in usb_dfu_running() local
298 if (entity == NULL) in usb_dfu_running()
303 return (entity->trans_complete || entity->trans_size) ? true: false; in usb_dfu_running()
308 struct usb_dfu_entity *entity = usb_dfu_get_entity(0); in usb_dfu_update_status() local
310 if (entity == NULL) in usb_dfu_update_status()
315 return entity->trans_complete; in usb_dfu_update_status()
320 struct usb_dfu_entity *entity = usb_dfu_get_entity(0); in usb_dfu_update_size_get() local
322 if (entity == NULL) in usb_dfu_update_size_get()
327 return &entity->trans_size; in usb_dfu_update_size_get()
332 struct usb_dfu_entity *entity = usb_dfu_get_entity(0); in dfu_ram_read() local
336 if (buf == NULL || entity == NULL) in dfu_ram_read()
341 offset = entity->offset; in dfu_ram_read()
342 if (offset > entity->ram_size) in dfu_ram_read()
347 len = min(len, (entity->ram_size - offset)); in dfu_ram_read()
349 ret = memcpy_s(buf, len, (const void *)((uint8_t *)entity->ram_addr + offset), len); in dfu_ram_read()
355 entity->offset += len; in dfu_ram_read()
364 struct usb_dfu_entity *entity = usb_dfu_get_entity(0); in dfu_ram_write() local
368 if (buf == NULL || entity == NULL) in dfu_ram_write()
373 offset = entity->offset; in dfu_ram_write()
374 if (offset > entity->ram_size) in dfu_ram_write()
379 len = min(len, (entity->ram_size - offset)); in dfu_ram_write()
381 …ret = memcpy_s((void *)((uint8_t *)entity->ram_addr + offset), entity->ram_size - offset, buf, len… in dfu_ram_write()
387 entity->offset += len; in dfu_ram_write()
388 entity->trans_size += len; in dfu_ram_write()
493 struct usb_dfu_entity *entity = usb_dfu_get_entity(0); in usbdev_dfu_transaction_cleanup() local
495 if (entity == NULL) in usbdev_dfu_transaction_cleanup()
500 entity->trans_size = 0; in usbdev_dfu_transaction_cleanup()
501 entity->trans_complete = 0; in usbdev_dfu_transaction_cleanup()
502 entity->seq_num = 0; in usbdev_dfu_transaction_cleanup()
503 entity->offset = 0; in usbdev_dfu_transaction_cleanup()
802 struct usb_dfu_entity *entity = usb_dfu_get_entity(0); in dfu_manifest_sync_request() local
811 if (entity != NULL) in dfu_manifest_sync_request()
813 entity->seq_num = 0; in dfu_manifest_sync_request()
814 entity->offset = 0; in dfu_manifest_sync_request()
837 struct usb_dfu_entity *entity = usb_dfu_get_entity(0); in dfu_manifest_request() local
846 if (entity != NULL) in dfu_manifest_request()
848 entity->trans_complete = 1; in dfu_manifest_request()
1012 static int dfu_ram_init_env(struct usb_dfu_entity *entity, char *envstr) in dfu_ram_init_env() argument
1022 ret = strncpy_s(entity->dfu_name, DFU_NAME_MAX_LEN, st, strlen(st) + 1); in dfu_ram_init_env()
1039 entity->ram_addr = (void *)strtoul(st, &st, 16); in dfu_ram_init_env()
1046 entity->ram_size = strtoul(st, &st, 16); in dfu_ram_init_env()
1048 entity->dfu_write = dfu_ram_write; in dfu_ram_init_env()
1049 entity->dfu_read = dfu_ram_read; in dfu_ram_init_env()
1056 struct usb_dfu_entity *entity; in usb_dfu_init_env_entities() local
1072 entity = malloc(sizeof(struct usb_dfu_entity)); in usb_dfu_init_env_entities()
1073 if (entity == NULL) in usb_dfu_init_env_entities()
1077 (void)memset_s(entity, sizeof(struct usb_dfu_entity), 0, sizeof(struct usb_dfu_entity)); in usb_dfu_init_env_entities()
1081 ret = dfu_ram_init_env(entity, envstr); in usb_dfu_init_env_entities()
1084 free(entity); in usb_dfu_init_env_entities()
1090 free(entity); in usb_dfu_init_env_entities()
1095 g_dfu_entity = entity; in usb_dfu_init_env_entities()