From 021f73634e525901dd38b206dac35b747c8dd8d2 Mon Sep 17 00:00:00 2001 From: henryk Date: Thu, 20 Dec 2007 04:02:47 +0000 Subject: Add SSC_DATA_GATE support git-svn-id: https://svn.openpcd.org:2342/trunk@399 6dc7ffe9-61d6-0310-9af1-9938baff3ed1 --- openpicc/application/cmd.c | 14 ++++++++++++++ openpicc/application/ssc_picc.c | 15 +++++++++++++++ openpicc/application/ssc_picc.h | 4 ++++ openpicc/config/board.h | 4 +--- 4 files changed, 34 insertions(+), 3 deletions(-) (limited to 'openpicc') diff --git a/openpicc/application/cmd.c b/openpicc/application/cmd.c index b66c6c8..ac1d605 100644 --- a/openpicc/application/cmd.c +++ b/openpicc/application/cmd.c @@ -212,6 +212,17 @@ void prvExecCommand(u_int32_t cmd, portCHAR *args) { DumpStringToUSB("cdiv_sync enabled \n\r"); } break; +#ifdef OPENPICC_MODIFIED_BOARD + case 'G': + i=atoiEx(args, &args); + ssc_set_data_gate(i); + if(i==0) { + DumpStringToUSB("SSC_DATA disabled \n\r"); + } else { + DumpStringToUSB("SSC_DATA enabled \n\r"); + } + break; +#endif case 'D': i=atoiEx(args, &args); tc_cdiv_set_divider(i); @@ -404,6 +415,9 @@ void prvExecCommand(u_int32_t cmd, portCHAR *args) { " * d div- set tc_cdiv divider value 16, 32, 64, ...\n\r" " * j,k - increase, decrease fdt_offset\n\r" " * a - change load modulation level\n\r" +#ifdef OPENPICC_MODIFIED_BOARD + " * g 0/1- disable or enable SSC_DATA through gate\n\r" +#endif " * 9 - reset CPU\n\r" " * ?,h - display this help screen\n\r" " *\n\r" diff --git a/openpicc/application/ssc_picc.c b/openpicc/application/ssc_picc.c index 79df04e..ab3f2e9 100644 --- a/openpicc/application/ssc_picc.c +++ b/openpicc/application/ssc_picc.c @@ -668,6 +668,16 @@ void ssc_tx_init(void) tx_pdc = (AT91PS_PDC) &(ssc->SSC_RPR); } +#ifdef OPENPICC_MODIFIED_BOARD +void ssc_set_data_gate(int enable) +{ + if(enable) + AT91F_PIO_SetOutput(AT91C_BASE_PIOA, OPENPICC_PIO_SSC_DATA_GATE); + else + AT91F_PIO_ClearOutput(AT91C_BASE_PIOA, OPENPICC_PIO_SSC_DATA_GATE); +} +#endif + void ssc_rx_init(void) { tc_cdiv_sync_init(); @@ -687,6 +697,11 @@ void ssc_rx_init(void) AT91F_PIO_CfgOutput(AT91C_BASE_PIOA, OPENPICC_PIO_SSC_DATA_CONTROL); AT91F_PIO_ClearOutput(AT91C_BASE_PIOA, OPENPICC_PIO_SSC_DATA_CONTROL); + +#ifdef OPENPICC_MODIFIED_BOARD + AT91F_PIO_CfgOutput(AT91C_BASE_PIOA, OPENPICC_PIO_SSC_DATA_GATE); + AT91F_PIO_SetOutput(AT91C_BASE_PIOA, OPENPICC_PIO_SSC_DATA_GATE); +#endif AT91F_AIC_ConfigureIt(AT91C_ID_SSC, OPENPICC_IRQ_PRIO_SSC, diff --git a/openpicc/application/ssc_picc.h b/openpicc/application/ssc_picc.h index b769fe7..650a09e 100644 --- a/openpicc/application/ssc_picc.h +++ b/openpicc/application/ssc_picc.h @@ -100,4 +100,8 @@ extern void ssc_tx_start(ssc_dma_tx_buffer_t *buf); extern volatile u_int32_t ssc_tx_fiq_fdt_cdiv; extern volatile u_int32_t ssc_tx_fiq_fdt_ssc; +#ifdef OPENPICC_MODIFIED_BOARD +extern void ssc_set_data_gate(int enable); +#endif + #endif diff --git a/openpicc/config/board.h b/openpicc/config/board.h index 85afd9e..e332b17 100644 --- a/openpicc/config/board.h +++ b/openpicc/config/board.h @@ -77,13 +77,11 @@ #define OPENPICC_SSC_DATA AT91C_PA18_RD #define OPENPICC_SSC_CLOCK AT91C_PA19_RK #define OPENPICC_SSC_TF AT91C_PIO_PA15 -#ifdef OPENPICC_MODIFIED_BOARD -#define OPENPICC_SSC_DATA_GATE AT91C_PA30 -#endif #define OPENPICC_PIO_FRAME AT91C_PIO_PA20 #ifdef OPENPICC_MODIFIED_BOARD #define OPENPICC_PIO_FRAME_BURST AT91C_PIO_PA4 +#define OPENPICC_PIO_SSC_DATA_GATE AT91C_PIO_PA31 #endif #define OPENPICC_PIO_SSC_DATA_CONTROL AT91C_PIO_PA21 #define OPENPICC_PIO_AB_DETECT AT91C_PIO_PA22 -- cgit v1.2.3