-
Notifications
You must be signed in to change notification settings - Fork 0
/
pin_config.h
58 lines (52 loc) · 2.12 KB
/
pin_config.h
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
// HINT! See also `print_pin_config_html.c` and `doc/pin_config.html`
#ifndef CONFIG_H
// GP0-GP28 (GPIO number, *not* pin number)
// NOTE: READ_DATA and READ_CLOCK must |
// be consequtive; see _Static_assert |
#define EMIT_PIN_CONFIG \
PIN( DATA, READ_DATA, 0 ) \
PIN( DATA, READ_CLOCK, 1 ) \
PIN( FREQ, INDEX, 2 ) \
PIN( FREQ, SECTOR, 3 ) \
PIN( STATUS, FAULT, 4 ) \
PIN( STATUS, SEEK_ERROR, 5 ) \
PIN( STATUS, ON_CYLINDER, 6 ) \
PIN( STATUS, UNIT_READY, 7 ) \
PIN( DATA, SERVO_CLOCK, 8 ) \
PIN( STATUS, UNIT_SELECTED, 9 ) \
PIN( STATUS, SEEK_END, 10 ) \
PIN( CONTROL, UNIT_SELECT_TAG, 14 ) \
PIN( CONTROL, TAG1, 11 ) \
PIN( CONTROL, TAG2, 12 ) \
PIN( CONTROL, TAG3, 13 ) \
PIN( CONTROL, BIT0, 16 ) \
PIN( CONTROL, BIT1, 17 ) \
PIN( CONTROL, BIT2, 18 ) \
PIN( CONTROL, BIT3, 19 ) \
PIN( CONTROL, BIT4, 20 ) \
PIN( CONTROL, BIT5, 21 ) \
PIN( CONTROL, BIT6, 22 ) \
PIN( CONTROL, BIT7, 26 ) \
PIN( CONTROL, BIT8, 27 ) \
PIN( CONTROL, BIT9, 28 )
// Naming matches figure 3-11 in this document:
// https://bitsavers.org/pdf/cdc/discs/smd/83322200M_CDC_BK4XX_BK5XX_Hardware_Reference_Manual_Jun1980.pdf
enum gpio_type { // <- first PIN() column
DATA = 1, // input/data: 9.67MHz data rate
FREQ, // input/freq: INDEX is 3600RPM/60=60hz, SECTOR is a multiple of that (potentially "non-integer")
STATUS, // input/status: low bitrate
CONTROL, // output: low bitrate
};
enum gpio_map {
#define PIN(TYPE, NAME, GPIO) GPIO_ ## NAME = GPIO,
EMIT_PIN_CONFIG
#undef PIN
};
#ifndef __cplusplus
_Static_assert(
GPIO_READ_CLOCK == (GPIO_READ_DATA+1),
"READ_DATA and READ_CLOCK must have consequtive GPIO pins due to PIO constraints (see PINCTRL discussion in RP2040 datasheet)");
#endif
#define FREQ_FREQ_HZ (5)
#define CONFIG_H
#endif