- while(!BUTTON_PRESS()) {
- /* Switch on carrier and let the tag charge for 1ms */
- AT91C_BASE_PIOA->PIO_SODR = GPIO_SSC_DOUT;
- SpinDelay(1);
-
- LED_A_ON();
- frame_send_rwd(queries[0].data, queries[0].bits);
- LED_A_OFF();
+ memset(BigBuf, 0, 1024);
+
+ int byte_index = 0, card_size = 0, command_size = 0;
+ uint16_t command_obfuscation = 0x57, response_obfuscation = 0;
+ uint16_t tag_type = perform_setup_phase_rwd();
+ switch_off_tag_rwd();
+
+ int error = 0;
+ switch(tag_type) {
+ case 0x1d:
+ DbpString("MIM 256 card found, reading card ...");
+ command_size = 9;
+ card_size = 256;
+ response_obfuscation = 0x52;
+ break;
+ case 0x3d:
+ DbpString("MIM 1024 card found, reading card ...");
+ command_size = 11;
+ card_size = 1024;
+ response_obfuscation = 0xd4;
+ break;
+ default:
+ DbpString("No or unknown card found, aborting");
+ error = 1;
+ break;
+ }
+
+ LED_B_ON();
+ while(!BUTTON_PRESS() && (byte_index<card_size)) {
+ if(perform_setup_phase_rwd() != tag_type) {
+ DbpString("Card removed, aborting");
+ switch_off_tag_rwd();
+ error=1;
+ break;
+ }