/* * us_ticks.c- Sigmastar * * Copyright (c) [2019~2020] SigmaStar Technology. * * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * 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 version 2 for more details. * */ #include #include #include #include // for usleep #include #include #include #include #include /* mmap() is defined in this header */ #include #define MSYS_IOCTL_MAGIC 'S' #define IOCTL_MSYS_GET_US_TICKS _IO(MSYS_IOCTL_MAGIC, 0x31) int main(int argc, char** argv) { int msys_fd=open("/dev/msys",O_RDWR|O_SYNC); unsigned long long t0=0,t1=0; int count=0; if(-1==msys_fd) { printf("can't open /dev/msys\n"); goto OPEN_FAILED; } while(1) { ioctl(msys_fd, IOCTL_MSYS_GET_US_TICKS, &t0); if(t0