Rev | Line | |
---|
[25] | 1 | #include "stdio.h" |
---|
| 2 | |
---|
| 3 | /////////// |
---|
| 4 | int main3() |
---|
| 5 | { |
---|
| 6 | |
---|
| 7 | #define NBLOCS 32 |
---|
| 8 | #define THRESHOLD 200 |
---|
| 9 | |
---|
| 10 | char buf_in[128*128]; |
---|
| 11 | char buf_out[128*128]; |
---|
| 12 | int i; |
---|
| 13 | int base = 0; |
---|
| 14 | |
---|
| 15 | while(base < 20*NBLOCS) { |
---|
| 16 | |
---|
| 17 | tty_printf("\n *** image %d *** at date = %d \n", base/NBLOCS, proctime()); |
---|
| 18 | |
---|
| 19 | /* Phase 1 : lecture image sur le disque et transfert vers buf_in */ |
---|
| 20 | if( ioc_read(base, buf_in, NBLOCS) ) |
---|
| 21 | { |
---|
| 22 | tty_printf("echec io_read\n"); |
---|
| 23 | exit(); |
---|
| 24 | } |
---|
| 25 | else |
---|
| 26 | { |
---|
| 27 | ioc_completed(); |
---|
| 28 | tty_printf("io_read completed at date = %d \n",proctime()); |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | /* Phase 2 : transfert de buf_in vers buf_out avec seuillage */ |
---|
| 32 | for(i=0 ; i<128*128 ; i++) { |
---|
| 33 | if( buf_in[i] > THRESHOLD ) buf_out[i] = 255; |
---|
| 34 | else buf_out[i] = buf_in[i]; |
---|
| 35 | } |
---|
| 36 | tty_printf("image processing completed at date = %d \n",proctime()); |
---|
| 37 | |
---|
| 38 | /* Phase 3 : transfert de buf_out vers le frame buffer par dma */ |
---|
| 39 | if( fb_sync_write(0,buf_out,128*128) ) |
---|
| 40 | { |
---|
| 41 | tty_printf("echec fb_write\n"); |
---|
| 42 | exit(); |
---|
| 43 | } |
---|
| 44 | else |
---|
| 45 | { |
---|
| 46 | tty_printf("display completed at date = %d \n",proctime()); |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | base = base + NBLOCS; |
---|
| 50 | } // end while |
---|
| 51 | exit(); |
---|
| 52 | return 0; |
---|
| 53 | |
---|
| 54 | } // end main3 |
---|
Note: See
TracBrowser
for help on using the repository browser.