TW200933486A - Method for updating firmware and firmware architecture - Google Patents

Method for updating firmware and firmware architecture Download PDF

Info

Publication number
TW200933486A
TW200933486A TW97103207A TW97103207A TW200933486A TW 200933486 A TW200933486 A TW 200933486A TW 97103207 A TW97103207 A TW 97103207A TW 97103207 A TW97103207 A TW 97103207A TW 200933486 A TW200933486 A TW 200933486A
Authority
TW
Taiwan
Prior art keywords
report
feature
usb
item
length
Prior art date
Application number
TW97103207A
Other languages
Chinese (zh)
Other versions
TWI356343B (en
Inventor
Hsing-Lun Chen
Tsang-Te Tsai
Original Assignee
Sonix Technology Co Ltd
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 Sonix Technology Co Ltd filed Critical Sonix Technology Co Ltd
Priority to TW97103207A priority Critical patent/TWI356343B/en
Publication of TW200933486A publication Critical patent/TW200933486A/en
Application granted granted Critical
Publication of TWI356343B publication Critical patent/TWI356343B/en

Links

Abstract

A method of updating firmware is provided. By means of calling either a Get_Report request or a Set_Report request and loading feature reports, an application program executed by a computer host performs command transmission and data exchange with a human interface device in order to complete a firmware updating procedure.

Description

200933486 九、發明說明: 【發明所屬之技術領域】 本發明有關於通用串列匯流排(universal serial bus, USB)介面,尤有關於一種具USB介面之人性化介面裝置 (human interface device,HID )的勃體(firmware)更新方 . 法。 【先前技術】 傳統上’電腦主機(h〇st)若要對一 USB HID進行韌 ® 體更新有二種實施方式:第-種方式是,必須先將作業系 統(operating system)所提供的標準驅動程式卸載 (uninstall ),作業系統再掃描該欲更新韌體之USB HID, 以執行一次匯流排列舉(enumerati〇n );接著,安裝一個 燒錄用之驅動程式,最後,透過該燒錄用驅動程式對該 USB HID進行所有燒錄動作。利用此種方式的好處是,該 燒錄用驅動程式可以完全掌控該USB HID,並藉由控制型 傳輸(control transfer)、中斷型傳輸(interrupttransfer) © 或巨ϊ型傳輸(bulk transfer)來傳遞燒錄之讀寫指令。 二而在部分實作與應用上,該燒錄用驅動程式與個人電 - 知(或作業系統)間會有相容性的問題產生。 第二種方式主要是利用作業系統所提供的標準USB HID驅動程式來進行燒錄動作,此種方式雖然可避免相容 性的問題,但如果該連接的USB HID是滑鼠或鍵盤的話, 則用來控制該USB HID的控制處置器(contr〇1 handler)會 被某些作業系統(例如Windows XP以及Windows Vista等) 給阻擋。此時,程式開發者只能宣告(declare )另一個不 5 200933486 屬於滑鼠及鍵盤的介面,而這也意謂著有至少—個端點 (endpoint)被消耗掉了。 另一方面,對一般USB HID之韌體流程而言,從普 通工作模式(general working mode)切換到燒錄模式 system programming mode)時,必須再重作一次匯流排列 舉,理由如下。第一:韌體運作在燒錄模式時,連接的主 機而要女裝另一個USB驅動程式來進行燒錄動作。第二: ❹ 燒錄模式所使用的傳輸管線(t]:ans如pipe) &法和普通 工作模式所使用的傳輸管線並存。由於執行一次匯流排列 舉大約需費時幾百個毫秒(millisec〇nd),無形中拉長了整 個燒錄韌體的總時間,若量產時仍採用此方式來更新韌 體’則匯流排列舉時間就會佔據整個更㈣體時間中很大 的比重’大幅增加時間成本。為解決上述問題,因此提 本發明。 【發明内容】 有鑑於上述問題,本發明一 更m a ^糸 疋鈥供—種韌體 =新方透過標準USBHID驅動程式來絲 hid裝置,更可以膝外ΤΤΓ1ΤΛ usb 亥⑽HID裝置從普通工作糍十如 、至燒錄模式,而無須作軟體或硬體之重置。、’ 為達成上述目的,本發明之勤體更新方法 —電腦主機(host)與一人|# 保應用於 具有一庫用程二性化介面裝置之間,該電腦主機 有應用程式並透過一通用序列匯流排 人性化介面裝置,兮/ 人 面連接至該 衣置該人性化介面裝置具有— 肩第一韌體,該 6 200933486 方法包含以下步驟:—啟動步驟,係經由該應用程式呼叫 二寫入報告請求(Set_R一),以傳遞—輸出特徵報告 (feature report)給該第一韌體, ^ 笛〜師疋步驟,係根據該 第-勤體接收到的該特徵輸出報告内容,決定是否要從一 普通工作模式切換至-燒錄模式,·以及,—燒錄步驟,庵 該第-知體切換至該燒錄模式後,該應用程式呼叫該寫: 報告請求,用以藉由該輸出特徵報告的裝载,對該乂性化 介面裝置進行燒錄。 φ 本發明另-目的是提供一種刪裝置的知體架構,包 含:-燒錄模組,具有- USB傳輸功能,並利用一㈣ 介面實現-燒錄功能,其令’當接收到一寫入報告嘖长 (Set_Report)時,根據該寫入報告請求之—第一報主之 内容進行燒錄;-普通工作模組,具有_⑽傳輸功 並利用該USB傳輸功能實現—特定產品特性,其中,舍 接收到-報告内容等於一預設值時,該普通工作模組心 一⑽狀態並禁能所有與職無關之中斷,並切換至該 燒,模組;以及一模式判斷模組,用以根據-模式旗標: 決定啟動該普通工作模組或該燒錄模組。 茲配合下列圖示、實施例之詳細說明及申請專利範 圍,將上述及本發明之其他目的與優點詳述於後。 【實施方式】 本說明書中之作業系統係以wind〇ws χρ作為範例說 明,唯本發明之韌體更新方法亦可應用於其他作業系統, 7 200933486 只要能支援或符合USB的規範即可。 第1圖係顯示一電腦主機與一 hid之間的資料流。參 考第1圖,有關電腦主機110與HID 120之間的通信架 構’在電腦主機110内分為二層:應用程式U1與標準 USB HID驅動程式112,在HID 120内亦區分為二層:USB ' 引擎121與韌體122。其中,USB通信的實際執行者是驅 動程式112與USB引擎121’它們負責建立傳輸封包、解 封包及檢驗通訊協定。 在習知USB的規範中’ Set__Report與Get—Report皆屬 於類別特定請求(class-specific request)指令,應用程式 111呼叫Set-Report指令之後,被允許傳遞一報告給hid 12〇。而當應用程式111呼叫Get_Report指令之後,HID 1 2 0 被允许藉由控制型管線(c〇ntr〇l pipe )傳遞一報告給主機 110。其中的報告共有三種型態:輸入(丨叩^)報告、輸 出(output)報告與特徵(feat ure) 報告。 ⑩ 本發明之特色是利用標準USB HID驅動程式所提供 - 或支援的請求:Set_Report(Feature)以及 Get Report(Feature), 用以在主機110與HID 120之間傳遞韌體更新所需之燒錄 程式與資料,如第1圖所示。換言之,本發明利用上述二 個請求作為一組輸出/輸入管道,將下載之程式與資料偽 裝成特徵報告’以進行HID之韌體更新動作’即可成功地 迴避Windows XP以及Windows Vista等作業系統的攔截,而 無須再安裝額外的驅動程式,大大增加了韌體更新的便利 性0 8 200933486 為方便稍後應用程式 111 能順利利用 Set_Report(Feature)以及 Get_Report(Feature)所傳遞的特 徵報告來裝載程式與相關資訊,以進行後續之燒錄動作, 對HID 120而言,為符合USB的規範與協定,有一些相 關的資訊(如特徵報告的長度等),必須事先宣告於報告描 述元(report descriptor)内的報告尺寸(Report Size)項目 (item)與報告計數值(Report c〇unt)項目,例如:假設特 徵報告的長度等於8位元組(bytes),則報告尺寸項目内之 ❹ 資料與報告計數值項目内之資料必須宣告為8,也就是:200933486 Nine, invention description: [Technical field of invention] The present invention relates to a universal serial bus (USB) interface, and more particularly to a human interface device (HID) with a USB interface. The firmware update method. [Prior Art] Traditionally, the computer host (h〇st) has two implementations for the firmware update of a USB HID: the first way is to first set the standard provided by the operating system. The driver uninstalls (uninstall), and the operating system scans the USB HID of the firmware to be updated to perform a queue arrangement (enumerati〇n); then, installs a driver for burning, and finally, through the programming. The driver performs all burning operations on the USB HID. The advantage of this approach is that the programming driver can fully control the USB HID and pass it via control transfer, interrupt transfer © or bulk transfer. Read and write instructions for burning. Second, in some implementations and applications, there is a problem of compatibility between the programming driver and the personal power-aware (or operating system). The second method mainly uses the standard USB HID driver provided by the operating system to perform the burning operation. Although this method can avoid the compatibility problem, if the connected USB HID is a mouse or a keyboard, then The control handler (contr〇1 handler) used to control the USB HID is blocked by certain operating systems (such as Windows XP and Windows Vista). At this point, the programmer can only declare another interface that belongs to the mouse and keyboard, and this means that at least one endpoint is consumed. On the other hand, for the firmware flow of the general USB HID, when switching from the general working mode to the system programming mode, the bus arrangement must be repeated again for the following reasons. First: When the firmware is in the burning mode, the connected host needs another USB driver for the burning operation. Second: 传输 The transmission pipeline used in the programming mode (t): ans such as pipe) & method and the transmission pipeline used in the normal working mode coexist. Since it takes about a hundred milliseconds (millisec〇nd) to perform a bus arrangement, the total time of the entire firmware is invisibly elongated. If mass production is used to update the firmware, then the bus is arranged. Taking time will take up a large proportion of the total (four) body time 'significantly increase the time cost. In order to solve the above problems, the present invention has been made. SUMMARY OF THE INVENTION In view of the above problems, the present invention has a more ma ^ 糸疋鈥 — firmware = new party through the standard USBHID driver to wire hid device, and can also kneel ΤΤΓ 1 ΤΛ usb hai (10) HID device from ordinary work 糍 ten For example, to the programming mode, there is no need to reset the software or hardware. In order to achieve the above object, the method for updating the body of the present invention - the host computer and the one person | # is applied between a device having a library and a user interface, and the computer host has an application and a general purpose The serial bus is arranged in a humanized interface device, and the human/personal interface is connected to the device. The humanized interface device has a shoulder first firmware. The method of 200933486 includes the following steps: - a startup step, calling a second write via the application Into the report request (Set_R one), to pass a feature report to the first firmware, the flute to the teacher step, according to the feature received by the first object to output the report content, determine whether To switch from a normal working mode to a programming mode, and, - a burning step, after the first body is switched to the programming mode, the application calls the writing: a report request for The load of the feature report is output, and the user interface device is burned. φ Another object of the present invention is to provide a physical structure of a deletion device, comprising: a programming module, having a USB transmission function, and implementing a programming function by using a (four) interface, which enables 'when a write is received When the report is set to (Set_Report), the content of the first report owner is written according to the write report request; the normal work module has _(10) transfer function and is realized by the USB transfer function-specific product characteristics, wherein Receiving - when the report content is equal to a preset value, the normal working module is in a state of 10 (10) and disables all interrupts irrelevant to the job, and switches to the burn, module; and a mode judging module According to the mode flag: decide to start the normal working module or the programming module. The above and other objects and advantages of the present invention will be described in detail with reference to the accompanying drawings. [Embodiment] The operating system in this manual uses wind〇ws χρ as an example. Only the firmware update method of the present invention can be applied to other operating systems. 7 200933486 It is only necessary to support or conform to the USB specification. Figure 1 shows the data flow between a computer host and a hid. Referring to FIG. 1, the communication architecture between the computer host 110 and the HID 120 is divided into two layers in the computer host 110: the application U1 and the standard USB HID driver 112 are also divided into two layers in the HID 120: USB 'Engine 121 and firmware 122. Among them, the actual executors of USB communication are the driver 112 and the USB engine 121' which are responsible for establishing transmission packets, decapsulating packets, and verifying communication protocols. In the conventional USB specification, 'Set__Report and Get-Report belong to the class-specific request command, and after the application 111 calls the Set-Report command, it is allowed to deliver a report to hid 12〇. When the application 111 calls the Get_Report command, the HID 1 2 0 is allowed to pass a report to the host 110 via the control pipeline (c〇ntr〇l pipe). There are three types of reports: input (丨叩^) reports, output reports, and feature (feat ure) reports. 10 The invention features a request provided by a standard USB HID driver - or a supported request: Set_Report (Feature) and Get Report (Feature), which are used to transfer the firmware update required between the host 110 and the HID 120. Program and information, as shown in Figure 1. In other words, the present invention successfully evades operating systems such as Windows XP and Windows Vista by using the above two requests as a set of output/input pipes and disguising the downloaded program and data as a feature report 'for HID firmware update action'. The interception without the need to install additional drivers greatly increases the convenience of firmware update. 0 8 200933486 To make it easier for the application 111 to successfully load the feature reports passed by Set_Report(Feature) and Get_Report(Feature) Program and related information for subsequent burning actions. For HID 120, in order to comply with USB specifications and agreements, there is some relevant information (such as the length of feature report, etc.), which must be declared in advance in the report description element (report) Report Size item (Report) item and report count value (Report c〇unt) item, for example, if the length of the feature report is equal to 8 bytes, then the data in the report size item is reported. The information in the item with the report count value must be declared as 8, ie:

Report Size(8) ’ Report c〇unt(8)。依此,在稍後 HID 12〇 連上主機110所執行的匯流排列舉令,主機11〇就可以取 得HID iZO之屬性與運作方式,且稍後應用程式iu就能 順利呼叫 Set_ReP〇rt(Feature)以及 Get—Rep〇rt(Feat㈣。 為避免混淆,應靠式⑴呼叫Set_Rep(m(feature)時由 主機!ΗΜ專遞至HID120之特徵報告,以下稱之為輸出特 徵報告。而應用程式⑴呼叫Get—以㈣加⑽)時由㈣ © 120回傳至主機11〇之特徵報告,以下稱之為輸入特徵報 •告,如第1圖所示。在應用上,輸出特徵報告與輸入特徵 •報告的長度m相同’當然也必須在励報告描述 元中分開宣告以玆分辨。 圖 第 。第 2::二 程 在本發明第一實施例開始進行之前, 所處的狀態。假設hid 120的為一支滑 首先介紹目前HID 120 鼠,係已連接上主機 9 200933486 110並在正常使用(即在普通工作模式)中,故目前是處 於執行普通工作模式USB程式的狀態(步驟S322,第3A 圖)。當然,在進入步驟S322之前,HID 12〇的微控器(圖 未不)已執行過模式旗標判斷(步驟S3丨〇,模式旗標MF 的初始值為普通工作模式)、普通工作模式初始化(步驟 • S320 )與普通工作模式匯流排列舉(步驟S321)的工作。 *步驟S322中普通上作模式USB程式具有傳輸功能, 並且能利用該USB傳輪功能實現滑鼠之所有特性,同時,也會 ® 回應應用程式U1呼叫之標準請求(standard request)與 類別特定請求。 以下,以第2圖為主,第3A圖與第3B圖為輔,說明本發 明韌體更新方法。 步驟 S210:應用程式 U1 呼叫 Set_Report(feature), 以傳遞特定内容之輸出特徵報告(假設長度為8個位元 組),來啟動整個韌體更新程序❶作業系統收到此請求後, 會透過USB HID驅動程式112檢查HID 120是否有輸出 ® 特徵報告的宣告以及其宣告之長度是否正確。若成功,由於輸出 特徵報告是透過控制型傳輸(Control Transfer)來傳送,作業系 統再透過下層之USB HID驅動程式120,將此請求在設定階 段(Setup Stage)傳送至USB介面130,接著,再將8個位元組之預 設值作為輸出特徵報告的内容,在資料階段(Data Stage)傳送至 USB 介面 130。 步驟S220 : HID 120接收前述請求與輸出特徵報告。 步驟S230 : HID 120決定是否切換至燒錄模式。對照 200933486 f 3A圖來看,此時HID120的微控器(圖未示)會連續判斷 是否有接收到Set_Report(feature)請求(步驟s323 ),以及 接收到的輸出特徵報告内容是否正確。若都正確的話 跳到步驟S240,否則,回到步驟S22〇。 、步驟S240:切換至燒錄模式。對照第3a圖來看,從 普通工作模式進人燒錄模式之前,微控ϋ會進行USB的狀Report Size(8) ’ Report c〇unt(8). According to this, at a later time, the HID 12 is connected to the bus arrangement command executed by the host 110, and the host 11〇 can obtain the attribute and operation mode of the HID iZO, and the application program iu can call the Set_ReP〇rt (Feature later). And Get-Rep〇rt (Feat (4). To avoid confusion, you should rely on the formula (1) to call Set_Rep (m (feature) when the host! ΗΜ specializes to the HID120 feature report, hereinafter referred to as the output feature report. And the application (1) call Get—(4) plus (10)) The feature report of (4) © 120 back to the host 11〇, hereinafter referred to as the input feature report, as shown in Figure 1. In the application, output feature report and input features • The length m of the report is the same 'of course, it must also be separately declared in the excitation report description element to distinguish it. Figure 2. 2: The state before the start of the first embodiment of the present invention, the state in which the hid 120 is assumed For the first slide, the current HID 120 mouse is connected to the host 9 200933486 110 and is in normal use (that is, in the normal working mode), so it is currently in the state of executing the normal working mode USB program (step S32). 2, FIG. 3A). Of course, before proceeding to step S322, the HID 12〇 micro controller (not shown) has performed the mode flag determination (step S3, the initial value of the mode flag MF is normal work). Mode), normal working mode initialization (step S320) and normal working mode flow arrangement (step S321). * Step S322, the normal upload mode USB program has a transmission function, and can use the USB transfer function to achieve sliding All the features of the mouse, at the same time, will respond to the standard request and category-specific requests of the application U1 call. The following is based on Figure 2, supplemented by Figures 3A and 3B, illustrating the toughness of the present invention. Step S210: The application U1 calls Set_Report(feature) to deliver the output feature report of the specific content (assuming a length of 8 bytes) to start the entire firmware update process, after the operation system receives the request The USB HID driver 112 checks whether the HID 120 has an output® signature report and whether the length of the announcement is correct. If successful, due to the output feature report It is transmitted through Control Transfer. The operating system then transmits the request to the USB interface 130 through the lower layer USB HID driver 120, and then 8 bytes. The preset value is transmitted as the output feature report to the USB interface 130 in the data stage. Step S220: The HID 120 receives the foregoing request and output feature report. Step S230: The HID 120 decides whether to switch to the programming mode. According to the 200933486 f 3A diagram, the HID 120's microcontroller (not shown) continuously determines whether a Set_Report (feature) request has been received (step s323), and whether the received output feature report content is correct. If it is correct, the process goes to step S240, otherwise, the process returns to step S22. Step S240: Switch to the programming mode. Looking at Figure 3a, the micro-controller will perform a USB shape before entering the normal programming mode.

態2始化(步驟S325 ),其内容包含:保存進入燒錄模式 之則的USB狀態以及禁能(disable)所有與usb無關之中斷 (interrupt)。其中,需保存的USB狀態包含:輸出特徵報 告的長度、輸入特徵報告的長度、特徵報告識別碼㈣州 ID)存在於否、每—端點(endp〇int )之致能狀態與暫停 (halt)狀態、咖位址以及址態狀態(c〇nfig_dst 等等。 本發明藉由保存上述的USB狀態,HID 12〇的微控器 可以在主機110不知情的狀況下順利地從普通工作模式進 、λ>錄模式大約需t幾個微秒(microsecond)的時間, ❹相較於傳統作法還須重新執行燒錄模式初始化(步驟 • S330 )以及燒錄模式匯流排列舉(步驟s34〇),大大縮減 了整個韌體更新的總時間。 步驟S250 .進行燒錄動作。這裡的燒錄動作包含有關 進行勃體更新之所有燒錄命令,例如:「取得勒體版本」、 「比較密碼」、「切換工作模式」、「冑除快閃記憶體(f i a s h erase)」、「區段清除(sect〇r⑽⑷」、「程式化(卩叫_)快 閃心It體」'「讀取快閃記憶體」冑等燒錄命令。由於輸出 特徵報告的8個位元組内容由接收之腦引擎i2i負責 11 200933486 解譯(也就是製造商自行定義),因此, 告的内容可以視需要由應用軟體⑴ 錄特徵報 關資料。應用程式⑴根據_待更新勒體;^錄命令或相 料翻主从且更新勒體的長度與輸出特 徵報口的長度(在此假設是8位元組),可重複The state 2 is initialized (step S325), and the content thereof includes: saving the USB state entering the programming mode and disabling all interrupts irrelevant to usb. The USB state to be saved includes: the length of the output feature report, the length of the input feature report, the feature report identification code (4) state ID), the presence status of each end point (endp〇int), and the pause (halt). State, coffee address, and address state (c〇nfig_dst, etc.. By storing the USB state described above, the HID 12〇 microcontroller can smoothly enter the normal working mode without the knowledge of the host 110. The λ> recording mode requires about a few microseconds of time, and the programming mode initialization (step S330) and the programming mode bus arrangement (step s34〇) must be re-executed compared to the conventional method. , greatly reducing the total time of the firmware update. Step S250. Perform the burning action. The burning action here includes all the burning commands for the body update, for example: "Get the version of the font", "Compare the password" , "Switch mode", "Fash erase", "Section clear (sect〇r(10)(4)", "Stylized (卩叫_) Flash Heart It""" Read flash memory胄 烧 烧 。 。 。 。 。 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于 由于Record the customs declaration data. The application (1) repeats the length of the lexicon and the length of the output feature quotation (in this case, an octet) according to _waiting to update the lexicon;

Set_Rep〇n(feature),藉由該輪出特徵報告的㈣將 更新勃體載入到励120的非揮發性記憶體⑽未示)中。 ❹ :要讀取HID120的相關資料或狀態時,則應用程 ^ 11呼叫Get_RepGrt(feature),藉由輸人特徵報 載’將資料或狀態回傳到主機110中。 裝 對照第圖來看,從普通工作模式進入燒錄模式之 後,微控益開始執行燒錄模式刪程式(步驟^ η式uSB程式也具有刪傳輸功能,並可利用usb : 來實現韌體更新功能。當微控器收到 e—RePcm(feature)請求後(步驟S36〇),會去掏取 的燒錄命令,判斷是否要程式化_(步驟Μ⑴, 二:的洽,跳到步驟S364,以進行程式化動 :二驟S3“,以處理…令。當微控器收I】 /rt(feature)請求後(步驟S370),會去判斷是否要 身:資料輕態(㈣助),若是的話,跳到步 以回庫^進仃資料或狀態讀取;否則,跳到步驟S376’ 在燒錄過程中,微控器會判斷是否勤體更新 t束(步驟S372),若是的話,跳到步驟S382,以 二SB卸栽(步驟S382 );否則,回到步驟SW,繼續 ΗΐΓΤΖΜ2所進行的咖卸载’主要是將 的硬體USB功能禁能,讓主機11〇以為Ηΐ]) 12〇 12 200933486 已斷線。之後,微控器再將硬體USB功能致能(enaMe), 讓主機110以為HID 120已重新連接,微控器就可回到普 通工作模式,重新執行一次普通工作模式初始化(步驟 S320 )與普通工作模式匯流排列舉(步驟),同時, 也完成整個㈣更新程序,使用者即能享受最新更新的勤 體功能。Set_Rep〇n(feature), by the (4) of the round-out feature report, loads the updated body into the non-volatile memory (10) of the excitation 120 (not shown). ❹ : When the relevant data or status of the HID 120 is to be read, the application ^ 11 calls Get_RepGrt (feature), and the data or status is returned to the host 110 by the input feature report. According to the figure, after entering the programming mode from the normal working mode, the micro-control will start to execute the programming mode to delete the program (step ^ η-type uSB program also has the delete transmission function, and can use usb : to achieve firmware update. Function: When the micro controller receives the e-RePcm (feature) request (step S36〇), it will go to the captured programming command to determine whether to programmatically _ (step Μ (1), two: contact, skip to step S364 To programmatically: two steps S3 "to handle the ... order. When the microcontroller receives I] / rt (feature) request (step S370), it will determine whether it is necessary: the data is light ((four) help) If yes, skip to step to return to the library to enter the data or status read; otherwise, skip to step S376' During the burning process, the microcontroller will determine whether the body is updating the t bundle (step S372), and if so , skip to step S382, unload with two SBs (step S382); otherwise, return to step SW, continue to 咖2 the coffee unloading 'mainly disable the hardware USB function, let the host 11 think it is Ηΐ]) 12〇12 200933486 has been disconnected. After that, the microcontroller will then use the hardware USB function. (enaMe), let the host 110 think that the HID 120 has been reconnected, the micro controller can return to the normal working mode, and re-execute a normal working mode initialization (step S320) and the normal working mode convergence arrangement (step), meanwhile, After completing the entire (four) update process, the user can enjoy the latest updated work function.

攸上述整個韌體更新過程可以看到本發明的二大優 點:第-個優點是省肖,本發明#由直接從普通工作模式 切換到燒錄模式,彳以大幅節省硬體的重置與插拔、以及 軟體的初始化與匯流排列舉的時間。第二個優點是使用的 便利性,無須額外安装驅動程式,就可一次安裝完成。 另一方面,本發明韌體更新方法不但可應用於hid 120已連接至主機11〇且已進入普通工作模式的情況,也 同樣可應用在HID 12〇與主機u〇尚未連接的情況。 第4圖為本發明韌體更新方法之第二實施例的流程 圖以下參考第4圖說明本發明第二實施例之所有步驟。 步驟S41〇 :將HID 120連接至主機11〇。 乂驟S420’^7體進入燒錄模式。對照第3B圖’HID 120 開機之後會判斷模式旗摞肿是否為燒錄模式(步驟 s3l〇y若是,跳到步驟S32〇,韌體進入燒錄模式並進行 乂 f松式初始化工作。例如在量產階段,上述模式旗摞仰 可預設等於燒錄模式’以方便載入韌體。 步驟S430 :執行燒錄模式匯流排列舉。如上所述,此 時,HID 120必須將輸出特徵報告與輸入特徵報告的長 度,宣告於報告;^、+、_ , 」 m σ钿迷TO (report descriptor)内的報告尺寸 13 200933486 (Report Size)項目(item)與報告計數值(Rep〇rt c〇un〇 項 目中,主機110就可以取得HID 120之屬性與運作方式。 步驟S440 :進行燒錄動作。根據一待更新韌體的長度 與輸出特徵報告的長度’應用程式111可重複呼叫 Set一ReporUfeature),以藉由該輸出特徵報告的裝載,將燒 錄命令或相關資料傳入HID 120,USB引擎121再負責解 譯並執行之。當然,若要讀取HID 120的資料或狀態時, 應用程式111呼叫Get_Rep〇rt(feature),藉由輸入特徵報 φ 告的裝載,將資料或狀態回傳到主機110中。詳細狀況已 在上述步驟S250中討論,這裡不再贅述。 如上所述,利用第3A圖與第3B圖之韌體架構,主機 110與HID 120之間進行燒錄動作時,透過攸 The above-mentioned whole firmware update process can see the two advantages of the present invention: the first advantage is that the invention is omitted, and the invention # switches from the normal working mode to the burning mode, thereby greatly saving the hardware reset and Plug-in, and the initialization of the software and the time of the bus arrangement. The second advantage is the ease of use, which can be installed in one installation without the need to install additional drivers. On the other hand, the firmware updating method of the present invention can be applied not only to the case where the hid 120 is connected to the host 11 but has entered the normal working mode, but also the case where the HID 12 is not connected to the host u. Fig. 4 is a flow chart showing a second embodiment of the firmware updating method of the present invention. Referring to Fig. 4, all the steps of the second embodiment of the present invention will be described below. Step S41: The HID 120 is connected to the host 11A. Step S420'^7 body enters the programming mode. After comparing the 3D picture 'HID 120', it will judge whether the mode flag is swollen or not. (Step s3l〇y If yes, skip to step S32〇, the firmware enters the programming mode and performs the 松f loose initialization. For example, In the mass production stage, the above mode flag can be preset to be equal to the programming mode 'to facilitate loading of the firmware. Step S430: Execute the programming mode bus arrangement. As described above, at this time, the HID 120 must report the output characteristics. Enter the length of the feature report, declared in the report; ^, +, _, ” m σ TO TO ( TO (report descriptor) report size 13 200933486 (Report Size) item (item) and report count value (Rep〇rt c〇 In the un〇 project, the host 110 can obtain the attributes and operation modes of the HID 120. Step S440: Perform a burning operation. According to the length of the firmware to be updated and the length of the output feature report, the application 111 can repeatedly call Set-ReporUfeature. The USB engine 121 is responsible for interpreting and executing the programming command or related data to the HID 120 by the loading reported by the output feature. Of course, if the HID 120 data or the like is to be read In the state, the application 111 calls Get_Rep〇rt(feature), and returns the data or status to the host 110 by inputting the loading of the feature report φ. The detailed situation has been discussed in the above step S250, and details are not described herein again. As described above, when the firmware is executed between the host 110 and the HID 120 by using the firmware structures of FIGS. 3A and 3B,

Get—Report(feature)與 Set_Rep〇rt(feature)二個管道來上傳 與下傳資料’就可避免控制HID 120的控制處置器被 Windows XP給阻擋。請注意,當第3A圖與第3B圖之韌 體架構應用在一般的USB裝置時,就沒有作業系統阻擋的 • 問題。因此,在主機110與一般的USB裝置之間進行燒錄 . 動作時’除了可以透過Get一Report(feature)與 Set_Report(feature)的這一組管道之外,也可以透過另一組 管道:即 Get_Report(IN)與 Set—Report(OUT)來上傳與下 傳資料’如第5A圖的步驟S523、S524與第π圖的步驟 S560、S570 所示。 在較佳實施例之詳細說明中所提出之具體實施例僅 用以方便說明本發明之技術内容,而非將本發明狹義地限 制於上述實施例’在不超出本發明之精神及以下申請專利 14 200933486 範圍之情況,所做之種種變化實施,皆屬於本發明之範圍。The Get-Report(feature) and Set_Rep〇rt(feature) two pipes are used to upload and transmit data' to prevent the control handler of the HID 120 from being blocked by Windows XP. Please note that when the firmware of Figures 3A and 3B is applied to a general USB device, there is no problem with the operating system blocking. Therefore, the host 110 and the general USB device are burned. In addition to the set of pipes of the Get-Report (feature) and the Set_Report (feature), the action can also pass through another set of pipes: Get_Report(IN) and Set_Report(OUT) are used to upload and download the data as shown in steps S560 and S570 of steps S523, S524 and π of FIG. 5A. The specific embodiments described in the detailed description of the preferred embodiments are merely used to illustrate the technical content of the present invention, and the invention is not limited to the above-described embodiments, without departing from the spirit of the invention and the following claims. 14 200933486 Scope of the scope, the implementation of various changes, are within the scope of the present invention.

15 200933486 【圖式簡單說明】 第1圖係顯示—電腦主機與一 HID之間的資料流。 第2圖為本發明韌體更新方法之第一實施例的流程 圖。 第3A圖與第3B圖為本發明HID之勃體流程圖。 . 第4圖為本發明韌體更新方法之第二實施例的流輕 圖0 第5A圖與第5B圖為本發明USB裝置之韌艚流择圖 ❸ 【主要元件符號說明】 110電腦主機 ill應用程式 112標準USB HID驅動程式 120人性化介面裝置 121 USB引擎 122韌體 130 USB介面15 200933486 [Simple description of the diagram] Figure 1 shows the data flow between the computer host and an HID. Fig. 2 is a flow chart showing the first embodiment of the firmware updating method of the present invention. 3A and 3B are flow charts of the HID of the present invention. 4 is a flow chart of the second embodiment of the firmware updating method of the present invention. FIG. 5A and FIG. 5B are diagrams showing the toughness of the USB device of the present invention. [Main component symbol description] 110 computer host ill Application 112 standard USB HID driver 120 user interface device 121 USB engine 122 firmware 130 USB interface

1616

Claims (1)

200933486 十、申請專利範圍: 1· 一種_更新方法’係應用於—電腦主機與—人性 面裝置(HID )之間,兮·雷腦主揪| 過n 機具有一應用程式並透 序列匯流排(USB)介面連接至該人性化介 =置’該人性化介面裝置具有—第一勒 • 包含以下步驟: 表 ' —啟動步驟,係經由該應用程式呼叫-寫入報告靖求 ^^邮),以傳遞—輸出特徵報^給該第_ 韌體; -決=驟,係根據該第一動體接收到的該特徵輸出 報:内容,決定是否要從一普通工作模式 一燒錄模式;以及 —燒錄步驟,當該第—知妙 庫用w 該燒錄模式後,該 應用程式呼叫該寫入報告請求,用以藉 2·如二報告的裝載,對該人性化介面I置進行燒錄 ❹ &含:專利範圍第1項所記載之方法,其中該燒錄步驟更 ‘ 根據-第二勒體的長度與該輸出特徵報告的長 . Γ;、式以-相對應的次數呼叫該寫:告: 、用以藉由該輸出特徵報告的裝載一二 3 體载入該人性化介面裝置中。 ,"—韌 •如申請專利範圍第1項所記載之 包含: / /、中該燒錄步驟更 該應用程式透過呼叫一讀取 用以藉由該讀取報心… (Μ-—。, 〇明求之一輸入特徵報告的裝 17 200933486 4. 5. 鲁 6. 罄 8. 如申請專利二=性化介面袈置的狀態或資料° 告的内容為資料。戶斤記載之方法,其中該輸入特徵報 之前更^ 3 _記载之方法,其中在該啟動步驟 <剛更包含以下步驟: "描v通工作模式匯流排列舉,用以在- HID報告 〜〔元(report descriptor )中宣告該輸入特徵報 告的長度。 包含 丨範圍第5項所記載之方法,其中該執行步驟更 根據該輪入特鉬 符徵報D的長度,宣告該HID報告描述元 盥輪入特徵報告尺寸(Report Size)項目(item) 士申:輪入特徵報告計數值(Report Count )項目。 μ專利範圍第丨項所記狀方法,其巾在該啟 之則更包含以下步驟: άτ. — λ, 9通工作模式匯流排列舉,用以在一 HID報告 ^、十、— 田元(report descriptor )中宣告該輸出特徵報 告的長度。 包1月專利範圍第7項所記載之方法,其中該執行步驟更 根據4輪出特徵報告的長度,宣告該hid報告描述元 輪出特徵報告尺寸(Report Size)項目(jtem ) 與—輪出特徵報告計數值(Report Count )項目。 °申清專利範圍第1項所記載之方法’其中該決定步驟還 包含: 18 9. 200933486 ίο如申心直該燒錄拉式之前’該第一動體保存—USB狀態。 ·=專利範圍第9項所記載之方法…該謂狀態包 告的長度、該輸入特徵報告的長度、 竹倒:m告識別碼存 暫停狀態、USB位:否、每―端點之致能狀態與 n· M及組態狀態其中之一或其組合。 包^專利1巳圍第1項所記载之方法,其甲該決定步驟還 在進入該燒錄描;+ +此 與咖無關i中斷該第一物體禁能(disable)所有 12.如申請專利範圍第i項 告的内容包含一燒錚。八方法,其中該輪出特徵報 人 l3燒錄命令以及一資料其中之一或且组 口,且該燒錄命令為製造商定義。 /,、、 更新n係應用於—電腦主 具有-應用程式,該方法包含以下步驟.電腦主機 透過-通料龍㈣(u 接至-人性化介面裝置二=將該電腦主機連 -第―物體; 胃人性化介面跋置具有 執行一燒錄模式匯流排列I· 進行燒錄’藉由該應用1式;及叫寫 (Set-Repon),利用—輪出特徵報:入報告請未 人性化介面裝置進行燒錄。 σ的裳栽,對該 申請專利範圍第13項所記 包含: 、甲該繞錄步驟更 根據一第二勤體的長度與該輪出 應用程式以一相對應的次數呼叫二的長度,該 。寫入報告請 19 200933486 求用以藉由°亥輪出特徵報告的裝載,將該第二韌 體載入該人性化介面裳置中。 15·如申請專利範圍第13項所記載之方法,其中該燒錄步驟更 包含: 該應用程式透過呼叫1取報告請求,㈣該讀取報告 請求之-輸入特徵報告的裝載,以回傳該人性化 介面裝置的狀態或資料。 16二請專利範圍第15項所記載之方法,其中該輸入特徵報 告的内容為資料。 17 :二Τ專:】範圍第15項所記載之方法,其中該執行該燒錄 模式匯流排列舉步驟包含: “在元中’宣告該輪入特徵報告的長度。 包專利娜17項所記載之方法,其中該宣告步雜更 根據該輸入特徵報告的 $ 之 ^ + 旦告該HID報告描述元 Ο 之一輪入特徵報告尺寸項^ 數值項目。 辨輸入特徵報告計 19.如申請專利範圍帛13項所記載之方 模式匯流排列舉步驟包含: 、中該執行該燒錄 20.如申請專,田述70中,宣告該輪出特徵報告的長 '專利範圍第19項所記載之方 旳長度。 包含: "中該宣告步驟更 根據該輸出特徵報告 夕一认 旦告該hid報生柑丄 :輪出特徵報告尺寸項目 “:迷元 數值項目。 荆33将徵報告計 20 200933486 21. 如申請專利範圍第13項所記載之方法,其中該輸出特徵報 告的内容包含一燒錄命令以及一資料其中之一或其組 合,且該燒錄命令為製造商定義。 22. —種USB裝置的韌體架構,包含: 一燒錄模組,具有一 USB傳輸功能,用以利用一 USB介面實 現一燒錄功能,其中,當接收到一寫入報告請求 (Set_Report )時,該燒錄模組根據該寫入報告請 求之一第一報告之内容進行燒錄; 一普通工作模組,具有一 USB傳輸功能,用以利用該USB傳 輸功能實現一特定產品特性,其中,當接收到一報告内 容等於一預設值時,該普通工作模組保存一 USB狀態 並禁能所有與USB無關之中斷,並切換至該燒錄模 組;以及 一模式判斷模組,用以根據一模式旗標,決定啟動該普通工作 模組或該燒錄模組。 23. 如申請專利範圍第22項所記載之架構,其中該燒錄模組更 包含: 當接收到一讀取報告請求(Get_Report)時,藉由該讀 取報告請求之一第二報告的裝載,以回傳該USB 裝置的狀態或資料。 24. 如申請專利範圍第23項所記載之架構,其中該第二報告為 一特徵報告或一輸入報告,且該第二報告的内容為資料。 25. 如申請專利範圍第23項所記載之架構,其中該USB狀態 包含該第一報告的長度、該第二報告的長度、一特徵報 告識別碼存在於否、每一端點之致能狀態與暫停狀 21 200933486200933486 X. Patent application scope: 1· A method of updating is applied between the computer host and the human face device (HID), and the device has an application and a serial bus. The (USB) interface is connected to the user interface. The user interface has the following steps: The table includes the following steps: Table '-starting step, calling through the application-writing report Jingqi^^mail) Passing the output-output feature to the _th firmware; - determining, according to the feature output message received by the first mobile body, determining whether to enter a programming mode from a normal working mode; And the burning step, when the first-known database uses the programming mode, the application calls the write report request, and the user interface is set by the loading of the second report. Burning ❹ & Included: The method described in the first item of the patent scope, wherein the burning step is further 'based on the length of the second homing body and the length of the output characteristic. Γ; Call the write: 告:, to borrow The report output characteristic of the loading member loaded twelve 3 Human Interface device. , "-Toughness as described in the first paragraph of the patent application scope: / /, in the burning step, the application reads through the call for reading by the reading... (Μ--. , 〇明求一一个输入特征的装置17 200933486 4. 5. Lu 6. 罄8. If you apply for a patent = the status or information of the sexual interface device, the content of the report is the data. Wherein the input feature is reported before the method of ^3_, wherein in the starting step < just more includes the following steps: " depicting v-working mode convergent arrangement for use in - HID report ~ [yuan (report) The length of the input feature report is declared in the descriptor. The method described in item 5 of the scope is included, wherein the execution step further announces the rounding feature of the HID report according to the length of the round-robin sign. Report Size item (item) Shishen: The rounded feature report count value (Report Count) item. The method of the patent range of the second paragraph of the patent scope, the towel also includes the following steps in the beginning: άτ. — λ, 9 through The mode convergence is arranged to announce the length of the output feature report in a HID report ^, ten, - report descriptor. The method described in item 7 of the January patent scope, wherein the execution step is further based on 4 The length of the feature report is announced, and the hid report is declared to describe the report size item (jtem) and the round-out feature report count value (Report Count) item. The method of recording includes the following steps: 18 9. 200933486 ίοIf the heart is straight before the burning of the drawing, the first moving body saves the USB state. The method described in item 9 of the patent range... The length of the status report, the length of the input feature report, the bamboo reversal: m acknowledgment code storage pause state, USB bit: no, each of the endpoint's enable state and n·M and configuration state or The combination of the method described in the first paragraph of the patent, the first step of the decision is still entering the burn description; + + this has nothing to do with the coffee interrupt the first object disable all 12 If the patent application scope is i The content of the advertisement includes a burnt method. The eight method, wherein the round-off feature is a person to burn a command and one of the materials and the group mouth, and the programming command is defined by the manufacturer. /,,, update n system Applicable - the computer main has - application, the method includes the following steps. The computer host through - through the dragon (four) (u connected to - human interface device two = the computer host - the first object; stomach human interface 跋Set to execute a burn-in mode bus arrangement I· to burn 'by the application 1; and call-to-reponse, use the round-off feature report: enter the report, please unhumanized interface device for burning. The sigma of the sigma is included in the thirteenth item of the patent application scope: A, the circling step further calls the length of the second one according to the length of a second physical body and the round-off application, . Write the report request 19 200933486 to load the second firmware into the user interface by loading the feature report. 15. The method of claim 13, wherein the burning step further comprises: the application receiving the report request by call 1, and (4) the loading of the read report request-input feature report to return the The status or information of the human interface device. The method described in Item 15 of the patent scope, wherein the content of the input feature report is data. 17: 二Τ专:: The method described in the fifteenth item, wherein the step of performing the programming mode convergence includes: “in the meta-declaration” the length of the round-in feature report. The method, wherein the announcement step is further based on the input feature report, and the HID report description element is one of the rounded feature report size items ^ numerical item. The input feature report is 19. If the patent application scope is 帛The steps of the square mode confluence arrangement described in the 13 items include: , and the execution of the burning is performed. 20. If the application is specific, in Tian Shu 70, the square of the long patent scope of the rounded feature report is declared. Length: Contains: " The announcement step is based on the output feature report, and the hid is reported to the citrus: the round-out feature report size item ": the fascia value item. The method of claim 13, wherein the content of the output feature report includes one of a burning command and a combination of a data, and the programming command is Manufacturer definition. 22. The firmware structure of a USB device, comprising: a programming module having a USB transmission function for implementing a programming function by using a USB interface, wherein when a write report request (Set_Report) is received The programming module performs programming according to the content of the first report of the write report request; a normal working module has a USB transmission function for implementing a specific product characteristic by using the USB transmission function, wherein When receiving a report content equal to a preset value, the normal working module saves a USB state and disables all USB-independent interrupts, and switches to the programming module; and a mode determining module, In order to activate the normal working module or the programming module according to a mode flag. 23. The architecture as recited in claim 22, wherein the programming module further comprises: when receiving a read report request (Get_Report), loading the second report by one of the read report requests To return the status or data of the USB device. 24. The structure as recited in claim 23, wherein the second report is a feature report or an input report, and the content of the second report is data. 25. The architecture as recited in claim 23, wherein the USB state comprises a length of the first report, a length of the second report, a presence of a feature report identification code, an enable state of each endpoint, and Suspension 21 200933486 態、USB位址以及組態狀態其中之一或其組合。 26.如申請專利範圍第22項所記載之架構,其中該第一報告為 一特徵報告或一輸出報告,且該第一報告的内容包含一燒 錄命令以及一資料其中之一或其組合。 22One or a combination of state, USB address, and configuration state. 26. The architecture as recited in claim 22, wherein the first report is a feature report or an output report, and the content of the first report includes one of a burn command and a profile or a combination thereof. twenty two
TW97103207A 2008-01-29 2008-01-29 Method for updating firmware and firmware architec TWI356343B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW97103207A TWI356343B (en) 2008-01-29 2008-01-29 Method for updating firmware and firmware architec

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW97103207A TWI356343B (en) 2008-01-29 2008-01-29 Method for updating firmware and firmware architec

Publications (2)

Publication Number Publication Date
TW200933486A true TW200933486A (en) 2009-08-01
TWI356343B TWI356343B (en) 2012-01-11

Family

ID=44865960

Family Applications (1)

Application Number Title Priority Date Filing Date
TW97103207A TWI356343B (en) 2008-01-29 2008-01-29 Method for updating firmware and firmware architec

Country Status (1)

Country Link
TW (1) TWI356343B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106201933A (en) * 2014-10-07 2016-12-07 新唐科技股份有限公司 Control device, controlled device and operation method

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102447755A (en) * 2010-10-15 2012-05-09 华晶科技股份有限公司 Method for connecting bending flexible circuit board in mobile phone and flexible circuit board
US11137995B2 (en) 2019-02-13 2021-10-05 International Business Machines Corporation Updating firmware of a microcontroller

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106201933A (en) * 2014-10-07 2016-12-07 新唐科技股份有限公司 Control device, controlled device and operation method
CN106201933B (en) * 2014-10-07 2019-03-22 新唐科技股份有限公司 control device, controlled device and operation method

Also Published As

Publication number Publication date
TWI356343B (en) 2012-01-11

Similar Documents

Publication Publication Date Title
TWI703498B (en) Memory device and associated boot code loading method of electronic device
CN107305534B (en) Method for simultaneously carrying out kernel mode access and user mode access
US20150261544A1 (en) Embedded System Boot from a Storage Device
JP4995737B2 (en) Method and device for initializing the startup procedure of a mobile device
TW201027426A (en) Systems and methods for managing endian mode of a device
US20120151231A1 (en) Power supply switching device, a power supply switching device control method and a power supply control program
US20100169546A1 (en) Flash memory access circuit
US20030226137A1 (en) Interface device, and method and computer readable product for updating firmware in the interface device
TWI816650B (en) Data storage device, controller and operating method thereof
CN112131156B (en) Data transmission method, system, electronic equipment and storage medium
TWI325561B (en) Embedded controller and computer system using the same
JP2008500656A (en) Method and system for processing jobs with two dual-role devices
TW200933486A (en) Method for updating firmware and firmware architecture
US20090049232A1 (en) Execute-in-place implementation for a nand device
TWI807384B (en) Storage device
JP4627636B2 (en) Mechanism for making asynchronous components an application framework agnostic
US20090106509A1 (en) Memory system and method of driving the same
WO2022007206A1 (en) Drawing command processing method, gpu, main device, terminal, and medium
JP2009223805A (en) Information processor and drive control method for device controller
JP2003108513A (en) Hardware chain pull
CN110618794B (en) Method and system for accessing NandFlash by SSD firmware
JP2003337784A (en) Control system and usb device
JP2007207089A (en) External storage device controller and program
JP2014067215A (en) Power-saving system and image forming device
EP2291749B1 (en) Exposing multi-mode audio device as a single coherent audio device