Xiaohu.Huang | f78b48b | 2022-01-17 10:41:38 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2021-2022 Amlogic, Inc. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: MIT |
| 5 | */ |
| 6 | |
| 7 | #ifndef N200_FUNC_H |
| 8 | #define N200_FUNC_H |
| 9 | |
| 10 | __BEGIN_DECLS |
| 11 | |
| 12 | #include "n200_timer.h" |
bangzheng.liu | 4d71f92 | 2022-09-29 16:12:20 +0800 | [diff] [blame] | 13 | #ifdef CONFIG_N200_REVA |
| 14 | #include "interrupt_control_pic.h" |
| 15 | #else |
| 16 | #include "interrupt_control_eclic.h" |
| 17 | #endif |
xiaohu.huang | 3826210 | 2022-05-06 22:21:48 +0800 | [diff] [blame] | 18 | #include "gcc_compiler_attributes.h" |
Xiaohu.Huang | f78b48b | 2022-01-17 10:41:38 +0800 | [diff] [blame] | 19 | |
| 20 | void pmp_open_all_space(void); |
| 21 | |
| 22 | void switch_m2u_mode(void); |
| 23 | |
| 24 | uint32_t get_mtime_freq(void); |
| 25 | |
| 26 | uint32_t mtime_lo(void); |
| 27 | |
| 28 | uint32_t mtime_hi(void); |
| 29 | |
| 30 | uint64_t get_mtime_value(void); |
| 31 | |
| 32 | uint64_t get_instret_value(void); |
| 33 | |
| 34 | uint64_t get_cycle_value(void); |
| 35 | |
| 36 | uint32_t get_cpu_freq(void); |
| 37 | |
xiaohu.huang | 3826210 | 2022-05-06 22:21:48 +0800 | [diff] [blame] | 38 | uint32_t __noinline measure_cpu_freq(size_t n); |
Xiaohu.Huang | f78b48b | 2022-01-17 10:41:38 +0800 | [diff] [blame] | 39 | |
| 40 | void wfe(void); |
| 41 | |
| 42 | uint64_t get_timer_value(void); |
| 43 | |
| 44 | uint32_t get_timer_freq(void); |
| 45 | |
| 46 | void test_handler(void); |
| 47 | |
| 48 | int EnableIrq(uint32_t ulIrq); |
| 49 | |
| 50 | int DisableIrq(uint32_t ulIrq); |
| 51 | |
| 52 | int SetIrqPriority(uint32_t ulIrq, uint32_t ulProi); |
| 53 | |
| 54 | int ClearPendingIrq(uint32_t ulIrq); |
| 55 | |
| 56 | int RegisterIrq(uint32_t int_num, uint32_t int_priority, function_ptr_t handler); |
| 57 | |
| 58 | int UnRegisterIrq(uint32_t ulIrq); |
| 59 | |
| 60 | unsigned long interrupt_status_get(void); |
| 61 | |
| 62 | void interrupt_disable(void); |
| 63 | |
| 64 | void interrupt_enable(void); |
| 65 | |
Xiaohu.Huang | f78b48b | 2022-01-17 10:41:38 +0800 | [diff] [blame] | 66 | __END_DECLS |
| 67 | |
| 68 | #endif |