Method, apparatus and device for multi-channel concurrent communication based on secure element and medium
By employing a multi-channel concurrent communication method and a polling approach to process data from security unit devices, the problems of poor timeliness and stability in existing technologies are solved, and stable and efficient data processing of security unit devices is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING TSINGTENG MICROSYSTEM CO LTD
- Filing Date
- 2024-12-04
- Publication Date
- 2026-04-21
AI Technical Summary
Existing communication methods for security unit devices suffer from poor timeliness and stability. In particular, data processing can significantly disrupt other modules, and storing large amounts of data in the system queue can lead to insufficient memory, affecting the normal operation of the device.
A multi-channel concurrent communication method is adopted. The mask value in the mask sequence is read by polling, the storage space data corresponding to the current mask bit is processed, and the response message is fed back through the target communication channel. This ensures that the data of each host device can be processed in sequence, avoiding data processing overflow and interruption of other modules.
This ensures the stability and timeliness of slave devices, guarantees that data from each master device can be processed sequentially, avoids data processing overflow and interruption, and improves communication stability and timeliness.
Smart Images

Figure CN119691825B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of communication technology, and more specifically to a communication method in which a single secure unit device can interact with multiple devices simultaneously based on currently disclosed communication protocols (such as the Serial Peripheral Interface (SPI) protocol, the Inter-Integrated Circuit (I2C) protocol, etc.), and particularly to a multi-channel concurrent communication method, apparatus, device and medium based on a secure unit. Background Technology
[0002] Currently, existing secure unit device communication is based on the interrupt generated by the secure unit device after receiving communication data. The data is processed or stored in the secure unit device's system message queue during the interrupt, and then processed according to the queue order.
[0003] However, the above communication processing method suffers from poor timeliness and stability. This is because processing data during interrupts generated by the security unit device can affect interrupts of other modules within the security unit device, resulting in untimely generation of other interrupt signals and thus poor timeliness. Storing large amounts of data in the system queue also poses a challenge to the memory of the security unit device. Insufficient memory space can cause the security unit device to malfunction, leading to stability issues. The security unit device may be vulnerable to attacks involving large amounts of data transmission, making a stable data processing solution essential. Summary of the Invention
[0004] To solve the above-mentioned technical problems, or at least partially solve them, this disclosure provides a multi-channel concurrent communication method, apparatus, device, and medium based on a security element.
[0005] In a first aspect, embodiments of this disclosure provide a multi-channel concurrent communication method based on a secure element, applied to a slave device, wherein the slave device is connected to multiple first master devices through multiple communication channels, with one communication channel connecting one first master device. The method includes:
[0006] In response to receiving data sent by at least one first host device, a reception completion interrupt is triggered and a preset mask value is set for the mask bits of the communication channels corresponding to the at least one first host device.
[0007] The mask value of each mask bit in the mask sequence is read sequentially using a polling method.
[0008] If 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 can continue to send the next data after receiving the response message;
[0009] Set the mask value of the current mask bit to the target mask value, and continue reading the mask value of the next mask bit in the mask sequence;
[0010] The polling operation stops when the mask value of each mask bit in the mask sequence is the target mask value.
[0011] Secondly, embodiments of this disclosure provide a multi-channel concurrent communication device based on a secure element, applied to a slave device. The slave device is connected to multiple first master devices through multiple communication channels, with one communication channel connecting one first master device. The device includes:
[0012] An interrupt triggering module is used 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 the mask bits of the communication channels corresponding to the at least one first host device.
[0013] The polling module is used to sequentially read the mask value of each mask bit in the mask sequence using a polling method;
[0014] The data processing module 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 to send 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 can continue to send the next data after receiving the response message;
[0015] A reset module is used to set the mask value of the current mask bit to the target mask value;
[0016] The polling module is also used to continue reading the mask value of the next mask bit in the mask sequence; and to stop the polling operation when the mask value of each mask bit in the mask sequence is the target mask value.
[0017] Thirdly, embodiments of this disclosure provide an electronic device, the electronic device comprising: a processor; a memory for storing executable instructions of the processor; the processor being configured to read the executable instructions from the memory and execute the executable instructions to implement the multi-channel concurrent communication method based on a secure element as described in the first aspect.
[0018] Fourthly, embodiments of this disclosure provide a computer-readable storage medium storing a computer program for implementing the multi-channel concurrent communication method based on a secure element as described in the first aspect.
[0019] The technical solution provided in this disclosure has the following advantages compared with the prior art:
[0020] The multi-channel concurrent communication scheme based on a secure element provided in this disclosure, in response to receiving data sent by at least one first host device, triggers a reception completion interrupt and sets preset mask values for the mask bits of the communication channels corresponding to the at least one first host device; sequentially reads the mask value of each mask bit in the mask sequence through polling; if 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 sends back an acknowledgment 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 acknowledgment 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; if the mask value of each mask bit in the mask sequence is the target mask value, the polling operation stops. By adopting the scheme of this disclosure, after receiving data sent by the host device, a receive completion interrupt is triggered and a preset mask value is set for the mask bits of the corresponding communication channel. The mask values of each mask bit are read in a polling manner, and the data in the storage space corresponding to the mask bits whose mask values are not the target mask value is processed. This ensures that the slave device does not receive too much data from a single host device at once, thus preventing it from continuously processing data sent by a single host device. This ensures the stability of the slave device. Furthermore, by polling and reading the data received by each communication channel, it is ensured that the data sent by each host device is processed sequentially, ensuring the timeliness of each data processing. Moreover, the absence of data processing in the interrupt also avoids the impact on interrupts of other modules. Attached Figure Description
[0021] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote 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 illustrating a multi-channel concurrent communication method based on a secure element provided as an exemplary embodiment of this disclosure;
[0023] Figure 2 A schematic diagram of the format of a mask sequence according to an exemplary embodiment of the present disclosure is shown;
[0024] Figure 3 This illustration shows a schematic diagram of a slave device receiving data concurrently through multiple channels, according to an exemplary embodiment of this disclosure.
[0025] Figure 4 A schematic diagram of a slave device's multi-channel concurrent response is shown in an exemplary embodiment of this disclosure;
[0026] Figure 5 This illustration shows the next state of a slave device after it has completed one operation of a mask sequence composed of polling interface masks, according to an exemplary embodiment of this disclosure.
[0027] Figure 6(a) illustrates the working process of a host device and a slave device being connected via a physical signal line in an exemplary embodiment of this disclosure. Figure 1 ;
[0028] Figure 6(b) illustrates the working process of a host device and a slave device being connected via a physical signal line in an exemplary embodiment of this disclosure. Figure 2 ;
[0029] Figure 6(c) illustrates the working process of a host device and a slave device being connected via a physical signal line in an exemplary embodiment of this disclosure. Figure 3 ;
[0030] Figure 6(d) illustrates the working process of a host device and a slave device being connected via a physical signal line in an exemplary embodiment of this disclosure. Figure 4 ;
[0031] Figure 7 This is a schematic diagram of the structure of a multi-channel concurrent communication device based on a security element, provided in an embodiment of this disclosure. Detailed Implementation
[0032] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0033] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0034] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based 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". Definitions of other terms will be given in the description below.
[0035] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.
[0036] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0037] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0038] The following detailed explanation, in conjunction with the accompanying drawings, describes the multi-channel concurrent communication method, apparatus, equipment, and medium based on a secure element provided in this disclosure.
[0039] Figure 1 This is a flowchart illustrating a multi-channel concurrent communication method based on a secure element provided in an exemplary embodiment of the present disclosure. The method can be executed by a multi-channel concurrent communication device based on a secure element provided in an embodiment of the present disclosure. The device can be implemented by software and / or hardware and can be integrated into an electronic device, which is a device integrating a secure element (SE).
[0040] This disclosed multi-channel concurrent communication method based on a secure element is applied to a slave device. The slave device is connected to multiple first master devices through multiple communication channels, with one communication channel connecting one first master device. The slave and master devices (including first master devices connected to the slave device via communication channels and second master devices connected to the slave device via physical signal lines) can selectively switch between master and slave modes. The devices should have data storage media and the ability to process data (e.g., a CPU). The master device can store data to be sent in the storage medium, and the slave device can store received data in the storage medium. After power-on, the slave device should logically implement a data queue and a function to query a specific piece of data stored in the storage medium bit by bit. The slave and master devices are connected through communication channels, the number of which is determined by the communication protocol used. If the slave device supports the function of controlling the master device's data transmission using additional physical signal lines, the supporting master devices should be connected to the same physical signal line, which is connected to the slave device.
[0041] It should be noted that in this embodiment, the slave device should have an SE chip. The first master device and the second master device connect to the slave device in different ways. The first master device connects to the slave device through a communication channel according to the adopted communication protocol, while the second master device connects to the slave device through a physical signal line. In other words, the solution of this disclosure can be applied to scenarios where the SE chip is used in multi-channel communication in mobile devices such as mobile phones.
[0042] like Figure 1 As shown, the multi-channel concurrent communication method based on a secure element may include the following steps:
[0043] Step 101: In response to receiving data sent by at least one first host device, trigger a reception completion interrupt and set a preset mask value for the mask bits of the communication channels corresponding to at least one first host device.
[0044] In this embodiment, after communication between the first master device and the slave device begins, at least one first master device will simultaneously or intermittently send data to the same slave device. After receiving data from at least one master device, the slave device stores the data in the storage space corresponding to each master device and triggers a reception completion interrupt. After triggering the reception completion interrupt, the master device cannot send new data to the slave device again. Furthermore, the slave device sets a preset mask value for the mask bits of the communication channels corresponding to the master devices that have completed communication. For example, a variable can be used in the interrupt to set the preset mask value for the corresponding communication channel.
[0045] The preset mask value does not include the target mask value. The preset mask value indicates that there is data in the storage space that needs to be processed, while the target mask value indicates that there is no data in the storage space that needs to be processed. For example, the target mask value can be set to 0, and the preset mask value can be set to 1. Using the same mask value to store multiple channel signals facilitates the slave device to query the channel signal status in real time, improving the speed of response from the communication to the slave device. For another example, the target mask value can be set to 1, and the preset mask value can be set to 0. For yet another example, the target mask value can be set to 0, and the preset mask value can be set to any value other than 0. Multiple non-zero values can be preset, and each mask bit can be 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 through a communication channel. One communication channel corresponds to one mask bit, and one mask bit corresponds to one storage space, thus forming a mapping relationship between the first host device, the communication channel, the mask bit, and the storage space.
[0047] For example, the first host device 1 corresponds to the mask bit 1, and the first host device 2 corresponds to the mask bit 2. After the slave device receives the data sent by the first host device 1, it sets the value of the mask bit 1 to 1, and after receiving the data sent by the first host device 2, it sets the value of the mask bit 2 to 1.
[0048] Step 102: Read the mask value of each mask bit in the mask sequence sequentially by polling.
[0049] As an example, each time a slave device receives data from a first master device, it starts timing. If new data is received within a preset time, the timing is reset to zero and restarted after the data is received. If no new data is received within the preset time, it is assumed that all first master devices have stopped communicating with it and it can start processing data. Then, the mask value of each mask bit in the mask sequence is read sequentially by polling.
[0050] For example, the mask sequence includes multiple mask bits. The slave device can construct the mask sequence according to the number of host devices (including the first host device and the second host device) it is connected to. The number of mask bits in the mask sequence is not less than the number of host devices connected, so as to ensure that each host device has a corresponding mask bit, and also to facilitate the access of new host devices.
[0051] For example, the slave device can concatenate the mask bits corresponding to all the first master devices that sent the data in this transmission according to the order of the received data to obtain a mask sequence. The mask value of each mask bit in the mask sequence is a preset mask value. Thus, when polling the mask sequence, the number of polling times is consistent with the number of first master devices that sent the data in this transmission (i.e., the number of interrupts that trigger the reception completion interrupt).
[0052] In this embodiment, the slave device can poll the mask sequence in either low-order to high-order or high-order to low-order order, sequentially reading the mask value of each mask bit in the mask sequence. Each time, the mask value of one mask bit is read, and the mask bit read in this instance is the current mask bit. By using mask-format data storage for communication signals, a 32-bit (4-byte) mask sequence can simultaneously support the storage of 32 channels of device communication signals, thus saving storage resources for the slave device.
[0053] For example, Figure 2 A schematic diagram of the format of a mask sequence according to an exemplary embodiment of the present disclosure is shown, such as... Figure 2 As shown, the mask sequence is one byte long and contains 8 mask bits, numbered from Bit1 to Bit8 from least significant bit to most significant bit. The mask value of each bit is 0 by default. Bit1 corresponds to device 1, Bit2 to device 2, Bit3 to device 3, and Bit4 to device 4. When a slave device receives data from devices 1, 2, and 4, it sets the mask value of the corresponding mask bit to 1. If it does not receive data from device 3, the mask value of Bit3 remains 0. The mask sequence is polled in order from least significant bit to most significant bit. Therefore, Bit1 is polled first to obtain the corresponding data for processing, followed by Bit2, and then Bit4.
[0054] Step 103: If the mask value of the current mask bit is not the target mask value, process the data in the storage space corresponding to the current mask bit, and send back an acknowledgment message through the target communication channel corresponding to the current mask bit, so that the first host device connected to the target communication channel can continue to send the next data after receiving the acknowledgment message.
[0055] The target mask value is preset and is used to represent data in the storage space that does not need to be processed.
[0056] Step 104: Set the mask value of the current mask bit to the target mask value, and continue reading 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. At this time, it 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. 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. At this time, the data in the corresponding storage space is processed, and an acknowledgment message is fed back through the target communication channel corresponding to the current mask bit, so that the first master device connected to the target communication channel can continue to send the next data after receiving the acknowledgment message. Since the slave device triggers a receive completion interrupt after receiving the data sent by the first master device, the first master device can no longer send data to the slave device. However, when the slave device finishes processing the data previously sent by the first master device, it sends an acknowledgment message back to the first master device. After receiving the acknowledgment message, the first master device continues to send data. Thus, the first master device avoids sending too much data to the slave device, thereby avoiding data processing overflow of the slave device.
[0058] 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. Then, it continues to read the mask value of the next mask bit in the mask sequence and determines whether that mask value is the target mask value. This process is repeated until the mask value of each mask bit in the mask sequence is the target mask value.
[0059] Step 105: Stop the polling operation if the mask value of each mask bit in the mask sequence is the target mask value.
[0060] In this embodiment, when the mask value of each mask bit in the mask sequence is the target mask value, all data received by the surface has been processed, and the operation of polling the mask sequence again is stopped at this time.
[0061] The multi-channel concurrent communication method based on a secure element provided in this disclosure, in response to receiving data sent by at least one first host device, triggers a reception completion interrupt and sets preset mask values for the mask bits of the communication channels corresponding to the at least one first host device; sequentially reads the mask value of each mask bit in the mask sequence through polling; if 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 sends back an acknowledgment 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 acknowledgment 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; if the mask value of each mask bit in the mask sequence is the target mask value, the polling operation stops. By adopting the scheme of this disclosure, after receiving data sent by the host device, a receive completion interrupt is triggered and a preset mask value is set for the mask bits of the corresponding communication channel. The mask values of each mask bit are read in a polling manner, and the data in the storage space corresponding to the mask bits whose mask values are not the target mask value is processed. This ensures that the slave device does not receive too much data from a single host device at once, thus preventing it from continuously processing data sent by a single host device. This ensures the stability of the slave device. Furthermore, by polling and reading the data received by each communication channel, it is ensured that the data sent by each host device is processed sequentially, ensuring the timeliness of each data processing. Moreover, the absence of data processing in the interrupt also avoids the impact on interrupts of other modules.
[0062] In one optional embodiment of this disclosure, when sequentially reading the mask value of each mask bit in the mask sequence using a polling method, the number of interrupts that trigger the receive completion interrupt can be obtained first. Then, the mask sequence is polled bit-by-bit to obtain the mask value of the current mask bit. The number of polling iterations is the same as the number of interrupts. In this embodiment, a receive completion interrupt is triggered when a slave device receives data sent by a first master device. Therefore, the number of interrupts that trigger the receive completion interrupt can represent the number of first master devices sending data this time, and also the number of mask bits in the mask sequence whose values have changed. Therefore, when polling the mask sequence bit-by-bit to obtain the mask value of the current mask bit, the required number of polling iterations is the same as the number of interrupts. For example, to avoid wasting processing resources by reading the mask values of all mask bits in the mask sequence, after receiving data sent by a first host device, the device identifier of that first host device can be recorded. Then, according to the high and low order of the mask bits corresponding to all first host devices in this data transmission, the mask bits corresponding to these first host devices are polled in turn, and the mask value of the mask bits of each polled mask bit is read. Thus, only the mask value of the mask bit corresponding to the first host device in this data transmission needs to be read, instead of reading the mask values of all mask bits, ensuring that the number of polling is consistent with the number of interrupts triggered.
[0063] In one optional embodiment of this disclosure, the target mask value can be set to 0. Therefore, before sequentially reading the mask value of each mask bit in the mask sequence via polling, it can be determined whether the value of the mask sequence is 0. Only when the value of the mask sequence is not 0 is the mask value of each mask bit in the mask sequence read sequentially via polling. It is understood that regardless of the number of mask bits in the mask sequence, if the mask value of all mask bits is 0, then the value of the mask sequence is 0. Therefore, 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, thus it can be determined that there is no data to be processed in the storage space corresponding to any mask bit, and therefore no polling operation is needed for 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 with a non-zero mask value, thus it can be determined that there is data to be processed in the storage space corresponding to at least one mask bit, in which case a polling operation needs to be performed on the mask sequence.
[0064] In one optional embodiment of this disclosure, for a target first host device that sends multiple data packets in a single communication (i.e., one send and multiple receive), a slave device allocates a corresponding storage queue to the target first host device to store the multiple data packets sent by the target first host device each time. The slave device stores the received multiple data packets into the storage queue in the order of reception. The storage queue constitutes the storage space corresponding to the communication channel connected to the target first host device. Furthermore, in this embodiment, the solution of this disclosure may further include: after performing one polling operation on the mask sequence, detecting whether there is unprocessed data in the storage queue; if unprocessed data is detected in the storage queue, setting the mask value of the mask bit corresponding to the storage queue to a preset mask value, and performing the polling operation on the mask sequence again.
[0065] In this embodiment, for a target first host device that transmits and receives multiple data streams simultaneously, the slave device uses a logical queue concept to place the received multiple data streams into a logical queue (i.e., a storage queue). After a single polling of the mask sequence, it checks whether there is still data in the logical queue. If there is data, the mask value of the corresponding mask bit in the logical queue is set to a preset mask value (e.g., set to 1), and another polling operation on the mask sequence is performed. This ensures that all multiple data streams sent by the target first host device can be processed at once and are processed in subsequent polls, avoiding the problem of the slave device continuously processing multiple data streams sent by the same host device, thus affecting the processing timeliness of data sent by other host devices. Furthermore, it should be noted that for a target first host device that transmits and receives multiple data streams simultaneously, the slave device only sends a response message to the target first host device after all multiple data streams sent at once have been processed (i.e., there is no data to be processed in the storage queue), allowing the target first host device to proceed with the next communication.
[0066] Figure 3 This illustration shows a schematic diagram of a slave device receiving data concurrently through multiple channels, as described in an exemplary embodiment of this disclosure. Figure 3As shown, a slave device (hereinafter referred to as "slave") connects to multiple first master devices (hereinafter referred to as "masters") through multiple communication channels, namely master 1, master 2, master 3, and master 4, and receives data sent by master 1, master 2, master 3, and master 4 respectively. Master 1, master 2, and master 3 are one-to-one transmitter and one-to-receiver devices, while master 4 is one-to-many transmitter and one-to-receiver device. Upon receiving data, the slave device generates an interrupt and sets the interface mask (i.e., mask bit) corresponding to each master to a mask value of 1. The data received by the slave device from each master device is stored in the corresponding storage space for later use. Then, the slave device polls the mask sequence composed of interface masks, performing the polling as many times as interrupts occur. If the mask value of the currently polled interface mask is 0, it continues polling the next interface mask; otherwise, the slave CPU processes the data in the corresponding storage space. After processing the data, the slave CPU responds to the masters according to the data of the polled interface mask. Figure 4 A schematic diagram of a slave device's multi-channel concurrent response is shown in an exemplary embodiment of this disclosure.
[0067] exist Figure 3 In the exemplary embodiment shown, host 4 is a device that transmits and receives multiple data streams in a single communication. After one round of polling, the data sent by host 4 has not been fully processed, and there is still unprocessed data in the storage space storing the data sent by host 4. Therefore, the mask value of its corresponding interface mask is still 1, and the next round of polling is required. After completing one round of polling of the mask sequence formed by the interface mask, the next state is as follows: Figure 5 As shown. Figure 5 As shown, the mask sequence formed by the interface masks needs to be polled again, with each polling cycle repeating for each interrupt until the value of each interface mask is 0. After processing all the data sent by the master, the slave device returns to an idle state, the communication mask value in the storage medium is 0, and the number of data entries in the slave device's logical queue is 0.
[0068] In one optional embodiment of this disclosure, the slave device can be connected to at least one second master device via a physical signal line (such as twisted pair, optical fiber, etc.). This physical signal line is controlled by the slave device to control the data transmission function of the connected second master device. When the slave device is idle, it sets the level of the physical signal line to low, at which point the second master device can send data to the slave device. When the slave device begins processing data, it sets the level of the physical signal line to high, indicating that it is currently in the data processing stage, at which point the second master device should stop sending the next data to the slave device. Here, low level is 0, and high level is 1.
[0069] Furthermore, before sending data to the slave device, at least one second master device checks whether the physical signal line is at a high level. When the physical signal line is at a high level, the second master device pauses sending new data to the slave device. It should be noted that when the physical signal line is set to a high level, if a second master device is currently sending data, it will continue sending the currently transmitted data and then maintain the high level of the physical signal line before sending the next data.
[0070] In this embodiment, the slave device and at least one second master device can be connected using the same fixed physical signal line. This physical signal line is low when the slave device is idle. When the slave device detects a communication signal and begins processing data, it sets the physical signal line to a high level. Before sending each data packet, the second master device checks the level of the physical signal line. If the level is high, it temporarily stops initiating a new round of communication. If communication is in progress, the level of the physical signal line is not checked during the current process. The second master device, which transmits and receives multiple data packets, should determine that the slave device is in the data processing stage after detecting that the physical signal line is high, and will not send the next data packet until the physical signal line goes low, thus avoiding data processing overflow by 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. The processing logic is similar to the relevant description in the previous embodiments. That is to say, in this embodiment, the way the first host device and the second host device access the slave device is different, and the way the slave device controls the first host device and the second host device to send data is different, but the way of setting mask bits and polling the data according to the mask value is the same. Therefore, the relevant content will not be described again here.
[0072] In this embodiment, the slave device supports connection to a second master device via an additional physical signal line. When the physical signal line is low, the second master device can start sending the next data, and when the physical signal line is high, it should stop sending the next data. Thus, the frequency of concurrent communication of the master device can be controlled from the master device end via physical signal lines, further improving the stability of multi-channel concurrent communication.
[0073] Figures 6(a)-6(d)Figure 6(a) illustrates the working process of a host device (hereinafter referred to as the master device) and a slave device (hereinafter referred to as the slave device) connected via a physical signal line according to an exemplary embodiment of this disclosure. Slave device 1 is connected to master devices 1, 2, and 3 via a single physical signal line. All these devices are 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 Figure 6(b), the slave device receives data sent by each master device concurrently through multi-communication. The data sent by master device 1 is denoted as Device 1 Data 1, the data sent by master device 2 is denoted as Device 2 Data 1, and the data sent by master device 3 is denoted as Device 3 Data 1. After the slave device starts processing data, it sets the level of the physical signal line to high level 1. Master devices 1 and 2 wait for a response from the slave device. Master device 3 still has data 2 to send, but since master device 3 recognizes that the level of the physical signal line is high, it pauses sending Device 3 Data 2. After the device finishes processing the previously received data, it sets the level of the physical signal line to low, as shown in Figure 6(d). The master device 1 and master device 2 have no data to send and are in an idle state. The master device 3 recognizes that the level of the physical signal line is low and starts sending data 2 from the sending device 3.
[0074] To implement the above embodiments, this disclosure also provides a multi-channel concurrent communication device based on a security element, applied to a slave device, wherein the slave device is connected to multiple first master devices through multiple communication channels, and one communication channel is connected to one first master device.
[0075] Figure 7 This is a schematic diagram of a multi-channel concurrent communication device based on a security element provided in an embodiment of the present disclosure. The device is implemented in software and / or hardware and can be integrated into an electronic device, which is a device with an integrated SE chip.
[0076] like Figure 7 As shown, the multi-channel concurrent communication device 50 based on a security unit may include: an interrupt triggering 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 to set a preset mask value for the mask bits of the communication channels corresponding to the at least one first host device.
[0078] The polling module 520 is used to sequentially read the mask value of each mask bit in the mask sequence using a polling method;
[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 to send 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 can continue to send the next data after receiving the response message;
[0080] The reset module 540 is used to set the mask value of the current mask bit to the target mask value;
[0081] The polling module 520 is also used to continue reading the mask value of the next mask bit in the mask sequence; and to 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 also used for:
[0083] Get the number of interrupts that triggered the receive completion interrupt;
[0084] The mask sequence is polled bit by bit to obtain the mask value of the current mask bit, wherein the number of polling is the same as the number of interruptions.
[0085] Further optionally, with a target mask value of 0, the multi-channel concurrent communication device 50 based on a secure element also includes:
[0086] The judgment module is used to determine whether the value of the mask sequence is 0;
[0087] The polling module 520 is also used to read the mask value of each mask bit in the mask sequence in a polling manner 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 data messages in a single communication, the slave device allocates a corresponding storage queue to the target first host device to store the multiple data messages sent by the target first host device each time. The slave device stores the received multiple data messages into the storage queue in the order of receipt. The storage queue constitutes the storage space corresponding to the communication channel connected to the target first host device. The multi-channel concurrent communication device 50 based on a security unit further includes:
[0089] The detection module is used to detect whether there is any unprocessed data in the storage queue after one polling of the mask sequence;
[0090] The polling module 520 is further configured to, when it detects 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 polling operation on the mask sequence again.
[0091] Optionally, the slave device is connected to at least one second master device via a physical signal line. The multi-channel concurrent communication device 50 based on a secure element further includes:
[0092] The control module is used to set the level of the physical signal line to low when the slave device is in an idle state.
[0093] Optionally, the control module is further configured to: set the level of the physical signal line to a high level when the slave device begins processing data.
[0094] Optionally, at least one second master device detects whether the level of the physical signal line is high before sending data to the slave device, and suspends sending new data to the slave device when the level of the physical signal line is high.
[0095] The multi-channel concurrent communication device based on a secure element for electronic devices provided in this disclosure can execute the multi-channel concurrent communication method based on a secure element provided in this disclosure, and has the corresponding functional modules and beneficial effects of the method. Content not described in detail in the device embodiments of this disclosure can be referred to the description in any method embodiment of this disclosure.
[0096] This disclosure also provides a computer program product, including a computer program / instruction that, when executed by a processor, implements the multi-channel concurrent communication method based on a secure element provided in any embodiment of this disclosure.
[0097] According to one or more embodiments of this disclosure, this disclosure provides an electronic device, including:
[0098] processor;
[0099] Memory used to store the processor's executable instructions;
[0100] The processor is configured to read the executable instructions from the memory and execute the executable instructions to implement the multi-channel concurrent communication method based on a secure element as provided in any embodiment of this disclosure.
[0101] According to one or more embodiments of the present disclosure, the present disclosure provides a computer-readable storage medium storing a computer program for implementing a multi-channel concurrent communication method based on a secure element as provided in any embodiment of the present disclosure.
[0102] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0103] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0104] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0105] The units described in the embodiments of this disclosure can be implemented in software or hardware. The names of the units are not, in some cases, intended to limit the specific unit.
[0106] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0107] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0108] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
[0109] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
[0110] Although the subject matter has been described using language specific to structural features and / or methodological logic, 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. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.
Claims
1. A multi-channel concurrent communication method based on a secure unit, characterized in that, Applied to slave devices, wherein the slave devices are connected to multiple first master devices through multiple communication channels, with one communication channel connecting one first master device, the method includes: In response to receiving data sent by at least one first host device, a reception completion interrupt is triggered and a preset mask value is set for the mask bits of the communication channels corresponding to the at least one first host device. The mask value of each mask bit in the mask sequence is read sequentially using a polling method. If 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 can continue to send the next data after receiving the response message; Set the mask value of the current mask bit to the target mask value, and continue reading the mask value of the next mask bit in the mask sequence; The polling operation stops when the mask value of each mask bit in the mask sequence is the target mask value.
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 via polling includes: Get the number of interrupts that triggered the receive completion interrupt; The mask sequence is polled bit by bit to obtain the mask value of the current mask bit, wherein the number of polling is the same as the number of interrupts.
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 via polling, the method further includes: The value of the mask sequence is determined to be non-zero.
4. The method according to claim 1, characterized in that, For a target first host device that sends multiple data messages in a single communication, the slave device allocates a corresponding storage queue to the target first host device to store the multiple data messages sent by the target first host device each time. The slave device stores the multiple data messages received in the order of receipt into the storage queue, wherein the storage queue constitutes the storage space corresponding to the communication channel connected to the target first host device. The method further includes: After performing one poll on the mask sequence, check whether there is any unprocessed data in the storage queue; If unprocessed data is detected 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-4, characterized in that, The slave device is connected to at least one second master 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 low.
6. The method according to claim 5, characterized in that, The method further includes: When the slave device begins processing data, the level of the physical signal line is set to high.
7. The method according to claim 6, characterized in that, Before sending data to the slave device, the at least one second master device detects whether the level of the physical signal line is high, and pauses sending new data to the slave device when the level of the physical signal line is high.
8. A multi-channel concurrent communication device based on a secure element, characterized in that, Applied to slave devices, wherein the slave devices are connected to multiple first master devices through multiple communication channels, with one communication channel connecting one first master device, the device includes: An interrupt triggering module is used 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 the mask bits of the communication channels corresponding to the at least one first host device. The polling module is used to sequentially read the mask value of each mask bit in the mask sequence using a polling method; The data processing module 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 to send 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 can continue to send the next data after receiving the response message; A reset module is used to set the mask value of the current mask bit to the target mask value; The polling module is also used to continue reading the mask value of the next mask bit in the mask sequence; and to 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 includes: processor; Memory used to store the processor's executable instructions; The processor is configured to read the executable instructions from the memory and execute the executable instructions to implement the multi-channel concurrent communication method based on a secure unit as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The storage medium stores a computer program for implementing the multi-channel concurrent communication method based on a secure unit as described in any one of claims 1-7.
Citation Information
Patent Citations
Data access method, system and device, equipment and storage medium
CN112380153A
Storage device and method of operating storage device
CN113360086A