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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
//! The real-to-complex FFT from NE10, the ARM DSP library the board
//! ships as `libNE10.so.10`.
//!
//! Unlike the rest of this crate, these declarations are neither
//! generated nor a shim of ours: NE10 is plain C, and this module
//! mirrors four of its functions and one of its structs by hand. The
//! headers they are written against are vendored in `vendor/ne10/` as
//! a drift baseline — nothing generates from them — and
//! `abi/ne10_abi.c` asserts at build time that the board's headers
//! still agree with what is written here.
//!
//! Bela has an `Fft` class of its own in `libbelaextra` wrapping these
//! same calls. `docs/fft.md` in the repository records why this crate
//! calls NE10 instead, along with what the transforms do to their
//! arguments.
//!
//! The transforms come in two spellings. `ne10_fft_r2c_1d_float32` is
//! a function pointer that stays null until `ne10_init` runs; the
//! `_neon` symbols declared here are the implementations behind it,
//! called directly, which is what Bela's own class does. The target is
//! `ARMv8` with NEON, so there is nothing to dispatch.
//!
//! Off the device target the library is not linked and these symbols
//! do not resolve. Declaring them anyway keeps the module compiling
//! everywhere the rest of the crate does.
use c_int;
use ;
/// One complex value, as NE10 lays it out: real part, then imaginary.
///
/// `#[repr(C)]` because slices of these are handed to the transforms
/// as they stand. `abi/ne10_abi.c` pins the size, the alignment, the
/// offsets and both field types against the board's header.
/// A real-to-complex plan, as an opaque pointee.
///
/// Deliberately not a description of NE10's struct: its layout is
/// conditional on `NE10_UNROLL_LEVEL`, a define this crate does not
/// see and must not depend on. What matters about it is that one plan
/// holds the twiddles *and* the scratch buffer a transform writes
/// through, so a plan has one user at a time.
///
/// The marker is what the nomicon asks of an opaque type: a bare
/// zero-length array would make this `Send`, `Sync` and `Unpin`.
unsafe extern "C"
// What `abi/ne10_abi.c` asserts on the C side, asserted here on ours:
// the two together are "the header and this module agree". These catch
// a mistake in the declarations above, which a build against a correct
// header would otherwise compile happily.
const _: = ;