• Based on DSP network service programming

    Abstract: Through analyzes the network card basic course of communications control and the digital signal processor (DSP) to the network card direct programming method, the success design based on the DSP network service procedure, thus realizes the DSP system digitization and the network fusion finally.

        Key word: DSP network service procedure communication protocol network card

    The DSP chip is to realize specially, has the special structure microprocessor which each kind of digital signal processing algorithm designs, its remarkable performance, rises unceasingly the performance-to-price ratio, consummates day after day the development way causes its application to be getting more and more widespread. The computer network technology introduction take DSP as the core embedded system, causes it to become the digitization, the network to unify, the collection correspondence, the computer and the seeing and hearing function in body’s electronic products, must promote the DSP system’s application value and the market prospect greatly. Unify the DSP technology and the networking, must solve two key questions: First, realizes DSP and network card’s hardware interface technology; second, based on DSP network service programming. DSP and network card’s hardware interface technology reference [1] has the quite exhaustive elaboration, the following main discussion based on the DSP network service programming.

    1 communication protocol formulation

    The agreement is uses for to manage the correspondence the laws and regulations, is foundation which the network system function realizes. Because DSP may realize to network card’s direct operation, corresponded in the OSI network model, the network card has contained the physical level and the data link layer complete content, therefore, had stipulated on the data link layer the data frame seal form, might for between the random stand correspondence provide the concrete standard based on the DSP confined network. Because the ethernet is one which of local area network most receives now welcome, in the ethernet, the network card uses in realizing 802.3 regulations, its typical representative is Novell Corporation’s NE2000 and network cards and so on 3COM Corporation’s 3C503, therefore in research work’s concrete experimental platform is take DSP as the core constitution ether local area network, mainly uses in the pronunciation the real-time communication, uses the network card is Novell Corporation’s NE2000 network card. NE2000 network card’s basic composition audience reference [2], its core component is the network interface controller (NIC) DP8390. This component has three parts of functions: First is IEEE802.3MAC (media access control) sublayer agreement logic, realizes the data frame seal and de-archiving, CSMA/CA (belt collision measuring ability carrier interception multiple access turning on) functions and so on agreement as well as CRC verification; Second is the register piles, the user mainly through piles each kind of order register programming to the NE2000 network card course of communications’s control to these registers to realize; Third is to the network card on the cushion RAM read-write control logic. The DP8390 transmission and the receive use the standard the IEEE802.3 frame form. IEEE802.3 has referred to ethernet’s agreement and the technology standard, but has made the revision to data packet’s basic structure, was mainly the type field turned the length field. Therefore, as in the core local area network corresponds data packet basic format as shown in Figure take DSP 1.

    DSP readout package and pack from destination address start. The destination address uses for to indicate a data frame in the network the goal node address which transmits. NE2000 supports 3 kind of destination addresses: Single-address, group address and cast address. The single-address indicated that has 1 node to be possible to receive this information; The group address expressed that most may have 64 byte receive identical frame information; But the cast address expresses it to be possible by the identical network in all festival receive. The source address is transmits the frame node the physical address, it can only be the single-address. The destination address and the source address refer to network card’s hardware address, also calls the physical address.

    After the source address’s 2 bytes expressed that this frame’s data length, only expressed data part’s length, fills in by user. The data field is composed of 46~1500 bytes. Is bigger than 1500 bytes data to divide into many frames to transmit; When is smaller than 46 bytes, must fill to 46 bytes. The reason has two: First, guaranteed that from the destination address field to the frame verification field length is 64 byte shortest frame sizes, with the aim of differentiating in channel’s effective frame and the hash; Second, for when prevents a station transmission short frame, when the first bit not yet arrives at main line’s most far-end completes the frame transmission, thus is possibly having time the collision does not examine the conflict signal. The NE2000 docking receives after the destination address field is smaller than 64 bytes frames thought that is “the fragment”, and deletes. In the data field, according to system’s concrete function request, the user may reserve certain bytes to stipulate the corresponding agreement, with the aim of corresponding both sides to rest on the information which in these bytes contains to realize the different function.

    2 based on DSP network service programming

    If based on the network operating system, the user may use some softwares to network operating system’s support, compiles the outstanding network service procedure very easily, but these procedures must attach in the network operating system. But under the DSP environment, must the inquire deeply network interface controller (NIC) principle of work [2], through programs directly to the network, realizes in the local area network between the random stand correspondence to abandon the network operating system completely.

    DSP is DSP each kind of register carries on the programming control to network card’s course of communications control to DP8390, completes the data grouping the correct transmission and the receive. The DP8390 all internal register is 8, the reflection to 4 pages. Each page has 16 to be possible to supply the read-write the register address (RA=00H~0fH). Page’s choice by the order register CA control. The 0th page of register uses in receiving and dispatching the process, the 1st page of register mainly uses in DP8390 the initialization, the 2nd page of register uses in the ring circuit diagnosis. DSP is takes to register’s operation the register DSP the port equipment, its actual physics port address (PPA) is the network card basic I/O port address (BIOA) and the register address (RA) the sum (i.e. PPA=BIOA RA). What should pay attention, between PPA and the register does not have 11 corresponding relationships, reads the operation to PPA with to write the operation not necessarily is carries on to the identical register, this kind of situation in the 0th page especially obvious. The user data grouping is alternately realizes in DSP and the network card through network card’s data port, may also use the DMA way also to be possible to use the PIO way read-in data grouping or to deliver the data grouping to the network card RAM buffer. In this system, DSP selects the DMA method to carry on the data read-write to the network card. Network card’s data port address (NDPA) is the network card basic I/O address (BIOA) adds offset address 10H (i.e. NDPA=BIOA 10H).

    The network card course of communications control may divide into the network card initialization, the receive to control and to transmit the control. Below gives to discuss separately.

    2.1 network card initialization

    The network card initialization’s primary mission is the register condition which the establishment needs, determined that transmits and receives the condition, and carries on the division to network card buffer RAM, establishes receives and transmits the cushion link. The concrete process please refer to reference [2]. What needs to explain, each network card entrusts with a physical address, with the aim of corresponding stand marking. This physical address has network card’s PROM (memory address is 0000~0005H) in six units, when network card initialization, reads in the DSP memory through long-distance DMA, and sends in the network card physical address register. Lies in a step significance: At the same time, if can read out network card’s physical address correctly, then the explanation network card hardware does not have the question basically, network card’s on electricity replacement and DSP pass smoothly to network card’s initialization; On the other hand, this physical address may use in DSP network system’s roll-call, package’s services and so on filtration discarding, i.e., the source address which and the destination address specified data newspaper carries according to the data frame comes in the link level from where, whether to receive or discarding. When network card initialization another important work receives the cushion link’s establishment, to use the buffer effectively, NIC will receive the buffer RAM looping cushion structure, as shown in Figure 2.

        Receive buffer RAM divides into many 256 byte buffers, N (N is most greatly 256) such buffer links in a logical cushion link through the indicator control. The cushion link’s start page address stores the PSTART register, surrounded the page end address to store the PSTOP register. PSTART and PSTOP have determined the receive cushion link’s size and the boundary. In order to be advantageous for the cushion link read-write operation, but also needs 2 indicators: Current page indicator CURR and boundary indicator BNRY. CURR determined that the next package places where, plays the cushion link to write the page indicator role; The BNRY direction has not taken the data packet outset page which after DSP processing arrives most early, the new receive’s data packet cannot its cover, play the cushion link to read the page indicator’s role. That is, CURR might tell the data grouping which the user the network card received current to put any position, but BNRY used in determining that DSP read the cushion link to any place. Because the receive buffer is the toroidal frame, when BNRY and CURR are equal, possibly surrounds the buffer possibly completely also spatial. In order to enable NIC to distinguish these two conditions, when gauge settled BNRY is equal to CURR, only then thought that the link buffer is full; When buffer free time, CURR compared to BNRY indicator value big 1. Therefore, when initialization establishes: BNRY=PSTART, CURR=PSTART 1. By now the read-write indicator was inconsistent, to guarantee that the correct read-write operation, introduces a software indicator NEXTPK instruction next package of outset page. Obviously, when initialization NEXTPK=CURR. By now, the cushion link read the indicator to NEXTPK, but BNRY is only saves the grouping buffer the outset page boundary to instruct, its value is NEXTPK-1.

    2.2 receive controlled process

    DSP completes after the DP8390 initialization, the network card is at the accepting state, once receives the grouping, automatically carries out local DMA, the FIFO data sends in the receive cushion link NIC, then applies for “the data grouping to the main engine to receive” the interrupt request. If DSP response interrupt, then starts network card long-distance DMA to read, reads in the student machine memory block the network card buffer’s in data grouping, then to receives the cushion to surround CURR, NEXTPK, the BNRY indicator content to make the revision, so that the network card can from on-line correct receive following grouping. After DSP response network card receive interrupt, the receive controlled process is as follows:

    ①Establishes long-distance DMA the start address; RSAR0=00H, RSAR1=Nextpk.

    ②Establishes the long-distance DMA operation the byte count, this length acts according to itself specific request in 46~1500 bytes scopes to determine.

    ③0AH loses one’s life makes register CR, start long-distance DMA to read.

    ④Reads in the data grouping in order from the network card data port, the attention, reads in first 4 byte non-data grouping content, the 1st byte is the accepting state, the 2nd byte for next package of page address pointer, 3 and 4 bytes for receive byte count. The 2nd byte content should send in Nextpk, other byte basis user request processing.

    ⑤Revises boundary indicator BNRY=Nextpk-1.

    ⑥Eliminates long-distance DMA byte count register RBCR0 and RBCR1.

    2.3 transmission controlled process

    DSP carries out long-distance DMA to write the operation first, passes on the memory in data grouping to the network card transmission buffer, then the start routing directive carries on the data grouping transmission. The transmission controlled process is as follows:

    ①Establishes long-distance DMA the start address for the network card transmission buffer start address;

    ②Establishes the long-distance DMA operation the byte count;

    ③12H loses one’s life makes register CR, start long-distance DMA to write;

    ④Sends out the data grouping in order to the network card transmission buffer;

    ⑤Eliminates the long-distance DMA byte count register;

    ⑥Establishment transmission byte count register TBCR0 and TBCR1;

    ⑦12H loses one’s life makes register CR, the log-on data grouping transmission.

    3 transmitting end sampling frequency control

    The transmitting end sampling frequency’s correct control mainly protects two points: One has a smallest transmission time gap, otherwise because the receiving end will not be able to receive promptly causes the system paralysis; Second, the sampling frequency can the foot concrete function realize the request. For example in the pronunciation real-time communication, the sampling frequency is decided by sound card’s sampling frequency. When 8kHz sampling frequency, the sound card each second sampling 8000 bytes, use 1024 bytes need when 128ms, if the communication protocol stipulated that transmits 1 time to transmit 1024 byte valid data, then must each 128ms transmit one time can guarantee that the buffer has the recent data to treat the transmission, can also guarantee that the receiving end has the recent data broadcast. 128ms is a theoretical calculation value, between the sampling speed and the sampling frequency always cannot match completely in the actual operation, but stores the data the buffer size is limited, if does not have the good control skill to realize the correct transmission, will create the sound vibration and the time delay. Solution is the double buffering technique and the double indicator control, and sends in the different transmission correspondence after between the sampling speed and sampling frequency’s match situation to carry on processing transmits. The correct transmission’s meaning has two aspects; first, each time transmits is the recent data; second, can satisfy the receiving end always to broadcast the recent data the demand.

    4 receiving ends prevent the data packet the loss

    Because DSP through the interrupt request judges whether to have the data to group the arrival, if interrupts busily, but two data packet arrival time difference is short, DSP has the possibility only to respond an interrupt, thus causes the drop the occurrence. Analysis network card receive data process, when the network card receives the data grouping, first carries out local DMA, the FIFO data sends in the receive cushion link NIC, and deposits the local DMA operation’s start address in the current page register (CURR) and the current local DMA register (CLDA0, CLDA1), DSP from the network card receive cushion link readout to the memory said that the long-distance DMA operation, instructs long-distance DMA with software indicator Nextpk the outset page. Therefore through compares network card local DMA and the long-distance DMA current address, namely compares CURR and the Nextpk indicator in the interrupt servicing subroutine, or compares CLDA0, CLDA1 and the Nextpk indicator, may guarantee where the current data grouping did put to go study arrives at where, thus prevented the drop the occurrence.

    5 conclusions

    DSP realized to the network card course of communications control has solved in the DSP network between the random stand, DSP network and between PC machine accurate, high speed real-time communication question, was applies the networking in the DSP digitization system’s key, thus finally has realized take DSP as the core processing system digitization and the network fusion.

    Share/Save/Bookmark

    Tuesday, July 8th, 2008 at 03:42
No comments yet.

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

TOP
Copyright © 51 Research and Design, Electronic Engineers website - Embedded Systems, MCU, DSP, EDA, Test and Measurement, Components, Communications, Power, Microelectronics, Semiconductors
Powered by WordPress | Theme by mg12 | Valid XHTML 1.1 and CSS 3