| 1 |
/* |
| 2 |
* The MIT License (MIT) |
| 3 |
* |
| 4 |
* Copyright (c) 2021 Renesas Electronics Corporation |
| 5 |
* |
| 6 |
* Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 |
* of this software and associated documentation files (the "Software"), to deal |
| 8 |
* in the Software without restriction, including without limitation the rights |
| 9 |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 10 |
* copies of the Software, and to permit persons to whom the Software is |
| 11 |
* furnished to do so, subject to the following conditions: |
| 12 |
* |
| 13 |
* The above copyright notice and this permission notice shall be included in |
| 14 |
* all copies or substantial portions of the Software. |
| 15 |
* |
| 16 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 |
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 |
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 22 |
* THE SOFTWARE. |
| 23 |
*/ |
| 24 |
|
| 25 |
#ifndef RA_RA_TIMER_H_ |
| 26 |
#define RA_RA_TIMER_H_ |
| 27 |
|
| 28 |
#include <stdint.h> |
| 29 |
|
| 30 |
void SysTick_Handler(void); |
| 31 |
uint32_t HAL_GetTick(void); |
| 32 |
|
| 33 |
#define DEF_CLKDEV 2 |
| 34 |
#define TENUSEC_COUNT (PCLK / DEF_CLKDEV / 100000) |
| 35 |
#define MSEC_COUNT (PCLK / DEF_CLKDEV / 100) |
| 36 |
|
| 37 |
typedef void (*AGT_TIMER_CB)(void *); |
| 38 |
|
| 39 |
void ra_agt_timer_set_callback(uint32_t ch, AGT_TIMER_CB cb, void *param); |
| 40 |
void ra_agt_int_isr0(void); |
| 41 |
void ra_agt_int_isr1(void); |
| 42 |
void ra_agt_timer_start(uint32_t ch); |
| 43 |
void ra_agt_timer_stop(uint32_t ch); |
| 44 |
void ra_agt_timer_set_freq(uint32_t ch, float freq); |
| 45 |
float ra_agt_timer_get_freq(uint32_t ch); |
| 46 |
void ra_agt_timer_init(uint32_t ch, float freq); |
| 47 |
void ra_agt_timer_deinit(uint32_t ch); |
| 48 |
__WEAK void agt_int_isr(void); |
| 49 |
uint32_t mtick(); |
| 50 |
|
| 51 |
#endif /* RA_RA_TIMER_H_ */ |