3 Copyright (C) Dean Camera, 2018.
5 dean [at] fourwalledcubicle [dot] com
10 Copyright 2018 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11 Copyright 2018 Filipe Rodrigues (filipepazrodrigues [at] gmail [dot] com)
13 Permission to use, copy, modify, distribute, and sell this
14 software and its documentation for any purpose is hereby granted
15 without fee, provided that the above copyright notice appear in
16 all copies and that both that the copyright notice and this
17 permission notice and warranty disclaimer appear in supporting
18 documentation, and that the name of the author not be used in
19 advertising or publicity pertaining to distribution of the
20 software without specific, written prior permission.
22 The author disclaims all warranties with regard to this
23 software, including all implied warranties of merchantability
24 and fitness. In no event shall the author be liable for any
25 special, indirect or consequential damages or any damages
26 whatsoever resulting from loss of use, data or profits, whether
27 in an action of contract, negligence or other tortious action,
28 arising out of or in connection with the use or performance of
33 * \brief Device mode driver for the library USB CCID Class driver.
35 * Device mode driver for the library USB CCID Class driver.
37 * \note This file should not be included directly. It is automatically included as needed by the USB module driver
38 * dispatch header located in LUFA/Drivers/USB.h.
41 /** \ingroup Group_USBClassCCID
42 * \defgroup Group_USBClassCCIDDevice CCID Class Device Mode Driver
44 * \section Sec_USBClassCCIDDevice_Dependencies Module Source Dependencies
45 * The following files must be built with any user project that uses this module:
46 * - LUFA/Drivers/USB/Class/Device/CCIDClassDevice.c <i>(Makefile source module name: LUFA_SRC_USBCLASS)</i>
48 * \section Sec_USBClassCCIDDevice_ModDescription Module Description
49 * Device Mode USB Class driver framework interface, for the CCID USB Class driver.
54 #ifndef _CCID_CLASS_DEVICE_H_
55 #define _CCID_CLASS_DEVICE_H_
58 #include "../../USB.h"
59 #include "../Common/CCIDClassCommon.h"
61 /* Public Interface - May be used in end-application: */
63 /** \brief CCID Class Device Mode Configuration and State Structure.
65 * Class state structure. An instance of this structure should be made for each CCID interface
66 * within the user application, and passed to each of the CCID class driver functions as the
67 * CCIDInterfaceInfo parameter. This stores each CCID interface's configuration and state information.
73 uint8_t InterfaceNumber
; /**< Interface number of the CCID interface within the device. */
74 uint8_t TotalSlots
; /**< Total of slots no this device. */
75 USB_Endpoint_Table_t DataINEndpoint
; /**< Data IN endpoint configuration table. */
76 USB_Endpoint_Table_t DataOUTEndpoint
; /**< Data OUT endpoint configuration table. */
77 } Config
; /**< Config data for the USB class interface within the device. All elements in this section
78 * <b>must</b> be set or the interface will fail to enumerate and operate correctly.
82 bool Aborted
; //< Set if host has started an abort process
83 uint8_t AbortedSeq
; //< Sequence number for the current abort process
84 } State
; /**< State data for the USB class interface within the device. All elements in this section
85 * are reset to their defaults when the interface is enumerated.
87 } USB_ClassInfo_CCID_Device_t
;
89 /* Function Prototypes: */
90 /** Configures the endpoints of a given CCID interface, ready for use. This should be linked to the library
91 * \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration containing
92 * the given CCID interface is selected.
94 * \param[in,out] CCIDInterfaceInfo Pointer to a structure containing a CCID Class configuration.
96 * \return Boolean \c true if the endpoints were successfully configured, \c false otherwise.
98 bool CCID_Device_ConfigureEndpoints(USB_ClassInfo_CCID_Device_t
* const CCIDInterfaceInfo
) ATTR_NON_NULL_PTR_ARG(1);
100 /** Processes incoming control requests from the host, that are directed to the given CCID class interface. This should be
101 * linked to the library \ref EVENT_USB_Device_ControlRequest() event.
103 * \param[in,out] CCIDInterfaceInfo Pointer to a structure containing a CCID Class configuration and state.
105 void CCID_Device_ProcessControlRequest(USB_ClassInfo_CCID_Device_t
* const CCIDInterfaceInfo
) ATTR_NON_NULL_PTR_ARG(1);
107 /** General management task for a given CCID class interface, required for the correct operation of the interface. This should
108 * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask().
110 * \param[in,out] CCIDInterfaceInfo Pointer to a structure containing a CCID Class configuration and state.
112 void CCID_Device_USBTask(USB_ClassInfo_CCID_Device_t
* const CCIDInterfaceInfo
) ATTR_NON_NULL_PTR_ARG(1);
114 uint8_t CALLBACK_CCID_IccPowerOn(uint8_t slot
, uint8_t* atr
, uint8_t* atrSize
, uint8_t* error
);
116 uint8_t CALLBACK_CCID_IccPowerOff(uint8_t slot
, uint8_t* error
);
118 uint8_t CALLBACK_CCID_GetSlotStatus(uint8_t slot
, uint8_t* error
);
120 uint8_t CALLBACK_CCID_XfrBlock(uint8_t slot
, uint8_t* error
, uint8_t* receivedBuffer
, uint8_t receivedBufferSize
, uint8_t* sendBuffer
, uint8_t* sentBufferSize
);
122 uint8_t CALLBACK_CCID_Abort(uint8_t slot
, uint8_t seq
, uint8_t* error
);