// ***************** overlay.h *************************************** // Risc-Dsp runtime library // // This file implements interface to dsp overlays handling // // (c) multicore.ru // // ******************************************************************* #ifndef _OVERLAY_H_ #define _OVERLAY_H_ // set maximum number of supported overlays #define MAX_OVERLAY_CTX 16 // set maximum number of supported dsp cores #define MAX_DSP 4 // // struct represent description of dsp core // struct dsp_ctx_info { unsigned num; // dsp core id [0..3] unsigned qstr_stop; // unsigned page_mode; // page mdoe(0,2,3) - sets ratio between pram:xram memory size unsigned pram_base; // base address of pram memory unsigned pram_size; // size of pram memory unsigned xyram_base; // base address of xram memory unsigned xyram_size; // size of xram memory unsigned __present; // }; // // struct represent description of overlay loaded into dsp // struct ovl_ctx { // text section addresses unsigned *__text_src; unsigned *__text_dst; unsigned __text_offset; unsigned __text_size; // data section addresses unsigned *__data_src; unsigned *__data_dst; unsigned __data_size; // bss section addresses unsigned *__bss_src; unsigned *__bss_dst; unsigned __bss_size; // overlay_info unsigned __present; unsigned __exit_dsp; unsigned __num; // dsp core where ovelay is loaded struct dsp_ctx_info * dsp_info; }; // // struct represent description of all overlays in program // struct ovl_dsp_ctx { struct ovl_ctx ctx[MAX_OVERLAY_CTX]; struct dsp_ctx_info info; unsigned curr_ctx_num; }; // // adds description of dsp // void add_dsp_entry( unsigned num, unsigned page_mode, unsigned qstr_stop, unsigned pram_base, unsigned xyram_base); // // inits dsp entry // void init_dsp_entry(); // // switch working dsp // void set_curr_dsp(unsigned num); // // select active overlay and load it into memory // void init_overlay(unsigned num); // // select overlay at given address // struct ovl_ctx* find_overlay_ctx(unsigned address); // // load overlay into dsp memory // int load_overlay(struct ovl_ctx* ctx); // // report overlay content (uncomment code in source to use it) // void print_overlay(struct ovl_ctx* ctx); // // report dsp memory settings (uncomment code in source to use it) // void print_dsp_memory_info(); // // converts address from dsp byte address space into risc address space // unsigned xyram_byte_address_to_risc(unsigned address, unsigned page_size); // // converts address from dsp byte address space into risc address space // unsigned xyram_word_address_to_risc(unsigned address, unsigned page_size); // // converts address from risc address space into dsp byte address space // unsigned risc_to_xyram_byte_address(unsigned address, unsigned page_size); // // gets size of memory page accordingly to page_mode // unsigned get_page_size(unsigned page_mode); #endif // _OVERLAY_H_