1、首次提交量产版本

2、解决开机切换分辨率闪logo问题:前一帧logo在底部闪现
3、增加手写纸功能:B5管脚打开swire功能
This commit is contained in:
“苏飞源” 2023-08-21 15:52:38 +08:00
commit 8e0643d30f
65 changed files with 89597 additions and 0 deletions

85
.gitignore vendored Normal file
View File

@ -0,0 +1,85 @@
# A .gitignore for Keil projects.
# Taken mostly from http://www.keil.com/support/man/docs/uv4/uv4_b_filetypes.htm
# User-specific uVision files
*.opt
*.uvopt
*.uvoptx
*.uvgui
*.uvgui.*
*.uvguix.*
# Listing files
#*.cod
#*.map
#*.m51
#*.m66
*._ip
*.i
*.lst
*/Listings/*.txt
# define exception below if needed
*.scr
# Object and HEX files
*.axf
*.b[0-3][0-9]
*.hex
*.d
*.crf
*.elf
*.hex
*.h86
*.obj
*.o
*.sbr
*.htm
# Build files
# define exception below if needed
*.bat
*._ia
*.__i
*._ii
# Generated output files
/Listings/*
/Objects/*
# Debugger files
# define exception below if needed
*.ini
# Other files
*.build_log.htm
*.cdb
*.dep
*.ic
*.lin
*.lnp
*.orc
# define exception below if needed
*.pack
# define exception below if needed
*.pdsc
*.plg
# define exception below if needed
*.sct
*.sfd
*.sfr
# Miscellaneous
*.tra
*.fed
*.l1p
*.l2p
*.iex
/si/
!*.bin
!*.map
# To explicitly override the above, define any exceptions here; e.g.:
# !my_customized_scatter_file.sct

View File

@ -0,0 +1,519 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_projx.xsd">
<SchemaVersion>2.1</SchemaVersion>
<Header>### uVision Project, (C) Keil Software</Header>
<Targets>
<Target>
<TargetName>ISP_568</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<pArmCC>5060750::V5.06 update 6 (build 750)::ARMCC</pArmCC>
<pCCUsed>5060750::V5.06 update 6 (build 750)::ARMCC</pCCUsed>
<uAC6>0</uAC6>
<TargetOption>
<TargetCommonOption>
<Device>ARMCM0</Device>
<Vendor>ARM</Vendor>
<PackID>ARM.CMSIS.5.5.1</PackID>
<PackURL>http://www.keil.com/pack/</PackURL>
<Cpu>IRAM(0x20000000,0x00020000) IROM(0x00000000,0x00040000) CPUTYPE("Cortex-M0") CLOCK(12000000) ESEL ELITTLE</Cpu>
<FlashUtilSpec></FlashUtilSpec>
<StartupFile></StartupFile>
<FlashDriverDll>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000)</FlashDriverDll>
<DeviceId>0</DeviceId>
<RegisterFile>$$Device:ARMCM0$Device\ARM\ARMCM0\Include\ARMCM0.h</RegisterFile>
<MemoryEnv></MemoryEnv>
<Cmp></Cmp>
<Asm></Asm>
<Linker></Linker>
<OHString></OHString>
<InfinionOptionDll></InfinionOptionDll>
<SLE66CMisc></SLE66CMisc>
<SLE66AMisc></SLE66AMisc>
<SLE66LinkerMisc></SLE66LinkerMisc>
<SFDFile></SFDFile>
<bCustSvd>0</bCustSvd>
<UseEnv>0</UseEnv>
<BinPath></BinPath>
<IncludePath></IncludePath>
<LibPath></LibPath>
<RegisterFilePath></RegisterFilePath>
<DBRegisterFilePath></DBRegisterFilePath>
<TargetStatus>
<Error>0</Error>
<ExitCodeStop>0</ExitCodeStop>
<ButtonStop>0</ButtonStop>
<NotGenerated>0</NotGenerated>
<InvalidFlash>1</InvalidFlash>
</TargetStatus>
<OutputDirectory>.\Objects\</OutputDirectory>
<OutputName>CVWL568_S21U_20230810</OutputName>
<CreateExecutable>1</CreateExecutable>
<CreateLib>0</CreateLib>
<CreateHexFile>1</CreateHexFile>
<DebugInformation>1</DebugInformation>
<BrowseInformation>1</BrowseInformation>
<ListingPath>.\Listings\</ListingPath>
<HexFormatSelection>1</HexFormatSelection>
<Merge32K>0</Merge32K>
<CreateBatchFile>1</CreateBatchFile>
<BeforeCompile>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopU1X>0</nStopU1X>
<nStopU2X>0</nStopU2X>
</BeforeCompile>
<BeforeMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopB1X>0</nStopB1X>
<nStopB2X>0</nStopB2X>
</BeforeMake>
<AfterMake>
<RunUserProg1>1</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name>fromelf --bin -o .\Objects\@L.bin .\Objects\@L.axf</UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopA1X>0</nStopA1X>
<nStopA2X>0</nStopA2X>
</AfterMake>
<SelectedForBatchBuild>0</SelectedForBatchBuild>
<SVCSIdString></SVCSIdString>
</TargetCommonOption>
<CommonProperty>
<UseCPPCompiler>0</UseCPPCompiler>
<RVCTCodeConst>0</RVCTCodeConst>
<RVCTZI>0</RVCTZI>
<RVCTOtherData>0</RVCTOtherData>
<ModuleSelection>0</ModuleSelection>
<IncludeInBuild>1</IncludeInBuild>
<AlwaysBuild>0</AlwaysBuild>
<GenerateAssemblyFile>0</GenerateAssemblyFile>
<AssembleAssemblyFile>0</AssembleAssemblyFile>
<PublicsOnly>0</PublicsOnly>
<StopOnExitCode>3</StopOnExitCode>
<CustomArgument></CustomArgument>
<IncludeLibraryModules></IncludeLibraryModules>
<ComprImg>1</ComprImg>
</CommonProperty>
<DllOption>
<SimDllName>SARMCM3.DLL</SimDllName>
<SimDllArguments> </SimDllArguments>
<SimDlgDll>DARMCM1.DLL</SimDlgDll>
<SimDlgDllArguments>-pCM0</SimDlgDllArguments>
<TargetDllName>SARMCM3.DLL</TargetDllName>
<TargetDllArguments> </TargetDllArguments>
<TargetDlgDll>TARMCM1.DLL</TargetDlgDll>
<TargetDlgDllArguments>-pCM0</TargetDlgDllArguments>
</DllOption>
<DebugOption>
<OPTHX>
<HexSelection>1</HexSelection>
<HexRangeLowAddress>0</HexRangeLowAddress>
<HexRangeHighAddress>0</HexRangeHighAddress>
<HexOffset>0</HexOffset>
<Oh166RecLen>16</Oh166RecLen>
</OPTHX>
</DebugOption>
<Utilities>
<Flash1>
<UseTargetDll>1</UseTargetDll>
<UseExternalTool>0</UseExternalTool>
<RunIndependent>0</RunIndependent>
<UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
<Capability>1</Capability>
<DriverSelection>4096</DriverSelection>
</Flash1>
<bUseTDR>1</bUseTDR>
<Flash2>BIN\UL2CM3.DLL</Flash2>
<Flash3>"" ()</Flash3>
<Flash4></Flash4>
<pFcarmOut></pFcarmOut>
<pFcarmGrp></pFcarmGrp>
<pFcArmRoot></pFcArmRoot>
<FcArmLst>0</FcArmLst>
</Utilities>
<TargetArmAds>
<ArmAdsMisc>
<GenerateListings>0</GenerateListings>
<asHll>1</asHll>
<asAsm>1</asAsm>
<asMacX>1</asMacX>
<asSyms>1</asSyms>
<asFals>1</asFals>
<asDbgD>1</asDbgD>
<asForm>1</asForm>
<ldLst>0</ldLst>
<ldmm>1</ldmm>
<ldXref>1</ldXref>
<BigEnd>0</BigEnd>
<AdsALst>1</AdsALst>
<AdsACrf>1</AdsACrf>
<AdsANop>0</AdsANop>
<AdsANot>0</AdsANot>
<AdsLLst>1</AdsLLst>
<AdsLmap>1</AdsLmap>
<AdsLcgr>1</AdsLcgr>
<AdsLsym>1</AdsLsym>
<AdsLszi>1</AdsLszi>
<AdsLtoi>1</AdsLtoi>
<AdsLsun>1</AdsLsun>
<AdsLven>1</AdsLven>
<AdsLsxf>1</AdsLsxf>
<RvctClst>1</RvctClst>
<GenPPlst>1</GenPPlst>
<AdsCpuType>"Cortex-M0"</AdsCpuType>
<RvctDeviceName></RvctDeviceName>
<mOS>0</mOS>
<uocRom>0</uocRom>
<uocRam>0</uocRam>
<hadIROM>1</hadIROM>
<hadIRAM>1</hadIRAM>
<hadXRAM>0</hadXRAM>
<uocXRam>0</uocXRam>
<RvdsVP>0</RvdsVP>
<RvdsMve>0</RvdsMve>
<hadIRAM2>0</hadIRAM2>
<hadIROM2>0</hadIROM2>
<StupSel>16</StupSel>
<useUlib>1</useUlib>
<EndSel>1</EndSel>
<uLtcg>0</uLtcg>
<nSecure>0</nSecure>
<RoSelD>4</RoSelD>
<RwSelD>3</RwSelD>
<CodeSel>0</CodeSel>
<OptFeed>0</OptFeed>
<NoZi1>0</NoZi1>
<NoZi2>0</NoZi2>
<NoZi3>0</NoZi3>
<NoZi4>0</NoZi4>
<NoZi5>0</NoZi5>
<Ro1Chk>0</Ro1Chk>
<Ro2Chk>0</Ro2Chk>
<Ro3Chk>0</Ro3Chk>
<Ir1Chk>0</Ir1Chk>
<Ir2Chk>1</Ir2Chk>
<Ra1Chk>1</Ra1Chk>
<Ra2Chk>1</Ra2Chk>
<Ra3Chk>1</Ra3Chk>
<Im1Chk>0</Im1Chk>
<Im2Chk>0</Im2Chk>
<OnChipMemories>
<Ocm1>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm1>
<Ocm2>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm2>
<Ocm3>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm3>
<Ocm4>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm4>
<Ocm5>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm5>
<Ocm6>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm6>
<IRAM>
<Type>0</Type>
<StartAddress>0x20000000</StartAddress>
<Size>0x20000</Size>
</IRAM>
<IROM>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x40000</Size>
</IROM>
<XRAM>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</XRAM>
<OCR_RVCT1>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT1>
<OCR_RVCT2>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT2>
<OCR_RVCT3>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT3>
<OCR_RVCT4>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x2000</Size>
</OCR_RVCT4>
<OCR_RVCT5>
<Type>1</Type>
<StartAddress>0x10000</StartAddress>
<Size>0x10000</Size>
</OCR_RVCT5>
<OCR_RVCT6>
<Type>0</Type>
<StartAddress>0x70000</StartAddress>
<Size>0xf0</Size>
</OCR_RVCT6>
<OCR_RVCT7>
<Type>0</Type>
<StartAddress>0x70100</StartAddress>
<Size>0xd0</Size>
</OCR_RVCT7>
<OCR_RVCT8>
<Type>0</Type>
<StartAddress>0x701d0</StartAddress>
<Size>0x7e30</Size>
</OCR_RVCT8>
<OCR_RVCT9>
<Type>0</Type>
<StartAddress>0x20000000</StartAddress>
<Size>0x20000</Size>
</OCR_RVCT9>
<OCR_RVCT10>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT10>
</OnChipMemories>
<RvctStartVector></RvctStartVector>
</ArmAdsMisc>
<Cads>
<interw>1</interw>
<Optim>4</Optim>
<oTime>0</oTime>
<SplitLS>0</SplitLS>
<OneElfS>1</OneElfS>
<Strict>0</Strict>
<EnumInt>0</EnumInt>
<PlainCh>0</PlainCh>
<Ropi>0</Ropi>
<Rwpi>0</Rwpi>
<wLevel>2</wLevel>
<uThumb>0</uThumb>
<uSurpInc>0</uSurpInc>
<uC99>1</uC99>
<uGnu>1</uGnu>
<useXO>0</useXO>
<v6Lang>1</v6Lang>
<v6LangP>1</v6LangP>
<vShortEn>1</vShortEn>
<vShortWch>1</vShortWch>
<v6Lto>0</v6Lto>
<v6WtE>0</v6WtE>
<v6Rtti>0</v6Rtti>
<VariousControls>
<MiscControls></MiscControls>
<Define>ISP_568</Define>
<Undefine></Undefine>
<IncludePath>..\..\src;..\..\src\board;..\..\src\common;..\..\src\sdk\include;..\..\src\app\demo;..\..\src\sdk\include\M0;..\..\src\app;..\CVWL568</IncludePath>
</VariousControls>
</Cads>
<Aads>
<interw>1</interw>
<Ropi>0</Ropi>
<Rwpi>0</Rwpi>
<thumb>0</thumb>
<SplitLS>0</SplitLS>
<SwStkChk>0</SwStkChk>
<NoWarn>0</NoWarn>
<uSurpInc>0</uSurpInc>
<useXO>0</useXO>
<uClangAs>0</uClangAs>
<VariousControls>
<MiscControls></MiscControls>
<Define></Define>
<Undefine></Undefine>
<IncludePath></IncludePath>
</VariousControls>
</Aads>
<LDads>
<umfTarg>1</umfTarg>
<Ropi>0</Ropi>
<Rwpi>0</Rwpi>
<noStLib>0</noStLib>
<RepFail>1</RepFail>
<useFile>0</useFile>
<TextAddressRange>0x00000000</TextAddressRange>
<DataAddressRange>0x20000000</DataAddressRange>
<pXoBase></pXoBase>
<ScatterFile></ScatterFile>
<IncludeLibs></IncludeLibs>
<IncludeLibsPath></IncludeLibsPath>
<Misc></Misc>
<LinkerInputFile></LinkerInputFile>
<DisabledWarnings></DisabledWarnings>
</LDads>
</TargetArmAds>
</TargetOption>
<Groups>
<Group>
<GroupName>app</GroupName>
<Files>
<File>
<FileName>main.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\main.c</FilePath>
</File>
<File>
<FileName>ap_demo.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\demo\ap_demo.c</FilePath>
</File>
<File>
<FileName>app_tp_transfer.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\demo\app_tp_transfer.c</FilePath>
</File>
<File>
<FileName>app_tp_st_touch.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\demo\app_tp_st_touch.c</FilePath>
</File>
<File>
<FileName>ap_demo_version.txt</FileName>
<FileType>5</FileType>
<FilePath>..\..\src\app\demo\ap_demo_version.txt</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>driver</GroupName>
<Files>
<File>
<FileName>CVWL568.lib</FileName>
<FileType>4</FileType>
<FilePath>..\..\src\sdk\CVWL568\lib\CVWL568.lib</FilePath>
</File>
<File>
<FileName>CVWL568_S21U_TP.lib</FileName>
<FileType>4</FileType>
<FilePath>..\..\src\sdk\CVWL568\lib\CVWL568_S21U_TP.lib</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>board</GroupName>
<Files>
<File>
<FileName>board.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\board\board.c</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>startup</GroupName>
<Files>
<File>
<FileName>startup_ARMCM0.s</FileName>
<FileType>2</FileType>
<FilePath>..\..\src\board\startup\startup_ARMCM0.s</FilePath>
<FileOption>
<CommonProperty>
<UseCPPCompiler>2</UseCPPCompiler>
<RVCTCodeConst>0</RVCTCodeConst>
<RVCTZI>0</RVCTZI>
<RVCTOtherData>0</RVCTOtherData>
<ModuleSelection>0</ModuleSelection>
<IncludeInBuild>1</IncludeInBuild>
<AlwaysBuild>2</AlwaysBuild>
<GenerateAssemblyFile>2</GenerateAssemblyFile>
<AssembleAssemblyFile>2</AssembleAssemblyFile>
<PublicsOnly>2</PublicsOnly>
<StopOnExitCode>11</StopOnExitCode>
<CustomArgument></CustomArgument>
<IncludeLibraryModules></IncludeLibraryModules>
<ComprImg>1</ComprImg>
</CommonProperty>
<FileArmAds>
<Aads>
<interw>2</interw>
<Ropi>2</Ropi>
<Rwpi>2</Rwpi>
<thumb>2</thumb>
<SplitLS>2</SplitLS>
<SwStkChk>2</SwStkChk>
<NoWarn>2</NoWarn>
<uSurpInc>2</uSurpInc>
<useXO>2</useXO>
<uClangAs>2</uClangAs>
<VariousControls>
<MiscControls></MiscControls>
<Define></Define>
<Undefine></Undefine>
<IncludePath></IncludePath>
</VariousControls>
</Aads>
</FileArmAds>
</FileOption>
</File>
</Files>
</Group>
<Group>
<GroupName>::CMSIS</GroupName>
</Group>
</Groups>
</Target>
</Targets>
<RTE>
<apis/>
<components>
<component Cclass="CMSIS" Cgroup="CORE" Cvendor="ARM" Cversion="5.2.0" condition="ARMv6_7_8-M Device">
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.5.1"/>
<targetInfos>
<targetInfo name="ISP_568"/>
</targetInfos>
</component>
</components>
<files>
<file attr="config" category="sourceAsm" condition="ARMCC" name="Device\ARM\ARMCM0\Source\ARM\startup_ARMCM0.s" version="1.0.0">
<instance index="0" removed="1">RTE\Device\ARMCM0\startup_ARMCM0.s</instance>
<component Cclass="Device" Cgroup="Startup" Cvendor="ARM" Cversion="1.1.0" condition="ARMCM0 CMSIS"/>
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.5.1"/>
<targetInfos/>
</file>
<file attr="config" category="sourceC" name="Device\ARM\ARMCM0\Source\system_ARMCM0.c" version="1.0.0">
<instance index="0" removed="1">RTE\Device\ARMCM0\system_ARMCM0.c</instance>
<component Cclass="Device" Cgroup="Startup" Cvendor="ARM" Cversion="1.1.0" condition="ARMCM0 CMSIS"/>
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.5.1"/>
<targetInfos/>
</file>
</files>
</RTE>
</Project>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,63 @@
; generated by Component: ARM Compiler 5.06 update 6 (build 750) Tool: ArmCC [4d3637]
; commandline ArmCC [--c99 --list --split_sections --debug -c --asm --interleave --gnu -o.\objects\board.o --asm_dir=.\Listings\ --list_dir=.\Listings\ --depend=.\objects\board.d --cpu=Cortex-M0 --apcs=interwork -O3 --diag_suppress=9931 -I..\..\src -I..\..\src\board -I..\..\src\common -I..\..\src\sdk\include -I..\..\src\app\demo -I..\..\src\sdk\include\M0 -I..\..\src\app -I..\CVWL568 -I.\RTE\_ISP_568 -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\CMSIS\Core\Include -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\Device\ARM\ARMCM0\Include -D__MICROLIB -D__UVISION_VERSION=528 -D_RTE_ -DARMCM0 -DISP_568 --omf_browse=.\objects\board.crf ..\..\src\board\board.c]
THUMB
AREA ||i.board_Init||, CODE, READONLY, ALIGN=2
board_Init PROC
;;;13
;;;14 void board_Init(void)
000000 b510 PUSH {r4,lr}
;;;15 {
;;;16 hal_system_init(SYSTEM_CLOCK);
000002 4807 LDR r0,|L1.32|
000004 f7fffffe BL hal_system_init
;;;17 hal_system_enable_systick(1);
000008 2001 MOVS r0,#1
00000a f7fffffe BL hal_system_enable_systick
;;;18 #if !EDA_MODE
;;;19 hal_system_init_console(115200);
00000e 20e1 MOVS r0,#0xe1
000010 0240 LSLS r0,r0,#9
000012 f7fffffe BL hal_system_init_console
;;;20 #endif
;;;21 #if defined(ISP_568) || defined(ISP_368)
;;;22 /* 从EFUSE读取DPHY校准值并设置 */
;;;23 hal_system_set_phy_calibration(true);
000016 2001 MOVS r0,#1
000018 f7fffffe BL hal_system_set_phy_calibration
;;;24 #endif
;;;25 }
00001c bd10 POP {r4,pc}
;;;26
ENDP
00001e 0000 DCW 0x0000
|L1.32|
DCD 0x04c4b400
;*** Start embedded assembler ***
#line 1 "..\\..\\src\\board\\board.c"
AREA ||.rev16_text||, CODE
THUMB
EXPORT |__asm___7_board_c_bcd01269____REV16|
#line 467 "C:\\Keil_v5\\ARM\\PACK\\ARM\\CMSIS\\5.5.1\\CMSIS\\Core\\Include\\cmsis_armcc.h"
|__asm___7_board_c_bcd01269____REV16| PROC
#line 468
rev16 r0, r0
bx lr
ENDP
AREA ||.revsh_text||, CODE
THUMB
EXPORT |__asm___7_board_c_bcd01269____REVSH|
#line 482
|__asm___7_board_c_bcd01269____REVSH| PROC
#line 483
revsh r0, r0
bx lr
ENDP
;*** End embedded assembler ***

View File

@ -0,0 +1,55 @@
; generated by Component: ARM Compiler 5.06 update 6 (build 750) Tool: ArmCC [4d3637]
; commandline ArmCC [--c99 --list --split_sections --debug -c --asm --interleave --gnu -o.\objects\main.o --asm_dir=.\Listings\ --list_dir=.\Listings\ --depend=.\objects\main.d --cpu=Cortex-M0 --apcs=interwork -O3 --diag_suppress=9931 -I..\..\src -I..\..\src\board -I..\..\src\common -I..\..\src\sdk\include -I..\..\src\app\demo -I..\..\src\sdk\include\M0 -I..\..\src\app -I..\CVWL568 -I.\RTE\_ISP_568 -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\CMSIS\Core\Include -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\Device\ARM\ARMCM0\Include -D__MICROLIB -D__UVISION_VERSION=528 -D_RTE_ -DARMCM0 -DISP_568 --omf_browse=.\objects\main.crf ..\..\src\app\main.c]
THUMB
AREA ||i.main||, CODE, READONLY, ALIGN=1
main PROC
;;;13
;;;14 int main()
000000 f7fffffe BL board_Init
;;;15 {
;;;16 // hal_system_init();
;;;17 board_Init();
;;;18
;;;19 while (1)
;;;20 {
;;;21 #if _DEMO_S8_EN
;;;22 ap_demo();
000004 f7fffffe BL ap_demo
|L1.8|
;;;23 #endif
;;;24 while (1);
000008 e7fe B |L1.8|
;;;25 }
;;;26 }
ENDP
;*** Start embedded assembler ***
#line 1 "..\\..\\src\\app\\main.c"
AREA ||.rev16_text||, CODE
THUMB
EXPORT |__asm___6_main_c_main____REV16|
#line 467 "C:\\Keil_v5\\ARM\\PACK\\ARM\\CMSIS\\5.5.1\\CMSIS\\Core\\Include\\cmsis_armcc.h"
|__asm___6_main_c_main____REV16| PROC
#line 468
rev16 r0, r0
bx lr
ENDP
AREA ||.revsh_text||, CODE
THUMB
EXPORT |__asm___6_main_c_main____REVSH|
#line 482
|__asm___6_main_c_main____REVSH| PROC
#line 483
revsh r0, r0
bx lr
ENDP
;*** End embedded assembler ***
__ARM_use_no_argv EQU 0

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,21 @@
/*
* Auto generated Run-Time-Environment Configuration File
* *** Do not modify ! ***
*
* Project: 'ISP_568'
* Target: 'ISP_568'
*/
#ifndef RTE_COMPONENTS_H
#define RTE_COMPONENTS_H
/*
* Define the Device Header File:
*/
#define CMSIS_device_header "ARMCM0.h"
#endif /* RTE_COMPONENTS_H */

3914
src/app/demo/ap_demo.c Normal file

File diff suppressed because it is too large Load Diff

45
src/app/demo/ap_demo.h Normal file
View File

@ -0,0 +1,45 @@
/*******************************************************************************
*
*
* File: s8_demo.h
* Description: s8测试头文件
* Version: V0.1
* Date: 2021-02-22
* Author: Tempest
*******************************************************************************/
#ifndef __AP_DEMO_H__
#define __AP_DEMO_H__
//#define DISABLE_TDDI_I2C_FUNCTION
//#define USE_WL518_INTERNAL_FLASH
/* 不同方案选择。选仅选1个*/
#define USE_FOR_SUMSUNG_S21U
#ifdef USE_FOR_SUMSUNG_S21U
#define AMOLED_NT37701_CSOT667 1
#define PANEL_INIT_CODE_ARRAY 1
#define G_PHONE_INT_DEFAULT_LOW
#define USE_FOR_S10_BLUE_MODE //S10蓝光模式
#define ADD_PANEL_DISPLAY_MODE //屏幕模式功能。白平衡功能
#define ADD_TIMER3_FUNCTION
#define ENABLE_TP_SLEEP
#define USE_FILTER_20220513
#define ADD_PWM_OUTPUT_FOR_BL //用PWM控制背光 20220510
#endif
/**
* @brief test system
* @param none
* @retval none
*/
void ap_demo(void);
void app_tp_I2C_init(void);
#endif

View File

@ -0,0 +1,22 @@
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
ISP568_S21U_NT37701AH_TM678_20230808
1、解决开机切换分辨率闪logo问题前一帧logo在底部闪现
2、增加手写纸功能B5管脚打开swire功能
////////////////////////////////////////////////////////////////////////
ISP568_S21U_NT37701AH_TM678_20230706
1、解决偶发触摸卡问题将ST触摸芯片的软件复位全部改成硬件复位。
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////

View File

@ -0,0 +1,150 @@
/*******************************************************************************
*
*
* File: app_tp_for_custom.h
* Description tp
* Version V0.1
* Date 2021-10-14
* Author zhanghz
*******************************************************************************/
#ifndef __APP_TP_FOR_CUSTOM_S8_H__
#define __APP_TP_FOR_CUSTOM_S8_H__
#include "test_cfg_global.h"
#include "string.h"
#include "tau_device_datatype.h"
#include "tau_common.h"
#include "app_tp_transfer.h"
#include "hal_gpio.h"
#define AP_TP_TRANSFER 1
#if AMOLED_NT37280
#define PHONE_SLAVE_TRANSFER_I2C 1 //1:表示手机跟芯片之间touch 数据采用 I2C 通信;
#define PHONE_SLAVE_TRANSFER_SPI 0 //1:表示手机跟芯片之间touch 数据采用 SPI 通信;
#define SCREEN_MASTER_TRANSFER_I2C 0 //1:表示屏幕跟芯片之间touch 数据采用 I2C 通信;
#define SCREEN_MASTER_TRANSFER_SPI 1 //1:表示屏幕跟芯片之间touch 数据采用 SPI 通信;
#elif LCD_HX83112A
#define PHONE_SLAVE_TRANSFER_I2C 1 //1:表示手机跟芯片之间touch 数据采用 I2C 通信;
#define PHONE_SLAVE_TRANSFER_SPI 0 //1:表示手机跟芯片之间touch 数据采用 SPI 通信;
#define SCREEN_MASTER_TRANSFER_I2C 0 //1:表示屏幕跟芯片之间touch 数据采用 I2C 通信;
#define SCREEN_MASTER_TRANSFER_SPI 0 //1:表示屏幕跟芯片之间touch 数据采用 SPI 通信;
#else // #if LCD_TD4310
#define PHONE_SLAVE_TRANSFER_I2C 1 //1:表示手机跟芯片之间touch 数据采用 I2C 通信;
#define PHONE_SLAVE_TRANSFER_SPI 0 //1:表示手机跟芯片之间touch 数据采用 SPI 通信;
#define SCREEN_MASTER_TRANSFER_I2C 1 //1:表示屏幕跟芯片之间touch 数据采用 I2C 通信;
#define SCREEN_MASTER_TRANSFER_SPI 0 //1:表示屏幕跟芯片之间touch 数据采用 SPI 通信;
#endif
#ifdef USE_FOR_SUMSUNG_S21U
#define CHIP_I2C_ADDRESS 0x48 //芯片本身 I2C 从机地址.机板I2C地址
#define SCREEN_I2C_ADDRESS 0x49 //屏幕 I2C 从机地址
#elif defined(USE_FOR_SUMSUNG_S9PLUS)
#define CHIP_I2C_ADDRESS 0x48 //芯片本身 I2C 从机地址
#define SCREEN_I2C_ADDRESS 0x20 //屏幕 I2C 从机地址
#else
#define CHIP_I2C_ADDRESS 0x48 //芯片本身 I2C 从机地址
#define SCREEN_I2C_ADDRESS 0x49 //屏幕 I2C 从机地址
#endif
#define CHIP_I2C_ADDR_BITS I2C_ADDR_BITS_7 //屏幕 I2C 地址位数 7/10默认为7
#define SCREEN_I2C_ADDR_BITS I2C_ADDR_BITS_7 //屏幕 I2C 地址位数 7/10默认为7
#define I2C_MASTER_SPEED 800000 //设置 I2C 主机通信速率
#define SPI_MASTER_SPEED 10000000 //设置 SPI 主机通信速率
#define BUFFER_SIZE_MAX 200 //定义 bufrer 最大的字节数
#define INPUT_WIDTH_VALUE 1440 //原装屏 X 坐标码值的最大值
#define INPUT_HEIGHT_VALUE 3200 //原装屏 Y 坐标码值的最大值
#define OUTPUT_WIDTH_VALUE 1080 //维修屏 X 坐标码值的最大值
#define OUTPUT_HEIGHT_VALUE 2400 //维修屏 Y 坐标码值的最大值
#define SCREEN_TRANSFER_WRITE false //接收到screen io中断发送数据之后不用读回
#define SCREEN_TRANSFER_READ true //接收到screen io中断发送数据之后要读回数据
typedef enum
{
I2C_ADDR_BITS_7 = 7,
I2C_ADDR_BITS_10 = 10
} en_I2C_ADDR_BITS_mdoe;
typedef struct
{
uint8_t *buffer; //接收到screen io中断后通信的发送buffer指针
size_t txbuffer_size; //发送 buffer 数据长度需要读回时目前只支持4个字节
size_t rxbuffer_size; //发送完数据之后,要读回的数据长度
bool read_flag; //true 接收到screen io中断发送数据之后要读回数据
} st_screen_data;
typedef struct
{
const uint8_t *buffer; //通信的发送buffer指针
size_t txbuffer_size; //发送 buffer 数据长度需要读回时目前只支持4个字节
size_t rxbuffer_size; //发送完数据之后,要读回的数据长度
bool read_flag; //true 接收到screen io中断发送数据之后要读回数据
} st_screen_const_data;
typedef struct
{
uint8_t reg_size; //接收buffer的个数
size_t write_back_size; //要发送的数据长度
const uint8_t *reg_data; //接收buffer
const uint8_t *write_back; //发送bufer
} st_reg_const_data;
typedef struct
{
uint8_t reg_size; //接收buffer的个数
size_t write_back_size; //要发送的数据长度
uint8_t *reg_data; //接收buffer
uint8_t *write_back; //发送bufer
} st_reg_data;
extern io_pad_e g_screen_input_rst_pad;
extern io_pad_e g_screen_input_int_pad;
extern io_pad_e g_phone_input_rst_pad;
extern io_pad_e g_phone_output_int_pad;
extern uint8_t phone_start_flag;
extern uint8_t phone_touch_flag;
extern const uint8_t screen_reg_int_data_size;
extern const uint8_t screen_reg_start_data_size;
extern st_screen_data screen_reg_int_data[];
extern st_screen_const_data screen_reg_start_data[];
//extern st_reg_const_data phone_reg_const_data[];
/**************************************************************************
* @name : app_tp_screen_analysis_const
* @brief : screen start
* @param[in] :
* @return :
* @retval :
**************************************************************************/
uint8_t app_tp_screen_analysis_const(uint8_t transfer_now, uint8_t *rxbuffer, size_t data_size);
/**************************************************************************
* @name : app_tp_screen_analysis_int
* @brief : screen IO中断后的
* @param[in] :
* @return :
* @retval :
**************************************************************************/
uint8_t app_tp_screen_analysis_int(uint8_t transfer_now, uint8_t *rxbuffer, size_t data_size);
/**************************************************************************
* @name : app_tp_phone_analysis_data
* @brief : phone
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void app_tp_phone_analysis_data(uint8_t *rxbuffer, size_t rxbuffer_size, const uint8_t **txbuffer, size_t *txbuffer_size);
#endif

View File

@ -0,0 +1,23 @@
/*******************************************************************************
*
*
* File: hal_tp_screen_transfer_data.h
* Description start/sleep/awake
* Version V0.1
* Date 2021-10-14
* Author zhanghz
*******************************************************************************/
#ifndef __HAL_TP_SCREEN_TRANSFER_DATA_S8_H__
#define __HAL_TP_SCREEN_TRANSFER_DATA_S8_H__
#include "tau_common.h"
/***************send to screen***************/
const uint8_t screen_87_data[] = {0x87};
const uint8_t screen_a0_00_ff_data[] = {0xa0, 0x00, 0xff};
const uint8_t screen_a4_06_c1_data[] = {0xa4, 0x06, 0xc1};
/*******************************************/
#endif

View File

@ -0,0 +1,571 @@
/*******************************************************************************
*
*
* File: app_tp_st_touch.c信
* Description ST touch
* Version V0.1
* Date 2023-03-13
* Author sfy
* Description ST touch
* Version V0.2
* Date 2023-03-22
* Author sfy
*******************************************************************************/
#include "test_cfg_global.h"
#include "app_tp_transfer.h"
#include "hal_i2c_master.h"
#include "hal_i2c_slave.h"
#include "hal_spi_master.h"
#include "hal_spi_slave.h"
#include "tau_log.h"
#include "app_tp_st_touch.h"
#define ST_TP_CALIBRATION_SUCCESS 0x5A // 校准成功标志
static volatile bool s_calibration_flag = false;
static volatile uint8_t s_calibration_correct_flag = false;
st_tp_scan_data tp_scan_data;
uint8_t st_touch_init_sensor_off[3] = {0xA0,0x00,0x00}; //2 sensor OFF
uint8_t st_touch_init_sensor_on[3] = {0xA0,0x00,0x01}; //2 sensor on
uint8_t st_touch_tp_tuning_reset[3] = {0xA4,0x00,0x00}; // 3 System Reset
uint8_t st_touch_tp_tuning_FpnlInit[3] = {0xA4,0x00,0x03}; // FPnl Init
uint8_t st_touch_tp_tuning_PnlInit[3] = {0xA4,0x00,0x02}; // Pnl Init
uint8_t st_touch_tp_tuning_TuneM[4] = {0xA4,0x03,0x13,0x00}; // TuneM
uint8_t st_touch_tp_tuning_TuneS[4] = {0xA4,0x03,0x0C,0x00}; // TuneS
uint8_t st_touch_tp_tuning_SvCfg[3] = {0xA4,0x05,0x01}; // SvCfg
uint8_t st_touch_tp_tuning_SvCx[3] = {0xA4,0x05,0x02}; // SvCx
uint8_t st_touch_tp_tuning_SvPnl[3] = {0xA4,0x05,0x04}; // SvPnl
uint8_t st_touch_tp_tuning_clearfifo[3] = {0xA4,0x00,0x01}; // 1 clear fifo
uint8_t st_touch_tp_tuning_clkreset[3] = {0xA4,0x00,0x05}; // clk reset
/**************************************************************************
* @name : ap_tp_st_touch_get_calibration_success_mark
* @brief : st touch
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void ap_tp_st_touch_get_calibration_success_mark(void)
{
uint8_t cali_send_buff[6] = {0xFA,0x20,0x01,0x00,0x00,0x00};
uint8_t cali_send_buff1[3] = {0xA4,0x06,0x01};
uint8_t cali_read_buff[40] = {0};
uint8_t i = 0;
app_tp_m_read(cali_send_buff, 5, cali_read_buff, 4);
while(!hal_i2c_m_transfer_complate());
delayMs(1);
app_tp_m_write(cali_send_buff1, 3);
while(!hal_i2c_m_transfer_complate());
delayMs(1);
app_tp_m_read(cali_send_buff, 5, cali_read_buff, 4);
while(!hal_i2c_m_transfer_complate());
delayMs(1);
app_tp_m_read(cali_send_buff, 5, cali_read_buff, 32);
while(!hal_i2c_m_transfer_complate());
if((cali_read_buff[20] == 0xFF) && (cali_read_buff[21] == 0xFF))
{
s_calibration_correct_flag = ST_TP_CALIBRATION_SUCCESS; // 校准成功
}
else
{
s_calibration_correct_flag = 0x00; // 校准失败
}
/*
for(i=0;i<32;i++)
{
printf("%02x ",cali_read_buff[i]);
}
*/
}
/**************************************************************************
* @name : ap_tp_st_touch_calibration
* @brief : st touch
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void ap_tp_st_touch_calibration(void)
{
// app_tp_m_write(st_touch_tp_tuning_reset, sizeof(st_touch_tp_tuning_reset)); // System Reset
// while(!hal_i2c_m_transfer_complate());
// delayMs(10);
app_tp_m_write(st_touch_tp_tuning_FpnlInit, sizeof(st_touch_tp_tuning_FpnlInit)); // FPnl Init
while(!hal_i2c_m_transfer_complate());
delayMs(1);
app_tp_m_write(st_touch_tp_tuning_PnlInit, sizeof(st_touch_tp_tuning_PnlInit)); // Pnl Init
while(!hal_i2c_m_transfer_complate());
delayMs(1);
app_tp_m_write(st_touch_tp_tuning_TuneM, sizeof(st_touch_tp_tuning_TuneM)); // TuneM
while(!hal_i2c_m_transfer_complate());
delayMs(1);
app_tp_m_write(st_touch_tp_tuning_TuneS, sizeof(st_touch_tp_tuning_TuneS)); // TuneS
while(!hal_i2c_m_transfer_complate());
delayMs(1);
app_tp_m_write(st_touch_tp_tuning_SvCfg, sizeof(st_touch_tp_tuning_SvCfg)); // SvCfg
while(!hal_i2c_m_transfer_complate());
delayMs(1);
app_tp_m_write(st_touch_tp_tuning_SvCx, sizeof(st_touch_tp_tuning_SvCx)); // SvCx
while(!hal_i2c_m_transfer_complate());
delayMs(1);
app_tp_m_write(st_touch_tp_tuning_SvPnl, sizeof(st_touch_tp_tuning_SvPnl)); // SvPnl
while(!hal_i2c_m_transfer_complate());
delayMs(1);
}
const unsigned short wCRCTalbeAbs[] =
{
0x0000, 0xCC01, 0xD801, 0x1400, 0xF001, 0x3C00, 0x2800, 0xE401,
0xA001, 0x6C00, 0x7800, 0xB401, 0x5000, 0x9C01, 0x8801, 0x4400,
};
/**************************************************************************
* @name : CRC16_2
* @brief : CRC
* @param[in] :pchMsg ; wDataLen CRC
* @return : 16CRC值
* @retval :
**************************************************************************/
unsigned short CRC16_2(unsigned char *pchMsg, unsigned short wDataLen)
{
unsigned short wCRC = 0xFFFF;
unsigned short i;
unsigned char chChar;
for (i = 0; i < wDataLen; i++)
{
chChar = *pchMsg++;
wCRC = wCRCTalbeAbs[(chChar ^ wCRC) & 15] ^ (wCRC >> 4);
wCRC = wCRCTalbeAbs[((chChar >> 4) ^ wCRC) & 15] ^ (wCRC >> 4);
}
return wCRC;
}
/**************************************************************************
* @name : ap_set_tp_calibration_04
* @brief : 04 02gamma校准等功能
* @param[in] :handler rx handler; dcs_packet
* @return : true
* @retval :
**************************************************************************/
bool ap_set_tp_calibration_04(hal_dsi_rx_ctrl_handle_t *handler, hal_dcs_packet_t *dcs_packet)
{
uint8_t i,crch,crcl,command,param[30] = {0};
unsigned short crc;
// 计算CRC值
for(i=0;i<dcs_packet->param_length;i++)
{
param[i+1] = dcs_packet->packet_param[i];
printf("%02x ",dcs_packet->packet_param[i]);
}
param[0] = 0x04;
crc = CRC16_2(param,dcs_packet->param_length-1);
crch = (crc>>8);
crcl = crc;
// CRC校验判断
// if(crch == dcs_packet->packet_param[dcs_packet->param_length-2] && crcl == dcs_packet->packet_param[dcs_packet->param_length-1])
{
command = param[3];
switch(command)
{
case CMD_TP_CABLIBRATION: // Touch校准
if( (param[4] == 0x01) && (param[5] == 0x01) && (param[6] == 0x01) )
{
s_calibration_flag = true;
s_calibration_correct_flag = false;
}
/* if( (param[4] == 0xA5) && (param[5] == 0x5A) && (param[6] == 0xA5) )
{
if(s_calibration_correct_flag) // 校准成功
{
hal_dsi_rx_ctrl_send_ack_cmd(handler,
DSI_ACK_DT_GEN_LONG_RESPONSE, //xxx
DSI_VC_0,
0x7, 0x04,0x02,0x07,0x2A,ST_TP_CALIBRATION_SUCCESS,0x00,0x00);
printf("cali. send ok ");
}
else // 校准失败
{
hal_dsi_rx_ctrl_send_ack_cmd(handler,
DSI_ACK_DT_GEN_LONG_RESPONSE, //xxx
DSI_VC_0,
0x7, 0x04,0x02,0x07,0x2A,0x00,0x00,0x00);
}
printf("%02x ",s_calibration_correct_flag);
}
*/
break;
case CMD_SET_IMAGE_RGB: // Image RGB发送
break;
case CMD_SEND_COMMAND: // Command Send
break;
case CMD_WRITE_GAMMA: // Gamma校正写入
break;
case CMD_START_GAMMA:
break;
default:
break;
}
}
// 兼容旧版本tp calibration
if( (dcs_packet->packet_param[0] == 0x01) && (dcs_packet->packet_param[1] == 0x01) && (dcs_packet->packet_param[2] == 0x01) )
{
s_calibration_flag = true;
s_calibration_correct_flag = false;
}
/*
if( (dcs_packet->packet_param[0] == 0xA5) && (dcs_packet->packet_param[1] == 0x5A) && (dcs_packet->packet_param[2] == 0xA5) )
{
if(s_calibration_correct_flag) // 校准成功
{
hal_dsi_rx_ctrl_send_ack_cmd(handler,
DSI_ACK_DT_GEN_LONG_RESPONSE, //xxx
DSI_VC_0,
0x7, 0x04,0x02,0x07,0x2A,ST_TP_CALIBRATION_SUCCESS,0x00,0x00);
}
else // 校准失败
{
hal_dsi_rx_ctrl_send_ack_cmd(handler,
DSI_ACK_DT_GEN_LONG_RESPONSE, //xxx
DSI_VC_0,
0x7, 0x04,0x02,0x07,0x2A,0x00,0x00,0x00);
}
}
*/
return true;
}
/**************************************************************************
* @name : ap_get_tp_calibration_status_01
* @brief :
* @param[in] :param 01
* @return : true
* @retval :
**************************************************************************/
bool ap_get_tp_calibration_status_01(hal_dsi_rx_ctrl_handle_t *handler, uint8_t param)
{
// if( param == 0x5A )
{
if(s_calibration_correct_flag) // 校准成功
{
hal_dsi_rx_ctrl_send_ack_cmd(handler,
DSI_ACK_DT_DSC_SHORT_RESPONSE_1B, //xxx
DSI_VC_0,
1,ST_TP_CALIBRATION_SUCCESS);
}
else // 校准失败
{
hal_dsi_rx_ctrl_send_ack_cmd(handler,
DSI_ACK_DT_DSC_SHORT_RESPONSE_1B, //xxx
DSI_VC_0,
1,0x00);
}
}
return true;
}
/**************************************************************************
* @name : app_tp_calibration_exec
* @brief : st touch
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void app_tp_calibration_exec(void)
{
uint8_t i = 0;
if(s_calibration_flag)
{
s_calibration_flag = false;
for(i=0;i<2;i++)
{
ap_tp_st_touch_calibration();
delayMs(4000);
ap_tp_st_touch_get_calibration_success_mark();
if(s_calibration_correct_flag == ST_TP_CALIBRATION_SUCCESS)
{
TAU_LOGD("calibration successful \n");
break;
}
else
{
TAU_LOGD("calibration failure \n");
}
}
}
}
/**************************************************************************
* @name : ap_tp_st_touch_scan_point_init
* @brief : st touch tp_scan_data结构体初始化
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void ap_tp_st_touch_scan_point_init(void)
{
uint8_t i=0;
for(i=0;i<ST_TP_SCAN_POINT_NUMBER_MAX;i++)
tp_scan_data.tp_point_buffer[i] = 0;
tp_scan_data.tp_point_up_error_flag = 0;
tp_scan_data.tp_read_point_counter = 0;
tp_scan_data.tp_point_error_time_counter = 0;
}
/**************************************************************************
* @name : ap_tp_st_touch_simulate_finger_release_event
* @brief : st touch ST
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void ap_tp_st_touch_simulate_finger_release_event(void)
{
uint8_t i,temp=0,ap_tp_release_buf[8] = {0x33,0x01,0x00,0x00,0x00,0x00,0x00,0x00};
for(i=0;i<5;i++)
{
temp = i;
ap_tp_release_buf[1] = (temp<<4)|0x01;
app_tp_screen_analysis_int(0, ap_tp_release_buf,8);
delayMs(6);
}
}
/**************************************************************************
* @name : ap_tp_st_touch_software_reset
* @brief : st touch
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void ap_tp_st_touch_software_reset(void)
{
TAU_LOGD("st_touch_software_reset \n");
ap_tp_st_touch_simulate_finger_release_event();
ap_tp_st_touch_scan_point_init();
app_tp_m_write(st_touch_tp_tuning_clkreset, sizeof(st_touch_tp_tuning_clkreset)); // clk reset
while(!hal_i2c_m_transfer_complate());
delayMs(5);
app_tp_m_write(st_touch_tp_tuning_reset, sizeof(st_touch_tp_tuning_reset)); // System Reset A4 00 00
while(!hal_i2c_m_transfer_complate());
delayMs(5);
app_tp_m_write(st_touch_tp_tuning_clearfifo, sizeof(st_touch_tp_tuning_clearfifo));//0xA4,0x00,0x01
while(!hal_i2c_m_transfer_complate());
delayMs(5);
app_tp_m_write(st_touch_init_sensor_on, sizeof(st_touch_init_sensor_on));//0xA0,0x00,0x01
while(!hal_i2c_m_transfer_complate());
delayMs(5);
// app_tp_screen_reset();
}
/**************************************************************************
* @name : app_tp_st_touch_hardware_reset
* @brief : st touch
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void ap_tp_st_touch_hardware_reset(void)
{
TAU_LOGD("st_touch_hardware_reset \n");
ap_tp_st_touch_simulate_finger_release_event();
ap_tp_st_touch_scan_point_init();
hal_gpio_set_output_data(g_screen_input_rst_pad, IO_LVL_HIGH);
delayMs(2);
hal_gpio_set_output_data(g_screen_input_rst_pad, IO_LVL_LOW);
delayMs(2);
hal_gpio_set_output_data(g_screen_input_rst_pad, IO_LVL_HIGH);
delayMs(2);
app_tp_m_write(st_touch_tp_tuning_clearfifo, sizeof(st_touch_tp_tuning_clearfifo));//0xA4,0x00,0x01}
while(!hal_i2c_m_transfer_complate());
delayMs(5);
app_tp_m_write(st_touch_init_sensor_off, sizeof(st_touch_init_sensor_off));//0xA0,0x00,0x00
while(!hal_i2c_m_transfer_complate());
delayMs(5);
app_tp_m_write(st_touch_init_sensor_on, sizeof(st_touch_init_sensor_on));//0xA0,0x00,0x01
while(!hal_i2c_m_transfer_complate());
delayMs(5);
}
/**************************************************************************
* @name : ap_tp_st_touch_scan_point_record_event
* @brief : st touch
* @param[in] : screendata buflen
* @return :
* @retval :
**************************************************************************/
void ap_tp_st_touch_scan_point_record_event(uint8_t* screendata,uint8_t len)
{
uint8_t i = 0, j,flag = 0,eventdata=0,eventid=0;
for(i=0;i<len;i++)
{
eventdata = screendata[i];
eventid = (screendata[i+1]>>4)+1;
i+=7;
if(eventdata == 0x13) // 按下事件
{
for(j=0;j<ST_TP_SCAN_POINT_NUMBER_MAX;j++)
{
if(tp_scan_data.tp_point_buffer[j] == eventid)
{
flag = 1;
break;
}
}
if(flag==0) // 轮询没有该ID需要保存
{
for(j=0;j<ST_TP_SCAN_POINT_NUMBER_MAX;j++) //寻找空位
{
if(tp_scan_data.tp_point_buffer[j] == 0x00)
{
tp_scan_data.tp_point_buffer[j] = eventid;
tp_scan_data.tp_read_point_counter++;
break;
}
}
}
}
if(eventdata == 0x33 && (tp_scan_data.tp_read_point_counter>0)) // 释放事件
{
for(j=0;j<ST_TP_SCAN_POINT_NUMBER_MAX;j++)
{
if(tp_scan_data.tp_point_buffer[j] == eventid) // 有该事件需要释放
{
tp_scan_data.tp_point_buffer[j] = 0;
tp_scan_data.tp_read_point_counter--;
break;
}
}
tp_scan_data.tp_point_up_error_flag = 1;
tp_scan_data.tp_point_error_time_counter = 0;
}
if(eventdata == 0x23) // 移动MOVE事件
{
tp_scan_data.tp_point_up_error_flag = 1;
tp_scan_data.tp_point_error_time_counter = 0;
}
}
}
/**************************************************************************
* @name : ap_tp_st_touch_scan_point_record_event_exec
* @brief : st touch while(1)
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void ap_tp_st_touch_scan_point_record_event_exec(void)
{
if(tp_scan_data.tp_point_up_error_flag == 1)
{
if(tp_scan_data.tp_point_error_time_counter < (65536/10)) // 65536*3 = 900ms 65536/10 = 30ms
{
tp_scan_data.tp_point_error_time_counter ++;
}
else // 没有收到move 或者release 时间超时
{
if(tp_scan_data.tp_read_point_counter>0) // 有残留点
{
printf("release finger %2d\n",tp_scan_data.tp_read_point_counter);
tp_scan_data.tp_read_point_counter = 0;
ap_tp_st_touch_simulate_finger_release_event();
}
ap_tp_st_touch_scan_point_init();
}
}
}
/**************************************************************************
* @name : ap_tp_st_touch_error_handler_F3
* @brief : st touch F3 02
* @param[in] : screendata
* @return :
* @retval :
**************************************************************************/
void ap_tp_st_touch_error_handler_F3(uint8_t* screendata)
{
// 收到 TP 异常回复 0xF3 0x02 0x00 0x00 0x00 0x00 0x00 0x00
// if(screendata[0] == 0xF3 && screendata[1] == 0x02 && screendata[2] == 0x00)
if(screendata[0] == 0xF3)
{
// ap_tp_st_touch_software_reset();
ap_tp_st_touch_hardware_reset();
}
}
/**************************************************************************
* @name : ap_tp_st_touch_error_handler_F3
* @brief : st touch FF FF
* @param[in] : screendata
* @return :
* @retval :
**************************************************************************/
void ap_tp_st_touch_error_handler_FF(uint8_t* screendata)
{
// 收到 TP 异常回复 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
if(screendata[1] == 0xFF && screendata[2] == 0xFF&& screendata[3] == 0xFF&&screendata[4] == 0xFF)
{
// ap_tp_st_touch_software_reset();
ap_tp_st_touch_hardware_reset();
}
}

View File

@ -0,0 +1,170 @@
/*******************************************************************************
*
*
* File: app_tp_st_touch.h
* Description ST touch
* Version V0.1
* Date 2023-03-13
* Author sfy
*******************************************************************************/
#ifndef __APP_TP_ST_TOUCH_H__
#define __APP_TP_ST_TOUCH_H__
#include "string.h"
#include "tau_device_datatype.h"
#include "tau_common.h"
#include "hal_dsi_rx_ctrl.h"
typedef enum
{
CMD_TP_CABLIBRATION = 0x2A,
CMD_SET_IMAGE_RGB = 0x2B,
CMD_SEND_COMMAND = 0x2C,
CMD_WRITE_GAMMA = 0x2D,
CMD_START_GAMMA = 0x2E
} st_tp_calibration_command;
#define ST_TP_SCAN_POINT_NUMBER_MAX 6 // TP 报点最大个数
typedef struct
{
uint8_t tp_point_buffer[ST_TP_SCAN_POINT_NUMBER_MAX]; // 记录TP报点ID
uint8_t tp_read_point_counter; // 报点ID个数统计
uint8_t tp_point_up_error_flag; // 记录需要执行UP事件标记
uint32_t tp_point_error_time_counter; // 没有收到move事件或者release事件时间计算
} st_tp_scan_data;
/**************************************************************************
* @name : ap_tp_st_touch_calibration
* @brief : st touch
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void ap_tp_st_touch_calibration(void);
/**************************************************************************
* @name : app_tp_calibration_exec
* @brief : st touch
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void app_tp_calibration_exec(void);
/**************************************************************************
* @name : ap_tp_st_touch_get_calibration_success_mark
* @brief : st touch
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void ap_tp_st_touch_get_calibration_success_mark(void);
/**************************************************************************
* @name : ap_set_tp_calibration_04
* @brief : 04 02gamma校准等功能
* @param[in] :handler rx handler; dcs_packet
* @return : true
* @retval :
**************************************************************************/
bool ap_set_tp_calibration_04(hal_dsi_rx_ctrl_handle_t *handler, hal_dcs_packet_t *dcs_packet);
/**************************************************************************
* @name : ap_get_tp_calibration_status_01
* @brief :
* @param[in] :param 01
* @return : true
* @retval :
**************************************************************************/
bool ap_get_tp_calibration_status_01(hal_dsi_rx_ctrl_handle_t *handler, uint8_t param);
/**************************************************************************
* @name : ap_tp_st_touch_scan_point_init
* @brief : st touch tp_scan_data结构体初始化
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void ap_tp_st_touch_scan_point_init(void);
/**************************************************************************
* @name : ap_tp_st_touch_simulate_finger_release_event
* @brief : st touch ST
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void ap_tp_st_touch_simulate_finger_release_event(void);
/**************************************************************************
* @name : ap_tp_st_touch_software_reset
* @brief : st touch
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void ap_tp_st_touch_software_reset(void);
/**************************************************************************
* @name : app_tp_st_touch_hardware_reset
* @brief : st touch
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void ap_tp_st_touch_hardware_reset(void);
/**************************************************************************
* @name : ap_tp_st_touch_scan_point_record_event
* @brief : st touch
* @param[in] : screendata buflen
* @return :
* @retval :
**************************************************************************/
void ap_tp_st_touch_scan_point_record_event(uint8_t* screendata,uint8_t len);
/**************************************************************************
* @name : ap_tp_st_touch_scan_point_record_event_exec
* @brief : st touch while(1)
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void ap_tp_st_touch_scan_point_record_event_exec(void);
/**************************************************************************
* @name : ap_tp_st_touch_error_handler_F3
* @brief : st touch F3 02
* @param[in] : screendata
* @return :
* @retval :
**************************************************************************/
void ap_tp_st_touch_error_handler_F3(uint8_t* screendata);
/**************************************************************************
* @name : ap_tp_st_touch_error_handler_F3
* @brief : st touch FF FF
* @param[in] : screendata
* @return :
* @retval :
**************************************************************************/
void ap_tp_st_touch_error_handler_FF(uint8_t* screendata);
#endif

View File

@ -0,0 +1,759 @@
/*******************************************************************************
*
*
* File: app_tp_transfer.c
* Description touch I2C/SPI
* Version V0.1
* Date 2021-10-14
* Author zhanghz
*******************************************************************************/
#include "test_cfg_global.h"
#include "app_tp_transfer.h"
#include "hal_i2c_master.h"
#include "hal_i2c_slave.h"
#include "hal_spi_master.h"
#include "hal_spi_slave.h"
#include "tau_log.h"
#include "tau_delay.h"
#include "app_tp_st_touch.h"
#if 1//def AP_TP_TRANSFER
uint8_t read_point; //当前要读的报点数。一个报点8BYTE数据
uint8_t s_screen_number[2];
uint8_t s_screen_temp[2];
//uint8_t s_screen_read_bak[200];
static uint8_t s_screen_read_buffer[BUFFER_SIZE_MAX];
static uint8_t s_phone_read_buffer[BUFFER_SIZE_MAX];
static bool s_spim_write = false; //记录SPI主机是否配置发送是的话需要清除RXFIFO
static bool s_screen_int_flag = false; //记录是否接收到屏幕的报点中断
static bool s_phone_reset_flag = false; //记录是否接收到手机的开机复位信号
static bool s_screen_int_transfer_status = false; //记录是否已经开始通信
bool s_screen_init_complate = false; //屏幕TP开机初始化完成标志
static uint8_t s_screen_const_transfer_count = 0xff; //记录当前通信到哪一步,初始值必须大于 screen_reg_start_data_size
#ifdef USE_FOR_SUMSUNG_S20
uint16_t u16TouchID;
#endif
static void app_tp_transfer_phone(size_t recieve_num);
//static void app_tp_reset_callback(void *data);
#if PHONE_SLAVE_TRANSFER_I2C //消除warning
static void app_tp_i2cs_callback(e_i2c_s_int_status int_status, size_t recieve_num);
#endif
#if PHONE_SLAVE_TRANSFER_SPI //消除warning
static void app_tp_spis_callback(hal_spis_event_e event, hal_spi_packet_info_t *packet_info);
#endif
#ifdef USE_FOR_SUMSUNG_S21U
uint8_t MI10_PRO_screen_init_data1[3] = {0xA0,0x00,0x01};
uint8_t MI10_PRO_screen_init_data2[6] = {0xA2,0x03,0x00,0x00,0x00,0x03};
uint8_t MI10_PRO_screen_init_data3[3] = {0xA2,0x02,0x00};
uint8_t MI10_PRO_screen_init_data4[3] = {0xC0,0x07,0x01};
//uint8_t MI10_PRO_screen_init_data5[3] = {0xA4,0x06,0x70};
//uint8_t MI10_PRO_screen_init_data6[3] = {0xA6,0x00,0x00};
//uint8_t MI10_PRO_screen_init_data7[5] = {0xFA,0x20,0x00,0x00,0x78};
//uint8_t MI10_PRO_screen_init_data8[6] = {0xA2,0x03,0x20,0x00,0x00,0x00};
//uint8_t MI10_PRO_screen_init_data9[2] = {0xA0,0x01};
//uint8_t MI10_PRO_screen_init_data10[3] = {0xA0,0x00,0x00};
#endif
/**************************************************************************
* @name : app_tp_screen_int_callback
* @brief : screen
* @param[in] :
* @return :
* @retval :
**************************************************************************/
static void app_tp_screen_int_callback(void *data)
{
s_screen_int_flag = true;
}
/**************************************************************************
* @name : app_tp_screen_int_lvl_low
* @brief : screen IO
* @param[in] :
* @return : trueIO
* @retval :
**************************************************************************/
static bool app_tp_screen_int_lvl_low(void)
{
uint8_t i = 1;
uint8_t j = 1;
#if SCREEN_MASTER_TRANSFER_I2C
// i=hal_gpio_get_input_data(g_screen_input_int_pad);
// j=hal_gpio_get_input_data(g_screen_input_int_pad);
// if((i+j)==0)
// {
// return true;
// }
//else
// {
// return false;
// }
return !hal_gpio_get_input_data(g_screen_input_int_pad);
#elif SCREEN_MASTER_TRANSFER_SPI
return !hal_gpio_get_input_data(g_screen_input_int_pad); //应对SPI主机通信过程中偶尔突然拉低CS 导致通信异常
#else
return false;
#endif
}
/**************************************************************************
* @name : app_tp_screen_int_init
* @brief : screen IO
* @param[in] :
* @return :
* @retval :
**************************************************************************/
static void app_tp_screen_int_init(void)
{
hal_gpio_set_pull_state(g_screen_input_int_pad, ENABLE, DISABLE); // 1.配置上拉
hal_gpio_ctrl_eint(g_screen_input_int_pad, DISABLE); // 2.关闭中断
hal_gpio_init_eint(g_screen_input_int_pad, DETECT_FALLING_EDGE); // 3.中断初始化,TP一般都是下降沿触发中断
hal_gpio_reg_eint_cb(g_screen_input_int_pad, app_tp_screen_int_callback); // 4.注册回调
hal_gpio_ctrl_eint(g_screen_input_int_pad, ENABLE); // 5.使能中断
}
#if 0
/**************************************************************************
* @name : app_tp_phone_reset_init
* @brief : phone reset IO
* @param[in] :
* @return :
* @retval :
**************************************************************************/
static void app_tp_phone_reset_init(void)
{
/*0.配置为输入*/
hal_gpio_init_input(g_phone_input_rst_pad);
/*1.关闭中断*/
hal_gpio_ctrl_eint(g_phone_input_rst_pad, DISABLE);
/*2.中断初始化*/
hal_gpio_init_eint(g_phone_input_rst_pad, DETECT_RISING_EDGE);
/*3.注册回调*/
hal_gpio_reg_eint_cb(g_phone_input_rst_pad, app_tp_reset_callback);
/*4.使能中断*/
hal_gpio_ctrl_eint(g_phone_input_rst_pad, ENABLE);
}
#endif
/**************************************************************************
* @name : app_tp_screen_init
* @brief : screen IO
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void app_tp_screen_init(void)
{
hal_gpio_init_output(g_screen_input_rst_pad, IO_LVL_HIGH);
delayUs(200);
hal_gpio_set_output_data(g_screen_input_rst_pad, IO_LVL_LOW);
delayUs(200);
hal_gpio_set_output_data(g_screen_input_rst_pad, IO_LVL_HIGH);
}
void app_tp_I2C_init(void)
{
hal_i2c_s_init(CHIP_I2C_ADDRESS, CHIP_I2C_ADDR_BITS);
hal_i2c_s_set_transfer(app_tp_i2cs_callback);
hal_i2c_s_nonblocking_read(s_phone_read_buffer, BUFFER_SIZE_MAX); //先配置接收 buffer
}
/**************************************************************************
* @name : app_tp_init
* @brief :
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void app_tp_init(void)
{
#ifdef DISABLE_TDDI_I2C_FUNCTION
hal_gpio_init_output(g_phone_output_int_pad, IO_LVL_HIGH); //配置phone报点输出中断IO口
hal_gpio_init_output(g_screen_input_rst_pad, IO_LVL_HIGH); //配置模组TP RESET
hal_gpio_set_mode(IO_PAD_TD_SPIM_CLK,IO_MODE_I2C1_SCL);
hal_gpio_set_mode(IO_PAD_TD_SPIM_CSN,IO_MODE_I2C1_SDA);
return;
#else
hal_gpio_set_pull_state(IO_PAD_TD_SPIM_CLK, ENABLE, DISABLE);
hal_gpio_set_pull_state(IO_PAD_TD_SPIM_CSN, ENABLE, DISABLE);
#endif
app_tp_screen_init(); //初始化手机复位的IO口
//app_tp_screen_int_init(); //配置screen中断输入引脚
#ifdef G_PHONE_INT_DEFAULT_LOW
hal_gpio_init_output(g_phone_output_int_pad, IO_LVL_LOW); //配置phone报点输出中断IO口
#else
hal_gpio_init_output(g_phone_output_int_pad, IO_LVL_HIGH); //配置phone报点输出中断IO口
#endif
hal_gpio_init_input(g_screen_input_int_pad);
// hal_gpio_init_output(g_screen_input_rst_pad, IO_LVL_HIGH); //配置模组TP RESET
#if SCREEN_MASTER_TRANSFER_I2C
hal_i2c_m_dma_init(SCREEN_I2C_ADDRESS, SCREEN_I2C_ADDR_BITS, I2C_MASTER_SPEED);
#elif SCREEN_MASTER_TRANSFER_SPI
hal_spi_m_dma_init(SPI_MASTER_SPEED, SCREEN_SPI_CPHA, SCREEN_SPI_CPOL);
#endif
#if PHONE_SLAVE_TRANSFER_I2C
// hal_i2c_s_init(CHIP_I2C_ADDRESS, CHIP_I2C_ADDR_BITS);
// hal_i2c_s_set_transfer(app_tp_i2cs_callback);
// hal_i2c_s_nonblocking_read(s_phone_read_buffer, BUFFER_SIZE_MAX); //先配置接收 buffer
#elif PHONE_SLAVE_TRANSFER_SPI
hal_spi_slave_init(PHONE_SPI_CPHA, PHONE_SPI_CPOL, true); // 初始化spi以及dma
hal_spi_slave_register_callback(app_tp_spis_callback); // 注册回调
hal_spi_slave_auto_transfer_abort(); // 停止传输
hal_spi_slave_flush_fifo(); // Flush FIFO
/* 每个packet自动接收, circle mode 为false, 即收到buffer max size数据后buffer不再更新, packet完成后调用回调 */
hal_spi_slave_set_auto_rx_buffer(s_phone_read_buffer, BUFFER_SIZE_MAX, false); // 设置auto rx buffer
hal_spi_slave_set_auto_tx_buffer(phone_reg_const_data[0].write_back, phone_reg_const_data[0].write_back_size, false); // 配置TX BUFFER
hal_spi_slave_enable(); // 启动spis
hal_spi_slave_auto_transfer_start(); // 启动rx自动接收
#endif
}
/**************************************************************************
* @name : app_tp_m_transfer_complate
* @brief :
* @param[in] :
* @return :true:
* @retval :
**************************************************************************/
bool app_tp_m_transfer_complate(void)
{
#if SCREEN_MASTER_TRANSFER_I2C
return hal_i2c_m_transfer_complate();
#elif SCREEN_MASTER_TRANSFER_SPI
return hal_spi_m_get_transfer_complate();
#else
return true;
#endif
}
/**************************************************************************
* @name : app_tp_s_transfer_complate
* @brief :
* @param[in] :
* @return :true:
* @retval :
**************************************************************************/
bool app_tp_s_transfer_complate(void)
{
#if SCREEN_MASTER_TRANSFER_I2C
return hal_i2c_s_write_complate() && hal_i2c_s_read_complate();
#elif SCREEN_MASTER_TRANSFER_SPI
return !hal_spi_slave_busy();
#else
return true;
#endif
}
/**************************************************************************
* @name : app_tp_m_write
* @brief : txbuffer中的数据
* @param[in] :txbuffer: buffer
* @param[in] :buffer_size: buffer
* @return :
* @retval :
**************************************************************************/
void app_tp_m_write(const uint8_t *txbuffer, size_t buffer_size)
{
#if SCREEN_MASTER_TRANSFER_I2C
hal_i2c_m_dma_write(txbuffer, buffer_size);
#elif SCREEN_MASTER_TRANSFER_SPI
hal_spi_m_dma_write(txbuffer, buffer_size);
s_spim_write = true;
#endif
}
/**************************************************************************
* @name : app_tp_m_read
* @brief : txbuffer中的数据和rxbuffer
* @param[in] :cmd: buffer
* @param[in] :cmd_size: buffer
* @param[in] :data_buffer: buffer
* @param[in] :data_size: buffer
* @return :
* @retval :
**************************************************************************/
void app_tp_m_read(const uint8_t *cmd, size_t cmd_size, uint8_t *data_buffer, size_t data_size)
{
#if SCREEN_MASTER_TRANSFER_I2C
uint8_t i = 0;
uint32_t address = 0;
for (i = 0; i < cmd_size; i++) //先将要发送的数据整合到 address
{
address |= (uint32_t)cmd[i] << i * 8;
}
hal_i2c_m_dma_read(address, cmd_size, data_buffer, data_size);
#elif SCREEN_MASTER_TRANSFER_SPI
hal_spi_m_dma_read(cmd, cmd_size, data_buffer, data_size);
#endif
}
/**************************************************************************
* @name : app_tp_s_write
* @brief : txbuffer中的数据
* @param[in] :txbuffer: buffer
* @param[in] :buffer_size: buffer
* @return :
* @retval :
**************************************************************************/
void app_tp_s_write(const uint8_t *txbuffer, size_t buffer_size)
{
#if PHONE_SLAVE_TRANSFER_I2C
hal_i2c_s_dma_write(txbuffer, buffer_size);
#elif PHONE_SLAVE_TRANSFER_SPI
//while (hal_spi_slave_busy());
hal_spi_slave_auto_transfer_abort();
hal_spi_slave_flush_fifo();
hal_spi_slave_set_auto_tx_buffer(txbuffer, buffer_size, true);
hal_spi_slave_auto_transfer_start();
#endif
}
/**************************************************************************
* @name : app_tp_s_read
* @brief : rxbuffer
* @param[in] :rxBuffer: buffer
* @param[in] :data_size: buffer
* @return :
* @retval :
**************************************************************************/
void app_tp_s_read(void *rxBuffer, size_t data_size)
{
#if PHONE_SLAVE_TRANSFER_I2C
hal_i2c_s_nonblocking_read(rxBuffer, data_size);
#endif
}
/**************************************************************************
* @name : app_tp_spis_callback
* @brief : SPI slave
* @param[in] :
* @return :
* @retval :
**************************************************************************/
#if PHONE_SLAVE_TRANSFER_I2C //消除warning
//经测试。int_status=0为读命令。=2为STOP。=1未测试到。
//recieve_num为接收到的指令个数
static void app_tp_i2cs_callback(e_i2c_s_int_status int_status, size_t recieve_num)
{
#if 0 // 1: test
if (int_status >2)
{
s_phone_read_buffer[2]=int_status;
s_phone_read_buffer[3]=recieve_num;
app_tp_m_write(s_phone_read_buffer, 4);
}
#endif
app_tp_transfer_phone(recieve_num);
}
#endif
/**************************************************************************
* @name : app_tp_spis_callback
* @brief : SPI slave
* @param[in] :
* @return :
* @retval :
**************************************************************************/
#if PHONE_SLAVE_TRANSFER_SPI //消除warning
static void app_tp_spis_callback(hal_spis_event_e event, hal_spi_packet_info_t *packet_info)
{
app_tp_transfer_phone(packet_info->packet_size);
}
#endif
#if 0
/**************************************************************************
* @name : app_tp_reset_callback
* @brief : IO跳变复位的中断处理函数
* @param[in] :
* @return :
* @retval :
**************************************************************************/
static void app_tp_reset_callback(void *data)
{
TAU_LOGD("app_tp_reset_callback\n");
s_phone_reset_flag = true;
app_tp_s_write(phone_reg_const_data[0].write_back, phone_reg_const_data[0].write_back_size);
#if PHONE_SLAVE_TRANSFER_SPI
hal_gpio_set_output_data(IO_PAD_AP_INT, IO_LVL_LOW);
#endif
}
#endif
void S20_Start_init(void)
{
uint8_t len=0;
uint8_t temp=0;
uint8_t temp_start_flag=0;
// if(phone_start_flag==1)
{
app_tp_m_read(screen_reg_int_data[0].buffer, 1, s_screen_read_buffer, 8);
while(!hal_i2c_m_transfer_complate());
delayMs(2);
while(!hal_gpio_get_input_data(g_screen_input_int_pad))
{
app_tp_m_read(screen_reg_int_data[0].buffer, 1, s_screen_read_buffer, 8);
while(!hal_i2c_m_transfer_complate());
delayMs(2);
}
temp=s_screen_read_buffer[0]&0xf0;
if((temp==0x10)||(temp==0x20)||(temp==0x30))
{
temp_start_flag=1;
}
if(temp_start_flag==0)
{
app_tp_m_write(MI10_PRO_screen_init_data1, sizeof(MI10_PRO_screen_init_data1));//0xA0,0x00,0x01
while(!hal_i2c_m_transfer_complate());
delayMs(1);
app_tp_m_write(MI10_PRO_screen_init_data2, sizeof(MI10_PRO_screen_init_data2));//0xA2,0x03,0x00,0x00,0x00,0x03
while(!hal_i2c_m_transfer_complate());
delayMs(1);
app_tp_m_write(MI10_PRO_screen_init_data3, sizeof(MI10_PRO_screen_init_data3));//0xA2,0x02,0x00
while(!hal_i2c_m_transfer_complate());
delayMs(1);
app_tp_m_write(MI10_PRO_screen_init_data4, sizeof(MI10_PRO_screen_init_data4));//0xC0,0x07,0x01
while(!hal_i2c_m_transfer_complate());
delayMs(1);
app_tp_m_read(screen_reg_int_data[0].buffer, 1, s_screen_read_buffer, 8);
while(!hal_i2c_m_transfer_complate());
if(s_screen_read_buffer[7]>0)
{
len=s_screen_read_buffer[7]*8;
app_tp_m_read(screen_reg_int_data[0].buffer, 1, s_screen_read_buffer, len);
while(!hal_i2c_m_transfer_complate());
}
}
#endif
if(hal_gpio_get_input_data(g_screen_input_int_pad))
{
s_screen_init_complate = true;
app_tp_screen_int_init();
phone_start_flag=0;
}
}
}
/**************************************************************************
* @name : app_tp_transfer_screen_const
* @brief : flow读写screen screen
* @param[in] :
* @return :
* @retval :
*TP第1步
*screen_reg_start_data[]
**************************************************************************/
static void app_tp_transfer_screen_const(void)
{
// static bool screen_const_transfer_buffer_ready = true; //发送 buffer 是否已准备好
uint8_t ii;
// uint8_t len=0;
/**** 1. 判断当前状态通信已结束, 状态通信已结束,并且开机初始化流程还未走完****/
#if 0 // test
uint8_t test_master_read_buffer[10] = {0x08, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19};
uint8_t write_buffer[10] = {0x04, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19};
// for (ii =0x20; ii<0x7F; ii++)
{
//hal_i2c_m_dma_init(ii, SCREEN_I2C_ADDR_BITS);
//delayMs(100);
if (hal_i2c_m_dma_write(write_buffer, 1))
{
//break;
}
while(!hal_i2c_m_transfer_complate());
hal_i2c_m_dma_read(test_master_read_buffer, 1, test_master_read_buffer, 2);
}
#endif
if (app_tp_m_transfer_complate() && (s_screen_const_transfer_count < screen_reg_start_data_size))
{
if (s_spim_write) //SPI 写数据后需要把接收FIFO的数据读出不然会影响下一次读取
{
hal_spi_m_clear_rxfifo();
s_spim_write = false;
}
#if 1
// #ifndef USE_FOR_SUMSUNG_S20
// for (ii =0; ii<screen_reg_start_data_size; ii++)
// {
// if (!screen_reg_start_data[ii].read_flag) //当前通信不需要读回,直接写
// {
// app_tp_m_write(screen_reg_start_data[ii].buffer, screen_reg_start_data[ii].txbuffer_size);
// }
// else //当前通信需要读回,先写再读
// {
// app_tp_m_read(screen_reg_start_data[ii].buffer, screen_reg_start_data[ii].txbuffer_size, \
// s_screen_read_bak, screen_reg_start_data[ii].rxbuffer_size);
// }
// while(!hal_i2c_m_transfer_complate());
// }
// #endif
#ifdef USE_FOR_SUMSUNG_S21U
#if 1
if(phone_start_flag==1)
{
S20_Start_init();
}
#endif
#if 0//
delayMs(100);
app_tp_m_read(screen_reg_int_data[0].buffer, screen_reg_int_data[0].txbuffer_size, s_screen_number, screen_reg_int_data[0].rxbuffer_size);
while(!hal_i2c_m_transfer_complate());
#endif
#ifdef USE_FOR_SUMSUNG_S20
s_screen_init_complate = true;
#endif
#else
/**** 2. 发送或读取从机数据 ****/
if (screen_const_transfer_buffer_ready)
{
screen_const_transfer_buffer_ready = false;
if (!screen_reg_start_data[s_screen_const_transfer_count].read_flag) //当前通信不需要读回,直接写
{
app_tp_m_write(screen_reg_start_data[s_screen_const_transfer_count].buffer, screen_reg_start_data[s_screen_const_transfer_count].txbuffer_size);
}
else //当前通信需要读回,先写再读
{
app_tp_m_read(screen_reg_start_data[s_screen_const_transfer_count].buffer, screen_reg_start_data[s_screen_const_transfer_count].txbuffer_size, \
s_screen_number, screen_reg_start_data[s_screen_const_transfer_count].rxbuffer_size);
}
s_screen_init_complate = true;
}
/**** 3. 解析本次通信数据并准备下一次通信的buffer ****/
else
{
screen_const_transfer_buffer_ready = true;
s_screen_const_transfer_count = app_tp_screen_analysis_const(s_screen_const_transfer_count, s_screen_number, \
screen_reg_start_data[s_screen_const_transfer_count].rxbuffer_size);
if (s_screen_const_transfer_count >= screen_reg_start_data_size)
{
s_screen_init_complate = true;
}
}
#endif
}
}
/**************************************************************************
* @name : app_tp_transfer_screen_start
* @brief : flow读写screen
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void app_tp_transfer_screen_start(void)
{
// s_screen_init_complate = false;
s_screen_const_transfer_count = 0;
//app_tp_screen_init();
#ifndef DISABLE_I2C_INIT_CODE
app_tp_transfer_screen_const();
#endif
s_screen_int_flag = false;
}
/**************************************************************************
* @name : app_tp_transfer_screen_int
* @brief : screen中断后flow读写screen
* @param[in] :
* @return :
* @retval :
*TP第2步
*screen_reg_int_data[]
**************************************************************************/
void app_tp_transfer_screen_int(void)
{
uint8_t len=0;
uint8_t temp_len=0;
bool screen_gpio_int = false;
static uint8_t screen_int_transfer_count = 0; //记录当前通信到哪一步
static bool screen_int_transfer_buffer_ready = true; //发送 buffer 是否已准备好
// static uint8_t test_flag = 0;
// s_screen_init_complate=false;//为了在线烧录特意将码片设置为不下发数据而是FT8719与敦泰的工具通讯
if (!s_screen_init_complate) //TP 初始化还未完成,则先进行初始化操作
{
app_tp_transfer_screen_const();
return;
}
/**** 1. 判断 screen 是否发出中断信号 ****/
// s_screen_int_flag: 中断信号标志位
// app_tp_screen_int_lvl_low : SPI 长时间通信时偶尔会出现cs拉高导致通信异常卡死该标志位用于解决卡死的问题
screen_gpio_int = s_screen_int_flag || app_tp_screen_int_lvl_low();
if (screen_gpio_int)
{
s_screen_int_flag = false;
app_tp_m_read(screen_reg_int_data[0].buffer, 1, s_screen_read_buffer, 8);
while(!hal_i2c_m_transfer_complate());
if(s_screen_read_buffer[7]>0)
{
len=s_screen_read_buffer[7]*8;
app_tp_m_read(screen_reg_int_data[0].buffer, 1, &s_screen_read_buffer[8], len);
while(!hal_i2c_m_transfer_complate());
temp_len=len+7;
}
if(s_screen_read_buffer[temp_len]>0)
{
len=s_screen_read_buffer[7]*8;
app_tp_m_read(screen_reg_int_data[0].buffer, 1, &s_screen_read_buffer[temp_len+1], len);
while(!hal_i2c_m_transfer_complate());
}
delayUs(100);
while(!hal_gpio_get_input_data(g_screen_input_int_pad))
{
app_tp_m_read(screen_reg_int_data[0].buffer, 1, s_screen_read_buffer, 8);
while(!hal_i2c_m_transfer_complate());
delayUs(100);
if(s_screen_read_buffer[7]>0)
{
len=s_screen_read_buffer[7]*8;
app_tp_m_read(screen_reg_int_data[0].buffer, 1, &s_screen_read_buffer[8], len);
while(!hal_i2c_m_transfer_complate());
delayUs(100);
}
}
ap_tp_st_touch_error_handler_F3(s_screen_read_buffer);
ap_tp_st_touch_error_handler_FF(s_screen_read_buffer);
ap_tp_st_touch_scan_point_record_event(s_screen_read_buffer, len + 8);
screen_int_transfer_buffer_ready = true;
screen_int_transfer_count = app_tp_screen_analysis_int(screen_int_transfer_count, s_screen_read_buffer,screen_reg_int_data[2].rxbuffer_size);
screen_int_transfer_count = 0;
s_screen_int_transfer_status = false;
}
}
/**************************************************************************
* @name : app_tp_transfer_phone
* @brief :
* @param[in] : recieve_num
* @return :
* @retval :
**************************************************************************/
static void app_tp_transfer_phone(size_t recieve_num)
{
const uint8_t *phone_write_buffer;
size_t phone_write_buffer_size = 0;
/* 数据解析判断是否需要答复以及答复的buffer指针 */
if (recieve_num > 0)
{
#if 0// 1: test
s_phone_read_buffer[3]=recieve_num;
app_tp_m_write(s_phone_read_buffer, 4);
#endif
app_tp_phone_analysis_data(s_phone_read_buffer, recieve_num, &phone_write_buffer, &phone_write_buffer_size);
}
app_tp_s_read(s_phone_read_buffer, BUFFER_SIZE_MAX);
if (phone_write_buffer_size) //大于0表示需要答复手机配置发送buffer
{
app_tp_s_write(phone_write_buffer, phone_write_buffer_size);
}
}
/**************************************************************************
* @name : app_tp_phone_reset_on
* @brief :
* @param[in] :
* @return :
* @retval :
**************************************************************************/
bool app_tp_phone_reset_on(void)
{
return s_phone_reset_flag;
}
/**************************************************************************
* @name : app_tp_phone_clear_reset_on
* @brief :
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void app_tp_phone_clear_reset_on(void)
{
s_phone_reset_flag = false;
}
#else
void app_tp_screen_init(void)
{
}
void app_tp_init(void)
{
}
void app_tp_transfer_screen_int(void)
{
}
void app_tp_transfer_screen_start(void)
{
}
bool app_tp_phone_reset_on(void)
{
return false;
}
void app_tp_phone_clear_reset_on(void)
{
}
void app_tp_s_write(const uint8_t *txbuffer, size_t buffer_size)
{
}
bool app_tp_enter_sleep_on(void)
{
return false;
}
#endif

View File

@ -0,0 +1,97 @@
/*******************************************************************************
*
*
* File: app_tp_transfer.h
* Description touch I2C/SPI
* Version V0.1
* Date 2021-10-14
* Author zhanghz
*******************************************************************************/
#ifndef __APP_TP_TRANSFER_H__
#define __APP_TP_TRANSFER_H__
#include "string.h"
#include "tau_device_datatype.h"
#include "tau_common.h"
#define SCREEN_TRANSFER_WRITE false //接收到screen io中断发送数据之后不用读回
#define SCREEN_TRANSFER_READ true //接收到screen io中断发送数据之后要读回数据
/**************************************************************************
* @name : app_tp_screen_init
* @brief : screen IO
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void app_tp_screen_init(void);
/**************************************************************************
* @name : app_tp_init
* @brief :
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void app_tp_init(void);
/**************************************************************************
* @name : app_tp_transfer_screen_int
* @brief : screen中断后flow读写screen
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void app_tp_transfer_screen_int(void);
/**************************************************************************
* @name : app_tp_transfer_screen_start
* @brief : flow读写screen
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void app_tp_transfer_screen_start(void);
/**************************************************************************
* @name : app_tp_phone_reset_on
* @brief :
* @param[in] :
* @return :
* @retval :
**************************************************************************/
bool app_tp_phone_reset_on(void);
/**************************************************************************
* @name : app_tp_phone_clear_reset_on
* @brief :
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void app_tp_phone_clear_reset_on(void);
/**************************************************************************
* @name : app_tp_s_write
* @brief : txbuffer中的数据
* @param[in] :txbuffer: buffer
* @param[in] :buffer_size: buffer
* @return :
* @retval :
**************************************************************************/
void app_tp_s_write(const uint8_t *txbuffer, size_t buffer_size);
/**************************************************************************
* @name : app_tp_enter_sleep_on
* @brief : tp
* @param[in] :
* @return :
* @retval :
**************************************************************************/
bool app_tp_enter_sleep_on(void);
void app_tp_m_write(const uint8_t *txbuffer, size_t buffer_size);
void app_tp_m_read(const uint8_t *cmd, size_t cmd_size, uint8_t *data_buffer, size_t data_size);
#endif

26
src/app/main.c Normal file
View File

@ -0,0 +1,26 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "test_cfg_global.h"
#include "tau_log.h"
#include "hal_system.h"
#include "board.h"
#include "tau_delay.h"
//test_cfg_global.h file choice what you want test or completely demo of S8 or S8+ Felix
int main()
{
// hal_system_init();
board_Init();
while (1)
{
#if _DEMO_S8_EN
ap_demo();
#endif
while (1);
}
}

84
src/app/test_cfg_global.h Normal file
View File

@ -0,0 +1,84 @@
/*******************************************************************************
* Copyright (C) 2019-2022, 518 Systems (R),All Rights Reserved.
*
* File: test_cfg_global.h
* Description
* Version V0.1
* Date 2021-05-01
* Author kevin
*******************************************************************************/
#ifndef __TEST_GLOBAL_CONFIG_H__
#define __TEST_GLOBAL_CONFIG_H__
/*******************************************************************************
* 1.Included files
*******************************************************************************/
/*******************************************************************************
* 2.Global constant and macro definitions using #define
*******************************************************************************/
#define _TEST_TIMER_EN 0
#define _TEST_DSI_TX_EN 0
#define _TEST_DSI_RX_EN 0
#define _TEST_PWM_EN 0
#define _TEST_SWIRE_EN 0
#define _TEST_WDG_EN 0
#define _TEST_GPIO_EN 0
#define _TEST_I2C_EN 0
#define _TEST_SPI_EN 0
#define _DEMO_S8_EN 1
#define _DEMO_S8P_EN 0
#if _TEST_TIMER_EN
#include "test_hal_timer.h"
#endif
#if _TEST_I2C_EN
#include "test_hal_i2c.h"
#endif
#if _TEST_SPI_EN
#include "test_hal_spi.h"
#endif
#if _TEST_DSI_TX_EN
#include "test_hal_dsi_tx.h"
#endif
#if _TEST_DSI_RX_EN
#include "test_hal_dsi_rx.h"
#endif
#if _TEST_PWM_EN
#include "test_hal_pwm.h"
#endif
#if _TEST_SWIRE_EN
#include "test_hal_swire.h"
#endif
#if _TEST_WDG_EN
#include "test_hal_wdg.h"
#endif
#if _TEST_GPIO_EN
#include "test_hal_gpio.h"
#endif
#if _TEST_I2C_TP_EN
#include "test_hal_i2c_tp.h"
#endif
#if _DEMO_S8_EN
#include "ap_demo.h"
#include "app_tp_for_custom_s8.h"
#endif
#if _DEMO_S8P_EN
#include "s8p_demo.h"
#include "app_tp_for_custom_s8p.h"
#endif
#endif

26
src/board/board.c Normal file
View File

@ -0,0 +1,26 @@
/*******************************************************************************
* Copyright (C) 2019-2022, ISP Systems (R),All Rights Reserved.
*
* File: board.c
* Description
* Version V0.1
* Date 2020-12-07
* Author linyw
*******************************************************************************/
#include "board.h"
#include "hal_system.h"
#include "ArmCM0.h"
void board_Init(void)
{
hal_system_init(SYSTEM_CLOCK);
hal_system_enable_systick(1);
#if !EDA_MODE
hal_system_init_console(115200);
#endif
#if defined(ISP_568) || defined(ISP_368)
/* 从EFUSE读取DPHY校准值并设置 */
hal_system_set_phy_calibration(true);
#endif
}

16
src/board/board.h Normal file
View File

@ -0,0 +1,16 @@
/*******************************************************************************
* Copyright (C) 2019-2022, CVA Systems (R),All Rights Reserved.
*
* File: board.h
* Description: baord
* Version: V0.1
* Date: 2020-01-08
* Author: lzy
*******************************************************************************/
#ifndef __BOARD_H__
#define __BOARD_H__
void board_Init(void);
#endif

View File

@ -0,0 +1,226 @@
;/**************************************************************************//**
; * @file startup_ARMCM0.s
; * @brief CMSIS Core Device Startup File for
; * ARMCM0 Device
; * @version V5.4.0
; * @date 12. December 2018
; ******************************************************************************/
;/*
; * Copyright (c) 2009-2018 Arm Limited. All rights reserved.
; *
; * SPDX-License-Identifier: Apache-2.0
; *
; * Licensed under the Apache License, Version 2.0 (the License); you may
; * not use this file except in compliance with the License.
; * You may obtain a copy of the License at
; *
; * www.apache.org/licenses/LICENSE-2.0
; *
; * Unless required by applicable law or agreed to in writing, software
; * distributed under the License is distributed on an AS IS BASIS, WITHOUT
; * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; * See the License for the specific language governing permissions and
; * limitations under the License.
; */
;//-------- <<< Use Configuration Wizard in Context Menu >>> ------------------
;<h> Stack Configuration
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
;</h>
Stack_Size EQU 0x00001000
AREA STACK, NOINIT, READWRITE, ALIGN=3
__stack_limit
Stack_Mem SPACE Stack_Size
__initial_sp
;<h> Heap Configuration
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
;</h>
Heap_Size EQU 0x00000C00
IF Heap_Size != 0 ; Heap is provided
AREA HEAP, NOINIT, READWRITE, ALIGN=3
__heap_base
Heap_Mem SPACE Heap_Size
__heap_limit
ENDIF
PRESERVE8
THUMB
; Vector Table Mapped to Address 0 at Reset
AREA RESET, DATA, READONLY
EXPORT __Vectors
EXPORT __Vectors_End
EXPORT __Vectors_Size
__Vectors DCD __initial_sp ; Top of Stack
DCD Reset_Handler ; Reset Handler
DCD NMI_Handler ; -14 NMI Handler
DCD HardFault_Handler ; -13 Hard Fault Handler
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD SVC_Handler ; -5 SVCall Handler
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD PendSV_Handler ; -2 PendSV Handler
DCD SysTick_Handler ; -1 SysTick Handler
; Interrupts
DCD VIDC_IRQn_Handler ; 0 Interrupt 0
DCD LCDC_IRQn_Handler ; 1 Interrupt 1
DCD MIPI_RX_IRQn_Handler ; 2 Interrupt 2
DCD MIPI_TX_IRQn_Handler ; 3 Interrupt 3
DCD MEMC_IRQn_Handler ; 4 Interrupt 4
DCD VPRE_IRQn_Handler ; 5 Interrupt 5
DCD FLSCTRL_IRQn_Handler ; 6 Interrupt 6
DCD DMA_IRQn_Handler ; 7 Interrupt 7
DCD TIMER0_IRQn_Handler ; 8 Interrupt 8
DCD TIMER1_IRQn_Handler ; 9 Interrupt 9
DCD TIMER2_IRQn_Handler ; 10 Interrupt 10
DCD TIMER3_IRQn_Handler ; 11 Interrupt 11
DCD WDG_IRQn_Handler ; 12 Interrupt 12
DCD UART_IRQn_Handler ; 13 Interrupt 13
DCD I2C0_IRQn_Handler ; 14 Interrupt 14
DCD I2C1_IRQn_Handler ; 15 Interrupt 15
DCD SPIS_IRQn_Handler ; 16 Interrupt 16
DCD SPIM_IRQn_Handler ; 17 Interrupt 17
DCD ADC_IRQn_Handler ; 18 Interrupt 18
DCD PWMDET_IRQn_Handler ; 19 Interrupt 19
DCD OTP_IRQn_Handler ; 20 Interrupt 20
DCD SWIRE_IRQn_Handler ; 21 Interrupt 21
DCD PVD_IRQn_Handler ; 22 Interrupt 22
DCD AP_NRESET_IRQn_Handler ; 23 Interrupt 23
DCD EXTI_INT0_IRQn_Handler ; 24 Interrupt 24
DCD EXTI_INT1_IRQn_Handler ; 25 Interrupt 25
DCD EXTI_INT2_IRQn_Handler ; 26 Interrupt 26
DCD EXTI_INT3_IRQn_Handler ; 27 Interrupt 27
DCD EXTI_INT4_IRQn_Handler ; 28 Interrupt 28
DCD EXTI_INT5_IRQn_Handler ; 29 Interrupt 29
DCD EXTI_INT6_IRQn_Handler ; 30 Interrupt 30
DCD EXTI_INT7_IRQn_Handler ; 31 Interrupt 31
SPACE ( 0 * 4) ; Interrupts 10 .. 31 are left out
__Vectors_End
__Vectors_Size EQU __Vectors_End - __Vectors
_NVIC_ICER0 EQU 0xE000E180 ;清中断使能寄存器地址
_NVIC_ICPR0 EQU 0xE000E280 ;清中断pending寄存器地址
AREA |.text|, CODE, READONLY
; Reset Handler
Reset_Handler PROC
EXPORT Reset_Handler [WEAK]
IMPORT __main
;清中断使能和pending ——开始——
CPSID I ; 屏蔽中断
LDR R0, =_NVIC_ICER0
LDR R1, =_NVIC_ICPR0
LDR R2, =0xFFFFFFFF
MOVS R3, #1 ; 设置循环次数 M0只有1组(32个)中断故只需要循环1次
_irq_clear
;CBZ R3, _irq_clear_end
CMP R3,#0 ; 循环次数等于0跳转到_irq_clear_end
BEQ _irq_clear_end
STR R2, [R0] ;,#4 ; NVIC_ICER0 - 清 enable IRQ 寄存器
STR R2, [R1] ;,#4 ; NVIC_ICPR0 - 清 pending IRQ 寄存器
SUBS R3, #1 ; 循环数自减1
B _irq_clear
_irq_clear_end
;清中断使能和pending ——结束——
CPSIE I ; 开启中断
LDR R0, =__main
BX R0
ENDP
; Macro to define default exception/interrupt handlers.
; Default handler are weak symbols with an endless loop.
; They can be overwritten by real handlers.
MACRO
Set_Default_Handler $Handler_Name
$Handler_Name PROC
EXPORT $Handler_Name [WEAK]
B .
ENDP
MEND
; Default exception/interrupt handler
Set_Default_Handler NMI_Handler
Set_Default_Handler HardFault_Handler
Set_Default_Handler SVC_Handler
Set_Default_Handler PendSV_Handler
Set_Default_Handler SysTick_Handler
Set_Default_Handler VIDC_IRQn_Handler
Set_Default_Handler LCDC_IRQn_Handler
Set_Default_Handler MIPI_RX_IRQn_Handler
Set_Default_Handler MIPI_TX_IRQn_Handler
Set_Default_Handler MEMC_IRQn_Handler
Set_Default_Handler VPRE_IRQn_Handler
Set_Default_Handler FLSCTRL_IRQn_Handler
Set_Default_Handler DMA_IRQn_Handler
Set_Default_Handler TIMER0_IRQn_Handler
Set_Default_Handler TIMER1_IRQn_Handler
Set_Default_Handler TIMER2_IRQn_Handler
Set_Default_Handler TIMER3_IRQn_Handler
Set_Default_Handler WDG_IRQn_Handler
Set_Default_Handler UART_IRQn_Handler
Set_Default_Handler I2C0_IRQn_Handler
Set_Default_Handler I2C1_IRQn_Handler
Set_Default_Handler SPIS_IRQn_Handler
Set_Default_Handler SPIM_IRQn_Handler
Set_Default_Handler ADC_IRQn_Handler
Set_Default_Handler PWMDET_IRQn_Handler
Set_Default_Handler OTP_IRQn_Handler
Set_Default_Handler SWIRE_IRQn_Handler
Set_Default_Handler PVD_IRQn_Handler
Set_Default_Handler AP_NRESET_IRQn_Handler
Set_Default_Handler EXTI_INT0_IRQn_Handler
Set_Default_Handler EXTI_INT1_IRQn_Handler
Set_Default_Handler EXTI_INT2_IRQn_Handler
Set_Default_Handler EXTI_INT3_IRQn_Handler
Set_Default_Handler EXTI_INT4_IRQn_Handler
Set_Default_Handler EXTI_INT5_IRQn_Handler
Set_Default_Handler EXTI_INT6_IRQn_Handler
Set_Default_Handler EXTI_INT7_IRQn_Handler
ALIGN
; User setup Stack & Heap
IF :LNOT::DEF:__MICROLIB
IMPORT __use_two_region_memory
ENDIF
EXPORT __stack_limit
EXPORT __initial_sp
IF Heap_Size != 0 ; Heap is provided
EXPORT __heap_base
EXPORT __heap_limit
ENDIF
END

216
src/common/tau_common.h Normal file
View File

@ -0,0 +1,216 @@
/*******************************************************************************
*
*
* File: tau_common.h
* Description
* Version V0.1
* Date 2020-09-07
* Author lzy
*******************************************************************************/
#ifndef __TAU_COMMON_H
#define __TAU_COMMON_H
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "stdint.h"
#include "math.h"
/*******************************************************************************
* 2.Global constant and macro definitions using #define
*******************************************************************************/
/**
* \name
* @{
*/
//#define ENABLE 1
//#define DISABLE 0
#define ON 1
#define OFF 0
#define NONE 0
#define EOS '\0'
/*
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
*/
#ifndef __cplusplus
#define true 1
#define false 0
#define bool _Bool
#endif /* ifndef __cplusplus */
#ifndef NULL
#define NULL ((void *)0)
#endif
#define TAU_LITTLE_ENDIAN 1234 /**< \brief 小端模式 */
#define TAU_BIG_ENDIAN 3412 /**< \brief 大端模式 */
/** @} */
/******************************************************************************/
/**
* \name
* @{
*/
#ifdef __cplusplus
#define __I volatile /*!< Defines 'read only' permissions */
#else
#define __I volatile const /*!< Defines 'read only' permissions */
#endif
#define __O volatile /*!< Defines 'write only' permissions */
#define __IO volatile /*!< Defines 'read / write' permissions */
#define TAU_INLINE inline
#define TAU_STATIC_INLINE static inline
#define TAU_STATIC static
#define TAU_CONST const
#define TAU_EXTERN extern
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
/**
* \brief
* \attention
*
*
* \par
* \code
* struct my_struct {
* int m1;
* char m2;
* };
* int offset_m2;
*
* offset_m2 = TAU_OFFSET(struct my_struct, m2);
* \endcode
*/
#define TAU_OFFSET(structure, member) ((uint32_t)(&(((structure *)0)->member)))
/** @} */
/**
* \brief
*
* \param ptr
* \param type
* \param member
*
* \par
* \code
* struct my_struct = {
* int m1;
* char m2;
* };
* struct my_struct my_st;
* char *p_m2 = &my_st.m2;
* struct my_struct *p_st = TAU_CONTAINER_OF(p_m2, struct my_struct, m2);
* \endcode
*/
#define TAU_CONTAINER_OF(ptr, type, member) \
((type *)((char *)(ptr)-TAU_OFFSET(type, member)))
/**
* \brief
*
* \code
* struct a = {
* uint32_t m1;
* uint32_t m2;
* };
* int size_m2;
*
* size_m2 = TAU_MEMBER_SIZE(a, m2); //size_m2 = 4
* \endcode
*/
#define TAU_MEMBER_SIZE(structure, member) (sizeof(((structure *)0)->member))
/**
* \brief
*
* \code
* int a[] = {0, 1, 2, 3};
* int element_a = TAU_NELEMENTS(a); // element_a = 4
* \endcode
*/
#define TAU_NELEMENTS(array) (sizeof(array) / sizeof((array)[0]))
/**
* \brief
*
* \param x
* \param align
*
* \code
* int size = TAU_ROUND_UP(15, 4); // size = 16
* \endcode
*/
#define TAU_ROUND_UP(x, align) (((int)(x)/(align))*(align) + (((int)(x)%(align)) ? (align) : 0))
/**
* \brief
*
* \param x
* \param align
*
* \code
* int size = TAU_ROUND_DOWN(15, 4); // size = 12
* \endcode
*/
#define TAU_ROUND_DOWN(x, align) (((int)(x)/(align))*(align))
/** \brief 倍数向上舍入 */
#define TAU_DIV_ROUND_UP(n, d) (((n) + (d)-1) / (d))
/**
* \brief
*
* \param x
* \param align 2
*
* \code
* if (TAU_ALIGNED(x, 4) {
* ; // x对齐
* } else {
* ; // x不对齐
* }
* \endcode
*/
#define TAU_ALIGNED(x, align) (((int)(x) & (align - 1)) == 0)
/** \brief 将1字节BCD数据转换为16进制数据 */
#define TAU_BCD_TO_HEX(val) (((val)&0x0f) + ((val) >> 4) * 10)
/** \brief 将1字节16进制数据转换为BCD数据 */
#define TAU_HEX_TO_BCD(val) ((((val) / 10) << 4) + (val) % 10)
/**
* \brief
*/
#define TAU_CEIL(val) ceil(val)
/*! @brief Construct the version number for drivers. */
#define MAKE_VERSION(major, minor, bugfix) (((major) << 16) | ((minor) << 8) | (bugfix))
/*******************************************************************************
* 3.Global structures, unions and enumerations using typedef
*******************************************************************************/
/* \brief 通用回调函数指针定义 */
typedef void (*fcb_type)(void *data);
#endif /* __TAU_COMMON_H */

34
src/common/tau_delay.h Normal file
View File

@ -0,0 +1,34 @@
/**
* File Name: tau_delay.h
*
*
*
* Author: Fortsense 3D Firmware Team
*
* Date: 2020/12/04
*
* Project: Taurus
*
* Description:
*
* HISTORY:
**/
#ifndef _DELAY_H_
#define _DELAY_H_
#include "stdint.h"
/**
* @brief delay ms ,2%
* @param ms:delay时长
* @retval none
*/
void delayMs(uint32_t ms);
/**
* @brief delay us ,2%
* @param us:delay时长
* @retval none
*/
void delayUs(uint32_t us);
#endif

View File

@ -0,0 +1,167 @@
/*******************************************************************************
*
*
* File: tau_device_datatype.h
* Description device datatype
* Version V0.1
* Date 2020-12-04
* Author kevin
*******************************************************************************/
#ifndef _TAU_DEVICE_DATATYPE_H_
#define _TAU_DEVICE_DATATYPE_H_
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "stdint.h"
#include "tau_common.h"
/*******************************************************************************
* 2.Global constant and macro definitions using #define
*******************************************************************************/
/*******************************************************************************
* 3.Global structures, unions and enumerations using typedef
*******************************************************************************/
/*! @brief 计算组状态码 */
#define MAKE_STATUS(group, code) ((((group)*100) + (code)))
/*******************************************************************************
* 3.Global structures, unions and enumerations using typedef
*******************************************************************************/
/*! @brief 分组状态值 */
enum _status_groups
{
STATUS_GROUP_GENERIC = 0,
STATUS_GROUP_I2C = 1,
STATUS_GROUP_UART = 2,
STATUS_GROUP_SPI = 3,
kStatusGroup_Timer = 4,
};
/*! @brief 常用状态码 */
enum _generic_status
{
STATUS_SUCCESS = MAKE_STATUS(STATUS_GROUP_GENERIC, 0),
STATUS_FAIL = MAKE_STATUS(STATUS_GROUP_GENERIC, 1),
STATUS_READ_ONLY = MAKE_STATUS(STATUS_GROUP_GENERIC, 2),
STATUS_OUT_OF_RANGE = MAKE_STATUS(STATUS_GROUP_GENERIC, 3),
STATUS_INVALID_ARGUMENT = MAKE_STATUS(STATUS_GROUP_GENERIC, 4),
STATUS_TIME_OUT = MAKE_STATUS(STATUS_GROUP_GENERIC, 5),
STATUS_NO_TRANSFER_IN_PROGRESS = MAKE_STATUS(STATUS_GROUP_GENERIC, 6),
};
/*!
* @brief timer状态
*/
typedef enum
{
TIMER_STATUS_IDLE = MAKE_STATUS(kStatusGroup_Timer, 0), /*!< 空闲 */
TIMER_STATUS_RUNNING = MAKE_STATUS(kStatusGroup_Timer, 1), /*!< 运行中 */
TIMER_STATUS_TIMEOUT = MAKE_STATUS(kStatusGroup_Timer, 2), /*!< 超时 */
} timer_status_e;
/*!
* @brief system触发事件(/)
*/
typedef enum
{
DETECT_HIGH_LVL = 0,
DETECT_LOW_LVL,
DETECT_RISING_EDGE,
DETECT_FALLING_EDGE
} sys_cfg_trigger_e;
/**
* @brief GPIO interrupt type
*/
typedef enum
{
TIMER_NUM0 = 0,
TIMER_NUM1,
TIMER_NUM2,
TIMER_NUM3,
TIMER_NUM_MAX
} timer_num_e;
/**
* @brief GPIO interrupt type
*/
typedef enum
{
GPIO_INT_EXTI_INT0 = 0,
GPIO_INT_EXTI_INT1,
GPIO_INT_EXTI_INT2,
GPIO_INT_EXTI_INT3,
GPIO_INT_EXTI_INT4,
GPIO_INT_EXTI_INT5,
GPIO_INT_EXTI_INT6,
GPIO_INT_EXTI_INT7,
GPIO_INT_MAX
} gpio_int_e;
/*! @brief PWMI中断类型 */
typedef enum _pwm_int_type
{
PWM_INT_HIGH_OVERFLOW = 0,
PWM_INT_LOW_OVERFLOW,
PWM_INT_TOTAL_OVERFLOW,
PWM_INT_HIGH_DONE,
PWM_INT_LOW_DONE,
PWM_INT_TOTAL_DONE,
PWM_INT_MAX
} pwm_int_type_e;
/**
* @brief I2C chose
*/
typedef enum
{
I2C_SELECT_0 = 0, //常用slave
I2C_SELECT_1, //常用master
} i2c_select_e;
/*!
* @brief
* @note
*/
typedef enum _i2c_rate
{
I2C_RATE_STANDARD = 1, //100kHz
I2C_RATE_FAST, //400kHz
I2C_RATE_HIGH, //1MHz
} i2c_rate_e;
/*! @brief DMA channel type */
typedef enum
{
DMA_CH0 = 0, /*!< SPIM */
DMA_CH1 = 1, /*!< IIC0 */
DMA_CH2 = 2, /*!< SPIS */
DMA_CH3 = 3, /*!< IIC1 */
DMA_CH4 = 4, /*!< SPI FLASH */
DMA_CH5 = 5, /*!< UART */
} dma_channel_e;
/*! @brief Type used for all status and error return values. */
typedef enum
{
DISABLE = 0,
ENABLE = !DISABLE
} function_state_e;
/*!< @brief 用于返回状态和错误 */
typedef int32_t status_t;
/*******************************************************************************
* 4.Global variable extern declarations
*******************************************************************************/
#endif

View File

@ -0,0 +1,375 @@
/*******************************************************************************
*
*
* File: tau_dsi_datatype.h
* Description: mipi dsi
* Version: V0.1
* Date: 2021-01-13
* Author: lzy
*******************************************************************************/
#ifndef __MIPI_DSI_COMMON_H__
#define __MIPI_DSI_COMMON_H__
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "tau_common.h"
/*******************************************************************************
* 2.Global constant and macro definitions using #define
*******************************************************************************/
#define DSC_PPS_SIZE 128
/*******************************************************************************
* 3.Global structures, unions and enumerations using typedef
*******************************************************************************/
/**
* @brief Data Types for Peripheral-sourced Packets,From Mipi DSI Spec
*/
typedef enum
{
DSI_ACK_DT_ERROR = 0x02,
DSI_ACK_DT_EOTP = 0x08,
DSI_ACK_DT_GEN_SHORT_RESPONSE_1B = 0x11,
DSI_ACK_DT_GEN_SHORT_RESPONSE_2B = 0x12,
DSI_ACK_DT_GEN_LONG_RESPONSE = 0x1A,
DSI_ACK_DT_DSC_LONG_RESPONSE = 0x1C,
DSI_ACK_DT_DSC_SHORT_RESPONSE_1B = 0x21,
DSI_ACK_DT_DSC_SHORT_RESPONSE_2B = 0x22,
DSI_ACK_DT_MAX
} dsi_ack_data_type_e;
/**
* @brief Software handle data types
*/
typedef enum
{
DSI_RECV_DT_PPS = 0x0A, //Picture Parameter Set
DSI_RECV_DT_GEN_WRITE_1B = 0x13, //Generic Short WRITE, 1 parameter
DSI_RECV_DT_GEN_WRITE_2B = 0x23, //Generic Short WRITE, 2 parameters
DSI_RECV_DT_GEN_READ_0B = 0x04, //Generic READ, no parameters
DSI_RECV_DT_GEN_READ_1B = 0x14, //Generic READ, 1 parameter
DSI_RECV_DT_GEN_READ_2B = 0x24, //Generic READ, 2 parameters
DSI_RECV_DT_DCS_WRITE_0B = 0x05, //DCS Short WRITE, no parameters
DSI_RECV_DT_DCS_WRITE_1B = 0x15, //DCS Short WRITE, 1 parameter
DSI_RECV_DT_DCS_READ_0B = 0x06, //DCS READ, no parameters
DSI_RECV_DT_GEN_WRITE_LONG = 0x29, //Generic Long Write
DSI_RECV_DT_DCS_WRITE_LONG = 0x39, //DCS Long Write/write_LUT Command Packet
DSI_RECV_DT_MAX
} dsi_data_type_e;
typedef enum
{
DCS_ENTER_IDLE_MODE = 0x39,
DCS_ENTER_INVERT_MODE = 0x21,
DCS_ENTER_NORMAL_MODE = 0x13,
DCS_ENTER_PARTIAL_MODE = 0x12,
DCS_ENTER_SLEEP_MODE = 0x10,
DCS_EXIT_IDLE_MODE = 0x38,
DCS_EXIT_INVERT_MODE = 0x20,
DCS_EXIT_SLEEP_MODE = 0x11,
DCS_GET_3D_CONTROL = 0x3F,
DCS_GET_ADDRESS_MODE = 0x0B,
DCS_GET_BLUE_CHANNEL = 0x08,
DCS_GET_COMPRESSION_MODE = 0x03,
DCS_GET_DIAGNOSTIC_RESULT = 0x0F,
DCS_GET_DISPLAY_MODE = 0x0D,
DCS_GET_GREEN_CHANNEL = 0x07,
DCS_GET_PIXEL_FORMAT = 0x0C,
DCS_GET_POWER_MODE = 0x0A,
DCS_GET_RED_CHANNEL = 0x06,
DCS_GET_SCANLINE = 0x45,
DCS_GET_SIGNAL_MODE = 0x0E,
DCS_NOP = 0x00,
DCS_READ_DDB_CONTINUE = 0xA8,
DCS_READ_DDB_START = 0xA1,
DCS_READ_MEMORY_CONTINUE = 0x3E,
DCS_READ_MEMORY_START = 0x2E,
DCS_SET_3D_CONTROL = 0x3D,
DCS_SET_ADDRESS_MODE = 0x36,
DCS_SET_COLUMN_ADDRESS = 0x2A,
DCS_SET_DISPLAY_OFF = 0x28,
DCS_SET_DISPLAY_ON = 0x29,
DCS_SET_GAMMA_CURVE = 0x26,
DCS_SET_PAGE_ADDRESS = 0x2B,
DCS_SET_PARTIAL_COLUMNS = 0x31,
DCS_SET_PARTIAL_ROWS = 0x30,
DCS_SET_PIXEL_FORMAT = 0x3A,
DCS_SET_SCROLL_AREA = 0x33,
DCS_SET_SCROLL_START = 0x37,
DCS_SET_TEAR_OFF = 0x34,
DCS_SET_TEAR_ON = 0x35,
DCS_SET_TEAR_SCANLINE = 0x44,
DCS_SET_VSYNC_TIMING = 0x40,
DCS_SOFT_RESET = 0x01,
DCS_WRITE_LUT = 0x2D,
DCS_WRITE_MEMORY_CONTINUE = 0x3C,
DCS_WRITE_MEMORY_START = 0x2C
} dsi_dcs_cmd_type_e;
/**
* @brief video data transfer mode
*/
typedef enum
{
DSI_DATA_VIDEO_MODE = 0,
DSI_DATA_CMD_MODE = 1,
DSI_DATA_MODE_MAX
} dsi_video_data_mode_e;
/**
* @brief dsi virtual channel
*/
typedef enum
{
DSI_VC_0 = 0,
DSI_VC_1 = 1,
DSI_VC_2 = 2,
DSI_VC_3 = 3,
DSI_VC_MAX
} dsi_virtual_channel_e;
/**
* @brief video data mode
*/
typedef enum
{
DSI_FRAME_RATE_60HZ = 0,
DSI_FRAME_RATE_90HZ = 1,
DSI_FRAME_RATE_120HZ = 2,
DSI_FRAME_RATE_144HZ = 3,
DSI_FRAME_RATE_160HZ = 4,
DSI_FRAME_RATE_MAX
} dsi_video_frame_rate_e;
/**
* @brief dsi rx color coding
*/
typedef enum
{
DSI_RGB565 = 1,
DSI_RGB666 = 2, /*!< 18 bbp(18bits per pixel) */
DSI_RGB666_LOOSELY = 3, /*!< 24 bbp(24bits per pixel) */
DSI_RGB888 = 4, /*!< 24 bbp(24bits per pixel) */
DSI_RGB10_10_10 = 5,
DSI_RGB12_12_12 = 6,
DSI_YCbCr422_16 = 7,
DSI_PENTILE_16 = DSI_YCbCr422_16,
DSI_YCbCr422_20_LOOSELY = 8,
DSI_YCbCr422_24 = 9,
DSI_YCbCr420_12 = 10,
DSI_COLOR_CODE_MAX
} dsi_color_code_e;
/**
* @brief dpi endianness type
*/
typedef enum
{
DPI_ENDIAN_RGB = 0,
DPI_ENDIAN_BGR
} dpi_endianness_type_e;
/**
* @brief dpi polarity type
*/
typedef enum
{
DPI_SIG_ACTIVE_HIGH = 0,
DPI_SIG_ACTIVE_LOW = 1
} dpi_polarity_e;
/**
* @brief mipi lane number
*/
typedef enum
{
DSI_LANE_1 = 1,
DSI_LANE_2 = 2,
DSI_LANE_3 = 3,
DSI_LANE_4 = 4,
DSI_LANE_NUME_MAX
} dsi_lane_nume_e;
/**
* @brief video mode
*/
typedef enum
{
DSI_NONBURST_PULSE = 0,
DSI_NONBURST_EVENT = 1,
DSI_BURST_MODE = 2,
DSI_VIDEO_MODE_MAX
} dsi_video_mode_type_e;
/**
* @brief panel init cmd transfer type
*/
typedef enum
{
DSI_CMD_TX_HS = 0,
DSI_CMD_TX_LP = 1
} dsi_tx_cmd_tx_type_e;
/**
* @brief dpi tx vpg style
*/
typedef enum
{
TX_VPG_V_COLOR = 0,
TX_VPG_H_COLOR = 1,
TX_VPG_V_BER = 2,
TX_VPG_FLICKER = 3,
TX_VPG_CHESSBOARD = 4,
TX_VPG_MAX
} dsi_tx_vpg_style_e;
#if defined(ISP_568) || defined(ISP_368)
/**
* @brief angle of rotation
*/
typedef enum
{
VIDOE_ROT_ANGLE_0 = 0, /* 不旋转 */
VIDOE_ROT_ANGLE_90 = 1, /* 旋转90度 */
VIDOE_ROT_ANGLE_180 = 2, /* 旋转180度 */
VIDOE_ROT_ANGLE_270 = 3, /* 转转270度 */
VIDOE_ROT_ANGLE_MAX
} video_rotate_angle_e;
/**
* @brief mipi rx lane swap
*/
typedef enum
{
RX_LANE_ORDER_DEFAULT = 0x0,
RX_LANE_ORDER_3012 = RX_LANE_ORDER_DEFAULT,
RX_LANE_ORDER_3210 = 0x1,
RX_LANE_ORDER_MAX
} dsi_rx_lane_swap_e;
/**
* @brief LTPO mode
*/
typedef enum
{
LTPO_MODE_NONE = 0,
LTPO_MODE_1 = 1,
LTPO_MODE_2 = 2,
LTPO_MODE_MAX
} ltpo_mode_e;
/**
* @brief transform
*/
typedef struct
{
ltpo_mode_e ltpo; /* ltpo 模式 */
bool mirror_en; /* 对video 做水平镜像标志位 */
video_rotate_angle_e rot_angle; /* 对video 做旋转的角度 */
dsi_video_data_mode_e dst_mode; /* mipi tx 输出video 数据传输模式(video/cmd mode) */
dsi_rx_lane_swap_e rx_lane_swap; /* rx lane swap */
} dsi_base_extra_info_t;
#endif
/**
* @brief mipi P/N lane swap flag
* eg: pn_swap = RX_LANE_0_PN_SWAP | RX_LANE_CLK_PN_SWAP;
* lane0 CLK P跟N交换lane不变
*/
typedef enum
{
RX_LANE_0_PN_SWAP = 0x1,
RX_LANE_1_PN_SWAP = 0x2,
RX_LANE_2_PN_SWAP = 0x4,
RX_LANE_3_PN_SWAP = 0x8,
RX_LANE_CLK_PN_SWAP = 0x10
} dsi_rx_lane_pn_swap_e;
/**
* @brief error processing level
*/
typedef enum
{
ERR_HANDLE_NONE = 0,
ERR_HANDLE_L1 = 1,
ERR_HANDLE_L2 = 2,
ERR_HANDLE_L3 = 3,
ERR_HANDLE_L4 = 4,
ERR_HANDLE_MAX
} hal_err_handle_level_e;
/**
* @brief transform
*/
typedef struct
{
uint32_t src_w; /* mipi rx 接收的 width */
uint32_t src_h; /* mipi rx 接收的 height */
uint32_t dst_w; /* mipi tx 发送的 width */
uint32_t dst_h; /* mipi tx 发送的 height */
dsi_video_frame_rate_e src_frate; /* mipi rx 接收的frame rate */
dsi_video_data_mode_e src_mode; /* mipi rx 接收video 数据传输模式(video/cmd mode) */
uint16_t pn_swap; /* mipi rx P/N swap标志位 */
#if defined(ISP_568) || defined(ISP_368)
dsi_base_extra_info_t extra_info; /* ISP_568/ISP_368 新增功能配置 */
#endif
} dsi_base_trans_info_t;
/**
* @brief ccm系数
*/
typedef struct
{
uint32_t coef_c00;
uint32_t coef_c01;
uint32_t coef_c02;
uint32_t coef_c10;
uint32_t coef_c11;
uint32_t coef_c12;
uint32_t coef_c20;
uint32_t coef_c21;
uint32_t coef_c22;
} ccm_coef_t;
/**
* @brief video mode display timing
*/
typedef struct
{
uint32_t vsa;
uint32_t vbp;
uint32_t vact;
uint32_t vfp;
uint32_t hsa;
uint32_t hbp;
uint32_t hact;
uint32_t hfp;
} vid_disp_timing_t;
/**
* @brief dpi极性配置
*/
typedef struct
{
dpi_polarity_e vsync_active_level; //vsync极性
dpi_polarity_e hsync_active_level; //hsync极性
dpi_polarity_e dataen_active_level; //dataen极性
dpi_polarity_e shutdown_active_level; //shutdown极性
dpi_polarity_e colorm_active_level; //colorm极性
} dpi_polarity_t;
/**
* @brief hight performan mode level
*/
typedef enum
{
HIGHT_PERFORMAN_NONE = 0,
HIGHT_PERFORMAN_L1 = 1,
HIGHT_PERFORMAN_L2 = 2,
HIGHT_PERFORMAN_MAX
} hight_performan_mode_e;
#endif //__MIPI_DSI_COMMON_H__

108
src/common/tau_log.h Normal file
View File

