WO2016155540A1 - 一种总线仲裁的方法、装置及系统 - Google Patents

一种总线仲裁的方法、装置及系统 Download PDF

Info

Publication number
WO2016155540A1
WO2016155540A1 PCT/CN2016/076965 CN2016076965W WO2016155540A1 WO 2016155540 A1 WO2016155540 A1 WO 2016155540A1 CN 2016076965 W CN2016076965 W CN 2016076965W WO 2016155540 A1 WO2016155540 A1 WO 2016155540A1
Authority
WO
WIPO (PCT)
Prior art keywords
bus
arbitration
working
working device
waiting time
Prior art date
Application number
PCT/CN2016/076965
Other languages
English (en)
French (fr)
Inventor
张兴星
李晓初
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2016155540A1 publication Critical patent/WO2016155540A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/14Handling requests for interconnection or transfer
    • G06F13/36Handling requests for interconnection or transfer for access to common bus or bus system

Definitions

  • the present invention relates to the field of bus arbitration, and in particular, to a method, device and system for bus arbitration.
  • a bus arbitration mechanism is generally used to manage devices or modules in the system that may occupy the bus to achieve simultaneous multiple devices or modules.
  • bus arbitration is achieved by the preemption of the bus by each host, that is, the bus is always occupied by the first preempted host. This may cause some hosts to never occupy the bus. This method cannot guarantee the fairness of bus occupation.
  • the bus arbitration device adjusts the priority of each device access request according to the waiting time of each device access request, and assigns the priority of the access authority according to the priority of each access request from highest to lowest. .
  • the scheme can balance the difference of each access request and avoid the access priority of the access request with low priority, the fairness of the bus occupation can be guaranteed.
  • the bus must be equipped with a bus arbitration device, and it is impossible to increase or decrease all the devices on the bus. .
  • the bus request goes through the out-of-band channel Submitted to the bus arbitration device, the goal of the minimum interconnection is not achieved.
  • the invention provides a method, a device and a system for bus arbitration, which can solve the problem that the interconnection between the devices in the system is less and the bus is occupied fairly in the prior art.
  • a first aspect of the present invention provides a method of bus arbitration, the method being applied to a working device that currently occupies a bus in a system for bus arbitration, the system further comprising a candidate device, wherein the candidate device is the system All devices other than the working device, the method includes:
  • the bus is released such that the device with the shortest arbitration waiting time in the candidate device occupies the bus.
  • the method further includes:
  • the occupancy sequence ring is used to indicate an order in which each device in the system occupies the bus
  • the arbitration waiting time of the working device is set to the most Large arbitration waiting time Tmax;
  • the maximum arbitration waiting duration is obtained by adding a device constant value to a working identification number of the working device.
  • the occupation sequence ring is formed by arranging the maximum arbitration waiting time length Tmax of all devices in the system from small to large.
  • the arbitration waiting time length Twait is determined by the identification number of the candidate device and the working The identification numbers are added or subtracted;
  • the maximum arbitration waiting time of the working device is Tmax ⁇ 2Nmax-1, and the Tmax of the working device is greater than the arbitration waiting of each candidate device in the system. Duration Twait.
  • the working device is the shortest Tmax in the system after the system is cold-started
  • the method before the broadcasting the working identification number of the working device to the candidate device, the method further includes:
  • the working device starts timing, and monitors a bus state of the bus. When it is determined that the timing value obtained by the timing is greater than or equal to its own Tmax, determining that the bus state is a bus idle state, the working device occupies the bus. And by using the bus to broadcast the bus occupation identifier and the work identification number of the working device.
  • the method further includes:
  • the any device broadcasts an end identifier through the bus
  • the any device When it is determined that data needs to be transmitted, the any device transmits data over the bus and broadcasts the end identification through the bus.
  • a second aspect of the present invention provides a device for bus arbitration, which is applied to a working device that currently occupies a bus in a system for bus arbitration, and the system further includes a candidate device.
  • the candidate device is all devices in the system except the working device, and the device includes:
  • a transmission unit configured to broadcast a working identification number of the working device to the candidate device, so that each of the candidate devices obtains a corresponding arbitration waiting time according to the identification number of the device and the working identification number;
  • a transmission unit for transmitting data through the bus
  • a releasing unit configured to release the bus after the transmitting unit finishes transmitting the data, so that a device with the shortest arbitration waiting time in the candidate device occupies the bus.
  • the apparatus further includes a processing unit, where the processing unit is configured to perform one of the following steps:
  • the occupancy sequence ring is used to indicate an order in which each device in the system occupies the bus
  • the maximum arbitration waiting duration is obtained by adding a device constant value to a working identification number of the working device.
  • the occupying sequence ring is spliced by a maximum arbitration waiting time length Tmax of all devices in the system from small to large. form.
  • the arbitration waiting time length Twait is determined by the identification number of the candidate device and the working The identification numbers are added or subtracted;
  • the maximum arbitration waiting time of the working device is Tmax ⁇ 2Nmax-1, and the Tmax of the working device is large.
  • the arbitration wait time Twait of each candidate device in the system is Nmax.
  • the working device is the shortest Tmax in the system after the system is cold-started Device, the device further includes:
  • a monitoring unit configured to start timing after detecting the cold start of the system, and monitor a bus state of the bus
  • the processing unit is further configured to: when determining that the timing value obtained by the monitoring unit is greater than or equal to its own Tmax, determining that the bus state is bus idle, occupying the bus;
  • the transmission unit is further configured to broadcast, by using the bus, a bus occupation identifier and an identification number of any one of the devices;
  • the processing unit determines that data is not required to be transmitted, the end identifier is broadcasted by the bus;
  • a third aspect of the invention provides a bus arbitration system, characterized in that the system comprises at least two of the following means:
  • the present invention broadcasts the working identification number to the candidate device through the working device, so that each of the candidate devices obtains a corresponding arbitration waiting time according to the own identification number and the working identification number, Determining, in the candidate device, a target device that has the shortest waiting time, and after transmitting the data through the bus, releasing the bus, so that the target device occupies the bus, which can effectively reduce each device in the system. Inter-connected lines ensure that each device takes up the bus fairly.
  • FIG. 1 is a schematic diagram of an embodiment of a method for bus arbitration in the embodiment
  • FIG. 2 is a schematic structural diagram of an occupied sequence ring in the embodiment
  • FIG. 3 is a schematic structural diagram of a device for bus arbitration in the embodiment
  • FIG. 5 is another schematic structural diagram of a device for bus arbitration in the embodiment.
  • FIG. 6 is a schematic structural diagram of a system for bus arbitration in the embodiment
  • FIG. 7 is another schematic structural diagram of a device for bus arbitration in the embodiment.
  • the terms “comprises” and “comprises” and “the” and “the” are intended to cover a non-exclusive inclusion, for example, a process, method, system, product, or device that comprises a series of steps or modules is not necessarily limited to Those steps or modules, but may include other steps or modules not explicitly listed or inherent to such processes, methods, products or devices, the division of the modules presented herein is merely a logical division. There may be additional divisions in the implementation of the actual application, for example, multiple modules may be combined or integrated into another system, or some features may be ignored, or not executed, and the displayed or discussed mutual coupling.
  • the direct coupling or the communication connection may be through some interfaces, and the indirect coupling or communication connection between the modules may be electrical or the like, which is not limited herein.
  • the modules described as separate components may or may not be physically separated, may not be physical modules, or may not be divided into multiple circuit modules, and some or all of the modules may be selected according to actual needs. The purpose of implementing the solution of the embodiments of the present invention.
  • Embodiments of the present invention provide a bus arbitration method, apparatus, and system for total Line arbitration field.
  • bus arbitration mainly means that in a system with many devices, each device needs to use the bus to transmit data, and compete with each other to seize the right to use the bus. The details are described below.
  • a method of bus arbitration is applied to a working device that currently occupies a bus in a system for bus arbitration, and the system further includes a candidate device, wherein the candidate device is in the system. All devices except the working device, including:
  • the working device broadcasts its own working identification number to the candidate device through the bus, and the candidate device calculates the arbitration waiting time for participating in the next bus arbitration by using its own identification number and the working identification number.
  • each of the foregoing candidate devices is compared with each other by calculating the waiting time of the arbitration, and finally: the device with the shortest arbitration waiting time in the candidate device is the target device that occupies the bus for the next time;
  • the target device that occupies the next bus is the device with the shortest arbitration waiting time in the candidate device.
  • the device is the device that first reaches its own arbitration waiting time after the bus is released in step 103.
  • the process of calculating the arbitration waiting duration of the candidate device may also be performed between step 101 and step 103.
  • the timing of determining the target device is not limited herein, as long as the bus is completed before being released by the working device, so as to ensure After the bus is released, the next bus arbitration can be performed normally, and the timing of obtaining the arbitration waiting time is related to the computing power of each device and the efficiency of the processing program.
  • the working device occupies the bus, if there is data to be transmitted, it is transmitted through the occupied bus.
  • the other devices in the system that is, the candidate device can only receive the data sent by the currently occupied bus working device.
  • the bus After the current working device releases the bus, the bus is in an idle state. Since the target device occupying the bus is determined to be next time, when the arbitration waiting time of the target device is reached, the target device may occupy the above-mentioned Idle state bus. It can be understood that each time the selected target device is the next working device, after the bus is occupied, the operations performed are consistent with steps 101-103, and the loop is infinite loop, which is not described in detail herein.
  • the working device broadcasts the working identification number to the candidate device, so that each of the candidate devices obtains a corresponding arbitration waiting duration according to the own identification number and the working identification number, to determine the candidate.
  • the device in the device arbitrates the shortest waiting time, and after the data is transmitted through the bus, releases the bus, so that the device with the shortest arbitration waiting time occupies the bus, which can effectively reduce interconnection between devices in the system. Trace the line to ensure that each device takes up the bus fairly.
  • the method further includes one of the following steps:
  • the occupation sequence ring is used to indicate the order in which each device in the system occupies the bus; in this case, the occupancy sequence ring is updated once, and also indicates that after each working device that occupies the bus releases the bus, Will not participate in the next bus arbitration,
  • the arbitration waiting time of the working device is set to a maximum arbitration waiting time length Tmax, and the occupation order of the working device is set at the end of the occupation sequence ring;
  • the occupation order of the new device occupying the bus is set in the occupation sequence ring. End to update the occupied sequence ring;
  • the current system has a total of N devices. After detecting that the system adds M1 devices, the arbitration of the M1 devices is set.
  • the system includes N+M1 devices; for the N+M1 device, the occupation time of the bus is sorted from small to large according to the N+M1 devices, so as to update the occupied sequence ring.
  • M1 is a positive integer; the M1 devices are arranged at the end of the occupation sequence sequence from first to last according to the order of joining;
  • the occupancy sequence ring does not change, and in subsequent bus arbitration, when the occupancy order of any one of the at least one devices is reduced, All current devices in the system do not occupy the bus;
  • the system includes N-M2 devices; for the N-M2 device, the occupation time of the bus by the N-M2 devices is small.
  • the M2 is a positive integer, and when the deletion is performed, the occupation sequence ring is unchanged, but only when the next time the original device occupies the bus, no device can occupy
  • the bus can only wait for the bus president at the next moment, the position of the deleted device on the occupied sequence ring is unchanged, but when the arbitration waiting time of the deleted device is reached, no device is currently occupied idle. State bus.
  • the device on the bus can be increased or decreased at any time, and any device can be isolated from the bus, that is, when the device is added or removed on the bus. It does not affect bus arbitration and data transmission, and supports hot swapping of hardware devices during system operation. And the access request to the bus does not need to be transmitted to the bus arbitration device through the external channel, which effectively reduces the interconnect routing.
  • the arbitration waiting time of the working device is set to a maximum arbitration waiting time Tmax;
  • the maximum arbitration waiting duration is obtained by adding a device constant value to the working identification number of the working device.
  • each device in the system needs to recalculate the respective Tmax, and the Tmax may be the same or different. Since the device constant value of each device is fixed, Tmax is specifically connected according to the device.
  • the interface location of the system is related. For example, if device A is on interface 3 before the system is shut down, the ID of the device A is the device address. For the address of interface 3, if device A is changing the connected interface after the system is restarted, the Tmax of this setting remains unchanged, and vice versa.
  • each device in the system participates in the first bus arbitration, and each of them needs to set a maximum arbitration waiting time Tmax, which specifically includes:
  • the contending device meets at least one of the following conditions: the contending device is a new device that newly accesses the system; and the contending device is a current access device in the system after the system is powered on. All the equipment of the system;
  • the maximum arbitration waiting time of each device in the system may form an occupation sequence ring occupied by the device, and the Tmax of each device in the system may spontaneously form a virtual occupation sequence ring, or may be a controller of the system. Make settings, which are not limited in this article.
  • the occupied sequence ring is controlled by a maximum arbitration waiting time Tmax of all devices in the system.
  • Tmax of all devices in the system.
  • the arbitration waiting time is Twait, based on the foregoing embodiment corresponding to FIG. 1 and the foregoing first and second optional embodiments. Adding or subtracting the identification number of the candidate device from the work identification number;
  • each device's Twait will change with the current working device in the next bus arbitration to ensure that the devices in the system can participate in the bus arbitration in an orderly manner to ensure fairness.
  • Twait of each device in the system is as follows:
  • Twait0 id0-id1;
  • Twait1 Tmax1;
  • Twait2 id2-id1;
  • TwaitN idN-id1;
  • Twait0 id0+id1;
  • Twait1 Tmax1;
  • Twait2 id2+id1;
  • TwaitN idN+id1;
  • Twait can be obtained by four arithmetic operations or other similar algorithms. As long as the device with the smallest Twait, that is, the target device, can be obtained, the specific calculation manner is not limited.
  • the maximum arbitration waiting time of the working device is Tmax ⁇ 2Nmax-1, and the Tmax of the working device is greater than each of the working operations in the system.
  • the device's arbitration wait time is Twait.
  • the working device is After the system is cold-started, the device with the shortest Tmax in the system, and the method for broadcasting the working identification number of the working device to the candidate device, the method further includes:
  • the working device starts timing, and monitors a bus state of the bus. When it is determined that the timing value obtained by the timing is greater than or equal to its own Tmax, determining that the bus state is a bus idle state, the working device occupies the bus. And by using the bus to broadcast the bus occupation identifier and the work identification number of the working device.
  • each device in the system starts timing and monitors the bus state of the bus for the first bus arbitration, which includes bus occupation and bus idle.
  • the shortest Tmax device can get the right to occupy the bus for the first time.
  • the method further includes one of the following steps:
  • the any device broadcasts an end identifier through the bus
  • the any device When it is determined that data needs to be transmitted, the any device transmits data over the bus and broadcasts the end identification through the bus.
  • each device can be guaranteed during bus arbitration.
  • the Twait calculated in this bus arbitration is reached first, the bus can be occupied, ensuring that each device has the opportunity to occupy the bus, effectively improving fairness.
  • a device for bus arbitration in the embodiment of the present invention is not required to be additionally equipped with bus arbitration.
  • the device directly utilizes the processing function of the device connected to the bus in the system, that is, the device connected to the bus has the function of bus arbitration.
  • the device 30 may be an independent communication device, a hardware device such as a single board, or a module integrated in any of the above systems, which is not limited herein.
  • the device 30 is applied to a working device that currently occupies a bus in a bus arbitration system, and the system further includes a candidate device, where the candidate device is all devices except the working device in the system, and the embodiment of the present invention include:
  • the transmitting unit 301 is configured to broadcast the working identification number of the working device to the candidate device, so that each of the candidate devices obtains a corresponding arbitration waiting time according to the identification number of the working device and the working identification number;
  • the releasing unit 302 is configured to release the bus after the transmitting unit 301 transmits the data, so that the device with the shortest arbitration waiting time in the candidate device occupies the bus.
  • the transmission unit 301 broadcasts the work identification number to the candidate device, so that each candidate device obtains a corresponding arbitration waiting duration according to its own identification number and the work identification number, and the release unit 303 transmits After the unit 301 transmits the data through the bus, the bus is released, so that the device with the shortest arbitration waiting time in the candidate device occupies the bus, which can effectively reduce interconnections between devices in the system and ensure each device. Fairly occupying the bus.
  • the apparatus further includes a processing unit 303, where the processing unit 303 is used. Do one of the following steps:
  • the occupancy sequence ring is used to indicate an order in which each device in the system occupies the bus;
  • the maximum arbitration waiting duration is obtained by adding a device constant value to the working identification number of the working device.
  • the occupied sequence ring is controlled by a maximum arbitration waiting time Tmax of all devices in the system. Formed from small to large.
  • the arbitration waiting time Twait is Adding or subtracting the identification number of the candidate device from the work identification number To
  • the maximum number of accessible devices of the system is Nmax, and the maximum arbitration waiting time of the working device is Tmax ⁇ 2Nmax-1, and the Tmax of the working device is greater than the arbitration waiting time Twait of each candidate device in the system.
  • the working device is the foregoing, according to the embodiment corresponding to FIG. 3, and the first to the second optional embodiment.
  • the device with the shortest Tmax in the system the device further includes:
  • the monitoring unit 304 is configured to start timing after detecting a cold start of the system, and monitor a bus state of the bus for performing a first bus arbitration, where the bus state includes one of bus occupation and bus idle;
  • the processing unit 303 is further configured to: when determining that the timing value obtained by the monitoring unit 304 is greater than or equal to its own Tmax, determining that the bus state is bus idle, occupying the bus.
  • the transmission unit 301 is further configured to: use the bus broadcast bus occupation identifier and the The identification number of any device;
  • the processing unit 303 determines that data is not required to be transmitted, the end identifier is broadcasted through the bus;
  • a bus arbitration system 60 in the embodiment of the present invention includes at least two devices as follows:
  • the present invention also provides a computer storage medium storing a program that, when executed, includes some or all of the steps of the bus arbitration described above.
  • FIG. 7 is another schematic structural diagram of a device 70 for bus arbitration according to an embodiment of the present invention.
  • the bus arbitration device 70 can include at least one network interface or other communication interface, at least one receiver 701, at least one transmitter 702, at least one processor 703, and memory 704 to enable connection communication between the devices, through at least one
  • the network interface (which may be wired or wireless) implements a communication connection between the system gateway and at least one other network element, and may use an Internet, a wide area network, a local network, a metropolitan area network, or the like.
  • the memory 704 can include read only memory and random access memory, and provides instructions and data to the processor 703.
  • a portion of the memory 704 can also include, possibly including, a high speed random access memory (RAM), and possibly a non- Un-volatile memory.
  • RAM high speed random access memory
  • the memory 704 stores the following elements, executable modules or data structures, or a subset thereof, or an extended set thereof:
  • Operation instructions include various operation instructions for implementing various operations.
  • Operating system Includes a variety of system programs for implementing various basic services and handling hardware-based tasks.
  • the apparatus for bus arbitration in the embodiment of the present invention is applied to a working device that currently occupies a bus in a system for bus arbitration, and the system further includes a candidate device, wherein the candidate device is all but the working device in the system.
  • the device 703 performs the following operations by calling an operation instruction stored in the memory 704 (which can be stored in the operating system):
  • the transmitter 702 uses the transmitter 702 to broadcast the working identification number of the working device to the candidate device, so that each of the candidate devices obtains a corresponding arbitration waiting time according to the own identification number and the working identification number;
  • the bus is released such that the device with the shortest arbitration waiting time in the candidate device occupies the bus.
  • the processor 703 may further perform one of the following steps:
  • the occupancy sequence ring is used to indicate the order in which each device in the system occupies the bus;
  • the maximum arbitration waiting duration is obtained by adding a device constant value to the working identification number of the working device.
  • the occupation sequence ring is formed by arranging the maximum arbitration waiting time Tmax of all devices in the system from small to large;
  • the arbitration waiting time length Twait is obtained by adding or subtracting the identification number of the candidate device from the work identification number
  • the maximum arbitration waiting time of the working device is Tmax ⁇ 2Nmax-1, and the Tmax of the working device is greater than the arbitration waiting of each candidate device in the system. Duration Twait.
  • the working device is a device with the shortest Tmax in the system after the system is cold-started, and the processor 703 further specifically before broadcasting the working identification number of the working device to the candidate device. Perform the following steps:
  • the working device occupies the bus. And using the transmitter 702 to broadcast the bus occupation identifier and the work identification number of the working device through the bus.
  • the processor 703 specifically performs one of the following steps:
  • the end identifier is broadcasted by the transmitter 702 through the bus;
  • the transmitter 702 transmits data over the bus and broadcasts the end identification through the bus.
  • the arbitration waiting duration Twait is obtained by adding or subtracting the identification number of the candidate device from the working identification number
  • the disclosed system, apparatus, and method may be implemented in other manners.
  • the device embodiments described above are merely illustrative.
  • the division of the unit is only a logical function division.
  • there may be another division manner for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored or not executed.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be in an electrical, mechanical or other form.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
  • the integrated unit if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable storage medium.
  • the technical solution of the present invention which is essential or contributes to the prior art, or all or part of the technical solution, may be embodied in the form of a software product stored in a storage medium. , including a number of instructions for causing a computer device (which may be a personal computer, server, or network device, etc.) to execute All or part of the steps of the method described in various embodiments of the invention.
  • the foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Bus Control (AREA)

Abstract

本发明实施例公开了一种总线仲裁的方法、装置及系统,所述方法应用于总线仲裁的系统中当前占用总线的工作设备,所述系统还包括候选设备,所述候选设备为所述系统中除所述工作设备之外的所有设备,所述方法包括:广播所述工作设备的工作标识号至所述候选设备,以使每个所述候选设备根据自身的标识号和所述工作标识号得到对应的仲裁等待时长;通过所述总线传输数据;在传输完所述数据后,释放所述总线,以使所述候选设备中仲裁等待时长最短的设备占用所述总线,能够有效减少系统内各个设备之间互联走线,保证各个设备公平的占用总线。

Description

一种总线仲裁的方法、装置及系统 技术领域
本发明涉及总线仲裁领域,尤其涉及一种总线仲裁的方法、装置及系统。
背景技术
片上集成系统中存在多个设备或功能模块可能同时会申请使用总线,为避免总线使用冲突,一般采用总线仲裁机制管理系统中可能会占用总线的设备或模块,以实现在多个设备或模块同时申请使用总线时,控制各个设备或模块访问总线的次序。
传统的总线仲裁机制主要有以下两种:
一种是设定总线占用检测机制,若主机需要占用数据线时,主机检测握手信号线是否处于高电平;若握手信号线处于低电平,主机则等待;若握手信号线处于高电平,主机则通过握手信号端将握手信号线置于低电平,并随即开始检测数据线是否存在数据传输的启动信号;若在对应的时间片内检测到启动信号,则主机退出占用数据线的竞争,若在对应的时间片内检测不到启动信号,则主机占用数据线。但该方案中,总线仲裁是由各主机对总线的抢占实现的,即总线总是由最先抢占的主机占用。这样可能导致有的主机永远无法占用总线,这种方式无法保证总线占用的公平性。
另一种是通过配备总线仲裁装置,总线仲裁装置根据各设备访问请求的等待时间,调整各设备访问请求的优先级,按照各访问请求的优先级从高到低的顺序分配访问权限的优先级。虽然该方案能够兼顾各个访问请求的差别,以及避免优先级低的访问请求无法获得访问权限,可以保证总线占用的公平性,但总线必须配备一个总线仲裁装置,不能实现总线上所有设备随意增减。而且,总线请求要通过带外通道 提交给总线仲裁装置,达不到互联走线最少的目的。
通过以上两种方案,均不能解决使用最少的互联走线将系统中各个设备互联,以及各个设备即可以公平的占用总线,又可以随时增减设备的问题。
发明内容
本发明提供一种总线仲裁的方法、装置及系统,能够解决现有技术中无法实现系统内各个设备之间互联走线较少,且公平的占用总线的问题。
本发明第一方面提供一种总线仲裁的方法,所述方法应用于总线仲裁的系统中当前占用总线的工作设备,所述系统还包括候选设备,所述候选设备为所述系统中除所述工作设备之外的所有设备,所述方法包括:
广播所述工作设备的工作标识号至所述候选设备,以使每个所述候选设备根据自身的标识号和所述工作标识号得到对应的仲裁等待时长;
通过所述总线传输数据;
在传输完所述数据后,释放所述总线,以使所述候选设备中仲裁等待时长最短的设备占用所述总线。
结合第一方面,本发明第一方面的第一种实现方式中,所述方法还包括如下步骤中的一个:
在所述工作设备释放所述总线之后,将所述工作设备的仲裁等待时长设置为所述工作设备的最大仲裁等待时长Tmax,并将所述工作设备的占用顺序设置在占用顺序环的末端,所述占用顺序环用于指示所述系统中每个设备占用所述总线的顺序;
在所述工作设备新接入所述系统时,将所述工作设备的仲裁等待时长设置为最大仲裁等待时长Tmax,并将所述工作设备的占用顺序设置在所述占用顺序环的末端;
在所述系统冷启动时,将所述工作设备的仲裁等待时长设置为最 大仲裁等待时长Tmax;
其中,所述最大仲裁等待时长由设备常数值与所述工作设备的工作标识号相加得到。
结合第一方面的第一种实现方式,本发明第一方面的第二种实现方式中,所述占用顺序环由所述系统中所有设备的最大仲裁等待时长Tmax按从小至大排列拼接形成。
结合第一方面,及第一方面的第一和第二种实现方式,本发明第一方面的第三种实现方式中,所述仲裁等待时长Twait由所述候选设备的标识号与所述工作标识号相加或相减得到;
若所述系统的最大可接入的设备的数量为Nmax,则所述工作设备的最大仲裁等待时长Tmax≥2Nmax-1,所述工作设备的Tmax大于系统中每个所述候选设备的仲裁等待时长Twait。
结合第一方面,及第一方面的第一至第三种实现方式,本发明第一方面的第四种实现方式中,所述工作设备为所述系统冷启动后,所述系统中Tmax最短的设备,所述广播所述工作设备的工作标识号至所述候选设备之前,所述方法还包括:
所述工作设备开始计时,并监测所述总线的总线状态,在确定计时得到的计时值大于或等于自身的Tmax时,确定所述总线状态为总线空闲,则所述工作设备占用所述总线,并通过所述总线广播总线占用标识和所述工作设备的工作标识号。
结合第一方面的第四种实现方式,本发明第一方面的第五种实现方式中,所述方法还包括如下步骤中的一个:
在确定不需要发送数据时,所述任一设备通过所述总线广播结束标识;
在确定需要发送数据时,所述任一设备通过所述总线发送数据,并通过所述总线广播所述结束标识。
本发明第二方面提供一种总线仲裁的装置,所述装置应用于总线仲裁的系统中当前占用总线的工作设备,所述系统还包括候选设备, 所述候选设备为所述系统中除所述工作设备之外的所有设备,所述装置包括;
传输单元,用于广播所述工作设备的工作标识号至所述候选设备,以使每个所述候选设备根据自身的标识号和所述工作标识号得到对应的仲裁等待时长;
传输单元,用于通过所述总线传输数据;
释放单元,用于在所述传输单元传输完所述数据后,释放所述总线,以使所述候选设备中仲裁等待时长最短的设备占用所述总线。
结合第二方面,本发明第二方面的第一种实现方式中,所述装置还包括处理单元,所述处理单元用于执行以下步骤中的一个:
在所述工作设备释放所述总线之后,将所述工作设备的仲裁等待时长设置为所述工作设备的最大仲裁等待时长Tmax,并将所述工作设备的占用顺序设置在占用顺序环的末端,所述占用顺序环用于指示所述系统中每个设备占用所述总线的顺序;
在所述工作设备新接入所述系统时,设置所述工作设备仲裁等待时长为最大仲裁等待时长Tmax,并将所述工作设备的占用顺序设置在所述占用顺序环的末端;
在所述系统冷启动时,设置所述工作设备仲裁等待时长为最大仲裁等待时长Tmax;
其中,所述最大仲裁等待时长由设备常数值与所述工作设备的工作标识号相加得到。
结合第二方面的第一种实现方式,本发明第一方面的第二种实现方式中,所述所述占用顺序环由所述系统中所有设备的最大仲裁等待时长Tmax按从小至大排列拼接形成。
结合第二方面,及第二方面的第一和第二种实现方式,本发明第二方面的第三种实现方式中,所述仲裁等待时长Twait由所述候选设备的标识号与所述工作标识号相加或相减得到;
若所述系统的最大可接入的设备的数量为Nmax,则所述工作设备的最大仲裁等待时长Tmax≥2Nmax-1,所述工作设备的Tmax大 于系统中每个候选设备的仲裁等待时长Twait。
结合第二方面,及第二方面的第一和第二种实现方式,本发明第二方面的第四种实现方式中,所述工作设备为所述系统冷启动后,所述系统中Tmax最短的设备,所述装置还包括:
监测单元,用于在检测到所述系统冷启动后,开始计时,并监测所述总线的总线状态;
所述处理单元还用于在确定所述监测单元计时得到的计时值大于或等于自身的Tmax时,确定所述总线状态为总线空闲,则占用所述总线;
所述传输单元还用于通过所述总线广播总线占用标识和所述任一设备的标识号;
结合第二方面的第一和第二种实现方式,本发明第二方面的第四种实现方式中,在所述处理单元确定不需要发送数据时,通过所述总线广播结束标识;
在所述处理单元确定需要发送数据时,通过所述总线发送数据,并通过所述总线广播所述结束标识。
本发明第三方面提供一种总线仲裁的系统,其特征在于,所述系统至少包括两个下述装置:
如第二方面、及第二方面的第一至第六种实现方式中任一所述的总线仲裁的装置。
从以上技术方案可以看出,本发明通过工作设备广播工作标识号至所述候选设备,以使每个所述候选设备根据自身的标识号和所述工作标识号得到对应的仲裁等待时长,以在确定所述候选设备中仲裁等待时长最短的目标设备,并在通过总线传输完所述数据后,释放所述总线,以使所述目标设备占用所述总线,能够有效减少系统内各个设备之间互联走线,保证各个设备公平的占用总线。
附图说明
图1为本实施例中一种总线仲裁的方法一实施例示意图;
图2为本实施例中一种占用顺序环一结构示意图;
图3为本实施例中一种总线仲裁的装置一结构示意图;
图4为本实施例中一种总线仲裁的装置另一结构示意图;
图5为本实施例中一种总线仲裁的装置另一结构示意图;
图6为本实施例中一种总线仲裁的系统一结构示意图;
图7为本实施例中一种总线仲裁的装置另一结构示意图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例,基于本发明中的实施例,本领域技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的实施例能够以除了在这里图示或描述的内容以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或模块的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或模块,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或模块,本文中所出现的模块的划分,仅仅是一种逻辑上的划分,实际应用中实现时可以有另外的划分方式,例如多个模块可以结合成或集成在另一个系统中,或一些特征可以忽略,或不执行,另外,所显示的或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,模块之间的间接耦合或通信连接可以是电性或其他类似的形式,本文中均不作限定。并且,作为分离部件说明的模块可以是也可以不是物理上的分离,可以是也可以不是物理模块,或者可以分不到多个电路模块中,可以根据实际的需要选择其中的部分或全部模块来实现本发明实施例方案的目的。
本发明实施例提供了一种总线仲裁的方法、装置及系统,用于总 线仲裁领域。本文中,总线仲裁主要是指,在一个包含很多设备的系统中,每个设备需要使用总线来传输数据时,相互之间会进行竞争,以抢占到总线的使用权。以下进行详细说明。
请参照图1和图2,一种总线仲裁的方法,所述方法应用于总线仲裁的系统中当前占用总线的工作设备,所述系统还包括候选设备,所述候选设备为所述系统中除所述工作设备之外的所有设备,包括:
101、广播所述工作设备的工作标识号至所述候选设备,以使每个所述候选设备根据自身的标识号和所述工作标识号得到对应的仲裁等待时长;
在工作设备占用总线期间,工作设备通过所述总线将自身的工作标识号广播至候选设备,候选设备利用自身的标识号和该工作标识号计算得到参与下一次总线仲裁的仲裁等待时长。
可以理解的是,上述各个候选设备通过对仲裁等待时长的计算,最后相互比较得到:所述候选设备中仲裁等待时长最短的设备即为下一次占用总线的目标设备;
在每一次总线总裁过程中,除工作设备之外的所有设备都将参与下一次总线仲裁的竞争,最终获得下一次占用总线的目标设备为所述候选设备中仲裁等待时长最短的设备,上述目标设备即为步骤103中总线被释放后,最先达到自身的仲裁等待时长的设备。
实际应用中,候选设备计算仲裁等待时长的过程也可以在步骤101与步骤103之间进行,具体确定目标设备的时序本文中不做限定,只要在总线被工作设备释放之前完成即可,以保证上述总线被释放后,下一次的总线仲裁可以正常进行,由于得到上述仲裁等待时长的时序与各个设备的运算能力及处理程序效率等有关。
102、通过所述总线传输数据;
工作设备在占用总线时,如果有数据需要传输,便通过占用的总线来进行传输,整个过程中,该系统中其它的设备即候选设备只能接收当前占用总线工作设备所发送的数据。
103、在传输完所述数据后,释放所述总线,以使所述候选设备 中仲裁等待时长最短的设备占用所述总线;
在当前的工作设备释放所述总线后,上述总线便处于空闲状态,由于已确定下一次占用总线的所述目标设备,所以在达到上述目标设备的仲裁等待时长时,上述目标设备会占用上述处于空闲状态的总线。可以理解的是,每次选出的目标设备即为下一次的工作设备,在占用上述总线后,所执行的操作与步骤101-103一致,无限循环,具体本文不再赘述。
本发明实施例中,工作设备广播工作标识号至所述候选设备,以使每个所述候选设备根据自身的标识号和所述工作标识号得到对应的仲裁等待时长,以在确定所述候选设备中仲裁等待时长最短的设备,并在通过总线传输完所述数据后,释放所述总线,以使所述仲裁等待时长最短的设备占用所述总线,能够有效减少系统内各个设备之间互联走线,保证各个设备公平的占用总线。
可选的,在上述图1所对应的实施例的基础上,本发明实施例的第一个可选实施例中,所述方法还包括如下步骤中的一个:
1、在所述工作设备释放所述总线之后,将所述工作设备的仲裁等待时长设置为所述工作设备的最大仲裁等待时长Tmax,并将所述工作设备的占用顺序设置在占用顺序环的末端,所述占用顺序环用于指示所述系统中每个设备占用所述总线的顺序;这种情况下,所述占用顺序环更新一次,也表明每次占用总线的工作设备释放总线后,不会参与下一次的总线仲裁,
2、在所述工作设备新接入所述系统时,所述工作设备的仲裁等待时长设置为最大仲裁等待时长Tmax,并将所述工作设备的占用顺序设置在所述占用顺序环的末端;
可以理解的是,当所述新接入的设备包括多个时,按照每个设备接入所述系统的时间先后顺序,将所述新设备占用所述总线的占用顺序设置在占用顺序环的末端,以更新所述占用顺序环;
以设备为总线上的节点角度来看,当前的系统共有N个设备,在检测到所述系统新增M1个设备后,设置所述M1个设备的仲裁等 待时长,所述系统中包含N+M1个设备;对所述N+M1设备,按所述N+M1个设备对总线的占用时长从小至大进行排序,以更新所述占用顺序环,所述M1为正整数;将所述M1个设备按照加入的先后顺序,从先至后设置在所述占用顺序序列的末端;
另外,在所述系统减少至少一个设备后,所述占用顺序环不变,在后续的总线仲裁中,在到达减少的所述至少一个设备中的任一设备的占用顺序时的占用顺序时,所述系统中当前所有的设备都不占用所述总线;
可以理解的是,在检测到所述系统减少M2个设备后,所述系统中包含N-M2个设备;对所述N-M2设备,按所述N-M2个设备对总线的占用时长从小至大进行排序,以更新所述占用顺序环的节点,所述M2为正整数,删除时,占用顺序环不变,只是下一次轮到原设备的占用总线的时刻时,没有任何设备可以占用总线,只能等待下一时刻的总线总裁,被删除的设备在上述占用顺序环上的位置不变,只是在到达该被删除的设备的仲裁等待时长时,不会有任何设备占用当前处于空闲状态的总线。
由此可见,本可选实施例中,不需要另外为上述系统配备总线仲裁装置,可以实现随时增减总线上的设备,任何设备都可以从总线上隔离,即在总线上增减设备时,不会影响总线仲裁以及数据的传输,支持在系统运行过程中硬件设备的热插拔。并且对总线的访问请求也不需要通过外通道传输至总线仲裁装置,有效减少互联走线。
3、在所述系统冷启动时,所述工作设备的仲裁等待时长设置为最大仲裁等待时长Tmax;
所述最大仲裁等待时长由设备常数值与所述工作设备的工作标识号相加得到。
可以理解的是,每次系统在冷启动后,系统中的每个设备都需要重新计算各自的Tmax,Tmax可能相同或不同,由于每个设备的设备常数值固定,所以Tmax具体根据设备连接在系统的接口位置有关,例如,设备A在系统关闭前在接口3,则该设备A的ID即设备地址 为接口3的地址,若在系统重新启动后,设备A并为改变连接的接口,则此次设置的Tmax保持不变,反之,随接口变化。
并且,在系统冷启动后,系统中每个设备均参与第一次总线仲裁,都需要设置各自的最大仲裁等待时长Tmax,具体包括:
将所述N个设备中第一次参与所述总线仲裁的设备设为竞争设备,分别设置所述竞争设备的Tmax,所述最大仲裁等待时长由设备常数值与所述竞争设备的标识号相加得到,所述竞争设备至少满足以下条件中的一个:所述竞争设备为新接入所述系统的新设备;所述竞争设备为所述系统上电后,所述系统中当前接入所述系统的所有设备;
从而,所述系统中每个设备的最大仲裁等待时长会形成设备对总线占用的占用顺序环,可以是系统中的各个设备的Tmax自发形成一个虚拟的占用顺序环,也可以是系统的控制器进行设置,具体本文中不做限定。
可选的,在上述第一个可选实施例的基础上,本发明实施例的第二个可选实施例中,所述占用顺序环由所述系统中所有设备的最大仲裁等待时长Tmax按从小至大排列拼接形成;可选的,也可以按照所述系统中每个设备第一次参与所述总线仲裁的时间先后顺序,从先至后排列拼接形成所述占用顺序环,如图2所示。
可选的,在上述图1所对应的实施例,及上述第一和第二个可选实施例的基础上,本发明实施例的第三个可选实施例中,所述仲裁等待时长Twait由所述候选设备的标识号与所述工作标识号相加或相减得到;
可以理解的是,每个设备的Twait每在下一次的总线仲裁中都会随着当前的工作设备变化,以保证系统各个设备间能够有序的参与总线仲裁,保证公平性。
例如,如图2所示的占用顺序环,系统中有N个设备Device,即Device0,Device1,…DeviceN,假设Device1为当前占用总线的工作设备,Device1利用总线发送自身的标识号和数据,Device1的最 大仲裁等待时长为Tmax1那么,在这个阶段中,该系统中各个设备的Twait如下:
Device0:Twait0=id0-id1;
Device1:Twait1=Tmax1;
Device2:Twait2=id2-id1;
……
DeviceN:TwaitN=idN-id1;
也可以是:
Device0:Twait0=id0+id1;
Device1:Twait1=Tmax1;
Device2:Twait2=id2+id1;
……
DeviceN:TwaitN=idN+id1;
由以上可以看出,Twait可以通过四则运算或其它类似算法得到,只要能够得到Twait最小的设备即目标设备,具体计算方式均不作限定。
可选的,若所述系统的最大可接入的设备的数量为Nmax,则所述工作设备的最大仲裁等待时长Tmax≥2Nmax-1,所述工作设备的Tmax大于系统中每个所述工作设备的仲裁等待时长Twait。
可选的,在上述图1所对应的实施例,及上述第一至第三个可选实施例的基础上,本发明实施例的第四个可选实施例中,所述工作设备为所述系统冷启动后,所述系统中Tmax最短的设备,所述广播所述工作设备的工作标识号至所述候选设备之前,所述方法还包括:
所述工作设备开始计时,并监测所述总线的总线状态,在确定计时得到的计时值大于或等于自身的Tmax时,确定所述总线状态为总线空闲,则所述工作设备占用所述总线,并通过所述总线广播总线占用标识和所述工作设备的工作标识号。
实际上,在检测到系统上电冷启动后,所述系统中每个设备均开始计时,并监测所述总线的总线状态,进行第一次总线仲裁,所述总线状态包括总线占用和总线空闲中的一个,这个过程中,每个设备都 会参与第一次总线仲裁,Tmax最短的设备即可获得第一次占用总线的权利。
可选的,在上述上述第四个可选实施例的基础上,本发明实施例的第五个可选实施例中,所述方法还包括如下步骤中的一个:
在确定不需要发送数据时,所述任一设备通过所述总线广播结束标识;
在确定需要发送数据时,所述任一设备通过所述总线发送数据,并通过所述总线广播所述结束标识。
可以理解的是,在系统上电后,系统进行周期性的计时,在每个计时期间,除上一个占用总线的设备外的所有设备一起参与下一次的总线仲裁即抢占总线。
可选的,本发明实施例中,由于所述系统中每个设备的Tmax都大于所述系统中仲裁等待时长最长的设备的仲裁等待时长,即可保证每个设备在总线仲裁时,在最先达到本次总线仲裁中计算得到的Twait时,即可占用总线,保证每个设备都有机会占用总线,有效提高公平性。
上面对本发明实施例中的一种总线仲裁的方法进行详细的举例说明,下面对本发明实施例中的一种总线仲裁的装置30,请参阅图3,本发明实施例不需要另外配备总线仲裁的装置,直接利用系统中连接总线的设备所具有的处理功能即可,即连接总线的设备都具有总线仲裁的功能。该装置30可以为独立的通信设备,也可以为单板等硬件设备,也可以是集成在上述系统中的任一设备内的一个模块,具体本文中均不作限定。所述装置30应用于总线仲裁的系统中当前占用总线的工作设备,所述系统还包括候选设备,所述候选设备为所述系统中除所述工作设备之外的所有设备,本发明实施例包括:
传输单元301,用于广播所述工作设备的工作标识号至所述候选设备,以使每个所述候选设备根据自身的标识号和所述工作标识号得到对应的仲裁等待时长;
并通过所述总线传输数据;
释放单元302,用于在所述传输单元301传输完所述数据后,释放所述总线,以使所述候选设备中仲裁等待时长最短的设备占用所述总线。
本发明实施例中,传输单元301广播工作标识号至所述候选设备,以使每个所述候选设备根据自身的标识号和所述工作标识号得到对应的仲裁等待时长,释放单元303在传输单元301通过总线传输完所述数据后,释放所述总线,以使所述候选设备中仲裁等待时长最短的设备占用所述总线,能够有效减少系统内各个设备之间互联走线,保证各个设备公平的占用总线。
可选的,在上述图3所对应的实施例的基础上,参阅图4,本发明实施例的第一个可选实施例中,所述装置还包括处理单元303,所述处理单元303用于执行以下步骤中的一个:
在所述释放单元302释放所述总线之后,将所述工作设备的仲裁等待时长设置为所述工作设备的最大仲裁等待时长Tmax,并将所述工作设备的占用顺序设置在占用顺序环的末端,所述占用顺序环用于指示所述系统中每个设备占用所述总线的顺序;
在所述工作设备新接入所述系统时,设置所述工作设备的仲裁等待时长为最大仲裁等待时长Tmax,并将所述工作设备的占用顺序设置在所述占用顺序环的末端;
在所述系统冷启动时,设置所述工作设备的仲裁等待时长为最大仲裁等待时长Tmax;
所述最大仲裁等待时长由设备常数值与所述工作设备的工作标识号相加得到。
可选的,在上述第一个可选实施例的基础上,本发明实施例的第二个可选实施例中,所述占用顺序环由所述系统中所有设备的最大仲裁等待时长Tmax按从小至大排列拼接形成。
可选的,在上述图3所对应的实施例,及第一和第二个可选实施例的基础上,本发明实施例的第三个可选实施例中,所述仲裁等待时长Twait由所述候选设备的标识号与所述工作标识号相加或相减得 到;
所述系统的最大可接入的设备的数量为Nmax,则所述工作设备的最大仲裁等待时长Tmax≥2Nmax-1,所述工作设备的Tmax大于系统中每个候选设备的仲裁等待时长Twait。
可选的,在上述图3所对应的实施例,及第一至第二个可选实施例的基础上,本发明实施例的第四个可选实施例中,所述工作设备为所述系统冷启动后,所述系统中Tmax最短的设备,所述装置还包括:
监测单元304,用于在检测到系统冷启动后,开始计时,并监测所述总线的总线状态,进行第一次总线仲裁,所述总线状态包括总线占用和总线空闲中的一个;
所述处理单元303还用于在确定所述监测单元304计时得到的计时值大于或等于自身的Tmax时,确定所述总线状态为总线空闲,则占用所述总线.
可选的,在上述第四个可选实施例的基础上,本发明实施例的第五个可选实施例中,所述传输单元301还用于通过所述总线广播总线占用标识和所述任一设备的标识号;
在所述处理单元303确定不需要发送数据时,通过所述总线广播结束标识;
在所述处理单元303确定需要发送数据时,通过所述总线发送数据,并通过所述总线广播所述结束标识。
请参阅图6,本发明实施例中一种总线仲裁的系统60至少包括两个下述装置:
如上述图3所对应的实施例,及上述图3对应的实施例的第一至第五个可选实施例中任一所述的总线仲裁的装置。
本发明还提供一种计算机存储介质,该介质存储有程序,该程序执行时包括上述总线仲裁的装置执行一种总线仲裁的方法中的部分或者全部步骤。
图7是本发明实施例一种总线仲裁的装置70的另一结构示意图。 总线仲裁的装置70可包括至少一个网络接口或者其它通信接口、至少一个接收器701、至少一个发射器702、至少一个处理器703和存储器704,以实现这些装置之间的连接通信,通过至少一个网络接口(可以是有线或者无线)实现该系统网关与至少一个其它网元之间的通信连接,可以使用互联网,广域网,本地网,城域网等。
存储器704可以包括只读存储器和随机存取存储器,并向处理器703提供指令和数据,存储器704的一部分还可以包括可能包含高速随机存取存储器(RAM,Random Access Memory),也可能还包括非不稳定的存储器(non-volatile memory)。
存储器704存储了如下的元素,可执行模块或者数据结构,或者它们的子集,或者它们的扩展集:
操作指令:包括各种操作指令,用于实现各种操作。
操作系统:包括各种系统程序,用于实现各种基础业务以及处理基于硬件的任务。
本发明实施例中的总线仲裁的装置应用于总线仲裁的系统中当前占用总线的工作设备,所述系统还包括候选设备,所述候选设备为所述系统中除所述工作设备之外的所有设备,处理器703通过调用存储器704存储的操作指令(该操作指令可存储在操作系统中),执行如下操作:
利用发射器702广播所述工作设备的工作标识号至所述候选设备,以使每个所述候选设备根据自身的标识号和所述工作标识号得到对应的仲裁等待时长;
利用发射器702通过所述总线传输数据;
在利用发射器702传输完所述数据后,释放所述总线,以使所述候选设备中仲裁等待时长最短的设备占用所述总线。
在一些实施方式中,上述处理器703还可以执行如下步骤中的一个:
在所述工作设备释放所述总线之后,将所述工作设备的仲裁等待时长设置为所述工作设备的Tmax,并将所述工作设备的占用顺序设 置在占用顺序环的末端,所述占用顺序环用于指示所述系统中每个设备占用所述总线的顺序;
在所述工作设备新接入所述系统时,设置所述工作设备最大仲裁等待时长Tmax,并将所述工作设备的占用顺序设置在所述占用顺序环的末端;
在所述系统冷启动时,设置所述工作设备最大仲裁等待时长Tmax;
所述最大仲裁等待时长由设备常数值与所述工作设备的工作标识号相加得到。
其中,所述占用顺序环由所述系统中所有设备的最大仲裁等待时长Tmax按从小至大排列拼接形成;
所述仲裁等待时长Twait由所述候选设备的标识号与所述工作标识号相加或相减得到;
若所述系统的最大可接入的设备的数量为Nmax,则所述工作设备的最大仲裁等待时长Tmax≥2Nmax-1,所述工作设备的Tmax大于系统中每个所述候选设备的仲裁等待时长Twait。
在一些实施方式中,所述工作设备为所述系统冷启动后,所述系统中Tmax最短的设备,上述处理器703在广播所述工作设备的工作标识号至所述候选设备之前,还具体执行以下步骤:
通过内置的计时器开始计时,并监测所述总线的总线状态,在确定计时得到的计时值大于或等于自身的Tmax时,确定所述总线状态为总线空闲,则所述工作设备占用所述总线,并利用发射器702通过所述总线广播总线占用标识和所述工作设备的工作标识号。
在一些实施方式中,上述处理器703具体执行以下步骤中的一个:
在确定不需要发送数据时,利用发射器702通过所述总线广播结束标识;
在确定需要发送数据时,利用发射器702通过所述总线发送数据,并通过所述总线广播所述结束标识。
其中,所述仲裁等待时长Twait由所述候选设备的标识号与所述工作标识号相加或相减得到;
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行 本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。
以上对本发明所提供的一种总线仲裁的方法、装置及系统进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。

Claims (14)

  1. 一种总线仲裁的方法,其特征在于,所述方法应用于总线仲裁的系统中当前占用总线的工作设备,所述系统还包括候选设备,所述候选设备为所述系统中除所述工作设备之外的所有设备,所述方法包括:
    广播所述工作设备的工作标识号至所述候选设备,以使每个所述候选设备根据自身的标识号和所述工作标识号得到对应的仲裁等待时长;
    通过所述总线传输数据;
    在传输完所述数据后,释放所述总线,以使所述候选设备中仲裁等待时长最短的设备占用所述总线。
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括如下步骤中的一个:
    在所述工作设备释放所述总线之后,将所述工作设备的仲裁等待时长设置为所述工作设备的最大仲裁等待时长Tmax,并将所述工作设备的占用顺序设置在占用顺序环的末端,所述占用顺序环用于指示所述系统中每个设备占用所述总线的顺序;
    在所述工作设备新接入所述系统时,将所述工作设备的仲裁等待时长设置为最大仲裁等待时长Tmax,并将所述工作设备的占用顺序设置在所述占用顺序环的末端;
    在所述系统冷启动时,将所述工作设备的仲裁等待时长设置为最大仲裁等待时长Tmax;
    其中,所述最大仲裁等待时长由设备常数值与所述工作设备的工作标识号相加得到。
  3. 根据权利要求2所述的方法,其特征在于,所述占用顺序环由所述系统中所有设备的最大仲裁等待时长Tmax按从小至大排列拼接形成。
  4. 根据权利要求1-3任一所述的方法,其特征在于,
    所述仲裁等待时长Twait由所述候选设备的标识号与所述工作标 识号相加或相减得到;
    若所述系统的最大可接入的设备的数量为Nmax,则所述工作设备的最大仲裁等待时长Tmax≥2Nmax-1,所述工作设备的Tmax大于系统中每个所述候选设备的仲裁等待时长Twait。
  5. 根据权利要求1至4任一所述的方法,其特征在于,所述工作设备为所述系统冷启动后,所述系统中Tmax最短的设备,所述广播所述工作设备的工作标识号至所述候选设备之前,所述方法还包括:
    所述工作设备开始计时,并监测所述总线的总线状态,在确定计时得到的计时值大于或等于自身的Tmax时,确定所述总线状态为总线空闲,则所述工作设备占用所述总线,并通过所述总线广播总线占用标识和所述工作设备的工作标识号。
  6. 根据权利要求5所述的方法,其特征在于,所述方法还包括如下步骤中的一个:
    在确定不需要发送数据时,所述工作设备通过所述总线广播结束标识;
    在确定需要发送数据时,所述工作设备通过所述总线发送数据,并通过所述总线广播所述结束标识。
  7. 一种总线仲裁的装置,其特征在于,所述装置应用于总线仲裁的系统中当前占用总线的工作设备,所述系统还包括候选设备,所述候选设备为所述系统中除所述工作设备之外的所有设备,所述装置包括;
    传输单元,用于广播所述工作设备的工作标识号至所述候选设备,以使每个所述候选设备根据自身的标识号和所述工作标识号得到对应的仲裁等待时长;
    所述传输单元还用于通过所述总线传输数据;
    释放单元,用于在所述传输单元传输完所述数据后,释放所述总线,以使所述候选设备中仲裁等待时长最短的设备占用所述总线。
  8. 根据权利要求7所述的装置,其特征在于,所述装置还包括 处理单元,所述处理单元用于执行以下步骤中的一个:
    在所述释放单元释放所述总线之后,将所述工作设备的仲裁等待时长设置为所述工作设备的最大仲裁等待时长Tmax,并将所述工作设备的占用顺序设置在占用顺序环的末端,所述占用顺序环用于指示所述系统中每个设备占用所述总线的顺序;
    在所述工作设备新接入所述系统时,设置所述工作设备的仲裁等待时长为最大仲裁等待时长Tmax,并将所述工作设备的占用顺序设置在所述占用顺序环的末端;
    在所述系统冷启动时,设置所述工作设备的仲裁等待时长为最大仲裁等待时长Tmax;
    其中,所述最大仲裁等待时长由设备常数值与所述工作设备的工作标识号相加得到。
  9. 根据权利要求8所述的装置,其特征在于,所述占用顺序环由所述系统中所有设备的最大仲裁等待时长Tmax按从小至大排列拼接形成。
  10. 根据权利要求7至9任一所述的装置,其特征在于,所述仲裁等待时长Twait由所述候选设备的标识号与所述工作标识号相加或相减得到;
    若所述系统的最大可接入的设备的数量为Nmax,则所述工作设备的最大仲裁等待时长Tmax≥2Nmax-1,所述工作设备的Tmax大于系统中每个候选设备的仲裁等待时长Twait。
  11. 根据权利要求7至10任一所述的装置,其特征在于,所述工作设备为所述系统冷启动后,所述系统中Tmax最短的设备,所述装置还包括:
    监测单元,用于在检测到所述系统冷启动后,开始计时,并监测所述总线的总线状态;
    所述处理单元还用于在确定所述监测单元计时得到的计时值大于或等于所述工作设备的Tmax时,确定所述总线状态为总线空闲,则占用所述总线;
    所述传输单元还用于通过所述总线广播总线占用标识和所述工作标识号。
  12. 根据权利要求11所述的装置,其特征在于,所述传输单元还用于:
    在所述处理单元确定所述任一设备不需要发送数据时,通过所述总线广播结束标识;
    在所述处理单元确定所述任一设备需要发送数据时,通过所述总线发送数据,并通过所述总线广播所述结束标识。
  13. 根据权利要求7至12任一所述的装置,其特征在于,所述系统中任一个设备在第一次加入总线仲裁时的最大仲裁等待时长大于所述系统中仲裁等待时长最长的设备的仲裁等待时长。
  14. 一种总线仲裁的系统,其特征在于,所述系统至少包括两个下述装置:
    如权利要求7至13任一所述的总线仲裁的装置。
PCT/CN2016/076965 2015-03-31 2016-03-22 一种总线仲裁的方法、装置及系统 WO2016155540A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510148379.5 2015-03-31
CN201510148379.5A CN104794079B (zh) 2015-03-31 2015-03-31 一种总线仲裁的方法、装置及系统

Publications (1)

Publication Number Publication Date
WO2016155540A1 true WO2016155540A1 (zh) 2016-10-06

Family

ID=53558882

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/076965 WO2016155540A1 (zh) 2015-03-31 2016-03-22 一种总线仲裁的方法、装置及系统

Country Status (2)

Country Link
CN (1) CN104794079B (zh)
WO (1) WO2016155540A1 (zh)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104794079B (zh) * 2015-03-31 2017-12-29 华为技术有限公司 一种总线仲裁的方法、装置及系统
TWI625630B (zh) * 2016-08-02 2018-06-01 緯穎科技服務股份有限公司 電腦系統及匯流排仲裁方法
CN107104865B (zh) * 2017-04-07 2020-08-18 惠州市天泽盈丰物联网科技股份有限公司 一种基于rs485总线的后台扩展方法及其系统
CN107766267B (zh) * 2017-10-12 2020-03-03 郑州云海信息技术有限公司 一种i2c总线的仲裁方法及系统
CN109582626B (zh) * 2018-12-03 2021-10-29 郑州云海信息技术有限公司 一种访问总线的方法、装置、设备及可读存储介质
CN110609803B (zh) * 2019-09-17 2021-02-02 上海钧正网络科技有限公司 主从通信方法、装置、系统、计算机设备和可读存储介质
CN118679470A (zh) * 2022-11-01 2024-09-20 深圳市韶音科技有限公司 通信方法、设备及系统

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101510181A (zh) * 2009-03-19 2009-08-19 北京中星微电子有限公司 一种总线仲裁方法和总线仲裁装置
CN102834816A (zh) * 2010-04-14 2012-12-19 高通股份有限公司 用以减少存取等待时间的总线仲裁技术
CN103077141A (zh) * 2012-12-26 2013-05-01 西安交通大学 一种基于amba总线的自适应实时加权优先仲裁方法及仲裁器
US20140156893A1 (en) * 2012-12-05 2014-06-05 Texas Instruments Incorporated Can bus edge timing control apparatus, systems and methods
WO2014135595A1 (fr) * 2013-03-06 2014-09-12 Sagem Defense Securite Procede de surveillance de communications pour systeme sur puce
CN104794079A (zh) * 2015-03-31 2015-07-22 华为技术有限公司 一种总线仲裁的方法、装置及系统

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6763418B1 (en) * 2001-09-07 2004-07-13 Agilent Technologies, Inc. Request bus arbitration
US6976109B2 (en) * 2003-04-16 2005-12-13 Neomagic Israel Ltd. Multi-level and multi-resolution bus arbitration
US9135195B2 (en) * 2012-07-24 2015-09-15 Freescasle Semiconductor, Inc. Prediction of electronic component behavior in bus-based systems
CN103136142A (zh) * 2013-03-05 2013-06-05 浪潮齐鲁软件产业有限公司 一种总线仲裁的方法

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101510181A (zh) * 2009-03-19 2009-08-19 北京中星微电子有限公司 一种总线仲裁方法和总线仲裁装置
CN102834816A (zh) * 2010-04-14 2012-12-19 高通股份有限公司 用以减少存取等待时间的总线仲裁技术
US20140156893A1 (en) * 2012-12-05 2014-06-05 Texas Instruments Incorporated Can bus edge timing control apparatus, systems and methods
CN103077141A (zh) * 2012-12-26 2013-05-01 西安交通大学 一种基于amba总线的自适应实时加权优先仲裁方法及仲裁器
WO2014135595A1 (fr) * 2013-03-06 2014-09-12 Sagem Defense Securite Procede de surveillance de communications pour systeme sur puce
CN104794079A (zh) * 2015-03-31 2015-07-22 华为技术有限公司 一种总线仲裁的方法、装置及系统

