RISC OS Open
A fast and easily customised operating system for ARM devices
ROOL
Home | News | Software | Bugs | Bounties | Forum | Documents | Photos | Contact us
Account

HALDeviceSysPeri_CPUClk

Hardware Abstraction Layer
» HAL Device API
» List of HAL devices
» CPU clock generator
(HALDeviceSysPeri_CPUClk)

Device API

Currently, only API version 0 is defined. API version 0 only allows the CPU clock rate to be set to one of a limited number of values, and the main entry points (numspeeds, info, get and set) to be re-entrant.

struct cpuclkdevice
{
  struct device dev;
  uint32_t (*numspeeds)(struct cpuclkdevice *cpuclk);
  uint32_t (*info)(struct cpuclkdevice *cpuclk,
                   uint32_t idx);
  uint32_t (*get)(struct cpuclkdevice *cpuclk);
  int (*set)(struct cpuclkdevice *cpuclk,
             uint32_t idx);
  int (*override)(struct cpuclkdevice *cpuclk,
                  const void *table,
                  uint32_t numentries,
                  int format);
};
Reading the available CPU speeds

The numspeeds and info entry points are used to read the number of available CPU speeds, and the corresponding clock rate (in MHz) for each speed index. These calls are equivalent to Portable_Speed2 reason codes 4 and 5. Clock rates returned by info must be increasing order.

Getting the current CPU speed

The get entry point should return the current CPU speed, as an index. If the call was made while in the middle of changing speed, the call must act to complete the change request before returning with the new clock speed. This call is equivalent to Portable_Speed2 reason code 7.

Setting the current CPU speed

The set entry point is used to set the CPU speed to the given index. If the call was made while in the middle of changing speed, the previous change request must be cancelled and the CPU should instead switch to the new speed. A return value of 0 indicates success, and -1 indicates failure. If a change request is cancelled due to set being re-entered, 0 is returned.

Overriding the list of available speeds

The override entry point can be used to override the list of CPU speeds that the device supports. This can be used for purposes such as overclocking. On entry, table must point to a device-specific table of data describing the available speeds, and numentries must be the number of entries in the table. format must be a device-specific identifier specifying the table format.

If the call is successful, the contents of table will be copied into the device the value of format will be returned.

If the call fails due to the table format being incorrect, the expected table format value will be returned.

If the call fails for any other reason (e.g. because the system is in the middle of changing speed), -1 will be returned.

For details about the supported table formats, see the source code/documentation accompanying the relevant device implementation.

Support in RISC OS

The PortableHAL version of the Portable module will search for a HALDeviceSysPeri_CPUClk device upon initialisation. If it finds such a device, and the device initialises successfully, it will use that device to provide implementations of the Portable_Speed and Portable_Speed2 SWIs.

Known implementations

Device ID Description Implemented in
HALDeviceID_CPUClk_OMAP3 OMAP3 CPU clock generator HAL.OMAP3.s.CPUClk
Information sources: Kernel.Hdr.HALDevice, HWSupport.PortableHAL.Hdr.CPUClkDevice in CVS
Revised on March 24, 2011 10:48:05 by Andrew Hodgkinson (6) (86.5.162.99)
Edit | Back in time (1 revision) | See changes | History | Views: Print | Source | Linked from: OMAP3 HAL, List of HAL devices

Search the Wiki

Commercial use

For commercial enquiries, please contact the owners of RISC OS, Castle Technology Ltd.

ROOL Store

The official C/C++ Development kit and more here.

Donate! Why?

Help ROOL make things happen – please consider donating!

Navigation

  • Home Page
  • All Pages
  • Recently Revised
  • Authors
  • Feeds
Site design © RISC OS Open Limited 2011 except where indicated
The RISC OS Open Instiki theme is based on Insitki's default layout

Valid XHTML 1.0  |  Valid CSS

Instiki 0.19.1(MML+)
This site runs on Rails

Hosted by Arachsys