[go: up one dir, main page]

WO2013182098A1 - Method and device for multicore terminal sharing resources - Google Patents

Method and device for multicore terminal sharing resources Download PDF

Info

Publication number
WO2013182098A1
WO2013182098A1 PCT/CN2013/078108 CN2013078108W WO2013182098A1 WO 2013182098 A1 WO2013182098 A1 WO 2013182098A1 CN 2013078108 W CN2013078108 W CN 2013078108W WO 2013182098 A1 WO2013182098 A1 WO 2013182098A1
Authority
WO
WIPO (PCT)
Prior art keywords
core
shared
current
register
frequency
Prior art date
Application number
PCT/CN2013/078108
Other languages
French (fr)
Chinese (zh)
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
Priority claimed from CN201210413307.5A external-priority patent/CN103778014B/en
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2013182098A1 publication Critical patent/WO2013182098A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • G06F9/526Mutual exclusion algorithms

Definitions

  • the present invention relates to the field of mobile communication technologies, and in particular, to a method and apparatus for sharing resources by a multi-core terminal.
  • Embodiments of the present invention provide a method and an apparatus for sharing resources by a multi-core terminal, which are intended to implement protection and coordinated use of public resources.
  • the method for sharing resources by the multi-core terminal includes:
  • the shared resource parameter is set according to the information stored in the shared mutex register for resource sharing.
  • the shared resource includes at least one of the following: a multi-core frequency modulation, a radio frequency (RF) common resource, an I2C bus, and a universal asynchronous transceiver transmitter (UART) serial port.
  • RF radio frequency
  • I2C I2C bus
  • UART universal asynchronous transceiver transmitter
  • the multi-core terminal includes a first core and a second core.
  • the step of setting the shared resource parameter according to the information stored in the shared mutual exclusion register includes: Setting a status bit of the shared mutex register to a non-idle state;
  • the step of setting the current core voltage and the current frequency of the first core according to the comparison result comprises:
  • the pre-adjusted core frequency is greater than a current frequency of the first core, reading a current core voltage from the shared mutually exclusive register, and comparing with a pre-adjusted core voltage;
  • the pre-adjusted core frequency is less than a current frequency of the first core, setting a current frequency of the first core; reading a current core voltage from the shared mutex register, and comparing with a pre-adjusted core voltage; Reading the core voltage allowed by the second core from the shared mutual exclusion register when the pre-adjusted core voltage is greater than the current core voltage; taking the pre-adjusted core voltage and the nuclear voltage allowed by the second core The larger one is set to the current core voltage.
  • the multi-core terminal includes a first core and a second core.
  • the step of setting the shared resource parameter according to the information stored in the shared mutex register includes:
  • the step of setting the shared resource parameter according to the information stored in the shared mutex register includes:
  • the above method further includes:
  • a device for sharing resources by a multi-core terminal comprising:
  • a status bit reading module configured to: read a status bit of the shared mutex register when one of the cores of the multi-core terminal needs to operate the shared resource;
  • the resource sharing module is configured to: when the status bit of the shared mutex register is idle, set the shared resource parameter according to the information stored in the shared mutex register for resource sharing.
  • the shared resource includes at least one of the following: a multi-core frequency modulation, a radio frequency (RF) common resource, an I2C bus, and a universal asynchronous transceiver transmitter (UART) serial port.
  • RF radio frequency
  • I2C I2C bus
  • UART universal asynchronous transceiver transmitter
  • the multi-core terminal includes a first core and a second core, and when the first core needs to perform frequency modulation and voltage regulation, the resource sharing module includes:
  • a setting unit configured to set a status bit of the shared mutex register to a non-idle state
  • a reading unit configured to read a current frequency of the first core from the shared mutex register, and Pre-adjust the nuclear frequencies for comparison
  • a setting unit configured to set a current core voltage and a current frequency of the first core according to the comparison result
  • An update unit configured to set the current core voltage, a current frequency of the first core, and The minimum core voltage allowed by the first core is written into the shared mutex register, respectively.
  • the setting unit is further configured to: when the pre-adjusted core frequency is greater than a current frequency of the first core, read a current core voltage from the shared mutual exclusion register, and compare with a preset nuclear voltage; Reading the core voltage allowed by the second core from the shared mutual exclusion register when the pre-adjusted core voltage is greater than the current core voltage; taking the pre-adjusted core voltage and the nuclear voltage allowed by the second core The larger one is set to the current core voltage; the current frequency of the first core is set; when the pre-adjusted kernel frequency is less than the current frequency of the first core, the current frequency of the first core is set; The shared mutex register reads the current core voltage and compares with the pre-adjusted core voltage; when the pre-adjusted core voltage is greater than the current core voltage, reads from the shared mutex register that the second core allows The core voltage; the larger of the pre-adjusted core voltage and the core voltage allowed by the second core is set
  • the multi-core terminal includes a first core and a second core, and when the first core needs to adjust a system bus frequency, the resource sharing module includes:
  • a setting unit configured to set a status bit of the shared mutex register to a non-idle state
  • a reading unit configured to: read a current bus frequency of the system from the shared mutex register, the second The minimum system bus frequency allowed by the core
  • a setting unit configured to: compare a preset core frequency, a current bus frequency of the system, and a minimum system bus frequency allowed by the second core; wherein the largest one is set to the current bus frequency of the system; and the update unit is set to: The current bus frequency of the system and the lowest system bus frequency allowed by the second core are respectively written into the shared mutex register.
  • the multi-core terminal includes a first core and a second core.
  • the resource sharing module includes: a reading unit, configured to: Reading a RF common resource status from the shared mutex register when a core wants to enter a sleep state or when waking up;
  • the setting unit is configured to: when any one of the multi-core terminals wants to enter a sleep state and the RF common resource state is an active state, setting the RF common resource state to a power-saving state; or Retrieving the RF common resource state to an active state when any of the multi-core terminals is awake and the common resource state is a power-saving state;
  • the update unit is configured to: write a current state of the RF common resource to the mutual Rejected in the shared register.
  • the setting unit is further configured to: when the resource sharing is completed, return the status bit of the shared mutex register to an idle state.
  • a method and device for sharing resources by a multi-core terminal when there are multiple shared resources, the shared mutual exclusion register is used to protect and coordinate the use of shared resources, thereby coordinating each Checking the allocation of shared resources improves the utilization of public resources and improves the overall performance of the terminal system.
  • FIG. 1 is a schematic flowchart of a method for sharing resources of a multi-core terminal according to an embodiment of the present invention
  • FIG. 2 is a schematic structural diagram of an apparatus for sharing resources of a multi-core terminal according to the present invention
  • the solution of the embodiment of the present invention is mainly: For a multi-core terminal, when there are multiple shared resources, the shared mutual exclusion register is used to protect and coordinate the use of the shared resource.
  • the multi-core terminal in the embodiment of the present invention refers to a terminal that includes two or more CPU cores (hereinafter referred to as a core).
  • a core The following embodiments are described by taking the terminal of the current dual-core shared architecture as an example.
  • an embodiment of the present invention provides a method for sharing resources by a multi-core terminal, including: Step S101: When one of the cores of the multi-core terminal needs to share resources, read a status bit of the shared mutual exclusion register;
  • shared resources refer to resources that can be accessed and operated by each core, including bus, memory, and peripherals, including but not limited to multi-core FM, RF common resources, I2C bus, and UART serial port.
  • a core in a multi-core terminal requires operating system bus frequency or common resources such as nuclear voltage, RF resources, and public I2C bus, it will affect the performance of other cores, so when any of the core dynamics When operating public resources, it is necessary to adjust the parameters and requirements of the other party. In addition, it is necessary to avoid conflicts caused by the simultaneous operation of resources by both parties.
  • This embodiment utilizes a shared mutex register to protect and coordinate the use of shared resources to ensure that each core can use shared resources normally.
  • the shared mutex register can be a 32-bit register, the lowest bit indicates the status bit, and the other 31 bits can be used by multiple cores.
  • the status bit of the shared mutex register is read to set the corresponding parameter according to the status bit of the shared mutex register.
  • Step S102 When the status bit of the shared mutex register is idle, set the corresponding parameter according to the information stored in the shared mutex register for resource sharing.
  • the status bit of the shared mutex register Determining whether the status bit of the shared mutex register is idle, when the status bit of the shared mutex register is not idle, indicating that the peer has control over the shared resource, and the current core cannot use the resource; when the shared mutex register is When the status bit is idle, the corresponding parameters can be adjusted according to the information stored in the shared mutex register to implement resource sharing.
  • setting parameters you need to set the status bit of the shared mutex register to non-idle state. After the resources are shared, you need to return the status bit of the shared mutex register to the idle state.
  • Example 1 Application scenario for multi-core dynamic frequency modulation and voltage regulation:
  • the shared mutex register is a 32-bit register, the lowest bit indicates the status bit, and the other 31 bits can be used by the dual core.
  • the lowest bit of the shared mutex register is read first.
  • the lowest bit of the shared mutex register read is idle, the corresponding frequency and core voltage settings can be performed. Otherwise, , need to wait for the lowest bit of the shared mutex register to be idle.
  • the two cores in the multi-core terminal are respectively set as the first core and the second core, and the implementation process of dynamically adjusting the clock and voltage of the multi-core shared architecture is as follows:
  • the lowest bit [0] of the shared mutex register is read first, and when bit [0] is 0, the sharing is indicated.
  • the mutex register is idle and can be used at present; when bit[0] is read as 1, the shared mutex register cannot be used;
  • the up-sequence process is followed; otherwise, the entire up-conversion process is exited;
  • the bit [5-4] in the shared mutex register is read, the current core voltage is obtained, and the pre-adjusted core voltage is compared with the current core voltage. If the pre-adjusted core voltage is greater than the current core voltage, Take the boost process, otherwise exit the boost process.
  • the pre-adjusted core frequency is less than the current frequency of the first core, first setting a current frequency of the first core; then reading the current core voltage from the shared mutex register, and pre-adjusting The core voltage is compared; when the pre-adjusted core voltage is greater than the current core voltage, the core voltage allowed by the second core is read from a bit [7-6] of the shared mutually exclusive register; The larger of the nucleation voltage and the nuclear voltage allowed by the second core is set to the current core voltage.
  • the current core voltage, the current frequency of the first core, and the minimum core voltage allowed by the first core are respectively written into corresponding bit bits [5-4] and bit[3 in the shared mutual exclusion register. -l], bit[9-8].
  • the lowest bit [0] of the shared mutex register is read first, and when it is read as 0, the shared mutex register is indicated. Idle, currently available; otherwise the shared mutex register cannot be used.
  • Example 2 Application scenario corresponding to the use of RF common resources by multiple cores:
  • a top-level shared mutex register needs to be designed to implement multi-core shared resources by using the shared mutex register.
  • the shared mutex register is a 32-bit register, the lowest bit indicates the status bit, and the other 31 bits can be used for the dual core.
  • the lowest bit of the shared mutex register is read first.
  • the lowest bit of the shared mutex register read is idle, the corresponding RF resource operation and setting can be performed.
  • the lowest bit of the shared mutex register is not idle, it needs to wait for the bit to be idle.
  • the implementation process of multi-core shared RF public resource usage is as follows: 1) When any core goes to sleep to operate the common resource to enter the power-saving state, the RF mutex shared register status bit must be read first, and must wait until bit[0] is 0. At this time, read the RF mutex shared register.
  • the other party's core RF common resource status bit[l] if it is 0, the corresponding RF common resource is set to the power saving state, and then the current state is set to the corresponding bit of the RF mutual exclusion shared register, and finally the RF mutual exclusion sharing is configured.
  • Register status bit bit[0] is 0, releasing control right;
  • Example 3 Application scenario corresponding to the use of common 12 C bus resources by multiple cores:
  • this register is a 32-bit register, the lowest bit indicates the status bit, and the other 31 bits can be used for the dual core.
  • the lowest bit of the shared mutex register is read first. When the read is idle, the common I2C bus can be used. When the read is non-idle, it needs to wait for the The bit is idle. When the operation is completed, the lowest bit of the shared mutex register needs to be set to 0, and the control right is released, and the other party can use it.
  • the I2C bus mutual exclusion shared register status bit, bit[0], must be set to 1 to release control so that other cores can use the common resource.
  • the embodiment can solve the allocation and use of the multi-core shared architecture/shared resources, and can not only effectively solve the use of the public resource UART serial port, the RF resource, etc., but also can solve the multi-core DVFS frequency modulation and voltage adjustment implementation scheme, thereby improving the scheme.
  • the overall performance of the terminal has a significant effect. For example, solving the multi-core shared architecture for dynamic frequency modulation and voltage regulation can significantly improve the standby of the system. Power consumption in scenarios such as calls and Internet access, extending the user's time spent on the battery.
  • the implementation of the dual-core or more-core shared architecture/shared resource is implemented by using the shared mutual exclusion register, and the implementation may be extended based on the foregoing solution of the embodiment, and details are not described herein again.
  • an embodiment of the present invention provides a device for sharing resources by a multi-core terminal, including: a status bit reading module 201 and a resource sharing module 202, where:
  • the status bit reading module 201 is configured to read a status bit of the shared mutex register when one of the cores of the multi-core terminal needs to share resources;
  • the resource sharing module 202 is configured to: when the status bit of the shared mutex register is idle, set corresponding parameters according to the information stored in the shared mutex register for resource sharing.
  • shared resources refer to resources that can be accessed and operated by each core, including bus, memory, and peripherals, including but not limited to multi-core FM, RF common resources, I2C bus, and UART serial port.
  • a core of a multi-core terminal requires operating system bus frequency or common resources such as nuclear voltage, RF resources, and public I2C bus, it will affect the performance of other cores. Therefore, when any core dynamically operates a common resource, it needs to combine the other parameters. And the requirements are adjusted. In addition, it is necessary to avoid conflicts caused by the simultaneous operation of resources by both parties.
  • This embodiment utilizes a shared mutex register to protect and coordinate the use of shared resources to ensure that each core can use shared resources normally.
  • the shared mutex register is a 32-bit register. The lowest bit indicates the status bit. The other 31 bits can be used by the dual core.
  • the status bit reading module 201 reads the status bit of the shared mutex register, so that the resource sharing module 202 sets the corresponding parameter according to the status bit of the shared mutex register.
  • the resource sharing module 202 first determines whether the status bit of the shared mutex register is idle. When the status bit of the shared mutex register is not idle, it indicates that the peer has control over the shared resource, and the current core cannot use the resource; When the status bit of the shared mutex register is idle, The information stored in the shared mutex register adjusts the corresponding parameters to achieve resource sharing. When setting parameters, you need to set the status bit of the shared mutex register to non-idle state. After the resources are shared, you need to return the status bit of the shared mutex register to the idle state.
  • the resource sharing module 202 includes: a setting unit 2021, a reading unit 2022, a setting unit 2023, and an updating unit 2024, where:
  • the setting unit 2021 is configured to set the state position of the shared mutual exclusion register to a non-idle state.
  • the reading unit 2022 is configured to read the current frequency of the first core from the shared mutex register and compare it with the pre-adjusted core frequency;
  • the setting unit 2023 is configured to set a current core voltage and a current frequency of the first core according to the comparison result
  • the updating unit 2024 is configured to separately write the current core voltage, the current frequency of the first core, and the minimum core voltage allowed by the first core into corresponding bits in the shared mutex register.
  • the setting unit 2023 is further configured to: when the pre-adjusted core frequency is greater than a current frequency of the first core, read a current core voltage from the shared mutex register, and compare with a pre-adjusted core voltage.
  • the shared mutual exclusion register reads the current core voltage and compares with the preset core voltage; when the preset core voltage is greater than the current core voltage, reading the second core permission from the shared mutual exclusion register The core voltage; the larger of the pre-adjusted core voltage and the core voltage allowed by the second core is set to the current core voltage.
  • the reading unit 2022 is further configured to read the current bus frequency of the system and the lowest system allowed by the second core from the shared mutual exclusion register. Bus frequency
  • the setting unit 2023 is further configured to compare the preset core frequency, the current bus frequency of the system, and the lowest system bus frequency allowed by the second core; wherein the largest one is set to the current bus frequency of the system; the update unit 2024 is further configured to The current bus frequency of the system and the lowest system bus frequency allowed by the second core are respectively written into corresponding bits in the shared mutex register.
  • the reading unit 2022 is further configured to read from the shared mutual exclusion register when any of the multi-core terminals wants to enter a sleep state or when awake The RF common resource state;
  • the setting unit 2023 is further configured to: when any one of the multi-core terminals wants to enter a sleep state and the corresponding RF common resource state is an active state, the corresponding RF common resource The state is set to a power-saving state; or, when any one of the multi-core terminals is awake and the corresponding RF common resource state is a power-saving state, the corresponding RF common resource state is restored to a working state. ;
  • the update unit 2024 is further configured to write the current state of the RF common resource into the corresponding bit of the mutually exclusive shared register.
  • the setting unit 2021 is further configured to return the status bit of the shared mutex register to an idle state after the resource sharing is completed.
  • the method and device for sharing resources by a multi-core terminal when there are multiple shared resources, the shared mutual exclusion register is used to protect and coordinate the use of the shared resource, and one of the cores in the multi-core terminal needs to be used.
  • the status bit of the shared mutex register is read; when the status bit of the shared mutex register is idle, the corresponding parameter is set according to the information stored in the shared mutex register for resource sharing, thereby coordinating the check resources of the shared resources. Distribution increases the utilization of public resources and improves the overall performance of the terminal system.
  • Embodiments of the present invention coordinate the allocation of shared resources by each core, improve the utilization rate of public resources, and improve the overall performance of the terminal system.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Power Sources (AREA)
  • Telephone Function (AREA)

Abstract

Embodiments of the present invention relate to a method and a device for a multicore terminal sharing resources. The method comprises: when one core in the multicore terminal needs to share the resources, reading a status bit of a shared mutex register; when the status bit of the shared mutex register is idle, setting a corresponding parameter according to information stored by the shared mutex register to perform resource sharing. According to the embodiments of the present invention, when the multicore terminal has multiple shared resources currently, the shared mutex register is used to protect and coordinate a use of the shared resources, therefore coordinating allocation of the shared resources performed by the cores, which improves a use rate of public resources, and meanwhile, improves overall performance of a terminal system.

Description

多核终端共享资源的方法及装置 技术领域  Method and device for sharing resources by multi-core terminal
本发明涉及移动通信技术领域, 尤其涉及一种多核终端共享资源的方法 及装置。  The present invention relates to the field of mobile communication technologies, and in particular, to a method and apparatus for sharing resources by a multi-core terminal.
背景技术 Background technique
随着系统集成技术和无线通信技术的快速发展,尤其是无线通信系统中, 多核智能机终端的大量出现,导致各 CPU核在操作很多公共资源时出现冲突。 例如, 当某一个 CPU核需要调整系统总线频率或核电压时, 会影响其它核的 性能, 若各 CPU核同时进行调频调压, 则会产生冲突; 又如, 当某一个 CPU 核需要操作公共 RF (射频) 资源时, 会影响其它核的功能, 若各 CPU核同 时操作公共 RF资源, 同样会造成资源使用冲突, 对于其他公共资源的使用, 同样存在冲突问题。 发明内容  With the rapid development of system integration technology and wireless communication technology, especially in wireless communication systems, a large number of multi-core intelligent machine terminals have appeared, resulting in conflicts between CPU cores when operating many common resources. For example, when a CPU core needs to adjust the system bus frequency or core voltage, it will affect the performance of other cores. If the CPU cores perform frequency modulation and voltage regulation at the same time, conflicts will occur; for example, when a certain CPU core needs to operate publicly. When the RF (radio frequency) resource affects the functions of other cores, if the CPU cores operate the common RF resources at the same time, the resource usage conflict will also occur. For other public resources, there are also conflicts. Summary of the invention
本发明实施例提供一种多核终端共享资源的方法及装置, 旨在实现公共 资源的保护与协调使用。  Embodiments of the present invention provide a method and an apparatus for sharing resources by a multi-core terminal, which are intended to implement protection and coordinated use of public resources.
该多核终端共享资源的方法, 包括:  The method for sharing resources by the multi-core terminal includes:
当多核终端中的其中一核需要操作共享资源时, 读取共享互斥寄存器的 状态位;  When one of the cores of the multi-core terminal needs to operate the shared resource, the status bit of the shared mutex register is read;
当所述共享互斥寄存器的状态位为空闲时, 依据所述共享互斥寄存器存 储的信息设置共享资源参数以进行资源共享。  When the status bit of the shared mutex register is idle, the shared resource parameter is set according to the information stored in the shared mutex register for resource sharing.
优选地, 所述共享资源至少包括以下之一: 多核调频调压、 射频(RF ) 公共资源、 I2C总线以及通用异步收发传输器(UART ) 串口。  Preferably, the shared resource includes at least one of the following: a multi-core frequency modulation, a radio frequency (RF) common resource, an I2C bus, and a universal asynchronous transceiver transmitter (UART) serial port.
优选地, 所述多核终端包括第一核和第二核, 当所述第一核需要进行调 频调压时, 所述依据共享互斥寄存器存储的信息设置共享资源参数的步骤包 括: 将所述共享互斥寄存器的状态位设置为非空闲状态; Preferably, the multi-core terminal includes a first core and a second core. When the first core needs to perform frequency modulation and voltage regulation, the step of setting the shared resource parameter according to the information stored in the shared mutual exclusion register includes: Setting a status bit of the shared mutex register to a non-idle state;
从所述共享互斥寄存器中读取所述第一核的当前频率, 与预调核频率进 行比较;  Reading a current frequency of the first core from the shared mutex register, and comparing with a pre-adjusted core frequency;
根据比较结果设置当前核电压以及所述第一核的当前频率;  Setting a current core voltage and a current frequency of the first core according to the comparison result;
将所述当前核电压、 所述第一核的当前频率以及所述第一核允许的最小 核电压分别写入所述共享互斥寄存器中。  Writing the current core voltage, the current frequency of the first core, and the minimum core voltage allowed by the first core into the shared mutex register, respectively.
优选地, 所述根据比较结果设置当前核电压以及所述第一核的当前频率 的步骤包括:  Preferably, the step of setting the current core voltage and the current frequency of the first core according to the comparison result comprises:
当所述预调核频率大于所述第一核的当前频率时, 从所述共享互斥寄存 器读取当前核电压, 与预调核电压进行比较;  When the pre-adjusted core frequency is greater than a current frequency of the first core, reading a current core voltage from the shared mutually exclusive register, and comparing with a pre-adjusted core voltage;
当所述预调核电压大于所述当前核电压时, 从所述共享互斥寄存器读取 所述第二核允许的核电压; 取所述预调核电压及第二核允许的核电压中的较 大者设置为当前核电压; 设置所述第一核的当前频率;  Reading the core voltage allowed by the second core from the shared mutual exclusion register when the pre-adjusted core voltage is greater than the current core voltage; taking the pre-adjusted core voltage and the nuclear voltage allowed by the second core The larger one is set to the current core voltage; the current frequency of the first core is set;
当所述预调核频率小于所述第一核的当前频率时, 设置所述第一核的当 前频率; 从所述共享互斥寄存器读取当前核电压, 与预调核电压进行比较; 当所述预调核电压大于所述当前核电压时, 从所述共享互斥寄存器读取所述 第二核允许的核电压; 取所述预调核电压及第二核允许的核电压中的较大者 设置为当前核电压。  When the pre-adjusted core frequency is less than a current frequency of the first core, setting a current frequency of the first core; reading a current core voltage from the shared mutex register, and comparing with a pre-adjusted core voltage; Reading the core voltage allowed by the second core from the shared mutual exclusion register when the pre-adjusted core voltage is greater than the current core voltage; taking the pre-adjusted core voltage and the nuclear voltage allowed by the second core The larger one is set to the current core voltage.
优选地, 所述多核终端包括第一核和第二核, 当所述第一核需要调整系 统总线频率时, 所述依据共享互斥寄存器存储的信息设置共享资源参数的步 骤包括:  Preferably, the multi-core terminal includes a first core and a second core. When the first core needs to adjust the system bus frequency, the step of setting the shared resource parameter according to the information stored in the shared mutex register includes:
将所述共享互斥寄存器的状态位设置为非空闲状态;  Setting a status bit of the shared mutex register to a non-idle state;
从所述共享互斥寄存器中读取系统当前总线频率、 所述第二核允许的最 低系统总线频率;  Reading a current bus frequency of the system from the shared mutex register, and a minimum system bus frequency allowed by the second core;
比较预调核频率、 所述系统当前总线频率以及第二核允许的最低系统总 线频率; 取其中最大者设置为系统当前总线频率;  Comparing the pre-adjusted core frequency, the current bus frequency of the system, and the lowest system bus frequency allowed by the second core; taking the largest one is set to the current bus frequency of the system;
将所述系统当前总线频率、 第二核允许的最低系统总线频率分别写入所 述共享互斥寄存器中。 优选地, 当所述多核终端共享 RF公共资源时, 所述依据共享互斥寄存 器存储的信息设置共享资源参数的步骤包括: The current bus frequency of the system and the lowest system bus frequency allowed by the second core are respectively written into the shared mutex register. Preferably, when the multi-core terminal shares the RF common resource, the step of setting the shared resource parameter according to the information stored in the shared mutex register includes:
当所述多核终端中的任一核欲进入睡眠状态时, 从所述共享互斥寄存器 中读取 RF公共资源状态; 若所述 RF公共资源状态为工作状态, 则将所述 RF公共资源状态置为省电状态, 并将所述 RF公共资源的当前状态写入所述 互斥共享寄存器中;  Reading an RF common resource state from the shared mutual exclusion register when any one of the multi-core terminals is in a sleep state; if the RF common resource state is an active state, the RF common resource status is Set to a power saving state, and write the current state of the RF common resource into the mutually exclusive shared register;
当所述多核终端中的任一核在唤醒时,从所述共享互斥寄存器中读取 RF 公共资源状态; 若所述 RF公共资源状态为省电状态, 则将所述 RF公共资源 状态恢复到工作状态,并将所述 RF公共资源的当前状态写入所述互斥共享寄 存器中。  Reading an RF common resource status from the shared mutex register when any of the multi-core terminals is awake; and restoring the RF common resource status if the RF common resource status is a power saving state Go to the working state and write the current state of the RF common resource to the mutually exclusive shared register.
优选地, 上述方法还包括:  Preferably, the above method further includes:
当资源共享完毕后, 将所述共享互斥寄存器的状态位回位成空闲状态。 一种多核终端共享资源的装置, 包括:  After the resource sharing is completed, the status bit of the shared mutex register is returned to the idle state. A device for sharing resources by a multi-core terminal, comprising:
状态位读取模块, 其设置为: 当多核终端中的其中一核需要操作共享资 源时, 读取共享互斥寄存器的状态位; 以及  a status bit reading module configured to: read a status bit of the shared mutex register when one of the cores of the multi-core terminal needs to operate the shared resource;
资源共享模块, 其设置为: 当所述共享互斥寄存器的状态位为空闲时, 依据所述共享互斥寄存器存储的信息设置共享资源参数以进行资源共享。  The resource sharing module is configured to: when the status bit of the shared mutex register is idle, set the shared resource parameter according to the information stored in the shared mutex register for resource sharing.
优选地, 所述共享资源至少包括以下之一: 多核调频调压、 射频(RF ) 公共资源、 I2C总线以及通用异步收发传输器(UART ) 串口。  Preferably, the shared resource includes at least one of the following: a multi-core frequency modulation, a radio frequency (RF) common resource, an I2C bus, and a universal asynchronous transceiver transmitter (UART) serial port.
优选地, 所述多核终端包括第一核和第二核, 当所述第一核需要进行调 频调压时, 所述资源共享模块包括:  Preferably, the multi-core terminal includes a first core and a second core, and when the first core needs to perform frequency modulation and voltage regulation, the resource sharing module includes:
置位单元,其设置为将所述共享互斥寄存器的状态位设置为非空闲状态; 读取单元, 其设置为从所述共享互斥寄存器中读取所述第一核的当前频 率, 与预调核频率进行比较;  a setting unit configured to set a status bit of the shared mutex register to a non-idle state; a reading unit configured to read a current frequency of the first core from the shared mutex register, and Pre-adjust the nuclear frequencies for comparison;
设置单元, 其设置为根据比较结果设置当前核电压以及所述第一核的当 前频率; 以及  a setting unit configured to set a current core voltage and a current frequency of the first core according to the comparison result;
更新单元, 其设置为将所述当前核电压、 所述第一核的当前频率以及所 述第一核允许的最小核电压分别写入所述共享互斥寄存器中。 An update unit configured to set the current core voltage, a current frequency of the first core, and The minimum core voltage allowed by the first core is written into the shared mutex register, respectively.
优选地, 所述设置单元还设置为: 当所述预调核频率大于所述第一核的 当前频率时, 从所述共享互斥寄存器读取当前核电压, 与预调核电压进行比 较; 当所述预调核电压大于所述当前核电压时, 从所述共享互斥寄存器读取 所述第二核允许的核电压; 取所述预调核电压及第二核允许的核电压中的较 大者设置为当前核电压; 设置所述第一核的当前频率; 当所述预调核频率小 于所述第一核的当前频率时, 设置所述第一核的当前频率; 从所述共享互斥 寄存器读取当前核电压, 与预调核电压进行比较; 当所述预调核电压大于所 述当前核电压时, 从所述共享互斥寄存器读取所述第二核允许的核电压; 取 所述预调核电压及第二核允许的核电压中的较大者设置为当前核电压。  Preferably, the setting unit is further configured to: when the pre-adjusted core frequency is greater than a current frequency of the first core, read a current core voltage from the shared mutual exclusion register, and compare with a preset nuclear voltage; Reading the core voltage allowed by the second core from the shared mutual exclusion register when the pre-adjusted core voltage is greater than the current core voltage; taking the pre-adjusted core voltage and the nuclear voltage allowed by the second core The larger one is set to the current core voltage; the current frequency of the first core is set; when the pre-adjusted kernel frequency is less than the current frequency of the first core, the current frequency of the first core is set; The shared mutex register reads the current core voltage and compares with the pre-adjusted core voltage; when the pre-adjusted core voltage is greater than the current core voltage, reads from the shared mutex register that the second core allows The core voltage; the larger of the pre-adjusted core voltage and the core voltage allowed by the second core is set as the current core voltage.
优选地, 所述多核终端包括第一核和第二核, 当所述第一核需要调整系 统总线频率时, 所述资源共享模块包括:  Preferably, the multi-core terminal includes a first core and a second core, and when the first core needs to adjust a system bus frequency, the resource sharing module includes:
置位单元,其设置为将所述共享互斥寄存器的状态位设置为非空闲状态; 读取单元, 其设置为: 从所述共享互斥寄存器中读取系统当前总线频率、 所述第二核允许的最低系统总线频率;  a setting unit configured to set a status bit of the shared mutex register to a non-idle state; a reading unit configured to: read a current bus frequency of the system from the shared mutex register, the second The minimum system bus frequency allowed by the core;
设置单元, 其设置为: 比较预调核频率、 所述系统当前总线频率以及第 二核允许的最低系统总线频率; 取其中最大者设置为系统当前总线频率; 更新单元, 其设置为: 用于将所述系统当前总线频率、 第二核允许的最 低系统总线频率分别写入所述共享互斥寄存器中。  a setting unit, configured to: compare a preset core frequency, a current bus frequency of the system, and a minimum system bus frequency allowed by the second core; wherein the largest one is set to the current bus frequency of the system; and the update unit is set to: The current bus frequency of the system and the lowest system bus frequency allowed by the second core are respectively written into the shared mutex register.
优选地, 所述多核终端包括第一核和第二核, 当所述多核终端共享 RF 公共资源时, 所述资源共享模块包括: 读取单元, 其设置为: 在所述多核终 端中的任一核欲进入睡眠状态或在唤醒时,从所述共享互斥寄存器中读取 RF 公共资源状态;  Preferably, the multi-core terminal includes a first core and a second core. When the multi-core terminal shares the RF common resource, the resource sharing module includes: a reading unit, configured to: Reading a RF common resource status from the shared mutex register when a core wants to enter a sleep state or when waking up;
所述设置单元, 其设置为: 在所述多核终端中的任一核欲进入睡眠状态 且所述 RF公共资源状态为工作状态时,将所述 RF公共资源状态置为省电状 态; 或者, 在所述多核终端中的任一核在唤醒时且所述公共资源状态为省电 状态时, 将所述 RF公共资源状态恢复到工作状态;  The setting unit is configured to: when any one of the multi-core terminals wants to enter a sleep state and the RF common resource state is an active state, setting the RF common resource state to a power-saving state; or Retrieving the RF common resource state to an active state when any of the multi-core terminals is awake and the common resource state is a power-saving state;
所述更新单元, 其设置为: 将所述 RF公共资源的当前状态写入所述互 斥共享寄存器中。 The update unit is configured to: write a current state of the RF common resource to the mutual Rejected in the shared register.
优选地, 所述置位单元还设置为: 当资源共享完毕后, 将所述共享互斥 寄存器的状态位回位成空闲状态。  Preferably, the setting unit is further configured to: when the resource sharing is completed, return the status bit of the shared mutex register to an idle state.
本发明实施例提出的一种多核终端共享资源的方法及装置, 针对目前多 核的终端, 存在多个共享资源时, 利用共享互斥寄存器来达到保护和协调共 享资源的使用, 由此协调了各核对共享资源的分配, 提高了公共资源的利用 率, 同时提高了终端系统整体性能。 附图概述 A method and device for sharing resources by a multi-core terminal according to an embodiment of the present invention, for a multi-core terminal, when there are multiple shared resources, the shared mutual exclusion register is used to protect and coordinate the use of shared resources, thereby coordinating each Checking the allocation of shared resources improves the utilization of public resources and improves the overall performance of the terminal system. BRIEF abstract
图 1是本发明多核终端共享资源的方法一实施例的流程示意图; 图 2 是本发明多核终端共享资源的装置一实施例的结构示意图; 图 3是本发明多核终端共享资源的装置一实施例中资源共享模块的结构 示意图。 本发明的较佳实施方式  1 is a schematic flowchart of a method for sharing resources of a multi-core terminal according to an embodiment of the present invention; FIG. 2 is a schematic structural diagram of an apparatus for sharing resources of a multi-core terminal according to the present invention; Schematic diagram of the structure of the resource sharing module. Preferred embodiment of the invention
本发明实施例的解决方案主要是: 针对目前多核的终端, 存在多个共享 资源时, 利用共享互斥寄存器来达到保护和协调共享资源的使用。  The solution of the embodiment of the present invention is mainly: For a multi-core terminal, when there are multiple shared resources, the shared mutual exclusion register is used to protect and coordinate the use of the shared resource.
本发明实施例中多核终端指包含两个或两个以上 CPU核 (以下简称核) 的终端, 以下各实施例以目前双核共享架构的终端为例进行说明。  The multi-core terminal in the embodiment of the present invention refers to a terminal that includes two or more CPU cores (hereinafter referred to as a core). The following embodiments are described by taking the terminal of the current dual-core shared architecture as an example.
如图 1所示, 本发明一实施例提出一种多核终端共享资源的方法, 包括: 步骤 S101 , 当多核终端中的其中一核需要共享资源时, 读取共享互斥寄 存器的状态位;  As shown in FIG. 1, an embodiment of the present invention provides a method for sharing resources by a multi-core terminal, including: Step S101: When one of the cores of the multi-core terminal needs to share resources, read a status bit of the shared mutual exclusion register;
其中, 共享资源指的是各个核都能访问和操作的资源, 包括总线、 内存 以及外设等,包括但不限于多核调频调压、 RF公共资源、 I2C总线以及 UART 串口等。  Among them, shared resources refer to resources that can be accessed and operated by each core, including bus, memory, and peripherals, including but not limited to multi-core FM, RF common resources, I2C bus, and UART serial port.
当多核终端中的某一个核需要操作系统总线频率或核电压、 RF资源、公 共 I2C总线等公共资源时, 都会影响其它核的性能, 所以当任何一个核动态 操作公共资源时都需要结合对方参数和要求进行调整, 此外, 还需要避免双 方同时操作资源造成的冲突问题。 When a core in a multi-core terminal requires operating system bus frequency or common resources such as nuclear voltage, RF resources, and public I2C bus, it will affect the performance of other cores, so when any of the core dynamics When operating public resources, it is necessary to adjust the parameters and requirements of the other party. In addition, it is necessary to avoid conflicts caused by the simultaneous operation of resources by both parties.
本实施例利用共享互斥寄存器来达到保护和协调共享资源的使用, 以保 证各核能正常使用共享资源。  This embodiment utilizes a shared mutex register to protect and coordinate the use of shared resources to ensure that each core can use shared resources normally.
首先需要设计一个顶层的共享互斥寄存器, 该共享互斥寄存器可以为 32 位寄存器, 最低位表示状态位, 其它 31位可以给多核各自使用。  First, you need to design a top-level shared mutex register. The shared mutex register can be a 32-bit register, the lowest bit indicates the status bit, and the other 31 bits can be used by multiple cores.
当多核终端中的其中一核需要使用共享资源时, 读取共享互斥寄存器的 状态位, 以便根据该共享互斥寄存器的状态位设置相应的参数。  When one of the cores of the multi-core terminal needs to use the shared resource, the status bit of the shared mutex register is read to set the corresponding parameter according to the status bit of the shared mutex register.
步骤 S102, 当所述共享互斥寄存器的状态位为空闲时, 依据所述共享互 斥寄存器存储的信息设置相应参数进行资源共享。  Step S102: When the status bit of the shared mutex register is idle, set the corresponding parameter according to the information stored in the shared mutex register for resource sharing.
判断所述共享互斥寄存器的状态位是否空闲, 当所述共享互斥寄存器的 状态位未空闲时, 表示对方核对共享资源具有控制权, 当前核无法使用资源; 当所述共享互斥寄存器的状态位为空闲时, 则可以依赖该共享互斥寄存器存 放的信息调节相应的参数, 以实现资源共享。 其中, 在设置参数时, 需要将 共享互斥寄存器的状态位设置为非空闲状态, 当资源共享完毕后, 需要将共 享互斥寄存器的状态位回位成空闲状态。  Determining whether the status bit of the shared mutex register is idle, when the status bit of the shared mutex register is not idle, indicating that the peer has control over the shared resource, and the current core cannot use the resource; when the shared mutex register is When the status bit is idle, the corresponding parameters can be adjusted according to the information stored in the shared mutex register to implement resource sharing. When setting parameters, you need to set the status bit of the shared mutex register to non-idle state. After the resources are shared, you need to return the status bit of the shared mutex register to the idle state.
下面以多核调频调压、 RF公共资源、 I2C总线为例对本实施例基于多核 终端实现资源共享的方案进行详细阐述: The following is a detailed description of the scheme for resource sharing based on multi-core terminals in this embodiment by taking multi-core FM voltage regulation, RF common resources, and I2C bus as examples:
实例一、 对于多核动态调频调压的应用场景:  Example 1: Application scenario for multi-core dynamic frequency modulation and voltage regulation:
首先需要设计一个顶层的共享互斥寄存器, 以利用该共享互斥寄存器实 现多核共享公共资源。  First, you need to design a top-level shared mutex register to implement multi-core shared common resources using the shared mutex register.
该共享互斥寄存器为 32位寄存器, 最低位表示状态位, 其它 31位可以 给双核各自使用。 当其中某一核进行调频调压时, 首先会读取该共享互斥寄 存器最低位, 当读取的共享互斥寄存器的最低位为空闲时, 则可以进行相应 的频率和核电压设置, 否则, 需要等待该共享互斥寄存器的最低位空闲为止。 当然, 在进行频率, 电压等设置时, 需要依赖该共享互斥寄存器存放的 信息作为调频调压的条件, 才能最终进行调频调压的设置, 当调频调压完成 后, 需要置该共享互斥寄存器的最低位为 0, 释放控制权, 则对方可以使用。 其中, 设定多核终端中的两核分别为第一核和第二核, 多核共享架构动 态调核时钟和电压的实现流程如下: The shared mutex register is a 32-bit register, the lowest bit indicates the status bit, and the other 31 bits can be used by the dual core. When one of the cores performs FM voltage regulation, the lowest bit of the shared mutex register is read first. When the lowest bit of the shared mutex register read is idle, the corresponding frequency and core voltage settings can be performed. Otherwise, , need to wait for the lowest bit of the shared mutex register to be idle. Of course, when setting the frequency, voltage, etc., it is necessary to rely on the information stored in the shared mutex register as the condition of the FM voltage regulation, in order to finally set the FM voltage regulation, when the frequency modulation is completed. After that, the lowest bit of the shared mutex register needs to be set to 0, and the control right is released, and the other party can use it. Wherein, the two cores in the multi-core terminal are respectively set as the first core and the second core, and the implementation process of dynamically adjusting the clock and voltage of the multi-core shared architecture is as follows:
1 ) 、 当第一核根据 CPU负载或者应用场景方式等需要进行调频时, 会 先读取该共享互斥寄存器最低位 bit[0] , 当读到 bit[0]为 0时, 表示该共享互 斥寄存器空闲, 目前可以使用; 当读到 bit[0]为 1时, 则无法使用该共享互斥 寄存器;  1) When the first core needs to perform frequency modulation according to the CPU load or the application scenario mode, the lowest bit [0] of the shared mutex register is read first, and when bit [0] is 0, the sharing is indicated. The mutex register is idle and can be used at present; when bit[0] is read as 1, the shared mutex register cannot be used;
2 )、 当读到 bit[0]位为空闲后, 硬件会自动将该位置 1 , 表示现在该共享 互斥寄存器已使用, 此时禁止其它用户改写该共享互斥寄存器;  2), when the bit[0] bit is read as idle, the hardware will automatically set the bit to 1 to indicate that the shared mutex register is now used. At this time, other users are prohibited from overwriting the shared mutex register.
3 )读取该共享互斥寄存器中 bit[3-l] , 读出该第一核的当前频率, 与预 调核频率比较, 根据比较结果设置当前核电压以及第一核的当前频率;  3) reading bit [3-l] in the shared mutex register, reading the current frequency of the first core, comparing with the pre-adjusted core frequency, and setting the current core voltage and the current frequency of the first core according to the comparison result;
如果预调核频率大于该第一核当前频率, 则走升频流程; 否则, 退出整 个升频流程; 走降频流程。  If the pre-adjusted core frequency is greater than the current frequency of the first core, the up-sequence process is followed; otherwise, the entire up-conversion process is exited;
在升频流程中, 读取该共享互斥寄存器中的 bit[5-4], 获取当前核电压, 以预调核电压和当前核电压作比较, 如果预调核电压大于当前核电压, 则走 升压流程, 否则退出升压流程。  In the up-conversion process, the bit [5-4] in the shared mutex register is read, the current core voltage is obtained, and the pre-adjusted core voltage is compared with the current core voltage. If the pre-adjusted core voltage is greater than the current core voltage, Take the boost process, otherwise exit the boost process.
当所述预调核电压大于所述当前核电压时, 读取该共享互斥寄存器的 bit[7-6] , 获取所述第二核允许的核电压; 取所述预调核电压及第二核允许的 核电压中的较大者设置为当前核电压; 然后设置所述第一核的当前频率。  When the pre-adjusted core voltage is greater than the current core voltage, reading a bit [7-6] of the shared mutex register, acquiring a core voltage allowed by the second core; taking the pre-adjusted core voltage and the first The larger of the core voltages allowed by the second core is set to the current core voltage; then the current frequency of the first core is set.
在降频流程中, 所述预调核频率小于所述第一核的当前频率, 首先设置 所述第一核的当前频率; 然后从所述共享互斥寄存器读取当前核电压, 与预 调核电压进行比较; 当所述预调核电压大于所述当前核电压时, 从所述共享 互斥寄存器的 bit[7-6]读取所述第二核允许的核电压; 取所述预调核电压及第 二核允许的核电压中的较大者设置为当前核电压。  In the frequency down process, the pre-adjusted core frequency is less than the current frequency of the first core, first setting a current frequency of the first core; then reading the current core voltage from the shared mutex register, and pre-adjusting The core voltage is compared; when the pre-adjusted core voltage is greater than the current core voltage, the core voltage allowed by the second core is read from a bit [7-6] of the shared mutually exclusive register; The larger of the nucleation voltage and the nuclear voltage allowed by the second core is set to the current core voltage.
最后, 将所述当前核电压、 所述第一核的当前频率以及所述第一核允许 的最小核电压分别写入所述共享互斥寄存器中对应位 bit[5-4]、 bit[3-l]、 bit[9-8]。  Finally, the current core voltage, the current frequency of the first core, and the minimum core voltage allowed by the first core are respectively written into corresponding bit bits [5-4] and bit[3 in the shared mutual exclusion register. -l], bit[9-8].
此时, 系统将该共享互斥寄存器 bit[0]置为 0, 让出控制权。 对应多核共享架构动态调节系统总线频率的实现流程如下:At this point, the system sets the shared mutex register bit[0] to 0, giving up control. The implementation process of dynamically adjusting the system bus frequency corresponding to the multi-core shared architecture is as follows:
1 ) 、 当第一核根据 CPU负载或者应用场景方式等需要进行调总线频率 时, 会先读该共享互斥寄存器最低位 bit[0] , 当读到为 0时, 表示该共享互斥 寄存器空闲, 目前可以使用; 否则无法使用该共享互斥寄存器。 1) When the first core needs to adjust the bus frequency according to the CPU load or the application scenario mode, the lowest bit [0] of the shared mutex register is read first, and when it is read as 0, the shared mutex register is indicated. Idle, currently available; otherwise the shared mutex register cannot be used.
2 )、 当读到 bit[0]位为空闲后, 硬件会自动将该位置 1 , 表示现在该共享 互斥寄存器已使用, 此时禁止其它用户改写该寄存器;  2), when the bit[0] bit is read as idle, the hardware will automatically set the bit to 1 to indicate that the shared mutex register is now used. At this time, other users are prohibited from overwriting the register.
3 )、 以动态降低系统总线频率为例, 根据调频策略需要降频时, 此时会 读取该共享互斥寄存器中 bit[13-l l] , 读出系统当前总线频率、 第二核允许的 最低系统总线频率;  3). Taking the system bus frequency dynamically as an example, when the frequency modulation strategy needs to be down-converted, the bit [13-ll] in the shared mutex register is read, and the current bus frequency of the system and the second core are allowed. Minimum system bus frequency;
读取该共享互斥寄存器的 bit[16-14] , 获取第二核允许的最低系统总线频 率,取 MAX(预调核频率、系统当前总线频率、第二核允许的最低总线频率) , 设置系统当前总线频率。  Read the bit [16-14] of the shared mutex register to obtain the lowest system bus frequency allowed by the second core, and take MAX (pre-tuning the core frequency, the current bus frequency of the system, the lowest bus frequency allowed by the second core), and set The current bus frequency of the system.
将当前系统总线频率和当前第二核允许的最低系统总线频率分别写到该 共享互斥寄存器中 bit[13-l l]和 bit[19-17]; 之后, 系统将该共享互斥寄存器 bit[0]置为 0, 让出控制权。  Write the current system bus frequency and the lowest system bus frequency allowed by the current second core to the bit [13-ll] and bit [19-17] in the shared mutex register; afterwards, the system shares the shared mutex register bit [ 0] is set to 0, giving up control.
实例二、 对应多核使用 RF公共资源的应用场景: Example 2: Application scenario corresponding to the use of RF common resources by multiple cores:
首先需要设计一个由顶层的共享互斥寄存器, 以利用该共享互斥寄存器 实现多核共享资源, 该共享互斥寄存器是 32位寄存器, 最低位表示状态位, 其它 31位可以给双核各自使用。 当其中某一核需要操作 RF资源时, 首先会 读取该共享互斥寄存器最低位, 当读取的共享互斥寄存器最低位为空闲时, 则可以进行相应的 RF资源操作和设置,当读取的共享互斥寄存器最低位为非 空闲时, 需要等待该位空闲为止。 当然, 进行 RF资源操作时, 需要依赖该共 享互斥寄存器存放的信息作为是否能操作 RF 的条件, 才能最终进行真正的 RF的设置, 当操作完成后, 需要置该共享互斥寄存器最低位为 0, 释放控制 权, 则对方可以使用。  First, a top-level shared mutex register needs to be designed to implement multi-core shared resources by using the shared mutex register. The shared mutex register is a 32-bit register, the lowest bit indicates the status bit, and the other 31 bits can be used for the dual core. When one of the cores needs to operate the RF resource, the lowest bit of the shared mutex register is read first. When the lowest bit of the shared mutex register read is idle, the corresponding RF resource operation and setting can be performed. When the lowest bit of the shared mutex register is not idle, it needs to wait for the bit to be idle. Of course, when performing RF resource operations, it is necessary to rely on the information stored in the shared mutex register as a condition for whether the RF can be operated, in order to finally perform true RF setting. When the operation is completed, the lowest bit of the shared mutex register needs to be set to 0, release control, the other party can use.
其中, 多核共享 RF公共资源使用的实现流程如下: 1)、 当任何一个核在睡眠前去操作公共资源进入省电状态时, 必须先读 RF互斥共享寄存器状态位, 必须一直等到 bit[0]为 0, 此时去读 RF互斥共享 寄存器中对方核 RF公共资源状态 bit[l] ,如果为 0, 此时对应将 RF公共资源 置为省电状态, 然后将当前状态置到 RF 互斥共享寄存器对应位中, 最后配 置 RF互斥共享寄存器状态位 bit[0]为 0, 释放控制权; The implementation process of multi-core shared RF public resource usage is as follows: 1) When any core goes to sleep to operate the common resource to enter the power-saving state, the RF mutex shared register status bit must be read first, and must wait until bit[0] is 0. At this time, read the RF mutex shared register. The other party's core RF common resource status bit[l], if it is 0, the corresponding RF common resource is set to the power saving state, and then the current state is set to the corresponding bit of the RF mutual exclusion shared register, and finally the RF mutual exclusion sharing is configured. Register status bit bit[0] is 0, releasing control right;
2)、 当任何一个核在唤醒时需要必须先读 RF互斥共享寄存器状态位, 必 须一直等到 bit[0]为 0,此时去读 RF互斥共享寄存器中对方核 RF公共资源状 态 bit[l] , 如果为 0, 此时对应将 RF公共资源置为恢复到工作状态, 然后将 当前状态置到 RF互斥共享寄存器对应位中 ,最后配置 RF互斥共享寄存器状 态位 bit[0]为 0, 释放控制权。  2) When any core wakes up, it needs to read the RF mutex shared register status bit first. It must wait until bit[0] is 0. At this time, read the RF core common resource status bit in the RF mutex shared register. l], if it is 0, the corresponding RF common resource is restored to the working state, then the current state is set to the corresponding bit of the RF mutex shared register, and finally the RF mutex shared register status bit bit[0] is configured as 0, release control.
实例三、 对应多核使用公共 12 C总线资源的应用场景: Example 3: Application scenario corresponding to the use of common 12 C bus resources by multiple cores:
首先需要设计一个由顶层的共享互斥寄存器, 利用该共享互斥寄存器, 该寄存器是 32位寄存器, 最低位表示状态位, 其它 31位可以给双核各自使 用。 当其中某一核需要操作公共 I2C资源时, 首先会读取该共享互斥寄存器 最低位, 当读取为空闲时, 则可以使用该公共 I2C总线, 当读取为非空闲时, 需要等待该位空闲为止。 当操作完成后, 需要置该共享互斥寄存器最低位为 0, 释放控制权, 则对方可以使用。  First, you need to design a shared mutex register from the top layer. Using the shared mutex register, this register is a 32-bit register, the lowest bit indicates the status bit, and the other 31 bits can be used for the dual core. When one of the cores needs to operate the common I2C resource, the lowest bit of the shared mutex register is read first. When the read is idle, the common I2C bus can be used. When the read is non-idle, it needs to wait for the The bit is idle. When the operation is completed, the lowest bit of the shared mutex register needs to be set to 0, and the control right is released, and the other party can use it.
其中, 多核公共 I2C总线资源使用的实现流程如下:  The implementation process of multi-core public I2C bus resource usage is as follows:
1)、 当任何一个核去操作公共 I2C总线资源, 必须先读 I2C总线互斥共 享寄存器状态位,必须一直等到 bit[0]为 0,此时才能去操作该 I2C总线资源; 如果 bit[0]—直为 1 , 则不能操作该 I2C总线;  1), when any core to operate the common I2C bus resources, you must first read the I2C bus mutual exclusion shared register status bit, you must wait until bit[0] is 0, then you can operate the I2C bus resource; if bit[0] ] - straight to 1, the I2C bus cannot be operated;
2)、 当任何一个核操作完该 I2C总线, 必须设置 I2C总线互斥共享寄存 器状态位 bit[0]为 1 , 释放控制权, 这样其它核才能使用该公共资源。  2) When any core operates the I2C bus, the I2C bus mutual exclusion shared register status bit, bit[0], must be set to 1 to release control so that other cores can use the common resource.
本实施例通过上述方案, 能够解决对多核共享架构 /共享资源的分配和使 用, 不但能实际解决公共资源 UART串口、 RF资源等的使用, 同时能解决多 核 DVFS调频调压实现方案, 从而提高了终端的整体性能, 其效果显著。 比 如解决多核共享架构进行动态调频调压, 可以比较明显的改善系统的待机、 通话、 上网等场景下的功耗, 延长用户对电池使用的时间。 Through the foregoing solution, the embodiment can solve the allocation and use of the multi-core shared architecture/shared resources, and can not only effectively solve the use of the public resource UART serial port, the RF resource, etc., but also can solve the multi-core DVFS frequency modulation and voltage adjustment implementation scheme, thereby improving the scheme. The overall performance of the terminal has a significant effect. For example, solving the multi-core shared architecture for dynamic frequency modulation and voltage regulation can significantly improve the standby of the system. Power consumption in scenarios such as calls and Internet access, extending the user's time spent on the battery.
在其他实施例中只要是利用共享互斥寄存器来实现对双核或者更多核共 享架构 /共享资源的使用, 均可以基于本实施例的上述方案而扩展实施, 在此 不再赘述。  In other embodiments, the implementation of the dual-core or more-core shared architecture/shared resource is implemented by using the shared mutual exclusion register, and the implementation may be extended based on the foregoing solution of the embodiment, and details are not described herein again.
如图 2所示, 本发明一实施例提出一种多核终端共享资源的装置, 包括: 状态位读取模块 201及资源共享模块 202, 其中: As shown in FIG. 2, an embodiment of the present invention provides a device for sharing resources by a multi-core terminal, including: a status bit reading module 201 and a resource sharing module 202, where:
状态位读取模块 201, 设置为当多核终端中的其中一核需要共享资源时, 读取共享互斥寄存器的状态位;  The status bit reading module 201 is configured to read a status bit of the shared mutex register when one of the cores of the multi-core terminal needs to share resources;
资源共享模块 202, 设置为当所述共享互斥寄存器的状态位为空闲时, 依据所述共享互斥寄存器存储的信息设置相应参数进行资源共享。  The resource sharing module 202 is configured to: when the status bit of the shared mutex register is idle, set corresponding parameters according to the information stored in the shared mutex register for resource sharing.
其中, 共享资源指的是各个核都能访问和操作的资源, 包括总线、 内存 以及外设等,包括但不限于多核调频调压、 RF公共资源、 I2C总线以及 UART 串口等。  Among them, shared resources refer to resources that can be accessed and operated by each core, including bus, memory, and peripherals, including but not limited to multi-core FM, RF common resources, I2C bus, and UART serial port.
当多核终端中的某一个核需要操作系统总线频率或核电压、 RF资源、公 共 I2C总线等公共资源时, 都会影响其它核的性能, 所以当任何一个核动态 操作公共资源时都需要结合对方参数和要求进行调整, 此外, 还需要避免双 方同时操作资源造成的冲突问题。  When a core of a multi-core terminal requires operating system bus frequency or common resources such as nuclear voltage, RF resources, and public I2C bus, it will affect the performance of other cores. Therefore, when any core dynamically operates a common resource, it needs to combine the other parameters. And the requirements are adjusted. In addition, it is necessary to avoid conflicts caused by the simultaneous operation of resources by both parties.
本实施例利用共享互斥寄存器来达到保护和协调共享资源的使用, 以保 证各核能正常使用共享资源。  This embodiment utilizes a shared mutex register to protect and coordinate the use of shared resources to ensure that each core can use shared resources normally.
首先需要设计一个由顶层的共享互斥寄存器,该共享互斥寄存器为 32位 寄存器, 最低位表示状态位, 其它 31位可以给双核各自使用。  First, you need to design a shared mutex register from the top layer. The shared mutex register is a 32-bit register. The lowest bit indicates the status bit. The other 31 bits can be used by the dual core.
当多核终端中的其中一核需要共享资源时, 通过状态位读取模块 201读 取共享互斥寄存器的状态位, 以便资源共享模块 202根据该共享互斥寄存器 的状态位设置相应的参数。  When one of the cores of the multi-core terminal needs to share the resource, the status bit reading module 201 reads the status bit of the shared mutex register, so that the resource sharing module 202 sets the corresponding parameter according to the status bit of the shared mutex register.
资源共享模块 202首先判断所述共享互斥寄存器的状态位是否空闲, 当 所述共享互斥寄存器的状态位未空闲时,表示对方核对共享资源具有控制权, 当前核无法使用资源; 当所述共享互斥寄存器的状态位为空闲时, 则可以依 赖该共享互斥寄存器存放的信息调节相应的参数, 以实现资源共享。 其中, 在设置参数时, 需要将共享互斥寄存器的状态位设置为非空闲状态, 当资源 共享完毕后, 需要将共享互斥寄存器的状态位回位成空闲状态。 The resource sharing module 202 first determines whether the status bit of the shared mutex register is idle. When the status bit of the shared mutex register is not idle, it indicates that the peer has control over the shared resource, and the current core cannot use the resource; When the status bit of the shared mutex register is idle, The information stored in the shared mutex register adjusts the corresponding parameters to achieve resource sharing. When setting parameters, you need to set the status bit of the shared mutex register to non-idle state. After the resources are shared, you need to return the status bit of the shared mutex register to the idle state.
较佳地, 如图 3所示, 所述资源共享模块 202包括: 置位单元 2021、 读 取单元 2022、 设置单元 2023以及更新单元 2024, 其中: Preferably, as shown in FIG. 3, the resource sharing module 202 includes: a setting unit 2021, a reading unit 2022, a setting unit 2023, and an updating unit 2024, where:
若设定所述多核终端包括第一核和第二核, 当所述第一核需要进行调频 调压时, 置位单元 2021 , 设置为将所述共享互斥寄存器的状态位置为非空闲 状态;  If the multi-core terminal is configured to include the first core and the second core, when the first core needs to perform frequency modulation and voltage regulation, the setting unit 2021 is configured to set the state position of the shared mutual exclusion register to a non-idle state. ;
读取单元 2022, 设置为从所述共享互斥寄存器中读取所述第一核的当前 频率, 与预调核频率进行比较;  The reading unit 2022 is configured to read the current frequency of the first core from the shared mutex register and compare it with the pre-adjusted core frequency;
设置单元 2023 , 设置为根据比较结果设置当前核电压以及所述第一核的 当前频率;  The setting unit 2023 is configured to set a current core voltage and a current frequency of the first core according to the comparison result;
更新单元 2024, 设置为将所述当前核电压、 所述第一核的当前频率以及 所述第一核允许的最小核电压分别写入所述共享互斥寄存器中对应位中。  The updating unit 2024 is configured to separately write the current core voltage, the current frequency of the first core, and the minimum core voltage allowed by the first core into corresponding bits in the shared mutex register.
较佳地,所述设置单元 2023还设置为当所述预调核频率大于所述第一核 的当前频率时, 从所述共享互斥寄存器读取当前核电压, 与预调核电压进行 比较; 当所述预调核电压大于所述当前核电压时, 从所述共享互斥寄存器读 取所述第二核允许的核电压; 取所述预调核电压及第二核允许的核电压中的 较大者设置为当前核电压; 设置所述第一核的当前频率; 当所述预调核频率 小于所述第一核的当前频率时, 设置所述第一核的当前频率; 从所述共享互 斥寄存器读取当前核电压, 与预调核电压进行比较; 当所述预调核电压大于 所述当前核电压时, 从所述共享互斥寄存器读取所述第二核允许的核电压; 取所述预调核电压及第二核允许的核电压中的较大者设置为当前核电压。 Preferably, the setting unit 2023 is further configured to: when the pre-adjusted core frequency is greater than a current frequency of the first core, read a current core voltage from the shared mutex register, and compare with a pre-adjusted core voltage. Reading the core voltage allowed by the second core from the shared mutual exclusion register when the pre-adjusted core voltage is greater than the current core voltage; taking the pre-adjusted core voltage and the nuclear voltage allowed by the second core The larger one is set to the current core voltage; the current frequency of the first core is set; when the pre-adjusted kernel frequency is less than the current frequency of the first core, the current frequency of the first core is set; The shared mutual exclusion register reads the current core voltage and compares with the preset core voltage; when the preset core voltage is greater than the current core voltage, reading the second core permission from the shared mutual exclusion register The core voltage; the larger of the pre-adjusted core voltage and the core voltage allowed by the second core is set to the current core voltage.
当所述第一核需要调整系统总线频率时,所述读取单元 2022还设置为从 所述共享互斥寄存器中读取系统当前总线频率、 所述第二核允许的最低系统 总线频率; When the first core needs to adjust the system bus frequency, the reading unit 2022 is further configured to read the current bus frequency of the system and the lowest system allowed by the second core from the shared mutual exclusion register. Bus frequency
所述设置单元 2023还设置为比较预调核频率、所述系统当前总线频率以 及第二核允许的最低系统总线频率;取其中最大者设置为系统当前总线频率; 所述更新单元 2024还设置为将所述系统当前总线频率、第二核允许的最 低系统总线频率分别写入所述共享互斥寄存器中对应位中。  The setting unit 2023 is further configured to compare the preset core frequency, the current bus frequency of the system, and the lowest system bus frequency allowed by the second core; wherein the largest one is set to the current bus frequency of the system; the update unit 2024 is further configured to The current bus frequency of the system and the lowest system bus frequency allowed by the second core are respectively written into corresponding bits in the shared mutex register.
当所述多核终端共享 RF公共资源时, 所述读取单元 2022还设置为在所 述多核终端中的任一核欲进入睡眠状态或在唤醒时, 从所述共享互斥寄存器 中读取对应的 RF公共资源状态; 所述设置单元 2023 还设置为在所述多核终端中的任一核欲进入睡眠状 态且所述对应的 RF公共资源状态为工作状态时,将所述对应的 RF公共资源 状态置为省电状态; 或者, 在所述多核终端中的任一核在唤醒时且所述对应 的 RF公共资源状态为省电状态时,将所述对应的 RF公共资源状态恢复到工 作状态; When the multi-core terminal shares the RF common resource, the reading unit 2022 is further configured to read from the shared mutual exclusion register when any of the multi-core terminals wants to enter a sleep state or when awake The RF common resource state; the setting unit 2023 is further configured to: when any one of the multi-core terminals wants to enter a sleep state and the corresponding RF common resource state is an active state, the corresponding RF common resource The state is set to a power-saving state; or, when any one of the multi-core terminals is awake and the corresponding RF common resource state is a power-saving state, the corresponding RF common resource state is restored to a working state. ;
所述更新单元 2024还设置为将所述 RF公共资源的当前状态写入所述互 斥共享寄存器对应位中。  The update unit 2024 is further configured to write the current state of the RF common resource into the corresponding bit of the mutually exclusive shared register.
所述置位单元 2021还设置为当资源共享完毕后,将所述共享互斥寄存器 的状态位回位成空闲状态。  The setting unit 2021 is further configured to return the status bit of the shared mutex register to an idle state after the resource sharing is completed.
本发明实施例多核终端共享资源的方法及装置, 针对目前多核的终端, 存在多个共享资源时, 利用共享互斥寄存器来达到保护和协调共享资源的使 用, 在多核终端中的其中一核需要共享资源时, 读取共享互斥寄存器的状态 位; 当共享互斥寄存器的状态位为空闲时, 依据共享互斥寄存器存储的信息 设置相应参数进行资源共享, 由此协调了各核对共享资源的分配, 提高了公 共资源的利用率, 同时提高了终端系统整体性能。 The method and device for sharing resources by a multi-core terminal according to an embodiment of the present invention, for a multi-core terminal, when there are multiple shared resources, the shared mutual exclusion register is used to protect and coordinate the use of the shared resource, and one of the cores in the multi-core terminal needs to be used. When the resource is shared, the status bit of the shared mutex register is read; when the status bit of the shared mutex register is idle, the corresponding parameter is set according to the information stored in the shared mutex register for resource sharing, thereby coordinating the check resources of the shared resources. Distribution increases the utilization of public resources and improves the overall performance of the terminal system.
本领域普通技术人员可以理解上述方法中的全部或部分步骤可通过程序 来指令相关硬件完成, 上述程序可以存储于计算机可读存储介质中, 如只读 存储器、 磁盘或光盘等。 可选地, 上述实施例的全部或部分步骤也可以使用 一个或多个集成电路来实现。 相应地, 上述实施例中的各模块 /单元可以釆用 硬件的形式实现, 也可以釆用软件功能模块的形式实现。 本发明不限制于任 何特定形式的硬件和软件的结合。 One of ordinary skill in the art can understand that all or part of the above steps can be completed by a program to instruct related hardware, and the above program can be stored in a computer readable storage medium, such as read only. Memory, disk or disc, etc. Alternatively, all or part of the steps of the above embodiments may also be implemented using one or more integrated circuits. Correspondingly, each module/unit in the foregoing embodiment may be implemented in the form of hardware, or may be implemented in the form of a software function module. The invention is not limited to any specific form of combination of hardware and software.
以上所述仅为本发明的优选实施例, 并非因此限制本发明的专利范围, 凡是利用本发明说明书及附图内容所作的等效结构或流程变换, 或直接或间 接运用在其它相关的技术领域, 均同理包括在本发明的专利保护范围内。  The above is only a preferred embodiment of the present invention, and is not intended to limit the scope of the present invention, and equivalent structural or process changes made by the present specification and drawings may be directly or indirectly applied to other related technical fields. The same is included in the scope of patent protection of the present invention.
工业实用性 Industrial applicability
本发明的实施例协调了各核对共享资源的分配, 提高了公共资源的利用 率, 同时提高了终端系统整体性能。  Embodiments of the present invention coordinate the allocation of shared resources by each core, improve the utilization rate of public resources, and improve the overall performance of the terminal system.

Claims

权 利 要 求 书 Claims
1、 一种多核终端共享资源的方法, 包括:  1. A method for sharing resources by a multi-core terminal, comprising:
当多核终端中的其中一核需要操作共享资源时, 读取共享互斥寄存器的 状态位;  When one of the cores of the multi-core terminal needs to operate the shared resource, the status bit of the shared mutex register is read;
当所述共享互斥寄存器的状态位为空闲时, 依据所述共享互斥寄存器存 储的信息设置共享资源参数以进行资源共享。  When the status bit of the shared mutex register is idle, the shared resource parameter is set according to the information stored in the shared mutex register for resource sharing.
2、根据权利要求 1所述的方法,其中,所述共享资源至少包括以下之一: 多核调频调压、 射频 (RF )公共资源、 I2C 总线以及通用异步收发传输器 ( UART ) 串口。 2. The method of claim 1, wherein the shared resource comprises at least one of the following: a multi-core frequency modulation, a radio frequency (RF) common resource, an I2C bus, and a universal asynchronous transceiver transmitter (UART) serial port.
3、 根据权利要求 1所述的方法, 其中, 所述多核终端包括第一核和第二 核, 当所述第一核需要进行调频调压时, 所述依据共享互斥寄存器存储的信 息设置共享资源参数的步骤包括: The method according to claim 1, wherein the multi-core terminal comprises a first core and a second core, and when the first core needs to perform frequency modulation and voltage regulation, the information is set according to the information stored in the shared mutual exclusion register. The steps to share resource parameters include:
将所述共享互斥寄存器的状态位设置为非空闲状态;  Setting a status bit of the shared mutex register to a non-idle state;
从所述共享互斥寄存器中读取所述第一核的当前频率, 与预调核频率进 行比较;  Reading a current frequency of the first core from the shared mutex register, and comparing with a pre-adjusted core frequency;
根据比较结果设置当前核电压以及所述第一核的当前频率;  Setting a current core voltage and a current frequency of the first core according to the comparison result;
将所述当前核电压、 所述第一核的当前频率以及所述第一核允许的最小 核电压分别写入所述共享互斥寄存器中。  Writing the current core voltage, the current frequency of the first core, and the minimum core voltage allowed by the first core into the shared mutex register, respectively.
4、 根据权利要求 3所述的方法, 其中, 所述根据比较结果设置当前核电 压以及所述第一核的当前频率的步骤包括: 4. The method according to claim 3, wherein the step of setting the current nuclear voltage and the current frequency of the first core according to the comparison result comprises:
当所述预调核频率大于所述第一核的当前频率时, 从所述共享互斥寄存 器读取当前核电压, 与预调核电压进行比较;  When the pre-adjusted core frequency is greater than a current frequency of the first core, reading a current core voltage from the shared mutually exclusive register, and comparing with a pre-adjusted core voltage;
当所述预调核电压大于所述当前核电压时, 从所述共享互斥寄存器读取 所述第二核允许的核电压; 取所述预调核电压及第二核允许的核电压中的较 大者设置为当前核电压; 设置所述第一核的当前频率;  Reading the core voltage allowed by the second core from the shared mutual exclusion register when the pre-adjusted core voltage is greater than the current core voltage; taking the pre-adjusted core voltage and the nuclear voltage allowed by the second core The larger one is set to the current core voltage; the current frequency of the first core is set;
当所述预调核频率小于所述第一核的当前频率时, 设置所述第一核的当 前频率; 从所述共享互斥寄存器读取当前核电压, 与预调核电压进行比较; 当所述预调核电压大于所述当前核电压时, 从所述共享互斥寄存器读取所述 第二核允许的核电压; 取所述预调核电压及第二核允许的核电压中的较大者 设置为当前核电压。 When the pre-adjusted core frequency is less than a current frequency of the first core, setting a current frequency of the first core; reading a current core voltage from the shared mutex register, and comparing with a pre-adjusted core voltage; Reading the core voltage allowed by the second core from the shared mutual exclusion register when the pre-adjusted core voltage is greater than the current core voltage; taking the pre-adjusted core voltage and the nuclear voltage allowed by the second core The larger one is set to the current core voltage.
5、 根据权利要求 1所述的方法, 其中, 所述多核终端包括第一核和第二 核, 当所述第一核需要调整系统总线频率时, 所述依据共享互斥寄存器存储 的信息设置共享资源参数的步骤包括: The method according to claim 1, wherein the multi-core terminal comprises a first core and a second core, and when the first core needs to adjust a system bus frequency, the information is set according to the information stored in the shared mutex register. The steps to share resource parameters include:
将所述共享互斥寄存器的状态位设置为非空闲状态;  Setting a status bit of the shared mutex register to a non-idle state;
从所述共享互斥寄存器中读取系统当前总线频率、 所述第二核允许的最 低系统总线频率;  Reading a current bus frequency of the system from the shared mutex register, and a minimum system bus frequency allowed by the second core;
比较预调核频率、 所述系统当前总线频率以及第二核允许的最低系统总 线频率; 取其中最大者设置为系统当前总线频率;  Comparing the pre-adjusted core frequency, the current bus frequency of the system, and the lowest system bus frequency allowed by the second core; taking the largest one is set to the current bus frequency of the system;
将所述系统当前总线频率、 第二核允许的最低系统总线频率分别写入所 述共享互斥寄存器中。  The current bus frequency of the system and the lowest system bus frequency allowed by the second core are respectively written into the shared mutex register.
66、、 根根据据权权利利要要求求 11所所述述的的方方法法,, 其其中中,, 当当所所述述多多核核终终端端共共享享 RRFF公公共共资资 源源时时,, 所所述述依依据据共共享享互互斥斥寄寄存存器器存存储储的的信信息息设设置置共共享享资资源源参参数数的的步步骤骤包包括括:: 当当所所述述多多核核终终端端中中的的任任一一核核欲欲进进入入睡睡眠眠状状态态时时,, 从从所所述述共共享享互互斥斥寄寄存存器器 中中读读取取 RRFF公公共共资资源源状状态态;; 若若所所述述 RRFF公公共共资资源源状状态态为为工工作作状状态态,, 则则将将所所述述 2200 RRFF公公共共资资源源状状态态置置为为省省电电状状态态,, 并并将将所所述述 RRFF公公共共资资源源的的当当前前状状态态写写入入所所述述 互互斥斥共共享享寄寄存存器器中中;; 66. The root method according to the claim of claim 11 according to the rights and interests, wherein, the multi-core nuclear terminal terminal shared the RRFF public common resource source At the time, the step by step according to the shared information sharing the shared information of the mutual-reserved register storage storage device sets the number of shared resource resource parameter parameters :: When any of the multi-nuclear nuclear terminal terminals in the described multi-nuclear nuclear terminal end point is intended to enter the sleep-sleeping state state, the mutual sharing of the mutual sharing is In the register, the reading and reading of the RRFF public common resource source state state; if the RRFF public common resource source state state is the working state state, then The 2200 RRFF public common resource source state state state is set to be a provincial power state state, and the current front state of the RRFF public common resource source will be State-state write write-in to the mutual repudiation co-shared register register ;;
当当所所述述多多核核终终端端中中的的任任一一核核在在唤唤醒醒时时,,从从所所述述共共享享互互斥斥寄寄存存器器中中读读取取 RRFF 公公共共资资源源状状态态;; 若若所所述述 RRFF公公共共资资源源状状态态为为省省电电状状态态,, 则则将将所所述述 RRFF公公共共资资源源 状状态态恢恢复复到到工工作作状状态态,,并并将将所所述述 RRFF公公共共资资源源的的当当前前状状态态写写入入所所述述互互斥斥共共享享寄寄 2255 存存器器中中。。  When any one of the multi-core core terminal terminals of the said multi-core core terminal is awake at the time of wake-up, reading from the shared shared mutual exclusion register Reading the RRFF public common resource source state state; if the RRFF public common resource source state state is the provincial power state state, then the description will be The source state state of the public public resources of the RRFF is restored to the working state state, and the current state of the current public resource source of the RRFF is written and written into the office. The mutually exclusive replies are shared and shared in the 2255 stor. .
77、、 根根据据权权利利要要求求 33--66中中任任一一项项所所述述的的方方法法,, 还还包包括括:: 77. The method according to any one of the items 33-66, according to the rights and interests of the right, and the package includes:
当当资资源源共共享享完完毕毕后后,, 将将所所述述共共享享互互斥斥寄寄存存器器的的状状态态位位回回位位成成空空闲闲状状态态。。
Figure imgf000017_0001
状态位读取模块, 其设置为: 当多核终端中的其中一核需要操作共享资 源时, 读取共享互斥寄存器的状态位; 以及
After the sharing of the resource resources is completed, the state status bits of the shared mutual shared register are returned to the empty idle state. . .
Figure imgf000017_0001
a status bit reading module configured to: read a status bit of the shared mutex register when one of the cores of the multi-core terminal needs to operate the shared resource;
资源共享模块, 其设置为: 当所述共享互斥寄存器的状态位为空闲时, 依据所述共享互斥寄存器存储的信息设置共享资源参数以进行资源共享。  The resource sharing module is configured to: when the status bit of the shared mutex register is idle, set the shared resource parameter according to the information stored in the shared mutex register for resource sharing.
9、根据权利要求 8所述的装置,其中,所述共享资源至少包括以下之一: 多核调频调压、 射频 (RF )公共资源、 I2C 总线以及通用异步收发传输器 ( UART ) 串口。 10、 根据权利要求 8所述的装置, 其中, 所述多核终端包括第一核和第 二核, 当所述第一核需要进行调频调压时, 所述资源共享模块包括: 9. The apparatus of claim 8, wherein the shared resource comprises at least one of the following: a multi-core frequency modulation, a radio frequency (RF) common resource, an I2C bus, and a universal asynchronous transceiver transmitter (UART) serial port. The device according to claim 8, wherein the multi-core terminal comprises a first core and a second core, and when the first core needs to perform frequency modulation and voltage regulation, the resource sharing module includes:
置位单元,其设置为将所述共享互斥寄存器的状态位设置为非空闲状态; 读取单元, 其设置为从所述共享互斥寄存器中读取所述第一核的当前频 率, 与预调核频率进行比较;  a setting unit configured to set a status bit of the shared mutex register to a non-idle state; a reading unit configured to read a current frequency of the first core from the shared mutex register, and Pre-adjust the nuclear frequencies for comparison;
设置单元, 其设置为根据比较结果设置当前核电压以及所述第一核的当 前频率; 以及  a setting unit configured to set a current core voltage and a current frequency of the first core according to the comparison result;
更新单元, 其设置为将所述当前核电压、 所述第一核的当前频率以及所 述第一核允许的最小核电压分别写入所述共享互斥寄存器中。 11、 根据权利要求 10所述的装置, 其中, 所述设置单元还设置为: 当所 述预调核频率大于所述第一核的当前频率时, 从所述共享互斥寄存器读取当 前核电压, 与预调核电压进行比较; 当所述预调核电压大于所述当前核电压 时, 从所述共享互斥寄存器读取所述第二核允许的核电压; 取所述预调核电 压及第二核允许的核电压中的较大者设置为当前核电压; 设置所述第一核的 当前频率; 当所述预调核频率小于所述第一核的当前频率时, 设置所述第一 核的当前频率; 从所述共享互斥寄存器读取当前核电压, 与预调核电压进行 比较; 当所述预调核电压大于所述当前核电压时, 从所述共享互斥寄存器读 取所述第二核允许的核电压; 取所述预调核电压及第二核允许的核电压中的 较大者设置为当前核电压。 12、 根据权利要求 8所述的装置, 其中, 所述多核终端包括第一核和第 二核, 当所述第一核需要调整系统总线频率时, 所述资源共享模块包括: 置位单元,其设置为将所述共享互斥寄存器的状态位设置为非空闲状态; 读取单元, 其设置为: 从所述共享互斥寄存器中读取系统当前总线频率、 所述第二核允许的最低系统总线频率; And an update unit configured to write the current core voltage, a current frequency of the first core, and a minimum core voltage allowed by the first core into the shared mutex register, respectively. The device according to claim 10, wherein the setting unit is further configured to: read the current core from the shared mutex register when the pre-adjusted core frequency is greater than a current frequency of the first core The voltage is compared with the pre-adjusted core voltage; when the pre-adjusted core voltage is greater than the current core voltage, the core voltage allowed by the second core is read from the shared mutex register; And a larger one of a voltage and a core voltage allowed by the second core is set as a current core voltage; setting a current frequency of the first core; when the pre-adjusted core frequency is less than a current frequency of the first core, setting Determining a current frequency of the first core; reading a current core voltage from the shared mutex register, comparing with a pre-adjusted core voltage; and when the pre-adjusted core voltage is greater than the current core voltage, mutually exclusive from the sharing The register reads the core voltage allowed by the second core; and takes the larger of the pre-adjusted core voltage and the core voltage allowed by the second core as the current core voltage. The device according to claim 8, wherein the multi-core terminal comprises a first core and a second core, and when the first core needs to adjust a system bus frequency, the resource sharing module comprises: a setting unit, It is set to set a status bit of the shared mutex register to a non-idle state; a reading unit configured to: read a current bus frequency of the system from the shared mutex register, and a minimum allowed by the second core System bus frequency;
设置单元, 其设置为: 比较预调核频率、 所述系统当前总线频率以及第 二核允许的最低系统总线频率; 取其中最大者设置为系统当前总线频率; 更新单元, 其设置为: 用于将所述系统当前总线频率、 第二核允许的最 低系统总线频率分别写入所述共享互斥寄存器中。  a setting unit, configured to: compare a preset core frequency, a current bus frequency of the system, and a minimum system bus frequency allowed by the second core; wherein the largest one is set to the current bus frequency of the system; and the update unit is set to: The current bus frequency of the system and the lowest system bus frequency allowed by the second core are respectively written into the shared mutex register.
13、 根据权利要求 8所述的装置, 其中, 所述多核终端包括第一核和第 二核, 当所述多核终端共享 RF公共资源时, 所述资源共享模块包括: 读取单 元, 其设置为: 在所述多核终端中的任一核欲进入睡眠状态或在唤醒时, 从 所述共享互斥寄存器中读取 RF公共资源状态; The apparatus according to claim 8, wherein the multi-core terminal comprises a first core and a second core, and when the multi-core terminal shares an RF common resource, the resource sharing module comprises: a reading unit, which is set When: any one of the multi-core terminals wants to enter a sleep state or wakes up, reads an RF common resource state from the shared mutual exclusion register;
所述设置单元, 其设置为: 在所述多核终端中的任一核欲进入睡眠状态 且所述 RF公共资源状态为工作状态时,将所述 RF公共资源状态置为省电状 态; 或者, 在所述多核终端中的任一核在唤醒时且所述公共资源状态为省电 状态时, 将所述 RF公共资源状态恢复到工作状态;  The setting unit is configured to: when any one of the multi-core terminals wants to enter a sleep state and the RF common resource state is an active state, setting the RF common resource state to a power-saving state; or Retrieving the RF common resource state to an active state when any of the multi-core terminals is awake and the common resource state is a power-saving state;
所述更新单元, 其设置为: 将所述 RF公共资源的当前状态写入所述互 斥共享寄存器中。  The updating unit is configured to: write a current state of the RF common resource into the mutually exclusive shared register.
14、 根据权利要求 10-13 中任一项所述的装置, 其中, 所述置位单元还 设置为: 当资源共享完毕后, 将所述共享互斥寄存器的状态位回位成空闲状 态。 The device according to any one of claims 10-13, wherein the setting unit is further configured to: after the resource sharing is completed, return the status bit of the shared mutex register to an idle state.
PCT/CN2013/078108 2012-10-25 2013-06-27 Method and device for multicore terminal sharing resources WO2013182098A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201210413307.5 2012-10-25
CN201210413307.5A CN103778014B (en) 2012-10-25 The method and device of multi-core terminal shared resource

