ethdev: make driver-only headers private
[dpdk.git] / drivers / net / txgbe / txgbe_regs_group.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2015-2020
3  */
4
5 #ifndef _TXGBE_REGS_GROUP_H_
6 #define _TXGBE_REGS_GROUP_H_
7
8 #include "txgbe_ethdev.h"
9
10 struct txgbe_hw;
11 struct reg_info {
12         uint32_t base_addr;
13         uint32_t count;
14         uint32_t stride;
15         const char *name;
16 };
17
18 static inline int
19 txgbe_read_regs(struct txgbe_hw *hw, const struct reg_info *reg,
20         uint32_t *reg_buf)
21 {
22         unsigned int i;
23
24         for (i = 0; i < reg->count; i++)
25                 reg_buf[i] = rd32(hw,
26                                         reg->base_addr + i * reg->stride);
27         return reg->count;
28 };
29
30 static inline int
31 txgbe_regs_group_count(const struct reg_info *regs)
32 {
33         int count = 0;
34         int i = 0;
35
36         while (regs[i].count)
37                 count += regs[i++].count;
38         return count;
39 };
40
41 static inline int
42 txgbe_read_regs_group(struct rte_eth_dev *dev, uint32_t *reg_buf,
43                                           const struct reg_info *regs)
44 {
45         int count = 0;
46         int i = 0;
47         struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
48
49         while (regs[i].count)
50                 count += txgbe_read_regs(hw, &regs[i++], &reg_buf[count]);
51         return count;
52 };
53
54 #endif /* _TXGBE_REGS_GROUP_H_ */