OpenCores
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] - Diff between revs 221 and 222

Show entire file | Details | Blame | View Log

Rev 221 Rev 222
Line 9... Line 9...
 
 
  unsigned int  line, column;
  unsigned int  line, column;
  unsigned int  color        = 0;
  unsigned int  color        = 0;
  unsigned int  x_coord      = 0;
  unsigned int  x_coord      = 0;
  unsigned int  y_coord      = 0;
  unsigned int  y_coord      = 0;
 
  unsigned int  palette      = 0;
 
  unsigned int  bg_color     = 0;
 
 
  const uint16_t offset_x    = 35;
  const uint16_t offset_x    = 35;
  const uint16_t offset_y    = 95;
  const uint16_t offset_y    = 95;
  const uint16_t char_width  =  7;
  const uint16_t char_width  =  7;
 
 
  // Screen introduction
  // Screen introduction
  gpu_fill (PIX_ADDR(0,                                    0                    ), 320,          480,          0x0001, DST_SWAP_NONE); // Background
  gpu_fill (PIX_ADDR(0,                                    0                    ), 320,          480,          0x0000, 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+1*char_width, offset_y+0*char_width), 3*char_width, 1*char_width, 0x0003, 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+0*char_width, offset_y+1*char_width), 1*char_width, 1*char_width, 0x0003, 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+4*char_width, offset_y+1*char_width), 1*char_width, 2*char_width, 0x0003, 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+3*char_width, offset_y+3*char_width), 1*char_width, 1*char_width, 0x0003, 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+2*char_width, offset_y+4*char_width), 1*char_width, 1*char_width, 0x0003, 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+1*char_width, offset_y+5*char_width), 1*char_width, 1*char_width, 0x0003, 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+1*6*char_width+0*char_width, offset_y+6*char_width), 5*char_width, 1*char_width, 0x0003, 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+0*char_width, offset_y+0*char_width), 1*char_width, 6*char_width, 0x0003, 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+6*char_width), 3*char_width, 1*char_width, 0x0003, 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+1*char_width, offset_y+4*char_width), 1*char_width, 1*char_width, 0x0003, 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+2*char_width, offset_y+3*char_width), 2*char_width, 1*char_width, 0x0003, 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+3*6*char_width+4*char_width, offset_y+4*char_width), 1*char_width, 2*char_width, 0x0003, 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+0*char_width, offset_y+2*char_width), 1*char_width, 5*char_width, 0x0003, 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+2*char_width), 3*char_width, 1*char_width, 0x0003, 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+1*char_width, offset_y+4*char_width), 3*char_width, 1*char_width, 0x0003, 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+4*6*char_width+4*char_width, offset_y+3*char_width), 1*char_width, 1*char_width, 0x0003, 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+0*char_width, offset_y+2*char_width), 1*char_width, 5*char_width, 0x0003, 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+2*char_width), 3*char_width, 1*char_width, 0x0003, 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+1*char_width, offset_y+4*char_width), 3*char_width, 1*char_width, 0x0003, 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);
  gpu_fill (PIX_ADDR(offset_x+5*6*char_width+4*char_width, offset_y+3*char_width), 1*char_width, 1*char_width, 0x0003, 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);
  ta_wait_no_lpm(WT_500MS);
  ta_wait_no_lpm(WT_500MS);
  ta_wait_no_lpm(WT_500MS);
  ta_wait_no_lpm(WT_500MS);
Line 70... Line 72...
    x_coord  =  0;
    x_coord  =  0;
  }
  }
  ta_wait_no_lpm(WT_500MS);
  ta_wait_no_lpm(WT_500MS);
  ta_wait_no_lpm(WT_500MS);
  ta_wait_no_lpm(WT_500MS);
 
 
//  // Initialize LFSR for random color generation
  // For each palette, try out each background-color
//  lfsr = 0xACEB;
  for( palette = 0; palette <6; palette = palette + 1 ) {
//
 
//  // Loop the demo
    LUT_CFG = (LUT_CFG & ~HW_LUT_PALETTE_MSK) | HW_LUT_BG_BLACK | (palette<<4);
//  loop = 0;
    ta_wait_no_lpm(WT_500MS);
//  while (loop <4) {
    ta_wait_no_lpm(WT_500MS);
//
 
//    // Select rotation & GPU use
    for( bg_color = 0; bg_color < 15; bg_color = bg_color + 1 ) {
//    switch(loop & 0x0003) {
 
//    case 0 : DISPLAY_CFG = DST_SWAP_CL;        wait_sel = 3;
      LUT_CFG = (LUT_CFG & ~HW_LUT_BGCOLOR_MSK) | (bg_color<<8);
//           break;
 
//    case 1 : DISPLAY_CFG = DST_SWAP_CL;        wait_sel = 2;
      ta_wait_no_lpm(WT_500MS);
//           break;
    }
//    case 2 : DISPLAY_CFG = DST_SWAP_CL;        wait_sel = 1;
 
//           break;
    LUT_CFG = (LUT_CFG & ~HW_LUT_BGCOLOR_MSK) | HW_LUT_BG_BLACK;
//    default: DISPLAY_CFG = DST_SWAP_CL;        wait_sel = 0;
    ta_wait_no_lpm(WT_500MS);
//           break;
    ta_wait_no_lpm(WT_500MS);
//    }
  }
//    loop++;
 
//    move_to_next_mode = 0;
  // Re-initialize LUT configuration
//
  LUT_CFG = HW_LUT_BG_BLACK     |
//    // Move the starting point of the buffer refresh
            HW_LUT_FG_WHITE     |
//    DISPLAY_REFR_CNT =        0;
            HW_LUT_PALETTE_0_HI |
//    while (!move_to_next_mode) {
            SW_LUT_BANK0_SELECT |
//
            SW_LUT_DISABLE;
//      // 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;
 
//      }
 
//    }
 
//  }
 
};
};
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.