Skip to content

Instantly share code, notes, and snippets.

@samirfor
Last active August 29, 2015 14:08
Show Gist options
  • Save samirfor/60f485c3ae3eeb15b331 to your computer and use it in GitHub Desktop.
Save samirfor/60f485c3ae3eeb15b331 to your computer and use it in GitHub Desktop.
/**
Copyright (C) 2014 Samir C. Costa <[email protected]>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <sys/io.h>
int main(int argc, char **argv)
{
if(getuid() != 0) {
printf("You must be root to run this app.\n");
return 1;
}
if(argc < 2) {
printf("Usage: %s [interval]\nInterval in microseconds.\n", argv[0]);
return 1;
}
int interval = atoi(argv[1]);
ioperm(0x378,3,1);
while(1) {
outb(0xff, 0x378);
usleep(interval);
outb(0x00, 0x378);
usleep(interval);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment