Hard Processor System Technical Reference Manual: Agilex™ 5 SoCs

ID 814346
Date 4/01/2024
Public
Document Table of Contents

5.11.6.1. Initialization

To initialize the timer, perform the following steps:

  1. Initialize the timer through the timer1controlreg register:
    • Disable the timer by writing a 0 to the timer1 enable bit (timer1_enable) of the timer1controlreg register.
    Note: Before writing to a timer1 load count register (timer1loadcount), you must disable the timer by writing a 0 to the timer1_enable bit of the timer1controlreg register to avoid potential synchronization problems.
    • Program the timer mode:
      • user-defined count—write 1 to the timer1 mode bit (timer1_mode) of the timer1controlreg register.
      • free-running—write 0 to the timer1 mode bit (timer1_mode) of the timer1controlreg register.
    • Set the interrupt mask as either masked or not masked by writing a 1 or 0, respectively, to the timer1_interrupt_mask bit of the timer1controlreg register.
  2. Load the timer counter value into the timer1loadcount register.
  3. Enable the timer by writing a 1 to the timer1_enable bit of the timer1controlreg register.