diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-06-10 13:25:26 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-06-17 12:58:33 +0200 |
commit | c4c8d3fd50e21a49b0e511e1dd19ab1d369c536c (patch) | |
tree | 796dc2232df10cc3c4aad8241da0b3a3cf83b796 /bsps/include/grlib | |
parent | arm: Fix parameter use in AARCH32_PMSA_MEM_ATTR() (diff) | |
download | rtems-c4c8d3fd50e21a49b0e511e1dd19ab1d369c536c.tar.bz2 |
grlib: Customizable allocation in ambapp_scan()
Make the memory allocations in ambapp_scan() customizable via the new struct
ambapp_context parameter which generalizes the memory copy handler.
Diffstat (limited to 'bsps/include/grlib')
-rw-r--r-- | bsps/include/grlib/ambapp.h | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/bsps/include/grlib/ambapp.h b/bsps/include/grlib/ambapp.h index 3c3d3e9e3e..2091103551 100644 --- a/bsps/include/grlib/ambapp.h +++ b/bsps/include/grlib/ambapp.h @@ -15,6 +15,15 @@ #ifndef __AMBAPP_H__ #define __AMBAPP_H__ +#include <stddef.h> + +/* Include VENDOR and DEVICE definitions */ +#include "ambapp_ids.h" + +#ifdef __cplusplus +extern "C" { +#endif + /** * @defgroup amba AMBA * @@ -25,13 +34,6 @@ * @{ */ -/* Include VENDOR and DEVICE definitions */ -#include "ambapp_ids.h" - -#ifdef __cplusplus -extern "C" { -#endif - /* Max supported AHB buses */ #define AHB_BUS_MAX 6 @@ -181,6 +183,11 @@ typedef void *(*ambapp_memcpy_t)( struct ambapp_bus *abus /* Optional AMBA Bus pointer */ ); +struct ambapp_context { + ambapp_memcpy_t copy_from_device; + void *(*alloc)(size_t); +}; + /* Scan a AMBA Plug & Play bus and create all device structures describing the * the devices. The devices will form a tree, where every node describes one * interface. The resulting tree is placed in the location pointed to by root. @@ -188,16 +195,16 @@ typedef void *(*ambapp_memcpy_t)( * Since it the tree is located in RAM it is easier to work with AMBA buses * that is located over PCI and SpaceWire etc. * + * \param abus Resulting device node tree root is stored here. * \param ioarea The IO-AREA where Plug & Play information can be found. - * \param parent Used internally when recursing down a bridge. Set to NULL. + * \param ctx The scan context. May be NULL. * \param mmaps Is used to perform address translation if needed. - * \param root Resulting device node tree root is stored here. * */ extern int ambapp_scan( struct ambapp_bus *abus, unsigned int ioarea, - ambapp_memcpy_t memfunc, + const struct ambapp_context *ctx, struct ambapp_mmap *mmaps ); |