1 //***************************************************************************** 2 // 3 //! @file am_hal_stimer.h 4 //! 5 //! @brief Functions for interfacing with the system timer (STIMER). 6 //! 7 //! @addtogroup stimer4_4p STIMER - System Timer 8 //! @ingroup apollo4p_hal 9 //! @{ 10 // 11 //***************************************************************************** 12 13 //***************************************************************************** 14 // 15 // Copyright (c) 2023, Ambiq Micro, Inc. 16 // All rights reserved. 17 // 18 // Redistribution and use in source and binary forms, with or without 19 // modification, are permitted provided that the following conditions are met: 20 // 21 // 1. Redistributions of source code must retain the above copyright notice, 22 // this list of conditions and the following disclaimer. 23 // 24 // 2. Redistributions in binary form must reproduce the above copyright 25 // notice, this list of conditions and the following disclaimer in the 26 // documentation and/or other materials provided with the distribution. 27 // 28 // 3. Neither the name of the copyright holder nor the names of its 29 // contributors may be used to endorse or promote products derived from this 30 // software without specific prior written permission. 31 // 32 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 33 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 34 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 35 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 36 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 37 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 38 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 39 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 40 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 41 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 42 // POSSIBILITY OF SUCH DAMAGE. 43 // 44 // This is part of revision stable-7da8bae71f of the AmbiqSuite Development Package. 45 // 46 //***************************************************************************** 47 #ifndef AM_HAL_STIMER_H 48 #define AM_HAL_STIMER_H 49 50 #ifdef __cplusplus 51 extern "C" 52 { 53 #endif 54 55 // 56 //! Compute address of a given COMPARE register. 57 //! @note - The parameter n should be 0 (as only 1 stimer module exists). 58 //! For Apollo4p, the parameter r should be 0-7 (compare) or 0-3 (capture). 59 // 60 #define AM_HAL_STIMER_COMPARE_OFFSET (&STIMER->SCMPR1 - &STIMER->SCMPR0) 61 #define AM_REG_STIMER_COMPARE(n, r) ((&STIMER->SCMPR0) + \ 62 (r * AM_HAL_STIMER_COMPARE_OFFSET)) 63 64 //! Compute address of a given CAPTURE register. r should be 0-3. 65 #define AM_HAL_STIMER_CAPTURE_OFFSET (&STIMER->SCAPT1 - &STIMER->SCAPT0) 66 #define AM_REG_STIMER_CAPTURE(n, r) ((&STIMER->SCAPT0) + \ 67 (r * AM_HAL_STIMER_CAPTURE_OFFSET)) 68 69 //! Compute address of a given NVRAM register. r should be 0-3. 70 #define AM_HAL_STIMER_NVRAM_OFFSET (&STIMER->SNVR1 - &STIMER->SNVR0) 71 #define AM_REG_STIMER_NVRAM(n, r) ((&STIMER->SNVR0) + \ 72 (r * AM_HAL_STIMER_NVRAM_OFFSET)) 73 74 //***************************************************************************** 75 // 76 //! @name Interrupt Status Bits 77 //! @{ 78 //! Interrupt Status Bits for enable/disble use 79 //! 80 //! These macros may be used to set and clear interrupt bits 81 // 82 //***************************************************************************** 83 #define AM_HAL_STIMER_INT_COMPAREA STIMER_STMINTSTAT_COMPAREA_Msk 84 #define AM_HAL_STIMER_INT_COMPAREB STIMER_STMINTSTAT_COMPAREB_Msk 85 #define AM_HAL_STIMER_INT_COMPAREC STIMER_STMINTSTAT_COMPAREC_Msk 86 #define AM_HAL_STIMER_INT_COMPARED STIMER_STMINTSTAT_COMPARED_Msk 87 #define AM_HAL_STIMER_INT_COMPAREE STIMER_STMINTSTAT_COMPAREE_Msk 88 #define AM_HAL_STIMER_INT_COMPAREF STIMER_STMINTSTAT_COMPAREF_Msk 89 #define AM_HAL_STIMER_INT_COMPAREG STIMER_STMINTSTAT_COMPAREG_Msk 90 #define AM_HAL_STIMER_INT_COMPAREH STIMER_STMINTSTAT_COMPAREH_Msk 91 92 #define AM_HAL_STIMER_INT_OVERFLOW STIMER_STMINTSTAT_OVERFLOW_Msk 93 94 #define AM_HAL_STIMER_INT_CAPTUREA STIMER_STMINTSTAT_CAPTUREA_Msk 95 #define AM_HAL_STIMER_INT_CAPTUREB STIMER_STMINTSTAT_CAPTUREB_Msk 96 #define AM_HAL_STIMER_INT_CAPTUREC STIMER_STMINTSTAT_CAPTUREC_Msk 97 #define AM_HAL_STIMER_INT_CAPTURED STIMER_STMINTSTAT_CAPTURED_Msk 98 //! @} 99 100 //***************************************************************************** 101 // 102 //! @name STimer Configuration Bits 103 //! @{ 104 //! Interrupt Status Bits for enable/disble use 105 //! 106 //! These macros may be used to set and clear interrupt bits 107 // 108 //***************************************************************************** 109 #define AM_HAL_STIMER_CFG_THAW _VAL2FLD(STIMER_STCFG_FREEZE, STIMER_STCFG_FREEZE_THAW) 110 #define AM_HAL_STIMER_CFG_FREEZE _VAL2FLD(STIMER_STCFG_FREEZE, STIMER_STCFG_FREEZE_FREEZE) 111 #define AM_HAL_STIMER_CFG_RUN _VAL2FLD(STIMER_STCFG_CLEAR, STIMER_STCFG_CLEAR_RUN) 112 #define AM_HAL_STIMER_CFG_CLEAR _VAL2FLD(STIMER_STCFG_CLEAR, STIMER_STCFG_CLEAR_CLEAR) 113 #define AM_HAL_STIMER_CFG_COMPARE_A_ENABLE _VAL2FLD(STIMER_STCFG_COMPAREAEN, STIMER_STCFG_COMPAREAEN_ENABLE) 114 #define AM_HAL_STIMER_CFG_COMPARE_B_ENABLE _VAL2FLD(STIMER_STCFG_COMPAREBEN, STIMER_STCFG_COMPAREBEN_ENABLE) 115 #define AM_HAL_STIMER_CFG_COMPARE_C_ENABLE _VAL2FLD(STIMER_STCFG_COMPARECEN, STIMER_STCFG_COMPARECEN_ENABLE) 116 #define AM_HAL_STIMER_CFG_COMPARE_D_ENABLE _VAL2FLD(STIMER_STCFG_COMPAREDEN, STIMER_STCFG_COMPAREDEN_ENABLE) 117 #define AM_HAL_STIMER_CFG_COMPARE_E_ENABLE _VAL2FLD(STIMER_STCFG_COMPAREEEN, STIMER_STCFG_COMPAREEEN_ENABLE) 118 #define AM_HAL_STIMER_CFG_COMPARE_F_ENABLE _VAL2FLD(STIMER_STCFG_COMPAREFEN, STIMER_STCFG_COMPAREFEN_ENABLE) 119 #define AM_HAL_STIMER_CFG_COMPARE_G_ENABLE _VAL2FLD(STIMER_STCFG_COMPAREGEN, STIMER_STCFG_COMPAREGEN_ENABLE) 120 #define AM_HAL_STIMER_CFG_COMPARE_H_ENABLE _VAL2FLD(STIMER_STCFG_COMPAREHEN, STIMER_STCFG_COMPAREHEN_ENABLE) 121 //! @} 122 123 //***************************************************************************** 124 // 125 //! @name Clock Configuration options 126 //! @{ 127 //! STimer Configuration register options. 128 //! 129 //! These options are to be used with the am_hal_stimer_config() function. 130 // 131 //***************************************************************************** 132 #define AM_HAL_STIMER_NO_CLK _VAL2FLD(STIMER_STCFG_CLKSEL, STIMER_STCFG_CLKSEL_NOCLK) 133 #if defined(AM_PART_APOLLO4) 134 #define AM_HAL_STIMER_HFRC_3MHZ _VAL2FLD(STIMER_STCFG_CLKSEL, STIMER_STCFG_CLKSEL_HFRC_3MHZ) 135 #define AM_HAL_STIMER_HFRC_187_5KHZ _VAL2FLD(STIMER_STCFG_CLKSEL, STIMER_STCFG_CLKSEL_HFRC_187KHZ) 136 #elif defined(AM_PART_APOLLO4B) || defined(AM_PART_APOLLO4P) 137 #define AM_HAL_STIMER_HFRC_6MHZ _VAL2FLD(STIMER_STCFG_CLKSEL, STIMER_STCFG_CLKSEL_HFRC_6MHZ) 138 #define AM_HAL_STIMER_HFRC_375KHZ _VAL2FLD(STIMER_STCFG_CLKSEL, STIMER_STCFG_CLKSEL_HFRC_375KHZ) 139 #endif 140 #define AM_HAL_STIMER_XTAL_32KHZ _VAL2FLD(STIMER_STCFG_CLKSEL, STIMER_STCFG_CLKSEL_XTAL_32KHZ) 141 #define AM_HAL_STIMER_XTAL_16KHZ _VAL2FLD(STIMER_STCFG_CLKSEL, STIMER_STCFG_CLKSEL_XTAL_16KHZ) 142 #define AM_HAL_STIMER_XTAL_1KHZ _VAL2FLD(STIMER_STCFG_CLKSEL, STIMER_STCFG_CLKSEL_XTAL_1KHZ) 143 #define AM_HAL_STIMER_LFRC_1KHZ _VAL2FLD(STIMER_STCFG_CLKSEL, STIMER_STCFG_CLKSEL_LFRC_1KHZ) 144 #define AM_HAL_STIMER_HFRC_CTIMER0A _VAL2FLD(STIMER_STCFG_CLKSEL, STIMER_STCFG_CLKSEL_CTIMER0) 145 #define AM_HAL_STIMER_HFRC_CTIMER0B _VAL2FLD(STIMER_STCFG_CLKSEL, STIMER_STCFG_CLKSEL_CTIMER1) 146 //! @} 147 148 //***************************************************************************** 149 // 150 //! @name Minimum delta value that can be set for Stimer 151 //! @{ 152 //! STimer Limit options. 153 //! 154 //! This constant is relevant to the am_hal_stimer_compare_delta_set() function. 155 // 156 //***************************************************************************** 157 #define AM_HAL_STIMER_MIN_DELTA 4 158 //! @} 159 160 //***************************************************************************** 161 // 162 //! @name Capture Control Register options. 163 //! @{ 164 //! Configuration options for capture control register. 165 //! 166 //! These options are to be used with the am_hal_stimer_capture_control_set 167 //! function. 168 // 169 //***************************************************************************** 170 #define AM_HAL_STIMER_CAPTURE0_ENABLE _VAL2FLD(STIMER_CAPTURECONTROL_CAPTURE0, STIMER_CAPTURECONTROL_CAPTURE0_ENABLE) 171 #define AM_HAL_STIMER_CAPTURE1_ENABLE _VAL2FLD(STIMER_CAPTURECONTROL_CAPTURE1, STIMER_CAPTURECONTROL_CAPTURE1_ENABLE) 172 #define AM_HAL_STIMER_CAPTURE2_ENABLE _VAL2FLD(STIMER_CAPTURECONTROL_CAPTURE2, STIMER_CAPTURECONTROL_CAPTURE2_ENABLE) 173 #define AM_HAL_STIMER_CAPTURE3_ENABLE _VAL2FLD(STIMER_CAPTURECONTROL_CAPTURE3, STIMER_CAPTURECONTROL_CAPTURE3_ENABLE) 174 //! @} 175 176 //***************************************************************************** 177 // 178 //! STIMER Specific status codes 179 // 180 //***************************************************************************** 181 typedef enum 182 { 183 // 184 //! Delta too small for setting Compare 185 // 186 AM_HAL_STIMER_DELTA_TOO_SMALL = AM_HAL_STATUS_MODULE_SPECIFIC_START 187 } am_hal_stimer_err_e; 188 189 //***************************************************************************** 190 // 191 //! Stimer configuration structure 192 // 193 //***************************************************************************** 194 typedef struct 195 { 196 // 197 //! Configuration options for the STIMER 198 // 199 uint32_t ui32STimerConfig; 200 } 201 am_hal_stimer_config_t; 202 203 //***************************************************************************** 204 // 205 // External function definitions 206 // 207 //***************************************************************************** 208 //***************************************************************************** 209 // 210 //! @brief Set up the stimer. 211 //! 212 //! @param ui32STimerConfig is the value to load into the configuration reg. 213 //! 214 //! This function should be used to perform the initial set-up of the 215 //! stimer. 216 //! 217 //! @return The 32-bit current config of the STimer Config register 218 // 219 //***************************************************************************** 220 extern uint32_t am_hal_stimer_config(uint32_t ui32STimerConfig); 221 222 //***************************************************************************** 223 // 224 //! @brief Check if the STIMER is running. 225 //! 226 //! This function should be used to perform the initial set-up of the 227 //! stimer. 228 //! 229 //! @return true = STIMER running; false = STIMER needs to be configured. 230 // 231 //***************************************************************************** 232 extern bool am_hal_stimer_is_running(void); 233 234 //***************************************************************************** 235 // 236 //! @brief Reset the current stimer block to power-up state. 237 // 238 //***************************************************************************** 239 extern void am_hal_stimer_reset_config(void); 240 241 //***************************************************************************** 242 // 243 //! @brief Get the current stimer value. 244 //! 245 //! This function can be used to read, uninvasively, the value in the stimer. 246 //! 247 //! @return The 32-bit value from the STimer counter register. 248 // 249 //***************************************************************************** 250 extern uint32_t am_hal_stimer_counter_get(void); 251 252 //***************************************************************************** 253 // 254 //! @brief Clear the stimer counter. 255 //! 256 //! This function clears the STimer Counter and leaves the stimer running. 257 // 258 //***************************************************************************** 259 extern void am_hal_stimer_counter_clear(void); 260 261 //***************************************************************************** 262 // 263 //! @brief Set the compare value. 264 //! 265 //! @param ui32CmprInstance is the compare register instance number (0-7). 266 //! @param ui32Delta is the value to add to the STimer counter and load into 267 //! the comparator register. 268 //! 269 //! @note There is no way to set an absolute value into a comparator register. 270 //! Only deltas added to the STimer counter can be written to the compare 271 //! registers. 272 //! Back to back writes to COMPARE are not reliable. This function takes 273 //! care of adding necessary wait till the value can be safely written. 274 //! If blocking in this function is not desirable, application should 275 //! check for it beforehand using am_hal_stimer_check_compare_delta_set() 276 //! 277 //! @return AM_HAL_STATUS_SUCCESS on success. 278 //! The minimum value that can be set is AM_HAL_STIMER_MIN_DELTA. If the 279 //! value supplied is less - the function bumps it up to safe value and 280 //! returns AM_HAL_STIMER_DELTA_TOO_SMALL 281 // 282 //***************************************************************************** 283 extern uint32_t am_hal_stimer_compare_delta_set(uint32_t ui32CmprInstance, 284 uint32_t ui32Delta); 285 286 //***************************************************************************** 287 // 288 //! @brief Get the current stimer compare register value. 289 //! 290 //! @param ui32CmprInstance is the compare register instance number (0-7). 291 //! 292 //! This function can be used to read the value in an stimer compare register. 293 //! 294 //! @note stimer compare register cannot be reliably read immediately after it 295 //! has been written to. This function will block in a wait loop 296 //! till the value can be safely read. 297 //! 298 //! @return Return the compare register value. 299 // 300 //***************************************************************************** 301 extern uint32_t am_hal_stimer_compare_get(uint32_t ui32CmprInstance); 302 303 //***************************************************************************** 304 // 305 //! @brief Start capturing data with the specified capture register. 306 //! 307 //! @param ui32CaptureNum is the Capture Register Number to read (0-3). 308 //! @param ui32GPIONumber is the pin number. 309 //! @param bPolarity: false (0) = Capture on low to high transition. 310 //! true (1) = Capture on high to low transition. 311 //! 312 //! Use this function to start capturing. 313 // 314 //***************************************************************************** 315 extern void am_hal_stimer_capture_start(uint32_t ui32CaptureNum, 316 uint32_t ui32GPIONumber, 317 bool bPolarity); 318 319 //***************************************************************************** 320 // 321 //! @brief Stop capturing data with the specified capture register. 322 //! 323 //! @param ui32CaptureNum is the Capture Register Number to read. 324 //! 325 //! Use this function to stop capturing. 326 // 327 //***************************************************************************** 328 extern void am_hal_stimer_capture_stop(uint32_t ui32CaptureNum); 329 330 //***************************************************************************** 331 // 332 //! @brief Get the current stimer capture register value. 333 //! 334 //! @param ui32CaptureNum is the Capture Register Number to read. 335 //! 336 //! This function can be used to read the value in an stimer capture register. 337 //! 338 //! @return Return the capture register value. 339 // 340 //***************************************************************************** 341 extern uint32_t am_hal_stimer_capture_get(uint32_t ui32CaptureNum); 342 343 //***************************************************************************** 344 // 345 //! @brief Set the current stimer nvram register value. 346 //! 347 //! @param ui32NvramNum is the NVRAM Register Number to read. 348 //! @param ui32NvramVal is the value to write to NVRAM. 349 //! 350 //! This function can be used to read the value in an stimer NVRAM register. 351 // 352 //***************************************************************************** 353 extern void am_hal_stimer_nvram_set(uint32_t ui32NvramNum, uint32_t ui32NvramVal); 354 355 //***************************************************************************** 356 // 357 //! @brief Get the current stimer nvram register value. 358 //! 359 //! @param ui32NvramNum is the NVRAM Register Number to read. 360 //! 361 //! This function can be used to read the value in an stimer NVRAM register. 362 //! 363 //! @return Return the nvram register value. 364 // 365 //***************************************************************************** 366 extern uint32_t am_hal_stimer_nvram_get(uint32_t ui32NvramNum); 367 368 //***************************************************************************** 369 // 370 //! @brief Enables the selected system timer interrupt. 371 //! 372 //! @param ui32Interrupt is the interrupt to be used. 373 //! 374 //! This function will enable the selected interrupts in the STIMER interrupt 375 //! enable register. In order to receive an interrupt from an stimer component, 376 //! you will need to enable the interrupt for that component in this main 377 //! register, as well as in the stimer configuration register (accessible though 378 //! am_hal_stimer_config()), and in the NVIC. 379 //! 380 //! ui32Interrupt should be the logical OR of one or more of the following 381 //! values: 382 //! 383 //! AM_HAL_STIMER_INT_COMPAREA 384 //! AM_HAL_STIMER_INT_COMPAREB 385 //! AM_HAL_STIMER_INT_COMPAREC 386 //! AM_HAL_STIMER_INT_COMPARED 387 //! AM_HAL_STIMER_INT_COMPAREE 388 //! AM_HAL_STIMER_INT_COMPAREF 389 //! AM_HAL_STIMER_INT_COMPAREG 390 //! AM_HAL_STIMER_INT_COMPAREH 391 //! 392 //! AM_HAL_STIMER_INT_OVERFLOW 393 //! 394 //! AM_HAL_STIMER_INT_CAPTUREA 395 //! AM_HAL_STIMER_INT_CAPTUREB 396 //! AM_HAL_STIMER_INT_CAPTUREC 397 //! AM_HAL_STIMER_INT_CAPTURED 398 // 399 //***************************************************************************** 400 extern void am_hal_stimer_int_enable(uint32_t ui32Interrupt); 401 402 //***************************************************************************** 403 // 404 //! @brief Return the enabled stimer interrupts. 405 //! 406 //! This function will return all enabled interrupts in the STIMER 407 //! interrupt enable register. 408 //! 409 //! @return return enabled interrupts. This will be a logical or of: 410 //! 411 //! AM_HAL_STIMER_INT_COMPAREA 412 //! AM_HAL_STIMER_INT_COMPAREB 413 //! AM_HAL_STIMER_INT_COMPAREC 414 //! AM_HAL_STIMER_INT_COMPARED 415 //! AM_HAL_STIMER_INT_COMPAREE 416 //! AM_HAL_STIMER_INT_COMPAREF 417 //! AM_HAL_STIMER_INT_COMPAREG 418 //! AM_HAL_STIMER_INT_COMPAREH 419 //! 420 //! AM_HAL_STIMER_INT_OVERFLOW 421 //! 422 //! AM_HAL_STIMER_INT_CAPTUREA 423 //! AM_HAL_STIMER_INT_CAPTUREB 424 //! AM_HAL_STIMER_INT_CAPTUREC 425 //! AM_HAL_STIMER_INT_CAPTURED 426 //! 427 //! @return Return the enabled timer interrupts. 428 // 429 //***************************************************************************** 430 extern uint32_t am_hal_stimer_int_enable_get(void); 431 432 //***************************************************************************** 433 // 434 //! @brief Disables the selected stimer interrupt. 435 //! 436 //! @param ui32Interrupt is the interrupt to be used. 437 //! 438 //! This function will disable the selected interrupts in the STIMER 439 //! interrupt register. 440 //! 441 //! ui32Interrupt should be the logical OR of one or more of the following 442 //! values: 443 //! 444 //! AM_HAL_STIMER_INT_COMPAREA 445 //! AM_HAL_STIMER_INT_COMPAREB 446 //! AM_HAL_STIMER_INT_COMPAREC 447 //! AM_HAL_STIMER_INT_COMPARED 448 //! AM_HAL_STIMER_INT_COMPAREE 449 //! AM_HAL_STIMER_INT_COMPAREF 450 //! AM_HAL_STIMER_INT_COMPAREG 451 //! AM_HAL_STIMER_INT_COMPAREH 452 //! 453 //! AM_HAL_STIMER_INT_OVERFLOW 454 //! 455 //! AM_HAL_STIMER_INT_CAPTUREA 456 //! AM_HAL_STIMER_INT_CAPTUREB 457 //! AM_HAL_STIMER_INT_CAPTUREC 458 //! AM_HAL_STIMER_INT_CAPTURED 459 // 460 //***************************************************************************** 461 extern void am_hal_stimer_int_disable(uint32_t ui32Interrupt); 462 463 //***************************************************************************** 464 // 465 //! @brief Sets the selected stimer interrupt. 466 //! 467 //! @param ui32Interrupt is the interrupt to be used. 468 //! 469 //! This function will set the selected interrupts in the STIMER 470 //! interrupt register. 471 //! 472 //! ui32Interrupt should be the logical OR of one or more of the following 473 //! values: 474 //! 475 //! AM_HAL_STIMER_INT_COMPAREA 476 //! AM_HAL_STIMER_INT_COMPAREB 477 //! AM_HAL_STIMER_INT_COMPAREC 478 //! AM_HAL_STIMER_INT_COMPARED 479 //! AM_HAL_STIMER_INT_COMPAREE 480 //! AM_HAL_STIMER_INT_COMPAREF 481 //! AM_HAL_STIMER_INT_COMPAREG 482 //! AM_HAL_STIMER_INT_COMPAREH 483 //! 484 //! AM_HAL_STIMER_INT_OVERFLOW 485 //! 486 //! AM_HAL_STIMER_INT_CAPTUREA 487 //! AM_HAL_STIMER_INT_CAPTUREB 488 //! AM_HAL_STIMER_INT_CAPTUREC 489 //! AM_HAL_STIMER_INT_CAPTURED 490 // 491 //***************************************************************************** 492 extern void am_hal_stimer_int_set(uint32_t ui32Interrupt); 493 494 //***************************************************************************** 495 // 496 //! @brief Clears the selected stimer interrupt. 497 //! 498 //! @param ui32Interrupt is the interrupt to be used. 499 //! 500 //! This function will clear the selected interrupts in the STIMER 501 //! interrupt register. 502 //! 503 //! ui32Interrupt should be the logical OR of one or more of the following 504 //! values: 505 //! 506 //! AM_HAL_STIMER_INT_COMPAREA 507 //! AM_HAL_STIMER_INT_COMPAREB 508 //! AM_HAL_STIMER_INT_COMPAREC 509 //! AM_HAL_STIMER_INT_COMPARED 510 //! AM_HAL_STIMER_INT_COMPAREE 511 //! AM_HAL_STIMER_INT_COMPAREF 512 //! AM_HAL_STIMER_INT_COMPAREG 513 //! AM_HAL_STIMER_INT_COMPAREH 514 //! 515 //! AM_HAL_STIMER_INT_OVERFLOW 516 //! 517 //! AM_HAL_STIMER_INT_CAPTUREA 518 //! AM_HAL_STIMER_INT_CAPTUREB 519 //! AM_HAL_STIMER_INT_CAPTUREC 520 //! AM_HAL_STIMER_INT_CAPTURED 521 // 522 //***************************************************************************** 523 extern void am_hal_stimer_int_clear(uint32_t ui32Interrupt); 524 525 //***************************************************************************** 526 // 527 //! @brief Returns either the enabled or raw stimer interrupt status. 528 //! 529 //! This function will return the stimer interrupt status. 530 //! 531 //! @param bEnabledOnly if true returns the status of the enabled interrupts 532 //! only. 533 //! 534 //! The return value will be the logical OR of one or more of the following 535 //! values: 536 //! 537 //! @return Returns the stimer interrupt status. 538 // 539 //***************************************************************************** 540 extern uint32_t am_hal_stimer_int_status_get(bool bEnabledOnly); 541 542 //***************************************************************************** 543 // 544 //! @brief Check if the compare value can be set without blocking. 545 //! 546 //! @param ui32CmprInstance is the compare register instance number (0-7). 547 //! 548 //! @return true if delta can be set safely without blocking. 549 // 550 //***************************************************************************** 551 extern bool am_hal_stimer_check_compare_delta_set(uint32_t ui32CmprInstance); 552 553 #ifdef __cplusplus 554 } 555 #endif 556 557 #endif // AM_HAL_STIMER_H 558 559 //***************************************************************************** 560 // 561 // End Doxygen group. 562 //! @} 563 // 564 //***************************************************************************** 565 566