source: soft/giet_vm/display/main.c @ 259

Last change on this file since 259 was 258, checked in by alain, 11 years ago

This is a major release, including a deep restructuration of code.
The main evolutions are

  • use of the Tsar preloader to load the GIET boot-loader from disk
  • introduction of a FAT32 file system library,
  • use of this fat32 library by the boot-loader to load the map.bin data structure, and the various .elf files
  • reorganisation of drivers (one file per peripheral).
  • introduction of drivers for new peripherals: vci_chbuf_dma and vci_multi_ahci.
  • introduction of a new physical memory allocator in the boot code.

This release has been tested on the tsar_generic_iob architecture,
for the two following mappings: 4c_1p_iob_four.xml and 4c_1p_iob_sort.xml

File size: 2.0 KB
Line 
1#include <stdio.h>
2
3#define NBLOCKS 32   // (128 * 128) / 512
4
5unsigned char buf[128*128] __attribute__((aligned(512)));
6
7__attribute__((constructor)) void main()
8{ 
9    int           fd;
10    int           blocks;
11    unsigned int  ko;
12    unsigned int  blocks_to_skip = 8*NBLOCKS;
13
14    giet_tty_printf("\nStarting task DISPLAY on processor %d at cycle %d\n",
15                    giet_procid(), giet_proctime() );
16
17    ///////////////////////////////////////////
18    fd = giet_fat_open( "misc/images.raw", 0 );
19    if ( fd < 0 )
20    {
21        giet_tty_printf("\n*** echec giet_fat_open for misc/images.raw at cycle %d\n", 
22                        giet_proctime() );
23        giet_exit();
24    }
25    else
26    {
27        giet_tty_printf("\ngiet_fat_open completed for misc/images.raw at cycle %d\n", 
28                        giet_proctime() );
29    }
30
31    /////////////////////////////////////////
32    while ( blocks_to_skip < (10 * NBLOCKS) )
33    {
34        // lecture image sur le disque
35        blocks = giet_fat_read( fd, buf, NBLOCKS, blocks_to_skip );
36        if ( blocks != NBLOCKS )
37        {
38            giet_tty_printf("\n*** echec giet_fat_read at cycle %d\n", 
39                            giet_proctime() );
40            giet_exit();
41        }
42        else
43        {
44            giet_tty_printf("\ngiet_fat_read for image %d completed at cycle %d \n", 
45                            (blocks_to_skip>>5), giet_proctime());
46        }
47
48        // transfert vers le frame buffer 
49        ko = giet_fb_sync_write( 0, buf, 128 * 128 );
50        if ( ko )
51        {
52            giet_tty_printf("\n*** echec giet_fb_sync_write at cycle %d\n", 
53                            giet_proctime() );
54            giet_exit();
55        }
56        else
57        {
58            giet_tty_printf("\ndisplay completed for image %d at cycle %d \n", 
59                            (blocks_to_skip>>5), giet_proctime());
60        }
61
62        blocks_to_skip = blocks_to_skip + NBLOCKS;
63    }
64
65    giet_tty_printf("\n*** Tak display exit at cycle %d ***\n", giet_proctime());
66    giet_exit();
67}
Note: See TracBrowser for help on using the repository browser.