📄 _csl_prevwritetable.c
字号:
/** @file _csl_prevWriteTable.c
*
* @brief File for functional layer of CSL API @a CSL_prevWriteTable()
*
* Description
* - The @a CSL_prevWriteTable() function definition & it's associated
* functions
*
* @date 18th October, 2004
* @author Vignesh LA.
*/
#include <csl_prev_aux.h>
#pragma CODE_SECTION (CSL_prevWriteTable, ".text:csl_section:prev");
/** @brief Writes the Gamma table to appropriate location.
*
*/
CSL_Status CSL_prevWriteTable(
/** Pointer to the object that holds reference to the
* instance of PREV requested after the call
*/
CSL_PrevHandle hPrev,
/** Pointer to the object that holds reference to the
* structure holding pointers to Red, Green and Blue Gamma
* tables
*/
CSL_PrevWriteTableData *data
){
Int16 i;
CSL_PrevRegsOvly prevRegs = hPrev->regs;
if(data == NULL) return (CSL_ESYS_INVPARAMS);
/*
Start End Memory
--------------------------------------------
0x0000 0x03FF Red Gamma table
0x0400 0x07FF Green Gamma table
0x0800 0x0BFF Blue Gamma table
0x0C00 0x0CFF NF threshold table
0x1000 0x107F Non-linear enhancer table
0x1400 0x163F CFA filter coefficient (each coefficient is 8-bits with a total of up to 576 coefficients)
*/
switch(data->tableSelect) {
case CSL_PREV_NOISE_FILTER:
/* 256x8 bits of table is to be written*/
/* we need to set the address once as it is an auto increment register on
a Read/Write*/
prevRegs->SET_TBL_ADDRESS = CSL_FMK(PREV_SET_TBL_ADDRESS_ADDR,0x0C00);
for( i=0;i<256;i++) {
prevRegs->SET_TBL_DATA = CSL_FMK(PREV_SET_TBL_DATA_DATA,data->tableData[i]);
}
break;
case CSL_PREV_GAMMA:
/* 3x1024x8 bits of table is to be written*/
prevRegs->SET_TBL_ADDRESS = CSL_FMK(PREV_SET_TBL_ADDRESS_ADDR,0);
for( i=0;i<3072;i++) {
prevRegs->SET_TBL_DATA = CSL_FMK(PREV_SET_TBL_DATA_DATA,data->tableData[i]);
}
break;
case CSL_PREV_RED_GAMMA:
/* 1024x8 bits of table is to be written*/
prevRegs->SET_TBL_ADDRESS = CSL_FMK(PREV_SET_TBL_ADDRESS_ADDR,0);
for( i=0;i<1024;i++) {
prevRegs->SET_TBL_DATA = CSL_FMK(PREV_SET_TBL_DATA_DATA,data->tableData[i]);
}
break;
case CSL_PREV_GREEN_GAMMA:
/* 1024x8 bits of table is to be written*/
prevRegs->SET_TBL_ADDRESS = CSL_FMK(PREV_SET_TBL_ADDRESS_ADDR,0x0400);
for( i=0;i<1024;i++) {
prevRegs->SET_TBL_DATA = CSL_FMK(PREV_SET_TBL_DATA_DATA,data->tableData[i]);
}
break;
case CSL_PREV_BLUE_GAMMA:
/* 1024x8 bits of table is to be written*/
prevRegs->SET_TBL_ADDRESS = CSL_FMK(PREV_SET_TBL_ADDRESS_ADDR,0x0800);
for( i=0;i<1024;i++) {
prevRegs->SET_TBL_DATA = CSL_FMK(PREV_SET_TBL_DATA_DATA,data->tableData[i]);
}
break;
case CSL_PREV_NL_LUM:
/* 128x20 bits of table is to be written*/
prevRegs->SET_TBL_ADDRESS = CSL_FMK(PREV_SET_TBL_ADDRESS_ADDR,0x1000);
for( i=0;i<128;i++) {
prevRegs->SET_TBL_DATA = CSL_FMK(PREV_SET_TBL_DATA_DATA,data->tableData[i]);
}
break;
case CSL_PREV_CFA_COEF:
/* 24x192 = 576x8 bits of table is to be written*/
prevRegs->SET_TBL_ADDRESS = CSL_FMK(PREV_SET_TBL_ADDRESS_ADDR,0x1400);
for( i=0;i<576;i++) {
prevRegs->SET_TBL_DATA = CSL_FMK(PREV_SET_TBL_DATA_DATA,data->tableData[i]);
}
break;
default:
return (CSL_ESYS_INVPARAMS);
};
return (CSL_SOK);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -