SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause copyrights: - Copyright (C) 2024 embedded brains GmbH & Co. KG enabled-by: bsps/arm/xilinx-zynqmp-rpu links: [] test-actions: - action-brief: | Synchronize with the clock tick. Disable interrupts. Busy wait three clock tick intervals. Enable interrupts. action-code: | uint32_t ns_per_tick; uint64_t three_ticks_interval; rtems_interrupt_level level; rtems_interval t_0; rtems_interval t_1; rtems_interval t_2; uint64_t m_0; uint64_t m_1; ns_per_tick = rtems_configuration_get_nanoseconds_per_tick(); three_ticks_interval = ( 7 * (uint64_t) nstosbt( ns_per_tick ) ) / 2; t_0 = rtems_clock_get_ticks_since_boot(); /* Synchronize with clock tick */ do { t_1 = rtems_clock_get_ticks_since_boot(); m_0 = (uint64_t) rtems_clock_get_monotonic_sbintime(); } while ( t_0 == t_1 ); rtems_interrupt_local_disable( level ); do { m_1 = (uint64_t) rtems_clock_get_monotonic_sbintime(); } while ( m_1 - m_0 <= three_ticks_interval ); rtems_interrupt_local_enable( level ); /* * Make sure the clock interrupt was serviced after the interrupt enable. */ do { t_2 = rtems_clock_get_ticks_since_boot(); } while ( t_1 == t_2 ); checks: - brief: | Check that exactly three clock ticks happened once interrupts are enabled again. code: | T_step_eq_u32( ${.:/step}, t_2 - t_1, 3 ); links: - role: validation uid: ../req/tick-catch-up-interval - role: validation uid: ../req/tick-catch-up-ticks links: [] test-brief: | Tests some Xilinx TTC clock driver functions. test-context: [] test-context-support: null test-description: null test-header: null test-includes: - rtems.h - sys/time.h test-local-includes: [] test-setup: null test-stop: null test-support: null test-target: testsuites/validation/tc-dev-clock-xil-ttc.c test-teardown: null type: test-case