Day1-12_Hands-on_DMA_get_buffer

Day1-12_Hands-on_DMA_get_buffer - IBM Systems &...

Info iconThis preview shows pages 1–9. 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 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 get data from the PPE to the SPE 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 SPE from a PPE ! Example of mfc_get /opt/cell_class/Hands-on-30/DMA/DMA_get
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 Using libspe 2.x – synchronous thread model
Background image of page 6
© 2007 IBM Corporation Cell Programming Workshop 3/2/2008 7 common.h #ifndef __common_h__ #define __common_h__ /* This union helps clarify calling parameters between the PPE and the SPE. */ typedef union { unsigned long long ull; unsigned int ui[2]; void *p; } addr64; #endif /* __common_h__ */
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 #include ". ./common.h" #include <libspe2.h> #include <pthread.h> #include <stdlib.h> #include <stdio.h> #include <sys/wait.h> #include <string.h> #define NUM_THREADS 8 typedef struct { spe_context_ptr_t spe_context; void *argp; void *envp; } thread_args_t; void *spe_thread( void *voidarg ) { thread_args_t *arg = (thread_args_t *)voidarg; unsigned int runflags = 0; unsigned int entry = SPE_DEFAULT_ENTRY; spe_context_run( arg->spe_context, &entry, runflags, arg->argp, arg->envp, NULL ); pthread_exit( NULL ); } /* String to pass to SPE */ char parameter_data[ NUM_THREADS ][128] __attribute__ ((aligned (128))); /* this is the pointer to the SPE code, to be used at thread creation time */ extern spe_program_handle_t hello_spu; The ppu program
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 16

Day1-12_Hands-on_DMA_get_buffer - IBM Systems &amp;...

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

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