blob: c5cbf7b88ad8060a0de2051f5c08823dee943151 [file] [log] [blame]
Kévin Redon9a12d682018-07-08 13:21:16 +02001/* Card simulator specific functions
Harald Welte390760a2016-02-27 16:23:46 +01002 *
Kévin Redon9a12d682018-07-08 13:21:16 +02003 * (C) 2015-2017 by Harald Welte <hwelte@hmw-consulting.de>
Harald Welte390760a2016-02-27 16:23:46 +01004 *
Kévin Redon9a12d682018-07-08 13:21:16 +02005 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
Harald Welte390760a2016-02-27 16:23:46 +01009 *
Kévin Redon9a12d682018-07-08 13:21:16 +020010 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
Harald Welte390760a2016-02-27 16:23:46 +010014 *
Kévin Redon9a12d682018-07-08 13:21:16 +020015 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
Harald Welte390760a2016-02-27 16:23:46 +010018 */
19
20#include "chip.h"
21#include "board.h"
Harald Welted8a003d2017-02-27 20:31:09 +010022#include "utils.h"
Harald Welte390760a2016-02-27 16:23:46 +010023
24static const Pin pins_cardsim[] = PINS_CARDSIM;
25
26void cardsim_set_simpres(uint8_t slot, int present)
27{
28 if (slot > 1)
29 return;
30
31 if (present)
32 PIO_Set(&pins_cardsim[slot]);
33 else
34 PIO_Clear(&pins_cardsim[slot]);
35}
36
37void cardsim_gpio_init(void)
38{
39 PIO_Configure(&pins_cardsim, ARRAY_SIZE(pins_cardsim));
40}