[go: up one dir, main page]

TWI844862B - Electronic device and method of operating same - Google Patents

Electronic device and method of operating same Download PDF

Info

Publication number
TWI844862B
TWI844862B TW111120743A TW111120743A TWI844862B TW I844862 B TWI844862 B TW I844862B TW 111120743 A TW111120743 A TW 111120743A TW 111120743 A TW111120743 A TW 111120743A TW I844862 B TWI844862 B TW I844862B
Authority
TW
Taiwan
Prior art keywords
command
operating system
operation command
electronic device
application layer
Prior art date
Application number
TW111120743A
Other languages
Chinese (zh)
Other versions
TW202349198A (en
Inventor
席文帥
Original Assignee
大陸商星宸科技股份有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 大陸商星宸科技股份有限公司 filed Critical 大陸商星宸科技股份有限公司
Priority to TW111120743A priority Critical patent/TWI844862B/en
Publication of TW202349198A publication Critical patent/TW202349198A/en
Application granted granted Critical
Publication of TWI844862B publication Critical patent/TWI844862B/en

Links

Landscapes

  • Navigation (AREA)
  • Stored Programmes (AREA)

Abstract

An electronic device and an operation method thereof are provided. The operation method of the electronic device includes the following steps: running an operating system to generate an operation command; looking up a driver command corresponding to the operation command in a look-up table according to the operation command; and executing the driver command.

Description

電子裝置及其操作方法Electronic device and method of operating the same

本發明是關於電子裝置,尤其是關於電子裝置之裝置驅動程式及電子裝置的操作方法。 The present invention relates to an electronic device, and more particularly to a device driver for the electronic device and an operating method for the electronic device.

圖1顯示習知嵌入式裝置之一種作業系統架構(architecture)的示意圖。作業系統包含應用層110、圖形使用者介面庫(graphic user interface library,GUI library)120、幀緩衝框架層(Frame buffer framework)130及裝置驅動程式層140。幀緩衝框架層130是Linux系統為顯示設備提供的一個介面,幀緩衝框架層130將顯示緩衝區抽象,屏蔽圖像硬體的底層差異,允許應用層110在圖形模式下直接或間接(例如,透過呼叫圖形使用者介面庫120的函式)對顯示緩衝區進行讀寫操作。基於幀緩衝框架開發的裝置驅動程式(device driver)稱為幀緩衝裝置驅動程式。 FIG1 is a schematic diagram showing an operating system architecture of a known embedded device. The operating system includes an application layer 110, a graphic user interface library (GUI library) 120, a frame buffer framework layer 130, and a device driver layer 140. The frame buffer framework layer 130 is an interface provided by the Linux system for display devices. The frame buffer framework layer 130 abstracts the display buffer, shields the underlying differences of the image hardware, and allows the application layer 110 to read and write the display buffer directly or indirectly (for example, by calling the function of the GUI library 120) in the graphics mode. The device driver developed based on the frame buffer framework is called the frame buffer device driver.

圖2顯示習知嵌入式裝置之另一種作業系統架構的示意圖。作業系統包含應用層210、圖形使用者介面庫220及裝置驅動程式層230。應用層210直接或間接(例如,透過呼叫圖形使用者介面庫220的函式)呼叫裝置驅動程式來控制硬體。圖2之作業系統架構適用於即時作業系統(Real-time operating system,RTOS)。 FIG2 shows a schematic diagram of another operating system architecture of a known embedded device. The operating system includes an application layer 210, a graphical user interface library 220, and a device driver layer 230. The application layer 210 directly or indirectly (for example, by calling a function of the graphical user interface library 220) calls the device driver to control the hardware. The operating system architecture of FIG2 is applicable to a real-time operating system (RTOS).

雖然圖1的幀緩衝框架層130可以屏蔽圖像硬體的底層差異,但幀緩衝框架層130卻與裝置驅動程式層140高度耦合(即,裝置驅動程式層140極度依賴幀緩衝框架層130所提供的資料結構來與上層或核心(kernel)溝通),造成幀緩衝裝置驅動程式難以移植到不包含幀緩衝框架層130的平台(例如,以圖2之架構作為作業系統的平台)。類似地,因為應用層210直接呼叫裝置驅動程式層230或者圖形使用者介面庫220通常沒有提供通用的介面,所以裝置驅動程式層230與應用層210及/或圖形使用者介面庫220高度耦合,不利於裝置驅動程式層230移植到具有幀緩衝框架層的平台(例如,以圖1之架構作為作業系統的平台)。 Although the frame buffer framework layer 130 of FIG. 1 can shield the underlying differences of the image hardware, the frame buffer framework layer 130 is highly coupled with the device driver layer 140 (i.e., the device driver layer 140 is highly dependent on the data structure provided by the frame buffer framework layer 130 to communicate with the upper layer or the kernel), making it difficult to port the frame buffer device driver to a platform that does not include the frame buffer framework layer 130 (e.g., a platform using the architecture of FIG. 2 as an operating system). Similarly, because the application layer 210 directly calls the device driver layer 230 or the GUI library 220 and generally does not provide a universal interface, the device driver layer 230 is highly coupled with the application layer 210 and/or the GUI library 220, which is not conducive to porting the device driver layer 230 to a platform with a frame buffer framework layer (for example, a platform with the architecture of FIG. 1 as the operating system).

上述的問題不只發生在幀緩衝裝置驅動程式,亦發生在其他類型的裝置驅動程式。 The above problem occurs not only in frame buffer device drivers, but also in other types of device drivers.

鑑於先前技術之不足,本發明之一目的在於提供一種電子裝置及其操作方法,以改善先前技術的不足。 In view of the deficiencies of the prior art, one purpose of the present invention is to provide an electronic device and an operating method thereof to improve the deficiencies of the prior art.

本發明之一實施例提供一種電子裝置,包含:一記憶體介面及一處理器。記憶體介面用來存取一記憶體,該記憶體儲存一作業系統之複數個程式指令或程式碼。處理器用來執行該些程式指令或程式碼以執行以下步驟:執行該作業系統以產生一操作命令;根據該操作命令,從一查找表中查詢對應該操作命令的一驅動程式命令;以及,執行該驅動程式命令。 One embodiment of the present invention provides an electronic device, comprising: a memory interface and a processor. The memory interface is used to access a memory, and the memory stores a plurality of program instructions or program codes of an operating system. The processor is used to execute the program instructions or program codes to perform the following steps: execute the operating system to generate an operation command; according to the operation command, query a driver command corresponding to the operation command from a lookup table; and execute the driver command.

本發明之另一實施例提供一種電子裝置的操作方法,包含:執行一作業系統以產生一操作命令;根據該操作命令,從一查找表中查詢對應該操作命令的一驅動程式命令;以及,執行該驅動程式命令。 Another embodiment of the present invention provides an operating method of an electronic device, comprising: executing an operating system to generate an operating command; searching a driver command corresponding to the operating command from a lookup table according to the operating command; and executing the driver command.

本發明之實施例所體現的技術手段可以改善先前技術之缺點的至少其中之一,因此本發明相較於先前技術更容易將裝置驅動程式在平台之間移植。 The technical means embodied in the embodiments of the present invention can improve at least one of the shortcomings of the previous technology. Therefore, the present invention is easier to transplant device drivers between platforms than the previous technology.

有關本發明的特徵、實作與功效,茲配合圖式作實施例詳細說明如下。 The features, implementation and effects of the present invention are described in detail below with reference to the accompanying drawings.

110,210,410:應用層 110,210,410: Application layer

120,220:圖形使用者介面庫 120,220: Graphical User Interface Library

130,420:幀緩衝框架層 130,420: frame buffer framework layer

140,230,440:裝置驅動程式層 140,230,440:Device driver layer

300:電子裝置 300: Electronic devices

310:處理器 310: Processor

320:影像處理電路 320: Image processing circuit

330:圖形引擎 330: Graphics Engine

340:疊加電路 340: Stacked circuit

350:圖像輸出電路 350: Image output circuit

360:記憶體介面 360:Memory interface

370:記憶體 370:Memory

375:儲存空間 375: Storage space

380:預設的圖像 380:Default image

IMG_out:輸出圖像 IMG_out: output image

430:作業系統轉接模組 430: Operating system adapter module

MI_FB_API_xxx:操作命令 MI_FB_API_xxx: Operation commands

MI_FB_IMPL_API_xxx:驅動程式命令 MI_FB_IMPL_API_xxx: driver command

APP_CMD:應用層命令 APP_CMD: Application layer command

ID:識別碼 ID: identification code

602,S604,S606,S610,S612,S620,S621,S622,S623,S624,S625,S626,S630,S632,S634,S636,S640,S910,S920,S922,S924,S926:步驟 602,S604,S606,S610,S612,S620,S621,S622,S623,S624,S625,S626,S630,S632,S634,S636,S640,S910,S920,S922,S924,S926: Steps

圖1顯示習知嵌入式裝置之一種作業系統架構的示意圖;圖2顯示習知嵌入式裝置之另一種作業系統架構的示意圖;圖3顯示本發明電子裝置之一實施例的功能方塊圖;圖4顯示本發明電子裝置300之一種作業系統架構的示意圖;圖5顯示本發明電子裝置300之另一種作業系統架構的示意圖;圖6顯示本發明電子裝置的操作方法之一實施例的流程圖;圖7顯示查找表之一實施例;圖8顯示圖6之步驟S620之子步驟;圖9顯示本發明之電子裝置的操作方法的另一實施例的流程圖;以及圖10顯示操作命令對應於幀緩衝框架的一種實施例。 FIG. 1 shows a schematic diagram of an operating system architecture of a known embedded device; FIG. 2 shows a schematic diagram of another operating system architecture of a known embedded device; FIG. 3 shows a functional block diagram of an embodiment of the electronic device of the present invention; FIG. 4 shows a schematic diagram of an operating system architecture of the electronic device 300 of the present invention; FIG. 5 shows a schematic diagram of another operating system architecture of the electronic device 300 of the present invention; FIG. 6 shows a flow chart of an embodiment of an operating method of the electronic device of the present invention; FIG. 7 shows an embodiment of a lookup table; FIG. 8 shows a sub-step of step S620 of FIG. 6; FIG. 9 shows a flow chart of another embodiment of the operating method of the electronic device of the present invention; and FIG. 10 shows an embodiment of an operation command corresponding to a frame buffer framework.

以下說明內容之技術用語係參照本技術領域之習慣用語,如本說明書對部分用語有加以說明或定義,該部分用語之解釋係以本說明書之說明或定義為準。 The technical terms used in the following descriptions refer to the customary terms in this technical field. If this manual explains or defines some of the terms, the interpretation of those terms shall be based on the explanation or definition in this manual.

本發明之揭露內容包含電子裝置及其操作方法。由於本發明之電子裝置所包含之部分元件單獨而言可能為已知元件,因此在不影響該裝置發明之充分揭露及可實施性的前提下,以下說明對於已知元件的細節將予以節略。此外,本發明之電子裝置的操作方法的部分或全部流程可以是軟體及/或韌體之形式,並且可藉由本發明之電子裝置或其等效裝置來執行,在不影響該方法發明之充分揭露及可實施性的前提下,以下方法發明之說明將著重於步驟內容而非硬體。 The disclosure of the present invention includes an electronic device and its operating method. Since some components included in the electronic device of the present invention may be known components individually, the details of the known components will be omitted in the following description without affecting the full disclosure and feasibility of the device invention. In addition, part or all of the process of the operating method of the electronic device of the present invention may be in the form of software and/or firmware, and can be executed by the electronic device of the present invention or its equivalent device. Without affecting the full disclosure and feasibility of the method invention, the following description of the method invention will focus on the step content rather than the hardware.

圖3顯示本發明電子裝置之一實施例的功能方塊圖。電子裝置300包含處理器310、影像處理電路320、圖形引擎330、疊加電路340、圖像輸出電路350、記憶體介面360及記憶體370。處理器310、影像處理電路320、圖形引擎330、疊加電路340及圖像輸出電路350透過記憶體介面360存取記憶體370。處理器310耦接影像處理電路320、圖形引擎330、疊加電路340及圖像輸出電路350。記憶體介面360耦接影像處理電路320、圖形引擎330、疊加電路340及圖像輸出電路350。處理器310耦接記憶體介面360及記憶體370。 FIG3 shows a functional block diagram of an embodiment of the electronic device of the present invention. The electronic device 300 includes a processor 310, an image processing circuit 320, a graphics engine 330, an overlay circuit 340, an image output circuit 350, a memory interface 360, and a memory 370. The processor 310, the image processing circuit 320, the graphics engine 330, the overlay circuit 340, and the image output circuit 350 access the memory 370 through the memory interface 360. The processor 310 is coupled to the image processing circuit 320, the graphics engine 330, the overlay circuit 340, and the image output circuit 350. The memory interface 360 is coupled to the image processing circuit 320, the graphics engine 330, the superposition circuit 340 and the image output circuit 350. The processor 310 is coupled to the memory interface 360 and the memory 370.

在一實施例中,處理器310、影像處理電路320、圖形引擎330、疊加電路340、圖像輸出電路350及記憶體介面360係整合於一第一晶片上,而記憶體370設置於一第二晶片上;此時,本發明之電子裝置是指該第一 晶片。 In one embodiment, the processor 310, the image processing circuit 320, the graphics engine 330, the superposition circuit 340, the image output circuit 350 and the memory interface 360 are integrated on a first chip, and the memory 370 is disposed on a second chip; in this case, the electronic device of the present invention refers to the first chip.

處理器310可以是具有程式執行能力的電路或電子元件,例如中央處理器、微處理器、微處理單元、數位訊號處理器、特殊應用積體電路(Application Specific Integrated Circuit,ASIC),或其等效電路。在一些實施例中,記憶體370儲存電子裝置300之作業系統的複數個程式指令或程式碼,而處理器310執行該作業系統(即,執行些程式指令或程式碼)。 The processor 310 may be a circuit or electronic component with program execution capability, such as a central processing unit, a microprocessor, a microprocessing unit, a digital signal processor, an application specific integrated circuit (ASIC), or an equivalent circuit thereof. In some embodiments, the memory 370 stores a plurality of program instructions or program codes of the operating system of the electronic device 300, and the processor 310 executes the operating system (i.e., executes the program instructions or program codes).

影像處理電路320對圖像資料進行例如濾波、亮度調整、對比度調整、色彩調整等處理。圖形引擎330可以產生預設的圖像380(例如選單)。疊加電路340用來將預設的圖像380與經影像處理電路320處理的圖像疊加(superposition),以產生疊加後的圖像。上述之經影像處理電路320處理的圖像及疊加後的圖像可以儲存在記憶體370的一個專屬的記憶體區塊中。圖像輸出電路350可以從疊加電路340或記憶體370取得疊加後的圖像(即待顯示的圖像),再將疊加後的圖像封裝或格式轉換後以輸出輸出圖像IMG_out。 The image processing circuit 320 processes the image data, such as filtering, brightness adjustment, contrast adjustment, and color adjustment. The graphics engine 330 can generate a preset image 380 (such as a menu). The superposition circuit 340 is used to superpose the preset image 380 with the image processed by the image processing circuit 320 to generate a superimposed image. The image processed by the image processing circuit 320 and the superimposed image can be stored in a dedicated memory block of the memory 370. The image output circuit 350 can obtain the superimposed image (i.e., the image to be displayed) from the superimposed circuit 340 or the memory 370, and then encapsulate or convert the superimposed image to output the output image IMG_out.

圖4顯示本發明電子裝置300之一種作業系統架構的示意圖。作業系統包含應用層410、幀緩衝框架層420、作業系統轉接模組430及裝置驅動程式層440。圖5顯示本發明電子裝置300之另一種作業系統架構的示意圖,圖5與圖4相似,但圖5的作業系統不包含幀緩衝框架層420。如圖4及圖5所示,本發明的電子裝置300利用作業系統轉接模組430作為裝置驅動程式層440與幀緩衝框架層420或應用層410之間的介面,使得裝置驅動程式層440之幀緩衝裝置驅動程式在兩種作業系統上皆可執行,而不需要大幅度的修改或甚至不需要任何修改(即,使幀緩衝裝置驅動程式的移植變容易)。 FIG4 is a schematic diagram showing an operating system architecture of the electronic device 300 of the present invention. The operating system includes an application layer 410, a frame buffer framework layer 420, an operating system adapter module 430, and a device driver layer 440. FIG5 is a schematic diagram showing another operating system architecture of the electronic device 300 of the present invention. FIG5 is similar to FIG4, but the operating system of FIG5 does not include the frame buffer framework layer 420. As shown in FIG. 4 and FIG. 5 , the electronic device 300 of the present invention uses the operating system adapter module 430 as an interface between the device driver layer 440 and the frame buffer framework layer 420 or the application layer 410, so that the frame buffer device driver of the device driver layer 440 can be executed on both operating systems without requiring major modifications or even no modifications (i.e., making the porting of the frame buffer device driver easier).

如圖4及圖5所示,作業系統轉接模組430將操作命令 MI_FB_API_xxx轉換成驅動程式命令MI_FB_IMPL_API_xxx(「xxx」代表多種命令),也就是根據操作命令MI_FB_API_xxx來產生相對應的驅動程式命令MI_FB_IMPL_API_xxx。在一實施例中,操作命令MI_FB_API_xxx是用以在記憶體370中建立顯示圖像的儲存空間375,圖形引擎330可據以將預設的圖像380(例如選單)繪製好後儲存至該儲存空間375,而疊加電路340可自該儲存空間375讀取預設的圖像380並與其它圖像進行疊加。在圖4的實施例中,操作命令MI_FB_API_xxx是由幀緩衝框架層420回應於應用層命令APP_CMD而產生。在圖5的實施例中,操作命令MI_FB_API_xxx是由應用層410產生。換言之,在圖5的實施例中,操作命令MI_FB_API_xxx亦可以視為應用層命令APP_CMD。應用層410包含應用程式及函式庫(包含但不限於圖形使用者介面庫),而應用層命令APP_CMD可以由應用程式直接產生(不呼叫函式庫),或是由應用程式間接產生(呼叫函式庫)。 As shown in FIG. 4 and FIG. 5 , the operating system adapter module 430 converts the operation command MI_FB_API_xxx into the driver command MI_FB_IMPL_API_xxx ("xxx" represents multiple commands), that is, generates the corresponding driver command MI_FB_IMPL_API_xxx according to the operation command MI_FB_API_xxx. In one embodiment, the operation command MI_FB_API_xxx is used to create a storage space 375 for displaying images in the memory 370, and the graphics engine 330 can draw a preset image 380 (such as a menu) and store it in the storage space 375, and the superposition circuit 340 can read the preset image 380 from the storage space 375 and superimpose it with other images. In the embodiment of FIG. 4 , the operation command MI_FB_API_xxx is generated by the frame buffer framework layer 420 in response to the application layer command APP_CMD. In the embodiment of FIG. 5 , the operation command MI_FB_API_xxx is generated by the application layer 410. In other words, in the embodiment of FIG. 5 , the operation command MI_FB_API_xxx can also be regarded as the application layer command APP_CMD. The application layer 410 includes an application program and a function library (including but not limited to a graphical user interface library), and the application layer command APP_CMD can be directly generated by the application program (without calling the function library) or indirectly generated by the application program (calling the function library).

在圖4的作業系統架構中,作業系統轉接模組430向幀緩衝框架層420註冊操作命令MI_FB_API_xxx(即,註冊應用程式介面(application program interface,API)),使得幀緩衝框架層420能根據正被執行或呼叫的命令來呼叫作業系統轉接模組430所提供之對應的應用程式介面。註冊的方法與習知中裝置驅動程式層140向幀緩衝框架層130註冊之方法相同。 In the operating system architecture of FIG. 4 , the operating system switching module 430 registers the operation command MI_FB_API_xxx (i.e., registers the application program interface (API)) to the frame buffer framework layer 420, so that the frame buffer framework layer 420 can call the corresponding application program interface provided by the operating system switching module 430 according to the command being executed or called. The registration method is the same as the method of registering the device driver layer 140 to the frame buffer framework layer 130 in the known method.

圖6顯示本發明電子裝置的操作方法之一實施例的流程圖,從該流程圖可以得知作業系統轉接模組430的實作細節。圖6的流程包含以下步驟,由處理器310執行。 FIG6 shows a flow chart of an embodiment of the operation method of the electronic device of the present invention, from which the implementation details of the operating system adapter module 430 can be known. The process of FIG6 includes the following steps, which are executed by the processor 310.

步驟S602:接收操作命令MI_FB_API_xxx。操作命令MI_FB_API_xxx可以是由幀緩衝框架層420產生(圖4)或是由應用層410產 生(圖5)。 Step S602: Receive the operation command MI_FB_API_xxx. The operation command MI_FB_API_xxx can be generated by the frame buffer framework layer 420 (Figure 4) or by the application layer 410 (Figure 5).

步驟S604:判斷電子裝置300目前正運行Linux系統或RTOS系統。處理器310可以根據系統參數進行步驟S604之判斷,細節為本技術領域具有通常知識者所熟知,故不再贅述。如果電子裝置300目前正運行RTOS系統(參考圖5之架構),則處理器310執行步驟S610。如果電子裝置300目前正運行Linux系統,則處理器310執行步驟S606。 Step S604: Determine whether the electronic device 300 is currently running a Linux system or an RTOS system. The processor 310 can make the determination of step S604 based on the system parameters. The details are well known to those skilled in the art and will not be described in detail. If the electronic device 300 is currently running an RTOS system (refer to the architecture of FIG. 5 ), the processor 310 executes step S610. If the electronic device 300 is currently running a Linux system, the processor 310 executes step S606.

步驟S606:判斷Linux系統目前正操作在使用者模式(user mode)或核心模式(kernel mode)。如果Linux系統目前正操作在使用者模式,則處理器310執行步驟S620。如果Linux系統目前正操作在核心模式,則處理器310執行步驟S630。 Step S606: Determine whether the Linux system is currently operating in user mode or kernel mode. If the Linux system is currently operating in user mode, the processor 310 executes step S620. If the Linux system is currently operating in kernel mode, the processor 310 executes step S630.

步驟S610、步驟S620及步驟S630分別是RTOS系統、Linux使用者模式及Linux核心模式下的驅動程式命令產生程序,將於下面詳述。處理器310於步驟S610、步驟S620或步驟S630中根據操作命令MI_FB_API_xxx產生驅動程式命令MI_FB_IMPL_API_xxx,然後處理器310於裝置驅動程式層440中執行該驅動程式命令MI_FB_IMPL_API_xxx或相對應的命令(步驟S640)。 Step S610, step S620 and step S630 are respectively the driver command generation procedures in the RTOS system, Linux user mode and Linux kernel mode, which will be described in detail below. The processor 310 generates the driver command MI_FB_IMPL_API_xxx according to the operation command MI_FB_API_xxx in step S610, step S620 or step S630, and then the processor 310 executes the driver command MI_FB_IMPL_API_xxx or the corresponding command in the device driver layer 440 (step S640).

圖6之步驟S610包含子步驟S612。在子步驟S612中,處理器310藉由查表找出對應操作命令MI_FB_API_xxx(或核心命令)或識別碼ID之驅動程式命令MI_FB_IMPL_API_xxx。請參閱圖7,圖7顯示查找表之一實施例。查找表的第一欄是操作命令MI_FB_API_xxx,第二欄是對應於操作命令MI_FB_API_xxx的識別碼ID(在一些實施例中,一個操作命令MI_FB_API_xxx具有一個唯一的識別碼ID),而第三欄是驅動程式命令 MI_FB_IMPL_API_xxx。舉例來說,處理器310可以根據操作命令MI_FB_API_open(MI_FB_API_mmap或MI_FB_API_close)或其識別碼0(1或2)找出對應的驅動程式命令MI_FB_IMPL_API_oepn(MI_FB_IMPL_API_mmap或MI_FB_IMPL_API_close)。請注意,圖7的查找表只列舉一些命令作為例子,實際的查找表可以包含更多命令。在一些實施例中,查找表儲存於記憶體370中。 Step S610 of FIG. 6 includes sub-step S612. In sub-step S612, the processor 310 finds the driver command MI_FB_IMPL_API_xxx corresponding to the operation command MI_FB_API_xxx (or core command) or the identification code ID by looking up the table. Please refer to FIG. 7, which shows an embodiment of the lookup table. The first column of the lookup table is the operation command MI_FB_API_xxx, the second column is the identification code ID corresponding to the operation command MI_FB_API_xxx (in some embodiments, an operation command MI_FB_API_xxx has a unique identification code ID), and the third column is the driver command MI_FB_IMPL_API_xxx. For example, the processor 310 can find the corresponding driver command MI_FB_IMPL_API_oepn (MI_FB_IMPL_API_mmap or MI_FB_IMPL_API_close) according to the operation command MI_FB_API_open (MI_FB_API_mmap or MI_FB_API_close) or its identification code 0 (1 or 2). Please note that the lookup table in FIG. 7 only lists some commands as examples, and the actual lookup table may include more commands. In some embodiments, the lookup table is stored in the memory 370.

圖8顯示圖6之步驟S620之子步驟,由處理器310執行。圖8的實施例可以對應到圖5之作業系統架構。步驟S621在Linux系統之使用者模式中執行,而步驟S622~S626在Linux系統之核心模式中執行。 FIG8 shows the sub-steps of step S620 of FIG6, which are executed by the processor 310. The embodiment of FIG8 can correspond to the operating system architecture of FIG5. Step S621 is executed in the user mode of the Linux system, and steps S622 to S626 are executed in the kernel mode of the Linux system.

步驟S621:在Linux使用者模式中,根據操作命令MI_FB_API_xxx找出對應的使用者命令。使用者命令即Linux使用者模式中對硬體或裝置進行操作的命令,例如開啟設備檔案(open)、輸出/入控制(ioctl)、關閉設備檔案(close)等。在一些實施例中,操作命令MI_FB_API_xxx是應用層410所產生的應用層命令APP_CMD(即,請參閱圖5的作業系統架構)。 Step S621: In Linux user mode, find the corresponding user command according to the operation command MI_FB_API_xxx. User commands are commands for operating hardware or devices in Linux user mode, such as opening device files (open), input/output control (ioctl), closing device files (close), etc. In some embodiments, the operation command MI_FB_API_xxx is an application layer command APP_CMD generated by the application layer 410 (i.e., please refer to the operating system architecture of Figure 5).

步驟S622:在Linux核心模式中,建立一個設備節點(device node)。此步驟為本技術領域具有通常知識者所熟知,故不再贅述。 Step S622: In the Linux kernel mode, a device node is established. This step is well known to those with ordinary knowledge in this technical field, so it will not be repeated here.

步驟S623:操作該設備節點,以找出對應該使用者命令之一核心命令,例如,找出與使用者模式之輸出/入控制(ioctl)(即,使用者命令)相對應的核心模式之輸出/入控制(device_ioctl)(即,核心命令)。因為對於Linux系統中的設備操作而言,使用者命令與核心命令具有一對一之對應關係,所以核心命令與操作命令MI_FB_API_xxx也具有一對一之對應關係。換 言之,可以用核心命令置換圖7之查找表的第一欄,或是在該查找表中新增一欄「核心命令」;核心命令也與識別碼ID呈現一對一的對應關係。 Step S623: Operate the device node to find a core command corresponding to the user command, for example, find the kernel mode input/output control (device_ioctl) (i.e., kernel command) corresponding to the user mode input/output control (ioctl) (i.e., user command). Because for device operations in the Linux system, user commands and kernel commands have a one-to-one correspondence, the kernel command and the operation command MI_FB_API_xxx also have a one-to-one correspondence. In other words, the first column of the lookup table in FIG. 7 can be replaced with the kernel command, or a new column "kernel command" can be added to the lookup table; the kernel command also has a one-to-one correspondence with the identification code ID.

步驟S624:判斷電子裝置300是否包含兩個作業系統。在一些實施例中,電子裝置300包含Linux系統及RTOS系統等兩個作業系統(可以由處理器310的一個核心執行,或是由處理器310的兩個核心分別執行)。如果電子裝置300包含兩個作業系統,則處理器310執行步驟S626;否則,處理器310執行步驟S625。 Step S624: Determine whether the electronic device 300 includes two operating systems. In some embodiments, the electronic device 300 includes two operating systems such as a Linux system and an RTOS system (which can be executed by one core of the processor 310 or by two cores of the processor 310). If the electronic device 300 includes two operating systems, the processor 310 executes step S626; otherwise, the processor 310 executes step S625.

步驟S625:找出對應該核心命令或一識別碼的驅動程式命令MI_FB_IMPL_API_xxx,例如,藉由查詢圖7之查找表。如上所述,因為核心命令與操作命令MI_FB_API_xxx相關,所以根據核心命令找出驅動程式命令MI_FB_IMPL_API_xxx等效於根據操作命令MI_FB_API_xxx及/或其識別碼ID找出驅動程式命令MI_FB_IMPL_API_xxx。 Step S625: Find the driver command MI_FB_IMPL_API_xxx corresponding to the core command or an identification code, for example, by querying the lookup table of Figure 7. As described above, because the core command is related to the operation command MI_FB_API_xxx, finding the driver command MI_FB_IMPL_API_xxx based on the core command is equivalent to finding the driver command MI_FB_IMPL_API_xxx based on the operation command MI_FB_API_xxx and/or its identification code ID.

步驟S626:傳送該核心命令及/或該識別碼ID至RTOS系統。如上所述,因為核心命令、識別碼ID及操作命令MI_FB_API_xxx可以互相對應,所以傳送核心命令及/或該識別碼ID等效於傳送對應的操作命令MI_FB_API_xxx。當兩個作業系統由處理器310的同一個核心執行時,可以藉由呼叫函式來執行步驟S626。在一實施例中,當兩個作業系統分別由處理器310的兩個核心或同一個核心執行時,可以藉由遠端處理訊息傳遞(Remote Processor Messaging,RPMsg)來傳送核心命令及/或該識別碼ID以執行步驟S626。遠端處理訊息傳遞為本技術領域具有通常知識者所熟知,故不再贅述。RTOS系統於接收到該核心命令及/或識別碼之後,處理器310便執行步驟S612來找出驅動程式命令MI_FB_IMPL_API_xxx。 Step S626: Send the core command and/or the identification code ID to the RTOS system. As described above, because the core command, the identification code ID and the operation command MI_FB_API_xxx can correspond to each other, sending the core command and/or the identification code ID is equivalent to sending the corresponding operation command MI_FB_API_xxx. When the two operating systems are executed by the same core of the processor 310, step S626 can be executed by calling a function. In one embodiment, when the two operating systems are respectively executed by two cores or the same core of the processor 310, the core command and/or the identification code ID can be sent by remote processor messaging (RPMsg) to execute step S626. Remote processing message transmission is well known to those with ordinary knowledge in this technical field, so it will not be described in detail. After the RTOS system receives the core command and/or identification code, the processor 310 executes step S612 to find the driver command MI_FB_IMPL_API_xxx.

當電子裝置300包含兩個作業系統時,裝置驅動程式通常是在RTOS系統中執行,這是因為RTOS系統具有執行速度快的優點。因此,步驟S626將核心命令及/或識別碼至RTOS系統,以在RTOS系統中找出驅動程式命令MI_FB_IMPL_API_xxx(即圖6之步驟S612)。 When the electronic device 300 includes two operating systems, the device driver is usually executed in the RTOS system because the RTOS system has the advantage of fast execution speed. Therefore, step S626 sends the core command and/or identification code to the RTOS system to find the driver command MI_FB_IMPL_API_xxx in the RTOS system (i.e., step S612 in Figure 6).

圖9顯示本發明之電子裝置的操作方法的另一實施例的流程圖,由處理器310執行。該實施例可以對應到圖4之作業系統架構,亦包含圖6之步驟S630的細節(即,步驟S632、S634及S636)。圖9的流程包以下步驟,其中步驟S910在Linux系統之使用者模式中執行,而步驟S920及S630在Linux系統之核心模式中執行。 FIG9 shows a flowchart of another embodiment of the operation method of the electronic device of the present invention, which is executed by the processor 310. The embodiment can correspond to the operating system architecture of FIG4, and also includes the details of step S630 of FIG6 (i.e., steps S632, S634 and S636). The process of FIG9 includes the following steps, wherein step S910 is executed in the user mode of the Linux system, and steps S920 and S630 are executed in the kernel mode of the Linux system.

步驟S910:接收應用層命令APP_CMD。在一些實施例中,應用層命令APP_CMD可以是步驟S621中的使用者命令,請參考上方關於步驟S621的說明。 Step S910: Receive application layer command APP_CMD. In some embodiments, the application layer command APP_CMD may be the user command in step S621, please refer to the description of step S621 above.

步驟S920:處理器310執行與幀緩衝框架層420相關之核心操作,包含步驟S922~S926。 Step S920: The processor 310 executes core operations related to the frame buffer framework layer 420, including steps S922~S926.

步驟S922:建立設備節點,此步驟為幀緩衝框架層420的固有的操作。 Step S922: Establishing a device node. This step is an inherent operation of the frame buffer framework layer 420.

步驟S924:操作該設備節點以找出對應該應用層命令之一核心命令。步驟S924與步驟S623相似,請參考上方關於步驟S623的說明。當應用層命令APP_CMD等於使用者命令時,步驟S924與步驟S623相同。 Step S924: Operate the device node to find a core command corresponding to the application layer command. Step S924 is similar to step S623, please refer to the above description of step S623. When the application layer command APP_CMD is equal to the user command, step S924 is the same as step S623.

步驟S926:找出對應該核心命令的操作命令MI_FB_API_xxx。請參閱圖4,因為作業系統轉接模組430已事先向幀緩衝框架層420註冊應用程式介面(註冊後操作命令MI_FB_API_xxx一對一對應於核心命令),所以 處理器310可以在幀緩衝框架層420中根據核心命令找出相對應的操作命令MI_FB_API_xxx。 Step S926: Find the operation command MI_FB_API_xxx corresponding to the core command. Please refer to Figure 4. Because the operating system adapter module 430 has registered the application program interface to the frame buffer framework layer 420 in advance (after registration, the operation command MI_FB_API_xxx corresponds one-to-one to the core command), the processor 310 can find the corresponding operation command MI_FB_API_xxx in the frame buffer framework layer 420 according to the core command.

步驟S632:判斷電子裝置300是否包含兩個作業系統。此步驟與步驟S624相同或相似。如果電子裝置300包含兩個作業系統,則處理器310執行步驟S636;否則,處理器310執行步驟S634。 Step S632: Determine whether the electronic device 300 includes two operating systems. This step is the same as or similar to step S624. If the electronic device 300 includes two operating systems, the processor 310 executes step S636; otherwise, the processor 310 executes step S634.

步驟S634:找出對應該操作命令或一識別碼的驅動程式命令。此步驟與步驟S612相似。 Step S634: Find the driver command corresponding to the operation command or an identification code. This step is similar to step S612.

步驟S636:傳送該操作命令及/或識別碼至RTOS系統。此步驟與步驟S626相似。 Step S636: Send the operation command and/or identification code to the RTOS system. This step is similar to step S626.

圖10是操作命令MI_FB_API_xxx對應於幀緩衝框架的一種實施例。如圖10所示,操作命令MI_FB_API_xxx的名稱與幀緩衝框架之使用者介面(即,使用者命令或應用層命令)的名稱相似,可使本發明之作業系統轉接模組430更容易與原Linux系統整合。對於其它類型的裝置驅動程式,本技術領域具有通常知識者亦可以根據圖10來命名操作命令MI_FB_API_xxx。請注意,圖10之命名方式只是一種實施方式,並非用以限制本發明。 FIG. 10 is an implementation example of the operation command MI_FB_API_xxx corresponding to the frame buffer framework. As shown in FIG. 10 , the name of the operation command MI_FB_API_xxx is similar to the name of the user interface of the frame buffer framework (i.e., user command or application layer command), which can make the operating system adapter module 430 of the present invention easier to integrate with the original Linux system. For other types of device drivers, those with ordinary knowledge in the art can also name the operation command MI_FB_API_xxx according to FIG. 10 . Please note that the naming method of FIG. 10 is only an implementation method and is not used to limit the present invention.

綜上所述,由於本發明的作業系統轉接模組430提供裝置驅動程式層440與應用層410或幀緩衝框架層420之間的轉接(adaption),所以電子裝置的開發者更容易將幀緩衝裝置驅動程式移植到不同的平台上。 In summary, since the operating system adapter module 430 of the present invention provides an adapter between the device driver layer 440 and the application layer 410 or the frame buffer framework layer 420, it is easier for the developer of the electronic device to port the frame buffer device driver to different platforms.

前揭實施例雖以幀緩衝裝置驅動程式為例,然此並非對本發明之限制,本技術領域人士可依本發明之揭露適當地將本發明應用於其它類型的裝置驅動程式。 Although the above-mentioned embodiments use the frame buffer device driver as an example, this is not a limitation of the present invention. People skilled in the art can appropriately apply the present invention to other types of device drivers based on the disclosure of the present invention.

雖然本發明之實施例如上所述,然而該些實施例並非用來限定 本發明,本技術領域具有通常知識者可依據本發明之明示或隱含之內容對本發明之技術特徵施以變化,凡此種種變化均可能屬於本發明所尋求之專利保護範疇,換言之,本發明之專利保護範圍須視本說明書之申請專利範圍所界定者為準。 Although the embodiments of the present invention are described above, these embodiments are not intended to limit the present invention. A person with ordinary knowledge in the technical field may make changes to the technical features of the present invention according to the explicit or implicit content of the present invention. All these changes may fall within the scope of patent protection sought by the present invention. In other words, the scope of patent protection of the present invention shall be subject to the scope of the patent application defined in this specification.

S602,S604,S606,S610,S612,S620,S630,S640:步驟S602, S604, S606, S610, S612, S620, S630, S640: Steps

Claims (18)

一種電子裝置,包含:一記憶體介面,用來存取一記憶體,該記憶體儲存一作業系統之複數個程式指令或程式碼;以及一處理器,耦接該記憶體介面,用來執行該些程式指令或程式碼以執行以下步驟:(A)執行該作業系統以產生一操作命令;(B)根據該操作命令,從一查找表中查詢對應該操作命令的一驅動程式命令;以及(C)執行該驅動程式命令。 An electronic device includes: a memory interface for accessing a memory storing a plurality of program instructions or program codes of an operating system; and a processor coupled to the memory interface for executing the program instructions or program codes to perform the following steps: (A) executing the operating system to generate an operation command; (B) searching a lookup table for a driver command corresponding to the operation command according to the operation command; and (C) executing the driver command. 如請求項1之電子裝置,其中,該操作命令係由該作業系統之一應用層產生。 An electronic device as claimed in claim 1, wherein the operation command is generated by an application layer of the operating system. 如請求項2之電子裝置,其中,該作業系統係一即時作業系統。 An electronic device as claimed in claim 2, wherein the operating system is a real-time operating system. 如請求項1之電子裝置,其中,該作業系統包含一幀緩衝框架層及一應用層,該幀緩衝框架層係回應於該應用層所產生之一應用層命令而產生該操作命令。 As in claim 1, the operating system includes a frame buffer framework layer and an application layer, and the frame buffer framework layer generates the operation command in response to an application layer command generated by the application layer. 如請求項1之電子裝置,其中,當該作業系統為一Linux系統時,該處理器更執行以下步驟:(D)接收一應用層命令;(E)建立一設備節點; (F)操作該設備節點以找出對應該應用層命令的一核心命令;以及(G)找出對應該核心命令的該操作命令。 The electronic device of claim 1, wherein when the operating system is a Linux system, the processor further executes the following steps: (D) receiving an application layer command; (E) establishing a device node; (F) operating the device node to find a core command corresponding to the application layer command; and (G) finding the operation command corresponding to the core command. 如請求項5之電子裝置,其中,該核心命令係一幀緩衝框架層之一命令。 An electronic device as claimed in claim 5, wherein the core command is a command of a frame buffer frame layer. 如請求項1之電子裝置,其中,當該作業系統為一Linux系統且該處理器更執行一即時作業系統時,該處理器更執行以下步驟:傳送該操作命令或對應該操作命令之一識別碼至該即時作業系統,其中,該步驟(B)係在該即時作業系統中執行。 The electronic device of claim 1, wherein, when the operating system is a Linux system and the processor further executes a real-time operating system, the processor further executes the following steps: transmitting the operation command or an identification code corresponding to the operation command to the real-time operating system, wherein the step (B) is executed in the real-time operating system. 如請求項1之電子裝置,其中,當該作業系統為一Linux系統時,該步驟(B)包含:找出對應該操作命令的一使用者命令;建立一設備節點;操作該設備節點以找出對應該使用者命令之一核心命令;以及根據該核心命令找出該驅動程式命令。 The electronic device of claim 1, wherein when the operating system is a Linux system, the step (B) includes: finding a user command corresponding to the operation command; establishing a device node; operating the device node to find a core command corresponding to the user command; and finding the driver command according to the core command. 如請求項1之電子裝置,其中,該操作命令係相關於該記憶體中建立一儲存空間,該電子裝置更包含:一圖形引擎,耦接該處理器及該記憶體介面,產生一圖像並將該圖像儲存至該操作命令對應的該儲存空間;以及一疊加電路,耦接該處理器及該記憶體介面,自該儲存空間讀取該圖像並將該圖像與另一圖像進行疊加。 As in claim 1, the operation command is related to establishing a storage space in the memory, and the electronic device further comprises: a graphics engine coupled to the processor and the memory interface, generating an image and storing the image in the storage space corresponding to the operation command; and a superposition circuit coupled to the processor and the memory interface, reading the image from the storage space and superimposing the image with another image. 一種電子裝置的操作方法,包含:(A)執行一作業系統以產生一操作命令;(B)根據該操作命令,從一查找表中查詢對應該操作命令的一驅動程式命令;以及(C)執行該驅動程式命令。 A method for operating an electronic device comprises: (A) executing an operating system to generate an operating command; (B) searching a driver command corresponding to the operating command from a lookup table according to the operating command; and (C) executing the driver command. 如請求項10之方法,其中,該操作命令係由該作業系統之一應用層產生。 The method of claim 10, wherein the operation command is generated by an application layer of the operating system. 如請求項11之方法,其中,該作業系統係一即時作業系統。 As in the method of claim 11, wherein the operating system is a real-time operating system. 如請求項10之方法,其中,該作業系統包含一幀緩衝框架層及一應用層,該幀緩衝框架層係回應於該應用層所產生之一應用層命令而產生該操作命令。 As in the method of claim 10, the operating system includes a frame buffer framework layer and an application layer, and the frame buffer framework layer generates the operation command in response to an application layer command generated by the application layer. 如請求項10之方法,其中,當該作業系統為一Linux系統時,該方法更包含:(D)接收一應用層命令;(E)建立一設備節點;(F)操作該設備節點以找出對應該應用層命令的一核心命令;以及(G)找出對應該核心命令的該操作命令。 The method of claim 10, wherein when the operating system is a Linux system, the method further comprises: (D) receiving an application layer command; (E) establishing a device node; (F) operating the device node to find a core command corresponding to the application layer command; and (G) finding the operation command corresponding to the core command. 如請求項14之方法,其中,該核心命令係一幀緩衝框架層之一命令。 The method of claim 14, wherein the core command is a command of a frame buffer frame layer. 如請求項10之方法,其中,當該作業系統為一Linux系統且該電子裝置更執行一即時作業系統時,該方法更包含:傳送該操作命令或對應該操作命令之一識別碼至該即時作業系統,其中,該步驟(B)係在該即時作業系統中執行。 The method of claim 10, wherein, when the operating system is a Linux system and the electronic device further executes a real-time operating system, the method further comprises: transmitting the operation command or an identification code corresponding to the operation command to the real-time operating system, wherein the step (B) is executed in the real-time operating system. 如請求項10之方法,其中,當該作業系統為一Linux系統時,該步驟(B)包含:找出對應該操作命令的一使用者命令;建立一設備節點;操作該設備節點以找出對應該使用者命令之一核心命令;以及根據該核心命令找出該驅動程式命令。 The method of claim 10, wherein when the operating system is a Linux system, the step (B) includes: finding a user command corresponding to the operation command; establishing a device node; operating the device node to find a core command corresponding to the user command; and finding the driver command according to the core command. 如請求項10之方法,其中,該操作命令係相關於一記憶體中建立一儲存空間,該方法更包含:利用一圖形引擎產生一圖像,以及儲存該圖像至該操作命令對應的該儲存空間;以及利用一疊加電路自該儲存空間讀取該圖像,並將該圖像與另一圖像進行疊加。 As in the method of claim 10, wherein the operation command is related to establishing a storage space in a memory, the method further comprises: generating an image using a graphics engine, and storing the image in the storage space corresponding to the operation command; and reading the image from the storage space using a superposition circuit, and superimposing the image with another image.
TW111120743A 2022-06-02 2022-06-02 Electronic device and method of operating same TWI844862B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW111120743A TWI844862B (en) 2022-06-02 2022-06-02 Electronic device and method of operating same

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW111120743A TWI844862B (en) 2022-06-02 2022-06-02 Electronic device and method of operating same

Publications (2)

Publication Number Publication Date
TW202349198A TW202349198A (en) 2023-12-16
TWI844862B true TWI844862B (en) 2024-06-11

Family

ID=90039157

Family Applications (1)

Application Number Title Priority Date Filing Date
TW111120743A TWI844862B (en) 2022-06-02 2022-06-02 Electronic device and method of operating same

Country Status (1)

Country Link
TW (1) TWI844862B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6895556B1 (en) * 1999-11-12 2005-05-17 International Business Machines Corporation System and method for providing access to displayed data
TW200947256A (en) * 2008-02-26 2009-11-16 Ibm Digital rights management of streaming captured content based on criteria regulating a sequence of elements
TW202001589A (en) * 2018-06-08 2020-01-01 廣達電腦股份有限公司 Sharing expansion device, controlling method and computer using the same
CN111625293A (en) * 2020-05-15 2020-09-04 武汉蓝星科技股份有限公司 Terminal dual system based on linux kernel and hardware access management method thereof

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6895556B1 (en) * 1999-11-12 2005-05-17 International Business Machines Corporation System and method for providing access to displayed data
TW200947256A (en) * 2008-02-26 2009-11-16 Ibm Digital rights management of streaming captured content based on criteria regulating a sequence of elements
TW202001589A (en) * 2018-06-08 2020-01-01 廣達電腦股份有限公司 Sharing expansion device, controlling method and computer using the same
CN111625293A (en) * 2020-05-15 2020-09-04 武汉蓝星科技股份有限公司 Terminal dual system based on linux kernel and hardware access management method thereof

Also Published As

Publication number Publication date
TW202349198A (en) 2023-12-16

Similar Documents

Publication Publication Date Title
US11864248B2 (en) Application function implementation method and electronic device
US11385857B2 (en) Method for displaying UI component and electronic device
CN109101352B (en) Image processing algorithm architecture, algorithm calling method, device, storage medium and mobile terminal
CN114286165B (en) Display equipment, mobile terminal, and screen-throwing data transmission method and system
KR101319632B1 (en) Auxiliary display device driver interface
CN114297436A (en) A display device and user interface theme updating method
US5574888A (en) A method and apparatus for establishing compatibility between communication applications producing at commands and a telephony application programming interface
CN113836540B (en) Method, apparatus, storage medium and program product for managing application rights
US20080140380A1 (en) Unified mobile display emulator
TWI844862B (en) Electronic device and method of operating same
CN114880025A (en) Electronic device and control method thereof
CN115469937A (en) Plug-in operation method and device, electronic equipment and storage medium
CN114286320B (en) Display equipment, mobile terminal and Bluetooth connection method
CN115576679B (en) Sensor control method and device, electronic equipment and storage medium
CN111324437A (en) Kernel function calling method of operating system and computer equipment
CN116521330A (en) Hook communication method, device and storage medium
KR101698484B1 (en) Method and apparatus for performing JAVA application
CN111913868B (en) User interface testing method, device, system and storage medium
TWI397819B (en) System and method for driving hardware device and processing data
EP4027258B1 (en) Image displaying apparatus and method thereof
CN115175266B (en) A data packet sending method, device, terminal and medium
US20240388788A1 (en) Electronic device and shooting method thereof, and medium
CN119807097A (en) USB camera management method, device, equipment and readable storage medium
CN118760381A (en) Display switching method, device, equipment and storage medium
CN113703655A (en) Mobile terminal and fixed screen detection method thereof