Created
April 17, 2017 23:33
-
-
Save macros/bbb10dedb8f0bdc582f52e5d663d5d30 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <fcntl.h> | |
#include <stdint.h> | |
int main(int argc, char **argv) { | |
int32_t l; | |
int fd; | |
if (argc != 2) { | |
fprintf(stderr, "Usage: %s <latency in us>\n", argv[0]); | |
return 2; | |
} | |
l = atoi(argv[1]); | |
printf("setting latency to %d us\n", l); | |
fd = open("/dev/cpu_dma_latency", O_WRONLY); | |
if (fd < 0) { | |
perror("open /dev/cpu_dma_latency"); | |
return 1; | |
} | |
if (write(fd, &l, sizeof(l)) != sizeof(l)) { | |
perror("write to /dev/cpu_dma_latency"); | |
return 1; | |
} | |
while (1) pause(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment