📄 lumchr_mgr.c
字号:
status = DsOpenPath(&req_PathGBo2W_OutputStream, &PathGBo2W_OutputStream);
if ( status != S_OK ) printf("ERROR : S_ERROR returned for status of DsOpenPath()...\n");
status = DsOpenPath(&req_PathV2W_OutputXfer, &PathV2W_OutputXfer);
if ( status != S_OK ) printf("ERROR : S_ERROR returned for status of DsOpenPath()...\n");
//
// Setup getBitsData
//
// 15 : jpeg consume 0x00
// 14 : jpeg dct mode
// 13 : per-byte bit reversal to GB input
// 12 : per-byte bit reversal from GB output
//gbCtrl = 0x2; // no bit-reversal on input
gbCtrl = 0x00; // do bit-reversal on input and output
bufInIndex = DsGetBufferIndexFromDS_BUFFER(PathW2GBi_InputStream.buf.id);
bufOutIndex = DsGetBufferIndexFromDS_BUFFER(PathGBo2W_OutputStream.buf.id);
getBitsData = (((gbCtrl & 0xf) << 12) | ((bufInIndex & 0x3f) << 6) | (bufOutIndex & 0x3f));
//
// Write the values into the Vlx binary (pre-load).
//
#ifdef _CONFIG_VLX_C
getBitsOffset = VLXLAB_vlumchr__gb_config;
#else
getBitsOffset = VLXLAB_vlumchr_D0_GBDATA;
#endif
printf("\nGetBits configuration data at %d offset (short) in CM1\n", getBitsOffset);
vlxBin->Binary[ getBitsOffset >> 2 ] = getBitsData; // convert long long to short
printf("\nWrote GetBits configuration data = %x \n", getBitsData);
//
// Load the VLx binary into CM1
//
status = VlxLoadBinaryByValue(
vlxBin, // the pointer to the binary
((vlxBin->BinaryByteLength + 1) >> 1), // length to transfer is 16-bit quantities
VLXLAB_vlumchr_PCSTART, // transfer from the beginning of the binary
0, // which is the beginning of CM1 (offset 0)
VLX_LOAD_PIO // using the PIOs for the transfer.
);
printf("Sema Data @pVlSemaStop(0x%08x) : 0x%08x (after VLx load, before VLx run)\n" ,pVlSemaStop, *pVlSemaStop);
//
// Kick channels
// ~ Make sure this is done *after* doing the VLx binary load into CM1
//
#ifdef VERBOSE_MODE
printf("verbose: DsKick : PathW2GBi_InputStream.srcCh.id = 0x%x\n", PathW2GBi_InputStream.srcCh.id);
printf("verbose: DsKick : PathGBo2W_OutputStream.dstCh.id = 0x%x\n", PathGBo2W_OutputStream.dstCh.id);
#endif
// Kick InputSteam src. DST is IO, so DsKick not needed
DsKick(PathW2GBi_InputStream.srcCh.id, &dsSrc_PathW2GBi_InputStream);
// Kick OutputStream dst, SRC is IO, so DsKick not needed
DsKick(PathGBo2W_OutputStream.dstCh.id, &dsDst_PathGBo2W_OutputStream);
//
// Reset and kick the VLx program
//
printf("\nVlxKick()...\n");
VlxResetPC(); // this makes the starting PC for the VLx be 0.
VlxKick(); // this turns on the VLx clock.
//
// Wait for VLx to clear semaphore
//
i=0;
printf("\nWaiting for VLx to clear semaphore...\n");
while( *(volatile unsigned short*)pVlSemaStop != 0 ) {
if( i++ > SEMA_TIMEOUT_CYCLES ) break;
}
printf("Sema Data @pVlSemaStop(0x%08x) : 0x%08x (after VLx load, before VLx run)\n" ,pVlSemaStop, *pVlSemaStop);
if (i>SEMA_TIMEOUT_CYCLES) {
printf("ERROR...semaphore timed out, resume.\n");
succeeded = S_FAIL_SEMA;
printf("status.gb_stall = 0x%x\n", *pVlStatusGb );
} else {
printf("...semaphore cleared, resume.\n");
}
printf("\nVlxStop()\n");
VlxStop(); // turns off the VLx clock
printf("\nDsKick for PathV2W_OutputXfer\n");
DsKick(PathV2W_OutputXfer.dstCh.id, &dsDst_PathV2W_OutputXfer);
DsKick(PathV2W_OutputXfer.srcCh.id, &dsSrc_PathV2W_OutputXfer);
printf("\nWaiting for PathV2W_OutputXfer.srcCh to halt...\n");
DsWaitHalted(PathV2W_OutputXfer.srcCh.id, DS_TIMEOUT_INDEFINITE);
printf("\t...halt detected; continuing.\n");
#if 0
printf("\nPrintout BufferTmp[]...\n");
for (i=0;i<10;i++) printf("BufferTmp[%d] = 0x%x\n", i, BufferTmp[i] );
#endif
printf("\nPrintout BufferOut[]...\n");
for (i=0;i<8;i++) printf("BufferOut[%d] = 0x%04x\n", i, BufferOut[i] );
//
// Check Data
//
if (
(BufferOut[0] != 0x73)
|| (BufferOut[1] != 0x53)
|| (BufferOut[2] != 0x1a5)
)
{
succeeded = S_FAIL_DATA;
}
if ( succeeded == S_PASS ) {
printf("\nPASSED!! \n");
} else {
printf("\nFAILED!! \n");
}
printf("\tBufferOut[0] = 0x%x, ExpectedVal = 0x%x\n", BufferOut[0], 0x73 );
printf("\tBufferOut[1] = 0x%x, ExpectedVal = 0x%x\n", BufferOut[1], 0x53 );
printf("\tBufferOut[2] = 0x%x, ExpectedVal = 0x%x\n", BufferOut[2], 0x1a5 );
} // end main end
//-------------------------------------------
//
// Function Defintions
//
//---------------------------------------
// BEGIN FUNC InitData()
//
//---------------------------------------
//
// CHR (MPEG spec Table B.13):
//
// vlc : 110 111 -> size 3 value 0x7
// vlc : 110 101 -> size 3 value 0x5
// vlc : 11110 11010 -> size 5 value 0x1a
//
// 110_111_110_101_11110_11010
// 1101111101011111011010 <-> 0101101111101011111011
// 1101_1111_0101_1111_0110_10 <-> 01_0110_1111_1010_1111_1011
// d . f . 5 . f . 6 . 8 <-> 1 . 6 . f . a . f . b
// 0xdf5f68 <-> 0x16fafb
//
// ---
//
// Start Code :
//
// 0x55_aa00_ff00_011c
// 01010101_10101010_00000000_11111111_00000000_00000001_11111100
// Data0[0] = 0x55;
// Data0[1] = 0xaa;
// Data0[2] = 0x00;
// Data0[3] = 0xff;
// Data0[4] = 0x00; // start code 1 of 3
// Data0[5] = 0x00; // start code 2 of 3
// Data0[6] = 0x01; // start code 3 of 3
// Data0[7] = 0x1c; // start code value
//
// Expected output :
//
// MAP PRINTF: BufferOut[0] = 0x0073
// MAP PRINTF: BufferOut[1] = 0x0053
// MAP PRINTF: BufferOut[2] = 0x01a5
//
void InitData(unsigned char *lArrayIn)
{
int i=0;
unsigned char Data0[BLOCKSIZE+1];
// Input Buffer
//for (i=0;i<BLOCKSIZE;i++) { Data0[i] = i; } // Init to incrementing sequence
for (i=0;i<BLOCKSIZE;i++) { Data0[i] = 0; } // Init to incrementing zeros
// Override these values // 0x5010254
Data0[0] = 0x51;
Data0[1] = 0xa1;
Data0[2] = 0xa2;
Data0[3] = 0x52;
Data0[4] = 0x00; // start code 1 of 3
Data0[5] = 0x00; // start code 2 of 3
Data0[6] = 0x80; // start code 3 of 3
Data0[7] = 0x1c; // start code value
Data0[8] = 0xdf;
Data0[9] = 0x5f;
Data0[10] = 0x68;
Data0[11] = 0x00;
for (i=0;i<BLOCKSIZE;i++) {
if ( i <= 7) {
lArrayIn[i] = swap_table[Data0[i]]; // Do bitswap per byte
} else {
//lArrayIn[i] = swap_table[Data0[i]]; // Do bitswap per byte
lArrayIn[i] = Data0[i]; // No swap
}
}
} // END FUNC InitData()
void InitDsReqPath(
DS_PATH_INFO *dsPathRequest,
BOOL isSrcIO,
BOOL isDstIO,
SINT32 bufferSize,
SINT32 srcSize,
SINT32 dstSize
)
{
dsPathRequest->srcCh.transferBurstSize = DS_DEFAULT;
dsPathRequest->srcCh.minInterburstDelay = DS_DEFAULT;
dsPathRequest->srcCh.dtsPriority = 1;
dsPathRequest->srcCh.channelPriority = DS_DEFAULT;
dsPathRequest->srcCh.descriptorFetchMode = DS_ACCESS_MODE_COHERENT_ALLOCATE;
dsPathRequest->srcCh.wayMask = DS_DEFAULT;
dsPathRequest->srcCh.base = 0;
dsPathRequest->isSrcIO = FALSE;
dsPathRequest->dstCh.transferBurstSize = DS_DEFAULT;
dsPathRequest->dstCh.minInterburstDelay = DS_DEFAULT;
dsPathRequest->dstCh.dtsPriority = 1;
dsPathRequest->dstCh.channelPriority = DS_DEFAULT;
dsPathRequest->dstCh.descriptorFetchMode = DS_ACCESS_MODE_COHERENT_ALLOCATE;
dsPathRequest->dstCh.wayMask = DS_DEFAULT;
dsPathRequest->dstCh.base = 0;
dsPathRequest->isDstIO = FALSE;
dsPathRequest->buf.bufferSize = bufferSize; // in bytes
dsPathRequest->buf.srcChunkSize = 32;
dsPathRequest->buf.dstChunkSize = 32;
dsPathRequest->isSrcIO = isSrcIO;
dsPathRequest->isDstIO = isDstIO;
dsPathRequest->flags = 0;
}
// END PROGRAM FILE end basic.c
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -