hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
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
/** @file */
/******************************************************************************
 *
 * Copyright(c) 2019 Realtek Corporation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of version 2 of the GNU General Public License as
 * published by the Free Software Foundation.
 *
 * 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 GNU General Public License for
 * more details.
 *
 ******************************************************************************/
 
#ifndef _MAC_AX_PLTFM_H_
#define _MAC_AX_PLTFM_H_
 
/* Include header file which contain the following definitions, */
/* or modify this file to meet your platform */
/*[Driver] use their own header files*/
#include "../hal_headers_le.h"
 
/*[Driver] provide the define of NULL, u8, u16, u32*/
#ifndef NULL
#define NULL        ((void *)0)
#endif
 
/*[Driver] provide the type mutex*/
/* Mutex type */
#define mac_ax_mutex _os_mutex
 
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(arr)        (sizeof(arr) / sizeof((arr)[0]))
#endif
 
#define _ASSERT_ BUG_ON
 
typedef u16 __le16;
typedef u32 __le32;
typedef u16 __be16;
typedef u32 __be32;
 
/* 1: enable MAC debug messages */
/* 0: disable MAC debug messages */
#define MAC_AX_DBG_MSG_EN    1
 
/* Set debug message level */
#define MAC_AX_MSG_LEVEL_TRACE        3
#define MAC_AX_MSG_LEVEL_WARNING    2
#define MAC_AX_MSG_LEVEL_ERR        1
#define MAC_AX_MSG_LEVEL_ALWAYS        0
#define MAC_AX_MSG_LEVEL        MAC_AX_MSG_LEVEL_TRACE
 
#define SET_CLR_WORD(_w, _v, _f)                                               \
               (((_w) & ~((_f##_MSK) << (_f##_SH))) |         \
               (((_v) & (_f##_MSK)) << (_f##_SH)))
#define SET_WORD(_v, _f)    (((_v) & (_f##_MSK)) << (_f##_SH))
#define GET_FIELD(_w, _f)         (((_w) >> (_f##_SH)) & (_f##_MSK))
 
#define SET_CLR_WOR2(_w, _v, _sh, _msk) (((_w) & ~(_msk << _sh)) |             \
                   (((_v) & _msk) << _sh))
#define SET_WOR2(_v, _sh, _msk)         (((_v) & _msk) << _sh)
#define GET_FIEL2(_w, _sh, _msk)        (((_w) >> _sh) & _msk)
 
#define GET_MSK(_f)         ((_f##_MSK) << (_f##_SH))
 
#endif