91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 47.55 KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2024-08-01
  • 語言: 其他
  • 標簽: CAN??LINUX??驅動??

資源簡介

linux下的CAN驅動程序。分三個文件夾:include,driver,app,分別存放頭文件、驅動程序和應用程序。里邊還有驅動程序的簡要介紹,介紹了驅動程序的組成和編寫應用過程。<br>很詳細的一份驅動資料。

資源截圖

代碼片段和文件信息

#include?
#include?
//#include?
#include?

#include?
#include?
//#include?
//#inclued?

#include?“mcpcan.h“

#include?“spi_cmd.h“
#include?“def.h“
//#include?“2410addr.h“
#include?“directio.h“
//#include?“option.h“
//#include?“2410lib.h“



#define?DEBUG

#ifdef?DEBUG
#define?dbgprintf(S)?printf(S)
#else
#define?dbgprintf(S)
#endif


int?fd;

void?send(void?*?arg)
{
????????struct?mcpcan_data?*datagramptr?=?(struct?mcpcan_data?*)arg;
????????while(1)
????????{??????
????????????????sleep(2);

????????????????write(fd?datagramptr?sizeof(struct?mcpcan_data));
????????????????printf(“send?datagram.\n“);
????????????????printf(“the?data?sended?is?%s.\n“?datagramptr->data);
????????}??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
}



int?main()
{
pthread_t?id;
int?ret;
struct?mcpcan_data?data_receive;
struct?mcpcan_data?data_send;

????/*?打印提示信息?*/
printf(“---can總線測試程序---\n“);

????????data_send.BufNo?=?TXBUF0;
????????data_send.IdType?=?STANDID;
????????data_send.id?=?23;
????????data_send.DataLen?=?8;
????????strcpy(data_send.data?“-CVTECH-“);

data_receive.BufNo?=?0;
data_receive.IdType?=?0;
data_receive.id?=?0;
data_receive.DataLen?=?0;
memset(data_receive.data90x0);

fd?=?open(“/dev/can“O_RDWR);
if(fd? {
printf(“Open?device?failed.\n“);
return?fd;
}
printf(“Open?device?success.\n“);

ret=pthread_create(&idNULL(void?*)send?&data_send);

????????if(ret!=0){
printf?(“Create?pthread?error!\n“);
exit?(1);
????????}

printf(“Create?pthread?success.\n“);

while(1)
{
int?datalen;

read(fd?&data_receive?sizeof(struct?mcpcan_data));

printf(“data_receive.BufNo?=?%d\n“data_receive.BufNo);
printf(“data_receive.IdType?=?%d\n“data_receive.IdType);
printf(“data_receive.id?=?%d\n“data_receive.id);
printf(“data_receive.DataLen?=?%d\n“data_receive.DataLen);
printf(“data_receive.data?=?%s\n“data_receive.data);
}

return?0;
}


?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件????????445??2006-03-16?08:56??代碼\app\Makefile

?????文件???????2157??2006-03-15?18:38??代碼\app\cantxrx.c

?????目錄??????????0??2006-03-15?18:21??代碼\app

?????文件????????630??2006-03-16?08:38??代碼\driver\Makefile

?????文件??????20271??2006-03-16?08:54??代碼\driver\mcpcan.c

?????文件??????16173??2006-03-15?17:07??代碼\driver\spi.c

?????文件???????2201??2006-03-15?17:07??代碼\driver\spi_cmd.c

?????目錄??????????0??2006-03-15?18:21??代碼\driver

?????文件???????1798??2006-03-16?08:35??代碼\include\2410addr.h

?????文件???????3250??2006-03-16?08:35??代碼\include\spi.h

?????文件???????5956??2006-03-16?08:41??代碼\include\mcpcan.h

?????文件???????1054??2006-03-16?08:35??代碼\include\spi_cmd.h

?????文件???????2302??2006-03-16?08:35??代碼\include\directio.h

?????文件????????408??2006-03-16?08:35??代碼\include\def.h

?????文件???????2195??2006-03-16?08:35??代碼\include\2410lib.h

?????文件???????1651??2006-03-16?08:35??代碼\include\option.h

?????文件???????3100??2006-03-16?08:35??代碼\include\hardware.h

?????文件??????84079??2006-03-16?08:35??代碼\include\S3C2410.h

?????目錄??????????0??2006-03-16?08:37??代碼\include

?????目錄??????????0??2006-03-15?18:21??代碼

?????文件??????41984??2006-03-16?08:54??代碼\CAN程序說明.doc

?????文件????????630??2006-03-16?08:38??代碼\driver\Makefile.txt

-----------?---------??----------?-----??----

???????????????190284????????????????????22


評論

共有 條評論