📄 canproc.c
字号:
/*================================================================================
Module Name: canproc.c
General Description:
==================================================================================
Honeywell Confidential Proprietary
ACS - Security (Asia Pacific) R&D Software Operations
(c) Copyright Honeywell 2006, All Rights Reserved
Revision History:
Modification Tracking
Author Date Ver Number Description of Changes
---------------- ------------ ---------- -------------------------
Chen Kang Date: 2006-3-21 Version: ver 1.0.0 Create
Chen Kang Date: 2006-8-21 Version: ver 1.0.0 Add annotates
Portability: Indicate if this module is portable to other compilers or
platforms. If not, indicate specific reasons why is it not portable.
==================================================================================
INCLUDE FILES
==================================================================================*/
#include "candrv.h"
#include "config.h"
#include "IncludeCan.h"
/* ==================================================================================
LOCAL FUNCTIONS DECLARATIONS
==================================================================================*/
/* =======================================================
Function Name:***** can_read_procmem *****
Description: ***** can_read_procmem entry func *****
Created By: ***** Chen Kang *****
Created Date: ***** 2006-3-21 *****
Calls: ***** NONE *****
Called By: ***** NONE *****
normal para: ***** off_t offset;int count; *****
pointer para: ***** char *buf; char **start;int *eof; void *dat; *****
Return type: ***** int *****
Others: ***** NONE *****
==========================================================*/
int can_read_procmem(char *buf, char **start, off_t offset,
int count, int *eof, void *data)
{
static char achBuffer[512];
int i,len=0;
if (offset > 0)
return 0;
//len + = sprintf (achBuffer, "can drv test first.\n");
for(i=0; i < CAN_MAX_NUM; i++)
{
len += sprintf(achBuffer+len,"CAN[%d]:ISR called hw:%d,sw:%d\n",
i, hw_irq_stat[i],sw_irq_stat[i]);
len += sprintf(achBuffer+len,"Ponter: R %d,W %d, FullFlag=%d,EmptyFlag=%d\n",
CANRcvCyBufApp[i].ReadPoint,
CANRcvCyBufApp[i].WritePoint,
CANRcvCyBufApp[i].FullFlag,
CANRcvCyBufApp[i].EmptyFlag);
if (len > 256)
break;
}
*start = achBuffer;
return len;
}
/*
* The proc filesystem: function to read and entry
*/
/* =======================================================
Function Name:***** scullc_proc_offset *****
Description: ***** scullc_proc_offset entry func *****
Created By: ***** Chen Kang *****
Created Date: ***** 2006-3-21 *****
Calls: ***** NONE *****
Called By: ***** NONE *****
normal para: ***** NONE *****
pointer para: ***** char *buf; char **start; off_t *offset; int *len; *****
Return type: ***** void *****
Others: ***** NONE *****
==========================================================*/
void scullc_proc_offset(char *buf, char **start, off_t *offset, int *len)
{
if (*offset == 0)
return;
if (*offset >= *len) { /* Not there yet */
*offset -= *len;
*len = 0;
}
else { /* We're into the interesting stuff now */
*start = buf + *offset;
*offset = 0;
}
}
/* =======================================================
Function Name:***** init_proc_module *****
Description: ***** init_proc_module entry func *****
Created By: ***** Chen Kang *****
Created Date: ***** 2006-3-21 *****
Calls: ***** NONE *****
Called By: ***** NONE *****
normal para: ***** void; *****
pointer para: ***** NONE *****
Return type: ***** void *****
Others: ***** NONE *****
==========================================================*/
void init_proc_module(void)
{
create_proc_read_entry("candrv", 0, NULL, can_read_procmem, NULL);
}
/* =======================================================
Function Name:***** cleanup_proc_module *****
Description: ***** cleanup_proc_module entry func *****
Created By: ***** Chen Kang *****
Created Date: ***** 2006-3-21 *****
Calls: ***** NONE *****
Called By: ***** NONE *****
normal para: ***** void; *****
pointer para: ***** NONE *****
Return type: ***** void *****
Others: ***** NONE *****
==========================================================*/
void cleanup_proc_module(void)
{
remove_proc_entry ("candrv",0);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -