/********************************************************************************* * Copyright: (C) 2017 LingYun IoT Studio * All rights reserved. * * Filename: test_plat_led.c * Description: This file used to test platdrv_led.c driver * * Version: 1.0.0(03/15/2014) * Author: Guo Wenxue * ChangeLog: 1, Release initial version on "03/15/2014 02:03:22 PM" * ********************************************************************************/ #include #include #include #include #include #include #include #include #include #include #define LED_CNT 4 #define PLATDRV_MAGIC 0x60 #define LED_OFF _IO (PLATDRV_MAGIC, 0x18) #define LED_ON _IO (PLATDRV_MAGIC, 0x19) #define LED_BLINK _IO (PLATDRV_MAGIC, 0x20) static inline msleep(unsigned long ms) { struct timeval tv; tv.tv_sec = ms/1000; tv.tv_usec = (ms%1000)*1000; select(0, NULL, NULL, NULL, &tv); } int main (int argc, char **argv) { int i; int fd; if( (fd=open("/dev/led", O_RDWR, 0755)) < 0 ) { printf("open led device failure: %s\n", strerror(errno)); return 0; } for(i=0; i