1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
/*
* Copyright : (C) 2023 Phytium Information Technology, Inc.
* All Rights Reserved.
*
* This program is OPEN SOURCE software: you can redistribute it and/or modify it
* under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd,
* either version 1.0 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the Phytium Public License for more details.
*
*
* FilePath: fdrivers_port.h
* Created Date: 2023-10-16 17:02:35
* Last Modified: Tue Feb 20 2024
* Description: This file is for drive layer code decoupling
*
* Modify History:
* Ver Who Date Changes
* ----- ---------- -------- ---------------------------------
* 1.0 huanghe 2023/10/17 first release
*/
#ifndef FDRIVERS_PORT_H
#define FDRIVERS_PORT_H
#include <rtthread.h>
/***************************** Include Files *********************************/
#include "rtconfig.h"
#include "ftypes.h"
#include "fkernel.h"
#include "fassert.h"
#include "fio.h"
#include "drv_log.h"
#include "fkernel.h"
#include "faarch.h"
#ifdef __cplusplus
extern "C"
{
#endif
/* cache */
void FDriverDCacheRangeFlush(uintptr_t adr, size_t len);
void FDriverDCacheRangeInvalidate(uintptr_t adr, size_t len);
void FDriverICacheRangeInvalidate(uintptr_t adr, size_t len);
void FDriverICacheInvalidate(void);
void FDriverDCacheInvalidate(void);
/* memory barrier */
#define FDRIVER_DSB() DSB()
#define FDRIVER_DMB() DMB()
#define FDRIVER_ISB() ISB()
/* time delay */
void FDriverUdelay(u32 usec);
void FDriverMdelay(u32 msec);
void FDriverSdelay(u32 sec);
#if (DBG_LEVEL >= DBG_WARNING)
#define FT_DEBUG_PRINT_W(TAG, format, ...) LOG_W(format, ##__VA_ARGS__)
#else
#define FT_DEBUG_PRINT_W(TAG, format, ...) LOG_W(...)
#endif
#if (DBG_LEVEL >= DBG_INFO)
#define FT_DEBUG_PRINT_I(TAG, format, ...) LOG_I(format, ##__VA_ARGS__)
#else
#define FT_DEBUG_PRINT_I(TAG, format, ...) LOG_I(...)
#endif
#if (DBG_LEVEL >= DBG_ERROR)
#define FT_DEBUG_PRINT_E(TAG, format, ...) LOG_E(format, ##__VA_ARGS__)
#else
#define FT_DEBUG_PRINT_E(TAG, format, ...) LOG_E(...)
#endif
#if (DBG_LEVEL >= DBG_LOG)
#define FT_DEBUG_PRINT_D(TAG, format, ...) LOG_D(format, ##__VA_ARGS__)
#else
#define FT_DEBUG_PRINT_D(TAG, format, ...) LOG_D(...)
#endif
#if (DBG_LEVEL >= DBG_LOG)
#define FT_DEBUG_PRINT_V(TAG, format, ...) LOG_D(format, ##__VA_ARGS__)
#else
#define FT_DEBUG_PRINT_V(TAG, format, ...) LOG_D(...)
#endif
#ifdef __cplusplus
}
#endif
#endif
|