Update luts (remove GPIO 117, which was marked as reserved)
[matches/MCTX3420.git] / server / bbb_pin_defines.c
1 #include "bbb_pin_defines.h"
2
3 /* Luts and stuff. Yay magic numbers **/
4
5 /** 
6  * A lookup table from the actual pin number to GPIO number.
7  * e.g P8_13 is g_pin_real_to_gpio[0*46+13] = g_pin_real_to_gpio[13]
8  * e.g P9_13 is g_pin_real_to_gpio[1*46+13] = g_pin_real_to_gpio[59]
9  *
10  * Where the returned value is 0, there is no GPIO pin
11  * at that location.
12  */
13
14 const unsigned char g_pin_real_to_gpio[BBB_PIN_COUNT+1] = {
15           0,   0,   0,   0,   0,   0,   0,  66,  67,  69,  68,  45,  44,   0,
16          26,  47,  46,  27,  65,   0,   0,   0,   0,   0,   0,   0,  61,  86,
17          88,  87,  89,  10,  11,   9,  81,   8,  80,  78,  79,  76,  77,  74,
18          75,  72,  73,  70,  71,   0,   0,   0,   0,   0,   0,   0,   0,   0,
19           0,  30,  60,  31,   0,  48,   0,   5,   4,   0,   0,   0,   0,  49,
20          15,   0,  14, 115,   0,   0, 112,   0,   0,   0,   0,   0,   0,   0,
21           0,   0,   0,   0,   0,   0,   0,   0,   0
22 };
23
24 /**
25  * Maps a GPIO number to an index into g_gpio (only for use in bbb_pin.c)
26  * If there is no index for that GPIO number, 128 is returned.
27  */
28 const unsigned char g_pin_gpio_to_index[GPIO_MAX_NUMBER+1] = {
29         128, 128, 128, 128,   0,   1, 128, 128,   2,   3,   4,   5, 128, 128,
30           6,   7, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,   8,   9,
31         128, 128,  10,  11, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
32         128, 128,  12,  13,  14,  15,  16,  17, 128, 128, 128, 128, 128, 128,
33         128, 128, 128, 128,  18,  19, 128, 128, 128,  20,  21,  22,  23,  24,
34          25,  26,  27,  28,  29,  30,  31,  32,  33,  34,  35,  36, 128, 128,
35         128, 128,  37,  38,  39,  40, 128, 128, 128, 128, 128, 128, 128, 128,
36         128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
37          41, 128, 128,  42, 128, 128
38 };
39
40 /**
41  * Maps an index in g_gpio to the corresponding GPIO number.
42  */
43 const unsigned char g_gpio_lut[GPIO_NUM_PINS] = {
44           4,   5,   8,   9,  10,  11,  14,  15,  26,  27,  30,  31,  44,  45,
45          46,  47,  48,  49,  60,  61,  65,  66,  67,  68,  69,  70,  71,  72,
46          73,  74,  75,  76,  77,  78,  79,  80,  81,  86,  87,  88,  89, 112,
47         115
48 };
49
50 /**
51  * Converts PWM index to PWM number
52  * e.g index 3 becomes 6 for /sys/class/pwm/pwm6
53  */
54 const unsigned char g_pin_safe_pwm[PWM_NUM_SAFE_PINS] = {
55         0, 2, 4, 6, 7
56 }; //blergh

UCC git Repository :: git.ucc.asn.au