9 string name =
"/dev/ttyUSB0";
10 int32_t baud = 115200;
14 uint16_t endcount = .5 * baud;
20 if (!strcmp(argv[7],
"rtscts"))
24 if (!strcmp(argv[7],
"xonxoff"))
31 parity = atoi(argv[5]);
35 duration = atof(argv[3]);
42 endcount = duration * baud / (bits + parity + stop + 1.);
46 size_t writecount = 0;
47 size_t twritecount = 0;
48 size_t errorcount = 0;
49 size_t timeoutcount = 0;
53 for (uint8_t
i=1;
i<255; ++
i)
55 vector <uint8_t> data;
56 for (
size_t j=0; j<endcount; ++j)
63 result = port->
put_data(&data[writecount], data.size() - writecount);
67 twritecount += result;
81 }
while (result < 0 || writecount < data.size());
82 printf(
"%lf %hhu: %lu/%lu Writes @ %.0lf BPS Errors: %lu Timeouts: %lu\n", tet.
split(),
i, writecount, twritecount, writecount/tet.
lap(), errorcount, timeoutcount);
87 printf(
"\n%lf Writes: %lu @ %lf BPS Errors: %lu Timeouts: %lu\n", et.
split(), twritecount, twritecount/et.
split(), errorcount, timeoutcount);
#define SERIAL_ERROR_TIMEOUT
Definition: cosmos-errno.h:171
static string port
Definition: add_radio.cpp:16
int32_t put_data(vector< uint8_t > data)
Definition: serialclass.cpp:707
int i
Definition: rw_test.cpp:37
Definition: serialclass.h:43
ElapsedTime et
Definition: agent_cpu_device_test.cpp:51
int32_t put_char(uint8_t c)
Definition: serialclass.cpp:609
static ElapsedTime tet
Definition: agent_file4.cpp:137
double lap()
Lap Time.
Definition: elapsedtime.cpp:145
string name
Definition: cubesat2obj.cpp:6
Definition: elapsedtime.h:62
int32_t set_flowcontrol(bool rtscts, bool xonxoff)
Definition: serialclass.cpp:386
double split()
ElapsedTime::split, gets the current elapsed time since the start()
Definition: elapsedtime.cpp:234
void reset()
ElapsedTime::reset.
Definition: elapsedtime.cpp:278