A bus control method, device, vehicle, and storage medium

By obtaining the application's access request in the bus control method, determining the target data packet and bus channel, and adding the processing task to the processing queue, it solves the problem of communication errors or blocking when multiple applications access the same bus channel at the same time, and achieves Efficient access and processing of integrated circuit buses.

CN114443532BActive Publication Date: 2024-09-03GUANGZHOU XIAOPENG MOTORS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210118885.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-08
Publication Date
2024-09-03
Estimated Expiration
2042-02-08

AI Technical Summary

Technical Problem

When different applications access the same bus channel at the same time, communication errors or blocking are prone to occur.

Method used

By obtaining the application's access request for the integrated circuit bus, determine the target data packet and target bus channel based on the access request and data packet information, add the processing task to the processing queue, and trigger the bus channel controller to process the data packet according to the queue order, Utilize preset priority and timeout management strategies to handle periodic and event-triggered tasks.

Benefits of technology

It achieves unified control of multiple bus channel requests, avoids preemption of the same bus channel, and prevents communication errors or blocking.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114443532B
    Figure CN114443532B
Patent Text Reader

Abstract

The embodiment of the present invention provides a bus control method, device, vehicle, and medium. The method includes: obtaining an access request for an integrated circuit bus from an application program, determining a target data packet operated by the access request and a corresponding target bus channel according to the access request and data packet information; the data packet information includes preset correspondence information between the data packet and the bus channel, adding a processing task of the target data packet to a processing queue of the target bus channel, and triggering the controller of the target bus channel to process the data packet in sequence according to the order of entering the processing queue, so that access to the integrated circuit bus is realized by using a unified control program, and requests for multiple bus channels are supported. When multiple applications access the same bus channel at the same time, the processing queues of each bus channel are used to trigger the processing in sequence to avoid preemption of the same bus channel, thereby avoiding communication errors or blockages.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and in particular to a bus control method, a bus control device, a vehicle, and a readable storage medium. Background Art

[0002] A general-purpose MCU (Microcontroller Unit) controller has one or more IIC (Inter-Integrated Circuit) controllers that can be used. IIC is a serial integrated circuit bus that uses a multi-master-slave architecture and supports one master and multiple slaves.

[0003] IIC can have multiple bus channels. When different applications access the same bus channel at the same time, communication errors or blockages often occur. Summary of the invention

[0004] The purpose of the embodiments of the present invention is to provide a bus control method, device, vehicle, and storage medium, so as to solve the technical problem that communication errors or blockages often occur when different applications access the same bus channel at the same time.

[0005] In order to solve the above problem, in a first aspect of the implementation of the present invention, a bus control method is first provided, comprising:

[0006] Obtaining an access request from an application program to an integrated circuit bus;

[0007] Determine, according to the access request and the data packet information, a target data packet operated by the access request and a target bus channel corresponding to the target data packet; wherein the data packet information includes preset corresponding relationship information between the data packet and the bus channel of the integrated circuit bus;

[0008] Adding the processing task of the target data packet to the processing queue of the target bus channel;

[0009] According to the order in which the processing tasks enter the processing queue, the controllers of the target bus channels are triggered in sequence to process the data packets.

[0010] Optionally, the data packet information includes a data packet status, and the method further includes:

[0011] According to the access request, changing the data packet state of the target data packet to an active state;

[0012] After triggering the controllers of the target bus channels to process the data packets in sequence according to the order in which the processing tasks enter the processing queue, the method further includes:

[0013] Acquire processing completion information of the target data packet returned by the controller of the target bus channel;

[0014] Change the packet state of the target packet to inactive.

[0015] Optionally, after obtaining the access request of the application program to the integrated circuit bus, the method further includes:

[0016] Determining whether the access request is a periodic task request or an event-triggered task request;

[0017] According to the preset priority of the periodic tasks or event-triggered tasks for the integrated circuit bus, the target data packet operated by the access request is sent to the controller of the target bus channel when the microcontroller where the controller of the target bus channel is located is idle, and the controller of the target bus channel is triggered to process it.

[0018] Optionally, the method further comprises:

[0019] In the case where the access request is a periodic task request, timeout management is performed on the processing of the target data packet according to a preset period of the periodic task for the integrated circuit bus.

[0020] Optionally, the method further comprises:

[0021] Determine, according to the access request, a target operation corresponding to the access request; wherein the target operation includes at least one of the following: a synchronous operation, an asynchronous operation, a triggering data sending operation, a triggering data receiving operation, a sending completion callback operation, a receiving completion callback operation, a triggering sending start character operation, and a triggering sending end character operation;

[0022] The controller triggering the target bus channel to process the data packet comprises:

