DMA (Direct Memory Access) transmission data processing method for urban intelligent system
By introducing cache modules and DMA channel information allocation and reorganization technology into urban smart systems, the problem of data congestion in DMA transmission is solved, the smoothness and stability of data transmission are achieved, and the bandwidth and access speed are optimized.
Patent Information
- Application Number
- CN202411137647.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-19
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2044-08-19
AI Technical Summary
Due to the large amount of data in DMA transmission in urban smart systems, traditional DMA is difficult to apply and can easily cause data congestion and transmission failure. There is a lack of effective solutions.
A DMA transmission data processing method is designed. By introducing the first cache module and the second cache module into the urban smart system, DMA channel information is used to allocate and reorganize the data to be transmitted, optimize data transmission, increase the data buffer area, and ensure data transmission. Go smoothly.
It effectively avoids transmission failures caused by data congestion, optimizes the bandwidth and data access speed of urban smart systems, and ensures the smoothness and stability of data transmission.
Smart Images

Figure CN118656320A
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data transmission, and in particular to a DMA transmission data processing method for a smart city system. Background Art
[0002] As the core component of smart cities, the urban smart system uses information technology and Internet technology to deeply integrate urban infrastructure, public services, social management, industrial development, culture and education with intelligent technologies to form an efficient, convenient, safe and green urban life operation platform. This system connects various fields of the city through digital, networked and intelligent technical means to form an interconnected and coordinated ecosystem; DMA (Direct Memory Access) transmission, as an efficient data transmission method, plays an important role in the data transmission and processing of urban smart systems.
[0003] DMA transfer copies data from one address space to another, providing high-speed data transfer between peripherals and memory, memory and memory, and peripherals and peripherals, thus realizing direct data transmission.
[0004] In the related technology, the amount of data generated by the urban smart system is too large, and the traditional DMA is difficult to apply to the urban smart system for data transmission, which can easily cause data congestion and lead to transmission failure.
[0005] There is currently no effective technical solution to the above problems. Summary of the invention
[0006] The purpose of this application is to provide a DMA transmission data processing method for a city smart system to solve the problem of data congestion and transmission failure caused by DMA transmission applications in a city smart system.
[0007] The present application provides a DMA transmission data processing method for a city smart system, which is applied in the city smart system. The city smart system includes a data transmission system, the data transmission system includes a first cache module and a second cache module, and the second cache module includes a plurality of second sub-cache blocks; The method comprises the following steps: S1, receiving data to be transmitted and corresponding target address information based on a first cache module; S2, reading the target address information in the first cache module, and allocating DMA channel information according to the target address information; S3, under the guidance of the DMA channel information, forwarding the data to be transmitted and the corresponding target address information in the first cache module to the second sub-cache block of the second cache module, and different DMA channel information is paired with at least one second sub-cache block in the second cache module; S4. Transmit the data to be transmitted in the second sub-cache block based on DMA transmission.
[0008] The DMA transmission data processing method for urban smart systems of the present application is based on the first cache module directly receiving the data to be transmitted and the corresponding target address information transmitted from each data port, and then allocating DMA channel information to the data to be transmitted according to the target address information, and then reorganizing and forwarding it to different second sub-cache blocks in the second cache module, so as to more effectively utilize the characteristics of DMA transmission for data transmission. At the same time, designing a secondary cache module to cache the data to be transmitted can effectively optimize the bandwidth of the urban smart system and improve the data access speed, and also increase the data buffer area for DMA transmission, ensuring that data transmission can proceed smoothly, and can effectively avoid the phenomenon of transmission failure caused by data congestion.
[0009] The DMA transmission data processing method for the city smart system, wherein step S4 comprises: S41, delivering all the data to be transmitted in the target sub-cache block based on DMA transmission, wherein the target sub-cache block is a second sub-cache block in which the amount of cached data to be transmitted is greater than or equal to a preset amount of data, or a second sub-cache block in which the cached data with a duration greater than or equal to a preset duration is included in the data to be transmitted.
[0010] In this example, the second sub-cache block whose cached data to be transmitted has a data amount greater than or equal to the preset data amount needs to be transmitted in a timely manner using DMA transmission to avoid overflow of the stored data in the second sub-cache block, and fully utilizes the transmission capacity of DMA transmission for data transmission; the second sub-cache block containing data to be transmitted with a cache duration greater than or equal to the preset duration also needs to be transmitted in a timely manner using DMA transmission to avoid the corresponding data to be transmitted staying in the second cache module for too long. The urban smart system has timeliness requirements for some data. If the data to be transmitted stays in the second cache module for too long and the data transmission is not completed, it will affect the normal operation of the urban smart system. Therefore, it is necessary to use DMA to transmit the data to be transmitted in the target sub-cache block. It can also avoid the phenomenon that no new data to be transmitted is generated for a long time, resulting in DMA transmission stagnation, and it can also avoid the phenomenon that the corresponding second sub-cache block occupies the corresponding DMA channel information for a long time, resulting in the corresponding DMA channel being idle for a long time, and can balance the usage of each DMA channel.
[0011] The DMA transmission data processing method for a city smart system, wherein the method further includes a step executed between step S1 and step S2: SA, constructing a data mapping set according to the data to be transmitted and the corresponding target address information in the first cache module; The method further comprises the steps performed between step S3 and step S4: SB. Verify all target address information in the target sub-cache block according to the data mapping set.
[0012] The data source address in step S4 is the storage address of the data to be transmitted in the second cache module, and the target address is the target address information received by the first cache module in step S1; when using DMA transmission, if the address mapping is incorrect, it may cause the target address to be inaccessible, and then cause the target object to fail to receive data. Therefore, the DMA transmission data processing method for urban smart systems in this application introduces steps SA and SB to verify the target address information to ensure that DMA transmission can proceed smoothly.
[0013] The DMA transmission data processing method for a city smart system, wherein the second cache module includes an allocation queue and a transmission queue, and the allocation queue and the transmission queue both include multiple second sub-cache blocks; the second sub-cache blocks in the allocation queue are transferred to the transmission queue after being converted into target sub-cache blocks; after completing data transmission, the target sub-cache block in the transmission queue clears the data stored therein and transfers it to the allocation queue.
[0014] The DMA transmission data processing method for the city smart system, wherein step S2 comprises: S21, reading target address information in the first cache module one by one; S22, analyzing and obtaining the target block where the target address information is located; S23, determining whether there is a second sub-cache block corresponding to the target block in the allocation queue, if yes, executing step S24, otherwise executing step S25; S24, allocating the DMA channel information matching the second sub-cache block corresponding to the target block in the allocation queue to the target address information; S25. Configure DMA channel information for an unloaded second sub-cache block in the allocation queue, and configure the DMA channel information to the target address information.
[0015] The DMA transmission data processing method for the urban smart system, wherein the second cache module also includes an intermediate queue, the intermediate queue includes multiple target sub-cache blocks, and the second sub-cache block in the allocation queue is first transferred to the intermediate queue after being converted into a target sub-cache block to wait for the corresponding DMA channel to be idle before being transferred to the transmission queue.
[0016] The DMA transmission data processing method for the city smart system, wherein step S25 comprises: S251, filtering and acquiring DMA channel information that does not match the target sub-cache block in the intermediate queue; S252: configure the unmatched DMA channel information for an unloaded second sub-cache block in the allocation queue, and configure the unmatched DMA channel information to the target address information.
[0017] The DMA transmission data processing method for the city smart system, wherein step S41 comprises: S411, when a target sub-cache block appears, generating a DMA trigger signal according to the DMA channel information paired with the target sub-cache block to trigger a DMA controller to call a corresponding DMA channel to transmit corresponding data to be transmitted according to the target address information cached in the target sub-cache block.
[0018] The DMA transmission data processing method for the city smart system, wherein when executing step S4, the method further includes the following steps: The CPU's access permission to the second sub-cache block that is transmitting the data to be transmitted is suspended.
[0019] The DMA transmission data processing method for a city smart system, wherein the first cache module includes a plurality of first sub-cache blocks, each of which is used to cache a set of data to be transmitted and corresponding target address information.
[0020] From the above, it can be seen that the DMA transmission data processing method for urban smart systems of the present application is based on the first cache module directly receiving the data to be transmitted and the corresponding target address information transmitted from each data port, and then allocating DMA channel information to the data to be transmitted according to the target address information, and then reorganizing and forwarding it to different second sub-cache blocks in the second cache module, so as to more effectively utilize the characteristics of DMA transmission for data transmission. At the same time, designing a secondary cache module to cache the data to be transmitted can effectively optimize the bandwidth of the urban smart system and improve the data access speed, and also add a data buffer area for DMA transmission, ensuring that data transmission can proceed smoothly, and can effectively avoid the phenomenon of transmission failure caused by data congestion. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 A flowchart of a DMA transmission data processing method for a city smart system provided in an embodiment of the present application.
[0022] Figure 2 Another flow chart of the DMA transmission data processing method for a city smart system provided in an embodiment of the present application.
[0023] Figure 3 It is a schematic diagram of the structure of the second cache module. DETAILED DESCRIPTION
[0024] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0025] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0026] Please refer to Figure 1-Figure 3 , some embodiments of the present application provide a DMA transmission data processing method for a city smart system, which is applied in the city smart system. The city smart system includes a data transmission system, the data transmission system includes a first cache module and a second cache module, and the second cache module includes a plurality of second sub-cache blocks; The DMA transmission data processing method for the city smart system includes the following steps: S1, receiving data to be transmitted and corresponding target address information based on a first cache module; S2, reading the target address information in the first cache module, and allocating DMA channel information according to the target address information; S3, under the guidance of the DMA channel information, forwarding the data to be transmitted and the corresponding target address information in the first cache module to the second sub-cache block of the second cache module, and different DMA channel information is paired with at least one second sub-cache block in the second cache module; S4. Transmit the data to be transmitted in the second sub-cache block based on DMA transmission.
[0027] Specifically, the data transmission system is an important part of the smart city infrastructure. It integrates and transmits data from various departments and fields in the city through networks and transmission equipment to achieve data sharing, information exchange and intelligent management; wherein, the data transmission system mainly includes two types of functions: network data transmission and local data transmission. The DMA transmission data processing method for the urban smart system in the embodiment of the present application is mainly used in local data transmission to locally transmit the data collected by various types of acquisition devices or the data received from the network port; the part of the data transmission system that performs the local data transmission function is provided with two levels of cache modules, wherein the first cache module is used to cache the data collected by the aforementioned various types of acquisition devices or the data received from the network port, which need to be transmitted to a specific storage location of the urban smart system and belong to the data to be transmitted; in the embodiment of the present application, the first cache module can be one or more, which are connected to different data ports, and can be expanded to connect different types of data ports according to usage requirements, and can receive corresponding data to be transmitted from the data port, so as to comprehensively obtain and cache various types of data to be transmitted that need to be locally transmitted during the operation of the urban smart system.
[0028] It should be noted that the DMA transmission data processing method for the urban smart system in the embodiment of the present application mainly transmits the data to be transmitted through DMA transmission. Therefore, the data transmission system also includes a DMA controller and multiple DMA channels for realizing DMA transmission; wherein, the target object of the DMA transmission may be one or more, and in the embodiment of the present application, it is preferably a data storage device of the urban smart system.
[0029] More specifically, the first cache module receives the data to be transmitted and the corresponding target address information based on the timing sequence of data transmission. The target address information is the final storage address where the corresponding data to be transmitted needs to be transmitted, and is generated by the parent source object of the data port connected to the first cache module or the CPU; the first cache module preferably synchronously aligns the data to be transmitted and the corresponding target address information for caching, such as storing each group of data to be transmitted and the corresponding target address information in the same first sub-cache block, so that the data to be transmitted and the corresponding target address information are aligned, which facilitates subsequent data analysis, data forwarding and data transmission.
[0030] More specifically, the DMA channel information is an identifier or number used in the DMA controller to distinguish different data transmission paths during the DMA transmission process.
[0031] More specifically, during the DMA transmission process, a transmission behavior based on a DMA channel can only transmit a continuous block of data. In the embodiment of the present application, steps S2-S3 are equivalent to a reorganization process of a block of data, and step S4 is the actual DMA transmission process, wherein step S2 can analyze the ownership (block) of the final storage address of the corresponding data to be transmitted according to the target address information, and then analyze whether different data to be transmitted can be configured for transmission in one transmission behavior, and then classify the different data to be transmitted through step S3 to reorganize into multiple data groups containing multiple data to be transmitted that need to be transmitted using different DMA channels; therefore, the process of allocating DMA channel information according to the target address information in step S2 is actually a process of classifying the data to be transmitted according to the ownership of the final storage address of the data to be transmitted, and step S3 is a process of allocating and reorganizing the data to be transmitted according to the DMA channel information to which the data to be transmitted is allocated. At the same time, considering the characteristic that DMA transmission can only transmit a continuous block of data, the method of caching the data to be transmitted based on the second sub-cache block paired with the DMA channel information can enable DMA transmission to transmit the corresponding data to be transmitted in the second sub-cache block based on the corresponding DMA channel each time.
[0032] It should be noted that the second sub-cache block can achieve pairing with the DMA channel information by adding a flag bit about the DMA channel information or storing the DMA channel information in the block. In the embodiment of the present application, it is preferred to store the DMA channel information in the starting address of the second sub-cache block to determine the pairing of the second sub-cache block, so that subsequent DMA transmission can determine the DMA channel it needs to use for data transmission by directly reading the data at the starting address of the second sub-cache block.
[0033] More specifically, the process of forwarding the data to be transmitted and the corresponding target address information in the first cache module to the second cache module can be carried out in a general data forwarding manner, or can be carried out in a DMA transmission manner to further reduce the CPU load, wherein the process of transmission forwarding based on the DMA transmission manner includes: determining the second sub-cache block that needs to receive the data to be transmitted and the corresponding target address information based on the DMA channel information, using the address of the second sub-cache block as a temporary target address, and transmitting the transmission data consisting of the data to be transmitted and the corresponding target address information based on the DMA transmission according to the temporary target address, thereby realizing the transmission forwarding of the data to be transmitted and the corresponding target address information.
[0034] More specifically, step S3 is a process of allocating and reorganizing according to the target address information corresponding to the data to be transmitted, and step S4 is a process of transmitting the allocated and reorganized data to be transmitted according to the target address information in the second sub-cache block, wherein the specific transmission process may be: determining the DMA channel information of the second sub-cache block for data transmission as needed (determined by the corresponding matching relationship, such as reading the DMA channel information stored in the starting address in the aforementioned second sub-cache block), calling the DMA channel corresponding to the DMA channel information based on the DMA controller, sequentially reading the target address information stored in the second sub-cache block, and transmitting the data to be transmitted corresponding to the target address information in the second sub-cache block to the target address information of the data storage device of the city smart system based on the DMA channel, so as to complete the transmission of all the data to be transmitted reorganized by the second sub-cache block in one transmission behavior; in addition, the second sub-cache block is divided based on the DMA channel information, and step S2 can reasonably plan and allocate the DMA channel information, so that during the DMA transmission, multiple tasks will not occupy the same DMA channel at the same time, resulting in transmission failure, thereby ensuring the smoothness of DMA transmission.
[0035] More specifically, the first cache module and the second cache module are pre-constructed cache areas with continuous addresses.
[0036] The DMA transmission data processing method for the urban smart system in the embodiment of the present application is based on the first cache module directly receiving the data to be transmitted and the corresponding target address information transmitted from each data port, and then allocating DMA channel information to the data to be transmitted according to the target address information, and then reorganizing and forwarding it to different second sub-cache blocks in the second cache module, so as to more effectively utilize the characteristics of DMA transmission for data transmission. At the same time, designing a secondary cache module to cache the data to be transmitted can effectively optimize the bandwidth of the urban smart system and improve the data access speed, and also increase the data buffer area for DMA transmission, ensuring that data transmission can proceed smoothly, and can effectively avoid the phenomenon of transmission failure caused by data congestion.
[0037] In some preferred embodiments, step S4 comprises: S41, delivering all the data to be transmitted in the target sub-cache block based on DMA transmission, the target sub-cache block being a second sub-cache block in which the amount of cached data to be transmitted is greater than or equal to a preset amount of data, or a second sub-cache block containing data to be transmitted with a cache duration greater than or equal to a preset duration.
[0038] Specifically, in order to make better use of the single transmission capacity of the DMA channel, step S41 only transmits the data to be transmitted in the second sub-cache block that meets specific conditions. In the embodiment of the present application, these second sub-cache blocks that meet specific conditions are defined as target sub-cache blocks; wherein, the second sub-cache block whose cached data to be transmitted has a data amount greater than or equal to the preset data amount needs to be transmitted in a timely manner using DMA transmission to avoid overflow of the stored data of the second sub-cache block, and also fully utilizes the transmission capacity of DMA transmission for data transmission; the second sub-cache block containing data to be transmitted whose cache duration is greater than or equal to the preset duration also needs to be transmitted in a timely manner using DMA transmission to avoid the corresponding data to be transmitted from being retained in the second cache module for too long. The urban smart system has timeliness requirements for some data. If the data to be transmitted stays in the second cache module for too long and the data transmission is not completed, it will affect the normal operation of the urban smart system. Therefore, it is necessary to use DMA to transmit the data to be transmitted in the target sub-cache block, and it can also avoid the phenomenon that no new data to be transmitted is generated for a long time, resulting in DMA transmission stagnation, and it can also avoid the phenomenon that the corresponding second sub-cache block occupies the corresponding DMA channel information for a long time, resulting in the corresponding DMA channel being idle for a long time, and it can balance the usage of each DMA channel.
[0039] More specifically, the preset data volume can be set according to the transmission requirements. In the embodiment of the present application, it is preferably 90% of the total storage capacity of the second sub-cache block.
[0040] More specifically, the preset duration can be set according to the timeliness requirements of the urban smart system for data.
[0041] More specifically, the DMA transmission data processing method for a city smart system in an embodiment of the present application can determine whether each second sub-cache block belongs to a target sub-cache block by monitoring or counting. In an embodiment of the present application, in order to further reduce the operating load of the CPU, it is preferably implemented in a counting manner; wherein each second sub-cache block is configured with two counters, one of which is used to count the amount of stored data in the second sub-cache block, and the other is used to count the time after the second sub-cache block starts writing data. The two counters are respectively configured with corresponding counting thresholds, corresponding to a preset data amount and a preset time length, respectively. After the counter reaches the counting threshold, it triggers DMA transmission to transmit the data to be transmitted in the second sub-cache block.
[0042] More specifically, after reaching the counting threshold, the counter can directly generate a corresponding DMA trigger signal to trigger the DMA transfer operation, or it can determine the second sub-cache block as the target sub-cache block after reaching the counting threshold, so that the DMA transmission data processing method for the urban smart system in the embodiment of the present application generates a corresponding DMA trigger signal to trigger the DMA transfer operation after identifying the appearance of the target sub-cache block; wherein, in the latter method, each second sub-cache block is configured with a corresponding flag bit regarding the target sub-cache block, and the counter sets the flag bit to 1 to determine the corresponding second sub-cache block as the target sub-cache block.
[0043] In some preferred embodiments, the DMA transmission data processing method for a city smart system further includes the following steps executed between step S1 and step S2: SA, constructing a data mapping set according to the data to be transmitted in the first cache module and the corresponding target address information; The DMA transmission data processing method for the city smart system also includes the following steps executed between step S3 and step S4: SB, verify all target address information in the target sub-cache block according to the data mapping set.
[0044] Specifically, the core parameters of DMA transmission include the data source address and the target address of the data transmission location, wherein the data source address in step S4 is the storage address of the data to be transmitted in the second cache module, and the target address is the target address information received by the first cache module in step S1; when using DMA transmission, if the address mapping is incorrect (that is, the data source address and the target address do not match), it may result in the inability to access the target address, and then cause the target object to fail to receive data. Therefore, the DMA transmission data processing method for the urban smart system in the embodiment of the present application introduces steps SA and SB to verify the target address information to ensure that the DMA transmission can proceed smoothly.
[0045] More specifically, the data mapping set includes a mapping relationship between tag data of the data to be transmitted and the corresponding target address information, wherein the tag data is used to distinguish the data to be transmitted, and may be characteristic data, header data, check code, etc. of the data to be transmitted, such as a CRC code for the data to be transmitted. In an embodiment of the present application, it is preferably 32-bit header data intercepted from the data to be transmitted; in the data mapping set, each tag data has corresponding target address information, and step SB can compare whether the tag data corresponding to the data to be transmitted in the target sub-cache block and the corresponding target address information exist in the data mapping set to verify the target address information of the data to be transmitted.
[0046] More specifically, step S4 is a step that is executed only after the verification of the target sub-cache block is passed. After the verification of the target sub-cache block fails, the DMA transmission data processing method for the urban smart system in the embodiment of the present application clears the target sub-cache block and deletes the mapping relationship of the corresponding data to be transmitted in the data mapping set, and retransmits the data to be transmitted based on steps S2 and S3 for reallocation, thereby ensuring the integrity of the data to be transmitted while ensuring that the DMA transmission can proceed smoothly.
[0047] More specifically, the construction process of the data mapping set is a continuous construction process, that is, each time the first cache module receives the data to be transmitted and the corresponding target address information, the data mapping set will add a corresponding data mapping set based on the data to be transmitted and the corresponding target address information, so it includes the mapping relationship corresponding to all the data to be transmitted stored in the first cache module and all the data to be transmitted stored in the second cache module that are not yet ready for transmission.
[0048] More specifically, in order to prevent the data mapping set from being too bloated, step SB further includes: after the target address information is verified, deleting the mapping relationship of the target address information in the data mapping set corresponding to the data to be transmitted.
[0049] More specifically, the target address information is generally the starting address of the final storage address to which the data to be transmitted needs to be transmitted. Therefore, in some more preferred embodiments, the data mapping set constructed in step SA also includes a mapping relationship between the data to be transmitted and the corresponding data length, and step SB also includes verifying the data length of all data to be transmitted in the target sub-cache block according to the data mapping set, thereby ensuring accurate DMA transmission.
[0050] In some preferred embodiments, the DMA transmission data processing method for a city smart system further includes the following steps executed between step SB and step S4: SC,verifies the consistency of all blocks where the target address information in the target sub-cache block is located.
[0051] Specifically, this step is to independently verify the ownership of the target address information cached by each target sub-cache block to ensure that the final storage address of the cached data to be transmitted is located in the same block, so as to ensure that the DMA transmission can successfully complete the corresponding transmission task.
[0052] More specifically, step S4 is a step that is executed only after the consistency verification of the target sub-cache block is passed. After the consistency verification of the target sub-cache block fails, the DMA transmission data processing method for the city smart system of the embodiment of the present application clears the target sub-cache block and deletes the mapping relationship of the corresponding data to be transmitted in the data mapping set, and retransmits the data to be transmitted based on steps S2 and S3 for redistribution, thereby ensuring the integrity of the data to be transmitted while ensuring that the DMA transmission can proceed smoothly. It should be noted that the first cache module deletes the corresponding cached data to be transmitted only after the target sub-cache block completes the verification of steps SB and SC, so as to ensure that the first cache module can provide the corresponding data to be transmitted and the corresponding target address information to the second cache module again after the corresponding data verification fails, thereby ensuring the integrity and reliability of data transmission.
[0053] More specifically, the DMA transmission data processing method for urban smart systems in the embodiment of the present application performs secondary verification on the data cached in the target sub-cache block based on the data mapping set and consistency, ensuring that the DMA transmission can successfully complete the corresponding transmission task and greatly improving the accuracy of data transmission.
[0054] In some preferred embodiments, the second cache module includes an allocation queue and a transmission queue, each of which includes multiple second sub-cache blocks; the second sub-cache blocks in the allocation queue are transferred to the transmission queue after being converted into target sub-cache blocks; after completing data transmission, the target sub-cache block in the transmission queue clears the data stored therein and transfers it to the allocation queue.
[0055] Specifically, the DMA transmission data processing method for the urban smart system of the embodiment of the present application divides the second cache module into an allocation queue and a transmission queue, which can effectively ensure the orderliness of data caching and transmission. Among them, the allocation queue has a data receiving function but not a data transmission function, and the transmission queue has a data transmission function but not a data receiving function, ensuring a clear functional division; and the corresponding second sub-cache blocks can be converted to each other, realizing the recycling of the second sub-cache blocks, and can make full use of the cache capacity of the second cache module.
[0056] More specifically, each second sub-cache block has a corresponding queue flag bit. The DMA transmission data processing method for a city smart system in an embodiment of the present application can switch the queue where the second sub-cache block is located by changing the queue flag bit.
[0057] It should be noted that step S3 completes the forwarding of the data to be transmitted based on the allocation queue, and step S4 completes the DMA transmission based on the transmission queue.
[0058] It should be noted that the number of target sub-cache blocks in the transfer queue is less than or equal to the number of DMA channels.
[0059] In some preferred embodiments, the second sub-cache block in the allocation queue is transferred to the transmission queue only after it is transformed into a target sub-cache block and passes the verification of steps SB and SC.
[0060] In some preferred embodiments, step S2 comprises: S21, reading target address information in the first cache module one by one; S22, analyzing and obtaining the target block where the target address information is located; S23, determining whether there is a second sub-cache block corresponding to the target block in the allocation queue, if yes, executing step S24, otherwise executing step S25; S24, assigning the DMA channel information matching the second sub-cache block corresponding to the target block in the allocation queue to the target address information; S25, configuring DMA channel information for an unloaded second sub-cache block in the allocation queue, and configuring the DMA channel information to the target address information.
[0061] Specifically, the target block where the target address information is located is a block of the data storage device of the urban smart system after transmission (which may be recorded by block number, position or block address). Steps S23 to S25 are the process of dividing the target address information based on the target block to determine the corresponding DMA channel information. It can be understood as establishing a pairing relationship between the target address information and the second sub-cache block and the DMA channel information based on the target block, and in the absence of suitable second sub-cache block and DMA channel information, creating suitable second sub-cache block and DMA channel information to establish a pairing relationship with the corresponding target address information; preferably, the DMA channel information corresponding to the second sub-cache blocks in the allocation queue are all different.
[0062] More specifically, the unloaded second sub-cache block used in step S25 is an unloaded second sub-cache block in a randomly selected allocation queue, which can effectively balance the usage of each second sub-cache block.
[0063] In some preferred embodiments, Figure 3 As shown, the second cache module also includes an intermediate queue, which includes multiple target sub-cache blocks. After the second sub-cache block in the allocation queue is converted into a target sub-cache block, it is first transferred to the intermediate queue to wait for the corresponding DMA channel to be idle before being transferred to the transmission queue.
[0064] It should be noted that in this embodiment, after the second sub-cache block in the allocation queue is transformed into the target sub-cache block and passes the verification of steps SB and SC, it is first transferred to the intermediate queue for queuing to wait for transfer to the transmission queue for transmission.
[0065] Specifically, in this embodiment, the data to be transmitted cached by the target sub-cache block in the intermediate queue is data that can be directly transmitted based on DMA transmission. Combined with the definition of the target sub-cache block in the aforementioned step S41, it can be seen that the second sub-cache block in the allocation queue is transformed into a target sub-cache block after meeting specific conditions and enters the intermediate queue to wait for transmission. Each target sub-cache block has matching DMA channel information. After the corresponding DMA channel is idle (that is, after completing the previous round of transmission tasks), the second sub-cache block in the intermediate queue is transferred to the transmission queue for DMA transmission; this processing method can further improve the orderliness and reliability of DMA transmission, and can further avoid the problem of data transmission failure caused by simultaneous occupation of DMA channels.
[0066] In some preferred embodiments, step S25 includes: S251, filtering and acquiring DMA channel information that does not match the target sub-cache block in the intermediate queue; S252: configure the unmatched DMA channel information for an unloaded second sub-cache block in the allocation queue, and configure the unmatched DMA channel information to the target address information.
[0067] Specifically, in order to further avoid the problem of data transmission failure caused by DMA channels being occupied at the same time, and to avoid large differences in the usage levels of different DMA channels caused by some DMA channels being occupied for a long time, step S25 balances the distribution method of DMA channel information based on the above-mentioned execution method, thereby balancing the service life of each DMA channel.
[0068] In some preferred embodiments, step S41 includes: S411, when a target sub-cache block appears, a DMA trigger signal is generated according to the DMA channel information paired with the target sub-cache block to trigger a DMA controller to call a corresponding DMA channel to transmit corresponding data to be transmitted according to the target address information cached in the target sub-cache block.
[0069] Specifically, different from the general DMA transmission logic, the DMA transmission data processing method for the urban smart system of the embodiment of the present application determines the storage location of the data to be transmitted and the corresponding target address information in the second sub-cache block based on a preset format or a preset divided storage space or a preset determined data mark bit, and designs the DMA controller to read the target address information and the previously allocated DMA channel information from the target sub-cache block, so as to use the corresponding DMA channel to transfer the corresponding data to be transmitted to the storage location corresponding to the target address information; wherein, the DMA trigger signal is an enable signal for triggering the operation of the DMA controller.
[0070] More specifically, in an implementation manner in which the second cache module includes an allocation queue and a transmission queue or includes an allocation queue, an intermediate queue and a transmission queue, the condition for the appearance of a target sub-cache block corresponds to: the target sub-cache block appears in the transmission queue; therefore, in this implementation manner, the queue flag bit of the transmission queue can be used as a DMA trigger signal.
[0071] In some preferred embodiments, when executing step S4, the method further comprises the following steps: The CPU's access permission to the second sub-cache block that is transmitting the data to be transmitted is suspended.
[0072] Specifically, the second sub-cache block that is transmitting the data to be transmitted corresponds to the target sub-cache block in the aforementioned transmission queue.
[0073] More specifically, in order to avoid CPU operation conflicts, the DMA transmission data processing method for a city smart system in an embodiment of the present application suspends the CPU's access rights to the second sub-cache block that is transmitting the data to be transmitted, thereby preventing the CPU's related instruction behavior from affecting the data to be transmitted in the second sub-cache block, and also preventing the data to be transmitted from being accessed simultaneously and affecting the DMA transmission process.
[0074] In some preferred embodiments, the first cache module includes a plurality of first sub-cache blocks, and each first sub-cache block is used to cache a group of data to be transmitted and corresponding target address information.
[0075] Specifically, since the first sub-cache block actually only needs to accept one set of data to be transmitted and the corresponding target address information to forward data, and the second sub-cache block needs to accept multiple sets of data to be transmitted and the corresponding target address information to be converted into a target sub-cache block, the number of first sub-cache blocks is preferably greater than the number of second sub-cache blocks.
[0076] More specifically, in this embodiment, the first sub-cache block preferably receives and forwards the data to be transmitted and the corresponding target address information based on the data transmission timing, so as to ensure the orderliness and timeliness of data transmission.
[0077] In some preferred embodiments, the first cache module includes an idle queue and a load queue, each of which includes multiple first sub-cache blocks. The first sub-cache block in the idle queue is transferred to the load queue after the data to be transmitted and the corresponding target address information are passed in; the first sub-cache block in the load queue is transferred to the idle queue after the data is cleared.
[0078] Specifically, this implementation achieves the recycling of the first sub-cache block, and can fully utilize the cache capacity of the first cache module to receive and forward data.
[0079] More specifically, the unloaded queue receives the data to be transmitted and the corresponding target address information based on the first sub-cache block at the head of the queue.
[0080] More specifically, the multiple first sub-cache blocks in the unloaded queue can receive the data to be transmitted and the corresponding target address information in parallel based on the data transmission timing; the multiple first sub-cache blocks in the loaded queue can forward the data to be transmitted and the corresponding target address information in parallel after being allocated the DMA channel information.
[0081] Furthermore, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0082] In this document, relational terms such as first and second, etc. are used merely to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any such actual relationship or order between these entities or operations.
[0083] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A DMA transmission data processing method for a city smart system, applied in a city smart system, characterized in that: The city intelligence system includes a data transmission system, the data transmission system includes a first cache module and a second cache module, the second cache module includes a plurality of second sub-cache blocks; The method comprises the following steps: S1, receiving data to be transmitted and corresponding target address information based on a first cache module; S2, reading the target address information in the first cache module, and allocating DMA channel information according to the target address information; S3, under the guidance of the DMA channel information, forwarding the data to be transmitted and the corresponding target address information in the first cache module to the second sub-cache block of the second cache module, and different DMA channel information is paired with at least one second sub-cache block in the second cache module; S4. Transmit the data to be transmitted in the second sub-cache block based on DMA transmission.
2. The DMA transmission data processing method for a city smart system according to claim 1, characterized in that: Step S4 includes: S41, delivering all the data to be transmitted in the target sub-cache block based on DMA transmission, wherein the target sub-cache block is a second sub-cache block in which the amount of cached data to be transmitted is greater than or equal to a preset amount of data, or a second sub-cache block in which the cached data having a cache duration greater than or equal to a preset duration is transmitted.
3. The DMA transmission data processing method for a city smart system according to claim 2, characterized in that: The method further comprises the following steps performed between step S1 and step S2: SA, constructing a data mapping set according to the data to be transmitted and the corresponding target address information in the first cache module; The method further comprises the steps performed between step S3 and step S4: SB. Verify all target address information in the target sub-cache block according to the data mapping set.
4. The DMA transmission data processing method for a city smart system according to claim 2, characterized in that: The second cache module includes an allocation queue and a transmission queue, and the allocation queue and the transmission queue both include a plurality of second sub-cache blocks; the second sub-cache blocks in the allocation queue are transferred to the transmission queue after being transformed into target sub-cache blocks; After completing the data transmission, the target sub-cache block in the transmission queue clears the stored data and transfers it to the allocation queue.
5. The DMA transmission data processing method for a city smart system according to claim 4, characterized in that: Step S2 includes: S21, reading target address information in the first cache module one by one; S22, analyzing and obtaining the target block where the target address information is located; S23, determining whether there is a second sub-cache block corresponding to the target block in the allocation queue, if yes, executing step S24, otherwise executing step S25; S24, allocating the DMA channel information matching the second sub-cache block corresponding to the target block in the allocation queue to the target address information; S25. Configure DMA channel information for an unloaded second sub-cache block in the allocation queue, and configure the DMA channel information to the target address information.
6. The DMA transmission data processing method for a city smart system according to claim 5, characterized in that: The second cache module also includes an intermediate queue, which includes multiple target sub-cache blocks. After being converted into a target sub-cache block, the second sub-cache block in the allocation queue is first transferred to the intermediate queue to wait for the corresponding DMA channel to be idle before being transferred to the transmission queue.
7. The DMA transmission data processing method for a city smart system according to claim 6, characterized in that: Step S25 includes: S251, filtering and acquiring DMA channel information that does not match the target sub-cache block in the intermediate queue; S252: configure the unmatched DMA channel information for an unloaded second sub-cache block in the allocation queue, and configure the unmatched DMA channel information to the target address information.
8. The DMA transmission data processing method for a city smart system according to claim 2, characterized in that: The steps of step S41 include: S411, when a target sub-cache block appears, generating a DMA trigger signal according to the DMA channel information paired with the target sub-cache block to trigger a DMA controller to call a corresponding DMA channel to transmit corresponding data to be transmitted according to the target address information cached in the target sub-cache block.
9. The DMA transmission data processing method for a city smart system according to claim 1, characterized in that: When executing step S4, the method further comprises the following steps: The CPU's access permission to the second sub-cache block that is transmitting the data to be transmitted is suspended.
10. The DMA transmission data processing method for a city smart system according to claim 1, characterized in that: The first cache module includes a plurality of first sub-cache blocks, and each of the first sub-cache blocks is used to cache a group of data to be transmitted and corresponding target address information.
Citation Information
Patent Citations
Processor system, as well as multi-channel memory copying DMA accelerator and method thereof
CN102567256A
Bus communication method and system
CN105677592A
Data processing system, method and device
CN110781104A
Direct memory access system and method
CN112256604A
Multi-partition network communication system of FC (Fiber Channel) equipment end and communication method of multi-partition network communication system
CN115118678A
Cited By
Audio processing method, audio playing method, audio processing device, audio playing device and control equipment
CN119724260A
