CN101232522B - Network card driving method - Google Patents

Network card driving method Download PDF

Info

Publication number
CN101232522B
CN101232522B CN2008100598575A CN200810059857A CN101232522B CN 101232522 B CN101232522 B CN 101232522B CN 2008100598575 A CN2008100598575 A CN 2008100598575A CN 200810059857 A CN200810059857 A CN 200810059857A CN 101232522 B CN101232522 B CN 101232522B
Authority
CN
China
Prior art keywords
network interface
interface card
data
register
upper strata
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN2008100598575A
Other languages
Chinese (zh)
Other versions
CN101232522A (en
Inventor
廉玉平
韩雁
霍明旭
陈金龙
张艳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang University ZJU
Original Assignee
Zhejiang University ZJU
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang University ZJU filed Critical Zhejiang University ZJU
Priority to CN2008100598575A priority Critical patent/CN101232522B/en
Publication of CN101232522A publication Critical patent/CN101232522A/en
Application granted granted Critical
Publication of CN101232522B publication Critical patent/CN101232522B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Computer And Data Communications (AREA)

Abstract

The invention relates to a network card-driving method. The lack of flexibility in prior art causes a communication efficiency reduction between different modules. The method of the invention includes the following steps: configuring the register of the network card according to the timing requirements; initializing the network card according to the parameters required for specific work; monitoring whether the card gives an interruption message and the upper layer gives a sending enable message, and if not, the system is in the waiting state; if receiving the sending enable message from the upper layer, the system enters the data sending process; if receiving the interruption message from the network card, the system enters the handling interruption process; if the writing pointer of the card does not change, the system enters the data receiving process. The method introduces a response waiting mechanism and with the drive, the upper layer can stop the network card data transfer process momentarily only by sending a data ending signal to the card driver. The time-based method greatly increases the universal performance of network card drivers.

Description

A kind of network card driving method
Technical field
The invention belongs to technical field of integrated circuits, be specifically related to a kind of network card driving method.
Background technology
In the highly developed information age of network technology, played very important important function naturally as the network interface card of OSI (the basic reference model of Open System Interconnection) data link layer.Yet the network interface card interface signal of different company is not quite similar, and the network interface card sequential of different process, different model requires also different, and this brings very big negative effect to the flexibility that drives based on hard-wired network interface card.
Traditional network interface card drives the software program that is based on C or the design of other language, but if want the chip of autonomous Design and network interface card are communicated, and must realize configuration and control to network interface card with hardware circuit.It all is at the concrete application and the network interface card of specific model that general network interface card drives, basic procedure comprises: the network interface card initialization, the control of Interrupt Process flow process, transmission flow control, receive flow process and control this several aspects, and interface signal be difficult for with chip in different circuit module communicate, the complexity that this has increased interface signal undoubtedly causes the reduction of communication efficiency between the disparate modules.
Summary of the invention
The objective of the invention is at the deficiencies in the prior art, a kind of have easy transplanting, configurable, network card driving method with characteristics such as open interface are provided.
Network card driving method of the present invention comprises network interface card initialization flow process, data transmission flow, Interrupt Process flow process and Data Receiving flow process.
Network interface card initialization flow process is mainly used in the corresponding registers in the network interface card is configured, these registers mainly comprise network interface card mode of operation register, the read-write pointer register, the physical address register, the multicast address register, interrupt mask register, data format configuration register, send configuration register, receive configuration register.
The data transmission flow is finished the transmission of data between upper strata and network interface card, promptly from the upper strata read data packet, is transferred to network interface card then.
The transmission direction of data is bottom-up in the Data Receiving flow process, and promptly read data packet from network interface card is transferred to the upper strata then.When driving, network interface card detects when new packet is arranged in the network interface card, read the data in the network interface card, and write commencing signal to the upper strata and transmit data simultaneously, if receive the answer signal that the upper strata provides, this data that then shown acceptance that the upper strata is successful, can cancel the data of this FPDP this moment.Repeat this process, till new packet reads and finishes in network interface card.
Network interface card Interrupt Process flow process is mainly handled the interrupt signal of being sent here by network interface card, and enters corresponding handling process according to signal type.If network interface card drives when receiving the Data Receiving interruption, handle according to above-mentioned Data Receiving flow process, other interrupt type, as be sent completely interruption, transmission is wrong to be interrupted, and receives mistake interruption etc., notes this information and keeps supplying layer inquiry to determine corresponding operation.
The concrete steps of network card driving method of the present invention are:
1, according to the sequential requirement of network interface card, utilize the high-level retention time of high level counter register monitoring read-write enable signal, utilize the low level retention time of low level counter register monitoring read-write enable signal, configure the register of network interface card.Specifically: it is Tl that network interface card requires the low level retention time, then the initial value of low level counter register is made as Tl/Tp at least, it is Th that network interface card requires the retention time of high level, and then the initial value of high level counter register is made as Th/Tp at least, and wherein Tp is a system clock cycle; When configuration register, earlier the high level counter register is operated, system time of every mistake, the value of this high level counter register subtracts 1, when this value is kept to 0, the low level counter register is operated, system time of every mistake, the value of this low level counter register subtracts 1, when this value is kept to 0, finishes the data configuration of register.
2, according to the parameter of the concrete need of work of network interface card network interface card is carried out initialization.
3, whether monitoring has the transmission enable information that interrupting information that network interface card provides and upper strata provide, if do not have, then is in wait state and continues monitoring.
If 4 receive the transmission enable information that the upper strata provides, then enter the data transmission flow.Specifically: at first reading from the upper strata needs to send length of data package information, so that whether driving detects the data length of finally reading into consistent with the length that begins to provide, simultaneously this length information is write the data length register of network interface card so that network interface card carries out read operation; The data message that constantly upper strata is sent is written in the data register of network interface card according to concrete network interface card sequential then; Whenever write data, give the answer signal in upper strata, so that the upper strata in time cancels read data and write new data, until the end signal of receiving that the upper strata provides.
If 5 receive the interrupting information that network interface card provides, then enter the Interrupt Process flow process.If the write pointer of network interface card does not change, represent that this interrupting information is not new Frame, then this interrupting information is noted in order to the upper-layer user and carried out interrupt inquiry, remove network interface card simultaneously and interrupt.If write pointer changes, represent that this interrupting information is new Frame, then enters step 6.
When 6, this interrupting information is new Frame, from the data length register of network interface card, read the length information of this Frame, sense data from the data register of network interface card then, and these data are write the upper strata, whenever write data after, enter wait state; When the upper strata provides an answer signal, stop wait state, the length information of this Frame is subtracted 1, constantly repeating this process, is 0 up to the length information of Frame, shows that whole Frame reads to finish, send a Frame end of transmission signal to the upper strata, end data receives flow process.
Network card driving method of the present invention has following feature:
When there was the request signal of transmission the outside, the network interface card router carried out the configuration of relevant parameter, reads length information and provides answer signal by the data/address bus port.Network interface card is given if want to transmit data in the upper strata subsequently, as long as in the data/address bus port, write corresponding data and provide the transmission enable signal, this enable signal must wait until that the network interface card router provides corresponding answer signal and just can cancel, whole like this process has just been finished the transmission of data, the upper strata is if want to finish the process of transmitting of network interface card, must provide corresponding end signal such as data spacing wave, then network interface card drives the process of transmitting configuration that automatically performs network interface card, thereby has finished outside control to the network interface card transmission flow.
When network interface card sent interrupt requests, the disconnected type of network interface card interrupt handling routine automatic centering detected and judges next step treatment step.Interrupt if not receive, then write down corresponding interrupting information, remove the interrupt register of network interface card simultaneously in order to the upper strata inquiry.If there is packets need to send the upper strata to, then provide the write data enable signal, simultaneously be ready to new frame data in FPDP, when the upper strata provided the answer signal that Data Receiving finishes, network interface card was accepted flow process and is cancelled enable signal and prepare transmission next frame data.During the reception of data, network interface card drives and provides corresponding end signal and network interface card is carried out the relevant parameters configuration in all finishing the network interface card buffering area.
For the chip or the circuit that will use network interface card as communication link, the control that network interface card provides, data and address wire are asynchronous signals with respect to this chip.It is different that different network interface card read-write sequences requires, and the network card driving method among the present invention provides configurable read-write cycle and data to set up and the retention time, can realize freely controlling exchanges data speed between network interface card and the chip.This function realizes by add two control registers in network interface card drives, a register is the high level counter register, be used to write down the high-level retention time of reading to enable and write enable signal of giving network interface card, another register is the low level counter register, is used to write down the low level retention time of reading to enable and write enable signal of giving network interface card.
The read-write operation of the configuration of the concrete parameter of register and register etc. is a basic fundamental general knowledge among the present invention, adopts the current techique means.Inventive point of the present invention is to provide a kind of data transfer control method that network interface card drives versatility that strengthens.
The data processing speed of different system is inequality, the speed that the data transmission bauds on upper strata and network interface card can receive generally is inequality, typical design philosophy is to add the data storage area, the upper strata is responsible for data are write this memory block, the network interface card driving is read these data and is transmitted according to the transmission rate of ad hoc networks calorie requirement, but if the processing speed of upper layer module changes or changes after the network interface card, the capacity of this data storage area also just needs to change, and this has just influenced the versatility that network interface card drives greatly.
The present invention has introduced and has replied waiting mechanism, when upper layer data is received in the network interface card driving, provide answer signal, these data of notice upper strata finish receiving, can transmit next data, the upper strata can utilize the data transmission procedure of this driving end to network interface card at any time, only need send the ED signal to the network interface card driving and get final product.This time-based method has strengthened the versatility that network interface card drives greatly.
Description of drawings
Fig. 1 is the flow chart of inventive method;
Fig. 2 is the flow chart of data transmission flow among Fig. 1;
Fig. 3 is the flow chart of Interrupt Process flow process and Data Receiving flow process among Fig. 1.
Embodiment
Further specify the inventive method below in conjunction with the drawings and specific embodiments.
Select the 10M/100M self adaptation Ethernet of the AX88796L of ASIX company in the present embodiment.This network interface card is supported ISA, 80186, and 68K and 8,051 four kinds of cpu types, we select isa bus explanation.Network interface card requires writing of register to enable the minimum 60ns of being of low level retention time, and the high-level retention time minimum is 100ns.Our supposing the system operating frequency is that 50Mhz is to be 20ns in the cycle.
As Fig. 1, the idiographic flow of network card driving method is:
1, according to network interface card high-low level retention time and system works frequency, draw system clock cycle Tp=20ns, low level retention time Tl=60ns, then the value of low level counter register is made as 3 (Tl/Tp=60/20); Equally, the retention time of high level is Th=100ns, and then the value of high level counter register is made as 5 (Th/Tp=100/20).When the specific design network interface card drove, these two registers can all be made as 8 bit bit wides, satisfy the different model network interface card, the requirement of different system operating frequency as far as possible.During the work of network interface card driver module, earlier the high level counter register is operated, system time of every mistake, the value of this high level counter register subtracts 1, when this value is kept to 0, the low level counter register is operated, system time of every mistake, the value of this low level counter register subtracts 1, when this value is kept to 0, finishes the data configuration of register.
2, network interface card is carried out initialization, this step mainly disposes the parameter of AX88796L network interface card need of work, can be configured according to following flow process:
1) read the reset mode register, and wait for that nearly 2ms waits for resetting and finish, the reset mode register can only carry out read operation and realizes resetting to network interface card here;
2) select the 0th page by write 21H to command register CR, and then can dispose the register of this page, comprise the start pointer that sends buffering area, stop pointer, read pointer, write pointer interrupts enabling interrupt status register etc.;
3) be not subjected to the influence of extraneous interrupt status for following layoutprocedure, realize the shielding interrupted by status register being write 00H;
4) configuration DCR (data configuration register), the data-transmission mode that mainly disposes DMA is the byte form or the form of word, as writes 01H selection word transmission form;
5) write 46H to receiving start pointer;
6) write 80H to receiving end pointer;
7) write 46H to read pointer;
8) with interrupt status register clear 0;
9) select the 1st page by write 61H to command register CR, and then can dispose the register of this page, as physical address, multicast address etc.;
10) configures physical address register PAR0~PAR6, multicast address register MAR0~MAR7, these values are configured according to concrete system requirements, can be configured to 192.168.83.200 as IP;
11) write 47H to write pointer;
12) read the value of scratchpad register, determine whether network interface card chooses network speed automatically, if lowest order is 0, does not show to configure, wait for, otherwise, illustrate to have configured, can proceed following layoutprocedure;
13) configuration TPSR register writes appropriate value and determines the transmission page address, as 40H;
14) open interruption and enable, guarantee that as required network interface card detects corresponding interrupt signal;
15) by being write 22H, command register CR starts network interface card work;
Be the initialized whole flow processs of network interface card above, in the time of need resetting network interface card on the upper strata, the input signal EnaConfig that can reset for startup of network interface card starts this initialization flow process, after network interface card finishes the initialization flow process, provides a DONE signal.
3, whether monitoring has the transmission enable information that interrupting information that network interface card provides and upper strata provide, if do not have, then is in wait state and continues monitoring.
4, if receive the transmission enable signal that the upper strata provides, then send data manipulation, adopt following acknowledgement mechanism.
As Fig. 2, whether whether at first reading from the upper strata needs to send length of data package information, consistent with the length that begins to provide so that driving detects the data length of finally reading into, simultaneously this length information is write the length information register of network interface card; Start the transmission flow of network interface card and constantly monitor the data message that send on the upper strata, if the upper strata provides one and sends enable signal, data in the driver module read data ports and these data are written in the data register of network interface card according to the sequential described in the step 1, when this transfer of data finishes, give the answer signal in upper strata, so that the upper strata is in time cancelled read data and write new data, constantly repeat this process.When receiving the end signal that the upper strata provides, end checks also to the data transfer operation of network interface card whether whether the length that writes consistent with the length information of beginning, if it is inconsistent, with the data dump in the network interface card and to the rub-out signal in upper strata, network interface card sends if unanimity then writes the 26H startup in command register CR.
If 5 receive the interrupting information of network interface card, then enter the Interrupt Process flow process.If the write pointer of network interface card does not change, represent that this interrupting information is not new Frame, then this interrupting information is noted in order to the upper-layer user and carried out interrupt inquiry, remove network interface card simultaneously and interrupt.If write pointer changes, represent that this interrupting information is new Frame, then enters step 6.
6,, when this interrupting information is new Frame, at first reads this length of data package information, and this length information is recorded local register as Fig. 3.The value of this data length register is used for control reception flow process and when finishes, when driver module was whenever read data, pointer added 1, when the value of the data number that reads and this data length register equates, illustrate that these frame data all read, stop reception operation network interface card.Secondly, when reading a new data from network interface card, all send an enable signal to the upper strata, the data of notice upper layer data port are upgraded at every turn, can carry out reading of new data, if the upper strata provides an answer signal, illustrate that the upper strata is correctly corresponding, at this moment, driver module is cancelled the enable signal to the upper strata, and read new data in the network interface card again, constantly repeat this process, thereby finish whole receiving course until the new data in the network interface card is run through.At last,, give the end signal of the packet end of transmission in upper strata, finish whole reception flow process when the new data in the network interface card reads when finishing.
Among the present invention, the sequential configurability that network interface card drives mainly is to realize by high level counter register in the step 1 and low level counter register.In the transmission course, the high level of enable signal and low level retention time are to finish by the mode of clock count.The easy transplantability that network interface card drives is replied the waiting mechanism realization by introducing in data transmission procedure.In the whole transmission course, the transmission of each data all is that by the time the other side sends answer signal and just cancels data on the data/address bus, and this has just been avoided the introducing of traditional data storage area, has saved hardware area.And the transfer of data between driving and the network interface card can be controlled by said high level counter register in front and low level counter register, so can't bring too big time delays.

