1.1 --- a/pkg/landfall-examples/hw_info/common.h Thu Feb 01 22:41:30 2024 +0100
1.2 +++ b/pkg/landfall-examples/hw_info/common.h Thu Feb 01 22:42:56 2024 +0100
1.3 @@ -1,7 +1,8 @@
1.4 /*
1.5 - * Access various peripherals on a board.
1.6 + * Common definitions and adapter function signatures for access to
1.7 + * board-specific functionality.
1.8 *
1.9 - * Copyright (C) 2023 Paul Boddie <paul@boddie.org.uk>
1.10 + * Copyright (C) 2023, 2024 Paul Boddie <paul@boddie.org.uk>
1.11 *
1.12 * This program is free software; you can redistribute it and/or
1.13 * modify it under the terms of the GNU General Public License as
1.14 @@ -222,11 +223,61 @@
1.15
1.16
1.17
1.18 +/* TCU adapter functions. */
1.19 +
1.20 +void *tcu_init(l4_addr_t start, l4_addr_t end);
1.21 +
1.22 +void *tcu_get_channel(void *tcu, uint8_t channel, l4_cap_idx_t irq);
1.23 +
1.24 +void tcu_disable(void *tcu_channel);
1.25 +
1.26 +void tcu_enable(void *tcu_channel);
1.27 +
1.28 +int tcu_is_enabled(void *tcu_channel);
1.29 +
1.30 +uint8_t tcu_get_clock(void *tcu_channel);
1.31 +
1.32 +void tcu_set_clock(void *tcu_channel, uint8_t clock);
1.33 +
1.34 +uint32_t tcu_get_prescale(void *tcu_channel);
1.35 +
1.36 +void tcu_set_prescale(void *tcu_channel, uint32_t prescale);
1.37 +
1.38 +uint32_t tcu_get_counter(void *tcu_channel);
1.39 +
1.40 +void tcu_set_counter(void *tcu_channel, uint32_t value);
1.41 +
1.42 +uint8_t tcu_get_count_mode(void *tcu_channel);
1.43 +
1.44 +void tcu_set_count_mode(void *tcu_channel, uint8_t mode);
1.45 +
1.46 +uint32_t tcu_get_full_data_value(void *tcu_channel);
1.47 +
1.48 +void tcu_set_full_data_value(void *tcu_channel, uint32_t value);
1.49 +
1.50 +uint32_t tcu_get_half_data_value(void *tcu_channel);
1.51 +
1.52 +void tcu_set_half_data_value(void *tcu_channel, uint32_t value);
1.53 +
1.54 +int tcu_get_full_data_mask(void *tcu_channel);
1.55 +
1.56 +void tcu_set_full_data_mask(void *tcu_channel, int masked);
1.57 +
1.58 +int tcu_get_half_data_mask(void *tcu_channel);
1.59 +
1.60 +void tcu_set_half_data_mask(void *tcu_channel, int masked);
1.61 +
1.62 +int tcu_have_interrupt(void *tcu_channel);
1.63 +
1.64 +int tcu_wait_for_irq(void *tcu_channel, uint32_t timeout);
1.65 +
1.66 +
1.67 +
1.68 /* Memory regions. */
1.69
1.70 enum memory_regions
1.71 {
1.72 - AIC, CPM, DMA, GPIO, I2C, RTC, SSI
1.73 + AIC, CPM, DMA, GPIO, I2C, RTC, SSI, TCU
1.74 };
1.75
1.76