csl_pwt.h
来自「dsp在音频处理中的运用」· C头文件 代码 · 共 558 行 · 第 1/2 页
H
558 行
/** ============================================================================
* @file csl_pwt.h
*
* @path $(CSLPATH)\arm\pwt\src
*
* @desc API and data structure for PWT CSL
*
*/
/* ============================================================================
* Copyright (c) Texas Instruments Inc 2002, 2003, 2004
*
* Use of this software is controlled by the terms and conditions found in the
* license agreement under which this software has been supplied.
* ===========================================================================
*/
/* @(#) PSP/CSL 3.00.01.00[5912] (2004-06-01) */
/* =============================================================================
* Revision History
* ===============
* 09-Jul-2004 sp Modifications done according to new CSL architecture
* 01-Jun-2004 Shiva File Created.
*
* =============================================================================
*/
#ifndef _CSL_PWT_H_
#define _CSL_PWT_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <csl.h>
#include <cslr_pwt.h>
/**
* PWT global typedef declarations
*/
/** Frequencies that PWT can be set with */
typedef enum
{
/** Value zero in FRC bits for buzzer frequency */
CSL_PWT_FRQ_ZERO = CSL_PWT_FRC_FRQ_ZERO,
/** Value one in FRC bits for buzzer frequency */
CSL_PWT_FRQ_ONE = CSL_PWT_FRC_FRQ_ONE,
/** Two value in FRC bits for buzzer frequency */
CSL_PWT_FRQ_TWO = CSL_PWT_FRC_FRQ_TWO,
/** Value three in FRC bits for buzzer frequency */
CSL_PWT_FRQ_THREE = CSL_PWT_FRC_FRQ_THREE,
/** Value four in FRC bits for buzzer frequency */
CSL_PWT_FRQ_FOUR = CSL_PWT_FRC_FRQ_FOUR,
/** Value five bits for buzzer frequency */
CSL_PWT_FRQ_FIVE = CSL_PWT_FRC_FRQ_FIVE,
/** Value six in FRC bits for buzzer frequency */
CSL_PWT_FRQ_SIX = CSL_PWT_FRC_FRQ_SIX,
/** Value seven in FRC bits for buzzer frequency */
CSL_PWT_FRQ_SEVEN = CSL_PWT_FRC_FRQ_SEVEN,
/** Value eight in FRC bits for buzzer frequency */
CSL_PWT_FRQ_EIGHT = CSL_PWT_FRC_FRQ_EIGHT,
/** Value nine in FRC bits for buzzer frequency */
CSL_PWT_FRQ_NINE = CSL_PWT_FRC_FRQ_NINE,
/** Value ten in FRC bits for buzzer frequency */
CSL_PWT_FRQ_TEN = CSL_PWT_FRC_FRQ_TEN,
/** Value eleven in FRC bits for buzzer frequency */
CSL_PWT_FRQ_ELEVEN = CSL_PWT_FRC_FRQ_ELEVEN
}CSL_PwtFrq;
/** Octave selection */
typedef enum
{
/** First octave selection */
CSL_PWT_FRC_OCT_ZERO = CSL_PWT_FRC_OCTV_FIRST,
/** Second octave selection */
CSL_PWT_FRC_OCT_ONE = CSL_PWT_FRC_OCTV_SECOND,
/** Third octave selection */
CSL_PWT_FRC_OCT_TWO = CSL_PWT_FRC_OCTV_THIRD,
/** Fourth octave selection */
CSL_PWT_FRC_OCT_THREE = CSL_PWT_FRC_OCTV_FOURTH
}CSL_PwtOct;
/** Tone switch ON/OFF */
typedef enum
{
/** Tone switch off */
CSL_PWT_VRC_ON_OFF_OFF = CSL_PWT_VRC_ONOFF_OFF,
/** Tone switch on */
CSL_PWT_VRC_ON_OFF_ON = CSL_PWT_VRC_ONOFF_ON
}CSL_PwtVrcOnoff;
/** Divider 1/154 switched ON/OFF */
typedef enum
{
/** Divider 1/154 switched on */
CSL_PWT_GCR_PWT_TESTIN_ON = CSL_PWT_GCR_TESTIN_ON,
/** Divider 1/154 switched off */
CSL_PWT_GCR_PWT_TESTIN_OFF = CSL_PWT_GCR_TESTIN_OFF
}CSL_PwtTestin;
/** PWT clock enable */
typedef enum
{
/** Clock disabled */
CSL_PWT_GCR_CLK_DIS = CSL_PWT_GCR_CLK_EN_DIS,
/** Clock enabled */
CSL_PWT_GCR_CLK_EN = CSL_PWT_GCR_CLK_EN_EN
}CSL_PwtClkEn;
/** Enums used to control the PWT */
typedef enum
{
/**
* @brief Command to switch off tone
* @param (NULL)
*/
CSL_PWT_CMD_VRC_ONOFF_OFF,
/**
* @brief Command to switch on tone
* @param (NULL)
*/
CSL_PWT_CMD_VRC_ONOFF_ON,
/**
* @brief Command to clock disable
* @param (NULL)
*/
CSL_PWT_CMD_GCR_CLK_EN_DIS,
/**
* @brief Command to clock enable
* @param (NULL)
*/
CSL_PWT_CMD_GCR_CLK_EN_EN
} CSL_PwtHwControlCmd;
/** Enums used to query the PWT H/W */
typedef enum
{
/**
* @brief Query frequency
* @param (CSL_PwtFrq *)
*/
CSL_PWT_QUERY_FRQ,
/**
* @brief Query octave
* @param (CSL_PwtOct *)
*/
CSL_PWT_QUERY_OCT,
/**
* @brief Query volume
* @param (Uint8 *)
*/
CSL_PWT_QUERY_VOL,
/**
* @brief Query divider 1/154 on / off
* @param (CSL_PwtTestin *)
*/
CSL_PWT_QUERY_TESTIN
} CSL_PwtHwStatusQuery;
/** Default setup values */
#define CSL_PWT_HWSETUP_DEFAULTS \
{ \
CSL_PWT_FRQ_ZERO, \
CSL_PWT_FRC_OCT_ZERO, \
0xFF, \
CSL_PWT_GCR_PWT_TESTIN_ON \
}
/** Default config values */
#define CSL_PWT_CONFIG_DEFAULTS \
{ \
CSL_PWT_FRC_RESETVAL, \
CSL_PWT_VRC_RESETVAL, \
CSL_PWT_GCR_RESETVAL \
}
/**
* PWT config structure
*/
typedef struct CSL_PwtConfig
{
/** Frequency control register */
volatile Uint8 FRC;
/** Volume control register */
volatile Uint8 VRC;
/** General control register */
volatile Uint8 GCR;
} CSL_PwtConfig;
/** Structure used to setup PWT device */
typedef struct CSL_PwtHwSetup
{
/** Frequencies selection */
CSL_PwtFrq frq;
/** Octave selection */
CSL_PwtOct oct;
/** Volume selection */
Uint8 vol;
/** Divider 1/154 switched ON/OFF (ON:0; OFF:1) */
CSL_PwtTestin testin;
} CSL_PwtHwSetup;
/** PWT object structure */
typedef struct CSL_PwtObj
{
/** Register overlay of the PWT */
CSL_PwtRegsOvly regs;
/** PWT instance */
CSL_InstNum perNum;
} CSL_PwtObj;
/** Pointer to the PWT instance */
typedef struct CSL_PwtObj *CSL_PwtHandle;
/**
* This will have the base-address information for the peripheral instance
*/
typedef struct CSL_PwtBaseAddress
{
/** Base-address of the Configuration registers of the peripheral */
CSL_PwtRegsOvly regs;
} CSL_PwtBaseAddress;
/**
* PWT Module specific parameters. Present implementation doesn't have
* any module specific parameters.
*/
typedef struct CSL_PwtParam
{
/** Bit mask to be used for module specific parameters.
* The below declaration is just a place-holder for future
* implementation.
*/
CSL_BitMask16 flags;
} CSL_PwtParam;
/**
* PWT module specific context information. Present implementation doesn't
* have any Context information.
*/
typedef struct CSL_PwtContext
{
/** Context information of PWT.
* The below declaration is just a place-holder for future
* implementation.
*/
Uint16 contextInfo;
} CSL_PwtContext;
/*
* PWT global function declarations
*/
/** ============================================================================
* @func CSL_pwtInit
*
* @desc
* This is the initialization function for the PWT CSL. This function
* needs to be called before any PWT CSL functions are called.
* This function is idem-potent.Currently, this function does not
* perform anything.
*
* @arg pContext
* Context information for PWT
*
* @ret CSL_Status
* CSL_SOK - Always returns
*
* @eg
* CSL_pwtInit (NULL)
* =============================================================================
*/
extern CSL_Status CSL_pwtInit (
CSL_PwtContext *pContext
);
/*
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?