commit
45974a2785
|
@ -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
|
|
@ -0,0 +1,521 @@
|
|||
<?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>
|
||||
<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>$$Device:ARMCM0$Device\ARM\SVD\ARMCM0.svd</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>ISP_568_Pixel7Pro</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>..\..\ISP_568_TP.BAT</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\ap_demo;..\..\src\sdk\include\M0;..\..\src\app;..\..\src\app\module_demo;..\..\src\app\touch;..\..\src\app\S8;..\..\src\app\S9;..\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\ap_demo\ap_demo.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>app_tp_transfer.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\src\app\ap_demo\app_tp_transfer.c</FilePath>
|
||||
<FileOption>
|
||||
<CommonProperty>
|
||||
<UseCPPCompiler>2</UseCPPCompiler>
|
||||
<RVCTCodeConst>0</RVCTCodeConst>
|
||||
<RVCTZI>0</RVCTZI>
|
||||
<RVCTOtherData>0</RVCTOtherData>
|
||||
<ModuleSelection>0</ModuleSelection>
|
||||
<IncludeInBuild>0</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>
|
||||
<Cads>
|
||||
<interw>2</interw>
|
||||
<Optim>0</Optim>
|
||||
<oTime>2</oTime>
|
||||
<SplitLS>2</SplitLS>
|
||||
<OneElfS>2</OneElfS>
|
||||
<Strict>2</Strict>
|
||||
<EnumInt>2</EnumInt>
|
||||
<PlainCh>2</PlainCh>
|
||||
<Ropi>2</Ropi>
|
||||
<Rwpi>2</Rwpi>
|
||||
<wLevel>0</wLevel>
|
||||
<uThumb>2</uThumb>
|
||||
<uSurpInc>2</uSurpInc>
|
||||
<uC99>2</uC99>
|
||||
<uGnu>2</uGnu>
|
||||
<useXO>2</useXO>
|
||||
<v6Lang>0</v6Lang>
|
||||
<v6LangP>0</v6LangP>
|
||||
<vShortEn>2</vShortEn>
|
||||
<vShortWch>2</vShortWch>
|
||||
<v6Lto>2</v6Lto>
|
||||
<v6WtE>2</v6WtE>
|
||||
<v6Rtti>2</v6Rtti>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath></IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
</FileArmAds>
|
||||
</FileOption>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>ISP_568_TP.lib</FileName>
|
||||
<FileType>4</FileType>
|
||||
<FilePath>..\..\src\app\ap_demo\ISP_568_TP.lib</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>
|
||||
</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>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
<GroupName>::CMSIS</GroupName>
|
||||
</Group>
|
||||
</Groups>
|
||||
</Target>
|
||||
</Targets>
|
||||
|
||||
<RTE>
|
||||
<apis/>
|
||||
<components>
|
||||
<component Cclass="CMSIS" Cgroup="CORE" Cvendor="ARM" Cversion="5.5.0" condition="ARMv6_7_8-M Device">
|
||||
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.8.0"/>
|
||||
<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
|
@ -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\ap_demo -I..\..\src\sdk\include\M0 -I..\..\src\app -I..\..\src\app\module_demo -I..\..\src\app\touch -I..\..\src\app\S8 -I..\..\src\app\S9 -I..\CVWL568 -I.\RTE\_ISP_568 -IC:\Users\Markin\AppData\Local\Arm\Packs\ARM\CMSIS\5.5.1\CMSIS\Core\Include -IC:\Users\Markin\AppData\Local\Arm\Packs\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:\\Users\\Markin\\AppData\\Local\\Arm\\Packs\\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 ***
|
|
@ -0,0 +1,92 @@
|
|||
; 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\ap_demo -I..\..\src\sdk\include\M0 -I..\..\src\app -I..\..\src\app\module_demo -I..\..\src\app\touch -I..\..\src\app\S8 -I..\..\src\app\S9 -I..\CVWL568 -I.\RTE\_ISP_568 -IC:\Users\Markin\AppData\Local\Arm\Packs\ARM\CMSIS\5.5.1\CMSIS\Core\Include -IC:\Users\Markin\AppData\Local\Arm\Packs\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
|
||||
;;;8
|
||||
;;;9 int main()
|
||||
000000 f7fffffe BL board_Init
|
||||
;;;10 {
|
||||
;;;11 board_Init();
|
||||
;;;12
|
||||
;;;13 while (1)
|
||||
;;;14 {
|
||||
;;;15 #if _DEMO_DSI_TX_EN
|
||||
;;;16 demo_dsi_tx_case();
|
||||
;;;17 #endif
|
||||
;;;18 #if _DEMO_DSI_RX_EN
|
||||
;;;19 demo_hal_dsi_rx_case();
|
||||
;;;20 #endif
|
||||
;;;21 #if _DEMO_TIMER_EN
|
||||
;;;22 demo_timer_case();
|
||||
;;;23 #endif
|
||||
;;;24 #if _DEMO_WDG_EN
|
||||
;;;25 demo_wdg_case();
|
||||
;;;26 #endif
|
||||
;;;27 #if _DEMO_GPIO_EN
|
||||
;;;28 demo_gpio_case();
|
||||
;;;29 #endif
|
||||
;;;30 #if _DEMO_PWM_EN
|
||||
;;;31 demo_pwm_case();
|
||||
;;;32 #endif
|
||||
;;;33 #if _DEMO_SWIRE_EN
|
||||
;;;34 demo_swire_case();
|
||||
;;;35 #endif
|
||||
;;;36
|
||||
;;;37 #if _DEMO_I2C_EN
|
||||
;;;38 demo_hal_spi();
|
||||
;;;39 #endif
|
||||
;;;40
|
||||
;;;41 #if _DEMO_SPI_EN
|
||||
;;;42 demo_hal_i2c();
|
||||
;;;43 #endif
|
||||
;;;44
|
||||
;;;45 #if _DEMO_S8_EN
|
||||
;;;46 s8_demo();
|
||||
;;;47 #endif
|
||||
;;;48
|
||||
;;;49 #if _DEMO_S8P_EN
|
||||
;;;50 s8p_demo();
|
||||
;;;51 #endif
|
||||
;;;52
|
||||
;;;53 #if _DEMO_S9_EN
|
||||
;;;54 ap_demo();
|
||||
000004 f7fffffe BL ap_demo
|
||||
|L1.8|
|
||||
;;;55 #endif
|
||||
;;;56 while (1);
|
||||
000008 e7fe B |L1.8|
|
||||
;;;57 }
|
||||
;;;58 }
|
||||
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:\\Users\\Markin\\AppData\\Local\\Arm\\Packs\\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.
|
@ -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 */
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,57 @@
|
|||
/*******************************************************************************
|
||||
*
|
||||
*
|
||||
* 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_Google_Pixel6pro
|
||||
//#define USE_FOR_SUMSUNG_S20PLUS
|
||||
//#define USE_FOR_OPPO_RENO3_PRO
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef USE_FOR_Google_Pixel6pro
|
||||
#define AMOLED_NT37701_CSOT667 1
|
||||
|
||||
#define FINGERPRINT_USE_DRIVERIC_FPR 1 // 指纹识别区域使用driver ic的FPR功能实现
|
||||
|
||||
#define PANEL_INIT_CODE_ARRAY 1
|
||||
#define ENABLE_TP_WAKE_UP 1
|
||||
#define USE_GPIO_CTRL_SWIRE //GPIO控制SWIRE/LED_ON
|
||||
|
||||
#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
|
||||
|
||||
#ifdef USE_FOR_OPPO_RENO3_PRO
|
||||
#define AMOLED_NT37701_HX655 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief test system 主函数
|
||||
* @param none
|
||||
* @retval none
|
||||
*/
|
||||
void ap_demo(void);
|
||||
void slave_SPI_init(void);
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,156 @@
|
|||
/*******************************************************************************
|
||||
*
|
||||
*
|
||||
* 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 0 //1:表示手机跟芯片之间,touch 数据采用 I2C 通信;
|
||||
#define PHONE_SLAVE_TRANSFER_SPI 1 //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_S20
|
||||
#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 0x49 //芯片本身 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 400000 //设置 I2C 主机通信速率
|
||||
|
||||
#define SPI_MASTER_SPEED 10000000 //设置 SPI 主机通信速率
|
||||
|
||||
#define BUFFER_SIZE_MAX 200 //定义 bufrer 最大的字节数
|
||||
|
||||
#define INPUT_WIDTH_VALUE 1440 //原装屏 X 坐标码值的最大值
|
||||
#define INPUT_HEIGHT_VALUE 3120 //原装屏 Y 坐标码值的最大值
|
||||
|
||||
#if LCD_FT8006S_TRULY59
|
||||
#define OUTPUT_WIDTH_VALUE 720 //维修屏 X 坐标码值的最大值
|
||||
#define OUTPUT_HEIGHT_VALUE 1520 //维修屏 Y 坐标码值的最大值
|
||||
|
||||
#else
|
||||
#define OUTPUT_WIDTH_VALUE 1080 //维修屏 X 坐标码值的最大值
|
||||
#define OUTPUT_HEIGHT_VALUE 2400 //维修屏 Y 坐标码值的最大值
|
||||
#endif
|
||||
|
||||
|
||||
#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 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
|
||||
|
|
@ -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
|
||||
|
|
@ -0,0 +1,900 @@
|
|||
/*******************************************************************************
|
||||
*
|
||||
*
|
||||
* 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"
|
||||
|
||||
#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 const uint8_t *s_slave_txbuffer = NULL;
|
||||
static size_t s_slave_txbuffer_size = 0;
|
||||
|
||||
|
||||
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
|
||||
st_tp_scan_data tp_scan_data;
|
||||
|
||||
#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);
|
||||
#define PHONE_SPI_CPHA 1
|
||||
#define PHONE_SPI_CPOL 1
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
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
|
||||
|
||||
#if 1//def ADD_TP_TUNING
|
||||
uint8_t MI10_PRO_TP_Tuning_data1[3] = {0xA4,0x00,0x00}; // System Reset
|
||||
uint8_t MI10_PRO_TP_Tuning_data2[3] = {0xA4,0x00,0x03}; // FPnl Init
|
||||
uint8_t MI10_PRO_TP_Tuning_data3[3] = {0xA4,0x00,0x02}; // Pnl Init
|
||||
uint8_t MI10_PRO_TP_Tuning_data4[4] = {0xA4,0x03,0x13,0x00}; // TuneM
|
||||
uint8_t MI10_PRO_TP_Tuning_data5[4] = {0xA4,0x03,0x0C,0x00}; // TuneS
|
||||
uint8_t MI10_PRO_TP_Tuning_data6[3] = {0xA4,0x05,0x01}; // SvCfg
|
||||
uint8_t MI10_PRO_TP_Tuning_data7[3] = {0xA4,0x05,0x02}; // SvCx
|
||||
uint8_t MI10_PRO_TP_Tuning_data8[3] = {0xA4,0x05,0x04}; // SvPnl
|
||||
#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 : true:IO 为低电平
|
||||
* @retval :
|
||||
**************************************************************************/
|
||||
static bool app_tp_screen_int_lvl_low(void)
|
||||
{
|
||||
#if SCREEN_MASTER_TRANSFER_I2C
|
||||
return false;
|
||||
#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(500);
|
||||
hal_gpio_set_output_data(g_screen_input_rst_pad, IO_LVL_LOW);
|
||||
delayUs(500);
|
||||
hal_gpio_set_output_data(g_screen_input_rst_pad, IO_LVL_HIGH);
|
||||
}
|
||||
|
||||
void slave_SPI_init(void)
|
||||
{
|
||||
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, 10, 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自动接收
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* @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_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, 8, 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 :
|
||||
**************************************************************************/
|
||||
static 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 :
|
||||
**************************************************************************/
|
||||
static 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();
|
||||
|
||||
hal_spi_slave_reset_tx(txbuffer, buffer_size, true);
|
||||
#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)
|
||||
{
|
||||
#if 0
|
||||
|
||||
if (event == SPI_EVENT_RCV_FULL)
|
||||
{
|
||||
|
||||
app_tp_transfer_phone(packet_info->packet_size);
|
||||
|
||||
while(hal_spi_slave_busy());
|
||||
|
||||
app_tp_s_write(s_slave_txbuffer, s_slave_txbuffer_size);
|
||||
hal_gpio_set_output_data(IO_PAD_PWMEN, IO_LVL_HIGH);
|
||||
}
|
||||
#else
|
||||
if (event == SPI_EVENT_RCV_FULL)
|
||||
{
|
||||
|
||||
}
|
||||
else if (event == SPI_EVENT_RCV_CS_HIGH)
|
||||
{
|
||||
app_tp_transfer_phone(packet_info->packet_size);
|
||||
app_tp_s_write(s_slave_txbuffer, s_slave_txbuffer_size);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#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;
|
||||
// if(phone_start_flag==1)
|
||||
{
|
||||
app_tp_m_read(screen_reg_int_data[0].buffer, 1, s_screen_read_buffer, 8);
|
||||
uint8_t lenth = sizeof(screen_reg_int_data[1])/sizeof(uint8_t);
|
||||
TAU_LOGD("SCREEN reg_data_size:%d", screen_reg_int_data_size);
|
||||
TAU_LOGD("SCREEN reg0_data_len:%d", lenth);
|
||||
for(int i =0; i<30; i++){
|
||||
TAU_LOGD("SCREEN reg1_data0[%d]:%x\n", i, screen_reg_int_data[0].buffer[i]);
|
||||
|
||||
}
|
||||
//TAU_LOGD("SCREEN reg1_data0:%x\n", screen_reg_int_data[2].buffer[0]);
|
||||
// TAU_LOGD("SCREEN reg1_data1:%x\n", screen_reg_int_data[2].buffer[1]);
|
||||
// TAU_LOGD("SCREEN reg1_data2:%x\n", screen_reg_int_data[2].buffer[2]);
|
||||
// TAU_LOGD("SCREEN reg1_data3:%x\n", screen_reg_int_data[2].buffer[3]);
|
||||
// TAU_LOGD("SCREEN reg1_data4:%x\n", screen_reg_int_data[2].buffer[4]);
|
||||
// TAU_LOGD("SCREEN reg1_data5:%x\n", screen_reg_int_data[2].buffer[5]);
|
||||
|
||||
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);
|
||||
}
|
||||
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());
|
||||
}
|
||||
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 是否已准备好
|
||||
|
||||
/**** 1. 判断当前状态通信已结束, 状态通信已结束,并且开机初始化流程还未走完****/
|
||||
|
||||
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
|
||||
|
||||
if(phone_start_flag==1)
|
||||
{
|
||||
S20_Start_init();
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* @name : ap_tp_calibration
|
||||
* @brief : 锟斤拷锟斤拷校准锟斤拷锟斤拷
|
||||
* @param[in] :
|
||||
* @return :
|
||||
* @retval :
|
||||
**************************************************************************/
|
||||
void ap_tp_calibration(void)
|
||||
{
|
||||
// app_tp_m_write(MI10_PRO_TP_Tuning_data1, sizeof(MI10_PRO_TP_Tuning_data1)); // System Reset
|
||||
// while(!hal_i2c_m_transfer_complate());
|
||||
// delayMs(10);
|
||||
app_tp_m_write(MI10_PRO_TP_Tuning_data2, sizeof(MI10_PRO_TP_Tuning_data2)); // FPnl Init
|
||||
while(!hal_i2c_m_transfer_complate());
|
||||
delayMs(1);
|
||||
app_tp_m_write(MI10_PRO_TP_Tuning_data3, sizeof(MI10_PRO_TP_Tuning_data3)); // Pnl Init
|
||||
while(!hal_i2c_m_transfer_complate());
|
||||
delayMs(1);
|
||||
app_tp_m_write(MI10_PRO_TP_Tuning_data4, sizeof(MI10_PRO_TP_Tuning_data4)); // TuneM
|
||||
while(!hal_i2c_m_transfer_complate());
|
||||
delayMs(1);
|
||||
app_tp_m_write(MI10_PRO_TP_Tuning_data5, sizeof(MI10_PRO_TP_Tuning_data5)); // TuneS
|
||||
while(!hal_i2c_m_transfer_complate());
|
||||
delayMs(1);
|
||||
app_tp_m_write(MI10_PRO_TP_Tuning_data6, sizeof(MI10_PRO_TP_Tuning_data6)); // SvCfg
|
||||
while(!hal_i2c_m_transfer_complate());
|
||||
delayMs(1);
|
||||
app_tp_m_write(MI10_PRO_TP_Tuning_data7, sizeof(MI10_PRO_TP_Tuning_data7)); // SvCx
|
||||
while(!hal_i2c_m_transfer_complate());
|
||||
delayMs(1);
|
||||
app_tp_m_write(MI10_PRO_TP_Tuning_data8, sizeof(MI10_PRO_TP_Tuning_data8)); // SvPnl
|
||||
while(!hal_i2c_m_transfer_complate());
|
||||
delayMs(1);
|
||||
}
|
||||
|
||||
void ap_tp_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;
|
||||
}
|
||||
|
||||
// 模拟ST 手指释放事件给到处理函数
|
||||
void ap_tp_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);
|
||||
}
|
||||
}
|
||||
|
||||
// ST 触摸芯片软件复位指令
|
||||
void ap_tp_system_softReset(void)
|
||||
{
|
||||
ap_tp_simulate_finger_release_event();
|
||||
ap_tp_scan_point_init();
|
||||
|
||||
app_tp_m_write(MI10_PRO_TP_Tuning_data1, sizeof(MI10_PRO_TP_Tuning_data1)); // System Reset
|
||||
while(!hal_i2c_m_transfer_complate());
|
||||
delayMs(20);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
// 记录报点事件
|
||||
void ap_tp_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;
|
||||
}
|
||||
}
|
||||
|
||||
// printf("E %2x,%2x,%2x\n",eventdata,len,tp_scan_data.tp_read_point_counter);
|
||||
|
||||
// printf("F %2d,%2d,%2d,%2d,%2d,%2d\n",tp_scan_data.tp_point_buffer[0],tp_scan_data.tp_point_buffer[1],tp_scan_data.tp_point_buffer[2]
|
||||
// ,tp_scan_data.tp_point_buffer[3],tp_scan_data.tp_point_buffer[4],tp_scan_data.tp_point_buffer[5]);
|
||||
|
||||
}
|
||||
|
||||
void ap_tp_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 时间超时
|
||||
{
|
||||
// tp_scan_data.tp_point_up_error_flag = 0;
|
||||
// tp_scan_data.tp_point_error_time_counter = 0;
|
||||
if(tp_scan_data.tp_read_point_counter>0) // 有残留点
|
||||
{
|
||||
TAU_LOGD("release finger %2d", tp_scan_data.tp_read_point_counter);
|
||||
tp_scan_data.tp_read_point_counter = 0;
|
||||
ap_tp_simulate_finger_release_event();
|
||||
}
|
||||
|
||||
// printf("F %2d,%2d,%2d,%2d,%2d,%2d\n",tp_scan_data.tp_point_buffer[0],tp_scan_data.tp_point_buffer[1],tp_scan_data.tp_point_buffer[2]
|
||||
// ,tp_scan_data.tp_point_buffer[3],tp_scan_data.tp_point_buffer[4],tp_scan_data.tp_point_buffer[5]);
|
||||
|
||||
ap_tp_scan_point_init();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* @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;
|
||||
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;
|
||||
}
|
||||
|
||||
#if 0 //test
|
||||
test_flag++;
|
||||
if (test_flag >1000000)
|
||||
{
|
||||
test_flag =0;
|
||||
//TAU_LOGD("Run ok!!\n");
|
||||
//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
|
||||
|
||||
/**** 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_transfer_status)) && app_tp_m_transfer_complate()) //判断当前不处于通信状态,并且准备通信
|
||||
{
|
||||
s_screen_int_flag = false;
|
||||
if (s_spim_write) //SPI 写数据后需要把接收FIFO的数据读出,不然会影响下一次读取
|
||||
{
|
||||
hal_spi_m_clear_rxfifo();
|
||||
s_spim_write = false;
|
||||
}
|
||||
|
||||
/**** 2. 发送或读取从机数据 ****/
|
||||
if (screen_int_transfer_buffer_ready)
|
||||
{
|
||||
#ifndef READ_MODULE_TP_ONE_BY_ONE
|
||||
screen_int_transfer_buffer_ready = false;
|
||||
s_screen_int_transfer_status = true;
|
||||
#if 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[8], 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);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
/**** 3. 解析本次通信数据,并准备下一次通信的buffer ****/
|
||||
else
|
||||
{
|
||||
#if 1
|
||||
#ifdef USE_FOR_SUMSUNG_S20
|
||||
u16TouchID=0x0000;
|
||||
#endif
|
||||
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;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* @name : app_tp_transfer_phone
|
||||
* @brief : 根据数据解析进行相应的答复
|
||||
* @param[in] : recieve_num:接收数据长度
|
||||
* @return :
|
||||
* @retval :
|
||||
**************************************************************************/
|
||||
static void app_tp_transfer_phone(size_t recieve_num)
|
||||
{
|
||||
TAU_LOGD("app_tp_transfer_phone,s_phone_read_buffer[0] [1] [2]=0x%x 0x%x 0x%x recieve_num=%d!\r\n",s_phone_read_buffer[0],s_phone_read_buffer[1],s_phone_read_buffer[2],recieve_num);
|
||||
app_tp_phone_analysis_data(s_phone_read_buffer, recieve_num, &s_slave_txbuffer, &s_slave_txbuffer_size);
|
||||
|
||||
#if PHONE_SLAVE_TRANSFER_I2C
|
||||
app_tp_s_read(s_phone_read_buffer, BUFFER_SIZE_MAX);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* @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
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
/*******************************************************************************
|
||||
*
|
||||
*
|
||||
* 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中断,发送数据之后要读回数据
|
||||
|
||||
#define ST_TP_SCAN_POINT_NUMBER_MAX 6
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t tp_point_buffer[ST_TP_SCAN_POINT_NUMBER_MAX]; // 锟斤拷锟秸碉拷 TP 锟斤拷锟姐,锟斤拷锟节硷拷录锟斤拷锟斤拷锟斤拷息
|
||||
uint8_t tp_read_point_counter; // 统锟狡憋拷锟斤拷锟斤拷值
|
||||
uint8_t tp_point_up_error_flag; // 锟斤拷锟斤拷锟酵凤拷锟届常锟斤拷志
|
||||
uint32_t tp_point_error_time_counter; // 锟斤拷锟斤拷锟斤拷时锟斤拷
|
||||
} st_tp_scan_data;
|
||||
|
||||
/**************************************************************************
|
||||
* @name : ap_tp_calibration
|
||||
* @brief : 锟斤拷锟斤拷校准锟斤拷锟斤拷
|
||||
* @param[in] :
|
||||
* @return :
|
||||
* @retval :
|
||||
**************************************************************************/
|
||||
void ap_tp_calibration(void);
|
||||
|
||||
void ap_tp_system_softReset(void);
|
||||
|
||||
void ap_tp_scan_point_record_event_exec(void);
|
||||
void ap_tp_scan_point_init(void);
|
||||
|
||||
extern bool s_screen_init_complate; //屏幕TP开机初始化完成标志
|
||||
|
||||
/**************************************************************************
|
||||
* @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);
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
#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"
|
||||
|
||||
int main()
|
||||
{
|
||||
board_Init();
|
||||
|
||||
while (1)
|
||||
{
|
||||
#if _DEMO_DSI_TX_EN
|
||||
demo_dsi_tx_case();
|
||||
#endif
|
||||
#if _DEMO_DSI_RX_EN
|
||||
demo_hal_dsi_rx_case();
|
||||
#endif
|
||||
#if _DEMO_TIMER_EN
|
||||
demo_timer_case();
|
||||
#endif
|
||||
#if _DEMO_WDG_EN
|
||||
demo_wdg_case();
|
||||
#endif
|
||||
#if _DEMO_GPIO_EN
|
||||
demo_gpio_case();
|
||||
#endif
|
||||
#if _DEMO_PWM_EN
|
||||
demo_pwm_case();
|
||||
#endif
|
||||
#if _DEMO_SWIRE_EN
|
||||
demo_swire_case();
|
||||
#endif
|
||||
|
||||
#if _DEMO_I2C_EN
|
||||
demo_hal_spi();
|
||||
#endif
|
||||
|
||||
#if _DEMO_SPI_EN
|
||||
demo_hal_i2c();
|
||||
#endif
|
||||
|
||||
#if _DEMO_S8_EN
|
||||
s8_demo();
|
||||
#endif
|
||||
|
||||
#if _DEMO_S8P_EN
|
||||
s8p_demo();
|
||||
#endif
|
||||
|
||||
#if _DEMO_S9_EN
|
||||
ap_demo();
|
||||
#endif
|
||||
while (1);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
/*******************************************************************************
|
||||
*
|
||||
* 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
|
||||
*******************************************************************************/
|
||||
/* 模块demo 宏定义 */
|
||||
#define _DEMO_TIMER_EN 0
|
||||
#define _DEMO_DSI_TX_EN 0
|
||||
#define _DEMO_DSI_RX_EN 0
|
||||
#define _DEMO_PWM_EN 0
|
||||
#define _DEMO_SWIRE_EN 0
|
||||
#define _DEMO_WDG_EN 0
|
||||
#define _DEMO_GPIO_EN 0
|
||||
#define _DEMO_I2C_EN 0
|
||||
#define _DEMO_SPI_EN 0
|
||||
/* ap demo 宏定义 */
|
||||
#define _DEMO_S8_EN 0
|
||||
#define _DEMO_S8P_EN 0
|
||||
#define _DEMO_S9_EN 1
|
||||
#if _DEMO_TIMER_EN
|
||||
#include "demo_hal_timer.h"
|
||||
#endif
|
||||
|
||||
#if _DEMO_I2C_EN
|
||||
#include "demo_hal_i2c.h"
|
||||
#endif
|
||||
|
||||
#if _DEMO_SPI_EN
|
||||
#include "demo_hal_spi.h"
|
||||
#endif
|
||||
|
||||
#if _DEMO_DSI_TX_EN
|
||||
#include "demo_hal_dsi_tx.h"
|
||||
#endif
|
||||
|
||||
#if _DEMO_DSI_RX_EN
|
||||
#include "demo_hal_dsi_rx.h"
|
||||
#endif
|
||||
|
||||
#if _DEMO_PWM_EN
|
||||
#include "demo_hal_pwm.h"
|
||||
#endif
|
||||
|
||||
#if _DEMO_SWIRE_EN
|
||||
#include "demo_hal_swire.h"
|
||||
#endif
|
||||
|
||||
#if _DEMO_WDG_EN
|
||||
#include "demo_hal_wdg.h"
|
||||
#endif
|
||||
|
||||
#if _DEMO_GPIO_EN
|
||||
#include "demo_hal_gpio.h"
|
||||
#endif
|
||||
|
||||
#if _DEMO_I2C_TP_EN
|
||||
#include "demo_hal_i2c_tp.h"
|
||||
#endif
|
||||
|
||||
#if _DEMO_S8_EN
|
||||
#include "s8_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
|
||||
|
||||
#if _DEMO_S9_EN
|
||||
#include "ap_demo.h"
|
||||
#include "app_tp_for_custom_s8.h"
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (C) 2019-2022, CVA 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
|
||||
}
|
||||
|
|
@ -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
|
|
@ -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
|
|
@ -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 */
|
|
@ -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
|
|
@ -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
|
||||
|
|
@ -0,0 +1,374 @@
|
|||
/*******************************************************************************
|
||||
*
|
||||
*
|
||||
* 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_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__
|
|
@ -0,0 +1,83 @@
|
|||
/*******************************************************************************
|
||||
*
|
||||
*
|
||||
* 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"
|
||||
|
||||
/*******************************************************************************
|
||||
* 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
|
||||
#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
|
||||
|
||||
/*******************************************************************************
|
||||
* 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
|
|
@ -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.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,211 @@
|
|||
/**************************************************************************//**
|
||||
* @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
|
||||
|
||||
#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 */
|
|
@ -0,0 +1,557 @@
|
|||
/*******************************************************************************
|
||||
*
|
||||
*
|
||||
* 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 直通模式,预留,仅debug使用 */
|
||||
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
|
||||
} 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 - 正常处理1个DSC , 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,10000000时回CMD为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_rate:frame 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);
|
||||
|
||||
#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__
|
|
@ -0,0 +1,284 @@
|
|||
/*******************************************************************************
|
||||
*
|
||||
*
|
||||
* 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 */
|
||||
bool tx_cmd_mode_sync; /* TX command mode 输出同步 */
|
||||
} 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 无
|
||||
*/
|
||||
void 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 无
|
||||
*/
|
||||
void 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__
|
|
@ -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 mode,方向为input,指定中断触发方式
|
||||
* @param pad:GPIO序号,参考枚举类型gpio_pad_e
|
||||
* @param trig:4种中断触发方式,参考枚举类型sys_cfg_trigger_e
|
||||
* @retval 无
|
||||
*/
|
||||
void hal_gpio_init_eint(io_pad_e pad, sys_cfg_trigger_e trig);
|
||||
|
||||
/**
|
||||
* @brief 注册GPIO中断回调函数
|
||||
* @param pad:GPIO序号,参考枚举类型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 pad:GPIO序号,参考枚举类型gpio_pad_e
|
||||
* @param state:开关控制
|
||||
* @retval 无
|
||||
*/
|
||||
void hal_gpio_ctrl_eint(io_pad_e pad, function_state_e state);
|
||||
|
||||
/**
|
||||
* @brief 获取GPIO中断类型
|
||||
* @param pad:GPIO序号,参考枚举类型gpio_pad_e
|
||||
* @retval 无
|
||||
*/
|
||||
gpio_int_e hal_gpio_get_int_type(io_pad_e pad);
|
||||
|
||||
/**
|
||||
* @brief 配置指定PAD为GPIO mode,方向为output,指定初始电平
|
||||
* @param pad:GPIO序号,参考枚举类型gpio_pad_e
|
||||
* @param lvl:初始电平,参考枚举类型gpio_level_e
|
||||
* @retval 无
|
||||
*/
|
||||
void hal_gpio_init_output(io_pad_e pad, gpio_level_e lvl);
|
||||
|
||||
/**
|
||||
* @brief 封装设置输出接口
|
||||
* @param pad:GPIO序号,参考枚举类型gpio_pad_e
|
||||
* @param lvl:初始电平,参考枚举类型gpio_level_e
|
||||
* @retval 无
|
||||
*/
|
||||
void hal_gpio_set_output_data(io_pad_e pad, gpio_level_e lvl);
|
||||
|
||||
/**
|
||||
* @brief 封装设置输出接口扩展,支持同时通知两个IO输出电平
|
||||
* @param pad1:GPIO序号,参考枚举类型gpio_pad_e
|
||||
* @param pad1_lvl:配置电平,参考枚举类型gpio_level_e
|
||||
* @param pad2:GPIO序号,参考枚举类型gpio_pad_e
|
||||
* @param pad2_lvl:配置电平,参考枚举类型gpio_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 mode,方向为input
|
||||
* @param pad:GPIO序号,参考枚举类型gpio_pad_e
|
||||
* @retval 无
|
||||
*/
|
||||
void hal_gpio_init_input(io_pad_e pad);
|
||||
|
||||
/**
|
||||
* @brief 读取输入电平
|
||||
* @param pad:GPIO序号,参考枚举类型gpio_pad_e
|
||||
* @retval 无
|
||||
*/
|
||||
gpio_level_e hal_gpio_get_input_data(io_pad_e pad);
|
||||
|
||||
/**
|
||||
* @brief 设置io mode
|
||||
* @param pad:GPIO序号,参考枚举类型gpio_pad_e
|
||||
* @param mode:工作模式,参考各PAD对应的mode枚举类型
|
||||
* @retval 无
|
||||
*/
|
||||
void hal_gpio_set_mode(io_pad_e pad, uint8_t mode);
|
||||
|
||||
/**
|
||||
* @brief 获取指定PAD的默认上拉、下拉状态
|
||||
* @param pad:GPIO序号,参考枚举类型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 pad:GPIO序号,参考枚举类型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 pad:GPIO序号,参考枚举类型gpio_pad_e
|
||||
* @param st_enable:1为施密特触发,0为正常触发
|
||||
* @retval 无
|
||||
*/
|
||||
void hal_gpio_set_schmitt_trigger(io_pad_e pad, function_state_e st_enable);
|
||||
|
||||
/**
|
||||
* @brief 配置指定PAD的驱动能力
|
||||
* @param pad:GPIO序号,参考枚举类型gpio_pad_e
|
||||
* @param strength:驱动强度,取值为0~3
|
||||
* @retval 无
|
||||
*/
|
||||
void hal_gpio_set_driving_strength(io_pad_e pad, uint8_t strength);
|
||||
|
||||
/**
|
||||
* @brief 配置指定PAD的电压转换速率
|
||||
* @param pad:GPIO序号,参考枚举类型gpio_pad_e
|
||||
* @param rate:驱动强度,取值为0~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__ */
|
|
@ -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] : txBuffer:发送数据buffer
|
||||
* @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] : rxBuffer:接收数据buffer
|
||||
* @param[in] : data_size:接收数据长度
|
||||
* @return : STATUS_SUCCESS:寄存器地址发送成功,并已配置DMA接收通道,但不一定完成接收
|
||||
* @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__*/
|
||||
|
|
@ -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] : txBuffer:发送数据buffer
|
||||
* @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] : rxBuffer:接收数据buffer
|
||||
* @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 : ENABLE:cycle模式,DISABLE:非cycle模式
|
||||
* @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__*/
|
||||
|
|
@ -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 ctl0:到达阈值thr0时的操作,参考枚举类型pwm_out_ctrl_e
|
||||
* @param ctl1:到达阈值thr1时的操作,参考枚举类型pwm_out_ctrl_e
|
||||
* @param thr0:阈值0,单位us
|
||||
* @param thr1:阈值1,单位us
|
||||
* @param period:一个周期的时间,单位us
|
||||
* @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 ctl0:到达阈值thr0时的操作,参考枚举类型pwm_out_ctrl_e
|
||||
* @param ctl1:到达阈值thr1时的操作,参考枚举类型pwm_out_ctrl_e
|
||||
* @param thr0:阈值0,单位us
|
||||
* @param thr1:阈值1,单位us
|
||||
* @param period:一个周期的时间,单位us
|
||||
* @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 period:一个周期的时间,单位us
|
||||
* @retval 无
|
||||
*/
|
||||
void hal_pwm_out_sync_period(uint32_t period);
|
||||
|
||||
/**
|
||||
* @brief 在同步控制模式下配置PWMO脉冲的控制
|
||||
* @param ctl0:到达阈值thr0时的操作,参考枚举类型pwm_out_ctrl_e
|
||||
* @param ctl1:到达阈值thr1时的操作,参考枚举类型pwm_out_ctrl_e
|
||||
* @retval 无
|
||||
*/
|
||||
void hal_pwm_out_sync_ctl(pwm_out_ctrl_e ctl0, pwm_out_ctrl_e ctl1);
|
||||
|
||||
/**
|
||||
* @brief 在同步阈值模式下配置PWMO脉冲的阈值
|
||||
* @param thr0:阈值0,单位us
|
||||
* @param thr1:阈值1,单位us
|
||||
* @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_en:high overflow中断使能开关
|
||||
* @param low_overflow_en:low overflow中断使能开关
|
||||
* @param total_overflow_en:total overflow中断使能开关
|
||||
* @param high_done_en:high done中断使能开关
|
||||
* @param low_done_en:low done中断使能开关
|
||||
* @param total_done_en:total 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_int:中断类型,参考枚举类型pwm_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_MISO、IO_PAD_TD_LEDPWM输出
|
||||
* @retval 无
|
||||
*/
|
||||
void hal_pwm_out_sel_io(io_pad_e pad);
|
||||
#endif
|
||||
#endif /* __HAL_PWM_H__ */
|
|
@ -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
|
||||
|
|
@ -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 cb:call 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 buffer:自动模式数据接收buffer
|
||||
* @param size: 自动模式数据接收buffer size
|
||||
* @param circle:circle mode,packet 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 buffer:自动模式数据发送buffer, buffer为NULL为切换为自动模式
|
||||
* @param size: 自动模式数据发收buffer size
|
||||
* @param circle:circle mode,重复发送buffer的数据
|
||||
* @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 buffer:自动模式数据发送buffer
|
||||
* @param size: 自动模式数据发收buffer size
|
||||
* @param circle:circle mode,重复发送buffer的数据
|
||||
* @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__*/
|
||||
|
|
@ -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_time:起始时长,单位us
|
||||
* @param stop_time:结束时长,单位us,必须大于300us
|
||||
* @param high_time:高电平时长,单位us
|
||||
* @param low_time:低电平时长,单位us
|
||||
* @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__ */
|
|
@ -0,0 +1,167 @@
|
|||
/*******************************************************************************
|
||||
*
|
||||
*
|
||||
* 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"
|
||||
|
||||
/*******************************************************************************
|
||||
* 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 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);
|
||||
|
||||
/**
|
||||
* @brief 用户字节数组形式从flash读取数据,按页读取,每页1024字节
|
||||
* @param *usr_cfg_t_addr(数组首地址),
|
||||
usr_cfg_t_size(数组大小可以超过1024,可以按页读也可连续跨页读)
|
||||
flash_page (页0~63)
|
||||
* @retval bool 无
|
||||
*/
|
||||
bool hal_system_flash_read(uint8_t *usr_cfg_t_addr, uint16_t usr_cfg_t_size, uint8_t flash_page);
|
||||
|
||||
/**
|
||||
* @brief 用户字节数组形式存入flash(次数有限,不可频繁写入),按页写入,每页1024字节
|
||||
* @param *usr_cfg_t_addr(数组首地址),
|
||||
usr_cfg_t_size(数组大小可以超过1024,可以按页写也可连续跨页写入),
|
||||
推荐按页顺序写入方式,第一次必须从0页开始写入,后续才可1~63任意页写入
|
||||
flash_page (写入页0~63)
|
||||
* @retval bool 校验size是否超出
|
||||
*/
|
||||
bool hal_system_flash_write(uint8_t *usr_cfg_t_addr, uint16_t usr_cfg_t_size, uint8_t flash_page);
|
||||
|
||||
#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__
|
|
@ -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 ms:超时时间,单位ms。由于应用场景一般是ms级别的,应用开发不需要计数具体时针数,
|
||||
故直接输入时间,在接口内部换算成时钟数进行寄存器设置。
|
||||
* @param cb_func:回调函数地址,不需要则填NULL
|
||||
* @param data:回调函数的参数地址,不需要则填NULL
|
||||
* @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 us:超时时间,单位us。由于应用场景一般是us级别的,应用开发不需要计数具体时针数,
|
||||
故直接输入时间,在接口内部换算成时钟数进行寄存器设置。
|
||||
* @param cb_func:回调函数地址,不需要则填NULL
|
||||
* @param data:回调函数的参数地址,不需要则填NULL
|
||||
* @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__ */
|
|
@ -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__ */
|
|
@ -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__ */
|
Loading…
Reference in New Issue