Browse Source

export BOOT_MODULE_FXN_TABLE

Signed-off-by: abagu <352211526@qq.com>
master
abagu 5 years ago
parent
commit
d3fe3d863b
  1. 53
      packages/vsky/libdsp/elf/loader.h
  2. 52
      packages/vsky/libdsp/inc/elfloader.h

53
packages/vsky/libdsp/elf/loader.h

@ -1,57 +1,7 @@
#ifndef __LOADER_H__
#define __LOADER_H__
#include <stdint.h>
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 */

52
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.
*/

Loading…
Cancel
Save