Fix build on Windows when using CMake (Tested on Windows XP SP3 with WinSDK 7)
This commit is contained in:
parent
b3b3f47876
commit
f372104163
3 changed files with 54 additions and 32 deletions
|
@ -71,6 +71,7 @@ int main(int argc,char* argv[])
|
|||
bool quiet_output = false;
|
||||
size_t szFound;
|
||||
nfc_device_desc_t *pnddDevices;
|
||||
const char* acLibnfcVersion = nfc_version();
|
||||
|
||||
// Get commandline options
|
||||
for (arg=1;arg<argc;arg++) {
|
||||
|
@ -88,7 +89,6 @@ int main(int argc,char* argv[])
|
|||
}
|
||||
|
||||
// Display libnfc version
|
||||
const char* acLibnfcVersion = nfc_version();
|
||||
printf("%s use libnfc %s\n", argv[0], acLibnfcVersion);
|
||||
|
||||
#ifdef WIN32
|
||||
|
|
|
@ -30,6 +30,15 @@
|
|||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#if defined (_WIN32)
|
||||
#if defined(nfc_EXPORTS)
|
||||
#define NFC_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define NFC_EXPORT __declspec(dllimport)
|
||||
#endif /* nfc_EXPORTS */
|
||||
#else /* defined (_WIN32) */
|
||||
#define NFC_EXPORT
|
||||
#endif
|
||||
|
||||
#include <nfc/nfc-types.h>
|
||||
|
||||
|
@ -38,35 +47,35 @@
|
|||
#endif // __cplusplus
|
||||
|
||||
/* NFC Device/Hardware manipulation */
|
||||
void nfc_list_devices(nfc_device_desc_t pnddDevices[], size_t szDevices, size_t *pszDeviceFound);
|
||||
nfc_device_t* nfc_connect(nfc_device_desc_t* pndd);
|
||||
void nfc_disconnect(nfc_device_t* pnd);
|
||||
bool nfc_configure(nfc_device_t* pnd, const nfc_device_option_t ndo, const bool bEnable);
|
||||
NFC_EXPORT void nfc_list_devices(nfc_device_desc_t pnddDevices[], size_t szDevices, size_t *pszDeviceFound);
|
||||
NFC_EXPORT nfc_device_t* nfc_connect(nfc_device_desc_t* pndd);
|
||||
NFC_EXPORT void nfc_disconnect(nfc_device_t* pnd);
|
||||
NFC_EXPORT bool nfc_configure(nfc_device_t* pnd, const nfc_device_option_t ndo, const bool bEnable);
|
||||
|
||||
/* NFC initiator: act as "reader" */
|
||||
bool nfc_initiator_init(const nfc_device_t* pnd);
|
||||
bool nfc_initiator_select_tag(const nfc_device_t* pnd, const nfc_modulation_t nmInitModulation, const byte_t* pbtInitData, const size_t szInitDataLen, nfc_target_info_t* pti);
|
||||
bool nfc_initiator_select_dep_target(const nfc_device_t* pnd, const nfc_modulation_t nmInitModulation, const byte_t* pbtPidData, const size_t szPidDataLen, const byte_t* pbtNFCID3i, const size_t szNFCID3iDataLen, const byte_t *pbtGbData, const size_t szGbDataLen, nfc_target_info_t* pti);
|
||||
bool nfc_initiator_deselect_tag(const nfc_device_t* pnd);
|
||||
bool nfc_initiator_transceive_bits(const nfc_device_t* pnd, const byte_t* pbtTx, const size_t szTxBits, const byte_t* pbtTxPar, byte_t* pbtRx, size_t* pszRxBits, byte_t* pbtRxPar);
|
||||
bool nfc_initiator_transceive_bytes(const nfc_device_t* pnd, const byte_t* pbtTx, const size_t szTxLen, byte_t* pbtRx, size_t* pszRxLen);
|
||||
bool nfc_initiator_transceive_dep_bytes(const nfc_device_t* pnd, const byte_t* pbtTx, const size_t szTxLen, byte_t* pbtRx, size_t* pszRxLen);
|
||||
bool nfc_initiator_mifare_cmd(const nfc_device_t* pnd, const mifare_cmd mc, const uint8_t ui8Block, mifare_param* pmp);
|
||||
NFC_EXPORT bool nfc_initiator_init(const nfc_device_t* pnd);
|
||||
NFC_EXPORT bool nfc_initiator_select_tag(const nfc_device_t* pnd, const nfc_modulation_t nmInitModulation, const byte_t* pbtInitData, const size_t szInitDataLen, nfc_target_info_t* pti);
|
||||
NFC_EXPORT bool nfc_initiator_select_dep_target(const nfc_device_t* pnd, const nfc_modulation_t nmInitModulation, const byte_t* pbtPidData, const size_t szPidDataLen, const byte_t* pbtNFCID3i, const size_t szNFCID3iDataLen, const byte_t *pbtGbData, const size_t szGbDataLen, nfc_target_info_t* pti);
|
||||
NFC_EXPORT bool nfc_initiator_deselect_tag(const nfc_device_t* pnd);
|
||||
NFC_EXPORT bool nfc_initiator_transceive_bits(const nfc_device_t* 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(const nfc_device_t* pnd, const byte_t* pbtTx, const size_t szTxLen, byte_t* pbtRx, size_t* pszRxLen);
|
||||
NFC_EXPORT bool nfc_initiator_transceive_dep_bytes(const nfc_device_t* pnd, const byte_t* pbtTx, const size_t szTxLen, byte_t* pbtRx, size_t* pszRxLen);
|
||||
NFC_EXPORT bool nfc_initiator_mifare_cmd(const nfc_device_t* pnd, const mifare_cmd mc, const uint8_t ui8Block, mifare_param* pmp);
|
||||
|
||||
/* NFC target: act as tag (i.e. MIFARE Classic) or NFC target device. */
|
||||
bool nfc_target_init(const nfc_device_t* pnd, byte_t* pbtRx, size_t* pszRxBits);
|
||||
bool nfc_target_receive_bits(const nfc_device_t* pnd, byte_t* pbtRx, size_t* pszRxBits, byte_t* pbtRxPar);
|
||||
bool nfc_target_receive_bytes(const nfc_device_t* pnd, byte_t* pbtRx, size_t* pszRxLen);
|
||||
bool nfc_target_receive_dep_bytes(const nfc_device_t* pnd, byte_t* pbtRx, size_t* pszRxLen);
|
||||
bool nfc_target_send_bits(const nfc_device_t* pnd, const byte_t* pbtTx, const size_t szTxBits, const byte_t* pbtTxPar);
|
||||
bool nfc_target_send_bytes(const nfc_device_t* pnd, const byte_t* pbtTx, const size_t szTxLen);
|
||||
bool nfc_target_send_dep_bytes(const nfc_device_t* pnd, const byte_t* pbtTx, const size_t szTxLen);
|
||||
NFC_EXPORT bool nfc_target_init(const nfc_device_t* pnd, byte_t* pbtRx, size_t* pszRxBits);
|
||||
NFC_EXPORT bool nfc_target_receive_bits(const nfc_device_t* pnd, byte_t* pbtRx, size_t* pszRxBits, byte_t* pbtRxPar);
|
||||
NFC_EXPORT bool nfc_target_receive_bytes(const nfc_device_t* pnd, byte_t* pbtRx, size_t* pszRxLen);
|
||||
NFC_EXPORT bool nfc_target_receive_dep_bytes(const nfc_device_t* pnd, byte_t* pbtRx, size_t* pszRxLen);
|
||||
NFC_EXPORT bool nfc_target_send_bits(const nfc_device_t* pnd, const byte_t* pbtTx, const size_t szTxBits, const byte_t* pbtTxPar);
|
||||
NFC_EXPORT bool nfc_target_send_bytes(const nfc_device_t* pnd, const byte_t* pbtTx, const size_t szTxLen);
|
||||
NFC_EXPORT bool nfc_target_send_dep_bytes(const nfc_device_t* pnd, const byte_t* pbtTx, const size_t szTxLen);
|
||||
|
||||
/* Special data accessors */
|
||||
const char* nfc_device_name(nfc_device_t* pnd);
|
||||
NFC_EXPORT const char* nfc_device_name(nfc_device_t* pnd);
|
||||
|
||||
/* Misc. functions */
|
||||
const char* nfc_version(void);
|
||||
NFC_EXPORT const char* nfc_version(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -28,22 +28,35 @@
|
|||
|
||||
#include <nfc/nfc-types.h>
|
||||
|
||||
/*
|
||||
* FIXME: There is no place for this here
|
||||
*/
|
||||
#if defined (_WIN32)
|
||||
#if defined(nfc_EXPORTS)
|
||||
#define NFC_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define NFC_EXPORT __declspec(dllimport)
|
||||
#endif /* nfc_EXPORTS */
|
||||
#else /* defined (_WIN32) */
|
||||
#define NFC_EXPORT
|
||||
#endif
|
||||
|
||||
byte_t oddparity(const byte_t bt);
|
||||
void oddparity_byte_ts(const byte_t* pbtData, const size_t szLen, byte_t* pbtPar);
|
||||
|
||||
byte_t mirror(byte_t bt);
|
||||
uint32_t mirror32(uint32_t ui32Bits);
|
||||
uint64_t mirror64(uint64_t ui64Bits);
|
||||
void mirror_byte_ts(byte_t *pbts, size_t szLen);
|
||||
NFC_EXPORT byte_t mirror(byte_t bt);
|
||||
NFC_EXPORT uint32_t mirror32(uint32_t ui32Bits);
|
||||
NFC_EXPORT uint64_t mirror64(uint64_t ui64Bits);
|
||||
NFC_EXPORT void mirror_byte_ts(byte_t *pbts, size_t szLen);
|
||||
|
||||
uint32_t swap_endian32(const void* pui32);
|
||||
uint64_t swap_endian64(const void* pui64);
|
||||
NFC_EXPORT uint32_t swap_endian32(const void* pui32);
|
||||
NFC_EXPORT uint64_t swap_endian64(const void* pui64);
|
||||
|
||||
void append_iso14443a_crc(byte_t* pbtData, size_t szLen);
|
||||
NFC_EXPORT void append_iso14443a_crc(byte_t* pbtData, size_t szLen);
|
||||
|
||||
void print_hex(const byte_t* pbtData, const size_t szLen);
|
||||
void print_hex_bits(const byte_t* pbtData, const size_t szBits);
|
||||
void print_hex_par(const byte_t* pbtData, const size_t szBits, const byte_t* pbtDataPar);
|
||||
NFC_EXPORT void print_hex(const byte_t* pbtData, const size_t szLen);
|
||||
NFC_EXPORT void print_hex_bits(const byte_t* pbtData, const size_t szBits);
|
||||
NFC_EXPORT void print_hex_par(const byte_t* pbtData, const size_t szBits, const byte_t* pbtDataPar);
|
||||
|
||||
#endif // _LIBNFC_BITUTILS_H_
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue