summaryrefslogtreecommitdiff
path: root/openpicc
diff options
context:
space:
mode:
authorhenryk <henryk@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2007-11-13 15:26:14 +0000
committerhenryk <henryk@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2007-11-13 15:26:14 +0000
commit3fb02f719f0bea99548a6bc7fe7c37e9d25ce800 (patch)
tree3742ace743afdd9d30fe5dc1602b5b557b1e6981 /openpicc
parentee1f021427f8966fb29e70eab1a3be4345af65b1 (diff)
Slight progress, still: enabling tc_fdt crashes the processor after some bits
git-svn-id: https://svn.openpcd.org:2342/trunk@326 6dc7ffe9-61d6-0310-9af1-9938baff3ed1
Diffstat (limited to 'openpicc')
-rw-r--r--openpicc/application/cmd.c6
-rw-r--r--openpicc/application/main.c3
-rw-r--r--openpicc/application/pio_irq.c2
-rw-r--r--openpicc/application/ssc_picc.c3
-rw-r--r--openpicc/application/tc_fdt.c9
-rw-r--r--openpicc/config/board.h1
6 files changed, 20 insertions, 4 deletions
diff --git a/openpicc/application/cmd.c b/openpicc/application/cmd.c
index e6b8947..0b5b8da 100644
--- a/openpicc/application/cmd.c
+++ b/openpicc/application/cmd.c
@@ -30,7 +30,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?h";
+static const char *SHORT_COMMANDS = "!pc+-l?h";
/* Note that the long/short command distinction only applies to the USB serial console
* */
@@ -263,6 +263,9 @@ void prvExecCommand(u_int32_t cmd, portCHAR *args) {
vUSBSendByte( (char)led + '0' );
DumpStringToUSB("\n\r");
break;
+ case '!':
+ tc_cdiv_sync_reset();
+ break;
case 'H':
case '?':
DumpStringToUSB(
@@ -281,6 +284,7 @@ void prvExecCommand(u_int32_t cmd, portCHAR *args) {
" * l - cycle LEDs\n\r"
" * p - print PIO pins\n\r"
" * z 0/1- enable or disable tc_cdiv_sync\n\r"
+ " * ! - reset tc_cdiv_sync\n\r"
" * ?,h - display this help screen\n\r"
" *\n\r"
" *****************************************************\n\r"
diff --git a/openpicc/application/main.c b/openpicc/application/main.c
index 8d0070d..eb51aeb 100644
--- a/openpicc/application/main.c
+++ b/openpicc/application/main.c
@@ -45,6 +45,7 @@
#include "ssc_picc.h"
#include "tc_cdiv.h"
#include "tc_cdiv_sync.h"
+#include "tc_fdt.h"
/**********************************************************************/
static inline void prvSetupHardware (void)
@@ -95,7 +96,7 @@ int main (void)
pll_init();
tc_cdiv_init();
- tc_cdiv_sync_init();
+ tc_fdt_init();
ssc_tx_init();
//ssc_rx_init();
diff --git a/openpicc/application/pio_irq.c b/openpicc/application/pio_irq.c
index c7238d8..d21d1db 100644
--- a/openpicc/application/pio_irq.c
+++ b/openpicc/application/pio_irq.c
@@ -144,7 +144,7 @@ void pio_irq_init(void)
{
AT91F_PIOA_CfgPMC();
AT91F_AIC_ConfigureIt(AT91C_ID_PIOA,
- AT91C_AIC_PRIOR_LOWEST,
+ OPENPICC_IRQ_PRIO_PIO,
AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL, &pio_irq_demux);
AT91F_AIC_EnableIt(AT91C_ID_PIOA);
}
diff --git a/openpicc/application/ssc_picc.c b/openpicc/application/ssc_picc.c
index 491cb76..4d21644 100644
--- a/openpicc/application/ssc_picc.c
+++ b/openpicc/application/ssc_picc.c
@@ -30,6 +30,7 @@
#include <AT91SAM7.h>
#include <lib_AT91SAM7.h>
+#include <FreeRTOS.h>
//#include <os/usb_handler.h>
#include "dbgu.h"
#include "led.h"
@@ -314,6 +315,7 @@ static int8_t ssc_rx_refill(void)
static void __ramfunc ssc_irq(void)
{
+ portSAVE_CONTEXT();
u_int32_t ssc_sr = ssc->SSC_SR;
// int i, *tmp, emptyframe = 0;
DEBUGP("ssc_sr=0x%08x, mode=%u: ", ssc_sr, ssc_state.mode);
@@ -451,6 +453,7 @@ static void __ramfunc ssc_irq(void)
#endif
DEBUGPCR("I");
AT91F_AIC_ClearIt(AT91C_ID_SSC);
+ portRESTORE_CONTEXT();
}
void ssc_print(void)
diff --git a/openpicc/application/tc_fdt.c b/openpicc/application/tc_fdt.c
index 55da9ca..0193863 100644
--- a/openpicc/application/tc_fdt.c
+++ b/openpicc/application/tc_fdt.c
@@ -29,11 +29,14 @@
*
*/
+#include <FreeRTOS.h>
+#include <task.h>
#include <lib_AT91SAM7.h>
#include <AT91SAM7.h>
#include "dbgu.h"
#include "openpicc.h"
+#include "led.h"
#include "tc_cdiv.h"
#include "tc_fdt.h"
@@ -54,6 +57,8 @@ void tc_frame_end_set(u_int16_t count)
static void tc_fdt_irq(void)
{
+ portSAVE_CONTEXT();
+ vLedSetGreen(1);
u_int32_t sr = tcfdt->TC_SR;
DEBUGP("tc_fdt_irq: TC2_SR=0x%08x TC2_CV=0x%08x ",
sr, tcfdt->TC_CV);
@@ -77,6 +82,9 @@ static void tc_fdt_irq(void)
DEBUGP("Compare_C ");
}
DEBUGPCR("");
+ AT91F_AIC_AcknowledgeIt();
+ vLedSetGreen(0);
+ portRESTORE_CONTEXT();
}
void tc_fdt_print(void)
@@ -123,4 +131,3 @@ void tc_fdt_init(void)
tcfdt->TC_IER = AT91C_TC_CPAS | AT91C_TC_CPBS | AT91C_TC_CPCS |
AT91C_TC_ETRGS;
}
-
diff --git a/openpicc/config/board.h b/openpicc/config/board.h
index 813a7a3..c2f0e2e 100644
--- a/openpicc/config/board.h
+++ b/openpicc/config/board.h
@@ -78,6 +78,7 @@
#define OPENPICC_PIO_CDIV_HELP_OUT AT91C_PA0_TIOA0
#define OPENPICC_PIO_CDIV_HELP_IN AT91C_PA29_TCLK2
+#define OPENPICC_IRQ_PRIO_PIO (AT91C_AIC_PRIOR_LOWEST+4)
#define OPENPICC_IRQ_PRIO_SSC (AT91C_AIC_PRIOR_HIGHEST-1)
#define OPENPCD_IRQ_PRIO_TC_FDT (AT91C_AIC_PRIOR_LOWEST+3)
personal git repositories of Harald Welte. Your mileage may vary