]> git.cryptolib.org Git - labortage2013badge.git/commitdiff
removing memory r/w/x features
authorbg <daniel.otte@rub.de>
Sat, 19 Oct 2013 03:45:58 +0000 (05:45 +0200)
committerbg <daniel.otte@rub.de>
Sat, 19 Oct 2013 03:45:58 +0000 (05:45 +0200)
firmware/main.c
firmware/special_functions.S
firmware/special_functions.h

index 056a7628228f059bbc145d2b7c10f2aeed42046a..6f756dee5225d5b3cd689ebd6f3b7cd688d39192 100644 (file)
@@ -34,7 +34,6 @@ different port or bit, change the macros below:
 #include "usbdrv.h"
 #include "oddebug.h"        /* This is also an example for using debug macros */
 #include "requests.h"       /* The custom request numbers we use */
 #include "usbdrv.h"
 #include "oddebug.h"        /* This is also an example for using debug macros */
 #include "requests.h"       /* The custom request numbers we use */
-#include "special_functions.h"
 #include "hotp.h"
 #if !SIMPLE_COUNTER
 #include "percnt2.h"
 #include "hotp.h"
 #if !SIMPLE_COUNTER
 #include "percnt2.h"
@@ -350,20 +349,6 @@ usbMsgLen_t usbFunctionSetup(uchar data[8])
                        usbMsgPtr = dbg_buffer;
                        return len;
                }
                        usbMsgPtr = dbg_buffer;
                        return len;
                }
-               case CUSTOM_RQ_READ_MEM:
-                       usbMsgPtr = (uchar*)rq->wValue.word;
-                       return rq->wLength.word;
-               case CUSTOM_RQ_WRITE_MEM:
-               case CUSTOM_RQ_EXEC_SPM:
-/*                     uni_buffer_fill = 4;
-                       uni_buffer.w16[0] = rq->wValue.word;
-                       uni_buffer.w16[1] = rq->wLength.word;
-                       return USB_NO_MSG;
-*/             case CUSTOM_RQ_READ_FLASH:
-                       uni_buffer.w16[0] = rq->wValue.word;
-                       uni_buffer.w16[1] = rq->wLength.word;
-            uni_buffer_fill = 4;
-                       return USB_NO_MSG;
                case CUSTOM_RQ_RESET:
                        soft_reset((uint8_t)(rq->wValue.word));
                        break;
                case CUSTOM_RQ_RESET:
                        soft_reset((uint8_t)(rq->wValue.word));
                        break;
@@ -404,46 +389,12 @@ uchar usbFunctionWrite(uchar *data, uchar len)
                }
                memcpy(dbg_buffer, data, len);
                return 1;
                }
                memcpy(dbg_buffer, data, len);
                return 1;
-       case CUSTOM_RQ_WRITE_MEM:
-               memcpy(uni_buffer.ptr[0], data, len);
-               uni_buffer.w16[0] += len;
-               return !(uni_buffer.w16[1] -= len);
-       case CUSTOM_RQ_EXEC_SPM:
-               if(uni_buffer_fill < 8){
-                       uint8_t l = 8 - uni_buffer_fill;
-                       if(len<l){
-                               len = l;
-                       }
-                       memcpy(&(uni_buffer.w8[uni_buffer_fill]), data, len);
-                       uni_buffer_fill += len;
-                       return 0;
-               }
-               uni_buffer.w16[1] -= len;
-               if (uni_buffer.w16[1] > 8) {
-                       memcpy(uni_buffer.ptr[0], data, len);
-                       uni_buffer.w16[0] += len;
-                       return 0;
-               } else {
-                       memcpy(&(uni_buffer.w8[uni_buffer_fill]), data, len);
-                       exec_spm(uni_buffer.w16[2], uni_buffer.w16[3], uni_buffer.ptr[0], data, len);
-                       return 1;
-               }
        default:
                return 1;
        }
        return 0;
 }
 uchar usbFunctionRead(uchar *data, uchar len){
        default:
                return 1;
        }
        return 0;
 }
 uchar usbFunctionRead(uchar *data, uchar len){
-       uchar ret = len;
-       switch(current_command){
-       case CUSTOM_RQ_READ_FLASH:
-               while(len--){
-                       *data++ = pgm_read_byte((uni_buffer.w16[0])++);
-               }
-               return ret;
-       default:
-               break;
-       }
        return 0;
 }
 
        return 0;
 }
 
index 88ae6dcba8393a330bda2cce8c036c6c9fc7c488..d3c9c51d9b453c9571cf213aa5fdc86c7246e80d 100644 (file)
 #include <avr/io.h>
 #include "usbconfig.h"
 
 #include <avr/io.h>
 #include "usbconfig.h"
 
-.global exec_spm
-/* void exec_spm(uint16_t z, uint16_t r0r1, void* dest, void* src, uint8_t len); */
-exec_spm:
-       push r28
-       push r29
-       movw r30, r24
-       movw r0, r22
-       movw r28, r20
-       movw r26, r18
-       movw r24, r16
-       in r23, _SFR_IO_ADDR(SREG)
-       cli
-       tst r24
-       breq spm_cmd
-       dec r24
-       breq last_store
-copy_loop:
-       ld r22, X+
-       st Y+, r22
-       dec r24
-       brne copy_loop
-last_store:
-       ld r22, X+
-       st Y+, r22
-spm_cmd:
-       spm
-       out _SFR_IO_ADDR(SREG), r23
-       clr r1
-       pop r29
-       pop r28
-       ret
-
 .global soft_reset
 soft_reset:
        cli
 .global soft_reset
 soft_reset:
        cli
index a970e14bd385cf110001fee125a825a6402232ec..aa55bff3b302a8a0291d36ad1d4729706edf7169 100644 (file)
@@ -22,7 +22,6 @@
 
 #include <stdint.h>
 
 
 #include <stdint.h>
 
-void exec_spm(uint16_t z, uint16_t r0r1, void* dest, void* src, uint8_t len);
 void soft_reset(uint8_t delay);
 
 #endif /* SPECIAL_FUNCTIONS_H_ */
 void soft_reset(uint8_t delay);
 
 #endif /* SPECIAL_FUNCTIONS_H_ */