Claims (1)

1. a network card driving method comprises network interface card initialization flow process, data transmission flow, Interrupt Process flow process and Data Receiving flow process, it is characterized in that the concrete steps of this network card driving method are:
A. according to the sequential requirement of network interface card, utilize the high-level retention time of high level counter register monitoring read-write enable signal, utilize the low level retention time of low level counter register monitoring read-write enable signal, configure the register of network interface card, specifically: it is Tl that network interface card requires the low level retention time, then the initial value of low level counter register is made as Tl/Tp at least, it is Th that network interface card requires the retention time of high level, then the initial value of high level counter register is made as Th/Tp at least, and wherein Tp is a system clock cycle; When configuration register, earlier the high level counter register is operated, system time of every mistake, the value of this high level counter register subtracts 1, when this value is kept to 0, the low level counter register is operated, system time of every mistake, the value of this low level counter register subtracts 1, when this value is kept to 0, finishes the data configuration of register;
B. according to the parameter of the concrete need of work of network interface card network interface card is carried out initialization;
C. whether monitoring has the transmission enable information that interrupting information that network interface card provides and upper strata provide, if do not have, then is in wait state and continues monitoring;
If d. receive the transmission enable information that the upper strata provides, then enter the data transmission flow, specifically: at first reading from the upper strata needs to send length of data package information, simultaneously this length information is write the data length register of network interface card; The data message that constantly upper strata is sent is written in the data register of network interface card according to concrete network interface card sequential then; Whenever write data, give the answer signal in upper strata, until the end signal of receiving that the upper strata provides;
If e. receive the interrupting information that network interface card provides, then enter the Interrupt Process flow process; If the write pointer of network interface card does not change, represent that this interrupting information is not new Frame, then this interrupting information is noted, remove network interface card simultaneously and interrupt; If write pointer changes, represent that this interrupting information is new Frame, then enters step f;
When f. this interrupting information is new Frame, from the data length register of network interface card, read the length information of this Frame, sense data from the data register of network interface card then, and these data are write the upper strata, whenever write data after, enter wait state; When the upper strata provides an answer signal, stop wait state, the length information of this Frame is subtracted 1, constantly repeat this process, be 0 up to the length information of Frame, send a Frame end of transmission signal to the upper strata, end data receives flow process.
CN2008100598575A 2008-02-22 2008-02-22 Network card driving method Expired - Fee Related CN101232522B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2008100598575A CN101232522B (en) 2008-02-22 2008-02-22 Network card driving method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2008100598575A CN101232522B (en) 2008-02-22 2008-02-22 Network card driving method

