Hi,

I've noticed drivers in RIOT will usually keep a copy of their
configuration parameters in RAM:

typedef struct {
    riot_driver_params_t params;
} riot_driver_t;

void riot_driver_setup(riot_driver_t *dev,
                       const riot_driver_params_t *params)
{
    dev->params = *params;
}

Why is it done this way instead of keeping a pointer to the location in
ROM?

typedef struct {
    const riot_driver_params_t *params;
} riot_driver_t;

void riot_driver_setup(riot_driver_t *dev,
                       const riot_driver_params_t *params)
{
    dev->params = params;
}

The only reason I can think of is that accessing RAM is faster than
ROM on Flash - or am I missing something?

Best,
Benjamin
_______________________________________________
devel mailing list
[email protected]
https://lists.riot-os.org/mailman/listinfo/devel

Reply via email to