static int open_fip(const uintptr_t spec) { int result = IO_FAIL; /* See if a Firmware Image Package is available */ result = io_dev_init(fip_dev_handle, (uintptr_t)FIP_IMAGE_NAME); if (result == IO_SUCCESS) { INFO("Using FIP\n"); /*TODO: Check image defined in spec is present in FIP. */ } return result; }
static int open_memmap(const uintptr_t spec) { int result = IO_FAIL; uintptr_t local_image_handle; result = io_dev_init(memmap_dev_handle, memmap_init_params); if (result == IO_SUCCESS) { result = io_open(memmap_dev_handle, spec, &local_image_handle); if (result == IO_SUCCESS) { /* INFO("Using Memmap IO\n"); */ io_close(local_image_handle); } } return result; }
static int open_semihosting(const uintptr_t spec) { int result; uintptr_t local_image_handle; /* See if the file exists on semi-hosting.*/ result = io_dev_init(sh_dev_handle, (uintptr_t)NULL); if (result == 0) { result = io_open(sh_dev_handle, spec, &local_image_handle); if (result == 0) { VERBOSE("Using Semi-hosting IO\n"); io_close(local_image_handle); } } return result; }
static int open_semihosting(void *spec) { int result = IO_FAIL; io_handle local_image_handle; /* See if the file exists on semi-hosting.*/ result = io_dev_init(sh_dev_handle, sh_init_params); if (result == IO_SUCCESS) { result = io_open(sh_dev_handle, spec, &local_image_handle); if (result == IO_SUCCESS) { INFO("Using Semi-hosting IO\n"); io_close(local_image_handle); } } return result; }
int io_add_dev(io_t * io, int fd){ io_dev_t * new_io_dev; int retval; new_io_dev = (io_dev_t *)malloc(sizeof(io_dev_t)); if(new_io_dev == NULL){ err_check(ERROR_MALLOC,"Failed to allocate mem."); } retval = io_dev_init(new_io_dev,fd); err_propagate(retval); io_dev_t * last_dev; retval = io_get_last_dev(io,&last_dev); if(last_dev == NULL){ // start new list io->dev_list.first = new_io_dev; }else{ last_dev->next = new_io_dev; } ++io->dev_list.dev_count; return ERROR_OK; }