view libavcodec/cell/h264_dma.c @ 9:ea1ba68cf0ed

update to match api changes + add sscc produced source
author Nina Engelhardt <nengel@mailbox.tu-berlin.de>
date Wed, 05 Jun 2013 14:43:26 +0200
parents
children
line source
1 #include <spu_mfcio.h>
2 #include "h264_dma.h"
4 DECLARE_ALIGNED_16(dma_list_elem_t, put_list_buf[2*(52+26+26)]);
5 dma_list_elem_t* put_list;
7 DECLARE_ALIGNED_16(dma_list_elem_t, get_list_buf[16*(4+5 + 2*3)]);
8 dma_list_elem_t* get_list;
10 inline void spu_dma_get(void *ls, unsigned ea, int size, int tag){
11 mfc_get(ls, ea, size, tag, 0, 0);
12 }
14 inline void spu_dma_put(void *ls, unsigned ea, int size, int tag){
15 mfc_put(ls, ea, size, tag, 0, 0);
16 }
18 inline void spu_dma_barrier_put(void *ls, unsigned ea, int size, int tag){
19 mfc_putb(ls, ea, size, tag, 0, 0);
20 }
22 // Function that wait to finish a DMA transfer with especific id
23 inline void wait_dma_id(int id){
24 spu_writech(MFC_WrTagMask, 1<< id);
25 (void)spu_mfcstat(MFC_TAG_UPDATE_ALL);
26 }
28 // Functions to get/put a block from/to main memory
29 void get_dma_list(void *dst, void* ea, unsigned int w, unsigned int h, unsigned int stride, unsigned int tag, int barrier)
30 {
31 unsigned int i = 0;
32 unsigned int listsize;
33 unsigned int ea_low;
35 dma_list_elem_t* list = get_list;
36 get_list+=h;
38 ea_low=(uint32_t) mfc_ea2l(ea);
40 /* Create the list, size of each list id the "width" parameter defined by the user */
41 for ( i=0; i<h; i++ ){
42 list[i].size.all32 = w;
43 list[i].ea_low = ea_low;
44 ea_low += stride;
45 }
46 /* Specify the list size and initiate the list transfer */
47 listsize = h*sizeof(dma_list_elem_t);
48 if (barrier)
49 mfc_getlb(dst, (unsigned)ea, list, listsize, tag, 0, 0);
50 else
51 mfc_getl(dst, (unsigned)ea, list, listsize, tag, 0, 0);
52 }
55 void put_dma_list(void *src, void* ea, unsigned int size, unsigned int h, unsigned int stride, unsigned int tag){
56 unsigned int i = 0;
57 unsigned int listsize;
58 unsigned int ea_low;
60 dma_list_elem_t* list = put_list;
61 put_list+=h;
63 ea_low=(uint32_t) mfc_ea2l(ea);
65 /* Create the list, size of each list id the "width" parameter defined by the user */
66 for ( i=0; i<h; i++ ) {
67 list[i].size.all32 = size;
68 list[i].ea_low = ea_low;
69 ea_low += stride;
70 }
71 /* Specify the list size and initiate the list transfer */
72 listsize = h*sizeof(dma_list_elem_t);
73 mfc_putl(src, (unsigned) ea, list, listsize, tag, 0, 0);
74 }