Skip to content
Snippets Groups Projects
Commit fc8e9689 authored by John Hodge's avatar John Hodge
Browse files

UDI/drivers - Added a helper macro for initialising PIO blocks

parent 3c283c48
No related merge requests found
......@@ -63,4 +63,25 @@ struct s_pio_ops {
udi_ubit32_t length;
};
#define UDIH_PIO_OPS_ENTRY(list, attr, regset, base, len) {list, ARRAY_COUNT(list), attr, regset, base, len}
#define UDIH_INIT_PIO(fcnname, _array, index_field, final_code) \
void fcnname(udi_cb_t *gcb, udi_pio_handle_t new_pio_handle) {\
rdata_t *rdata = gcb->context; \
if( rdata->index_field != (udi_index_t)-1 ) { \
rdata->pio_handles[rdata->index_field] = new_pio_handle; \
}\
rdata->index_field ++; \
if( rdata->index_field < sizeof(_array)/sizeof(_array[0]) ) { \
const struct s_pio_ops *ops = &pio_ops[rdata->index_field]; \
udi_pio_map(bus_dev_bind__pio_map, gcb, \
ops->regset_idx, ops->base_offset, ops->length, \
ops->trans_list, ops->list_length, \
UDI_PIO_LITTLE_ENDIAN, 0, 0 \
); \
return ; \
} \
final_code \
}
#endif
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