34#ifndef _FREERTOS_DRIVERS_COMMON_BENCHMARKCAN_HXX_
35#define _FREERTOS_DRIVERS_COMMON_BENCHMARKCAN_HXX_
70 bool need_signal =
false;
102 ssize_t
read(
File *file,
void *buf,
size_t count)
override
104 ssize_t result =
Can::read(file, buf, count);
106 bool need_signal =
false;
111 unsigned num_frames = result /
sizeof(
struct can_frame);
136 ssize_t
write(
File *file,
const void *buf,
size_t count)
override
147 bool need_signal =
false;
See OSMutexLock in os/OS.hxx.
Lightweight locking class for protecting small critical sections.
Generic CAN driver for throughput testing purposes.
ssize_t write(File *file, const void *buf, size_t count) override
Write to a file or device.
~BenchmarkCan()
Destructor.
void tx_msg() override
function to try and transmit a message
long long readTimeLast_
timestamp of last read in OS time
bool refill_locked()
Refills the rxBuf from the packet_ and readCount.
void disable() override
function to disable device
void start_benchmark(const struct can_frame *frame, unsigned count)
Start a benchmarking run.
size_t readCount_
count of packets still to inject
long long get_timestamp(unsigned *count)
Get the latest performance time stamp.
struct can_frame packet_
packet to inject.
ssize_t read(File *file, void *buf, size_t count) override
Read from a file or device.
BenchmarkCan(const char *name)
Constructor.
void enable() override
function to enable device
Base class for a CAN device for the Arduino environment.
int read(struct can_frame *frame)
Read a frame if there is one available.
DeviceBuffer< struct can_frame > * rxBuf
receive buffer
size_t space()
Return the number of items for which space is available.
void signal_condition()
Signal the wakeup condition.
size_t pending()
Return the number of items in the queue.
size_t put(const T *buf, size_t items)
Insert a number of items to the buffer.
const char * name
device name
static long long get_monotonic()
Get the monotonic time since the system started.
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Removes default copy-constructor and assignment added by C++.