Skip to content

Commit

Permalink
Use driver subsystem for example
Browse files Browse the repository at this point in the history
  • Loading branch information
grg-haas committed Jan 26, 2024
1 parent 8ee8143 commit dec100d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions examples/devshare/eapp/devshare.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,23 @@

int main()
{
int ret, i;
int ret, fd, i;
ret = claim_mmio(SECURE_DEVICE,
strlen(SECURE_DEVICE));
if(ret < 0) {
printf("Failed to claim " SECURE_DEVICE "\n");
return -1;
}

fd = openat(-2, "uart8250", 0, 0);
if(fd < 0) {
printf("Failed to get fd for device\n");
return -1;
}

for(i = 0; i < 1000; i++) {
printf("Writing to UART: %i!\n", i);
fflush(stdout);
fprintf(fd, "Writing to UART: %i!\n", i);
fflush(fd);
}

// todo do something with the device
Expand Down

0 comments on commit dec100d

Please sign in to comment.