MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sdma_alloc

Function sdma_alloc

freebsd/arm/freescale/imx/imx6_sdma.c:160–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

158}
159
160int
161sdma_alloc(void)
162{
163 struct sdma_channel *channel;
164 struct sdma_softc *sc;
165 int found;
166 int chn;
167 int i;
168
169 sc = sdma_sc;
170 found = 0;
171
172 /* Channel 0 can't be used */
173 for (i = 1; i < SDMA_N_CHANNELS; i++) {
174 channel = &sc->channel[i];
175 if (channel->in_use == 0) {
176 channel->in_use = 1;
177 found = 1;
178 break;
179 }
180 }
181
182 if (!found)
183 return (-1);
184
185 chn = i;
186
187 /* Allocate area for buffer descriptors */
188 channel->bd = (void *)kmem_alloc_contig(PAGE_SIZE, M_ZERO, 0, ~0,
189 PAGE_SIZE, 0, VM_MEMATTR_UNCACHEABLE);
190
191 return (chn);
192}
193
194int
195sdma_free(int chn)

Callers 1

ssi_attachFunction · 0.85

Calls 1

kmem_alloc_contigFunction · 0.50

Tested by

no test coverage detected