GCC Code Coverage Report


Directory: ./
File: libfprint/drivers/aes3500.c
Date: 2024-05-04 14:54:39
Exec Total Coverage
Lines: 21 21 100.0%
Functions: 4 4 100.0%
Branches: 4 5 80.0%

Line Branch Exec Source
1 /*
2 * AuthenTec AES3500 driver for libfprint
3 *
4 * AES3500 is a press-typed sensor, which captures image in 128x128
5 * pixels.
6 *
7 * Thanks Rafael Toledo for the Windows driver and the help.
8 *
9 * This work is derived from Daniel Drake's AES4000 driver.
10 *
11 * Copyright (C) 2011-2013 Juvenn Woo <machese@gmail.com>
12 * Copyright (C) 2007-2008 Daniel Drake <dsd@gentoo.org>
13 *
14 * This library is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License as
16 * published by the Free Software Foundation; either version 2.1 of the
17 * License, or (at your option) any later version.
18 *
19 * This library is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this library; if not, write to the Free Software
26 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
27 * 02110-1301 USA
28 */
29
30 #define FP_COMPONENT "aes3500"
31
32 #include "aes3k.h"
33
34 #define DATA_BUFLEN 0x2089
35
36 /* image size = FRAME_WIDTH x FRAME_WIDTH */
37 #define FRAME_WIDTH 128
38 #define FRAME_SIZE (FRAME_WIDTH * AES3K_FRAME_HEIGHT / 2)
39 #define FRAME_NUMBER (FRAME_WIDTH / AES3K_FRAME_HEIGHT)
40 #define ENLARGE_FACTOR 2
41
42
43 static struct aes_regwrite init_reqs[] = {
44 /* master reset */
45 { 0x80, 0x01 },
46 { 0, 0 },
47 { 0x80, 0x00 },
48 { 0, 0 },
49
50 { 0x81, 0x00 },
51 { 0x80, 0x00 },
52 { 0, 0 },
53
54 /* scan reset */
55 { 0x80, 0x02 },
56 { 0, 0 },
57 { 0x80, 0x00 },
58 { 0, 0 },
59
60 /* disable register buffering */
61 { 0x80, 0x04 },
62 { 0, 0 },
63 { 0x80, 0x00 },
64 { 0, 0 },
65
66 { 0x81, 0x00 },
67 { 0, 0 },
68 /* windows driver reads registers now (81 02) */
69 { 0x80, 0x00 },
70 { 0x81, 0x00 },
71
72 /* set excitation bias current: 2mhz drive ring frequency,
73 * 4V drive ring voltage, 16.5mA excitation bias */
74 { 0x82, 0x04 },
75
76 /* continuously sample drive ring for finger detection,
77 * 62.50ms debounce delay */
78 { 0x83, 0x13 },
79
80 { 0x84, 0x07 }, /* set calibration resistance to 12 kiloohms */
81 { 0x85, 0x3d }, /* set calibration capacitance */
82 { 0x86, 0x03 }, /* detect drive voltage */
83 { 0x87, 0x01 }, /* set detection frequency to 125khz */
84 { 0x88, 0x02 }, /* set column scan period */
85 { 0x89, 0x02 }, /* set measure drive */
86 { 0x8a, 0x33 }, /* set measure frequency and sense amplifier bias */
87 { 0x8b, 0x33 }, /* set matrix pattern */
88 { 0x8c, 0x0f }, /* set demodulation phase 1 */
89 { 0x8d, 0x04 }, /* set demodulation phase 2 */
90 { 0x8e, 0x23 }, /* set sensor gain */
91 { 0x8f, 0x07 }, /* set image parameters */
92 { 0x90, 0x00 }, /* carrier offset null */
93 { 0x91, 0x1c }, /* set A/D reference high */
94 { 0x92, 0x08 }, /* set A/D reference low */
95 { 0x93, 0x00 }, /* set start row to 0 */
96 { 0x94, 0x07 }, /* set end row */
97 { 0x95, 0x00 }, /* set start column to 0 */
98 { 0x96, 0x1f }, /* set end column */
99 { 0x97, 0x04 }, /* data format and thresholds */
100 { 0x98, 0x28 }, /* image data control */
101 { 0x99, 0x00 }, /* disable general purpose outputs */
102 { 0x9a, 0x0b }, /* set initial scan state */
103 { 0x9b, 0x00 }, /* clear challenge word bits */
104 { 0x9c, 0x00 }, /* clear challenge word bits */
105 { 0x9d, 0x09 }, /* set some challenge word bits */
106 { 0x9e, 0x53 }, /* clear challenge word bits */
107 { 0x9f, 0x6b }, /* set some challenge word bits */
108 { 0, 0 },
109 };
110
111 static struct aes_regwrite capture_reqs[] = {
112 { 0x80, 0x00 },
113 { 0x81, 0x00 },
114 { 0, 0 },
115 { 0x81, 0x04 },
116 { 0, 0 },
117 { 0x81, 0x00 },
118 };
119
120 struct _FpiDeviceAes3500
121 {
122 FpiDeviceAes3k parent;
123 };
124 G_DECLARE_FINAL_TYPE (FpiDeviceAes3500, fpi_device_aes3500, FPI,
125 DEVICE_AES3500, FpiDeviceAes3k);
126
4/5
✓ Branch 0 taken 117 times.
✓ Branch 1 taken 24 times.
✓ Branch 2 taken 117 times.
✓ Branch 3 taken 117 times.
✗ Branch 4 not taken.
750 G_DEFINE_TYPE (FpiDeviceAes3500, fpi_device_aes3500, FPI_TYPE_DEVICE_AES3K);
127
128
129 static const FpIdEntry id_table[] = {
130 { .vid = 0x08ff, .pid = 0x5731 },
131 { .vid = 0, .pid = 0, .driver_data = 0 },
132 };
133
134 static void
135 1 fpi_device_aes3500_init (FpiDeviceAes3500 *self)
136 {
137 1 }
138
139 static void
140 117 fpi_device_aes3500_class_init (FpiDeviceAes3500Class *klass)
141 {
142 117 FpDeviceClass *dev_class = FP_DEVICE_CLASS (klass);
143 117 FpImageDeviceClass *img_class = FP_IMAGE_DEVICE_CLASS (klass);
144 117 FpiDeviceAes3kClass *aes_class = FPI_DEVICE_AES3K_CLASS (klass);
145
146 117 dev_class->id = "aes3500";
147 117 dev_class->full_name = "AuthenTec AES3500";
148 117 dev_class->id_table = id_table;
149
150 117 img_class->img_height = FRAME_WIDTH * ENLARGE_FACTOR;
151 117 img_class->img_width = FRAME_WIDTH * ENLARGE_FACTOR;
152
153 117 aes_class->data_buflen = DATA_BUFLEN;
154 117 aes_class->frame_width = FRAME_WIDTH;
155 117 aes_class->frame_size = FRAME_SIZE;
156 117 aes_class->frame_number = FRAME_NUMBER;
157 117 aes_class->enlarge_factor = ENLARGE_FACTOR;
158 117 aes_class->init_reqs = init_reqs;
159 117 aes_class->init_reqs_len = G_N_ELEMENTS (init_reqs);
160 117 aes_class->capture_reqs = capture_reqs;
161 117 aes_class->capture_reqs_len = G_N_ELEMENTS (capture_reqs);
162 }
163