[0023] The controller of the target bus channel is triggered to perform the target operation on the target data packet.

[0024] Optionally, the method further comprises:

[0025] According to the access request, determining that a target operation corresponding to the access request is a synchronization operation;

[0026] The controller triggering the target bus channel to process the data packet comprises:

[0027] Obtaining a read / write status from a controller of the target bus channel through a read / write interface provided by a control program of the integrated circuit bus;

[0028] Based on the read / write status, the synchronization operation status is returned to the application.

[0029] Optionally, the method further comprises:

[0030] According to the access request, determining that a target operation corresponding to the access request is an asynchronous operation;

[0031] The controller triggering the target bus channel to process the data packet comprises:

[0032] Obtaining a read / write status from a controller of the target bus channel through a read / write interface provided by the operating system;

[0033] According to the read / write status, the asynchronous operation status is returned to the application.

[0034] In a second aspect of the present invention, a bus control device is provided, comprising:

[0035] A request acquisition module, used to acquire an access request from an application program to an integrated circuit bus;

[0036] a channel determination module, configured to determine, according to the access request and the data packet information, a target data packet operated by the access request and a target bus channel corresponding to the target data packet; wherein the data packet information includes information on a preset correspondence relationship between the data packet and the bus channel of the integrated circuit bus;

[0037] A task adding module, used for adding the processing task of the target data packet to the processing queue of the target bus channel;

[0038] The processing trigger module is used to trigger the controller of the target bus channel to process the data packet in sequence according to the order in which the processing tasks enter the processing queue.

[0039] Optionally, the data packet information includes a data packet status, and the device further includes:

[0040] A first state changing module, configured to change the data packet state of the target data packet to an active state according to the access request;

[0041] An information acquisition module, configured to acquire processing completion information of the target data packet returned by the controller of the target bus channel after the controller of the target bus channel is triggered in sequence to process the data packet in the order in which the processing tasks enter the processing queue;

[0042] The second state changing module is used to change the data packet state of the target data packet to an inactive state.

[0043] Optionally, the device further comprises:

[0044] A request determination module, configured to determine whether the access request is a periodic task request or an event-triggered task request after obtaining the access request of the application program to the integrated circuit bus;

[0045] An idle processing trigger module is used to sort the preset priorities of the periodic tasks or event-triggered tasks for the integrated circuit bus according to the priority, and when the microcontroller where the controller of the target bus channel is located is idle, send the target data packet operated by the access request to the controller of the target bus channel, and trigger the controller of the target bus channel to process it.

[0046] Optionally, the device further comprises:

[0047] A timeout management module is used to perform timeout management on the processing of the target data packet according to a preset period of the periodic task for the integrated circuit bus when the access request is a periodic task request.

[0048] Optionally, the device further comprises:

[0049] An operation determination module, configured to determine, according to the access request, a target operation corresponding to the access request; wherein the target operation includes at least one of the following: a synchronous operation, an asynchronous operation, a triggering data sending operation, a triggering data receiving operation, a sending completion callback operation, a receiving completion callback operation, a triggering sending start character operation, and a triggering sending end character operation;

[0050] The processing trigger module includes:

[0051] The operation execution submodule is used to trigger the controller of the target bus channel to execute the target operation on the target data packet.

[0052] Optionally, the device further comprises:

[0053] A synchronization operation determination module, configured to determine, according to the access request, that a target operation corresponding to the access request is a synchronization operation;

[0054] The processing trigger module includes:

[0055] A first read / write status acquisition submodule, configured to obtain a read / write status from a controller of the target bus channel through a read / write interface provided by a control program of the integrated circuit bus;

[0056] The synchronization status returning submodule is used to return the synchronization operation status to the application according to the read / write status.

[0057] Optionally, the device further comprises:

[0058] An asynchronous operation determination module, configured to determine, according to the access request, that a target operation corresponding to the access request is an asynchronous operation;

[0059] The processing trigger module includes:

[0060] A second read / write status acquisition submodule, used to obtain the read / write status from the controller of the target bus channel through the read / write interface provided by the operating system;

[0061] The asynchronous status returning submodule is used to return the asynchronous operation status to the application according to the read / write status.

[0062] In a third aspect of the present invention, a vehicle is provided, characterized in that it includes a processor, a communication interface, a memory and an integrated circuit bus, wherein the processor, the communication interface and the memory communicate with each other through the integrated circuit bus;

[0063] Memory, used to store computer programs;

[0064] The processor is used to implement any of the method steps described above when executing the program stored in the memory.

[0065] In a fourth aspect of the implementation of the present invention, a computer-readable storage medium is provided, on which a computer program is stored, characterized in that when the program is executed by a processor, any of the methods described above is implemented.

