Communication control method and apparatus for dual chips, device and storage medium
By obtaining the interface indication information in the POS terminal to flexibly set the UART or SPI interface, it solves the problems of data leakage and inflexible control methods caused by the SPI interface, achieves safer and more efficient communication control, and adapts to different hardware layouts and security risks. , reducing hardware design complexity and cost.
Patent Information
- Application Number
- PCT/CN2023/103225
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-03-16
- Filing Date
- 2023-06-28
- Publication Date
- 2024-09-19
AI Technical Summary
When existing POS terminals communicate through the SPI interface, it is easy to cause data leakage and the control method is not flexible enough. Especially due to the pin distribution problem caused by the module packaging layout, it increases the complexity and cost of the hardware design.
A dual-chip communication control method is proposed to flexibly set the UART or SPI interface between chips by obtaining interface indication information to ensure the security and flexibility of the communication process, including obtaining interface indication information, setting the target interface according to the information, and Switch UART and SPI interfaces when necessary to accommodate different hardware layouts and security risks.
It improves the control flexibility of the communication interface, reduces the possibility of data leakage, reduces the complexity and cost of hardware design, and meets the requirements of PCI security certification.
Smart Images

Figure CN2023103225_19092024_PF_FP_ABST
Abstract
Description
A dual-chip communication control method, device, equipment, and storage medium Technical Field
[0001] The present application relates to the field of electronic communication technology, and in particular to a dual-chip communication control method and apparatus, device, and storage medium. Background Art
[0002] Currently, a POS terminal includes an application processing chip and a security processing chip. Typically, the application processing chip (AP) and the security processing chip (SP) communicate via the SPI interface. However, in actual hardware design, the module (AP) is attached to the motherboard. SPI requires four pins: MOSI, MISO, CLK, and CS. The distribution of the module pins depends on the module's package layout. Most modules have external pin contacts located around the edges, with some located at the bottom of the module where it meets the motherboard. For example, in some projects, the motherboard structure design allows probes to detect waveforms on the MOSI and MISO pins of the module's SPI interface through a gap in the POS printer. There's no physical space to add a wallboard to this gap (adding a wallboard would require re-boarding, increasing costs). Therefore, the current method of communicating via the SPI interface is prone to data leakage during communication and lacks flexible control methods.
[0003] Summary of the Invention
[0004] The main purpose of the embodiments of the present application is to propose a dual-chip communication control method and apparatus, device, and storage medium that can flexibly set the interfaces required for communication between chips.
[0005] To achieve the above objectives, a first aspect of an embodiment of the present application provides a dual-chip communication control method, which is applied to a terminal, wherein the terminal includes an application processing chip and a security processing chip. The method includes:
[0006] Obtaining interface indication information of the terminal;
[0007] Perform interface setting according to the interface indication information to obtain a target interface; the target interface includes a UART interface or an SPI interface;
[0008] The target interface is opened to enable communication between the application processing chip and the security processing chip through the target interface.
[0009] In some embodiments, the interface indication information includes first indication information and second indication information, the first indication information is used to indicate that communication is performed through a UART interface, and the second indication information is used to indicate that communication is performed through an SPI interface;
[0010] The performing interface setting according to the interface indication information to obtain a target interface includes:
[0011] If the interface indication information is the first indication information, performing interface setting according to the first indication information to obtain a target interface; the target interface is the UART interface;
[0012] If the interface indication information is the second indication information, interface setting is performed according to the second indication information to obtain the target interface; the target interface is the SPI interface.
[0013] In some embodiments, performing interface setting according to the first indication information to obtain a target interface includes:
[0014] Acquire configuration parameters according to the first indication information; the configuration parameters include: node, baud rate, data bit, parity bit, stop bit, and flow control;
[0015] The parameters of the UART interface are set according to the configuration parameters to obtain the target interface.
[0016] In some embodiments, before obtaining the interface indication information of the terminal, the method further includes:
[0017] determining a usage status of the terminal;
[0018] Comparing the usage state with a preset condition; the preset condition includes any one of the following: the usage state is a power-on initialization state, the usage state is a state of calling the SPI interface to perform an operation, and the usage state is a state of releasing the SPI interface;
[0019] If the usage status meets the preset condition, the step of obtaining the interface indication information of the terminal is performed.
[0020] In some embodiments, after the usage status meets the preset condition, the method further includes:
[0021] If it is determined that the terminal has a security risk, the step of obtaining the interface indication information of the terminal is performed, and the corresponding target interface is the UART interface, and the installation position of the UART interface in the terminal is not on the side of the gap of the printer of the terminal;
[0022] If it is determined that the terminal does not have the security risk, the SPI interface is opened to enable the application processing chip and the security processing chip to communicate through the SPI interface.
[0023] In some embodiments, determining that the terminal has a security risk further includes:
[0024] Obtaining the installation location of the SPI interface on the terminal;
[0025] If the SPI interface is installed at the terminal on a side of the gap in the printer, it is determined that the terminal has a safety hazard.
[0026] In some embodiments, determining the usage status of the terminal includes:
[0027] Obtaining a power-on signal, and determining a usage state of the terminal according to the power-on signal, wherein the usage state is the power-on initialization state;
[0028] Alternatively, a calling interface signal is obtained, where the calling interface signal is used to represent a signal requesting to call the SPI interface; and a usage state of the terminal is determined according to the calling interface signal, where the usage state is a state in which the SPI interface is called to perform an operation;
[0029] Alternatively, a release interface signal is obtained, where the release interface signal is used to represent a signal requesting to uninstall the SPI interface; and a usage state of the terminal is determined according to the release interface signal, where the usage state is a state of releasing the SPI interface.
[0030] To achieve the above objectives, a second aspect of an embodiment of the present application provides a dual-chip communication control device, which is applied to a terminal. The terminal includes an application processing chip and a security processing chip. The device includes:
[0031] An acquisition module, configured to acquire interface indication information of the terminal;
[0032] A setting module, configured to perform interface setting according to the interface indication information to obtain a target interface; the target interface includes a UART interface or an SPI interface;
[0033] The control module is configured to open the target interface so that the application processing chip and the security processing chip can communicate with each other through the target interface.
[0034] A third aspect of the embodiments of the present application provides a computer device, comprising a memory and a processor, wherein the memory stores a program, and when the program is executed by the processor, the processor is used to execute the method described in any one of the embodiments of the first aspect of the present application.
[0035] The fourth aspect of the embodiments of the present application proposes a storage medium, which is a computer-readable storage medium. The storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the method described in any one of the embodiments of the first aspect of the present application.
[0036] The embodiment of the present application proposes a dual-chip communication control method, device equipment, and storage medium, which sets the interface through interface indication information to obtain the target interface, which is an SPI interface or a UART interface, to achieve flexible setting of the interface and improve the flexibility of communication. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] FIG1 is a schematic diagram of the hardware structure of a terminal provided in an embodiment of the present application;
[0038] FIG2 is a flow chart of a dual-chip communication control method provided by one embodiment of the present application;
[0039] FIG3 is a flow chart of a dual-chip communication control method provided by another embodiment of the present application;
[0040] FIG4 is a flowchart of step 203 in FIG3 ;
[0041] FIG5 is a schematic diagram of the hardware structure of a terminal provided in another embodiment of the present application;
[0042] FIG6 is a flowchart of step 102 in FIG2 ;
[0043] FIG7 is a schematic flow chart of whether to use a UART interface to replace an SPI interface provided in Example 1;
[0044] FIG8 is a schematic flow chart of interface settings for power-on initialization provided in Example 2;
[0045] FIG9 is a schematic flow chart of calling the SPI interface to perform read interface settings provided in Example 3;
[0046] FIG10 is a schematic flow chart of calling the SPI interface to perform write interface settings provided in Example 4;
[0047] FIG11 is a schematic flow chart of releasing the SPI interface provided in Example 5;
[0048] FIG12 is a block diagram of the module structure of a dual-chip communication control device provided in an embodiment of the present application;
[0049] FIG13 is a schematic diagram of the hardware structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0050] In order to make the purpose, technical solutions and advantages of this application more clearly understood, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0051] It should be noted that although the functional modules are divided in the device schematic and the logical order is shown in the flowchart, in some cases, the steps shown or described can be performed in a different order than the module division in the device or the order in the flowchart.
[0052] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.
[0053] Point of Sale (POS): Also known as a POS terminal, this multifunctional terminal is installed at authorized credit card merchants and acceptance points, connected to a computer network, to enable automatic electronic funds transfer. It supports purchases, pre-authorizations, balance inquiries, and transfers, offering safe, fast, and reliable operation. It includes a security processing chip, an application processing chip, and SPI and UART interfaces.
[0054] Security Process (SP): It can run and control independently, and can independently complete user payment functions. At the same time, it also controls the application processing chip through an interface to display passwords. This interface only transmits fixed information commands indicating the number of valid user clicks and input error signal commands, and does not involve any ciphertext or plaintext related to password information.
[0055] Application Process (AP): It can run normal enterprise software and can also connect to extended wireless devices, including wireless printers, to print payment receipts.
[0056] Serial Peripheral Interface (SPI): also known as SPI interface, is a synchronous serial data transmission standard.
[0057] A Universal Asynchronous Receiver Transmitter (UART), also known as a UART interface, is a piece of computer hardware that converts data between serial and parallel communication. UARTs are often integrated into other communication interfaces. UARTs are also commonly referred to as "serial ports."
[0058] Currently, any POS terminal sold externally must pass PCI (Payment Card Industry) security certification. This certification strictly stipulates that disassembly of the device must trigger (triggering means that the device has disassembly protection, and after disassembly, the physical structure changes, the contacts loosen, triggering the safety protection circuit, and the system software prompts to enter protection mode) and that no physically exposed signal pins are left.
[0059] For POS terminals that cannot physically have exposed signal pins, the typical approach is to include both an application processing chip and a security processing chip. Communication between the two chips occurs via the SPI interface. However, in actual hardware design, the module (AP) is mounted on the motherboard. SPI requires four pins: MOSI, MISO, CLK, and CS. The module's pinout distribution depends on the module's package layout. Most modules have external pin contacts located around the edges, while some have them located at the bottom where the module meets the motherboard. For example, in some projects, the motherboard design allows probes to detect waveforms on the MOSI and MISO pins of the module's SPI interface through a gap in the POS printer. This gap lacks physical space for wallboard to block the gap (adding wallboard would require re-boarding, increasing costs). Therefore, current communication methods using the SPI interface are prone to data leakage and lack flexible control.
[0060] The dual-chip communication control method of the embodiment of the present application, when applied to a terminal, can improve the control flexibility of the communication interface and reduce the possibility of data leakage to a certain extent.
[0061] Referring to Figure 1, which is a schematic diagram of the hardware structure of a terminal provided in an embodiment of the present application, the terminal includes a security processing chip SP and an application processing chip AP, which generally communicate with each other via an SPI interface. To improve communication flexibility, the embodiment of the present application aims to set the interface using interface indication information to obtain a target interface, which is an SPI interface or a UART interface, to achieve flexible interface setting and improve communication flexibility.
[0062] The embodiments of the present application provide a dual-chip communication control method and apparatus, a computer device, and a storage medium, which are specifically described through the following embodiments. First, the dual-chip communication control method in the embodiments of the present application is described.
[0063] 2 , the dual-chip communication control method of an embodiment of the present application is applied to the terminal shown in FIG1 . The method of this embodiment includes but is not limited to the following steps:
[0064] Step 101, obtaining terminal interface indication information;
[0065] Step 102, performing interface settings according to the interface indication information to obtain a target interface; the target interface includes a UART interface or an SPI interface;
[0066] Step 103: Open the target interface to enable communication between the application processing chip and the security processing chip through the target interface.
[0067] First, steps 101 to 103 are briefly described.
[0068] In step 101, the interface indication information refers to one of the following: indication information indicating that the interface required between the application processing chip and the security processing chip is a UART interface, or the interface indication information refers to indication information indicating that the interface required between the application processing chip and the security processing chip is an SPI interface.
[0069] After obtaining the interface indication information, you can perform interface settings according to the interface indication information.
[0070] Therefore, in step 102, after obtaining the target interface according to the interface indication information, the target interface is a UART interface or an SPI interface. It is understandable that different interface indication information corresponds to different target interfaces.
[0071] After the target interface is set, the target interface is opened in step 103. In this way, the application processing chip and the security processing chip can communicate with each other through the target interface.
[0072] If the target interface is a UART interface, then after step 103, the dual-chip communication control method of the embodiment of the present application further includes at least one of the following:
[0073] Call the UART interface for read operation;
[0074] Call the UART interface for write operation;
[0075] Close the UART interface.
[0076] It can be understood that, in this embodiment, the operation of the UART interface is integrated into the original SPI interface through the interface indication information of step 101 .
[0077] Steps 101-103 are described in detail below.
[0078] Detailed description of step 101:
[0079] Steps 101-103 can be performed periodically. A time period is pre-set. Steps 101-103 are then performed once per time period. For example, the time period is set to 2 minutes. Every 2 minutes, steps 101-103 are performed again to obtain a new target interface and open the target interface for communication. In this case, step 101 may include periodically obtaining interface indication information. The advantage of periodically obtaining interface indication information is that the target interface is regularly updated and the currently open target interface is continuously adjusted, so that the opened target interface can meet the terminal's ever-changing interface requirements.
[0080] In another embodiment, steps 101-103 may be triggered by a trigger event. In this case, step 101 may include obtaining interface indication information in response to the trigger event. The advantage of obtaining interface indication information in response to a trigger event is that it reduces unnecessary processing overhead when there is no communication requirement between chips, or even when the terminal is powered on but has no communication requirements. Furthermore, responding to trigger events is more real-time, which can improve processing real-time performance in scenarios with stringent real-time requirements.
[0081] The trigger event is an event used to trigger the execution of the dual-chip communication control method of the embodiment of the present application. It may include but is not limited to the following events:
[0082] Identified as being in the power-on initialization state;
[0083] Identify the state of calling the SPI interface for operation;
[0084] It is recognized that the SPI interface is in the released state.
[0085] Therefore, referring to FIG3 , in one embodiment, before step 101 , the dual-chip communication control method further includes the following steps:
[0086] Step 201, determining the usage status of the terminal;
[0087] Step 202: Compare the usage state with a preset condition; the preset condition includes any one of the following: the usage state is a power-on initialization state, the usage state is a state of calling an SPI interface for operation, and the usage state is a state of releasing an SPI interface;
[0088] Step 203: If the usage status meets the preset condition, the step of obtaining the terminal's interface indication information is executed.
[0089] The benefit of performing steps 201-203 is that unnecessary processing overhead is reduced and the real-time processing performance can be improved.
[0090] In another embodiment, if the usage status does not meet the preset condition, the SPI interface is opened to enable communication between the application processing chip and the security processing chip through the SPI interface.
[0091] Next, steps 201-203 are briefly described.
[0092] In step 201, the usage status is used to represent the current operating environment of the terminal. For example, if the usage status is the power-on initialization state, it means that the terminal is currently in the initialization operation environment. For another example, if the usage status is the power-off state, it means that the terminal is currently in the stop operation environment. For another example, if the usage status is the interface calling state, it means that the terminal is currently in the interface operation environment.
[0093] In steps 202-203, by introducing preset conditions, the step of obtaining the terminal interface indication information is performed only when the preset conditions are met, so that the setting of the target interface is more in line with the actual operation of the terminal, further improving the real-time processing.
[0094] Next, steps 201-203 are described in detail.
[0095] In one embodiment, step 201 includes:
[0096] Obtain a power-on signal, and determine the terminal's usage state according to the power-on signal, wherein the usage state is a power-on initialization state;
[0097] Alternatively, a calling interface signal is obtained, where the calling interface signal is used to represent a signal requesting to call the SPI interface; and a usage state of the terminal is determined according to the calling interface signal, where the usage state is a state in which the SPI interface is called to perform an operation;
[0098] Alternatively, a release interface signal is obtained, where the release interface signal is used to indicate a signal requesting to uninstall the SPI interface; and the use state of the terminal is determined according to the release interface signal, where the use state is a state in which the SPI interface is released.
[0099] Continuing with Figure 1, the UART and SPI interfaces are located in different locations on the terminal. Generally speaking, due to the specific nature of the SPI interface, the MOSI and MISO pins are physically susceptible to waveform detection by a probe. In this case, the terminal often presents a security risk, necessitating flexible interface configuration.
[0100] Therefore, in one embodiment, referring to FIG. 4 , step 203 specifically includes:
[0101] Step 301: If the usage status meets the preset conditions and if it is determined that the terminal has a security risk, then the step of obtaining the terminal's interface indication information is executed, and the corresponding target interface is a UART interface, and the UART interface is not installed on the side of the gap of the terminal's printer;
[0102] Step 302: If the usage status meets the preset conditions and if it is determined that there is no security risk in the terminal, the SPI interface is opened to enable communication between the application processing chip and the security processing chip via the SPI interface.
[0103] The benefit of performing steps 301-302 is that whether to obtain the terminal interface indication information is determined based on whether there is a security risk, thereby further reducing processing overhead and ensuring the communication security of the terminal.
[0104] It's important to note that the presence of security risks generally depends on the terminal's structural composition. For example, refer to Figure 5. The terminal shown in Figure 5 has a printer, unlike the terminal in Figure 1. In the terminal in Figure 5, the SPI interface is located near the printer's gap, making it more susceptible to probe waveform detection, potentially presenting a security risk. In this case, the UART interface is located away from the printer's gap, making it less susceptible to probe waveform detection and providing greater security.
[0105] Therefore, in one embodiment, determining whether a terminal has a security risk includes:
[0106] Get the installation location of the SPI interface on the terminal;
[0107] If the SPI interface is installed on the side of the printer where the terminal is installed, it is determined that there is a safety hazard in the terminal.
[0108] However, it should be noted that in addition to determining whether there is a security risk based on the installation location of the SPI interface as described above, other methods can also be used to determine whether there is a security risk. For example, the terminal model hardware configuration information can be read to determine whether there is a security risk based on the model hardware configuration information.
[0109] After the above steps 201-203 are completed, step 101 is determined to be executed, and step 101 is described below.
[0110] The interface indication information in step 101 includes first indication information and second indication information, the first indication information is used to indicate that communication is performed through a UART interface, and the second indication information is used to indicate that communication is performed through an SPI interface.
[0111] The first indication information or the second indication information may be obtained by the terminal receiving input information from a user layer and determining the first indication information or the second indication information according to the input information.
[0112] The first indication information or the second indication information may be obtained by the terminal accessing a preset storage location and reading the first indication information or the second indication information from the preset storage location. For example, the first indication information or the second indication information may be pre-stored in a preset storage location on a server. When performing communication control between the two chips, the terminal reads the indication information in the preset storage location, thereby obtaining the first indication information or the second indication information.
[0113] After step 101 is executed, step 102 will be described next.
[0114] This embodiment proposes replacing SPI with UART in software when speed is not a concern. When the module's UART pinout is not on the printer's side, it cannot be detected, thus complying with safety standards. The Android platform's AP and SP communication architecture has traditionally used pure SPI, with extensive driver logic. With the sudden switch to a UART interface, UART interface development typically doesn't involve extensive driver processing. To avoid revising the entire architecture, kernel file operations are used to streamline the UART and SPI drivers, avoiding the manual effort of extensive code refactoring.
[0115] 6 , step 102 specifically includes:
[0116] Step 401: If the interface indication information is the first indication information, then the interface setting is performed according to the first indication information to obtain the target interface; the target interface is a UART interface;
[0117] Step 402: If the interface indication information is the second indication information, perform interface setting according to the second indication information to obtain a target interface; the target interface is an SPI interface.
[0118] Step 401 specifically includes:
[0119] Acquire configuration parameters according to the first indication information; the configuration parameters include: node, baud rate, data bit, parity bit, stop bit, and flow control;
[0120] Set the parameters of the UART interface according to the configuration parameters to obtain the target interface.
[0121] In one example, various parameters in the configuration parameters are set as follows: node: / dev / ttyS1; baud rate: cfg.baud=115200; data bits: cfg.bits=8; parity bit: cfg.parity=0; stop bit: cfg.stops=1; and flow control: cfg.flowctl=0.
[0122] In one example, steps 401-402 are as follows: the user layer reads the value of the hardware configuration parameter spi_or_uart (interface indication information), transfers the user space data to the kernel space (preset storage location) and saves it. When the value is set to spi (second indication information), only the spi service is configured. When the value is set to uart (first indication information), the serial port parameters (configuration parameters) are simultaneously configured in the spi service startup interface.
[0123] In summary of the above embodiments, the dual-chip communication control method of the present application will be described below through specific application examples.
[0124] Different Android platforms have different hardware layouts and configurations. During the factory production process, some fixed hardware parameters are written to the device's flash memory and stored for use during runtime. These parameters include a wide range of information, such as module model, module configuration, and whether the device requires special processing. Furthermore, hardware parameters are highly secure and cannot be easily tampered with. Therefore, when designing hardware, whether a particular device needs to avoid SPI interface detection and instead communicate via the UART interface can be written as a variable into the hardware parameters.
[0125] Example 1, referring to FIG7, is a schematic flow chart of whether to use the UART interface to replace the SPI interface provided in this example 1. Example 1 specifically includes:
[0126] AP communicates with SP to trigger SPI write action;
[0127] The Framework layer (application framework layer) reads the model hardware configuration;
[0128] Check whether this model has SPI security risks;
[0129] Set the interface indication information to the first indication information (spi_or_uart=uart), or set the interface indication information to the second indication information (spi_or_uart=spi);
[0130] The interface indication information (the value of spi_or_uart) is passed into the kernel space as a kernel global variable to control the operation process of each read and write, that is, the target interface output by the communication control method of the dual chip of the embodiment of the present application is affected according to the interface indication information, thereby flexibly controlling the communication between the chips.
[0131] It should be noted that the model hardware configuration information contains many parameters, such as the module models and model codes used by the POS machine (terminal). These parameters are basically solidified after leaving the factory and are generally not allowed to be tampered with. As long as the parameters need to be solidified, they can be put into the hardware configuration parameters. After the software is running, it will run different logic according to the read hardware configuration parameters.
[0132] Example 2, referring to FIG8, is a schematic flow chart of the interface settings during startup initialization provided by Example 2. Example 2 specifically includes:
[0133] When the machine (terminal) is powered on, the boot process configures the SPI service;
[0134] Read the value of the hardware configuration parameter spi_or_uart to determine whether to use uart to replace spi;
[0135] If spi_or_uart=spi, only the spi service is configured; if spi_or_uart=uart, the serial port parameters are configured and the serial port is opened synchronously in the spi service startup interface.
[0136] Example 3, refer to Figure 9, which is a schematic flow chart of calling the SPI interface to set the read interface provided in Example 3. When the user touches the screen to input non-sensitive information, the specific screen coordinate value will be sent to the AP through the SP, and the user layer will call down to the SPI read interface of the kernel layer. At this time, Example 3 specifically includes:
[0137] SPI synchronous read interface;
[0138] If spi_or_uart=uart, the uart data is read and returned to the user layer;
[0139] If spi_or_uart = spi, the spi data is read and returned to the user layer.
[0140] It should be noted that the non-sensitive information in Example 3 refers to information that can be obtained, such as name and age. Sensitive information, on the other hand, refers to information that cannot be obtained, such as passwords and card numbers. Sensitive information is not transmitted to the AP and is processed by the SP. Therefore, it does not involve communication between the SP and the AP, and the SP processor has a higher security level. The processing of non-sensitive information will trigger communication between the AP and the SP, resulting in the transmission of screen coordinate values (allowing the AP to know where the user clicked on the screen and respond accordingly, such as launching an application), thus generating the steps in Example 3.
[0141] Example 4, referring to Figure 10, is a schematic flow chart of calling the SPI interface to perform write interface settings provided in Example 4. When the AP periodically (5s) sends data to the SP to query the current trigger status, it involves the AP writing data to the SP. At this time, Example 4 specifically includes:
[0142] SPI synchronous write interface;
[0143] If spi_or_uart = uart, after writing data to uart, the status of write success or failure is returned to the user layer;
[0144] If spi_or_uart = spi, after writing data to spi, the status of write success or failure is returned to the user layer.
[0145] Example 5, referring to Figure 11, is a schematic flow chart of releasing the SPI interface provided in Example 5. When the AP does not need to use SPI, it can uninstall the SPI driver and call the SPI release function of the kernel layer. After calling the SPI release function, Example 5 specifically includes:
[0146] Release the SPI interface;
[0147] When the kernel layer is set to spi, it returns directly to the end;
[0148] When the kernel layer is set to uart, call to close the uart interface and then end.
[0149] In summary, the dual-chip communication control method of the embodiment of the present application also has the following technical effects: for POS terminals, variables are passed in through the user layer to control whether the driver layer actually calls UART or SPI, operations on UART are added to the SPI interface, and the same set of codes is used to realize dynamic switching of SPI and UART communications, so that UART is covered with the coat of SPI, increasing the flexibility of the Android platform, and compatibility between different project solutions in software does not require additional hardware changes, saving project costs, making it easy to port to different projects, and ensuring the physical data security of the terminal.
[0150] Referring to Figure 12 , an embodiment of the present application further provides a dual-chip communication control device, which is applied to a terminal. The terminal includes an application processing chip and a security processing chip, and can implement the dual-chip communication control method described above. Figure 12 is a block diagram of the module structure of the dual-chip communication control device provided by an embodiment of the present application. The device includes: an acquisition module 501, a setting module 502, and a control module 503. The acquisition module 501 is used to obtain interface indication information of the terminal; the setting module 502 is used to perform interface settings based on the interface indication information to obtain a target interface; the target interface includes a UART interface or an SPI interface; and the control module 503 is used to open the target interface to enable communication between the application processing chip and the security processing chip via the target interface.
[0151] The dual-chip communication control device of the embodiment of the present application is used to execute the dual-chip communication control method in the above embodiment. Its specific processing process is the same as the dual-chip communication control method in the above embodiment, and will not be repeated here.
[0152] The dual-chip communication control device proposed in the embodiment of the present application is intended to set the interface through interface indication information to obtain the target interface, which is an SPI interface or a UART interface, to achieve flexible setting of the interface and improve the flexibility of communication.
[0153] The present application also provides a computer device, including:
[0154] at least one processor, and
[0155] a memory communicatively connected to at least one processor; wherein,
[0156] The memory stores instructions, and the instructions are executed by at least one processor so that the at least one processor implements a method as described in any one of the embodiments of the present application when executing the instructions.
[0157] The hardware structure of the computer device is described in detail below with reference to Figure 13. The computer device includes: a processor 601, a memory 602, an input / output interface 603, a communication interface 604, and a bus 605.
[0158] The processor 601 may be implemented as a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is configured to execute relevant programs to implement the technical solutions provided in the embodiments of the present application.
[0159] The memory 602 can be implemented in the form of ROM (Read Only Memory), static storage device, dynamic storage device, or RAM (Random Access Memory). The memory 602 can store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 602 and is called by the processor 601 to execute the dual-chip communication control method of the embodiments of this application.
[0160] Input / output interface 603, used to implement information input and output;
[0161] Communication interface 604, used to implement communication interaction between this device and other devices, which can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.); and
[0162] Bus 605 , which transmits information between various components of the device (e.g., processor 601 , memory 602 , input / output interface 603 , and communication interface 604 );
[0163] The processor 601 , the memory 602 , the input / output interface 603 and the communication interface 604 are connected to each other in communication within the device via a bus 605 .
[0164] An embodiment of the present application further provides a storage medium, which is a computer-readable storage medium. The computer-readable storage medium stores computer-executable instructions, which are used to enable a computer to execute the dual-chip communication control method of the embodiment of the present application.
[0165] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0166] The embodiments described in the embodiments of this application are intended to more clearly illustrate the technical solutions of the embodiments of this application and do not constitute a limitation on the technical solutions provided by the embodiments of this application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0167] Those skilled in the art will understand that the technical solutions shown in Figures 2 to 4 and Figures 6 to 11 do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0168] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, i.e., they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of this embodiment.
[0169] Those skilled in the art will appreciate that all or some of the steps in the methods, systems, and functional modules / units in the devices disclosed above may be implemented as software, firmware, hardware, or appropriate combinations thereof.
[0170] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0171] It should be understood that in this application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0172] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0173] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0174] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0175] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store programs, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0176] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but are not intended to limit the scope of the present invention. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and essence of the present invention should be within the scope of the present invention.
Claims
1. A dual-chip communication control method, It is characterized in that Applied to a terminal, the terminal includes an application processing chip and a security processing chip, and the method includes: Acquiring interface indication information of the terminal; Perform interface setting according to the interface indication information to obtain a target interface; the target interface includes a UART interface or an SPI interface; The target interface is opened so that the application processing chip and the security processing chip can communicate with each other through the target interface.
2. The method according to claim 1, It is characterized in that The interface indication information includes first indication information and second indication information, the first indication information is used to indicate that communication is performed through a UART interface, and the second indication information is used to indicate that communication is performed through an SPI interface; The step of performing interface setting according to the interface indication information to obtain a target interface includes: If the interface indication information is the first indication information, performing interface setting according to the first indication information to obtain a target interface; the target interface is the UART interface; If the interface indication information is the second indication information, interface setting is performed according to the second indication information to obtain the target interface; the target interface is the SPI interface.
3. The method according to claim 2, It is characterized in that The performing interface setting according to the first indication information to obtain a target interface includes: Acquire configuration parameters according to the first indication information; the configuration parameters include: node, baud rate, data bit, parity bit, stop bit, flow control; The parameters of the UART interface are set according to the configuration parameters to obtain the target interface.
4. The method according to any one of claims 1 to 3, It is characterized in that Before acquiring the interface indication information of the terminal, the method further includes: Determining a usage status of the terminal; Compare the use state with a preset condition; the preset condition includes any one of the following: the use state is a power-on initialization state, the use state is a state of calling the SPI interface to perform an operation, and the use state is a state of releasing the SPI interface; If the usage status meets the preset condition, the step of obtaining the interface indication information of the terminal is performed.
5. The method according to claim 4, It is characterized in that After the use status meets the preset condition, the method further includes: If it is determined that the terminal has a security risk, the step of obtaining the interface indication information of the terminal is performed, and the corresponding target interface is the UART interface, and the installation position of the UART interface in the terminal is not on the gap side of the printer of the terminal; If it is determined that the terminal does not have the security risk, the SPI interface is opened to enable the application processing chip and the security processing chip to communicate through the SPI interface.
6. The method according to claim 5, It is characterized in that The determining that the terminal has a potential safety hazard further includes: Obtaining the installation location of the SPI interface in the terminal; If the SPI interface is located on the side of the gap in the printer at the installation position of the terminal, it is determined that the terminal exists Safety hazard.
7. The method according to claim 4, It is characterized in that The determining the usage status of the terminal includes: Acquire a power-on signal, and determine a use state of the terminal according to the power-on signal, wherein the use state is the power-on initialization state; Alternatively, a calling interface signal is obtained, where the calling interface signal is used to represent a signal requesting to call the SPI interface; then, a use state of the terminal is determined according to the calling interface signal, and the use state is a state of calling the SPI interface to perform an operation; Alternatively, a release interface signal is obtained, where the release interface signal is used to represent a signal requesting to uninstall the SPI interface; then, a use state of the terminal is determined according to the release interface signal, and the use state is a state of releasing the SPI interface.
8. A dual-chip communication control device, It is characterized in that Applied to a terminal, the terminal includes an application processing chip and a security processing chip, and the device includes: An acquisition module, used to acquire interface indication information of the terminal; A setting module, used for performing interface setting according to the interface indication information to obtain a target interface; the target interface includes a UART interface or an SPI interface; The control module is used to open the target interface so that the application processing chip and the security processing chip can communicate through the target interface.
9. A computer device, It is characterized in that The computer device includes a memory and a processor, wherein the memory stores a program, and when the program is executed by the processor, the processor is used to execute: The method according to any one of claims 1 to 7.
10. A storage medium, wherein the storage medium is a computer-readable storage medium, It is characterized in that The storage medium stores computer executable instructions, and the computer executable instructions are used to enable a computer to execute: The method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Information processing and conversion equipment with information security system
CN101247449A
Security chip, mobile communication terminal and method for improving communication security thereof
CN106161028A
Java card chip communication equipment and communication method
CN111475430A
Interface multiplexing chip and chip debugging system
CN115344105A
Concurrent data operation method and device for multiple security chips, equipment and storage medium
CN115525935A