Publications (2)

Publication Number Publication Date
CN101232522A CN101232522A (en) 2008-07-30
CN101232522B true CN101232522B (en) 2010-06-16

Family

ID=39898694

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2008100598575A Expired - Fee Related CN101232522B (en) 2008-02-22 2008-02-22 Network card driving method

Country Status (1)

Country Link
CN (1) CN101232522B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104519599A (en) * 2013-09-30 2015-04-15 宁夏先锋软件有限公司 USB wireless network card capable of displaying time and generating sound
EP2924522B1 (en) * 2014-03-28 2016-05-25 dSPACE digital signal processing and control engineering GmbH Method for influencing a control program
CN104079432A (en) * 2014-06-20 2014-10-01 珠海市君天电子科技有限公司 Method and device for processing abnormity of network equipment
CN108712290A (en) * 2018-05-25 2018-10-26 北京无线电测量研究所 network card driving method, device and storage medium
CN109714600B (en) * 2019-01-12 2020-05-26 贵州佰仕佳信息工程有限公司 Compatible big data acquisition system
CN110413328B (en) * 2019-07-24 2022-05-24 苏州浪潮智能科技有限公司 PXE function enabling method and device for network card port and related equipment
CN113360191B (en) * 2020-03-03 2022-05-27 杭州海康威视数字技术股份有限公司 Driving device of network switching chip

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1410890A (en) * 2001-10-08 2003-04-16 联想(北京)有限公司 Method of operating netcard nucleus driving program under user's mode
CN1661998A (en) * 2004-02-26 2005-08-31 阳庆电子股份有限公司 Method for setting online parameter for wireless network card in dual modes
CN1992732A (en) * 2005-12-30 2007-07-04 英业达股份有限公司 Network card automatic configuration system and method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1410890A (en) * 2001-10-08 2003-04-16 联想(北京)有限公司 Method of operating netcard nucleus driving program under user's mode
CN1661998A (en) * 2004-02-26 2005-08-31 阳庆电子股份有限公司 Method for setting online parameter for wireless network card in dual modes
CN1992732A (en) * 2005-12-30 2007-07-04 英业达股份有限公司 Network card automatic configuration system and method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
JP特開2005-347894A 2005.12.15

