Change byte_t type to uint8_t (Fixes Issue 147)

This commit is contained in:
Audrey Diacre 2011-11-24 10:54:42 +00:00
parent ce846931bc
commit 784a2f86a2
43 changed files with 442 additions and 444 deletions

View file

@ -38,7 +38,7 @@ struct nfc_emulator {
};
struct nfc_emulation_state_machine {
int (*io)(struct nfc_emulator *emulator, const byte_t *data_in, const size_t data_in_len, byte_t *data_out, const size_t data_out_len);
int (*io)(struct nfc_emulator *emulator, const uint8_t *data_in, const size_t data_in_len, uint8_t *data_out, const size_t data_out_len);
void *data;
};

View file

@ -32,8 +32,6 @@
# include <stdbool.h>
# include <stdio.h>
typedef uint8_t byte_t;
# define DEVICE_NAME_LENGTH 256
# define DEVICE_PORT_LENGTH 64
@ -59,7 +57,7 @@ typedef struct {
selecting tags supporting it? */
bool bAutoIso14443_4;
/** Supported modulation encoded in a byte */
byte_t btSupportByte;
uint8_t btSupportByte;
/** Last error reported by the PCD / encountered by the PCD driver
* MSB LSB
* | 00 | 00 |
@ -73,7 +71,7 @@ typedef struct {
typedef char nfc_connstring[1024];
// Compiler directive, set struct alignment to 1 byte_t for compatibility
// Compiler directive, set struct alignment to 1 uint8_t for compatibility
# pragma pack(1)
/**
@ -155,19 +153,19 @@ typedef enum {
*/
typedef struct {
/** NFCID3 */
byte_t abtNFCID3[10];
uint8_t abtNFCID3[10];
/** DID */
byte_t btDID;
uint8_t btDID;
/** Supported send-bit rate */
byte_t btBS;
uint8_t btBS;
/** Supported receive-bit rate */
byte_t btBR;
uint8_t btBR;
/** Timeout value */
byte_t btTO;
uint8_t btTO;
/** PP Parameters */
byte_t btPP;
uint8_t btPP;
/** General Bytes */
byte_t abtGB[48];
uint8_t abtGB[48];
size_t szGB;
/** DEP mode */
nfc_dep_mode ndm;
@ -178,12 +176,12 @@ typedef struct {
* @brief NFC ISO14443A tag (MIFARE) information
*/
typedef struct {
byte_t abtAtqa[2];
byte_t btSak;
uint8_t abtAtqa[2];
uint8_t btSak;
size_t szUidLen;
byte_t abtUid[10];
uint8_t abtUid[10];
size_t szAtsLen;
byte_t abtAts[254]; // Maximal theoretical ATS is FSD-2, FSD=256 for FSDI=8 in RATS
uint8_t abtAts[254]; // Maximal theoretical ATS is FSD-2, FSD=256 for FSDI=8 in RATS
} nfc_iso14443a_info;
/**
@ -192,10 +190,10 @@ typedef struct {
*/
typedef struct {
size_t szLen;
byte_t btResCode;
byte_t abtId[8];
byte_t abtPad[8];
byte_t abtSysCode[2];
uint8_t btResCode;
uint8_t abtId[8];
uint8_t abtPad[8];
uint8_t abtSysCode[2];
} nfc_felica_info;
/**
@ -204,11 +202,11 @@ typedef struct {
*/
typedef struct {
/** abtPupi store PUPI contained in ATQB (Answer To reQuest of type B) (see ISO14443-3) */
byte_t abtPupi[4];
uint8_t abtPupi[4];
/** abtApplicationData store Application Data contained in ATQB (see ISO14443-3) */
byte_t abtApplicationData[4];
uint8_t abtApplicationData[4];
/** abtProtocolInfo store Protocol Info contained in ATQB (see ISO14443-3) */
byte_t abtProtocolInfo[3];
uint8_t abtProtocolInfo[3];
/** ui8CardIdentifier store CID (Card Identifier) attributted by PCD to the PICC */
uint8_t ui8CardIdentifier;
} nfc_iso14443b_info;
@ -219,14 +217,14 @@ typedef struct {
*/
typedef struct {
/** DIV: 4 LSBytes of tag serial number */
byte_t abtDIV[4];
uint8_t abtDIV[4];
/** Software version & type of REPGEN */
byte_t btVerLog;
uint8_t btVerLog;
/** Config Byte, present if long REPGEN */
byte_t btConfig;
uint8_t btConfig;
/** ATR, if any */
size_t szAtrLen;
byte_t abtAtr[33];
uint8_t abtAtr[33];
} nfc_iso14443bi_info;
/**
@ -234,7 +232,7 @@ typedef struct {
* @brief NFC ISO14443-2B ST SRx tag information
*/
typedef struct {
byte_t abtUID[8];
uint8_t abtUID[8];
} nfc_iso14443b2sr_info;
/**
@ -242,9 +240,9 @@ typedef struct {
* @brief NFC ISO14443-2B ASK CTx tag information
*/
typedef struct {
byte_t abtUID[4];
byte_t btProdCode;
byte_t btFabCode;
uint8_t abtUID[4];
uint8_t btProdCode;
uint8_t btFabCode;
} nfc_iso14443b2ct_info;
/**
@ -252,8 +250,8 @@ typedef struct {
* @brief NFC Jewel tag information
*/
typedef struct {
byte_t btSensRes[2];
byte_t btId[4];
uint8_t btSensRes[2];
uint8_t btId[4];
} nfc_jewel_info;
/**

View file

@ -73,22 +73,22 @@ extern "C" {
/* NFC initiator: act as "reader" */
NFC_EXPORT bool nfc_initiator_init (nfc_device * pnd);
NFC_EXPORT bool nfc_initiator_select_passive_target (nfc_device * pnd, const nfc_modulation nm, const byte_t * pbtInitData, const size_t szInitData, nfc_target * pnt);
NFC_EXPORT bool nfc_initiator_select_passive_target (nfc_device * pnd, const nfc_modulation nm, const uint8_t * pbtInitData, const size_t szInitData, nfc_target * pnt);
NFC_EXPORT bool nfc_initiator_list_passive_targets (nfc_device * pnd, const nfc_modulation nm, nfc_target ant[], const size_t szTargets, size_t * pszTargetFound);
NFC_EXPORT bool nfc_initiator_poll_target (nfc_device * pnd, const nfc_modulation * pnmTargetTypes, const size_t szTargetTypes, const uint8_t uiPollNr, const uint8_t uiPeriod, nfc_target * pnt);
NFC_EXPORT bool nfc_initiator_select_dep_target (nfc_device * pnd, const nfc_dep_mode ndm, const nfc_baud_rate nbr, const nfc_dep_info * pndiInitiator, nfc_target * pnt);
NFC_EXPORT bool nfc_initiator_deselect_target (nfc_device * pnd);
NFC_EXPORT bool nfc_initiator_transceive_bytes (nfc_device * pnd, const byte_t * pbtTx, const size_t szTx, byte_t * pbtRx, size_t * pszRx, struct timeval *timeout);
NFC_EXPORT bool nfc_initiator_transceive_bits (nfc_device * pnd, const byte_t * pbtTx, const size_t szTxBits, const byte_t * pbtTxPar, byte_t * pbtRx, size_t * pszRxBits, byte_t * pbtRxPar);
NFC_EXPORT bool nfc_initiator_transceive_bytes_timed (nfc_device * pnd, const byte_t * pbtTx, const size_t szTx, byte_t * pbtRx, size_t * pszRx, uint32_t * cycles);
NFC_EXPORT bool nfc_initiator_transceive_bits_timed (nfc_device * pnd, const byte_t * pbtTx, const size_t szTxBits, const byte_t * pbtTxPar, byte_t * pbtRx, size_t * pszRxBits, byte_t * pbtRxPar, uint32_t * cycles);
NFC_EXPORT bool nfc_initiator_transceive_bytes (nfc_device * pnd, const uint8_t * pbtTx, const size_t szTx, uint8_t * pbtRx, size_t * pszRx, struct timeval *timeout);
NFC_EXPORT bool nfc_initiator_transceive_bits (nfc_device * pnd, const uint8_t * pbtTx, const size_t szTxBits, const uint8_t * pbtTxPar, uint8_t * pbtRx, size_t * pszRxBits, uint8_t * pbtRxPar);
NFC_EXPORT bool nfc_initiator_transceive_bytes_timed (nfc_device * pnd, const uint8_t * pbtTx, const size_t szTx, uint8_t * pbtRx, size_t * pszRx, uint32_t * cycles);
NFC_EXPORT bool nfc_initiator_transceive_bits_timed (nfc_device * pnd, const uint8_t * pbtTx, const size_t szTxBits, const uint8_t * pbtTxPar, uint8_t * pbtRx, size_t * pszRxBits, uint8_t * pbtRxPar, uint32_t * cycles);
/* NFC target: act as tag (i.e. MIFARE Classic) or NFC target device. */
NFC_EXPORT bool nfc_target_init (nfc_device * pnd, nfc_target * pnt, byte_t * pbtRx, size_t * pszRx);
NFC_EXPORT bool nfc_target_send_bytes (nfc_device * pnd, const byte_t * pbtTx, const size_t szTx, struct timeval *timout);
NFC_EXPORT bool nfc_target_receive_bytes (nfc_device * pnd, byte_t * pbtRx, size_t * pszRx, struct timeval *timout);
NFC_EXPORT bool nfc_target_send_bits (nfc_device * pnd, const byte_t * pbtTx, const size_t szTxBits, const byte_t * pbtTxPar);
NFC_EXPORT bool nfc_target_receive_bits (nfc_device * pnd, byte_t * pbtRx, size_t * pszRxBits, byte_t * pbtRxPar);
NFC_EXPORT bool nfc_target_init (nfc_device * pnd, nfc_target * pnt, uint8_t * pbtRx, size_t * pszRx);
NFC_EXPORT bool nfc_target_send_bytes (nfc_device * pnd, const uint8_t * pbtTx, const size_t szTx, struct timeval *timout);
NFC_EXPORT bool nfc_target_receive_bytes (nfc_device * pnd, uint8_t * pbtRx, size_t * pszRx, struct timeval *timout);
NFC_EXPORT bool nfc_target_send_bits (nfc_device * pnd, const uint8_t * pbtTx, const size_t szTxBits, const uint8_t * pbtTxPar);
NFC_EXPORT bool nfc_target_receive_bits (nfc_device * pnd, uint8_t * pbtRx, size_t * pszRxBits, uint8_t * pbtRxPar);
/* Error reporting */
NFC_EXPORT const char *nfc_strerror (const nfc_device * pnd);
@ -99,9 +99,9 @@ extern "C" {
NFC_EXPORT const char *nfc_device_name (nfc_device * pnd);
/* Misc. functions */
NFC_EXPORT void iso14443a_crc (byte_t * pbtData, size_t szLen, byte_t * pbtCrc);
NFC_EXPORT void iso14443a_crc_append (byte_t * pbtData, size_t szLen);
NFC_EXPORT byte_t * iso14443a_locate_historical_bytes (byte_t * pbtAts, size_t szAts, size_t * pszTk);
NFC_EXPORT void iso14443a_crc (uint8_t * pbtData, size_t szLen, uint8_t * pbtCrc);
NFC_EXPORT void iso14443a_crc_append (uint8_t * pbtData, size_t szLen);
NFC_EXPORT uint8_t * iso14443a_locate_historical_bytes (uint8_t * pbtAts, size_t szAts, size_t * pszTk);
NFC_EXPORT const char *nfc_version (void);
/* PN53x specific errors */