|
|
@ -21,6 +21,56 @@ struct eiofxn { |
|
|
|
void (*on_close)(struct eiofxn *); /* [optional] called when elf_close, give a chance to free `ptr' */ |
|
|
|
}; |
|
|
|
|
|
|
|
typedef struct BOOT_MODULE_FXN_TABLE { |
|
|
|
/**
|
|
|
|
* @brief The API is called by the kernel to open the specific |
|
|
|
* boot module. This is used by boot module to initialize themselves |
|
|
|
* and the peripheral drivers. |
|
|
|
*/ |
|
|
|
int32_t (*open)(void* ptr_driver, void (*asyncComplete)(void *)); |
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief The API is called by the kernel to close the boot module |
|
|
|
* Boot Modules use this API and to close themselves and the peripheral |
|
|
|
* drivers. |
|
|
|
*/ |
|
|
|
int32_t (*close)(void); |
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief The API is called by the kernel to read a specific number |
|
|
|
* of bytes from the boot module and to populate the data buffer. |
|
|
|
*/ |
|
|
|
int32_t (*read)(uint8_t * ptr_buf, uint32_t num_bytes); |
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief The API is called by the kernel to write a specific number |
|
|
|
* of bytes to the boot module from the data buffer. This is *optional* |
|
|
|
*/ |
|
|
|
int32_t (*write)(uint8_t* ptr_buf, uint32_t num_bytes); |
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief This API is called by the kernal to peek at some bytes |
|
|
|
* without removing them from the buffer |
|
|
|
*/ |
|
|
|
int32_t (*peek)(uint8_t *ptr_buf, uint32_t num_bytes); |
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief This API is called by the kernel to move the read/write |
|
|
|
* pointers in the buffer. The values of parameter from |
|
|
|
* match those of fseek - 0 = from start of file, |
|
|
|
* 1 = from current position, 2 = from end of file. |
|
|
|
* Returns 0 if the seek is successful, -1 if it failed. |
|
|
|
*/ |
|
|
|
int32_t (*seek)(int32_t loc, int32_t from); |
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief This API is called by the kernel to determine how much data |
|
|
|
* is currently available for immediate read. Returns -1 if |
|
|
|
* the stream has been closed. |
|
|
|
*/ |
|
|
|
int32_t (*query)(void); |
|
|
|
} BOOT_MODULE_FXN_TABLE; |
|
|
|
|
|
|
|
/*
|
|
|
|
* load elf binary. |
|
|
|
* |
|
|
@ -73,6 +123,8 @@ int elf_load(elf_info_t ei, int phdr); |
|
|
|
void elf_dump(elf_info_t ei); |
|
|
|
|
|
|
|
|
|
|
|
void load_elf (BOOT_MODULE_FXN_TABLE *bootFxn, uint32_t *ientry_point); |
|
|
|
|
|
|
|
/*
|
|
|
|
* load elf binary from emif flash. |
|
|
|
*/ |
|
|
|