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

📄 arlan-proc.c

📁 linux和2410结合开发 用他可以生成2410所需的zImage文件
💻 C
📖 第 1 页 / 共 2 页
字号:
	SARLUCN(_12, 1);	SARLUS(specRouterTimeout);	SARLUCN(_13, 5);	/* Scrambled Area */	SARLUIA(SID);	SARLUCN(encryptionKey, 12);	SARLUIA(_14);	SARLUSA(waitTime);	SARLUSA(lParameter);	SARLUCN(_15, 3);	SARLUS(headerSize);	SARLUS(sectionChecksum);	SARLUC(registrationMode);	SARLUC(registrationFill);	SARLUS(pollPeriod);	SARLUS(refreshPeriod);	SARLSTR(name, 16);	SARLUCN(NID, 6);	SARLUC(localTalkAddress);	SARLUC(codeFormat);	SARLUC(numChannels);	SARLUC(channel1);	SARLUC(channel2);	SARLUC(channel3);	SARLUC(channel4);	SARLUCN(SSCode, 59);/*      SARLUCN( _16, 0x140); */	/* Statistics Block - 0x0300 */	SARLUC(hostcpuLock);	SARLUC(lancpuLock);	SARLUCN(resetTime, 18);	SARLUIA(numDatagramsTransmitted);	SARLUIA(numReTransmissions);	SARLUIA(numFramesDiscarded);	SARLUIA(numDatagramsReceived);	SARLUIA(numDuplicateReceivedFrames);	SARLUIA(numDatagramsDiscarded);	SARLUS(maxNumReTransmitDatagram);	SARLUS(maxNumReTransmitFrames);	SARLUS(maxNumConsecutiveDuplicateFrames);	/* misaligned here so we have to go to characters */	SARLUIA(numBytesTransmitted);	SARLUIA(numBytesReceived);	SARLUIA(numCRCErrors);	SARLUIA(numLengthErrors);	SARLUIA(numAbortErrors);	SARLUIA(numTXUnderruns);	SARLUIA(numRXOverruns);	SARLUIA(numHoldOffs);	SARLUIA(numFramesTransmitted);	SARLUIA(numFramesReceived);	SARLUIA(numReceiveFramesLost);	SARLUIA(numRXBufferOverflows);	SARLUIA(numFramesDiscardedAddrMismatch);	SARLUIA(numFramesDiscardedSIDMismatch);	SARLUIA(numPollsTransmistted);	SARLUIA(numPollAcknowledges);	SARLUIA(numStatusTimeouts);	SARLUIA(numNACKReceived);	SARLUS(auxCmd);	SARLUCN(dumpPtr, 4);	SARLUC(dumpVal);	SARLUC(wireTest);		/* next 4 seems too long for procfs, over single page ?	SARLUCN( _17, 0x86);	SARLUCN( txBuffer, 0x800);	SARLUCN( rxBuffer,  0x800); 	SARLUCN( _18, 0x0bff);	 */	pos += sprintf(arlan_drive_info + pos, "rxRing\t=\t0x");	for (i = 0; i < 0x50; i++)		pos += sprintf(arlan_drive_info + pos, "%02x", ((char *) priva->conf)[priva->conf->rxOffset + i]);	pos += sprintf(arlan_drive_info + pos, "\n");	SARLUC(configStatus);	SARLUC(_22);	SARLUC(progIOCtrl);	SARLUC(shareMBase);	SARLUC(controlRegister);	pos += sprintf(arlan_drive_info + pos, " total %d chars\n", pos);	if (ctl)		if (ctl->procname)			pos += sprintf(arlan_drive_info + pos, " driver name : %s\n", ctl->procname);final:	*lenp = pos;	if (!write)		retv = proc_dostring(ctl, write, filp, buffer, lenp);	else	{		*lenp = 0;		return -1;	}	return retv;}static int arlan_sysctl_info161719(ctl_table * ctl, int write, struct file *filp,			    void *buffer, size_t * lenp){	int i;	int retv, pos, devnum;	struct arlan_private *priva = NULL;	pos = 0;	devnum = ctl->procname[5] - '0';	if (arlan_device[devnum] == NULL)	{		pos += sprintf(arlan_drive_info + pos, "No device found here \n");		goto final;	}	else		priva = arlan_device[devnum]->priv;	if (priva == NULL)	{		printk(KERN_WARNING " Could not find the device private in arlan procsys, bad\n ");		return -1;	}	memcpy_fromio(priva->conf, priva->card, sizeof(struct arlan_shmem));	SARLUCN(_16, 0xC0);	SARLUCN(_17, 0x6A);	SARLUCN(_18, 14);	SARLUCN(_19, 0x86);	SARLUCN(_21, 0x3fd);final:	*lenp = pos;	retv = proc_dostring(ctl, write, filp, buffer, lenp);	return retv;}static int arlan_sysctl_infotxRing(ctl_table * ctl, int write, struct file *filp,			    void *buffer, size_t * lenp){	int i;	int retv, pos, devnum;	struct arlan_private *priva = NULL;	pos = 0;	devnum = ctl->procname[5] - '0';	if (arlan_device[devnum] == NULL)	{		  pos += sprintf(arlan_drive_info + pos, "No device found here \n");		  goto final;	}	else		priva = arlan_device[devnum]->priv;	if (priva == NULL)	{		printk(KERN_WARNING " Could not find the device private in arlan procsys, bad\n ");		return -1;	}	memcpy_fromio(priva->conf, priva->card, sizeof(struct arlan_shmem));	SARLBNpln(u_char, txBuffer, 0x800);final:	*lenp = pos;	retv = proc_dostring(ctl, write, filp, buffer, lenp);	return retv;}static int arlan_sysctl_inforxRing(ctl_table * ctl, int write, struct file *filp,			    void *buffer, size_t * lenp){	int i;	int retv, pos, devnum;	struct arlan_private *priva = NULL;	pos = 0;	devnum = ctl->procname[5] - '0';	if (arlan_device[devnum] == NULL)	{		  pos += sprintf(arlan_drive_info + pos, "No device found here \n");		  goto final;	} else		priva = arlan_device[devnum]->priv;	if (priva == NULL)	{		printk(KERN_WARNING " Could not find the device private in arlan procsys, bad\n ");		return -1;	}	memcpy_fromio(priva->conf, priva->card, sizeof(struct arlan_shmem));	SARLBNpln(u_char, rxBuffer, 0x800);final:	*lenp = pos;	retv = proc_dostring(ctl, write, filp, buffer, lenp);	return retv;}static int arlan_sysctl_info18(ctl_table * ctl, int write, struct file *filp,			void *buffer, size_t * lenp){	int i;	int retv, pos, devnum;	struct arlan_private *priva = NULL;	pos = 0;	devnum = ctl->procname[5] - '0';	if (arlan_device[devnum] == NULL)	{		pos += sprintf(arlan_drive_info + pos, "No device found here \n");		goto final;	}	else		priva = arlan_device[devnum]->priv;	if (priva == NULL)	{		printk(KERN_WARNING " Could not find the device private in arlan procsys, bad\n ");		return -1;	}	memcpy_fromio(priva->conf, priva->card, sizeof(struct arlan_shmem));	SARLBNpln(u_char, _18, 0x800);final:	*lenp = pos;	retv = proc_dostring(ctl, write, filp, buffer, lenp);	return retv;}#endif				/* #ifdef ARLAN_PROC_SHM_DUMP */static char conf_reset_result[200];static int arlan_configure(ctl_table * ctl, int write, struct file *filp,		    void *buffer, size_t * lenp){	int pos = 0;	int devnum = ctl->procname[6] - '0';	struct arlan_private *priv;	if (devnum < 0 || devnum > MAX_ARLANS - 1)	{		  printk(KERN_WARNING "too strange devnum in procfs parse\n ");		  return -1;	}	else if (arlan_device[devnum] != NULL)	{		  priv = arlan_device[devnum]->priv;		  arlan_command(arlan_device[devnum], ARLAN_COMMAND_CLEAN_AND_CONF);	}	else		return -1;	*lenp = pos;	return proc_dostring(ctl, write, filp, buffer, lenp);}static int arlan_sysctl_reset(ctl_table * ctl, int write, struct file *filp,		       void *buffer, size_t * lenp){	int pos = 0;	int devnum = ctl->procname[5] - '0';	struct arlan_private *priv;	if (devnum < 0 || devnum > MAX_ARLANS - 1)	{		  printk(KERN_WARNING "too strange devnum in procfs parse\n ");		  return -1;	}	else if (arlan_device[devnum] != NULL)	{		priv = arlan_device[devnum]->priv;		arlan_command(arlan_device[devnum], ARLAN_COMMAND_CLEAN_AND_RESET);	} else		return -1;	*lenp = pos + 3;	return proc_dostring(ctl, write, filp, buffer, lenp);}/* Place files in /proc/sys/dev/arlan */#define CTBLN(num,card,nam) \        {num , #nam, &(arlan_conf[card].nam), \         sizeof(int), 0600, NULL, &proc_dointvec}#ifdef ARLAN_DEBUGGING#define ARLAN_PROC_DEBUG_ENTRIES	{48, "entry_exit_debug", &arlan_entry_and_exit_debug, \                sizeof(int), 0600, NULL, &proc_dointvec},\	{49, "debug", &arlan_debug, \                sizeof(int), 0600, NULL, &proc_dointvec},#else #define ARLAN_PROC_DEBUG_ENTRIES#endif#define ARLAN_SYSCTL_TABLE_TOTAL(cardNo)\	CTBLN(1,cardNo,spreadingCode),\	CTBLN(2,cardNo, channelNumber),\	CTBLN(3,cardNo, scramblingDisable),\	CTBLN(4,cardNo, txAttenuation),\	CTBLN(5,cardNo, systemId), \	CTBLN(6,cardNo, maxDatagramSize),\	CTBLN(7,cardNo, maxFrameSize),\	CTBLN(8,cardNo, maxRetries),\	CTBLN(9,cardNo, receiveMode),\	CTBLN(10,cardNo, priority),\	CTBLN(11,cardNo, rootOrRepeater),\	CTBLN(12,cardNo, SID),\	CTBLN(13,cardNo, registrationMode),\	CTBLN(14,cardNo, registrationFill),\	CTBLN(15,cardNo, localTalkAddress),\	CTBLN(16,cardNo, codeFormat),\	CTBLN(17,cardNo, numChannels),\	CTBLN(18,cardNo, channel1),\	CTBLN(19,cardNo, channel2),\	CTBLN(20,cardNo, channel3),\	CTBLN(21,cardNo, channel4),\	CTBLN(22,cardNo, txClear),\	CTBLN(23,cardNo, txRetries),\	CTBLN(24,cardNo, txRouting),\	CTBLN(25,cardNo, txScrambled),\	CTBLN(26,cardNo, rxParameter),\	CTBLN(27,cardNo, txTimeoutMs),\	CTBLN(28,cardNo, waitCardTimeout),\	CTBLN(29,cardNo, channelSet), \	{30, "name", arlan_conf[cardNo].siteName, \                16, 0600, NULL, &proc_dostring},\	CTBLN(31,cardNo,waitTime),\	CTBLN(32,cardNo,lParameter),\	CTBLN(33,cardNo,_15),\	CTBLN(34,cardNo,headerSize),\	CTBLN(35,cardNo,async),\	CTBLN(36,cardNo,tx_delay_ms),\	CTBLN(37,cardNo,retries),\	CTBLN(38,cardNo,ReTransmitPacketMaxSize),\	CTBLN(39,cardNo,waitReTransmitPacketMaxSize),\	CTBLN(40,cardNo,fastReTransCount),\	CTBLN(41,cardNo,driverRetransmissions),\	CTBLN(42,cardNo,txAckTimeoutMs),\	CTBLN(43,cardNo,registrationInterrupts),\	CTBLN(44,cardNo,hardwareType),\	CTBLN(45,cardNo,radioType),\	CTBLN(46,cardNo,writeEEPROM),\	CTBLN(47,cardNo,writeRadioType),\	ARLAN_PROC_DEBUG_ENTRIES\	CTBLN(50,cardNo,in_speed),\	CTBLN(51,cardNo,out_speed),\	CTBLN(52,cardNo,in_speed10),\	CTBLN(53,cardNo,out_speed10),\	CTBLN(54,cardNo,in_speed_max),\	CTBLN(55,cardNo,out_speed_max),\	CTBLN(56,cardNo,measure_rate),\	CTBLN(57,cardNo,pre_Command_Wait),\	CTBLN(58,cardNo,rx_tweak1),\	CTBLN(59,cardNo,rx_tweak2),\	CTBLN(60,cardNo,tx_queue_len),\static ctl_table arlan_conf_table0[] ={	ARLAN_SYSCTL_TABLE_TOTAL(0)#ifdef ARLAN_PROC_SHM_DUMP	{150, "arlan0-txRing", &arlan_drive_info,	 ARLAN_STR_SIZE, 0400, NULL, &arlan_sysctl_infotxRing},	{151, "arlan0-rxRing", &arlan_drive_info,	 ARLAN_STR_SIZE, 0400, NULL, &arlan_sysctl_inforxRing},	{152, "arlan0-18", &arlan_drive_info,	 ARLAN_STR_SIZE, 0400, NULL, &arlan_sysctl_info18},	{153, "arlan0-ring", &arlan_drive_info,	 ARLAN_STR_SIZE, 0400, NULL, &arlan_sysctl_info161719},	{154, "arlan0-shm-cpy", &arlan_drive_info,	 ARLAN_STR_SIZE, 0400, NULL, &arlan_sysctl_info},#endif	{155, "config0", &conf_reset_result, \	 100, 0400, NULL, &arlan_configure}, \	{156, "reset0", &conf_reset_result, \	 100, 0400, NULL, &arlan_sysctl_reset}, \	{0}};static ctl_table arlan_conf_table1[] ={	ARLAN_SYSCTL_TABLE_TOTAL(1)#ifdef ARLAN_PROC_SHM_DUMP	{150, "arlan1-txRing", &arlan_drive_info,	 ARLAN_STR_SIZE, 0400, NULL, &arlan_sysctl_infotxRing},	{151, "arlan1-rxRing", &arlan_drive_info,	 ARLAN_STR_SIZE, 0400, NULL, &arlan_sysctl_inforxRing},	{152, "arlan1-18", &arlan_drive_info,	 ARLAN_STR_SIZE, 0400, NULL, &arlan_sysctl_info18},	{153, "arlan1-ring", &arlan_drive_info,	 ARLAN_STR_SIZE, 0400, NULL, &arlan_sysctl_info161719},	{154, "arlan1-shm-cpy", &arlan_drive_info,	 ARLAN_STR_SIZE, 0400, NULL, &arlan_sysctl_info},#endif	{155, "config1", &conf_reset_result,	 100, 0400, NULL, &arlan_configure},	{156, "reset1", &conf_reset_result,	 100, 0400, NULL, &arlan_sysctl_reset},	{0}};static ctl_table arlan_conf_table2[] ={	ARLAN_SYSCTL_TABLE_TOTAL(2)#ifdef ARLAN_PROC_SHM_DUMP	{150, "arlan2-txRing", &arlan_drive_info,	 ARLAN_STR_SIZE, 0400, NULL, &arlan_sysctl_infotxRing},	{151, "arlan2-rxRing", &arlan_drive_info,	 ARLAN_STR_SIZE, 0400, NULL, &arlan_sysctl_inforxRing},	{152, "arlan2-18", &arlan_drive_info,	 ARLAN_STR_SIZE, 0400, NULL, &arlan_sysctl_info18},	{153, "arlan2-ring", &arlan_drive_info,	 ARLAN_STR_SIZE, 0400, NULL, &arlan_sysctl_info161719},	{154, "arlan2-shm-cpy", &arlan_drive_info,	 ARLAN_STR_SIZE, 0400, NULL, &arlan_sysctl_info},#endif	{155, "config2", &conf_reset_result,	 100, 0400, NULL, &arlan_configure},	{156, "reset2", &conf_reset_result,	 100, 0400, NULL, &arlan_sysctl_reset},	{0}};static ctl_table arlan_conf_table3[] ={	ARLAN_SYSCTL_TABLE_TOTAL(3)#ifdef ARLAN_PROC_SHM_DUMP	{150, "arlan3-txRing", &arlan_drive_info,	 ARLAN_STR_SIZE, 0400, NULL, &arlan_sysctl_infotxRing},	{151, "arlan3-rxRing", &arlan_drive_info,	 ARLAN_STR_SIZE, 0400, NULL, &arlan_sysctl_inforxRing},	{152, "arlan3-18", &arlan_drive_info,	 ARLAN_STR_SIZE, 0400, NULL, &arlan_sysctl_info18},	{153, "arlan3-ring", &arlan_drive_info,	 ARLAN_STR_SIZE, 0400, NULL, &arlan_sysctl_info161719},	{154, "arlan3-shm-cpy", &arlan_drive_info,	 ARLAN_STR_SIZE, 0400, NULL, &arlan_sysctl_info},#endif	{155, "config3", &conf_reset_result,	 100, 0400, NULL, &arlan_configure},	{156, "reset3", &conf_reset_result,	 100, 0400, NULL, &arlan_sysctl_reset},	{0}};static ctl_table arlan_table[] ={	{0, "arlan0", NULL, 0, 0600, arlan_conf_table0},	{0, "arlan1", NULL, 0, 0600, arlan_conf_table1},	{0, "arlan2", NULL, 0, 0600, arlan_conf_table2},	{0, "arlan3", NULL, 0, 0600, arlan_conf_table3},	{0}};#elsestatic ctl_table arlan_table[MAX_ARLANS + 1] ={	{0}};#endif#elsestatic ctl_table arlan_table[MAX_ARLANS + 1] ={	{0}};#endif// static int mmtu = 1234;static ctl_table arlan_root_table[] ={	{254, "arlan", NULL, 0, 0555, arlan_table},	{0}};/* Make sure that /proc/sys/dev is there *///static ctl_table arlan_device_root_table[] =//{//	{CTL_DEV, "dev", NULL, 0, 0555, arlan_root_table},//	{0}//};static struct ctl_table_header *arlan_device_sysctl_header;int init_arlan_proc(void){	int i = 0;	if (arlan_device_sysctl_header)		return 0;	for (i = 0; i < MAX_ARLANS && arlan_device[i]; i++)		arlan_table[i].ctl_name = i + 1;	arlan_device_sysctl_header = register_sysctl_table(arlan_root_table, 0);	if (!arlan_device_sysctl_header)		return -1;	return 0;};#ifdef MODULEint init_module(void){	return init_arlan_proc();};void cleanup_module(void){	unregister_sysctl_table(arlan_device_sysctl_header);	arlan_device_sysctl_header = NULL;	return;};#endif				// MODULEMODULE_LICENSE("GPL");

⌨️ 快捷键说明

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