libnfc 1.3.9
|
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 00035 /* DRIVER_ACR122_ENABLED */ 00036 00037 # if defined (DRIVER_PN531_USB_ENABLED) || defined (DRIVER_PN533_USB_ENABLED) 00038 # include "drivers/pn53x_usb.h" 00039 # endif 00040 /* DRIVER_PN531_USB_ENABLED || DRIVER_PN533_USB_ENABLED */ 00041 00042 # if defined (DRIVER_PN531_USB_ENABLED) 00043 # include "drivers/pn531_usb.h" 00044 # endif 00045 /* DRIVER_PN531_USB_ENABLED */ 00046 00047 # if defined (DRIVER_PN533_USB_ENABLED) 00048 # include "drivers/pn533_usb.h" 00049 # endif 00050 /* DRIVER_PN533_USB_ENABLED */ 00051 00052 # if defined (DRIVER_ARYGON_ENABLED) 00053 # include "drivers/arygon.h" 00054 # endif 00055 /* DRIVER_ARYGON_ENABLED */ 00056 00057 # if defined (DRIVER_PN532_UART_ENABLED) 00058 # include "drivers/pn532_uart.h" 00059 # endif 00060 /* DRIVER_PN532_UART_ENABLED */ 00061 00062 # define DRIVERS_MAX_DEVICES 16 00063 # define MAX_FRAME_LEN 264 00064 00065 static const struct driver_callbacks drivers_callbacks_list[] = { 00066 // Driver Name Chip callbacks Pick Device List Devices Connect Transceive Disconnect 00067 # if defined (DRIVER_ACR122_ENABLED) 00068 {ACR122_DRIVER_NAME, &pn53x_callbacks_list, acr122_pick_device, acr122_list_devices, acr122_connect, 00069 acr122_transceive, acr122_disconnect}, 00070 # endif 00071 /* DRIVER_ACR122_ENABLED */ 00072 # if defined (DRIVER_PN531_USB_ENABLED) 00073 {PN531_USB_DRIVER_NAME, &pn53x_callbacks_list, pn531_usb_pick_device, pn531_usb_list_devices, pn531_usb_connect, 00074 pn53x_usb_transceive, pn53x_usb_disconnect}, 00075 # endif 00076 /* DRIVER_PN531_USB_ENABLED */ 00077 # if defined (DRIVER_PN533_USB_ENABLED) 00078 {PN533_USB_DRIVER_NAME, &pn53x_callbacks_list, pn533_usb_pick_device, pn533_usb_list_devices, pn533_usb_connect, 00079 pn53x_usb_transceive, pn53x_usb_disconnect}, 00080 # endif 00081 /* DRIVER_PN533_USB_ENABLED */ 00082 # if defined (DRIVER_ARYGON_ENABLED) 00083 {ARYGON_DRIVER_NAME, &pn53x_callbacks_list, arygon_pick_device, arygon_list_devices, arygon_connect, 00084 arygon_transceive, arygon_disconnect}, 00085 # endif 00086 /* DRIVER_ARYGON_ENABLED */ 00087 # if defined (DRIVER_PN532_UART_ENABLED) 00088 {PN532_UART_DRIVER_NAME, &pn53x_callbacks_list, pn532_uart_pick_device, pn532_uart_list_devices, pn532_uart_connect, 00089 pn532_uart_transceive, pn532_uart_disconnect}, 00090 # endif 00091 /* DRIVER_PN532_UART_ENABLED */ 00092 }; 00093 00094 # ifdef DEBUG 00095 /* 00096 * FIXME: Helper macro for dumping drivers messages. 00097 * Here is not the best place for such a macro, however, I 00098 * can't see any convenient place ATM. 00099 */ 00100 # define PRINT_HEX(pcTag, pbtData, szBytes) do { \ 00101 size_t __szPos; \ 00102 printf(" %s: ", pcTag); \ 00103 for (__szPos=0; __szPos < (size_t)(szBytes); __szPos++) { \ 00104 printf("%02x ",pbtData[__szPos]); \ 00105 } \ 00106 printf("\n"); \ 00107 } while (0); 00108 # endif 00109 00110 #endif // __NFC_DRIVERS_H__