@ -0,0 +1,108 @@
/*******************************************************************************
*
*
* File: tau_log.h
* Description log file
* Version V0.1
* Date 2020-12-08
* Author linyw
*******************************************************************************/
#ifndef _TAU_LOG_H_
#define _TAU_LOG_H_
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include <stdint.h>
#include <string.h>
#include <stdarg.h>
#include "ArmCM0.h"
#if LOG_MODE_RTT
#include "SEGGER_RTT.h"
#endif
/*******************************************************************************
* 2.Global constant and macro definitions using #define
*******************************************************************************/
#ifdef LOG_TAG
#undef LOG_TAG
#endif
#define LOG_TAG "tau_log"
#define LOG_CURREN_LEVEL kLOG_LEVEL_DBG /* 配置打印等级 TODO:每个模块可配置打印等级 */
/*
* Using the following three macros for conveniently logging.
*/
#if EDA_MODE
#define TAU_LOGD(format,...)
#define TAU_LOGI(format,...)
#define TAU_LOGE(format,...)
#else
#if LOG_MODE_RTT
#define TAU_LOGD(format,...) \
do { \
if (LOG_CURREN_LEVEL <= kLOG_LEVEL_DBG) { \
SEGGER_RTT_printf(0,"[%s] (%04d) " format, LOG_TAG, __LINE__, ##__VA_ARGS__); \
}; \
} while (0)
#define TAU_LOGI(format,...) \
do { \
if (LOG_CURREN_LEVEL <= kLOG_LEVEL_INF) { \
SEGGER_RTT_printf(0,"[%s] (%04d) " format, LOG_TAG, __LINE__, ##__VA_ARGS__); \
}; \
} while (0)
#define TAU_LOGE(format,...) \
do { \
if (LOG_CURREN_LEVEL <= kLOG_LEVEL_ERR) { \
SEGGER_RTT_printf(0,"error [%s] (%04d) " format, LOG_TAG, __LINE__, ##__VA_ARGS__); \
}; \
} while (0)
#else
#define TAU_LOGD(format,...) \
do { \
if (LOG_CURREN_LEVEL <= kLOG_LEVEL_DBG) { \
LOG_printf("[%s] (%04d) " format, LOG_TAG, __LINE__, ##__VA_ARGS__); \
}; \
} while (0)
#define TAU_LOGI(format,...) \
do { \
if (LOG_CURREN_LEVEL <= kLOG_LEVEL_INF) { \
LOG_printf("[%s] (%04d) " format, LOG_TAG, __LINE__, ##__VA_ARGS__); \
}; \
} while (0)
#define TAU_LOGE(format,...) \
do { \
if (LOG_CURREN_LEVEL <= kLOG_LEVEL_ERR) { \
LOG_printf("error [%s] (%04d) " format, LOG_TAG, __LINE__, ##__VA_ARGS__); \
}; \
} while (0)
#endif
#endif
/*******************************************************************************
* 3.Global structures, unions and enumerations using typedef
*******************************************************************************/
typedef enum
{
kLOG_LEVEL_DBG = 0,
kLOG_LEVEL_INF,
kLOG_LEVEL_ERR,
kLOG_LEVEL_NONE /* 不打印任何参数 */
} log_level_t;
/*******************************************************************************
* 4.Global variable extern declarations
*******************************************************************************/
/*******************************************************************************
* 5.Global function prototypes
*******************************************************************************/
void LOG_printf(const char *fmt, ...);
#endif

229
src/common/tau_operations.h Normal file
View File

@ -0,0 +1,229 @@
/*******************************************************************************
*
*
* File: tau_operations.h
* Description
* Version V0.1
* Date 2020-09-07
* Author lzy
*******************************************************************************/
#ifndef __TAU_BYTEOPS_H
#define __TAU_BYTEOPS_H
/**
* \name
* @{
*/
/** \brief 长整数位数 */
#ifndef TAU_BITS_PER_LONG
#define TAU_BITS_PER_LONG 32
#endif
/** \brief 字节位数 */
#define TAU_BITS_PER_BYTE 8
/** @} */
/******************************************************************************/
/**
* \name
* @{
*/
/** \brief bit移位
* TAU_BIT(2) is 0x4
*/
#define TAU_BIT(bit) (1u << (bit))
/** \brief 值移位
* TAU_SBF(0xFF, 8) is 0xff00
*/
#define TAU_SBF(value, field) ((value) << (field))
/** \brief bit置位
* TAU_BIT_SET(0, 8) is 0x100
*/
#define TAU_BIT_SET(data, bit) ((data) |= TAU_BIT(bit))
/** \brief bit清零
* TAU_BIT_CLR(0xFF, 2) is 0xfb
*/
#define TAU_BIT_CLR(data, bit) ((data) &= ~TAU_BIT(bit))
/** \brief bit置位, 根据 mask 指定的位
* TAU_BIT_SET_MASK(0xF0F0, 0xF00) is 0xfff0
*/
#define TAU_BIT_SET_MASK(data, mask) ((data) |= (mask))
/** \brief bit清零, 根据 mask 指定的位
* TAU_BIT_CLR_MASK(0xFFFF, 0xFF00) is 0xff
*/
#define TAU_BIT_CLR_MASK(data, mask) ((data) &= ~(mask))
/** \brief bit翻转
* TAU_BIT_TOGGLE(0xFFFF, 0) is 0xfffe
* TAU_BIT_TOGGLE(0x0000, 1) is 0x2
*/
#define TAU_BIT_TOGGLE(data, bit) ((data) ^= TAU_BIT(bit))
/** \brief bit修改
* TAU_BIT_MODIFY(0, 8, 1) is 0x100
* TAU_BIT_MODIFY(0xFFFF, 1, 0) is 0xfffd
*/
#define TAU_BIT_MODIFY(data, bit, value) \
((value) ? TAU_BIT_SET(data, bit) : TAU_BIT_CLR(data, bit))
/** \brief 测试bit是否置位
* TAU_BIT_ISSET(0xF0F1, 1) is 0
* TAU_BIT_ISSET(0xF0F2, 1) is 2
*/
#define TAU_BIT_ISSET(data, bit) ((data) & TAU_BIT(bit))
/** \brief 获取bit值
* TAU_BIT_GET(0xF0F1, 1) is 0
* TAU_BIT_GET(0xF0F2, 1) is 1
*/
#define TAU_BIT_GET(data, bit) (TAU_BIT_ISSET(data, bit) ? 1 : 0)
/** \brief 检测bit值
* TAU_BIT_CHECK(0xF5FF, 4) is 1
*/
#define TAU_BIT_CHECK(data, bit) \
(((data) & TAU_BIT(bit)) ? 1 : 0)
/** \brief 获取 n bits 掩码值
* TAU_BITS_MASK(2) is 0x3
*/
#define TAU_BITS_MASK(n) (~((~0u) << (n)))
/** \brief 获取位段值
* TAU_BITS_GET(0xF5FF, 0x0F00, 8) is 0x5
*/
#define TAU_BITS_GET(data, mask, pos) \
(((data) & (mask)) >> (pos))
/** \brief 获取位段值
* TAU_BITS_CHECK(0xF5FF, 0x0F00) is 1
*/
#define TAU_BITS_CHECK(data, mask) \
(((data) & (mask)) ? 1 : 0)
/** \brief 修改位段值
* TAU_BITS_MODIFY(0xF5FF, 0x0FF0, 0x8A0) is 0xF8AF
*/
#define TAU_BITS_MODIFY(data, clear_mask, set_mask) \
(data) = (((data) & (~(clear_mask))) | (set_mask))
/** \brief 设置位段值
* TAU_WRITE_REG32(0x05FF, 0xFFFA) is 0xFFFA
*/
#define TAU_WRITE_REG32(data, value) ((data) = (value))
/** \brief 设置位段值
* TAU_READ_REG32(0x05FF) is 0x05FF
*/
#define TAU_READ_REG32(data) (data)
/** @} */
/******************************************************************************/
/**
* \brief 2-byte整数的高位byte
*
* \par
* \code
* uint16_t a = 0x1234;
* uint16_t b;
*
* b = TAU_MSB(a); //b=0x12
* \endcode
*/
#define TAU_MSB(x) (((x) >> 8) & 0xff)
/**
* \brief 2-byte整数的低位byte
*
* \par
* \code
* uint16_t a = 0x1234;
* uint16_t b;
*
* b = TAU_LSB(a); //b=0x34
* \endcode
*/
#define TAU_LSB(x) ((x) & 0xff)
/**
* \brief 2-word整数的高位word
*
* \par
* \code
* uint32_t a = 0x12345678;
* uint32_t b;
*
* b = TAU_MSW(a); //b=0x1234
* \endcode
*/
#define TAU_MSW(x) (((x) >> 16) & 0xffff)
/**
* \brief 2-word整数的低位word
*
* \par
* \code
* uint32_t a = 0x12345678;
* uint32_t b;
*
* b = TAU_LSW(a); //b=0x5678
* \endcode
*/
#define TAU_LSW(x) ((x) & 0xffff)
/**
* \brief 32-bit整数的高位word和低位word
*
* \par
* \code
* uint32_t a = 0x12345678;
* uint32_t b;
*
* b = TAU_WORDSWAP(a); //b=0x56781234
* \endcode
*/
#define TAU_WORDSWAP(x) (TAU_MSW(x) | (TAU_LSW(x) << 16))
/**
* \brief 32-bit整数的字节顺序
*
* \par
* \code
* uint32_t a = 0x12345678;
* uint32_t b;
*
* b = TAU_LONGSWAP(a); //b=0x78563412
* \endcode
*/
#define TAU_LONGSWAP(x) ((TAU_LLSB(x) << 24) | \
(TAU_LNLSB(x) << 16) | \
(TAU_LNMSB(x) << 8) | \
(TAU_LMSB(x)))
#define TAU_LLSB(x) ((x) & 0xff) /**< \brief 取32bit整数第1个字节 */
#define TAU_LNLSB(x) (((x) >> 8) & 0xff) /**< \brief 取32bit整数第2个字节 */
#define TAU_LNMSB(x) (((x) >> 16) & 0xff) /**< \brief 取32bit整数第3个字节 */
#define TAU_LMSB(x) (((x) >> 24) & 0xff) /**< \brief 取32bit整数第4个字节 */
#define TAU_LNSB(x,n) (((x) >> ((n) * 8) ) & 0xff) /**< \brief 取32bit整数第n个字节 ,参数 0 - 3*/
/**
* @}
*/
#endif /* __TAU_BYTEOPS_H */
/* end of file */

Binary file not shown.

Binary file not shown.

Binary file not shown.

213
src/sdk/include/M0/ArmCM0.h Normal file
View File

@ -0,0 +1,213 @@
/**************************************************************************//**
* @file ARMCM0.h
* @brief CMSIS Core Peripheral Access Layer Header File for
* ARMCM0 Device
* @version V5.3.1
* @date 09. July 2018
******************************************************************************/
/*
* Copyright (c) 2009-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ARMCM0_H
#define ARMCM0_H
#ifdef __cplusplus
extern "C" {
#endif
/* ------------------------- Interrupt Number Definition ------------------------ */
typedef enum IRQn
{
/* ------------------- Processor Exceptions Numbers ----------------------------- */
NonMaskableInt_IRQn = -14, /* 2 Non Maskable Interrupt */
HardFault_IRQn = -13, /* 3 HardFault Interrupt */
SVCall_IRQn = -5, /* 11 SV Call Interrupt */
PendSV_IRQn = -2, /* 14 Pend SV Interrupt */
SysTick_IRQn = -1, /* 15 System Tick Interrupt */
/* ------------------- Processor Interrupt Numbers ------------------------------ */
VIDC_IRQn = 0,
LCDC_IRQn = 1,
MIPI_RX_IRQn = 2,
MIPI_TX_IRQn = 3,
MEMC_IRQn = 4,
VPRE_IRQn = 5,
FLSCTRL_IRQn = 6,
DMA_IRQn = 7,
TIMER0_IRQn = 8,
TIMER1_IRQn = 9,
TIMER2_IRQn = 10,
TIMER3_IRQn = 11,
WDG_IRQn = 12,
UART_IRQn = 13,
I2C0_IRQn = 14,
I2C1_IRQn = 15,
SPIS_IRQn = 16,
SPIM_IRQn = 17,
ADC_IRQn = 18,
PWMDET_IRQn = 19,
OTP_IRQn = 20,
SWIRE_IRQn = 21,
PVD_IRQn = 22,
AP_NRESET_IRQn = 23,
EXTI_INT0_IRQn = 24,
EXTI_INT1_IRQn = 25,
EXTI_INT2_IRQn = 26,
EXTI_INT3_IRQn = 27,
EXTI_INT4_IRQn = 28,
EXTI_INT5_IRQn = 29,
EXTI_INT6_IRQn = 30,
EXTI_INT7_IRQn = 31
/* Interrupts 10 .. 31 are left out */
} IRQn_Type;
/* ================================================================================ */
/* ================ Processor and Core Peripheral Section ================ */
/* ================================================================================ */
/* ------- Start of section using anonymous unions and disabling warnings ------- */
#if defined (__CC_ARM)
#pragma push
#pragma anon_unions
#elif defined (__ICCARM__)
#pragma language=extended
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wc11-extensions"
#pragma clang diagnostic ignored "-Wreserved-id-macro"
#elif defined (__GNUC__)
/* anonymous unions are enabled by default */
#elif defined (__TMS470__)
/* anonymous unions are enabled by default */
#elif defined (__TASKING__)
#pragma warning 586
#elif defined (__CSMC__)
/* anonymous unions are enabled by default */
#else
#warning Not supported compiler type
#endif
/* -------- Configuration of Core Peripherals ----------------------------------- */
#define __CM0_REV 0x0000U /* Core revision r0p0 */
#define __MPU_PRESENT 0U /* no MPU present */
#define __VTOR_PRESENT 0U /* no VTOR present */
#define __NVIC_PRIO_BITS 2U /* Number of Bits used for Priority Levels */ //20220228
#define __Vendor_SysTickConfig 0U /* Set to 1 if different SysTick Config is used */
#define __FPU_PRESENT 0U /* Set to 1 if FPU is present */
#define __FPU_DP 0U /* single precision FPU */
#define __ICACHE_PRESENT 0U /* Set to 1 if I-CACHE is present */
#define __DCACHE_PRESENT 0U /* Set to 1 if D-CACHE is present */
#define __DSP_PRESENT 0U /* no DSP extension present */
#define FPGA_MODE 0
#define EDA_MODE 0
#define EXTERN_24M 0
#define CPU_CLK_100M 0
#define LOG_MODE_RTT 0 /* 0:UART MODE 1: rtt MODE */
#include "core_cm0.h" /* Processor and core peripherals */
#include "system_ARMCM0.h" /* System Header */
/*----------------------------------------------------------------------------
Define clocks
*----------------------------------------------------------------------------*/
#define XTAL (500000000UL) /* Oscillator frequency */
#if FPGA_MODE
#define SYSTEM_CLOCK (33300000U)
#else
/* 使用外部晶振时,系统时钟只能是100M,不使用外部晶振时,系统时钟可以是100M/80M*/
#if EXTERN_24M
#define SYSTEM_CLOCK (100000000U)
#else
#if CPU_CLK_100M
#define SYSTEM_CLOCK (100000000U)
#else
#define SYSTEM_CLOCK (80000000U)
#endif
#endif
#endif
/* -------- End of section using anonymous unions and disabling warnings -------- */
#if defined (__CC_ARM)
#pragma pop
#elif defined (__ICCARM__)
/* leave anonymous unions enabled */
#elif (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
#pragma clang diagnostic pop
#elif defined (__GNUC__)
/* anonymous unions are enabled by default */
#elif defined (__TMS470__)
/* anonymous unions are enabled by default */
#elif defined (__TASKING__)
#pragma warning restore
#elif defined (__CSMC__)
/* anonymous unions are enabled by default */
#else
#warning Not supported compiler type
#endif
/* In HS mode and when the DMA is used, all variables and data structures dealing
with the DMA during the transaction process should be 4-bytes aligned */
#define DMA_WORD_ALIGN_EN
#ifdef DMA_WORD_ALIGN_EN
#if defined (__GNUC__) /* GNU Compiler */
#define __ALIGN_END __attribute__ ((aligned (4)))
#define __ALIGN_BEGIN
#else
#define __ALIGN_END
#if defined (__CC_ARM) /* ARM Compiler */
#define __ALIGN_BEGIN __align(4)
#elif defined (__ICCARM__) /* IAR Compiler */
#define __ALIGN_BEGIN
#elif defined (__TASKING__) /* TASKING Compiler */
#define __ALIGN_BEGIN __align(4)
#endif /* __CC_ARM */
#endif /* __GNUC__ */
#else
#define __ALIGN_BEGIN
#define __ALIGN_END
#define __ALIGN_END_1 __attribute__ ((aligned (1)))
#endif /* DMA_WORD_ALIGN_EN */
/* __packed keyword used to decrease the data type alignment to 1-byte */
#if defined (__CC_ARM) /* ARM Compiler */
#define __packed __packed
#elif defined (__ICCARM__) /* IAR Compiler */
#define __packed __packed
#elif defined ( __GNUC__ ) /* GNU Compiler */
#define __packed __attribute__ ((__packed__))
#define __weak __attribute__((weak))
#elif defined (__TASKING__) /* TASKING Compiler */
#define __packed __unaligned
#endif /* __CC_ARM */
#ifdef __cplusplus
}
#endif
#endif /* ARMCM0_H */

View File

@ -0,0 +1,569 @@
/*******************************************************************************
*
*
* File: hal_dsi_rx_ctrl.h
* Description: hal mipi dsi rx path control
* Version: V0.1
* Date: 2021-04-06
* Author: lzy
*******************************************************************************/
#ifndef __HAL_DSI_RX_CTRL_H__
#define __HAL_DSI_RX_CTRL_H__
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "tau_dsi_datatype.h"
#include "tau_common.h"
/*******************************************************************************
* 2.Global constant and macro definitions using #define
*******************************************************************************/
#define RX_DCS_QUEUE_MAX_SIZE 20 /* DCS存储队列长度 */
/*******************************************************************************
* 3.Global structures, unions and enumerations using typedef
*******************************************************************************/
typedef struct hal_dcs_execute_entry_t hal_dcs_execute_entry_t;
typedef struct hal_dcs_packet_t hal_dcs_packet_t;
typedef struct hal_dsi_rx_ctrl_handle_t hal_dsi_rx_ctrl_handle_t;
/* DCS CMD 回调函数, 注册进cus_dcs_entry_table里, 匹配对应的DCS 后回调*/
typedef bool (*hal_dsi_rx_ctrl_dcs_execute)(hal_dsi_rx_ctrl_handle_t *rx_handle, hal_dcs_packet_t *dcs_packet);
/* AP 读cmd 回调, 需要快速回CMD 时可注册, 为NULL 时DSC 读指令与写指令经过parse后由cus_dcs_entry_table回调 */
typedef bool (*hal_dsi_rx_ctrl_read_entry)(uint8_t data_type, uint8_t dcs_cmd, uint8_t param);
/* AP PPS 更新回调,参数为PPS 以及从PPS 里解析出来的picture width/height, 用于分辨率切换, 不注册该接口时内部处理PPS */
typedef bool (*hal_dsi_rx_ctrl_pps_entry)(uint8_t *pps, uint8_t size, uint32_t pic_width, uint32_t pic_height);
/**
* @brief hal_rx_dbg_event_e select
*/
typedef enum hal_rx_dbg_event_e
{
HAL_RX_DBG_FS = 0, /* Frame start */
HAL_RX_DBG_EVENT_MAX
} hal_rx_dbg_event_e;
/* RX debug 回调函数,用于获取frame start 等功能debug */
typedef void (*hal_dsi_rx_ctrl_dbg_entry)(hal_rx_dbg_event_e event);
/**
* @brief dsi rx ctrl handle struct
*/
typedef struct hal_dsi_rx_ctrl_handle_t
{
dsi_base_trans_info_t base_info; /* mipi video 转换基本信息 */
dsi_color_code_e rx_color_mode; /* 输入color mode */
dsi_lane_nume_e rx_lanes; /* mipi data lane */
dsi_video_mode_type_e rx_nonburst_models; /* transmission packet sequences */
dsi_virtual_channel_e rx_vc; /* virtual channel number */
bool compress_en; /* DSC 压缩标志 */
uint32_t rx_hsclk_rate; /* mipi 高速信号lane rate */
uint8_t rx_dsc_pps[DSC_PPS_SIZE]; /* DSC 压缩PPS参数 */
const hal_dcs_execute_entry_t *cus_dcs_entry_table; /* DCS处理函数列表 */
hal_dsi_rx_ctrl_read_entry rx_dcs_read_entry; /* Host读指令数据函数,为NULL时由rx_dcs_queue注册cmd处理 */
hal_dsi_rx_ctrl_pps_entry pps_update_entry; /* PPS Update 时回调函数,用于分辨率切换更新PPS,为NULL时内部处理 */
bool used; /* handle使用标志位 */
uint8_t pq_marginal; /* picture quality,参数为hal_rx_pq_marginal_type_e */
bool direct_mode; /* video mode 直通模式,支持60hz同帧率且porch相等或者相近时使用 */
hal_dsi_rx_ctrl_dbg_entry rx_debug_cb; /* rx debug 回调函数,目前为收到frame start之后回调预留其他debug功能 */
hal_err_handle_level_e err_handler_level; /* RX接收错误的时候对模块做reset等级, 等级越高reset模块越多 */
bool draw_mode; /* 画点模式,仅debug使用 */
#if defined(ISP_568) || defined(ISP_368)
uint8_t rx_strength; /* 用于调节RX信号强度仅适用于开启内阻校准模式档位0~7默认3 */
hight_performan_mode_e hight_performan_mode; /* 高性能模式等级,参考hight_performan_mode_e */
bool pu_optimize; /* 用于优化PU显示效果默认为false;true:优化PU显示显示效果,高功耗;false:普通PU模式,低功耗 */
#endif
bool video_auto_sync; /* Video mode 自动同步开关 */
uint8_t rx_debug_status; /* rx debug status用于debug表示rx的状态 */
} hal_dsi_rx_ctrl_handle_t;
/**
* @brief DCS command execute entry
*/
typedef struct hal_dcs_execute_entry_t
{
uint32_t dcs_command; /* DCS command */
hal_dsi_rx_ctrl_dcs_execute execute_func; /* command 对应处理函数 */
bool immediately_func; /* 执行机制:true-在中断里立即执行,false-加入DCS队列异步执行 */
} hal_dcs_execute_entry_t;
/**
* @brief DCS packet
*/
typedef struct hal_dcs_packet_t
{
uint32_t data_type; /* data type */
uint32_t dcs_command; /* dcs command */
uint32_t param_length; /* dcs param length */
uint8_t *packet_param; /* dcs param */
const hal_dcs_execute_entry_t *dcs_execute_entry; /* dcs packet 处理函数入口*/
} hal_dcs_packet_t;
/**
* @brief dcs command filter select
*/
typedef enum
{
HAL_RX_DCS_FILTER_0 = 0,
HAL_RX_DCS_FILTER_1 = 1,
HAL_RX_DCS_FILTER_2 = 2,
HAL_RX_DCS_FILTER_3 = 3,
HAL_RX_DCS_FILTER_4 = 4,
HAL_RX_DCS_FILTER_5 = 5,
HAL_RX_DCS_FILTER_6 = 6,
HAL_RX_DCS_FILTER_7 = 7,
HAL_RX_DCS_FILTER_MAX
} hal_rx_dcs_filter_sel_e;
/**
* @brief pentile source color format
*/
typedef enum
{
PENTILE_SRC_FORMAT_RGB = 0x0,
PENTILE_SRC_FORMAT_BGR = 0x1,
PENTILE_SRC_FORMAT_RGBG_BGRG = 0x8,
PENTILE_SRC_FORMAT_GBGR_GRGB = 0x9,
PENTILE_SRC_FORMAT_BGRG_RGBG = 0xA,
PENTILE_SRC_FORMAT_GRGB_GBGR = 0xB,
PENTILE_SRC_FORMAT_RGBG_RGBG = 0xC,
PENTILE_SRC_FORMAT_GBGR_GBGR = 0xD,
PENTILE_SRC_FORMAT_BGRG_BGRG = 0xE,
PENTILE_SRC_FORMAT_GRGB_GRGB = 0xF,
PENTILE_SRC_FORMAT_MAX
} pentile_src_format_e;
/**
* @brief pential G0 G1 swap mode
*/
typedef enum
{
PENTILE_G0G1 = 0,
PENTILE_G1G0 = 1
} pentile_g_swap_e;
/**
* @brief pential R B swap mode
*/
typedef enum
{
PENTILE_RGBG_BGRG = 0,
PENTILE_GGRB_RBGG = 1,
PENTILE_GGBR_BRGG = 3
} pentile_rb_swap_e;
/**
* @brief TE
*/
typedef enum
{
TE_HW_MODE = 0, /* TE由硬件产生,频率与输出帧率一致 */
TE_USER_MODE = 1, /* 底层不产生TE, 由hal_dsi_rx_ctrl_gen_a_tear_signal 接口产生 */
TE_SOFT_60HZ_MODE = 2, /* 底层软件产生同步60Hz TE */
TE_SOFT_90HZ_MODE = 4, /* 底层软件产生同步90Hz TE */
TE_SOFT_120HZ_MODE = 5, /* 底层软件产生同步120Hz TE */
TE_HW_MAX
} te_mode_e;
/**
* @brief pq_marginal_type select
*/
typedef enum
{
PQ_TYPE_0 = 0x0,
PQ_TYPE_1 = 0x1,
PQ_TYPE_2 = 0x3,
PQ_TYPE_3 = 0x2,
PQ_TYPE_4 = 0xA,
PQ_TYPE_5 = 0xE,
PQ_TYPE_6 = 0xC,
PQ_TYPE_7 = 0x1A,
PQ_TYPE_8 = 0x18,
PQ_TYPE_MAX
} hal_rx_pq_marginal_type_e;
/**
* @brief RX CLK
*/
typedef enum
{
RX_CLK_100M = 0,
RX_CLK_150M = 1,
RX_CLK_200M = 2,
RX_CLK_300M = 3,
RX_CLK_MAX
} hal_rx_clk_e;
/*******************************************************************************
* 4.Global variable extern declarations
*******************************************************************************/
/*******************************************************************************
* 5.Global function prototypes
*******************************************************************************/
/**
* @brief dsi rx ctrl handle (hal_dsi_rx_ctrl_release_handle)
* @param none
* @retval dsi rx handle
*/
hal_dsi_rx_ctrl_handle_t *hal_dsi_rx_ctrl_create_handle(void);
/**
* @brief dsi rx ctrl handle
* @param rx_ctrl_handle: dsi rx handle
* @retval true/false
*/
bool hal_dsi_rx_ctrl_release_handle(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle);
/**
* @brief rx ctrl handle PPS
* @param rx_ctrl_handle: dsi rx handle
* @param pps: pps
* @param pps_size: pps
* @retval true/false
*/
bool hal_dsi_rx_ctrl_pre_init_pps(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, uint8_t pps[], uint32_t pps_size);
/**
* @brief dsi rx
* @param rx_ctrl_handle: dsi rx handle
* @retval true/false
*/
bool hal_dsi_rx_ctrl_init(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle);
/**
* @brief dsi rx
* @param rx_ctrl_handle: dsi rx handle
* @retval true/false
*/
bool hal_dsi_rx_ctrl_deinit(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle);
/**
* @brief dsi rx
* @param rx_ctrl_handle: dsi rx handle
* @retval true/false
*/
bool hal_dsi_rx_ctrl_start(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle);
/**
* @brief dsi rx参数并恢复状态 (debug使用, rx_ctrl_handle参数后调用该接口重启)
* @param rx_ctrl_handle: dsi rx handle
* @retval true/false
*/
bool hal_dsi_rx_ctrl_restart(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle);
/**
* @brief dsi rx
* @param rx_ctrl_handle: dsi rx handle
* @retval true/false
*/
bool hal_dsi_rx_ctrl_stop(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle);
/**
* @brief RX clk,RX CLK ,video mode场景出现FIFO FULL情况调试使用
* @param rxbr_clk: rx clk, hs_lane_rate/8
* @retval true/false
*/
bool hal_dsi_rx_ctrl_set_rx_clk(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, hal_rx_clk_e rxbr_clk);
/**
* @brief MIPI HOST的读响应 CMD
* @param rx_ctrl_handle: dsi rx handle
* @param data_type: data type
* @param vc: virtual channel
* @param cmd_count: ack command
* @param ... : command(cmd_count )
* @retval true/false
*/
bool hal_dsi_rx_ctrl_send_ack_cmd(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, dsi_ack_data_type_e data_type, dsi_virtual_channel_e vc, uint8_t cmd_count, ...);
/**
* @brief 使,hal_dsi_rx_ctrl_send_ack_cmd功能一致
* @param rx_ctrl_handle: dsi rx handle
* @param data_size: ,4
* @param data: cmd数据,:
* data[0]:DI(data type)
* data[1]:data 0
* data[2]:data 1
* data[3]:pkt type,0
* @retval true/false
*/
bool hal_dsi_rx_ctrl_ack_short_cmd(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, uint8_t data_size, uint8_t data[]);
/**
* @brief 使,hal_dsi_rx_ctrl_send_ack_cmd功能一致
* @param rx_ctrl_handle: dsi rx handle
* @param data_size: ,Word Count + header长度 (header固定为4)
* @param data: cmd数据,:
* data[0]:DI(data type)
* data[1]:wc 0 (Word Count )
* data[2]:wc 1 (Word Count )
* data[3]:pkt type,1
* data[N]:
* @retval true/false
*/
bool hal_dsi_rx_ctrl_ack_long_cmd(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, uint8_t data_size, uint8_t data[]);
/**
* @brief DSC接口,cus_dcs_entry_table里对应DCS immediately_func为false的函数
* @param rx_ctrl_handle: dsi rx handle
* @retval true - 1DSC , false - DSC
*/
bool hal_dsi_rx_ctrl_dsc_async_handler(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle);
/**
* @brief 使filter丢弃不需要处理的CMD,MCU资源被无效CMD占用
* @param rx_ctrl_handle: dsi rx handle
* @param filter_number: filter (0-7)
* @param cmd_start: command code起始位
* @param cmd_end: command code终止位
* @retval true/false
*/
bool hal_dsi_rx_ctrl_set_hw_cmd_filter(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle,
hal_rx_dcs_filter_sel_e filter_number,
uint32_t cmd_start, uint32_t cmd_end);
/**
* @brief ,
* @param rx_ctrl_handle: dsi rx handle
* @param line_num: ,1 ~ input height
* @retval true/false
*/
bool hal_dsi_rx_ctrl_set_cus_sync_line(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, uint32_t line_num);
/**
* @brief 使pattern代替mipi输入()
* @param rx_ctrl_handle: dsi rx handle
* @param pg_orient: pattern (0:Vertical mode ; 1:Horizontal mode)
* @param enable: /pattern
* @retval true/false
*/
bool hal_dsi_rx_ctrl_enable_test_pattern(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, uint8_t pg_orient, bool enable);
/**
* @brief TE信号特征
* @param rx_ctrl_handle: dsi rx handle
* @param inverse_poly: tear信号极性
* @param te_width: tear信号宽度(0-1023)
* @retval true/false
*/
bool hal_dsi_rx_ctrl_set_te_waveform(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, bool inverse_poly, uint32_t te_width);
/**
* @brief scld filter配置,
* @param rx_ctrl_handle: dsi rx handle
* @param scld_filter_h: filter
* @param scld_filter_v: filter
* @retval true/false
*/
bool hal_dsi_rx_ctrl_set_cus_scld_filter(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, uint32_t scld_filter_h[32][2], uint32_t scld_filter_v[32][2]);
/**
* @brief AP BTA回复数据最大size
* @param rx_ctrl_handle: dsi rx handle
* @retval
*/
uint32_t hal_dsi_rx_ctrl_get_max_ret_size(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle);
/**
* @brief AP Compression Mode Command配置,0,使
* @param rx_ctrl_handle: dsi rx handle
* @retval AP compressen_en
*/
bool hal_dsi_rx_ctrl_get_compressen_en(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle);
/**
* @brief TE信号
* @param rx_ctrl_handle: dsi rx handle
* @retval none
*/
bool hal_dsi_rx_ctrl_gen_a_tear_signal(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle);
/**
* @brief
* @param rx_ctrl_handle: dsi rx handle
* @retval true/false
*/
bool hal_dsi_rx_ctrl_toggle_resolution(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle);
/**
* @brief ,debug使用
* @param rx_ctrl_handle: dsi rx handle
* @retval true/false
*/
bool hal_dsi_rx_ctrl_hight_performan_mode(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle);
/**
* @brief TE信号为软件模式
* @param rx_ctrl_handle: dsi rx handle
* @retval none
*/
bool hal_dsi_rx_ctrl_set_sw_tear_mode(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle);
/**
* @brief TE信号为硬件模式
* @param rx_ctrl_handle: dsi rx handle
* @retval none
*/
bool hal_dsi_rx_ctrl_set_hw_tear_mode(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle);
/**
* @brief pentile格式
* @param rx_ctrl_handle: dsi rx handle
* @param src_format: pentile format
* @param g_swap: swap G0 G1
* @param rb_swap: swap R B
* @retval true/false
*/
bool hal_dsi_rx_ctrl_set_pentile_format(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, pentile_src_format_e src_format, pentile_g_swap_e g_swap, pentile_rb_swap_e rb_swap);
/**
* @brief RX escape clk
* @param rx_ctrl_handle: dsi rx handle
* @param esc_clk: escape clk Hz,10000000CMD为10Mhz
* @retval true/false
*/
bool hal_dsi_rx_ctrl_set_cus_esc_clk(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, uint32_t esc_clk);
/**
* @brief filter
* @param rx_ctrl_handle: dsi rx handle
* @param enable: / filter
* @retval true/false
*/
bool hal_dsi_rx_ctrl_set_auto_hw_filter(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, bool enable);
/*
* @brief DCS cmd , Tx init
* @param enable/disable
* @retval true/false
*/
bool hal_dsi_rx_ctrl_set_dcs_direct_mode(bool enable);
/*
* @brief (video mode)
* @param rx_ctrl_handle: dsi rx handle
* @param frame_rateframe rate
*/
bool hal_dsi_rx_ctrl_toggle_input_frame_rate(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, dsi_video_frame_rate_e frame_rate);
/**
* @brief TE模式扩展接口
* @param line_num: ,1 ~ input height
,step为100逐步减小,
* @param te_mode: te ,使HW mode
* @retval none
*/
bool hal_dsi_rx_ctrl_set_tear_mode_ex(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, uint32_t line_num, te_mode_e te_mode);
/**
* @brief
* @param rx_ctrl_handle: dsi rx handle
* @retval true/false
*/
bool hal_dsi_rx_ctrl_toggle_resolution_ex(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle);
/*
* @brief ,.
hal_dsi_rx_ctrl_set_auto_hw_filter关闭hw filter用于获取所有软件CMD
* @param rx_ctrl_handle: dsi rx handle
* @param
* @retval none
*/
void hal_dsi_rx_ctrl_register_write_cmd_entry(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, hal_dsi_rx_ctrl_dcs_execute execute_func);
#if !defined(ISP_568) && !defined(ISP_368)
/* ISP_518/ISP_308 接口 */
/**
* @brief Channel Gain ,
* @param rx_ctrl_handle: dsi rx handle
* @param gain_r: channel gain coefficient for R
* @param gain_g: channel gain coefficient for G
* @param gain_b: channel gain coefficient for B
* @retval true/false
*/
bool hal_dsi_rx_ctrl_set_cus_pq_gain(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, int r_gain, int g_gain, int b_gain);
/**
* @brief enhance for luma参数配置,
* @param rx_ctrl_handle: dsi rx handle
* @param enhl_str: Enhance Str
* @param enhl_edgeslope: Enhance Edge Slope
* @retval none
*/
bool hal_dsi_rx_ctrl_set_cus_pq_enh_lum(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, uint32_t enhl_str, uint32_t enhl_edgeslope);
/**
* @brief false color remove for chroma参数配置,
* @param rx_ctrl_handle: dsi rx handle
* @param desatstr: :0-4095
* @param desatslope: :0-4095
* @retval none
*/
bool hal_dsi_rx_ctrl_set_cus_pq_enh_chr(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, uint32_t desatstr, uint32_t desatslope);
/**
* @brief false color remove for chroma参数配置2,
* @param rx_ctrl_handle: dsi rx handle
* @param desatmode: 0- 1-
* @param fc_final_alpha: :0 - 255
* @param edge_med_slope: :0 - 4095
* @retval none
*/
bool hal_dsi_rx_ctrl_set_cus_pq_enh_chr2(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, uint32_t desatmode, uint32_t fc_final_alpha, uint32_t edge_med_slope);
#else
/* ISP_568/ISP_368 接口 */
/**
* @brief video多余部分mipi输入是900x1792,828x1792,
* @param rx_ctrl_handle: dsi rx handle
* @param crop_width:
* @param crop_height:
* @retval true/false
*/
bool hal_dsi_rx_ctrl_crop_video(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, uint32_t crop_width, uint32_t crop_height);
/*
* @brief ,
* @param rx_ctrl_handle: dsi rx handle
* @param red_data: R分量
* @param green_data: G分量
* @param blue_data: B分量
* @retval none
*/
void hal_dsi_rx_ctrl_draw_mode_init(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, uint8_t red_data, uint8_t green_data, uint8_t blue_data);
/*
* @brief
* @param rx_ctrl_handle: dsi rx handle
* @param x: x
* @param y: y
* @param red_data: R分量
* @param green_data: G分量
* @param blue_data: B分量
* @retval none
*/
void hal_dsi_rx_ctrl_set_pixel_data(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, int x, int y, uint8_t red_data, uint8_t green_data, uint8_t blue_data);
/*
* @brief
* @param rx_ctrl_handle: dsi rx handle
* @param x1,y1:
* @param x2,y2:
* @param red_data: R分量
* @param green_data: G分量
* @param blue_data: B分量
* @retval none
*/
void hal_dsi_rx_ctrl_set_rect_pixel_data(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, int x1, int x2, int y1, int y2, uint8_t red_data, uint8_t green_data, uint8_t blue_data);
#endif
#endif //__HAL_DSI_RX_CTRL_H__

View File

@ -0,0 +1,286 @@
/*******************************************************************************
*
*
* File: hal_dsi_tx_ctrl.h
* Description: hal mipi dsi tx
* Version: V0.1
* Date: 2021-04-23
* Author: wuc
*******************************************************************************/
#ifndef __HAL_DSI_TX_CTRL_H__
#define __HAL_DSI_TX_CTRL_H__
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "tau_dsi_datatype.h"
#include "tau_device_datatype.h"
#include "tau_common.h"
#include "hal_gpio.h"
#include "stdint.h"
#include "stdbool.h"
/*******************************************************************************
* 2.Global constant and macro definitions using #define
*******************************************************************************/
/*******************************************************************************
* 3.Global structures, unions and enumerations using typedef
*******************************************************************************/
/**
* @brief MIPI TX参数结构体
*/
typedef struct
{
bool used; /* handle使用标志位 */
uint8_t lane_num;
dsi_virtual_channel_e channel_id;
dsi_video_mode_type_e vid_mode;
dsi_tx_cmd_tx_type_e cmd_tx_type; /* 初始化模式传输命令方式0:HS; 1:LP */
uint8_t pclk_offset; /* 增加lane byte clk以增大HFP适配LONG H的TP */
uint32_t dpi_vsa;
uint32_t dpi_vbp;
uint32_t dpi_vfp;
uint32_t dpi_hsa;
uint32_t dpi_hbp;
uint32_t dpi_hfp;
dsi_base_trans_info_t base_info; /* mipi video 转换基本信息 */
uint32_t tx_line_delay; /* tx 发送至屏端显示的延迟行数,由屏端决定,用于分辨率切换时确认切换时间点 */
float tx_frame_rate; /* 默认60Hz输出,不建议配置为其他,仅作为debug使用 */
bool tx_clkawayshs; /* 默认为false, 配置为true时video mode消隐行期间clk不进入LP */
uint8_t blank_rows; /* 默认为0, 针对特殊屏使用大于0时生效表示向下补黑blank_rows行 */
uint8_t blank_columns; /* 默认为0, 针对特殊屏使用大于0时生效表示向右补黑blank_columns列 */
bool lp_exit_lpdt; /* 每一条LP CMD都退出LPDT */
#if defined(ISP_568) || defined(ISP_368)
bool tx_cmd_mode_sync; /* TX command mode 输出同步 */
#endif
} hal_dsi_tx_ctrl_handle_t;
/**
* @brief crop parameters
*/
typedef struct
{
uint16_t crop_top;
uint16_t crop_bottom;
uint16_t crop_left;
uint16_t crop_right;
} hal_dsi_tx_crop_t;
/**
* @brief MIPI TX初始化
* @param tx_ctrl_handle: MIPI TX实例
* @retval :0 :-1
*/
bool hal_dsi_tx_ctrl_init(hal_dsi_tx_ctrl_handle_t *tx_ctrl_handle);
/**
* @brief MIPI TX反初始化
* @param tx_ctrl_handle: MIPI TX实例
* @retval :0 :-1
*/
bool hal_dsi_tx_ctrl_deinit(hal_dsi_tx_ctrl_handle_t *tx_ctrl_handle);
/**
* @brief MIPI TX创建实例
* @param
* @retval tx_ctrl_handle: MIPI TX实例
*/
hal_dsi_tx_ctrl_handle_t *hal_dsi_tx_ctrl_create_handle(void);
/**
* @brief MIPI TX释放实例
* @param tx_ctrl_handle: MIPI TX实例
* @retval :0 :-1
*/
bool hal_dsi_tx_ctrl_release_handle(hal_dsi_tx_ctrl_handle_t *tx_ctrl_handle);
/**
* @brief MIPI TX开始运行
* @param tx_ctrl_handle: MIPI TX实例
* @retval :0 :-1
*/
bool hal_dsi_tx_ctrl_start(hal_dsi_tx_ctrl_handle_t *tx_ctrl_handle);
/**
* @brief MIPI TX停止运行
* @param tx_ctrl_handle: MIPI TX实例
* @retval :0 :-1
*/
bool hal_dsi_tx_ctrl_stop(hal_dsi_tx_ctrl_handle_t *tx_ctrl_handle);
/**
* @brief panel
* @param
* @retval
*/
void hal_dsi_tx_ctrl_enter_init_panel_mode(void);
/**
* @brief 退panel
* @param
* @retval
*/
void hal_dsi_tx_ctrl_exit_init_panel_mode(void);
/**
* @brief MIPI TX接收命令
* @param data_type: dsi_data_type_e
* @param vc: dsi_virtual_channel_e
* @param cmd: DCS指令
* @param size:
* @param data:
* @retval
*/
void hal_dsi_tx_ctrl_read_cmd(uint8_t data_type, uint8_t vc, uint8_t cmd, uint8_t size, uint8_t *data);
/**
* @brief MIPI TX发送命令
* @param data_type: dsi_data_type_e
* @param vc: dsi_virtual_channel_e
* @param cmd_count:
* @param ...:
* @retval true-command发送正常false-TX当前状态不能发送command
*/
bool hal_dsi_tx_ctrl_write_cmd(uint8_t data_type, uint8_t vc, uint8_t cmd_count, ...);
/**
* @brief MIPI TX发送命令
* @param data_type: dsi_data_type_e
* @param vc: dsi_virtual_channel_e
* @param size: data个数
* @param data: data数组
* @retval true-command发送正常false-TX当前状态不能发送command
*/
bool hal_dsi_tx_ctrl_write_array_cmd(uint8_t data_type, uint8_t vc, uint8_t size, const uint8_t *data);
/**
* @brief TX溢出时钟分频系统
* @param esc_div: TX溢出时钟分频系数
* @retval
*/
void hal_dsi_tx_ctrl_set_escape_clock_div(uint8_t esc_div);
/**
* @brief
* @param state: Reset脚拉高
* @retval
*/
void hal_dsi_tx_ctrl_panel_reset_pin(gpio_level_e state);
/**
* @brief
* @param st_line:
* @param st_col:
* @param end_line:
* @param end_col:
* @retval
*/
void hal_dsi_tx_ctrl_set_partial_disp_area(uint32_t st_line, uint32_t st_col, uint32_t end_line, uint32_t end_col);
/**
* @brief
* @param pd_en:
* @retval
*/
void hal_dsi_tx_ctrl_set_partial_disp(function_state_e pd_en);
/**
* @brief
* @param R: RGB的R分量
* @param G: RGB的G分量
* @param B: RGB的B分量
* @retval
*/
void hal_dsi_tx_ctrl_set_overwrite_rgb(uint8_t R, uint8_t G, uint8_t B);
/**
* @brief
* @param ow_en:
* @retval
*/
void hal_dsi_tx_ctrl_set_overwrite(function_state_e ow_en);
/**
* @brief RGB或BGR
* @param endianness: RGB或BGR显示
* @retval
*/
void hal_dsi_tx_ctrl_set_endianness(dpi_endianness_type_e endianness);
/**
* @brief CCM参数
* @param coef: ccm_coef_t
* @retval
*/
void hal_dsi_tx_ctrl_set_ccm(ccm_coef_t coef);
/**
* @brief TX VPG的输出
* @param vpg_en: 使VPG
* @param style: VPG的样式
* @retval
*/
void hal_dsi_tx_ctrl_set_vpg(function_state_e vpg_en, dsi_tx_vpg_style_e style);
/**
* @brief video mode下使能LP CMD
* @param lp_en:使LP CMD
* @retval
*/
void hal_dsi_tx_ctrl_set_lp_cmd(function_state_e lp_en);
/**
* @brief tx输出的图像
* @param tx_ctrl_handle: dsi tx handle
* @param crop:
* @retval
*/
void hal_dsi_tx_crop_pic(hal_dsi_tx_ctrl_handle_t *tx_ctrl_handle, hal_dsi_tx_crop_t *crop);
#if !defined(ISP_568) && !defined(ISP_368)
/* ISP_518/ISP_308 接口 */
/**
* @brief
* @param flip_en:
* @retval
*/
void hal_dsi_tx_ctrl_set_horizon_flip(function_state_e flip_en);
/**
* @brief tx filter
* @param tx_ctrl_handle: dsi tx handle
* @param filter_h: filter
* @param filter_v: filter
* @retval true/false
*/
bool hal_dsi_tx_ctrl_set_cus_pq_filter(hal_dsi_tx_ctrl_handle_t *tx_ctrl_handle, uint32_t filter_h[32][2], uint32_t filter_v[32][2]);
/**
* @brief tx边缘参数,
* @param tx_ctrl_handle: dsi tx handle
* @param threshold:
* @param slope:
* @retval true/false
*/
bool hal_dsi_tx_ctrl_set_cus_pq_edge(hal_dsi_tx_ctrl_handle_t *tx_ctrl_handle, uint8_t threshold, uint16_t slope);
#else
/* ISP_568/ISP_368 接口 */
/**
* @brief tx filter
* @param tx_ctrl_handle: dsi tx handle
* @param filter: tx filter
* @retval true/false
*/
bool hal_dsi_tx_ctrl_set_cus_pq_filter(hal_dsi_tx_ctrl_handle_t *tx_ctrl_handle, uint32_t filter[32]);
/**
* @brief TX command mode ,TE信号后调用
* @param tx_ctrl_handle: dsi tx handle
* @retval true/false
*/
bool hal_dsi_tx_ctrl_cmd_mode_rcv_te(hal_dsi_tx_ctrl_handle_t *tx_ctrl_handle);
#endif
#endif //__HAL_DSI_TX_CTRL_H__

109
src/sdk/include/hal_flash.h Normal file
View File

@ -0,0 +1,109 @@
/*******************************************************************************
*
*
* File: hal_system.h
* Description hal
* Version V0.1
* Date 2023-03-03
* Author kevin
*******************************************************************************/
#ifndef __HAL_FLASH_H__
#define __HAL_FLASH_H__
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "tau_common.h"
/*******************************************************************************
* 2.Global constant and macro definitions using #define
*******************************************************************************/
/*******************************************************************************
* 3.Global structures, unions and enumerations using typedef
*******************************************************************************/
/*******************************************************************************
* 4.Global variable extern declarations
*******************************************************************************/
/*******************************************************************************
* 5.Global function prototypes
*******************************************************************************/
/**
* @brief flash ,使flash模块后需要deinit用于节省功耗
* @param
* @retval bool
*/
void hal_flash_init(void);
/**
* @brief flash
* @param
* @retval bool
*/
void hal_flash_deinit(void);
/**
* @brief flash ctl读取flash-uid操作
* @param UID[16] UID的数组,UID最大长度为16
* @param UID (16)
* @retval
*/
void hal_flash_read_uid(uint8_t *UID, uint8_t size);
/**
* @brief
* @param flash_block:0-13block进行擦除,block写之前需要先擦除对应64K数据
* @retval
*/
bool hal_flash_erase(uint8_t flash_block);
/**
* @brief flash读取数据,1024
* @param *usr_cfg_t_addr(),
usr_cfg_t_size(1024,1024)
flash_block:block(0-13,0-3TDDI Flash区域)
flash_page :(block 0~63)
page_offset_addr:block = 64K
* @retval bool
*/
bool hal_flash_normal_read(uint8_t *usr_cfg_t_addr,
uint16_t usr_cfg_t_size,
uint8_t flash_block,
uint16_t flash_page,
uint16_t page_offset_addr);
/**
* @brief flash(),1024
:block前确认使用hal_flash_erase进行擦除整个blocK,block的0-63page进行写入
* @param *usr_cfg_t_addr(),
usr_cfg_t_size(1024,1024)
flash_block:block(0-13,0-3TDDI Flash区域)
flash_page block 0~63
page_offset_addr:0-1023 byte
* @retval bool size是否超出
*/
bool hal_flash_normal_write(uint8_t *usr_cfg_t_addr,
uint16_t usr_cfg_t_size,
uint8_t flash_block,
uint16_t flash_page,
uint16_t page_offset_addr);
/**
* @brief 0xABflash退出deep sleep power mode
* @param none
* @retval null
*/
void hal_flash_release_power_down(void);
/**
* @brief 0xB9flash进入deep sleep power mode
* @param none
* @retval null
*/
void hal_flash_power_down(void);
#endif //__HAL_FLASH_H__

537
src/sdk/include/hal_gpio.h Normal file
View File

@ -0,0 +1,537 @@
/*******************************************************************************
*
*
* File: hal_gpio.h
* Description gpio HAL层头文件
* Version V0.1
* Date 2021-03-17
* Author wuc
*******************************************************************************/
#ifndef __HAL_GPIO_H__
#define __HAL_GPIO_H__
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "tau_device_datatype.h"
#include "tau_common.h"
/*******************************************************************************
* 2.Global constant and macro definitions using #define
*******************************************************************************/
/**
* @brief GPIO pin
*/
typedef enum
{
/*以GPIO命名PIN*/
IO_PAD_GPIO0 = 0,
IO_PAD_GPIO1,
IO_PAD_GPIO2,
IO_PAD_GPIO3,
IO_PAD_GPIO4,
IO_PAD_GPIO5,
IO_PAD_GPIO6,
IO_PAD_RESV,
IO_PAD_GPIO8,
IO_PAD_GPIO9,
IO_PAD_GPIO10,
IO_PAD_GPIO11,
IO_PAD_GPIO12,
IO_PAD_GPIO13,
IO_PAD_GPIO14,
IO_PAD_RESV1,
IO_PAD_RESV2,
IO_PAD_GPIO17,
IO_PAD_GPIO18,
IO_PAD_GPIO19,
IO_PAD_GPIO20,
IO_PAD_GPIO21,
/*以实际PAD NAME命名PIN*/
IO_PAD_AP_SPIS_MISO = IO_PAD_GPIO0,
IO_PAD_AP_SPIS_MOSI = IO_PAD_GPIO1,
IO_PAD_AP_INT = IO_PAD_GPIO2,
IO_PAD_AP_TE = IO_PAD_GPIO3,
IO_PAD_AP_SWIRE = IO_PAD_GPIO4,
IO_PAD_TD_SPIM_MISO = IO_PAD_GPIO5,
IO_PAD_TD_SPIM_MOSI = IO_PAD_GPIO6,
IO_PAD_TD_RSTN = IO_PAD_RESV,
IO_PAD_TD_TPRSTN = IO_PAD_GPIO8,
IO_PAD_TD_INT = IO_PAD_GPIO9,
IO_PAD_TD_LEDPWM = IO_PAD_GPIO10,
IO_PAD_TD_FC_CLK = IO_PAD_GPIO11,
IO_PAD_TD_FC_CSN = IO_PAD_GPIO12,
IO_PAD_TD_FC_MISO = IO_PAD_GPIO13,
IO_PAD_TD_FC_MOSI = IO_PAD_GPIO14,
IO_PAD_UART_RX = IO_PAD_GPIO17,
IO_PAD_UART_TX = IO_PAD_GPIO18,
IO_PAD_PWMEN = IO_PAD_GPIO19,
IO_PAD_ADCIN = IO_PAD_GPIO20,
IO_PAD_AP_TPRSTN = IO_PAD_GPIO21,
IO_PAD_AP_SPIS_CLK,
IO_PAD_AP_SPIS_CSN,
IO_PAD_TD_SPIM_CLK,
IO_PAD_TD_SPIM_CSN,
IO_PAD_SFC_CLK,
IO_PAD_SFC_CSN,
IO_PAD_SFC_IO0,
IO_PAD_SFC_IO1,
IO_PAD_MAX,
/*以实际BALL编号命名PIN*/
IO_PIN_A1 = IO_PAD_TD_TPRSTN,
IO_PIN_A2 = IO_PAD_TD_FC_CSN,
IO_PIN_A3 = IO_PAD_TD_SPIM_MISO,
IO_PIN_A4 = IO_PAD_TD_SPIM_CLK,
IO_PIN_A5 = IO_PAD_PWMEN,
IO_PIN_A6 = IO_PAD_ADCIN,
IO_PIN_A7 = IO_PAD_AP_INT,
IO_PIN_A8 = IO_PAD_AP_SPIS_MOSI,
IO_PIN_B1 = IO_PAD_TD_FC_CLK,
IO_PIN_B2 = IO_PAD_TD_FC_MISO,
IO_PIN_B3 = IO_PAD_TD_SPIM_MOSI,
IO_PIN_B4 = IO_PAD_TD_SPIM_CSN,
IO_PIN_B5 = IO_PAD_AP_SWIRE,
IO_PIN_B7 = IO_PAD_AP_SPIS_MISO,
IO_PIN_B8 = IO_PAD_AP_SPIS_CSN,
IO_PIN_C1 = IO_PAD_TD_FC_MOSI,
IO_PIN_C2 = IO_PAD_TD_LEDPWM,
IO_PIN_C4 = IO_PAD_UART_TX,
IO_PIN_C5 = IO_PAD_UART_RX,
IO_PIN_C6 = IO_PAD_AP_TE,
IO_PIN_D1 = IO_PAD_TD_RSTN,
IO_PIN_D2 = IO_PAD_TD_INT,
IO_PIN_D7 = IO_PAD_AP_TPRSTN,
IO_PIN_D8 = IO_PAD_AP_SPIS_CLK,
} io_pad_e;
/**
* @brief PAD_AP_SPIS_CLK可选的mode
*/
typedef enum
{
IO_MODE_JTAG_TCK = 0,
IO_MODE_SPIS_SCLK = 1,
IO_MODE_I2C0_SCL = 3,
} pad_ap_spis_clk_mode_e;
/**
* @brief PAD_AP_SPIS_CSN可选的mode
*/
typedef enum
{
IO_MODE_JTAG_TRSTN = 0,
IO_MODE_SPIS_CSN = 1,
IO_MODE_I2C0_SDA = 3,
} pad_ap_spis_csn_mode_e;
/**
* @brief PAD_AP_SPIS_MISO可选的mode
*/
typedef enum
{
IO_MODE_JTAG_TDO = 0,
IO_MODE_SPIS_MISO = 1,
IO_MODE_GPIO0 = 2,
IO_MODE_UART_RX_AP = 3,
IO_MODE_SPIM_MISO_AP = 4,
} pad_ap_spis_miso_mode_e;
/**
* @brief PAD_AP_SPIS_MOSI可选的mode
*/
typedef enum
{
IO_MODE_JTAG_TMS = 0,
IO_MODE_SPIS_MOSI = 1,
IO_MODE_GPIO1 = 2,
IO_MODE_UART_TX_AP = 3,
IO_MODE_SPIM_MOSI_AP = 4,
} pad_ap_spis_mosi_mode_e;
/**
* @brief PAD_AP_TPRSTN可选的mode
*/
typedef enum
{
IO_MODE_JTAG_TDI = 0,
IO_MODE_GPIO21 = 2,
} pad_ap_tprstn_mode_e;
/**
* @brief PAD_AP_INT可选的mode
*/
typedef enum
{
IO_MODE_GPIO2 = 2,
} pad_ap_int_mode_e;
/**
* @brief PAD_AP_TE可选的mode
*/
typedef enum
{
IO_MODE_TEAR = 0,
IO_MODE_GPIO3 = 2,
} pad_ap_te_mode_e;
/**
* @brief PAD_AP_SWIRE可选的mode
*/
typedef enum
{
IO_MODE_SWIRE = 0,
IO_MODE_PWMO = 1,
IO_MODE_GPIO4 = 2,
} pad_ap_swire_mode_e;
/**
* @brief PAD_TD_SPIM_CLK可选的mode
*/
typedef enum
{
IO_MODE_SPIM_SCLK = 0,
IO_MODE_I2C1_SCL = 1,
} pad_td_spim_clk_mode_e;
/**
* @brief PAD_TD_SPIM_CSN可选的mode
*/
typedef enum
{
IO_MODE_SPIM_CSN = 0,
IO_MODE_I2C1_SDA = 1,
} pad_td_spim_csn_mode_e;
/**
* @brief PAD_TD_SPIM_MISO可选的mode
*/
typedef enum
{
IO_MODE_SPIM_MISO = 0,
#if defined(ISP_568) || defined(ISP_368)
IO_MODE_PWMO1 = 1,
#endif
IO_MODE_GPIO5 = 2,
} pad_td_spim_miso_mode_e;
/**
* @brief PAD_TD_SPIM_MOSI可选的mode
*/
typedef enum
{
IO_MODE_SPIM_MOSI = 0,
IO_MODE_GPIO6 = 2,
} pad_td_spim_mosi_mode_e;
/**
* @brief PAD_TD_TPRSTN可选的mode
*/
typedef enum
{
IO_MODE_GPIO8 = 2,
} pad_td_tprstn_mode_e;
/**
* @brief PAD_TD_INT可选的mode
*/
typedef enum
{
IO_MODE_GPIO9_FUNC = 0,
IO_MODE_GPIO9 = 2,
} pad_td_int_mode_e;
/**
* @brief PAD_TD_LEDPWM可选的mode
*/
typedef enum
{
IO_MODE_PWMI = 0,
#if defined(ISP_568) || defined(ISP_368)
IO_MODE_PWMO2 = 1,
#endif
IO_MODE_GPIO10 = 2,
} pad_td_ledpwm_mode_e;
/**
* @brief PAD_TD_FC_CLK可选的mode
*/
typedef enum
{
IO_MODE_TSPIS_CLK = 0,
IO_MODE_GPIO11 = 2,
} pad_td_fc_clk_mode_e;
/**
* @brief PAD_TD_FC_CSN可选的mode
*/
typedef enum
{
IO_MODE_TSPIS_CSN = 0,
IO_MODE_GPIO12 = 2,
} pad_td_fc_csn_mode_e;
/**
* @brief PAD_TD_FC_MISO可选的mode
*/
typedef enum
{
IO_MODE_TSPIS_MISO = 0,
IO_MODE_GPIO13 = 2,
} pad_td_fc_miso_mode_e;
/**
* @brief PAD_TD_FC_MOSI可选的mode
*/
typedef enum
{
IO_MODE_TSPIS_MOSI = 0,
IO_MODE_GPIO14 = 2,
} pad_td_fc_mosi_mode_e;
/**
* @brief PAD_UART_RX可选的mode
*/
typedef enum
{
IO_MODE_UART_RX = 0,
IO_MODE_GPIO17 = 2,
} pad_uart_rx_mode_e;
/**
* @brief PAD_UART_TX可选的mode
*/
typedef enum
{
IO_MODE_UART_TX = 0,
IO_MODE_GPIO18 = 2,
} pad_uart_tx_mode_e;
/**
* @brief PAD_PWMEN可选的mode
*/
typedef enum
{
IO_MODE_GPIO19 = 2,
} pad_pwmen_mode_e;
/**
* @brief PAD_ADCIN可选的mode
*/
typedef enum
{
IO_MODE_GPIO20 = 2,
} pad_adcin_mode_e;
/**
* @brief PAD_SFC_CLK可选的mode
*/
typedef enum
{
IO_MODE_INTER_FLS_CLK = 0,
IO_MODE_EXT_FLS_CLK = 1,
} pad_sfc_clk_mode_e;
/**
* @brief PAD_SFC_CSN可选的mode
*/
typedef enum
{
IO_MODE_INTER_FLS_CSN = 0,
IO_MODE_EXT_FLS_CSN = 1,
} pad_sfc_csn_mode_e;
/**
* @brief PAD_SFC_IO0可选的mode
*/
typedef enum
{
IO_MODE_INTER_FLS_IO0 = 0,
IO_MODE_EXT_FLS_MISO = 1,
} pad_sfc_io0_mode_e;
/**
* @brief PAD_SFC_IO1可选的mode
*/
typedef enum
{
IO_MODE_INTER_FLS_IO1 = 0,
IO_MODE_EXT_FLS_MOSI = 1,
} pad_sfc_io1_mode_e;
/**
* @brief PAD电压转换速率
*/
typedef enum
{
IO_SLEW_RATE_SLOW = 0,
IO_SLEW_RATE_FAST = 1,
} pad_slew_rate_e;
/*******************************************************************************
* IOE
*******************************************************************************/
/**
* @brief GPIO io方向
*/
typedef enum
{
IO_IOE_INPUT = 0,
IO_IOE_OUTPUT
} gpio_ioe_direct_e;
/**
* @brief GPIO level
*/
typedef enum
{
IO_LVL_LOW = 0,
IO_LVL_HIGH
} gpio_level_e;
/*******************************************************************************
* 3.Global structures, unions and enumerations using typedef
*******************************************************************************/
/*******************************************************************************
* 4.Global variable extern declarations
*******************************************************************************/
/*******************************************************************************
* 5.Global function prototypes
*******************************************************************************/
/**
* @brief PAD为GPIO modeinput
* @param padGPIO序号gpio_pad_e
* @param trig4sys_cfg_trigger_e
* @retval
*/
void hal_gpio_init_eint(io_pad_e pad, sys_cfg_trigger_e trig);
/**
* @brief GPIO中断回调函数
* @param padGPIO序号gpio_pad_e
* @param cb_func
* @param data
* @retval
*/
void hal_gpio_reg_eint_cb(io_pad_e pad, fcb_type cb_func);
/**
* @brief GPIO中断
* @param padGPIO序号gpio_pad_e
* @param state
* @retval
*/
void hal_gpio_ctrl_eint(io_pad_e pad, function_state_e state);
/**
* @brief GPIO中断类型
* @param padGPIO序号gpio_pad_e
* @retval
*/
gpio_int_e hal_gpio_get_int_type(io_pad_e pad);
/**
* @brief PAD为GPIO modeoutput
* @param padGPIO序号gpio_pad_e
* @param lvlgpio_level_e
* @retval
*/
void hal_gpio_init_output(io_pad_e pad, gpio_level_e lvl);
/**
* @brief
* @param padGPIO序号gpio_pad_e
* @param lvlgpio_level_e
* @retval
*/
void hal_gpio_set_output_data(io_pad_e pad, gpio_level_e lvl);
/**
* @brief IO输出电平
* @param pad1GPIO序号gpio_pad_e
* @param pad1_lvlgpio_level_e
* @param pad2GPIO序号gpio_pad_e
* @param pad2_lvlgpio_level_e
* @retval
*/
void hal_gpio_set_output_data_ex(io_pad_e pad1, gpio_level_e pad1_lvl, io_pad_e pad2, gpio_level_e pad2_lvl);
/**
* @brief PAD为GPIO modeinput
* @param padGPIO序号gpio_pad_e
* @retval
*/
void hal_gpio_init_input(io_pad_e pad);
/**
* @brief
* @param padGPIO序号gpio_pad_e
* @retval
*/
gpio_level_e hal_gpio_get_input_data(io_pad_e pad);
/**
* @brief io mode
* @param padGPIO序号gpio_pad_e
* @param modePAD对应的mode枚举类型
* @retval
*/
void hal_gpio_set_mode(io_pad_e pad, uint8_t mode);
/**
* @brief PAD的默认上拉
* @param padGPIO序号gpio_pad_e
* @param up_enable
* @param down_enable
* @retval
*/
void hal_gpio_get_pull_state(io_pad_e pad, function_state_e *up_enable, function_state_e *down_enable);
/**
* @brief PAD的默认上拉
* @param padGPIO序号gpio_pad_e
* @param up_enable
* @param down_enable
* @retval
*/
void hal_gpio_set_pull_state(io_pad_e pad, function_state_e up_enable, function_state_e down_enable);
/**
* @brief PAD是否为施密特触发
* @param padGPIO序号gpio_pad_e
* @param st_enable10
* @retval
*/
void hal_gpio_set_schmitt_trigger(io_pad_e pad, function_state_e st_enable);
/**
* @brief PAD的驱动能力
* @param padGPIO序号gpio_pad_e
* @param strength0~3
* @retval
*/
void hal_gpio_set_driving_strength(io_pad_e pad, uint8_t strength);
/**
* @brief PAD的电压转换速率
* @param padGPIO序号gpio_pad_e
* @param rate0~3
* @retval
*/
void hal_gpio_set_slew_rate(io_pad_e pad, pad_slew_rate_e rate);
/**
* @brief AP_RSTN引脚中断
* @param enable:
* @param cb_func
* @param trig
* @retval
*/
void hal_gpio_set_ap_reset_int(bool enable, fcb_type cb_func, sys_cfg_trigger_e trig);
#endif /* __HAL_GPIO_H__ */

View File

@ -0,0 +1,80 @@
/*******************************************************************************
*
*
* File: hal_i2c_master.h
* Description i2c hal file
* Version V0.1
* Date 2021-10-14
* Author zhanghz
*******************************************************************************/
#ifndef __HAL_I2C_MASTER_H__
#define __HAL_I2C_MASTER_H__
#include "tau_device_datatype.h"
#include "tau_common.h"
#include "string.h"
/**************************************************************************
* @name : hal_i2c_m_dma_init
* @brief : i2c master dma
* @param[in] : slave_addr
* @param[in] : addr_bits
* @param[in] : i2c_speed_hz:
* @return :
* @retval :
**************************************************************************/
void hal_i2c_m_dma_init(uint8_t slave_addr, uint8_t addr_bits, uint32_t i2c_speed_hz);
/**************************************************************************
* @name : hal_i2c_m_dma_write
* @brief : i2c master dma
* @param[in] : txBufferbuffer
* @param[in] : data_size
* @return : STATUS_SUCCESS DMA
* @return :
* @retval :
**************************************************************************/
status_t hal_i2c_m_dma_write(const uint8_t *txBuffer, size_t data_size);
/**************************************************************************
* @name : hal_i2c_m_dma_read
* @brief : i2c master dma
* @param[in] : reg_address
* @param[in] : reg_size
* @param[in] : rxBufferbuffer
* @param[in] : data_size
* @return : STATUS_SUCCESSDMA接收通道
* @return :
* @retval :
**************************************************************************/
status_t hal_i2c_m_dma_read(uint32_t reg_address, size_t reg_size, uint8_t *rxBuffer, size_t data_size);
/**************************************************************************
* @name : hal_i2c_m_transfer_complate
* @brief : i2c master
* @param[in] :
* @return : true
* @return : false
* @retval :
**************************************************************************/
bool hal_i2c_m_transfer_complate(void);
/**************************************************************************
* @name : hal_i2c_m_set_high_impedance
* @brief : I2C IO口设置为高阻态
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void hal_i2c_m_set_high_impedance(void);
/**************************************************************************
* @name : hal_i2c_m_deinit
* @brief : i2c主机 IP去初始化使
* @param[in] :
* @return :
* @retval :
***************************************************************************/
void hal_i2c_m_deinit(void);
#endif /* __HAL_I2C_MASTER_H__*/

View File

@ -0,0 +1,179 @@
/*******************************************************************************
*
*
* File: hal_i2c_slave.h
* Description i2c hal file
* Version V0.1
* Date 2021-10-14
* Author zhanghz
*******************************************************************************/
#ifndef __HAL_I2C_SLAVE_H__
#define __HAL_I2C_SLAVE_H__
#include "tau_device_datatype.h"
#include "tau_common.h"
#include "string.h"
typedef enum
{
I2C_S_INT_READ = 0, //发生 读请求 中断
I2C_S_INT_RX, //发生 接收 中断
I2C_S_INT_STOP //发生 stop 中断
} e_i2c_s_int_status;
#if defined(ISP_568) || defined(ISP_368)
typedef enum
{
I2C_S_0 = 0,
I2C_S_1,
I2C_S_MAX
} i2c_s_index_e;
#endif
typedef void (*hal_i2c_s_callback_t)(e_i2c_s_int_status int_status, size_t receive_num);
/**************************************************************************
* @name : hal_i2c_s_init
* @brief : i2c slave
* @param[in] : slave_addr
* @param[in] : addr_bits
* @return :
* @retval :
**************************************************************************/
void hal_i2c_s_init(uint8_t slave_addr, uint8_t addr_bits);
/**************************************************************************
* @name : hal_i2c_s_dma_write
* @brief : i2c slave dma
* @param[in] : txBufferbuffer
* @param[in] : data_size
* @return : STATUS_SUCCESS DMA
* @return :
* @retval :
**************************************************************************/
status_t hal_i2c_s_dma_write(const uint8_t *txBuffer, size_t data_size);
/**************************************************************************
* @name : hal_i2c_s_nonblocking_read
* @brief : i2c slave
* @param[in] : rxBufferbuffer
* @param[in] : data_size
* @return : STATUS_SUCCESS
* @return :
* @retval :
**************************************************************************/
status_t hal_i2c_s_nonblocking_read(uint8_t *rxBuffer, size_t data_size);
/**************************************************************************
* @name : hal_i2c_s_transfer_complate
* @brief : i2c slave
* @param[in] :
* @return : true
* @return : false
* @retval :
**************************************************************************/
bool hal_i2c_s_write_complate(void);
/**************************************************************************
* @name : hal_i2c_s_read_complate
* @brief : i2c slave
* @param[in] :
* @return :
* @retval :
**************************************************************************/
uint8_t hal_i2c_s_read_complate(void);
/**************************************************************************
* @name : hal_i2c_s_read_complate_clear
* @brief : i2c slave
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void hal_i2c_s_read_complate_clear(void);
/**************************************************************************
* @name : hal_i2c_s_set_dma_tx_cycle
* @brief : I2C cycle
* @param[in] :
* @return : ENABLEcycle模式DISABLEcycle模式
* @retval :
**************************************************************************/
void hal_i2c_s_set_dma_tx_cycle(bool enable);
/**************************************************************************
* @name : hal_i2c_s_set_transfer
* @brief : i2c
* @param[in] :hal_tp_transfer_phone_tmp
* @return :
* @retval :
**************************************************************************/
void hal_i2c_s_set_transfer(hal_i2c_s_callback_t hal_i2c_s_callback_tmp);
/**************************************************************************
* @name : hal_i2c_s_read_data
* @brief :read data
* @param[in] : rx_data:
* @return : 1:
* @return : 0: fifo
* @retval :
**************************************************************************/
status_t hal_i2c_s_read_data(uint8_t *rx_data);
/**************************************************************************
* @name : hal_i2c_s_write_data
* @brief :write data
* @param[in] : tx_data:
* @return : 1:
* @return : 0: fifo
* @retval :
**************************************************************************/
status_t hal_i2c_s_write_data(const uint8_t tx_data);
/**************************************************************************
* @name : hal_i2c_s_rxfifo_notempty
* @brief : rxfifo
* @param[in] :
* @return : true: rxfifo
* @return : false: rxfifo
* @retval :
**************************************************************************/
bool hal_i2c_s_rxfifo_notempty(void);
/**************************************************************************
* @name : hal_i2c_s_set_high_impedance
* @brief : I2C IO口设置为高阻态
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void hal_i2c_s_set_high_impedance(void);
/**************************************************************************
* @name : hal_i2c_s_get_tx_byte_num
* @brief : I2C从机发送成功字节数
* @param[in] :
* @return :
* @retval :
**************************************************************************/
int hal_i2c_s_get_tx_byte_num(void);
/**************************************************************************
* @name : hal_i2c_s_deinit
* @brief : i2c IP去初始化使
* @param[in] :slave_num
* @return :
* @retval :
***************************************************************************/
void hal_i2c_s_deinit(void);
#if defined(ISP_568) || defined(ISP_368)
/**************************************************************************
* @name : hal_i2c_s_sel
* @brief : i2c slave
* @param[in] : slaver
* @return :
* @retval :
**************************************************************************/
void hal_i2c_s_sel(i2c_s_index_e slaver);
#endif
#endif /* __HAL_I2C_SLAVE_H__*/

219
src/sdk/include/hal_pwm.h Normal file
View File

@ -0,0 +1,219 @@
/*******************************************************************************
*
*
* File: hal_pwm.h
* Description pwm HAL层头文件
* Version V0.1
* Date 2021-03-17
* Author wuc
*******************************************************************************/
#ifndef __HAL_PWM_H__
#define __HAL_PWM_H__
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "tau_device_datatype.h"
#include "tau_common.h"
#include "hal_gpio.h"
/*******************************************************************************
* 2.Global constant and macro definitions using #define
*******************************************************************************/
/*******************************************************************************
* 3.Global structures, unions and enumerations using typedef
*******************************************************************************/
/*! @brief PWM触发功能的定义 */
typedef enum _pwm_out_ctrl_e
{
PWMO_CTRL_KEEP = 0,
PWMO_CTRL_LOW = 1,
PWMO_CTRL_HIGH = 2,
PWMO_CTRL_TOGGLE = 3,
PWMO_CTRL_MAX
} pwm_out_ctrl_e;
/*******************************************************************************
* 4.Global variable extern declarations
*******************************************************************************/
/*******************************************************************************
* 5.Global function prototypes
*******************************************************************************/
/**
* @brief PWMO初始化
* @param
* @retval
*/
void hal_pwm_out_init(void);
/**
* @brief PWMO反初始化
* @param
* @retval
*/
void hal_pwm_out_deinit(void);
/**
* @brief PWMO输出脉冲暂停
* @param state
* @retval
*/
void hal_pwm_out_pause(function_state_e state);
/**
* @brief PWMO脉冲并开始输出
* @param ctl0thr0时的操作pwm_out_ctrl_e
* @param ctl1thr1时的操作pwm_out_ctrl_e
* @param thr00us
* @param thr11us
* @param periodus
* @retval
*/
void hal_pwm_out_config_all(pwm_out_ctrl_e ctl0, pwm_out_ctrl_e ctl1, uint32_t thr0, uint32_t thr1, uint32_t period);
/**
* @brief PWMO脉冲所有参数
* @param ctl0thr0时的操作pwm_out_ctrl_e
* @param ctl1thr1时的操作pwm_out_ctrl_e
* @param thr00us
* @param thr11us
* @param periodus
* @retval
*/
void hal_pwm_out_sync_all(pwm_out_ctrl_e ctl0, pwm_out_ctrl_e ctl1, uint32_t thr0, uint32_t thr1, uint32_t period);
/**
* @brief pwm输出以控制背光
* @param polarity: false:true:
* @param duty_ratio: (0-total_ratio)
* @param total_ratio:
* @param frequency: HZ
* @retval
*/
void hal_pwm_out_config_duty_ratio(bool polarity, uint16_t duty_ratio, uint16_t total_ratio, uint32_t frequency);
/**
* @brief PWMO脉冲的周期
* @param periodus
* @retval
*/
void hal_pwm_out_sync_period(uint32_t period);
/**
* @brief PWMO脉冲的控制
* @param ctl0thr0时的操作pwm_out_ctrl_e
* @param ctl1thr1时的操作pwm_out_ctrl_e
* @retval
*/
void hal_pwm_out_sync_ctl(pwm_out_ctrl_e ctl0, pwm_out_ctrl_e ctl1);
/**
* @brief PWMO脉冲的阈值
* @param thr00us
* @param thr11us
* @retval
*/
void hal_pwm_out_sync_thr(uint32_t thr0, uint32_t thr1);
/**
* @brief PWMO脉冲
* @param pause_state
* @retval
*/
void hal_pwm_out_sync_pause(function_state_e pause_state);
/**
* @brief PWMI初始化
* @param
* @retval
*/
void hal_pwm_in_init(void);
/**
* @brief PWMI反初始化
* @param
* @retval
*/
void hal_pwm_in_deinit(void);
/**
* @brief PWMI中断回调函数PWMI中断类型指针pwm_int_type_e
* @param cb_func
* @retval
*/
void hal_pwm_in_register_callback(fcb_type cb_func);
/**
* @brief PWMI所有中断的开关
* @param high_overflow_enhigh overflow中断使能开关
* @param low_overflow_enlow overflow中断使能开关
* @param total_overflow_entotal overflow中断使能开关
* @param high_done_enhigh done中断使能开关
* @param low_done_enlow done中断使能开关
* @param total_done_entotal done中断使能开关
* @retval
*/
void hal_pwm_in_config_int(function_state_e high_overflow_en, function_state_e low_overflow_en, function_state_e total_overflow_en,
function_state_e high_done_en, function_state_e low_done_en, function_state_e total_done_en);
/**
* @brief PWMI单个中断的开关
* @param pwm_intpwm_int_type_e
* @param enable
* @retval
*/
void hal_pwm_in_set_int(pwm_int_type_e pwm_int, function_state_e enable);
/**
* @brief PWMI所有中断
* @param
* @retval
*/
void hal_pwm_in_clear_int(void);
/**
* @brief PWMI中断
* @param state
* @retval
*/
void hal_pwm_in_ctrl_int(function_state_e state);
/**
* @brief PWMI脉冲周期时长
* @param
* @retval us
*/
uint32_t hal_pwm_in_get_total_period(void);
/**
* @brief PWMI脉冲高电平时长
* @param
* @retval us
*/
uint32_t hal_pwm_in_get_high_period(void);
/**
* @brief PWMI脉冲低电平时长
* @param
* @retval us
*/
uint32_t hal_pwm_in_get_low_period(void);
/**
* @brief PWMI上升沿累积个数
* @param
* @retval 使沿32
*/
uint32_t hal_pwm_in_get_current_count(void);
#if defined(ISP_568) || defined(ISP_368)
/**
* @brief PWMO输出的IO口
* @param pad: PWMO输出的IO口,IO_PAD_AP_SWIRE,IO_PAD_TD_SPIM_MISOIO_PAD_TD_LEDPWM输出
* @retval
*/
void hal_pwm_out_sel_io(io_pad_e pad);
#endif
#endif /* __HAL_PWM_H__ */

View File

@ -0,0 +1,89 @@
/*******************************************************************************
*
*
* File: hal_spi_touch.h
* Description spi hal file
* Version V0.1
* Date 2021-10-25
* Author zhanghz
*******************************************************************************/
#ifndef __HAL_SPI_MASTER_H__
#define __HAL_SPI_MASTER_H__
#include "tau_device_datatype.h"
#include "tau_common.h"
#include "string.h"
/**************************************************************************
* @name : hal_spi_m_dma_init
* @brief : SPIM DMA
* @param[in] :speed
* @param[in] :cpha: 沿沿
* @param[in] :cpol: 线
* @return :
* @retval :
**************************************************************************/
void hal_spi_m_dma_init(uint32_t speed, uint8_t cpha, uint8_t cpol);
/**************************************************************************
* @name : hal_spi_m_dma_write
* @brief : SPIM
* @param[in] :data_buffer: buffer
* @param[in] :data_size: buffer
* @return :STATUS_SUCCESS:
* @return :
* @retval :
**************************************************************************/
status_t hal_spi_m_dma_write(const uint8_t *data_buffer, size_t data_size);
/**************************************************************************
* @name : hal_spi_m_dma_read
* @brief : SPIM
* @param[in] :cmd: buffer
* @param[in] :cmd_size: buffer
* @param[in] :data_buffer: buffer
* @param[in] :data_size: buffer
* @return :STATUS_SUCCESS:
* @return :
* @retval :
**************************************************************************/
status_t hal_spi_m_dma_read(const uint8_t *cmd, size_t cmd_size, uint8_t *data_buffer, size_t data_size);
/**************************************************************************
* @name : hal_spi_m_get_transfer_complate
* @brief : SPIM
* @param[in] :
* @return :true
* @retval :
**************************************************************************/
bool hal_spi_m_get_transfer_complate(void);
/**************************************************************************
* @name : hal_spi_m_clear_rxfifo
* @brief : rxfifo
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void hal_spi_m_clear_rxfifo(void);
/**************************************************************************
* @name : hal_spi_m_set_high_impedance
* @brief : SPI IO口设置为高阻态
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void hal_spi_m_set_high_impedance(void);
/**************************************************************************
* @name : hal_spi_m_deinit
* @brief : SPI (SPIM)
* @param[in] :
* @return :true
* @retval :
**************************************************************************/
bool hal_spi_m_deinit(void);
#endif

View File

@ -0,0 +1,181 @@
/*******************************************************************************
* Copyright (C) 2021-2022, All Rights Reserved.
*
* File: hal_spi_slave.h
* Description spi slave hal file
* Version V0.1
* Date 2021-10-23
* Author lzy
*******************************************************************************/
#ifndef __HAL_SPI_SLAVE_H__
#define __HAL_SPI_SLAVE_H__
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "tau_dsi_datatype.h"
#include "tau_common.h"
/*******************************************************************************
* 2.Global constant and macro definitions using #define
*******************************************************************************/
/*******************************************************************************
* 3.Global structures, unions and enumerations using typedef
*******************************************************************************/
/*
event eg:rx_buffer_size=8, host发送16个byte数据,
8byte数据时产生SPI_EVENT_RCV_FULL事件,,
host拉高CS,SPI_EVENT_RCV_CS_HIGH事件
*/
typedef enum
{
SPI_EVENT_RCV_DATA = 0, /* 手动模式下SPIS 接受每接收一个数据即产生事件 */
SPI_EVENT_RCV_FULL, /* 自动模式下 SPIS 接收数据等于buffer size后产生事件 */
SPI_EVENT_RCV_CS_HIGH, /* 自动模式下 SPIS 收到CS 拉高的信号 */
} hal_spis_event_e;
typedef struct hal_spi_packet_info_t
{
uint8_t *rx_buffer; /* 接收buffer */
uint32_t rx_buffer_size; /* 接收buffer size */
bool rx_circle; /* 接收circle mode */
const uint8_t *tx_buffer; /* 发送buffer */
uint32_t tx_buffer_size; /* 发送buffer size */
bool tx_circle; /* 发送circle mode */
uint32_t packet_size; /* packet size */
} hal_spi_packet_info_t;
typedef void (*hal_spi_slave_cb)(hal_spis_event_e event, hal_spi_packet_info_t *packet_info);
/*******************************************************************************
* 4.Global variable extern declarations
*******************************************************************************/
/*******************************************************************************
* 5.Global function prototypes
*******************************************************************************/
/**
* @brief spi slave
* @param cpha:
* @param cpol:
* @param dma: DMA enable
* @retval true/false
*/
bool hal_spi_slave_init(uint8_t cpha, uint8_t cpol, bool dma);
/**
* @brief spi slave
* @param none
* @retval true/false
*/
bool hal_spi_slave_deinit(void);
/**
* @brief spi slave
* @param cbcall back
* @retval true/false
*/
bool hal_spi_slave_register_callback(hal_spi_slave_cb cb);
/**
* @brief spi slave enable
* @param none
* @retval true/false
*/
bool hal_spi_slave_enable(void);
/**
* @brief spi slave disable
* @param none
* @retval true/false
*/
bool hal_spi_slave_disable(void);
/**
* @brief spi slave buffer, callback, buffer为NULL时为自动接收模式
* @param bufferbuffer
* @param size buffer size
* @param circlecircle modepacket size buffer size offset 0()
* @retval true/false
*/
bool hal_spi_slave_set_auto_rx_buffer(uint8_t *buffer, uint32_t size, bool circle);
/**
* @brief spi slave buffer
* @param bufferbuffer, buffer为NULL为切换为自动模式
* @param size buffer size
* @param circlecircle modebuffer的数据
* @retval true/false
*/
bool hal_spi_slave_set_auto_tx_buffer(const uint8_t *buffer, uint32_t size, bool circle);
/**
* @brief spi slave
* @param none
* @retval true/false
*/
bool hal_spi_slave_auto_transfer_start(void);
/**
* @brief spi slave (circle mode packet结束可使用)
* @param none
* @retval true/false
*/
bool hal_spi_slave_auto_transfer_abort(void);
/**
* @brief spi slave flush fifo(circle mode packet结束后可使用)
* @param none
* @retval true/false
*/
bool hal_spi_slave_flush_fifo(void);
/**
* @brief reset spis tx,spis后重新配置输出数据
* @param bufferbuffer
* @param size buffer size
* @param circlecircle modebuffer的数据
* @retval true/false
*/
bool hal_spi_slave_reset_tx(const uint8_t *buffer, uint32_t size, bool circle);
/**
* @brief check spi slave busy(CS status)
* @param none
* @retval true/false
*/
bool hal_spi_slave_busy(void);
/**
* @brief rx fifo
* @param none
* @retval true/false
*/
bool hal_spi_slave_get_rxfifo_notempty(void);
/**
* @brief rx fifo
* @param none
* @retval true/false
*/
bool hal_spi_slave_read_data(uint32_t *data);
/**
* @brief tx fifo
* @param none
* @retval true/false
*/
bool hal_spi_slave_write_data(const uint8_t data);
/**************************************************************************
* @name : hal_spi_s_set_high_impedance
* @brief : SPI IO口设置为高阻态
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void hal_spi_s_set_high_impedance(void);
#endif /* __HAL_SPI_SLAVE_H__*/

View File

@ -0,0 +1,75 @@
/*******************************************************************************
*
*
* File: hal_swire.h
* Description swire HAL层头文件
* Version V0.1
* Date 2021-03-17
* Author wuc
*******************************************************************************/
#ifndef __HAL_SWIRE_H__
#define __HAL_SWIRE_H__
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "tau_device_datatype.h"
#include "tau_common.h"
/*******************************************************************************
* 2.Global constant and macro definitions using #define
*******************************************************************************/
/*******************************************************************************
* 3.Global structures, unions and enumerations using typedef
*******************************************************************************/
/*******************************************************************************
* 4.Global variable extern declarations
*******************************************************************************/
/*******************************************************************************
* 5.Global function prototypes
*******************************************************************************/
/**
* @brief SWIRE初始化
* @param
* @retval
*/
void hal_swire_init(void);
/**
* @brief SWIRE反初始化
* @param
* @retval
*/
void hal_swire_deinit(void);
/**
* @brief SWIRE脉冲并开始输出
* @param start_timeus
* @param stop_timeus300us
* @param high_timeus
* @param low_timeus
* @param pulse沿
* @retval
*/
void hal_swire_start(uint32_t start_time, uint32_t stop_time,
uint32_t high_time, uint32_t low_time,
uint32_t pulse);
/**
* @brief
* @param state
* @retval
*/
void hal_swire_open(function_state_e state);
/**
* @brief
* @param cb_func
* @retval
*/
void hal_swire_register_callback(fcb_type cb_func);
#endif /* __HAL_SWIRE_H__ */

View File

@ -0,0 +1,219 @@
/*******************************************************************************
*
*
* File: hal_system.h
* Description hal
* Version V0.1
* Date 2021-05-21
* Author lzy
*******************************************************************************/
#ifndef __HAL_SYSTEM_H__
#define __HAL_SYSTEM_H__
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "tau_common.h"
#include "hal_flash.h"
/*******************************************************************************
* 2.Global constant and macro definitions using #define
*******************************************************************************/
/*******************************************************************************
* API兼容宏定义
*******************************************************************************/
/**
* @brief 0xABflash退出deep sleep power mode
* API为hal_flash_release_power_down
* @param none
* @retval null
*/
#define hal_system_flash_release_power_down()\
{\
hal_flash_init();\
hal_flash_release_power_down();\
hal_flash_deinit();\
}
/**
* @brief 0xB9flash进入deep sleep power mode
* API为hal_system_flash_power_down
* @param
* @retval null
*/
#define hal_system_flash_power_down()\
{\
hal_flash_init();\
hal_flash_power_down();\
hal_flash_deinit();\
}
/**
* @brief flash读取数据,1024
* API为hal_flash_normal_read
* @param *usr_cfg_t_addr(),
usr_cfg_t_size(1024)
flash_page 0~63
* @retval bool
*/
#define hal_system_flash_read(usr_cfg_t_addr, usr_cfg_t_size, flash_page)\
({\
bool ret;\
hal_flash_init();\
ret = hal_flash_normal_read(usr_cfg_t_addr, usr_cfg_t_size, 13, flash_page, 0);\
hal_flash_deinit();\
ret;\
})
/**
* @brief flash(),1024
* API为hal_flash_normal_write
* @param *usr_cfg_t_addr(),
usr_cfg_t_size(1024)
01~63
flash_page 0~63
* @retval bool size是否超出
*/
#define hal_system_flash_write(usr_cfg_t_addr, usr_cfg_t_size, flash_page)\
({\
bool ret;\
if(flash_page == 0)\
{\
hal_flash_erase(13);\
}\
hal_flash_init();\
ret = hal_flash_normal_write(usr_cfg_t_addr, usr_cfg_t_size, 13, flash_page, 0);\
hal_flash_deinit();\
ret;\
})
/*******************************************************************************
* 3.Global structures, unions and enumerations using typedef
*******************************************************************************/
/*******************************************************************************
* 4.Global variable extern declarations
*******************************************************************************/
/*******************************************************************************
* 5.Global function prototypes
*******************************************************************************/
/**
* @brief system
* @param none
* @retval none
*/
void hal_system_init(uint32_t sysclk);
/**
* @brief system console
* @param baud_rate
* @retval none
*/
void hal_system_init_console(uint32_t baud_rate);
/**
* @brief mcu进入idle模式,
* @param disable_systick: idle时是否关闭systick(退idle systick)
* @retval none
*/
void hal_system_idle_mode(bool disable_systick);
/**
* @brief systick回调函数
* @param cb_func
* @retval
*/
void hal_system_register_systick_cb(fcb_type cb_func);
/**
* @brief sys tickt
* @param ms: sys tickt , 1-10ms
* @retval true/false
*/
bool hal_system_enable_systick(uint8_t ms);
/**
* @brief systickt
* @param none
* @retval systickt值
*/
bool hal_system_disable_systick(void);
/**
* @brief systickt
* @param none
* @retval systickt值
*/
uint32_t hal_system_get_tick(void);
/**
* @brief deep sleep mode , AP_RSTN
* @param polarity true:沿, false:沿
* @retval none
*/
void hal_system_deep_sleep_mode(bool polarity);
/**
* @brief flash开关(使,)
* @param enable:true:F_SPI访问内部flash , false:F_SPI访问内部flash
* @retval true/false
*/
bool hal_system_share_flash_mode(bool enable);
/**
* @brief sleep mode
* @param enable
* @retval none
*/
void hal_system_sleep_mode(bool enable);
/**
* @brief reset chip
* @param none
* @retval none
*/
void hal_system_reset_chip(void);
/**
* @brief PVD检测
* @param none
* @retval none
*/
void hal_system_set_pvd(bool enable);
/**
* @brief VCC电源开关
* 使: VCC掉电13D与13M使用外灌电源时VCC供电,
* @param enable: true:CP, false:CP
* @retval none
*/
void hal_system_set_vcc(bool enable);
#if defined(ISP_568) || defined(ISP_368)
/**
* @brief DPHY内部校准开关
* @param en: 使
* @retval none
*/
void hal_system_set_phy_calibration(bool en);
#endif
/**
* @brief debug state
* @param none
* @retval debug state
*/
uint32_t hal_system_get_debug_state(void);
/**
* @brief clear debug state(debug only)
* @param none
* @retval none
*/
void hal_system_clear_debug_state(void);
#endif //__HAL_SYSTEM_H__

View File

@ -0,0 +1,92 @@
/*******************************************************************************
*
*
* File: hal_timer.h
* Description timer HAL层头文件
* Version V0.1
* Date 2021-03-16
* Author wuc
*******************************************************************************/
#ifndef __HAL_TIMER_H__
#define __HAL_TIMER_H__
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "tau_device_datatype.h"
#include "tau_common.h"
/*******************************************************************************
* 2.Global constant and macro definitions using #define
*******************************************************************************/
/*******************************************************************************
* 3.Global structures, unions and enumerations using typedef
*******************************************************************************/
/*******************************************************************************
* 4.Global variable extern declarations
*******************************************************************************/
/*******************************************************************************
* 5.Global function prototypes
*******************************************************************************/
/**
* @brief
* @param index(0~3)timer_num_e
* @retval
*/
void hal_timer_init(timer_num_e index);
/**
* @brief
* @param index(0~3)timer_num_e
* @retval
*/
void hal_timer_deinit(timer_num_e index);
/**
* @brief
* @param index(0~3)timer_num_e
* @param msmsms级别的
* @param cb_funcNULL
* @param dataNULL
* @retval
*/
void hal_timer_start(timer_num_e index, uint32_t ms, fcb_type cb_func, void *data);
/**
* @brief
* @param index(0~3)timer_num_e
* @param ususus级别的
* @param cb_funcNULL
* @param dataNULL
* @retval
*/
void hal_timer_start_ex(timer_num_e index, uint32_t us, fcb_type cb_func, void *data);
/**
* @brief
* @param index(0~3)timer_num_e
* @retval
*/
void hal_timer_stop(timer_num_e index);
/**
* @brief
* @param index(0~3)timer_num_e
* @param bool enable使
* @retval
*/
void hal_timer_set_repeat(timer_num_e index, bool repeat);
/**
* @brief
* @param index(0~3)timer_num_e
* @retval timer_status_e
*/
timer_status_e hal_timer_get_status(timer_num_e index);
#endif /* __HAL_TIMER_H__ */

131
src/sdk/include/hal_uart.h Normal file
View File

@ -0,0 +1,131 @@
/*******************************************************************************
*
*
* File: hal_uart.h
* Description
* Version V0.1
* Date 2021-11-24
* Author kc
*******************************************************************************/
#ifndef __HAL_UART_H__
#define __HAL_UART_H__
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "stdint.h"
#include "tau_common.h"
/*******************************************************************************
* 2.Global constant and macro definitions using #define
*******************************************************************************/
/*******************************************************************************
* 3.Global structures, unions and enumerations using typedef
*******************************************************************************/
typedef enum
{
HAL_UART_STOPBIT_1 = 0,
HAL_UART_STOPBIT_2 = 1
} hal_uart_stopbit_e;
typedef enum
{
HAL_UART_PARITY_NO = 0,
HAL_UART_PARITY_ODD = 0x01,
HAL_UART_PARITY_EVEN = 0x03,
} hal_uart_parity_e;
typedef enum
{
HAL_UART_DATAWIDTH_6 = 1,
HAL_UART_DATAWIDTH_7 = 2,
HAL_UART_DATAWIDTH_8 = 3
} hal_uart_datawidth_e;
typedef struct
{
uint32_t baudrate;
hal_uart_stopbit_e stopbits;
hal_uart_datawidth_e data_width;
hal_uart_parity_e parity;
} hal_uart_config_t;
typedef struct _hal_uart_handle_t
{
hal_uart_config_t uart_config;
void (* txdmacallback)(void);
void (* rxdmacallback)(void);
} hal_uart_handle_t;
typedef enum
{
HAL_UART_OK = 0x00U,
HAL_UART_ERROR = 0x01U,
HAL_UART_BUSY = 0x02U,
HAL_UART_TIMEOUT = 0x03U
} hal_uart_status;
/*******************************************************************************
* 4.Global variable extern declarations
*******************************************************************************/
/*******************************************************************************
* 5.Global function prototypes
*******************************************************************************/
/**
* @brief uart
* @param hal_uart_handle_t
* @retval hal_uart_status
*/
hal_uart_status hal_uart_init(hal_uart_handle_t *huart);
/**
* @brief uart口
* @param hal_uart_handle_t
* @retval hal_uart_status
*/
hal_uart_status hal_uart_deinit(hal_uart_handle_t *huart);
/**
* @brief
* @param hal_uart_handle_t
* @param pdata:
* @param size:
* @retval hal_uart_status
*/
hal_uart_status hal_uart_transmit_blocking(hal_uart_handle_t *huart, uint8_t *pdata, uint16_t size);
/**
* @brief
* @param hal_uart_handle_t
* @param pdata:
* @param size:
* @retval hal_uart_status
*/
hal_uart_status hal_uart_receive_blocking(hal_uart_handle_t *huart, uint8_t *pdata, uint16_t size);
/**
* @brief 使DMA发送数据TX和RX共用一个DMA TX/RX传输完后才能进行RX/TX的传输
* @param hal_uart_handle_t
* @param pdata:
* @param size:
* @retval hal_uart_status
*/
hal_uart_status hal_uart_transmit_dma(hal_uart_handle_t *huart, uint8_t *pdata, uint16_t size);
/**
* @brief 使DMA发送数据TX和RX共用一个DMA TX/RX传输完后才能进行RX/TX的传输
* @param hal_uart_handle_t
* @param pdata:
* @param size:
* @retval hal_uart_status
*/
hal_uart_status hal_uart_receive_dma(hal_uart_handle_t *huart, uint8_t *pdata, uint16_t size);
#endif /* __HAL_UART_H__ */

94
src/sdk/include/hal_wdg.h Normal file
View File

@ -0,0 +1,94 @@
/*******************************************************************************
*
*
* File: hal_wdg.h
* Description wdg HAL层头文件
* Version V0.1
* Date 2021-03-16
* Author wuc
*******************************************************************************/
#ifndef __HAL_WDG_H__
#define __HAL_WDG_H__
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "tau_device_datatype.h"
#include "tau_common.h"
/*******************************************************************************
* 2.Global constant and macro definitions using #define
*******************************************************************************/
/*******************************************************************************
* 3.Global structures, unions and enumerations using typedef
*******************************************************************************/
/*!
* @brief watch dog模式
*/
typedef enum
{
WDG_MODE_RESET = 0, //复位模式,跑飞复位
WDG_MODE_INTERRUPT = 1 //中断模式,跑飞进入中断
} wdg_mode_e;
/*******************************************************************************
* 4.Global variable extern declarations
*******************************************************************************/
/*******************************************************************************
* 5.Global function prototypes
*******************************************************************************/
/**
* @brief
* @param
* @retval
*/
void hal_wdg_init(void);
/**
* @brief
* @param
* @retval
*/
void hal_wdg_deinit(void);
/**
* @brief
* @param wdg_mode_e modeSel:
* @param uint32_t load: ms
* @retval
*/
void hal_wdg_start(wdg_mode_e modeSel, uint32_t load);
/**
* @brief
* @param
* @retval
*/
void hal_wdg_stop(void);
/**
* @brief WDG是否循环超时
* @param enable使
* @retval
*/
void hal_wdg_set_repeat(bool repeat);
/**
* @brief
* @param cb_func
* @param data
* @retval
*/
void hal_wdg_register_callback(fcb_type cb_func, void *data);
/**
* @brief
* @param
* @retval
*/
void hal_wdg_kick_dog(void);
#endif /* __HAL_WDG_H__ */

1
src/sdk/sdk_version.h Normal file
View File

@ -0,0 +1 @@
#define SDK_REVISION 4644