Multi-channel concurrent communication method and device based on security unit, equipment and medium
By adopting a multi-channel concurrent communication method in the security unit device and using a polling mechanism to process the received data, the problem of poor timeliness and stability of communication processing of the security unit device in the prior art is solved, and the timeliness and stability of data processing is achieved.
Patent Information
- Application Number
- CN202411771262.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2044-12-04
AI Technical Summary
The communication processing methods of existing security unit devices have poor timeliness and stability, mainly because processing data during interrupts will affect the utilization of interrupt signals and memory resources of other modules, resulting in untimely data processing and insufficient memory.
A multi-channel concurrent communication method based on a security unit is adopted, and the reception is triggered after receiving the data sent by the host device, and a preset mask value is set for the mask bits of the corresponding communication channel, the mask value of each mask bit is read through polling and the data in the storage space where the mask value is not the target mask value is processed.
This method avoids data processing overflow when the slave device processes data sent by a single host device to the greatest extent, ensures the stability of the slave device, and processes it by polling and reading the data received by each communication channel, ensuring that the data sent by each host device can be processed in turn, and ensuring the timeliness of data processing.
Smart Images

Figure CN119691825A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of communication technology, and more specifically to a communication method in which a single security unit device interacts with multiple devices simultaneously based on currently disclosed communication protocols (such as a serial peripheral interface (SPI) protocol, a two-wire serial communication bus (I2C) protocol, etc.), and more particularly to a multi-channel concurrent communication method, apparatus, device and medium based on a security unit. Background Art
[0002] At present, existing security unit device communications are all based on the interruption generated by the security unit device after receiving communication data, processing the data in the interruption or storing the data in the system message queue of the security unit device, and then processing the data according to the queue order.
[0003] However, the above communication processing method has problems with timeliness and poor stability. This is because processing data in the interrupt generated by the security unit device will affect the interrupts of other modules of the security unit device, that is, it will cause other interrupt signals to be generated untimely, resulting in poor timeliness; a large amount of data stored in the system queue is also a challenge to the memory of the security unit device. If the memory space is insufficient, the security unit device will not be able to operate normally, resulting in stability problems. The security unit device may be attacked by large amounts of data transmission, and a stable data processing solution is very necessary. Summary of the invention
[0004] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a multi-channel concurrent communication method, device, equipment and medium based on a security unit.
[0005] In a first aspect, an embodiment of the present disclosure provides a multi-channel concurrent communication method based on a security unit, which is applied to a slave device, wherein the slave device is connected to multiple first host devices through multiple communication channels, and one communication channel is connected to one first host device, and the method includes:
[0006] In response to receiving data sent by at least one first host device, triggering a reception completion interrupt and setting a preset mask value for a mask bit of a communication channel respectively corresponding to the at least one first host device;
[0007] The mask value of each mask bit in the mask sequence is read in turn by polling;
[0008] In the case where the mask value of the current mask bit is not the target mask value, processing the data in the storage space corresponding to the current mask bit, and feeding back a response message through the target communication channel corresponding to the current mask bit, so that the first host device connected to the target communication channel continues to send the next data after receiving the response message;
[0009] Setting the mask value of the current mask bit as the target mask value, and continuing to read the mask value of the next mask bit in the mask sequence;
[0010] When the mask value of each mask bit in the mask sequence is the target mask value, the polling operation is stopped.
[0011] In a second aspect, an embodiment of the present disclosure provides a multi-channel concurrent communication device based on a security unit, which is applied to a slave device, wherein the slave device is connected to multiple first host devices through multiple communication channels, and one communication channel is connected to one first host device, and the device includes:
[0012] an interrupt triggering module, configured to trigger a reception completion interrupt in response to receiving data sent by at least one first host device and to set a preset mask value for a mask bit of a communication channel respectively corresponding to the at least one first host device;
[0013] A polling module, used for sequentially reading the mask value of each mask bit in the mask sequence in a polling manner;
[0014] a data processing module, configured to process data in a storage space corresponding to a current mask bit when a mask value of the current mask bit is not a target mask value, and feed back a response message through a target communication channel corresponding to the current mask bit, so that a first host device connected to the target communication channel continues to send next data after receiving the response message;
[0015] A reset module, used for setting the mask value of the current mask bit to the target mask value;
[0016] The polling module is further configured to continue reading the mask value of the next mask bit in the mask sequence; and stop the polling operation when the mask value of each mask bit in the mask sequence is the target mask value.
[0017] In a third aspect, an embodiment of the present disclosure provides an electronic device, comprising: a processor; a memory for storing executable instructions of the processor; the processor is used to read the executable instructions from the memory and execute the executable instructions to implement the multi-channel concurrent communication method based on the security unit as described in the first aspect.
[0018] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program is used to implement the multi-channel concurrent communication method based on the security unit as described in the first aspect.
[0019] Compared with the prior art, the technical solution provided by the embodiments of the present disclosure has the following advantages:
[0020] The multi-channel concurrent communication scheme based on the security unit provided by the embodiment of the present disclosure triggers a reception completion interrupt in response to receiving data sent by at least one first host device and sets a preset mask value for the mask bit of the communication channel corresponding to the at least one first host device; reads the mask value of each mask bit in the mask sequence in turn by polling; when the mask value of the current mask bit is not the target mask value, processes the data in the storage space corresponding to the current mask bit, and feeds back a response message through the target communication channel corresponding to the current mask bit, so that the first host device connected to the target communication channel continues to send the next data after receiving the response message; sets the mask value of the current mask bit to the target mask value, and continues to read the mask value of the next mask bit in the mask sequence; when the mask value of each mask bit in the mask sequence is the target mask value, stops the polling operation. By adopting the scheme disclosed in the present invention, after receiving the data sent by the host device, a reception completion interrupt is triggered and a preset mask value is set for the mask bit of the corresponding communication channel, and the mask value of each mask bit is read in a polling manner and the data in the storage space corresponding to the mask bit whose mask value is not the target mask value is processed, it is ensured to the greatest extent that the slave device does not obtain too much data from a certain host device for processing at one time, resulting in the situation that the data sent by a single host device is always processed, thereby ensuring the stability of the slave device, and by polling and reading the data received by each communication channel for processing, it can be ensured that the data sent by each host device can be processed in turn, thereby ensuring the timeliness of the processing of each data, and there is no need to process the data in the interruption, thereby avoiding the impact on the interruption of other modules. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0022] Figure 1 A flowchart of a multi-channel concurrent communication method based on a security unit provided by an exemplary embodiment of the present disclosure;
[0023] Figure 2 A schematic diagram showing the format of a mask sequence of an exemplary embodiment of the present disclosure is shown;
[0024] Figure 3 A schematic diagram showing a multi-channel concurrent data reception by a slave device according to an exemplary embodiment of the present disclosure is shown;
[0025] Figure 4 A schematic diagram showing a multi-channel concurrent response of a slave device according to an exemplary embodiment of the present disclosure is shown;
[0026] Figure 5 A schematic diagram showing the next state of a slave device after executing an operation of a mask sequence consisting of a polling interface mask according to an exemplary embodiment of the present disclosure;
[0027] FIG. 6( a ) shows a schematic diagram of a working process of connecting a host device and a slave device via a physical signal line according to an exemplary embodiment of the present disclosure. Figure 1 ;
[0028] FIG. 6( b ) shows a schematic diagram of a working process of connecting a host device and a slave device via a physical signal line according to an exemplary embodiment of the present disclosure. Figure 2 ;
[0029] FIG. 6( c ) shows a schematic diagram of a working process of connecting a host device and a slave device via a physical signal line according to an exemplary embodiment of the present disclosure. Figure 3 ;
[0030] FIG. 6( d ) shows a schematic diagram of a working process of connecting a host device and a slave device via a physical signal line according to an exemplary embodiment of the present disclosure. Figure 4 ;
[0031] Figure 7 A schematic diagram of the structure of a multi-channel concurrent communication device based on a security unit provided in one embodiment of the present disclosure. DETAILED DESCRIPTION
[0032] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0033] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0034] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0035] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0036] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0037] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0038] The following is a detailed explanation of the multi-channel concurrent communication method, device, equipment and medium based on the security unit provided by the present disclosure in conjunction with the accompanying drawings.
[0039] Figure 1 A flow chart of a multi-channel concurrent communication method based on a security unit is provided for an exemplary embodiment of the present disclosure. The method can be executed by a multi-channel concurrent communication device based on a security unit provided in an embodiment of the present disclosure. The device can be implemented by software and / or hardware and can be integrated in an electronic device. The electronic device is a device integrated with a security element (Secure Element, SE).
[0040] The multi-channel concurrent communication method based on the safety unit disclosed in the present invention is applied to a slave device, and the slave device is connected to multiple first host devices through multiple communication channels, and one communication channel is connected to one first host device. Among them, the slave device and the host device (including the first host device connected to the slave device through the communication channel and the second host device connected to the slave device through the physical signal line) can choose to perform master-slave switching, and the device should have a data storage medium and the ability to process data (such as a CPU in the device), the host device can store the data to be sent in the storage medium, and the slave device stores the received data in the storage medium. After power-on, the slave device should logically implement the queue for storing data and the function of bit-by-bit query of a certain data stored in the storage medium. The slave device and the host device are connected through a communication channel, and the number of communication channels is subject to the provisions of the communication protocol used. If the slave device supports the function of using an additional physical signal line to control the data transmission of the host device, the supported host device should be connected to the same physical signal line, which is connected to the slave device.
[0041] It should be noted that in the embodiments of the present disclosure, the device as the slave device should have an SE chip, and the first host device and the second host device are connected to the slave device in different ways. The first host device is connected to the slave device through a communication channel according to the adopted communication protocol, and the second host device is connected to the slave device through a physical signal line. In other words, the solution of the present disclosure can be applied to the scenario of multi-channel communication of SE chips in mobile devices such as mobile phones.
[0042] like Figure 1 As shown, the multi-channel concurrent communication method based on the safety unit may include the following steps:
[0043] Step 101 , in response to receiving data sent by at least one first host device, triggering a reception completion interrupt and setting a preset mask value for a mask bit of a communication channel respectively corresponding to the at least one first host device.
[0044] In this embodiment, after the communication between the first host device and the slave device begins, at least one first host device will send data to the same slave device simultaneously or intermittently. After receiving the data sent by at least one host device, the slave device stores the data in the storage space corresponding to each host device and triggers the receiving completion interrupt. After the receiving completion interrupt is triggered, the host device cannot send new data to the slave device again. In addition, the slave device also sets a preset mask value for the mask bit of the communication channel corresponding to the host device that has completed the communication. For example, a variable can be used in the interrupt to set a preset mask value for the corresponding communication channel.
[0045] Among them, the preset mask value does not include the target mask value. The preset mask value is used to indicate that there is data to be processed in the storage space, and the target mask value is used to indicate that there is no data to be processed in the storage space. For example, the target mask value can be set to 0, the preset mask value is set to 1, and the multi-channel signal is stored using the same mask value to facilitate the slave device to query the channel signal status in real time, thereby improving the speed of the slave device to respond after the communication occurs; for another example, the target mask value can be set to 1, and the preset mask value is set to 0; for another example, the target mask value can be set to 0, and the preset mask value is set to any value other than 0. Multiple non-zero values can be pre-set, and each mask bit is randomly assigned a non-zero value as the preset mask value.
[0046] It should be noted that, in this embodiment, a first host device is connected to a slave device via a communication channel, one communication channel corresponds to a mask bit, and one mask bit corresponds to a storage space, thereby forming a mapping relationship of first host device-communication channel-mask bit-storage space.
[0047] For example, the first host device 1 corresponds to mask bit 1, and the first host device 2 corresponds to mask bit 2. After the slave device receives the data sent by the first host device 1, it sets the value of mask bit 1 to 1, and after receiving the data sent by the first host device 2, it sets the value of mask bit 2 to 1.
[0048] Step 102: read the mask value of each mask bit in the mask sequence in turn by polling.
[0049] As an example, each time the slave device receives data sent by a first host device, it starts timing. If new data is received within a preset time, the timing is reset and restarted after the data is received. If no new data is received within the preset time, it is considered that all first host devices have stopped communicating with it and can start processing data, and the mask value of each mask bit in the mask sequence is read in turn through polling.
[0050] Exemplarily, the mask sequence includes multiple mask bits, and the slave device can construct a mask sequence according to the number of host devices (including the first host device and the second host device) to which it is connected. The number of mask bits included in the mask sequence is not less than the number of connected host devices to ensure that each host device has a corresponding mask bit, which is also convenient for connecting new host devices.
[0051] Exemplarily, the slave device can splice the mask bits corresponding to all the first host devices sending data this time in the order of received data to obtain a mask sequence, and the mask value of each mask bit in the mask sequence is a preset mask value, so that when the mask sequence is polled, the number of polling times is consistent with the number of first host devices sending data this time (that is, the number of interrupts that trigger the receive completion interrupt).
[0052] In this embodiment, the slave device can poll the mask sequence in order from low to high or from high to low, and read the mask value of each mask bit in the mask sequence in sequence, wherein each time the mask value of a mask bit is read, the mask bit read this time is the current mask bit. By using masked data to store communication signals, a 32-bit (4-byte) mask sequence can simultaneously support 32-way device communication signal storage by storing signals in masked form, thereby saving storage resources of the slave device.
[0053] For example, Figure 2 A schematic diagram showing the format of a mask sequence of an exemplary embodiment of the present disclosure is shown. Figure 2 As shown, the length of the mask sequence is one byte, including 8 mask bits, which are Bit1 to Bit8 from low to high. The mask value of each bit is 0 by default, wherein the first host device corresponding to Bit1 is device 1, the first host device corresponding to Bit2 is device 2, the first host device corresponding to Bit3 is device 3, and the first host device corresponding to Bit4 is device 4. When the slave device receives data sent by devices 1, 2, and 4, the mask value of the corresponding mask bit is set to 1. If the data of device 3 is not received, the mask value of the corresponding Bit3 is still 0. Each time the mask sequence is polled, it is polled in the order from low to high. Therefore, Bit1 is polled first and the corresponding data is obtained for processing, then Bit2 is polled and the corresponding data is obtained for processing, and then Bit4 is polled and the corresponding data is obtained for processing.
[0054] Step 103, when the mask value of the current mask bit is not the target mask value, the data in the storage space corresponding to the current mask bit is processed, and a response message is fed back through the target communication channel corresponding to the current mask bit, so that the first host device connected to the target communication channel continues to send the next data after receiving the response message.
[0055] The target mask value is preset, and is used to indicate that there is no data to be processed in the storage space.
[0056] Step 104, setting the mask value of the current mask bit as the target mask value, and continuing to read the mask value of the next mask bit in the mask sequence.
[0057] In this embodiment, after the slave device reads the mask value corresponding to the current mask bit, it further determines whether the mask value of the current mask bit is the target mask value. If it is the target mask value, it is determined that there is no data to be processed in the storage space corresponding to the current mask bit, and then the mask value of the next mask bit in the mask sequence is read and the mask value is determined to be the target mask value; if the mask value of the current mask bit is not the target mask value, it is determined that there is data to be processed in the storage space corresponding to the current mask bit, and then the data in the corresponding storage space is processed, and a response message is fed back through the target communication channel corresponding to the current mask bit, so that the first host device connected to the target communication channel continues to send the next data after receiving the response message. Since the slave device triggers the receiving completion interrupt after receiving the data sent by the first host device, the first host device can no longer continue to send data to the slave device, and when the slave device processes the data previously sent by the first host device, it feeds back a response message to the first host device, and the first host device continues to send data after receiving the response message, thereby avoiding the first host device from sending too much data to the slave device, thereby avoiding the overflow of the slave device data processing.
[0058] In addition, in this embodiment, after the slave device processes the data in the storage space corresponding to the current mask bit, it sets the mask value of the current mask bit to the target mask value to indicate that the data in the corresponding storage space has been processed, and then continues to read the mask value of the next mask bit in the mask sequence and determines whether the mask value is the target mask value. The above process is repeated until the mask value of each mask bit in the mask sequence is the target mask value.
[0059] Step 105: When the mask value of each mask bit in the mask sequence is the target mask value, stop the polling operation.
[0060] In this embodiment, when the mask value of each mask bit in the mask sequence is the target mask value, it means that all received data has been processed, and the operation of polling the mask sequence again is stopped.
[0061] The multi-channel concurrent communication method based on the security unit provided by the embodiment of the present disclosure triggers a reception completion interrupt in response to receiving data sent by at least one first host device and sets a preset mask value for the mask bit of the communication channel corresponding to the at least one first host device; reads the mask value of each mask bit in the mask sequence in turn by polling; when the mask value of the current mask bit is not the target mask value, processes the data in the storage space corresponding to the current mask bit, and feeds back a response message through the target communication channel corresponding to the current mask bit, so that the first host device connected to the target communication channel continues to send the next data after receiving the response message; sets the mask value of the current mask bit to the target mask value, and continues to read the mask value of the next mask bit in the mask sequence; when the mask value of each mask bit in the mask sequence is the target mask value, stops the polling operation. By adopting the scheme disclosed in the present invention, after receiving the data sent by the host device, a reception completion interrupt is triggered and a preset mask value is set for the mask bit of the corresponding communication channel, and the mask value of each mask bit is read in a polling manner and the data in the storage space corresponding to the mask bit whose mask value is not the target mask value is processed, it is ensured to the greatest extent that the slave device does not obtain too much data from a certain host device for processing at one time, resulting in the situation that the data sent by a single host device is always processed, thereby ensuring the stability of the slave device, and by polling and reading the data received by each communication channel for processing, it can be ensured that the data sent by each host device can be processed in turn, thereby ensuring the timeliness of the processing of each data, and there is no need to process the data in the interruption, thereby avoiding the impact on the interruption of other modules.
[0062] In an optional implementation of the present disclosure, the mask value of each mask bit in the mask sequence is read in turn by polling, the number of interrupts that trigger the reception completion interrupt can be obtained first, and the mask sequence is polled bit by bit to obtain the mask value of the current mask bit, wherein the number of polls is consistent with the number of interrupts. In this embodiment, a reception completion interrupt is triggered when the slave device receives data sent by a first host device, so the number of interrupts that trigger the reception completion interrupt can represent the number of first host devices that send data this time, and also represents the number of mask bits in the mask sequence whose mask bit values change, so when the mask sequence is polled bit by bit to obtain the mask value of the current mask bit, the required number of polls is consistent with the number of interrupts. For example, in order to avoid wasting processing resources caused by reading the mask values of all mask bits in a mask sequence, after receiving data sent by a first host device, the device identification of the first host device can be recorded, and then the mask bits corresponding to all the first host devices sending the data this time are polled in turn according to the high and low order of the mask bits corresponding to the first host devices, and the mask values of the mask bits polled each time are read. In this way, it is only necessary to read the mask value of the mask bit corresponding to the first host device sending the data this time, without reading the mask values of all mask bits, thereby ensuring that the number of polling times is consistent with the number of interrupts triggering the interrupt.
[0063] In an optional implementation of the present disclosure, the target mask value can be set to 0, so that before the mask value of each mask bit in the mask sequence is read in turn by polling, it can also be determined whether the value of the mask sequence is 0, and the mask value of each mask bit in the mask sequence is read in turn by polling only when the value of the mask sequence is not 0. It can be understood that no matter how many mask bits are included in the mask sequence, if the mask values of all mask bits are 0, the value of the mask sequence is 0, so if the value of the mask sequence is 0, it is determined that the mask value of each mask bit in the mask sequence is 0, so that it can be determined that there is no data to be processed in the storage space corresponding to all mask bits, so there is no need to perform a polling operation on the mask sequence; if the value of the mask sequence is not 0, it can be determined that there is at least one mask bit in the mask sequence whose mask value is not 0, so it can be determined that there is data to be processed in the storage space corresponding to at least one mask bit, and at this time, it is necessary to perform a polling operation on the mask sequence.
[0064] In an optional implementation of the present disclosure, for a target first host device that sends multiple data in a single communication (i.e., one receive and multiple send), the slave device allocates a corresponding storage queue to the target first host device for storing the multiple data sent by the target first host device each time, and the slave device stores the received multiple data in the storage queue in the order of reception, wherein the storage queue constitutes the storage space corresponding to the communication channel connected to the target first host device. Furthermore, in this embodiment, the scheme of the present disclosure may also include: after performing a poll on the mask sequence, detecting whether there is unprocessed data in the storage queue; when detecting that there is unprocessed data in the storage queue, setting the mask value of the mask bit corresponding to the storage queue to the preset mask value, and performing the operation of polling the mask sequence again.
[0065] In this embodiment, for the target first host device with one receive and multiple send, the slave device uses the concept of logical queues to put the received multiple data into a logical queue (i.e., a storage queue). After a single polling of the mask sequence, it checks whether there is any data in the logical queue. If there is data, the mask value of the mask bit corresponding to the logical queue is set to a preset mask value (e.g., set to 1), and the polling operation of the mask sequence is performed once more to ensure that the multiple data sent by the target first host device with one receive and multiple send can be processed at one time, and processed in subsequent polling, thereby avoiding the problem that the slave device always processes the multiple data sent by the same host device and affects the processing timeliness of the data sent by other host devices. In addition, it should be noted that for the target first host device with one receive and multiple send, as long as the multiple data sent by it in a single time are processed (i.e., there is no data to be processed in the storage queue), the slave device will feedback a response message to the target first host device, and the target first host data can communicate next time.
[0066] Figure 3 A schematic diagram showing a multi-channel concurrent data reception of a slave device according to an exemplary embodiment of the present disclosure is shown. Figure 3As shown, a slave device (referred to as "slave") is connected to multiple first host devices (referred to as "host"), namely host 1, host 2, host 3 and host 4, through multiple communication channels, and receives data sent by host 1, host 2, host 3 and host 4 respectively, wherein host 1, host 2 and host 3 are one-transmit-one-receive devices, and host 4 is a one-receive-multiple-transmit device. After receiving the data, the slave device generates an interrupt, and sets the interface mask (i.e., mask bit) corresponding to each host to the mask value 1. The data received by the slave device from each host device is stored in the corresponding storage space for subsequent use. Afterwards, the slave device polls the mask sequence composed of the interface mask, and polls several times for each interrupt generated. If the mask value of the currently polled interface mask is 0, the next interface mask will continue to be polled, otherwise the slave CPU (cpu) processes the data in the corresponding storage space. After the slave CPU processes the data, it responds to the host according to the data of the polled interface mask. Figure 4 A schematic diagram showing multi-channel concurrent responses of a slave device according to an exemplary embodiment of the present disclosure is shown.
[0067] exist Figure 3 In the exemplary embodiment shown, the host 4 is a one-receive-multiple-transmit device, that is, multiple data are sent in one communication. After one polling, the data sent by the host 4 has not been processed, and there is still data in the storage space for storing the data sent by the host 4 that has not been processed. Therefore, the mask value of the corresponding interface mask is still 1, and the next polling operation is required. After executing the operation of the mask sequence composed of the polling interface mask once, the next state is as follows Figure 5 As shown. Figure 5 As shown, the mask sequence composed of the interface mask needs to be polled again, and polling is performed several times when several interrupts are generated until the value of each interface mask is 0. After processing all the data sent by the host, the slave device returns to the idle state, the communication mask value in the storage medium is 0, and the number of data in the logical queue of the slave device is 0.
[0068] In an optional embodiment of the present disclosure, the slave device can be connected to at least one second host device via a physical signal line (such as a twisted pair, an optical fiber, etc.), and the physical signal line is controlled by the slave device to control the data transmission function of the connected second host device. When the slave device is in an idle state, the level of the physical signal line is set to a low level, and the second host device can send data to the slave device; when the slave device starts to process data, the slave device sets the level of the physical signal line to a high level, indicating that it is currently in the data processing stage, and the second host device should stop sending the next data to the slave device. Among them, the low level is 0 and the high level is 1.
[0069] Furthermore, before sending data to the slave device, at least one second host device first detects whether the level of the physical signal line is at a high level. When the level of the physical signal line is at a high level, the second host device suspends sending new data to the slave device. It should be noted that when the level of the physical signal line is set to a high level, if a second host device is sending data, it continues to send the data currently being sent, and then maintains the level of the physical signal line before sending the next data.
[0070] In this embodiment, the slave device and at least one second host device can be connected using the same fixed physical signal line, which is at a low level when the slave device is idle. When the slave device recognizes a communication signal and starts to process data, the level of the physical signal line is set to a high level. The second host device judges the level of the physical signal line before sending each data, and temporarily stops initiating a new round of communication when the level is high. If it is in the communication process, the level of the physical signal line is not judged in the current process. The second host device with one receive and multiple send should judge that the slave device is in the data processing stage after recognizing that the level of the physical signal line is pulled high, and will not send the next data until the level of the physical signal line is pulled low, thereby avoiding data processing overflow of the slave device.
[0071] It should be noted that for the data received from the second host device, the slave device also allocates corresponding mask bits and storage space to the second host device, and processes the received data by polling the mask sequence. Its processing logic is similar to the relevant description in the aforementioned embodiment. That is, in the embodiment of the present disclosure, the first host device and the second host device are connected to the slave device in different ways, and the slave device controls the first host device and the second host device to send data in different ways. However, the method of setting the mask bits and polling according to the mask value for data processing is the same, so the relevant content will not be repeated here.
[0072] In this embodiment, the slave device supports connecting to a second host device through an additional physical signal line. When the physical signal line is at a low level, the second host device can start sending the next data, and when the physical signal line is at a high level, the sending of the next data should be stopped. In this way, the frequency of concurrent communication of the host device is controlled from the host device side through the physical signal line, thereby further improving the stability of multi-channel concurrent communication.
[0073] Figure 6(a)-Figure 6(d)A schematic diagram of the working process of connecting a host device (hereinafter referred to as a master device) and a slave device (hereinafter referred to as a slave device) through a physical signal line in an exemplary embodiment of the present disclosure is shown. As shown in FIG6(a), slave device 1 and master device 1, master device 2, and master device 3 are connected through a physical signal line. These devices are all in an idle state, and the level of the physical signal line is 0. At this time, each master device can send data to the slave device. As shown in FIG6(b), the slave device concurrently receives data sent by each master device through multi-communication. The data sent by master device 1 is recorded as device 1 data 1, the data sent by master device 2 is recorded as device 2 data 1, and the data sent by master device 3 is recorded as device 3 data 1. After the slave device starts to process the data, the level of the physical signal line is set to high level 1. Master device 1 and master device 2 wait for the response fed back by the slave device. Master device 3 still has data 2 to be sent, but master device 3 recognizes that the level of the physical signal line is high, so master device 3 suspends sending device 3 data 2. After the slave device processes the last received data, it sets the level of the physical signal line to a low level. As shown in FIG6( d ), master device 1 and master device 2 have no data to send and are in an idle state. Master device 3 recognizes that the level of the physical signal line is a low level and starts sending device 3 data 2.
[0074] In order to implement the above embodiments, the present disclosure also provides a multi-channel concurrent communication device based on a security unit, which is applied to a slave device. The slave device is connected to multiple first host devices through multiple communication channels, and one communication channel is connected to one first host device.
[0075] Figure 7 A schematic diagram of the structure of a multi-channel concurrent communication device based on a security unit provided in one embodiment of the present disclosure, the device is implemented in software and / or hardware and can be integrated in an electronic device, which is a device integrated with an SE chip.
[0076] like Figure 7 As shown, the multi-channel concurrent communication device 50 based on the safety unit may include: an interrupt trigger module 510 , a polling module 520 , a data processing module 530 and a reset module 540 .
[0077] The interrupt triggering module 510 is used to trigger a reception completion interrupt in response to receiving data sent by at least one first host device and set a preset mask value for the mask bits of the communication channels respectively corresponding to the at least one first host device;
[0078] A polling module 520, configured to sequentially read the mask value of each mask bit in the mask sequence in a polling manner;
[0079] The data processing module 530 is used to process the data in the storage space corresponding to the current mask bit when the mask value of the current mask bit is not the target mask value, and feed back a response message through the target communication channel corresponding to the current mask bit, so that the first host device connected to the target communication channel continues to send the next data after receiving the response message;
[0080] A reset module 540, configured to set the mask value of the current mask bit to the target mask value;
[0081] The polling module 520 is further configured to continue reading the mask value of the next mask bit in the mask sequence; and stop the polling operation when the mask value of each mask bit in the mask sequence is the target mask value.
[0082] Optionally, the polling module 520 is further configured to:
[0083] Get the number of interrupts that trigger the receive completion interrupt;
[0084] The mask sequence is polled bit by bit to obtain a mask value of a current mask bit, wherein the number of polling times is consistent with the number of interruptions.
[0085] Further optionally, the target mask value is 0, and the multi-channel concurrent communication device 50 based on the security unit further includes:
[0086] A judging module, used to judge whether the value of the mask sequence is 0;
[0087] The polling module 520 is further configured to read the mask value of each mask bit in the mask sequence in turn by polling when it is determined that the value of the mask sequence is not 0.
[0088] Optionally, for a target first host device that sends multiple pieces of data in a single communication, the slave device allocates a corresponding storage queue to the target first host device for storing the multiple pieces of data sent by the target first host device each time, and the slave device stores the received multiple pieces of data in the storage queue in a receiving order, wherein the storage queue constitutes a storage space corresponding to the communication channel connected to the target first host device; the multi-channel concurrent communication device 50 based on the security unit further includes:
[0089] A detection module, used for detecting whether there is unprocessed data in the storage queue after performing one poll on the mask sequence;
[0090] The polling module 520 is further configured to, when detecting that there is unprocessed data in the storage queue, set the mask value of the mask bit corresponding to the storage queue to the preset mask value, and perform the operation of polling the mask sequence again.
[0091] Optionally, the slave device is connected to at least one second host device via a physical signal line, and the multi-channel concurrent communication device 50 based on the security unit further includes:
[0092] The control module is used to set the level of the physical signal line to a low level when the slave device is in an idle state.
[0093] Further optionally, the control module is also used to: set the level of the physical signal line to a high level when the slave device starts to process data.
[0094] Optionally, before sending data to the slave device, at least one second host device detects whether the level of the physical signal line is at a high level, and suspends sending new data to the slave device when the level of the physical signal line is at a high level.
[0095] The multi-channel concurrent communication device based on a security unit and applied to an electronic device provided in the embodiments of the present disclosure can execute the multi-channel concurrent communication method based on a security unit provided in the embodiments of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method. Contents not fully described in the embodiments of the present disclosure device can refer to the description in any method embodiment of the present disclosure.
[0096] The embodiments of the present disclosure also provide a computer program product, including a computer program / instruction, which, when executed by a processor, implements the multi-channel concurrent communication method based on a security unit provided in any embodiment of the present disclosure.
[0097] According to one or more embodiments of the present disclosure, the present disclosure provides an electronic device, including:
[0098] processor;
[0099] a memory for storing instructions executable by the processor;
[0100] The processor is used to read the executable instructions from the memory and execute the executable instructions to implement the multi-channel concurrent communication method based on the security unit as provided in any embodiment of the present disclosure.
[0101] According to one or more embodiments of the present disclosure, the present disclosure provides a computer-readable storage medium, wherein the storage medium stores a computer program, wherein the computer program is used to implement a multi-channel concurrent communication method based on a security unit as provided in any embodiment of the present disclosure.
[0102] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0103] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0104] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0105] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit does not, in some cases, limit the unit itself.
[0106] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0107] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0108] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0109] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0110] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A multi-channel concurrent communication method based on a security unit, characterized in that: Applied to a slave device, the slave device is connected to multiple first host devices through multiple communication channels, one communication channel is connected to one first host device, the method includes: In response to receiving data sent by at least one first host device, triggering a reception completion interrupt and setting a preset mask value for a mask bit of a communication channel respectively corresponding to the at least one first host device; The mask value of each mask bit in the mask sequence is read in turn by polling; In the case where the mask value of the current mask bit is not the target mask value, processing the data in the storage space corresponding to the current mask bit, and feeding back a response message through the target communication channel corresponding to the current mask bit, so that the first host device connected to the target communication channel continues to send the next data after receiving the response message; Setting the mask value of the current mask bit as the target mask value, and continuing to read the mask value of the next mask bit in the mask sequence; When the mask value of each mask bit in the mask sequence is the target mask value, the polling operation is stopped.
2. The method according to claim 1, characterized in that The step of sequentially reading the mask value of each mask bit in the mask sequence in a polling manner includes: Get the number of interrupts that trigger the receive completion interrupt; The mask sequence is polled bit by bit to obtain a mask value of a current mask bit, wherein the number of polling times is consistent with the number of interruptions.
3. The method according to claim 2, characterized in that The target mask value is 0. Before sequentially reading the mask value of each mask bit in the mask sequence in a polling manner, the method further includes: It is determined that the value of the mask sequence is not zero.
4. The method according to claim 1, characterized in that: For a target first host device that sends multiple pieces of data in a single communication, the slave device allocates a corresponding storage queue for the target first host device to store the multiple pieces of data sent by the target first host device each time, and the slave device stores the received multiple pieces of data in the storage queue in a receiving order, wherein the storage queue constitutes a storage space corresponding to the communication channel connected to the target first host device; The method further comprises: After performing one poll on the mask sequence, detecting whether there is unprocessed data in the storage queue; When it is detected that there is unprocessed data in the storage queue, the mask value of the mask bit corresponding to the storage queue is set to the preset mask value, and the operation of polling the mask sequence is performed again.
5. The method according to any one of claims 1 to 4, characterized in that: The slave device is connected to at least one second host device via a physical signal line, and the method further includes: When the slave device is in an idle state, the level of the physical signal line is set to a low level.
6. The method according to claim 5, characterized in that The method further comprises: When the slave device starts to process data, the level of the physical signal line is set to a high level.
7. The method according to claim 6, characterized in that Before sending data to the slave device, the at least one second host device detects whether the level of the physical signal line is at a high level, and suspends sending new data to the slave device when the level of the physical signal line is at a high level.
8. A multi-channel concurrent communication device based on a security unit, characterized in that: Applied to a slave device, the slave device is connected to multiple first host devices through multiple communication channels, one communication channel is connected to one first host device, and the device includes: an interrupt triggering module, configured to trigger a reception completion interrupt in response to receiving data sent by at least one first host device and to set a preset mask value for a mask bit of a communication channel respectively corresponding to the at least one first host device; A polling module, used for sequentially reading the mask value of each mask bit in the mask sequence in a polling manner; a data processing module, configured to process data in a storage space corresponding to a current mask bit when a mask value of the current mask bit is not a target mask value, and feed back a response message through a target communication channel corresponding to the current mask bit, so that a first host device connected to the target communication channel continues to send next data after receiving the response message; A reset module, used for setting the mask value of the current mask bit to the target mask value; The polling module is further configured to continue reading the mask value of the next mask bit in the mask sequence; and stop the polling operation when the mask value of each mask bit in the mask sequence is the target mask value.
9. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing instructions executable by the processor; The processor is used to read the executable instructions from the memory and execute the executable instructions to implement the multi-channel concurrent communication method based on the security unit as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and the computer program is used to implement the multi-channel concurrent communication method based on the security unit as described in any one of claims 1 to 7 above.
Citation Information
Patent Citations
Data access method, system and device, equipment and storage medium
CN112380153A
Storage device and method of operating storage device
CN113360086A
GPU-based encryption method and device, encryption equipment and storage medium
CN114254335A
Techniques for controlling vector processing operations
CN118525266A
Input / output interruption control system for virtual computer system
JP1990029831A