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

HALDeviceAudio_AudC

Hardware Abstraction Layer
» HAL Device API
» List of HAL devices
» 16-bit sound input/output controller

16-bit sound input/output controller

(HALDeviceAudio_AudC)

Device API

API versions 0 and 1 are currently defined.

API version 0

API version 0 is a simplistic version of the API, where most of the work is performed directly by the SoundDMA? module.

struct haldeviceaudio_audc
{
    struct device;
    struct haldeviceaudio_mixer *mixer;
    unsigned int channels_out;
    unsigned int channels_in;
}

mixer points to the mixer device associated with this sound output device. channels_out and channels_in contain the number of output and input channels supported by the device.

API version 1

API version 1 extends the haldevice_audc struct, allowing the HAL device to implement all the device-specific functionality that was previously in SoundDMA.

struct haldevice_audc_1
{
  /* Version 0 interface */
  struct haldevice_audc dev;

  /* 1.0 extension */
  uint32_t dmaparams[5];
  void (*PreEnable)(struct haldevice_audc_1 *, uint32_t dmabufsize);
  void (*PostEnable)(struct haldevice_audc_1 *, uint32_t dmabufsize);
  void (*PreDisable)(struct haldevice_audc_1 *);
  void (*PostDisable)(struct haldevice_audc_1 *);
  uint32_t (*IRQHandle)(struct haldevice_audc_1 *);
  uint32_t numrates;
  struct audioratetable *ratetable;
  void (*SetRate)(struct haldevice_audc_1 *, uint32_t index);
};

The dmaparams array contains the values of R0, R1, R2, R3 and R7 to provide to DMA_RegisterChannel? when SoundDMA module registers itself with DMAManager?.

The PreEnable and PostEnable calls are made when audio is being enabled. They are both called with IRQs enabled, and with dmabufsize specifying the size of the DMA buffer that is in use (in bytes). The driver should use dmabufsize to program the controller as required, e.g. setting FIFO threshold levels. PreEnable will be called before DMA is enabled, and PostEnable will be called after DMA is enabled.

The PreDisable and PostDisable calls are made when audio is being disabled. As with the Enable calls, IRQs will be enabled, and PreDisable will be called before DMA is disabled, while PostDisable will be called after DMA has been disabled.

If the device specifies an IRQ device number, then IRQHandle will be called whenever an interrupt is received from the device, whether audio is currently enabled or not. The return code of IRQHandle indicates what action the SoundDMA module should take:

Return code Meaning
0 No action necessary
1 Audio reset required (i.e. turn audio off and then on again). This return code has no effect if audio is already off.
Other values Reserved

numrates specifies the number of entries in the sample rate table. The sample rate table, pointed to by ratetable is an array of audioratetable structures:

struct audioratetable
{
  uint32_t frequency; // Frequency in Hz
  uint8_t period; // Period in usec
  uint8_t reserved[3]; // Reserved - can be used by audio device
};

The entries in the sample rate table must be in order of increasing frequency.

SetRate is used to set the current sample rate. The index parameter is a 0-based index into ratetable, indicating the sample rate to use. The sample rate will only be modified while audio is turned off.

Support in RISC OS

The Sound0Trid version of the SoundDMA module only supports API version 0.×.

The Sound0HAL version of the SoundDMA module only supports API version 1.×.

Known implementations

Device ID Description Implemented in
HALDeviceID_AudC_M5451 Acer M5451 AC’97 controller HAL.Tungsten.s.Audio
HALDeviceID_AudC_TPS65950 TPS65950-compatible audio controller HAL.OMAP3.s.Audio
Information sources: Kernel.Hdr.HALDevice, HWSupport.Sound.Sound0Trid.hdr.AudioDevice, HWSupport.Sound.Sound0HAL.hdr.AudioDevice in CVS
Revised on January 16, 2010 19:45:37 by Jeffrey Lee (213) (127.0.0.1)
Edit | Back in time (2 revisions) | See changes | History | Views: Print | Source | Linked from: OMAP3 HAL, List of HAL devices, HALDeviceAudio_Mixer

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