Last change
on this file since 17010 was 11071, checked in by tbretz, 13 years ago |
Replaced v19r21 by a version extracted with 'unzip -a' to get proper unix text format.
|
File size:
719 bytes
|
Line | |
---|
1 | #include <stdio.h>
|
---|
2 | #include <dis.h>
|
---|
3 |
|
---|
4 | int registers[10];
|
---|
5 | int ids[10];
|
---|
6 |
|
---|
7 | void set_register(tag, data, size)
|
---|
8 | int *tag, *data, *size;
|
---|
9 | {
|
---|
10 | int index, value;
|
---|
11 |
|
---|
12 | index = data[0];
|
---|
13 | value = data[1];
|
---|
14 | printf("Setting register %d to value %d\n", index, value);
|
---|
15 | /* here we set the register, read it back and update the service*/
|
---|
16 | registers[index] = value;
|
---|
17 | dis_update_service(ids[index]);
|
---|
18 |
|
---|
19 | }
|
---|
20 |
|
---|
21 | main(argc,argv)
|
---|
22 | int argc;
|
---|
23 | char **argv;
|
---|
24 | {
|
---|
25 | int i;
|
---|
26 | char aux[80];
|
---|
27 |
|
---|
28 | for(i = 0; i< 10; i++)
|
---|
29 | {
|
---|
30 | sprintf(aux,"Register%03d",i);
|
---|
31 | ids[i] = dis_add_service( aux, "I", ®isters[i], sizeof(int),
|
---|
32 | (void *)0, 0 );
|
---|
33 | }
|
---|
34 |
|
---|
35 | dis_add_cmnd("SET_REGISTER","I:2",set_register, 0);
|
---|
36 |
|
---|
37 | dis_start_serving( "TEST_REGISTERS" );
|
---|
38 |
|
---|
39 | while(1)
|
---|
40 | {
|
---|
41 | pause();
|
---|
42 | }
|
---|
43 | }
|
---|
44 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.