nuttx/arch/avr/src/avrdx
Kerogit 0b5bf6c2c5 arch/avr/src/avrdx/avrdx_delay: add custom up_udelay function
NuttX builtin up_udelay function uses BOARD_LOOPSPERMSEC configuration
value to determine how many loops need to be done to cause requested
delay. This does not match well with AVR DA/DB microcontrollers
because the CPU clock frequency is configurable.

A board configuration could therefore provide BOARD_LOOPSPERMSEC
valid for one frequency but for other frequencies, the user would
be required to calibrate the value and would still get incorrect
result when changing the clock speed during runtime.

This patch therefore implements dynamic architecture-specific
up_udelay function which determines current clock settings
and infers required loop count from that.

New function was tested by simple application that used up_udelay
to put delays between printf calls.

Signed-off-by: Kerogit <kr.git@kerogit.eu>
2026-06-12 09:55:11 -04:00
..
iodefs arch/avr/src/avrdx: add support for reading CPU clock from other sources 2026-06-12 09:55:11 -04:00
avrdx.h arch/avr/src/avrdx/avrdx_delay: add custom up_udelay function 2026-06-12 09:55:11 -04:00
avrdx_config.h arch/avr/avrdx: added support for serial driver 2025-05-08 15:58:18 +08:00
avrdx_delay.c arch/avr/src/avrdx/avrdx_delay: add custom up_udelay function 2026-06-12 09:55:11 -04:00
avrdx_delay_loop.h arch/avr/src/avrdx/avrdx_delay: add custom up_udelay function 2026-06-12 09:55:11 -04:00
avrdx_delay_loop.S arch/avr/src/avrdx/avrdx_delay: add custom up_udelay function 2026-06-12 09:55:11 -04:00
avrdx_exceptions.S arch/avr/src/avrdx: added support for AVR128DA64 and AVR128DB64 chips 2025-05-08 15:58:18 +08:00
avrdx_gpio.h arch/avr/src/avrdx: added I/O interrupt multiplexer 2025-05-08 15:58:18 +08:00
avrdx_gpio_isr_mux.c arch/avr/src/avrdx: fixed typo in avrdx_gpio_isr_mux.c 2026-02-28 20:59:01 -05:00
avrdx_head.S arch/avr/avrdx: do not copy const variables into RAM 2025-07-10 12:21:40 -03:00
avrdx_init.c arch/avr/src/avrdx: added I/O interrupt multiplexer 2025-05-08 15:58:18 +08:00
avrdx_iodefs.h arch/avr/src/avrdx: added support for AVR128DA64 and AVR128DB64 chips 2025-05-08 15:58:18 +08:00
avrdx_lowconsole.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
avrdx_lowinit.c arch/avr/avrdx: added support for serial driver 2025-05-08 15:58:18 +08:00
avrdx_memorymap.h
avrdx_peripherals.c arch/avr/src/avrdx/avrdx_delay: add custom up_udelay function 2026-06-12 09:55:11 -04:00
avrdx_serial.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
avrdx_serial.h arch/avr/src/avrdx: fix missing code for alternate pin positions 2025-12-01 19:12:26 +08:00
avrdx_serial_early.c arch/avr/avrdx: added support for serial driver 2025-05-08 15:58:18 +08:00
avrdx_timerisr.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
avrdx_timerisr_tickless_alarm.c !sys/types.h: change time_t and clock_t to int64_t to align with other OSes 2026-05-19 16:21:28 +08:00
avrdx_twi.c include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
avrdx_twi.h arch/avr/src/avrdx: add support for TWI (I2C and SMBus) peripheral 2025-12-01 19:12:26 +08:00
chip.h
Kconfig arch/avr/src/avrdx/avrdx_delay: add custom up_udelay function 2026-06-12 09:55:11 -04:00
Make.defs arch/avr/src/avrdx/avrdx_delay: add custom up_udelay function 2026-06-12 09:55:11 -04:00