URL
https://opencores.org/ocsvn/openmsp430/openmsp430/trunk
Subversion Repositories openmsp430
[/] [openmsp430/] [trunk/] [fpga/] [altera_de0_nano_soc/] [software/] [apps/] [gfx_demo/] [demo_2bpp.c] - Rev 221
Go to most recent revision | Compare with Previous | Blame | View Log
#include "demo.h" #include "timerA.h" #include "gfx_controller.h" //---------------------------------------------------// // 8BPP DEMO //---------------------------------------------------// void demo_2bpp(void) { unsigned int line, column; unsigned int color = 0; unsigned int x_coord = 0; unsigned int y_coord = 0; const uint16_t offset_x = 35; const uint16_t offset_y = 95; const uint16_t char_width = 7; // Screen introduction gpu_fill (PIX_ADDR(0, 0 ), 320, 480, 0x0001, DST_SWAP_NONE); // Background gpu_fill (PIX_ADDR(offset_x+1*6*char_width+1*char_width, offset_y+0*char_width), 3*char_width, 1*char_width, 0x0002, DST_SWAP_NONE); // 2 gpu_fill (PIX_ADDR(offset_x+1*6*char_width+0*char_width, offset_y+1*char_width), 1*char_width, 1*char_width, 0x0002, DST_SWAP_NONE); gpu_fill (PIX_ADDR(offset_x+1*6*char_width+4*char_width, offset_y+1*char_width), 1*char_width, 2*char_width, 0x0002, DST_SWAP_NONE); gpu_fill (PIX_ADDR(offset_x+1*6*char_width+3*char_width, offset_y+3*char_width), 1*char_width, 1*char_width, 0x0002, DST_SWAP_NONE); gpu_fill (PIX_ADDR(offset_x+1*6*char_width+2*char_width, offset_y+4*char_width), 1*char_width, 1*char_width, 0x0002, DST_SWAP_NONE); gpu_fill (PIX_ADDR(offset_x+1*6*char_width+1*char_width, offset_y+5*char_width), 1*char_width, 1*char_width, 0x0002, DST_SWAP_NONE); gpu_fill (PIX_ADDR(offset_x+1*6*char_width+0*char_width, offset_y+6*char_width), 5*char_width, 1*char_width, 0x0002, DST_SWAP_NONE); gpu_fill (PIX_ADDR(offset_x+3*6*char_width+0*char_width, offset_y+0*char_width), 1*char_width, 6*char_width, 0x0002, DST_SWAP_NONE); // b gpu_fill (PIX_ADDR(offset_x+3*6*char_width+1*char_width, offset_y+6*char_width), 3*char_width, 1*char_width, 0x0002, DST_SWAP_NONE); gpu_fill (PIX_ADDR(offset_x+3*6*char_width+1*char_width, offset_y+4*char_width), 1*char_width, 1*char_width, 0x0002, DST_SWAP_NONE); gpu_fill (PIX_ADDR(offset_x+3*6*char_width+2*char_width, offset_y+3*char_width), 2*char_width, 1*char_width, 0x0002, DST_SWAP_NONE); gpu_fill (PIX_ADDR(offset_x+3*6*char_width+4*char_width, offset_y+4*char_width), 1*char_width, 2*char_width, 0x0002, DST_SWAP_NONE); gpu_fill (PIX_ADDR(offset_x+4*6*char_width+0*char_width, offset_y+2*char_width), 1*char_width, 5*char_width, 0x0002, DST_SWAP_NONE); // p gpu_fill (PIX_ADDR(offset_x+4*6*char_width+1*char_width, offset_y+2*char_width), 3*char_width, 1*char_width, 0x0002, DST_SWAP_NONE); gpu_fill (PIX_ADDR(offset_x+4*6*char_width+1*char_width, offset_y+4*char_width), 3*char_width, 1*char_width, 0x0002, DST_SWAP_NONE); gpu_fill (PIX_ADDR(offset_x+4*6*char_width+4*char_width, offset_y+3*char_width), 1*char_width, 1*char_width, 0x0002, DST_SWAP_NONE); gpu_fill (PIX_ADDR(offset_x+5*6*char_width+0*char_width, offset_y+2*char_width), 1*char_width, 5*char_width, 0x0002, DST_SWAP_NONE); // p gpu_fill (PIX_ADDR(offset_x+5*6*char_width+1*char_width, offset_y+2*char_width), 3*char_width, 1*char_width, 0x0002, DST_SWAP_NONE); gpu_fill (PIX_ADDR(offset_x+5*6*char_width+1*char_width, offset_y+4*char_width), 3*char_width, 1*char_width, 0x0002, DST_SWAP_NONE); gpu_fill (PIX_ADDR(offset_x+5*6*char_width+4*char_width, offset_y+3*char_width), 1*char_width, 1*char_width, 0x0002, DST_SWAP_NONE); ta_wait_no_lpm(WT_500MS); ta_wait_no_lpm(WT_500MS); ta_wait_no_lpm(WT_500MS); ta_wait_no_lpm(WT_500MS); // Clear background gpu_fill (PIX_ADDR(0, 0 ), 320, 240, 0x0000, DST_SWAP_NONE); // Wait for on-going GPU operation to be done before moving on gpu_wait_done(); // Fill the screen with all possible colors color = 0x0000; x_coord = 0; y_coord = 0; for( line = 0; line <2; line = line + 1 ) { for( column = 0; column < 2; column = column + 1 ) { draw_block(PIX_ADDR(x_coord, y_coord), 158, 118, color, DST_SWAP_NONE, 0); if (color==3) { color= 0;} else { color++; } x_coord += 162; } y_coord += 122; x_coord = 0; } ta_wait_no_lpm(WT_500MS); ta_wait_no_lpm(WT_500MS); // // Initialize LFSR for random color generation // lfsr = 0xACEB; // // // Loop the demo // loop = 0; // while (loop <4) { // // // Select rotation & GPU use // switch(loop & 0x0003) { // case 0 : DISPLAY_CFG = DST_SWAP_CL; wait_sel = 3; // break; // case 1 : DISPLAY_CFG = DST_SWAP_CL; wait_sel = 2; // break; // case 2 : DISPLAY_CFG = DST_SWAP_CL; wait_sel = 1; // break; // default: DISPLAY_CFG = DST_SWAP_CL; wait_sel = 0; // break; // } // loop++; // move_to_next_mode = 0; // // // Move the starting point of the buffer refresh // DISPLAY_REFR_CNT = 0; // while (!move_to_next_mode) { // // // Fill the screen with random colors // x_coord = 0; // y_coord = 0; // for( line = 0; line <4; line = line + 1 ) { // for( column = 0; column < 4; column = column + 1 ) { // // // Compute next color from LFSR // lfsr_lsb = lfsr & 1; /* Get LSB (i.e., the output bit). */ // lfsr >>= 1; /* Shift register */ // lfsr ^= (-lfsr_lsb) & 0xB400u; /* If the output bit is 1, apply toggle mask. // * The value has 1 at bits corresponding // * to taps, 0 elsewhere. */ // color = lfsr & 0x000F; // // // Draw the box // draw_block(PIX_ADDR(x_coord, y_coord), 77, 57, color, DST_SWAP_NONE, use_gpu); // x_coord += 80; // } // y_coord += 60; // x_coord = 0; // } // // // Wait according to config // switch(wait_sel) { // case 0 : while(DISPLAY_REFR_CNT!=0); DISPLAY_REFR_CNT = 2; // break; // case 1 : while(DISPLAY_REFR_CNT!=0); DISPLAY_REFR_CNT = 4; // break; // case 2 : while(DISPLAY_REFR_CNT!=0); DISPLAY_REFR_CNT = 7; // break; // default: while(DISPLAY_REFR_CNT!=0); DISPLAY_REFR_CNT = 10; // break; // } // } // } };
Go to most recent revision | Compare with Previous | Blame | View Log