Commit 836941d5 authored by Lucas Russo's avatar Lucas Russo

include/sm_io_mod_dispatch.h: add macros for declaring structure in linker table

parent b639279a
...@@ -20,7 +20,26 @@ typedef struct { ...@@ -20,7 +20,26 @@ typedef struct {
const smio_bootstrap_ops_t *bootstrap_ops; const smio_bootstrap_ops_t *bootstrap_ops;
} smio_mod_dispatch_t; } smio_mod_dispatch_t;
extern const smio_mod_dispatch_t smio_mod_dispatch []; /*
* WARNING! Using SMIO_MOD_DECLARE requires .smio_mod_dispatch section in linker script
* .smio_mod_dispatch : ALIGN(4)
* {
* _smio_mod_dispatch = .;
* KEEP(*(.smio_mod_dispatch))
* _esmio_mod_dispatch = .;
* }
*/
extern const smio_mod_dispatch_t *_smio_mod_dispatch;
extern const smio_mod_dispatch_t *_esmio_mod_dispatch;
#define SMIO_MOD_DECLARE(mod_id, mod_name, mod_bootstrap_ops) \
const smio_mod_dispatch_t __attribute__ ((section (".smio_mod_dispatch"))) \
smio_mod_ ## mod_id ## _ ## mod_name = { \
.id = mod_id, \
.name = mod_name, \
.bootstrap_ops = &mod_bootstrap_ops \
};
#ifdef __cplusplus #ifdef __cplusplus
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment