L04_DMA - CS1372: HELPING TO PUT THE COMPUTING IN ECE...

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

View Full Document Right Arrow Icon
CS1372: HELPING TO PUT THE COMPUTING IN ECE CS1372: HELPING TO PUT THE COMPUTING IN ECE CS1372 DMA
Background image of page 1

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

View Full DocumentRight Arrow Icon
CS1372: HELPING TO PUT THE COMPUTING IN ECE But First…We Lied Remember when we said pointers have to know what they are pointing at? int *p; short *s; char *cp;
Background image of page 2
CS1372: HELPING TO PUT THE COMPUTING IN ECE CS1372: HELPING TO PUT THE COMPUTING IN ECE Sometimes we need a pointer But we don’t know what it is pointing at!!!
Background image of page 3

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

View Full DocumentRight Arrow Icon
CS1372: HELPING TO PUT THE COMPUTING IN ECE For this… void *vp;
Background image of page 4
CS1372: HELPING TO PUT THE COMPUTING IN ECE For example void genericSwap(void *a, void *b, size_t size) { char c; char *ap = a; char *bp = b; int i; for(i=0; i<size; i++) { c = ap[i]; ap[i] = bp[i]; bp[i] = c; } }
Background image of page 5

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

View Full DocumentRight Arrow Icon
CS1372: HELPING TO PUT THE COMPUTING IN ECE Or void genericSwap(void *a, void *b, size_t size) { char c; char *ap = a; char *bp = b; int i; for(i=0; i<size; i++) { c = *ap; *ap = *bp; *bp = c; ap++; bp++; } }
Background image of page 6
CS1372: HELPING TO PUT THE COMPUTING IN ECE CS1372: HELPING TO PUT THE COMPUTING IN ECE Questions?
Background image of page 7

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

View Full DocumentRight Arrow Icon
CS1372: HELPING TO PUT THE COMPUTING IN ECE Problem: Speed
Background image of page 8
CS1372: HELPING TO PUT THE COMPUTING IN ECE Analysis Where is all the time spent in a computer program?
Background image of page 9

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

View Full DocumentRight Arrow Icon
CS1372: HELPING TO PUT THE COMPUTING IN ECE Loops int main() { REG_DISPCTL = MODE3 | BG2_ENABLE; while(1); { for(i=0; i<38400; i++) { videoBuffer[i] = RED; } } }
Background image of page 10
CS1372: HELPING TO PUT THE COMPUTING IN ECE Two Big Users of Time Copying a block of memory from one place to another Filling in a block of memory with a single value
Background image of page 11

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

View Full DocumentRight Arrow Icon
CS1372: HELPING TO PUT THE COMPUTING IN ECE Analysis u16 image[38400] = {0x2134,…, 0x6352}; u16 *ptr = videoBuffer; for(ptr = videoBuffer; ptr<videoBuffer+38400; ptr++) { *ptr = *image++; }
Background image of page 12
Assembly lea r1, image # Picture data ld r2, vidBufAdr # Video Buffer Loop ldr r0, r1, 0 # Get a short str r0, r2, 0 # Store it add r1, r1, 2 # inc pointer add r2, r2, 2 add r2, r3, -(0x6000000+38400) # check brp Loop # Do it again! halt
Background image of page 13

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

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

This note was uploaded on 02/07/2012 for the course CS 1372 taught by Professor Smith during the Spring '07 term at Georgia Institute of Technology.

Page1 / 42

L04_DMA - CS1372: HELPING TO PUT THE COMPUTING IN ECE...

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

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