CCID: Add support for PC-to-Reader XfrBlock message
[pub/lufa.git] / Demos / Device / ClassDriver / CCID / CCID.h
1 /*
2 LUFA Library
3 Copyright (C) Dean Camera, 2018.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7 */
8
9 /*
10 Copyright 2018 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11 Copyright 2018 Filipe Rodrigues (filipepazrodrigues [at] gmail [dot] com)
12
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.
21
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
29 this software.
30 */
31
32 /** \file
33 *
34 * Header file for CCID.c.
35 */
36
37 #ifndef _CCID_H_
38 #define _CCID_H_
39
40 /* Includes: */
41 #include <avr/io.h>
42 #include <avr/wdt.h>
43 #include <avr/power.h>
44 #include <avr/interrupt.h>
45
46 #include "Descriptors.h"
47
48 #include "Lib/Iso7816.h"
49
50 #include <LUFA/Drivers/USB/USB.h>
51 #include <LUFA/Drivers/Board/LEDs.h>
52 #include <LUFA/Platform/Platform.h>
53
54 /* Macros: */
55 /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
56 #define LEDMASK_USB_NOTREADY LEDS_LED1
57
58 /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */
59 #define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3)
60
61 /** LED mask for the library LED driver, to indicate that the USB interface is ready. */
62 #define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4)
63
64 /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
65 #define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
66
67 /** LED mask for the library LED driver, to indicate that the USB interface is busy. */
68 #define LEDMASK_USB_BUSY LEDS_LED2
69
70 /* Function Prototypes: */
71 void SetupHardware(void);
72
73 void EVENT_USB_Device_Connect(void);
74 void EVENT_USB_Device_Disconnect(void);
75 void EVENT_USB_Device_ConfigurationChanged(void);
76 void EVENT_USB_Device_ControlRequest(void);
77
78 uint8_t CALLBACK_CCID_IccPowerOn(USB_ClassInfo_CCID_Device_t* const CCIDInterfaceInfo,
79 uint8_t slot,
80 uint8_t* const atr,
81 uint8_t* const atrSize,
82 uint8_t* const error);
83 uint8_t CALLBACK_CCID_IccPowerOff(USB_ClassInfo_CCID_Device_t* const CCIDInterfaceInfo,
84 uint8_t slot,
85 uint8_t* const error);
86 uint8_t CALLBACK_CCID_GetSlotStatus(USB_ClassInfo_CCID_Device_t* const CCIDInterfaceInfo,
87 uint8_t slot,
88 uint8_t* const error);
89 uint8_t CALLBACK_CCID_XfrBlock(USB_ClassInfo_CCID_Device_t* const CCIDInterfaceInfo,
90 uint8_t slot,
91 uint8_t* const receivedBuffer,
92 uint8_t receivedBufferSize,
93 uint8_t* const sendBuffer,
94 uint8_t* const sentBufferSize,
95 uint8_t* const error);
96 uint8_t CALLBACK_CCID_Abort(USB_ClassInfo_CCID_Device_t* const CCIDInterfaceInfo,
97 uint8_t slot,
98 uint8_t seq,
99 uint8_t* const error);
100
101 #endif
102