Publications (1)

Publication Number Publication Date
WO2013182098A1 true WO2013182098A1 (en) 2013-12-12

Family

ID=49711401

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2013/078108 WO2013182098A1 (en) 2012-10-25 2013-06-27 Method and device for multicore terminal sharing resources

Country Status (1)

Country Link
WO (1) WO2013182098A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060004988A1 (en) * 2004-06-30 2006-01-05 Jordan Paul J Single bit control of threads in a multithreaded multicore processor
CN1758229A (en) * 2005-10-28 2006-04-12 中国人民解放军国防科学技术大学 Local space shared memory method of heterogeneous multi-kernel microprocessor
US7665002B1 (en) * 2005-12-14 2010-02-16 Advanced Micro Devices, Inc. Multi-core integrated circuit with shared debug port
CN102521207A (en) * 2010-12-22 2012-06-27 威盛电子股份有限公司 Distributed management of shared power supplies for multi-core microprocessors

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060004988A1 (en) * 2004-06-30 2006-01-05 Jordan Paul J Single bit control of threads in a multithreaded multicore processor
CN1758229A (en) * 2005-10-28 2006-04-12 中国人民解放军国防科学技术大学 Local space shared memory method of heterogeneous multi-kernel microprocessor
US7665002B1 (en) * 2005-12-14 2010-02-16 Advanced Micro Devices, Inc. Multi-core integrated circuit with shared debug port
CN102521207A (en) * 2010-12-22 2012-06-27 威盛电子股份有限公司 Distributed management of shared power supplies for multi-core microprocessors