[0066] An embodiment of the present invention provides a bus control method, device, vehicle and storage medium, which obtains an access request of an application to an integrated circuit bus, and determines the target data packet operated by the access request and the target bus channel corresponding to the target data packet according to the access request and data packet information; wherein the data packet information includes preset correspondence information between the data packet and the bus channel of the integrated circuit bus, adds the processing task of the target data packet to the processing queue of the target bus channel, and triggers the controller of the target bus channel to process the data packet in sequence according to the order in which the processing tasks enter the processing queue, so that the application can use a unified control program to access the integrated circuit bus, and supports requests for multiple bus channels. When multiple applications access the same bus channel at the same time, the control program can use the processing queues of each bus channel to trigger processing in sequence to avoid preemption of the same bus channel, thereby avoiding communication errors or blockages. BRIEF DESCRIPTION OF THE DRAWINGS

[0067] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.

[0068] Figure 1 A flowchart showing a bus control method embodiment of the present invention is shown;

[0069] Figure 2 A schematic diagram showing a control procedure of an integrated circuit bus;

[0070] Figure 3 A schematic diagram showing the processing method of asynchronous operation request;

[0071] Figure 4 A flow chart showing the steps of a bus control method of the present invention is shown;

[0072] Figure 5 A flow chart showing the steps of a bus control method of the present invention is shown;

[0073] Figure 6 A schematic diagram showing the scheduling of periodic tasks and event-triggered tasks;

[0074] Figure 7 A schematic diagram showing the operations provided by the control program;

[0075] Figure 8 A schematic diagram showing the calling relationship between the application and the control program;

[0076] Fig. 9 A structural block diagram of a bus control device according to an embodiment of the present invention is shown;

[0077] Fig.10 A schematic diagram of a vehicle according to an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0078] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0079] Reference Figure 1 , shows a flowchart of a bus control method according to an embodiment of the present invention, which may specifically include the following steps:

[0080] Step 101: Obtain an access request from an application program to an integrated circuit bus.

[0081] In an embodiment of the present invention, the integrated circuit bus is a serial bus used to connect a microcontroller and its external devices. The integrated circuit bus has at least one bus channel. For each bus channel, there is a controller corresponding to the bus channel inside the microcontroller. When different applications access the same bus channel at the same time, communication errors or blockages are likely to occur. In order to solve this problem, the applicant creatively proposes to use a set of standard integrated circuit bus control programs to manage bus communications. The application layer only needs to use the control program to access the integrated circuit bus.

[0082] For example, Figure 2 Schematic diagram of the control program of the integrated circuit bus shown in FIG. From the software level, multiple different applications such as APP0, APP1, APP2, etc. running on the MCU (microcontroller) will access different external devices. These external devices will be hung on different bus channels according to the hardware design, such as Dev_0, Dev_1 hanging on the bus channel IIC0, Dev_2, Dev_3 hanging on the bus channel IIC1, Dev_4, Dev_5 hanging on the bus channel IIC2. There are IICcontrollers (controllers) inside the MCU, such as the controller of IIC0, the controller of IIC1, and the controller of IIC2. The IIC (control program) running on the MCU will manage the controller of IIC0, the controller of IIC1, the controller of IIC2, etc. The IIC (control program) provides a complete service interface for the application layer to use and manages all IIC controllers inside the MCU.

[0083] In the embodiment of the present invention, in order to enable the control program to control the integrated circuit bus, the control program needs to be initialized before the application uses the control program. The initialization of the control program mainly includes loading various hardware resources connected to the integrated circuit bus into the control program.

[0084] In the embodiment of the present invention, when the application needs to access the integrated circuit bus, it sends an access request for the integrated circuit bus to the control program, and the control program receives the access request, that is, the control program can obtain the access request for the integrated circuit bus from the application. For example, the IIC control program can receive access requests for the integrated circuit bus from different applications at the same time, and the access requests can be for different data packets.

[0085] Step 102, based on the access request and the data packet information, determine the target data packet operated by the access request and the target bus channel corresponding to the target data packet; wherein the data packet information includes preset correspondence information between the data packet and the bus channel of the integrated circuit bus.

[0086] In the embodiment of the present invention, the control program can determine the data packet operated by the access request according to the access request, and record it as the target data packet. For example, the access request carries the index identifier of the target data packet, and the target data packet is determined according to the index identifier.

[0087] In an embodiment of the present invention, the control program can pre-set the preset correspondence information between the data packet and the bus channel of the integrated circuit bus, and the preset correspondence information can be recorded in the data packet information corresponding to the bus channel. The control program can search for the target data packet in the data packet information corresponding to each bus channel. If the target data packet is found in the data packet information corresponding to a certain bus channel, the bus channel corresponding to the target data packet is determined to be the bus channel, which is recorded as the target bus channel.

