亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? can_send.c

?? can4linux-3.5.3.gz can4 linux
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* can driver*  test programm*  send messages commissioned via command line* * To do:* - more sequences for -t * - -debug schaltet mit debug level auch Treiber in debug mode* - ..* - do configuration of test with a special file format (can_send.rc)* - use nanosleep() see test3() ?** - CAN Errors are shown only in the basic mode.*   use it in all test modes*   and make an automatic reset in case of bus-off configurable** all activities has normally be finished before the progrmm can exit* and close the driver. Typiclyy the transmitt buffer is filled.* The programm has to wait for tx buffer empty before exiting.* At the momnt the program has some sleep() only.*/#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <unistd.h>#include <stdio.h>#include <stdlib.h>#include <stddef.h>#include <string.h>#include <signal.h>#include <sys/time.h>#include <time.h>#include <sys/ioctl.h>#include <math.h>#ifdef USE_RT_SCHEDULING# include <sched.h># include <sys/mman.h>#endif#include <errno.h>#include "can4linux.h"#if defined(EMBED)# if defined(COLDFIRE)/* IGW900 */#  define STDDEV "/home/bin/can0"# else#  define STDDEV "/dev/can0"# endif#else# define STDDEV "/dev/can1"#endif#define VERSION "1.9"#ifndef TRUE# define TRUE  1# define FALSE 0#endifextern int errno;canmsg_t message;void sbuf(unsigned char *s, int n);void usage(char *s);int can_fd;int node                 = 8;int debug                = FALSE;int extd                 = FALSE;int load		 = 50;		/* default bus-load */int doload		 = FALSE;		/* default bus-load */int stresstest           = FALSE;int testtype             = 1;  int sleeptime            = 1;		/* default: 1ms */int errwaittime		 = 1000;	/* waittime after error */int cstdout              = FALSE;	/* use stdout for CAN message */long int test_count_soll = 1;		/* single message */int rtr                  = FALSE;int baud		 = -1;		/* dont change baud rate */int priority		 = -1;		/* dont change priority rate */int canreset		 = FALSE;int endless		 = 0;		/* endlees test *//* functions */void clean_process(void);void test1(void);void test2(void);void test3(void);void test10(void);void test11(void);void test12(void);void test20(void);void test30(void);void test31(void);void test40(void);/************************************************************************* set_bitrate - sets the CAN bit rate*** Changing these registers only possible in Reset mode.** RETURN:**/int	set_bitrate(	int fd,			/* device descriptor */	int baud		/* bit rate */	){Config_par_t  cfg;volatile Command_par_t cmd;int ret;    cmd.cmd = CMD_STOP;    ioctl(fd, CAN_IOCTL_COMMAND, &cmd);    cfg.target = CONF_TIMING;     cfg.val1   = baud;    ret = ioctl(fd, CAN_IOCTL_CONFIG, &cfg);    cmd.cmd = CMD_START;    ioctl(fd, CAN_IOCTL_COMMAND, &cmd);    if (ret < 0) {	perror("set_bitrate");	exit(-1);    } else {	ret = 0;    }    return ret;}#include "getstat.c"int can_reset(void) {int ret;volatile Command_par_t cmd;    cmd.cmd = CMD_RESET;    ret = ioctl(can_fd, CAN_IOCTL_COMMAND, &cmd);    return ret;}int can_start(void) {int ret;volatile Command_par_t cmd;    cmd.cmd = CMD_CLEARBUFFERS;    ret = ioctl(can_fd, CAN_IOCTL_COMMAND, &cmd);    cmd.cmd = CMD_START;    ret = ioctl(can_fd, CAN_IOCTL_COMMAND, &cmd);    return ret;}void displayerror(canmsg_t *rx){/* static int boffcnt = 0; */	printf("Flags 0x%02x,", rx->flags);	if( 0 == (rx->flags & MSG_ERR_MASK)) {		printf(" CAN Error Free");	}	if( rx->flags & MSG_WARNING) {		printf(" CAN Warning Level,");	}	if( rx->flags & MSG_PASSIVE) {		printf(" CAN Error Passive,");	}	if( rx->flags & MSG_BUSOFF) {		printf(" CAN Bus Off,");		can_reset();		/* sleep 100ms */		usleep (100000);		can_start();	}	printf("\n");}	    /**** The main program**/int main(int argc, char **argv){int ret;int cnt;int c;char *pname;extern char *optarg;extern int optind;char device[40] = STDDEV;int max_priority;int increment = 0;long int test_count = 0;    pname = *argv;#ifdef USE_RT_SCHEDULING    max_priority = sched_get_priority_max(SCHED_RR) - 1;#else     max_priority = 1;#endif    /* our default 8 byte message */    message.id      = 100;    message.cob     = 0;    message.flags   = 0;    message.length  = 8;    message.data[0] = 0x55;    message.data[1] = 2;    message.data[2] = 3;    message.data[3] = 4;    message.data[4] = 5;    message.data[5] = 6;    message.data[6] = 7;    message.data[7] = 0xaa;    /* parse command line */    while ((c = getopt(argc, argv, "b:dehl:rp:s:n:D:t:T:VR")) != EOF) {	switch (c) {	    case 'r':		rtr = TRUE;		break;	    case 'e':		extd = TRUE;		break;	    case 'b':		baud = atoi(optarg);		break;	    case 'l':		load = atoi(optarg);		doload = TRUE;		break;	    case 'p':	        {#ifdef USE_RT_SCHEDULING	        struct sched_param mysched;		    priority = atoi(optarg);		    if (priority < 0 ) {		      fprintf(stderr, "Priority < 0 not allowed\n");		    }		    if (priority > max_priority) {		      fprintf(stderr, "Priority > %d not allowed\n",		      					max_priority);		    }		    mysched.sched_priority =		    		sched_get_priority_max(SCHED_RR) - 1;		    ret = sched_setscheduler(0,SCHED_FIFO,&mysched);		    if ( debug == TRUE ) {			printf("sched_setscheduler() = %d\n", ret);		    }		    /* lock all currently and in future			allocated memory blocks in physical ram */		    ret = mlockall(MCL_CURRENT | MCL_FUTURE);		    if ( debug == TRUE ) {			printf("mlockall() = %d\n", ret);		    }#endif		}		break;	    case 's':		sleeptime = atoi(optarg);		endless |= 0x01;		break;	    case 'n':		node = atoi(optarg);		sprintf(device, "/dev/canp%d", node);		break;	    case 'D':	        if (0 == strcmp(optarg, "stdout")) {	            cstdout = TRUE;		} else if (		    /* path ist starting with '.' or '/', use it as it is */			optarg[0] == '.'			|| 			optarg[0] == '/'			) {		    sprintf(device, "%s", optarg);	        } else {		    sprintf(device, "/dev/%s", optarg);		}		break;	    case 'd':		debug = TRUE;		break;	    case 't':		stresstest = TRUE;		testtype   = atoi(optarg);		break;	    case 'T':		test_count_soll = atoi(optarg);		endless |= 0x02;		break;	    case 'V':		printf("can_send V " VERSION ", " __DATE__ "\n");		exit(0);		break;	    case 'R':		canreset = TRUE;		break;	    case 'h':	    default: usage(pname); exit(0);	}    }    /* look for additional arguments given on the command line */    if ( argc - optind > 0 ) {        /* at least one additional argument, the message id is given */	message.id =  strtol(argv[optind++], NULL, 0);    	memset(message.data, 0, 8);	message.length = 0;    }    if ( argc - optind > 0 ) {    	/* also data bytes areg given with the command */	cnt = 0;	while(optind != argc) {	    message.data[cnt++] = strtol(argv[optind++], NULL, 0);	}	message.length = cnt;    }    if (rtr) {	message.flags |= MSG_RTR;    }    if (extd) {	message.flags |= MSG_EXT;    }    if (endless != 0x01) {        /* only the value 1 means endless, all other values means,         * additional options used -> no endless         */        endless = 0;    }    if ( debug == TRUE ) {	printf("can_send V " VERSION ", " __DATE__ "\n");	printf("(c) 1996-2006 port GmbH\n");	printf(" using canmsg_t with %d bytes\n", sizeof(canmsg_t));	printf("  data at offset %d\n", offsetof(canmsg_t, data));	printf(" max process priority is \"-p %d\"\n", max_priority);	if (stresstest) {	    printf("should send one of the test sequences\n");	} else {	    printf("should send mess %ld with: %s", message.id,		message.length > 0 ? ": " : "out data");	    sbuf(message.data, message.length);	}    }    sleeptime *= 1000;    if ( debug == TRUE ) {	printf("Sleeptime between transmit messages= %d us\n", sleeptime);    }    srand(node * 100);    if(sleeptime > 0) {    	errwaittime = sleeptime;    } else {    	errwaittime = 1000;    }    if (cstdout == FALSE) {        /* really use CAN, open the device driver */	if ( debug == TRUE ) {	    printf("Open device %s\n", device);	}	/* can_fd = open(device, O_WRONLY | O_NONBLOCK); */	can_fd = open(device, O_RDWR | O_NONBLOCK);	if (can_fd == -1) {	    fprintf(stderr, "open error %d;", errno);	    perror(device);	    exit(1);	}	if ( canreset == TRUE ) {	    ret = can_reset();	    if ( ret == -1 ) {		perror("CAN Reset");		exit(EXIT_FAILURE);	    }	    if ( debug == TRUE) {		printf("Reset successfull\n");	    }	    exit(EXIT_SUCCESS);	}		if (baud > 0) {	    if ( debug == TRUE ) {		printf("change Bit-Rate to %d Kbit/s\n", baud);	    }	    set_bitrate(can_fd, baud);	}    } else {	can_fd = 1;		/* use stdout */    }    if ( debug == TRUE ) {	printf("opened %s succesful, got can_fd = %d\n", device, can_fd);    }    if (doload == TRUE) {	test20();	exit(0);    }    if (stresstest) {	switch(testtype) {	    case 1:  test1(); exit(0); break;	    case 2:  test2(); exit(0); break;	    case 3:  test3(); exit(0); break;	    case 4:  increment = 1; break;	    case 10: test10(); exit(0); break;	    case 11: test11();	    	sleep(2); printf("finito\n");	    		exit(0); break;	    case 12: test12(); exit(0); break;	    case 30: test30(); exit(0); break;	    case 31: test31(); exit(0); break;	    case 40: test40(); exit(0); break;	    default:	    fprintf(stderr, "test type %d is not defined\n", testtype);	    exit(0); break;	}    }    /* else */    /* the default can_send, simply send a message */    /* no special test, send the normal message, (old behaviouur) */    do {        canmsg_t rx;        int i;        if(debug == TRUE) {	     printf(" transmit message %ld\n", message.id ); 	}	ret = write(can_fd, &message, 1);	if(ret == -1) {	    /* int e = errno; */	    perror("write error");	    /* if ( e == ENOSPC) { */		usleep(errwaittime); 		continue;	    /* } */	} else if(ret == 0) {	    printf("transmit timed out\n");		usleep(errwaittime); 		continue;	} else {	    ;	}	/* now read the rx queue, it may contain	 * frames with id -1, which signals an error */	do {	    i = read(can_fd, &rx, 1);	    if(-1 == i) {		perror("read error");	    } else if((i > 0) && (CANDRIVERERROR == rx.id)) {		displayerror(&rx);	    }	}	while(i > 0);	if( debug == TRUE ) {	     showCANStat(can_fd); 	}	if(sleeptime > 0) usleep(sleeptime);	message.id += increment;		test_count++;	        if(endless != 1) {	    if(test_count == test_count_soll) {		break;	    }	}    }    while(1);    if (sleeptime == 0) {        /* do not close while the controller is sending a message         * sleep() then close()         */        usleep(50000);        /* sleep(1); */    }    ret = close(can_fd);    if (ret == -1) {	fprintf(stderr, "close error %d;", errno);	perror("");	exit(1);    }    if ( debug == TRUE ) {	printf("closed fd = %d succesful\n", can_fd);    }    return 0;}/* show buffer in hex */void sbuf(unsigned char *s, int n){int i;    for(i = 0; i< n; i++) {	fprintf(stdout, "%02x ", *s++);    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产乱淫av一区二区三区| 久久久另类综合| 不卡的av电影在线观看| 国产一区二区三区蝌蚪| 美国毛片一区二区三区| 国精产品一区一区三区mba桃花| 亚洲成在线观看| 免费在线观看不卡| 国产露脸91国语对白| 97久久超碰精品国产| 欧美唯美清纯偷拍| 久久久91精品国产一区二区三区| 日韩欧美在线影院| 中文字幕一区二区三区视频| 亚洲一区二区欧美激情| 国产剧情一区在线| 欧洲精品一区二区| 喷水一区二区三区| 亚洲欧洲综合另类| 亚洲第一综合色| 国产麻豆成人传媒免费观看| 99精品国产视频| 久久一留热品黄| 亚洲成人资源在线| eeuss鲁一区二区三区| 久久在线免费观看| 亚洲大片精品永久免费| 波波电影院一区二区三区| 欧美mv日韩mv国产网站| 天涯成人国产亚洲精品一区av| 国产99精品视频| 国产亚洲va综合人人澡精品 | 国产精品亚洲成人| 亚洲精品一区二区三区在线观看| 亚洲国产欧美在线| 91麻豆精品国产91久久久更新时间| 国产精品国产三级国产a| 不卡的av网站| 一区在线观看视频| 欧美午夜视频网站| 日本美女一区二区| 久久蜜桃av一区二区天堂| 成人三级伦理片| 亚洲综合色网站| 欧美一卡二卡在线观看| 国产在线一区二区综合免费视频| 日韩一区二区不卡| 国产精品白丝jk白祙喷水网站| 国产视频911| 在线观看欧美日本| 国产成人高清视频| 一个色在线综合| 国产亚洲精品免费| 欧美麻豆精品久久久久久| 国产呦萝稀缺另类资源| 亚洲欧美日韩综合aⅴ视频| 91麻豆精品国产91久久久久久| 成人av免费在线| 视频在线观看一区二区三区| 久久男人中文字幕资源站| 欧美日韩高清不卡| av电影天堂一区二区在线观看| 亚洲品质自拍视频网站| 精品国产乱码久久久久久蜜臀| 色综合久久中文字幕综合网| 国产麻豆日韩欧美久久| 天堂精品中文字幕在线| 一区二区三区蜜桃| 亚洲欧美另类图片小说| 亚洲免费在线视频一区 二区| 精品成a人在线观看| 欧美一区二区免费| 欧美大片顶级少妇| 精品久久久久香蕉网| 欧美一区二区视频免费观看| 日韩一区二区中文字幕| 欧美一级在线视频| 精品福利在线导航| 国产精品久久久久精k8 | 91精品国产综合久久蜜臀 | 成人aaaa免费全部观看| 视频一区二区三区入口| 日本一不卡视频| 国产高清成人在线| 免费一级片91| 亚洲精品一区二区三区在线观看| 懂色av一区二区三区免费观看| 粉嫩aⅴ一区二区三区四区| 国产大陆a不卡| 精品视频一区二区三区免费| 91精品国产91热久久久做人人| 欧美大片日本大片免费观看| 久久久精品tv| 美女一区二区三区在线观看| 国产成人自拍高清视频在线免费播放 | 在线看国产一区| 26uuu另类欧美| 亚洲大片一区二区三区| 成人一区二区三区视频在线观看| 91在线视频免费观看| 亚洲精品在线网站| 日韩在线播放一区二区| 色哟哟日韩精品| 国产精品嫩草影院com| 美腿丝袜亚洲色图| 日韩精品在线一区二区| 亚洲国产欧美日韩另类综合 | 成人性生交大片免费看视频在线| 欧美午夜在线一二页| 亚洲乱码国产乱码精品精可以看| 国产在线精品免费av| 精品蜜桃在线看| 精品一区二区三区免费观看| 日韩三级.com| 国产毛片一区二区| 中文字幕在线观看不卡| 成人av电影在线| 一区二区久久久| 日韩欧美亚洲一区二区| 国内外精品视频| 亚洲色图在线视频| 欧美日韩国产首页| 国模娜娜一区二区三区| 国产精品免费久久| 欧美日韩1234| 国产成人精品午夜视频免费| 国产精品久久久久久久久久久免费看 | 久久在线观看免费| 成人影视亚洲图片在线| 亚洲高清视频在线| 久久综合久久鬼色| 色播五月激情综合网| 久久99精品久久久久久动态图| 国产亚洲欧美色| 欧美精品久久久久久久久老牛影院| 日韩高清不卡一区二区三区| 久久久精品国产99久久精品芒果| 91年精品国产| www.亚洲精品| 国产黄色成人av| 麻豆国产精品一区二区三区| 日韩一区在线播放| 久久久综合精品| 欧美一区二区成人6969| 欧美视频你懂的| 色狠狠色噜噜噜综合网| 大桥未久av一区二区三区中文| 美日韩一区二区| 青青草国产成人99久久| 亚洲图片欧美视频| 亚洲一二三区不卡| 亚洲va国产va欧美va观看| 亚洲综合一区在线| 午夜精品一区二区三区免费视频| 亚洲日本一区二区| eeuss鲁片一区二区三区在线观看| 精品国产一区二区亚洲人成毛片| 欧美一a一片一级一片| 欧洲在线/亚洲| 欧美日韩国产经典色站一区二区三区| 99热精品一区二区| 欧美午夜电影网| 日韩欧美国产电影| 国产精品丝袜在线| 亚洲成人免费av| 精品一区二区三区视频在线观看 | 欧美精品一卡二卡| 精品国产亚洲一区二区三区在线观看| 精品国一区二区三区| 国产精品毛片大码女人| 亚洲1区2区3区4区| 成人一级黄色片| 日韩欧美中文字幕精品| 国产精品初高中害羞小美女文| 午夜a成v人精品| www.亚洲在线| 久久久精品综合| 日韩精品乱码av一区二区| 成人av影院在线| 国产区在线观看成人精品| 偷窥国产亚洲免费视频| aaa国产一区| 亚洲欧美一区二区不卡| 风间由美一区二区三区在线观看| 在线免费观看日本一区| 国产精品毛片久久久久久| 国产一区 二区 三区一级| 日韩女优电影在线观看| 五月天一区二区| 欧美日韩成人综合天天影院| 国产精品青草久久| 99久久精品免费看国产免费软件| 久久美女高清视频| 国产91在线观看| 亚洲日本韩国一区| 精品视频一区三区九区| 亚洲成va人在线观看| 欧美一级精品在线| 国产一区二三区| 亚洲激情男女视频|