Also Published As

Publication number Publication date
CN104794079A (zh) 2015-07-22
CN104794079B (zh) 2017-12-29

Similar Documents

Publication Publication Date Title
WO2016155540A1 (zh) 一种总线仲裁的方法、装置及系统
US10305823B2 (en) Network interface card configuration method and resource management center
CN105022717B (zh) 附加请求数优先级的片上网络资源仲裁方法及仲裁单元
JP5793690B2 (ja) インタフェース装置、およびメモリバスシステム
US20100287262A1 (en) Method and system for guaranteed end-to-end data flows in a local networking domain
US9860189B2 (en) Systems and methods to enable network communications for management controllers
EP2902914B1 (en) Data transmission method and device
WO2014063463A1 (zh) 一种物理网卡管理方法、装置及物理主机
TW201929501A (zh) 資料處理裝置、及資料處理裝置之控制方法
WO2014201623A1 (zh) 用于数据传输的方法、装置和系统以及物理网卡
JP2016126677A (ja) 負荷算出方法、負荷算出プログラム及び負荷算出装置
JPWO2014128802A1 (ja) インタフェース装置およびバスシステム
CN111371694B (zh) 一种分流方法、装置和系统、处理设备和存储介质
US20190351545A1 (en) Cluster control method, cluster control system, and terminal device
TWI625630B (zh) 電腦系統及匯流排仲裁方法
CN103176941B (zh) 核间通信方法和代理装置
WO2023093805A1 (zh) 存储控制方法、存储控制器、存储芯片、网卡、可读介质
CN104348906B (zh) 一种分布式系统中数据协商方法及装置
JP5978849B2 (ja) 並列計算機システム、クロスバスイッチ及び並列計算機システムの制御方法
EP1119141A1 (en) Real-time communication device and system
JP5949312B2 (ja) 並列計算機システム、データ転送装置及び並列計算機システムの制御方法
US9405719B2 (en) Circuitry to generate and/or use at least one transmission time in at least one descriptor
US7085865B2 (en) I/O throughput by pre-termination arbitration
CN116456447A (zh) 设备同步方法、电子设备及蓝牙通信系统
WO2016074362A1 (zh) 一种数据包的下发方法、装置及宽带接入设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16771295

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16771295

Country of ref document: EP

Kind code of ref document: A1