From ad5b96d584fc9962a9d8504067cd59697fb9a580 Mon Sep 17 00:00:00 2001 From: henryk Date: Fri, 29 Feb 2008 08:53:20 +0000 Subject: New cleaned-up (and then messed up again) SSC code Better layering separation git-svn-id: https://svn.openpcd.org:2342/trunk@434 6dc7ffe9-61d6-0310-9af1-9938baff3ed1 --- openpicc/application/cmd.c | 98 +++++++++++++++++++++++++++++++--------------- 1 file changed, 66 insertions(+), 32 deletions(-) (limited to 'openpicc/application/cmd.c') diff --git a/openpicc/application/cmd.c b/openpicc/application/cmd.c index a96a68d..3b777b3 100644 --- a/openpicc/application/cmd.c +++ b/openpicc/application/cmd.c @@ -18,7 +18,7 @@ #include "tc_cdiv.h" #include "tc_cdiv_sync.h" #include "pio_irq.h" -#include "ssc_picc.h" +#include "ssc.h" #include "usb_print.h" #include "load_modulation.h" @@ -45,7 +45,7 @@ static const portBASE_TYPE USE_COLON_FOR_LONG_COMMANDS = 0; /* When not USE_COLON_FOR_LONG_COMMANDS then short commands will be recognized by including * their character in the string SHORT_COMMANDS * */ -static const char *SHORT_COMMANDS = "!pc+-l?hq9fjkai"; +static const char *SHORT_COMMANDS = "!pc+-l?hq9fjka#i"; /* Note that the long/short command distinction only applies to the USB serial console * */ @@ -132,16 +132,10 @@ 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"}, -}; -#define DYNAMIC_PIN_PLL_LOCK -1 -static struct { int pin; char * description; } PIO_PINS[] = { - {DYNAMIC_PIN_PLL_LOCK, "pll lock "}, - {OPENPICC_PIO_FRAME, "frame start"}, +#define DYNAMIC_PIN_PLL_LOCK 1 +static struct { int pin; int dynpin; char * description; } PIO_PINS[] = { + {0,DYNAMIC_PIN_PLL_LOCK, "pll lock "}, + {OPENPICC_PIO_FRAME,0, "frame start"}, }; void print_pio(void) { @@ -153,7 +147,7 @@ void print_pio(void) " *****************************************************\n\r" " *\n\r"); for(i=0; iSSC_SR); @@ -294,6 +293,21 @@ void prvExecCommand(u_int32_t cmd, portCHAR *args) { DumpStringToUSB(" * TC0_CV value: "); DumpUIntToUSB(*AT91C_TC0_CV); DumpStringToUSB("\n\r"); + DumpStringToUSB(" * TC2_CV value: "); + DumpUIntToUSB(*AT91C_TC2_CV); + DumpStringToUSB("\n\r"); + DumpStringToUSB(" * TC2_IMR value: "); + DumpUIntToUSB(*AT91C_TC2_IMR); + DumpStringToUSB("\n\r"); + DumpStringToUSB(" * TC2_SR value: "); + DumpUIntToUSB(*AT91C_TC2_SR); + DumpStringToUSB("\n\r"); + DumpStringToUSB(" * TC2_RB value: "); + DumpUIntToUSB(*AT91C_TC2_RB); + DumpStringToUSB("\n\r"); + DumpStringToUSB(" * TC2_RC value: "); + DumpUIntToUSB(*AT91C_TC2_RC); + DumpStringToUSB("\n\r"); DumpStringToUSB(" * SSC_SR value: "); DumpUIntToUSB(*AT91C_SSC_SR); DumpStringToUSB("\n\r"); @@ -312,6 +326,12 @@ void prvExecCommand(u_int32_t cmd, portCHAR *args) { DumpStringToUSB(" * SSC_TCR value: "); DumpUIntToUSB(*AT91C_SSC_TCR); DumpStringToUSB("\n\r"); + DumpStringToUSB(" * SSC_RPR value: "); + DumpUIntToUSB(*AT91C_SSC_RPR); + DumpStringToUSB("\n\r"); + DumpStringToUSB(" * SSC_RCR value: "); + DumpUIntToUSB(*AT91C_SSC_RCR); + DumpStringToUSB("\n\r"); DumpStringToUSB(" * SSC_IMR value: "); DumpUIntToUSB(*AT91C_SSC_IMR); DumpStringToUSB("\n\r"); @@ -346,6 +366,17 @@ void prvExecCommand(u_int32_t cmd, portCHAR *args) { case '!': tc_cdiv_sync_reset(); break; + case '#': + if(!OPENPICC->features.clock_switching) { + DumpStringToUSB("* This hardware is not clock switching capable\n\r"); + break; + } + clock_select = (clock_select+1) % _MAX_CLOCK_SOURCES; + ssc_select_clock(clock_select); + DumpStringToUSB("Active clock is now "); + DumpUIntToUSB(clock_select); + DumpStringToUSB("\n\r"); + break; case 'J': fdt_offset++; DumpStringToUSB("fdt_offset is now "); @@ -375,7 +406,8 @@ void prvExecCommand(u_int32_t cmd, portCHAR *args) { break; #endif case 'Q': - ssc_rx_start(); + //BROKEN new ssc code + //ssc_rx_start(); while(0) { DumpUIntToUSB(AT91C_BASE_SSC->SSC_SR); DumpStringToUSB("\n\r"); @@ -402,11 +434,13 @@ void prvExecCommand(u_int32_t cmd, portCHAR *args) { DumpStringToUSB(OPENPICC->release_name); DumpStringToUSB("\n\r *\n\r" " * test - test critical sections\n\r" + " * thru - test throughput\n\r" #if ( configUSE_TRACE_FACILITY == 1 ) " * t - print task list and stack usage\n\r" #endif " * c - print configuration\n\r" " * +,- - decrease/increase comparator threshold\n\r" + " * # - switch clock\n\r" " * l - cycle LEDs\n\r" " * p - print PIO pins\n\r" " * z 0/1- enable or disable tc_cdiv_sync\n\r" @@ -551,8 +585,9 @@ void startstop_field_meter(void) { portBASE_TYPE vCmdInit() { unsigned int i; for(i=0; iPLL_LOCK; + PIO_PINS[i].dynpin = 0; } } @@ -567,7 +602,6 @@ portBASE_TYPE vCmdInit() { } xSemaphoreTake(xFieldMeterMutex, portMAX_DELAY); - if(xTaskCreate(vCmdCode, (signed portCHAR *)"CMD", TASK_CMD_STACK, NULL, TASK_CMD_PRIORITY, &xCmdTask) != pdPASS) { return 0; -- cgit v1.2.3