From 8c1bae59f57cd2cffe13234aee94c2b7aa08e8dd Mon Sep 17 00:00:00 2001 From: henryk Date: Sun, 9 Dec 2007 06:49:28 +0000 Subject: Clean up SSC performance metric reporting git-svn-id: https://svn.openpcd.org:2342/trunk@382 6dc7ffe9-61d6-0310-9af1-9938baff3ed1 --- openpicc/application/cmd.c | 24 +++++++++++++++--------- openpicc/application/iso14443_layer3a.c | 2 +- openpicc/application/ssc_picc.c | 30 ++++++++++++++++++++++-------- openpicc/application/ssc_picc.h | 12 +++++++++--- 4 files changed, 47 insertions(+), 21 deletions(-) (limited to 'openpicc') diff --git a/openpicc/application/cmd.c b/openpicc/application/cmd.c index 463f514..b66c6c8 100644 --- a/openpicc/application/cmd.c +++ b/openpicc/application/cmd.c @@ -106,6 +106,12 @@ int atoiEx(const char * nptr, char * * eptr) return sign * curval; } +static const struct {ssc_metric metric; char *description;} SSC_METRICS[] = { + {OVERFLOWS, "overflows"}, + {BUFFER_ERRORS, "internal buffer management errors"}, + {FREE_BUFFERS, "free rx buffers"}, + {LATE_FRAMES, "late frames"}, +}; static const struct { int pin; char * description; } PIO_PINS[] = { {OPENPICC_PIO_PLL_LOCK, "pll lock "}, {OPENPICC_PIO_FRAME, "frame start"}, @@ -129,6 +135,7 @@ void print_pio(void) DumpStringToUSB(" *****************************************************\n\r"); } + static const AT91PS_SPI spi = AT91C_BASE_SPI; #define SPI_MAX_XFER_LEN 33 @@ -264,15 +271,14 @@ void prvExecCommand(u_int32_t cmd, portCHAR *args) { DumpStringToUSB(" * load_mod_level: "); DumpUIntToUSB(load_mod_level_set); DumpStringToUSB("\n\r"); - DumpStringToUSB(" * SSC RX overflows: "); - DumpUIntToUSB(ssc_get_overflows()); - DumpStringToUSB("\n\r"); - DumpStringToUSB(" * SSC free buffers: "); - DumpUIntToUSB(ssc_count_free()); - DumpStringToUSB("\n\r"); - DumpStringToUSB(" * SSC late frames: "); - DumpUIntToUSB(ssc_get_late_frames()); - DumpStringToUSB("\n\r"); + DumpStringToUSB(" * SSC performance metrics:\n\r"); + for(i=0; i<(int)(sizeof(SSC_METRICS)/sizeof(SSC_METRICS[0])); i++) { + DumpStringToUSB(" * \t"); + DumpStringToUSB(SSC_METRICS[i].description); + DumpStringToUSB(": "); + DumpUIntToUSB(ssc_get_metric(SSC_METRICS[i].metric)); + DumpStringToUSB("\n\r"); + } DumpStringToUSB(" * SSC status: "); DumpUIntToUSB(AT91C_BASE_SSC->SSC_SR); DumpStringToUSB("\n\r"); diff --git a/openpicc/application/iso14443_layer3a.c b/openpicc/application/iso14443_layer3a.c index a5db2cd..c4e02cd 100644 --- a/openpicc/application/iso14443_layer3a.c +++ b/openpicc/application/iso14443_layer3a.c @@ -162,7 +162,7 @@ void iso14443_layer3a_state_machine (void *pvParameters) ssc_dma_rx_buffer_t* buffer = NULL; portBASE_TYPE need_receive = 0, switch_on = 0; - if(ssc_get_overflows() > 0 && state != ERROR) { + if(ssc_get_metric(SSC_ERRORS) > 0 && state != ERROR) { LAYER3_DEBUG("SSC overflow error, please debug\n\r"); state = ERROR; } diff --git a/openpicc/application/ssc_picc.c b/openpicc/application/ssc_picc.c index ce507fd..10beaab 100644 --- a/openpicc/application/ssc_picc.c +++ b/openpicc/application/ssc_picc.c @@ -89,15 +89,8 @@ ssc_dma_tx_buffer_t ssc_tx_buffer; static volatile int overflows; static volatile int ssc_buffer_errors; static volatile int late_frames = 0; -int ssc_get_overflows(void) { - return 1000*ssc_buffer_errors + overflows; -} - -int ssc_get_late_frames(void) { - return late_frames; -} -int ssc_count_free(void) { +static int ssc_count_free(void) { int i,free = 0; for(i=0; i