root / host / apps / omap_debug / usrp-e-ram.c @ f2454f90
History | View | Annotate | Download (502 Bytes)
| 1 | fa35b710 | root | #include <stdio.h> |
|---|---|---|---|
| 2 | #include <sys/types.h> |
||
| 3 | #include <fcntl.h> |
||
| 4 | |||
| 5 | int main(int rgc, char *argv[]) |
||
| 6 | {
|
||
| 7 | int fp, i, cnt;
|
||
| 8 | unsigned short buf[1024]; |
||
| 9 | unsigned short buf_rb[1024]; |
||
| 10 | |||
| 11 | fp = open("/dev/usrp1_e0", O_RDWR);
|
||
| 12 | printf("fp = %d\n", fp);
|
||
| 13 | |||
| 14 | for (i=0; i<1024; i++) |
||
| 15 | buf[i] = i*256;
|
||
| 16 | write(fp, buf, 2048);
|
||
| 17 | read(fp, buf_rb, 2048);
|
||
| 18 | |||
| 19 | printf("Read back %hX %hX\n", buf_rb[0], buf_rb[1]); |
||
| 20 | |||
| 21 | for (i=0; i<1024; i++) { |
||
| 22 | if (buf[i] != buf_rb[i])
|
||
| 23 | printf("Read - %hX, expected - %hX\n", buf_rb[i], buf[i]);
|
||
| 24 | } |
||
| 25 | } |