Day1-13_Hands-on_DMA_get&put_buffer

Day1-13_Hands-on_DMA_get&put_buffer - IBM Systems...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
Cell Programming Workshop 3/2/2008 © 2007 IBM Corporation 1 Hands-on - DMA Transfer Using get and put Buffer Cell Programming Workshop Cell/Quasar Ecosystem & Solutions Enablement
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
© 2007 IBM Corporation Cell Programming Workshop 3/2/2008 2 Class Objectives ! At the end of this class you should know how to use DMA to transfer data between SPE and PPU, back and forth, using a buffer Trademarks - Cell Broadband Engine and Cell Broadband Engine Architecture are trademarks of Sony Computer Entertainment, Inc.
Background image of page 2
© 2007 IBM Corporation Cell Programming Workshop 3/2/2008 3 Class agenda ! DMA transfer into an SPU from a PPU ! Example of mfc_get ! DMA transfer from an SPU into a PPU ! Example of mfc_put
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
© 2007 IBM Corporation Cell Programming Workshop 3/2/2008 4 DMA data into an SPU - mfc_get
Background image of page 4
© 2007 IBM Corporation Cell Programming Workshop 3/2/2008 5 DMA Example: Read into Local Store void dma_mem_to_ls(unsigned int mem_addr, volatile void *ls_addr,unsigned int size) { unsigned int tag = 0; unsigned int mask = 1; mfc_get(ls_addr,mem_addr,size,tag,0,0); mfc_write_tag_mask(mask); mfc_read_tag_status_all(); } Set tag mask Wait for all tag DMA completed Read contents of mem_addr into ls_addr
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
© 2007 IBM Corporation Cell Programming Workshop 3/2/2008 6 DMA data out of the SPU into the PPU – mfc_put
Background image of page 6
© 2007 IBM Corporation Cell Programming Workshop 3/2/2008 7 DMA Example: Write to Main Memory void dma_ls_to_mem(unsigned int mem_addr,volatile void *ls_addr, unsigned int size) { unsigned int tag = 0; unsigned int mask = 1; mfc_put(ls_addr,mem_addr,size,tag,0,0); mfc_write_tag_mask(mask); mfc_read_tag_status_all(); } Write contents of mem_addr into ls_addr Set tag mask Wait for all tag DMA completed
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
© 2007 IBM Corporation Cell Programming Workshop 3/2/2008 8 Using libspe 2.x – synchronous thread model /opt/cell_class/Hands-on-30/DMA_getbuf_libspe2/
Background image of page 8
© 2007 IBM Corporation Cell Programming Workshop 3/2/2008 9 The PPU program #include <stdio.h> //#include <libspe.h> //#include <libmisc.h> #include <string.h> #include <libspe2.h> //spu program extern spe_program_handle_t getbuf_spu; //local buffer unsigned char buffer[128] __attribute__ ((aligned(128))); //spe context spe_context_ptr_t speid; unsigned int flags = 0; unsigned int entry = SPE_DEFAULT_ENTRY; spe_stop_info_t stop_info;
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 16

Day1-13_Hands-on_DMA_get&amp;amp;put_buffer - IBM Systems...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online