csl_uwireaux.h
来自「dsp在音频处理中的运用」· C头文件 代码 · 共 466 行
H
466 行
/**==========================================================================
* @file csl_uwireAux.h
*
* @path $(CSLPATH)\arm\uwire\src
*
* @desc API Auxilary header file for UWIRE 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-22) */
/*============================================================================
* Revision History
* ===============
* 24-Jun-2004 rr File Created.
*
*============================================================================
*/
#ifndef _CSL_UWIREAUX_H_
#define _CSL_UWIREAUX_H_
/* Inline Functions */
#include<csl_uwire.h>
/**
* Hardware Control Functions of UWIRE
*/
/**===========================================================================
* @n@b CSL_uwireLoadTdr
* @des
* @n Function to load the transmit data register
*
* @b Arguments
* @verbatim
hUwire Handle to MicroWire interface
tdr argument passed
@endverbatim
*
* <b> Return Value </b> void
*
* <b> Pre Condition </b>
* @n none
*
* <b> Post Condition </b>
* @n transmit data register is filled
*
* @b Modifies
* @n transmit data register
*
* @b Example
* @verbatim
CSL_UwireHandle hUwire;
.............
CSL_uwireLoadTdr (hUwire, tdr);
@endverbatim
*=============================================================================
*/
static inline
void CSL_uwireLoadTdr(
CSL_UwireHandle hUwire,
Uint16 tdr
)
{
CSL_FINS(hUwire->regs->TDR_RDR,UWIRE_TDR_RDR_TDR_RDR,tdr);
}
/**===========================================================================
* @n@b CSL_uwireSetActive
* @des
* @n Function to set the chip select of the selected device to its
* active level
* @b Arguments
* @verbatim
hUwire Handle to MicroWire interface
@endverbatim
*
* <b> Return Value </b> void
*
* <b> Pre Condition </b>
* @n none
*
* <b> Post Condition </b>
* @n Chip select of the selected device is active.
*
* @b Modifies
* @n The corresponding bit in the control register
*
* @b Example
* @verbatim
CSL_UwireHandle hUwire;
.............
CSL_uwireSetActive (hUwire);
@endverbatim
*=============================================================================
*/
static inline
void CSL_uwireSetActive (
CSL_UwireHandle hUwire
)
{
CSL_FINST(hUwire->regs->CSR,UWIRE_CSR_CS_CMD,ACTIVE);
}
/**===========================================================================
* @n@b CSL_uwireSetInactive
* @des
* @n Function to set the chip select of the selected device to its
* inactive level
*
* @b Arguments
* @verbatim
hUwire Handle to MicroWire interface
@endverbatim
*
* <b> Return Value </b> void
*
* <b> Pre Condition </b>
* @n none
*
* <b> Post Condition </b>
* @n Chip select of the selected device is inactive.
*
* @b Modifies
* @n The corresponding bit in the control register
*
* @b Example
* @verbatim
CSL_UwireHandle hUwire;
.............
CSL_uwireSetInactive (hUwire);
@endverbatim
*=============================================================================
*/
static inline
void CSL_uwireSetInactive (
CSL_UwireHandle hUwire
)
{
CSL_FINST(hUwire->regs->CSR,UWIRE_CSR_CS_CMD,INACTIVE);
}
/**===========================================================================
* @n@b CSL_uwireStartEn
* @des
* @n Function to make the interface Start a write and/or read process
*
* @b Arguments
* @verbatim
hUwire Handle to MicroWire interface
@endverbatim
*
* <b> Return Value </b> void
*
* <b> Pre Condition </b>
* @n none
*
* <b> Post Condition </b>
* @n A write and/or read process gets started
*
* @b Modifies
* @n The corresponding bit in the control register
*
* @b Example
* @verbatim
CSL_UwireHandle hUwire;
..........
CSL_uwireStartEn (hUwire);
@endverbatim
*=============================================================================
*/
static inline
void CSL_uwireStartEn(
CSL_UwireHandle hUwire
)
{
CSL_FINST(hUwire->regs->CSR,UWIRE_CSR_START,ENABLE);
}
/**===========================================================================
* @n@b CSL_uwireStartDb
* @des
* @n Function to make the interface stop a write and/or read process
*
* @b Arguments
* @verbatim
hUwire Handle to MicroWire interface
@endverbatim
*
* <b> Return Value </b> void
*
* <b> Pre Condition </b>
* @n none
*
* <b> Post Condition </b>
* @n A write and/or read process is not started
*
* @b Modifies
* @n The corresponding bit in the control register
*
* @b Example
* @verbatim
CSL_UwireHandle hUwire;
..........
CSL_uwireStartDb (hUwire);
@endverbatim
*=============================================================================
*/
static inline
void CSL_uwireStartDb(
CSL_UwireHandle hUwire
)
{
CSL_FINST(hUwire->regs->CSR,UWIRE_CSR_START,DISABLE);
}
/**===========================================================================
* @n@b CSL_uwireSetIndex
* @des
* @n Function to set the index for selecting the external device
*
* @b Arguments
* @verbatim
hUwire Handle to MicroWire interface
index argument passed
@endverbatim
*
* <b> Return Value </b> void
*
* <b> Pre Condition </b>
* @n none
*
* <b> Post Condition </b>
* @n Device specified by the index is selected
*
* @b Modifies
* @n The corresponding bits in the control register
*
* @b Example
* @verbatim
CSL_UwireHandle hUwire;
.............
CSL_uwireInex (hUwire, &index);
@endverbatim
*=============================================================================
*/
static inline
void CSL_uwireSetIndex (
CSL_UwireHandle hUwire,
CSL_UwireIndex index
)
{
CSL_FINS(hUwire->regs->CSR,UWIRE_CSR_INDEX,index);
}
/**===========================================================================
* @n@b CSL_uwireNbRead
* @des
* @n Function to set the number of bits to be received
*
* @b Arguments
* @verbatim
hUwire Handle to MicroWire interface
nbrd argument passed
@endverbatim
*
* <b> Return Value </b> void
*
* <b> Pre Condition </b>
* @n none
*
* <b> Post Condition </b>
* @n Holds the number of bits to be read
*
* @b Modifies
* @n The corresponding bits in the control register
*
* @b example
* @verbatim
CSL_UwireHandle hUwire;
.............
CSL_uwireNbRead (hUwire,&nbrd);
@endverbatim
*=============================================================================
*/
static inline
void CSL_uwireNbRead (
CSL_UwireHandle hUwire,
Uint8 Nbrd
)
{
CSL_FINS(hUwire->regs->CSR,UWIRE_CSR_NB_BITS_RD,Nbrd);
}
/**===========================================================================
* @n@b CSL_uwireNbWrite
* @des
* @n Function to set the number of bits to be transmitted
*
* @b Arguments
* @verbatim
hUwire Handle to MicroWire interface
nbwt argument passed
@endverbatim
*
* <b> Return Value </b> void
*
* <b> Pre Condition </b>
* @n none
*
* <b> Post Condition </b>
* @n Holds the number of bits to transmit
*
* @b Modifies
* @n The corresponding bits in the control register
*
* @b Example
* @verbatim
CSL_UwireHandle hUwire;
.............
CSL_uwireNbWrite (hUwire,&nbwt);
@endverbatim
*=============================================================================
*/
static inline
void CSL_uwireNbWrite (
CSL_UwireHandle hUwire,
Uint8 Nbwt
)
{
CSL_FINS(hUwire->regs->CSR,UWIRE_CSR_NB_BITS_WR,Nbwt);
}
/**===========================================================================
* @n@b CSL_uwireGetRdr
* @des
* @n Function to get the receive data register value
*
* @b Arguments
* @verbatim
hUwire Handle to MicroWire interface
@endverbatim
*
* <b> Return Value </b> Uint16
*
* <b> Pre Condition </b>
* @n none
*
* <b> Post Condition </b>
* @n Response contains the receive data register contents
*
* @b Modifies
* @n none
*
* @b Example
* @verbatim
CSL_UwireHandle hUwire;
.............
*((Uint16 *) response) = CSL_uwireGetRdr (hUwire);
@endverbatim
*=============================================================================
*/
static inline
Uint16 CSL_uwireGetRdr(CSL_UwireHandle hUwire
)
{
return(Uint16)(hUwire->regs->TDR_RDR);
}
/**===========================================================================
* @n@b CSL_uwireGetRdState
* @des
* @n Function to get the status of the receive data register
*
* @b Arguments
* @verbatim
hUwire Handle to MicroWire interface
@endverbatim
*
* <b> Return Value </b> Bool
*
* <b> Pre Condition </b>
* @n none
*
* <b> Post Condition </b>
* @n Response contains the status of the receive data register
*
* @b Modifies
* @n none
*
* @b Example
* @verbatim
CSL_UwireHandle hUwire;
.............
*((Bool *) response) = CSL_uwireGetRdstate (hUwire);
@endverbatim
*=============================================================================
*/
static inline
Bool CSL_uwireGetRdstate (
CSL_UwireHandle hUwire
)
{
return (Bool)CSL_FEXT(hUwire->regs->CSR,UWIRE_CSR_RDRB);
}
/**===========================================================================
* @n@b CSL_uwireGetCsrb
*
* @b Description
* @n Function to get check whether CSR is ready to receive data
*
* @b Arguments
* @verbatim
hUwire Handle to MicroWire interface
@endverbatim
*
* <b> Return Value </b> Bool
*
* <b> Pre Condition </b>
* @n none
*
* <b> Post Condition </b>
* @n Response contains the status whether CSR is ready to receive data
*
* @b Modifies
* @n none
*
* @b Example
* @verbatim
CSL_UwireHandle hUwire;
.............
*((Bool *) response) = CSL_uwireGetCsrb ( hUwire );
@endverbatim
*=============================================================================
*/
static inline
Bool CSL_uwireGetCsrb (
CSL_UwireHandle hUwire
)
{
return (Bool)CSL_FEXT(hUwire->regs->CSR,UWIRE_CSR_CSRB);
}
#endif /* _CSL_UWIREAUX_H_ */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?