summaryrefslogtreecommitdiff
path: root/openpicc/application/ssc_picc.c
diff options
context:
space:
mode:
authorhenryk <henryk@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2007-12-09 06:49:28 +0000
committerhenryk <henryk@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2007-12-09 06:49:28 +0000
commit8c1bae59f57cd2cffe13234aee94c2b7aa08e8dd (patch)
tree13c5244859d81bdecf92fa67c8103fef31335ff8 /openpicc/application/ssc_picc.c
parentceb643380b02d0d8289e3ad75a495123414ace8c (diff)
Clean up SSC performance metric reporting
git-svn-id: https://svn.openpcd.org:2342/trunk@382 6dc7ffe9-61d6-0310-9af1-9938baff3ed1
Diffstat (limited to 'openpicc/application/ssc_picc.c')
-rw-r--r--openpicc/application/ssc_picc.c30
1 files changed, 22 insertions, 8 deletions
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<SSC_DMA_BUFFER_COUNT; i++) {
if(dma_buffers[i].state == FREE) free++;
@@ -105,6 +98,27 @@ int ssc_count_free(void) {
return free;
}
+int ssc_get_metric(ssc_metric metric) {
+ switch(metric) {
+ case OVERFLOWS:
+ return overflows;
+ break;
+ case BUFFER_ERRORS:
+ return ssc_buffer_errors;
+ break;
+ case FREE_BUFFERS:
+ return ssc_count_free();
+ break;
+ case LATE_FRAMES:
+ return late_frames;
+ break;
+ case SSC_ERRORS:
+ return ssc_get_metric(OVERFLOWS) + ssc_get_metric(BUFFER_ERRORS);
+ break;
+ }
+ return 0;
+}
+
static ssc_dma_rx_buffer_t* __ramfunc ssc_find_dma_buffer(ssc_dma_buffer_state_t oldstate,
ssc_dma_buffer_state_t newstate)
{
personal git repositories of Harald Welte. Your mileage may vary