📄 cs44800.h
字号:
//=============================================================================
// File Name: ddx8001.h
//
// Copyright 2003 Cirrus Logic Corporation
//
// Description:
// Definitions for the ddx8001 pwm (Apogee) chip
//
// Modification History:
//
// $Id: cs44800.h,v 1.1 2005/04/29 10:22:00 michaell Exp $
// $Log: cs44800.h,v $
// Revision 1.1 2005/04/29 10:22:00 michaell
// merge 2.6 into head
//
// Revision 1.1.1.1 2005/03/07 08:07:07 dchien
// Import Sonata2_2-6-3
//
// Revision 1.2 2004/09/17 20:05:12 jminor
// Bug 26219, merge of CS44800 PWM driver.
//
// Revision 1.1.2.1 2004/09/17 15:18:02 jminor
// Bug 26217, integrated CS44800 driver to Hong Kong demo branch.
//
//============================================================================
#ifndef _cs44800_H
#define _cs44800_H
//-----------------------------------------------------------------------------
// Enumerations for setting various operating parameters
//-----------------------------------------------------------------------------
enum pwm_runstate {PWM_STOP, PWM_RUN}; // enum for run/low power state
// enum for GPIO pins
enum gpio_decl {GPIO0, GPIO1, GPIO2, GPIO3, GPIO4, GPIO5, GPIO6};
enum pwm_powerstate {PWM_OFF, PWM_ON};
enum pwm_mutestate {MUTE, UNMUTE};
enum pwm_mutechan {CHA1, CHB1, CHA2, CHB2, CHA3, CHB3, CHA4, CHB4, CH_ALL};
enum pwm_rampstate {RAMPED_UP, RAMPED_DOWN};
enum pwm_type { PWM_ST_FB, // ST full-bridge PWM back end
PWM_PH_HB, // Philips half-bridge PWM back end
PWM_UNKNOWN}; // Unsupported
#define VOL_0DB 51 // 0dB volume level setting
#define VOL_M20DB 31 // -20dB volume level setting
#define CS44800_ADDRESS 0x98 // CS44800 I2C address
//-----------------------------------------------------------------------------
// I2C register address definitions
//-----------------------------------------------------------------------------
#define CS44800_REG_VERSION 0x01 // Revision and ID
#define CS44800_CLK_CONFIG 0x02 // Clock configuration and power
#define CS44800_PWM_PDN 0x03 // PWM channel power down
#define CS44800_MISC_CONFIG 0x04 // Miscellaneous configuration
#define CS44800_RAMP_CONFIG 0x05 // Ramp configuration
#define CS44800_VOL_CONFIG 0x06 // Volume configuration
#define CS44800_MINT_VOL 0x07 // Master volume control, integer
#define CS44800_MFRAC_VOL 0x08 // Master volume control, fraction
#define CS44800_CH1INT_VOL 0x09 // Channel 1 volume, integer
#define CS44800_CH2INT_VOL 0x0a // Channel 2 volume, integer
#define CS44800_CH3INT_VOL 0x0b // Channel 3 volume, integer
#define CS44800_CH4INT_VOL 0x0c // Channel 4 volume, integer
#define CS44800_CH5INT_VOL 0x0d // Channel 5 volume, integer
#define CS44800_CH6INT_VOL 0x0e // Channel 6 volume, integer
#define CS44800_CH7INT_VOL 0x0f // Channel 7 volume, integer
#define CS44800_CH8INT_VOL 0x10 // Channel 8 volume, integer
#define CS44800_CH14FRAC_VOL 0x11 // Channels 1-4 volume, fraction
#define CS44800_CH58FRAC_VOL 0x12 // Channels 5-8 volume, fraction
#define CS44800_CHAN_MUTE 0x13 // Independent channel mute
#define CS44800_INV_POL 0x14 // Channel invert polarity
#define CS44800_PEAK_LIM 0x15 // Limiter control
#define CS44800_LIM_ATK 0x16 // Limiter attack rate
#define CS44800_LIM_REL 0x17 // Limiter release rate
#define CS44800_INT_CNTL 0x28 // Interrupt pin control
#define CS44800_INT_STATUS 0x2a // Interrupt status
#define CS44800_GPIO_IO 0x2c // GPIO pin direction
#define CS44800_GPIO_PT 0x2d // GPIO polarity/type
#define CS44800_GPIO_LE 0x2e // GPIO edge/level trigger
#define CS44800_GPIO_STAT 0x2f // GPIO pin status
#define CS44800_GPIO_INT_MASK 0x30 // GPIO interrupt mask
#define CS44800_PWM_CONFIG 0x31 // PWM configuration
#define CS44800_PWM_MIN_PULSE 0x32 // PWM minimum pulse width
#define CS44800_PWM_DELAY 0x33 // PWM delay
#define CS44800_PSR_CONFIG 0x34 // PSR and power supply config
#define CS44800_DEC_SCALE_2 0x35 // PSR Decimator scale factor
#define CS44800_DEC_SCALE_1 0x36 // PSR Decimator scale factor
#define CS44800_DEC_SCALE_0 0x37 // PSR Decimator scale factor
#define CS44800_DEC_OFF_2 0x38 // PSR Decimator offset
#define CS44800_DEC_OFF_1 0x39 // PSR Decimator offset
#define CS44800_DEC_OFF_0 0x3a // PSR Decimator offset
#define CS44800_DEC_OUT_2 0x3b // PSR Decimator output
#define CS44800_DEC_OUT_1 0x3c // PSR Decimator output
#define CS44800_DEC_OUT_0 0x3d // PSR Decimator output
#define PWM_POWERUP GPIO5 // PWM back end power up control
// for the Philips half-bridge
#define PWM_ENABLE1 GPIO1 // PWM Enable 1 (R/L out)
#define PWM_ENABLE2 GPIO2 // PWM Enable 2 (CEN/LFE out)
#define PWM_ENABLE3 GPIO3 // PWM Enable 3 (RS/LS out)
#define PWM_ENABLE4 GPIO4 // PWM Enable 4 (LX/RX out)
//-----------------------------------------------------------------------------
// Function:
int PWM_Init(
// Description:
// Initializes the CS44800
// Notes:
//
// Parameters:
void);
// Returns: unsigned char
// SUCCESS, FAIL otherwise
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Function:
int CS44800_SetPDNState(
// Description:
// Sets the power down state of the CS44800
// Notes:
//
// Parameters:
enum pwm_runstate state); // 0 - power down, 1 - run
// Returns: unsigned char
// SUCCESS = 0, FAIL otherwise
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Function:
int PWM_SetVolume(
// Description:
// Sets the master volume between +12dB and -50dB plus off.
// Notes:
//
// Parameters:
unsigned char vol); // 0-63, where 0 is off, 1 is -50dB and
// 63 is +12dB
// Returns: unsigned char
// SUCCESS = 0, FAIL otherwise
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Function:
unsigned char CS44800_SetChannelVolume(
// Description:
// Sets all channel volumes between +12dB and -50dB plus off.
// Notes:
//
// Parameters:
unsigned char vol); // 0-63, where 0, 1 is -50dB and 63 is +12dB
// Returns: unsigned char
// SUCCESS = 0, FAIL otherwise
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Function:
int PWM_AmpOn(
//
// Description:
// Turns the external High power amp on
//
// Parameters:
void
);
// Returns: SUCCESS or FAIL
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Function:
int PWM_AmpOff(
//
// Description:
// Turns the external High power amp off
//
// Parameters:
void
);
// Returns: SUCCESS or FAIL
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Function:
int PWM_Mute(
//
// Description:
// mutes the volume
//
// Parameters:
void
);
// Returns: SUCCESS or FAIL
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Function:
int PWM_UnMute(
//
// Description:
// unmutes the volume
//
// Parameters:
void
);
// Returns: SUCCESS or FAIL
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Function:
int CS44800_SetRampState(
// Description:
// Sets the ramp state (ramped up or ramped down) for all channels.
// Notes:
//
// Parameters:
enum pwm_rampstate state); // RAMPED_UP or RAMPED_DOWN
// Returns: unsigned char
// SUCCESS = 0, FAIL otherwise
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Function:
int CS44800_ClearGPIOInt(
// Description:
// Reads the CS44800 GPIO Status register to clear the GPIO interrupt.
// Notes:
//
// Parameters:
void);
// Returns: unsigned char
// SUCCESS = 0, FAIL otherwise
//
//-----------------------------------------------------------------------------
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -