CN110737480A - Multiplexing method and device for serial port drivers - Google Patents
Multiplexing method and device for serial port drivers Download PDFInfo
- Publication number
- CN110737480A CN110737480A CN201910879831.3A CN201910879831A CN110737480A CN 110737480 A CN110737480 A CN 110737480A CN 201910879831 A CN201910879831 A CN 201910879831A CN 110737480 A CN110737480 A CN 110737480A
- Authority
- CN
- China
- Prior art keywords
- serial port
- serial
- interface function
- unit
- starting
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/4401—Bootstrapping
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Transfer Systems (AREA)
Abstract
The invention provides a serial driver multiplexing method and a device, wherein the method comprises the following steps of operating a th starting code in a th starting unit to obtain preset configuration parameters to initialize a default serial port, operating a second starting code in a second starting unit to judge whether a current required serial port and the default serial port are , if not , re-initializing the current required serial port, and calling an interface function of a th starting unit to perform corresponding operation.
Description
Technical Field
The invention relates to the field of SOC chip circuits, in particular to a multiplexing method and a multiplexing device for serial port drivers.
Background
In the framework of armv8 and the like, the bootloader is also divided into vendor loader initialization, ARMtrust firmware initialization, trust OS initialization, U-BOOT and the like, and each stages are independent subsystems which respectively need to initialize serial port drivers and hardware and output printing information so that developers can know the current starting condition.
Meanwhile, an embedded SOC usually has a plurality of serial ports, and the IO of each serial port may be multiplexed with the IO of other functions so as to flexibly use different function combinations in different types of products, which results in that serial ports which can be used for debugging in different projects are different from the SOC, each subsystem in the starting process needs to adapt the serial port driver again to output the printing information to the correct serial port, the subsystems are generally maintained by different teams, and partial subsystems may not provide source codes for the downstream links of research and development possibly due to safety or confidentiality reasons, so that the maintenance challenge is brought to the serial port printing driver which can be normally used by adapting different development boards.
Disclosure of Invention
Therefore, serial drivers need to be reused, so as to solve the problems of repeated initialization and difficult maintenance of of the serial drivers in the prior art.
In order to achieve the above object, the inventor provides serial drivers multiplexing methods, including the following steps:
running a th starting code in an th starting unit to acquire preset configuration parameters to initialize the default serial port;
running a second starting code in a second starting unit, judging whether the current required serial port and the default serial port are or not, and if not , initializing the current required serial port again;
calling interface function of start unit to do corresponding operation.
, the preset configuration parameters include the base address of the print debug serial port and the baud rate required by the input and output of the serial port driver.
, the interface function of the th starting unit comprises an input interface function or an output interface function, and the "calling the interface function of the th starting unit to perform corresponding operation" comprises:
and acquiring a calling instruction of the subsystem, calling th starting unit input interface function or output interface function, and carrying out printing operation on the output function of the docking subsystem.
, the current serial port is determined according to the current circuit board to which the chip is connected, the chip is the th starting unit.
, the th starting unit is BOOT ROM, and the second starting unit is BOOT loader.
The inventor also provides serial port driver multiplexing devices, which comprise a th starting unit, a parameter storage unit and a plurality of serial ports, wherein the th starting unit stores a th starting code, the parameter storage unit stores preset configuration parameters, and serial ports are default serial ports;
the th boot code when executed implements the steps of:
acquiring preset configuration parameters in a parameter storage unit to initialize a default serial port;
when a second starting code in a second starting unit is operated, judging whether the current required serial port and the default serial port are , and if not , initializing the current required serial port again;
and calling the interface function to perform corresponding operation.
, the preset configuration parameters include the base address of the print debug serial port and the baud rate required by the input and output of the serial port driver.
, the interface function of the th starting unit comprises an input interface function or an output interface function, and the "calling the interface function of the th starting unit to perform corresponding operation" comprises:
and acquiring a calling instruction of the subsystem, calling th starting unit input interface function or output interface function, and carrying out printing operation on the output function of the docking subsystem.
, the current serial port is determined according to the current circuit board to which the chip is connected, the chip is the th starting unit.
, the th starting unit is BOOT ROM, and the second starting unit is BOOT loader.
The serial port driver multiplexing method and the device in the technical scheme comprise the following steps of operating a starting code in a starting unit to obtain preset configuration parameters to initialize a default serial port, operating a second starting code in a second starting unit to judge whether a current required serial port and the default serial port are , if not , initializing the current required serial port again, and calling an interface function of a starting unit to perform corresponding operation.
Drawings
Fig. 1 is a flowchart of a serial driver multiplexing method according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a serial driver multiplexing apparatus according to an embodiment of the present invention;
FIG. 3 is a diagram illustrating a serial driver multiplexing device according to another embodiment of the present invention;
description of reference numerals:
101. th start unit;
102. a second starting unit;
103. a serial port;
104. and a parameter storage unit.
Detailed Description
To explain technical contents, structural features, and objects and effects of the technical solutions in detail, the following detailed description is given with reference to the accompanying drawings in conjunction with the embodiments.
The serial port hardware and serial port driver used by the subsystems in all the subsequent stages are samples with the use of the BOOT ROM, the BOOT ROM program is solidified in the chip, does not occupy any system memory, and does not influence the subsequent subsystem program running in any stage in executable space such as DRAM memory or NOR, therefore, as long as the problem that the serial port printing program in the unmodified BOOT ROM is adapted to different hardware circuit boards and possibly uses different serial ports is solved, the printing program of the BOOT ROM can be used by all the subsystems in the starting process, and the problems of repeated initialization and respective configuration and maintenance of the serial port driver are solved.
To solve the above problem, please refer to fig. 1, which is a flowchart of a serial driver multiplexing method according to an embodiment of the present invention, the method includes the following steps:
firstly, the method goes to step S101 to run the th boot code in the th boot unit, and obtain the preset configuration parameters to initialize the default serial port.
In this embodiment, the th start unit is a BOOT ROM, the th start code is a start program stored in the BOOT ROM, the preset configuration parameters include a base address of a print debug serial port and a baud rate required for serial port driver input and output, the print debug serial port refers to a UART controller, i.e., a Universal Asynchronous Receiver/Transmitter (Universal Asynchronous Receiver/Transmitter), and the UART is Universal serial data buses for Asynchronous communication, the buses perform bidirectional communication, and full duplex transmission and reception can be achieved, and the default serial port refers to serial ports for system start automatic configuration.
The UART is mainly composed of the following parts: the function of each part is as follows:
(1) and an output buffer register for receiving and storing the parallel data from the CPU via the data bus.
(2) And an output shift register which receives the parallel data from the output buffer, shifts out the data bit by bit at the rate of the transmission clock, i.e., converts the parallel data into serial data output.
(3) An input shift register which shifts data appearing on the serial data input line bit by bit at a rate of a reception clock and, when the data is full, supplies the data in parallel to an input buffer register, i.e., converts the serial data into parallel data.
(4) An input buffer register which receives the parallel data from the input shift register and then is taken away by the CPU.
(5) And a control register for receiving the control word from the CPU and determining the transmission mode and data format for communication based on the content of the control word. For example, the parameters such as the asynchronous mode or the synchronous mode, the number of bits of the data character, whether parity exists, and the number of bits of the stop bit.
(6) A status register. The status register stores various status information of the interface, such as whether the output buffer is empty, whether the input character is ready, and the like. During communication, when a certain state is met, state detection logic in the interface sends a corresponding position "1" of the state register for the CPU to query.
And then, step S102 is performed to run a second boot code in the second boot unit, whether the current required serial port and the default serial port are or not is judged, and if not , the current required serial port is initialized again.
During the boot process, the system may go through different boot stages, that is, after the th boot code in the th boot unit is executed, the system may continue to execute other boot codes, for example, the boot code in the second boot unit, and specifically, the second boot code is loaded into a corresponding cache unit (e.g., DDR) for execution.
In this embodiment, the second start unit is Bootloader, the serial port required currently is determined according to a circuit board to which the current chip is docked, the chip is the chip where the th start unit is located, the universal SOC host controller may be applied to various scenes where it is not feasible to dock with different external devices, it is difficult to ensure that a certain fixed serial ports can be used as debug serial ports, and it is necessary to select a suitable serial port as a debug serial port according to an actual circuit board of the external device.
Then step S103 is entered to call the interface function of the th starting unit to perform corresponding operations.
Since the interface function is fixed in starting unit, it can be called repeatedly, and it can not occupy any storage space and program running space outside SOC.
In this embodiment, the th starting unit includes an input interface function or an output interface function, and the corresponding operation includes a printing operation or a reading input operation, "calling the th starting unit to perform the corresponding operation" includes obtaining a call instruction of a subsystem, calling the th starting unit to perform the input interface function or the output interface function, and performing the printing operation on the output function of the subsystem.
As shown in FIG. 2, the inventor also provides serial drivers multiplexing devices, which include a th boot unit 101, a parameter storage unit 104 and a plurality of serial ports 103, wherein the th boot unit 101 stores a th boot code, the parameter storage unit 104 stores preset configuration parameters, and serial ports are default serial ports 103;
the th boot code when executed implements the steps of:
acquiring preset configuration parameters in a parameter storage unit to initialize a default serial port;
when a second starting code in a second starting unit is operated, judging whether the current required serial port and the default serial port are , and if not , initializing the current required serial port again;
and calling the interface function to perform corresponding operation.
The preset configuration parameters preferably include a base address of a printing debugging serial port and a baud rate required by input and output of a serial port driver, the current required serial port is determined according to a circuit board in which a current chip is in butt joint, the chip is the th starting unit, the th starting unit is a BOOT ROM, and the second starting unit is a BOOT loader.
In some embodiments, the interface function of the startup unit includes an input interface function or an output interface function, and the "calling the interface function of the startup unit to perform corresponding operation" includes obtaining a call instruction of the subsystem, calling the input interface function or the output interface function of the startup unit, and performing a printing operation on the output function of the subsystem.
Fig. 3 is a schematic diagram of a serial driver multiplexing apparatus according to another embodiment of the present invention, where an SOC chip includes built-in BOOT ROM, a plurality of UART serial ports, and hardware including registers for parameter baud rates and serial module base addresses required for serial driver input and output.
The driver used for debugging the printing in the BOOT ROM comprises UART _ init (), putc ()/getc (), namely a driver containing a printing serial port and an output/input interface function, wherein the UART _ init () has the function of initializing the UART controller and the IO thereof, the getc () has the function of acquiring input characters from the UART controller, and the putc () has the function of outputting characters from the UART controller.
In FIG. 3, UART base reg and base reg are two registers for storing UART base value and base value, UART base refers to the base address of the UART controller for printing debugging, base refers to the baud rate of the UART, and other parameters generally use 8 data bits 1 stop bit as default configuration without additional modification.
The UART0/1/2 in FIG. 3 refers to 3 UART controllers, and the specific number is not limited, and may be less than 3 or more than 3. the Subsystem 1/2/3 in the right column of FIG. 3 refers to an independent Subsystem required in different stages of the BOOT ROM in the SoC BOOT process, and may be modules of manufacturers, such as loader, ARM-managed Firmware, Trust OS, U-BOOT, Kernel, and the like, and the number is not limited to 3.
After the system is started, a start code in the BOOTROM initializes a serial port (i.e., work executed by a uart _ init () function) according to a default configuration (default values stored in uart base and base registers), and then uses putc () and getc () interfaces according to actual conditions, i.e., according to call requests of subsystems in different phases, the print () related functions of the subsystems are docked through the putc () and getc () interfaces.
After the BOOT ROM stage is completed, the UART controller and its IO are reinitialized (no reinitialization is needed if the serial number used is equal to the chip default serial ) according to the debug serial number used by the actual circuit board (i.e., the circuit board of the electronic component connected to the SOC mentioned above) in the Subsystem 1 (some manufacturers refer to First Loader or other names), and the putc ()/getc () interface of the BOOT ROM is directly used in the subsequent program.
In the subsequent subsystem at any starting stage, the serial port does not need to be initialized any more, and when the serial port needs to be used for printing, a putc ()/getc () interface provided by the BOOT ROM can be directly called, and printing operation is carried out through a print () related function of the docking subsystem.
The invention provides a serial driver multiplexing method and a device, the method comprises the following steps of operating a th starting code in a th starting unit, acquiring preset configuration parameters to initialize a default serial port, operating a second starting code in a second starting unit, judging whether a current required serial port and the default serial port are , if not , re-initializing the current required serial port, and calling an interface function of a th starting unit to perform corresponding operation.
It should be noted that, although the above embodiments have been described herein, the invention is not limited thereto. Therefore, based on the innovative concepts of the present invention, the technical solutions of the present invention can be directly or indirectly applied to other related technical fields by making changes and modifications to the embodiments described herein, or by using equivalent structures or equivalent processes performed in the content of the present specification and the attached drawings, which are included in the scope of the present invention.
Claims (10)
1, serial port driver multiplexing method, characterized by that, the said method includes the following steps:
running a th starting code in an th starting unit to acquire preset configuration parameters to initialize the default serial port;
running a second starting code in a second starting unit, judging whether the current required serial port and the default serial port are or not, and if not , initializing the current required serial port again;
calling interface function of start unit to do corresponding operation.
2. The method for multiplexing the serial drivers as claimed in claim 1, wherein the preset configuration parameters include a base address of a print debug serial port and a baud rate required by the input and output of the serial driver.
3. The serial port driver multiplexing method of claim 1, wherein the th starting unit's interface function includes an input interface function or an output interface function, and the "calling the th starting unit's interface function to perform corresponding operation" includes:
and acquiring a calling instruction of the subsystem, calling th starting unit input interface function or output interface function, and carrying out printing operation on the output function of the docking subsystem.
4. The method for multiplexing the serial drivers as claimed in claim 1, wherein the current serial port is determined according to the circuit board to which the current chip is connected, and the chip is the th starting unit.
5. The method for multiplexing serial drivers according to claim 1, wherein the th boot unit is BOOTROM and the second boot unit is BOOTLOADER.
6, serial port driver multiplexing devices, characterized in that the device includes starting unit, parameter memory cell and multiple serial ports, starting unit stores starting code, parameter memory cell stores preset configuration parameters, serial ports are default serial ports;
the th boot code when executed implements the steps of:
acquiring preset configuration parameters in a parameter storage unit to initialize a default serial port;
when a second starting code in a second starting unit is operated, judging whether the current required serial port and the default serial port are , and if not , initializing the current required serial port again;
and calling the interface function to perform corresponding operation.
7. The multiplexing device for the serial drivers as claimed in claim 6, wherein the preset configuration parameters include a base address of a print debug serial port and a baud rate required by the input and output of the serial driver.
8. The serial drivers multiplexing device, as claimed in claim 6, wherein the th starting unit's interface function includes an input interface function or an output interface function, and the "calling the th starting unit's interface function to perform corresponding operation" includes:
and acquiring a calling instruction of the subsystem, calling th starting unit input interface function or output interface function, and carrying out printing operation on the output function of the docking subsystem.
9. The multiplexing device for the serial drivers as claimed in claim 6, wherein the current serial port is determined according to the circuit board to which the current chip is connected, and the chip is the th starting unit.
10. The serial driver multiplexing device of claim 6, wherein the th BOOT unit is BOOT ROM and the second BOOT unit is BOOT loader.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910879831.3A CN110737480B (en) | 2019-09-18 | 2019-09-18 | Serial port driver multiplexing method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910879831.3A CN110737480B (en) | 2019-09-18 | 2019-09-18 | Serial port driver multiplexing method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110737480A true CN110737480A (en) | 2020-01-31 |
CN110737480B CN110737480B (en) | 2022-05-13 |
Family
ID=69268023
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910879831.3A Active CN110737480B (en) | 2019-09-18 | 2019-09-18 | Serial port driver multiplexing method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110737480B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2022082950A1 (en) * | 2020-10-23 | 2022-04-28 | 福州富昌维控电子科技有限公司 | Method for improving device serial communication efficiency and terminal |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070180223A1 (en) * | 2006-01-31 | 2007-08-02 | Kabushiki Kaisha Toshiba | Computer system and method of booting the system |
CN101894069A (en) * | 2010-06-10 | 2010-11-24 | 中兴通讯股份有限公司 | Debugging method and device of early serial port printing in Linux |
CN103135995A (en) * | 2011-11-22 | 2013-06-05 | 中兴通讯股份有限公司 | BootLoader backup management method and device |
CN104008008A (en) * | 2014-06-17 | 2014-08-27 | 厦门雅迅网络股份有限公司 | Method for conducting multiplexing on debugging serial port in Linux system |
CN106407156A (en) * | 2016-09-23 | 2017-02-15 | 深圳震有科技股份有限公司 | A method and a system for BOOTROM guiding multi-core CPU boot |
CN108021405A (en) * | 2016-10-28 | 2018-05-11 | 福州瑞芯微电子股份有限公司 | The driving method and device of storage medium in a kind of SOC system starting process |
CN109597651A (en) * | 2018-10-12 | 2019-04-09 | 国营芜湖机械厂 | A kind of serial ports and network interface module development approach based on MPC7410 processor |
-
2019
- 2019-09-18 CN CN201910879831.3A patent/CN110737480B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070180223A1 (en) * | 2006-01-31 | 2007-08-02 | Kabushiki Kaisha Toshiba | Computer system and method of booting the system |
CN101894069A (en) * | 2010-06-10 | 2010-11-24 | 中兴通讯股份有限公司 | Debugging method and device of early serial port printing in Linux |
CN103135995A (en) * | 2011-11-22 | 2013-06-05 | 中兴通讯股份有限公司 | BootLoader backup management method and device |
CN104008008A (en) * | 2014-06-17 | 2014-08-27 | 厦门雅迅网络股份有限公司 | Method for conducting multiplexing on debugging serial port in Linux system |
CN106407156A (en) * | 2016-09-23 | 2017-02-15 | 深圳震有科技股份有限公司 | A method and a system for BOOTROM guiding multi-core CPU boot |
CN108021405A (en) * | 2016-10-28 | 2018-05-11 | 福州瑞芯微电子股份有限公司 | The driving method and device of storage medium in a kind of SOC system starting process |
CN109597651A (en) * | 2018-10-12 | 2019-04-09 | 国营芜湖机械厂 | A kind of serial ports and network interface module development approach based on MPC7410 processor |
Non-Patent Citations (1)
Title |
---|
韩贺松: ""嵌入式驱动程序打印程序设计及应用"", 《中国优秀硕士学位论文全文数据库(工程科技I辑)》 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2022082950A1 (en) * | 2020-10-23 | 2022-04-28 | 福州富昌维控电子科技有限公司 | Method for improving device serial communication efficiency and terminal |
Also Published As
Publication number | Publication date |
---|---|
CN110737480B (en) | 2022-05-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20020133695A1 (en) | Apparatus and method for detecting a change in system hardware configuration to reduce the amount of time to execute a post routine | |
KR100764921B1 (en) | Virtual rom for device enumeration | |
EP1588260A2 (en) | Hot plug interfaces and failure handling | |
CN110727466B (en) | Multi-grain multi-core computer platform and starting method thereof | |
CN109936716B (en) | Display driving realization method and system | |
US20100122072A1 (en) | Debugging system, debugging method, debugging control method, and debugging control program | |
CN110737480A (en) | Multiplexing method and device for serial port drivers | |
US20070250740A1 (en) | System and method for conducting BIST operations | |
KR100801759B1 (en) | Device and system for debugging device using control bus | |
CN116627472A (en) | Firmware program upgrading method and server of high-speed peripheral component equipment | |
CN114691223B (en) | Method and device for transmitting BIOS logs through network | |
WO2022199622A1 (en) | Method for running startup program of electronic device, and electronic device | |
CN110321171B (en) | Startup detection device, system and method | |
CN105068835B (en) | Mobile terminal and debugging information display method thereof | |
US10866922B1 (en) | Firmware debug trace capture using serial peripheral interface | |
CN101989219B (en) | Hardware fault detection debugging code information output method, device and system | |
US7343431B1 (en) | Method, apparatus, and computer-readable medium for disabling BIOS-provided console redirection capabilities in the presence of an incompatible communications device | |
CN111176735B (en) | Method for accelerating startup of electrocardiograph | |
US20050081100A1 (en) | System and method for automatically initializing and diagnosing backplanes of electronic devices | |
KR940000453B1 (en) | Low-hevel processor loading method in electronic exchange | |
JPH11149377A (en) | Image forming device | |
JP3265284B2 (en) | emulator | |
CN116339771A (en) | Control method and computing device for hard disk firmware upgrade | |
CN118152157A (en) | Deadlock processing method, device, equipment, medium and vehicle of I2C bus | |
JPH05224999A (en) | Runaway processor |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
CB02 | Change of applicant information | ||
CB02 | Change of applicant information |
Address after: 350003 building 18, No.89, software Avenue, Gulou District, Fuzhou City, Fujian Province Applicant after: Ruixin Microelectronics Co.,Ltd. Address before: 350003 building 18, No.89, software Avenue, Gulou District, Fuzhou City, Fujian Province Applicant before: FUZHOU ROCKCHIP ELECTRONICS Co.,Ltd. |
|
GR01 | Patent grant | ||
GR01 | Patent grant |