summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--openpcd/firmware/src/main_pwm.c31
-rw-r--r--openpcd/firmware/src/main_reqa.c28
2 files changed, 30 insertions, 29 deletions
diff --git a/openpcd/firmware/src/main_pwm.c b/openpcd/firmware/src/main_pwm.c
index 20659cb..f39a55a 100644
--- a/openpcd/firmware/src/main_pwm.c
+++ b/openpcd/firmware/src/main_pwm.c
@@ -52,10 +52,6 @@ static u_int8_t rsrel_table[] = {
37, 26, 27, 51, 38, 28, 29, 39, 30, 52, 31, 40, 41, 53, 42, 43,
54, 44, 45, 55, 46, 47, 56, 57, 58, 59, 60, 61, 62, 63 };
-
-static u_int16_t cdivs[] = { 128, 64, 32, 16 };
-static int cdiv_idx = 0;
-
static void help(void)
{
DEBUGPCR("o: decrease duty p: increase duty\r\n"
@@ -79,18 +75,13 @@ void _init_func(void)
/* switch PA17 (connected to MFIN on board) to input */
AT91F_PIO_CfgInput(AT91C_BASE_PIOA, AT91C_PIO_PA17);
- DEBUGPCRF("Initializing carrier divider");
- tc_cdiv_init();
-
- DEBUGPCRF("Initializing PWM");
pwm_init();
+ rc632_modulate_mfin();
+
pwm_freq_set(0, 105937);
pwm_start(0);
- pwm_duty_set_percent(0, 22); /* 22% of 9.43uS = 2.07uS */
- rc632_modulate_mfin();
- DEBUGPCRF("Initializing SSC RX");
- ssc_rx_init();
+ pwm_duty_set_percent(0, 22); /* 22% of 9.43uS = 2.07uS */
}
int _main_dbgu(char key)
@@ -191,22 +182,6 @@ int _main_dbgu(char key)
help();
return 0;
break;
- case '<':
- tc_cdiv_phase_inc();
- break;
- case '>':
- tc_cdiv_phase_dec();
- break;
- case '{':
- if (cdiv_idx > 0)
- cdiv_idx--;
- tc_cdiv_set_divider(cdivs[cdiv_idx]);
- break;
- case '}':
- if (cdiv_idx < ARRAY_SIZE(cdivs)-1)
- cdiv_idx++;
- tc_cdiv_set_divider(cdivs[cdiv_idx]);
- break;
default:
return -EINVAL;
}
diff --git a/openpcd/firmware/src/main_reqa.c b/openpcd/firmware/src/main_reqa.c
index 4f2b1cf..5d7c80b 100644
--- a/openpcd/firmware/src/main_reqa.c
+++ b/openpcd/firmware/src/main_reqa.c
@@ -16,12 +16,16 @@
#include "led.h"
#include "pcd_enumerate.h"
#include "trigger.h"
+#include "tc.h"
void _init_func(void)
{
//udp_init();
trigger_init();
+ DEBUGPCRF("enabling RC632");
rc632_init();
+ DEBUGPCRF("enabling TC");
+ tc_cdiv_init();
DEBUGPCRF("turning on RF");
rc632_turn_on_rf(RAH);
DEBUGPCRF("initializing 14443A operation");
@@ -58,12 +62,17 @@ static void help(void)
DEBUGPCR("r: REQA w: WUPA a: ANTICOL\r\n"
"y: inc cw cond x: dec cond c: inc mod cond");
DEBUGPCR("v: dec mod cond o: dec ana_out p: dec ana_out\r\n"
- "h: trigger high l: trigger low");
+ "h: trigger high l: trigger low u: dec MFOUT mode");
+ DEBUGPCR("i: inc MFOUT md <: dec cdiv ph >: inc cdiv phase\r\n"
+ "{: dev cdiv }: inc cdiv");
}
+static u_int16_t cdivs[] = { 128, 64, 32, 16 };
+
int _main_dbgu(char key)
{
int ret = 0;
+ static int cdiv_idx = 0;
switch (key) {
case '?':
@@ -132,6 +141,22 @@ int _main_dbgu(char key)
case 'l':
AT91F_PIO_ClearOutput(AT91C_BASE_PIOA, OPENPCD_PIO_TRIGGER);
break;
+ case '<':
+ tc_cdiv_phase_inc();
+ break;
+ case '>':
+ tc_cdiv_phase_dec();
+ break;
+ case '{':
+ if (cdiv_idx > 0)
+ cdiv_idx--;
+ tc_cdiv_set_divider(cdivs[cdiv_idx]);
+ break;
+ case '}':
+ if (cdiv_idx < ARRAY_SIZE(cdivs)-1)
+ cdiv_idx++;
+ tc_cdiv_set_divider(cdivs[cdiv_idx]);
+ break;
default:
return -EINVAL;
}
@@ -165,6 +190,7 @@ void _main_func(void)
rc632_reg_write(RAH, RC632_REG_MFOUT_SELECT, mfout_sel);
for (i = 0; i < 0x3ffff; i++) {}
//rc632_dump();
+ tc_cdiv_print();
switch (mode) {
case MODE_REQA:
personal git repositories of Harald Welte. Your mileage may vary