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