Patent Abstract:
A data storage device and a software method using same are described. The method dynamically relocates and includes; upon receiving a requirement to load a new code object to a first storage medium, allocating a dynamic relocation region of the first storage medium, writing information related a task to be performed in relation to the dynamic relocation region to a second storage medium, selecting the new code object from a plurality of code objects stored in the second storage medium, and loading the selected new code object to the allocated dynamic relocation region, and generating information for performing a task associated with the loaded new code object.

Full Description:
CROSS-REFERENCE TO RELATED APPLICATION 
       [0001]    This application claims the benefit of Korean Patent Application No. 10-2009-0029492 filed on Apr. 6, 2009, the subject matter of which is hereby incorporated by reference. 
       BACKGROUND 
       [0002]    The inventive concept relates to a data storage device and a software design method using same. 
         [0003]    In general, a memory used in a system-on-chip (SOC) configured to drive a disc drive has a fixed size. The size of this memory is typically small because the memory is essentially an embedded system. The resulting data storage capacity places significant limitation on the amount of programming code and related data that may be stored to control the functionality of an incorporating disc drive. 
         [0004]    Accordingly, there is a need to dynamically relocate code in a disc drive in order to enable the performance of various disc drive functions using a memory having a limited data storage capacity. 
       SUMMARY 
       [0005]    Embodiments of the inventive concept provide a method of dynamically relocating code objects which may be loaded during system operation. Embodiments of the inventive concept also provide a disc drive using a method of dynamically relocating code objects which may be loaded during system operation. 
         [0006]    According to an aspect of the inventive concept, there is provided a method of dynamically relocating code objects, wherein the method includes: allocating a dynamic relocation region of a first storage medium to which a new code object is to be loaded, when a requirement for loading the new code object to the first storage medium occurs; writing information about a task that has to be performed in the dynamic relocation region of the first storage medium to a second storage medium; selecting the new code object from a plurality of code objects stored in the second storage medium and loading the new code object to the dynamic relocation region allocated to the first storage medium; and generating information for performing a task corresponding to the loaded new code object. 
         [0007]    In the allocating of the dynamic relocation region, the dynamic relocation region of the first storage medium to which the new code object is to be loaded is allocated based on a priority sequence of tasks loaded to the first storage medium, wherein a task having lower priority is earlier selected. 
         [0008]    If the new code object to be written in the dynamic relocation region is a code object that has been executed before, information about a task stored in the second storage medium is used as information for performing a task corresponding to the new code object. 
         [0009]    If the new code object to be written in the dynamic relocation region is not a code object that has been executed before, information for performing a task corresponding to the new code object is initialized. 
         [0010]    The information for performing a task may include at least task control block information and stack information. 
         [0011]    The first storage medium includes a random access memory, and the second storage medium includes a disc. 
         [0012]    The information about a task that has been performed in the dynamic relocation region of the first storage medium is written in a maintenance cylinder region of the disc. 
         [0013]    According to an aspect of the inventive concept, there is provided a disc drive including: a first storage medium to which a code object, which corresponds to a task to be performed in a system, is loaded; a second storage medium which stores a plurality of code objects; and a processor which replaces at least one code object selected from code objects loaded to the first storage medium with at least one code object selected from code objects stored in the second storage medium, according to a code object dynamic relocation command. 
         [0014]    The processor may include a code object management unit which manages position information of code objects and task control block information and stack information for performing tasks corresponding to the code objects. 
         [0015]    The processor allocates a storage region of the first storage medium to which a new code object is to be loaded, according to a code object dynamic relocation command, stores information about a task that has been performed in the allocated storage region in the second storage medium, and reads the new code object to be loaded from the second storage medium and overwrites the new code object in the storage region allocated to the first storage medium. 
         [0016]    When the processor reads the new code object to be loaded from the second storage medium and overwrites the new code object in the storage region which is allocated to the first storage medium according to a code object dynamic relocation command, if the new code object to be loaded is a code object that has been executed before, information about a task that has been stored in the second storage medium is used as a task control block and stack information for performing a task corresponding to the new code object. 
         [0017]    The processor allocates a dynamic relocation region to the first storage medium, wherein the dynamic relocation region is a region to which a new code object is to be loaded, based on a priority sequence of tasks loaded to the first storage medium, wherein a task having lower priority is earlier selected. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0018]    Embodiments of the inventive concept will be more clearly understood from the following detailed description taken in conjunction with the accompanying drawings in which: 
           [0019]      FIG. 1  is a block diagram of a disc drive according to an embodiment of the inventive concept; 
           [0020]      FIG. 2  is a diagram conceptually illustrating a software operating system for a disc drive according to an embodiment of the inventive concept; 
           [0021]      FIG. 3  is a flowchart summarizing a method of dynamically relocating code objects according to an embodiment of the inventive concept; 
           [0022]      FIG. 4  is a general block diagram illustrating an example of operating a disc drive within an MP3 player using the method of dynamically relocating code objects according to an embodiment of the inventive concept; 
           [0023]      FIG. 5  is a conceptual diagram illustrating exemplary data processing for the MP3 player of  FIG. 4 ; and 
           [0024]      FIG. 6  is a perspective view of a head disc assembly included within a disc drive according to an embodiment of the inventive concept. 
       
    
    
     DETAILED DESCRIPTION OF THE EMBODIMENTS 
       [0025]    The present inventive concept, advantages of the inventive concept, and objectives achieved by embodiments of the inventive concept may be fully understood by referring to the attached drawings exemplarily illustrating embodiments of the inventive concept. Hereinafter, embodiments of the inventive concept will be described in some additional detail with reference to the attached drawings. 
         [0026]    Figure (FIG.)  1  is a block diagram of a disc drive according to an embodiment of the inventive concept. Referring to  FIG. 1 , the disc drive comprises a processor  110 , a read only memory (ROM)  120 , a random access memory (RAM)  130 , a media interface (I/F)  140 , a media  150 , a host interface (I/F)  160 , a host device ( 170 ), an external interface (I/F)  180 , and a bus ( 190 ). 
         [0027]    The processor  110  interprets a command and controls constituent elements of the disc drive according to the interpreted results. The processor  110  includes a code object management unit (not shown) that loads a code object stored in the media  150  to the RAM  130 . In addition, the processor  110  controls in such a way that code objects loaded in the RAM  130  are dynamically relocated, as will be described in some additional detail hereafter. 
         [0028]    The ROM  120  stores program codes and data for operating the disc drive. 
         [0029]    The program codes and data stored in the ROM  120  or the media  150  are loaded to the RAM  130  according to a control of the processor  110 . In the illustrated embodiment, code objects loaded to the RAM  130  are dynamically relocated according to a control of the processor  110 . 
         [0030]    In certain embodiments of the inventive concept, the media  150  includes a disc that is a major storage medium of the disc drive. For example,  FIG. 6  is a perspective view of a head disc assembly including a disc in a disc drive according to an embodiment of the inventive concept. 
         [0031]    Referring to  FIG. 6 , the head disc assembly includes at least one disc  12  which is rotated by a spindle motor  14 . The disc drive may also include a transducer  16  disposed close to the surface of the disc  12 . 
         [0032]    The transducer  16  reads information from the disc  12  or writes information to the disc by detecting a magnetic field of the disc  12  or magnetizing the disc  12 . In general, the transducer  16  may be coupled with the surface of the disc  12 . Although  FIG. 6  illustrates only one transducer  16 , the transducer  16  may consist of a write transducer for magnetizing the disc  12  and a read transducer for detecting a magnetic field from the disc  12 . The read transducer may include a magneto-resistive (MR) device. In general, the transducer  16  is referred to as a head. 
         [0033]    The transducer  16  may be incorporated into a slider  20 . The slider  20  is structured such that an air bearing is formed between the transducer  16  and the surface of the disc  12 . The slider  20  is combined with a head gimbals assembly  22 . The head gimbals assembly  22  is attached to an actuator arm  24  including a voice coil  26 . The voice coil  26  is disposed adjacent to a magnetic assembly  28  to define a voice coil motor (VCM)  30 . The current provided to the voice coil  26  generates a torque for rotating the actuator arm  24  with respect to the bearing assembly  32 . Due to the rotation of the actuator arm  24 , the transducer  16  crosses over the surface of the disc  12 . 
         [0034]    The disc  12  includes a plurality of tracks  34  which are annular. In general, information is stored in the tracks  34  of the disc  12 , wherein each of the tracks  34  generally includes a plurality of sectors that each includes a data field and an identification field. The identification field includes a gray code for identifying a sector and a track cylinder. A logic block address is allocated to a recordable region of the disc  12 . The logic block address of the disc drive is converted into cylinder/head/sector information and stored in the recordable region of the disc  12 . The disc  12  includes a maintenance cylinder region to which a user has no access and a user data region to which a user has access. The transducer  16  crosses over the surface of the disc  12  to read information of other tracks or write information thereon. 
         [0035]    A plurality of code objects may be stored in the disc  12  to perform various functions using the disc drive. For example, a code object for performing an MP3 playing function, a code object for performing a navigation function, a code object for performing various video games may be stored in the disc  12 . 
         [0036]    Referring again to  FIG. 1 , the media interface  140  allows the processor  110  to access to the media  150 , such that the processor  110  writes/reads data. The media interface  140  may include a servo circuit (not shown) for controlling the head disc assembly and a reading/writing channel circuit (not shown) for performing a signal process for data reading/writing. 
         [0037]    The host interface  160  enables data read/write processing together with a host device such as a personal computer. For example, examples of the host interface  160  include a serial advanced technology attachment (SATA) interface, a parallel advanced technology attachment (PATA) interface, and a universal serial bus (USB) interface. 
         [0038]    The external interface  180  enables data read/write processing together with an external device via input/output (I/O) terminals installed in the disc drive. Examples of the external interface  180  include an accelerated graphics port (AGP) interface, a USB interface, an IEEE1394 interface, a personal computer memory card international association (PCMCIA) interface, a LAN interface, a Bluetooth interface, a high definition multimedia interface (HDMI), a programmable communication interface (PCI), an industry standard architecture (ISA) interface, a peripheral component interconnect-express (PCI-E) interface, an express card interface, a SATA interface, a PATA interface, and a serial interface. 
         [0039]    The bus  190  delivers data between constituent components of the disc drive. 
         [0040]    Operation of dynamically relocating code objects in the disc drive by the processor  110  will now be described in some additional detail with reference to  FIG. 2  which conceptually illustrates a software operating system. 
         [0041]    Referring to  FIG. 2 , the media  150 , for example, hard disc drive (HDD) media stores a plurality of code objects  1  through N. 
         [0042]    The ROM  120  stores a boot image and a packed real time operating system (RTOS) image. 
         [0043]    In the illustrated embodiment of  FIG. 2 , the HDD media  150  is assumed to be a magnetic disc. The plurality of code objects stored on the disc may include a code objects for operating a disc drive and code objects related to various functions to be performed in the disc drive. For example, code objects for performing an MP3 player function, a navigation function, or a video game function may be stored in the disc. 
         [0044]    An unpacked RTOS image obtained by reading a boot image from the ROM  120  is loaded to the RAM  130 . In addition, code objects, which are stored in the HDD media  150  and required to perform a host interface and an external interface, are loaded to the RAM  130 . The RAM  130  may include a data storage region DATA AREA. 
         [0045]    A channel circuit  200  includes a circuit for performing a signal process for data reading/writing, and a servo circuit  210  includes circuits for controlling the head disc assembly to perform data reading/writing. 
         [0046]    An RTOS  110 A is a multi-program operating system using a disc. According to various assigned tasks (and related commands), the RTOS  110 A performs real-time multiprocessing in a foreground having higher priority, and batch processing in a background having lower priority. In addition, the RTOS  110 A loads code objects from the disc and unloads code objects to the disc. 
         [0047]    The RTOS  110 A manages a code object management unit (COMU)  110 - 1 , a code object loader (COL)  110 - 2 , a memory handler (MH)  110 - 3 , a channel control module (CCM)  110 - 4 , and a servo control module (SCM)  110 - 5 , and performs tasks corresponding to required commands. The RTOS  110 A also manages an application program  220 . 
         [0048]    The COMU  110 - 1  stores position information indicating where code objects are stored, converts a virtual address into an actual address, and performs bus arbitration. The COMU  110 - 1  also stores priority information related to tasks to be performed. In addition, the COMU  110 - 1  manages task control block (TCB) information and stack information for performing tasks corresponding to code objects. 
         [0049]    The COL  110 - 2  loads code objects stored in the HDD media  150  to the RAM  130 , or unloads code objects stored in the RAM  130  onto the HDD media  150 , by using the COMU  110 - 1 . 
         [0050]    The HM  110 - 3  writes data to or reads data from the ROM  120  or the RAM  130 . 
         [0051]    The CCM  110 - 4  performs a channel control for performing signal processing during read/write processing, and the SCM  110 - 5  performs a servo control including the head disc assembly to perform read/write processing. 
         [0052]    Initially, while the disc drive is being booted up, the RTOS  110 A loads code objects for controlling a disc drive to the RAM  130 . Then, after boot-up of the disc drive, it may be driven by using the code objects loaded to the RAM  130 . 
         [0053]    If code objects need to be dynamically relocated in order to perform additional functions, excluding functions that are performed using the code objects which have been loaded to the RAM  130 , when the disc drive operates, the RTOS  110 A relocates the code objects that have been loaded to the RAM  130  by using the COMU  110 - 1  in the following manner. 
         [0054]    First, when dynamic relocation of code objects is required, the RTOS  110 A selects tasks corresponding to code objects which have been loaded to the RAM  130  in such a sequence that a task having lower priority is earlier selected, by using the COMU  110 - 1 . Then, the RTOS  110 A writes TCB information and stack information of the selected task to the disc, by using the COL  110 - 2 . In the illustrated embodiment of  FIG. 2 , the disc may be the HDD media  150 . The TCB information and stack information of the selected task may be stored in a maintenance cylinder region of the disc. 
         [0055]    The RTOS  110 A obtains position information regarding where a code object is to be newly stored using the COMU  110 - 1 , and then overwrites the new code object selected from code objects stored in the disc in a region of the RAM  130  where the task having lowest priority has been present using the COL  110 - 2 . 
         [0056]    Then, the RTOS  110 A determines, using the COMU  110 - 1 , whether the new code object has ever been executed before. If the new code object has been executed before, the RTOS  110 A reads TCB information and stack information related to the corresponding code object from the disc and determines the read TCB information and stack information as TCB information and stack information for performing a task corresponding to the new code object that has been loaded to the RAM  130 . Otherwise, if the newly loaded code object has not been executed before, TCB and stack information, which is task information about the newly loaded code object, is initialized. 
         [0057]    By performing these operations described above, a code object for performing a new function may be loaded to the RAM  130  without re-starting the system. 
         [0058]    Now, a method of dynamically relocating code objects, according to an embodiment of the inventive concept will be described with reference to  FIGS. 1 and 3 . 
         [0059]    First, the processor  110  determines whether dynamic relocation of code objects is required (S 310 ). The dynamic relocation of code objects is required in the case in which, after booting up, code objects, which have been loaded to the RAM  130 , need to be replaced with new code objects. The code object dynamic relocation requirement may be received from the host device  170 , and also, from a device connected to the external interface  180 . 
         [0060]    If dynamic relocation of code objects is required, the processor  110  allocates a dynamic relocation region to a first storage medium, by using the code object management unit (COMU) included in the processor  110  (S 320 ). In certain embodiments of the inventive concept, the first storage medium may be the RAM  130 . An exemplary method of allocating the dynamic relocation region will be described in some additional detail. Code objects, which have been loaded to the RAM  130 , are selected in a priority sequence, that is, a task having lower priority is earlier selected. Then, a region in which the selected task is performed is allocated as the dynamic relocation region. 
         [0061]    TCB information and stack information, which are information about the region allocated as the dynamic relocation region in operation  5310 , are written in a second storage medium (S 330 ). In the illustrated present embodiment, the second storage medium may be a disc; that is, the HDD media  150 . For example, the TCB information and stack information, which are information about the region allocated as the dynamic relocation region, may be stored in a maintenance cylinder region of the disc. 
         [0062]    Then, a new code object which is required among code objects stored in the second storage medium may be read and overwritten in the dynamic relocation region allocated in the first storage medium (S 340 ). 
         [0063]    Then, it is identified whether the new code object, which is loaded to the dynamic relocation region of the first storage medium, has been executed before (S 350 ). This identification operation may be performed using a code object history stored in a COMU. 
         [0064]    If it is identified in operation S 350  that the new code object is a code object that has been loaded before, TCB information and stack information related to the corresponding code object are read from the second storage medium and set as TCB information and stack information for performing a task corresponding to the new code object that is loaded to the RAM  130  (S 360 ). 
         [0065]    Otherwise, if it is identified that the new code object is not a code object that has been loaded before, TCB information and stack information for performing a task corresponding to the new code object are initialized (S 370 ). 
         [0066]    As described above, dynamic relocation of code objects is performed when a hard disc drive boots up and is being executed. 
         [0067]    An example of operating a disc drive as an MP3 by applying the method of dynamically relocating code objects to a disc drive will be described in some additional detail with reference to  FIG. 4 .  FIG. 4  is a block diagram illustrating one application embodiment for operating the disc drive as the MP3 player using a method of dynamically relocating code objects to the disc drive according to an embodiment of the inventive concept. 
         [0068]    As illustrated in  FIG. 4 , the disc drive comprises a processor  110 , a ROM  120 , a RAM  130 , a HDD media  150 , and a digital/analog converter  230 . 
         [0069]    The HDD media  150  includes, in addition to code objects for operating the disc drive itself, an MP3 decoding code  150 - 1 , and an MP3 file  150 - 2 . 
         [0070]    When an MP3 player function is needed to be performed in the disc drive during when the disc drive boots up and code objects for operating the disc drive are loaded and executed, the processor  110  loads the MP3 decoding code  150 - 1  stored in the HDD media  150  to the RAM  130  by using the method of dynamically relocating code objects as described above. 
         [0071]    Then, according to an input command, the processor  110  reads the MP3 file  150 - 2  from the HDD media  150  and loads the MP3 file  150 - 2  to the RAM  130 . The MP3 file  150 - 2  loaded to the RAM  130  is decoded by using the MP3 decoding code  150 - 1  that has been loaded to the RAM  130  and then outputs to the digital/analog converter  230 . 
         [0072]    The digital/analog converter  230  converts a digital signal processed by MP3 decoding into an analog signal and outputs the analog signal to a speaker (not shown). As such, the disc drive performs an MP3 player function. 
         [0073]      FIG. 5  further conceptually illustrates the data processing of  FIG. 4 . 
         [0074]    The HDD media  150 , the RAM  130 , and a Queue buffer  130 - 3  may be included in a disc drive  1000 , and the digital/analog converter  230  and a speaker  240  may be included in an external device  2000  which is connected to an external interface of the disc drive  1000 . In certain embodiments of the inventive concept, all of the constituent elements of the external device  2000  may be included in the disc drive  1000 . In other embodiments, only the digital/analog converter  230  may be included in the disc drive  1000 . 
         [0075]    In a case in which an MP3 decoding code  130 - 2  is loaded to the RAM  130  using the method of dynamically relocating code objects, when a command for MP3 playing is input through an input interface, the processor  110  reads an MP3 file from the HDD media  150  and loads the MP3 file to the RAM  130 . 
         [0076]    Then, according to a control of the processor  110 , an MP3 file  130 - 1  is decoded by using the MP3 decoding code  130 - 2  in the RAM  130  and outputs the decoded MP3 file to the Queue buffer  130 - 3 . Then, data which is stored in the Queue buffer  130 - 3  is output to the digital/analog converter  230  through the external interface in a given sequence, and an analog signal processed by the digital/analog converter  230  is output to the external device  240 . 
         [0077]    Thus, without adding a separate MP3 decoding circuit to the disc drive  1000 , only with software design, the disc drive  1000  can be operated as an MP3 player. 
         [0078]    Referring back to  FIG. 1 , various functions may be performed by the disc drive by storing code objects for performing additional functions, in addition to code objects for driving the disc drive, in the media  150 , and dynamically relocating code objects that have been loaded to the RAM  130  after booting up. 
         [0079]    When code objects for performing other functions, such as a MP player function, a navigation function, or a video game function, in addition to the unique function of the disc drive, are stored in the media  150  and the method of dynamically relocating code objects is applied to the disc drive, various functions excluding the unique function of the disc drive can be performed by using the disc drive. 
         [0080]    That is, by using the method of dynamically relocating code objects, the disc drive can be operated as an MP3 player, a navigation device, or a video game device. Specifically, to operate the disc drive as an MP3 player, the external interface  180  needs to be connected to the digital/analog converter and the external device  240  illustrated in  FIG. 5 . In addition, to operate the disc drive as a navigation device, a display device needs to be connected to the external interface  180 . 
         [0081]    Thus, when dynamic relocation of code objects is performed in the disc drive according to a device connected to the external interface  180 , the disc drive can be operated as various devices according to software design. 
         [0082]    The dynamic relocation of code objects may also be performed corresponding to a device connected through the host interface  160 , not the external interface  180 . 
         [0083]    By reference, the disc drive can be operated as a communications storage by, for example, adding a TCP/IP acceleration engine and a module for supporting Ethernet media access control (MAC) to the processor  110  and then dynamically relocating software related thereto. 
         [0084]    While the inventive concept has been particularly shown and described with reference to exemplary embodiments thereof, it will be understood that various changes in form and details may be made therein without departing from the scope of the following claims.

Technology Classification (CPC): 6