📄 tsip_data.c
字号:
/* ============================================================================
* Copyright (c) Texas Instruments Inc 2002, 2003, 2004, 2005, 2006
*
* Use of this software is controlled by the terms and conditions found
* in the license agreement under which this software has been supplied.
* ============================================================================
*/
/** ============================================================================
* @file tsip_data.c
*
* @path $(CSLPATH)\example\c6486\tsip_elb_example\tsip\src
*
* @desc This is an utility program for TSIP example.
*
* ============================================================================
*/
#include <csl_types.h>
#include <csl_psc.h>
#include <cslr_psc.h>
#include <soc.h>
/* For PSC */
CSL_PscHandle hPsc;
CSL_PscObj pscObj;
CSL_Status psc_status;
/*
* =============================================================================
* @func Init_Mem
*
* @desc
* @n This function initializes memory with data passed.
*
* @arg
* Addr - Address from which memory has to be initialized.
* NoofArrays - Lengh
* Count - Number of data
* IncrData - data to be incremented
*
* @return
* None
* =============================================================================
*/
void Init_Mem (
Uint8* Addr,
Uint32 NoofArrays,
Uint32 Count,
Uint8 IncrData
)
{
Uint32 i;
Uint32 Data = 0x1;
for (i=0; i < Count * NoofArrays; i++) {
*(Uint8*)(Addr + i) = Data;
Data += IncrData;
}
}
/*
* =============================================================================
* @func Verify_Transfer
*
* @desc
* @n This function Verifies TSIP CFG A transfer
*
* @arg
* FrameCnt - Frame count
* FrameSize - Frame size
* srcBuff - Source buffer
* dstBuff - Destination buffer
*
* @return
* None
* =============================================================================
*/
Bool Verify_Transfer (
Uint32 FrameCnt,
Uint32 FrameSize,
Uint32 srcBuff,
Uint32 dstBuff
)
{
Uint8* ExpArrayPtr = (Uint8*)(srcBuff );
Uint8* dstArrayPtr = (Uint8*)(dstBuff );
int i,j;
dstArrayPtr = dstArrayPtr + FrameSize;
ExpArrayPtr = (Uint8*)(srcBuff );
dstArrayPtr = (Uint8*)(dstBuff );
dstArrayPtr = dstArrayPtr + FrameSize ;
for (i = 0; i < FrameCnt + 1 ; i++) {
for (j = 0; j < FrameSize;j++) {
if (j >= (FrameSize - 4) ) {
if(dstArrayPtr[j] != ((i+1)>> ((j - FrameSize - 4) * 8))) {
return (1);
}
}
else {
if (j > 3) {
if(ExpArrayPtr[j] != dstArrayPtr[j]) {
return (1);
}
}
else {
if(dstArrayPtr[j] != ((i+1)>> (j * 8))) {
return (1);
}
}
}
}
ExpArrayPtr = ExpArrayPtr + FrameSize ;
dstArrayPtr = dstArrayPtr + FrameSize ;
}
return (0);
}
/*
* =============================================================================
* @func Verify_Transfer_BigEnd
*
* @desc
* @n This function Verifies TSIP CFG A BigEndian transfer
*
* @arg
* FrameCnt - Frame count
* FrameSize - Frame size
* srcBuff - Source buffer
* dstBuff - Destination buffer
*
* @return
* None
* =============================================================================
*/
Bool Verify_Transfer_BigEnd (
Uint32 FrameCnt,
Uint32 FrameSize,
Uint32 srcBuff,
Uint32 dstBuff
)
{
Uint8* ExpArrayPtr = (Uint8*)(srcBuff );
Uint8* dstArrayPtr = (Uint8*)(dstBuff );
int i,j;
dstArrayPtr = dstArrayPtr + FrameSize;
ExpArrayPtr = (Uint8*)(srcBuff );
dstArrayPtr = (Uint8*)(dstBuff );
dstArrayPtr = dstArrayPtr + FrameSize ;
for (i = 0; i < FrameCnt + 1 ; i++) {
for (j = 0; j < FrameSize;j++) {
if (j >= (FrameSize - 4) ) {
if(dstArrayPtr[(j/4 * 4) + (3 - (j%4))] !=
((i+1)>> ((j - FrameSize - 4) * 8))) {
return (1);
}
}
else {
if (j > 3) {
if(ExpArrayPtr[j] != dstArrayPtr[j]) {
return (1);
}
}
else {
if(dstArrayPtr[(3 - (j%4))] != ((i+1)>> (j * 8))) {
return (1);
}
}
}
}
ExpArrayPtr = ExpArrayPtr + FrameSize ;
dstArrayPtr = dstArrayPtr + FrameSize ;
}
return (0);
}
/*
* =============================================================================
* @func setup_PSC
*
* @desc
* @n This function is to setup PSC
*
* @arg
* None
*
* @return
* None
* =============================================================================
*/
void setup_PSC (
void
)
{
hPsc = CSL_pscOpen(&pscObj, CSL_PSC, NULL, &psc_status);
}
/*
* =============================================================================
* @func Close_PSC_handle
*
* @desc
* @n This function is to close PSC instance.
*
* @arg
* None
*
* @return
* None
* =============================================================================
*/
void Close_PSC_handle (
void
)
{
CSL_pscClose(hPsc);
}
/*
* =============================================================================
* @func TSIP_Domain_Enable
*
* @desc
* @n This function is to enables the TSIP PSC domains
*
* @arg
* None
*
* @return
* None
* =============================================================================
*/
void TSIP_Domain_Enable (
void
)
{
Uint32 pwrDmn;
Uint32 module;
Uint32 response;
setup_PSC();
/* Enabling TSIP0 Clock */
module = CSL_PSC_MODULE_TSIP0;
CSL_pscHwControl (hPsc, CSL_PSC_CMD_ENABLE_MODULE, &module);
/* set Go for Power domain transition*/
pwrDmn = CSL_PSC_PWRDMN_ALWAYSON;
CSL_pscHwControl (hPsc, CSL_PSC_CMD_PWRDMN_TRNS, &pwrDmn);
/* Enabling TSIP1 Clock */
module = CSL_PSC_MODULE_TSIP1;
CSL_pscHwControl (hPsc, CSL_PSC_CMD_ENABLE_MODULE, &module);
/* set Go for Power domain transition*/
pwrDmn = CSL_PSC_PWRDMN_ALWAYSON;
CSL_pscHwControl (hPsc, CSL_PSC_CMD_PWRDMN_TRNS, &pwrDmn);
/* Enabling TSIP2 Clock */
module = CSL_PSC_MODULE_TSIP2;
CSL_pscHwControl (hPsc, CSL_PSC_CMD_ENABLE_MODULE, &module);
/* set Go for Power domain transition*/
pwrDmn = CSL_PSC_PWRDMN_ALWAYSON;
CSL_pscHwControl (hPsc, CSL_PSC_CMD_PWRDMN_TRNS, &pwrDmn);
do {
CSL_pscGetHwStatus(hPsc, CSL_PSC_QUERY_PWRDMN_TRANS_STAT,
(void *)&response);
response &= (1 << CSL_PSC_PWRDMN_ALWAYSON);
} while(response != 0x0);
Close_PSC_handle();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -