summaryrefslogtreecommitdiff
path: root/openpicc/application/main.c
diff options
context:
space:
mode:
authorhenryk <henryk@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2007-11-26 06:20:17 +0000
committerhenryk <henryk@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2007-11-26 06:20:17 +0000
commit16d42d5f6b8df076a04a18ffd13d0defc999c7bf (patch)
tree5ea288cc5c509bdc549690877a68bb03679cb447 /openpicc/application/main.c
parent29ea5bbf5b9c3b3679aa40e4ee7029284cb424c6 (diff)
Prepare transmission code
Restructure/add some buffer code Reset the watchdog timer (now at 1.5s), add a watchdog pinger thread git-svn-id: https://svn.openpcd.org:2342/trunk@352 6dc7ffe9-61d6-0310-9af1-9938baff3ed1
Diffstat (limited to 'openpicc/application/main.c')
-rw-r--r--openpicc/application/main.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/openpicc/application/main.c b/openpicc/application/main.c
index 48e9ab2..a093d70 100644
--- a/openpicc/application/main.c
+++ b/openpicc/application/main.c
@@ -48,6 +48,7 @@
#include "tc_fdt.h"
#include "usb_print.h"
#include "iso14443_layer3a.h"
+#include "decoder.h"
/**********************************************************************/
static inline void prvSetupHardware (void)
@@ -76,8 +77,6 @@ void vApplicationIdleHook(void)
{
static char disabled_green = 0;
//static int i=0;
- /* Restart watchdog, has been enabled in Cstartup_SAM7.c */
- AT91F_WDTRestart(AT91C_BASE_WDTC);
//vLedSetGreen(i^=1);
if(!disabled_green) {
//vLedSetGreen(0);
@@ -86,9 +85,9 @@ void vApplicationIdleHook(void)
usb_print_flush();
}
-void main_help_print_buffer(ssc_dma_buffer_t *buffer, int *pktcount)
+void main_help_print_buffer(ssc_dma_rx_buffer_t *buffer, int *pktcount)
{
- u_int16_t *tmp = (u_int16_t*)buffer->data;
+ ISO14443A_SHORT_TYPE *tmp = (ISO14443A_SHORT_TYPE*)buffer->data;
int i, dumped = 0;
unsigned int j;
for(i = buffer->len / sizeof(*tmp); i >= 0 ; i--) {
@@ -102,7 +101,7 @@ void main_help_print_buffer(ssc_dma_buffer_t *buffer, int *pktcount)
DumpStringToUSB(" ");
}
dumped = 1;
- DumpUIntToUSB(i);
+ DumpUIntToUSB(buffer->len / sizeof(*tmp) - i);
DumpStringToUSB(": ");
for(j=0; j<sizeof(*tmp)*8; j++) {
usb_print_char_f( (((*tmp) >> j) & 0x1) ? '1' : '_' , 0);
@@ -120,7 +119,7 @@ void vMainTestSSCRXConsumer (void *pvParameters)
static int pktcount=0;
(void)pvParameters;
while(1) {
- ssc_dma_buffer_t* buffer;
+ ssc_dma_rx_buffer_t* buffer;
if(xQueueReceive(ssc_rx_queue, &buffer, portMAX_DELAY)) {
portENTER_CRITICAL();
buffer->state = PROCESSING;
@@ -142,11 +141,25 @@ void vMainTestSSCRXConsumer (void *pvParameters)
}
}
+/* This task pings the watchdog even when the idle task is not running
+ * It should be started with a very high priority and will delay most of the time */
+void vMainWatchdogPinger (void *pvParameters)
+{
+ (void)pvParameters;
+
+ while(1) {
+ /* Restart watchdog, has been enabled in Cstartup_SAM7.c */
+ AT91F_WDTRestart(AT91C_BASE_WDTC);
+ vTaskDelay(500*portTICK_RATE_MS);
+ }
+}
+
/**********************************************************************/
int main (void)
{
prvSetupHardware ();
usb_print_init();
+ decoder_init();
pio_irq_init();
@@ -165,6 +178,9 @@ int main (void)
vCmdInit();
+ xTaskCreate (vMainWatchdogPinger, (signed portCHAR *) "WDT PINGER", 64,
+ NULL, TASK_ISO_PRIORITY -1, NULL);
+
//vLedSetGreen(1);
/* Remap RAM to addr 0 */
personal git repositories of Harald Welte. Your mileage may vary