mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 10:37:23 -07:00
CHG: continue code cleanup.
REM: removed stdint.h , since we are using c99 when compiling.
This commit is contained in:
parent
9c624f67b3
commit
07bc72b880
12 changed files with 66 additions and 157 deletions
|
@ -34,7 +34,7 @@ void EMVReadRecord(uint8_t arg0, uint8_t arg1,emvtags *currentcard)
|
|||
// perform read
|
||||
// write the result to the provided card
|
||||
if(!emv_readrecord(record,sfi,receivedAnswer)) {
|
||||
if(EMV_DBGLEVEL >= 1) Dbprintf("readrecord failed");
|
||||
if(MF_DBGLEVEL >= 1) Dbprintf("readrecord failed");
|
||||
}
|
||||
if(*(receivedAnswer+1) == 0x70){
|
||||
decode_ber_tlv_item(receivedAnswer+1, &inputtag);
|
||||
|
@ -42,7 +42,7 @@ void EMVReadRecord(uint8_t arg0, uint8_t arg1,emvtags *currentcard)
|
|||
}
|
||||
else
|
||||
{
|
||||
if(EMV_DBGLEVEL >= 1)
|
||||
if(MF_DBGLEVEL >= 1)
|
||||
Dbprintf("Record not found SFI=%i RECORD=%i", sfi, record);
|
||||
}
|
||||
return;
|
||||
|
@ -56,7 +56,7 @@ void EMVSelectAID(uint8_t *AID, uint8_t AIDlen, emvtags* inputcard)
|
|||
tlvtag inputtag; // create the tag structure
|
||||
// perform select
|
||||
if(!emv_select(AID, AIDlen, receivedAnswer)){
|
||||
if(EMV_DBGLEVEL >= 1) Dbprintf("AID Select failed");
|
||||
if(MF_DBGLEVEL == 1) Dbprintf("AID Select failed");
|
||||
return;
|
||||
}
|
||||
// write the result to the provided card
|
||||
|
@ -80,7 +80,7 @@ void EMVSelectAID(uint8_t *AID, uint8_t AIDlen, emvtags* inputcard)
|
|||
if(currentcard.tag_61_len !=0){
|
||||
emv_decode_field(currentcard.tag_61, currentcard.tag_61_len, ¤tcard);}
|
||||
}
|
||||
if(EMV_DBGLEVEL >= 2)
|
||||
if(MF_DBGLEVEL >= 2)
|
||||
DbpString("SELECT AID COMPLETED");
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ int EMVGetProcessingOptions(uint8_t *PDOL, uint8_t PDOLlen, emvtags* inputcard)
|
|||
tlvtag inputtag; //create the tag structure
|
||||
// perform pdol
|
||||
if(!emv_getprocessingoptions(PDOL, PDOLlen, receivedAnswer)){
|
||||
if(EMV_DBGLEVEL >= 1) Dbprintf("get processing options failed");
|
||||
if(MF_DBGLEVEL >= 1) Dbprintf("get processing options failed");
|
||||
return 0;
|
||||
}
|
||||
// write the result to the provided card
|
||||
|
@ -111,7 +111,7 @@ int EMVGetProcessingOptions(uint8_t *PDOL, uint8_t PDOLlen, emvtags* inputcard)
|
|||
// store 82 and 94 tags (AIP, AFL)
|
||||
emv_decode_field(inputtag.value, inputtag.valuelength, ¤tcard);
|
||||
}
|
||||
if(EMV_DBGLEVEL >= 2)
|
||||
if(MF_DBGLEVEL >= 2)
|
||||
DbpString("GET PROCESSING OPTIONS COMPLETE");
|
||||
return 1;
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ int EMVGetChallenge(emvtags* inputcard)
|
|||
// tlvtag inputtag; //create the tag structure
|
||||
// perform select
|
||||
if(!emv_getchallenge(receivedAnswer)){
|
||||
if(EMV_DBGLEVEL >= 1) Dbprintf("get processing options failed");
|
||||
if(MF_DBGLEVEL >= 1) Dbprintf("get processing options failed");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -146,7 +146,7 @@ int EMVGenerateAC(uint8_t refcontrol, emvtags* inputcard)
|
|||
// tlvtag inputtag; //create the tag structure
|
||||
// perform select
|
||||
if(!emv_generateAC(refcontrol, cdolcommand, cdolcommandlen,receivedAnswer)){
|
||||
if(EMV_DBGLEVEL >= 1) Dbprintf("get processing options failed");
|
||||
if(MF_DBGLEVEL >= 1) Dbprintf("get processing options failed");
|
||||
return 1;
|
||||
}
|
||||
if(receivedAnswer[2] == 0x77) //format 2 data field returned
|
||||
|
@ -189,7 +189,7 @@ int EMV_PaywaveTransaction()
|
|||
Dbhexdump(pdolcommandlen, pdolcommand,false);
|
||||
|
||||
if(!EMVGetProcessingOptions(pdolcommand,pdolcommandlen, ¤tcard)) {
|
||||
if(EMV_DBGLEVEL >= 1) Dbprintf("PDOL failed");
|
||||
if(MF_DBGLEVEL >= 1) Dbprintf("PDOL failed");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -253,7 +253,7 @@ int EMV_PaypassTransaction()
|
|||
emv_generateDOL(currentcard.tag_9F38, currentcard.tag_9F38_len, ¤tcard, pdolcommand, &pdolcommandlen);
|
||||
}
|
||||
if(EMVGetProcessingOptions(pdolcommand,pdolcommandlen, ¤tcard)) {
|
||||
if(EMV_DBGLEVEL >= 1) Dbprintf("PDOL failed");
|
||||
if(MF_DBGLEVEL >= 1) Dbprintf("PDOL failed");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -337,7 +337,7 @@ void EMVTransaction()
|
|||
|
||||
while(true) {
|
||||
if(!iso14443a_select_card(uid, NULL, &cuid, true, 0)) {
|
||||
if(EMV_DBGLEVEL >= 1) Dbprintf("Can't select card");
|
||||
if(MF_DBGLEVEL >= 1) Dbprintf("Can't select card");
|
||||
break;
|
||||
}
|
||||
//selectPPSE
|
||||
|
@ -355,7 +355,7 @@ void EMVTransaction()
|
|||
//TODO: add other card schemes like AMEX, JCB, China Unionpay etc
|
||||
break;
|
||||
}
|
||||
if (EMV_DBGLEVEL >= 2) DbpString("EMV TRANSACTION FINISHED");
|
||||
if (MF_DBGLEVEL >= 2) DbpString("EMV TRANSACTION FINISHED");
|
||||
//finish up
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||
LEDsoff();
|
||||
|
|
120
armsrc/emvutil.c
120
armsrc/emvutil.c
|
@ -12,7 +12,6 @@
|
|||
|
||||
#define DUMP(varname) Dbprintf("%s=", #varname);
|
||||
|
||||
int EMV_DBGLEVEL = EMV_DBG_ALL;
|
||||
//uint8_t PCB = 0x00; //track Protocol Control Byte externally
|
||||
|
||||
//util functions
|
||||
|
@ -1365,8 +1364,7 @@ int emv_select(uint8_t* AID, uint8_t AID_len, void* data)
|
|||
int emv_readrecord(uint8_t recordnumber, uint8_t sfi, void* data)
|
||||
{
|
||||
uint16_t readRecordCmd_len = 5;
|
||||
uint8_t readRecordCmd[readRecordCmd_len];
|
||||
|
||||
uint8_t readRecordCmd[readRecordCmd_len];
|
||||
readRecordCmd[0] = 0x00;
|
||||
readRecordCmd[1] = 0xB2;
|
||||
readRecordCmd[2] = recordnumber;
|
||||
|
@ -1378,8 +1376,7 @@ int emv_readrecord(uint8_t recordnumber, uint8_t sfi, void* data)
|
|||
int emv_getprocessingoptions(uint8_t* pdol, uint8_t pdol_len, void* data)
|
||||
{
|
||||
uint16_t processingCmd_len = 4 + 1 + 2 + pdol_len + 1;
|
||||
uint8_t processingCmd[processingCmd_len];
|
||||
|
||||
uint8_t processingCmd[processingCmd_len];
|
||||
processingCmd[0] = 0x80;
|
||||
processingCmd[1] = 0xA8;
|
||||
processingCmd[2] = 0x00;
|
||||
|
@ -1396,8 +1393,7 @@ int emv_getprocessingoptions(uint8_t* pdol, uint8_t pdol_len, void* data)
|
|||
int emv_computecryptogram(uint8_t* UDOL, uint8_t UDOL_len, void *data)
|
||||
{
|
||||
uint16_t cryptogramCmd_len = 4 + 1 + UDOL_len + 1;
|
||||
uint8_t cryptogramCmd[cryptogramCmd_len];
|
||||
|
||||
uint8_t cryptogramCmd[cryptogramCmd_len];
|
||||
cryptogramCmd[0] = 0x80;
|
||||
cryptogramCmd[1] = 0x2A;
|
||||
cryptogramCmd[2] = 0x8E;
|
||||
|
@ -1405,7 +1401,6 @@ int emv_computecryptogram(uint8_t* UDOL, uint8_t UDOL_len, void *data)
|
|||
cryptogramCmd[4] = UDOL_len;
|
||||
memcpy(&(cryptogramCmd[5]), UDOL, UDOL_len);
|
||||
cryptogramCmd[cryptogramCmd_len-1] = 0x00;
|
||||
|
||||
return iso14_apdu(cryptogramCmd, cryptogramCmd_len, data);
|
||||
}
|
||||
|
||||
|
@ -1413,13 +1408,11 @@ int emv_getchallenge(void *data)
|
|||
{
|
||||
uint16_t challengeCmd_len = 5;
|
||||
uint8_t challengeCmd[challengeCmd_len];
|
||||
|
||||
challengeCmd[0] = 0x00;
|
||||
challengeCmd[1] = 0x84;
|
||||
challengeCmd[2] = 0x00;
|
||||
challengeCmd[3] = 0x00;
|
||||
challengeCmd[4] = 0x00;
|
||||
|
||||
challengeCmd[4] = 0x00;
|
||||
return iso14_apdu(challengeCmd, challengeCmd_len, data);
|
||||
}
|
||||
|
||||
|
@ -1427,7 +1420,6 @@ int emv_loopback(uint8_t* transData , uint8_t transData_len, void *data)
|
|||
{
|
||||
uint16_t loopbackCmd_len = 4 + 1 + transData_len + 1;
|
||||
uint8_t loopbackCmd[loopbackCmd_len];
|
||||
|
||||
loopbackCmd[0] = 0x00;
|
||||
loopbackCmd[1] = 0xEE;
|
||||
loopbackCmd[2] = 0x00;
|
||||
|
@ -1441,8 +1433,7 @@ int emv_loopback(uint8_t* transData , uint8_t transData_len, void *data)
|
|||
int emv_generateAC(uint8_t refcontrolparam, uint8_t* cdolinput, uint8_t cdolinputlen, void* data)
|
||||
{
|
||||
uint16_t acCmd_len = 4 + 1 + cdolinputlen + 1;
|
||||
uint8_t acCmd[acCmd_len];
|
||||
|
||||
uint8_t acCmd[acCmd_len];
|
||||
acCmd[0] = 0x80;
|
||||
acCmd[1] = 0xAE;
|
||||
acCmd[2] = refcontrolparam;
|
||||
|
@ -1462,22 +1453,14 @@ int emv_decodeAFL(uint8_t* AFL, uint8_t AFLlen ){
|
|||
//Print out AIP Bit meanings
|
||||
int emv_decodeAIP(uint8_t* AIP)
|
||||
{
|
||||
if((AIP[0] & AIP_SDA_SUPPORTED) == AIP_SDA_SUPPORTED)
|
||||
Dbprintf("SDA supported");
|
||||
if((AIP[0] & AIP_DDA_SUPPORTED) == AIP_DDA_SUPPORTED)
|
||||
Dbprintf("DDA supported");
|
||||
if((AIP[0] & AIP_CARDHOLDER_VERIFICATION)==AIP_CARDHOLDER_VERIFICATION)
|
||||
Dbprintf("Cardholder verification is supported");
|
||||
if((AIP[0] & AIP_TERMINAL_RISK) == AIP_TERMINAL_RISK)
|
||||
Dbprintf("Terminal risk management is to be performed");
|
||||
if((AIP[0] & AIP_ISSUER_AUTH) == AIP_ISSUER_AUTH)
|
||||
Dbprintf("Issuer authentication is supported ");
|
||||
if((AIP[0] & AIP_CDA_SUPPORTED) == AIP_CDA_SUPPORTED)
|
||||
Dbprintf("CDA supported");
|
||||
if((AIP[1] & AIP_CHIP_SUPPORTED) == AIP_CHIP_SUPPORTED)
|
||||
Dbprintf("Chip supported");
|
||||
if((AIP[1] & AIP_MSR_SUPPORTED) == AIP_MSR_SUPPORTED)
|
||||
Dbprintf("MSR supported");
|
||||
if ((AIP[0] & AIP_SDA_SUPPORTED) == AIP_SDA_SUPPORTED) Dbprintf("SDA supported");
|
||||
if ((AIP[0] & AIP_DDA_SUPPORTED) == AIP_DDA_SUPPORTED) Dbprintf("DDA supported");
|
||||
if ((AIP[0] & AIP_CARDHOLDER_VERIFICATION) == AIP_CARDHOLDER_VERIFICATION) Dbprintf("Cardholder verification is supported");
|
||||
if ((AIP[0] & AIP_TERMINAL_RISK) == AIP_TERMINAL_RISK) Dbprintf("Terminal risk management is to be performed");
|
||||
if ((AIP[0] & AIP_ISSUER_AUTH) == AIP_ISSUER_AUTH) Dbprintf("Issuer authentication is supported ");
|
||||
if ((AIP[0] & AIP_CDA_SUPPORTED) == AIP_CDA_SUPPORTED) Dbprintf("CDA supported");
|
||||
if ((AIP[1] & AIP_CHIP_SUPPORTED) == AIP_CHIP_SUPPORTED) Dbprintf("Chip supported");
|
||||
if ((AIP[1] & AIP_MSR_SUPPORTED) == AIP_MSR_SUPPORTED) Dbprintf("MSR supported");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1490,59 +1473,33 @@ int emv_decodeCVM(uint8_t* CVM, uint8_t CVMlen)
|
|||
amountX = bytes_to_num(CVM, 4);
|
||||
amountY = bytes_to_num(CVM+4, 4);
|
||||
counter +=8;
|
||||
while(counter < CVMlen)
|
||||
while (counter < CVMlen)
|
||||
{
|
||||
if((CVM[counter] & 0x40) == 0x40){
|
||||
if((CVM[counter] & 0x3F)== 0x00){
|
||||
Dbprintf("Fail CVM processing");
|
||||
}
|
||||
if((CVM[counter] & 0x3F) == 0x01){
|
||||
Dbprintf("Plaintext PIN verification performed by ICC");
|
||||
}
|
||||
if((CVM[counter] & 0x3F) == 0x02){
|
||||
Dbprintf("Enciphered PIN verified online");
|
||||
}
|
||||
if((CVM[counter] & 0x3F) == 0x03){
|
||||
Dbprintf("Plaintext PIN verification performed by ICC and signature (paper)");
|
||||
}
|
||||
if((CVM[counter] & 0x3F) == 0x04){
|
||||
Dbprintf("Enciphered PIN verification performed by ICC");
|
||||
}
|
||||
if((CVM[counter] & 0x3F) == 0x05){
|
||||
Dbprintf("Enciphered PIN verification performed by ICC and signature (paper)");
|
||||
}
|
||||
if((CVM[counter] & 0x3F) == 0x30){
|
||||
Dbprintf("Signature (paper)");
|
||||
}
|
||||
if((CVM[counter] & 0x7F) == 0x40){ // iceman, wrong masked used? changed from 0x3f -> 0x7f
|
||||
Dbprintf("No CVM required");
|
||||
}
|
||||
if ((CVM[counter] & 0x40) == 0x40){
|
||||
if ((CVM[counter] & 0x3F)== 0x00){ Dbprintf("Fail CVM processing");}
|
||||
if ((CVM[counter] & 0x3F) == 0x01){ Dbprintf("Plaintext PIN verification performed by ICC");}
|
||||
if ((CVM[counter] & 0x3F) == 0x02){ Dbprintf("Enciphered PIN verified online");}
|
||||
if ((CVM[counter] & 0x3F) == 0x03){ Dbprintf("Plaintext PIN verification performed by ICC and signature (paper)");}
|
||||
if ((CVM[counter] & 0x3F) == 0x04){ Dbprintf("Enciphered PIN verification performed by ICC");}
|
||||
if ((CVM[counter] & 0x3F) == 0x05){ Dbprintf("Enciphered PIN verification performed by ICC and signature (paper)");}
|
||||
if ((CVM[counter] & 0x3F) == 0x30){ Dbprintf("Signature (paper)");}
|
||||
// iceman, wrong masked used? changed from 0x3f -> 0x7f
|
||||
if ((CVM[counter] & 0x7F) == 0x40){ Dbprintf("No CVM required");}
|
||||
counter +=2;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
Dbprintf("Fail cardholder verification if this CVM is unsuccessful");
|
||||
counter +=2;
|
||||
}
|
||||
if(CVM[counter+1] == 0x00){
|
||||
Dbprintf("Always");}
|
||||
if(CVM[counter+1] == 0x01){
|
||||
Dbprintf("If unattended cash");}
|
||||
if(CVM[counter+1] == 0x02){
|
||||
Dbprintf("If not unattended cash and not manual cash and not purchase with cashback");}
|
||||
if(CVM[counter+1] == 0x03){
|
||||
Dbprintf("If terminal supports the CVM");}
|
||||
if(CVM[counter+1] == 0x04){
|
||||
Dbprintf("If manual cash");}
|
||||
if(CVM[counter+1] == 0x05){
|
||||
Dbprintf("If purchase with cashback");}
|
||||
if(CVM[counter+1] == 0x06){
|
||||
Dbprintf("If transaction is in the application currency and is under %lu value", amountX);}
|
||||
if(CVM[counter+1] == 0x07){
|
||||
Dbprintf("If transaction is in the application currency and is over %lu value", amountX);}
|
||||
if(CVM[counter+1] == 0x08){
|
||||
Dbprintf("If transaction is in the application currency and is under %lu value", amountY);}
|
||||
if(CVM[counter+1] == 0x09){
|
||||
Dbprintf("If transaction is in the application currency and is over %lu value", amountY);}
|
||||
if (CVM[counter+1] == 0x00){ Dbprintf("Always");}
|
||||
if (CVM[counter+1] == 0x01){ Dbprintf("If unattended cash");}
|
||||
if (CVM[counter+1] == 0x02){ Dbprintf("If not unattended cash and not manual cash and not purchase with cashback");}
|
||||
if (CVM[counter+1] == 0x03){ Dbprintf("If terminal supports the CVM");}
|
||||
if (CVM[counter+1] == 0x04){ Dbprintf("If manual cash");}
|
||||
if (CVM[counter+1] == 0x05){ Dbprintf("If purchase with cashback");}
|
||||
if (CVM[counter+1] == 0x06){ Dbprintf("If transaction is in the application currency and is under %" PRIu32 " value", amountX);}
|
||||
if (CVM[counter+1] == 0x07){ Dbprintf("If transaction is in the application currency and is over %" PRIu32 " value", amountX);}
|
||||
if (CVM[counter+1] == 0x08){ Dbprintf("If transaction is in the application currency and is under %" PRIu32 " value", amountY);}
|
||||
if (CVM[counter+1] == 0x09){ Dbprintf("If transaction is in the application currency and is over %" PRIu32 " value", amountY);}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -1559,8 +1516,7 @@ void dumpCard(emvtags* currentcard){
|
|||
DUMP(currentcard->SAK2);
|
||||
Dbhexdump(1, ¤tcard->SAK2, false);
|
||||
DUMP(currentcard->ATS);
|
||||
Dbhexdump(currentcard->ATS_len, currentcard->ATS, false);
|
||||
|
||||
Dbhexdump(currentcard->ATS_len, currentcard->ATS, false);
|
||||
DUMP(currentcard->tag_4F);
|
||||
Dbhexdump(currentcard->tag_4F_len, currentcard->tag_4F, false);
|
||||
DUMP(currentcard->tag_50);
|
||||
|
@ -1579,9 +1535,9 @@ void dumpCard(emvtags* currentcard){
|
|||
Dbhexdump(currentcard->tag_86_len, currentcard->tag_86, false);
|
||||
DUMP(currentcard->tag_87);
|
||||
Dbhexdump(1, currentcard->tag_87, false);
|
||||
DUMP(currentcard->tag_88);
|
||||
DUMP(currentcard->tag_88);
|
||||
Dbhexdump(1, currentcard->tag_88, false);
|
||||
DUMP(currentcard->tag_8A);
|
||||
DUMP(currentcard->tag_8A);
|
||||
Dbhexdump(2, currentcard->tag_8A, false);
|
||||
DUMP(currentcard->tag_8C);
|
||||
Dbhexdump(currentcard->tag_8C_len, currentcard->tag_8C, false);
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <inttypes.h>
|
||||
#include "proxmark3.h"
|
||||
#include "apps.h"
|
||||
#include "tlv.h"
|
||||
|
@ -30,15 +31,6 @@
|
|||
// reader voltage field detector
|
||||
#define EMV_MINFIELDV 4000
|
||||
|
||||
// debug
|
||||
// 0 - no debug messages 1 - error messages 2 - all messages 4 - extended debug mode
|
||||
#define EMV_DBG_NONE 0
|
||||
#define EMV_DBG_ERROR 1
|
||||
#define EMV_DBG_ALL 2
|
||||
#define EMV_DBG_EXTENDED 4
|
||||
|
||||
extern int EMV_DBGLEVEL;
|
||||
|
||||
//EMV emulator states need to update
|
||||
#define EMVEMUL_NOFIELD 0
|
||||
#define EMVEMUL_IDLE 1
|
||||
|
|
|
@ -567,23 +567,19 @@ int emlSetValBl(uint32_t blReg, uint8_t blBlock, int blockNum) {
|
|||
uint64_t emlGetKey(int sectorNum, int keyType) {
|
||||
uint8_t key[6] = {0x00};
|
||||
uint8_t* emCARD = BigBuf_get_EM_addr();
|
||||
|
||||
memcpy(key, emCARD + 16 * (FirstBlockOfSector(sectorNum) + NumBlocksPerSector(sectorNum) - 1) + keyType * 10, 6);
|
||||
return bytes_to_num(key, 6);
|
||||
}
|
||||
|
||||
void emlClearMem(void) {
|
||||
int b;
|
||||
|
||||
const uint8_t trailer[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x07, 0x80, 0x69, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
|
||||
const uint8_t uid[] = {0xe6, 0x84, 0x87, 0xf3, 0x16, 0x88, 0x04, 0x00, 0x46, 0x8e, 0x45, 0x55, 0x4d, 0x70, 0x41, 0x04};
|
||||
uint8_t* emCARD = BigBuf_get_EM_addr();
|
||||
|
||||
memset(emCARD, 0, CARD_MEMORY_SIZE);
|
||||
|
||||
// fill sectors trailer data
|
||||
for(b = 3; b < 256; b<127?(b+=4):(b+=16))
|
||||
emlSetMem((uint8_t *)trailer, b , 1);
|
||||
for(uint8_t b = 3; b < 256; b < 127 ? (b += 4) : (b += 16))
|
||||
emlSetMem((uint8_t *)trailer, b, 1);
|
||||
|
||||
// uid
|
||||
emlSetMem((uint8_t *)uid, 0, 1);
|
||||
|
|
|
@ -35,17 +35,17 @@
|
|||
*/
|
||||
#include "printf.h"
|
||||
|
||||
typedef uint32_t uintmax_t;
|
||||
typedef int32_t intmax_t;
|
||||
|
||||
typedef unsigned char u_char;
|
||||
typedef unsigned int u_int;
|
||||
typedef unsigned long u_long;
|
||||
typedef unsigned short u_short;
|
||||
typedef unsigned long long u_quad_t;
|
||||
typedef long long quad_t;
|
||||
|
||||
typedef unsigned long u_long;
|
||||
typedef unsigned short u_short;
|
||||
typedef int ssize_t;
|
||||
/*
|
||||
typedef uint32_t uintmax_t;
|
||||
typedef int32_t intmax_t;
|
||||
*/
|
||||
|
||||
#define NBBY 8 /* number of bits in a byte */
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
//#include "util.h"
|
||||
#include "string.h"
|
||||
|
||||
int kvsprintf(const char *format, void *arg, int radix, va_list ap) __attribute__ ((format (printf, 1, 0)));
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2010 Hector Martin "marcan" <marcan@marcansoft.com>
|
||||
//
|
||||
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
|
||||
// at your option, any later version. See the LICENSE.txt file for the text of
|
||||
// the license.
|
||||
//-----------------------------------------------------------------------------
|
||||
// Replacement stdint.h because GCC doesn't come with it yet (C99)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef __STDINT_H
|
||||
#define __STDINT_H
|
||||
|
||||
typedef signed char int8_t;
|
||||
typedef short int int16_t;
|
||||
typedef int int32_t;
|
||||
typedef long long int int64_t;
|
||||
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short int uint16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef unsigned long long int uint64_t;
|
||||
|
||||
typedef int intptr_t;
|
||||
typedef unsigned int uintptr_t;
|
||||
|
||||
#endif /* __STDINT_H */
|
|
@ -9,7 +9,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
#include "string.h"
|
||||
|
||||
void *memcpy(void *dest, const void *src, int len)
|
||||
RAMFUNC void *memcpy(void *dest, const void *src, int len)
|
||||
{
|
||||
uint8_t *d = dest;
|
||||
const uint8_t *s = src;
|
||||
|
@ -31,7 +31,7 @@ void *memset(void *dest, int c, int len)
|
|||
return dest;
|
||||
}
|
||||
|
||||
int memcmp(const void *av, const void *bv, int len)
|
||||
RAMFUNC int memcmp(const void *av, const void *bv, int len)
|
||||
{
|
||||
const uint8_t *a = av;
|
||||
const uint8_t *b = bv;
|
||||
|
|
|
@ -272,13 +272,9 @@ void BootROM(void)
|
|||
LED_B_OFF();
|
||||
LED_A_OFF();
|
||||
|
||||
AT91C_BASE_EFC0->EFC_FMR =
|
||||
AT91C_MC_FWS_1FWS |
|
||||
MC_FLASH_MODE_MASTER_CLK_IN_MHZ(48);
|
||||
AT91C_BASE_EFC0->EFC_FMR = AT91C_MC_FWS_1FWS | MC_FLASH_MODE_MASTER_CLK_IN_MHZ(48);
|
||||
#ifdef HAS_512_FLASH
|
||||
AT91C_BASE_EFC1->EFC_FMR =
|
||||
AT91C_MC_FWS_1FWS |
|
||||
MC_FLASH_MODE_MASTER_CLK_IN_MHZ(48);
|
||||
AT91C_BASE_EFC1->EFC_FMR = AT91C_MC_FWS_1FWS | MC_FLASH_MODE_MASTER_CLK_IN_MHZ(48);
|
||||
#endif
|
||||
// Initialize all system clocks
|
||||
ConfigClocks();
|
||||
|
|
|
@ -27,10 +27,6 @@
|
|||
#include <inttypes.h>
|
||||
#include "usb_cmd.h"
|
||||
|
||||
/*
|
||||
#define lu PRIu32
|
||||
#define lx PRIx32
|
||||
*/
|
||||
#define PROXPROMPT "pm3 --> "
|
||||
|
||||
void SendCommand(UsbCommand *c);
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
#include "reveng.h"
|
||||
|
||||
/* Private declarations */
|
||||
|
@ -116,7 +117,7 @@ mtostr(const model_t *model) {
|
|||
if((string = malloc(size))) {
|
||||
sprintf(strbuf, "\"%s\"", model->name);
|
||||
sprintf(string,
|
||||
"width=%lu "
|
||||
"width=%" PRIu32 ""
|
||||
"poly=0x%s "
|
||||
"init=0x%s "
|
||||
"refin=%s "
|
||||
|
|
|
@ -103,7 +103,7 @@ lo_edge_detect le(
|
|||
// Major modes:
|
||||
// 000 -- LF reader (generic)
|
||||
// 001 -- LF edge detect (generic)
|
||||
// 010 -- LF passthrough
|
||||
// 010 -- LF passthru
|
||||
|
||||
mux8 mux_ssp_clk (major_mode, ssp_clk, lr_ssp_clk, le_ssp_clk, 1'b0, 1'b0, 1'b0, 1'b0, 1'b0, 1'b0);
|
||||
mux8 mux_ssp_din (major_mode, ssp_din, lr_ssp_din, 1'b0, lp_ssp_din, 1'b0, 1'b0, 1'b0, 1'b0, 1'b0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue