Lines Matching refs:adap
24 int pt3_stop_dma(struct pt3_adapter *adap) in pt3_stop_dma() argument
26 struct pt3_board *pt3 = adap->dvb_adap.priv; in pt3_stop_dma()
31 base = get_dma_base(adap->adap_idx); in pt3_stop_dma()
46 int pt3_start_dma(struct pt3_adapter *adap) in pt3_start_dma() argument
48 struct pt3_board *pt3 = adap->dvb_adap.priv; in pt3_start_dma()
49 u32 base = get_dma_base(adap->adap_idx); in pt3_start_dma()
52 iowrite32(lower_32_bits(adap->desc_buf[0].b_addr), in pt3_start_dma()
54 iowrite32(upper_32_bits(adap->desc_buf[0].b_addr), in pt3_start_dma()
61 static u8 *next_unit(struct pt3_adapter *adap, int *idx, int *ofs) in next_unit() argument
67 if (*idx == adap->num_bufs) in next_unit()
70 return &adap->buffer[*idx].data[*ofs]; in next_unit()
73 int pt3_proc_dma(struct pt3_adapter *adap) in pt3_proc_dma() argument
77 idx = adap->buf_idx; in pt3_proc_dma()
78 ofs = adap->buf_ofs; in pt3_proc_dma()
80 if (adap->buffer[idx].data[ofs] == PT3_BUF_CANARY) in pt3_proc_dma()
83 while (*next_unit(adap, &idx, &ofs) != PT3_BUF_CANARY) { in pt3_proc_dma()
86 p = &adap->buffer[adap->buf_idx].data[adap->buf_ofs]; in pt3_proc_dma()
87 if (adap->num_discard > 0) in pt3_proc_dma()
88 adap->num_discard--; in pt3_proc_dma()
89 else if (adap->buf_ofs + PT3_ACCESS_UNIT > DATA_BUF_SZ) { in pt3_proc_dma()
90 dvb_dmx_swfilter_packets(&adap->demux, p, in pt3_proc_dma()
91 (DATA_BUF_SZ - adap->buf_ofs) / TS_PACKET_SZ); in pt3_proc_dma()
92 dvb_dmx_swfilter_packets(&adap->demux, in pt3_proc_dma()
93 adap->buffer[idx].data, ofs / TS_PACKET_SZ); in pt3_proc_dma()
95 dvb_dmx_swfilter_packets(&adap->demux, p, in pt3_proc_dma()
99 adap->buf_idx = idx; in pt3_proc_dma()
100 adap->buf_ofs = ofs; in pt3_proc_dma()
105 void pt3_init_dmabuf(struct pt3_adapter *adap) in pt3_init_dmabuf() argument
112 p = adap->buffer[0].data; in pt3_init_dmabuf()
114 while (idx < adap->num_bufs) { in pt3_init_dmabuf()
120 p = adap->buffer[idx].data; in pt3_init_dmabuf()
123 adap->buf_idx = 0; in pt3_init_dmabuf()
124 adap->buf_ofs = 0; in pt3_init_dmabuf()
127 void pt3_free_dmabuf(struct pt3_adapter *adap) in pt3_free_dmabuf() argument
132 pt3 = adap->dvb_adap.priv; in pt3_free_dmabuf()
133 for (i = 0; i < adap->num_bufs; i++) in pt3_free_dmabuf()
135 adap->buffer[i].data, adap->buffer[i].b_addr); in pt3_free_dmabuf()
136 adap->num_bufs = 0; in pt3_free_dmabuf()
138 for (i = 0; i < adap->num_desc_bufs; i++) in pt3_free_dmabuf()
140 adap->desc_buf[i].descs, adap->desc_buf[i].b_addr); in pt3_free_dmabuf()
141 adap->num_desc_bufs = 0; in pt3_free_dmabuf()
145 int pt3_alloc_dmabuf(struct pt3_adapter *adap) in pt3_alloc_dmabuf() argument
155 pt3 = adap->dvb_adap.priv; in pt3_alloc_dmabuf()
156 adap->num_bufs = 0; in pt3_alloc_dmabuf()
157 adap->num_desc_bufs = 0; in pt3_alloc_dmabuf()
160 &adap->buffer[i].b_addr, GFP_KERNEL); in pt3_alloc_dmabuf()
163 adap->buffer[i].data = p; in pt3_alloc_dmabuf()
164 adap->num_bufs++; in pt3_alloc_dmabuf()
166 pt3_init_dmabuf(adap); in pt3_alloc_dmabuf()
172 DIV_ROUND_UP(adap->num_bufs * DATA_BUF_XFERS, DESCS_IN_PAGE); in pt3_alloc_dmabuf()
178 adap->num_desc_bufs++; in pt3_alloc_dmabuf()
179 adap->desc_buf[i].descs = p; in pt3_alloc_dmabuf()
180 adap->desc_buf[i].b_addr = desc_addr; in pt3_alloc_dmabuf()
183 d = &adap->desc_buf[i - 1].descs[DESCS_IN_PAGE - 1]; in pt3_alloc_dmabuf()
188 data_addr = adap->buffer[idx].b_addr + ofs; in pt3_alloc_dmabuf()
189 d = &adap->desc_buf[i].descs[j]; in pt3_alloc_dmabuf()
202 if (idx >= adap->num_bufs) { in pt3_alloc_dmabuf()
203 desc_addr = adap->desc_buf[0].b_addr; in pt3_alloc_dmabuf()
214 pt3_free_dmabuf(adap); in pt3_alloc_dmabuf()