From d3fe3d863b1688b54fdf236d05f242aa5eeeb237 Mon Sep 17 00:00:00 2001 From: abagu <352211526@qq.com> Date: Thu, 9 Apr 2020 15:05:00 +0800 Subject: [PATCH] export BOOT_MODULE_FXN_TABLE Signed-off-by: abagu <352211526@qq.com> --- packages/vsky/libdsp/elf/loader.h | 53 +--------------------------- packages/vsky/libdsp/inc/elfloader.h | 52 +++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 52 deletions(-) diff --git a/packages/vsky/libdsp/elf/loader.h b/packages/vsky/libdsp/elf/loader.h index 1383408..ac8a8c8 100644 --- a/packages/vsky/libdsp/elf/loader.h +++ b/packages/vsky/libdsp/elf/loader.h @@ -1,57 +1,7 @@ #ifndef __LOADER_H__ #define __LOADER_H__ #include - -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; - +#include "elfloader.h" /* Prototypes */ uint32_t iblBoot (BOOT_MODULE_FXN_TABLE *bootFxn, int32_t dataFormat, void *formatParams); @@ -70,5 +20,4 @@ BOOT_MODULE_FXN_TABLE *iblInitI2c (void); BOOT_MODULE_FXN_TABLE *iblInitSpiNor (void); BOOT_MODULE_FXN_TABLE *iblInitSpiNand (void); -void load_elf (BOOT_MODULE_FXN_TABLE *bootFxn, uint32_t *ientry_point); #endif /* _IBLLOC_H */ diff --git a/packages/vsky/libdsp/inc/elfloader.h b/packages/vsky/libdsp/inc/elfloader.h index 7924828..eb15e96 100644 --- a/packages/vsky/libdsp/inc/elfloader.h +++ b/packages/vsky/libdsp/inc/elfloader.h @@ -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. */