Also Published As

Publication number Publication date
CN101232522A (en) 2008-07-30

Similar Documents

Publication Publication Date Title
CN101232522B (en) Network card driving method
CN104811273B (en) A kind of implementation method of high speed monobus communication
CN106951388B (en) PCIe-based DMA data transmission method and system
CN100481043C (en) Method, system, and program for handling input/output commands
CN102696021B (en) Interface clock manages
EP0378426B1 (en) Data transfer using bus address lines
US20080162773A1 (en) Apparatus and methods for multiple unidirectional virtual connections among sas devices
US20150074304A1 (en) Apparatus and method for polling addresses of one or more slave devices in a communications system
JPH02227766A (en) Data transfer apparatus for digital computer
EP2499574A1 (en) Apparatus and method for polling addresses of one or more slave devices in a communications system
CN105677598B (en) The module and method of multiple MEMS sensor data are quickly read based on I2C interface
JP4739349B2 (en) Multimedia card interface method, computer program, and apparatus
CN102968396B (en) Dedicated data transmission module from Flash chip to sram chip
CN115729870A (en) Efficient PCIE DMA data transmission method based on FPGA
CN102567272A (en) Method for improving working frequency of SPI (Serial Peripheral Interface) circuit
CN101122894A (en) Asynchronous serial communication control device
US6889265B2 (en) Apparatus and method to allow and synchronize schedule changes in a USB enhanced host controller
CN109522251A (en) A kind of high-speed synchronous serial port board and its working method based on PXIe bus
CN111026691B (en) OWI communication equipment based on APB bus
CN107608927B (en) Design method of LPC bus host port supporting full function
CN107870885A (en) Communication system, device and method
CN101436119A (en) System and method for media card communication
US20220358079A1 (en) I2c bus architecture using shared clock and dedicated data lines
US10572439B1 (en) I3C read from long latency devices
EP1988463A1 (en) Memory control apparatus and memory control method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C17 Cessation of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20100616

Termination date: 20130222