libnfc
1.4.2
|
00001 /*- 00002 * Public platform independent Near Field Communication (NFC) library 00003 * 00004 * Copyright (C) 2009, Roel Verdult 00005 * 00006 * This program is free software: you can redistribute it and/or modify it 00007 * under the terms of the GNU Lesser General Public License as published by the 00008 * Free Software Foundation, either version 3 of the License, or (at your 00009 * option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, but WITHOUT 00012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 00014 * more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public License 00017 * along with this program. If not, see <http://www.gnu.org/licenses/> 00018 */ 00019 00025 #ifndef __NFC_DRIVERS_H__ 00026 # define __NFC_DRIVERS_H__ 00027 00028 # include <nfc/nfc-types.h> 00029 00030 # include "chips/pn53x.h" 00031 00032 # if defined (DRIVER_ACR122_ENABLED) 00033 # include "drivers/acr122.h" 00034 # endif /* DRIVER_ACR122_ENABLED */ 00035 00036 # if defined (DRIVER_PN531_USB_ENABLED) || defined (DRIVER_PN533_USB_ENABLED) 00037 # include "drivers/pn53x_usb.h" 00038 # endif /* DRIVER_PN531_USB_ENABLED || DRIVER_PN533_USB_ENABLED */ 00039 00040 # if defined (DRIVER_PN531_USB_ENABLED) 00041 # include "drivers/pn531_usb.h" 00042 # endif /* DRIVER_PN531_USB_ENABLED */ 00043 00044 # if defined (DRIVER_PN533_USB_ENABLED) 00045 # include "drivers/pn533_usb.h" 00046 # endif /* DRIVER_PN533_USB_ENABLED */ 00047 00048 # if defined (DRIVER_ARYGON_ENABLED) 00049 # include "drivers/arygon.h" 00050 # endif /* DRIVER_ARYGON_ENABLED */ 00051 00052 # if defined (DRIVER_PN532_UART_ENABLED) 00053 # include "drivers/pn532_uart.h" 00054 # endif /* DRIVER_PN532_UART_ENABLED */ 00055 00056 # define DRIVERS_MAX_DEVICES 16 00057 # define MAX_FRAME_LEN 264 00058 00059 static const struct driver_callbacks drivers_callbacks_list[] = { 00060 // Driver Name Chip callbacks Pick Device List Devices Connect Transceive Disconnect 00061 # if defined (DRIVER_PN531_USB_ENABLED) 00062 {PN531_USB_DRIVER_NAME, &pn53x_callbacks_list, pn531_usb_pick_device, pn531_usb_list_devices, pn531_usb_connect, 00063 NULL, pn53x_usb_transceive, pn53x_usb_disconnect}, 00064 # endif /* DRIVER_PN531_USB_ENABLED */ 00065 # if defined (DRIVER_PN533_USB_ENABLED) 00066 {PN533_USB_DRIVER_NAME, &pn53x_callbacks_list, pn533_usb_pick_device, pn533_usb_list_devices, pn533_usb_connect, 00067 pn533_usb_init, pn53x_usb_transceive, pn53x_usb_disconnect}, 00068 # endif /* DRIVER_PN533_USB_ENABLED */ 00069 # if defined (DRIVER_ACR122_ENABLED) 00070 {ACR122_DRIVER_NAME, &pn53x_callbacks_list, acr122_pick_device, acr122_list_devices, acr122_connect, 00071 NULL, acr122_transceive, acr122_disconnect}, 00072 # endif /* DRIVER_ACR122_ENABLED */ 00073 # if defined (DRIVER_ARYGON_ENABLED) 00074 {ARYGON_DRIVER_NAME, &pn53x_callbacks_list, arygon_pick_device, arygon_list_devices, arygon_connect, 00075 NULL, arygon_transceive, arygon_disconnect}, 00076 # endif /* DRIVER_ARYGON_ENABLED */ 00077 # if defined (DRIVER_PN532_UART_ENABLED) 00078 {PN532_UART_DRIVER_NAME, &pn53x_callbacks_list, pn532_uart_pick_device, pn532_uart_list_devices, pn532_uart_connect, 00079 NULL, pn532_uart_transceive, pn532_uart_disconnect}, 00080 # endif /* DRIVER_PN532_UART_ENABLED */ 00081 }; 00082 00083 # ifdef DEBUG 00084 /* 00085 * TODO Move this helper macro for dumping drivers messages. 00086 * Here is not the best place for such a macro, however, I 00087 * can't see any convenient place ATM. 00088 */ 00089 # define PRINT_HEX(pcTag, pbtData, szBytes) do { \ 00090 size_t __szPos; \ 00091 printf(" %s: ", pcTag); \ 00092 for (__szPos=0; __szPos < (size_t)(szBytes); __szPos++) { \ 00093 printf("%02x ",pbtData[__szPos]); \ 00094 } \ 00095 printf("\n"); \ 00096 } while (0); 00097 # endif 00098 00099 #endif // __NFC_DRIVERS_H__