]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/Altera_Code/HardwareLibrary/include/alt_timers.h
Added project for Altera Cyclone V SoC, currently running from internal RAM.
[freertos] / FreeRTOS / Demo / CORTEX_A9_Cyclone_V_SoC_DK / Altera_Code / HardwareLibrary / include / alt_timers.h
diff --git a/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/Altera_Code/HardwareLibrary/include/alt_timers.h b/FreeRTOS/Demo/CORTEX_A9_Cyclone_V_SoC_DK/Altera_Code/HardwareLibrary/include/alt_timers.h
new file mode 100644 (file)
index 0000000..3c9918f
--- /dev/null
@@ -0,0 +1,681 @@
+/*! \file\r
+ *  Altera - Module Description\r
+ */\r
+\r
+/******************************************************************************\r
+*\r
+* Copyright 2013 Altera Corporation. All Rights Reserved.\r
+*\r
+* Redistribution and use in source and binary forms, with or without\r
+* modification, are permitted provided that the following conditions are met:\r
+*\r
+* 1. Redistributions of source code must retain the above copyright notice,\r
+* this list of conditions and the following disclaimer.\r
+*\r
+* 2. Redistributions in binary form must reproduce the above copyright notice,\r
+* this list of conditions and the following disclaimer in the documentation\r
+* and/or other materials provided with the distribution.\r
+*\r
+* 3. The name of the author may not be used to endorse or promote products\r
+* derived from this software without specific prior written permission.\r
+*\r
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY EXPRESS OR\r
+* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
+* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. IN NO\r
+* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\r
+* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT\r
+* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r
+* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING\r
+* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY\r
+* OF SUCH DAMAGE.\r
+*\r
+******************************************************************************/\r
+\r
+#ifndef __ALT_GPT_H__\r
+#define __ALT_GPT_H__\r
+\r
+#include <stdint.h>\r
+#include <stdbool.h>\r
+#include "hwlib.h"\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif  /* __cplusplus */\r
+\r
+\r
+/******************************************************************************/\r
+/*! \addtogroup GPT_MGR The General Purpose Timer Manager API\r
+ *\r
+ *  There are nine on-chip general purpose timers. Seven timers are available\r
+ *  to each CPU.\n\n\r
+ *  There are four types of timers available:\r
+ *     - Four general-purpose countdown timers available to CPU0, CPU1, or the\r
+ *     FPGA.\n\r
+ *     - Each CPU has a private GP countdown timer available only to itself.\n\r
+ *     - Each CPU has a watchdog timer  available only to itself that can work in\r
+ *     GP timer countdown mode.\n\r
+ *     - One continuous-countup global timer with compare capabilities available to\r
+ *     both CPUs and the FPGA.\n\n\r
+ *     Each type has a somewhat different HW interface This API presents the same\r
+ *     external interface for each.\r
+ *\r
+ * @{\r
+ */\r
+\r
+/******************************************************************************/\r
+/*!\r
+ * This type definition enumerates the names of the timers\r
+ * managed by the General Purpose Timers Manager.\r
+ */\r
+typedef enum ALT_GPT_TIMER_e\r
+{\r
+     /*!\r
+      * \b CPU_GLOBAL_TMR - CPU Core Global timer - There is one 64-bit\r
+      * continuously incrementing counter for all CPU cores that is clocked\r
+      * by PERIPHCLK. CPU_GLOBAL_TMR selects the comparator value, compare\r
+      * enable, autoincrement value, autoincrement enable, and interrupt\r
+      * enable for the CPU this code is running on.\r
+      */\r
+    ALT_GPT_CPU_GLOBAL_TMR,\r
+\r
+    /*!\r
+     * \b CPU_PRIVATE_TMR - CPU Core 32-bit Private Timer - The private timer\r
+     * for the CPU this code is running on. Clocked by PERIPHCLK. Counts\r
+     * down to zero and can either stop or restart.\r
+     */\r
+    ALT_GPT_CPU_PRIVATE_TMR,\r
+\r
+    /*!\r
+     * \b CPU_WDTGPT_TMR - CPU Core 32-bit Watchdog Timer - The watchdog\r
+     * timer can be used as a general-purpose timer by calling\r
+     * alt_wdt_response_mode_set() to put the watchdog timer in general-purpose\r
+     * timer mode. It is recommended that programmers use the other available\r
+     * timers first before using the watchdog timer as there is more software\r
+     * overhead involved in using the watchdog timer in this mode. This enum is\r
+     * for the core watchdog timer of the CPU this code is running on. Counts\r
+     * down to zero and can either stop or restart.\r
+     */\r
+    ALT_GPT_CPU_WDTGPT_TMR,\r
+\r
+    /* Peripheral Timers */\r
+    /* OSC1 Clock Group */\r
+    /*!\r
+     * \b osc1_timer0 - 32-bit timer connected to the L4_OSC1 bus clocked by\r
+     * osc1_clk. Counts down to zero and can either stop or restart.\r
+     */\r
+    ALT_GPT_OSC1_TMR0,\r
+\r
+    /*!\r
+     * \b osc1_timer1 - 32-bit timer connected to the L4_OSC1 bus clocked by\r
+     * osc1_clk. Counts down to zero and can either stop or restart.\r
+     */\r
+    ALT_GPT_OSC1_TMR1,\r
+\r
+    /* L4_SP Clock Group */\r
+    /*!\r
+     * \b sp_timer0 - 32-bit timer connected to the L4_SP bus clocked by\r
+     * l4_sp_clk. Counts down to zero and can either stop or restart.\r
+     */\r
+    ALT_GPT_SP_TMR0,\r
+\r
+    /*!\r
+     * \b sp_timer1 - 32-bit timer connected to the L4_SP bus clocked by\r
+     * l4_sp_clk. Counts down to zero and can either stop or restart.\r
+     */\r
+    ALT_GPT_SP_TMR1\r
+\r
+}  ALT_GPT_TIMER_t;\r
+\r
+\r
+/*!\r
+ * This type definition enumerates the possible rollover or restart modes\r
+ * of the general purpose timers.\r
+ */\r
+typedef enum ALT_GPT_RESTART_MODE_e\r
+{\r
+     /*!\r
+     * \b ONE-SHOT \b MODE - \b CPU_PRIVATE_TMR,\r
+     * \b OSC1_TMR0, \b OSC1_TMR1, \b SP_TMR0, and \b SP_TMR1\r
+     * count down from the value set with alt_gpt_counter_set() to\r
+     * zero, trigger an interrupt and stop.\n\r
+     * The global timer \b CPU_GLOBAL_TMR counts up to the next compare value\r
+     * set by the compare value, triggers an interrupt and stops\r
+     * comparing.\r
+     */\r
+     ALT_GPT_RESTART_MODE_ONESHOT,\r
+\r
+    /*!\r
+     * \b USER-SUPPLIED \b COUNT - For \b CPU_PRIVATE_TMR,  \b OSC1_TMR0,\r
+     * \b OSC1_TMR1, \b SP_TMR0, and \b SP_TMR1, the timer counts down\r
+     * to zero and then resets to a value previously set using\r
+     * alt_gpt_counter_set() and continues counting.\n\r
+     * \b CPU_GLOBAL_TMR counts up to the comparator value, then adds\r
+     * the value set in alt_gpt_counter_set() to the comparator value and\r
+     * continues counting.\r
+     */\r
+     ALT_GPT_RESTART_MODE_PERIODIC\r
+\r
+} ALT_GPT_RESTART_MODE_t;\r
+\r
+\r
+/******************************************************************************/\r
+/*! \addtogroup GPT_STATUS Enable, Disable, and Status\r
+ *\r
+ * This functional group handles enabling, disabling, and reading the\r
+ * current enable state of the general purpose timers and the global timer.\r
+ *\r
+ * @{\r
+ */\r
+/******************************************************************************/\r
+/*! Uninitialize all of the general-purpose timer modules\r
+ *\r
+ */\r
+ALT_STATUS_CODE alt_gpt_all_tmr_uninit(void);\r
+\r
+/******************************************************************************/\r
+/*! Initialize all of the general-purpose timer modules\r
+ *\r
+ */\r
+ALT_STATUS_CODE alt_gpt_all_tmr_init(void);\r
+\r
+/******************************************************************************/\r
+/*!\r
+ * Stop and disable the specified general purpose timer or global timer.\r
+ *\r
+ *\r
+ * \param       tmr_id\r
+ *              The timer identifier.\r
+ *\r
+ * \retval      ALT_E_SUCCESS   The operation was successful.\r
+ * \retval      ALT_E_ERROR     The operation failed.\r
+ * \retval      ALT_E_BAD_ARG   Tried to stop an invalid timer.\r
+ */\r
+ALT_STATUS_CODE alt_gpt_tmr_stop(ALT_GPT_TIMER_t tmr_id);\r
+\r
+/******************************************************************************/\r
+/*!\r
+ * Enable and start the specified general purpose timer or global timer.\r
+ *\r
+ *\r
+ * \param       tmr_id\r
+ *              The timer identifier.\r
+ *\r
+ * \retval      ALT_E_SUCCESS   The operation was successful.\r
+ * \retval      ALT_E_ERROR     The operation failed.\r
+ * \retval      ALT_E_BAD_ARG   Tried to start an invalid timer.\r
+ */\r
+ALT_STATUS_CODE alt_gpt_tmr_start(ALT_GPT_TIMER_t tmr_id);\r
+\r
+/******************************************************************************/\r
+/*!\r
+ * Returns whether the specified timer is currently running or not.\r
+ * For the free-running 64-bit global timer, returns whether its comparison\r
+ * mode is enabled or not.\r
+ *\r
+ * \param       tmr_id\r
+ *              The timer identifier.\r
+ *\r
+ * \retval      ALT_E_TRUE      The timer is currently enabled and running.\r
+ * \retval      ALT_E_FALSE     The timer is currently disabled and stopped.\r
+ * \retval      ALT_E_BAD_ARG   Tried to access an invalid timer.\r
+ */\r
+ALT_STATUS_CODE alt_gpt_tmr_is_running(ALT_GPT_TIMER_t tmr_id);\r
+\r
+/******************************************************************************/\r
+/*!\r
+ * Restarts the specified general purpose timer with its original value. If\r
+ * used for the global timer, it updates the comparator value with the sum of\r
+ * the auto-increment value and the current global timer value and enables\r
+ * comparison mode.\r
+ *\r
+ *\r
+ * \param       tmr_id\r
+ *              The timer identifier.\r
+ *\r
+ * \retval      ALT_E_SUCCESS   The operation was successful.\r
+ * \retval      ALT_E_ERROR     The operation failed.\r
+ * \retval      ALT_E_BAD_ARG   Tried to access an invalid timer.\r
+ */\r
+ALT_STATUS_CODE alt_gpt_tmr_reset(ALT_GPT_TIMER_t tmr_id);\r
+\r
+\r
+/*! @} */\r
+/******************************************************************************/\r
+/*! \addtogroup GPT_COUNTER Counters Interface\r
+ *\r
+ * This functional group handles setting and reading the general purpose\r
+ * timer counters and the global timer.\r
+ *\r
+ * @{\r
+ * */\r
+/******************************************************************************/\r
+/*!\r
+ * For tmr_id = \b CPU_PRIVATE_TMR, \b OSC1_TMR0, \b\r
+ * OSC1_TMR1, \b SP_TMR0, or \b SP_TMR1, sets the countdown value of the\r
+ * specified timer and the value that the counter will reset to (in rollover\r
+ * mode) or if restarted (in one-shot mode). It does not automatically start\r
+ * the counter. \n For tmr_id = \b CPU_GLOBAL_TMR,\r
+ * this function sets the auto-increment value instead, which is similar in\r
+ * function to setting the reset value of the other timers. The effect of this\r
+ * function is identical to using alt_globaltmr_autoinc_set().\r
+ *\r
+ *\r
+ * \param       tmr_id\r
+ *              The timer identifier.\r
+ *\r
+ * \param       val\r
+ *              The 32-bit counter value to load.\r
+ *\r
+ * \retval      ALT_E_SUCCESS   The operation was successful.\r
+ * \retval      ALT_E_ERROR     The operation failed.\r
+ * \retval      ALT_E_BAD_ARG   Invalid input argument.\r
+ */\r
+ALT_STATUS_CODE alt_gpt_counter_set(ALT_GPT_TIMER_t tmr_id,\r
+        uint32_t val);\r
+\r
+/******************************************************************************/\r
+/*!\r
+ * For tmr_id = \b CPU_PRIVATE_TMR, \b OSC1_TMR0, \b\r
+ * OSC1_TMR1, \b SP_TMR0, or \b SP_TMR1, returns the current counter value of\r
+ * the specified timer. \n For tmr_id = \b CPU_GLOBAL_TMR, returns the 32\r
+ * low-order bits of the counter and is identical to the result returned by\r
+ * alt_globaltmr_counter_get_low32(). Use alt_globaltmr_get() to obtain the full\r
+ * 64-bit timer value.\r
+ *\r
+ * \param       tmr_id\r
+ *              The timer identifier.\r
+ *\r
+ *\r
+ * \retval      uint32_t     The current 32-bit counter value.\r
+ */\r
+uint32_t alt_gpt_counter_get(ALT_GPT_TIMER_t tmr_id);\r
+\r
+/******************************************************************************/\r
+/*!\r
+ * For tmr_id = \b CPU_PRIVATE_TMR, \b OSC1_TMR0, \b\r
+ * OSC1_TMR1, \b SP_TMR0, or \b SP_TMR1, returns the counter value that is\r
+ * set to be reloaded when the specified timer hits zero. \n\r
+ * For tmr_id =  \b CPU_GLOBAL_TMR, returns the value that will\r
+ * autoincrement the comparator value, which defines the time until the next\r
+ * comparator interrupt is triggered.  This is similar in function to the\r
+ * reset value of the other timers. It is identical to the result returned by\r
+ * alt_globaltmr_autoinc_get(). \n The value returned does not take into\r
+ * CPU_PRIVATE_TMR and  \b CPU_GLOBAL_TMR. The prescaler value may be obtained\r
+ * with alt_gpt_prescaler_get().\r
+ *\r
+ *\r
+ * \param       tmr_id\r
+ *              The timer identifier.\r
+ *\r
+ *\r
+ * \retval      uint32_t    The reset counter value currently set.\r
+ * \retval      0           An error occurred.\r
+ */\r
+uint32_t alt_gpt_reset_value_get(ALT_GPT_TIMER_t tmr_id);\r
+\r
+/******************************************************************************/\r
+/*!\r
+ * Returns the maximum counter value available for the specified\r
+ * timer. Valid for \b CPU_PRIVATE_TMR, \b OSC1_TMR0,\r
+ * \b OSC1_TMR1, \b SP_TMR0, \b SP_TMR1, and \b CPU_GLOBAL_TMR. \n\r
+ * The value returned does not factor in the value of the clock prescaler\r
+ * available for \b CPU_PRIVATE_TMR and \b CPU_GLOBAL_TMR.\r
+ *\r
+ *\r
+ * \param       tmr_id\r
+ *              The timer identifier.\r
+ *\r
+ *\r
+ * \retval      uint32_t    The maximum counter value available for this timer.\r
+ * \retval      0           An error occurred.\r
+ *\r
+ */\r
+uint32_t alt_gpt_maxcounter_get(ALT_GPT_TIMER_t tmr_id);\r
+\r
+/******************************************************************************/\r
+/*!\r
+ * Sets the clock prescaler value of the specified timer. Valid for \b\r
+ * CPU_PRIVATE_TMR and \b CPU_GLOBAL_TMR. Returns an error\r
+ * if called with a tmr_id of \b OSC1_TMR0,\r
+ * \b OSC1_TMR1, \b SP_TMR0, or \b SP_TMR1 since they have no prescaler.\r
+ *\r
+ * \param       tmr_id\r
+ *              The timer identifier.\r
+ *\r
+ * \param       val\r
+ *              The 32-bit prescaler value to load. Valid range is 1-256.\r
+ *\r
+ * \retval      ALT_E_SUCCESS   The operation was successful.\r
+ * \retval      ALT_E_ERROR     The operation failed.\r
+ * \retval      ALT_E_BAD_ARG   Invalid input argument.\r
+ */\r
+ALT_STATUS_CODE alt_gpt_prescaler_set(ALT_GPT_TIMER_t tmr_id,\r
+        uint32_t val);\r
+\r
+/******************************************************************************/\r
+/*!\r
+ * Returns the clock prescaler value of the specified timer. Valid for \b\r
+ * CPU_PRIVATE_TMR and \b CPU_GLOBAL_TMR. Returns one if\r
+ * called with a tmr_id of \b OSC1_TMR0, \b\r
+ * OSC1_TMR1, \b SP_TMR0, or \b SP_TMR1 since they have no prescaler.\r
+ *\r
+ *\r
+ * \param       tmr_id\r
+ *              The timer identifier.\r
+ *\r
+ * \retval      uint32_t    The prescaler value. Valid range is 1-256.\r
+ *                             Zero indicates an error.\r
+ */\r
+uint32_t alt_gpt_prescaler_get(ALT_GPT_TIMER_t tmr_id);\r
+\r
+/******************************************************************************/\r
+/*!\r
+ * Returns the integer portion of the current countdown frequency of the\r
+ * specified timer.\r
+ *\r
+ *\r
+ * \param       tmr_id\r
+ *              The timer identifier.\r
+ *\r
+ * \retval      unint32_t    The integer portion of the repeat frequency of the\r
+ *                             given timer, measured in Hertz (cycles per second).\r
+ */\r
+uint32_t alt_gpt_freq_get(ALT_GPT_TIMER_t tmr_id);\r
+\r
+/******************************************************************************/\r
+/*!\r
+ * Returns the current period of the specified timer measured in seconds.\r
+ * If the result is less than 64, alt_gpt_millisecs_get() will give a more\r
+ * precise result.\r
+ *\r
+ * \param       tmr_id\r
+ *              The timer identifier.\r
+ *\r
+ * \retval      uint32_t      The current period of the given timer, measured\r
+ *                         in seconds.\r
+ */\r
+uint32_t alt_gpt_time_get(ALT_GPT_TIMER_t tmr_id);\r
+\r
+/******************************************************************************/\r
+/*!\r
+ * Returns the current period of the specified timer measured in milliseconds.\r
+ *\r
+ *\r
+ *\r
+ * \param       tmr_id\r
+ *              The timer identifier.\r
+ *\r
+ * \retval      uint32_t      The current period of the given timer, measured\r
+ *                         in milliseconds. Returns 0 if result cannot fit\r
+ *                         in 32 bits. alt_gpt_time_get() can be used to\r
+ *                         obtain measurements of longer periods.\r
+ *                         alt_gpt_microsecs_get() can be used to obtain\r
+ *                         more precise measurements of shorter periods.\r
+ */\r
+uint32_t alt_gpt_time_millisecs_get(ALT_GPT_TIMER_t tmr_id);\r
+\r
+/******************************************************************************/\r
+/*!\r
+ * Returns the current period of the specified timer measured in milliseconds.\r
+ *\r
+ *\r
+ *\r
+ * \param       tmr_id\r
+ *              The timer identifier.\r
+ *\r
+ * \retval      uint32_t      The current period of the given timer, measured\r
+ *                         in microseconds. Returns 0 if result cannot fit\r
+ *                         in 32 bits. alt_gpt_millisecs_get() and\r
+ *                         alt_gpt_time_get() can be used to obtain\r
+ *                         measurements of longer periods.\r
+ */\r
+uint32_t alt_gpt_time_microsecs_get(ALT_GPT_TIMER_t tmr_id);\r
+\r
+/******************************************************************************/\r
+/*!\r
+ * Returns the current time until the specified timer counts\r
+ * down to zero, measured in seconds.\r
+ *\r
+ * \param       tmr_id\r
+ *              The timer identifier.\r
+ *\r
+ *\r
+ * \retval      uint32_t     The current 32-bit counter value.\r
+ */\r
+uint32_t alt_gpt_curtime_get(ALT_GPT_TIMER_t tmr_id);\r
+\r
+\r
+/******************************************************************************/\r
+/*!\r
+ * Returns the current time until the specified timer counts\r
+ * down to zero, measured in milliseconds. \n Returns 0xFFFFFFFF if the value\r
+ * is too large to be expressed in 32 bits.\r
+ *\r
+ * \param       tmr_id\r
+ *              The timer identifier.\r
+ *\r
+ *\r
+ * \retval      uint32_t     The current 32-bit counter value.\r
+ */\r
+uint32_t alt_gpt_curtime_millisecs_get(ALT_GPT_TIMER_t tmr_id);\r
+\r
+\r
+/******************************************************************************/\r
+/*!\r
+ * Returns the current time until the specified timer counts\r
+ * down to zero, measured in microseconds. \n Returns  0xFFFFFFFF if the value\r
+ * is too large to be expressed in 32 bits.\r
+ *\r
+ * \param       tmr_id\r
+ *              The timer identifier.\r
+ *\r
+ *\r
+ * \retval      uint32_t     The current 32-bit counter value.\r
+ */\r
+uint32_t alt_gpt_curtime_microsecs_get(ALT_GPT_TIMER_t tmr_id);\r
+\r
+\r
+/******************************************************************************/\r
+/*!\r
+ * Returns the current time until the specified timer counts\r
+ * down to zero, measured in nanoseconds. \n Returns  0xFFFFFFFF if the value\r
+ * is too large to be expressed in 32 bits.\r
+ *\r
+ * \param       tmr_id\r
+ *              The timer identifier.\r
+ *\r
+ *\r
+ * \retval      uint32_t     The current 32-bit counter value.\r
+ */\r
+uint32_t alt_gpt_curtime_nanosecs_get(ALT_GPT_TIMER_t tmr_id);\r
+\r
+\r
+/******************************************************************************/\r
+/*!\r
+ * Returns the maximum available period of the specified\r
+ * timer measured in seconds.\r
+ *\r
+ *\r
+ * \param       tmr_id\r
+ *              The timer identifier.\r
+ *\r
+ * \retval      uint32_t      The maximum period of the given timer, measured\r
+ *                         in seconds. Returns 0 if result cannot fit\r
+ *                         in 32 bits.\r
+ */\r
+uint32_t alt_gpt_maxtime_get(ALT_GPT_TIMER_t tmr_id);\r
+\r
+/******************************************************************************/\r
+/*!\r
+ * Returns the maximum available period of the specified\r
+ * timer measured in milliseconds.\r
+ *\r
+ *\r
+ * \param       tmr_id\r
+ *              The timer identifier.\r
+ *\r
+ * \retval      uint32_t      The maximum period of the given timer, measured\r
+ *                         in milliseconds. Returns 0 if result cannot fit\r
+ *                         in 32 bits.\r
+ */\r
+uint32_t alt_gpt_maxtime_millisecs_get(ALT_GPT_TIMER_t tmr_id);\r
+\r
+/*! @} */\r
+\r
+/******************************************************************************/\r
+/*! \addtogroup GPT_INT Interrupts\r
+ * This functional group handles managing, setting, clearing, and disabling\r
+ * the interrupts of the general purpose timers and the global timer.\r
+ * @{  */\r
+/******************************************************************************/\r
+/*!\r
+ * Disables the interrupt from the specified general purpose timer or\r
+ * global timer module.\r
+ *\r
+ *\r
+ * \param       tmr_id\r
+ *              The timer identifier.\r
+ *\r
+ * \retval      ALT_E_SUCCESS   The operation was successful.\r
+ * \retval      ALT_E_ERROR     The operation failed.\r
+ * \retval      ALT_E_BAD_ARG   Invalid input argument.\r
+ */\r
+ALT_STATUS_CODE alt_gpt_int_disable(ALT_GPT_TIMER_t tmr_id);\r
+\r
+/******************************************************************************/\r
+/*!\r
+ * Enables the interrupt of the specified general purpose timer or global\r
+ * timer module.\r
+ *\r
+ *\r
+ * \param       tmr_id\r
+ *              The timer identifier.\r
+ *\r
+ * \retval      ALT_E_SUCCESS   The operation was successful.\r
+ * \retval      ALT_E_ERROR     The operation failed.\r
+ * \retval      ALT_E_BAD_ARG   Invalid input argument.\r
+ */\r
+ALT_STATUS_CODE alt_gpt_int_enable(ALT_GPT_TIMER_t tmr_id);\r
+\r
+/******************************************************************************/\r
+/*!\r
+ * Return \b TRUE if the interrupt of the specified timer module is enabled\r
+ * and \b FALSE if the interrupt is disabled or masked.\r
+ *\r
+ * \param       tmr_id\r
+ *              The timer identifier.\r
+ *\r
+ * \retval      TRUE            The timer interrupt is currently enabled.\r
+ * \retval      FALSE           The timer interrupt is currently disabled.\r
+ */\r
+bool alt_gpt_int_is_enabled(ALT_GPT_TIMER_t tmr_id);\r
+\r
+/******************************************************************************/\r
+/*!\r
+ * Clear the pending interrupt status of the specified timer module.\r
+ *\r
+ *\r
+ * \param       tmr_id\r
+ *              The timer identifier.\r
+ *\r
+ * \retval      ALT_E_SUCCESS   The operation was successful.\r
+ * \retval      ALT_E_ERROR     The operation failed.\r
+ * \retval      ALT_E_BAD_ARG   Invalid input argument.\r
+ */\r
+ALT_STATUS_CODE alt_gpt_int_clear_pending(ALT_GPT_TIMER_t tmr_id);\r
+\r
+/******************************************************************************/\r
+/*!\r
+ * Read the state (pending or not) of the interrupt of the specified timer\r
+ * module without changing the interrupt state.\r
+ *\r
+ *\r
+ * \param       tmr_id\r
+ *              The timer identifier.\r
+ *\r
+ * \retval      ALT_E_TRUE            The timer interrupt is currently pending.\r
+ * \retval      ALT_E_FALSE           The timer interrupt is not currently pending.\r
+ * \retval      ALT_E_BAD_ARG   Invalid input argument.\r
+ */\r
+ALT_STATUS_CODE alt_gpt_int_is_pending(ALT_GPT_TIMER_t tmr_id);\r
+\r
+/******************************************************************************/\r
+/*!\r
+ * Read the state of the interrupt of the specified general purpose timer\r
+ * module and if the interrupt is set, clear it.\r
+ *\r
+ *\r
+ * \param       tmr_id\r
+ *              The timer identifier.\r
+ *\r
+ * \retval      ALT_E_TRUE            The timer interrupt is currently pending.\r
+ * \retval      ALT_E_FALSE           The timer interrupt is not currently pending.\r
+ * \retval      ALT_E_BAD_ARG   Invalid input argument.\r
+ */\r
+ALT_STATUS_CODE alt_gpt_int_if_pending_clear(ALT_GPT_TIMER_t tmr_id);\r
+/*! @} */\r
+\r
+/******************************************************************************/\r
+/*! \addtogroup GPT_MODE Mode Control\r
+ * This functional group handles setting and reading the operational mode of\r
+ * the general purpose timers. The module version ID read function is also\r
+ * located here.\r
+ * @{\r
+ */\r
+/******************************************************************************/\r
+/*!\r
+ * Sets the mode of the specified timer, the behavior that occurs when either\r
+ * the general-purpose timer counts down to zero or when the the global timer\r
+ * reaches its comparator value.\r
+ *\r
+ *\r
+ * \param       tmr_id\r
+ *              The timer identifier.\r
+ *\r
+ * \param       mode\r
+ *              \b GPT_RESTART_MODE_ONESHOT - To select one-shot mode for\r
+ *              the timer.\r
+ * \n           \b GPT_RESTART_MODE_PERIODIC - To select free-run mode for\r
+ *              the timer.\r
+ *\r
+ * \internal\r
+ *   The HHP HPS Timer NPP states that the value of the counter (Timer1LoadCount\r
+ *   register) must be set to 0xFFFFFFFF before changing this setting to free-\r
+ *   running mode (and timer must be disabled). The relevent L4 peripheral\r
+ *   document does not mention the requirement to write 0xFFFFFFFF to the\r
+ *   Timer1LoadCount register though.\r
+ * \endinternal\r
+ *\r
+ *\r
+ * \retval      ALT_E_SUCCESS   The operation was successful.\r
+ * \retval      ALT_E_ERROR     The operation failed.\r
+ * \retval      ALT_E_BAD_ARG   Invalid input argument.\r
+ */\r
+ALT_STATUS_CODE alt_gpt_mode_set(ALT_GPT_TIMER_t tmr_id,\r
+        ALT_GPT_RESTART_MODE_t mode);\r
+\r
+/******************************************************************************/\r
+/*!\r
+ * Reads the mode of the specified timer.\r
+ *\r
+ * \param       tmr_id\r
+ *              The timer identifier.\r
+ *\r
+ * \retval      GPT_RESTART_MODE_ONESHOT    Timer is set to one-shot mode.\r
+ * \retval      GPT_RESTART_MODE_PERIODIC   Counter value is set to a\r
+ *                                              user-defined value.\r
+ * \retval      ALT_E_BAD_ARG               Invalid input argument.\r
+ */\r
+int32_t alt_gpt_mode_get(ALT_GPT_TIMER_t tmr_id);\r
+\r
+/*! @} */\r
+/*! @} */\r
+/*! @} */\r
+/*! @} */\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif  /* __cplusplus */\r
+#endif  /* __ALT_GPT_H__ */\r