Skip to content

Commit dec100d

Browse files
committed
Use driver subsystem for example
1 parent 8ee8143 commit dec100d

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

examples/devshare/eapp/devshare.c

+9-3
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,23 @@
77

88
int main()
99
{
10-
int ret, i;
10+
int ret, fd, i;
1111
ret = claim_mmio(SECURE_DEVICE,
1212
strlen(SECURE_DEVICE));
1313
if(ret < 0) {
1414
printf("Failed to claim " SECURE_DEVICE "\n");
1515
return -1;
1616
}
1717

18+
fd = openat(-2, "uart8250", 0, 0);
19+
if(fd < 0) {
20+
printf("Failed to get fd for device\n");
21+
return -1;
22+
}
23+
1824
for(i = 0; i < 1000; i++) {
19-
printf("Writing to UART: %i!\n", i);
20-
fflush(stdout);
25+
fprintf(fd, "Writing to UART: %i!\n", i);
26+
fflush(fd);
2127
}
2228

2329
// todo do something with the device

0 commit comments

Comments
 (0)