Lines Matching refs:ctx
71 struct gtimer_dev_ctx *ctx; in enable() local
73 ctx = mod_gtimer_ctx.table + fwk_id_get_element_idx(dev_id); in enable()
75 ctx->hw_timer->P_CTL &= ~CNTBASE_P_CTL_IMASK; in enable()
76 ctx->hw_timer->P_CTL |= CNTBASE_P_CTL_ENABLE; in enable()
83 struct gtimer_dev_ctx *ctx; in disable() local
85 ctx = mod_gtimer_ctx.table + fwk_id_get_element_idx(dev_id); in disable()
87 ctx->hw_timer->P_CTL |= CNTBASE_P_CTL_IMASK; in disable()
88 ctx->hw_timer->P_CTL &= ~CNTBASE_P_CTL_ENABLE; in disable()
95 const struct gtimer_dev_ctx *ctx; in get_counter() local
97 ctx = mod_gtimer_ctx.table + fwk_id_get_element_idx(dev_id); in get_counter()
99 *value = mod_gtimer_get_counter(ctx->hw_timer); in get_counter()
106 struct gtimer_dev_ctx *ctx; in set_timer() local
126 ctx = mod_gtimer_ctx.table + fwk_id_get_element_idx(dev_id); in set_timer()
128 ctx->hw_timer->P_CVALL = (uint32_t)(timestamp & 0xFFFFFFFFUL); in set_timer()
129 ctx->hw_timer->P_CVALH = (uint32_t)(timestamp >> 32UL); in set_timer()
136 struct gtimer_dev_ctx *ctx; in get_timer() local
140 ctx = mod_gtimer_ctx.table + fwk_id_get_element_idx(dev_id); in get_timer()
143 counter_low = ctx->hw_timer->P_CVALL; in get_timer()
144 counter_high = ctx->hw_timer->P_CVALH; in get_timer()
153 struct gtimer_dev_ctx *ctx; in get_frequency() local
159 ctx = mod_gtimer_ctx.table + fwk_id_get_element_idx(dev_id); in get_frequency()
161 *frequency = ctx->config->frequency; in get_frequency()
193 struct gtimer_dev_ctx *ctx; in gtimer_device_init() local
195 ctx = mod_gtimer_ctx.table + fwk_id_get_element_idx(element_id); in gtimer_device_init()
197 ctx->config = data; in gtimer_device_init()
198 if (ctx->config->hw_timer == 0 || in gtimer_device_init()
199 ctx->config->hw_counter == 0 || in gtimer_device_init()
200 ctx->config->control == 0 || in gtimer_device_init()
201 ctx->config->frequency < GTIMER_FREQUENCY_MIN_HZ || in gtimer_device_init()
202 ctx->config->frequency > GTIMER_FREQUENCY_MAX_HZ) { in gtimer_device_init()
207 ctx->hw_timer = (struct cntbase_reg *)ctx->config->hw_timer; in gtimer_device_init()
208 ctx->hw_counter = (struct cntctl_reg *)ctx->config->hw_counter; in gtimer_device_init()
209 ctx->control = (struct cntcontrol_reg *)ctx->config->control; in gtimer_device_init()
214 ctx->hw_counter->ACR = CNTCTL_ACR_RPCT | in gtimer_device_init()
219 ctx->hw_counter->FRQ = ctx->config->frequency; in gtimer_device_init()
239 static void gtimer_control_init(struct gtimer_dev_ctx *ctx) in gtimer_control_init() argument
242 ctx->control->CR &= ~CNTCONTROL_CR_EN; in gtimer_control_init()
243 ctx->control->FID0 = ctx->config->frequency; in gtimer_control_init()
244 ctx->control->CR |= CNTCONTROL_CR_FCREQ | CNTCONTROL_CR_EN; in gtimer_control_init()
249 struct gtimer_dev_ctx *ctx; in gtimer_start() local
255 ctx = mod_gtimer_ctx.table + fwk_id_get_element_idx(id); in gtimer_start()
257 if (ctx->config->skip_cntcontrol_init) { in gtimer_start()
261 if (!fwk_id_is_type(ctx->config->clock_id, FWK_ID_TYPE_NONE)) { in gtimer_start()
265 ctx->config->clock_id, in gtimer_start()
268 gtimer_control_init(ctx); in gtimer_start()
279 struct gtimer_dev_ctx *ctx; in gtimer_process_notification() local
288 ctx = mod_gtimer_ctx.table + fwk_id_get_element_idx(event->target_id); in gtimer_process_notification()
289 gtimer_control_init(ctx); in gtimer_process_notification()
309 static fwk_timestamp_t mod_gtimer_timestamp(const void *ctx) in mod_gtimer_timestamp() argument
313 const struct mod_gtimer_dev_config *cfg = ctx; in mod_gtimer_timestamp()
325 const void **ctx, in mod_gtimer_driver() argument
328 *ctx = cfg; in mod_gtimer_driver()