summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author(no author) <(no author)@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2006-08-03 10:38:45 +0000
committer(no author) <(no author)@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2006-08-03 10:38:45 +0000
commit3866f9839a61f117f9def7926b50eac9a5888eef (patch)
tree340c4484d7367cbf10244839cfe5355a366fffab
parentada3d4fa86e6f178c8281f1cf7a5c55f8961accb (diff)
add support for conductance register change via serial port
git-svn-id: https://svn.openpcd.org:2342/trunk@72 6dc7ffe9-61d6-0310-9af1-9938baff3ed1
-rw-r--r--openpcd/firmware/src/main_reqa.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/openpcd/firmware/src/main_reqa.c b/openpcd/firmware/src/main_reqa.c
index e03fffa..f760f71 100644
--- a/openpcd/firmware/src/main_reqa.c
+++ b/openpcd/firmware/src/main_reqa.c
@@ -33,6 +33,22 @@ void _init_func(void)
static volatile int mode = MODE_REQA;
+static void reg_inc(u_int8_t reg)
+{
+ u_int8_t val;
+ rc632_reg_read(RAH, reg, &val);
+ rc632_reg_write(RAH, reg, val++);
+ DEBUGPCRF("reg 0x%02x = 0x%02x", reg, val);
+}
+
+static void reg_dec(u_int8_t reg)
+{
+ u_int8_t val;
+ rc632_reg_read(RAH, reg, &val);
+ rc632_reg_write(RAH, reg, val--);
+ DEBUGPCRF("reg 0x%02x = 0x%02x", reg, val);
+}
+
int _main_dbgu(char key)
{
switch (key) {
@@ -45,6 +61,21 @@ int _main_dbgu(char key)
case 'a':
mode = MODE_ANTICOL;
break;
+ /* Those below don't work as long as
+ * iso14443a_init() is called before
+ * every cycle */
+ case 'y':
+ reg_inc(RC632_REG_CW_CONDUCTANCE);
+ break;
+ case 'x':
+ reg_dec(RC632_REG_CW_CONDUCTANCE);
+ break;
+ case 'c':
+ reg_inc(RC632_REG_MOD_CONDUCTANCE);
+ break;
+ case 'v':
+ reg_dec(RC632_REG_MOD_CONDUCTANCE);
+ break;
default:
return -EINVAL;
}
@@ -73,8 +104,9 @@ void _main_func(void)
//rc632_reset();
rc632_turn_on_rf();
rc632_iso14443a_init(RAH);
- for (i = 0; i < 0xfffff; i++) {}
+ for (i = 0; i < 0xfff; i++) {}
//rc632_dump();
+
switch (mode) {
case MODE_REQA:
status = rc632_iso14443a_transceive_sf(RAH, ISO14443A_SF_CMD_REQA, &atqa);
personal git repositories of Harald Welte. Your mileage may vary