summaryrefslogtreecommitdiff
path: root/openpicc/application/main.c
diff options
context:
space:
mode:
authorhenryk <henryk@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2007-11-22 21:34:42 +0000
committerhenryk <henryk@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2007-11-22 21:34:42 +0000
commitba894ea0e3cf9919ab521bd7de1e66b384cca65a (patch)
treee9247ca72b209a97ff9667f38bfd0184ad5473e1 /openpicc/application/main.c
parentcb27c68785d658d8a14dcbd23a77456b22a79846 (diff)
Refactor frame print code out and use in iso14443_layer3a
git-svn-id: https://svn.openpcd.org:2342/trunk@345 6dc7ffe9-61d6-0310-9af1-9938baff3ed1
Diffstat (limited to 'openpicc/application/main.c')
-rw-r--r--openpicc/application/main.c53
1 files changed, 28 insertions, 25 deletions
diff --git a/openpicc/application/main.c b/openpicc/application/main.c
index 0756d10..b739f34 100644
--- a/openpicc/application/main.c
+++ b/openpicc/application/main.c
@@ -86,12 +86,36 @@ void vApplicationIdleHook(void)
usb_print_flush();
}
+void main_help_print_buffer(ssc_dma_buffer_t *buffer, int *pktcount)
+{
+ u_int32_t *tmp = (u_int32_t*)buffer->data;
+ int i, dumped = 0;
+ unsigned int j;
+ for(i = buffer->len / sizeof(*tmp); i >= 0 ; i--) {
+ if( *tmp != 0x00000000 ) {
+ if(dumped == 0) {
+ DumpUIntToUSB(buffer->len);
+ DumpStringToUSB(", ");
+ DumpUIntToUSB((*pktcount)++);
+ DumpStringToUSB(": ");
+ } else {
+ DumpStringToUSB(" ");
+ }
+ dumped = 1;
+ for(j=0; j<sizeof(*tmp)*8; j++) {
+ usb_print_char_f( (((*tmp) >> j) & 0x1) ? '1' : '_' , 0);
+ }
+ usb_print_flush();
+ //DumpBufferToUSB((char*)(tmp), sizeof(*tmp));
+ }
+ tmp++;
+ }
+ if(dumped) DumpStringToUSB("\n\r");
+}
+
void vMainTestSSCRXConsumer (void *pvParameters)
{
- int i, dumped;
static int pktcount=0;
- unsigned int j;
- u_int32_t *tmp;
(void)pvParameters;
while(1) {
ssc_dma_buffer_t* buffer;
@@ -106,28 +130,7 @@ void vMainTestSSCRXConsumer (void *pvParameters)
vLedBlinkGreen();*/
//i = usb_print_set_default_flush(0);
- tmp = (u_int32_t*)buffer->data;
- dumped = 0;
- for(i = buffer->len / sizeof(*tmp); i >= 0 ; i--) {
- if( *tmp != 0x00000000 ) {
- if(dumped == 0) {
- DumpUIntToUSB(buffer->len);
- DumpStringToUSB(", ");
- DumpUIntToUSB(pktcount++);
- DumpStringToUSB(": ");
- } else {
- DumpStringToUSB(" ");
- }
- dumped = 1;
- for(j=0; j<sizeof(*tmp)*8; j++) {
- usb_print_char_f( (((*tmp) >> j) & 0x1) ? '1' : '_' , 0);
- }
- usb_print_flush();
- //DumpBufferToUSB((char*)(tmp), sizeof(*tmp));
- }
- tmp++;
- }
- if(dumped) DumpStringToUSB("\n\r");
+ main_help_print_buffer(buffer, &pktcount);
//usb_print_set_default_flush(i);
portENTER_CRITICAL();
personal git repositories of Harald Welte. Your mileage may vary