📄 dpof.c
字号:
else
{
if (ByteCount & 0x00000001)
{
if (JobSection_Length & 0x00000001)
{
while ((JobSection_Length - 1) > 0)
{
L2_DRAMSetStartAddr(JobSection_StartDramAddr,K_SDRAM_Prefetch);
L2_DRAMReadWord(&tmp1,&tmp2);
L2_DRAMReadWord(&tmp3,&tmp4);
L2_DRAMSetStartAddr(NewDpofFileDramAddr,K_SDRAM_NoPrefetch);
L2_DRAMWriteWord(tmp2,tmp3);
//Next source address is not wordboundary
JobSection_StartDramAddr += 1;
JobSection_Length -= 2;
//Next destination address iswordboundary
NewDpofFileByteCount += 2;
NewDpofFileDramAddr = K_SDRAM_DPOF4_BufAddr + (NewDpofFileByteCount >> 1);
}
//Copy the last byte tmp1
L2_DRAMSetStartAddr(JobSection_StartDramAddr,K_SDRAM_Prefetch);
L2_DRAMReadWord(&tmp1,&tmp2);
L2_DRAMSetStartAddr(NewDpofFileDramAddr,K_SDRAM_NoPrefetch);
L2_DRAMWriteWord(tmp2,0x00);
//Next destination address is not wordboundary
NewDpofFileByteCount += 1;
NewDpofFileDramAddr = K_SDRAM_DPOF4_BufAddr + (NewDpofFileByteCount >> 1);
}
else
{
while (JobSection_Length > 0)
{
//Copy the first byte tmp2
L2_DRAMSetStartAddr(JobSection_StartDramAddr,K_SDRAM_Prefetch);
L2_DRAMReadWord(&tmp1,&tmp2);
L2_DRAMReadWord(&tmp3,&tmp4);
L2_DRAMSetStartAddr(NewDpofFileDramAddr,K_SDRAM_NoPrefetch);
L2_DRAMWriteWord(tmp2,tmp3);
//Next source address is not wordboundary
JobSection_StartDramAddr += 1;
JobSection_Length -= 2;
//Next destination address is wordboundary
NewDpofFileByteCount += 2;
NewDpofFileDramAddr = K_SDRAM_DPOF4_BufAddr + (NewDpofFileByteCount >> 1);
}
}
}
else //SrcAddr & DestAddr are both wordboundary
{
L2_DoDRAMDMA((JobSection_StartDramAddr * 2),(NewDpofFileDramAddr * 2),(((JobSection_Length + 1) >> 1) << 1));
NewDpofFileByteCount += JobSection_Length;
NewDpofFileDramAddr = K_SDRAM_DPOF4_BufAddr + (NewDpofFileByteCount >> 1);
}
}
}
//-----------------------------------------------------------------------------
//DPOF_FindDpofJobSection
//-----------------------------------------------------------------------------
UCHAR DPOF_FindDpofJobSection(ULONG *NewDramAddr,ULONG *ByteCount,ULONG *JobSection_StartDramAddr,ULONG *JobSection_StartByteCount) USING_0
{
USHORT i,j,k;
BIT find_job = 0;
UCHAR sts = TRUE;
if ((*ByteCount < G_DOS_FileSize) && (!find_job))
{
if (*ByteCount & 0x00000001)
{
k = 1;
}
else
{
k = 0;
}
SDRAM_Dram2Sram((*NewDramAddr),G_ucStorData,K_DPOF_SEARCH_SIZE);
for (i = k; i < K_DPOF_SEARCH_SIZE; i++)
{
*ByteCount += 1;
//Compare characters [JOB]
if ((G_ucStorData[i] == DPOF_JobSectionTitle[0]) && (G_ucStorData[i + 1] == DPOF_JobSectionTitle[1]) && (G_ucStorData[i + 2] == DPOF_JobSectionTitle[2]) && (G_ucStorData[i + 3] == DPOF_JobSectionTitle[3]) && (G_ucStorData[i + 4] == DPOF_JobSectionTitle[4]))
{
*JobSection_StartByteCount = *ByteCount;
*JobSection_StartDramAddr = K_SDRAM_DPOF1_BufAddr + ((*JobSection_StartByteCount - 1) >> 1);
*ByteCount += 4;
find_job = 1;
for (j = (i + 5); j < K_DPOF_SEARCH_SIZE; j++)
{
*ByteCount += 1;
//Compare line-feed and return
if ((G_ucStorData[j] == 0x0d) && (G_ucStorData[j + 1] == 0x0a))
{
*ByteCount += 1;
*NewDramAddr = K_SDRAM_DPOF1_BufAddr + (*ByteCount >> 1);
break;
}
}
break;
}
}
}
if (!find_job)
{
sts = FALSE;
}
return sts;
}
//-----------------------------------------------------------------------------
//DPOF_FindDpofIMGSRC
//-----------------------------------------------------------------------------
//version4.0@ada@0513 for DPOF
UCHAR DPOF_FindDpofIMGSRC(ULONG *NewDramAddr,ULONG *ByteCount,USHORT *ImgSrcIdx) USING_0
{
USHORT i,k,l;
UCHAR sts = FALSE;
UCHAR tmp;
UCHAR char1,char2,char3;
if (*ByteCount < G_DOS_FileSize)
{
//Find the directory index
tmp = (UCHAR)(G_USR_Dir1Count / 100);
char1 = tmp + '0';
char2 = (UCHAR)(G_USR_Dir1Count - (((USHORT)tmp) * 100)) / 10 + '0';
char3 = (UCHAR)(G_USR_Dir1Count % 10) + '0';
if (*ByteCount & 0x00000001)
{
l = 1;
}
else
{
l = 0;
}
SDRAM_Dram2Sram(*NewDramAddr,G_ucStorData,K_DPOF_SEARCH_SIZE);
for (i = l; i < K_DPOF_SEARCH_SIZE; i++)
{
*ByteCount += 1;
//Compare with "IMG SRC"
if ((G_ucStorData[i] == DPOF_ImgSrcStdSunpXXXXjpg[1]) && (G_ucStorData[i + 1] == DPOF_ImgSrcStdSunpXXXXjpg[2]) &&
(G_ucStorData[i + 2] == DPOF_ImgSrcStdSunpXXXXjpg[3]) && (G_ucStorData[i + 3] == DPOF_ImgSrcStdSunpXXXXjpg[4]) &&
(G_ucStorData[i + 4] == DPOF_ImgSrcStdSunpXXXXjpg[5]) && (G_ucStorData[i + 5] == DPOF_ImgSrcStdSunpXXXXjpg[6]) &&
(G_ucStorData[i + 6] == DPOF_ImgSrcStdSunpXXXXjpg[7]))
{
//Compare "DCIM/xxxxxxxx"
//version4.0@ada@0513 for DPOF
if ((G_ucStorData[i + 14] == G_USR_Dir0Name[0]) && (G_ucStorData[i + 15] == G_USR_Dir0Name[1]) && (G_ucStorData[i + 16] == G_USR_Dir0Name[2]) && (G_ucStorData[i + 17] == G_USR_Dir0Name[3]) && (G_ucStorData[i + 18] == 0x2f) &&
//(G_ucStorData[i + 19] == G_USR_Dir1Name[0]) && (G_ucStorData[i + 20] == G_USR_Dir1Name[1]) && (G_ucStorData[i + 21] == G_USR_Dir1Name[2]) && (G_ucStorData[i + 22] == G_USR_Dir1Name[3]) &&
//(G_ucStorData[i + 19] == char1) && (G_ucStorData[i + 20] == char2) && (G_ucStorData[i + 21] == char3) && (G_ucStorData[i + 22] == G_USR_Dir1Name[3]) &&
//(G_ucStorData[i + 23] == G_USR_Dir1Name[4]) && (G_ucStorData[i + 24] == G_USR_Dir1Name[5]) && (G_ucStorData[i + 25] == G_USR_Dir1Name[6]) && (G_ucStorData[i + 26] == G_USR_Dir1Name[7]))
(G_ucStorData[i + 19] == DpofDir1Name[0]) && (G_ucStorData[i + 20] == DpofDir1Name[1]) && (G_ucStorData[i + 21] == DpofDir1Name[2]) && (G_ucStorData[i + 22] == DpofDir1Name[3]) &&
(G_ucStorData[i + 23] == DpofDir1Name[4]) && (G_ucStorData[i + 24] == DpofDir1Name[5]) && (G_ucStorData[i + 25] == DpofDir1Name[6]) && (G_ucStorData[i + 26] == DpofDir1Name[7]))
{
*ImgSrcIdx = ((((USHORT)G_ucStorData[i + 32] - '0') * 1000) + (((USHORT)G_ucStorData[i + 33] - '0') * 100) + (((USHORT)G_ucStorData[i + 34] - '0') * 10) + (USHORT)G_ucStorData[i + 35] -'0');
*ByteCount += 35;
sts = TRUE;
for (k = (i + 42); k < K_DPOF_SEARCH_SIZE; k++)
{
*ByteCount += 1;
//Compare line-feed and return
if ((G_ucStorData[k] == 0x0d) && (G_ucStorData[k + 1] == 0x0a))
{
*ByteCount += 7;
*NewDramAddr = K_SDRAM_DPOF1_BufAddr + (*ByteCount >> 1);
break;
}
}
}
break;
}
}
}
return sts;
}
//-----------------------------------------------------------------------------
//DPOF_FindDpofPRTPID
//-----------------------------------------------------------------------------
UCHAR DPOF_FindDpofPRTPID(ULONG *NewDramAddr,ULONG *ByteCount,USHORT *PrtPid) USING_0
{
USHORT i,j,k,l;
UCHAR sts = TRUE;
if ((*ByteCount < G_DOS_FileSize) && (*PrtPid == 0))
{
if (*ByteCount & 0x00000001)
{
l = 1;
}
else
{
l = 0;
}
SDRAM_Dram2Sram(*NewDramAddr,G_ucStorData,K_DPOF_SEARCH_SIZE);
for (i = l; i < K_DPOF_SEARCH_SIZE; i++)
{
*ByteCount += 1;
if ((G_ucStorData[i] == 'P') && (G_ucStorData[i + 1] == 'R') && (G_ucStorData[i + 2] == 'T') && (G_ucStorData[i + 3] == ' ') &&
(G_ucStorData[i + 4] == 'P') && (G_ucStorData[i + 5] == 'I') && (G_ucStorData[i + 6] == 'D'))
{
*ByteCount += 6;
for (j = (i + 7); j < K_DPOF_SEARCH_SIZE; j++)
{
*ByteCount += 1;
if ((G_ucStorData[j] >= '0') && (G_ucStorData[j] <= '9'))
{
*PrtPid = (((USHORT)(G_ucStorData[j] - '0') * 100) + ((USHORT)(G_ucStorData[j + 1] - '0') * 10) + ((USHORT)G_ucStorData[j + 2] - '0'));
*ByteCount += 2;
for (k = (j + 3); k < K_DPOF_SEARCH_SIZE; k++)
{
*ByteCount += 1;
//Compare line-feed and return
if ((G_ucStorData[k] == 0x0d) && (G_ucStorData[k + 1] == 0x0a))
{
*ByteCount += 1;
*NewDramAddr = K_SDRAM_DPOF1_BufAddr + (*ByteCount >> 1);
break;
}
}
break;
}
}
}
break;
}
}
if (*PrtPid == 0)
{
sts = FALSE;
}
return sts;
}
//-----------------------------------------------------------------------------
//DPOF_ModifyDpofPRTPID
//-----------------------------------------------------------------------------
UCHAR DPOF_ModifyDpofPRTPID(ULONG NewDramAddr,ULONG ByteCount) USING_0
{
USHORT i,j,l;
UCHAR sts = TRUE;
BIT PrtPid_Found = 0;
if ((ByteCount < G_DOS_FileSize) && (PrtPid_Found == 0))
{
if (ByteCount & 0x00000001)
{
l = 1;
}
else
{
l = 0;
}
SDRAM_Dram2Sram(NewDramAddr,G_ucStorData,K_DPOF_SEARCH_SIZE);
for (i = l; i < K_DPOF_SEARCH_SIZE; i++)
{
ByteCount += 1;
if ((G_ucStorData[i] == 'P') && (G_ucStorData[i + 1] == 'R') && (G_ucStorData[i + 2] == 'T') && (G_ucStorData[i + 3] == ' ') &&
(G_ucStorData[i + 4] == 'P') && (G_ucStorData[i + 5] == 'I') && (G_ucStorData[i + 6] == 'D'))
{
ByteCount += 6;
for (j = (i + 7); j < K_DPOF_SEARCH_SIZE; j++)
{
ByteCount += 1;
if ((G_ucStorData[j] >= '0') && (G_ucStorData[j] <= '9'))
{
PrtPid_Found = 1;
G_ucStorData[j] = (UCHAR)(NewDpofJobSectionPRTPID / 100);
G_ucStorData[j + 1] = (UCHAR)((NewDpofJobSectionPRTPID - (((USHORT)G_ucStorData[j]) * 100)) / 10) + '0';
G_ucStorData[j] += '0';
G_ucStorData[j + 2] = (UCHAR)(NewDpofJobSectionPRTPID % 10) + '0';
SDRAM_Sram2Dram(G_ucStorData,NewDramAddr,K_DPOF_SEARCH_SIZE);
NewDpofJobSectionPRTPID ++;
break;
}
}
}
break;
}
}
if (PrtPid_Found == 0)
{
sts = FALSE;
}
return sts;
}
//-----------------------------------------------------------------------------
//DPOF_FindDpofPRTTYP
//-----------------------------------------------------------------------------
UCHAR DPOF_FindDpofPRTTYP(ULONG *NewDramAddr,ULONG *ByteCount,UCHAR *PrtTyp) USING_0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -