Skip to content

Commit ef4fd5c

Browse files
committed
nfb-dual-port
1 parent 9fe312a commit ef4fd5c

File tree

2 files changed

+279
-227
lines changed

2 files changed

+279
-227
lines changed

input/nfbCInterface/include/ndpreader.hpp

Lines changed: 37 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,47 +3,51 @@
33

44
#include "ndpheader.h"
55

6+
#include <nfb/ndp.h>
67
#include <stdint.h>
78
#include <string>
8-
#include <vector>
9-
#include <nfb/ndp.h>
109
#include <sys/time.h>
10+
#include <vector>
1111

1212
enum class NdpFwType {
13-
NDP_FW_HANIC,
14-
NDP_FW_NDK,
15-
NDP_FW_UNKNOWN,
13+
NDP_FW_HANIC,
14+
NDP_FW_NDK,
15+
NDP_FW_UNKNOWN,
1616
};
1717

18-
class NdpReader
19-
{
18+
class NdpReader {
2019
public:
21-
NdpReader(uint16_t packet_bufferSize = 50, uint64_t timeout = 300);
22-
~NdpReader();
23-
24-
int init_interface(const std::string &interface);
25-
void print_stats();
26-
void close();
27-
int get_pkt(struct ndp_packet **ndp_packet, struct timeval *timestamp);
28-
std::string error_msg;
20+
NdpReader(uint16_t packet_bufferSize = 50, uint64_t timeout = 300);
21+
~NdpReader();
22+
23+
int init_interface(const std::string& interface);
24+
void print_stats();
25+
void close();
26+
int get_pkt(struct ndp_packet** ndp_packet, struct timeval* timestamp);
27+
std::string error_msg;
28+
2929
private:
30-
void set_booted_fw();
31-
void convert_fw_ts_to_timeval(const uint64_t *fw_ts, struct timeval *tv);
32-
void set_sw_timestamp(struct timeval *tv);
33-
bool retrieve_ndp_packets();
34-
struct nfb_device *dev_handle; // NFB device
35-
struct ndp_queue *rx_handle; // data receiving NDP queue
36-
uint64_t processed_packets;
37-
uint16_t packet_bufferSize;
38-
uint64_t timeout;
39-
40-
NdpFwType fw_type;
41-
std::vector<uint32_t> ndk_timestamp_offsets;
42-
43-
uint16_t ndp_packet_buffer_processed;
44-
uint16_t ndp_packet_buffer_packets;
45-
struct ndp_packet *ndp_packet_buffer;
46-
bool ndp_packet_buffer_valid;
30+
void set_booted_fw();
31+
void convert_fw_ts_to_timeval(const uint64_t* fw_ts, struct timeval* tv);
32+
void set_sw_timestamp(struct timeval* tv);
33+
bool retrieve_ndp_packets();
34+
struct nfb_device* dev_handle; // NFB device
35+
std::vector<struct nfb_device*> dev_handles; // NFB devices
36+
std::vector<struct ndp_queue*> rx_handles; // data receiving NDP queues
37+
struct ndp_queue* rx_handle; // data receiving NDP queue
38+
uint64_t processed_packets;
39+
uint16_t packet_bufferSize;
40+
uint64_t timeout;
41+
42+
NdpFwType fw_type;
43+
std::vector<uint32_t> ndk_timestamp_offsets;
44+
45+
uint16_t ndp_packet_buffer_processed;
46+
uint16_t ndp_packet_buffer_packets;
47+
struct ndp_packet* ndp_packet_buffer;
48+
bool ndp_packet_buffer_valid;
49+
50+
uint64_t port_index = 0;
4751
};
4852

49-
#endif //NFBREADER_HPP
53+
#endif // NFBREADER_HPP

0 commit comments

Comments
 (0)