Also Published As

Publication number Publication date
CN103778014A (en) 2014-05-07

Similar Documents

Publication Publication Date Title
US9436254B2 (en) Method and apparatus for per core performance states
US9026816B2 (en) Method and system for determining an energy-efficient operating point of a platform
US8924755B2 (en) Connected standby sleep state
JP5410109B2 (en) Power control system and power control method
US8656196B2 (en) Hardware automatic performance state transitions in system on processor sleep and wake events
JP6322838B2 (en) Power management for memory access in system on chip
JP6370498B2 (en) Method and system for operating state coordination among multiple SOCs in a computing device
CN109064538B (en) View rendering method, device, storage medium and intelligent terminal
US10564708B2 (en) Opportunistic waking of an application processor
US20230161723A1 (en) Role detection for usb-based charging
WO2021121161A1 (en) Process management method and apparatus, electronic device
CN113253824B (en) MCU system based on RISC-V kernel, power supply method and terminal equipment
US9323307B2 (en) Active display processor sleep state
EP4478204A1 (en) Hardware interface signal generation method and apparatus and electronic device
WO2023123496A1 (en) Chip system and control method
CN107613546B (en) BLE chip, control method of designated element in BLE chip and Bluetooth low-power-consumption equipment
WO2013182098A1 (en) Method and device for multicore terminal sharing resources
CN112771470A (en) System, apparatus and method for common power control of multiple intellectual property bodies and shared power rails
EP3945424A1 (en) Memory power management method and processor system
KR102730355B1 (en) Low power system-on-chip and operation method thereof
CN103778014B (en) The method and device of multi-core terminal shared resource
WO2024216999A1 (en) Resource scheduling method and apparatus
CN115348566A (en) Near field communication method, mobile terminal and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 13800608

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 13800608

Country of ref document: EP

Kind code of ref document: A1