summaryrefslogtreecommitdiff
path: root/bsp/x1000/drivers/drv_pin.c
blob: e132f8f52890685687ca950125f9639450086f01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
 * File      : drv_pin.c
 * This file is part of RT-Thread RTOS
 * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License along
 *  with this program; if not, write to the Free Software Foundation, Inc.,
 *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Change Logs:
 * Date           Author       Notes
 * 2017-01-01     Urey      first version
 */

#include <rthw.h>
#include <rtdevice.h>
#include <board.h>
#include "drv_gpio.h"

#define CORE_BOARD_PIN_NUMBERS  94      //Halley2

#define __X1000_PIN(index, port, pin) { 0, GPIO_PORT_##port, GPIO_Pin_##pin}
#define __X1000_PIN_DEFAULT {-1, 0, 0}


struct pin_index
{
    int         index;
    uint32_t    port;
    uint32_t    pin;
};


static const struct pin_index pins[] =
{
    __X1000_PIN_DEFAULT,            //0 NULL
    __X1000_PIN_DEFAULT,            //1 RST
    __X1000_PIN(2,B,26),
    __X1000_PIN(3,B,25),

    __X1000_PIN_DEFAULT,
    __X1000_PIN_DEFAULT,
    __X1000_PIN_DEFAULT,
    __X1000_PIN_DEFAULT,
    __X1000_PIN_DEFAULT,
    __X1000_PIN_DEFAULT,
    __X1000_PIN_DEFAULT,
    __X1000_PIN_DEFAULT,
    __X1000_PIN_DEFAULT,
    __X1000_PIN_DEFAULT,
    __X1000_PIN_DEFAULT,
    __X1000_PIN_DEFAULT,
    __X1000_PIN_DEFAULT,

    __X1000_PIN(17,B,7),
    __X1000_PIN(18,B,6),
    __X1000_PIN(19,B,10),

    __X1000_PIN(20,B,9),
    __X1000_PIN(21,B,8),
    __X1000_PIN(22,B,13),
    __X1000_PIN(23,B,11),
    __X1000_PIN(24,B,12),
    __X1000_PIN(25,B,15),
    __X1000_PIN(26,B,14),
    __X1000_PIN(27,B,16),
    __X1000_PIN(28,A,1),
    __X1000_PIN(29,A,0),
    __X1000_PIN(30,B,18),
    __X1000_PIN(31,A,3),
    __X1000_PIN(32,A,2),
    __X1000_PIN_DEFAULT,
    __X1000_PIN_DEFAULT,
    __X1000_PIN_DEFAULT,
    __X1000_PIN_DEFAULT,
    __X1000_PIN(37,A,4),
    __X1000_PIN(38,A,6),
    __X1000_PIN(39,B,17),
    __X1000_PIN(40,B,20),
    __X1000_PIN(41,A,5),
    __X1000_PIN(42,A,7),
    __X1000_PIN(43,A,8),
    __X1000_PIN(44,A,9),
    __X1000_PIN(45,A,11),
    __X1000_PIN(46,B,19),
    __X1000_PIN(47,A,10),
};