[0088] For example, Figure 3 The schematic diagram of the processing method of the asynchronous operation request shown in the figure. The IIC control program has data packet information corresponding to each bus channel, and the tables in the figure are the data packet information of bus channel IIC0, the data packet information of bus channel IIC1, and the data packet information of bus channel IIC2. The data packet information includes a packet index (i.e., an index identifier of the data packet), and may also include a packet status (i.e., a packet status), and a packet data pointer (i.e., a pointer to the data packet). The target data packet is searched in the table of data packet information corresponding to each bus channel to determine the target bus channel corresponding to the target data packet.

[0089] Step 103: Add the processing task of the target data packet to the processing queue of the target bus channel.

[0090] In the embodiment of the present invention, the control program uses the processing queue to schedule the processing tasks of different data packets, specifically, a processing queue is set for each bus channel, and the order in which the processing tasks of the data packets enter the processing queue is determined according to the order of access requests.

[0091] In an embodiment of the present invention, after determining the target data packet and the target bus channel corresponding to the access request, the control program may add the processing task of the target data packet to the processing queue of the target bus channel. Figure 3 As shown, the IIC control program receives access requests from multiple APPs, and the access requests are asynchronous operation requests. The corresponding packet index is added to the processing queue of each bus channel in the order of the access requests, that is, the processing task corresponding to the packet index is added to the processing queue of each bus channel.

[0092] Step 104 , triggering the controllers of the target bus channels to process the data packets in sequence according to the order in which the processing tasks enter the processing queue.

[0093] In an embodiment of the present invention, the control program can trigger the controller of the target bus channel to process the data packet in turn according to the order in which the processing tasks enter the processing queue, so as to enable the controller of the target bus channel to process the data packet. Among them, when it is the turn of the processing task of the target data packet in the processing queue, the controller of the target bus channel is triggered to process the target data packet. For example, the processing of reading / writing the target data packet. Specifically, any applicable processing can be included, and the embodiment of the present invention does not limit this. Each bus channel adopts the above method respectively.

[0094] According to an embodiment of the present invention, by obtaining an access request for an integrated circuit bus from an application, a target data packet operated by the access request and a target bus channel corresponding to the target data packet are determined according to the access request and data packet information; wherein the data packet information includes preset correspondence information between the data packet and the bus channel of the integrated circuit bus, a processing task for the target data packet is added to a processing queue of the target bus channel, and the controller of the target bus channel is triggered in sequence to process the data packet in the order in which the processing tasks enter the processing queue, so that the application can use a unified control program to implement access to the integrated circuit bus, and support for requests for multiple bus channels is implemented. When multiple applications access the same bus channel at the same time, the control program can use the processing queues of each bus channel to trigger processing in sequence to avoid preemption of the same bus channel, thereby avoiding communication errors or blockages.

[0095] In an optional embodiment of the present invention, Figure 4 In the step flow chart of a bus control method shown, the data packet information includes a data packet status, and a specific method of determining a target data packet operated by the access request and a target bus channel corresponding to the target data packet based on the access request and the data packet information, further includes: step 1031, changing the data packet status of the target data packet to an active state based on the access request.

[0096] After the controller triggering the target bus channel processes the data packet, the method further comprises:

[0097] Step 106, obtaining the processing completion information of the target data packet returned by the controller of the target bus channel;

[0098] Step 107: Change the data packet state of the target data packet to an inactive state.

[0099] The application can also call the control program to manage the data packet status. The control program can change the data packet status according to the access request. Specifically, after determining the target data packet corresponding to the access request, the data packet status of the target data packet is changed to the active state. The data packet status is also recorded in the data packet information corresponding to each bus channel.

[0100] After the controller of the target bus channel completes processing of the target data packet, it returns processing completion information to the control program. The control program can obtain the processing completion information and change the data packet state of the target data packet to an inactive state accordingly. The data packet state can be used to lock the data packet, thereby solving the deadlock problem of synchronous and asynchronous operations and achieving the role of data protection.

[0101] For example, Figure 3 The packet status (i.e., packet status) is stored in the packet information corresponding to each bus channel shown, where Active refers to the active state and InActive refers to the inactive state. According to the access request, the packet status is changed to Active, and the target packet is added to the processing queue of the target bus channel. When the control program obtains the processing completion information of the target packet, the packet status is changed to InActive.

[0102] In an optional embodiment of the present invention, Figure 5 The step flow chart of a bus control method shown in the figure, after obtaining the access request of the application program to the integrated circuit bus, further includes:

[0103] Step 108: Determine whether the access request is a periodic task request or an event-triggered task request.

[0104] Step 109, according to the preset priority of the periodic task or event-triggered task for the integrated circuit bus, sort by priority, when the microcontroller where the controller of the target bus channel is located is idle, send the target data packet operated by the access request to the controller of the target bus channel, and trigger the controller of the target bus channel to process.

[0105] The control program involves the scheduling design of two kinds of tasks. One is a periodic task and the other is an event-triggered task. When the control program determines that the access request is a periodic task request or an event-triggered task request, the control program can determine the target data packet operated by the access request and the target bus channel corresponding to the target data packet based on the access request and the data packet information corresponding to the bus channel of the integrated circuit bus. However, the processing queue is no longer used to manage the periodic task and the event-triggered task. Instead, the control program pre-sets the priority of the periodic task and the event-triggered task and controls the two tasks according to the priority.

[0106] The control program can sort the tasks according to the preset priorities of the periodic tasks or event-triggered tasks for the integrated circuit bus, and the tasks with high priority are executed first, and the tasks with low priority are executed later. When the microcontroller where the controller of the target bus channel is located is idle, the target data packet operated by the access request is sent to the controller of the target bus channel, and the processing of the controller of the target bus channel is triggered, so as to use the idle time of the microcontroller to quickly execute the task, make full use of the task scheduling of the microcontroller, and improve the real-time performance of task execution.

[0107] In an optional embodiment of the present invention, it also includes: when the access request is a periodic task request, timeout management is performed on the processing of the target data packet according to a preset period of the periodic task for the integrated circuit bus.

[0108] For periodic tasks, not only are priorities set, but also the periods of periodic tasks are set to perform timeout management on the processing of data packets. A period is preset for the periodic tasks of the integrated circuit bus, which is recorded as a preset period. In the case where the access request is a periodic task request, the control program can perform timeout management on the processing of the target data packet according to the preset period. Specifically, if the processing time of the target data packet exceeds the preset period, it is determined that the processing of the target data packet has timed out; if the processing time of the target data packet does not exceed the preset period, it is determined that the processing of the target data packet has not timed out.

[0109] For example, Figure 6 The diagram shows the scheduling of periodic tasks and event-triggered tasks. On the MCU, there are Apptask1: period is 10ms, priority is 4; App task2: period is 5ms, priority is 2; IIC period task (periodic task of integrated circuit bus): period is 5ms, priority is 2; IIC event task (event-triggered task of integrated circuit bus): priority is 2. When the APP requests multiple IIC operations, the operating system will execute the IIC event task when the MCU is idle according to the preset priority order, making full use of the MCU's task scheduling to achieve the effect of real-time operation.

[0110] In an optional embodiment of the present invention, it further includes: determining a target operation corresponding to the access request according to the access request; wherein the target operation includes at least one of the following: synchronous operation, asynchronous operation, triggering data transmission operation, triggering data reception operation, transmission completion callback operation, reception completion callback operation, triggering transmission start character operation, triggering transmission end character operation. The step 105 includes: triggering the controller of the target bus channel to perform the target operation on the target data packet.

[0111] like Figure 7 The operation provided by the control program as shown in the figure includes synchronous operation, asynchronous operation, triggering data sending operation, triggering data receiving operation, sending completion callback operation, receiving completion callback operation, triggering sending start character operation, triggering sending end character operation, initialization operation, canceling packet operation, obtaining packet status operation, obtaining channel status operation, operating system scheduling operation, counting operation, etc., or any other applicable operation, which is not limited in the embodiment of the present invention.

[0112] Among them, synchronous operation means that once the call is started, the caller has to wait for the call to return the result before continuing to execute. Asynchronous operation, contrary to synchronous operation, does not wait for the result, but can continue to execute subsequent operations after the call is issued, and the callee notifies the caller through the status, or handles the call through a callback function. Triggering the operation of sending data refers to the triggering operation of sending data. Triggering the operation of receiving data refers to the triggering operation of receiving data. The callback operation of sending completion refers to the callback operation of the completion of the operation of sending data. The callback operation of receiving completion refers to the callback operation of the completion of the operation of receiving data. The operation of triggering the operation of sending the start character refers to the triggering operation of sending the start character. The operation of triggering the operation of sending the end character refers to the triggering operation of sending the end character. The initialization operation refers to the operation of initializing the control program, and the initialization mainly includes loading the hardware resources connected to the integrated circuit bus into the control program. The operation of canceling the packet refers to the operation of canceling various operations related to the data packet. The operation of obtaining the packet status refers to the operation of obtaining the status of the data packet. The operation of obtaining the channel status refers to the operation of obtaining the status of the bus channel. The operation of operating system scheduling refers to the operation of using the scheduling provided by the operating system, that is, the OS in the figure. The counting operation refers to the operation of using the hardware counter, that is, the Timer in the figure.

[0113] After obtaining the access request, in addition to determining the target data packet and the target bus channel corresponding to the access request, the control program is also required to determine the target operation corresponding to the access request according to the access request. When the controller that triggers the target bus channel processes the target data packet, specifically, the controller that triggers the target bus channel performs the target operation on the target data packet.

[0114] In an optional embodiment of the present invention, it further includes: determining, according to the access request, that the target operation corresponding to the access request is a synchronous operation. In a specific implementation of triggering the controller of the target bus channel to process the data packet, it includes: obtaining a read / write status from the controller of the target bus channel through a read / write interface provided by the control program of the integrated circuit bus; and returning a synchronous operation status to the application according to the read / write status.

[0115] The control program can determine the target operation corresponding to the access request according to the access request, and the target operation is a synchronous operation. When the controller of the target bus channel processes the data packet, the control program performs the synchronous operation. Figure 8 Schematic diagram of the calling relationship between the application and the control program shown. When the APP (application) requests a synchronous operation from the IIC control program, it obtains the read / write status from the IIC controller (controller of the target bus channel) through the read / write interface provided by the IIC control program, and then the IIC control program can return the synchronous operation status to the APP based on the returned read / write status.

[0116] In addition, if Figure 8 As shown in the figure, when APP requests the IIC control program to initialize the packet, the IIC control program can return the packet status. When APP requests the IIC control program to determine the packet status, the IIC control program can also feedback the packet status. Among them, the initialization packet refers to adding the packet index, packet status, and packet data pointer of the data packet to the data packet information of the bus channel.

[0117] In an optional embodiment of the present invention, it further includes: determining, according to the access request, that the target operation corresponding to the access request is an asynchronous operation. In a specific implementation of triggering the controller of the target bus channel to process the data packet, it includes: obtaining a read / write status from the controller of the target bus channel through a read / write interface provided by an operating system; and returning an asynchronous operation status to the application according to the read / write status.

[0118] The control program can determine the target operation corresponding to the access request according to the access request, and the target operation is an asynchronous operation. When the controller of the target bus channel processes the data packet, the control program performs the asynchronous operation. Figure 8 As shown, when APP (application) requests asynchronous operation from IIC control program, it obtains read / write status from IIC controller (controller of target bus channel) through read / write interface provided by operating system (or OS scheduling), and then IIC control program can return asynchronous operation status to APP according to the returned read / write status.

[0119] The application can call various interfaces of the control program to manage data packets, perform read / write operations, initialize operations, etc. Synchronous operations can operate external devices hanging on the integrated circuit bus in real time. Asynchronous operations can receive multiple requests. The control program uses scheduling strategies such as processing queues, periodic tasks, and event-triggered tasks to trigger read / write operations and timeout management on external devices hanging on the integrated circuit bus.

[0120] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

[0121] Reference Fig. 9 , shows a structural block diagram of a bus control device according to an embodiment of the present invention, which may specifically include the following steps:

[0122] A request acquisition module 201, used to acquire an access request from an application program to an integrated circuit bus;

[0123] The channel determination module 202 is used to determine the target data packet operated by the access request and the target bus channel corresponding to the target data packet according to the access request and the data packet information; wherein the data packet information includes preset corresponding relationship information between the data packet and the bus channel of the integrated circuit bus;

[0124] A task adding module 203, used for adding the processing task of the target data packet to the processing queue of the target bus channel;

[0125] The processing trigger module 204 is used to trigger the controller of the target bus channel to process the data packet in sequence according to the order in which the processing tasks enter the processing queue.

[0126] In an optional embodiment of the present invention, the data packet information includes a data packet status, and the device further includes:

[0127] A first state changing module, configured to change the data packet state of the target data packet to an active state according to the access request;

[0128] An information acquisition module, configured to acquire processing completion information of the target data packet returned by the controller of the target bus channel after the controller of the target bus channel is triggered in sequence to process the data packet in the order in which the processing tasks enter the processing queue;

[0129] The second state changing module is used to change the data packet state of the target data packet to an inactive state.

[0130] In an optional embodiment of the present invention, the device further comprises:

[0131] A request determination module, configured to determine whether the access request is a periodic task request or an event-triggered task request after obtaining the access request of the application program to the integrated circuit bus;

[0132] An idle processing trigger module is used to sort the preset priorities of the periodic tasks or event-triggered tasks for the integrated circuit bus according to the priority, and when the microcontroller where the controller of the target bus channel is located is idle, send the target data packet operated by the access request to the controller of the target bus channel, and trigger the controller of the target bus channel to process it.

[0133] In an optional embodiment of the present invention, the device further comprises:

[0134] A timeout management module is used to perform timeout management on the processing of the target data packet according to a preset period of the periodic task for the integrated circuit bus when the access request is a periodic task request.

[0135] In an optional embodiment of the present invention, the device further comprises:

[0136] An operation determination module, configured to determine, according to the access request, a target operation corresponding to the access request; wherein the target operation includes at least one of the following: a synchronous operation, an asynchronous operation, a triggering data sending operation, a triggering data receiving operation, a sending completion callback operation, a receiving completion callback operation, a triggering sending start character operation, and a triggering sending end character operation;

[0137] The processing trigger module includes:

[0138] The operation execution submodule is used to trigger the controller of the target bus channel to execute the target operation on the target data packet.

[0139] In an optional embodiment of the present invention, the device further comprises:

[0140] A synchronization operation determination module, configured to determine, according to the access request, that a target operation corresponding to the access request is a synchronization operation;

[0141] The processing trigger module includes:

[0142] A first read / write status acquisition submodule, configured to obtain a read / write status from a controller of the target bus channel through a read / write interface provided by a control program of the integrated circuit bus;

[0143] The synchronization status returning submodule is used to return the synchronization operation status to the application according to the read / write status.

[0144] In an optional embodiment of the present invention, the device further comprises:

[0145] An asynchronous operation determination module, configured to determine, according to the access request, that a target operation corresponding to the access request is an asynchronous operation;

[0146] The processing trigger module includes:

[0147] A second read / write status acquisition submodule, used to obtain the read / write status from the controller of the target bus channel through the read / write interface provided by the operating system;

[0148] The asynchronous status returning submodule is used to return the asynchronous operation status to the application according to the read / write status.

[0149] According to an embodiment of the present invention, by obtaining an access request for an integrated circuit bus from an application, a target data packet operated by the access request and a target bus channel corresponding to the target data packet are determined according to the access request and data packet information; wherein the data packet information includes preset correspondence information between the data packet and the bus channel of the integrated circuit bus, a processing task for the target data packet is added to a processing queue of the target bus channel, and the controller of the target bus channel is triggered in sequence to process the data packet in the order in which the processing tasks enter the processing queue, so that the application can use a unified control program to implement access to the integrated circuit bus, and support for requests for multiple bus channels is implemented. When multiple applications access the same bus channel at the same time, the control program can use the processing queues of each bus channel to trigger processing in sequence to avoid preemption of the same bus channel, thereby avoiding communication errors or blockages.

[0150] The embodiment of the present invention further provides a vehicle, such as Fig.10 As shown, it includes a processor 901, a communication interface 902, a memory 903 and an integrated circuit bus 904, wherein the processor 901, the communication interface 902, and the memory 903 communicate with each other through the integrated circuit bus 904.

[0151] Memory 903, used for storing computer programs;

[0152] The processor 901 is used to implement the steps described in any of the above method embodiments when executing the program stored in the memory 903.

[0153] The integrated circuit bus mentioned in the above terminal can be a peripheral component interconnect standard (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The integrated circuit bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0154] The communication interface is used for communication between the above terminal and other devices.

[0155] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0156] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0157] In another embodiment of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium stores instructions. When the instructions are executed on a computer, the computer executes the bus control method described in any one of the above embodiments.

[0158] In another embodiment of the present invention, a computer program product including instructions is provided. When the computer program product is run on a computer, the computer executes the bus control method described in any one of the above embodiments.

[0159] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.

[0160] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0161] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0162] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims

1. A bus control method, characterized in that: include: Obtaining an access request from an application program to an integrated circuit bus; Determine, according to the access request and the data packet information, a target data packet operated by the access request and a target bus channel corresponding to the target data packet; wherein the data packet information includes preset corresponding relationship information between the data packet and the bus channel of the integrated circuit bus, and a data packet status; According to the access request, changing the data packet state of the target data packet to an active state; Adding the processing task of the target data packet to the processing queue of the target bus channel; According to the order in which the processing tasks enter the processing queue, the controllers of the target bus channels are triggered in sequence to process the data packets; Acquire processing completion information of the target data packet returned by the controller of the target bus channel; Change the packet state of the target packet to inactive.

2. The method according to claim 1, characterized in that After obtaining the access request of the application program to the integrated circuit bus, the method further includes: Determining whether the access request is a periodic task request or an event-triggered task request; According to the preset priority of the periodic tasks or event-triggered tasks for the integrated circuit bus, the target data packet operated by the access request is sent to the controller of the target bus channel when the microcontroller where the controller of the target bus channel is located is idle, and the controller of the target bus channel is triggered to process it.

3. The method according to claim 2, characterized in that The method further comprises: In the case where the access request is a periodic task request, timeout management is performed on the processing of the target data packet according to a preset period of the periodic task for the integrated circuit bus.

4. The method according to claim 1, characterized in that: The method further comprises: Determine, according to the access request, a target operation corresponding to the access request; wherein the target operation includes at least one of the following: a synchronous operation, an asynchronous operation, a triggering data sending operation, a triggering data receiving operation, a sending completion callback operation, a receiving completion callback operation, a triggering sending start character operation, and a triggering sending end character operation; The controller triggering the target bus channel to process the data packet comprises: The controller of the target bus channel is triggered to perform the target operation on the target data packet.

5. The method according to claim 1, characterized in that The method further comprises: According to the access request, determining that a target operation corresponding to the access request is a synchronization operation; The controller triggering the target bus channel to process the data packet comprises: Obtaining a read / write status from a controller of the target bus channel through a read / write interface provided by a control program of the integrated circuit bus; Based on the read / write status, the synchronization operation status is returned to the application.

6. The method according to claim 1, characterized in that The method further comprises: According to the access request, determining that a target operation corresponding to the access request is an asynchronous operation; The controller triggering the target bus channel to process the data packet comprises: Obtaining a read / write status from a controller of the target bus channel through a read / write interface provided by the operating system; According to the read / write status, the asynchronous operation status is returned to the application.

7. A bus control device, characterized in that: include: A request acquisition module, used to acquire an access request from an application program to an integrated circuit bus; a channel determination module, configured to determine, according to the access request and the data packet information, a target data packet operated by the access request and a target bus channel corresponding to the target data packet; wherein the data packet information includes information on a preset correspondence relationship between the data packet and the bus channel of the integrated circuit bus, and a data packet status; A first state changing module, configured to change the data packet state of the target data packet to an active state according to the access request; A task adding module, used for adding the processing task of the target data packet to the processing queue of the target bus channel; A processing trigger module, used to trigger the controller of the target bus channel to process the data packet in sequence according to the order in which the processing tasks enter the processing queue; An information acquisition module, configured to acquire processing completion information of the target data packet returned by the controller of the target bus channel after the controller of the target bus channel is triggered in sequence to process the data packet in the order in which the processing tasks enter the processing queue; The second state changing module is used to change the data packet state of the target data packet to an inactive state.

8. The device according to claim 7, characterized in that The device also includes: A request determination module, configured to determine whether the access request is a periodic task request or an event-triggered task request after obtaining the access request of the application program to the integrated circuit bus; An idle processing trigger module is used to sort the preset priorities of the periodic tasks or event-triggered tasks for the integrated circuit bus according to the priority, and when the microcontroller where the controller of the target bus channel is located is idle, send the target data packet operated by the access request to the controller of the target bus channel, and trigger the controller of the target bus channel to process it.

9. The device according to claim 8, characterized in that The device also includes: A timeout management module is used to perform timeout management on the processing of the target data packet according to a preset period of the periodic task for the integrated circuit bus when the access request is a periodic task request.

10. The device according to claim 7, characterized in that The device also includes: An operation determination module, configured to determine, according to the access request, a target operation corresponding to the access request; wherein the target operation includes at least one of the following: a synchronous operation, an asynchronous operation, a triggering data sending operation, a triggering data receiving operation, a sending completion callback operation, a receiving completion callback operation, a triggering sending start character operation, and a triggering sending end character operation; The processing trigger module includes: The operation execution submodule is used to trigger the controller of the target bus channel to execute the target operation on the target data packet.

11. The device according to claim 7, characterized in that The device also includes: A synchronization operation determination module, configured to determine, according to the access request, that a target operation corresponding to the access request is a synchronization operation; The processing trigger module includes: A first read / write status acquisition submodule, configured to obtain a read / write status from a controller of the target bus channel through a read / write interface provided by a control program of the integrated circuit bus; The synchronization status returning submodule is used to return the synchronization operation status to the application according to the read / write status.

12. The device according to claim 7, characterized in that The device also includes: An asynchronous operation determination module, configured to determine, according to the access request, that a target operation corresponding to the access request is an asynchronous operation; The processing trigger module includes: A second read / write status acquisition submodule, used to obtain the read / write status from the controller of the target bus channel through the read / write interface provided by the operating system; The asynchronous status returning submodule is used to return the asynchronous operation status to the application program according to the read / write status.

13. A vehicle, characterized in that: It includes a processor, a communication interface, a memory and an integrated circuit bus, wherein the processor, the communication interface and the memory communicate with each other through the integrated circuit bus; Memory, used to store computer programs; A processor, for implementing the method steps described in any one of claims 1 to 6 when executing a program stored in a memory.

14. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.