Lines Matching defs:ch
100 bcmdmac_channel_type(struct bcmdmac_channel *ch)
102 if (ISSET(ch->ch_debug, DMAC_DEBUG_LITE))
109 bcmdmac_channel_used(struct bcmdmac_channel *ch)
111 return ch->ch_callback != NULL;
140 struct bcmdmac_channel *ch;
179 ch = &sc->sc_channels[index];
180 ch->ch_sc = sc;
181 ch->ch_index = index;
182 ch->ch_callback = NULL;
183 ch->ch_callbackarg = NULL;
184 ch->ch_ih = NULL;
190 ch->ch_debug = bcmdmac_read(sc, DMAC_DEBUG(index));
202 struct bcmdmac_channel *ch = arg;
203 struct bcmdmac_softc *sc = ch->ch_sc;
206 cs = bcmdmac_read(sc, DMAC_CS(ch->ch_index));
207 bcmdmac_write(sc, DMAC_CS(ch->ch_index), cs);
210 ce = bcmdmac_read(sc, DMAC_DEBUG(ch->ch_index));
213 bcmdmac_write(sc, DMAC_DEBUG(ch->ch_index), ce);
215 if (ch->ch_callback)
216 ch->ch_callback(cs, ce, ch->ch_callbackarg);
226 struct bcmdmac_channel *ch = NULL;
241 ch = &sc->sc_channels[index];
242 ch->ch_callback = cb;
243 ch->ch_callbackarg = cbarg;
248 if (ch == NULL)
251 KASSERT(ch->ch_ih == NULL);
253 ch->ch_ih = fdt_intr_establish_idx(sc->sc_fa_node, ch->ch_index, ipl,
254 bcmdmac_intr, ch, sc->sc_dev.dv_xname);
256 if (ch->ch_ih == NULL) {
258 DEVNAME(sc), ch->ch_index);
259 ch->ch_callback = NULL;
260 ch->ch_callbackarg = NULL;
261 ch = NULL;
264 return ch;
268 bcmdmac_free(struct bcmdmac_channel *ch)
270 struct bcmdmac_softc *sc = ch->ch_sc;
273 bcmdmac_halt(ch);
276 val = bcmdmac_read(sc, DMAC_CS(ch->ch_index));
279 bcmdmac_write(sc, DMAC_CS(ch->ch_index), val);
282 fdt_intr_disestablish(ch->ch_ih);
283 ch->ch_ih = NULL;
284 ch->ch_callback = NULL;
285 ch->ch_callbackarg = NULL;
290 bcmdmac_set_conblk_addr(struct bcmdmac_channel *ch, bus_addr_t addr)
292 struct bcmdmac_softc *sc = ch->ch_sc;
294 bcmdmac_write(sc, DMAC_CONBLK_AD(ch->ch_index), addr);
298 bcmdmac_transfer(struct bcmdmac_channel *ch)
300 struct bcmdmac_softc *sc = ch->ch_sc;
303 val = bcmdmac_read(sc, DMAC_CS(ch->ch_index));
308 bcmdmac_write(sc, DMAC_CS(ch->ch_index), val);
314 bcmdmac_halt(struct bcmdmac_channel *ch)
316 struct bcmdmac_softc *sc = ch->ch_sc;
320 val = bcmdmac_read(sc, DMAC_CS(ch->ch_index));
322 bcmdmac_write(sc, DMAC_CS(ch->ch_index), val);
327 bcmdmac_write(sc, DMAC_NEXTCONBK(ch->ch_index), 0);
331 bcmdmac_write(sc, DMAC_CS(ch->ch_index), val);