From 82a994e1ab60e3c7222a7b3b1cb77a4b6fccfb4e Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@6dc7ffe9-61d6-0310-9af1-9938baff3ed1> Date: Sun, 10 Sep 2006 14:12:58 +0000 Subject: add PLL inhibit support code for PICC git-svn-id: https://svn.openpcd.org:2342/trunk@168 6dc7ffe9-61d6-0310-9af1-9938baff3ed1 --- openpcd/firmware/Makefile | 2 +- openpcd/firmware/src/picc/main_openpicc.c | 44 ++++++++++--------------------- openpcd/firmware/src/picc/pll.c | 24 +++++++++++++++++ openpcd/firmware/src/picc/pll.h | 8 ++++++ 4 files changed, 47 insertions(+), 31 deletions(-) create mode 100644 openpcd/firmware/src/picc/pll.c create mode 100644 openpcd/firmware/src/picc/pll.h diff --git a/openpcd/firmware/Makefile b/openpcd/firmware/Makefile index 4bb05dc..e700012 100644 --- a/openpcd/firmware/Makefile +++ b/openpcd/firmware/Makefile @@ -99,7 +99,7 @@ else # PICC support code SRCARM += src/picc/tc_fdt.c src/picc/ssc_picc.c src/picc/adc.c \ src/picc/decoder.c src/picc/decoder_miller.c \ - src/picc/decoder_nrzl.c src/picc/poti.c + src/picc/decoder_nrzl.c src/picc/poti.c src/picc/pll.c # finally, the actual main application SRCARM += src/picc/$(TARGET).c endif diff --git a/openpcd/firmware/src/picc/main_openpicc.c b/openpcd/firmware/src/picc/main_openpicc.c index b8b51a0..3b3ba2a 100644 --- a/openpcd/firmware/src/picc/main_openpicc.c +++ b/openpcd/firmware/src/picc/main_openpicc.c @@ -8,13 +8,15 @@ #include #include "../openpcd.h" #include +#include void _init_func(void) { - //tc_cdiv_init(); + pll_init(); + poti_init(); + tc_cdiv_init(); //adc_init(); //ssc_rx_init(); - //poti_init(); // ssc_tx_init(); } @@ -22,6 +24,7 @@ int _main_dbgu(char key) { unsigned char value; static u_int8_t poti = 64; + static u_int8_t pll_inh = 1; DEBUGPCRF("main_dbgu"); @@ -39,36 +42,17 @@ int _main_dbgu(char key) DEBUGPCRF("Poti: %u", poti); break; case 'e': - poti_init(); - break; -#if 0 - case '4': - AT91F_DBGU_Printk("Testing RC632 : "); - if (rc632_test(RAH) == 0) - AT91F_DBGU_Printk("SUCCESS!\n\r"); - else - AT91F_DBGU_Printk("ERROR!\n\r"); - - break; - case '5': - rc632_reg_read(RAH, RC632_REG_RX_WAIT, &value); - DEBUGPCR("Reading RC632 Reg RxWait: 0x%02xr", value); - - break; - case '6': - DEBUGPCR("Writing RC632 Reg RxWait: 0x55"); - rc632_reg_write(RAH, RC632_REG_RX_WAIT, 0x55); - break; - case '7': - rc632_dump(); - break; - case 'P': - rc632_power(1); + poti_comp_carr(poti); + DEBUGPCRF("Poti: %u", poti); break; case 'p': - rc632_power(0); + pll_inh++; + pll_inh &= 0x01; + pll_inhibit(pll_inh); + DEBUGPCRF("PLL Inhibit: %u\n", pll_inh); + break; + case '>': break; -#endif } return -EINVAL; @@ -82,5 +66,5 @@ void _main_func(void) /* next we deal with incoming reqyests from USB EP1 (OUT) */ usb_in_process(); - ssc_rx_unthrottle(); + //ssc_rx_unthrottle(); } diff --git a/openpcd/firmware/src/picc/pll.c b/openpcd/firmware/src/picc/pll.c new file mode 100644 index 0000000..c554ea6 --- /dev/null +++ b/openpcd/firmware/src/picc/pll.c @@ -0,0 +1,24 @@ + +#include +#include +#include "../openpcd.h" + +void pll_inhibit(int inhibit) +{ + if (inhibit) + AT91F_PIO_SetOutput(AT91C_BASE_PIOA, OPENPICC_PIO_PLL_INHIBIT); + else + AT91F_PIO_ClearOutput(AT91C_BASE_PIOA, OPENPICC_PIO_PLL_INHIBIT); +} + +int pll_is_locked(void) +{ + return AT91F_PIO_IsInputSet(AT91C_BASE_PIOA, OPENPICC_PIO_PLL_LOCK); +} + +void pll_init(void) +{ + AT91F_PIO_CfgOutput(AT91C_BASE_PIOA, OPENPICC_PIO_PLL_INHIBIT); + AT91F_PIO_CfgInput(AT91C_BASE_PIOA, OPENPICC_PIO_PLL_LOCK); + pll_inhibit(0); +} diff --git a/openpcd/firmware/src/picc/pll.h b/openpcd/firmware/src/picc/pll.h new file mode 100644 index 0000000..fc00105 --- /dev/null +++ b/openpcd/firmware/src/picc/pll.h @@ -0,0 +1,8 @@ +#ifndef _PLL_H +#define _PLL_H + +extern int pll_is_locked(void); +extern void pll_inhibit(int inhibit); +extern void pll_init(void); + +#endif -- cgit v1.2.3