diff options
-rw-r--r-- | openpcd/firmware/Makefile | 2 | ||||
-rw-r--r-- | openpcd/firmware/src/picc/main_openpicc.c | 44 | ||||
-rw-r--r-- | openpcd/firmware/src/picc/pll.c | 24 | ||||
-rw-r--r-- | openpcd/firmware/src/picc/pll.h | 8 |
4 files changed, 47 insertions, 31 deletions
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 <os/usb_handler.h> #include "../openpcd.h" #include <os/main.h> +#include <picc/pll.h> 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 <sys/types.h> +#include <lib_AT91SAM7.h> +#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 |