⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sysctl.c

📁 can4linux-3.5.3.gz can4 linux
💻 C
字号:
/* can_sysctl** can4linux -- LINUX CAN device driver source * * This file is subject to the terms and conditions of the GNU General Public * License.  See the file "COPYING" in the main directory of this archive * for more details. * *  * Copyright (c) 2001 port GmbH Halle/Saale * (c) 2001 Heinz-J黵gen Oertel (oe@port.de) *          Claus Schroeter (clausi@chemie.fu-berlin.de) *------------------------------------------------------------------ * $Header: /z2/cvsroot/products/0530/software/can4linux/src/sysctl.c,v 1.7 2008/11/24 11:31:25 oe Exp $ * *-------------------------------------------------------------------------- * * * * *//* * This Template implements the SYSCTL basics, and handler/strategy routines * Users may implement own routines and hook them up with the 'handler'		 * and 'strategy' methods of sysctl. *  * */#include "defs.h"#include <linux/mm.h>#include <linux/sysctl.h>#include <linux/ctype.h>static struct ctl_table_header *Can_systable = NULL;/* ----- Prototypes *//* ----- global variables accessible through /proc/sys/Can */char version[] = VERSION;char IOModel[MAX_CHANNELS] = { 0 };char Chipset[] =#if defined(ATCANMINI_PELICAN)	"SJA1000"#elif defined(CPC_PCI)	"SJA1000"#elif defined(IME_SLIMLINE)	"SJA1000"#elif defined(PCM3680)	"SJA1000"#elif defined(IXXAT_PCI03)	"SJA1000"#elif defined(CCPC104)	"SJA1000"#elif defined(MCF5282)	"FlexCAN"#elif defined(GENERIC_I82527)	"i82527"#elif defined(SBS_PC7)	"i82527"#elif defined(AD_BLACKFIN)	"BlackFIN"#elif defined(ATMEL_SAM9)	"AT91SAM9263"#else	""#endif;int IRQ[MAX_CHANNELS]; /*              = { 0x0 }; *//* dont assume a standard address, always configure, * address                         = = 0 means no board available */upointer_t  Base[MAX_CHANNELS]    = { 0x0 };/* void __iomem  *Base[MAX_CHANNELS]    = { 0x0 }; */int Baud[MAX_CHANNELS]             = { 0x0 };unsigned int AccCode[MAX_CHANNELS] = { 0x0 };unsigned int AccMask[MAX_CHANNELS] = { 0x0 };int Timeout[MAX_CHANNELS] 	   = { 0x0 };/* predefined value of the output control register,* depends of TARGET set by Makefile */int Outc[MAX_CHANNELS]	  = { 0x0 };int TxErr[MAX_CHANNELS]   = { 0x0 };int RxErr[MAX_CHANNELS]   = { 0x0 };int Overrun[MAX_CHANNELS] = { 0x0 };int Options[MAX_CHANNELS] = { 0x0 };#ifdef DEBUG_COUNTERint Cnt1[MAX_CHANNELS]    = { 0x0 };int Cnt2[MAX_CHANNELS]    = { 0x0 };#endif /* DEBUG_COUNTER *//* ----- the sysctl table */#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)/* sysctl without a binary number *//* #define CTL_UNNUMBERED	CTL_NONE */#define CTL_UNNUMBERED	1#endifctl_table can_sysctl_table[] = {        {         .ctl_name = CTL_UNNUMBERED,         .procname = "version",         .data = &version,         .maxlen = PROC_VER_LENGTH,         .mode = 0444,         .proc_handler = &proc_dostring,         .strategy = &sysctl_string,        },        {         .ctl_name = CTL_UNNUMBERED,         .procname = "Chipset",         .data = &Chipset,         .maxlen = PROC_CHIPSET_LENGTH,         .mode = 0444,         .proc_handler = &proc_dostring,         .strategy = &sysctl_string,        },	{         .ctl_name = CTL_UNNUMBERED,         .procname = "IOModel",         .data = &IOModel,         .maxlen = MAX_CHANNELS + 1,   /* +1 for '\0' */         .mode = 0444,         .proc_handler = &proc_dostring,         .strategy = &sysctl_string,        },	{         .ctl_name = CTL_UNNUMBERED,         .procname = "IRQ",         .data = IRQ,         .maxlen = MAX_CHANNELS * sizeof(int),         .mode = 0644,         .proc_handler = &proc_dointvec,         },        {         .ctl_name = CTL_UNNUMBERED,         .procname = "Base",         .data = Base,         .maxlen = MAX_CHANNELS * sizeof(int),         /* .maxlen = MAX_CHANNELS * sizeof(void __iomem *), */         .mode = 0644,         .proc_handler = &proc_dointvec,         },        {         .ctl_name = CTL_UNNUMBERED,         .procname = "Baud",         .data = Baud,         .maxlen = MAX_CHANNELS * sizeof(int),         .mode = 0644,         .proc_handler = &proc_dointvec,         },        {         .ctl_name = CTL_UNNUMBERED,         .procname = "AccCode",         .data = AccCode,         .maxlen = MAX_CHANNELS * sizeof(unsigned int),         .mode = 0644,         .proc_handler = &proc_dointvec,         },        {         .ctl_name = CTL_UNNUMBERED,         .procname = "AccMask",         .data = AccMask,         .maxlen = MAX_CHANNELS * sizeof(unsigned int),         .mode = 0644,         .proc_handler = &proc_dointvec,         },        {         .ctl_name = CTL_UNNUMBERED,         .procname = "Timeout",         .data = Timeout,         .maxlen = MAX_CHANNELS * sizeof(int),         .mode = 0644,         .proc_handler = &proc_dointvec,         },         {         .ctl_name = CTL_UNNUMBERED,         .procname = "Outc",         .data = Outc,         .maxlen = MAX_CHANNELS * sizeof(int),         .mode = 0644,         .proc_handler = &proc_dointvec,         }, 	{         .ctl_name = CTL_UNNUMBERED,         .procname = "TxErr",         .data = TxErr,         .maxlen = MAX_CHANNELS * sizeof(int),         .mode = 0444,         .proc_handler = &proc_dointvec,         },	{         .ctl_name = CTL_UNNUMBERED,         .procname = "RxErr",         .data = RxErr,         .maxlen = MAX_CHANNELS * sizeof(int),         .mode = 0444,         .proc_handler = &proc_dointvec,         },	{         .ctl_name = CTL_UNNUMBERED,         .procname = "Overrun",         .data = Overrun,         .maxlen = MAX_CHANNELS * sizeof(int),         .mode = 0444,         .proc_handler = &proc_dointvec,         },	{         .ctl_name = CTL_UNNUMBERED,         .procname = "dbgMask",         .data = &dbgMask,         .maxlen = 1 * sizeof(int),         .mode = 0644,         .proc_handler = &proc_dointvec,         },#ifdef DEBUG_COUNTER/* ---------------------------------------------------------------------- */ 	{         .ctl_name = CTL_UNNUMBERED,         .procname = "cnt1",         .data = Cnt1,         .maxlen = MAX_CHANNELS * sizeof(int),         .mode = 0444,         .proc_handler = &proc_dointvec,         },	{         .ctl_name = CTL_UNNUMBERED,         .procname = "cnt2",         .data = Cnt2,         .maxlen = MAX_CHANNELS * sizeof(int),         .mode = 0444,         .proc_handler = &proc_dointvec,         },/* ---------------------------------------------------------------------- */#endif /* DEBUG_COUNTER */	{.ctl_name = 0}}; static ctl_table can_root[] = {        {         .ctl_name = CTL_UNNUMBERED,         .procname = "Can",         .maxlen   = 0,         .mode     = 0555,         .child    = can_sysctl_table,         },        {.ctl_name = 0}};static ctl_table dev_root[] = {	{	 .ctl_name = CTL_DEV,	 .procname = "dev",	 .maxlen = 0,	 .mode = 0555,	 .child = can_root,	 },	{.ctl_name = 0}};/* ----- register and unregister entrys */void register_systables(void){#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)    Can_systable = register_sysctl_table(dev_root, 0);#else    Can_systable = register_sysctl_table(dev_root);#endif}void unregister_systables(void){    unregister_sysctl_table(Can_systable);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -