A printing method of document under ReWorks real-time operating system

By dynamically adjusting the priority of file conversion tasks in the ReWorks real-time operating system and using the Qt support library to convert documents to PostScript format, the problem of difficulty in directly printing documents under the ReWorks real-time operating system is solved, and document printing on embedded devices is realized.

CN122240047APending Publication Date: 2026-06-19联想长风科技(北京)有限公司

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
联想长风科技(北京)有限公司
Filing Date
2026-03-18
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

Document printing is difficult to perform directly under the ReWorks real-time operating system, and existing printer drivers cannot communicate with embedded devices.

Method used

In the ReWorks real-time operating system, the initial execution priority of the file conversion task is set to be the same as the priority of the system idle task. A scheduling event callback function is attached to dynamically update the priority. The document is converted to PostScript format using the Qt support library and sent to a printer that supports the PostScript language through a pre-configured communication interface.

Benefits of technology

It implements document printing functionality under the ReWorks real-time operating system, solving the problem of difficulty in directly printing documents in existing technologies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122240047A_ABST
    Figure CN122240047A_ABST
Patent Text Reader

Abstract

This invention discloses a method for printing documents under the ReWorks real-time operating system, relating to the field of document printing technology. The method includes: creating a file conversion task for the document to be printed, setting the initial execution priority of the file conversion task; attaching a scheduling event callback function, executing a dynamic priority scheduling strategy to update the execution priority of the file conversion task, and outputting the updated execution priority; calling the Qt support library to convert the document to be printed into a PostScript format file; sending the PostScript format file to the printer through a pre-configured first communication interface; and the printer receiving and parsing the file through a second communication interface and executing document printing. This invention solves the technical problem of difficulty in directly printing documents under the ReWorks real-time operating system in existing technologies, achieving the technical effect of document printing under the ReWorks real-time operating system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of document printing technology, and more specifically to a method for printing documents under the ReWorks real-time operating system. Background Technology

[0002] As embedded applications become increasingly complex, the need for document printing is gradually emerging in embedded real-time operating systems. However, most printer manufacturers' drivers typically only support general-purpose operating systems such as Windows or Linux, making them difficult to directly adapt and use in embedded real-time operating system environments like ReWorks. This results in the system being unable to directly communicate with the printer and complete document printing, affecting the implementation of printing functionality in embedded devices during practical applications. Summary of the Invention

[0003] This application provides a method for printing documents under the ReWorks real-time operating system, which addresses the technical problem that it is difficult to directly print documents under the ReWorks real-time operating system in the prior art.

[0004] In view of the above problems, this application provides a method for printing documents under the ReWorks real-time operating system.

[0005] This application provides a method for printing documents under the ReWorks real-time operating system, the method comprising: After creating a file conversion task for the document to be printed in the ReWorks real-time operating system, an initial execution priority is set for the file conversion task, which is the same as the priority of the system's idle task. A scheduling event callback function of the ReWorks real-time operating system is then attached to update the execution priority of the file conversion task using a dynamic priority scheduling strategy, and the updated execution priority is output. Based on the updated execution priority, the Qt support library is invoked to convert the document to be printed into a PostScript format file. The PostScript format file is then sent to the printer via a first communication interface pre-configured by the ReWorks real-time operating system, wherein the printer supports the PostScript language. The printer receives and parses the PostScript format file via a second communication interface and executes document printing.

[0006] One or more technical solutions provided in this application have at least the following technical effects or advantages: This application, after creating a file conversion task for a document to be printed in the ReWorks real-time operating system, sets the initial execution priority of the file conversion task, wherein the initial execution priority is the same as the system idle task priority; it hooks the scheduling event callback function of the ReWorks real-time operating system to execute a dynamic priority scheduling strategy to update the execution priority of the file conversion task, and outputs the updated execution priority; based on the updated execution priority, it calls the Qt support library to convert the document to be printed into a PostScript format file; it sends the PostScript format file to the printer through a first communication interface pre-configured by the ReWorks real-time operating system, wherein the printer supports the PostScript language; the printer receives and parses the PostScript format file through a second communication interface and executes document printing. This invention solves the technical problem of difficulty in directly printing documents under the ReWorks real-time operating system in the prior art. By dynamically adjusting the priority of the file conversion task and using the Qt support library to convert the document into PostScript format before sending it to a printer that supports the PostScript language, it achieves the technical effect of document printing under the ReWorks real-time operating system. Attached Figure Description

[0007] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0008] Figure 1 A schematic flowchart illustrating a document printing method under the ReWorks real-time operating system, provided as an embodiment of this application; Figure 2 This is a flowchart illustrating the process of converting a document to be printed into a PostScript format file in a document printing method under the ReWorks real-time operating system provided in this application embodiment. Detailed Implementation

[0009] This application provides a method for printing documents under the ReWorks real-time operating system. It addresses the technical problem that it is difficult to directly print documents under the ReWorks real-time operating system in the prior art. By dynamically adjusting the priority of file conversion tasks and using the Qt support library to convert the document into PostScript format and then sending it to a printer that supports the PostScript language, the technical effect of printing documents under the ReWorks real-time operating system is achieved.

[0010] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.

[0011] It should be noted that any variation of the terms "comprising" and "having" is intended to cover non-exclusive inclusion, for example, a process, method, system, product, or server that includes a series of steps or units is not necessarily limited to those steps or units that are explicitly listed, but may include other steps or modules that are not explicitly listed or that are inherent to such processes, methods, products, or devices.

[0012] Examples, such as Figure 1 As shown, this application provides a method for printing documents under the ReWorks real-time operating system, the method comprising: Step S100: After creating a file conversion task for the document to be printed in the ReWorks real-time operating system, set the initial execution priority of the file conversion task, wherein the initial execution priority is the same as the priority of the system idle task.

[0013] In this embodiment, within the ReWorks real-time operating system, when a document printing requirement arises, a file conversion task is first created for the document to be printed. This task performs format conversion processing on the document to generate a data file that can be used for printing. The file conversion task is created and added to the task scheduling queue under the task management mechanism of the ReWorks real-time operating system. The ReWorks real-time operating system is a real-time operating system for embedded devices, used for creating, scheduling, and managing system tasks and resources.

[0014] After the file conversion task is created, configure the scheduling parameters for the task, including setting the task's execution priority. Execution priority is a scheduling parameter in the ReWorks real-time operating system's scheduling mechanism, used to determine the execution order of multiple tasks during the scheduling process.

[0015] During the task initialization phase, the initial execution priority of the file conversion task is set to be the same as that of the system idle task. The system idle task priority is the priority level corresponding to the idle task in the ReWorks real-time operating system. By setting the initial execution priority of the file conversion task to be the same as that of the system idle task, the file conversion task is placed in the lowest priority state during task scheduling, thus preventing it from occupying processor resources preferentially when other tasks are present.

[0016] Step S200: Attach the scheduling event callback function of the ReWorks real-time operating system to execute the dynamic priority scheduling strategy to update the execution priority of the file conversion task, and output the updated execution priority.

[0017] In this embodiment, a scheduling event callback function is attached to the ReWorks real-time operating system via a hook interface. The hook interface is a system extension interface provided by the ReWorks real-time operating system, used to invoke pre-registered processing rules when a system scheduling event occurs. The scheduling event callback function is a set of processing rules triggered by the system scheduling mechanism when a task scheduling event occurs, used to adjust task scheduling parameters according to the current system task running status.

[0018] After hooking the scheduling event callback function via the hook interface, when a task scheduling-related event occurs in the ReWorks real-time operating system, the system scheduling mechanism executes the scheduling event callback function according to pre-defined rules and updates the execution priority of the file conversion task based on the dynamic priority scheduling strategy. The dynamic priority scheduling strategy is a rule that dynamically adjusts task priorities based on the current task execution status in the ReWorks real-time operating system. This strategy determines the priority adjustment method by detecting the task priority distribution in the system. When no real-time task with a higher execution priority than the initial execution priority is detected in the ReWorks real-time operating system, the execution priority of the file conversion task is raised to a first set priority; when a real-time task with a higher execution priority is detected, the execution priority of the file conversion task is adjusted to a second set priority lower than the initial execution priority. The updated execution priority is obtained through the above scheduling strategy execution process and used as the basis for scheduling the file conversion task in subsequent task scheduling processes, thereby achieving dynamic updating of the file conversion task's execution priority.

[0019] Furthermore, in the method provided in the application embodiment, the scheduling event callback function is attached according to the hook interface provided by the ReWorks real-time operating system, wherein the strategy of the scheduling event callback function includes: When it is detected that there is no real-time task in the ReWorks real-time operating system with a higher execution priority than the initial execution priority, the initial execution priority is raised to a first set priority; when it is detected that there is a real-time task in the ReWorks real-time operating system with a higher execution priority than the initial execution priority, the execution priority of the file conversion task is lowered to a second set priority lower than the initial execution priority.

[0020] In this embodiment, when executing the scheduling event callback function, the system task scheduling queue is checked by reading the task priority information in the ReWorks real-time operating system task control structure. Specifically, the priority of tasks currently in the running or ready state is obtained and compared with the initial execution priority of the file conversion task to determine whether there are any real-time tasks with higher initial execution priorities. Here, a real-time task is a task in the ReWorks real-time operating system that has a defined response time requirement and participates in system scheduling according to its priority; the task priority is used to indicate the execution order of tasks during the scheduling process.

[0021] When the detection results indicate that there are no real-time tasks with a higher execution priority than the initial execution priority in the ReWorks real-time operating system, the execution priority of the file conversion task is increased by calling the task priority adjustment interface provided by the ReWorks real-time operating system, adjusting the initial execution priority to the first preset priority. The first preset priority is a pre-set priority level higher than the initial execution priority, used to improve the execution order of the file conversion task in task scheduling. This ensures that the file conversion task receives priority scheduling opportunities when system processor resources are available, allowing it to perform the format conversion processing of the document to be printed.

[0022] When detection results indicate the presence of real-time tasks with higher execution priorities in the ReWorks real-time operating system, the execution priority of the file conversion task is lowered by invoking the task priority adjustment interface. This lowers the file conversion task's execution priority to a second, pre-defined priority, which is lower than the initial priority. By reducing the file conversion task's priority in the system scheduling queue, the ReWorks real-time operating system prioritizes the execution of real-time tasks, thereby minimizing the impact of the file conversion task on the execution of real-time tasks and maintaining the real-time responsiveness of the system scheduling process.

[0023] Step S300: Based on the update execution priority, call the Qt support library to convert the document to be printed into a PostScript format file.

[0024] In this embodiment, the execution priority is used as the basis for task scheduling. When the Qt support library is invoked to perform format conversion on the document to be printed, the PrintSupport module in the Qt support library is called to construct a print object based on the document to be printed, and to set print parameters and print output format for the print object. The print parameters include paper parameters and DPI parameters. With the print output format set to PostScript, the print object performs format conversion on the document to be printed, thereby generating a PostScript format file. The PostScript format file is a page description language file.

[0025] Furthermore, the method provided in the application embodiments also includes: The Qt support library was pre-ported into the ReWorks real-time operating system.

[0026] In this embodiment, the Qt support library is ported to the ReWorks real-time operating system. The Qt support library is a collection of runtime libraries provided by the Qt framework, including modules related to graphics processing, file processing, and printing. During the porting process, the Qt source code is obtained and, combined with the processor architecture of the ReWorks real-time operating system, is compiled using a cross-compilation toolchain to generate Qt library files suitable for the ReWorks real-time operating system environment. After compilation, the Qt library files are deployed to the ReWorks real-time operating system's file system or application runtime directory. The linking relationships and runtime loading paths of the Qt library files are configured during application building, enabling the application to recognize and call the Qt support library.

[0027] After the Qt support library was ported, the ReWorks real-time operating system loaded and called the functional modules provided by Qt, including the PrintSupport module for printing. The PrintSupport module, within the Qt support library, is responsible for implementing printing functionality, providing interfaces for constructing print objects, configuring print parameters, and setting print output formats. When the application performs document printing processing, it calls the printing interface in the PrintSupport module to construct a print object and sets parameters such as paper size, DPI, and print output format, thereby converting the document to be printed into a PostScript format file. By pre-porting the Qt support library into the ReWorks real-time operating system, the system has the runtime environment to perform document format conversion processing.

[0028] Furthermore, such as Figure 2As shown, the method provided in the application embodiment, using the update execution priority as the task scheduling basis, calls the Qt support library to convert the document to be printed into a PostScript format file, and further includes: The PrintSupport module in the Qt support library is invoked to construct a print object based on the document to be printed; the print parameters of the print object are set, and the print output format is configured to PostScript format, wherein the print parameters include paper size and DPI parameters; under the PostScript format, the print object is executed to perform format conversion processing on the document to be printed, and the PostScript format file is output.

[0029] In this embodiment, the PrintSupport module in the Qt support library is first invoked to construct a print object based on the document to be printed. The PrintSupport module is a functional module in the Qt support library used for print processing, and the print object is an object instance used to carry print tasks and print configurations. Specifically, the document content and page information of the document to be printed are read, and the print interface corresponding to the PrintSupport module is called to create a print object, establishing a correspondence between the print object and the document to be printed, thereby obtaining a print object for subsequent print configuration and format conversion processing.

[0030] After constructing the print object, the print parameters are set, and the print output format is configured to PostScript. These parameters include paper size and DPI. The paper size determines the paper size and page layout, while the DPI determines the print resolution. Specifically, by calling the parameter setting interface in the PrintSupport module, the paper size and DPI parameters are written to the print object, and the print output format is set to PostScript, thus obtaining a print object capable of PostScript output.

[0031] In PostScript format, the print object performs format conversion on the document to be printed and outputs a PostScript file. PostScript is a page description language format used to describe page content and layout. Specifically, it calls the output execution interface corresponding to the print object, causing the PrintSupport module to perform page parsing, layout generation, and format writing according to the paper size, DPI parameters, and PostScript format of the document to be printed, thereby generating a PostScript file.

[0032] Step S400: Send the PostScript format file to the printer through the first communication interface pre-configured by the ReWorks real-time operating system, wherein the printer supports the PostScript language.

[0033] In this embodiment, a PostScript format file is sent to the printer via a first communication interface pre-configured in the ReWorks real-time operating system. The first communication interface is a data transmission interface within the ReWorks real-time operating system, used to establish a data communication channel between the ReWorks real-time operating system and the external device. The PostScript format file is a page description language file generated after the document to be printed has been converted using the PrintSupport module in the Qt support library. The printer is a printing device that supports PostScript language parsing and can receive and parse PostScript format print data.

[0034] During data transmission, the ReWorks real-time operating system first establishes a data transmission connection with the printer by calling the first communication interface and loads the PostScript format file into the system data buffer. Subsequently, the first communication interface encapsulates and processes the PostScript format file according to the data transmission protocol, progressively transmitting the page description data from the PostScript file to the printer. Since the printer supports the PostScript language, it can recognize the page description information in the received PostScript file, thus completing the data reception process.

[0035] Step S500: The printer receives and parses the PostScript format file through the second communication interface and executes document printing.

[0036] In this embodiment, the printer receives a PostScript format file through a second communication interface. This second communication interface is used by the printer to receive data from external devices, establishing a data reception channel between the printer and the ReWorks real-time operating system. During data reception, the printer receives data sent by the ReWorks real-time operating system through the second communication interface, and buffers and reassembles the received data stream according to the communication protocol, thereby writing the received data into the printer's internal buffer to obtain a complete PostScript format file.

[0037] After receiving the PostScript file, the printer's internal parsing program processes it. The PostScript file is a page description file written in the PostScript language. The printer's internal PostScript interpreter reads the PostScript content from the file and parses it according to the PostScript syntax rules, converting the file into print control commands that the printer can execute.

[0038] After parsing the PostScript file, the printer executes the document printing operation according to the print control instructions. Specifically, the printer control system generates corresponding print control data based on the print control instructions and transmits the print control data to the printer's imaging component. The imaging component then forms the corresponding print content on the printing medium, thereby completing the printing output of the document to be printed.

[0039] Furthermore, the method provided in the application embodiments also includes: When the second communication interface of the printer is a USB interface, the first communication interface sends the PostScript format file to the printer by calling the USB printer driver of the ReWorks real-time operation.

[0040] In this embodiment, when the printer's second communication interface is a USB interface, the PostScript format file is sent by calling the USB printer driver in the ReWorks real-time operating system. The USB interface is a Universal Serial Bus interface used to establish a data communication channel between the ReWorks real-time operating system and the printer; the USB printer driver is a device driver running in the ReWorks real-time operating system, used to implement data interaction control between the operating system and the USB printer.

[0041] During data transmission, the ReWorks real-time operating system first calls the USB printer driver to establish a USB communication connection with the printer, and obtains printer device information through the USB device identification process, thus completing the initialization of the USB printer device. Subsequently, the ReWorks real-time operating system loads the PostScript format file into the system data buffer, and uses the USB printer driver to call the USB data transfer interface to encapsulate the PostScript format file into a USB data transfer packet.

[0042] After data encapsulation is completed, the USB printer driver sends the USB data transmission data packet to the printer through the USB interface according to the USB communication protocol, thereby transmitting the PostScript format file to the printer device, enabling the printer to receive the PostScript format file and perform subsequent parsing and printing processing.

[0043] Furthermore, the method provided in the application embodiments also includes: Initialize the USB controller and USB device driver, establish the IRP data structure, and build the driver framework; populate the predefined USB device structure based on the driver framework, and configure the device class field and device subclass field in the USB device structure to identify the printer device information; in the device addition function of the ReWorks real-time operating system, register and create a character-type device node based on the device information.

[0044] In this embodiment, when implementing a USB printer driver in the ReWorks real-time operating system, the USB controller and USB device driver are first initialized, and an IRP data structure is established to construct the driver framework. The USB controller is a control module for managing USB bus communication. It initializes the USB hardware control unit by calling the USB controller initialization interface provided by the ReWorks real-time operating system, enabling the USB controller to perform device enumeration and data transfer. The USB device driver is a device driver running in the ReWorks real-time operating system. It loads and registers the driver through the system driver management mechanism, enabling the USB device driver to participate in USB device communication processing. During driver initialization, an IRP data structure is established. The IRP data structure is used for sending control commands and transmitting data. By defining an IRP data structure instance in the driver and initializing its fields, the USB device driver uses the IRP data structure to send control commands and process data transmission during USB communication. For example, the IRP data structure includes a `transferLen` field describing the data transmission length and a `bufCount` field describing the number of data buffers, thus forming the driver framework for USB communication processing.

[0045] After the driver framework is built, a predefined USB device structure is populated based on it. Device class and device subclass fields are configured within this structure to enable printer device information identification. The USB device structure is a data structure used to describe the attribute information of a USB device. By populating this structure with USB device descriptor information, the ReWorks real-time operating system can identify the type of the connected device. Specifically, by setting the device class field in the USB device structure to printer device class value 0x07 and the device subclass field to printer device subclass value 0x01, the ReWorks real-time operating system can identify the connected device as a printer device based on the device class and device subclass fields when performing USB device enumeration.

[0046] After printer device identification is completed, the device addition function in the ReWorks real-time operating system performs device registration and creates a character-type device node based on the device information. This device addition function is called by the USB controller after the USB device is connected, when the USB driver framework confirms device matching, and is used to perform system-side access processing for newly connected devices. The device addition function receives the identified device information, first establishing the association between the printer device instance and the driver framework, then calling the character device registration interface to register the printer device as a character-type device, and creating the corresponding character-type device node in the ReWorks real-time operating system. The character-type device node serves as the interface entry point for the application layer to access the printer device, enabling applications to call the USB printer driver's read and write functions through this character-type device node, thereby achieving the sending and receiving of print data.

[0047] Furthermore, the method provided in the application embodiments also includes: When the second communication interface of the printer is a network interface, the first communication interface sends the PostScript format file to the network address of the printer through Socket programming.

[0048] In this embodiment, when the printer's second communication interface is a network interface, the first communication interface sends a PostScript format file to the printer's network address via Socket programming. The network interface is the type of interface the printer uses to connect to a network communication environment, such as an Ethernet interface or a wireless network interface, used to establish a network communication connection between the printer and the ReWorks real-time operating system. Socket programming is a programming method used in network communication to implement application-layer data transmission, establishing a network data transmission channel by creating a Socket communication endpoint. The network address identifies the printer's communication location on the network, such as the printer's IP address and corresponding port number.

[0049] During data transmission, the ReWorks real-time operating system establishes a network communication connection through the first communication interface and creates a Socket communication endpoint through the Socket interface, enabling the Socket communication endpoint to establish a network connection with the printer's network address. The Socket interface is a network communication programming interface. After the connection is established, the PostScript format file is loaded into the data buffer, and the PostScript format file is processed for data transmission according to the network transmission protocol through the Socket communication interface, allowing the data in the PostScript format file to be transmitted to the printer device through the network communication channel.

[0050] After completing the data transmission, the printer receives the PostScript format file through its network interface and parses and processes the PostScript format file according to the PostScript language parsing capability supported by the printer, thereby performing the document printing operation.

[0051] Furthermore, the method provided in the application embodiments also includes: Register the printer as a USB client device to the USB controller.

[0052] In this embodiment, the printer is registered as a USB client device to the USB controller. The USB client device is a peripheral device instance managed by the host-side USB controller within the USB communication architecture, representing a specific USB device connected to the USB bus. The USB controller is a control unit in the ReWorks real-time operating system used to manage USB bus device connections, device enumeration, and data communication. After the USB printer is connected, the USB controller first executes the USB device enumeration process, obtaining the printer's device attributes by reading the USB device description information, and generating a corresponding device instance in the system device management structure.

[0053] After device identification is complete, a corresponding USB client device instance is created based on the device description information obtained during the USB device enumeration phase, and this instance is associated with the USB printer driver. Subsequently, through the device registration interface provided by the USB controller, the USB client device instance is added to the device management list maintained by the USB controller, enabling the controller to recognize the device as a USB peripheral managed by the current system. After registration, during USB data communication, the USB controller, based on the association between the USB client device instance and the USB printer driver, delegates data transmission requests from the USB bus to the USB printer driver for processing, thus enabling data communication between the ReWorks real-time operating system and the printer.

[0054] In summary, the embodiments of this application have at least the following technical effects: This application, after creating a file conversion task for a document to be printed in the ReWorks real-time operating system, sets the initial execution priority of the file conversion task, wherein the initial execution priority is the same as the system idle task priority; it hooks the scheduling event callback function of the ReWorks real-time operating system to execute a dynamic priority scheduling strategy to update the execution priority of the file conversion task, and outputs the updated execution priority; based on the updated execution priority, it calls the Qt support library to convert the document to be printed into a PostScript format file; it sends the PostScript format file to the printer through a first communication interface pre-configured by the ReWorks real-time operating system, wherein the printer supports the PostScript language; the printer receives and parses the PostScript format file through a second communication interface and executes document printing. This invention solves the technical problem of difficulty in directly printing documents under the ReWorks real-time operating system in the prior art. By dynamically adjusting the priority of the file conversion task and using the Qt support library to convert the document into PostScript format before sending it to a printer that supports the PostScript language, it achieves the technical effect of document printing under the ReWorks real-time operating system.

[0055] It should be noted that the order of the embodiments described above is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. Furthermore, the above description focuses on specific embodiments of this specification. The processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired results. In some implementations, multitasking and parallel processing are possible or may be advantageous.

[0056] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the present invention. Any modifications, equivalent changes, and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the scope of the present invention.

Claims

1. A method for printing documents under the ReWorks real-time operating system, characterized in that, The method includes: After creating a file conversion task for a document to be printed in the ReWorks real-time operating system, the initial execution priority of the file conversion task is set, wherein the initial execution priority is the same as the priority of the system idle task; The scheduling event callback function of the ReWorks real-time operating system is attached to execute a dynamic priority scheduling strategy to update the execution priority of the file conversion task and output the updated execution priority. Based on the update execution priority, the Qt support library is called to convert the document to be printed into a PostScript format file. The PostScript format file is sent to the printer through the first communication interface pre-configured in the ReWorks real-time operating system, wherein the printer supports the PostScript language; The printer receives and parses the PostScript format file through the second communication interface and executes document printing.

2. The document printing method under the ReWorks real-time operating system as described in claim 1, characterized in that, Based on the hook interface provided by the ReWorks real-time operating system, the scheduling event callback function is attached, wherein the strategy of the scheduling event callback function includes: When it is detected that there is no real-time task with a higher execution priority than the initial execution priority in the ReWorks real-time operating system, the initial execution priority is raised to the first set priority; When a real-time task with a higher execution priority than the initial execution priority is detected in the ReWorks real-time operating system, the execution priority of the file conversion task is reduced to a second set priority that is lower than the initial execution priority.

3. The document printing method under the ReWorks real-time operating system as described in claim 2, characterized in that, When the second communication interface of the printer is a USB interface, the first communication interface sends the PostScript format file to the printer by calling the USB printer driver of the ReWorks real-time operation.

4. A method for printing documents under the ReWorks real-time operating system as described in claim 3, characterized in that, Also includes: Initialize the USB controller and USB device drivers, establish the IRP data structure, and build the driver framework; The predefined USB device structure is populated based on the driver framework, and the printer device information is identified by configuring the device class field and device subclass field in the USB device structure. In the device addition function of the ReWorks real-time operating system, a character-type device node is registered and created based on the device information.

5. A method for printing documents under the ReWorks real-time operating system as described in claim 1, characterized in that, When the second communication interface of the printer is a network interface, the first communication interface sends the PostScript format file to the network address of the printer through Socket programming.

6. A method for printing documents under the ReWorks real-time operating system as described in claim 1, characterized in that, The Qt support library was pre-ported into the ReWorks real-time operating system.

7. A method for printing documents under the ReWorks real-time operating system as described in claim 6, characterized in that, Based on the update execution priority, the task scheduling is categorized by calling the Qt support library to convert the document to be printed into a PostScript format file, including: The PrintSupport module in the Qt support library is invoked to construct a print object based on the document to be printed; Set the printing parameters of the printing object and configure the print output format to PostScript format, wherein the printing parameters include the paper size and DPI parameters; In the PostScript format, the print object performs format conversion processing on the document to be printed, and outputs the PostScript format file.

8. A method for printing documents under the ReWorks real-time operating system as described in claim 4, characterized in that, Register the printer as a USB client device to the USB controller.