Mercurial > cgi-bin > hgwebdir.cgi > PR > Applications > VSs > VSs__H264__App
diff libavcodec/cell/h264_dma.c @ 2:897f711a7157
rearrange to work with autoconf
| author | Nina Engelhardt <nengel@mailbox.tu-berlin.de> |
|---|---|
| date | Tue, 25 Sep 2012 15:55:33 +0200 |
| parents | |
| children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/libavcodec/cell/h264_dma.c Tue Sep 25 15:55:33 2012 +0200 1.3 @@ -0,0 +1,74 @@ 1.4 +#include <spu_mfcio.h> 1.5 +#include "h264_dma.h" 1.6 + 1.7 +DECLARE_ALIGNED_16(dma_list_elem_t, put_list_buf[2*(52+26+26)]); 1.8 +dma_list_elem_t* put_list; 1.9 + 1.10 +DECLARE_ALIGNED_16(dma_list_elem_t, get_list_buf[16*(4+5 + 2*3)]); 1.11 +dma_list_elem_t* get_list; 1.12 + 1.13 +inline void spu_dma_get(void *ls, unsigned ea, int size, int tag){ 1.14 + mfc_get(ls, ea, size, tag, 0, 0); 1.15 +} 1.16 + 1.17 +inline void spu_dma_put(void *ls, unsigned ea, int size, int tag){ 1.18 + mfc_put(ls, ea, size, tag, 0, 0); 1.19 +} 1.20 + 1.21 +inline void spu_dma_barrier_put(void *ls, unsigned ea, int size, int tag){ 1.22 + mfc_putb(ls, ea, size, tag, 0, 0); 1.23 +} 1.24 + 1.25 +// Function that wait to finish a DMA transfer with especific id 1.26 +inline void wait_dma_id(int id){ 1.27 + spu_writech(MFC_WrTagMask, 1<< id); 1.28 + (void)spu_mfcstat(MFC_TAG_UPDATE_ALL); 1.29 +} 1.30 + 1.31 +// Functions to get/put a block from/to main memory 1.32 +void get_dma_list(void *dst, void* ea, unsigned int w, unsigned int h, unsigned int stride, unsigned int tag, int barrier) 1.33 +{ 1.34 + unsigned int i = 0; 1.35 + unsigned int listsize; 1.36 + unsigned int ea_low; 1.37 + 1.38 + dma_list_elem_t* list = get_list; 1.39 + get_list+=h; 1.40 + 1.41 + ea_low=(uint32_t) mfc_ea2l(ea); 1.42 + 1.43 + /* Create the list, size of each list id the "width" parameter defined by the user */ 1.44 + for ( i=0; i<h; i++ ){ 1.45 + list[i].size.all32 = w; 1.46 + list[i].ea_low = ea_low; 1.47 + ea_low += stride; 1.48 + } 1.49 + /* Specify the list size and initiate the list transfer */ 1.50 + listsize = h*sizeof(dma_list_elem_t); 1.51 + if (barrier) 1.52 + mfc_getlb(dst, (unsigned)ea, list, listsize, tag, 0, 0); 1.53 + else 1.54 + mfc_getl(dst, (unsigned)ea, list, listsize, tag, 0, 0); 1.55 +} 1.56 + 1.57 + 1.58 +void put_dma_list(void *src, void* ea, unsigned int size, unsigned int h, unsigned int stride, unsigned int tag){ 1.59 + unsigned int i = 0; 1.60 + unsigned int listsize; 1.61 + unsigned int ea_low; 1.62 + 1.63 + dma_list_elem_t* list = put_list; 1.64 + put_list+=h; 1.65 + 1.66 + ea_low=(uint32_t) mfc_ea2l(ea); 1.67 + 1.68 + /* Create the list, size of each list id the "width" parameter defined by the user */ 1.69 + for ( i=0; i<h; i++ ) { 1.70 + list[i].size.all32 = size; 1.71 + list[i].ea_low = ea_low; 1.72 + ea_low += stride; 1.73 + } 1.74 + /* Specify the list size and initiate the list transfer */ 1.75 + listsize = h*sizeof(dma_list_elem_t); 1.76 + mfc_putl(src, (unsigned) ea, list, listsize, tag, 0, 0); 1.77 +}
