16char ascVersion, appVersion, command;
18char dataBuffer[MAXDATALEN];
19unsigned long iIteration;
21char usage[] =
"\n ascii_serial_com_encode_decode_profiler [-h] <N>\n\n"
22 " where N is the number of iterations to run\n"
23 " -h: show this help then exit\n"
26int main(
int argc,
char *argv[]) {
30 "ascii_serial_com_encode_decode_profiler not enough arguments\n");
31 fprintf(stderr,
"%s", usage);
34 if (strncmp(
"-h", argv[1], 2) == 0) {
35 fprintf(stderr,
"%s", usage);
38 const unsigned long nIterations = strtoul(argv[1], NULL, 10);
39 fprintf(stdout,
"Running with %lu iterations.\n", nIterations);
47 fprintf(stderr,
"Uncaught exception: %u, during init, exiting.\n", e);
51 for (iIteration = 0; iIteration < nIterations; iIteration++) {
57 for (
size_t iChar = 0; iChar < messageLen; iChar++) {
62 &asc, &ascVersion, &appVersion, &command, dataBuffer, &dataLen);
64 Catch(e) { fprintf(stderr,
"Uncaught exception: %u, continuing.\n", e); }
67 fprintf(stdout,
"Finished %lu iterations.\n", nIterations);
circular_buffer_uint8 * ascii_serial_com_get_output_buffer(ascii_serial_com *asc)
ASCII Serial Com get output buffer.
void ascii_serial_com_init(ascii_serial_com *asc)
ASCII Serial Com Interface init method.
void ascii_serial_com_put_message_in_output_buffer(ascii_serial_com *asc, char ascVersion, char appVersion, char command, const char *data, size_t dataLen)
ASCII Serial Com Pack and put message in output buffer.
void ascii_serial_com_get_message_from_input_buffer(ascii_serial_com *asc, char *ascVersion, char *appVersion, char *command, char *data, size_t *dataLen)
ASCII Serial Com pop message from input buffer and unpack.
circular_buffer_uint8 * ascii_serial_com_get_input_buffer(ascii_serial_com *asc)
ASCII Serial Com get input buffer.
size_t circular_buffer_get_size_uint8(const circular_buffer_uint8 *circ_buf)
circular buffer get number of elements
uint8_t circular_buffer_pop_front_uint8(circular_buffer_uint8 *circ_buf)
circular buffer pop front
void circular_buffer_push_back_uint8(circular_buffer_uint8 *circ_buf, const uint8_t element)
circular buffer push back
ASCII Serial Com Interface State struct.