summaryrefslogtreecommitdiff
path: root/openpicc/application/cmd.c
diff options
context:
space:
mode:
authorhenryk <henryk@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2007-11-13 00:47:14 +0000
committerhenryk <henryk@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2007-11-13 00:47:14 +0000
commit3d0a9bd40be2d014e0877eb623042c899d8cbe66 (patch)
tree16afede5c836924716cbd916ad1d63e5cc1be7c5 /openpicc/application/cmd.c
parent1dfa375abb95c59830c38697c53fa9a6794a9fb9 (diff)
Add PIO IRQ counter (and print it in 'c' command)
Make tc_cdiv_sync interrupt working Add 'p' command to print some PIO inputs Add 'z' command to enable/disable tc_cdiv_sync git-svn-id: https://svn.openpcd.org:2342/trunk@324 6dc7ffe9-61d6-0310-9af1-9938baff3ed1
Diffstat (limited to 'openpicc/application/cmd.c')
-rw-r--r--openpicc/application/cmd.c46
1 files changed, 45 insertions, 1 deletions
diff --git a/openpicc/application/cmd.c b/openpicc/application/cmd.c
index 7ff7f53..d7ce784 100644
--- a/openpicc/application/cmd.c
+++ b/openpicc/application/cmd.c
@@ -11,6 +11,8 @@
#include "openpicc.h"
#include "led.h"
#include "da.h"
+#include "tc_cdiv_sync.h"
+#include "pio_irq.h"
xQueueHandle xCmdQueue;
xTaskHandle xCmdTask;
@@ -26,7 +28,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 = "c+-l?h";
+static const char *SHORT_COMMANDS = "pc+-l?h";
/* Note that the long/short command distinction only applies to the USB serial console
* */
@@ -92,6 +94,29 @@ int atoiEx(const char * nptr, char * * eptr)
return sign * curval;
}
+static const struct { int pin; char * description; } PIO_PINS[] = {
+ {OPENPICC_PIO_PLL_LOCK, "pll lock "},
+ {OPENPICC_PIO_FRAME, "frame start"},
+};
+void print_pio(void)
+{
+ int data = *AT91C_PIOA_PDSR;
+ unsigned int i;
+ DumpStringToUSB(
+ " *****************************************************\n\r"
+ " * Current PIO readings: *\n\r"
+ " *****************************************************\n\r"
+ " *\n\r");
+ for(i=0; i<sizeof(PIO_PINS)/sizeof(PIO_PINS[0]); i++) {
+ DumpStringToUSB(" * ");
+ DumpStringToUSB(PIO_PINS[i].description);
+ DumpStringToUSB(": ");
+ DumpUIntToUSB((data & PIO_PINS[i].pin) ? 1 : 0 );
+ DumpStringToUSB("\n\r");
+ }
+ DumpStringToUSB(" *****************************************************\n\r");
+}
+
static const AT91PS_SPI spi = AT91C_BASE_SPI;
#define SPI_MAX_XFER_LEN 33
@@ -157,6 +182,19 @@ void prvExecCommand(u_int32_t cmd, portCHAR *args) {
DumpStringToUSB("\n\r");
}
break;
+ case 'Z':
+ i=atoiEx(args, &args);
+ if(i==0) {
+ tc_cdiv_sync_disable();
+ DumpStringToUSB("cdiv_sync disabled \n\r");
+ } else {
+ tc_cdiv_sync_enable();
+ DumpStringToUSB("cdiv_sync enabled \n\r");
+ }
+ break;
+ case 'P':
+ print_pio();
+ break;
case 'C':
DumpStringToUSB(
" *****************************************************\n\r"
@@ -188,6 +226,10 @@ void prvExecCommand(u_int32_t cmd, portCHAR *args) {
DumpStringToUSB(" * The comparator threshold is ");
DumpUIntToUSB(da_get_value());
DumpStringToUSB("\n\r");
+ DumpStringToUSB(" * Number of PIO IRQs handled: ");
+ i = pio_irq_get_count() & (~(unsigned int)0);
+ DumpUIntToUSB(i);
+ DumpStringToUSB("\n\r");
DumpStringToUSB(
" *\n\r"
" *****************************************************\n\r"
@@ -232,6 +274,8 @@ void prvExecCommand(u_int32_t cmd, portCHAR *args) {
" * 1..4 - automatic transmit at selected power levels\n\r"
" * +,- - decrease/increase comparator threshold\n\r"
" * l - cycle LEDs\n\r"
+ " * p - print PIO pins\n\r"
+ " * z 0/1- enable or disable tc_cdiv_sync\n\r"
" * ?,h - display this help screen\n\r"
" *\n\r"
" *****************************************************\n\r"
personal git repositories of Harald Welte. Your mileage may vary