|
Last change
on this file since 168 was
168,
checked in by alain, 13 years ago
|
|
Introducing application "display" to test the IOC and FBF components.
|
|
File size:
1.5 KB
|
| Line | |
|---|
| 1 | #include <stdio.h> |
|---|
| 2 | |
|---|
| 3 | #define NBLOCS 32 |
|---|
| 4 | #define THRESHOLD 200 |
|---|
| 5 | |
|---|
| 6 | __attribute__((constructor)) int main(void) |
|---|
| 7 | { |
|---|
| 8 | unsigned char buf_in[128*128]; |
|---|
| 9 | unsigned char buf_out[128*128]; |
|---|
| 10 | unsigned int i; |
|---|
| 11 | unsigned int base = 0; |
|---|
| 12 | |
|---|
| 13 | while (base < 5 * NBLOCS) |
|---|
| 14 | { |
|---|
| 15 | |
|---|
| 16 | giet_tty_printf("\n *** image %d *** at date = %d \n", |
|---|
| 17 | base / NBLOCS, giet_proctime()); |
|---|
| 18 | |
|---|
| 19 | /* Phase 1 : lecture image sur le disque et transfert vers buf_in */ |
|---|
| 20 | if (giet_ioc_read(base, buf_in, NBLOCS)) |
|---|
| 21 | { |
|---|
| 22 | giet_tty_printf("echec giet_ioc_read\n"); |
|---|
| 23 | giet_exit(); |
|---|
| 24 | } |
|---|
| 25 | else |
|---|
| 26 | { |
|---|
| 27 | giet_ioc_completed(); |
|---|
| 28 | giet_tty_printf("io_read completed at date = %d \n", giet_proctime()); |
|---|
| 29 | } |
|---|
| 30 | |
|---|
| 31 | /* Phase 2 : transfert de buf_in vers buf_out avec seuillage */ |
|---|
| 32 | for (i = 0; i < 128 * 128; i++) |
|---|
| 33 | { |
|---|
| 34 | if (buf_in[i] > THRESHOLD) |
|---|
| 35 | buf_out[i] = 255; |
|---|
| 36 | else |
|---|
| 37 | buf_out[i] = buf_in[i]; |
|---|
| 38 | } |
|---|
| 39 | giet_tty_printf("image processing completed at date = %d \n", giet_proctime()); |
|---|
| 40 | |
|---|
| 41 | /* Phase 3 : transfert de buf_out vers le frame buffer par dma */ |
|---|
| 42 | if (giet_fb_sync_write(0, buf_out, 128 * 128)) |
|---|
| 43 | { |
|---|
| 44 | giet_tty_printf("echec giet_fb_write\n"); |
|---|
| 45 | giet_exit(); |
|---|
| 46 | } |
|---|
| 47 | else |
|---|
| 48 | { |
|---|
| 49 | giet_tty_printf("transfer completed at date = %d \n", giet_proctime()); |
|---|
| 50 | } |
|---|
| 51 | |
|---|
| 52 | base = base + NBLOCS; |
|---|
| 53 | } |
|---|
| 54 | |
|---|
| 55 | giet_exit(); |
|---|
| 56 | |
|---|
| 57 | return 0; |
|---|
| 58 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.