Commit 7bdf7669 authored by Aurelio Colosimo's avatar Aurelio Colosimo

All datasets except Port DS moved to struct pp_globals

Signed-off-by: Aurelio Colosimo's avatarAurelio Colosimo <aurelio@aureliocolosimo.it>
parent 315f56a6
......@@ -58,19 +58,19 @@ int main(int argc, char **argv)
/* FIXME check all of these calloc's, since some stuff will be
* part of pp_globals */
ppi->defaultDS = calloc(1, sizeof(*ppi->defaultDS));
ppi->currentDS = calloc(1, sizeof(*ppi->currentDS));
ppi->parentDS = calloc(1, sizeof(*ppi->parentDS));
GLBS(ppi)->defaultDS = calloc(1, sizeof(*GLBS(ppi)->defaultDS));
GLBS(ppi)->currentDS = calloc(1, sizeof(*GLBS(ppi)->currentDS));
GLBS(ppi)->parentDS = calloc(1, sizeof(*GLBS(ppi)->parentDS));
ppi->portDS = calloc(1, sizeof(*ppi->portDS));
ppi->timePropertiesDS = calloc(1, sizeof(*ppi->timePropertiesDS));
GLBS(ppi)->timePropertiesDS = calloc(1, sizeof(*GLBS(ppi)->timePropertiesDS));
GLBS(ppi)->servo = calloc(1, sizeof(*GLBS(ppi)->servo));
ppi->arch_data = calloc(1, sizeof(struct posix_arch_data));
ppi->n_ops = &posix_net_ops;
ppi->t_ops = &posix_time_ops;
if ((!ppi->defaultDS) || (!ppi->currentDS) || (!ppi->parentDS)
|| (!ppi->portDS) || (!ppi->timePropertiesDS)
if ((!GLBS(ppi)->defaultDS) || (!GLBS(ppi)->currentDS) || (!GLBS(ppi)->parentDS)
|| (!ppi->portDS) || (!GLBS(ppi)->timePropertiesDS)
|| (!GLBS(ppi)->frgn_master) || (!ppi->arch_data)
)
exit(__LINE__);
......
......@@ -46,11 +46,7 @@ static struct pp_globals ppg_static; /* forward declaration */
/* despite the name, ppi_static is not static: tests/measure_t24p.c uses it */
struct pp_instance ppi_static = {
.glbs = &ppg_static,
.defaultDS = &defaultDS,
.currentDS = &currentDS,
.parentDS = &parentDS,
.portDS = &portDS,
.timePropertiesDS = &timePropertiesDS,
.n_ops = &wrpc_net_ops,
.t_ops = &wrpc_time_ops,
};
......@@ -60,6 +56,10 @@ static struct pp_globals ppg_static = {
.nports = 1,
.pp_instances = &ppi_static,
.servo = &servo,
.defaultDS = &defaultDS,
.currentDS = &currentDS,
.parentDS = &parentDS,
.timePropertiesDS = &timePropertiesDS,
};
int wrc_ptp_init()
......
......@@ -159,12 +159,7 @@ struct pp_instance {
TimeInternal cField; /* transp. clocks */
TimeInternal last_rcv_time, last_snt_time; /* two temporaries */
/* Data sets */
DSDefault *defaultDS; /* page 65 */
DSCurrent *currentDS; /* page 67 */
DSParent *parentDS; /* page 68 */
DSPort *portDS; /* page 72 */
DSTimeProperties *timePropertiesDS; /* page 70 */
unsigned long timeouts[__PP_TO_ARRAY_SIZE];
UInteger16 recv_sync_sequence_id;
......@@ -191,6 +186,13 @@ struct pp_globals {
struct pp_frgn_master frgn_master[PP_NR_FOREIGN_RECORDS];
struct pp_servo *servo;
/* Data sets */
DSDefault *defaultDS; /* page 65 */
DSCurrent *currentDS; /* page 67 */
DSParent *parentDS; /* page 68 */
DSTimeProperties *timePropertiesDS; /* page 70 */
/* FIXME Here include all is common to many interfaces */
};
......
......@@ -38,17 +38,17 @@ static inline struct pp_globals *GLBS(struct pp_instance *ppi)
static inline struct DSDefault *DSDEF(struct pp_instance *ppi)
{
return ppi->defaultDS;
return GLBS(ppi)->defaultDS;
}
static inline struct DSCurrent *DSCUR(struct pp_instance *ppi)
{
return ppi->currentDS;
return GLBS(ppi)->currentDS;
}
static inline struct DSParent *DSPAR(struct pp_instance *ppi)
{
return ppi->parentDS;
return GLBS(ppi)->parentDS;
}
static inline struct DSPort *DSPOR(struct pp_instance *ppi)
......@@ -58,7 +58,7 @@ static inline struct DSPort *DSPOR(struct pp_instance *ppi)
static inline struct DSTimeProperties *DSPRO(struct pp_instance *ppi)
{
return ppi->timePropertiesDS;
return GLBS(ppi)->timePropertiesDS;
}
static inline struct pp_net_path *NP(struct pp_instance *ppi)
......
......@@ -39,11 +39,11 @@ int ppsi_main(int argc, char **argv)
PP_PRINTF("bare: starting. Compiled on %s\n", __DATE__);
ppi->glbs = ppg;
ppi->defaultDS = &defaultDS;
ppi->currentDS = &currentDS;
ppi->parentDS = &parentDS;
GLBS(ppi)->defaultDS = &defaultDS;
GLBS(ppi)->currentDS = &currentDS;
GLBS(ppi)->parentDS = &parentDS;
ppi->portDS = &portDS;
ppi->timePropertiesDS = &timePropertiesDS;
GLBS(ppi)->timePropertiesDS = &timePropertiesDS;
GLBS(ppi)->servo = &servo;
ppi->arch_data = NULL;
ppi->n_ops = &bare_net_ops;
......
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