1、首次提交

2、已小批量量产代码
This commit is contained in:
“苏飞源” 2024-03-19 11:23:30 +08:00
commit a9763743ec
114 changed files with 73352 additions and 0 deletions

85
.gitignore vendored Normal file
View File

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

546
project/WL468/WL468.uvprojx Normal file
View File

@ -0,0 +1,546 @@
<?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>WL468</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<pArmCC>5060750::V5.06 update 6 (build 750)::ARMCC</pArmCC>
<pCCUsed>5060750::V5.06 update 6 (build 750)::ARMCC</pCCUsed>
<uAC6>0</uAC6>
<TargetOption>
<TargetCommonOption>
<Device>ARMCM0</Device>
<Vendor>ARM</Vendor>
<PackID>ARM.CMSIS.5.5.1</PackID>
<PackURL>http://www.keil.com/pack/</PackURL>
<Cpu>IRAM(0x20000000,0x00020000) IROM(0x00000000,0x00040000) CPUTYPE("Cortex-M0") CLOCK(12000000) ESEL ELITTLE</Cpu>
<FlashUtilSpec></FlashUtilSpec>
<StartupFile></StartupFile>
<FlashDriverDll>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000)</FlashDriverDll>
<DeviceId>0</DeviceId>
<RegisterFile>$$Device:ARMCM0$Device\ARM\ARMCM0\Include\ARMCM0.h</RegisterFile>
<MemoryEnv></MemoryEnv>
<Cmp></Cmp>
<Asm></Asm>
<Linker></Linker>
<OHString></OHString>
<InfinionOptionDll></InfinionOptionDll>
<SLE66CMisc></SLE66CMisc>
<SLE66AMisc></SLE66AMisc>
<SLE66LinkerMisc></SLE66LinkerMisc>
<SFDFile></SFDFile>
<bCustSvd>0</bCustSvd>
<UseEnv>0</UseEnv>
<BinPath></BinPath>
<IncludePath></IncludePath>
<LibPath></LibPath>
<RegisterFilePath></RegisterFilePath>
<DBRegisterFilePath></DBRegisterFilePath>
<TargetStatus>
<Error>0</Error>
<ExitCodeStop>0</ExitCodeStop>
<ButtonStop>0</ButtonStop>
<NotGenerated>0</NotGenerated>
<InvalidFlash>1</InvalidFlash>
</TargetStatus>
<OutputDirectory>.\Objects\</OutputDirectory>
<OutputName>WL468_demo</OutputName>
<CreateExecutable>1</CreateExecutable>
<CreateLib>0</CreateLib>
<CreateHexFile>1</CreateHexFile>
<DebugInformation>1</DebugInformation>
<BrowseInformation>1</BrowseInformation>
<ListingPath>.\Listings\</ListingPath>
<HexFormatSelection>1</HexFormatSelection>
<Merge32K>0</Merge32K>
<CreateBatchFile>1</CreateBatchFile>
<BeforeCompile>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopU1X>0</nStopU1X>
<nStopU2X>0</nStopU2X>
</BeforeCompile>
<BeforeMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopB1X>0</nStopB1X>
<nStopB2X>0</nStopB2X>
</BeforeMake>
<AfterMake>
<RunUserProg1>1</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name>fromelf --bin -o .\Objects\@L.bin .\Objects\@L.axf</UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopA1X>0</nStopA1X>
<nStopA2X>0</nStopA2X>
</AfterMake>
<SelectedForBatchBuild>0</SelectedForBatchBuild>
<SVCSIdString></SVCSIdString>
</TargetCommonOption>
<CommonProperty>
<UseCPPCompiler>0</UseCPPCompiler>
<RVCTCodeConst>0</RVCTCodeConst>
<RVCTZI>0</RVCTZI>
<RVCTOtherData>0</RVCTOtherData>
<ModuleSelection>0</ModuleSelection>
<IncludeInBuild>1</IncludeInBuild>
<AlwaysBuild>0</AlwaysBuild>
<GenerateAssemblyFile>0</GenerateAssemblyFile>
<AssembleAssemblyFile>0</AssembleAssemblyFile>
<PublicsOnly>0</PublicsOnly>
<StopOnExitCode>3</StopOnExitCode>
<CustomArgument></CustomArgument>
<IncludeLibraryModules></IncludeLibraryModules>
<ComprImg>1</ComprImg>
</CommonProperty>
<DllOption>
<SimDllName>SARMCM3.DLL</SimDllName>
<SimDllArguments> </SimDllArguments>
<SimDlgDll>DARMCM1.DLL</SimDlgDll>
<SimDlgDllArguments>-pCM0</SimDlgDllArguments>
<TargetDllName>SARMCM3.DLL</TargetDllName>
<TargetDllArguments> </TargetDllArguments>
<TargetDlgDll>TARMCM1.DLL</TargetDlgDll>
<TargetDlgDllArguments>-pCM0</TargetDlgDllArguments>
</DllOption>
<DebugOption>
<OPTHX>
<HexSelection>1</HexSelection>
<HexRangeLowAddress>0</HexRangeLowAddress>
<HexRangeHighAddress>0</HexRangeHighAddress>
<HexOffset>0</HexOffset>
<Oh166RecLen>16</Oh166RecLen>
</OPTHX>
</DebugOption>
<Utilities>
<Flash1>
<UseTargetDll>1</UseTargetDll>
<UseExternalTool>0</UseExternalTool>
<RunIndependent>0</RunIndependent>
<UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
<Capability>1</Capability>
<DriverSelection>4096</DriverSelection>
</Flash1>
<bUseTDR>1</bUseTDR>
<Flash2>BIN\UL2CM3.DLL</Flash2>
<Flash3>"" ()</Flash3>
<Flash4></Flash4>
<pFcarmOut></pFcarmOut>
<pFcarmGrp></pFcarmGrp>
<pFcArmRoot></pFcArmRoot>
<FcArmLst>0</FcArmLst>
</Utilities>
<TargetArmAds>
<ArmAdsMisc>
<GenerateListings>0</GenerateListings>
<asHll>1</asHll>
<asAsm>1</asAsm>
<asMacX>1</asMacX>
<asSyms>1</asSyms>
<asFals>1</asFals>
<asDbgD>1</asDbgD>
<asForm>1</asForm>
<ldLst>0</ldLst>
<ldmm>1</ldmm>
<ldXref>1</ldXref>
<BigEnd>0</BigEnd>
<AdsALst>1</AdsALst>
<AdsACrf>1</AdsACrf>
<AdsANop>0</AdsANop>
<AdsANot>0</AdsANot>
<AdsLLst>1</AdsLLst>
<AdsLmap>1</AdsLmap>
<AdsLcgr>1</AdsLcgr>
<AdsLsym>1</AdsLsym>
<AdsLszi>1</AdsLszi>
<AdsLtoi>1</AdsLtoi>
<AdsLsun>1</AdsLsun>
<AdsLven>1</AdsLven>
<AdsLsxf>1</AdsLsxf>
<RvctClst>1</RvctClst>
<GenPPlst>1</GenPPlst>
<AdsCpuType>"Cortex-M0"</AdsCpuType>
<RvctDeviceName></RvctDeviceName>
<mOS>0</mOS>
<uocRom>0</uocRom>
<uocRam>0</uocRam>
<hadIROM>1</hadIROM>
<hadIRAM>1</hadIRAM>
<hadXRAM>0</hadXRAM>
<uocXRam>0</uocXRam>
<RvdsVP>0</RvdsVP>
<RvdsMve>0</RvdsMve>
<hadIRAM2>0</hadIRAM2>
<hadIROM2>0</hadIROM2>
<StupSel>16</StupSel>
<useUlib>1</useUlib>
<EndSel>1</EndSel>
<uLtcg>0</uLtcg>
<nSecure>0</nSecure>
<RoSelD>4</RoSelD>
<RwSelD>3</RwSelD>
<CodeSel>0</CodeSel>
<OptFeed>0</OptFeed>
<NoZi1>0</NoZi1>
<NoZi2>0</NoZi2>
<NoZi3>0</NoZi3>
<NoZi4>0</NoZi4>
<NoZi5>0</NoZi5>
<Ro1Chk>0</Ro1Chk>
<Ro2Chk>0</Ro2Chk>
<Ro3Chk>0</Ro3Chk>
<Ir1Chk>0</Ir1Chk>
<Ir2Chk>1</Ir2Chk>
<Ra1Chk>0</Ra1Chk>
<Ra2Chk>0</Ra2Chk>
<Ra3Chk>0</Ra3Chk>
<Im1Chk>1</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>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT6>
<OCR_RVCT7>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT7>
<OCR_RVCT8>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT8>
<OCR_RVCT9>
<Type>0</Type>
<StartAddress>0x70000</StartAddress>
<Size>0x8000</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>1</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></Define>
<Undefine></Undefine>
<IncludePath>..\..\src;..\..\src\board;..\..\src\common;..\..\src\sdk\include;..\..\src\sdk\include\M0;..\..\src\app;..\..\src\app\S8;..\..\src\app\touch;..\..\src\app\module_demo;..\..\src\app\Mi12Lite</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>app_tp_transfer.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\touch\app_tp_transfer.c</FilePath>
</File>
<File>
<FileName>app_tp_for_custom_s8.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\S8\app_tp_for_custom_s8.c</FilePath>
</File>
<File>
<FileName>s8_demo.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\S8\s8_demo.c</FilePath>
</File>
<File>
<FileName>Mi12Lite.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\Mi12Lite\Mi12Lite.c</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>driver</GroupName>
<Files>
<File>
<FileName>CVWL468.lib</FileName>
<FileType>4</FileType>
<FilePath>..\..\src\sdk\CVWL468\lib\CVWL468.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>modules_demo</GroupName>
<Files>
<File>
<FileName>demo_hal_crc.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\module_demo\demo_hal_crc.c</FilePath>
</File>
<File>
<FileName>demo_hal_dsi_rx.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\module_demo\demo_hal_dsi_rx.c</FilePath>
</File>
<File>
<FileName>demo_hal_dsi_tx.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\module_demo\demo_hal_dsi_tx.c</FilePath>
</File>
<File>
<FileName>demo_hal_flash.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\module_demo\demo_hal_flash.c</FilePath>
</File>
<File>
<FileName>demo_hal_gpio.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\module_demo\demo_hal_gpio.c</FilePath>
</File>
<File>
<FileName>demo_hal_i2c.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\module_demo\demo_hal_i2c.c</FilePath>
</File>
<File>
<FileName>demo_hal_spi.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\module_demo\demo_hal_spi.c</FilePath>
</File>
<File>
<FileName>demo_hal_pwm.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\module_demo\demo_hal_pwm.c</FilePath>
</File>
<File>
<FileName>demo_hal_pwr.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\module_demo\demo_hal_pwr.c</FilePath>
</File>
<File>
<FileName>demo_hal_swire.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\module_demo\demo_hal_swire.c</FilePath>
</File>
<File>
<FileName>demo_hal_uart.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\module_demo\demo_hal_uart.c</FilePath>
</File>
<File>
<FileName>demo_hal_wdg.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\module_demo\demo_hal_wdg.c</FilePath>
</File>
<File>
<FileName>module_demo_main.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\module_demo\module_demo_main.c</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>::CMSIS</GroupName>
</Group>
</Groups>
</Target>
</Targets>
<RTE>
<apis/>
<components>
<component Cclass="CMSIS" Cgroup="CORE" Cvendor="ARM" Cversion="5.2.0" condition="ARMv6_7_8-M Device">
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.5.1"/>
<targetInfos>
<targetInfo name="WL468"/>
</targetInfos>
</component>
</components>
<files>
<file attr="config" category="sourceAsm" condition="ARMCC" name="Device\ARM\ARMCM0\Source\ARM\startup_ARMCM0.s" version="1.0.0">
<instance index="0" removed="1">RTE\Device\ARMCM0\startup_ARMCM0.s</instance>
<component Cclass="Device" Cgroup="Startup" Cvendor="ARM" Cversion="1.1.0" condition="ARMCM0 CMSIS"/>
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.5.1"/>
<targetInfos/>
</file>
<file attr="config" category="sourceC" name="Device\ARM\ARMCM0\Source\system_ARMCM0.c" version="1.0.0">
<instance index="0" removed="1">RTE\Device\ARMCM0\system_ARMCM0.c</instance>
<component Cclass="Device" Cgroup="Startup" Cvendor="ARM" Cversion="1.1.0" condition="ARMCM0 CMSIS"/>
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.5.1"/>
<targetInfos/>
</file>
</files>
</RTE>
</Project>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,60 @@
; 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 -O0 --diag_suppress=9931 -I..\..\src -I..\..\src\board -I..\..\src\common -I..\..\src\sdk\include -I..\..\src\sdk\include\M0 -I..\..\src\app -I..\..\src\app\S8 -I..\..\src\app\touch -I..\..\src\app\module_demo -I..\..\src\app\Mi12Lite -I.\RTE\_WL668 -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\CMSIS\Core\Include -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\Device\ARM\ARMCM0\Include -D__MICROLIB -D__UVISION_VERSION=528 -D_RTE_ -DARMCM0 --omf_browse=.\objects\board.crf ..\..\src\board\board.c]
THUMB
AREA ||i.board_Init||, CODE, READONLY, ALIGN=2
board_Init PROC
;;;20 */
;;;21 void board_Init(void)
000000 b510 PUSH {r4,lr}
;;;22 {
;;;23 /* system init ,配置MCU时钟 */
;;;24 hal_system_init(HAL_SYSCLK_80M);
000002 4806 LDR r0,|L1.28|
000004 f7fffffe BL hal_system_init
;;;25
;;;26 /* 使用SWD口作为Debug Log输出,可配置成Uart方式 */
;;;27 tau_log_init(115200, LOG_PORT_SWD);
000008 2102 MOVS r1,#2
00000a 20e1 MOVS r0,#0xe1
00000c 0240 LSLS r0,r0,#9
00000e f7fffffe BL tau_log_init
;;;28
;;;29 /* systick init,根据需要配置 */
;;;30 hal_system_enable_systick(1);
000012 2001 MOVS r0,#1
000014 f7fffffe BL hal_system_enable_systick
;;;31 }
000018 bd10 POP {r4,pc}
ENDP
00001a 0000 DCW 0x0000
|L1.28|
DCD 0x04c4b400
;*** Start embedded assembler ***
#line 1 "..\\..\\src\\board\\board.c"
AREA ||.rev16_text||, CODE
THUMB
EXPORT |__asm___7_board_c_bcd01269____REV16|
#line 467 "C:\\Keil_v5\\ARM\\PACK\\ARM\\CMSIS\\5.5.1\\CMSIS\\Core\\Include\\cmsis_armcc.h"
|__asm___7_board_c_bcd01269____REV16| PROC
#line 468
rev16 r0, r0
bx lr
ENDP
AREA ||.revsh_text||, CODE
THUMB
EXPORT |__asm___7_board_c_bcd01269____REVSH|
#line 482
|__asm___7_board_c_bcd01269____REVSH| PROC
#line 483
revsh r0, r0
bx lr
ENDP
;*** End embedded assembler ***

View File

@ -0,0 +1,192 @@
; 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\demo_hal_crc.o --asm_dir=.\Listings\ --list_dir=.\Listings\ --depend=.\objects\demo_hal_crc.d --cpu=Cortex-M0 --apcs=interwork -O0 --diag_suppress=9931 -I..\..\src -I..\..\src\board -I..\..\src\common -I..\..\src\sdk\include -I..\..\src\sdk\include\M0 -I..\..\src\app -I..\..\src\app\S8 -I..\..\src\app\touch -I..\..\src\app\module_demo -I..\..\src\app\Mi12Lite -I.\RTE\_WL668 -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\CMSIS\Core\Include -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\Device\ARM\ARMCM0\Include -D__MICROLIB -D__UVISION_VERSION=528 -D_RTE_ -DARMCM0 --omf_browse=.\objects\demo_hal_crc.crf ..\..\src\app\module_demo\demo_hal_crc.c]
THUMB
AREA ||i.demo_crc_array_dma_cal||, CODE, READONLY, ALIGN=2
demo_crc_array_dma_cal PROC
;;;76 */
;;;77 bool demo_crc_array_dma_cal(void)
000000 b50e PUSH {r1-r3,lr}
;;;78 {
;;;79 crc_ctrl_handle_t crc_cfg_para =
000002 4a07 LDR r2,|L1.32|
000004 ca07 LDM r2,{r0-r2}
000006 466b MOV r3,sp
000008 c307 STM r3!,{r0-r2}
;;;80 {
;;;81 CRC_32_POL_VALUE0,
;;;82 CRC_SEED_VALUE_0,
;;;83 CRC_32_BIT_PROTOCOL,
;;;84 CRC_FXOR_ENABLE,
;;;85 CRC_REV_ONLY_BITS_TRANSPOSE,
;;;86 CRC_REV_ONLY_BITS_TRANSPOSE
;;;87 };
;;;88
;;;89 hal_crc_dma_init(&crc_cfg_para, demo_crc_dma_callback, sg_crc32_arry, CRC_ELEMENT_MAX_TATOL);
00000a 2320 MOVS r3,#0x20
00000c 4a05 LDR r2,|L1.36|
00000e 4906 LDR r1,|L1.40|
000010 4668 MOV r0,sp
000012 f7fffffe BL hal_crc_dma_init
;;;90
;;;91 hal_crc_dma_start();
000016 f7fffffe BL hal_crc_dma_start
;;;92
;;;93 return true;
00001a 2001 MOVS r0,#1
;;;94 }
00001c bd0e POP {r1-r3,pc}
;;;95 #else
ENDP
00001e 0000 DCW 0x0000
|L1.32|
DCD ||.constdata||
|L1.36|
DCD sg_crc32_arry
|L1.40|
DCD demo_crc_dma_callback
AREA ||i.demo_crc_dma_callback||, CODE, READONLY, ALIGN=2
demo_crc_dma_callback PROC
;;;66 */
;;;67 void demo_crc_dma_callback(uint32_t calculate_result)
000000 b538 PUSH {r3-r5,lr}
;;;68 {
000002 4604 MOV r4,r0
;;;69 TAU_LOGD("dma demo[0x%x]\n", calculate_result);
000004 bf00 NOP
000006 2345 MOVS r3,#0x45
000008 a203 ADR r2,|L2.24|
00000a a105 ADR r1,|L2.32|
00000c 2000 MOVS r0,#0
00000e 9400 STR r4,[sp,#0]
000010 f7fffffe BL tau_log_printf
000014 bf00 NOP
;;;70 }
000016 bd38 POP {r3-r5,pc}
;;;71
ENDP
|L2.24|
000018 6372632d DCB "crc-log",0
00001c 6c6f6700
|L2.32|
000020 5b25735d DCB "[%s] (%04d) dma demo[0x%x]\n",0
000024 20282530
000028 34642920
00002c 646d6120
000030 64656d6f
000034 5b307825
000038 785d0a00
AREA ||i.demo_hal_crc_case||, CODE, READONLY, ALIGN=2
demo_hal_crc_case PROC
;;;125 */
;;;126 void demo_hal_crc_case(void)
000000 b510 PUSH {r4,lr}
;;;127 {
;;;128 TAU_LOGD("HAL CRC DEMO.\n");
000002 bf00 NOP
000004 2380 MOVS r3,#0x80
000006 a204 ADR r2,|L3.24|
000008 a105 ADR r1,|L3.32|
00000a 2000 MOVS r0,#0
00000c f7fffffe BL tau_log_printf
000010 bf00 NOP
;;;129
;;;130 #if CRC_DMA_CAL_EN
;;;131 demo_crc_array_dma_cal(); // DMA方式计算
000012 f7fffffe BL demo_crc_array_dma_cal
;;;132 #else
;;;133 demo_crc_array_cal(); // CPU方式计算
;;;134 #endif
;;;135
;;;136 }
000016 bd10 POP {r4,pc}
;;;137
ENDP
|L3.24|
000018 6372632d DCB "crc-log",0
00001c 6c6f6700
|L3.32|
000020 5b25735d DCB "[%s] (%04d) HAL CRC DEMO.\n",0
000024 20282530
000028 34642920
00002c 48414c20
000030 43524320
000034 44454d4f
000038 2e0a00
00003b 00 DCB 0
AREA ||.constdata||, DATA, READONLY, ALIGN=2
DCD 0x04c11db7
DCD 0x00000000
000008 01010101 DCB 0x01,0x01,0x01,0x01
AREA ||.data||, DATA, ALIGN=2
sg_crc32_arry
DCD 0x00000000
DCD 0xffffffff
DCD 0xaaaaaaaa
DCD 0xeeeeeeee
DCD 0x55555555
DCD 0x66666666
DCD 0x11111111
DCD 0x77777777
DCD 0x12345678
DCD 0x456789ab
DCD 0x89abcdef
DCD 0x3456789a
DCD 0x6789abcd
DCD 0x9abcdef0
DCD 0xbcdef012
DCD 0xfedcab98
DCD 0x5a5aa5a5
DCD 0x37377373
DCD 0x98988989
DCD 0x76767676
DCD 0x41233214
DCD 0x67433467
DCD 0x91df91df
DCD 0x76347634
DCD 0x46378912
DCD 0x57351059
DCD 0xabfc9483
DCD 0x837204af
DCD 0x41057dba
DCD 0x893cd024
DCD 0x56378105
DCD 0xfa34610b
;*** Start embedded assembler ***
#line 1 "..\\..\\src\\app\\module_demo\\demo_hal_crc.c"
AREA ||.rev16_text||, CODE
THUMB
EXPORT |__asm___14_demo_hal_crc_c_aac8fc6c____REV16|
#line 467 "C:\\Keil_v5\\ARM\\PACK\\ARM\\CMSIS\\5.5.1\\CMSIS\\Core\\Include\\cmsis_armcc.h"
|__asm___14_demo_hal_crc_c_aac8fc6c____REV16| PROC
#line 468
rev16 r0, r0
bx lr
ENDP
AREA ||.revsh_text||, CODE
THUMB
EXPORT |__asm___14_demo_hal_crc_c_aac8fc6c____REVSH|
#line 482
|__asm___14_demo_hal_crc_c_aac8fc6c____REVSH| PROC
#line 483
revsh r0, r0
bx lr
ENDP
;*** End embedded assembler ***

View File

@ -0,0 +1,576 @@
; 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\demo_hal_dsi_rx.o --asm_dir=.\Listings\ --list_dir=.\Listings\ --depend=.\objects\demo_hal_dsi_rx.d --cpu=Cortex-M0 --apcs=interwork -O0 --diag_suppress=9931 -I..\..\src -I..\..\src\board -I..\..\src\common -I..\..\src\sdk\include -I..\..\src\sdk\include\M0 -I..\..\src\app -I..\..\src\app\S8 -I..\..\src\app\touch -I..\..\src\app\module_demo -I..\..\src\app\Mi12Lite -I.\RTE\_WL668 -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\CMSIS\Core\Include -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\Device\ARM\ARMCM0\Include -D__MICROLIB -D__UVISION_VERSION=528 -D_RTE_ -DARMCM0 --omf_browse=.\objects\demo_hal_dsi_rx.crf ..\..\src\app\module_demo\demo_hal_dsi_rx.c]
THUMB
AREA ||i.ap_dcs_read||, CODE, READONLY, ALIGN=2
ap_dcs_read PROC
;;;79
;;;80 static bool ap_dcs_read(uint8_t data_type, uint8_t dcs_cmd, uint8_t param)
000000 b5f0 PUSH {r4-r7,lr}
;;;81 {
000002 b0b7 SUB sp,sp,#0xdc
000004 4606 MOV r6,r0
000006 460c MOV r4,r1
000008 4617 MOV r7,r2
;;;82 if (dcs_cmd == 0xaa)
00000a 2caa CMP r4,#0xaa
00000c d10b BNE |L1.38|
;;;83 {
;;;84 uint8_t cmd[] = {DSI_ACK_DT_DCS_LONG_RESPONSE,
00000e 22d8 MOVS r2,#0xd8
000010 491c LDR r1,|L1.132|
000012 a801 ADD r0,sp,#4
000014 f7fffffe BL __aeabi_memcpy4
;;;85 212, 0, 1,
;;;86 0x21, 0x07, 0x2C, 0x27, 0x2B, 0x7A, 0x78, 0x7A,
;;;87 0x7D, 0x7D, 0x7E, 0x7F, 0x7E, 0x7E, 0x7F, 0x7F,
;;;88 0x71, 0xE8, 0x36, 0x2A, 0x2E, 0x07, 0x89, 0x17,
;;;89 0x8B, 0x84, 0x28, 0x26, 0x6D, 0xEB, 0x12, 0x34,
;;;90 0x79, 0x78, 0x79, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C,
;;;91 0x7D, 0x7D, 0x7E, 0x7F, 0x7E, 0x7E, 0x7F, 0x7F,
;;;92 0x7C, 0x67, 0x6E, 0x6c, 0x8A, 0x5B, 0x71, 0x00,
;;;93 0x7D, 0x7D, 0x7E, 0x7F, 0x7E, 0x7E, 0x7F, 0x7F,
;;;94 0x7d, 0x68, 0x61, 0xd9, 0x1A, 0x5B, 0xa7, 0x00,
;;;95 0x7D, 0x7D, 0x7E, 0x7F, 0x7E, 0x7E, 0x7F, 0x7F,
;;;96 0x7e, 0x69, 0x63, 0xe9, 0x3c, 0x5B, 0xfE, 0x00,
;;;97 0x7D, 0x7D, 0x7E, 0x7F, 0x7E, 0x7E, 0x7F, 0x7F,
;;;98 0x7f, 0x60, 0x3E, 0x6f, 0x9b, 0x5B, 0x45, 0x00,
;;;99 0x7D, 0x7D, 0x7E, 0x7F, 0x7E, 0x7E, 0x7F, 0x7F,
;;;100 0x70, 0x61, 0x4E, 0xc9, 0xdA, 0x5B, 0x69, 0x00,
;;;101 0x7D, 0x7D, 0x7E, 0x7F, 0x7E, 0x7E, 0x7F, 0x7F,
;;;102 0x71, 0x63, 0xaE, 0x88, 0x0A, 0x5B, 0x30, 0x00,
;;;103 0x12, 0x34, 0x56, 0x78, 0x9a, 0xab, 0xcd, 0xef,
;;;104 0x11, 0x22, 0x33, 0x44, 0x0A, 0x5B, 0x30, 0x00,
;;;105 0x12, 0x34, 0x56, 0x78, 0x9a, 0xab, 0xcd, 0xef,
;;;106 0x7f, 0x60, 0x3E, 0x6f, 0x9b, 0x5B, 0x45, 0x00,
;;;107 0x7D, 0x7D, 0x7E, 0x7F, 0x7E, 0x7E, 0x7F, 0x7F,
;;;108 0x7f, 0x60, 0x3E, 0x6f, 0x9b, 0x5B, 0x45, 0x00,
;;;109 0x7D, 0x7D, 0x7E, 0x7F, 0x7E, 0x7E, 0x7F, 0x7F,
;;;110 0x71, 0xE8, 0x36, 0x2A, 0x2E, 0x07, 0x89, 0x17,
;;;111 0x8B, 0x84, 0x28, 0x26, 0x6D, 0xEB, 0x12, 0x34,
;;;112 0x11, 0x22, 0x33, 0x44
;;;113 };
;;;114 /*长包超128字节发送*/
;;;115 hal_dsi_rx_ctrl_ack_long_cmd(g_rx_ctrl_handle, sizeof(cmd) / sizeof(uint8_t), cmd);
000018 aa01 ADD r2,sp,#4
00001a 21d8 MOVS r1,#0xd8
00001c 481a LDR r0,|L1.136|
00001e 6800 LDR r0,[r0,#0] ; g_rx_ctrl_handle
000020 f7fffffe BL hal_dsi_rx_ctrl_ack_long_cmd
;;;116 }
000024 e022 B |L1.108|
|L1.38|
;;;117 else if (dcs_cmd == 0xFE)
000026 2cfe CMP r4,#0xfe
000028 d120 BNE |L1.108|
;;;118 {
;;;119 uint16_t return_size;
;;;120 return_size = hal_dsi_rx_ctrl_get_max_ret_size(g_rx_ctrl_handle);
00002a 4817 LDR r0,|L1.136|
00002c 6800 LDR r0,[r0,#0] ; g_rx_ctrl_handle
00002e f7fffffe BL hal_dsi_rx_ctrl_get_max_ret_size
000032 b285 UXTH r5,r0
;;;121 if (return_size == 3)
000034 2d03 CMP r5,#3
000036 d10a BNE |L1.78|
;;;122 {
;;;123 uint8_t cmd[] = {DSI_ACK_DT_DCS_LONG_RESPONSE, 3, 0, 1, 0x40, 0x00, 0x03};
000038 a114 ADR r1,|L1.140|
00003a c903 LDM r1,{r0,r1}
00003c 9136 STR r1,[sp,#0xd8]
00003e 9035 STR r0,[sp,#0xd4]
;;;124
;;;125 hal_dsi_rx_ctrl_ack_long_cmd(g_rx_ctrl_handle, sizeof(cmd) / sizeof(uint8_t), cmd);
000040 aa35 ADD r2,sp,#0xd4
000042 2107 MOVS r1,#7
000044 4810 LDR r0,|L1.136|
000046 6800 LDR r0,[r0,#0] ; g_rx_ctrl_handle
000048 f7fffffe BL hal_dsi_rx_ctrl_ack_long_cmd
;;;126 }
00004c e00d B |L1.106|
|L1.78|
;;;127 else if (return_size == 32)
00004e 2d20 CMP r5,#0x20
000050 d10b BNE |L1.106|
;;;128 {
;;;129
;;;130 uint8_t cmd[] = {DSI_ACK_DT_DCS_LONG_RESPONSE,
000052 2224 MOVS r2,#0x24
000054 a10f ADR r1,|L1.148|
000056 a82e ADD r0,sp,#0xb8
000058 f7fffffe BL __aeabi_memcpy4
;;;131 32, 0, 1, 0x01, 0xc4, 0x01, 0xcd, 0x01, 0xfb, 0x55, 0x55,
;;;132 0x55, 0x4e, 0x4c, 0x4e, 0x2e, 0x2d, 0x31, 0x30,
;;;133 0x30, 0x38, 0x49, 0x42, 0x49, 0x3c, 0x39, 0x47,
;;;134 0x01, 0x07, 0x2b, 0xfa, 0x22, 0x19, 0x32, 0x02
;;;135 };
;;;136
;;;137 hal_dsi_rx_ctrl_ack_long_cmd(g_rx_ctrl_handle, sizeof(cmd) / sizeof(uint8_t), cmd);
00005c aa2e ADD r2,sp,#0xb8
00005e 2124 MOVS r1,#0x24
000060 4809 LDR r0,|L1.136|
000062 6800 LDR r0,[r0,#0] ; g_rx_ctrl_handle
000064 f7fffffe BL hal_dsi_rx_ctrl_ack_long_cmd
;;;138 }
000068 bf00 NOP
|L1.106|
;;;139 }
00006a bf00 NOP
|L1.108|
;;;140
;;;141 TAU_LOGD("r %x\n", dcs_cmd);
00006c bf00 NOP
00006e 238d MOVS r3,#0x8d
000070 a211 ADR r2,|L1.184|
000072 a115 ADR r1,|L1.200|
000074 2000 MOVS r0,#0
000076 9400 STR r4,[sp,#0]
000078 f7fffffe BL tau_log_printf
00007c bf00 NOP
;;;142 return true;
00007e 2001 MOVS r0,#1
;;;143 }
000080 b037 ADD sp,sp,#0xdc
000082 bdf0 POP {r4-r7,pc}
;;;144
ENDP
|L1.132|
DCD ||.constdata||+0x18
|L1.136|
DCD g_rx_ctrl_handle
|L1.140|
00008c 1c0300 DCB 28,3,0
00008f 014000 DCB 1,"@",0
000092 0300 DCB 3,0
|L1.148|
000094 1c2000 DCB 28," ",0
000097 0101c401 DCB 1,1,196,1,205,1,251,"UUUNLN.-1008IBI<9G",1,"\a+",250,""""
00009b cd01fb55
00009f 55554e4c
0000a3 4e2e2d31
0000a7 30303849
0000ab 42493c39
0000af 4701072b
0000b3 fa22
0000b5 193202 DCB 25,"2",2
|L1.184|
0000b8 64656d6f DCB "demo_hal_dsi_rx",0
0000bc 5f68616c
0000c0 5f647369
0000c4 5f727800
|L1.200|
0000c8 5b25735d DCB "[%s] (%04d) r %x\n",0
0000cc 20282530
0000d0 34642920
0000d4 72202578
0000d8 0a00
0000da 00 DCB 0
0000db 00 DCB 0
AREA ||i.cus_dsc_execute||, CODE, READONLY, ALIGN=2
cus_dsc_execute PROC
;;;49 //客制化DCS处理函数
;;;50 static bool cus_dsc_execute(hal_dsi_rx_ctrl_handle_t *handler, hal_dcs_packet_t *dcs_packet)
000000 b57c PUSH {r2-r6,lr}
;;;51 {
000002 4606 MOV r6,r0
000004 460c MOV r4,r1
;;;52 TAU_LOGD("cus_dsc_execute DCS[0x%x]\n", dcs_packet->dcs_command);
000006 bf00 NOP
000008 6860 LDR r0,[r4,#4]
00000a 2334 MOVS r3,#0x34
00000c a211 ADR r2,|L2.84|
00000e a115 ADR r1,|L2.100|
000010 9000 STR r0,[sp,#0]
000012 2000 MOVS r0,#0
000014 f7fffffe BL tau_log_printf
000018 bf00 NOP
;;;53 for (int i = 0; i < dcs_packet->param_length; i ++)
00001a 2500 MOVS r5,#0
00001c e00c B |L2.56|
|L2.30|
;;;54 {
;;;55 TAU_LOGD("cus_dsc_execute param[%d]:0x%x\n", i, dcs_packet->packet_param[i]);
00001e bf00 NOP
000020 68e0 LDR r0,[r4,#0xc]
000022 5d40 LDRB r0,[r0,r5]
000024 2337 MOVS r3,#0x37
000026 a20b ADR r2,|L2.84|
000028 a118 ADR r1,|L2.140|
00002a 9500 STR r5,[sp,#0]
00002c 9001 STR r0,[sp,#4]
00002e 2000 MOVS r0,#0
000030 f7fffffe BL tau_log_printf
000034 bf00 NOP
000036 1c6d ADDS r5,r5,#1 ;53
|L2.56|
000038 68a0 LDR r0,[r4,#8] ;53
00003a 42a8 CMP r0,r5 ;53
00003c d8ef BHI |L2.30|
;;;56 }
;;;57
;;;58 #if 0
;;;59 /* ack long cmd */
;;;60 hal_dsi_rx_ctrl_send_ack_cmd(g_rx_ctrl_handle,
;;;61 DSI_ACK_DT_GEN_LONG_RESPONSE,
;;;62 DSI_VC_0,
;;;63 5,
;;;64 0x1,
;;;65 0x2,
;;;66 0x3,
;;;67 0x4,
;;;68 0x5);
;;;69 #else
;;;70 /* ack short cmd */
;;;71 hal_dsi_rx_ctrl_send_ack_cmd(g_rx_ctrl_handle,
00003e 20c1 MOVS r0,#0xc1
000040 2301 MOVS r3,#1
000042 2200 MOVS r2,#0
000044 2121 MOVS r1,#0x21
000046 9000 STR r0,[sp,#0]
000048 481b LDR r0,|L2.184|
00004a 6800 LDR r0,[r0,#0] ; g_rx_ctrl_handle
00004c f7fffffe BL hal_dsi_rx_ctrl_send_ack_cmd
;;;72 DSI_ACK_DT_DCS_SHORT_RESPONSE_1B,
;;;73 DSI_VC_0,
;;;74 1,
;;;75 0xC1);
;;;76 #endif
;;;77 return true;
000050 2001 MOVS r0,#1
;;;78 }
000052 bd7c POP {r2-r6,pc}
;;;79
ENDP
|L2.84|
000054 64656d6f DCB "demo_hal_dsi_rx",0
000058 5f68616c
00005c 5f647369
000060 5f727800
|L2.100|
000064 5b25735d DCB "[%s] (%04d) cus_dsc_execute DCS[0x%x]\n",0
000068 20282530
00006c 34642920
000070 6375735f
000074 6473635f
000078 65786563
00007c 75746520
000080 4443535b
000084 30782578
000088 5d0a00
00008b 00 DCB 0
|L2.140|
00008c 5b25735d DCB "[%s] (%04d) cus_dsc_execute param[%d]:0x%x\n",0
000090 20282530
000094 34642920
000098 6375735f
00009c 6473635f
0000a0 65786563
0000a4 75746520
0000a8 70617261
0000ac 6d5b2564
0000b0 5d3a3078
0000b4 25780a00
|L2.184|
DCD g_rx_ctrl_handle
AREA ||i.demo_hal_dsi_rx_case||, CODE, READONLY, ALIGN=2
demo_hal_dsi_rx_case PROC
;;;203 */
;;;204 void demo_hal_dsi_rx_case()
000000 f7fffffe BL open_mipi_rx
;;;205 {
;;;206 open_mipi_rx();
;;;207 TAU_LOGD("open_mipi_rx done !\n");
000004 bf00 NOP
000006 23cf MOVS r3,#0xcf
000008 a205 ADR r2,|L3.32|
00000a a109 ADR r1,|L3.48|
00000c 2000 MOVS r0,#0
00000e f7fffffe BL tau_log_printf
000012 bf00 NOP
;;;208 while (1)
000014 e003 B |L3.30|
|L3.22|
;;;209 {
;;;210 hal_dsi_rx_ctrl_dcs_async_handler(g_rx_ctrl_handle);
000016 480f LDR r0,|L3.84|
000018 6800 LDR r0,[r0,#0] ; g_rx_ctrl_handle
00001a f7fffffe BL hal_dsi_rx_ctrl_dcs_async_handler
|L3.30|
00001e e7fa B |L3.22|
;;;211 }
;;;212 }
ENDP
|L3.32|
000020 64656d6f DCB "demo_hal_dsi_rx",0
000024 5f68616c
000028 5f647369
00002c 5f727800
|L3.48|
000030 5b25735d DCB "[%s] (%04d) open_mipi_rx done !\n",0
000034 20282530
000038 34642920
00003c 6f70656e
000040 5f6d6970
000044 695f7278
000048 2020646f
00004c 6e652021
000050 0a00
000052 00 DCB 0
000053 00 DCB 0
|L3.84|
DCD g_rx_ctrl_handle
AREA ||i.open_mipi_rx||, CODE, READONLY, ALIGN=2
open_mipi_rx PROC
;;;151
;;;152 static void open_mipi_rx()
000000 b510 PUSH {r4,lr}
;;;153 {
;;;154 if (g_rx_ctrl_handle == NULL)
000002 482d LDR r0,|L4.184|
000004 6800 LDR r0,[r0,#0] ; g_rx_ctrl_handle
000006 2800 CMP r0,#0
000008 d103 BNE |L4.18|
;;;155 {
;;;156 g_rx_ctrl_handle = hal_dsi_rx_ctrl_create_handle();
00000a f7fffffe BL hal_dsi_rx_ctrl_create_handle
00000e 492a LDR r1,|L4.184|
000010 6008 STR r0,[r1,#0] ; g_rx_ctrl_handle
|L4.18|
;;;157 }
;;;158
;;;159 g_rx_ctrl_handle->base_info.src_w = INPUT_WIDTH;
000012 202d MOVS r0,#0x2d
000014 0100 LSLS r0,r0,#4
000016 4928 LDR r1,|L4.184|
000018 6809 LDR r1,[r1,#0] ; g_rx_ctrl_handle
00001a 6008 STR r0,[r1,#0]
;;;160 g_rx_ctrl_handle->base_info.src_h = INPUT_HEIGHT;
00001c 2005 MOVS r0,#5
00001e 0200 LSLS r0,r0,#8
000020 4925 LDR r1,|L4.184|
000022 6809 LDR r1,[r1,#0] ; g_rx_ctrl_handle
000024 6048 STR r0,[r1,#4]
;;;161 g_rx_ctrl_handle->base_info.dst_w = OUTPUT_WIDTH;
000026 202d MOVS r0,#0x2d
000028 0100 LSLS r0,r0,#4
00002a 4923 LDR r1,|L4.184|
00002c 6809 LDR r1,[r1,#0] ; g_rx_ctrl_handle
00002e 6088 STR r0,[r1,#8]
;;;162 g_rx_ctrl_handle->base_info.dst_h = OUTPUT_HEIGHT;
000030 2005 MOVS r0,#5
000032 0200 LSLS r0,r0,#8
000034 4920 LDR r1,|L4.184|
000036 6809 LDR r1,[r1,#0] ; g_rx_ctrl_handle
000038 60c8 STR r0,[r1,#0xc]
;;;163 g_rx_ctrl_handle->base_info.src_frate = INPUT_FRAME_RATE;
00003a 2000 MOVS r0,#0
00003c 491e LDR r1,|L4.184|
00003e 6809 LDR r1,[r1,#0] ; g_rx_ctrl_handle
000040 7408 STRB r0,[r1,#0x10]
;;;164 g_rx_ctrl_handle->base_info.src_mode = INPUT_DATA_MODE;
000042 491d LDR r1,|L4.184|
000044 6809 LDR r1,[r1,#0] ; g_rx_ctrl_handle
000046 7448 STRB r0,[r1,#0x11]
;;;165 g_rx_ctrl_handle->rx_color_mode = INPUT_COLOR_MODE;
000048 2104 MOVS r1,#4
00004a 481b LDR r0,|L4.184|
00004c 6800 LDR r0,[r0,#0] ; g_rx_ctrl_handle
00004e 3020 ADDS r0,r0,#0x20
000050 7401 STRB r1,[r0,#0x10]
;;;166 g_rx_ctrl_handle->rx_lanes = INPUT_MIPI_LANE_NUM;
000052 4819 LDR r0,|L4.184|
000054 6800 LDR r0,[r0,#0] ; g_rx_ctrl_handle
000056 3020 ADDS r0,r0,#0x20
000058 7441 STRB r1,[r0,#0x11]
;;;167 g_rx_ctrl_handle->rx_nonburst_models = INPUT_VIDEO_MODEL;
00005a 2101 MOVS r1,#1
00005c 4816 LDR r0,|L4.184|
00005e 6800 LDR r0,[r0,#0] ; g_rx_ctrl_handle
000060 3020 ADDS r0,r0,#0x20
000062 7481 STRB r1,[r0,#0x12]
;;;168 g_rx_ctrl_handle->compress_en = INPUT_COMPRESS;
000064 2100 MOVS r1,#0
000066 4814 LDR r0,|L4.184|
000068 6800 LDR r0,[r0,#0] ; g_rx_ctrl_handle
00006a 3020 ADDS r0,r0,#0x20
00006c 74c1 STRB r1,[r0,#0x13]
;;;169 g_rx_ctrl_handle->rx_hsclk_rate = INPUT_MIPI_LANE_RATE;
00006e 4813 LDR r0,|L4.188|
000070 4911 LDR r1,|L4.184|
000072 6809 LDR r1,[r1,#0] ; g_rx_ctrl_handle
000074 6348 STR r0,[r1,#0x34]
;;;170 g_rx_ctrl_handle->extra_info.flow_control_mode = FC_AUTO_MODE;
000076 2100 MOVS r1,#0
000078 480f LDR r0,|L4.184|
00007a 6800 LDR r0,[r0,#0] ; g_rx_ctrl_handle
00007c 76c1 STRB r1,[r0,#0x1b]
;;;171 g_rx_ctrl_handle->cus_dcs_entry_table = g_cus_rx_dcs_execute_table;
00007e 4910 LDR r1,|L4.192|
000080 480d LDR r0,|L4.184|
000082 6800 LDR r0,[r0,#0] ; g_rx_ctrl_handle
000084 3080 ADDS r0,r0,#0x80
000086 6381 STR r1,[r0,#0x38]
;;;172 g_rx_ctrl_handle->rx_dcs_read_entry = ap_dcs_read;
000088 490e LDR r1,|L4.196|
00008a 480b LDR r0,|L4.184|
00008c 6800 LDR r0,[r0,#0] ; g_rx_ctrl_handle
00008e 3080 ADDS r0,r0,#0x80
000090 63c1 STR r1,[r0,#0x3c]
;;;173
;;;174 /*PIN28~PIN19依次为21c03*/
;;;175 g_rx_ctrl_handle->rx_lane_swap = RX_LANE_SWAP_2103;
000092 2102 MOVS r1,#2
000094 4808 LDR r0,|L4.184|
000096 6800 LDR r0,[r0,#0] ; g_rx_ctrl_handle
000098 30c0 ADDS r0,r0,#0xc0
00009a 7201 STRB r1,[r0,#8]
;;;176
;;;177 /* 对 lane0~lane3 以及clk lane 进行PN交换*/
;;;178 g_rx_ctrl_handle->base_info.pn_swap = RX_LANE_0_PN_SWAP | RX_LANE_1_PN_SWAP | RX_LANE_2_PN_SWAP | RX_LANE_3_PN_SWAP | RX_LANE_CLK_PN_SWAP;
00009c 201f MOVS r0,#0x1f
00009e 4906 LDR r1,|L4.184|
0000a0 6809 LDR r1,[r1,#0] ; g_rx_ctrl_handle
0000a2 8288 STRH r0,[r1,#0x14]
;;;179
;;;180 if (g_rx_ctrl_handle->compress_en == true)
;;;181 {
;;;182 //hal_dsi_rx_ctrl_pre_init_pps(g_rx_ctrl_handle, pps, 128);
;;;183 }
;;;184 hal_dsi_rx_ctrl_init(g_rx_ctrl_handle);
0000a4 4804 LDR r0,|L4.184|
0000a6 6800 LDR r0,[r0,#0] ; g_rx_ctrl_handle
0000a8 f7fffffe BL hal_dsi_rx_ctrl_init
;;;185 #if 0
;;;186 //使用盒子发送读命令 0xA,0xB,0xC,0xD,0xE,0xF,0x1E,0x1D
;;;187 hal_dsi_rx_ctrl_set_auto_ack(g_rx_ctrl_handle, HAL_RX_QRESP_CODE0, DSI_ACK_DT_DCS_SHORT_RESPONSE_1B, 0x0F, 1, 0xab);
;;;188 hal_dsi_rx_ctrl_set_auto_ack(g_rx_ctrl_handle, HAL_RX_QRESP_CODE1, DSI_ACK_DT_DCS_SHORT_RESPONSE_2B, 0x0e, 2, 0xef, 0xcd);
;;;189 hal_dsi_rx_ctrl_set_auto_ack(g_rx_ctrl_handle, HAL_RX_QRESP_CODE2, DSI_ACK_DT_GEN_SHORT_RESPONSE_1B, 0x0a, 1, 0x12);
;;;190 hal_dsi_rx_ctrl_set_auto_ack(g_rx_ctrl_handle, HAL_RX_QRESP_CODE3, DSI_ACK_DT_GEN_SHORT_RESPONSE_2B, 0x0b, 2, 0x34, 0x56);
;;;191 hal_dsi_rx_ctrl_set_auto_ack(g_rx_ctrl_handle, HAL_RX_QRESP_CODE4, DSI_ACK_DT_DCS_LONG_RESPONSE, 0x0c, 4, 0x12, 0x34, 0x56, 0x78);
;;;192 hal_dsi_rx_ctrl_set_auto_ack(g_rx_ctrl_handle, HAL_RX_QRESP_CODE5, DSI_ACK_DT_GEN_LONG_RESPONSE, 0x0d, 4, 0xab, 0xcd, 0xef, 0x9a);
;;;193 hal_dsi_rx_ctrl_set_auto_ack(g_rx_ctrl_handle, HAL_RX_QRESP_CODE6, DSI_ACK_DT_GEN_LONG_RESPONSE, 0x1e, 8, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8);
;;;194 hal_dsi_rx_ctrl_set_auto_ack(g_rx_ctrl_handle, HAL_RX_QRESP_CODE7, DSI_ACK_DT_DCS_LONG_RESPONSE, 0x1d, 8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10);
;;;195 #endif
;;;196 hal_dsi_rx_ctrl_start(g_rx_ctrl_handle);
0000ac 4802 LDR r0,|L4.184|
0000ae 6800 LDR r0,[r0,#0] ; g_rx_ctrl_handle
0000b0 f7fffffe BL hal_dsi_rx_ctrl_start
;;;197 }
0000b4 bd10 POP {r4,pc}
;;;198
ENDP
0000b6 0000 DCW 0x0000
|L4.184|
DCD g_rx_ctrl_handle
|L4.188|
DCD 0x1cab7a40
|L4.192|
DCD g_cus_rx_dcs_execute_table
|L4.196|
DCD ap_dcs_read
AREA ||.constdata||, DATA, READONLY, ALIGN=2
g_cus_rx_dcs_execute_table
DCD 0x00000083
DCD cus_dsc_execute
000008 00000000 DCB 0x00,0x00,0x00,0x00
DCD 0x00000000
DCD 0x00000000
000014 00000000 DCB 0x00,0x00,0x00,0x00
000018 1cd40001 DCB 0x1c,0xd4,0x00,0x01
00001c 21072c27 DCB 0x21,0x07,0x2c,0x27
000020 2b7a787a DCB 0x2b,0x7a,0x78,0x7a
000024 7d7d7e7f DCB 0x7d,0x7d,0x7e,0x7f
000028 7e7e7f7f DCB 0x7e,0x7e,0x7f,0x7f
00002c 71e8362a DCB 0x71,0xe8,0x36,0x2a
000030 2e078917 DCB 0x2e,0x07,0x89,0x17
000034 8b842826 DCB 0x8b,0x84,0x28,0x26
000038 6deb1234 DCB 0x6d,0xeb,0x12,0x34
00003c 7978797c DCB 0x79,0x78,0x79,0x7c
000040 7c7c7c7c DCB 0x7c,0x7c,0x7c,0x7c
000044 7d7d7e7f DCB 0x7d,0x7d,0x7e,0x7f
000048 7e7e7f7f DCB 0x7e,0x7e,0x7f,0x7f
00004c 7c676e6c DCB 0x7c,0x67,0x6e,0x6c
000050 8a5b7100 DCB 0x8a,0x5b,0x71,0x00
000054 7d7d7e7f DCB 0x7d,0x7d,0x7e,0x7f
000058 7e7e7f7f DCB 0x7e,0x7e,0x7f,0x7f
00005c 7d6861d9 DCB 0x7d,0x68,0x61,0xd9
000060 1a5ba700 DCB 0x1a,0x5b,0xa7,0x00
000064 7d7d7e7f DCB 0x7d,0x7d,0x7e,0x7f
000068 7e7e7f7f DCB 0x7e,0x7e,0x7f,0x7f
00006c 7e6963e9 DCB 0x7e,0x69,0x63,0xe9
000070 3c5bfe00 DCB 0x3c,0x5b,0xfe,0x00
000074 7d7d7e7f DCB 0x7d,0x7d,0x7e,0x7f
000078 7e7e7f7f DCB 0x7e,0x7e,0x7f,0x7f
00007c 7f603e6f DCB 0x7f,0x60,0x3e,0x6f
000080 9b5b4500 DCB 0x9b,0x5b,0x45,0x00
000084 7d7d7e7f DCB 0x7d,0x7d,0x7e,0x7f
000088 7e7e7f7f DCB 0x7e,0x7e,0x7f,0x7f
00008c 70614ec9 DCB 0x70,0x61,0x4e,0xc9
000090 da5b6900 DCB 0xda,0x5b,0x69,0x00
000094 7d7d7e7f DCB 0x7d,0x7d,0x7e,0x7f
000098 7e7e7f7f DCB 0x7e,0x7e,0x7f,0x7f
00009c 7163ae88 DCB 0x71,0x63,0xae,0x88
0000a0 0a5b3000 DCB 0x0a,0x5b,0x30,0x00
0000a4 12345678 DCB 0x12,0x34,0x56,0x78
0000a8 9aabcdef DCB 0x9a,0xab,0xcd,0xef
0000ac 11223344 DCB 0x11,0x22,0x33,0x44
0000b0 0a5b3000 DCB 0x0a,0x5b,0x30,0x00
0000b4 12345678 DCB 0x12,0x34,0x56,0x78
0000b8 9aabcdef DCB 0x9a,0xab,0xcd,0xef
0000bc 7f603e6f DCB 0x7f,0x60,0x3e,0x6f
0000c0 9b5b4500 DCB 0x9b,0x5b,0x45,0x00
0000c4 7d7d7e7f DCB 0x7d,0x7d,0x7e,0x7f
0000c8 7e7e7f7f DCB 0x7e,0x7e,0x7f,0x7f
0000cc 7f603e6f DCB 0x7f,0x60,0x3e,0x6f
0000d0 9b5b4500 DCB 0x9b,0x5b,0x45,0x00
0000d4 7d7d7e7f DCB 0x7d,0x7d,0x7e,0x7f
0000d8 7e7e7f7f DCB 0x7e,0x7e,0x7f,0x7f
0000dc 71e8362a DCB 0x71,0xe8,0x36,0x2a
0000e0 2e078917 DCB 0x2e,0x07,0x89,0x17
0000e4 8b842826 DCB 0x8b,0x84,0x28,0x26
0000e8 6deb1234 DCB 0x6d,0xeb,0x12,0x34
0000ec 11223344 DCB 0x11,0x22,0x33,0x44
AREA ||.data||, DATA, ALIGN=2
g_rx_ctrl_handle
DCD 0x00000000
;*** Start embedded assembler ***
#line 1 "..\\..\\src\\app\\module_demo\\demo_hal_dsi_rx.c"
AREA ||.rev16_text||, CODE
THUMB
EXPORT |__asm___17_demo_hal_dsi_rx_c_6471478a____REV16|
#line 467 "C:\\Keil_v5\\ARM\\PACK\\ARM\\CMSIS\\5.5.1\\CMSIS\\Core\\Include\\cmsis_armcc.h"
|__asm___17_demo_hal_dsi_rx_c_6471478a____REV16| PROC
#line 468
rev16 r0, r0
bx lr
ENDP
AREA ||.revsh_text||, CODE
THUMB
EXPORT |__asm___17_demo_hal_dsi_rx_c_6471478a____REVSH|
#line 482
|__asm___17_demo_hal_dsi_rx_c_6471478a____REVSH| PROC
#line 483
revsh r0, r0
bx lr
ENDP
;*** End embedded assembler ***

View File

@ -0,0 +1,691 @@
; 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\demo_hal_dsi_tx.o --asm_dir=.\Listings\ --list_dir=.\Listings\ --depend=.\objects\demo_hal_dsi_tx.d --cpu=Cortex-M0 --apcs=interwork -O0 --diag_suppress=9931 -I..\..\src -I..\..\src\board -I..\..\src\common -I..\..\src\sdk\include -I..\..\src\sdk\include\M0 -I..\..\src\app -I..\..\src\app\S8 -I..\..\src\app\touch -I..\..\src\app\module_demo -I..\..\src\app\Mi12Lite -I.\RTE\_WL668 -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\CMSIS\Core\Include -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\Device\ARM\ARMCM0\Include -D__MICROLIB -D__UVISION_VERSION=528 -D_RTE_ -DARMCM0 --omf_browse=.\objects\demo_hal_dsi_tx.crf ..\..\src\app\module_demo\demo_hal_dsi_tx.c]
THUMB
AREA ||i.demo_dsi_tx_case||, CODE, READONLY, ALIGN=2
demo_dsi_tx_case PROC
;;;365 */
;;;366 void demo_dsi_tx_case(void)
000000 bf00 NOP
;;;367 {
;;;368 TAU_LOGD("DSI TX DEMO.\n");
000002 23ff MOVS r3,#0xff
000004 3371 ADDS r3,r3,#0x71
000006 a206 ADR r2,|L1.32|
000008 a107 ADR r1,|L1.40|
00000a 2000 MOVS r0,#0
00000c f7fffffe BL tau_log_printf
000010 bf00 NOP
;;;369 demo_open_mipi_rx();
000012 f7fffffe BL demo_open_mipi_rx
;;;370 demo_open_mipi_tx();
000016 f7fffffe BL demo_open_mipi_tx
;;;371
;;;372 while (1)
00001a bf00 NOP
|L1.28|
00001c e7fe B |L1.28|
;;;373 {
;;;374 #if DEMO_BTA_HS_EN
;;;375 if (sg_bta_need_flag) //当需要进行BTA回读的时候置标志位等待Vporch阶段进行BTA回读获取有效数据
;;;376 {
;;;377 uint8_t bta_data = 0;
;;;378 if (hal_dsi_tx_ctrl_vporch_bta_opera(0x06, 0xDA, 1, &bta_data))
;;;379 {
;;;380 //Vporch阶段进行BTA回读获取到有效数据关闭本次回读流程
;;;381 sg_bta_need_flag = false;
;;;382 TAU_LOGD("hs bta[0x%x]\n", bta_data);
;;;383 }
;;;384 }
;;;385 #endif
;;;386 }
;;;387
;;;388 }
;;;389
ENDP
00001e 0000 DCW 0x0000
|L1.32|
000020 74782d6c DCB "tx-log",0
000024 6f6700
000027 00 DCB 0
|L1.40|
000028 5b25735d DCB "[%s] (%04d) DSI TX DEMO.\n",0
00002c 20282530
000030 34642920
000034 44534920
000038 54582044
00003c 454d4f2e
000040 0a00
000042 00 DCB 0
000043 00 DCB 0
AREA ||i.demo_open_mipi_rx||, CODE, READONLY, ALIGN=1
demo_open_mipi_rx PROC
;;;208 **/
;;;209 static void demo_open_mipi_rx(void)
000000 4770 BX lr
;;;210 {
;;;211 /*RX demo详细请参考demo_hal_dsi_rx*/
;;;212 #if DEMO_RX_GEN_PATTERN
;;;213 /* 创建rx ctrl handle */
;;;214 if (g_rx_ctrl_handle == NULL)
;;;215 {
;;;216 g_rx_ctrl_handle = hal_dsi_rx_ctrl_create_handle();
;;;217 }
;;;218 g_rx_ctrl_handle->base_info.src_w = INPUT_WIDTH;
;;;219 g_rx_ctrl_handle->base_info.src_h = INPUT_HEIGHT;
;;;220 g_rx_ctrl_handle->base_info.dst_w = __DPI_HACT;
;;;221 g_rx_ctrl_handle->base_info.dst_h = __DPI_VACT;
;;;222 g_rx_ctrl_handle->rx_hsclk_rate = INPUT_MIPI_LANE_RATE;
;;;223 g_rx_ctrl_handle->base_info.src_frate = INPUT_SRC_FRATE;
;;;224 g_rx_ctrl_handle->base_info.src_mode = DSI_INPUT_DATA_MODE;
;;;225 g_rx_ctrl_handle->rx_color_mode = INPUT_COLOR_MODE;
;;;226 g_rx_ctrl_handle->rx_lanes = INPUT_MIPI_LANE_NUM;
;;;227 g_rx_ctrl_handle->rx_nonburst_models = INPUT_VIDEO_MODEL;
;;;228
;;;229 /* 初始化rx ctrl */
;;;230 hal_dsi_rx_ctrl_init(g_rx_ctrl_handle);
;;;231
;;;232 /* 配置RX video pattern */
;;;233 hal_dsi_rx_ctrl_enable_test_pattern(g_rx_ctrl_handle, g_rx_pattern_sel, true, PATTERN_FPS);
;;;234
;;;235 /* 启动rx ctrl */
;;;236 hal_dsi_rx_ctrl_start(g_rx_ctrl_handle);
;;;237 #endif
;;;238
;;;239 }
;;;240
ENDP
AREA ||i.demo_open_mipi_tx||, CODE, READONLY, ALIGN=2
demo_open_mipi_tx PROC
;;;245 **/
;;;246 static void demo_open_mipi_tx(void)
000000 b500 PUSH {lr}
;;;247 {
000002 b087 SUB sp,sp,#0x1c
;;;248 /*创建TX实例*/
;;;249 if (g_tx_ctrl_handle == NULL)
000004 4853 LDR r0,|L3.340|
000006 6800 LDR r0,[r0,#0] ; g_tx_ctrl_handle
000008 2800 CMP r0,#0
00000a d103 BNE |L3.20|
;;;250 {
;;;251 g_tx_ctrl_handle = hal_dsi_tx_ctrl_create_handle();
00000c f7fffffe BL hal_dsi_tx_ctrl_create_handle
000010 4950 LDR r1,|L3.340|
000012 6008 STR r0,[r1,#0] ; g_tx_ctrl_handle
|L3.20|
;;;252 }
;;;253 g_tx_ctrl_handle->lane_num = _LANE_NUMBER;
000014 2104 MOVS r1,#4
000016 484f LDR r0,|L3.340|
000018 6800 LDR r0,[r0,#0] ; g_tx_ctrl_handle
00001a 3020 ADDS r0,r0,#0x20
00001c 7501 STRB r1,[r0,#0x14]
;;;254 g_tx_ctrl_handle->channel_id = VIRTUAL_CHANNEL;
00001e 2100 MOVS r1,#0
000020 484c LDR r0,|L3.340|
000022 6800 LDR r0,[r0,#0] ; g_tx_ctrl_handle
000024 3020 ADDS r0,r0,#0x20
000026 7601 STRB r1,[r0,#0x18]
;;;255 g_tx_ctrl_handle->vid_mode = OUTPUT_VID_SEL_MODE;
000028 2102 MOVS r1,#2
00002a 484a LDR r0,|L3.340|
00002c 6800 LDR r0,[r0,#0] ; g_tx_ctrl_handle
00002e 3020 ADDS r0,r0,#0x20
000030 7641 STRB r1,[r0,#0x19]
;;;256 g_tx_ctrl_handle->cmd_tx_type = _CMD_TYPE;
000032 2101 MOVS r1,#1
000034 4847 LDR r0,|L3.340|
000036 6800 LDR r0,[r0,#0] ; g_tx_ctrl_handle
000038 3020 ADDS r0,r0,#0x20
00003a 7681 STRB r1,[r0,#0x1a]
;;;257 g_tx_ctrl_handle->dpi_vsa = __DPI_VSA;
00003c 2010 MOVS r0,#0x10
00003e 4945 LDR r1,|L3.340|
000040 6809 LDR r1,[r1,#0] ; g_tx_ctrl_handle
000042 6188 STR r0,[r1,#0x18]
;;;258 g_tx_ctrl_handle->dpi_vbp = __DPI_VBP;
000044 4943 LDR r1,|L3.340|
000046 6809 LDR r1,[r1,#0] ; g_tx_ctrl_handle
000048 61c8 STR r0,[r1,#0x1c]
;;;259 g_tx_ctrl_handle->dpi_vfp = __DPI_VFP;
00004a 207b MOVS r0,#0x7b
00004c 4941 LDR r1,|L3.340|
00004e 6809 LDR r1,[r1,#0] ; g_tx_ctrl_handle
000050 6208 STR r0,[r1,#0x20]
;;;260 g_tx_ctrl_handle->dpi_hsa = __DPI_HSA;
000052 2006 MOVS r0,#6
000054 493f LDR r1,|L3.340|
000056 6809 LDR r1,[r1,#0] ; g_tx_ctrl_handle
000058 6248 STR r0,[r1,#0x24]
;;;261 g_tx_ctrl_handle->dpi_hbp = __DPI_HBP;
00005a 2012 MOVS r0,#0x12
00005c 493d LDR r1,|L3.340|
00005e 6809 LDR r1,[r1,#0] ; g_tx_ctrl_handle
000060 6288 STR r0,[r1,#0x28]
;;;262 g_tx_ctrl_handle->dpi_hfp = __DPI_HFP;
000062 2020 MOVS r0,#0x20
000064 493b LDR r1,|L3.340|
000066 6809 LDR r1,[r1,#0] ; g_tx_ctrl_handle
000068 62c8 STR r0,[r1,#0x2c]
;;;263 g_tx_ctrl_handle->base_info.src_w = INPUT_WIDTH;
00006a 202d MOVS r0,#0x2d
00006c 0140 LSLS r0,r0,#5
00006e 4939 LDR r1,|L3.340|
000070 6809 LDR r1,[r1,#0] ; g_tx_ctrl_handle
000072 6008 STR r0,[r1,#0]
;;;264 g_tx_ctrl_handle->base_info.src_h = INPUT_HEIGHT;
000074 20b9 MOVS r0,#0xb9
000076 0100 LSLS r0,r0,#4
000078 4936 LDR r1,|L3.340|
00007a 6809 LDR r1,[r1,#0] ; g_tx_ctrl_handle
00007c 6048 STR r0,[r1,#4]
;;;265 g_tx_ctrl_handle->base_info.dst_w = __DPI_HACT;
00007e 4836 LDR r0,|L3.344|
000080 4934 LDR r1,|L3.340|
000082 6809 LDR r1,[r1,#0] ; g_tx_ctrl_handle
000084 6088 STR r0,[r1,#8]
;;;266 g_tx_ctrl_handle->base_info.dst_h = __DPI_VACT;
000086 2015 MOVS r0,#0x15
000088 01c0 LSLS r0,r0,#7
00008a 4932 LDR r1,|L3.340|
00008c 6809 LDR r1,[r1,#0] ; g_tx_ctrl_handle
00008e 60c8 STR r0,[r1,#0xc]
;;;267 g_tx_ctrl_handle->base_info.src_frate = INPUT_SRC_FRATE;
000090 2000 MOVS r0,#0
000092 4930 LDR r1,|L3.340|
000094 6809 LDR r1,[r1,#0] ; g_tx_ctrl_handle
000096 7408 STRB r0,[r1,#0x10]
;;;268 g_tx_ctrl_handle->base_info.src_mode = DSI_INPUT_DATA_MODE;
000098 492e LDR r1,|L3.340|
00009a 6809 LDR r1,[r1,#0] ; g_tx_ctrl_handle
00009c 7448 STRB r0,[r1,#0x11]
;;;269 g_tx_ctrl_handle->base_info.dst_mode = DSI_OUTPUT_DATA_MODE;
00009e 492d LDR r1,|L3.340|
0000a0 6809 LDR r1,[r1,#0] ; g_tx_ctrl_handle
0000a2 7488 STRB r0,[r1,#0x12]
;;;270
;;;271 #if LCD_PT628_CSOT //RGBG玻璃匹配RGB Driver IC
;;;272 //remap规则参数 此款玻璃remapl_rule/remapr_rule使用同一规则 如果玻璃存在两个规则需要支持请定义两个数组分别配置remapl_rule/remapr_rule
;;;273 remap_rule_t remap_rule =
0000a4 2218 MOVS r2,#0x18
0000a6 a12d ADR r1,|L3.348|
0000a8 a801 ADD r0,sp,#4
0000aa f7fffffe BL __aeabi_memcpy4
;;;274 {
;;;275 9, 11, 12, 8, 7, 10, 4, 5, 6, 2, 1, 3,
;;;276 20, 19, 22, 21, 23, 24, 14, 13, 15, 16, 17, 18
;;;277 };
;;;278 g_tx_ctrl_handle->pentile_info.pentile_24b = true; // 是否RGB驱动IC搭配RGBG玻璃使用
0000ae 2101 MOVS r1,#1
0000b0 4828 LDR r0,|L3.340|
0000b2 6800 LDR r0,[r0,#0] ; g_tx_ctrl_handle
0000b4 303c ADDS r0,r0,#0x3c
0000b6 7081 STRB r1,[r0,#2]
;;;279 g_tx_ctrl_handle->pentile_info.pentile_reverse_en = true; // 是否需要使用芯片本身行反转功能
0000b8 4826 LDR r0,|L3.340|
0000ba 6800 LDR r0,[r0,#0] ; g_tx_ctrl_handle
0000bc 303c ADDS r0,r0,#0x3c
0000be 7041 STRB r1,[r0,#1]
;;;280 g_tx_ctrl_handle->pentile_info.pentile_enable = true; // 是否RGBG格式的数据传输
0000c0 4824 LDR r0,|L3.340|
0000c2 6800 LDR r0,[r0,#0] ; g_tx_ctrl_handle
0000c4 3020 ADDS r0,r0,#0x20
0000c6 7701 STRB r1,[r0,#0x1c]
;;;281 g_tx_ctrl_handle->pentile_info.remapl_rule = &remap_rule; // reamp规则1
0000c8 a901 ADD r1,sp,#4
0000ca 4822 LDR r0,|L3.340|
0000cc 6800 LDR r0,[r0,#0] ; g_tx_ctrl_handle
0000ce 6441 STR r1,[r0,#0x44]
;;;282 g_tx_ctrl_handle->pentile_info.remapr_rule = &remap_rule; // reamp规则2
0000d0 4820 LDR r0,|L3.340|
0000d2 6800 LDR r0,[r0,#0] ; g_tx_ctrl_handle
0000d4 6481 STR r1,[r0,#0x48]
;;;283 g_tx_ctrl_handle->pentile_info.rgb_hact = 900; // 如果是RGB驱动IC搭配RGBG玻璃使用此处配置RGB驱动IC的分辨率dst_w按玻璃分辨率进行配置
0000d6 21e1 MOVS r1,#0xe1
0000d8 0089 LSLS r1,r1,#2
0000da 481e LDR r0,|L3.340|
0000dc 6800 LDR r0,[r0,#0] ; g_tx_ctrl_handle
0000de 6401 STR r1,[r0,#0x40]
;;;284 /* RGBG 屏幕补黑配置,此款玻璃两块补黑区域均参与子像素重排*/
;;;285 g_tx_ctrl_handle->pentile_info.blank_info0.blank_en = 1; // 是否使用补黑区域0
0000e0 2101 MOVS r1,#1
0000e2 481c LDR r0,|L3.340|
0000e4 6800 LDR r0,[r0,#0] ; g_tx_ctrl_handle
0000e6 303c ADDS r0,r0,#0x3c
0000e8 7541 STRB r1,[r0,#0x15]
;;;286 g_tx_ctrl_handle->pentile_info.blank_info0.remap_en = 1; // 补黑区域0是否参与remap重排
0000ea 481a LDR r0,|L3.340|
0000ec 6800 LDR r0,[r0,#0] ; g_tx_ctrl_handle
0000ee 303c ADDS r0,r0,#0x3c
0000f0 7501 STRB r1,[r0,#0x14]
;;;287 g_tx_ctrl_handle->pentile_info.blank_info0.st_col = 0; // 补黑区域0起始位置按有效子像素序号进行计算
0000f2 2100 MOVS r1,#0
0000f4 4817 LDR r0,|L3.340|
0000f6 6800 LDR r0,[r0,#0] ; g_tx_ctrl_handle
0000f8 303c ADDS r0,r0,#0x3c
0000fa 8201 STRH r1,[r0,#0x10]
;;;288 g_tx_ctrl_handle->pentile_info.blank_info0.width = 12; // 补黑区域0补黑宽度按子像素级计算
0000fc 210c MOVS r1,#0xc
0000fe 4815 LDR r0,|L3.340|
000100 6800 LDR r0,[r0,#0] ; g_tx_ctrl_handle
000102 303c ADDS r0,r0,#0x3c
000104 8241 STRH r1,[r0,#0x12]
;;;289 g_tx_ctrl_handle->pentile_info.blank_info1.blank_en = 1; // 是否使用补黑区域1
000106 2101 MOVS r1,#1
000108 4812 LDR r0,|L3.340|
00010a 6800 LDR r0,[r0,#0] ; g_tx_ctrl_handle
00010c 303c ADDS r0,r0,#0x3c
00010e 76c1 STRB r1,[r0,#0x1b]
;;;290 g_tx_ctrl_handle->pentile_info.blank_info1.remap_en = 1; // 补黑区域1是否参与remap重排
000110 4810 LDR r0,|L3.340|
000112 6800 LDR r0,[r0,#0] ; g_tx_ctrl_handle
000114 303c ADDS r0,r0,#0x3c
000116 7681 STRB r1,[r0,#0x1a]
;;;291 g_tx_ctrl_handle->pentile_info.blank_info1.st_col = 1248; // 补黑区域1起始位置按有效子像素序号进行计算必须大于补黑区域0的起始位置
000118 2127 MOVS r1,#0x27
00011a 0149 LSLS r1,r1,#5
00011c 480d LDR r0,|L3.340|
00011e 6800 LDR r0,[r0,#0] ; g_tx_ctrl_handle
000120 303c ADDS r0,r0,#0x3c
000122 82c1 STRH r1,[r0,#0x16]
;;;292 g_tx_ctrl_handle->pentile_info.blank_info1.width = 216; // 补黑区域1补黑宽度按子像素级计算
000124 21d8 MOVS r1,#0xd8
000126 480b LDR r0,|L3.340|
000128 6800 LDR r0,[r0,#0] ; g_tx_ctrl_handle
00012a 303c ADDS r0,r0,#0x3c
00012c 8301 STRH r1,[r0,#0x18]
;;;293 #endif
;;;294
;;;295 #if DEMO_ENDIAN_EN
;;;296 hal_dsi_tx_ctrl_set_endianness(DPI_ENDIAN_BGR);// 默认RGB输出可以更改为BGR 需要在初始化之前调用
;;;297 #endif
;;;298
;;;299 /*调用初始化接口进行TX初始化*/
;;;300 hal_dsi_tx_ctrl_init(g_tx_ctrl_handle);
00012e 4809 LDR r0,|L3.340|
000130 6800 LDR r0,[r0,#0] ; g_tx_ctrl_handle
000132 f7fffffe BL hal_dsi_tx_ctrl_init
;;;301
;;;302 /*屏幕初始化复位时序和发送initial code*/
;;;303 if (!panel_init)
000136 480f LDR r0,|L3.372|
000138 7800 LDRB r0,[r0,#0] ; panel_init
00013a 2800 CMP r0,#0
00013c d104 BNE |L3.328|
;;;304 {
;;;305 demo_panel_init();
00013e f7fffffe BL demo_panel_init
;;;306 panel_init = true;
000142 2001 MOVS r0,#1
000144 490b LDR r1,|L3.372|
000146 7008 STRB r0,[r1,#0]
|L3.328|
;;;307 }
;;;308
;;;309 #if DEMO_TX_VPG_EN /*使用TX VPG测试TX是否正常工作*/
;;;310 hal_dsi_tx_ctrl_set_vpg(true, TX_VPG_V_COLOR, false);
;;;311 #endif
;;;312
;;;313 /*tx start开始传输高速数据*/
;;;314 hal_dsi_tx_ctrl_start(g_tx_ctrl_handle);
000148 4802 LDR r0,|L3.340|
00014a 6800 LDR r0,[r0,#0] ; g_tx_ctrl_handle
00014c f7fffffe BL hal_dsi_tx_ctrl_start
;;;315
;;;316 /*可选功能配置,在任意时刻均可调用 start*/
;;;317 #if DEMO_CCM_EN
;;;318 ccm_coef_t coef;
;;;319 coef.coef_c00 = 0x1f3;
;;;320 coef.coef_c01 = 0xf3a;
;;;321 coef.coef_c02 = 0xfd3;
;;;322 coef.coef_c10 = 0xf9c;
;;;323 coef.coef_c11 = 0x19c;
;;;324 coef.coef_c12 = 0xfca;
;;;325 coef.coef_c20 = 0x27;
;;;326 coef.coef_c21 = 0xf46;
;;;327 coef.coef_c22 = 0x193;
;;;328 hal_dsi_tx_ctrl_set_ccm(&coef);
;;;329 #endif
;;;330
;;;331 #if DEMO_OVERWRITE_EN
;;;332 hal_dsi_tx_ctrl_set_overwrite_rgb(0x00, 0x00, 0xFF); //蓝色图形数据输出 参数为R/G/B灰度值
;;;333 hal_dsi_tx_ctrl_overwrite_enable(true); //开启overwrite功能
;;;334 /*........*/
;;;335 //hal_dsi_tx_ctrl_overwrite_enable(false); //需要关闭overwrite功能时调用
;;;336 #endif
;;;337
;;;338 #if DEMO_EDGE_DECT_EN
;;;339 dsi_tx_edge_dect_t edge_dect_para = {0x10, true};
;;;340 hal_dsi_tx_ctrl_set_edge_dect(&edge_dect_para);
;;;341 #endif
;;;342
;;;343 #if DEMO_EDGE_ENHANCE_EN
;;;344 dsi_tx_edge_enh_t edge_enh_para = {true, 64, 4, 64, 0};
;;;345 hal_dsi_tx_ctrl_set_edge_enhance(&edge_enh_para);
;;;346 #endif
;;;347
;;;348 #if DEMO_FC_EN
;;;349 dsi_tx_fc_t fc_para = {64, 64};
;;;350 hal_dsi_tx_ctrl_set_fc(&fc_para);
;;;351 #endif
;;;352
;;;353 #if DEMO_BCS_EN
;;;354 dsi_tx_bcs_t bcs_cfg = {0x00, 0x10, 0x10}; // 参数含义:{明亮度,对比度,饱和度}
;;;355 hal_dsi_tx_ctrl_set_bcs(&bcs_cfg);
;;;356 #endif
;;;357 /*可选功能配置,在任意时刻均可调用 end*/
;;;358
;;;359 }
000150 b007 ADD sp,sp,#0x1c
000152 bd00 POP {pc}
;;;360
ENDP
|L3.340|
DCD g_tx_ctrl_handle
|L3.344|
DCD 0x000004da
|L3.348|
00015c 090b0c08 DCB "\t\v\f\b\a\n",4,5,6,2,1,3,20,19,22,21,23,24,14,"\r",15,16
000160 070a0405
000164 06020103
000168 14131615
00016c 17180e0d
000170 0f10
000172 1112 DCB 17,18
|L3.372|
DCD panel_init
AREA ||i.demo_panel_init||, CODE, READONLY, ALIGN=2
demo_panel_init PROC
;;;123 **/
;;;124 void demo_panel_init(void)
000000 b50e PUSH {r1-r3,lr}
;;;125 {
;;;126 #if AMOLED_NT37280
;;;127 demo_tx_panel_backlight_on();
;;;128 #endif
;;;129
;;;130 /*初始化TD_RSTN并产生屏端复位信号*/
;;;131 hal_gpio_init_output(PIN_TD_RSTN, IO_LVL_HIGH);
000002 2101 MOVS r1,#1
000004 2007 MOVS r0,#7
000006 f7fffffe BL hal_gpio_init_output
;;;132 hal_gpio_set_output_data(PIN_TD_RSTN, IO_LVL_HIGH);
00000a 2101 MOVS r1,#1
00000c 2007 MOVS r0,#7
00000e f7fffffe BL hal_gpio_set_output_data
;;;133 delayMs(10);
000012 200a MOVS r0,#0xa
000014 f7fffffe BL delayMs
;;;134 hal_gpio_set_output_data(PIN_TD_RSTN, IO_LVL_LOW);
000018 2100 MOVS r1,#0
00001a 2007 MOVS r0,#7
00001c f7fffffe BL hal_gpio_set_output_data
;;;135 delayMs(10);
000020 200a MOVS r0,#0xa
000022 f7fffffe BL delayMs
;;;136 hal_gpio_set_output_data(PIN_TD_RSTN, IO_LVL_HIGH);
000026 2101 MOVS r1,#1
000028 2007 MOVS r0,#7
00002a f7fffffe BL hal_gpio_set_output_data
;;;137 delayMs(10);
00002e 200a MOVS r0,#0xa
000030 f7fffffe BL delayMs
;;;138
;;;139 /*bta read register*/
;;;140 #if DEMO_BTA_LP_EN
;;;141 hal_dsi_tx_ctrl_read_cmd(0x06, 0, 0xDA, 1, &bta_ack_data);
;;;142 TAU_LOGD("DA[0x%x]\n", bta_ack_data);
;;;143 #endif
;;;144
;;;145 /*initial code*/
;;;146 #if LCD_PT628_CSOT
;;;147 TAU_LOGD("LCD_PT628_CSOT pannel init\n");
000034 bf00 NOP
000036 2393 MOVS r3,#0x93
000038 a249 ADR r2,|L4.352|
00003a a14b ADR r1,|L4.360|
00003c 2000 MOVS r0,#0
00003e f7fffffe BL tau_log_printf
000042 bf00 NOP
;;;148 hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0xBF, 0x00);
000044 2000 MOVS r0,#0
000046 23bf MOVS r3,#0xbf
000048 2202 MOVS r2,#2
00004a 4601 MOV r1,r0
00004c 9000 STR r0,[sp,#0]
00004e 2015 MOVS r0,#0x15
000050 f7fffffe BL hal_dsi_tx_ctrl_write_cmd
;;;149 hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0xC0, 0x00);
000054 2000 MOVS r0,#0
000056 23c0 MOVS r3,#0xc0
000058 2202 MOVS r2,#2
00005a 4601 MOV r1,r0
00005c 9000 STR r0,[sp,#0]
00005e 2015 MOVS r0,#0x15
000060 f7fffffe BL hal_dsi_tx_ctrl_write_cmd
;;;150 hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x00, 0x00);
000064 2000 MOVS r0,#0
000066 4603 MOV r3,r0
000068 2202 MOVS r2,#2
00006a 4601 MOV r1,r0
00006c 9000 STR r0,[sp,#0]
00006e 2015 MOVS r0,#0x15
000070 f7fffffe BL hal_dsi_tx_ctrl_write_cmd
;;;151 hal_dsi_tx_ctrl_write_cmd(0x39, 0, 4, 0xFF, 0x87, 0x56, 0x01);
000074 2001 MOVS r0,#1
000076 2156 MOVS r1,#0x56
000078 2287 MOVS r2,#0x87
00007a 23ff MOVS r3,#0xff
00007c 9200 STR r2,[sp,#0]
00007e 9101 STR r1,[sp,#4]
000080 9002 STR r0,[sp,#8]
000082 2204 MOVS r2,#4
000084 2100 MOVS r1,#0
000086 2039 MOVS r0,#0x39
000088 f7fffffe BL hal_dsi_tx_ctrl_write_cmd
;;;152 hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x00, 0x80);
00008c 2080 MOVS r0,#0x80
00008e 2300 MOVS r3,#0
000090 2202 MOVS r2,#2
000092 4619 MOV r1,r3
000094 9000 STR r0,[sp,#0]
000096 2015 MOVS r0,#0x15
000098 f7fffffe BL hal_dsi_tx_ctrl_write_cmd
;;;153 hal_dsi_tx_ctrl_write_cmd(0x39, 0, 3, 0xFF, 0x87, 0x56);
00009c 2056 MOVS r0,#0x56
00009e 2187 MOVS r1,#0x87
0000a0 23ff MOVS r3,#0xff
0000a2 2203 MOVS r2,#3
0000a4 9100 STR r1,[sp,#0]
0000a6 9001 STR r0,[sp,#4]
0000a8 2100 MOVS r1,#0
0000aa 2039 MOVS r0,#0x39
0000ac f7fffffe BL hal_dsi_tx_ctrl_write_cmd
;;;154 hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x00, 0xE8);
0000b0 20e8 MOVS r0,#0xe8
0000b2 2300 MOVS r3,#0
0000b4 2202 MOVS r2,#2
0000b6 4619 MOV r1,r3
0000b8 9000 STR r0,[sp,#0]
0000ba 2015 MOVS r0,#0x15
0000bc f7fffffe BL hal_dsi_tx_ctrl_write_cmd
;;;155 hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0xC0, 0x20);
0000c0 2020 MOVS r0,#0x20
0000c2 23c0 MOVS r3,#0xc0
0000c4 2202 MOVS r2,#2
0000c6 2100 MOVS r1,#0
0000c8 9000 STR r0,[sp,#0]
0000ca 2015 MOVS r0,#0x15
0000cc f7fffffe BL hal_dsi_tx_ctrl_write_cmd
;;;156 hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x00, 0x00);
0000d0 2000 MOVS r0,#0
0000d2 4603 MOV r3,r0
0000d4 2202 MOVS r2,#2
0000d6 4601 MOV r1,r0
0000d8 9000 STR r0,[sp,#0]
0000da 2015 MOVS r0,#0x15
0000dc f7fffffe BL hal_dsi_tx_ctrl_write_cmd
;;;157 hal_dsi_tx_ctrl_write_cmd(0x39, 0, 4, 0xFF, 0x87, 0x56, 0x01);
0000e0 2001 MOVS r0,#1
0000e2 2156 MOVS r1,#0x56
0000e4 2287 MOVS r2,#0x87
0000e6 23ff MOVS r3,#0xff
0000e8 9200 STR r2,[sp,#0]
0000ea 9101 STR r1,[sp,#4]
0000ec 9002 STR r0,[sp,#8]
0000ee 2204 MOVS r2,#4
0000f0 2100 MOVS r1,#0
0000f2 2039 MOVS r0,#0x39
0000f4 f7fffffe BL hal_dsi_tx_ctrl_write_cmd
;;;158 hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x00, 0x80);
0000f8 2080 MOVS r0,#0x80
0000fa 2300 MOVS r3,#0
0000fc 2202 MOVS r2,#2
0000fe 4619 MOV r1,r3
000100 9000 STR r0,[sp,#0]
000102 2015 MOVS r0,#0x15
000104 f7fffffe BL hal_dsi_tx_ctrl_write_cmd
;;;159 hal_dsi_tx_ctrl_write_cmd(0x39, 0, 3, 0xFF, 0x87, 0x56);
000108 2056 MOVS r0,#0x56
00010a 2187 MOVS r1,#0x87
00010c 23ff MOVS r3,#0xff
00010e 2203 MOVS r2,#3
000110 9100 STR r1,[sp,#0]
000112 9001 STR r0,[sp,#4]
000114 2100 MOVS r1,#0
000116 2039 MOVS r0,#0x39
000118 f7fffffe BL hal_dsi_tx_ctrl_write_cmd
;;;160 hal_dsi_tx_ctrl_write_cmd(0x05, 0, 1, 0x11);
00011c 2311 MOVS r3,#0x11
00011e 2201 MOVS r2,#1
000120 2100 MOVS r1,#0
000122 2005 MOVS r0,#5
000124 f7fffffe BL hal_dsi_tx_ctrl_write_cmd
;;;161 delayMs(120);
000128 2078 MOVS r0,#0x78
00012a f7fffffe BL delayMs
;;;162 hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x35, 0x00);
00012e 2000 MOVS r0,#0
000130 2335 MOVS r3,#0x35
000132 2202 MOVS r2,#2
000134 4601 MOV r1,r0
000136 9000 STR r0,[sp,#0]
000138 2015 MOVS r0,#0x15
00013a f7fffffe BL hal_dsi_tx_ctrl_write_cmd
;;;163 hal_dsi_tx_ctrl_write_cmd(0x39, 0, 3, 0x51, 0x0F, 0xFF);
00013e 20ff MOVS r0,#0xff
000140 210f MOVS r1,#0xf
000142 2351 MOVS r3,#0x51
000144 2203 MOVS r2,#3
000146 9100 STR r1,[sp,#0]
000148 9001 STR r0,[sp,#4]
00014a 2100 MOVS r1,#0
00014c 2039 MOVS r0,#0x39
00014e f7fffffe BL hal_dsi_tx_ctrl_write_cmd
;;;164 hal_dsi_tx_ctrl_write_cmd(0x05, 0, 1, 0x29);
000152 2329 MOVS r3,#0x29
000154 2201 MOVS r2,#1
000156 2100 MOVS r1,#0
000158 2005 MOVS r0,#5
00015a f7fffffe BL hal_dsi_tx_ctrl_write_cmd
;;;165
;;;166 #elif AMOLED_NT37280
;;;167 TAU_LOGD("AMOLED_NT37280 pannel init\n");
;;;168 hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0xFF, 0xE0);
;;;169 hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0xFB, 0x01);
;;;170 hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x18, 0x80);
;;;171 hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x1A, 0x15);
;;;172 hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x73, 0x01);
;;;173 hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x89, 0x7F);
;;;174 hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x0D, 0x9B);
;;;175 hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x46, 0x17);
;;;176 hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0xFF, 0xF0);
;;;177 hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0xFB, 0x01);
;;;178 hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x54, 0x03);
;;;179 hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x9C, 0x00);
;;;180 hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0xFF, 0x20);
;;;181 hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0xFB, 0x01);
;;;182 hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x34, 0x00);
;;;183 hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x35, 0x66);
;;;184 hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x36, 0x66);
;;;185 hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0xFF, 0x10);
;;;186 hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0xFB, 0x01);
;;;187 hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x88, 0x07);
;;;188 hal_dsi_tx_ctrl_write_cmd(0x39, 0, 5, 0x2A, 0x00, 0x00, 0x04, 0x37);
;;;189 hal_dsi_tx_ctrl_write_cmd(0x39, 0, 5, 0x2B, 0x00, 0x00, 0x08, 0xE7);
;;;190 hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x7F, 0x07);
;;;191 hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0xE9, 0x00);
;;;192 hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0xBF, 0x00);
;;;193 hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0xC0, 0x00);
;;;194 hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x35, 0x00); //TE 35=00是标准60Hz; 35=01是有很多小信号
;;;195 hal_dsi_tx_ctrl_write_cmd(0x29, 0, 3, 0x51, 0x0F, 0xFF); //CABC
;;;196 hal_dsi_tx_ctrl_write_cmd(0x05, 0, 1, 0x11);
;;;197 delayMs(120);
;;;198 hal_dsi_tx_ctrl_write_cmd(0x05, 0, 1, 0x29);
;;;199 delayMs(10);
;;;200 #endif
;;;201
;;;202 }
00015e bd0e POP {r1-r3,pc}
;;;203
ENDP
|L4.352|
000160 74782d6c DCB "tx-log",0
000164 6f6700
000167 00 DCB 0
|L4.360|
000168 5b25735d DCB "[%s] (%04d) LCD_PT628_CSOT pannel init\n",0
00016c 20282530
000170 34642920
000174 4c43445f
000178 50543632
00017c 385f4353
000180 4f542070
000184 616e6e65
000188 6c20696e
00018c 69740a00
AREA ||.data||, DATA, ALIGN=2
g_tx_ctrl_handle
DCD 0x00000000
panel_init
000004 00 DCB 0x00
;*** Start embedded assembler ***
#line 1 "..\\..\\src\\app\\module_demo\\demo_hal_dsi_tx.c"
AREA ||.rev16_text||, CODE
THUMB
EXPORT |__asm___17_demo_hal_dsi_tx_c_6c4bcf7f____REV16|
#line 467 "C:\\Keil_v5\\ARM\\PACK\\ARM\\CMSIS\\5.5.1\\CMSIS\\Core\\Include\\cmsis_armcc.h"
|__asm___17_demo_hal_dsi_tx_c_6c4bcf7f____REV16| PROC
#line 468
rev16 r0, r0
bx lr
ENDP
AREA ||.revsh_text||, CODE
THUMB
EXPORT |__asm___17_demo_hal_dsi_tx_c_6c4bcf7f____REVSH|
#line 482
|__asm___17_demo_hal_dsi_tx_c_6c4bcf7f____REVSH| PROC
#line 483
revsh r0, r0
bx lr
ENDP
;*** End embedded assembler ***

View File

@ -0,0 +1,29 @@
; 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\demo_hal_flash.o --asm_dir=.\Listings\ --list_dir=.\Listings\ --depend=.\objects\demo_hal_flash.d --cpu=Cortex-M0 --apcs=interwork -O0 --diag_suppress=9931 -I..\..\src -I..\..\src\board -I..\..\src\common -I..\..\src\sdk\include -I..\..\src\sdk\include\M0 -I..\..\src\app -I..\..\src\app\S8 -I..\..\src\app\touch -I..\..\src\app\module_demo -I..\..\src\app\Mi12Lite -I.\RTE\_WL668 -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\CMSIS\Core\Include -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\Device\ARM\ARMCM0\Include -D__MICROLIB -D__UVISION_VERSION=528 -D_RTE_ -DARMCM0 --omf_browse=.\objects\demo_hal_flash.crf ..\..\src\app\module_demo\demo_hal_flash.c]
THUMB
;*** Start embedded assembler ***
#line 1 "..\\..\\src\\app\\module_demo\\demo_hal_flash.c"
AREA ||.rev16_text||, CODE
THUMB
EXPORT |__asm___16_demo_hal_flash_c____REV16|
#line 467 "C:\\Keil_v5\\ARM\\PACK\\ARM\\CMSIS\\5.5.1\\CMSIS\\Core\\Include\\cmsis_armcc.h"
|__asm___16_demo_hal_flash_c____REV16| PROC
#line 468
rev16 r0, r0
bx lr
ENDP
AREA ||.revsh_text||, CODE
THUMB
EXPORT |__asm___16_demo_hal_flash_c____REVSH|
#line 482
|__asm___16_demo_hal_flash_c____REVSH| PROC
#line 483
revsh r0, r0
bx lr
ENDP
;*** End embedded assembler ***

View File

@ -0,0 +1,29 @@
; 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\demo_hal_gpio.o --asm_dir=.\Listings\ --list_dir=.\Listings\ --depend=.\objects\demo_hal_gpio.d --cpu=Cortex-M0 --apcs=interwork -O0 --diag_suppress=9931 -I..\..\src -I..\..\src\board -I..\..\src\common -I..\..\src\sdk\include -I..\..\src\sdk\include\M0 -I..\..\src\app -I..\..\src\app\S8 -I..\..\src\app\touch -I..\..\src\app\module_demo -I..\..\src\app\Mi12Lite -I.\RTE\_WL668 -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\CMSIS\Core\Include -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\Device\ARM\ARMCM0\Include -D__MICROLIB -D__UVISION_VERSION=528 -D_RTE_ -DARMCM0 --omf_browse=.\objects\demo_hal_gpio.crf ..\..\src\app\module_demo\demo_hal_gpio.c]
THUMB
;*** Start embedded assembler ***
#line 1 "..\\..\\src\\app\\module_demo\\demo_hal_gpio.c"
AREA ||.rev16_text||, CODE
THUMB
EXPORT |__asm___15_demo_hal_gpio_c____REV16|
#line 467 "C:\\Keil_v5\\ARM\\PACK\\ARM\\CMSIS\\5.5.1\\CMSIS\\Core\\Include\\cmsis_armcc.h"
|__asm___15_demo_hal_gpio_c____REV16| PROC
#line 468
rev16 r0, r0
bx lr
ENDP
AREA ||.revsh_text||, CODE
THUMB
EXPORT |__asm___15_demo_hal_gpio_c____REVSH|
#line 482
|__asm___15_demo_hal_gpio_c____REVSH| PROC
#line 483
revsh r0, r0
bx lr
ENDP
;*** End embedded assembler ***

View File

@ -0,0 +1,29 @@
; 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\demo_hal_i2c.o --asm_dir=.\Listings\ --list_dir=.\Listings\ --depend=.\objects\demo_hal_i2c.d --cpu=Cortex-M0 --apcs=interwork -O0 --diag_suppress=9931 -I..\..\src -I..\..\src\board -I..\..\src\common -I..\..\src\sdk\include -I..\..\src\sdk\include\M0 -I..\..\src\app -I..\..\src\app\S8 -I..\..\src\app\touch -I..\..\src\app\module_demo -I..\..\src\app\Mi12Lite -I.\RTE\_WL668 -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\CMSIS\Core\Include -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\Device\ARM\ARMCM0\Include -D__MICROLIB -D__UVISION_VERSION=528 -D_RTE_ -DARMCM0 --omf_browse=.\objects\demo_hal_i2c.crf ..\..\src\app\module_demo\demo_hal_i2c.c]
THUMB
;*** Start embedded assembler ***
#line 1 "..\\..\\src\\app\\module_demo\\demo_hal_i2c.c"
AREA ||.rev16_text||, CODE
THUMB
EXPORT |__asm___14_demo_hal_i2c_c____REV16|
#line 467 "C:\\Keil_v5\\ARM\\PACK\\ARM\\CMSIS\\5.5.1\\CMSIS\\Core\\Include\\cmsis_armcc.h"
|__asm___14_demo_hal_i2c_c____REV16| PROC
#line 468
rev16 r0, r0
bx lr
ENDP
AREA ||.revsh_text||, CODE
THUMB
EXPORT |__asm___14_demo_hal_i2c_c____REVSH|
#line 482
|__asm___14_demo_hal_i2c_c____REVSH| PROC
#line 483
revsh r0, r0
bx lr
ENDP
;*** End embedded assembler ***

View File

@ -0,0 +1,29 @@
; 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\demo_hal_pwm.o --asm_dir=.\Listings\ --list_dir=.\Listings\ --depend=.\objects\demo_hal_pwm.d --cpu=Cortex-M0 --apcs=interwork -O0 --diag_suppress=9931 -I..\..\src -I..\..\src\board -I..\..\src\common -I..\..\src\sdk\include -I..\..\src\sdk\include\M0 -I..\..\src\app -I..\..\src\app\S8 -I..\..\src\app\touch -I..\..\src\app\module_demo -I..\..\src\app\Mi12Lite -I.\RTE\_WL668 -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\CMSIS\Core\Include -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\Device\ARM\ARMCM0\Include -D__MICROLIB -D__UVISION_VERSION=528 -D_RTE_ -DARMCM0 --omf_browse=.\objects\demo_hal_pwm.crf ..\..\src\app\module_demo\demo_hal_pwm.c]
THUMB
;*** Start embedded assembler ***
#line 1 "..\\..\\src\\app\\module_demo\\demo_hal_pwm.c"
AREA ||.rev16_text||, CODE
THUMB
EXPORT |__asm___14_demo_hal_pwm_c____REV16|
#line 467 "C:\\Keil_v5\\ARM\\PACK\\ARM\\CMSIS\\5.5.1\\CMSIS\\Core\\Include\\cmsis_armcc.h"
|__asm___14_demo_hal_pwm_c____REV16| PROC
#line 468
rev16 r0, r0
bx lr
ENDP
AREA ||.revsh_text||, CODE
THUMB
EXPORT |__asm___14_demo_hal_pwm_c____REVSH|
#line 482
|__asm___14_demo_hal_pwm_c____REVSH| PROC
#line 483
revsh r0, r0
bx lr
ENDP
;*** End embedded assembler ***

View File

@ -0,0 +1,29 @@
; 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\demo_hal_pwr.o --asm_dir=.\Listings\ --list_dir=.\Listings\ --depend=.\objects\demo_hal_pwr.d --cpu=Cortex-M0 --apcs=interwork -O0 --diag_suppress=9931 -I..\..\src -I..\..\src\board -I..\..\src\common -I..\..\src\sdk\include -I..\..\src\sdk\include\M0 -I..\..\src\app -I..\..\src\app\S8 -I..\..\src\app\touch -I..\..\src\app\module_demo -I..\..\src\app\Mi12Lite -I.\RTE\_WL668 -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\CMSIS\Core\Include -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\Device\ARM\ARMCM0\Include -D__MICROLIB -D__UVISION_VERSION=528 -D_RTE_ -DARMCM0 --omf_browse=.\objects\demo_hal_pwr.crf ..\..\src\app\module_demo\demo_hal_pwr.c]
THUMB
;*** Start embedded assembler ***
#line 1 "..\\..\\src\\app\\module_demo\\demo_hal_pwr.c"
AREA ||.rev16_text||, CODE
THUMB
EXPORT |__asm___14_demo_hal_pwr_c____REV16|
#line 467 "C:\\Keil_v5\\ARM\\PACK\\ARM\\CMSIS\\5.5.1\\CMSIS\\Core\\Include\\cmsis_armcc.h"
|__asm___14_demo_hal_pwr_c____REV16| PROC
#line 468
rev16 r0, r0
bx lr
ENDP
AREA ||.revsh_text||, CODE
THUMB
EXPORT |__asm___14_demo_hal_pwr_c____REVSH|
#line 482
|__asm___14_demo_hal_pwr_c____REVSH| PROC
#line 483
revsh r0, r0
bx lr
ENDP
;*** End embedded assembler ***

View File

@ -0,0 +1,29 @@
; 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\demo_hal_spi.o --asm_dir=.\Listings\ --list_dir=.\Listings\ --depend=.\objects\demo_hal_spi.d --cpu=Cortex-M0 --apcs=interwork -O0 --diag_suppress=9931 -I..\..\src -I..\..\src\board -I..\..\src\common -I..\..\src\sdk\include -I..\..\src\sdk\include\M0 -I..\..\src\app -I..\..\src\app\S8 -I..\..\src\app\touch -I..\..\src\app\module_demo -I..\..\src\app\Mi12Lite -I.\RTE\_WL668 -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\CMSIS\Core\Include -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\Device\ARM\ARMCM0\Include -D__MICROLIB -D__UVISION_VERSION=528 -D_RTE_ -DARMCM0 --omf_browse=.\objects\demo_hal_spi.crf ..\..\src\app\module_demo\demo_hal_spi.c]
THUMB
;*** Start embedded assembler ***
#line 1 "..\\..\\src\\app\\module_demo\\demo_hal_spi.c"
AREA ||.rev16_text||, CODE
THUMB
EXPORT |__asm___14_demo_hal_spi_c____REV16|
#line 467 "C:\\Keil_v5\\ARM\\PACK\\ARM\\CMSIS\\5.5.1\\CMSIS\\Core\\Include\\cmsis_armcc.h"
|__asm___14_demo_hal_spi_c____REV16| PROC
#line 468
rev16 r0, r0
bx lr
ENDP
AREA ||.revsh_text||, CODE
THUMB
EXPORT |__asm___14_demo_hal_spi_c____REVSH|
#line 482
|__asm___14_demo_hal_spi_c____REVSH| PROC
#line 483
revsh r0, r0
bx lr
ENDP
;*** End embedded assembler ***

View File

@ -0,0 +1,29 @@
; 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\demo_hal_swire.o --asm_dir=.\Listings\ --list_dir=.\Listings\ --depend=.\objects\demo_hal_swire.d --cpu=Cortex-M0 --apcs=interwork -O0 --diag_suppress=9931 -I..\..\src -I..\..\src\board -I..\..\src\common -I..\..\src\sdk\include -I..\..\src\sdk\include\M0 -I..\..\src\app -I..\..\src\app\S8 -I..\..\src\app\touch -I..\..\src\app\module_demo -I..\..\src\app\Mi12Lite -I.\RTE\_WL668 -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\CMSIS\Core\Include -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\Device\ARM\ARMCM0\Include -D__MICROLIB -D__UVISION_VERSION=528 -D_RTE_ -DARMCM0 --omf_browse=.\objects\demo_hal_swire.crf ..\..\src\app\module_demo\demo_hal_swire.c]
THUMB
;*** Start embedded assembler ***
#line 1 "..\\..\\src\\app\\module_demo\\demo_hal_swire.c"
AREA ||.rev16_text||, CODE
THUMB
EXPORT |__asm___16_demo_hal_swire_c____REV16|
#line 467 "C:\\Keil_v5\\ARM\\PACK\\ARM\\CMSIS\\5.5.1\\CMSIS\\Core\\Include\\cmsis_armcc.h"
|__asm___16_demo_hal_swire_c____REV16| PROC
#line 468
rev16 r0, r0
bx lr
ENDP
AREA ||.revsh_text||, CODE
THUMB
EXPORT |__asm___16_demo_hal_swire_c____REVSH|
#line 482
|__asm___16_demo_hal_swire_c____REVSH| PROC
#line 483
revsh r0, r0
bx lr
ENDP
;*** End embedded assembler ***

View File

@ -0,0 +1,29 @@
; 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\demo_hal_uart.o --asm_dir=.\Listings\ --list_dir=.\Listings\ --depend=.\objects\demo_hal_uart.d --cpu=Cortex-M0 --apcs=interwork -O0 --diag_suppress=9931 -I..\..\src -I..\..\src\board -I..\..\src\common -I..\..\src\sdk\include -I..\..\src\sdk\include\M0 -I..\..\src\app -I..\..\src\app\S8 -I..\..\src\app\touch -I..\..\src\app\module_demo -I..\..\src\app\Mi12Lite -I.\RTE\_WL668 -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\CMSIS\Core\Include -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\Device\ARM\ARMCM0\Include -D__MICROLIB -D__UVISION_VERSION=528 -D_RTE_ -DARMCM0 --omf_browse=.\objects\demo_hal_uart.crf ..\..\src\app\module_demo\demo_hal_uart.c]
THUMB
;*** Start embedded assembler ***
#line 1 "..\\..\\src\\app\\module_demo\\demo_hal_uart.c"
AREA ||.rev16_text||, CODE
THUMB
EXPORT |__asm___15_demo_hal_uart_c____REV16|
#line 467 "C:\\Keil_v5\\ARM\\PACK\\ARM\\CMSIS\\5.5.1\\CMSIS\\Core\\Include\\cmsis_armcc.h"
|__asm___15_demo_hal_uart_c____REV16| PROC
#line 468
rev16 r0, r0
bx lr
ENDP
AREA ||.revsh_text||, CODE
THUMB
EXPORT |__asm___15_demo_hal_uart_c____REVSH|
#line 482
|__asm___15_demo_hal_uart_c____REVSH| PROC
#line 483
revsh r0, r0
bx lr
ENDP
;*** End embedded assembler ***

View File

@ -0,0 +1,252 @@
; 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\demo_hal_wdg.o --asm_dir=.\Listings\ --list_dir=.\Listings\ --depend=.\objects\demo_hal_wdg.d --cpu=Cortex-M0 --apcs=interwork -O0 --diag_suppress=9931 -I..\..\src -I..\..\src\board -I..\..\src\common -I..\..\src\sdk\include -I..\..\src\sdk\include\M0 -I..\..\src\app -I..\..\src\app\S8 -I..\..\src\app\touch -I..\..\src\app\module_demo -I..\..\src\app\Mi12Lite -I.\RTE\_WL668 -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\CMSIS\Core\Include -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\Device\ARM\ARMCM0\Include -D__MICROLIB -D__UVISION_VERSION=528 -D_RTE_ -DARMCM0 --omf_browse=.\objects\demo_hal_wdg.crf ..\..\src\app\module_demo\demo_hal_wdg.c]
THUMB
AREA ||i.demo_wdg_callback||, CODE, READONLY, ALIGN=2
demo_wdg_callback PROC
;;;70 */
;;;71 static void demo_wdg_callback(void *data)
000000 b510 PUSH {r4,lr}
;;;72 {
000002 4604 MOV r4,r0
;;;73 /* 翻转GPIO */
;;;74 sg_wdg_io_lvl = (sg_wdg_io_lvl ? IO_LVL_LOW : IO_LVL_HIGH);
000004 480d LDR r0,|L1.60|
000006 7800 LDRB r0,[r0,#0] ; sg_wdg_io_lvl
000008 2800 CMP r0,#0
00000a d101 BNE |L1.16|
00000c 2001 MOVS r0,#1
00000e e000 B |L1.18|
|L1.16|
000010 2000 MOVS r0,#0
|L1.18|
000012 490a LDR r1,|L1.60|
000014 7008 STRB r0,[r1,#0]
;;;75 hal_gpio_set_output_data(sg_wdg_io_pad, sg_wdg_io_lvl);
000016 4608 MOV r0,r1
000018 7801 LDRB r1,[r0,#0] ; sg_wdg_io_lvl
00001a 4809 LDR r0,|L1.64|
00001c 7800 LDRB r0,[r0,#0] ; sg_wdg_io_pad
00001e f7fffffe BL hal_gpio_set_output_data
;;;76 sg_feed_cnt++;
000022 4808 LDR r0,|L1.68|
000024 7800 LDRB r0,[r0,#0] ; sg_feed_cnt
000026 1c40 ADDS r0,r0,#1
000028 4906 LDR r1,|L1.68|
00002a 7008 STRB r0,[r1,#0]
;;;77
;;;78 if (sg_feed_cnt > 10)
00002c 4608 MOV r0,r1
00002e 7800 LDRB r0,[r0,#0] ; sg_feed_cnt
000030 280a CMP r0,#0xa
000032 dd01 BLE |L1.56|
;;;79 {
;;;80 hal_wdg_stop();
000034 f7fffffe BL hal_wdg_stop
|L1.56|
;;;81 }
;;;82 }
000038 bd10 POP {r4,pc}
;;;83
ENDP
00003a 0000 DCW 0x0000
|L1.60|
DCD sg_wdg_io_lvl
|L1.64|
DCD sg_wdg_io_pad
|L1.68|
DCD sg_feed_cnt
AREA ||i.demo_wdg_case||, CODE, READONLY, ALIGN=2
demo_wdg_case PROC
;;;124 */
;;;125 void demo_wdg_case(void)
000000 b510 PUSH {r4,lr}
;;;126 {
;;;127 TAU_LOGI("demo_wdg_case\r\n");
000002 bf00 NOP
000004 237f MOVS r3,#0x7f
000006 a204 ADR r2,|L2.24|
000008 a105 ADR r1,|L2.32|
00000a 2001 MOVS r0,#1
00000c f7fffffe BL tau_log_printf
000010 bf00 NOP
;;;128
;;;129 #if WDG_CASE_RST
;;;130 demo_wdg_case_rst_mode();
;;;131 #elif WDG_CASE_INTR
;;;132 demo_wdg_case_int_mode();
000012 f7fffffe BL demo_wdg_case_int_mode
;;;133 #endif
;;;134 }
000016 bd10 POP {r4,pc}
;;;135
ENDP
|L2.24|
000018 7764672d DCB "wdg-log",0
00001c 6c6f6700
|L2.32|
000020 5b25735d DCB "[%s] (%04d) demo_wdg_case\r\n",0
000024 20282530
000028 34642920
00002c 64656d6f
000030 5f776467
000034 5f636173
000038 650d0a00
AREA ||i.demo_wdg_case_int_mode||, CODE, READONLY, ALIGN=2
demo_wdg_case_int_mode PROC
;;;88 */
;;;89 static void demo_wdg_case_int_mode(void)
000000 b508 PUSH {r3,lr}
;;;90 {
;;;91 TAU_LOGI("int start...\n");
000002 bf00 NOP
000004 235b MOVS r3,#0x5b
000006 a21a ADR r2,|L3.112|
000008 a11b ADR r1,|L3.120|
00000a 2001 MOVS r0,#1
00000c f7fffffe BL tau_log_printf
000010 bf00 NOP
;;;92
;;;93 /* WDG初始化 */
;;;94 hal_wdg_init();
000012 f7fffffe BL hal_wdg_init
;;;95
;;;96 /* 设置循环超时 */
;;;97 hal_wdg_set_repeat(true);
000016 2001 MOVS r0,#1
000018 f7fffffe BL hal_wdg_set_repeat
;;;98
;;;99 /* 设置回调函数 */
;;;100 hal_wdg_register_callback(demo_wdg_callback, NULL);
00001c 2100 MOVS r1,#0
00001e 481d LDR r0,|L3.148|
000020 f7fffffe BL hal_wdg_register_callback
;;;101
;;;102 /*初始化GPIO低状态*/
;;;103 hal_gpio_init_output(sg_wdg_io_pad, sg_wdg_io_lvl);
000024 481c LDR r0,|L3.152|
000026 7801 LDRB r1,[r0,#0] ; sg_wdg_io_lvl
000028 481c LDR r0,|L3.156|
00002a 7800 LDRB r0,[r0,#0] ; sg_wdg_io_pad
00002c f7fffffe BL hal_gpio_init_output
;;;104
;;;105 /* 设置中断模式 */
;;;106 hal_wdg_start(WDG_MODE_INTERRUPT, 200);
000030 21c8 MOVS r1,#0xc8
000032 2001 MOVS r0,#1
000034 f7fffffe BL hal_wdg_start
;;;107
;;;108
;;;109 while (sg_feed_cnt < 6)
000038 e014 B |L3.100|
|L3.58|
;;;110 {
;;;111 sg_feed_cnt++;
00003a 4819 LDR r0,|L3.160|
00003c 7800 LDRB r0,[r0,#0] ; sg_feed_cnt
00003e 1c40 ADDS r0,r0,#1
000040 4917 LDR r1,|L3.160|
000042 7008 STRB r0,[r1,#0]
;;;112 hal_wdg_kick_dog();
000044 f7fffffe BL hal_wdg_kick_dog
;;;113 delayMs(150);
000048 2096 MOVS r0,#0x96
00004a f7fffffe BL delayMs
;;;114 TAU_LOGI("feed [%d]th done\n", sg_feed_cnt);
00004e bf00 NOP
000050 4813 LDR r0,|L3.160|
000052 7800 LDRB r0,[r0,#0] ; sg_feed_cnt
000054 2372 MOVS r3,#0x72
000056 a206 ADR r2,|L3.112|
000058 a112 ADR r1,|L3.164|
00005a 9000 STR r0,[sp,#0]
00005c 2001 MOVS r0,#1
00005e f7fffffe BL tau_log_printf
000062 bf00 NOP
|L3.100|
000064 480e LDR r0,|L3.160|
000066 7800 LDRB r0,[r0,#0] ;109 ; sg_feed_cnt
000068 2806 CMP r0,#6 ;109
00006a dbe6 BLT |L3.58|
;;;115 }
;;;116
;;;117 }
00006c bd08 POP {r3,pc}
;;;118 #endif
ENDP
00006e 0000 DCW 0x0000
|L3.112|
000070 7764672d DCB "wdg-log",0
000074 6c6f6700
|L3.120|
000078 5b25735d DCB "[%s] (%04d) int start...\n",0
00007c 20282530
000080 34642920
000084 696e7420
000088 73746172
00008c 742e2e2e
000090 0a00
000092 00 DCB 0
000093 00 DCB 0
|L3.148|
DCD demo_wdg_callback
|L3.152|
DCD sg_wdg_io_lvl
|L3.156|
DCD sg_wdg_io_pad
|L3.160|
DCD sg_feed_cnt
|L3.164|
0000a4 5b25735d DCB "[%s] (%04d) feed [%d]th done\n",0
0000a8 20282530
0000ac 34642920
0000b0 66656564
0000b4 205b2564
0000b8 5d746820
0000bc 646f6e65
0000c0 0a00
0000c2 00 DCB 0
0000c3 00 DCB 0
AREA ||.data||, DATA, ALIGN=0
sg_wdg_io_pad
000000 01 DCB 0x01
sg_wdg_io_lvl
000001 00 DCB 0x00
sg_feed_cnt
000002 00 DCB 0x00
;*** Start embedded assembler ***
#line 1 "..\\..\\src\\app\\module_demo\\demo_hal_wdg.c"
AREA ||.rev16_text||, CODE
THUMB
EXPORT |__asm___14_demo_hal_wdg_c_481a36a8____REV16|
#line 467 "C:\\Keil_v5\\ARM\\PACK\\ARM\\CMSIS\\5.5.1\\CMSIS\\Core\\Include\\cmsis_armcc.h"
|__asm___14_demo_hal_wdg_c_481a36a8____REV16| PROC
#line 468
rev16 r0, r0
bx lr
ENDP
AREA ||.revsh_text||, CODE
THUMB
EXPORT |__asm___14_demo_hal_wdg_c_481a36a8____REVSH|
#line 482
|__asm___14_demo_hal_wdg_c_481a36a8____REVSH| PROC
#line 483
revsh r0, r0
bx lr
ENDP
;*** End embedded assembler ***

View File

@ -0,0 +1,95 @@
; 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 -O0 --diag_suppress=9931 -I..\..\src -I..\..\src\board -I..\..\src\common -I..\..\src\sdk\include -I..\..\src\sdk\include\M0 -I..\..\src\app -I..\..\src\app\S8 -I..\..\src\app\touch -I..\..\src\app\module_demo -I..\..\src\app\Mi12Lite -I.\RTE\_WL668 -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\CMSIS\Core\Include -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\Device\ARM\ARMCM0\Include -D__MICROLIB -D__UVISION_VERSION=528 -D_RTE_ -DARMCM0 --omf_browse=.\objects\main.crf ..\..\src\app\main.c]
THUMB
AREA ||i.main||, CODE, READONLY, ALIGN=2
main PROC
;;;68 #endif /* __MODULE_DEMO_MAIN_H__ */
;;;9 int main()
000000 f7fffffe BL board_Init
;;;10 {
;;;11 board_Init();
;;;12
;;;13 while (1)
000004 e00b B |L1.30|
|L1.6|
;;;14 {
;;;15 #if _MODULE_DEMO_ENABLE
;;;16 module_demo_main();
;;;17 #endif
;;;18
;;;19 #if _DEMO_S8_EN
;;;20 s8_demo();
000006 f7fffffe BL s8_demo
;;;21 #endif
;;;22
;;;23 #if _DEMO_S8P_EN
;;;24 s8p_demo();
;;;25 #endif
;;;26
;;;27 #if _DEMO_S9_EN
;;;28 s9_demo();
;;;29 #endif
;;;30
;;;31 #if _DEMO_MI_12_LITE_EN
;;;32 mi12_lite_demo();
;;;33 #endif
;;;34 TAU_LOGD("668 Demo\n");
00000a bf00 NOP
00000c 2322 MOVS r3,#0x22
00000e a204 ADR r2,|L1.32|
000010 a105 ADR r1,|L1.40|
000012 2000 MOVS r0,#0
000014 f7fffffe BL tau_log_printf
000018 bf00 NOP
;;;35 while (1);
00001a bf00 NOP
|L1.28|
00001c e7fe B |L1.28|
|L1.30|
00001e e7f2 B |L1.6|
;;;36 }
;;;37 }
ENDP
|L1.32|
000020 7461755f DCB "tau_log",0
000024 6c6f6700
|L1.40|
000028 5b25735d DCB "[%s] (%04d) 668 Demo\n",0
00002c 20282530
000030 34642920
000034 36363820
000038 44656d6f
00003c 0a00
00003e 00 DCB 0
00003f 00 DCB 0
;*** Start embedded assembler ***
#line 1 "..\\..\\src\\app\\main.c"
AREA ||.rev16_text||, CODE
THUMB
EXPORT |__asm___6_main_c_main____REV16|
#line 467 "C:\\Keil_v5\\ARM\\PACK\\ARM\\CMSIS\\5.5.1\\CMSIS\\Core\\Include\\cmsis_armcc.h"
|__asm___6_main_c_main____REV16| PROC
#line 468
rev16 r0, r0
bx lr
ENDP
AREA ||.revsh_text||, CODE
THUMB
EXPORT |__asm___6_main_c_main____REVSH|
#line 482
|__asm___6_main_c_main____REVSH| PROC
#line 483
revsh r0, r0
bx lr
ENDP
;*** End embedded assembler ***
__ARM_use_no_argv EQU 0

View File

View File

@ -0,0 +1,66 @@
; 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\module_demo_main.o --asm_dir=.\Listings\ --list_dir=.\Listings\ --depend=.\objects\module_demo_main.d --cpu=Cortex-M0 --apcs=interwork -O0 --diag_suppress=9931 -I..\..\src -I..\..\src\board -I..\..\src\common -I..\..\src\sdk\include -I..\..\src\sdk\include\M0 -I..\..\src\app -I..\..\src\app\S8 -I..\..\src\app\touch -I..\..\src\app\module_demo -I..\..\src\app\Mi12Lite -I.\RTE\_WL668 -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\CMSIS\Core\Include -IC:\Keil_v5\ARM\PACK\ARM\CMSIS\5.5.1\Device\ARM\ARMCM0\Include -D__MICROLIB -D__UVISION_VERSION=528 -D_RTE_ -DARMCM0 --omf_browse=.\objects\module_demo_main.crf ..\..\src\app\module_demo\module_demo_main.c]
THUMB
AREA ||i.module_demo_main||, CODE, READONLY, ALIGN=1
module_demo_main PROC
;;;14
;;;15 void module_demo_main()
000000 4770 BX lr
;;;16 {
;;;17 #if _MODULE_DEMO_DSI_TX_EN
;;;18 demo_dsi_tx_case();
;;;19 #endif
;;;20
;;;21 #if _MODULE_DEMO_DSI_RX_EN
;;;22 demo_hal_dsi_rx_case();
;;;23 #endif
;;;24
;;;25 #if _MODULE_DEMO_TIMER_EN
;;;26 demo_timer_case();
;;;27 #endif
;;;28
;;;29 #if _MODULE_DEMO_WDG_EN
;;;30 demo_wdg_case();
;;;31 #endif
;;;32
;;;33 #if _MODULE_DEMO_GPIO_EN
;;;34 demo_gpio_case();
;;;35 #endif
;;;36
;;;37 #if _MODULE_DEMO_SWIRE_EN
;;;38 demo_hal_swire();
;;;39 #endif
;;;40
;;;41 #if _MODULE_DEMO_SPI_EN
;;;42 demo_hal_spi();
;;;43 #endif
;;;44
;;;45 #if _MODULE_DEMO_I2C_EN
;;;46 demo_hal_i2c();
;;;47 #endif
;;;48
;;;49 #if _MODULE_DEMO_FLASH_EN
;;;50 demo_hal_flash();
;;;51 #endif
;;;52
;;;53 #if _MODULE_DEMO_PWM_EN
;;;54 demo_hal_pwm();
;;;55 #endif
;;;56
;;;57 #if _MODULE_DEMO_PWR_EN
;;;58 demo_hal_pwr();
;;;59 #endif
;;;60
;;;61 #if _MODULE_DEMO_UART_EN
;;;62 demo_hal_uart_case();
;;;63 #endif
;;;64
;;;65 #if _MODULE_DEMO_CRC_EN
;;;66 demo_hal_crc_case();
;;;67 #endif
;;;68
;;;69 }
ENDP

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

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

476
project/WL668/WL668.uvprojx Normal file
View File

@ -0,0 +1,476 @@
<?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>WL668</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<pArmCC>5060750::V5.06 update 6 (build 750)::ARMCC</pArmCC>
<pCCUsed>5060750::V5.06 update 6 (build 750)::ARMCC</pCCUsed>
<uAC6>0</uAC6>
<TargetOption>
<TargetCommonOption>
<Device>ARMCM0</Device>
<Vendor>ARM</Vendor>
<PackID>ARM.CMSIS.5.5.1</PackID>
<PackURL>http://www.keil.com/pack/</PackURL>
<Cpu>IRAM(0x20000000,0x00020000) IROM(0x00000000,0x00040000) CPUTYPE("Cortex-M0") CLOCK(12000000) ESEL ELITTLE</Cpu>
<FlashUtilSpec></FlashUtilSpec>
<StartupFile></StartupFile>
<FlashDriverDll>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000)</FlashDriverDll>
<DeviceId>0</DeviceId>
<RegisterFile>$$Device:ARMCM0$Device\ARM\ARMCM0\Include\ARMCM0.h</RegisterFile>
<MemoryEnv></MemoryEnv>
<Cmp></Cmp>
<Asm></Asm>
<Linker></Linker>
<OHString></OHString>
<InfinionOptionDll></InfinionOptionDll>
<SLE66CMisc></SLE66CMisc>
<SLE66AMisc></SLE66AMisc>
<SLE66LinkerMisc></SLE66LinkerMisc>
<SFDFile></SFDFile>
<bCustSvd>0</bCustSvd>
<UseEnv>0</UseEnv>
<BinPath></BinPath>
<IncludePath></IncludePath>
<LibPath></LibPath>
<RegisterFilePath></RegisterFilePath>
<DBRegisterFilePath></DBRegisterFilePath>
<TargetStatus>
<Error>0</Error>
<ExitCodeStop>0</ExitCodeStop>
<ButtonStop>0</ButtonStop>
<NotGenerated>0</NotGenerated>
<InvalidFlash>1</InvalidFlash>
</TargetStatus>
<OutputDirectory>.\Objects\</OutputDirectory>
<OutputName>X90Pro_WL668_20240319</OutputName>
<CreateExecutable>1</CreateExecutable>
<CreateLib>0</CreateLib>
<CreateHexFile>1</CreateHexFile>
<DebugInformation>1</DebugInformation>
<BrowseInformation>1</BrowseInformation>
<ListingPath>.\Listings\</ListingPath>
<HexFormatSelection>1</HexFormatSelection>
<Merge32K>0</Merge32K>
<CreateBatchFile>1</CreateBatchFile>
<BeforeCompile>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopU1X>0</nStopU1X>
<nStopU2X>0</nStopU2X>
</BeforeCompile>
<BeforeMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopB1X>0</nStopB1X>
<nStopB2X>0</nStopB2X>
</BeforeMake>
<AfterMake>
<RunUserProg1>1</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name>fromelf --bin -o .\Objects\@L.bin .\Objects\@L.axf</UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopA1X>0</nStopA1X>
<nStopA2X>0</nStopA2X>
</AfterMake>
<SelectedForBatchBuild>0</SelectedForBatchBuild>
<SVCSIdString></SVCSIdString>
</TargetCommonOption>
<CommonProperty>
<UseCPPCompiler>0</UseCPPCompiler>
<RVCTCodeConst>0</RVCTCodeConst>
<RVCTZI>0</RVCTZI>
<RVCTOtherData>0</RVCTOtherData>
<ModuleSelection>0</ModuleSelection>
<IncludeInBuild>1</IncludeInBuild>
<AlwaysBuild>0</AlwaysBuild>
<GenerateAssemblyFile>0</GenerateAssemblyFile>
<AssembleAssemblyFile>0</AssembleAssemblyFile>
<PublicsOnly>0</PublicsOnly>
<StopOnExitCode>3</StopOnExitCode>
<CustomArgument></CustomArgument>
<IncludeLibraryModules></IncludeLibraryModules>
<ComprImg>1</ComprImg>
</CommonProperty>
<DllOption>
<SimDllName>SARMCM3.DLL</SimDllName>
<SimDllArguments> </SimDllArguments>
<SimDlgDll>DARMCM1.DLL</SimDlgDll>
<SimDlgDllArguments>-pCM0</SimDlgDllArguments>
<TargetDllName>SARMCM3.DLL</TargetDllName>
<TargetDllArguments> </TargetDllArguments>
<TargetDlgDll>TARMCM1.DLL</TargetDlgDll>
<TargetDlgDllArguments>-pCM0</TargetDlgDllArguments>
</DllOption>
<DebugOption>
<OPTHX>
<HexSelection>1</HexSelection>
<HexRangeLowAddress>0</HexRangeLowAddress>
<HexRangeHighAddress>0</HexRangeHighAddress>
<HexOffset>0</HexOffset>
<Oh166RecLen>16</Oh166RecLen>
</OPTHX>
</DebugOption>
<Utilities>
<Flash1>
<UseTargetDll>1</UseTargetDll>
<UseExternalTool>0</UseExternalTool>
<RunIndependent>0</RunIndependent>
<UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
<Capability>1</Capability>
<DriverSelection>4096</DriverSelection>
</Flash1>
<bUseTDR>1</bUseTDR>
<Flash2>BIN\UL2CM3.DLL</Flash2>
<Flash3>"" ()</Flash3>
<Flash4></Flash4>
<pFcarmOut></pFcarmOut>
<pFcarmGrp></pFcarmGrp>
<pFcArmRoot></pFcArmRoot>
<FcArmLst>0</FcArmLst>
</Utilities>
<TargetArmAds>
<ArmAdsMisc>
<GenerateListings>0</GenerateListings>
<asHll>1</asHll>
<asAsm>1</asAsm>
<asMacX>1</asMacX>
<asSyms>1</asSyms>
<asFals>1</asFals>
<asDbgD>1</asDbgD>
<asForm>1</asForm>
<ldLst>0</ldLst>
<ldmm>1</ldmm>
<ldXref>1</ldXref>
<BigEnd>0</BigEnd>
<AdsALst>1</AdsALst>
<AdsACrf>1</AdsACrf>
<AdsANop>0</AdsANop>
<AdsANot>0</AdsANot>
<AdsLLst>1</AdsLLst>
<AdsLmap>1</AdsLmap>
<AdsLcgr>1</AdsLcgr>
<AdsLsym>1</AdsLsym>
<AdsLszi>1</AdsLszi>
<AdsLtoi>1</AdsLtoi>
<AdsLsun>1</AdsLsun>
<AdsLven>1</AdsLven>
<AdsLsxf>1</AdsLsxf>
<RvctClst>1</RvctClst>
<GenPPlst>1</GenPPlst>
<AdsCpuType>"Cortex-M0"</AdsCpuType>
<RvctDeviceName></RvctDeviceName>
<mOS>0</mOS>
<uocRom>0</uocRom>
<uocRam>0</uocRam>
<hadIROM>1</hadIROM>
<hadIRAM>1</hadIRAM>
<hadXRAM>0</hadXRAM>
<uocXRam>0</uocXRam>
<RvdsVP>0</RvdsVP>
<RvdsMve>0</RvdsMve>
<hadIRAM2>0</hadIRAM2>
<hadIROM2>0</hadIROM2>
<StupSel>16</StupSel>
<useUlib>1</useUlib>
<EndSel>1</EndSel>
<uLtcg>0</uLtcg>
<nSecure>0</nSecure>
<RoSelD>4</RoSelD>
<RwSelD>3</RwSelD>
<CodeSel>0</CodeSel>
<OptFeed>0</OptFeed>
<NoZi1>0</NoZi1>
<NoZi2>0</NoZi2>
<NoZi3>0</NoZi3>
<NoZi4>0</NoZi4>
<NoZi5>0</NoZi5>
<Ro1Chk>0</Ro1Chk>
<Ro2Chk>0</Ro2Chk>
<Ro3Chk>0</Ro3Chk>
<Ir1Chk>0</Ir1Chk>
<Ir2Chk>1</Ir2Chk>
<Ra1Chk>0</Ra1Chk>
<Ra2Chk>0</Ra2Chk>
<Ra3Chk>0</Ra3Chk>
<Im1Chk>1</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>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT6>
<OCR_RVCT7>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT7>
<OCR_RVCT8>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT8>
<OCR_RVCT9>
<Type>0</Type>
<StartAddress>0x70000</StartAddress>
<Size>0x8000</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>1</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></Define>
<Undefine></Undefine>
<IncludePath>..\..\src;..\..\src\board;..\..\src\common;..\..\src\sdk\include;..\..\src\sdk\include\M0;..\..\src\app;..\..\src\app\S8;..\..\src\app\touch;..\..\src\app\module_demo;..\..\src\app\Mi12Lite</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>app_tp_transfer.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\touch\app_tp_transfer.c</FilePath>
</File>
<File>
<FileName>app_tp_for_custom_s8.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\S8\app_tp_for_custom_s8.c</FilePath>
</File>
<File>
<FileName>s8_demo.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\S8\s8_demo.c</FilePath>
</File>
<File>
<FileName>demo_version.txt</FileName>
<FileType>5</FileType>
<FilePath>..\..\src\app\demo_version.txt</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>driver</GroupName>
<Files>
<File>
<FileName>CVWL668.lib</FileName>
<FileType>4</FileType>
<FilePath>..\..\src\sdk\CVWL668\lib\CVWL668.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.2.0" condition="ARMv6_7_8-M Device">
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.5.1"/>
<targetInfos>
<targetInfo name="WL668"/>
</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>

View File

@ -0,0 +1,546 @@
<?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>WL668T</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<pArmCC>5060750::V5.06 update 6 (build 750)::ARMCC</pArmCC>
<pCCUsed>5060750::V5.06 update 6 (build 750)::ARMCC</pCCUsed>
<uAC6>0</uAC6>
<TargetOption>
<TargetCommonOption>
<Device>ARMCM0</Device>
<Vendor>ARM</Vendor>
<PackID>ARM.CMSIS.5.5.1</PackID>
<PackURL>http://www.keil.com/pack/</PackURL>
<Cpu>IRAM(0x20000000,0x00020000) IROM(0x00000000,0x00040000) CPUTYPE("Cortex-M0") CLOCK(12000000) ESEL ELITTLE</Cpu>
<FlashUtilSpec></FlashUtilSpec>
<StartupFile></StartupFile>
<FlashDriverDll>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000)</FlashDriverDll>
<DeviceId>0</DeviceId>
<RegisterFile>$$Device:ARMCM0$Device\ARM\ARMCM0\Include\ARMCM0.h</RegisterFile>
<MemoryEnv></MemoryEnv>
<Cmp></Cmp>
<Asm></Asm>
<Linker></Linker>
<OHString></OHString>
<InfinionOptionDll></InfinionOptionDll>
<SLE66CMisc></SLE66CMisc>
<SLE66AMisc></SLE66AMisc>
<SLE66LinkerMisc></SLE66LinkerMisc>
<SFDFile></SFDFile>
<bCustSvd>0</bCustSvd>
<UseEnv>0</UseEnv>
<BinPath></BinPath>
<IncludePath></IncludePath>
<LibPath></LibPath>
<RegisterFilePath></RegisterFilePath>
<DBRegisterFilePath></DBRegisterFilePath>
<TargetStatus>
<Error>0</Error>
<ExitCodeStop>0</ExitCodeStop>
<ButtonStop>0</ButtonStop>
<NotGenerated>0</NotGenerated>
<InvalidFlash>1</InvalidFlash>
</TargetStatus>
<OutputDirectory>.\Objects\</OutputDirectory>
<OutputName>WL668T_demo</OutputName>
<CreateExecutable>1</CreateExecutable>
<CreateLib>0</CreateLib>
<CreateHexFile>1</CreateHexFile>
<DebugInformation>1</DebugInformation>
<BrowseInformation>1</BrowseInformation>
<ListingPath>.\Listings\</ListingPath>
<HexFormatSelection>1</HexFormatSelection>
<Merge32K>0</Merge32K>
<CreateBatchFile>1</CreateBatchFile>
<BeforeCompile>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopU1X>0</nStopU1X>
<nStopU2X>0</nStopU2X>
</BeforeCompile>
<BeforeMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopB1X>0</nStopB1X>
<nStopB2X>0</nStopB2X>
</BeforeMake>
<AfterMake>
<RunUserProg1>1</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name>fromelf --bin -o .\Objects\@L.bin .\Objects\@L.axf</UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopA1X>0</nStopA1X>
<nStopA2X>0</nStopA2X>
</AfterMake>
<SelectedForBatchBuild>0</SelectedForBatchBuild>
<SVCSIdString></SVCSIdString>
</TargetCommonOption>
<CommonProperty>
<UseCPPCompiler>0</UseCPPCompiler>
<RVCTCodeConst>0</RVCTCodeConst>
<RVCTZI>0</RVCTZI>
<RVCTOtherData>0</RVCTOtherData>
<ModuleSelection>0</ModuleSelection>
<IncludeInBuild>1</IncludeInBuild>
<AlwaysBuild>0</AlwaysBuild>
<GenerateAssemblyFile>0</GenerateAssemblyFile>
<AssembleAssemblyFile>0</AssembleAssemblyFile>
<PublicsOnly>0</PublicsOnly>
<StopOnExitCode>3</StopOnExitCode>
<CustomArgument></CustomArgument>
<IncludeLibraryModules></IncludeLibraryModules>
<ComprImg>1</ComprImg>
</CommonProperty>
<DllOption>
<SimDllName>SARMCM3.DLL</SimDllName>
<SimDllArguments> </SimDllArguments>
<SimDlgDll>DARMCM1.DLL</SimDlgDll>
<SimDlgDllArguments>-pCM0</SimDlgDllArguments>
<TargetDllName>SARMCM3.DLL</TargetDllName>
<TargetDllArguments> </TargetDllArguments>
<TargetDlgDll>TARMCM1.DLL</TargetDlgDll>
<TargetDlgDllArguments>-pCM0</TargetDlgDllArguments>
</DllOption>
<DebugOption>
<OPTHX>
<HexSelection>1</HexSelection>
<HexRangeLowAddress>0</HexRangeLowAddress>
<HexRangeHighAddress>0</HexRangeHighAddress>
<HexOffset>0</HexOffset>
<Oh166RecLen>16</Oh166RecLen>
</OPTHX>
</DebugOption>
<Utilities>
<Flash1>
<UseTargetDll>1</UseTargetDll>
<UseExternalTool>0</UseExternalTool>
<RunIndependent>0</RunIndependent>
<UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
<Capability>1</Capability>
<DriverSelection>4096</DriverSelection>
</Flash1>
<bUseTDR>1</bUseTDR>
<Flash2>BIN\UL2CM3.DLL</Flash2>
<Flash3>"" ()</Flash3>
<Flash4></Flash4>
<pFcarmOut></pFcarmOut>
<pFcarmGrp></pFcarmGrp>
<pFcArmRoot></pFcArmRoot>
<FcArmLst>0</FcArmLst>
</Utilities>
<TargetArmAds>
<ArmAdsMisc>
<GenerateListings>0</GenerateListings>
<asHll>1</asHll>
<asAsm>1</asAsm>
<asMacX>1</asMacX>
<asSyms>1</asSyms>
<asFals>1</asFals>
<asDbgD>1</asDbgD>
<asForm>1</asForm>
<ldLst>0</ldLst>
<ldmm>1</ldmm>
<ldXref>1</ldXref>
<BigEnd>0</BigEnd>
<AdsALst>1</AdsALst>
<AdsACrf>1</AdsACrf>
<AdsANop>0</AdsANop>
<AdsANot>0</AdsANot>
<AdsLLst>1</AdsLLst>
<AdsLmap>1</AdsLmap>
<AdsLcgr>1</AdsLcgr>
<AdsLsym>1</AdsLsym>
<AdsLszi>1</AdsLszi>
<AdsLtoi>1</AdsLtoi>
<AdsLsun>1</AdsLsun>
<AdsLven>1</AdsLven>
<AdsLsxf>1</AdsLsxf>
<RvctClst>1</RvctClst>
<GenPPlst>1</GenPPlst>
<AdsCpuType>"Cortex-M0"</AdsCpuType>
<RvctDeviceName></RvctDeviceName>
<mOS>0</mOS>
<uocRom>0</uocRom>
<uocRam>0</uocRam>
<hadIROM>1</hadIROM>
<hadIRAM>1</hadIRAM>
<hadXRAM>0</hadXRAM>
<uocXRam>0</uocXRam>
<RvdsVP>0</RvdsVP>
<RvdsMve>0</RvdsMve>
<hadIRAM2>0</hadIRAM2>
<hadIROM2>0</hadIROM2>
<StupSel>16</StupSel>
<useUlib>1</useUlib>
<EndSel>1</EndSel>
<uLtcg>0</uLtcg>
<nSecure>0</nSecure>
<RoSelD>4</RoSelD>
<RwSelD>3</RwSelD>
<CodeSel>0</CodeSel>
<OptFeed>0</OptFeed>
<NoZi1>0</NoZi1>
<NoZi2>0</NoZi2>
<NoZi3>0</NoZi3>
<NoZi4>0</NoZi4>
<NoZi5>0</NoZi5>
<Ro1Chk>0</Ro1Chk>
<Ro2Chk>0</Ro2Chk>
<Ro3Chk>0</Ro3Chk>
<Ir1Chk>0</Ir1Chk>
<Ir2Chk>1</Ir2Chk>
<Ra1Chk>0</Ra1Chk>
<Ra2Chk>0</Ra2Chk>
<Ra3Chk>0</Ra3Chk>
<Im1Chk>1</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>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT6>
<OCR_RVCT7>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT7>
<OCR_RVCT8>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT8>
<OCR_RVCT9>
<Type>0</Type>
<StartAddress>0x70000</StartAddress>
<Size>0x8000</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>1</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></Define>
<Undefine></Undefine>
<IncludePath>..\..\src;..\..\src\board;..\..\src\common;..\..\src\sdk\include;..\..\src\sdk\include\M0;..\..\src\app;..\..\src\app\S8;..\..\src\app\touch;..\..\src\app\module_demo;..\..\src\app\Mi12Lite</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>app_tp_transfer.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\touch\app_tp_transfer.c</FilePath>
</File>
<File>
<FileName>app_tp_for_custom_s8.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\S8\app_tp_for_custom_s8.c</FilePath>
</File>
<File>
<FileName>s8_demo.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\S8\s8_demo.c</FilePath>
</File>
<File>
<FileName>Mi12Lite.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\Mi12Lite\Mi12Lite.c</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>driver</GroupName>
<Files>
<File>
<FileName>CVWL668T.lib</FileName>
<FileType>4</FileType>
<FilePath>..\..\src\sdk\CVWL668T\lib\CVWL668T.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>modules_demo</GroupName>
<Files>
<File>
<FileName>demo_hal_crc.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\module_demo\demo_hal_crc.c</FilePath>
</File>
<File>
<FileName>demo_hal_dsi_rx.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\module_demo\demo_hal_dsi_rx.c</FilePath>
</File>
<File>
<FileName>demo_hal_dsi_tx.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\module_demo\demo_hal_dsi_tx.c</FilePath>
</File>
<File>
<FileName>demo_hal_flash.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\module_demo\demo_hal_flash.c</FilePath>
</File>
<File>
<FileName>demo_hal_gpio.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\module_demo\demo_hal_gpio.c</FilePath>
</File>
<File>
<FileName>demo_hal_i2c.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\module_demo\demo_hal_i2c.c</FilePath>
</File>
<File>
<FileName>demo_hal_spi.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\module_demo\demo_hal_spi.c</FilePath>
</File>
<File>
<FileName>demo_hal_pwm.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\module_demo\demo_hal_pwm.c</FilePath>
</File>
<File>
<FileName>demo_hal_pwr.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\module_demo\demo_hal_pwr.c</FilePath>
</File>
<File>
<FileName>demo_hal_swire.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\module_demo\demo_hal_swire.c</FilePath>
</File>
<File>
<FileName>demo_hal_uart.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\module_demo\demo_hal_uart.c</FilePath>
</File>
<File>
<FileName>demo_hal_wdg.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\module_demo\demo_hal_wdg.c</FilePath>
</File>
<File>
<FileName>module_demo_main.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\src\app\module_demo\module_demo_main.c</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>::CMSIS</GroupName>
</Group>
</Groups>
</Target>
</Targets>
<RTE>
<apis/>
<components>
<component Cclass="CMSIS" Cgroup="CORE" Cvendor="ARM" Cversion="5.2.0" condition="ARMv6_7_8-M Device">
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.5.1"/>
<targetInfos>
<targetInfo name="WL668T"/>
</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>

View File

@ -0,0 +1,11 @@
1. 此目录下所有project文件仅为链接文件使用宏定义和库文件区分
2. 强烈建议将不使用的芯片型号文件夹删除,仅保留使用的芯片型号文件夹,以免串烧导致芯片烧坏
3. 如若更换芯片仅需将提供的原工程下特定型号文件夹拷贝到模板工程删除原芯片project下原型号文件夹重新编译即可
如原来使用668芯片后面更换为668T芯片仅需把客户工程project下668文件夹删除重新从提供的源工程下的668T文件夹拷贝到客户工程project下打开重新编译即可
SDK每次更新会在demo.c中增加代码或注释请自行阅读。
第三代产品包括WL668,668T,468

1348
src/app/Mi12Lite/Mi12Lite.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,15 @@
/*******************************************************************************
* Copyright (C) 2019-2022, TAU Systems (R),All Rights Reserved.
*
* File: Mi12Lite.h
* Description XiaoMi 12 Lite file
* Version V0.1
* Date 2023-06-25
* Author Jaya
*******************************************************************************/
#ifndef __MI12_LITE_DEMO_H__
#define __MI12_LITE_DEMO_H__
void mi12_lite_demo(void);
#endif /* __MI12_LITE_DEMO_H__ */

View File

@ -0,0 +1,486 @@
/*******************************************************************************
*
*
* File: app_tp_for_custom.c
* Description tp start/sleep/awake
* Version V0.1
* Date 2021-10-14
* Author zhanghz
*******************************************************************************/
#include "test_cfg_global.h"
#if _DEMO_S8_EN
#if 0
#include "s8_update_firmware.c"
#else
#include "app_tp_for_custom_s8.h"
#include "app_tp_phone_transfer_data_s8.h"
#include "app_tp_screen_transfer_data_s8.h"
#include "tau_log.h"
#include "tau_delay.h"
#include "hal_i2c_slave.h"
#include "tau_operations.h"
#include "hal_system.h"
#ifdef LOG_TAG
#undef LOG_TAG
#endif
#define LOG_TAG "s8_tp"
#define S8_TP_DEBUG_LOG 0
#define Touch_Release_Event_Time 2 //手指松开时间 50ms步进
#define Touch_MAX_Point 10 //最大触摸点
typedef struct
{
uint16_t X; // 坐标
uint16_t Y; // 坐标
uint16_t X_in; // 坐标
uint16_t Y_in; // 坐标
uint16_t Z; // 触摸面积
uint8_t Event;//0无触 1按下 2移动 3松开
uint8_t Eventbk;//0无触 1按下 2移动 3松开
uint16_t Event_Time;//事件保持时间
} Touch_Single_Point_str;
typedef struct
{
Touch_Single_Point_str Touch_Single_Point[Touch_MAX_Point];//最大 10 个触摸点
uint8_t Event_Hold;//事件保持 1表示有触摸点事件
uint8_t Event_Single_Flag;//单次触发触摸点事件,1表示当前可以触发一次触点事件,可给中断
} Touch_str;
Touch_str Touch = //初始化值
{
.Touch_Single_Point[0] = (Touch_Single_Point_str){.X = 0, .Y = 0, .X_in = 0, .Y_in = 0, .Z = 0, .Event = 0, .Eventbk = 0, .Event_Time = 0,},
.Touch_Single_Point[1] = (Touch_Single_Point_str){.X = 0, .Y = 0, .X_in = 0, .Y_in = 0, .Z = 0, .Event = 0, .Eventbk = 0, .Event_Time = 0,},
.Touch_Single_Point[2] = (Touch_Single_Point_str){.X = 0, .Y = 0, .X_in = 0, .Y_in = 0, .Z = 0, .Event = 0, .Eventbk = 0, .Event_Time = 0,},
.Touch_Single_Point[3] = (Touch_Single_Point_str){.X = 0, .Y = 0, .X_in = 0, .Y_in = 0, .Z = 0, .Event = 0, .Eventbk = 0, .Event_Time = 0,},
.Touch_Single_Point[4] = (Touch_Single_Point_str){.X = 0, .Y = 0, .X_in = 0, .Y_in = 0, .Z = 0, .Event = 0, .Eventbk = 0, .Event_Time = 0,},
#if (Touch_MAX_Point==10)
.Touch_Single_Point[5] = (Touch_Single_Point_str){.X = 0, .Y = 0, .X_in = 0, .Y_in = 0, .Z = 0, .Event = 0, .Eventbk = 0, .Event_Time = 0,},
.Touch_Single_Point[6] = (Touch_Single_Point_str){.X = 0, .Y = 0, .X_in = 0, .Y_in = 0, .Z = 0, .Event = 0, .Eventbk = 0, .Event_Time = 0,},
.Touch_Single_Point[7] = (Touch_Single_Point_str){.X = 0, .Y = 0, .X_in = 0, .Y_in = 0, .Z = 0, .Event = 0, .Eventbk = 0, .Event_Time = 0,},
.Touch_Single_Point[8] = (Touch_Single_Point_str){.X = 0, .Y = 0, .X_in = 0, .Y_in = 0, .Z = 0, .Event = 0, .Eventbk = 0, .Event_Time = 0,},
.Touch_Single_Point[9] = (Touch_Single_Point_str){.X = 0, .Y = 0, .X_in = 0, .Y_in = 0, .Z = 0, .Event = 0, .Eventbk = 0, .Event_Time = 0,},
#endif
.Event_Hold = 0,
.Event_Single_Flag = 0,
};
io_pad_e g_screen_input_rst_pad = IO_PAD_TD_TP_RESX; /* FIXME Cuckoo没有TD TPRSTN,QFN 封装片上使用的是FC IO2 */
io_pad_e g_screen_input_int_pad = IO_PAD_TD_INT;
io_pad_e g_phone_input_rst_pad = IO_PAD_AP_TPRSTN;
io_pad_e g_phone_output_int_pad = IO_PAD_AP_INT;
static uint8_t start_now = 1;
/*************************************报点协议 master 相关 buffer ****************************************/
uint8_t screen_data_write_1[1] = {0x87}; //触点/坐标 数据读取对应的发送buffer
uint8_t screen_data_write_2[3] = {0xc0, 0x05, 0x01}; //配置buffer
uint8_t screen_data_write_3[3] = {0xc0, 0x05, 0x00}; //配置buffer
st_screen_data screen_reg_int_data[] = { \
{screen_data_write_1, 1, 10, SCREEN_TRANSFER_READ}, \
{screen_data_write_2, 3, 0, SCREEN_TRANSFER_WRITE}, \
{screen_data_write_3, 3, 0, SCREEN_TRANSFER_WRITE}
};
const uint8_t screen_reg_int_data_size = sizeof(screen_reg_int_data) / sizeof(
st_screen_data);//结构体数组的元素个数,数组按照协议发送数据先后排列
/***********************************报点协议 master 相关 buffer 截止**************************************/
/***********************************开机屏幕初始化 master 相关 buffer ************************************/
// 数组按照协议发送数据先后排列
st_screen_const_data screen_reg_start_data[] = { \
{data_num_00, screen_87_data, sizeof(screen_87_data), 10, SCREEN_TRANSFER_READ}, \
{data_num_01, screen_a0_00_ff_data, sizeof(screen_a0_00_ff_data), 0, SCREEN_TRANSFER_WRITE}, \
{data_num_02, screen_a4_06_c1_data, sizeof(screen_a4_06_c1_data), 0, SCREEN_TRANSFER_WRITE}, \
};
const uint8_t screen_reg_start_data_size = sizeof(screen_reg_start_data) / sizeof(st_screen_const_data);
/*********************************开机屏幕初始化 master 相关 buffer 截止**********************************/
/*************************************报点协议 slave 相关 buffer******************************************/
uint8_t phone_reg_coord_data[] = {0x60}; //坐标 数据反馈对应的接收数据
uint8_t phone_reg_coord_back[8] = {0x09, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00}; //坐标 数据反馈对应的数据buffer
uint8_t phone_reg_coord_back_BUF[10][10] = {0x09, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00}; //坐标 数据反馈对应的数据buffer
uint8_t phone_reg_coord_back_X61[80] = {0x09, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00}; //坐标 数据反馈对应的数据buffer
uint8_t phone_reg_coord_BUF_NUM = 0;
st_reg_data phone_reg_int_data[] = {{1, 8, phone_reg_coord_back_X61, phone_reg_coord_back_X61}};
uint8_t phone_reg_int_size = sizeof(phone_reg_int_data) / sizeof(phone_reg_int_data[0]);
/***********************************报点协议 slave 相关 buffer 截止***************************************/
/****************************开机阶段slave需要反馈的数据及其对应的接收开头********************************/
st_reg_const_data phone_reg_const_data[] = { \
{sizeof(phone_60_start_back), sizeof(phone_60_start_back), phone_60_start_back, phone_60_start_back}, \
{sizeof(phone_22_data), sizeof(phone_22_back), phone_22_data, phone_22_back}, \
{sizeof(phone_21_data), sizeof(phone_21_back), phone_21_data, phone_21_back}, \
{sizeof(phone_55_data), sizeof(phone_55_back), phone_55_data, phone_55_back}, \
{sizeof(phone_af_data), sizeof(phone_af_back), phone_af_data, phone_af_back}, \
{sizeof(phone_f1_data), sizeof(phone_f1_back), phone_f1_data, phone_f1_back}, \
{sizeof(phone_a5_data), sizeof(phone_a5_back), phone_a5_data, phone_a5_back}, \
{sizeof(phone_a3_data), sizeof(phone_a3_back), phone_a3_data, phone_a3_back}, \
{sizeof(phone_a4_data), sizeof(phone_a4_back), phone_a4_data, phone_a4_back}, \
{sizeof(phone_52_data), sizeof(phone_52_back), phone_52_data, phone_52_back}, \
{sizeof(phone_23_data), sizeof(phone_23_back), phone_23_data, phone_23_back}, \
{sizeof(phone_30_data), sizeof(phone_30_back), phone_30_data, phone_30_back}, \
{sizeof(phone_e4_00_data), sizeof(phone_e4_00_back), phone_e4_00_data, phone_e4_00_back}, \
{sizeof(phone_e4_01_data), sizeof(phone_e4_01_back), phone_e4_01_data, phone_e4_01_back}, \
{sizeof(phone_85_data), sizeof(phone_85_back), phone_85_data, phone_85_back}, \
{sizeof(phone_f5_data), sizeof(phone_f5_back), phone_f5_data, phone_f5_back}, \
{sizeof(phone_f6_data), sizeof(phone_f6_back), phone_f6_data, phone_f6_back}, \
{sizeof(phone_ea_data), sizeof(phone_ea_back), phone_ea_data, phone_ea_back}, \
{sizeof(phone_b1_data), sizeof(phone_b1_back), phone_b1_data, phone_b1_back}, \
{sizeof(phone_72_data), sizeof(phone_72_back), phone_72_data, phone_72_back}, \
{sizeof(phone_80_data), sizeof(phone_80_back), phone_80_data, phone_80_back}, \
{sizeof(phone_90_data), sizeof(phone_90_back), phone_90_data, phone_90_back} \
};
uint8_t phone_reg_const_data_size = sizeof(phone_reg_const_data) / sizeof(phone_reg_const_data[0]);
/***************************开机阶段slave需要反馈的数据及其对应的接收开头截止******************************/
/**************************************************************************
* @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)
{
uint8_t return_num = transfer_now + 1;
static uint8_t app_tp_count = 0;
switch (transfer_now)
{
case data_num_00: //87
if (rxbuffer[1] == 0x87 && rxbuffer[2] == 0x03)
{
#if S8_TP_DEBUG_LOG
TAU_LOGD("87 wait 03 ok\r\n");
#endif
}
else
{
#if S8_TP_DEBUG_LOG
TAU_LOGD("TD TP init [%d] \r\n", rxbuffer[2]);
#endif
app_tp_count++;
return_num = transfer_now;
if (app_tp_count > 120) //初始化不成功重新reset screen
{
app_tp_count = 0;
app_tp_screen_init();
return_num = data_num_00;
}
delayMs(10);
}
break;
default:
break;
}
return return_num;
}
/**************************************************************************
* @name : app_tp_screen_analysis_int
* @brief : screen
* @param[in] :
* @return :
* @retval :
**************************************************************************/
uint8_t app_tp_screen_analysis_int(uint8_t transfer_now, uint8_t *rxbuffer, size_t data_size)
{
for (uint8_t ss = 0; ss < 10; ss++)
phone_reg_coord_back_BUF[phone_reg_coord_BUF_NUM][ss] = rxbuffer[ss];
if (++phone_reg_coord_BUF_NUM >= Touch_MAX_Point)
phone_reg_coord_BUF_NUM = Touch_MAX_Point;
if ((rxbuffer[9] & 0x1f) > 0)
{
return 0;
}
for (uint8_t ss = 0; ss < phone_reg_coord_BUF_NUM; ss++)
{
uint8_t touch_id = 0;
uint8_t touch_event_id = 0;
touch_id = phone_reg_coord_back_BUF[ss][3] >> 4;
if (touch_id >= Touch_MAX_Point)
continue; //判断手指编号是否超出范围
touch_event_id = phone_reg_coord_back_BUF[ss][2] >> 4;//触摸事件
if (touch_event_id == 0x01)
{
Touch.Touch_Single_Point[touch_id].Event = 0x01;
Touch.Touch_Single_Point[touch_id].Event_Time = Touch_Release_Event_Time;
Touch.Touch_Single_Point[touch_id].X_in = (((uint16_t)phone_reg_coord_back_BUF[ss][5] & 0x0F) << 8) |
(phone_reg_coord_back_BUF[ss][4]);
Touch.Touch_Single_Point[touch_id].Y_in = ((uint16_t)phone_reg_coord_back_BUF[ss][6] << 4) | ((
phone_reg_coord_back_BUF[ss][5] & 0xF0) >> 4);
Touch.Touch_Single_Point[touch_id].Z = phone_reg_coord_back_BUF[ss][7];
//分辨率转换
Touch.Touch_Single_Point[touch_id].X = (((float)Touch.Touch_Single_Point[touch_id].X_in) *
(float)INPUT_WIDTH_VALUE) / ((float)OUTPUT_WIDTH_VALUE);
Touch.Touch_Single_Point[touch_id].Y = (((float)Touch.Touch_Single_Point[touch_id].Y_in) *
(float)INPUT_HEIGHT_VALUE) / ((float)OUTPUT_HEIGHT_VALUE);
}
else if (touch_event_id == 0x02)
{
Touch.Touch_Single_Point[touch_id].Event = 0x02;
Touch.Touch_Single_Point[touch_id].Event_Time = Touch_Release_Event_Time;
Touch.Touch_Single_Point[touch_id].X_in = (((uint16_t)phone_reg_coord_back_BUF[ss][5] & 0x0F) << 8) |
(phone_reg_coord_back_BUF[ss][4]);
Touch.Touch_Single_Point[touch_id].Y_in = ((uint16_t)phone_reg_coord_back_BUF[ss][6] << 4) | ((
phone_reg_coord_back_BUF[ss][5] & 0xF0) >> 4);
Touch.Touch_Single_Point[touch_id].Z = phone_reg_coord_back_BUF[ss][7];
//分辨率转换
Touch.Touch_Single_Point[touch_id].X = (((float)Touch.Touch_Single_Point[touch_id].X_in) *
(float)INPUT_WIDTH_VALUE) / ((float)OUTPUT_WIDTH_VALUE);
Touch.Touch_Single_Point[touch_id].Y = (((float)Touch.Touch_Single_Point[touch_id].Y_in) *
(float)INPUT_HEIGHT_VALUE) / ((float)OUTPUT_HEIGHT_VALUE);
}
else if (touch_event_id == 0x03)
{
Touch.Touch_Single_Point[touch_id].Event = 0x03;
Touch.Touch_Single_Point[touch_id].Event_Time = Touch_Release_Event_Time;
}
else if (touch_event_id == 0x04)
{
if (Touch.Touch_Single_Point[touch_id].Event != 0)
{
Touch.Touch_Single_Point[touch_id].Event_Time = Touch_Release_Event_Time;
}
}
else if (touch_event_id == 0)
{
if (Touch.Touch_Single_Point[touch_id].Event != 0)
{
Touch.Touch_Single_Point[touch_id].Event = 0x03;
Touch.Touch_Single_Point[touch_id].Event_Time = Touch_Release_Event_Time;
}
}
else
{
if (Touch.Touch_Single_Point[touch_id].Event != 0)
{
Touch.Touch_Single_Point[touch_id].Event = 0x03;
Touch.Touch_Single_Point[touch_id].Event_Time = Touch_Release_Event_Time;
}
}
}
Touch.Event_Single_Flag = 1;
phone_reg_coord_BUF_NUM = 0;
if (Touch.Event_Single_Flag)
{
uint8_t Touch_num = 0;
for (uint8_t ss = 0; ss < Touch_MAX_Point; ss++)
{
if (Touch.Touch_Single_Point[ss].Event == 0)
continue;
Touch_num++;
}
uint8_t s1 = 0;
for (uint8_t ss = 0; ss < Touch_MAX_Point; ss++)
{
if (Touch.Touch_Single_Point[ss].Event == 0)
continue;
uint16_t X0, Y0;
X0 = ((float)Touch.Touch_Single_Point[ss].X) * 4095.1 / ((float)INPUT_WIDTH_VALUE);
Y0 = ((float)Touch.Touch_Single_Point[ss].Y) * 4095.1 / ((float)INPUT_HEIGHT_VALUE);
if (X0 > 0xfff)
X0 = 0xfff;
if (Y0 > 0xfff)
Y0 = 0xfff;
//bit0-bit1:event id; 0表示触摸类事件1表示状态事件2表示手势事件3表示空事件
//bit2-bit5:touch id; 表示第几个触摸手指
//bit6-bit7:touch action; 0没有触摸事件1:按下;2:移动;3:松开
phone_reg_coord_back_X61[((s1) * 8) + 0] = (Touch.Touch_Single_Point[ss].Event << 6) | ((
ss + 1) << 2); //44 press C4 leave 84 move
phone_reg_coord_back_X61[((s1) * 8) + 1] = (uint8_t)((X0 & 0xFF0) >> 4); //x 高八位
phone_reg_coord_back_X61[((s1) * 8) + 2] = (uint8_t)((Y0 & 0xFF0) >> 4); //y 高八位
phone_reg_coord_back_X61[((s1) * 8) + 3] = ((X0 & 0xF) << 4) | ((Y0 & 0xF)); //bit0-bit3:y低四位;bit4-bit7:x低四位;
phone_reg_coord_back_X61[((s1) * 8) + 4] = 4; //major
phone_reg_coord_back_X61[((s1) * 8) + 5] = 4; //minor
//touch type0:普通手指触摸1:盘旋2:保护套3:手套;4:尖笔;5:手掌;6:潮湿的;7:接近;8:轻摇
phone_reg_coord_back_X61[((s1) * 8) + 6] = ((Touch.Touch_Single_Point[ss].Z & 0xFE) >> 2); //bit0-bit5:z只有6位;bit6-bit7:touch type的高两位
phone_reg_coord_back_X61[((s1) * 8) + 7] = --Touch_num; //bit0-bit5:buffer里面剩余多少个事件;bit6-bit7touch type 低两位
Touch.Touch_Single_Point[ss].Eventbk = Touch.Touch_Single_Point[ss].Event;
#if S8_TP_DEBUG_LOG
TAU_LOGD("[%x] %d %d\r\n", phone_reg_coord_back_X61[((s1) * 8) + 0], X0, Y0);
#endif
Touch.Touch_Single_Point[ss].Event = 0;
s1++;
}
hal_gpio_set_output_data(g_phone_output_int_pad, IO_LVL_LOW); //拉低TP中断脚,通知AP读取TP数据
Touch.Event_Single_Flag = 0;
}
return screen_reg_int_data_size + 1;
}
void app_tp_phone_analysis_data(uint8_t *rxbuffer, size_t rxbuffer_size, const uint8_t **txbuffer,
size_t *txbuffer_size)
{
static uint8_t phone_reg_e4_count = 1;
switch (rxbuffer[0])
{
case 0x60:
if (start_now)
{
start_now = 0;
*txbuffer_size = sizeof(phone_60_start_back);
*txbuffer = phone_60_start_back;
}
else
{
hal_gpio_set_output_data(g_phone_output_int_pad, IO_LVL_HIGH);
*txbuffer = phone_reg_coord_back_X61;
*txbuffer_size = sizeof(phone_reg_coord_back_X61);
}
break;
case 0x61:
hal_gpio_set_output_data(g_phone_output_int_pad, IO_LVL_HIGH);
*txbuffer = &phone_reg_coord_back_X61[8];
*txbuffer_size = sizeof(phone_reg_coord_back_X61) - 8;
break;
case 0x22:
*txbuffer = phone_22_back;
*txbuffer_size = sizeof(phone_22_back);
break;
case 0x21:
*txbuffer = phone_21_back;
*txbuffer_size = sizeof(phone_21_back);
break;
case 0x55:
*txbuffer = phone_55_back;
*txbuffer_size = sizeof(phone_55_back);
break;
case 0xaf:
*txbuffer = phone_af_back;
*txbuffer_size = sizeof(phone_af_back);
break;
case 0xf1:
*txbuffer = phone_f1_back;
*txbuffer_size = sizeof(phone_f1_back);
break;
case 0xa5:
*txbuffer = phone_a5_back;
*txbuffer_size = sizeof(phone_a5_back);
break;
case 0xa3:
*txbuffer = phone_a3_back;
*txbuffer_size = sizeof(phone_a3_back);
break;
case 0xa4:
*txbuffer = phone_a4_back;
*txbuffer_size = sizeof(phone_a4_back);
break;
case 0x52:
*txbuffer = phone_52_back;
*txbuffer_size = sizeof(phone_52_back);
break;
case 0x23:
*txbuffer = phone_23_back;
*txbuffer_size = sizeof(phone_23_back);
break;
case 0x30:
*txbuffer = phone_30_back;
*txbuffer_size = sizeof(phone_30_back);
break;
case 0xe4:
if (rxbuffer_size == 2)
{
phone_reg_e4_count = rxbuffer[1];
return;
}
else
{
rxbuffer[1] = phone_reg_e4_count;
rxbuffer_size = 2;
}
break;
case 0x85:
*txbuffer = phone_85_back;
*txbuffer_size = sizeof(phone_85_back);
break;
case 0xf5:
*txbuffer = phone_f5_back;
*txbuffer_size = sizeof(phone_f5_back);
break;
case 0xf6:
*txbuffer = phone_f6_back;
*txbuffer_size = sizeof(phone_f6_back);
break;
case 0xea:
*txbuffer = phone_ea_back;
*txbuffer_size = sizeof(phone_ea_back);
break;
case 0xb1:
*txbuffer = phone_b1_back;
*txbuffer_size = sizeof(phone_b1_back);
break;
case 0x72:
*txbuffer = phone_72_back;
*txbuffer_size = sizeof(phone_72_back);
#if S8_TP_DEBUG_LOG
TAU_LOGD("AP Touch Init Ok");
#endif
break;
case 0x80:
*txbuffer = phone_80_back;
*txbuffer_size = sizeof(phone_80_back);
break;
case 0x90:
*txbuffer = phone_90_back;
*txbuffer_size = sizeof(phone_90_back);
break;
}
}
/**************************************************************************
* @name : app_tp_write_other_operations
* @brief : ,reset等
* @param[in] : txbuffer输入数组指针 or null
* @param[in] : buffer_size or
* @param[in] :
* @return :
* @retval : NULL时buffer_size是数组数据长度NULL时,buffer_size作为事件标志位
**************************************************************************/
void app_tp_write_other_operations(const uint8_t *txbuffer, uint32_t buffer_size)
{
if (txbuffer == NULL) //数组为null,buffer_size复用做事件标志
{
switch (buffer_size)
{
case 0:
start_now = 1;
break;
default:
break;
}
}
else
{
//if(txbuffer[0]=='xx') todo 可按需判断数组功能,目前只有一种功能,所以不需要判断了
phone_reg_coord_back_X61[0] = 0x84;
phone_reg_coord_back_X61[7] = 0xff; //发送第七BYTE的值0xff释放全部手指
hal_gpio_set_output_data(g_phone_output_int_pad, IO_LVL_LOW); //拉低TP中断脚,通知AP读取TP数据
}
}
#endif
#endif

View File

@ -0,0 +1,107 @@
/*******************************************************************************
*
*
* 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 "string.h"
#include "tau_device_datatype.h"
#include "tau_common.h"
#include "app_tp_transfer.h"
#include "hal_gpio.h"
#include "s8_demo.h"
#define BUFFER_SIZE_MAX 250 //定义 bufrer 最大的字节数
#define SCREEN_INT_LOW_DEFAULT 0
/** 跟手机之间使用 I2C 通信 **/
#define PHONE_SLAVE_TRANSFER_I2C 1 //1:表示手机跟芯片之间touch 数据采用 I2C 通信;
#define PHONE_I2CS_INDEX I2C_INDEX_0
#define CHIP_I2C_ADDRESS 0x48 //芯片本身 I2C 从机地址
#define CHIP_I2C_ADDR_BITS I2C_ADDR_BITS_7 //屏幕 I2C 地址位数 7/10默认为7
/** 跟手机之间使用 SPI 通信 **/
#define PHONE_SLAVE_TRANSFER_SPI 0 //1:表示手机跟芯片之间touch 数据采用 SPI 通信;
#define PHONE_SPI_CPHA 0 //0:表示时钟在数据之后才切换即第1个时钟沿有效
#define PHONE_SPI_CPOL 0 //0:表示闲时时钟状态为低电平
/** 跟屏幕之间使用 I2C 通信 **/
#define SCREEN_MASTER_TRANSFER_I2C 0 //1:表示屏幕跟芯片之间touch 数据采用 I2C 通信;
#define SCREEN_I2CM_INDEX I2C_INDEX_1
#define SCREEN_I2C_ADDRESS 0x49 //屏幕 I2C 从机地址
#define SCREEN_I2C_ADDR_BITS I2C_ADDR_BITS_7 //屏幕 I2C 地址位数 7/10默认为7
#define I2C_MASTER_SPEED 400000 //设置 I2C 主机通信速率
/** 跟屏幕之间使用 SPI 通信 **/
#define SCREEN_MASTER_TRANSFER_SPI 1 //1:表示屏幕跟芯片之间touch 数据采用 SPI 通信;
#define SCREEN_SPI_CPHA 0 //0:表示时钟在数据之后才切换即第1个时钟沿有效
#define SCREEN_SPI_CPOL 0 //0:表示闲时时钟状态为低电平
#define SPI_MASTER_SPEED 8000000 //设置 SPI 主机通信速率
/** 坐标转换参数 **/
#define INPUT_WIDTH_VALUE 1440 //原装屏 X 坐标码值的最大值
#define INPUT_HEIGHT_VALUE 2960 //原装屏 Y 坐标码值的最大值
#define OUTPUT_WIDTH_VALUE 1080 //维修屏 X 坐标码值的最大值
#define OUTPUT_HEIGHT_VALUE 2280 //维修屏 Y 坐标码值的最大值
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 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);
/**************************************************************************
* @name : app_tp_write_other_operations
* @brief : ,reset等
* @param[in] : txbuffer输入数组指针 or null
* @param[in] : buffer_size or
* @param[in] :
* @return :
* @retval : NULL时buffer_size是数组数据长度NULL时,buffer_size作为事件标志位
**************************************************************************/
void app_tp_write_other_operations(const uint8_t *txbuffer, uint32_t buffer_size);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,64 @@
/*******************************************************************************
*
*
* 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};
const uint8_t screen_a4_06_01_data[] = {0xa4, 0x06, 0x01};
const uint8_t screen_a4_00_01_data[] = {0xa4, 0x00, 0x01};
const uint8_t screen_a4_0c_5a_data[] = {0xa4, 0x0c, 0x5a};
const uint8_t screen_a4_05_04_data[] = {0xa4, 0x05, 0x04};
const uint8_t screen_a4_00_03_data[] = {0xa4, 0x00, 0x03};
//读取固件等版本信息
const uint8_t screen_a7_00_00_data[] = {0xA7, 0x00, 0x00, 0x00};
//解锁
const uint8_t screen_fa_20_24_data[] = {0xFA, 0x20, 0x00, 0x00, 0x24, 0x01};
const uint8_t screen_fa_20_32_data[] = {0xFA, 0x20, 0x00, 0x00, 0x32, 0x10};
const uint8_t screen_fa_20_34_data[] = {0xFA, 0x20, 0x00, 0x00, 0x34, 0x02};
const uint8_t screen_fa_20_3f_data[] = {0xFA, 0x20, 0x00, 0x00, 0x3F, 0x07};
const uint8_t screen_fa_20_3d_data[] = {0xFA, 0x20, 0x00, 0x00, 0x3D, 0x30};
const uint8_t screen_fa_20_2d_data[] = {0xFA, 0x20, 0x00, 0x00, 0x2D, 0x02};
const uint8_t screen_fa_20_1b_data[] = {0xFA, 0x20, 0x00, 0x00, 0x1B, 0x66};
const uint8_t screen_fa_20_68_data[] = {0xFA, 0x20, 0x00, 0x00, 0x68, 0x13};
const uint8_t screen_fa_20_25_data[] = {0xFA, 0x20, 0x00, 0x00, 0x25, 0x20};
const uint8_t screen_fa_20_6b_data[] = {0xFA, 0x20, 0x00, 0x00, 0x6B, 0x00};
const uint8_t screen_fa_20_de_data[] = {0xFA, 0x20, 0x00, 0x00, 0xDE, 0x03};
const uint8_t screen_fa_20_28_data[] = {0xFA, 0x20, 0x00, 0x01, 0x28, 0xFF, 0xFF, 0xFF, 0x83};
const uint8_t screen_fa_20_6a_data[] = {0xFA, 0x20, 0x00, 0x00, 0x6A, 0xA0};
//读取寄存器值
const uint8_t screen_fb_20_6a_data[] = {0xFB, 0x20, 0x00, 0x00, 0x6A};
const uint8_t screen_fa_20_72_data1[] = {0xFA, 0x20, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x3F, 0x00};
const uint8_t screen_fa_20_72_data2[] = {0xFA, 0x20, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, 0x40, 0x3E, 0x27, 0x00};
const uint8_t screen_fa_20_72_data3[] = {0xFA, 0x20, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, 0x7C, 0x2D, 0x03, 0x00};
const uint8_t screen_fa_20_6B_data[] = {0xFA, 0x20, 0x00, 0x00, 0x6B, 0x00, 0x40, 0x42, 0x0F, 0x00, 0x00, 0xC0};
const uint8_t screen_fb_20_71_data[] = {0xFB, 0x20, 0x00, 0x00, 0x71};
/*******************************************/
#endif

2124
src/app/S8/s8_demo.c Normal file

File diff suppressed because it is too large Load Diff

21
src/app/S8/s8_demo.h Normal file
View File

@ -0,0 +1,21 @@
/*******************************************************************************
*
*
* File: s8_demo.h
* Description: s8测试头文件
* Version: V0.1
* Date: 2021-02-22
* Author: Tempest
*******************************************************************************/
#ifndef __S8_DEMO_H__
#define __S8_DEMO_H__
/**
* @brief ap demo
* @param none
* @retval none
*/
void s8_demo(void);
#endif

39
src/app/demo_version.txt Normal file
View File

@ -0,0 +1,39 @@
/////////////////////////////////////////////////////////////////////////////////
// 版本说明 demo
更改时间ISP型号+机型+Driver IC+玻璃型号+更改时间如ISP568_S20P_NT37701AH_VSN667_20230316
问题描述:简洁扼要说明问题情况
解决方法:简单说明修改的方法
注意事项:
1、上传Git时直接将版本说明复制到Git修改项中实现同步。
2、如该项目提供有两个客户需要在更改时间项前增加客户名称
如:
BC_ISP568_S20P_NT37701AH_VSN667_20230316; 博创项目
CX_ISP568_S20P_NT37701AH_VSN667_20230316; 创信项目
/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
ISP668_X90Pro+_NT37705H_TM678_20240219
1、修改AOD亮度
/////////////////////////////////////////////////////////////////////////////////
ISP668_X90Pro+_NT37705H_TM678_20231130
1、增加通话息屏功能。
解决方法:使用触摸触发通话息屏功能
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

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

@ -0,0 +1,37 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "test_cfg_global.h"
#include "tau_log.h"
#include "hal_system.h"
#include "board.h"
#include "module_demo_main.h"
int main()
{
board_Init();
while (1)
{
#if _MODULE_DEMO_ENABLE
module_demo_main();
#endif
#if _DEMO_S8_EN
s8_demo();
#endif
#if _DEMO_S8P_EN
s8p_demo();
#endif
#if _DEMO_S9_EN
s9_demo();
#endif
#if _DEMO_MI_12_LITE_EN
mi12_lite_demo();
#endif
TAU_LOGD("668 Demo\n");
while (1);
}
}

View File

@ -0,0 +1 @@
module_demo:存放hal层给客户的demo code,每个客户都需要release

View File

@ -0,0 +1,137 @@
/*******************************************************************************
*
*
* File: demo_hal_crc.c
* Description crc demo源文件
* Version V0.1
* Date: 2023-07-27
* Author zzf
*******************************************************************************/
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "demo_hal_crc.h"
/*******************************************************************************
* 2.Global constant and macro definitions using #define
*******************************************************************************/
#ifdef LOG_TAG
#undef LOG_TAG
#endif
#define LOG_TAG "crc-log"
/* CRC计算方式0-CPU方式 1-DMA方式 */
#define CRC_DMA_CAL_EN (1)
/* for max total of test elements */
#define CRC_ELEMENT_MAX_TATOL (32u)
/* for crc initial POL regs value */
#define CRC_32_POL_VALUE0 (0x04C11DB7u)
#define CRC_16_POL_VALUE0 (0x8005u)
/* for crc calculate in crc software calculate */
#define CRC_SEED_VALUE_0 (0u)
#define CRC_SEED_VALUE_F (0xFFFFu)
/*******************************************************************************
* 3.Global function and Global variable declarations
*******************************************************************************/
#if CRC_DMA_CAL_EN
/* all the one element value crc calculate for software crc */
static uint32_t sg_crc32_arry[CRC_ELEMENT_MAX_TATOL] =
{
0x00000000, 0xFFFFFFFF, 0xAAAAAAAA, 0xEEEEEEEE, 0x55555555, 0x66666666, 0x11111111, 0x77777777,
0x12345678, 0x456789AB, 0x89ABCDEF, 0x3456789A, 0x6789ABCD, 0x9ABCDEF0, 0xBCDEF012, 0xFEDCAB98,
0x5a5aa5a5, 0x37377373, 0x98988989, 0x76767676, 0x41233214, 0x67433467, 0x91DF91DF, 0x76347634,
0x46378912, 0x57351059, 0xABFC9483, 0x837204AF, 0x41057DBA, 0x893CD024, 0x56378105, 0xFA34610B,
};
#else
/* all the one element value crc calculate for software crc */
static uint16_t sg_crc16_element_arry[CRC_ELEMENT_MAX_TATOL] =
{
0x0000, 0xFFFF, 0xAAAA, 0x2222, 0x3333, 0xDDDD, 0x9999, 0x8888,
0x1234, 0x5678, 0x9ABC, 0x2345, 0x4567, 0xABCD, 0xCDEF, 0x789A,
0x5a5a, 0x2323, 0x6868, 0x5aa5, 0x7887, 0x8558, 0x6336, 0xAFAF,
0x3194, 0x7853, 0x7733, 0x76DE, 0x89CA, 0x7401, 0x7392, 0xD2A8,
};
#endif
/*******************************************************************************
* 4.Global function prototypes
*******************************************************************************/
#if CRC_DMA_CAL_EN
/**
* @brief DMA计算CRC值回调函数
* @param calculate_result: CRC计算结果
* @retval None
*/
void demo_crc_dma_callback(uint32_t calculate_result)
{
TAU_LOGD("dma demo[0x%x]\n", calculate_result);
}
/**
* @brief DMA计算CRC值
* @param None
* @retval true or false
*/
bool demo_crc_array_dma_cal(void)
{
crc_ctrl_handle_t crc_cfg_para =
{
CRC_32_POL_VALUE0,
CRC_SEED_VALUE_0,
CRC_32_BIT_PROTOCOL,
CRC_FXOR_ENABLE,
CRC_REV_ONLY_BITS_TRANSPOSE,
CRC_REV_ONLY_BITS_TRANSPOSE
};
hal_crc_dma_init(&crc_cfg_para, demo_crc_dma_callback, sg_crc32_arry, CRC_ELEMENT_MAX_TATOL);
hal_crc_dma_start();
return true;
}
#else
/**
* @brief CPU阻塞式计算CRC值
* @param None
* @retval true or false
*/
bool demo_crc_array_cal(void)
{
crc_ctrl_handle_t crc_cfg_para =
{
CRC_16_POL_VALUE0,
CRC_SEED_VALUE_F,
CRC_16_BIT_PROTOCOL,
CRC_FXOR_ENABLE,
CRC_REV_BOTH_TRANSPOSE,
CRC_REV_BOTH_TRANSPOSE
};
hal_crc_init(&crc_cfg_para);
uint32_t output_crc = hal_crc_cal(sg_crc16_element_arry, CRC_ELEMENT_MAX_TATOL);
TAU_LOGD("cpu demo[0x%x]\n", output_crc);
return true;
}
#endif
/**
* @brief demo测试接口函数
* @param None
* @retval None
*/
void demo_hal_crc_case(void)
{
TAU_LOGD("HAL CRC DEMO.\n");
#if CRC_DMA_CAL_EN
demo_crc_array_dma_cal(); // DMA方式计算
#else
demo_crc_array_cal(); // CPU方式计算
#endif
}

View File

@ -0,0 +1,41 @@
/*******************************************************************************
*
*
* File: demo_hal_crc.h
* Description: crc demo头文件
* Version: V0.1
* Date: 2023-07-27
* Author: zzf
*******************************************************************************/
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "hal_crc.h"
#include "tau_delay.h"
#include "tau_log.h"
/*******************************************************************************
* 2.Global constant and macro definitions using #define
*******************************************************************************/
#ifndef _DEMO_HAL_CRC_H_
#define _DEMO_HAL_CRC_H_
/*******************************************************************************
* 3.Global structures, unions and enumerations using typedef
*******************************************************************************/
/*******************************************************************************
* 4.Global variable extern declarations
*******************************************************************************/
/*******************************************************************************
* 5.Global function prototypes
*******************************************************************************/
/**
* @brief demo测试接口函数
* @param None
* @retval None
*/
void demo_hal_crc_case(void);
#endif //_DEMO_HAL_CRC_H_

View File

@ -0,0 +1,212 @@
/*******************************************************************************
*
*
* File: demo_hal_dsi_rx.c
* Description: dsi rx
* Version: V0.1
* Date: 2020-06-12
* Author: lzy
*******************************************************************************/
#include "tau_device_datatype.h"
#include "tau_log.h"
#include "tau_operations.h"
#include "tau_common.h"
#include "hal_dsi_rx_ctrl.h"
#ifdef LOG_TAG
#undef LOG_TAG
#endif
#define LOG_TAG "demo_hal_dsi_rx"
//客户可配参数
//输入配置
#define INPUT_WIDTH 720
#define INPUT_HEIGHT 1280
//输入 MIPI lane rate,video mode 下需要计算delay, command mode可以不设置或者随便设置
#define INPUT_MIPI_LANE_RATE 481000000
//输入图像格式
#define INPUT_COLOR_MODE DSI_RGB888
//输出数据格式(DSI_DATA_CMD_MODE , DSI_DATA_VIDEO_MODE)
#define INPUT_DATA_MODE DSI_DATA_VIDEO_MODE
//输入mipi lane数量(DSI_RX_LANE_x x为1-4)
#define INPUT_MIPI_LANE_NUM DSI_LANE_4
//输入为video mode 时数据格式
#define INPUT_VIDEO_MODEL DSI_NONBURST_EVENT
//输入虚拟通道(0-3)
#define INPUT_VC DSI_VC_0
//输入的帧率(60/90/120/144Hz)
#define INPUT_FRAME_RATE DSI_FRAME_RATE_60HZ
//输入数据是否DSC压缩
#define INPUT_COMPRESS false
//输出配置
#define OUTPUT_WIDTH 720
#define OUTPUT_HEIGHT 1280
static hal_dsi_rx_ctrl_handle_t *g_rx_ctrl_handle = NULL;
//客制化DCS处理函数
static bool cus_dsc_execute(hal_dsi_rx_ctrl_handle_t *handler, hal_dcs_packet_t *dcs_packet)
{
TAU_LOGD("cus_dsc_execute DCS[0x%x]\n", dcs_packet->dcs_command);
for (int i = 0; i < dcs_packet->param_length; i ++)
{
TAU_LOGD("cus_dsc_execute param[%d]:0x%x\n", i, dcs_packet->packet_param[i]);
}
#if 0
/* ack long cmd */
hal_dsi_rx_ctrl_send_ack_cmd(g_rx_ctrl_handle,
DSI_ACK_DT_GEN_LONG_RESPONSE,
DSI_VC_0,
5,
0x1,
0x2,
0x3,
0x4,
0x5);
#else
/* ack short cmd */
hal_dsi_rx_ctrl_send_ack_cmd(g_rx_ctrl_handle,
DSI_ACK_DT_DCS_SHORT_RESPONSE_1B,
DSI_VC_0,
1,
0xC1);
#endif
return true;
}
static bool ap_dcs_read(uint8_t data_type, uint8_t dcs_cmd, uint8_t param)
{
if (dcs_cmd == 0xaa)
{
uint8_t cmd[] = {DSI_ACK_DT_DCS_LONG_RESPONSE,
212, 0, 1,
0x21, 0x07, 0x2C, 0x27, 0x2B, 0x7A, 0x78, 0x7A,
0x7D, 0x7D, 0x7E, 0x7F, 0x7E, 0x7E, 0x7F, 0x7F,
0x71, 0xE8, 0x36, 0x2A, 0x2E, 0x07, 0x89, 0x17,
0x8B, 0x84, 0x28, 0x26, 0x6D, 0xEB, 0x12, 0x34,
0x79, 0x78, 0x79, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C,
0x7D, 0x7D, 0x7E, 0x7F, 0x7E, 0x7E, 0x7F, 0x7F,
0x7C, 0x67, 0x6E, 0x6c, 0x8A, 0x5B, 0x71, 0x00,
0x7D, 0x7D, 0x7E, 0x7F, 0x7E, 0x7E, 0x7F, 0x7F,
0x7d, 0x68, 0x61, 0xd9, 0x1A, 0x5B, 0xa7, 0x00,
0x7D, 0x7D, 0x7E, 0x7F, 0x7E, 0x7E, 0x7F, 0x7F,
0x7e, 0x69, 0x63, 0xe9, 0x3c, 0x5B, 0xfE, 0x00,
0x7D, 0x7D, 0x7E, 0x7F, 0x7E, 0x7E, 0x7F, 0x7F,
0x7f, 0x60, 0x3E, 0x6f, 0x9b, 0x5B, 0x45, 0x00,
0x7D, 0x7D, 0x7E, 0x7F, 0x7E, 0x7E, 0x7F, 0x7F,
0x70, 0x61, 0x4E, 0xc9, 0xdA, 0x5B, 0x69, 0x00,
0x7D, 0x7D, 0x7E, 0x7F, 0x7E, 0x7E, 0x7F, 0x7F,
0x71, 0x63, 0xaE, 0x88, 0x0A, 0x5B, 0x30, 0x00,
0x12, 0x34, 0x56, 0x78, 0x9a, 0xab, 0xcd, 0xef,
0x11, 0x22, 0x33, 0x44, 0x0A, 0x5B, 0x30, 0x00,
0x12, 0x34, 0x56, 0x78, 0x9a, 0xab, 0xcd, 0xef,
0x7f, 0x60, 0x3E, 0x6f, 0x9b, 0x5B, 0x45, 0x00,
0x7D, 0x7D, 0x7E, 0x7F, 0x7E, 0x7E, 0x7F, 0x7F,
0x7f, 0x60, 0x3E, 0x6f, 0x9b, 0x5B, 0x45, 0x00,
0x7D, 0x7D, 0x7E, 0x7F, 0x7E, 0x7E, 0x7F, 0x7F,
0x71, 0xE8, 0x36, 0x2A, 0x2E, 0x07, 0x89, 0x17,
0x8B, 0x84, 0x28, 0x26, 0x6D, 0xEB, 0x12, 0x34,
0x11, 0x22, 0x33, 0x44
};
/*长包超128字节发送*/
hal_dsi_rx_ctrl_ack_long_cmd(g_rx_ctrl_handle, sizeof(cmd) / sizeof(uint8_t), cmd);
}
else if (dcs_cmd == 0xFE)
{
uint16_t return_size;
return_size = hal_dsi_rx_ctrl_get_max_ret_size(g_rx_ctrl_handle);
if (return_size == 3)
{
uint8_t cmd[] = {DSI_ACK_DT_DCS_LONG_RESPONSE, 3, 0, 1, 0x40, 0x00, 0x03};
hal_dsi_rx_ctrl_ack_long_cmd(g_rx_ctrl_handle, sizeof(cmd) / sizeof(uint8_t), cmd);
}
else if (return_size == 32)
{
uint8_t cmd[] = {DSI_ACK_DT_DCS_LONG_RESPONSE,
32, 0, 1, 0x01, 0xc4, 0x01, 0xcd, 0x01, 0xfb, 0x55, 0x55,
0x55, 0x4e, 0x4c, 0x4e, 0x2e, 0x2d, 0x31, 0x30,
0x30, 0x38, 0x49, 0x42, 0x49, 0x3c, 0x39, 0x47,
0x01, 0x07, 0x2b, 0xfa, 0x22, 0x19, 0x32, 0x02
};
hal_dsi_rx_ctrl_ack_long_cmd(g_rx_ctrl_handle, sizeof(cmd) / sizeof(uint8_t), cmd);
}
}
TAU_LOGD("r %x\n", dcs_cmd);
return true;
}
static const hal_dcs_execute_entry_t g_cus_rx_dcs_execute_table[] =
{
{0x83, cus_dsc_execute, false}, //cus dcs 0x83, 处理函数为cus_dsc_execute不需要立即运行在while里异步即可
{0, NULL, false} //{0,NULL,false} 数组最后一个固定成员作为table结尾的判断标准
};
static void open_mipi_rx()
{
if (g_rx_ctrl_handle == NULL)
{
g_rx_ctrl_handle = hal_dsi_rx_ctrl_create_handle();
}
g_rx_ctrl_handle->base_info.src_w = INPUT_WIDTH;
g_rx_ctrl_handle->base_info.src_h = INPUT_HEIGHT;
g_rx_ctrl_handle->base_info.dst_w = OUTPUT_WIDTH;
g_rx_ctrl_handle->base_info.dst_h = OUTPUT_HEIGHT;
g_rx_ctrl_handle->base_info.src_frate = INPUT_FRAME_RATE;
g_rx_ctrl_handle->base_info.src_mode = INPUT_DATA_MODE;
g_rx_ctrl_handle->rx_color_mode = INPUT_COLOR_MODE;
g_rx_ctrl_handle->rx_lanes = INPUT_MIPI_LANE_NUM;
g_rx_ctrl_handle->rx_nonburst_models = INPUT_VIDEO_MODEL;
g_rx_ctrl_handle->compress_en = INPUT_COMPRESS;
g_rx_ctrl_handle->rx_hsclk_rate = INPUT_MIPI_LANE_RATE;
g_rx_ctrl_handle->extra_info.flow_control_mode = FC_AUTO_MODE;
g_rx_ctrl_handle->cus_dcs_entry_table = g_cus_rx_dcs_execute_table;
g_rx_ctrl_handle->rx_dcs_read_entry = ap_dcs_read;
/*PIN28~PIN19依次为21c03*/
g_rx_ctrl_handle->rx_lane_swap = RX_LANE_SWAP_2103;
/* 对 lane0~lane3 以及clk lane 进行PN交换*/
g_rx_ctrl_handle->base_info.pn_swap = RX_LANE_0_PN_SWAP | RX_LANE_1_PN_SWAP | RX_LANE_2_PN_SWAP | RX_LANE_3_PN_SWAP | RX_LANE_CLK_PN_SWAP;
if (g_rx_ctrl_handle->compress_en == true)
{
//hal_dsi_rx_ctrl_pre_init_pps(g_rx_ctrl_handle, pps, 128);
}
hal_dsi_rx_ctrl_init(g_rx_ctrl_handle);
#if 0
//使用盒子发送读命令 0xA,0xB,0xC,0xD,0xE,0xF,0x1E,0x1D
hal_dsi_rx_ctrl_set_auto_ack(g_rx_ctrl_handle, HAL_RX_QRESP_CODE0, DSI_ACK_DT_DCS_SHORT_RESPONSE_1B, 0x0F, 1, 0xab);
hal_dsi_rx_ctrl_set_auto_ack(g_rx_ctrl_handle, HAL_RX_QRESP_CODE1, DSI_ACK_DT_DCS_SHORT_RESPONSE_2B, 0x0e, 2, 0xef, 0xcd);
hal_dsi_rx_ctrl_set_auto_ack(g_rx_ctrl_handle, HAL_RX_QRESP_CODE2, DSI_ACK_DT_GEN_SHORT_RESPONSE_1B, 0x0a, 1, 0x12);
hal_dsi_rx_ctrl_set_auto_ack(g_rx_ctrl_handle, HAL_RX_QRESP_CODE3, DSI_ACK_DT_GEN_SHORT_RESPONSE_2B, 0x0b, 2, 0x34, 0x56);
hal_dsi_rx_ctrl_set_auto_ack(g_rx_ctrl_handle, HAL_RX_QRESP_CODE4, DSI_ACK_DT_DCS_LONG_RESPONSE, 0x0c, 4, 0x12, 0x34, 0x56, 0x78);
hal_dsi_rx_ctrl_set_auto_ack(g_rx_ctrl_handle, HAL_RX_QRESP_CODE5, DSI_ACK_DT_GEN_LONG_RESPONSE, 0x0d, 4, 0xab, 0xcd, 0xef, 0x9a);
hal_dsi_rx_ctrl_set_auto_ack(g_rx_ctrl_handle, HAL_RX_QRESP_CODE6, DSI_ACK_DT_GEN_LONG_RESPONSE, 0x1e, 8, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8);
hal_dsi_rx_ctrl_set_auto_ack(g_rx_ctrl_handle, HAL_RX_QRESP_CODE7, DSI_ACK_DT_DCS_LONG_RESPONSE, 0x1d, 8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10);
#endif
hal_dsi_rx_ctrl_start(g_rx_ctrl_handle);
}
/**
* @brief test system
* @param none
* @retval none
*/
void demo_hal_dsi_rx_case()
{
open_mipi_rx();
TAU_LOGD("open_mipi_rx done !\n");
while (1)
{
hal_dsi_rx_ctrl_dcs_async_handler(g_rx_ctrl_handle);
}
}

View File

@ -0,0 +1,22 @@
/*******************************************************************************
*
*
* File: demo_hal_dsi_rx.h
* Description: dsi rx
* Version: V0.1
* Date: 2020-06-12
* Author: lzy
*******************************************************************************/
#ifndef __DEMO_HAL_DSI_RX_H__
#define __DEMO_HAL_DSI_RX_H__
/**
* @brief test system
* @param none
* @retval none
*/
void demo_hal_dsi_rx_case(void);
#endif

View File

@ -0,0 +1,389 @@
/*******************************************************************************
*
*
* File: demo_hal_dsi_tx.c
* Description dsi_tx demo源文件
* Version V0.1
* Date: 2023-07-27
* Author zzf
*******************************************************************************/
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "demo_hal_dsi_tx.h"
#if AMOLED_NT37280
#include "hal_swire.h"
#endif
/*******************************************************************************
* 2.Global constant and macro definitions using #define
*******************************************************************************/
#ifdef LOG_TAG
#undef LOG_TAG
#endif
#define LOG_TAG "tx-log"
#define DEMO_TX_VPG_EN (0) // 只适用于video模式输入video模式输出
#define DEMO_RX_GEN_PATTERN (0) // TX VPG和RX pattern不建议同时打开
#define DEMO_CCM_EN (0) // 基于RX pattern数据通路进行CCM调整
#define DEMO_ENDIAN_EN (0) // RGB大小端配置
#define DEMO_OVERWRITE_EN (0) // Overwrite功能配置
#define DEMO_EDGE_DECT_EN (0) // 边缘检测功能配置
#define DEMO_EDGE_ENHANCE_EN (0) // 边缘增强功能配置
#define DEMO_FC_EN (0) // false color功能配置
#define DEMO_BCS_EN (0) // BCS调整功能配置
#define DEMO_BTA_LP_EN (0) // LP模式下BTA使用
#define DEMO_BTA_HS_EN (0) // HS传输过程中BTA使用
/* base_info输入端信息 */
#define INPUT_WIDTH (1440)
#define INPUT_HEIGHT (2960)
#define INPUT_SRC_FRATE DSI_FRAME_RATE_60HZ
/* 输出数据格式(DSI_DATA_CMD_MODE , DSI_DATA_VIDEO_MODE) */
#define DSI_INPUT_DATA_MODE DSI_DATA_VIDEO_MODE
#define DSI_OUTPUT_DATA_MODE DSI_DATA_VIDEO_MODE
/* vid模式选择 */
#define OUTPUT_VID_SEL_MODE DSI_BURST_MODE
/* 虚拟通道(0-3) */
#define VIRTUAL_CHANNEL DSI_VC_0
/* TD_RSTN pin脚使用定义宏 */
#define PIN_TD_RSTN IO_PAD_TD_RSTN
#if DEMO_RX_GEN_PATTERN
/*输入mipi lane数量(DSI_RX_LANE_x x为1-4)*/
#define INPUT_MIPI_LANE_NUM DSI_LANE_4
/*输入图像格式*/
#define INPUT_COLOR_MODE DSI_RGB888
/*video mode输入时数据格式*/
#define INPUT_VIDEO_MODEL DSI_NONBURST_EVENT
/*输入MIPI lane rate,video mode下需要计算delay,command mode可以不设置或者随便设置*/
#define INPUT_MIPI_LANE_RATE (1200000000)
/*IPI pattern fps*/
#define PATTERN_FPS (60)
#endif
/*******************************************************************************
* 3.Global function and Global variable declarations
*******************************************************************************/
static hal_dsi_tx_ctrl_handle_t *g_tx_ctrl_handle = NULL;
#if DEMO_RX_GEN_PATTERN
static hal_dsi_rx_ctrl_handle_t *g_rx_ctrl_handle = NULL;
static uint8_t g_rx_pattern_sel = 0; // 0:Vertical mode ; 1:Horizontal mode
#endif
static bool panel_init = false;
#if DEMO_BTA_LP_EN
static uint8_t bta_ack_data = 0;
#endif
#if DEMO_BTA_HS_EN
static bool sg_bta_need_flag = true;
#endif
/*******************************************************************************
* 4.Global function prototypes
*******************************************************************************/
#if AMOLED_NT37280
/**
* @brief timer回调函数用于swire输出
* @param data:
* @retval
*/
static void demo_tx_timer_callback(void *data)
{
hal_swire_set_waveform(12, 12, 12, 12);
hal_swire_set_pulse(32);
}
/**
* @brief
* @param
* @retval
*/
static void demo_tx_panel_backlight_on(void)
{
hal_gpio_init_output(IO_PAD_AP_PWMEN, IO_LVL_HIGH);
hal_swire_init();
hal_swire_enable(true);
hal_swire_set_waveform(12, 12, 12, 12);
hal_swire_set_pulse(36);
hal_timer_init(TIMER_NUM1);
hal_timer_start(TIMER_NUM1, 16, demo_tx_timer_callback, NULL);
}
#endif
/**
* @brief PANEL初始化
* @param None
* @retval None
**/
void demo_panel_init(void)
{
#if AMOLED_NT37280
demo_tx_panel_backlight_on();
#endif
/*初始化TD_RSTN并产生屏端复位信号*/
hal_gpio_init_output(PIN_TD_RSTN, IO_LVL_HIGH);
hal_gpio_set_output_data(PIN_TD_RSTN, IO_LVL_HIGH);
delayMs(10);
hal_gpio_set_output_data(PIN_TD_RSTN, IO_LVL_LOW);
delayMs(10);
hal_gpio_set_output_data(PIN_TD_RSTN, IO_LVL_HIGH);
delayMs(10);
/*bta read register*/
#if DEMO_BTA_LP_EN
hal_dsi_tx_ctrl_read_cmd(0x06, 0, 0xDA, 1, &bta_ack_data);
TAU_LOGD("DA[0x%x]\n", bta_ack_data);
#endif
/*initial code*/
#if LCD_PT628_CSOT
TAU_LOGD("LCD_PT628_CSOT pannel init\n");
hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0xBF, 0x00);
hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0xC0, 0x00);
hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x00, 0x00);
hal_dsi_tx_ctrl_write_cmd(0x39, 0, 4, 0xFF, 0x87, 0x56, 0x01);
hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x00, 0x80);
hal_dsi_tx_ctrl_write_cmd(0x39, 0, 3, 0xFF, 0x87, 0x56);
hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x00, 0xE8);
hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0xC0, 0x20);
hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x00, 0x00);
hal_dsi_tx_ctrl_write_cmd(0x39, 0, 4, 0xFF, 0x87, 0x56, 0x01);
hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x00, 0x80);
hal_dsi_tx_ctrl_write_cmd(0x39, 0, 3, 0xFF, 0x87, 0x56);
hal_dsi_tx_ctrl_write_cmd(0x05, 0, 1, 0x11);
delayMs(120);
hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x35, 0x00);
hal_dsi_tx_ctrl_write_cmd(0x39, 0, 3, 0x51, 0x0F, 0xFF);
hal_dsi_tx_ctrl_write_cmd(0x05, 0, 1, 0x29);
#elif AMOLED_NT37280
TAU_LOGD("AMOLED_NT37280 pannel init\n");
hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0xFF, 0xE0);
hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0xFB, 0x01);
hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x18, 0x80);
hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x1A, 0x15);
hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x73, 0x01);
hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x89, 0x7F);
hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x0D, 0x9B);
hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x46, 0x17);
hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0xFF, 0xF0);
hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0xFB, 0x01);
hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x54, 0x03);
hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x9C, 0x00);
hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0xFF, 0x20);
hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0xFB, 0x01);
hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x34, 0x00);
hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x35, 0x66);
hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x36, 0x66);
hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0xFF, 0x10);
hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0xFB, 0x01);
hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x88, 0x07);
hal_dsi_tx_ctrl_write_cmd(0x39, 0, 5, 0x2A, 0x00, 0x00, 0x04, 0x37);
hal_dsi_tx_ctrl_write_cmd(0x39, 0, 5, 0x2B, 0x00, 0x00, 0x08, 0xE7);
hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x7F, 0x07);
hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0xE9, 0x00);
hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0xBF, 0x00);
hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0xC0, 0x00);
hal_dsi_tx_ctrl_write_cmd(0x15, 0, 2, 0x35, 0x00); //TE 35=00是标准60Hz; 35=01是有很多小信号
hal_dsi_tx_ctrl_write_cmd(0x29, 0, 3, 0x51, 0x0F, 0xFF); //CABC
hal_dsi_tx_ctrl_write_cmd(0x05, 0, 1, 0x11);
delayMs(120);
hal_dsi_tx_ctrl_write_cmd(0x05, 0, 1, 0x29);
delayMs(10);
#endif
}
/**
* @brief RX初始化和开启
* @param None
* @retval None
**/
static void demo_open_mipi_rx(void)
{
/*RX demo详细请参考demo_hal_dsi_rx*/
#if DEMO_RX_GEN_PATTERN
/* 创建rx ctrl handle */
if (g_rx_ctrl_handle == NULL)
{
g_rx_ctrl_handle = hal_dsi_rx_ctrl_create_handle();
}
g_rx_ctrl_handle->base_info.src_w = INPUT_WIDTH;
g_rx_ctrl_handle->base_info.src_h = INPUT_HEIGHT;
g_rx_ctrl_handle->base_info.dst_w = __DPI_HACT;
g_rx_ctrl_handle->base_info.dst_h = __DPI_VACT;
g_rx_ctrl_handle->rx_hsclk_rate = INPUT_MIPI_LANE_RATE;
g_rx_ctrl_handle->base_info.src_frate = INPUT_SRC_FRATE;
g_rx_ctrl_handle->base_info.src_mode = DSI_INPUT_DATA_MODE;
g_rx_ctrl_handle->rx_color_mode = INPUT_COLOR_MODE;
g_rx_ctrl_handle->rx_lanes = INPUT_MIPI_LANE_NUM;
g_rx_ctrl_handle->rx_nonburst_models = INPUT_VIDEO_MODEL;
/* 初始化rx ctrl */
hal_dsi_rx_ctrl_init(g_rx_ctrl_handle);
/* 配置RX video pattern */
hal_dsi_rx_ctrl_enable_test_pattern(g_rx_ctrl_handle, g_rx_pattern_sel, true, PATTERN_FPS);
/* 启动rx ctrl */
hal_dsi_rx_ctrl_start(g_rx_ctrl_handle);
#endif
}
/**
* @brief TX初始化和开启
* @param None
* @retval None
**/
static void demo_open_mipi_tx(void)
{
/*创建TX实例*/
if (g_tx_ctrl_handle == NULL)
{
g_tx_ctrl_handle = hal_dsi_tx_ctrl_create_handle();
}
g_tx_ctrl_handle->lane_num = _LANE_NUMBER;
g_tx_ctrl_handle->channel_id = VIRTUAL_CHANNEL;
g_tx_ctrl_handle->vid_mode = OUTPUT_VID_SEL_MODE;
g_tx_ctrl_handle->cmd_tx_type = _CMD_TYPE;
g_tx_ctrl_handle->dpi_vsa = __DPI_VSA;
g_tx_ctrl_handle->dpi_vbp = __DPI_VBP;
g_tx_ctrl_handle->dpi_vfp = __DPI_VFP;
g_tx_ctrl_handle->dpi_hsa = __DPI_HSA;
g_tx_ctrl_handle->dpi_hbp = __DPI_HBP;
g_tx_ctrl_handle->dpi_hfp = __DPI_HFP;
g_tx_ctrl_handle->base_info.src_w = INPUT_WIDTH;
g_tx_ctrl_handle->base_info.src_h = INPUT_HEIGHT;
g_tx_ctrl_handle->base_info.dst_w = __DPI_HACT;
g_tx_ctrl_handle->base_info.dst_h = __DPI_VACT;
g_tx_ctrl_handle->base_info.src_frate = INPUT_SRC_FRATE;
g_tx_ctrl_handle->base_info.src_mode = DSI_INPUT_DATA_MODE;
g_tx_ctrl_handle->base_info.dst_mode = DSI_OUTPUT_DATA_MODE;
#if LCD_PT628_CSOT //RGBG玻璃匹配RGB Driver IC
//remap规则参数 此款玻璃remapl_rule/remapr_rule使用同一规则 如果玻璃存在两个规则需要支持请定义两个数组分别配置remapl_rule/remapr_rule
remap_rule_t remap_rule =
{
9, 11, 12, 8, 7, 10, 4, 5, 6, 2, 1, 3,
20, 19, 22, 21, 23, 24, 14, 13, 15, 16, 17, 18
};
g_tx_ctrl_handle->pentile_info.pentile_24b = true; // 是否RGB驱动IC搭配RGBG玻璃使用
g_tx_ctrl_handle->pentile_info.pentile_reverse_en = true; // 是否需要使用芯片本身行反转功能
g_tx_ctrl_handle->pentile_info.pentile_enable = true; // 是否RGBG格式的数据传输
g_tx_ctrl_handle->pentile_info.remapl_rule = &remap_rule; // reamp规则1
g_tx_ctrl_handle->pentile_info.remapr_rule = &remap_rule; // reamp规则2
g_tx_ctrl_handle->pentile_info.rgb_hact = 900; // 如果是RGB驱动IC搭配RGBG玻璃使用此处配置RGB驱动IC的分辨率dst_w按玻璃分辨率进行配置
/* RGBG 屏幕补黑配置,此款玻璃两块补黑区域均参与子像素重排*/
g_tx_ctrl_handle->pentile_info.blank_info0.blank_en = 1; // 是否使用补黑区域0
g_tx_ctrl_handle->pentile_info.blank_info0.remap_en = 1; // 补黑区域0是否参与remap重排
g_tx_ctrl_handle->pentile_info.blank_info0.st_col = 0; // 补黑区域0起始位置按有效子像素序号进行计算
g_tx_ctrl_handle->pentile_info.blank_info0.width = 12; // 补黑区域0补黑宽度按子像素级计算
g_tx_ctrl_handle->pentile_info.blank_info1.blank_en = 1; // 是否使用补黑区域1
g_tx_ctrl_handle->pentile_info.blank_info1.remap_en = 1; // 补黑区域1是否参与remap重排
g_tx_ctrl_handle->pentile_info.blank_info1.st_col = 1248; // 补黑区域1起始位置按有效子像素序号进行计算必须大于补黑区域0的起始位置
g_tx_ctrl_handle->pentile_info.blank_info1.width = 216; // 补黑区域1补黑宽度按子像素级计算
#endif
#if DEMO_ENDIAN_EN
hal_dsi_tx_ctrl_set_endianness(DPI_ENDIAN_BGR);// 默认RGB输出可以更改为BGR 需要在初始化之前调用
#endif
/*调用初始化接口进行TX初始化*/
hal_dsi_tx_ctrl_init(g_tx_ctrl_handle);
/*屏幕初始化复位时序和发送initial code*/
if (!panel_init)
{
demo_panel_init();
panel_init = true;
}
#if DEMO_TX_VPG_EN /*使用TX VPG测试TX是否正常工作*/
hal_dsi_tx_ctrl_set_vpg(true, TX_VPG_V_COLOR, false);
#endif
/*tx start开始传输高速数据*/
hal_dsi_tx_ctrl_start(g_tx_ctrl_handle);
/*可选功能配置,在任意时刻均可调用 start*/
#if DEMO_CCM_EN
ccm_coef_t coef;
coef.coef_c00 = 0x1f3;
coef.coef_c01 = 0xf3a;
coef.coef_c02 = 0xfd3;
coef.coef_c10 = 0xf9c;
coef.coef_c11 = 0x19c;
coef.coef_c12 = 0xfca;
coef.coef_c20 = 0x27;
coef.coef_c21 = 0xf46;
coef.coef_c22 = 0x193;
hal_dsi_tx_ctrl_set_ccm(&coef);
#endif
#if DEMO_OVERWRITE_EN
hal_dsi_tx_ctrl_set_overwrite_rgb(0x00, 0x00, 0xFF); //蓝色图形数据输出 参数为R/G/B灰度值
hal_dsi_tx_ctrl_overwrite_enable(true); //开启overwrite功能
/*........*/
//hal_dsi_tx_ctrl_overwrite_enable(false); //需要关闭overwrite功能时调用
#endif
#if DEMO_EDGE_DECT_EN
dsi_tx_edge_dect_t edge_dect_para = {0x10, true};
hal_dsi_tx_ctrl_set_edge_dect(&edge_dect_para);
#endif
#if DEMO_EDGE_ENHANCE_EN
dsi_tx_edge_enh_t edge_enh_para = {true, 64, 4, 64, 0};
hal_dsi_tx_ctrl_set_edge_enhance(&edge_enh_para);
#endif
#if DEMO_FC_EN
dsi_tx_fc_t fc_para = {64, 64};
hal_dsi_tx_ctrl_set_fc(&fc_para);
#endif
#if DEMO_BCS_EN
dsi_tx_bcs_t bcs_cfg = {0x00, 0x10, 0x10}; // 参数含义:{明亮度,对比度,饱和度}
hal_dsi_tx_ctrl_set_bcs(&bcs_cfg);
#endif
/*可选功能配置,在任意时刻均可调用 end*/
}
/**
* @brief demo测试接口函数
* @param None
* @retval None
*/
void demo_dsi_tx_case(void)
{
TAU_LOGD("DSI TX DEMO.\n");
demo_open_mipi_rx();
demo_open_mipi_tx();
while (1)
{
#if DEMO_BTA_HS_EN
if (sg_bta_need_flag) //当需要进行BTA回读的时候置标志位等待Vporch阶段进行BTA回读获取有效数据
{
uint8_t bta_data = 0;
if (hal_dsi_tx_ctrl_vporch_bta_opera(0x06, 0xDA, 1, &bta_data))
{
//Vporch阶段进行BTA回读获取到有效数据关闭本次回读流程
sg_bta_need_flag = false;
TAU_LOGD("hs bta[0x%x]\n", bta_data);
}
}
#endif
}
}

View File

@ -0,0 +1,77 @@
/*******************************************************************************
*
*
* File: demo_hal_dsi_tx.h
* Description: dsi-tx demo头文件
* Version: V0.1
* Date: 2023-07-27
* Author: zzf
*******************************************************************************/
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "hal_dsi_tx_ctrl.h"
#include "hal_dsi_rx_ctrl.h"
#include "tau_delay.h"
#include "tau_log.h"
/*******************************************************************************
* 2.Global constant and macro definitions using #define
*******************************************************************************/
#ifndef _DEMO_HAL_DSI_TX_H_
#define _DEMO_HAL_DSI_TX_H_
#define LCD_PT628_CSOT (1) //4lane RGBG-1242x2699 RGB-900X2688
#define AMOLED_NT37280 (0) //4lane 1080X2280
#if LCD_PT628_CSOT
#define _LANE_NUMBER (4) //数据lane的个数
#define _CMD_TYPE (DSI_CMD_TX_LP) //0-HS,1-LP;
#define __DPI_VSA (16) //VSYNC宽度
#define __DPI_VBP (16) //VSYNC后的无效像素
#define __DPI_VACT (2688) //玻璃V分辨率定义
#define __DPI_VFP (123 ) //VSYNC前的无效像素
#define __DPI_HSA (6) //HSYNC宽度
#define __DPI_HBP (18) //HSYNC后的无效像素
#define __DPI_HACT (1242) //玻璃H分辨率定义
#define __DPI_HFP (32) //HSYNC前的无效像素
#elif AMOLED_NT37280
#define _LANE_NUMBER (4) //数据lane的个数
#define _CMD_TYPE (DSI_CMD_TX_LP) //0-HS,1-LP;
#define __DPI_VSA (4) //VSYNC宽度
#define __DPI_VBP (28) //VSYNC后的无效像素
#define __DPI_VACT (2280) //V分辨率定义
#define __DPI_VFP (10) //VSYNC前的无效像素
#define __DPI_HSA (8) //HSYNC宽度
#define __DPI_HBP (16) //HSYNC后的无效像素
#define __DPI_HACT (1080) //H分辨率定义
#define __DPI_HFP (36) //HSYNC前的无效像素
#endif
/*******************************************************************************
* 3.Global structures, unions and enumerations using typedef
*******************************************************************************/
/*******************************************************************************
* 4.Global variable extern declarations
*******************************************************************************/
/*******************************************************************************
* 5.Global function prototypes
*******************************************************************************/
/**
* @brief demo测试接口函数
* @param None
* @retval None
*/
void demo_dsi_tx_case(void);
#endif

View File

@ -0,0 +1,218 @@
/*******************************************************************************
* Copyright (C) 2021-2022, All Rights Reserved.
*
* File: test_hal_flash.c
* Description hal_flash
* Version V0.1
* Date 2022-04-21
* Author RANDY
*******************************************************************************/
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "demo_hal_flash.h"
#include "hal_flash.h"
#include "tau_delay.h"
#include "tau_log.h"
#include "tau_common.h"
#include "test_cfg_global.h"
#if _MODULE_DEMO_FLASH_EN
/*******************************************************************************
* 2.Global constant and macro definitions using #define
*******************************************************************************/
#ifdef LOG_TAG
#undef LOG_TAG
#endif
#define LOG_TAG "demo_flash"
#define TEST_DATA_SIZE 32
#define DATA_BLOCK_SIZE (64*1024)
#define DATA_PAGE_SIZE 1024
/*******************************************************************************
* 3.Global structures, unions and enumerations using typedef
*******************************************************************************/
static fls_ops_cfg_t *fls_ops_cfg;
/*******************************************************************************
* 4.Global variable extern declarations
*******************************************************************************/
/*******************************************************************************
* 5.Global function prototypes
*******************************************************************************/
/**************************************************************************
* @name :
* @brief
* @param
* @retval
**************************************************************************/
void test_hal_flash_get_public_region_test(void)
{
uint8_t test_data[TEST_DATA_SIZE] = 0;
TAU_LOGD("test get data public\n");
fls_ops_cfg->flash_block = 7;//固定值
fls_ops_cfg->flash_page = 0;//0-32
fls_ops_cfg->page_offset_addr = 0;
fls_ops_cfg->data_size = TEST_DATA_SIZE;
fls_ops_cfg->user_data = test_data;
hal_flash_init();
//1 读数据
hal_flash_public_region_ops(FLASH_PUBLIC_READ, fls_ops_cfg);
for (uint8_t i = 0; i < TEST_DATA_SIZE; i++)
{
TAU_LOGD("read data[%d]=0x%x ", i, test_data[i]);
}
//2 写数据
for (uint32_t i = 0; i < TEST_DATA_SIZE; i++)
{
test_data[i] = i;
}
hal_flash_public_region_ops(FLASH_PUBLIC_WRITE, fls_ops_cfg);
//3 回读
for (uint32_t i = 0; i < TEST_DATA_SIZE; i++)
{
test_data[i] = 0;
}
hal_flash_public_region_ops(FLASH_PUBLIC_READ, fls_ops_cfg);
//4 对比
for (uint8_t i = 0; i < TEST_DATA_SIZE; i++)
{
TAU_LOGD("read data[%d]=0x%x ", i, test_data[i]);
}
}
// 验证flash UID的读取16byte的UID
void test_flash_uid_read(void)
{
uint8_t get_id[16] = {0};
TAU_LOGD("test_flash_uid_read begin \n");
hal_flash_init();
hal_flash_read_uid(get_id, 16);
//不同的ICID不一样存在0x00或者0xFF的情况
for (uint8_t i = 0; i < 16; i++)
{
TAU_LOGD("read ID [%d]=0x%X \n", i, get_id[i]);
}
}
/**
* @brief user_data的数据个数
* @param
* @retval bool
*/
void get_user_data_size(void)
{
uint32_t user_data_size = 0;
TAU_LOGD("test get data addr\n");
user_data_size = hal_flash_get_user_data_size();
TAU_LOGD("user_data size 0x%x \n", user_data_size);
}
void test_hal_flash_get_user_region_test(void)
{
uint8_t user_data[32];
uint32_t user_address = 0; //需要读取数据的位置
uint32_t user_data_size = 0;
TAU_LOGD("test get data addr\n");
//读取user data 0地址
user_address = 0;
fls_ops_cfg->flash_block = user_address / DATA_BLOCK_SIZE;
fls_ops_cfg->flash_page = (user_address % DATA_BLOCK_SIZE) / DATA_PAGE_SIZE;
fls_ops_cfg->page_offset_addr = user_address % DATA_PAGE_SIZE;
fls_ops_cfg->data_size = 16;
fls_ops_cfg->user_data = user_data;
hal_flash_user_region_ops(FLASH_USERDATA_READ, fls_ops_cfg);
for (uint8_t i = 0; i < 2; i++)
{
TAU_LOGD("user_data[%d]=0x%x ", i, user_data[i]);
}
//读取user data 0x6000地址
user_address = 0x6000;
fls_ops_cfg->flash_block = user_address / DATA_BLOCK_SIZE;
fls_ops_cfg->flash_page = (user_address % DATA_BLOCK_SIZE) / DATA_PAGE_SIZE;
fls_ops_cfg->page_offset_addr = user_address % DATA_PAGE_SIZE;
fls_ops_cfg->data_size = 16;
fls_ops_cfg->user_data = user_data;
hal_flash_user_region_ops(FLASH_USERDATA_READ, fls_ops_cfg);
for (uint8_t i = 0; i < 2; i++)
{
TAU_LOGD("user_data[%d]=0x%x ", i, user_data[i]);
}
}
/**
* @brief user_data的绝对起始地址
* @param
* @retval bool
*/
void demo_hal_flash(void)
{
uint8_t case_sel = 2;
switch (case_sel)
{
case 1:
test_hal_flash_get_public_region_test();
break;
case 2:
test_hal_flash_get_user_region_test();
break;
case 3:
test_flash_uid_read();
break;
case 4:
get_user_data_size();
break;
case 5:
//测试共享flash接口,需要外接SPI主机测试
TAU_LOGI("test TMON \n");
hal_flash_share_mode(true);
break;
default:
break;
}
}
#endif

View File

@ -0,0 +1,35 @@
/*******************************************************************************
* Copyright (C) 2021-2022, All Rights Reserved.
*
* File: test_hal_flash.h
* Description: hal_flash测试用例头文件
* Version: V0.1
* Date: 2023-07-17
* Author: Kevin
*******************************************************************************/
#ifndef __DEMO_HAL_FLASH_H__
#define __DEMO_HAL_FLASH_H__
/*******************************************************************************
* 1.Included files
*******************************************************************************/
/*******************************************************************************
* 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
*******************************************************************************/
void demo_hal_flash(void);
#endif /* __TEST_HAL_FLASH_H__ */

View File

@ -0,0 +1,268 @@
/*******************************************************************************
*
*
* File: demo_gpio.c
* Description GPIO测试用例源文件
* Version V0.1
* Date 2023-07-27
* Author kevin
*******************************************************************************/
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "hal_gpio.h"
#include "tau_delay.h"
#include "tau_log.h"
#include "test_cfg_global.h"
#if _DEMO_GPIO_EN
/*******************************************************************************
* 2.Global constant and macro definitions using #define
*******************************************************************************/
#ifdef LOG_TAG
#undef LOG_TAG
#endif
#define LOG_TAG "gpio-log"
//output
#define GPIO_OUT_TEST 1
#define GPIO_OUT_IN_CONNECT 0
//input
#define GPIO_IN_INT_SINGLE 0
//IO mode init
#define GPIO_MODE_INIT 0
/*******************************************************************************
* 3.Global structures, unions and enumerations using typedef
*******************************************************************************/
/*******************************************************************************
* 4.Global variable extern declarations
*******************************************************************************/
static bool s_gpio_callback_flag = false;
static sys_cfg_trigger_e s_gpio_trig = DETECT_HIGH_LVL;
static io_pad_e s_gpio_demo_pad1 = IO_PAD_AP_TPRSTN;
static io_pad_e s_gpio_demo_pad2 = IO_PAD_AP_PWMEN;
/*******************************************************************************
* 5.Global function prototypes
*******************************************************************************/
/**************************************************************************
* @name : demo_gpio_callback
* @brief :
* @param[in] :
* @return :
* @retval :
**************************************************************************/
static void demo_gpio_callback(void *data)
{
gpio_int_e type = *(gpio_int_e *)data;
gpio_int_e int_type = hal_gpio_get_int_type(s_gpio_demo_pad1);
TAU_LOGI("demo_gpio_callback type:%d, int_type:%d, s_gpio_trig:%d\r\n", type, int_type, s_gpio_trig);
hal_gpio_ctrl_eint(s_gpio_demo_pad1, DISABLE);
if (DETECT_HIGH_LVL == s_gpio_trig)
{
hal_gpio_set_output_data(s_gpio_demo_pad2, IO_LVL_LOW);
}
else if (DETECT_LOW_LVL == s_gpio_trig)
{
hal_gpio_set_output_data(s_gpio_demo_pad2, IO_LVL_HIGH);
}
switch (s_gpio_trig)
{
case DETECT_HIGH_LVL:
s_gpio_trig = DETECT_LOW_LVL;
break;
case DETECT_LOW_LVL:
s_gpio_trig = DETECT_RISING_EDGE;
break;
case DETECT_RISING_EDGE:
s_gpio_trig = DETECT_FALLING_EDGE;
break;
default:
return;
}
s_gpio_callback_flag = true;
}
/**************************************************************************
* @name : demo_gpio_int
* @brief : gpio测试中断通用配置
* @param[in] :
* @return :
* @retval :
**************************************************************************/
static void demo_gpio_int(io_pad_e pad, sys_cfg_trigger_e trig)
{
/*1.关闭中断*/
hal_gpio_ctrl_eint(pad, DISABLE);
/*2.中断初始化*/
hal_gpio_init_eint(pad, trig);
/*3.注册回调*/
hal_gpio_reg_eint_cb(pad, demo_gpio_callback);
/*4.使能中断*/
hal_gpio_ctrl_eint(pad, ENABLE);
}
/**************************************************************************
* @name : demo_gpio_out_case
* @brief : gpio output功能测试
* @param[in] :
* @return :
* @retval :
**************************************************************************/
static void demo_gpio_out_case(void)
{
gpio_level_e flag = IO_LVL_LOW;
TAU_LOGI("demo_gpio_out_case\r\n");
hal_gpio_init_output(s_gpio_demo_pad1, flag);
while (1)
{
delayMs(10);
flag = (flag == IO_LVL_LOW) ? IO_LVL_HIGH : IO_LVL_LOW;
hal_gpio_set_output_data(s_gpio_demo_pad1, flag);
}
}
/**************************************************************************
* @name : demo_gpio_in_case
* @brief : gpio input功能测试
* @param[in] :
* @return :
* @retval :
**************************************************************************/
static void demo_gpio_in_case(void)
{
gpio_level_e flag = IO_LVL_LOW;
TAU_LOGI("demo_gpio_in_case\r\n");
hal_gpio_init_input(s_gpio_demo_pad1);
hal_gpio_init_output(s_gpio_demo_pad2, flag);
while (1)
{
delayMs(10);
flag = (flag == IO_LVL_LOW) ? IO_LVL_HIGH : IO_LVL_LOW;
hal_gpio_set_output_data(s_gpio_demo_pad2, flag);
}
}
/**************************************************************************
* @name : demo_gpio_int_single
* @brief : gpio input配置单个中断
* @param[in] :
* @return :
* @retval :
**************************************************************************/
static void demo_gpio_int_single(void)
{
sys_cfg_trigger_e trig = s_gpio_trig;
TAU_LOGI("demo_gpio_int_single trig:%d\r\n", trig);
if (DETECT_HIGH_LVL == s_gpio_trig || DETECT_RISING_EDGE == s_gpio_trig)
{
hal_gpio_init_output(s_gpio_demo_pad2, IO_LVL_LOW);
}
else if (DETECT_LOW_LVL == s_gpio_trig || DETECT_FALLING_EDGE == s_gpio_trig)
{
hal_gpio_init_output(s_gpio_demo_pad2, IO_LVL_HIGH);
}
demo_gpio_int(s_gpio_demo_pad1, trig);
if (DETECT_HIGH_LVL == s_gpio_trig || DETECT_RISING_EDGE == s_gpio_trig)
{
delayMs(100);
hal_gpio_set_output_data(s_gpio_demo_pad2, IO_LVL_HIGH);
}
else if (DETECT_LOW_LVL == s_gpio_trig || DETECT_FALLING_EDGE == s_gpio_trig)
{
delayMs(100);
hal_gpio_set_output_data(s_gpio_demo_pad2, IO_LVL_LOW);
}
}
/**
* @brief GPIO初始化配置,IO功能以及状态,
* TP相关I2C/SPI tp_transfer.c
* @param none
* @retval none
*/
static void demo_gpio_init(void)
{
io_pad_attr_t attrs[] =
{
//1.配置成GPIO 输出
{IO_PIN_8, PIN8_MODE_GPIO7, IO_IOE_OUTPUT, IO_LVL_LOW}, /* PIN_8(TD_RSTN), GPIO,输出,低电平 */
{IO_PIN_17, PIN17_MODE_GPIO8, IO_IOE_OUTPUT, IO_LVL_LOW}, /* PIN_17(PWMEN), GPIO,输出,低电平 */
{IO_PIN_16, PIN16_MODE_GPIO2, IO_IOE_OUTPUT, IO_LVL_LOW}, /* PIN_16(AP_INT),GPIO,输出,低电平 */
//2.配置成GPIO 输入
{IO_PIN_29, PIN29_MODE_GPIO3, IO_IOE_INPUT, IO_LVL_NONE}, /* PIN_29(AP_TE), GPIO,输入 */
//3.配置UART TX
{IO_PIN_2, PIN2_MODE_UART0_TX, IO_IOE_NONE, IO_LVL_NONE}, /* PIN_2(UART0_TX), UART,TX */
//4.配置I2C
{IO_PIN_5, PIN5_MODE_I2C1_SCL, IO_IOE_NONE, IO_LVL_NONE}, /* PIN_5(TD_SPIM_CLK), I2C,SCL */
{IO_PIN_6, PIN6_MODE_I2C1_SDA, IO_IOE_NONE, IO_LVL_NONE}, /* PIN_6(TD_SPIM_CSN), I2C,SDA */
//5.配置SPIS
{IO_PIN_30, PIN30_MODE_SPIS_MISO, IO_IOE_NONE, IO_LVL_NONE}, /* PIN_30(AP_SPIS_MISO), SPIS,MISO */
{IO_PIN_31, PIN31_MODE_SPIS_CSN, IO_IOE_NONE, IO_LVL_NONE}, /* PIN_31(AP_SPIS_CSN), SPIS,CSN */
{IO_PIN_32, PIN32_MODE_SPIS_SCLK, IO_IOE_NONE, IO_LVL_NONE}, /* PIN_32(AP_SPIS_CLK), SPIS,CLK */
{IO_PIN_33, PIN33_MODE_SPIS_MOSI, IO_IOE_NONE, IO_LVL_NONE} /* PIN_33(AP_SPIS_MOSI), SPIS,MOSI */
};
uint8_t size = sizeof(attrs) / sizeof(io_pad_attr_t);
hal_gpio_config_pad(attrs, size);
}
/**************************************************************************
* @name : demo_gpio_case
* @brief :
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void demo_gpio_case(void)
{
s_gpio_callback_flag = true;
#if GPIO_IN_INT_SINGLE
while (1)
{
if (s_gpio_callback_flag)
{
s_gpio_callback_flag = false;
demo_gpio_int_single();
}
}
#elif GPIO_OUT_TEST
demo_gpio_out_case();
#elif GPIO_OUT_IN_CONNECT
demo_gpio_in_case();
#elif GPIO_MODE_INIT
demo_gpio_init();
#endif
}
#endif

View File

@ -0,0 +1,35 @@
/*******************************************************************************
*
*
* File: demo_gpio.h
* Description: GPIO测试用例头文件
* Version: V0.1
* Date: 2023-07-27
* Author: kevin
*******************************************************************************/
#ifndef __DEMO_GPIO_H__
#define __DEMO_GPIO_H__
/*******************************************************************************
* 1.Included files
*******************************************************************************/
/*******************************************************************************
* 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
*******************************************************************************/
void demo_gpio_case(void);
#endif /* __DEMO_GPIO_H__ */

View File

@ -0,0 +1,412 @@
/*******************************************************************************
* Copyright (C) 2020-2023, tau Systems (R),All Rights Reserved.
*
* File: demo_hal_i2ci.c
* Description i2c demo code
* Version V0.1
* Date 2023-07-27
* Author swx
*******************************************************************************/
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "hal_i2c_master.h"
#include "hal_i2c_slave.h"
#include "demo_hal_i2c.h"
#include "hal_gpio.h"
#include "tau_log.h"
#include "tau_delay.h"
#if _MODULE_DEMO_I2C_EN
/*******************************************************************************
* 2.Global constant and macro definitions using #define
*******************************************************************************/
#ifdef LOG_TAG
#undef LOG_TAG
#endif
#define LOG_TAG "demo_hal_i2c"
#define BUFFER_SIZE 10 // 以10个数据为例
#define CHECK_TRANS_RESULT(src, dst, size) \
for(uint32_t check_num = 0; check_num < size; check_num ++) \
{\
if(src[check_num] != dst[check_num])\
{\
TAU_LOGD("src[%d] = %x, dst[%d] = %x , error!!\n",check_num,src[check_num],check_num,dst[check_num]);\
return false;\
}\
}\
/*******************************************************************************
* 3.Global function and Global variable declarations
*******************************************************************************/
static uint8_t i2cm_read_buffer[BUFFER_SIZE];
static uint8_t i2cs_read_buffer[BUFFER_SIZE];
static uint8_t i2cs_write_buffer[BUFFER_SIZE];
/*******************************************************************************
* 4.Global variable extern declarations
*******************************************************************************/
/*******************************************************************************
* 5.Global function prototypes
*******************************************************************************/
/**
* @brief i2c master的IO初始化
* @param none
* @retval none
*/
static void i2cm_io_init(void)
{
io_pad_attr_t attrs[] =
{
{IO_PAD_TD_SPIM_CLK, PIN5_MODE_I2C1_SCL, IO_IOE_NONE, IO_LVL_HIGH},
{IO_PAD_TD_SPIM_CSN, PIN6_MODE_I2C1_SDA, IO_IOE_NONE, IO_LVL_HIGH}
};
uint8_t size = sizeof(attrs) / sizeof(io_pad_attr_t);
hal_gpio_config_pad(attrs, size);
}
/**
* @brief i2c slave的IO初始化
* @param none
* @retval none
*/
static void i2cs_io_init(void)
{
io_pad_attr_t attrs[] =
{
{IO_PAD_AP_SPIS_CLK, PIN32_MODE_I2C02_SCL, IO_IOE_NONE, IO_LVL_HIGH},
{IO_PAD_AP_SPIS_CSN, PIN31_MODE_I2C02_SDA, IO_IOE_NONE, IO_LVL_HIGH}
};
uint8_t size = sizeof(attrs) / sizeof(io_pad_attr_t);
hal_gpio_config_pad(attrs, size);
}
/**
* @brief i2c slave的中断回调服务函数
* @param index: I2Cx index
* @param int_status:
* @param recieve_num packet数
* @retval none
*/
static void i2cs_callback(i2c_index_e index, hal_i2cs_event_e int_status, size_t recieve_num)
{
/* 收到READ_REQ中断 */
if (int_status == I2CS_EVENT_READ)
{
/* 更新I2CS的txbuffer将i2cs_write_buffer的数据发送给主机 */
hal_i2cs_update_tx_buffer(index, i2cs_write_buffer, BUFFER_SIZE, false);
}
/* 收到stop中断 */
else if (int_status == I2CS_EVENT_STOP)
{
if (recieve_num > 0)
{
/* 将读到的值写到i2cs_write_buffer中 */
for (int i = 0; i < recieve_num; i++)
i2cs_write_buffer[i] = i2cs_read_buffer[i];
}
/* 更新I2CS的rxbuffer */
hal_i2cs_update_rx_buffer(index, i2cs_read_buffer, BUFFER_SIZE);
}
}
/**
* @brief i2c master初始化
* @param index: I2Cx index
* @param addr:
* @param addr_bits:
* @param speed:
* @retval none
*/
void i2cm_init(i2c_index_e index, uint16_t addr, uint8_t addr_bits, uint32_t speed)
{
/* I2CS的IO初始化 */
i2cm_io_init();
/* I2CM初始化 */
hal_i2cm_init(index, addr, addr_bits, speed);
}
/**
* @brief i2c slave初始化
* @param index: I2Cx index
* @param addr:
* @param addr_bits:
* @retval none
*/
void i2cs_init(i2c_index_e index, uint16_t addr, uint8_t addr_bits)
{
/* I2CS的IO初始化 */
i2cs_io_init();
/* I2CS的初始化 */
hal_i2cs_init(index, addr, addr_bits);
/* I2CS注册回调函函数 */
hal_i2cs_register_callback(index, i2cs_callback);
/* I2CS设置初始读写buffer */
hal_i2cs_update_rx_buffer(index, i2cs_read_buffer, BUFFER_SIZE);
hal_i2cs_update_tx_buffer(index, i2cs_write_buffer, BUFFER_SIZE, false);
/* I2CS启动 */
hal_i2cs_start(index);
}
/**
* @brief i2c master去初始化
* @param index: I2Cx index
* @retval none
*/
void i2cm_deinit(i2c_index_e index)
{
hal_i2cm_deinit(index);
}
/**
* @brief i2c slave去初始化
* @param index: I2Cx index
* @retval none
*/
void i2cs_deinit(i2c_index_e index)
{
hal_i2cs_stop(index);
hal_i2cs_deinit(index);
}
/**
* @brief i2c case buffer初始化
* @param none
* @retval none
*/
static void i2c_case_buffer_init(void)
{
TAU_LOGD("i2c_case_buffer_init\n");
/* init buffer */
uint8_t i = 0 ;
for (i = 0; i < BUFFER_SIZE; i ++)
{
i2cm_read_buffer[i] = 0;
i2cs_read_buffer[i] = 0;
i2cs_write_buffer[i] = 0;
}
}
/**
* @brief I2CM与I2CS对接,I2CM用CPU方式传输数据的正确性
* @param
* @retval bool true/false
*/
static bool hal_i2c_cpu_transfer_case(void)
{
uint8_t write_buffer[10] = {0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19};
uint8_t addr_bit = 7;
uint32_t speed = 400000;
uint16_t addr = 0x50;
/* I2CM初始化I2C1+目标地址0x50+7位地址+400k传输速率 */
i2cm_init(I2C_INDEX_1, addr, addr_bit, speed);
/* I2CS初始化I2C0+本机地址0x50+7位地址 */
i2cs_init(I2C_INDEX_0, addr, addr_bit);
/* buffer初始化 */
i2c_case_buffer_init();
/* I2CM写write_buffer数据到0x50地址的从机 */
if (hal_i2cm_write(I2C_INDEX_1, write_buffer, BUFFER_SIZE) != true)
{
TAU_LOGD("I2CM CPU write data fail!\n");
return false;
}
TAU_LOGD("tx: %x %x %x %x %x %x %x %x %x %x\n", write_buffer[0], write_buffer[1], write_buffer[2], \
write_buffer[3], write_buffer[4], write_buffer[5], write_buffer[6], write_buffer[7], write_buffer[8], \
write_buffer[9]);
/* I2CM向地址为0x50的从机读取BUFFER_SIZE个数据此case中寄存器addr和size为0可自行添加 */
if (hal_i2cm_read(I2C_INDEX_1, 0, 0, i2cm_read_buffer, BUFFER_SIZE) != true)
{
TAU_LOGD("I2CM CPU read data fail!\n");
return false;
}
TAU_LOGD("rx: %x %x %x %x %x %x %x %x %x %x\n", i2cm_read_buffer[0], i2cm_read_buffer[1], \
i2cm_read_buffer[2], i2cm_read_buffer[3], i2cm_read_buffer[4], i2cm_read_buffer[5], \
i2cm_read_buffer[6], i2cm_read_buffer[7], i2cm_read_buffer[8], i2cm_read_buffer[9]);
/* 检查传输结果I2CM发出去的数据是否与接收到的数据一致 */
CHECK_TRANS_RESULT(write_buffer, i2cm_read_buffer, BUFFER_SIZE);
/* I2CM && I2CS去初始化 */
i2cs_deinit(I2C_INDEX_0);
i2cm_deinit(I2C_INDEX_1);
TAU_LOGD("hal_i2c_cpu_transfer_case done!\n");
return true;
}
/**
* @brief I2CM与I2CS对接,I2CM用DMA方式传输数据的正确性
* @param
* @retval bool true/false
*/
static bool hal_i2c_dma_transfer_case(void)
{
uint8_t write_buffer[10] = {0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29};
uint8_t addr_bit = 7;
uint32_t speed = 400000;
uint16_t addr = 0x50;
/* I2CM初始化I2C1+目标地址0x50+7位地址+400k传输速率 */
i2cm_init(I2C_INDEX_1, addr, addr_bit, speed);
/* I2CS初始化I2C0+本机地址0x50+7位地址 */
i2cs_init(I2C_INDEX_0, addr, addr_bit);
/* buffer初始化 */
i2c_case_buffer_init();
/* I2CM写write_buffer数据到0x50地址的从机 */
hal_i2cm_dma_write(I2C_INDEX_1, write_buffer, BUFFER_SIZE);
/* 等待I2CM传输完成 */
while (!hal_i2cm_get_transfer_complete(I2C_INDEX_1));
TAU_LOGD("tx: %x %x %x %x %x %x %x %x %x %x\n", write_buffer[0], write_buffer[1], write_buffer[2], \
write_buffer[3], write_buffer[4], write_buffer[5], write_buffer[6], write_buffer[7], write_buffer[8], \
write_buffer[9]);
/* I2CM向地址为0x50的从机读取BUFFER_SIZE个数据此case中寄存器addr和size为0可自行添加 */
hal_i2cm_dma_read(I2C_INDEX_1, 0, 0, i2cm_read_buffer, BUFFER_SIZE);
/* 等待I2CM传输完成 */
while (!hal_i2cm_get_transfer_complete(I2C_INDEX_1));
TAU_LOGD("rx: %x %x %x %x %x %x %x %x %x %x\n", i2cm_read_buffer[0], i2cm_read_buffer[1], \
i2cm_read_buffer[2], i2cm_read_buffer[3], i2cm_read_buffer[4], i2cm_read_buffer[5], \
i2cm_read_buffer[6], i2cm_read_buffer[7], i2cm_read_buffer[8], i2cm_read_buffer[9]);
/* 检查传输结果I2CM发出去的数据是否与接收到的数据一致 */
CHECK_TRANS_RESULT(write_buffer, i2cm_read_buffer, BUFFER_SIZE);
/* I2CM && I2CS去初始化 */
i2cs_deinit(I2C_INDEX_0);
i2cm_deinit(I2C_INDEX_1);
TAU_LOGD("hal_i2c_dma_transfer_case done!\n");
return true;
}
/**
* @brief I2CM与I2CS对接,slave通信的正确性
* @param
* @retval bool true/false
*/
static bool hal_i2c_double_slave_case(void)
{
uint16_t i2cs1_addr = 0x50;
uint8_t i2cs1_addrbit = 7;
uint16_t i2cs2_addr = 0x120;
uint8_t i2cs2_addrbit = 10;
uint32_t speed = 400000;
uint8_t write_buffer1[10] = {0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19};
uint8_t write_buffer2[10] = {0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29};
/* I2CM初始化I2C1+目标地址0x50+7位地址+400k传输速率 */
i2cm_init(I2C_INDEX_1, i2cs1_addr, i2cs1_addrbit, speed);
/* I2CS初始化I2C0+本机地址0x50+7位地址 */
i2cs_init(I2C_INDEX_0, i2cs1_addr, i2cs1_addrbit);
/* I2CS初始化I2C2+本机地址0x120+10位地址 */
i2cs_init(I2C_INDEX_2, i2cs2_addr, i2cs2_addrbit);
/* I2CM写write_buffer1数据到0x50地址的从机 */
hal_i2cm_dma_write(I2C_INDEX_1, write_buffer1, BUFFER_SIZE);
/* 等待I2CM传输完成 */
while (!hal_i2cm_get_transfer_complete(I2C_INDEX_1));
TAU_LOGD("tx: %x %x %x %x %x %x %x %x %x %x\n", write_buffer1[0], write_buffer1[1], write_buffer1[2], \
write_buffer1[3], write_buffer1[4], write_buffer1[5], write_buffer1[6], write_buffer1[7], write_buffer1[8], \
write_buffer1[9]);
/* I2CM向地址为0x50的从机读取BUFFER_SIZE个数据此case中寄存器addr和size为0可自行添加 */
hal_i2cm_dma_read(I2C_INDEX_1, 0, 0, i2cm_read_buffer, BUFFER_SIZE);
/* 等待I2CM传输完成 */
while (!hal_i2cm_get_transfer_complete(I2C_INDEX_1));
TAU_LOGD("rx: %x %x %x %x %x %x %x %x %x %x\n", i2cm_read_buffer[0], i2cm_read_buffer[1], \
i2cm_read_buffer[2], i2cm_read_buffer[3], i2cm_read_buffer[4], i2cm_read_buffer[5], \
i2cm_read_buffer[6], i2cm_read_buffer[7], i2cm_read_buffer[8], i2cm_read_buffer[9]);
/* 检查传输结果I2CM发出去的数据是否与接收到的数据一致 */
CHECK_TRANS_RESULT(write_buffer1, i2cm_read_buffer, BUFFER_SIZE);
/* 修改I2CM的目标从机地址为10位地址的0x120 */
hal_i2cm_set_slave_addr(I2C_INDEX_1, i2cs2_addr, i2cs2_addrbit);
/* I2CM写write_buffer2数据到0x120地址的从机 */
hal_i2cm_dma_write(I2C_INDEX_1, write_buffer2, BUFFER_SIZE);
/* 等待I2CM传输完成 */
while (!hal_i2cm_get_transfer_complete(I2C_INDEX_1));
TAU_LOGD("tx: %x %x %x %x %x %x %x %x %x %x\n", write_buffer2[0], write_buffer2[1], write_buffer2[2], \
write_buffer2[3], write_buffer2[4], write_buffer2[5], write_buffer2[6], write_buffer2[7], write_buffer2[8], \
write_buffer2[9]);
/* I2CM向地址为0x120的从机读取BUFFER_SIZE个数据此case中寄存器addr和size为0可自行添加 */
hal_i2cm_dma_read(I2C_INDEX_1, 0, 0, i2cm_read_buffer, BUFFER_SIZE);
/* 等待I2CM传输完成 */
while (!hal_i2cm_get_transfer_complete(I2C_INDEX_1));
TAU_LOGD("rx: %x %x %x %x %x %x %x %x %x %x\n", i2cm_read_buffer[0], i2cm_read_buffer[1], \
i2cm_read_buffer[2], i2cm_read_buffer[3], i2cm_read_buffer[4], i2cm_read_buffer[5], \
i2cm_read_buffer[6], i2cm_read_buffer[7], i2cm_read_buffer[8], i2cm_read_buffer[9]);
/* 检查传输结果I2CM发出去的数据是否与接收到的数据一致 */
CHECK_TRANS_RESULT(write_buffer2, i2cm_read_buffer, BUFFER_SIZE);
/* I2CM && I2CS去初始化 */
i2cm_deinit(I2C_INDEX_1);
i2cs_deinit(I2C_INDEX_0);
i2cs_deinit(I2C_INDEX_2);
TAU_LOGD("hal_i2c_double_slave_case done!\n");
return true;
}
/**
* @brief i2c demo case
* @param none
* @retval none
*/
void demo_hal_i2c(void)
{
/* I2C DMA传输case */
if (!hal_i2c_dma_transfer_case())
{
i2cs_deinit(I2C_INDEX_0);
i2cm_deinit(I2C_INDEX_1);
TAU_LOGD("hal_i2c_dma_transfer_case fail!\n");
}
/* 双slave传输case */
if (!hal_i2c_double_slave_case())
{
i2cm_deinit(I2C_INDEX_1);
i2cs_deinit(I2C_INDEX_0);
i2cs_deinit(I2C_INDEX_2);
TAU_LOGD("hal_i2c_double_slave_case fail!\n");
}
/* I2C CPU传输case */
if (!hal_i2c_cpu_transfer_case())
{
i2cs_deinit(I2C_INDEX_0);
i2cm_deinit(I2C_INDEX_1);
TAU_LOGD("hal_i2c_cpu_transfer_case fail!\n");
}
TAU_LOGD("i2c case done\n");
}
#endif

View File

@ -0,0 +1,35 @@
/*******************************************************************************
* Copyright (C) 2020-2023, tau Systems (R),All Rights Reserved.
*
* File: demo_hal_i2c.h
* Description: demo i2c
* Version: V0.1
* Date 2023-07-27
* Author: swx
*******************************************************************************/
#ifndef __DEMO_HAL_I2C_H__
#define __DEMO_HAL_I2C_H__
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "test_cfg_global.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
*******************************************************************************/
void demo_hal_i2c(void);
#endif /* __DEMO_HAL_I2C_H__ */

View File

@ -0,0 +1,125 @@
/*******************************************************************************
*
*
* File: demo_hal_pwm.c
* Description pwm demo code
* Version V0.1
* Date 2023-07-27
* Author jaya
*******************************************************************************/
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "stdarg.h"
#include "stdlib.h"
#include "stdio.h"
#include "test_cfg_global.h"
#include "hal_pwm.h"
#include "hal_gpio.h"
#include "tau_log.h"
#include "tau_delay.h"
#include "demo_hal_pwm.h"
#if _MODULE_DEMO_PWM_EN
/*******************************************************************************
* 2.Global constant and macro definitions using #define
*******************************************************************************/
#ifdef LOG_TAG
#undef LOG_TAG
#endif
#define LOG_TAG "demo_hal_pwm"
/*******************************************************************************
* 3.Global function and Global variable declarations
*******************************************************************************/
/*******************************************************************************
* 4.Global variable extern declarations
*******************************************************************************/
/*******************************************************************************
* 5.Global function prototypes
*******************************************************************************/
/**
* @brief PWM输出demo
* @param
* @retval bool true/false
*/
bool demo_digital_pwm_output(void)
{
/* GPIO 初始化,配置PIN15输出PWM, PWM可配置从PIN2/PIN13/PIN15/PIN17/PIN36输出 */
hal_gpio_set_mode(IO_PIN_15, PIN15_MODE_PWMO);
//hal_gpio_set_mode(IO_PIN_17, PIN17_MODE_PWMO);
/* PWM 初始化 配置为30K 255阶 */
if (hal_pwm_init(30000, 255))
{
/* PWM enable */
hal_pwm_enable(true);
uint8_t i = 0;
while (i != 255)
{
/* PWM 配置占空比, 从1/255开始到100%*/
hal_pwm_set_duty(i);
delayMs(20);
i++;
}
}
/* PWM disable */
hal_pwm_enable(false);
/* PWM deinit */
hal_pwm_deinit();
TAU_LOGD("demo_digital_pwm_output done\n");
return true;
}
/**
* @brief PWM输出demo
* @param
* @retval bool true/false
*/
bool demo_analog_pwm_output_with_vcc(void)
{
/* 模拟PWM,可选择不从数字IO输出PWM,也可以选择从数字IO输出 */
hal_gpio_set_mode(IO_PIN_15, PIN15_MODE_PWMO);
//hal_gpio_set_mode(IO_PIN_17, PIN17_MODE_PWMO);
/* PWM 初始化 配置为30K 255阶 */
if (hal_pwm_init(30000, 255))
{
/* PWM enable */
hal_pwm_enable(true);
/* ELVCC 接入3-6V的电源,PWM 配置从ELVCC调试后的电源 */
hal_pwm_set_elvcc_output(true);
uint8_t i = 0;
while (i != 255)
{
hal_pwm_set_duty(i);
delayMs(20);
i++;
}
}
/* PWM disable */
hal_pwm_enable(false);
/* PWM deinit */
hal_pwm_deinit();
TAU_LOGD("demo_digital_pwm_output done\n");
return true;
}
/**
* @brief pwm demo case
* @param none
* @retval none
*/
void demo_hal_pwm(void)
{
TAU_LOGD("pwm dmeo \n");
//demo_digital_pwm_output();
demo_analog_pwm_output_with_vcc();
}
#endif

View File

@ -0,0 +1,36 @@
/*******************************************************************************
* Copyright (C) 2020-2023, tau Systems (R),All Rights Reserved.
*
* File: demo_hal_pwm.h
* Description: demo pwm
* Version: V0.1
* Date 2023-07-27
* Author: jaya
*******************************************************************************/
#ifndef __DEMO_HAL_PWM_H__
#define __DEMO_HAL_PWM_H__
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "test_cfg_global.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
*******************************************************************************/
void demo_hal_pwm(void);
#endif /* __DEMO_HAL_PWM_H__ */

View File

@ -0,0 +1,218 @@
/*******************************************************************************
*
*
* File: demo_hal_pwr.c
* Description pwr demo code
* Version V0.1
* Date 2023-07-27
* Author jaya
*******************************************************************************/
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "stdarg.h"
#include "stdlib.h"
#include "stdio.h"
#include "test_cfg_global.h"
#include "hal_pwr.h"
#include "hal_gpio.h"
#include "tau_log.h"
#include "tau_delay.h"
#include "demo_hal_pwr.h"
#if _MODULE_DEMO_PWR_EN
/*******************************************************************************
* 2.Global constant and macro definitions using #define
*******************************************************************************/
#ifdef LOG_TAG
#undef LOG_TAG
#endif
#define LOG_TAG "demo_hal_pwr"
#define MAIN_POWER_SELECT PWR_SEL_VCC /* 主供电电源选择 */
#define SLEEP_MODE_POWER PWR_SLEEP_IN_TP18 /* 息屏电源选择 */
/*******************************************************************************
* 3.Global function and Global variable declarations
*******************************************************************************/
/*******************************************************************************
* 4.Global variable extern declarations
*******************************************************************************/
/*******************************************************************************
* 5.Global function prototypes
*******************************************************************************/
static bool sg_system_resume = false;
static void ap_rstn_pull_high_cb(void *data)
{
TAU_LOGD("AP RSTN !\n");
/* system resume begin */
sg_system_resume = true;
/* 关闭AP reset检查 */
hal_gpio_set_ap_reset_int(DISABLE, NULL, DETECT_HIGH_LVL);
}
/**
* @brief normal sleep mode demo
* @param
* @retval bool true/false
*/
static bool demo_normal_sleep_mode()
{
/* 主电源供电选择 */
hal_pwr_set_main_power(MAIN_POWER_SELECT);
if (MAIN_POWER_SELECT == PWR_SEL_VCC)
{
while (hal_pwr_get_vcc_power_ready() == false);
}
/* system 正常启动 */
/* sustem suspend */
/* 关闭外设/图像通路 */
/* 息屏电源供电选择 */
hal_pwr_set_sleep_mode_power(SLEEP_MODE_POWER);
/* enter deep sleep mode */
TAU_LOGD("enter stop mode now\n");
/* normal sleep mode, MCU可以正常工作 */
hal_gpio_set_ap_reset_int(ENABLE, ap_rstn_pull_high_cb, DETECT_RISING_EDGE);
hal_pwr_enter_normal_sleep_mode();
while (1)
{
/* normal sleep mode 下外设模块正常,打印正常,SWD通讯正常 */
TAU_LOGD("wait ap rstn\n");
if (sg_system_resume)
{
break;
}
delayMs(1000);
}
/* 退出sleep mode */
hal_pwr_exit_sleep_mode();
/* system resume */
TAU_LOGD("system resum\n");
return true;
}
/**
* @brief stop sleep mode demo
* @param
* @retval bool true/false
*/
static bool demo_stop_sleep_mode()
{
/* 主电源供电选择 */
hal_pwr_set_main_power(MAIN_POWER_SELECT);
if (MAIN_POWER_SELECT == PWR_SEL_VCC)
{
while (hal_pwr_get_vcc_power_ready() == false);
}
/* system 正常启动 */
/* sustem suspend */
/* 关闭外设/图像通路 */
/* 息屏电源供电选择 */
hal_pwr_set_sleep_mode_power(SLEEP_MODE_POWER);
/* enter deep sleep mode */
while (1)
{
TAU_LOGD("enter stop mode now\n");
/* 等待打印完成 */
delayMs(200); /* 实际使用不需要延时 */
/* 配置唤醒AP RSTN 、SPIS CS、TD INT 唤醒*/
hal_pwr_set_stop_sleep_wakeup_pin(IO_PAD_AP_RSTN, WUP_RISING_EDGE);
hal_pwr_set_stop_sleep_wakeup_pin(IO_PAD_AP_SPIS_CSN, WUP_FALLING_EDGE);
hal_pwr_set_stop_sleep_wakeup_pin(IO_PAD_TD_INT, WUP_FALLING_EDGE);
delayMs(1000); /* 实际使用不需要延时 */
/* 进入stop sleep mode, MCU停止运行,SWD无法通讯 */
io_pad_e wakeup_io = hal_pwr_enter_stop_sleep_mode();
TAU_LOGD("stop sleep mode wake up by io %d\n", wakeup_io);
if (wakeup_io == IO_PAD_AP_RSTN)
{
TAU_LOGD("AP RSTN reset, system resume\n");
break;
}
else
{
TAU_LOGD("Touch process\n");
/* 处理touchu 事件 处理完成后继续进入sleep mode*/
}
}
/* 退出sleep mode */
hal_pwr_exit_sleep_mode();
/* system resume */
TAU_LOGD("system resum\n");
return true;
}
/**
* @brief deep sleep mode demo
* @param
* @retval bool true/false
*/
static bool demo_deep_sleep_mode()
{
pwr_reset_flag_e reset_flag = hal_pwr_get_reset_flag();
TAU_LOGD("wakeup flag %d\n", reset_flag);
if (reset_flag == RF_TDINT_WAKEUP)
{
/* TD_INT reset, 处理触摸事件, 唤醒AP 等待AP RSTN*/
TAU_LOGD("TD_INT reset\n");
}
/* 主电源供电选择 */
hal_pwr_set_main_power(MAIN_POWER_SELECT);
if (MAIN_POWER_SELECT == PWR_SEL_VCC)
{
while (hal_pwr_get_vcc_power_ready() == false);
}
/* system 正常启动 */
/* enter deep sleep mode */
TAU_LOGD("enter deep mode now\n");
/* 息屏电源供电选择 */
hal_pwr_set_sleep_mode_power(SLEEP_MODE_POWER);
/* deep sleep mode,配置AP RSTN 上升沿,TD INT 下降沿唤醒 */
hal_pwr_enter_deep_sleep_mode(WUP_RISING_EDGE, WUP_FALLING_EDGE);
/* 数字完全掉电,SWD无法通讯,唤醒后芯片重启 */
return true;
}
/**
* @brief pwr demo case
* @param none
* @retval none
*/
void demo_hal_pwr(void)
{
TAU_LOGD("pwr dmeo \n");
/* normal sleep mode demo */
demo_normal_sleep_mode();
/* stop sleep mode demo */
demo_stop_sleep_mode();
/* deep sleep mode demo */
demo_deep_sleep_mode();
}
#endif

View File

@ -0,0 +1,36 @@
/*******************************************************************************
* Copyright (C) 2020-2023, tau Systems (R),All Rights Reserved.
*
* File: demo_hal_pwr.h
* Description: demo pwr
* Version: V0.1
* Date 2023-07-27
* Author: jaya
*******************************************************************************/
#ifndef __DEMO_HAL_PWR_H__
#define __DEMO_HAL_PWR_H__
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "test_cfg_global.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
*******************************************************************************/
void demo_hal_pwr(void);
#endif /* __DEMO_HAL_PWR_H__ */

View File

@ -0,0 +1,485 @@
/*******************************************************************************
* Copyright (C) 2020-2023, tau Systems (R),All Rights Reserved.
*
* File: demo_hal_spi.c
* Description spi demo code
* Version V0.1
* Date 2023-07-27
* Author swx
*******************************************************************************/
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "hal_spi_master.h"
#include "hal_spi_slave.h"
#include "demo_hal_spi.h"
#include "hal_gpio.h"
#include "tau_log.h"
#include "tau_delay.h"
#if _MODULE_DEMO_SPI_EN
/*******************************************************************************
* 2.Global constant and macro definitions using #define
*******************************************************************************/
#ifdef LOG_TAG
#undef LOG_TAG
#endif
#define LOG_TAG "demo_hal_spi"
#define BUFFER_SIZE 255
#define CHECK_TRANS_RESULT(src, dst, size) \
for(uint32_t check_num = 0; check_num < size; check_num ++) \
{\
if(src[check_num] != dst[check_num])\
{\
TAU_LOGD("src[%d] = %x, dst[%d] = %x , error!!\n",check_num,src[check_num],check_num,dst[check_num]);\
return false;\
}\
}\
/*******************************************************************************
* 3.Global function and Global variable declarations
*******************************************************************************/
bool spis_hw_miss_flag = false;
/*SPIS硬件回复功能32组回复数据*/
uint8_t spis_hw_header_data0[] = {0xf0, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d};
uint8_t spis_hw_header_data1[] = {0xf1, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19};
uint8_t spis_hw_header_data2[] = {0xf2, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29};
uint8_t spis_hw_header_data3[] = {0xf3, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39};
uint8_t spis_hw_header_data4[] = {0xf4, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49};
uint8_t spis_hw_header_data5[] = {0xf5, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59};
uint8_t spis_hw_header_data6[] = {0xf6, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69};
uint8_t spis_hw_header_data7[] = {0xf7, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79};
uint8_t spis_hw_header_data8[] = {0xf8, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89};
uint8_t spis_hw_header_data9[] = {0xf9, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99};
uint8_t spis_hw_header_data10[] = {0xfa, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9};
uint8_t spis_hw_header_data11[] = {0xfb, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9};
uint8_t spis_hw_header_data12[] = {0xfc, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9};
uint8_t spis_hw_header_data13[] = {0xfd, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9};
uint8_t spis_hw_header_data14[] = {0xfe, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9};
uint8_t spis_hw_header_data15[] = {0xff, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9};
uint8_t spis_hw_header_data16[] = {0xf0, 0x21, 0x31, 0x41, 0x51, 0x61, 0x71, 0x81, 0x91};
uint8_t spis_hw_header_data17[] = {0xf1, 0x22, 0x31, 0x42, 0x52, 0x62, 0x72, 0x82, 0x92};
uint8_t spis_hw_header_data18[] = {0xf2, 0x23, 0x33, 0x43, 0x53, 0x63, 0x73, 0x83, 0x93};
uint8_t spis_hw_header_data19[] = {0xf3, 0x24, 0x34, 0x44, 0x54, 0x64, 0x74, 0x84, 0x94};
uint8_t spis_hw_header_data20[] = {0xf4, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09};
uint8_t spis_hw_header_data21[] = {0xf5, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19};
uint8_t spis_hw_header_data22[] = {0xf6, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29};
uint8_t spis_hw_header_data23[] = {0xf7, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39};
uint8_t spis_hw_header_data24[] = {0xf8, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49};
uint8_t spis_hw_header_data25[] = {0xf9, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59};
uint8_t spis_hw_header_data26[] = {0xfa, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69};
uint8_t spis_hw_header_data27[] = {0xfb, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79};
uint8_t spis_hw_header_data28[] = {0xfc, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89};
uint8_t spis_hw_header_data29[] = {0xfd, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99};
uint8_t spis_hw_header_data30[] = {0xfe, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89};
uint8_t spis_hw_header_data31[] = {0xff, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xf0, 0x13, 0xff};
static hal_spis_hw_ack_info_t spis_hw_test_header[32] =
{
/*序号_匹配值_匹配长度_使能_回复延时_回复数据的地址_回复数据长度 */
{0, {0x01, 0x02, 0x03, 0x04}, 0, 1, 0, spis_hw_header_data0, sizeof(spis_hw_header_data0) / sizeof(uint8_t) - 1},
{1, {0x05, 0x06, 0x07, 0x08}, 1, 1, 1, spis_hw_header_data1, sizeof(spis_hw_header_data1) / sizeof(uint8_t) - 1},
{2, {0x09, 0x0a, 0x0b, 0x0c}, 2, 1, 2, spis_hw_header_data2, sizeof(spis_hw_header_data2) / sizeof(uint8_t) - 1},
{3, {0x0d, 0x0e, 0x0f, 0x10}, 3, 1, 3, spis_hw_header_data3, sizeof(spis_hw_header_data3) / sizeof(uint8_t) - 1},
{4, {0x11, 0x12, 0x13, 0x14}, 0, 1, 4, spis_hw_header_data4, sizeof(spis_hw_header_data4) / sizeof(uint8_t) - 1},
{5, {0x15, 0x16, 0x17, 0x18}, 1, 1, 5, spis_hw_header_data5, sizeof(spis_hw_header_data5) / sizeof(uint8_t) - 1},
{6, {0x19, 0x1a, 0x1b, 0x1c}, 2, 1, 6, spis_hw_header_data6, sizeof(spis_hw_header_data6) / sizeof(uint8_t) - 1},
{7, {0x1d, 0x1e, 0x1f, 0x20}, 3, 1, 7, spis_hw_header_data7, sizeof(spis_hw_header_data7) / sizeof(uint8_t) - 1},
{8, {0x21, 0x22, 0x23, 0x24}, 0, 1, 8, spis_hw_header_data8, sizeof(spis_hw_header_data8) / sizeof(uint8_t) - 1},
{9, {0x25, 0x26, 0x27, 0x28}, 1, 1, 9, spis_hw_header_data9, sizeof(spis_hw_header_data9) / sizeof(uint8_t) - 1},
{10, {0x29, 0x2a, 0x2b, 0x2c}, 2, 1, 10, spis_hw_header_data10, sizeof(spis_hw_header_data10) / sizeof(uint8_t) - 1},
{11, {0x2d, 0x2e, 0x2f, 0x30}, 3, 1, 0, spis_hw_header_data11, sizeof(spis_hw_header_data11) / sizeof(uint8_t) - 1},
{12, {0x31, 0x32, 0x33, 0x34}, 0, 1, 1, spis_hw_header_data12, sizeof(spis_hw_header_data12) / sizeof(uint8_t) - 1},
{13, {0x35, 0x36, 0x37, 0x38}, 1, 1, 2, spis_hw_header_data13, sizeof(spis_hw_header_data13) / sizeof(uint8_t) - 1},
{14, {0x39, 0x3a, 0x3b, 0x3c}, 2, 1, 3, spis_hw_header_data14, sizeof(spis_hw_header_data14) / sizeof(uint8_t) - 1},
{15, {0x3d, 0x3e, 0x3f, 0x40}, 3, 1, 4, spis_hw_header_data15, sizeof(spis_hw_header_data15) / sizeof(uint8_t) - 1},
{16, {0x41, 0x42, 0x43, 0x44}, 0, 1, 5, spis_hw_header_data16, sizeof(spis_hw_header_data16) / sizeof(uint8_t) - 1},
{17, {0x45, 0x46, 0x47, 0x48}, 1, 1, 6, spis_hw_header_data17, sizeof(spis_hw_header_data17) / sizeof(uint8_t) - 1},
{18, {0x49, 0x4a, 0x4b, 0x4c}, 2, 1, 7, spis_hw_header_data18, sizeof(spis_hw_header_data18) / sizeof(uint8_t) - 1},
{19, {0x4d, 0x4e, 0x4f, 0x50}, 3, 1, 8, spis_hw_header_data19, sizeof(spis_hw_header_data19) / sizeof(uint8_t) - 1},
{20, {0x51, 0x52, 0x53, 0x54}, 0, 1, 9, spis_hw_header_data20, sizeof(spis_hw_header_data20) / sizeof(uint8_t) - 1},
{21, {0x55, 0x56, 0x57, 0x58}, 1, 1, 10, spis_hw_header_data21, sizeof(spis_hw_header_data21) / sizeof(uint8_t) - 1},
{22, {0x59, 0x5a, 0x5b, 0x5c}, 2, 1, 11, spis_hw_header_data22, sizeof(spis_hw_header_data22) / sizeof(uint8_t) - 1},
{23, {0x5d, 0x5e, 0x5f, 0x60}, 3, 1, 12, spis_hw_header_data23, sizeof(spis_hw_header_data23) / sizeof(uint8_t) - 1},
{24, {0x61, 0x62, 0x63, 0x64}, 0, 1, 13, spis_hw_header_data24, sizeof(spis_hw_header_data24) / sizeof(uint8_t) - 1},
{25, {0x65, 0x66, 0x67, 0x68}, 1, 1, 14, spis_hw_header_data25, sizeof(spis_hw_header_data25) / sizeof(uint8_t) - 1},
{26, {0x69, 0x6a, 0x6b, 0x6c}, 2, 1, 15, spis_hw_header_data26, sizeof(spis_hw_header_data26) / sizeof(uint8_t) - 1},
{27, {0x6d, 0x6e, 0x6f, 0x70}, 3, 1, 11, spis_hw_header_data27, sizeof(spis_hw_header_data27) / sizeof(uint8_t) - 1},
{28, {0x71, 0x72, 0x73, 0x74}, 0, 1, 12, spis_hw_header_data28, sizeof(spis_hw_header_data28) / sizeof(uint8_t) - 1},
{29, {0x75, 0x76, 0x77, 0x78}, 1, 1, 13, spis_hw_header_data29, sizeof(spis_hw_header_data29) / sizeof(uint8_t) - 1},
{30, {0x79, 0x7a, 0x7b, 0x7c}, 2, 1, 12, spis_hw_header_data30, sizeof(spis_hw_header_data30) / sizeof(uint8_t) - 1},
{31, {0x7d, 0x7e, 0x7f, 0x80}, 3, 1, 14, spis_hw_header_data31, sizeof(spis_hw_header_data31) / sizeof(uint8_t) - 1},
};
static uint8_t spim_write_buffer[BUFFER_SIZE] = {0};
static uint8_t spim_read_buffer[BUFFER_SIZE] = {0};
static uint8_t spis_read_buffer[BUFFER_SIZE] = {0};
static uint8_t spis_write_buffer[BUFFER_SIZE] = {0};
/*******************************************************************************
* 4.Global variable extern declarations
*******************************************************************************/
/*******************************************************************************
* 5.Global function prototypes
*******************************************************************************/
/**
* @brief spi master IO初始化
* @param none
* @retval
*/
static void spim_io_init(void)
{
io_pad_attr_t attrs[] =
{
{IO_PAD_TD_SPIM_CLK, PIN5_MODE_SPIM_SCLK, IO_IOE_NONE, IO_LVL_HIGH},
{IO_PAD_TD_SPIM_CSN, PIN6_MODE_SPIM_CSN, IO_IOE_NONE, IO_LVL_HIGH},
{IO_PAD_TD_SPIM_MISO, PIN7_MODE_SPIM_MISO, IO_IOE_NONE, IO_LVL_HIGH},
{IO_PAD_TD_SPIM_MOSI, PIN4_MODE_SPIM_MOSI, IO_IOE_NONE, IO_LVL_HIGH}
};
uint8_t size = sizeof(attrs) / sizeof(io_pad_attr_t);
hal_gpio_config_pad(attrs, size);
}
/**
* @brief spi slave IO初始化
* @param none
* @retval
*/
static void spis_io_init(void)
{
io_pad_attr_t attrs[] =
{
{IO_PAD_AP_SPIS_CLK, PIN32_MODE_SPIS_SCLK, IO_IOE_NONE, IO_LVL_HIGH},
{IO_PAD_AP_SPIS_CSN, PIN31_MODE_SPIS_CSN, IO_IOE_NONE, IO_LVL_HIGH},
{IO_PAD_AP_SPIS_MISO, PIN30_MODE_SPIS_MISO, IO_IOE_NONE, IO_LVL_HIGH},
{IO_PAD_AP_SPIS_MOSI, PIN33_MODE_SPIS_MOSI, IO_IOE_NONE, IO_LVL_HIGH}
};
uint8_t size = sizeof(attrs) / sizeof(io_pad_attr_t);
hal_gpio_config_pad(attrs, size);
}
/**
* @brief spi slave中断回调函数
* @param eventSPIS收到的中断事件
* @param packet_info SPIS收到的数据packet
* @retval
*/
void spis_callback(hal_spis_event_e event, hal_spis_packet_info_t *packet_info)
{
/* 收到CS_RISE中断 */
if (event == SPIS_EVENT_RCV_CS_RISE)
{
/* 更新SPIS的txbuffer和rxbuffer */
hal_spis_update_rx_buffer(spis_read_buffer, BUFFER_SIZE);
hal_spis_update_tx_buffer(spis_write_buffer, BUFFER_SIZE, true);
}
/* 收到CS_FALL中断 */
else if (event == SPIS_EVENT_RCV_CS_FALL)
{
//TAU_LOGD("spis_test SPIS_EVENT_RCV_CS_FALL\n");
}
/* 收到数据接收指定阈值中断 */
else if (event == SPIS_EVENT_RCV_CNT)
{
//TAU_LOGD("spis_test SPIS_EVENT_RCV_CNT\n");
}
/* 收到数据接收完全中断 */
else if (event == SPIS_EVENT_RCV_FULL)
{
//TAU_LOGD("spis_test SPIS_EVENT_RCV_CNT\n");
}
}
/**
* @brief spi slave硬件快速回复功能中断回调函数
* @param eventSPIS收到的中断事件
* @param packet_info SPIS收到的数据packet
* @retval
*/
void spis_hw_callback(hal_spis_event_e event, hal_spis_packet_info_t *packet_info)
{
/* 收到CS_RISE中断 */
if (event == SPIS_EVENT_RCV_CS_RISE)
{
/* 产生了ALL_MISS中断的标记 */
if (spis_hw_miss_flag)
{
/* 使能SPIS硬件快速回复功能默认回复值为0xE0 */
hal_spis_set_hw_ack_enable(ENABLE, 0xE0);
spis_hw_miss_flag = false;
}
/* SPIS更新读写buffer */
hal_spis_update_tx_buffer(spis_hw_header_data31, sizeof(spis_hw_header_data31) / sizeof(uint8_t), true);
hal_spis_update_rx_buffer(spis_read_buffer, BUFFER_SIZE);
}
/* 收到ALL_MISS中断 */
if (event == SPIS_EVENT_ALL_MISS)
{
/* 关闭SPIS硬件快速回复功能默认回复值为0xF0 */
hal_spis_set_hw_ack_enable(DISABLE, 0xf0);
spis_hw_miss_flag = true;
TAU_LOGE("All miss intr test\n");
}
}
/**
* @brief
* @param range_begin:
* @param renge_end:
* @retval uint32_t :
*/
uint32_t unit_case_get_rand(uint32_t range_begin, uint32_t renge_end)
{
uint32_t range = 1;
if (renge_end > range_begin)
{
range = renge_end - range_begin + 1;
}
else
{
TAU_LOGE("rand range[%d ~ %d] error! default set to 1\n");
}
return (uint32_t)((rand() % range) + range_begin);
}
/**
* @brief spi master和slave的发送/buffer初始化
* @param none
* @retval
*/
static bool spi_case_rand_buffer(bool spim_en, bool spis_en)
{
TAU_LOGD("spi_case_rand_buffer\n");
/* read buffer默认初始化为0, tx buffer 初始为随机数 */
uint8_t i = 0 ;
uint32_t count = BUFFER_SIZE;
for (i = 0; i < count; i ++)
{
spis_read_buffer[i] = 0;
spim_read_buffer[i] = 0;
if (spim_en)
{
spim_write_buffer[i] = unit_case_get_rand(0, 255);
}
if (spis_en)
{
spis_write_buffer[i] = unit_case_get_rand(0, 255);
}
}
return true;
}
/**
* @brief SPIM与SPIS对接,
* @param
* @retval bool true/false
*/
static bool hal_spi_base_case(void)
{
uint32_t speed = 400000;
uint8_t cpha = 0;
uint8_t cpol = 0;
/* 随机buffer值 */
spi_case_rand_buffer(true, true);
/* SPIS IO初始化 */
spis_io_init();
/* SPIS初始化相位0+极性0 */
hal_spis_init(cpha, cpol);
/* SPIS设置初始读写buffer */
hal_spis_update_rx_buffer(spis_read_buffer, BUFFER_SIZE);
hal_spis_update_tx_buffer(spis_write_buffer, BUFFER_SIZE, true);
/* SPIS注册回调函函数这里开启了CS_RISE、CS_FALL、RX_CNT、RX_FULL中断RX_CNT阈值设置为100 */
hal_spis_register_callback(spis_callback, SPIS_EVENT_RCV_CS_RISE | SPIS_EVENT_RCV_CS_FALL | SPIS_EVENT_RCV_CNT | SPIS_EVENT_RCV_FULL, 100);
/* SPIS启动 */
hal_spis_start();
/* SPIM IOc初始化 */
spim_io_init();
/* SPIM初始化400k传输速率+相位0+极性0 */
hal_spim_init(speed, cpha, cpol);
TAU_LOGD("base trans para cpha[%d] cpol[%d] speed[%d] \n", cpha, cpol, speed);
/* 测试 SPIM CPU读写 */
hal_spim_read(spim_write_buffer, BUFFER_SIZE, spim_read_buffer, BUFFER_SIZE);
/* SPIM 写完,检查 SPIS RX buffer 是否等于 SPIM TX buffer*/
CHECK_TRANS_RESULT(spim_write_buffer, spis_read_buffer, BUFFER_SIZE);
/* SPIM 读完,检查 SPIS TX buffer 是否等于 SPIM RX buffer*/
CHECK_TRANS_RESULT(spis_write_buffer, spim_read_buffer, BUFFER_SIZE);
/* 随机buffer值 */
spi_case_rand_buffer(true, false);
/* 测试 SPIM CPU写 */
hal_spim_write(spim_write_buffer, BUFFER_SIZE);
/* SPIM 写完,检查 SPIS RX buffer 是否等于 SPIM TX buffer*/
CHECK_TRANS_RESULT(spim_write_buffer, spis_read_buffer, BUFFER_SIZE);
/* 传输完成,关闭SPI */
hal_spis_stop();
hal_spis_deinit();
hal_spim_deinit();
TAU_LOGD("hal_spi_base_case done!\n");
return true;
}
/**
* @brief SPIM与SPIS对接, SPIS
* @param
* @retval bool true/false
*/
static bool hal_spis_hw_case(void)
{
uint32_t speed = 400000;
uint8_t cpha = 0;
uint8_t cpol = 0;
uint8_t write_buffer[30] = {0x9e, 0xa0, 0x00, 0x01, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
0x8a, 0x1b, 0x1c, 0x5d, 0x7e, 0x4f, 0x20, 0x21, 0x22, 0x23,
0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x30, 0x31, 0x32, 0x33
};
/* SPIS IO初始化 */
spis_io_init();
/* SPIS初始化相位0+极性0 */
hal_spis_init(cpha, cpol);
/* SPIS设置初始读buffer */
hal_spis_update_rx_buffer(spis_read_buffer, BUFFER_SIZE);
/* SPIS设置初始写buffer */
hal_spis_update_tx_buffer(spis_hw_header_data31, sizeof(spis_hw_header_data31) / sizeof(uint8_t), true);
/* SPIS注册回调函函数这里开启了CS_RISE和ALL_MISS中断 */
hal_spis_register_callback(spis_hw_callback, SPIS_EVENT_RCV_CS_RISE | SPIS_EVENT_ALL_MISS, 0);
/* 设置SPIS硬件快速回复参数 */
hal_spis_set_hw_ack_info(spis_hw_test_header, (sizeof(spis_hw_test_header) / sizeof(hal_spis_hw_ack_info_t)));
/* 使能SPIS硬件快速回复功能默认回复值为0xE0 */
hal_spis_set_hw_ack_enable(ENABLE, 0xE0);
/* SPIS启动 */
hal_spis_start();
/* SPIM IO初始化 */
spim_io_init();
/* SPIM初始化400k传输速率+相位0+极性0 */
hal_spim_init(speed, cpha, cpol);
/* 32组硬件快速回复功能参数demo */
for (int k = 0; k < 32; k++)
{
/* write_buffer前4个字节设置为每组参数的匹配值 */
for (int j = 0; j < 4; j++)
{
write_buffer[j] = spis_hw_test_header[k].cmp_data[j];
}
/* 将第11组和第14组的write_buffer[0]自加这样匹配不到后就会产生ALL_MISS中断 */
if ((k == 10) || (k == 13))
{
write_buffer[0]++;
}
/* FLUSH SPIM FIFO */
hal_spim_flush();
/* SPIM发送30个write_buffer数据给SPIS并读取SPIS的30个数据到spim_read_buffer */
hal_spim_read(write_buffer, 30, spim_read_buffer, 30);
/* 等待SPIM传输完成 */
while (!hal_spim_get_transfer_complete());
printf("SPIM_TX:");
for (int i = 0; i < 30; i++)
{
printf("%02x ", spis_read_buffer[i]);
}
printf("\n");
printf("SPIM_RX:");
for (int i = 0; i < 30; i++)
{
printf("%02x ", spim_read_buffer[i]);
}
printf("\n");
/* 以下是校验SPIS的硬件快速回复数据是否正确 */
int index = spis_hw_test_header[k].delay_clk + 1 + spis_hw_test_header[k].cmp_len + 1;
printf("CMP_LEN:%d, DELAY_CLK:%d\n", spis_hw_test_header[k].cmp_len, spis_hw_test_header[k].delay_clk);
bool flag = true;
for (int i = 0; i < spis_hw_test_header[k].ack_length; i++)
{
if (spis_hw_test_header[k].ack_address[i] == spim_read_buffer[index + i])
{
if (flag)
{
printf("Group[%d] OK\n", k);
flag = false;
}
continue;
}
else
{
if ((k == 10) || (k == 13))
{
if (flag)
{
printf("Group[%d] All_miss init test\n", k);
flag = false;
}
continue;
}
else
{
printf("Header_addr[%d]:%02x Header_addr[%d]:%02x ", i, spis_hw_test_header[k].ack_address[i], index + i, spim_read_buffer[index + i]);
printf("Group[%d] error\n", k);
return false;
}
}
}
printf("\n");
}
/* 传输完成,关闭SPI */
hal_spis_stop();
hal_spis_deinit();
hal_spim_deinit();
TAU_LOGD("hal_spis_hw_case done!\n");
return true;
}
/**
* @brief spi demo case
* @param none
* @retval none
*/
void demo_hal_spi(void)
{
/* 基础传输case */
if (!hal_spi_base_case())
{
hal_spis_stop();
hal_spis_deinit();
hal_spim_deinit();
TAU_LOGD("hal_spi_base_case fail!\n");
}
/* SPIS硬件快速回复功能case */
if (!hal_spis_hw_case())
{
hal_spis_stop();
hal_spis_deinit();
hal_spim_deinit();
TAU_LOGD("hal_spis_hw_case fail!\n");
}
TAU_LOGD("spi case done\n");
}
#endif

View File

@ -0,0 +1,37 @@
/*******************************************************************************
* Copyright (C) 2020-2023, tau Systems (R),All Rights Reserved.
*
* File: demo_hal_spi.h
* Description: demo spi
* Version: V0.1
* Date 2023-07-27
* Author: swx
*******************************************************************************/
#ifndef __DEMO_HAL_SPI_H__
#define __DEMO_HAL_SPI_H__
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "test_cfg_global.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
*******************************************************************************/
void demo_hal_spi(void);
#endif /* __DEMO_HAL_SPI_H__ */

View File

@ -0,0 +1,140 @@
/*******************************************************************************
*
*
* File: demo_hal_swire.c
* Description swire demo code
* Version V0.1
* Date 2023-07-27
* Author jaya
*******************************************************************************/
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "stdarg.h"
#include "stdlib.h"
#include "stdio.h"
#include "test_cfg_global.h"
#include "hal_swire.h"
#include "hal_gpio.h"
#include "tau_log.h"
#include "tau_delay.h"
#include "demo_hal_swire.h"
#if _MODULE_DEMO_SWIRE_EN
/*******************************************************************************
* 2.Global constant and macro definitions using #define
*******************************************************************************/
#ifdef LOG_TAG
#undef LOG_TAG
#endif
#define LOG_TAG "demo_hal_swire"
/*******************************************************************************
* 3.Global function and Global variable declarations
*******************************************************************************/
/*******************************************************************************
* 4.Global variable extern declarations
*******************************************************************************/
/*******************************************************************************
* 5.Global function prototypes
*******************************************************************************/
/**
* @brief swire demo
* @param
* @retval bool true/false
*/
static bool demo_hal_swire_gen_swire_manual(void)
{
/* 配置PIN15为SWIRE 输出*/
hal_gpio_set_mode(IO_PAD_AP_SWIRE, PIN15_MODE_SWIRE);
/* swire 初始化 */
hal_swire_init();
/* 启动swire, Swire引脚信号拉高 */
hal_swire_enable(true);
delayMs(100);
/* 配置pulse 为36,产生36个脉冲波形后保持拉高 */
hal_swire_set_pulse(36);
delayMs(100);
/* 配置pulse 为25,产生25个脉冲波形后保持拉高 */
hal_swire_set_pulse(25);
delayMs(100);
/* 关闭swire, Swire引脚信号拉低 */
hal_swire_enable(false);
/* swire去初始化 */
hal_swire_deinit();
return true;
}
/**
* @brief swire demo
* @param
* @retval bool true/false
*/
static bool demo_hal_swire_gen_swire_auto(void)
{
/* 配置PIN15为SWIRE 输出*/
hal_gpio_set_mode(IO_PAD_AP_SWIRE, PIN15_MODE_SWIRE);
/* swire 初始化 */
hal_swire_init();
hal_swire_set_timer(TIMER_NUM0, 16, true);
/* 启动swire, Swire引脚信号拉高,每个16ms发送一次swire信号 */
hal_swire_enable(true);
/*保持每16ms输出36个脉冲持续100ms*/
hal_swire_set_pulse(36); /* 使用timer情况下pulse配置为0时实际输出255个脉冲, 可以在enable之前或者enable前后配置发送正确波形,消除255脉冲问题 */
delayMs(100);
/* 配置pulse 为25,保持每16ms输出36个脉冲持续100ms */
hal_swire_set_pulse(25);
/* 关闭swire, Swire引脚信号拉低 */
hal_swire_enable(false);
/* swire去初始化 */
hal_swire_deinit();
return true;
}
/**
* @brief swire demo
* @param
* @retval bool true/false
*/
static bool demo_hal_swire_set_swire_waveform(void)
{
/* 配置PIN15为SWIRE 输出*/
hal_gpio_set_mode(IO_PAD_AP_SWIRE, PIN15_MODE_SWIRE);
/* swire 初始化 */
hal_swire_init();
/* 配置波形,持续时间50us */
hal_swire_set_waveform(50, 50, 50, 50);
/* 启动swire, Swire引脚信号拉高 */
hal_swire_enable(true);
delayMs(100);
/* 配置pulse 为36,产生36个脉冲波形后保持拉高 */
hal_swire_set_pulse(36);
delayMs(100);
/* 关闭swire, Swire引脚信号拉低 */
hal_swire_enable(false);
/* swire去初始化 */
hal_swire_deinit();
return true;
}
/**
* @brief swire demo case
* @param none
* @retval none
*/
void demo_hal_swire(void)
{
TAU_LOGD("swire dmeo \n");
demo_hal_swire_gen_swire_manual();
//demo_hal_swire_gen_swire_auto();
//demo_hal_swire_set_swire_waveform();
}
#endif

View File

@ -0,0 +1,36 @@
/*******************************************************************************
* Copyright (C) 2020-2023, tau Systems (R),All Rights Reserved.
*
* File: demo_hal_swire.h
* Description: demo swire
* Version: V0.1
* Date 2023-07-27
* Author: jaya
*******************************************************************************/
#ifndef __DEMO_HAL_SWIRE_H__
#define __DEMO_HAL_SWIRE_H__
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "test_cfg_global.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
*******************************************************************************/
void demo_hal_swire(void);
#endif /* __DEMO_HAL_SWIRE_H__ */

View File

@ -0,0 +1,136 @@
/*******************************************************************************
*
*
* File: demo_hal_timer.c
* Description timer demo源文件
* Version V0.1
* Date 2023-07-27
* Author zzf
*******************************************************************************/
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "hal_timer.h"
#include "hal_gpio.h"
#include "tau_log.h"
/*******************************************************************************
* 2.Global constant and macro definitions using #define
*******************************************************************************/
#ifdef LOG_TAG
#undef LOG_TAG
#endif
#define LOG_TAG "timer-log"
#define TIMER_DEMO_NORMAL 0 //定时器常规使用,循环超时
#define TIMER_DEMO_RESTART 1 //中断重启定时器
#define TIMER_SEL TIMER_NUM0 //timer0-3 都ok
/*******************************************************************************
* 3.Global structures, unions and enumerations using typedef
*******************************************************************************/
/*******************************************************************************
* 4.Global variable extern declarations
*******************************************************************************/
static io_pad_e sg_timer_io_pad = IO_PAD_GPIO1;
static gpio_level_e sg_timer_io_lvl = IO_LVL_LOW;
#if TIMER_DEMO_RESTART
static uint16_t sg_timer_count = 1;
#endif
/*******************************************************************************
* 5.Global function prototypes
*******************************************************************************/
#if TIMER_DEMO_RESTART
/**
* @brief
* @param None
* @retval None
*/
static void demo_timer_restart_callback(void *data)
{
/* 翻转GPIO */
sg_timer_io_lvl = (sg_timer_io_lvl ? IO_LVL_LOW : IO_LVL_HIGH);
hal_gpio_set_output_data(sg_timer_io_pad, sg_timer_io_lvl);
/* 重新启动定时器 */
sg_timer_count = sg_timer_count * 10;
if (sg_timer_count > 100)
{
sg_timer_count = 1;
}
hal_timer_start(TIMER_SEL, sg_timer_count * 10, demo_timer_restart_callback, NULL);
}
/**
* @brief
* @param None
* @retval None
*/
static void demo_timer_case_restart(void)
{
/*重新初始化定时器*/
hal_timer_init(TIMER_SEL);
hal_timer_set_repeat(TIMER_SEL, false);
/*初始化GPIO低电平*/
hal_gpio_init_output(sg_timer_io_pad, sg_timer_io_lvl);
/*更新当前timer测试参数*/
hal_timer_start(TIMER_SEL, sg_timer_count * 10, demo_timer_restart_callback, NULL);
}
#endif
#if TIMER_DEMO_NORMAL
/**
* @brief
* @param None
* @retval None
*/
static void demo_timer_normal_callback(void *data)
{
/* 翻转GPIO */
sg_timer_io_lvl = (sg_timer_io_lvl ? IO_LVL_LOW : IO_LVL_HIGH);
hal_gpio_set_output_data(sg_timer_io_pad, sg_timer_io_lvl);
}
/**
* @brief
* @param None
* @retval None
*/
static void demo_timer_case_normal(void)
{
/*重新初始化定时器*/
hal_timer_init(TIMER_SEL);
hal_timer_set_repeat(TIMER_SEL, true);
/*初始化GPIO低电平*/
hal_gpio_init_output(sg_timer_io_pad, sg_timer_io_lvl);
/*更新当前timer测试参数*/
hal_timer_start(TIMER_SEL, 10, demo_timer_normal_callback, NULL);
}
#endif
/**
* @brief demo测试接口函数
* @param None
* @retval None
*/
void demo_timer_case(void)
{
TAU_LOGI("start test\r\n");
#if TIMER_DEMO_NORMAL
demo_timer_case_normal(); // 10ms定时进行IO电平翻转
#elif TIMER_DEMO_RESTART
demo_timer_case_restart();
#endif
TAU_LOGI("end test\r\n");
}

View File

@ -0,0 +1,39 @@
/*******************************************************************************
*
*
* File: demo_hal_timer.h
* Description: timer demo头文件
* Version: V0.1
* Date: 2023-07-27
* Author: zzf
*******************************************************************************/
#ifndef __DEMO_TIMER_H__
#define __DEMO_TIMER_H__
/*******************************************************************************
* 1.Included files
*******************************************************************************/
/*******************************************************************************
* 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 demo测试接口函数
* @param None
* @retval None
*/
void demo_timer_case(void);
#endif /* __DEMO_TIMER_H__ */

View File

@ -0,0 +1,648 @@
/*******************************************************************************
*
*
* File: demo_hal_uart.c
* Description USB转串口分别连接UART01
* Version V0.1
* Date 2023-07-09
* Author kc
*******************************************************************************/
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "stdarg.h"
#include "stdlib.h"
#include "stdio.h"
#include "test_cfg_global.h"
#include "hal_uart.h"
#include "hal_gpio.h"
#include "tau_log.h"
#include "tau_delay.h"
#include "demo_hal_uart.h"
#if _MODULE_DEMO_UART_EN
/*******************************************************************************
* 2.Global constant and macro definitions using #define
*******************************************************************************/
#ifdef LOG_TAG
#undef LOG_TAG
#endif
#define LOG_TAG "uart-log"
#define UART_TEST_AUTO 1
#define TEST_UART_BAUDRATE 115200
/*******************************************************************************
* 3.Global function and Global variable declarations
*******************************************************************************/
/**
* @brief case
*/
typedef enum
{
UART_CASE_BLOCKING = 0,
UART_CASE_NONE_BLOCKING,
UART_CASE_DMA,
UART_CASE_MAX,
UART_CASE_LOOP_BACK,
UART_CASE_DEINIT,
} uart_case_e;
typedef void (*unit_test_func)();
typedef struct unit_test_entry_t
{
char case_name[128]; /* Case名称 */
unit_test_func case_func; /* Case处理函数 */
} unit_test_entry_t;
/*******************************************************************************
* 4.Global variable extern declarations
*******************************************************************************/
static char sg_uart_log[256] = {0};
static char sg_uart_send_buff[1024] = {0};
static char sg_uart_recv_buff[1024] = {0};
static uart_case_e sg_uart_case = UART_CASE_BLOCKING;
static hal_uart_num_e sg_uart_cur_num = HAL_UART_0;
volatile static bool sg_uart_case_done = true;
static hal_uart_config_t s_huart;
/*******************************************************************************
* 5.Global function prototypes
*******************************************************************************/
void STRFMT(const char *fmt, ...)
{
va_list ap;//初始化指向可变参数列表的指针
//将第一个可变参数的地址付给ap即ap指向可变参数列表的开始
va_start(ap, fmt);
//将参数fmt、ap指向的可变参数一起转换成格式化字符串放string数组中其作用同sprintf只是参数类型不同
vsprintf(sg_uart_log, fmt, ap);
va_end(ap); //ap付值为0没什么实际用处主要是为程序健壮性
}
#define TEST_LOG(num,format,...) \
do { \
STRFMT(format, ##__VA_ARGS__); \
hal_uart_send_blocking(num, (uint8_t *)sg_uart_log, strlen(sg_uart_log)); \
} while (0)
/**************************************************************************
* @name : TEST_UART_PinMux_Init
* @brief : UART
* @param[in] :
* @return :
* @retval :
**************************************************************************/
static void test_uart_mode_init(void)
{
//UART 0
hal_gpio_set_mode(IO_PAD_UART0_TX, PIN2_MODE_UART0_TX);
hal_gpio_set_mode(IO_PAD_UART0_RX, PIN36_MODE_UART0_RX);
//UART 1 只有唯一一组
//hal_gpio_set_mode(IO_PAD_UART1_TX, PIN14_MODE_UART1_TX);
//hal_gpio_set_mode(IO_PAD_TD_TP_RESX, PIN13_MODE_UART1_RX);
}
/**************************************************************************
* @name : test_uart_deinit
* @brief : uart注销
* @param[in] :
* @return :
* @retval :
**************************************************************************/
static void test_uart_common_deinit(hal_uart_num_e num)
{
delayMs(500);
hal_uart_deinit(num);
}
/**************************************************************************
* @name : test_uart_normal_init
* @brief : uart
* @param[in] :
* @return :
* @retval :
**************************************************************************/
static void test_uart_common_init(hal_uart_num_e num)
{
hal_uart_config_t huart = {0};
huart.baudrate = TEST_UART_BAUDRATE;
huart.data_width = HAL_UART_DATAWIDTH_8;
huart.parity = HAL_UART_PARITY_NO;
huart.stopbits = HAL_UART_STOPBIT_1;
hal_uart_init(num, &huart);
}
/**
* @brief
* @param
* @retval
*/
static char test_uart_get_input_str(hal_uart_num_e num)
{
char str = 0;
hal_uart_recv_blocking(num, (uint8_t *)&str, 1);
return str;
}
/**
* @brief
* @param
* @retval
*/
static uint32_t test_uart_get_input_num(hal_uart_num_e num)
{
uint32_t recv = 0;
char str[10] = {0};
uint8_t i = 0;
TEST_LOG(num, "input recv num and space to exit:");
while (1)
{
hal_uart_recv_blocking(num, (uint8_t *)&str[i], 1);
if (str[i] >= '0' && str[i] <= '9')
{
TEST_LOG(num, "%c", (char)str[i]);
i++;
}
else if (str[i] == 32)
{
str[i] = 0;
TEST_LOG(num, "\n");
break;
}
}
recv = atol(str);
return recv;
}
/**
* @brief uart所在PAD为GPIO mode
* @param
* @retval
*/
static void test_uart_reset_uart_mode(void)
{
hal_gpio_init_input(IO_PAD_AP_SPIS_MOSI);
hal_gpio_init_input(IO_PAD_UART0_TX);
hal_gpio_init_input(IO_PAD_AP_SPIS_MISO);
hal_gpio_init_input(IO_PAD_UART0_RX);
hal_gpio_init_input(IO_PAD_AP_TPRSTN);
hal_gpio_init_input(IO_PAD_AP_PWMEN);
hal_gpio_init_input(IO_PAD_TD_SPIM_MOSI);
hal_gpio_init_input(IO_PAD_UART1_TX);
hal_gpio_init_input(IO_PAD_TD_TP_RESX);
}
/**
* @brief UART2上设置UART1的TX和RX PAD
* @param
* @retval
*/
static void test_uart_set_uart_mode(void)
{
char str = 0;
hal_uart_num_e uart_org_num = sg_uart_cur_num;
TEST_LOG(uart_org_num, "select UART(0/1):\n");
TEST_LOG(uart_org_num, "Enter:");
str = test_uart_get_input_str(uart_org_num);
TEST_LOG(uart_org_num, "%c\n\n", str);
sg_uart_cur_num = (hal_uart_num_e)(str - '0');
if (HAL_UART_1 == sg_uart_cur_num) /* 测试UART1 */
{
//sel tx
TEST_LOG(uart_org_num, "select UART1 TX:\n");
TEST_LOG(uart_org_num, "0:IO_PAD_UART1_TX->PIN14_MODE_UART1_TX\n");
//sel rx
TEST_LOG(uart_org_num, "select UART1 RX:\n");
TEST_LOG(uart_org_num, "0:IO_PAD_TD_TP_RESX->PIN13_MODE_UART1_RX\n");
TEST_LOG(uart_org_num, "change the connect pin and press space to continue \n");
delayMs(200);
test_uart_reset_uart_mode();
hal_gpio_set_mode(IO_PAD_UART1_TX, PIN14_MODE_UART1_TX);
hal_gpio_set_mode(IO_PAD_TD_TP_RESX, PIN13_MODE_UART1_RX);
hal_uart_deinit(HAL_UART_0);
test_uart_common_init(HAL_UART_1);
}
else
{
uint8_t sel_tx, sel_rx;
//sel tx
TEST_LOG(uart_org_num, "select UART0 TX:\n");
TEST_LOG(uart_org_num, "0:IO_PAD_UART0_TX->PIN2_MODE_UART0_TX\n");
TEST_LOG(uart_org_num, "1:IO_PAD_AP_SPIS_MOSI->PIN33_MODE_UART0_TX \n");
TEST_LOG(uart_org_num, "2:IO_PAD_TD_SPIM_MOSI->PIN4_MODE_UART0_TX\n");
TEST_LOG(uart_org_num, "Enter:");
str = test_uart_get_input_str(uart_org_num);
TEST_LOG(uart_org_num, "%c\n\n", str);
sel_tx = str - '0';
//sel rx
TEST_LOG(uart_org_num, "select UART0 RX:\n");
TEST_LOG(uart_org_num, "0:IO_PAD_UART0_RX->PIN36_MODE_UART0_RX\n");
TEST_LOG(uart_org_num, "1:IO_PAD_AP_SPIS_MISO->PIN30_MODE_UART0_RX\n");
TEST_LOG(uart_org_num, "2:IO_PAD_AP_TPRSTN->PIN18_MODE_UART0_RX\n");
TEST_LOG(uart_org_num, "3:IO_PAD_AP_PWMEN->PIN17_MODE_UART0_RX\n");
TEST_LOG(uart_org_num, "4:IO_PAD_UART1_TX->PIN14_MODE_UART0_RX\n");
TEST_LOG(uart_org_num, "Enter:");
str = test_uart_get_input_str(uart_org_num);
TEST_LOG(uart_org_num, "%c\n\n", str);
sel_rx = str - '0';
TEST_LOG(uart_org_num, "change the connect pin and press space to continue \n");
delayMs(500);
test_uart_reset_uart_mode();
switch (sel_tx)
{
case 0:
hal_gpio_set_mode(IO_PAD_UART0_TX, PIN2_MODE_UART0_TX);
break;
case 1:
hal_gpio_set_mode(IO_PAD_AP_SPIS_MOSI, PIN33_MODE_UART0_TX);
break;
case 2:
hal_gpio_set_mode(IO_PAD_TD_SPIM_MOSI, PIN4_MODE_UART0_TX);
break;
default:
break;
}
switch (sel_rx)
{
case 0:
hal_gpio_set_mode(IO_PAD_UART0_RX, PIN36_MODE_UART0_RX);
break;
case 1:
hal_gpio_set_mode(IO_PAD_AP_SPIS_MISO, PIN30_MODE_UART0_RX);
break;
case 2:
hal_gpio_set_mode(IO_PAD_AP_TPRSTN, PIN18_MODE_UART0_RX);
break;
case 3:
hal_gpio_set_mode(IO_PAD_AP_PWMEN, PIN17_MODE_UART0_RX);
break;
case 4:
hal_gpio_set_mode(IO_PAD_UART1_TX, PIN14_MODE_UART0_RX);
break;
default:
break;
}
hal_uart_deinit(HAL_UART_1);
test_uart_common_init(HAL_UART_0);
}
while (1)
{
str = test_uart_get_input_str(sg_uart_cur_num);
if (str == 32)
{
break;
}
}
}
/**
* @brief
* @param
* @retval
*/
static bool test_uart_sel_continue()
{
uint8_t str = 0;
delayMs(500);
test_uart_common_deinit(sg_uart_cur_num);
test_uart_common_init(sg_uart_cur_num);
TEST_LOG(sg_uart_cur_num, " y repeat \n");
TEST_LOG(sg_uart_cur_num, " n exit \n");
while (1)
{
str = test_uart_get_input_str(sg_uart_cur_num);
switch (str)
{
case 'y':
TEST_LOG(sg_uart_cur_num, "y\n");
return true;
case 'n':
TEST_LOG(sg_uart_cur_num, "n\n");
return false;
default:
continue;
}
}
}
/**************************************************************************
* @name : test_uart_blocking
* @brief : UART TXRX阻塞读写
* @param[in] :
* @return :
* @retval :
**************************************************************************/
static void test_uart_blocking(void)
{
uint32_t recv = 0;
delayMs(500);
test_uart_common_deinit(sg_uart_cur_num);
test_uart_common_init(sg_uart_cur_num);
delayMs(500);
TEST_LOG(sg_uart_cur_num, "test uart%d start.\n", sg_uart_cur_num);
//test recv
recv = test_uart_get_input_num(sg_uart_cur_num);
TEST_LOG(sg_uart_cur_num, "input %d char one time:\n", recv);
memset(sg_uart_recv_buff, 0, recv + 1);
if (!hal_uart_recv_blocking(sg_uart_cur_num, (uint8_t *)sg_uart_recv_buff, recv))
{
TEST_LOG(sg_uart_cur_num, "an error has occurred!\n");
}
TEST_LOG(sg_uart_cur_num, "%s\n", sg_uart_recv_buff);
//test send
TEST_LOG(sg_uart_cur_num, "send:\n");
strcpy(sg_uart_send_buff, sg_uart_recv_buff);
if (!hal_uart_send_blocking(sg_uart_cur_num, (uint8_t *)sg_uart_send_buff, strlen(sg_uart_send_buff)))
{
TEST_LOG(sg_uart_cur_num, "an error has occurred!\n");
}
TEST_LOG(sg_uart_cur_num, "\n");
sg_uart_case_done = true;
}
/**************************************************************************
* @name : test_uart_trans_cb
* @brief :
* @param[in] :
* @return :
* @retval :
**************************************************************************/
static void test_uart_trans_cb(status_t status, void *user_data)
{
switch (status)
{
case STATUS_UART_RX_IDLE:
case STATUS_UART_TX_IDLE:
*(bool *)user_data = true;
break;
default:
break;
}
}
/**************************************************************************
* @name : test_uart_none_blocking
* @brief : UART TXRX非阻塞读写
* @param[in] :
* @return :
* @retval :
**************************************************************************/
static void test_uart_none_blocking(void)
{
uint32_t recv = 0;
volatile bool int_done = false;
delayMs(500);
test_uart_common_deinit(sg_uart_cur_num);
s_huart.baudrate = TEST_UART_BAUDRATE;
s_huart.data_width = HAL_UART_DATAWIDTH_8;
s_huart.parity = HAL_UART_PARITY_NO;
s_huart.stopbits = HAL_UART_STOPBIT_1;
s_huart.callback = test_uart_trans_cb;
s_huart.user_data = &int_done;
hal_uart_init(sg_uart_cur_num, &s_huart);
delayMs(500);
TEST_LOG(sg_uart_cur_num, "test uart%d start...\n", sg_uart_cur_num);
TEST_LOG(sg_uart_cur_num, "input and output 10 char:\n");
int_done = false;
memset(sg_uart_recv_buff, 0, recv + 1);
while (!hal_uart_recv_none_blocking(sg_uart_cur_num, (uint8_t *)sg_uart_recv_buff, 10))
{
//TEST_LOG(sg_uart_cur_num, "device busy!\n");
}
while (!int_done);
//test send
int_done = false;
strcpy(sg_uart_send_buff, sg_uart_recv_buff);
while (!hal_uart_send_none_blocking(sg_uart_cur_num, (uint8_t *)sg_uart_send_buff, strlen(sg_uart_send_buff)))
{
//TEST_LOG(sg_uart_cur_num, "device busy!\n");
}
while (!int_done);
TEST_LOG(sg_uart_cur_num, "\n");
sg_uart_case_done = true;
}
/**************************************************************************
* @name : test_uart_dma_transmit
* @brief : UART DMA读写测试
* @param[in] :
* @return :
* @retval :
**************************************************************************/
static void test_uart_dma_transmit(void)
{
uint32_t recv = 0;
char str = 0;
bool int_done = false;
while (1)
{
TEST_LOG(sg_uart_cur_num, "test uart%d start...\n", sg_uart_cur_num);
recv = test_uart_get_input_num(sg_uart_cur_num);
TEST_LOG(sg_uart_cur_num, "please input %d char once:\n", recv);
test_uart_common_deinit(sg_uart_cur_num);
s_huart.baudrate = TEST_UART_BAUDRATE;
s_huart.data_width = HAL_UART_DATAWIDTH_8;
s_huart.parity = HAL_UART_PARITY_NO;
s_huart.stopbits = HAL_UART_STOPBIT_1;
s_huart.callback = test_uart_trans_cb;
s_huart.user_data = &int_done;
hal_uart_init(sg_uart_cur_num, &s_huart);
int_done = false;
memset(sg_uart_recv_buff, 0, recv + 1);
while (!hal_uart_dma_recv(sg_uart_cur_num, (uint8_t *)sg_uart_recv_buff, recv))
{
//TEST_LOG(sg_uart_cur_num, "device busy!\n");
}
while (!int_done)
{
delayMs(500);
};
TEST_LOG(sg_uart_cur_num, "%s\n", sg_uart_recv_buff);
TEST_LOG(sg_uart_cur_num, "please input %d char twice:\n", recv);
int_done = false;
memset(sg_uart_recv_buff, 0, recv + 1);
while (!hal_uart_dma_recv(sg_uart_cur_num, (uint8_t *)sg_uart_recv_buff, recv))
{
//TEST_LOG(sg_uart_cur_num, "device busy!\n");
}
while (!int_done)
{
delayMs(100);
//TEST_LOG("recv dma not done!!!\n");
};
TEST_LOG(sg_uart_cur_num, "%s\n", sg_uart_recv_buff);
int_done = false;
strcpy(sg_uart_send_buff, "uart dma tx test comp once!\n");
while (!hal_uart_dma_send(sg_uart_cur_num, (uint8_t *)sg_uart_send_buff, strlen(sg_uart_send_buff)))
{
//TEST_LOG(sg_uart_cur_num, "device busy!\n");
}
while (!int_done);
int_done = false;
strcpy(sg_uart_send_buff, "uart dma tx test comp twice!\n");
while (!hal_uart_dma_send(sg_uart_cur_num, (uint8_t *)sg_uart_send_buff, strlen(sg_uart_send_buff)))
{
//TEST_LOG(sg_uart_cur_num, "device busy!\n");
}
while (!int_done);
if (sg_uart_cur_num == HAL_UART_0)
{
hal_uart_dma_path_close(HAL_UART0_DMA_PATH_TX);
hal_uart_dma_path_close(HAL_UART0_DMA_PATH_RX);
//TEST_LOG(sg_uart_cur_num, "close uart0 dma channel\n");
}
else
{
hal_uart_dma_path_close(HAL_UART1_DMA_PATH_TX);
hal_uart_dma_path_close(HAL_UART1_DMA_PATH_RX);
//TEST_LOG(sg_uart_cur_num, "close uart1 dma channel\n");
}
delayMs(500);
/* 用普通方式初始化uart */
test_uart_common_deinit(sg_uart_cur_num);
test_uart_common_init(sg_uart_cur_num);
TEST_LOG(sg_uart_cur_num, "0:continue\n");
TEST_LOG(sg_uart_cur_num, "1:exit\n");
TEST_LOG(sg_uart_cur_num, "Enter:");
while (1)
{
str = test_uart_get_input_str(sg_uart_cur_num);
if ('0' == str)
{
TEST_LOG(sg_uart_cur_num, "%c\n", str);
break;
}
else if ('1' == str)
{
TEST_LOG(sg_uart_cur_num, "%c\n", str);
sg_uart_case_done = true;
return;
}
}
}
}
static const unit_test_entry_t sg_uart_unit_test_table[] =
{
{"blocking case ...", test_uart_blocking},
{"none blocking case ...", test_uart_none_blocking},
{"dma trans case ...", test_uart_dma_transmit},
{"end", NULL},
};
#if UART_TEST_AUTO
/**
* @brief uart测试用例切换
* @param
* @retval
*/
static void test_uart_auto_case(void)
{
for (sg_uart_case = UART_CASE_BLOCKING; sg_uart_case < UART_CASE_MAX; sg_uart_case++)
{
TEST_LOG(sg_uart_cur_num, "%s\n", sg_uart_unit_test_table[sg_uart_case].case_name);
sg_uart_case_done = false;
/*配置并启动定时器*/
sg_uart_unit_test_table[sg_uart_case].case_func();
/*等待超时中断*/
while (!sg_uart_case_done);
TEST_LOG(sg_uart_cur_num, "test case pass \n");
TEST_LOG(sg_uart_cur_num, "\n");
}
}
#else
/**
* @brief uart测试用例切换
* @param
* @retval
*/
static void test_uart_unit_case(uint8_t case_num)
{
TEST_LOG(sg_uart_cur_num, "%s\n", sg_uart_unit_test_table[case_num].case_name);
sg_uart_case_done = false;
/*配置并启动定时器*/
sg_uart_unit_test_table[case_num].case_func();
/*等待超时中断*/
while (!sg_uart_case_done);
TEST_LOG(sg_uart_cur_num, "test case pass!!\n");
}
#endif
/**************************************************************************
* @name : demo_hal_uart_case
* @brief :
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void demo_hal_uart_case(void)
{
test_uart_common_init(sg_uart_cur_num);
test_uart_mode_init();
while (1)
{
test_uart_set_uart_mode();
#if UART_TEST_AUTO
test_uart_auto_case();
#else
test_uart_unit_case(sg_uart_case);
#endif
if (!test_uart_sel_continue())
{
break;
}
}
TEST_LOG(sg_uart_cur_num, "uart test done!\n");
}
#endif

View File

@ -0,0 +1,36 @@
/*******************************************************************************
* Copyright (C) 2020-2023, tau Systems (R),All Rights Reserved.
*
* File: demo_hal_uart.h
* Description: hal uart测试用例头文件
* Version: V0.1
* Date 2023-07-09
* Author: kc
*******************************************************************************/
#ifndef __DEMO_HAL_UART_H__
#define __DEMO_HAL_UART_H__
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "test_cfg_global.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
*******************************************************************************/
void demo_hal_uart_case(void);
#endif /* __DEMO_HAL_UART_H__ */

View File

@ -0,0 +1,135 @@
/*******************************************************************************
*
*
* File: demo_hal_wdg.c
* Description watch dog demo源文件
* Version V0.1
* Date 2023-07-27
* Author zzf
*******************************************************************************/
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "hal_wdg.h"
#include "hal_gpio.h"
#include "tau_delay.h"
#include "tau_log.h"
/*******************************************************************************
* 2.Global constant and macro definitions using #define
*******************************************************************************/
#ifdef LOG_TAG
#undef LOG_TAG
#endif
#define LOG_TAG "wdg-log"
#define WDG_CASE_RST 0 //复位模式
#define WDG_CASE_INTR 1 //中断模式
/*******************************************************************************
* 3.Global structures, unions and enumerations using typedef
*******************************************************************************/
/*******************************************************************************
* 4.Global variable extern declarations
*******************************************************************************/
#if WDG_CASE_INTR
static io_pad_e sg_wdg_io_pad = IO_PAD_GPIO1;
static gpio_level_e sg_wdg_io_lvl = IO_LVL_LOW;
/* 循环喂狗 */
static uint8_t sg_feed_cnt = 0;
#endif
/*******************************************************************************
* 5.Global function prototypes
*******************************************************************************/
#if WDG_CASE_RST
/**
* @brief
* @param
* @retval
*/
static void demo_wdg_case_rst_mode(void)
{
TAU_LOGI("reset start...\n");
/* WDG初始化复位模式 */
hal_wdg_init();
/* 启动 */
hal_wdg_start(WDG_MODE_RESET, 5000);
}
#endif
#if WDG_CASE_INTR
/**
* @brief
* @param
* @retval
*/
static void demo_wdg_callback(void *data)
{
/* 翻转GPIO */
sg_wdg_io_lvl = (sg_wdg_io_lvl ? IO_LVL_LOW : IO_LVL_HIGH);
hal_gpio_set_output_data(sg_wdg_io_pad, sg_wdg_io_lvl);
sg_feed_cnt++;
if (sg_feed_cnt > 10)
{
hal_wdg_stop();
}
}
/**
* @brief
* @param
* @retval
*/
static void demo_wdg_case_int_mode(void)
{
TAU_LOGI("int start...\n");
/* WDG初始化 */
hal_wdg_init();
/* 设置循环超时 */
hal_wdg_set_repeat(true);
/* 设置回调函数 */
hal_wdg_register_callback(demo_wdg_callback, NULL);
/*初始化GPIO低状态*/
hal_gpio_init_output(sg_wdg_io_pad, sg_wdg_io_lvl);
/* 设置中断模式 */
hal_wdg_start(WDG_MODE_INTERRUPT, 200);
while (sg_feed_cnt < 6)
{
sg_feed_cnt++;
hal_wdg_kick_dog();
delayMs(150);
TAU_LOGI("feed [%d]th done\n", sg_feed_cnt);
}
}
#endif
/**
* @brief demo测试接口函数
* @param None
* @retval None
*/
void demo_wdg_case(void)
{
TAU_LOGI("demo_wdg_case\r\n");
#if WDG_CASE_RST
demo_wdg_case_rst_mode();
#elif WDG_CASE_INTR
demo_wdg_case_int_mode();
#endif
}

View File

@ -0,0 +1,40 @@
/*******************************************************************************
*
*
* File: demo_hal_wdg.h
* Description: watch dog demo头文件
* Version: V0.1
* Date: 2023-07-27
* Author: zzf
*******************************************************************************/
#ifndef __DEMO_WDG_H__
#define __DEMO_WDG_H__
/*******************************************************************************
* 1.Included files
*******************************************************************************/
/*******************************************************************************
* 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 demo测试接口函数
* @param None
* @retval None
*/
void demo_wdg_case(void);
#endif /* __DEMO_WDG_H__ */

View File

@ -0,0 +1,69 @@
/*******************************************************************************
*
* File: ap_demo_main.c
* Description: ap demo main file
* Version: V0.1
* Date: 2022-04-15
* Author: Jaya
*******************************************************************************/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "module_demo_main.h"
void module_demo_main()
{
#if _MODULE_DEMO_DSI_TX_EN
demo_dsi_tx_case();
#endif
#if _MODULE_DEMO_DSI_RX_EN
demo_hal_dsi_rx_case();
#endif
#if _MODULE_DEMO_TIMER_EN
demo_timer_case();
#endif
#if _MODULE_DEMO_WDG_EN
demo_wdg_case();
#endif
#if _MODULE_DEMO_GPIO_EN
demo_gpio_case();
#endif
#if _MODULE_DEMO_SWIRE_EN
demo_hal_swire();
#endif
#if _MODULE_DEMO_SPI_EN
demo_hal_spi();
#endif
#if _MODULE_DEMO_I2C_EN
demo_hal_i2c();
#endif
#if _MODULE_DEMO_FLASH_EN
demo_hal_flash();
#endif
#if _MODULE_DEMO_PWM_EN
demo_hal_pwm();
#endif
#if _MODULE_DEMO_PWR_EN
demo_hal_pwr();
#endif
#if _MODULE_DEMO_UART_EN
demo_hal_uart_case();
#endif
#if _MODULE_DEMO_CRC_EN
demo_hal_crc_case();
#endif
}

View File

@ -0,0 +1,68 @@
/*******************************************************************************
*
* File: module_demo_main.h
* Description: module demo main file
* Version: V0.1
* Date: 2023-07-27
* Author: Jaya
*******************************************************************************/
#ifndef __MODULE_DEMO_MAIN_H__
#define __MODULE_DEMO_MAIN_H__
#include "test_cfg_global.h"
#if _MODULE_DEMO_DSI_TX_EN
#include "demo_hal_dsi_tx.h"
#endif
#if _MODULE_DEMO_DSI_RX_EN
#include "demo_hal_dsi_rx.h"
#endif
#if _MODULE_DEMO_TIMER_EN
#include "demo_hal_timer.h"
#endif
#if _MODULE_DEMO_WDG_EN
#include "demo_hal_wdg.h"
#endif
#if _MODULE_DEMO_GPIO_EN
#include "demo_hal_gpio.h"
#endif
#if _MODULE_DEMO_SWIRE_EN
#include "demo_hal_swire.h"
#endif
#if _MODULE_DEMO_SPI_EN
#include "demo_hal_spi.h"
#endif
#if _MODULE_DEMO_I2C_EN
#include "demo_hal_i2c.h"
#endif
#if _MODULE_DEMO_FLASH_EN
#include "demo_hal_flash.h"
#endif
#if _MODULE_DEMO_PWM_EN
#include "demo_hal_pwm.h"
#endif
#if _MODULE_DEMO_PWR_EN
#include "demo_hal_pwr.h"
#endif
#if _MODULE_DEMO_UART_EN
#include "demo_hal_uart.h"
#endif
#if _MODULE_DEMO_CRC_EN
#include "demo_hal_crc.h"
#endif
void module_demo_main(void);
#endif /* __MODULE_DEMO_MAIN_H__ */

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

@ -0,0 +1,55 @@
/*******************************************************************************
*
* 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 _MODULE_DEMO_ENABLE 0
#define _MODULE_DEMO_TIMER_EN 0
#define _MODULE_DEMO_DSI_TX_EN 0
#define _MODULE_DEMO_DSI_RX_EN 0
#define _MODULE_DEMO_PWM_EN 0
#define _MODULE_DEMO_SWIRE_EN 0
#define _MODULE_DEMO_WDG_EN 0
#define _MODULE_DEMO_GPIO_EN 0
#define _MODULE_DEMO_I2C_EN 0
#define _MODULE_DEMO_SPI_EN 0
#define _MODULE_DEMO_PWR_EN 0
/* ap demo 宏定义 */
#define _DEMO_S8_EN 1
#define _DEMO_S8P_EN 0
#define _DEMO_S9_EN 0
#define _DEMO_MI_12_LITE_EN 0
#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 "s9_demo.h"
#include "app_tp_for_custom_s9.h"
#endif
#if _DEMO_MI_12_LITE_EN
#include "Mi12Lite.h"
#endif
#endif

View File

@ -0,0 +1,678 @@
/*******************************************************************************
*
*
* File: app_tp_transfer.c
* Description touch I2C/SPI
* Version V0.1
* Date 2021-10-14
* Author zhanghz
*******************************************************************************/
#include "test_cfg_global.h"
#include "app_tp_transfer.h"
#include "hal_i2c_master.h"
#include "hal_i2c_slave.h"
#include "hal_spi_master.h"
#include "hal_spi_slave.h"
#include "tau_log.h"
#include "tau_delay.h"
#include "stdio.h"
#include "hal_system.h"
#ifdef BUFFER_SIZE_MAX
static uint8_t s_screen_read_buffer[BUFFER_SIZE_MAX];
static uint8_t s_phone_read_buffer[BUFFER_SIZE_MAX];
static const uint8_t *s_slave_txbuffer = NULL;
static size_t s_slave_txbuffer_size = 0;
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; //记录是否已经开始通信
static bool s_screen_init_complate = true; //屏幕TP开机初始化完成标志,初始值为true确保app_tp_transfer_screen_start之后才配置开机初始化
static uint8_t s_screen_const_transfer_count = 0xff; //记录当前通信到哪一步,初始值必须大于 screen_reg_start_data_size
static void app_tp_transfer_phone(i2c_index_e index, size_t recieve_num);
static void app_tp_reset_callback(void *data);
#if PHONE_SLAVE_TRANSFER_I2C //消除warning
static void app_tp_i2cs_callback(i2c_index_e index, hal_i2cs_event_e 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_spis_packet_info_t *packet_info);
#endif
/**************************************************************************
* @name : app_tp_screen_int_callback
* @brief : screen
* @param[in] :
* @return :
* @retval :
**************************************************************************/
static void app_tp_screen_int_callback(void *data)
{
s_screen_int_flag = true;
}
/**************************************************************************
* @name : app_tp_screen_int_lvl_low
* @brief : screen IO
* @param[in] :
* @return : trueIO
* @retval :
**************************************************************************/
static bool app_tp_screen_int_lvl_low(void)
{
#if SCREEN_INT_LOW_DEFAULT
return hal_gpio_get_input_data(g_screen_input_int_pad); //INT 为高电平时,说明还有报点数据没读出
#else
return !hal_gpio_get_input_data(g_screen_input_int_pad); //INT 为低电平时,说明还有报点数据没读出
#endif
}
/**************************************************************************
* @name : app_tp_screen_int_init
* @brief : screen IO
* @param[in] :
* @return :
* @retval :
**************************************************************************/
static void app_tp_screen_int_init(void)
{
hal_gpio_ctrl_eint(g_screen_input_int_pad, false); // 1.关闭中断
#if SCREEN_INT_LOW_DEFAULT
hal_gpio_set_pull_state(g_screen_input_int_pad, false, true); // 2.配置下拉
hal_gpio_init_eint(g_screen_input_int_pad, DETECT_RISING_EDGE); // 3.中断初始化,INT 上升沿触发中断
#else
hal_gpio_set_pull_state(g_screen_input_int_pad, true, false); // 2.配置上拉
hal_gpio_init_eint(g_screen_input_int_pad, DETECT_FALLING_EDGE); // 3.中断初始化,INT 下降沿触发中断
#endif
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, true); // 5.使能中断
}
/**************************************************************************
* @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, false);
/*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, true);
}
/**************************************************************************
* @name : app_tp_screen_init
* @brief : screen IO
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void app_tp_screen_init(void)
{
hal_gpio_init_output(g_screen_input_rst_pad, IO_LVL_HIGH);
delayUs(200);
hal_gpio_set_output_data(g_screen_input_rst_pad, IO_LVL_LOW);
delayUs(200);
hal_gpio_set_output_data(g_screen_input_rst_pad, IO_LVL_HIGH);
delayUs(400);
}
#if SCREEN_MASTER_TRANSFER_I2C
/**************************************************************************
* @name : screen_i2cm_io_init
* @brief : screen通信的i2cm IO初始化
* @param[in] :
* @return :
* @retval :
**************************************************************************/
static void screen_i2cm_io_init(void)
{
io_pad_attr_t attrs[] =
{
{IO_PAD_TD_SPIM_CLK, PIN5_MODE_I2C1_SCL, IO_IOE_NONE, IO_LVL_HIGH},
{IO_PAD_TD_SPIM_CSN, PIN6_MODE_I2C1_SDA, IO_IOE_NONE, IO_LVL_HIGH}
};
uint8_t size = sizeof(attrs) / sizeof(io_pad_attr_t);
hal_gpio_config_pad(attrs, size);
}
#endif
#if PHONE_SLAVE_TRANSFER_I2C
/**************************************************************************
* @name : phone_i2cs_io_init
* @brief : phonet通信的i2cs IO初始化
* @param[in] :
* @return :
* @retval :
**************************************************************************/
static void phone_i2cs_io_init(void)
{
io_pad_attr_t attrs[] =
{
{IO_PAD_AP_SPIS_CLK, PIN32_MODE_I2C02_SCL, IO_IOE_NONE, IO_LVL_HIGH},
{IO_PAD_AP_SPIS_CSN, PIN31_MODE_I2C02_SDA, IO_IOE_NONE, IO_LVL_HIGH}
};
uint8_t size = sizeof(attrs) / sizeof(io_pad_attr_t);
hal_gpio_config_pad(attrs, size);
}
#endif
#if SCREEN_MASTER_TRANSFER_SPI
/**************************************************************************
* @name : screen_spim_io_init
* @brief : screen通信的spim IO初始化
* @param[in] :
* @return :
* @retval :
**************************************************************************/
static void screen_spim_io_init(void)
{
io_pad_attr_t attrs[] =
{
{IO_PAD_TD_SPIM_CLK, PIN5_MODE_SPIM_SCLK, IO_IOE_NONE, IO_LVL_HIGH},
{IO_PAD_TD_SPIM_CSN, PIN6_MODE_SPIM_CSN, IO_IOE_NONE, IO_LVL_HIGH},
{IO_PAD_TD_SPIM_MISO, PIN7_MODE_SPIM_MISO, IO_IOE_NONE, IO_LVL_HIGH},
{IO_PAD_TD_SPIM_MOSI, PIN4_MODE_SPIM_MOSI, IO_IOE_NONE, IO_LVL_HIGH}
};
uint8_t size = sizeof(attrs) / sizeof(io_pad_attr_t);
hal_gpio_config_pad(attrs, size);
}
#endif
#if PHONE_SLAVE_TRANSFER_SPI
/**************************************************************************
* @name : screen_spis_io_init
* @brief : phone通信的spis IO初始化
* @param[in] :
* @return :
* @retval :
**************************************************************************/
static void phone_spis_io_init(void)
{
io_pad_attr_t attrs[] =
{
{IO_PAD_AP_SPIS_CLK, PIN32_MODE_SPIS_SCLK, IO_IOE_NONE, IO_LVL_HIGH},
{IO_PAD_AP_SPIS_CSN, PIN31_MODE_SPIS_CSN, IO_IOE_NONE, IO_LVL_HIGH},
{IO_PAD_AP_SPIS_MISO, PIN30_MODE_SPIS_MISO, IO_IOE_NONE, IO_LVL_HIGH},
{IO_PAD_AP_SPIS_MOSI, PIN33_MODE_SPIS_MOSI, IO_IOE_NONE, IO_LVL_HIGH}
};
uint8_t size = sizeof(attrs) / sizeof(io_pad_attr_t);
hal_gpio_config_pad(attrs, size);
}
#endif
/**************************************************************************
* @name : app_tp_init
* @brief :
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void app_tp_init(void)
{
#if _DEMO_IPHONE_X_EN
app_tp_phone_data_init();
#endif
app_tp_phone_reset_init(); //初始化手机复位的IO口
app_tp_screen_int_init(); //配置screen中断输入引脚
hal_gpio_init_output(g_phone_output_int_pad, IO_LVL_HIGH); //配置phone报点输出中断IO口
#if SCREEN_MASTER_TRANSFER_I2C
screen_i2cm_io_init();
hal_i2cm_init(SCREEN_I2CM_INDEX, SCREEN_I2C_ADDRESS, SCREEN_I2C_ADDR_BITS, I2C_MASTER_SPEED);
#elif SCREEN_MASTER_TRANSFER_SPI
screen_spim_io_init();
hal_spim_init(SPI_MASTER_SPEED, SCREEN_SPI_CPHA, SCREEN_SPI_CPOL);
#endif
#if PHONE_SLAVE_TRANSFER_I2C
phone_i2cs_io_init();
hal_i2cs_init(PHONE_I2CS_INDEX, CHIP_I2C_ADDRESS, CHIP_I2C_ADDR_BITS);
hal_i2cs_register_callback(PHONE_I2CS_INDEX, app_tp_i2cs_callback);
hal_i2cs_update_rx_buffer(PHONE_I2CS_INDEX, s_phone_read_buffer, BUFFER_SIZE_MAX);
hal_i2cs_update_tx_buffer(PHONE_I2CS_INDEX, phone_reg_const_data[0].write_back, phone_reg_const_data[0].write_back_size, false);
hal_i2cs_start(PHONE_I2CS_INDEX);
#elif PHONE_SLAVE_TRANSFER_SPI
phone_spis_io_init();
hal_spis_init(PHONE_SPI_CPHA, PHONE_SPI_CPOL); // 初始化spis
hal_spis_update_rx_buffer(s_phone_read_buffer, BUFFER_SIZE_MAX); // 设置auto rx buffer
hal_spis_update_tx_buffer(phone_reg_const_data[0].write_back, phone_reg_const_data[0].write_back_size, false); // 配置TX BUFFER
hal_spis_register_callback(app_tp_spis_callback, SPIS_EVENT_RCV_FULL | SPIS_EVENT_RCV_CS_RISE, 0); // 注册回调
hal_spis_start(); // 启动tx自动发送
#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_i2cm_get_transfer_complete(SCREEN_I2CM_INDEX);
#elif SCREEN_MASTER_TRANSFER_SPI
return hal_spim_get_transfer_complete();
#else
return true;
#endif
}
#if 0
/**************************************************************************
* @name : app_tp_s_transfer_complate
* @brief :
* @param[in] :
* @return :true:
* @retval :
**************************************************************************/
bool app_tp_s_transfer_complate(void)
{
#if PHONE_SLAVE_TRANSFER_I2C
return hal_i2c_s_write_complate() && hal_i2c_s_read_complate();
#elif PHONE_SLAVE_TRANSFER_SPI
return !hal_spis_busy();
#else
return true;
#endif
}
#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_i2cm_dma_write(SCREEN_I2CM_INDEX, txbuffer, buffer_size);
#elif SCREEN_MASTER_TRANSFER_SPI
hal_spim_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_i2cm_dma_read(SCREEN_I2CM_INDEX, address, cmd_size, data_buffer, data_size);
#elif SCREEN_MASTER_TRANSFER_SPI
hal_spim_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(i2c_index_e index, const uint8_t *txbuffer, size_t buffer_size)
{
#if PHONE_SLAVE_TRANSFER_I2C
hal_i2cs_update_tx_buffer(index, txbuffer, buffer_size, true);
#elif PHONE_SLAVE_TRANSFER_SPI
hal_spis_update_rx_buffer(s_phone_read_buffer, BUFFER_SIZE_MAX);
hal_spis_update_tx_buffer(txbuffer, buffer_size, true);
app_tp_write_other_operations(txbuffer, buffer_size);
#endif
}
/**************************************************************************
* @name : app_tp_s_read
* @brief : rxbuffer
* @param[in] :rxBuffer: buffer
* @param[in] :data_size: buffer
* @return :
* @retval :
**************************************************************************/
void app_tp_s_read(i2c_index_e index, void *rxBuffer, size_t data_size)
{
#if PHONE_SLAVE_TRANSFER_I2C
hal_i2cs_update_rx_buffer(index, rxBuffer, data_size);
#endif
}
/**************************************************************************
* @name : app_tp_spis_callback
* @brief : SPI slave
* @param[in] :
* @return :
* @retval :
**************************************************************************/
#if PHONE_SLAVE_TRANSFER_I2C //消除warning
static void app_tp_i2cs_callback(i2c_index_e index, hal_i2cs_event_e int_status, size_t recieve_num)
{
static bool i2cs_transfer = true; //确保一次通信只解析一次
if (i2cs_transfer)
{
i2cs_transfer = false;
app_tp_transfer_phone(index, recieve_num);
}
if (int_status == I2CS_EVENT_READ)
{
app_tp_s_write(index, s_slave_txbuffer, s_slave_txbuffer_size);
}
else if (int_status == I2CS_EVENT_STOP)
{
i2cs_transfer = true;
}
}
#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_spis_packet_info_t *packet_info)
{
static bool spis_transfer = true; //确保一次通信只解析一次
// 1. 接收完数据, 完成一次解析??
if (spis_transfer)
{
app_tp_transfer_phone(0, packet_info->packet_size);
spis_transfer = false;
}
// 2.一帧通信结束, 需要重新设置 txbuffer
if (event == SPIS_EVENT_RCV_CS_RISE)
{
spis_transfer = true;
if (s_slave_txbuffer_size)
{
app_tp_s_write(0, s_slave_txbuffer, s_slave_txbuffer_size);
}
}
}
#endif
/**************************************************************************
* @name : app_tp_reset_callback
* @brief : IO跳变复位的中断处理函数
* @param[in] :
* @return :
* @retval :
**************************************************************************/
static void app_tp_reset_callback(void *data)
{
s_phone_reset_flag = true;
//app_tp_s_write(phone_reg_const_data[0].write_back, phone_reg_const_data[0].write_back_size); ///////S8 s8p
#if PHONE_SLAVE_TRANSFER_SPI
hal_gpio_set_output_data(IO_PAD_AP_INT, IO_LVL_LOW);
#endif
//TAU_LOGD("app_tp_reset_callback\n");
}
/**************************************************************************
* @name : app_tp_transfer_screen_const
* @brief : flow读写screen screen
* @param[in] :
* @return :
* @retval :
**************************************************************************/
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_spim_flush();
s_spim_write = false;
}
/**** 2. 发送或读取从机数据 ****/
if (screen_const_transfer_buffer_ready)
{
screen_const_transfer_buffer_ready = false;
if (screen_reg_start_data[s_screen_const_transfer_count].buffer)
{
if (!screen_reg_start_data[s_screen_const_transfer_count].read_flag) //当前通信不需要读回,直接写
{
app_tp_m_write(screen_reg_start_data[s_screen_const_transfer_count].buffer, screen_reg_start_data[s_screen_const_transfer_count].txbuffer_size);
}
else //当前通信需要读回,先写再读
{
app_tp_m_read(screen_reg_start_data[s_screen_const_transfer_count].buffer, screen_reg_start_data[s_screen_const_transfer_count].txbuffer_size, \
s_screen_read_buffer, screen_reg_start_data[s_screen_const_transfer_count].rxbuffer_size);
}
}
}
/**** 3. 解析本次通信数据并准备下一次通信的buffer ****/
else
{
screen_const_transfer_buffer_ready = true;
s_screen_const_transfer_count = app_tp_screen_analysis_const(s_screen_const_transfer_count, s_screen_read_buffer, \
screen_reg_start_data[s_screen_const_transfer_count].rxbuffer_size);
if (s_screen_const_transfer_count >= screen_reg_start_data_size)
{
s_screen_init_complate = true;
}
}
}
}
/**************************************************************************
* @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();
app_tp_transfer_screen_const();
}
/**************************************************************************
* @name : app_tp_transfer_screen_int
* @brief : screen中断后flow读写screen !
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void app_tp_transfer_screen_int(void)
{
bool screen_gpio_int = false;
static uint8_t screen_int_transfer_count = 0; //记录当前通信到哪一步
static bool screen_int_transfer_buffer_ready = true; //发送 buffer 是否已准备好
volatile bool init_gpio = false;
static bool Release_all_fingers = false;
static volatile uint32_t current_time = 0;
static volatile uint32_t back_time = 0;
if (!s_screen_init_complate) //TP 初始化还未完成,则先进行初始化操作
{
app_tp_transfer_screen_const();
return;
}
/**** 1. 判断 screen 是否发出中断信号 ****/
// s_screen_int_flag: 中断信号标志位
// app_tp_screen_int_lvl_low : SPI 长时间通信时偶尔会出现cs拉高导致通信异常卡死该标志位用于解决卡死的问题
init_gpio = app_tp_screen_int_lvl_low();
screen_gpio_int = (s_screen_int_flag || init_gpio);
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_spim_flush();
s_spim_write = false;
}
/**** 2. 发送或读取从机数据 ****/
if (screen_int_transfer_buffer_ready)
{
screen_int_transfer_buffer_ready = false;
s_screen_int_transfer_status = true;
if (!screen_reg_int_data[screen_int_transfer_count].read_flag) //当前通信不需要读回,直接写
{
app_tp_m_write(screen_reg_int_data[screen_int_transfer_count].buffer, screen_reg_int_data[screen_int_transfer_count].txbuffer_size);
}
else //当前通信需要读回,先写再读
{
app_tp_m_read(screen_reg_int_data[screen_int_transfer_count].buffer, screen_reg_int_data[screen_int_transfer_count].txbuffer_size, \
s_screen_read_buffer, screen_reg_int_data[screen_int_transfer_count].rxbuffer_size);
}
}
/**** 3. 解析本次通信数据并准备下一次通信的buffer ****/
else
{
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[screen_int_transfer_count].rxbuffer_size);
Release_all_fingers = true;
back_time = hal_system_get_tick();
if (screen_int_transfer_count >= screen_reg_int_data_size) //解析需要等最后一次通信结束,最后一次数据解析后,停止通信
{
screen_int_transfer_count = 0;
s_screen_int_transfer_status = false;
return;
}
}
}
#if _DEMO_S8_EN
else
{
current_time = hal_system_get_tick();
if (((current_time - back_time) > 800) && Release_all_fingers)
{
app_tp_write_other_operations(s_screen_read_buffer, 8);
Release_all_fingers = false;
}
}
#endif
}
/**************************************************************************
* @name : app_tp_transfer_phone
* @brief :
* @param[in] : recieve_num
* @return :
* @retval :
**************************************************************************/
static void app_tp_transfer_phone(i2c_index_e index, size_t recieve_num)
{
/* 数据解析判断是否需要答复以及答复的buffer指针 */
if (recieve_num > 0)
{
app_tp_phone_analysis_data(s_phone_read_buffer, recieve_num, &s_slave_txbuffer, &s_slave_txbuffer_size);
}
app_tp_s_read(index, s_phone_read_buffer, BUFFER_SIZE_MAX);
}
/**************************************************************************
* @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(i2c_index_e index, const uint8_t *txbuffer, size_t buffer_size)
{
}
#endif

View File

@ -0,0 +1,189 @@
/*******************************************************************************
*
*
* 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"
#include "hal_i2c_slave.h"
#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 enum
{
data_num_00 = 0,
data_num_01,
data_num_02,
data_num_03,
data_num_04,
data_num_05,
data_num_06,
data_num_07,
data_num_08,
data_num_09,
data_num_10,
data_num_11,
data_num_12,
data_num_13,
data_num_14,
data_num_15,
data_num_16,
data_num_17,
data_num_18,
data_num_19,
data_num_20,
data_num_21,
data_num_22,
data_num_23,
data_num_24,
data_num_25,
data_num_26,
data_num_27,
data_num_28,
data_num_29,
data_num_30,
data_num_31,
data_num_32,
data_num_33,
data_num_34,
data_num_35,
data_num_36,
data_num_37,
data_num_38,
data_num_39,
data_num_40,
data_num_41,
data_num_42,
data_num_43,
data_num_44,
data_num_45,
data_num_46,
data_num_47,
data_num_48,
data_num_49
} en_data_num;
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
{
en_data_num data_num; //记录当前为第几个结构体数组元素
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; //要发送的数据长度
const uint8_t *reg_data; //接收buffer
const uint8_t *write_back; //发送bufer
} st_reg_data;
/**************************************************************************
* @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(i2c_index_e index, 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

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

@ -0,0 +1,31 @@
/*******************************************************************************
*
*
* File: board.c
* Description
* Version V0.1
* Date 2023-07-23
* Author lzy
*******************************************************************************/
#include "board.h"
#include "hal_system.h"
#include "hal_gpio.h"
#include "ArmCM0.h"
#include "tau_log.h"
/**
* @brief ,,log输出
* @param none
* @retval none
*/
void board_Init(void)
{
/* system init ,配置MCU时钟 */
hal_system_init(HAL_SYSCLK_80M);
/* 使用SWD口作为Debug Log输出,可配置成Uart方式 */
tau_log_init(115200, LOG_PORT_SWD);
/* systick init,根据需要配置 */
hal_system_enable_systick(1);
}

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

@ -0,0 +1,21 @@
/*******************************************************************************
*
*
* File: board.h
* Description: baord
* Version: V0.1
* Date: 2020-01-08
* Author: lzy
*******************************************************************************/
#ifndef __BOARD_H__
#define __BOARD_H__
/**
* @brief ,,log输出
* @param none
* @retval none
*/
void board_Init(void);
#endif

View File

@ -0,0 +1,226 @@
;/**************************************************************************//**
; * @file startup_ARMCM0.s
; * @brief CMSIS Core Device Startup File for
; * ARMCM0 Device
; * @version V5.4.0
; * @date 12. December 2018
; ******************************************************************************/
;/*
; * Copyright (c) 2009-2018 Arm Limited. All rights reserved.
; *
; * SPDX-License-Identifier: Apache-2.0
; *
; * Licensed under the Apache License, Version 2.0 (the License); you may
; * not use this file except in compliance with the License.
; * You may obtain a copy of the License at
; *
; * www.apache.org/licenses/LICENSE-2.0
; *
; * Unless required by applicable law or agreed to in writing, software
; * distributed under the License is distributed on an AS IS BASIS, WITHOUT
; * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; * See the License for the specific language governing permissions and
; * limitations under the License.
; */
;//-------- <<< Use Configuration Wizard in Context Menu >>> ------------------
;<h> Stack Configuration
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
;</h>
Stack_Size EQU 0x00001000
AREA STACK, NOINIT, READWRITE, ALIGN=3
__stack_limit
Stack_Mem SPACE Stack_Size
__initial_sp
;<h> Heap Configuration
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
;</h>
Heap_Size EQU 0x00000C00
IF Heap_Size != 0 ; Heap is provided
AREA HEAP, NOINIT, READWRITE, ALIGN=3
__heap_base
Heap_Mem SPACE Heap_Size
__heap_limit
ENDIF
PRESERVE8
THUMB
; Vector Table Mapped to Address 0 at Reset
AREA RESET, DATA, READONLY
EXPORT __Vectors
EXPORT __Vectors_End
EXPORT __Vectors_Size
__Vectors DCD __initial_sp ; Top of Stack
DCD Reset_Handler ; Reset Handler
DCD NMI_Handler ; -14 NMI Handler
DCD HardFault_Handler ; -13 Hard Fault Handler
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD SVC_Handler ; -5 SVCall Handler
DCD 0 ; Reserved
DCD 0 ; Reserved
DCD PendSV_Handler ; -2 PendSV Handler
DCD SysTick_Handler ; -1 SysTick Handler
; Interrupts
DCD VIDC_IRQn_Handler ; 0 Interrupt 0
DCD LCDC_IRQn_Handler ; 1 Interrupt 1
DCD MIPI_RX_IRQn_Handler ; 2 Interrupt 2
DCD MIPI_TX_IRQn_Handler ; 3 Interrupt 3
DCD MEMC_IRQn_Handler ; 4 Interrupt 4
DCD VPRE_IRQn_Handler ; 5 Interrupt 5
DCD FLSCTRL_IRQn_Handler ; 6 Interrupt 6
DCD DMA_IRQn_Handler ; 7 Interrupt 7
DCD TIMER0_IRQn_Handler ; 8 Interrupt 8
DCD TIMER1_IRQn_Handler ; 9 Interrupt 9
DCD TIMER2_IRQn_Handler ; 10 Interrupt 10
DCD TIMER3_IRQn_Handler ; 11 Interrupt 11
DCD WDG_IRQn_Handler ; 12 Interrupt 12
DCD UART_IRQn_Handler ; 13 Interrupt 13
DCD I2C0_IRQn_Handler ; 14 Interrupt 14
DCD I2C1_IRQn_Handler ; 15 Interrupt 15
DCD SPIS_IRQn_Handler ; 16 Interrupt 16
DCD SPIM_IRQn_Handler ; 17 Interrupt 17
DCD VPRE1_IRQn_Handler ; 18 Interrupt 18
DCD I2C2_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
BNE _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 VPRE1_IRQn_Handler
Set_Default_Handler I2C2_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

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

@ -0,0 +1,222 @@
/*******************************************************************************
*
*
* 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 uint32_t status_t;
/* \brief 通用回调函数指针定义 */
typedef void (*fcb_type)(void *data);
typedef void (*uart_trans_cb)(status_t status, void *user_data);
typedef void (*flash_trans_cb)(status_t status, void *user_data);
#endif /* __TAU_COMMON_H */

72
src/common/tau_delay.c Normal file
View File

@ -0,0 +1,72 @@
/**
* File Name: tau_delay.c
*
*
*
* Author: cn
*
* Date: 2020/11/30
*
* Project: Taurus
*
* Description:
*
* HISTORY:
**/
#include "tau_delay.h"
#include "ArmCM0.h"
#include "stdint.h"
#include "drv_common.h"
/*******************************************************************************
* precompile configuration start #pragma
*******************************************************************************/
#pragma O0 /* 考虑延时函数的准确性其余文件的优化等级随工程调整时delay函数依然按-O0等级进行编译作用域为本文件不建议更改 */
/**
* @brief delay ms ,2%
* @param ms:delay时长
* @retval none
*/
__weak void delayMs(uint32_t ms)
{
#if !EDA_MODE
while (ms--)
{
delayUs(1000);
}
#endif
}
/**
* @brief delay us ,2%
* @param us:delay时长
* @retval none
*/
__weak void delayUs(uint32_t us) /*FIXME 需校准*/
{
#if !EDA_MODE
int i = 0;
if (us < 2)
{
return;
}
while (us --)
{
#if CPU_CLK_100M
i = 10;
#elif FPGA_MODE
i = 2;
#else
i = 8;
#endif
while (i --)
{
;
}
}
#endif
}
/*******************************************************************************
* precompile configuration end #pragma O0
*******************************************************************************/

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

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

View File

@ -0,0 +1,229 @@
/*******************************************************************************
*
*
* 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,
STATUS_GROUP_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 UART状态枚举定义
*
*/
typedef enum
{
STATUS_UART_TX_BUSY = MAKE_STATUS(STATUS_GROUP_UART, 0), /*!< Transmitter is busy. */
STATUS_UART_RX_BUSY = MAKE_STATUS(STATUS_GROUP_UART, 1), /*!< Receiver is busy. */
STATUS_UART_TX_IDLE = MAKE_STATUS(STATUS_GROUP_UART, 2), /*!< USART transmitter is idle. */
STATUS_UART_RX_IDLE = MAKE_STATUS(STATUS_GROUP_UART, 3), /*!< USART receiver is idle. */
STATUS_UART_TX_ERR = MAKE_STATUS(STATUS_GROUP_UART, 7), /*!< Error happens on txFIFO. */
STATUS_UART_RX_ERR = MAKE_STATUS(STATUS_GROUP_UART, 9), /*!< Error happens on rxFIFO. */
STATUS_UART_RX_RING_BUFF_OVERRUN = MAKE_STATUS(STATUS_GROUP_UART, 8), /*!< Error happens on rx ring buffer */
STATUS_UART_NOISE_ERR = MAKE_STATUS(STATUS_GROUP_UART, 10), /*!< USART noise error. */
STATUS_UART_FRAMING_ERR = MAKE_STATUS(STATUS_GROUP_UART, 11), /*!< USART framing error. */
STATUS_UART_PARITY_ERR = MAKE_STATUS(STATUS_GROUP_UART, 12), /*!< USART parity error. */
STATUS_UART_BAUDRATE_NOT_SPT = MAKE_STATUS(STATUS_GROUP_UART, 13), /*!< Baudrate is not support in current clock source */
} uart_status_e;
/*!
* @brief timer状态
*/
typedef enum
{
STATUS_TIMER_IDLE = MAKE_STATUS(STATUS_GROUP_TIMER, 0), /*!< 空闲 */
STATUS_TIMER_RUNNING = MAKE_STATUS(STATUS_GROUP_TIMER, 1), /*!< 运行中 */
STATUS_TIMER_TIMEOUT = MAKE_STATUS(STATUS_GROUP_TIMER, 2), /*!< 超时 */
} timer_status_e;
/*!
* @brief system触发事件(/)
*/
typedef enum
{
DETECT_HIGH_LVL = 0,
DETECT_LOW_LVL,
DETECT_RISING_EDGE,
DETECT_FALLING_EDGE,
DETECT_DOUBLE_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 I2C Index
* @note
*/
typedef enum
{
I2C_INDEX_0,
I2C_INDEX_1,
I2C_INDEX_2,
I2C_INDEX_MAX
} i2c_index_e;
/*!
* @brief DMA channel type
* @note
*/
typedef enum
{
AHB_DMA_CH0,
AHB_DMA_CH1,
AHB_DMA_CH2,
AHB_DMA_CH3,
AHB_DMA_CH4,
AHB_DMA_CH5,
AHB_DMA_CH6,
AHB_DMA_CH7,
AHB_DMA_CH_NUM
} dma_channel_type_e;
/*! @brief Type used for all status and error return values. */
typedef enum
{
DISABLE = 0,
ENABLE = !DISABLE
} function_state_e;
/**
* @brief The reversal types of the bit order of the input/output data
*/
typedef enum
{
CRC_REV_NO_TRANSPOSE = 0, /*!< No transposition */
CRC_REV_ONLY_BITS_TRANSPOSE, /*!< Bits in bytes are transposed; bytes are not transposed */
CRC_REV_BOTH_TRANSPOSE, /*!< Both bits in bytes and bytes are transposed */
CRC_REV_ONLY_BYTES_TRANSPOSE, /*!< Only bytes are transposed; no bits in a byte are transposed */
} crc_reversal_type_e;
/**
* @brief Complement Read Of CRC Data Register
*/
typedef enum
{
CRC_FXOR_DISABLE = 0, /*!< No XOR on reading */
CRC_FXOR_ENABLE, /*!< Invert or complement the read value of the CRC Data register */
} crc_fxor_function_e;
/**
* @brief width of CRC protocol (polynomial)
*/
typedef enum
{
CRC_16_BIT_PROTOCOL = 0, /*!< 0: 16-bit CRC protocol */
CRC_32_BIT_PROTOCOL, /*!< 1: 32-bit CRC protocol */
} crc_protocol_type_e;
/*******************************************************************************
* 4.Global variable extern declarations
*******************************************************************************/
#endif

View File

@ -0,0 +1,404 @@
/*******************************************************************************
*
*
* 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_DCS_LONG_RESPONSE = 0x1C,
DSI_ACK_DT_DCS_SHORT_RESPONSE_1B = 0x21,
DSI_ACK_DT_DCS_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_DSC_STREAM = 11,
DSI_COLOR_CODE_MAX
} dsi_color_code_e;
/**
* @brief dsi endianness type
*/
typedef enum
{
DPI_ENDIAN_RGB = 0,
DPI_ENDIAN_BGR
} dsi_endianness_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 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
PIN28&PIN27 PIN26&PIN25 PIN24&PIN23 PIN22&PIN21 PIN20&PIN19
RX_LANE_SWAP_0123 D0P&D0N D1P&D1N CLKP&CLKN D2P&D2N D3P&D3N
RX_LANE_SWAP_3210 D3P&D3N D2P&D2N CLKP&CLKN D1P&D1N D0P&D0N
RX_LANE_SWAP_2103(default) D2P&D2N D1P&D1N CLKP&CLKN D0P&D0N D3P&D3N
RX_LANE_SWAP_3012 D3P&D3N D0P&D0N CLKP&CLKN D1P&D1N D2P&D2N
*/
typedef enum
{
RX_LANE_SWAP_0123 = 0x0,
RX_LANE_SWAP_3210 = 0x1,
RX_LANE_SWAP_2103 = 0x2,
RX_LANE_SWAP_DEFAULT_ORDER = 0x2, /* 默认原理图为2103顺序 */
RX_LANE_SWAP_3012 = 0x3,
RX_LANE_SWAP_MAX
} dsi_rx_lane_swap_e;
/**
* @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不变
* lane表示的是进行完lane swap的lane,lane swap配置RX_LANE_SWAP_3012,RX_LANE_0_PN_SWAP则表示PIN26&PIN25进行PN交换,D0P&D0N变成D0N&D0P
*/
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 flow control mode
*/
typedef enum
{
FC_AUTO_MODE = 0, /* 自动匹配模式,根据base info配置匹配1-4 */
FC_V2V_NORMAL_MODE = 1, /* Video to Video 模式转换 */
FC_V2C_NORMAL_MODE = 2, /* Video to Command 模式转换 */
FC_C2V_NORMAL_MODE = 3, /* Command to Video 模式转换 */
FC_C2C_NORMAL_MODE = 4, /* Command to Command 模式转换 */
FC_PRO_MOTION_MODE = 6, /* 自适应帧率转换(LTPO模式) */
FC_PRO_MOTION_MODE_2 = 5, /* 自适应帧率转换(LTPO模式) */
FC_PRO_MOTION_WITH_PU_MODE = 7, /* 自适应帧率带PU */
FC_V2V_AUTO_SYCN_MODE = 8, /* Video to Video 软件同步 */
FC_V2V_DIRECT_MODE = 9, /* Video to Video 直通模式 */
FC_MODE_MAX
} flow_control_mode_e;
/**
* @brief transform
*/
typedef struct
{
uint16_t top;
uint16_t bottom;
uint16_t left;
uint16_t right;
bool enable;
} pic_edge_info_t;
/**
* @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) */
dsi_video_data_mode_e dst_mode; /* mipi tx 输出video 数据传输模式(video/cmd mode) */
uint16_t pn_swap; /* mipi P/N swap标志位, rx可配置/tx暂不支持 */
} dsi_base_trans_info_t;
/**
* @brief transform
*/
typedef struct
{
bool mirror_en; /* 对video 做水平镜像标志位 */
bool pu_optimize; /* 用于优化PU显示效果默认为false;true:优化PU显示显示效果,高功耗;false:普通PU模式,低功耗 */
video_rotate_angle_e rot_angle; /* 对video 做旋转的角度 */
flow_control_mode_e flow_control_mode; /* 图像数据流控制模式 */
pic_edge_info_t crop_info; /* 图像边缘裁剪配置 not impletmented */
pic_edge_info_t blank_info; /* 图像边缘补黑配置 not impletmented */
bool bw_optimize; /* 带宽自动检查,默认打开 */
} dsi_base_extra_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 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;
/**
* @brief TX False color去伪彩参数结构体
*/
typedef struct
{
uint16_t edgemedslope;
uint16_t desatslope;
} dsi_tx_fc_t;
/**
* @brief TX
*/
typedef struct
{
bool y_enh_method;
uint8_t enhance_str;
uint16_t enhance_slope;
uint16_t boundscale_low;
uint16_t boundscale_high;
} dsi_tx_edge_enh_t;
/**
* @brief TX
*/
typedef struct
{
uint8_t edge_thr;
bool use_large_kernel;
} dsi_tx_edge_dect_t;
/**
* @brief TX bcsa
*/
typedef struct
{
int8_t brightness; /* 亮度调整, 范围-127 - 127 */
uint16_t contrast; /* 对比度调整,范围0 - 4095 */
uint16_t saturation; /* 饱和度调整,范围0 - 4095 */
} dsi_tx_bcs_t;
/**
* @brief partial display
*/
typedef struct
{
uint32_t st_line; /*部分显示起始行位置*/
uint32_t st_col; /*部分显示起始列位置*/
uint32_t end_line; /*部分显示结束行位置*/
uint32_t end_col; /*部分显示结束列位置*/
uint8_t value_r; /*部分显示背景色R值*/
uint8_t value_g; /*部分显示背景色G值*/
uint8_t value_b; /*部分显示背景色B值*/
} dsi_tx_par_dis_t;
#endif //__MIPI_DSI_COMMON_H__

214
src/common/tau_log.c Normal file
View File

@ -0,0 +1,214 @@
/*******************************************************************************
*
*
* File: tau_log.c
* Description log file
* Version V0.1
* Date 2020-12-08
* Author linyw
*******************************************************************************/
/*******************************************************************************
* 1.Included header files
*******************************************************************************/
#include <stdio.h>
#include "ArmCM0.h"
#include "hal_uart.h"
#include "tau_log.h"
#include "tau_delay.h"
#define SWD_LOG_ADD_BAUD_DLY (1) //swd打印时加入baud延时
#define LOG_MAX_LEN_SINGLE (128) //每条打印的最大长度
/*******************************************************************************
* 2.Private constant and macro definitions using #define
*******************************************************************************/
/*******************************************************************************
* 3.Private enumerations, structures and unions using typedef
*******************************************************************************/
/*! @brief tau_log结构体,打印端口为swd时使用 */
typedef struct
{
uint16_t wr_ptr; /*!< 当前buf的写指针 */
uint16_t buf_size; /*!< buf长度 */
uint16_t dly; /*!< 打印一个byte的us级延时用以模拟波特率 */
uint16_t rd_ptr; /*!< 当前buf的读指针 */
char* p_buf; /*!< 缓存log的buf的首地址 */
uint8_t log_lv; /*!< 打印等级 */
uint8_t rsv0; /*!< reserved字段 */
uint16_t rsv1; /*!< reserved字段 */
} tau_log_t;
/*******************************************************************************
* 4.Static variables
*******************************************************************************/
static log_port_e g_log_port = LOG_PORT_SWD;
static char g_log_buf[LOG_BUF_SIZE] = {0};
const tau_log_t g_tau_log __attribute__((section(".ARM.__at_0x1101C"))) =
{
0,
LOG_BUF_SIZE,
86,
0,
g_log_buf,
(uint8_t)LOG_CURREN_LEVEL
};
/*******************************************************************************
* 5.Global variable or extern global variabls/functions
*******************************************************************************/
/*******************************************************************************
* 6.Static function prototypes
*******************************************************************************/
/**************************************************************************
* @name : tau_log_push_log
* @brief : log放到缓存中
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void tau_log_push_log(tau_log_t* p_tau_log, char* p_log, uint16_t len)
{
uint16_t total_len = len; //打印数据总长度
uint16_t temp_len = 0;
//4字节对齐,swd驱动只能4byte读写
if (total_len % 4)
{
total_len += 4 - (total_len % 4);
}
if (total_len > LOG_BUF_SIZE)
{
total_len = LOG_BUF_SIZE;
}
if (p_tau_log->wr_ptr + total_len > LOG_BUF_SIZE) //超出log buf长度需要分两次搬运
{
//搬运第一部分内容
temp_len = LOG_BUF_SIZE - p_tau_log->wr_ptr;
memcpy(&p_tau_log->p_buf[p_tau_log->wr_ptr], p_log, temp_len);
//搬运剩下的内容从buf头开始填充
memcpy(&p_tau_log->p_buf[0], &p_log[temp_len], total_len - temp_len);
p_tau_log->wr_ptr = p_tau_log->wr_ptr + total_len - LOG_BUF_SIZE;
}
else
{
memcpy(&p_tau_log->p_buf[p_tau_log->wr_ptr], p_log, total_len);
p_tau_log->wr_ptr += total_len;
}
if (p_tau_log->wr_ptr >= LOG_BUF_SIZE)
{
p_tau_log->wr_ptr = 0;
}
#if(SWD_LOG_ADD_BAUD_DLY)
delayUs(p_tau_log->dly * total_len); //模拟波特率的延时
#endif
}
/**************************************************************************
* @name : fputc
* @brief : fputc函数
* @param[in] :
* @return :
* @retval :
**************************************************************************/
int fputc(int ch, FILE *f)
{
tau_log_t* p_tau_log = (tau_log_t*)0x1101C;
if (g_log_port == LOG_PORT_SWD)
{
tau_log_push_log(p_tau_log, (char*)&ch, 1);
}
else
{
hal_uart_send_blocking((hal_uart_num_e)g_log_port, (uint8_t *)&ch, 1);
}
return ch;
}
/**************************************************************************
* @name : fgetc
* @brief : fgetc函数
* @param[in] :
* @return :
* @retval :
**************************************************************************/
int fgetc(FILE *f)
{
char ch;
if (g_log_port != LOG_PORT_SWD) /* SWD 暂时不支持字符输入 */
{
hal_uart_recv_blocking((hal_uart_num_e)g_log_port, (uint8_t *)&ch, 1);
}
return ch;
}
/**************************************************************************
* @name : LOG_printf
* @brief : log函数
* @param[in] :
* @return :
* @retval :
**************************************************************************/
void tau_log_printf(log_level_e log_lv, const char *fmt, ...)
{
#if !EDA_MODE
char string_buf[LOG_MAX_LEN_SINGLE] = {0}; //缓存输入的打印数据
va_list ap;//初始化指向可变参数列表的指针
tau_log_t* p_tau_log = (tau_log_t*)0x1101C;
//printf("log_lv addr:0x%x,val:%d,dly:%d\n",(uint32_t)&p_tau_log->log_lv,p_tau_log->log_lv,p_tau_log->dly);
if (log_lv < p_tau_log->log_lv)
{
return;
}
//将第一个可变参数的地址付给ap即ap指向可变参数列表的开始
va_start(ap, fmt);
if (g_log_port == LOG_PORT_SWD)
{
vsprintf(string_buf, fmt, ap);
tau_log_push_log(p_tau_log, string_buf, strlen(string_buf));
}
else
{
//将参数fmt、ap指向的可变参数一起转换成格式化字符串放string数组中其作用同sprintf只是参数类型不同
vsprintf(g_log_buf, fmt, ap);
printf("\n%s", g_log_buf);
}
va_end(ap); //ap付值为0没什么实际用处主要是为程序健壮性
#endif
}
void tau_log_init(uint32_t baud_rate, log_port_e log_port)
{
if(log_port >= LOG_PORT_SWD)
{
g_log_port = LOG_PORT_SWD;
}
else
{
hal_uart_config_t huart;
huart.baudrate = baud_rate;
huart.data_width = HAL_UART_DATAWIDTH_8;
huart.parity = HAL_UART_PARITY_NO;
huart.stopbits = HAL_UART_STOPBIT_1;
hal_uart_init((hal_uart_num_e)log_port, &huart);
g_log_port = log_port;
}
}

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

@ -0,0 +1,100 @@
/*******************************************************************************
*
*
* 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:每个模块可配置打印等级 */
#define LOG_BUF_SIZE (256) /* 配置打印缓存的大小 */
/*
* Using the following three macros for conveniently logging.
*/
#define TAU_LOGD(format,...) \
do { \
tau_log_printf(kLOG_LEVEL_DBG, "[%s] (%04d) " format, LOG_TAG, __LINE__, ##__VA_ARGS__); \
} while (0)
#define TAU_LOGI(format,...) \
do { \
tau_log_printf(kLOG_LEVEL_INF, "[%s] (%04d) " format, LOG_TAG, __LINE__, ##__VA_ARGS__); \
} while (0)
#define TAU_LOGE(format,...) \
do { \
tau_log_printf(kLOG_LEVEL_ERR, "[%s] (%04d) " format, LOG_TAG, __LINE__, ##__VA_ARGS__); \
} while (0)
/*******************************************************************************
* 3.Global structures, unions and enumerations using typedef
*******************************************************************************/
/**
* @brief log打印等级枚举
*
*/
typedef enum
{
kLOG_LEVEL_DBG = 0,
kLOG_LEVEL_INF,
kLOG_LEVEL_ERR,
kLOG_LEVEL_NONE /* 不打印任何参数 */
} log_level_e;
/**
* @brief log打印端口枚举
*
*/
typedef enum
{
LOG_PORT_UART0, /* 使用串口输出打印 */
LOG_PORT_UART1, /* 使用串口输出打印 */
LOG_PORT_SWD, /* 使用swd输出打印 */
LOG_PORT_UNKNOWN
} log_port_e;
/*******************************************************************************
* 4.Global variable extern declarations
*******************************************************************************/
/*******************************************************************************
* 5.Global function prototypes
*******************************************************************************/
/**
* @brief log系统
* @param baud_rate
* @param log_port
* @retval none
*/
void tau_log_init(uint32_t baud_rate, log_port_e log_port);
/**
* @brief log系统
* @param baud_rate
* @param log_port
* @retval none
*/
void tau_log_printf(log_level_e log_lv, const char *fmt, ...);
#endif

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

@ -0,0 +1,229 @@
/*******************************************************************************
*
*
* File: tau_operations.h
* Description
* Version V0.1
* Date 2020-09-07
* Author lzy
*******************************************************************************/
#ifndef __TAU_BYTEOPS_H
#define __TAU_BYTEOPS_H
/**
* \name
* @{
*/
/** \brief 长整数位数 */
#ifndef TAU_BITS_PER_LONG
#define TAU_BITS_PER_LONG 32
#endif
/** \brief 字节位数 */
#define TAU_BITS_PER_BYTE 8
/** @} */
/******************************************************************************/
/**
* \name
* @{
*/
/** \brief bit移位
* TAU_BIT(2) is 0x4
*/
#define TAU_BIT(bit) (1u << (bit))
/** \brief 值移位
* TAU_SBF(0xFF, 8) is 0xff00
*/
#define TAU_SBF(value, field) ((value) << (field))
/** \brief bit置位
* TAU_BIT_SET(0, 8) is 0x100
*/
#define TAU_BIT_SET(data, bit) ((data) |= TAU_BIT(bit))
/** \brief bit清零
* TAU_BIT_CLR(0xFF, 2) is 0xfb
*/
#define TAU_BIT_CLR(data, bit) ((data) &= ~TAU_BIT(bit))
/** \brief bit置位, 根据 mask 指定的位
* TAU_BIT_SET_MASK(0xF0F0, 0xF00) is 0xfff0
*/
#define TAU_BIT_SET_MASK(data, mask) ((data) |= (mask))
/** \brief bit清零, 根据 mask 指定的位
* TAU_BIT_CLR_MASK(0xFFFF, 0xFF00) is 0xff
*/
#define TAU_BIT_CLR_MASK(data, mask) ((data) &= ~(mask))
/** \brief bit翻转
* TAU_BIT_TOGGLE(0xFFFF, 0) is 0xfffe
* TAU_BIT_TOGGLE(0x0000, 1) is 0x2
*/
#define TAU_BIT_TOGGLE(data, bit) ((data) ^= TAU_BIT(bit))
/** \brief bit修改
* TAU_BIT_MODIFY(0, 8, 1) is 0x100
* TAU_BIT_MODIFY(0xFFFF, 1, 0) is 0xfffd
*/
#define TAU_BIT_MODIFY(data, bit, value) \
((value) ? TAU_BIT_SET(data, bit) : TAU_BIT_CLR(data, bit))
/** \brief 测试bit是否置位
* TAU_BIT_ISSET(0xF0F1, 1) is 0
* TAU_BIT_ISSET(0xF0F2, 1) is 2
*/
#define TAU_BIT_ISSET(data, bit) ((data) & TAU_BIT(bit))
/** \brief 获取bit值
* TAU_BIT_GET(0xF0F1, 1) is 0
* TAU_BIT_GET(0xF0F2, 1) is 1
*/
#define TAU_BIT_GET(data, bit) (TAU_BIT_ISSET(data, bit) ? 1 : 0)
/** \brief 检测bit值
* TAU_BIT_CHECK(0xF5FF, 4) is 1
*/
#define TAU_BIT_CHECK(data, bit) \
(((data) & TAU_BIT(bit)) ? 1 : 0)
/** \brief 获取 n bits 掩码值
* TAU_BITS_MASK(2) is 0x3
*/
#define TAU_BITS_MASK(n) (~((~0u) << (n)))
/** \brief 获取位段值
* TAU_BITS_GET(0xF5FF, 0x0F00, 8) is 0x5
*/
#define TAU_BITS_GET(data, mask, pos) \
(((data) & (mask)) >> (pos))
/** \brief 获取位段值
* TAU_BITS_CHECK(0xF5FF, 0x0F00) is 1
*/
#define TAU_BITS_CHECK(data, mask) \
(((data) & (mask)) ? 1 : 0)
/** \brief 修改位段值
* TAU_BITS_MODIFY(0xF5FF, 0x0FF0, 0x8A0) is 0xF8AF
*/
#define TAU_BITS_MODIFY(data, clear_mask, set_mask) \
(data) = (((data) & (~(clear_mask))) | (set_mask))
/** \brief 设置位段值
* TAU_WRITE_REG32(0x05FF, 0xFFFA) is 0xFFFA
*/
#define TAU_WRITE_REG32(data, value) ((data) = (value))
/** \brief 设置位段值
* TAU_RAED_REG32(0x05FF) is 0x05FF
*/
#define TAU_RAED_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.

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

@ -0,0 +1,184 @@
/**************************************************************************//**
* @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,
VPRE1_IRQn = 18,
I2C2_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 */
#include "core_cm0.h" /* Processor and core peripherals */
#include "system_ARMCM0.h" /* System Header */
/* -------- End of section using anonymous unions and disabling warnings -------- */
#if defined (__CC_ARM)
#pragma pop
#elif defined (__ICCARM__)
/* leave anonymous unions enabled */
#elif (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
#pragma clang diagnostic pop
#elif defined (__GNUC__)
/* anonymous unions are enabled by default */
#elif defined (__TMS470__)
/* anonymous unions are enabled by default */
#elif defined (__TASKING__)
#pragma warning restore
#elif defined (__CSMC__)
/* anonymous unions are enabled by default */
#else
#warning Not supported compiler type
#endif
/* In HS mode and when the DMA is used, all variables and data structures dealing
with the DMA during the transaction process should be 4-bytes aligned */
#define DMA_WORD_ALIGN_EN
#ifdef DMA_WORD_ALIGN_EN
#if defined (__GNUC__) /* GNU Compiler */
#define __ALIGN_END __attribute__ ((aligned (4)))
#define __ALIGN_BEGIN
#else
#define __ALIGN_END
#if defined (__CC_ARM) /* ARM Compiler */
#define __ALIGN_BEGIN __align(4)
#elif defined (__ICCARM__) /* IAR Compiler */
#define __ALIGN_BEGIN
#elif defined (__TASKING__) /* TASKING Compiler */
#define __ALIGN_BEGIN __align(4)
#endif /* __CC_ARM */
#endif /* __GNUC__ */
#else
#define __ALIGN_BEGIN
#define __ALIGN_END
#define __ALIGN_END_1 __attribute__ ((aligned (1)))
#endif /* DMA_WORD_ALIGN_EN */
/* __packed keyword used to decrease the data type alignment to 1-byte */
#if defined (__CC_ARM) /* ARM Compiler */
#define __packed __packed
#elif defined (__ICCARM__) /* IAR Compiler */
#define __packed __packed
#elif defined ( __GNUC__ ) /* GNU Compiler */
#define __packed __attribute__ ((__packed__))
#define __weak __attribute__((weak))
#elif defined (__TASKING__) /* TASKING Compiler */
#define __packed __unaligned
#endif /* __CC_ARM */
#ifdef __cplusplus
}
#endif
#endif /* ARMCM0_H */

View File

@ -0,0 +1,56 @@
/*******************************************************************************
*
*
* File: hal_aod_clk.h
* Description: aod
* Version: V0.1
* Date: 2023-11-02
* Author: lzy
*******************************************************************************/
#ifndef __HAL_AOD_CLK_H__
#define __HAL_AOD_CLK_H__
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "tau_dsi_datatype.h"
#include "tau_common.h"
#include "tau_log.h"
#include "hal_dsi_rx_ctrl.h"
/*******************************************************************************
* 2.Global constant and macro definitions using #define
*******************************************************************************/
/*******************************************************************************
* 3.Global structures, unions and enumerations using typedef
*******************************************************************************/
/**
* @brief clk type
*/
typedef enum
{
HAL_AOD_HOUR, /* 时 */
HAL_AOD_MIN, /* 分 */
HAL_AOD_SEC, /* 秒 */
HAL_AOD_TYPE_MAX
} hal_aod_clk_type_e;
/*******************************************************************************
* 4.Global variable extern declarations
*******************************************************************************/
/*******************************************************************************
* 5.Global function prototypes
*******************************************************************************/
bool hal_aod_clk_init(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, uint16_t x, uint16_t y, uint8_t r, uint8_t g, uint8_t b);
void hal_aod_clk_update_pic_info(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle,hal_aod_clk_type_e type, uint16_t wide, uint16_t length);
void hal_aod_clk_update_center_point(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, uint16_t x, uint16_t y);
void hal_aod_clk_draw(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, uint8_t hour, uint8_t min, uint8_t sec);
#endif //__HAL_AOD_CLK_H__

114
src/sdk/include/hal_crc.h Normal file
View File

@ -0,0 +1,114 @@
/*******************************************************************************
*
*
* File: hal_crc.h
* Description: hal crc ͷ<EFBFBD>ļ<EFBFBD>
* Version: V0.1
* Date: 2023-07-27
* Author: zzf
*******************************************************************************/
#ifndef __HAL_CRC_H
#define __HAL_CRC_H
#ifdef __cplusplus
extern "C" {
#endif
/*******************************************************************************
* 1.Included files
*******************************************************************************/
#include "tau_device_datatype.h"
#include "tau_common.h"
/*******************************************************************************
* 2.Exported constant and macro definitions
*******************************************************************************/
/*******************************************************************************
* 3.Exported structures, unions and enumerations
*******************************************************************************/
/**
* @brief crc calculation unit structure
*/
typedef struct
{
uint32_t polynomial_value;
uint32_t initial_seed_value;
crc_protocol_type_e crc_protocol;
crc_fxor_function_e crc_foxr;
crc_reversal_type_e crc_reversal_in;
crc_reversal_type_e crc_reversal_out;
} crc_ctrl_handle_t;
/**
* @brief crc dma callback function define
*/
typedef void (*crc_dma_callback)(uint32_t crc_result);
/*******************************************************************************
* 4.Exported variable declarations
*******************************************************************************/
/*******************************************************************************
* 5.Exported function declarations
*******************************************************************************/
/**
* @brief The initialization for CRC calculation unit
* @param crc_ctrl_handle: configuration parameters in initialization
* @retval true or false
**/
bool hal_crc_init(const crc_ctrl_handle_t *crc_ctrl_handle);
/**
* @brief The initialization for CRC calculation unit
* @param None
* @retval true or false
**/
bool hal_crc_deinit(void);
/**
* @brief Reset CRC calculation unit and DR to CRCR_INIT value
* @param None
* @retval true or false
**/
bool hal_crc_reset(void);
/**
* @brief Get the result of CRC calculation uint
* @param buffer_address: 16-bit or 32-bit crc calculate buffer address
* @param buffer_length: the length of buffer
* @retval 32-bit crc calculate result
**/
uint32_t hal_crc_cal(const void *buffer_address, uint32_t buffer_length);
/**
* @brief initial DMA transfer
* @param crc_ctrl_handle: configuration parameters in initialization
* @param buffer_address: 16-bit or 32-bit crc calculate buffer address
* @param buffer_length: the length of buffer(0~65535)
* @param cb_func: dma interrupt callback function to get the result of crc calculation
* @retval true or false
**/
bool hal_crc_dma_init(const crc_ctrl_handle_t *crc_ctrl_handle, crc_dma_callback cb_func, const void *buffer_address, uint16_t buffer_length);
/**
* @brief deinitial DMA transfer
* @param None
* @retval true or false
**/
bool hal_crc_dma_deinit(void);
/**
* @brief start DMA transfer
* @param None
* @retval true or false
**/
bool hal_crc_dma_start(void);
#ifdef __cplusplus
}
#endif
#endif /* __HAL_CRC_H */
/***************** (C) COPYRIGHT ISP Systems (R) END OF FILE ******************/

View File

@ -0,0 +1,475 @@
/*******************************************************************************
*
*
* 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"
#include "tau_log.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_event_e select
*/
typedef enum hal_rx_event_e
{
HAL_RX_FS_EVENT = 0x1, /* Frame start event */
HAL_RX_LINE_EVENT = 0x2, /* Frame receive line event */
} hal_rx_event_e;
/**
* @brief rx pq filter index
* 使linear,使OPT filter
* RX_FLT_OPT_0最模糊,,index越大越清晰,齿
*/
typedef enum
{
RX_FLT_OPT_0 = 0,
RX_FLT_OPT_1 = 1,
RX_FLT_OPT_2 = 2,
RX_FLT_OPT_3 = 3,
RX_FLT_OPT_4 = 4,
RX_FLT_OPT_5 = 5,
RX_FLT_OPT_6 = 6,
RX_FLT_OPT_7 = 7,
RX_FLT_OPT_8 = 8,
RX_FLT_OPT_9 = 9,
RX_FLT_OPT_10 = 10,
RX_FLT_LINEAR = 11,
RX_FLT_MAX
} hal_dsi_rx_pq_filter_e;
/* RX debug 回调函数,用于获取frame start 等功能debug */
typedef void (*hal_dsi_rx_ctrl_event_entry)(hal_rx_event_e event, void *data);
/**
* @brief dsi rx ctrl handle struct
*/
typedef struct hal_dsi_rx_ctrl_handle_t
{
dsi_base_trans_info_t base_info; /* mipi video 转换基本信息 */
dsi_base_extra_info_t extra_info; /* 新增旋转、镜像配置 */
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 */
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使用标志位 */
hal_err_handle_level_e err_handler_level; /* RX接收错误的时候对模块做reset等级, 等级越高reset模块越多 */
uint8_t rx_strength; /* 用于调节RX信号强度仅适用于开启内阻校准模式档位0~7默认3 */
hight_performan_mode_e hight_performan_mode; /* 高性能模式等级,参考hight_performan_mode_e */
dsi_rx_lane_swap_e rx_lane_swap; /* lane swap default order is 2103*/
hal_dsi_rx_pq_filter_e rx_pq_index; /* 画质调整滤波器,默认为linear最优效果,特殊场景使用OPT filter */
} 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 */
uint16_t crc_data; /* dcs crc */
const hal_dcs_execute_entry_t *dcs_execute_entry; /* dcs packet 处理函数入口*/
} hal_dcs_packet_t;
/**
* @brief video mode RX pattern参数结构体
*/
typedef struct
{
uint32_t ipi_pg_hsa;
uint32_t ipi_pg_hbp;
uint32_t ipi_pg_hfp;
uint32_t ipi_pg_vsa;
uint32_t ipi_pg_vbp;
uint32_t ipi_pg_vfp;
uint32_t frame_rate;
} hal_dsi_rx_ipi_pg_t;
/**
* @brief dcs command filter select
*/
typedef enum
{
HAL_RX_DCS_FILTER_0 = 0x0,
HAL_RX_DCS_FILTER_1 = 0x1,
HAL_RX_DCS_FILTER_2 = 0x2,
HAL_RX_DCS_FILTER_3 = 0x3,
HAL_RX_DCS_FILTER_4 = 0x4,
HAL_RX_DCS_FILTER_5 = 0x5,
HAL_RX_DCS_FILTER_6 = 0x6,
HAL_RX_DCS_FILTER_7 = 0x7,
HAL_RX_DCS_FILTER_8 = 0x8,
HAL_RX_DCS_FILTER_9 = 0x9,
HAL_RX_DCS_FILTER_A = 0xA,
HAL_RX_DCS_FILTER_B = 0xB,
HAL_RX_DCS_FILTER_MAX
} hal_rx_dcs_filter_sel_e;
/**
* @brief dcs command filter select
*/
typedef enum
{
HAL_RX_QRESP_CODE0 = 0,
HAL_RX_QRESP_CODE1 = 1,
HAL_RX_QRESP_CODE2 = 2,
HAL_RX_QRESP_CODE3 = 3,
HAL_RX_QRESP_CODE4 = 4,
HAL_RX_QRESP_CODE5 = 5,
HAL_RX_QRESP_CODE6 = 6,
HAL_RX_QRESP_CODE7 = 7,
HAL_RX_QRESP_MAX
} hal_rx_dcs_qresp_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 RX CLK
*/
typedef enum
{
RX_CLK_100M = 0,
RX_CLK_150M = 1,
RX_CLK_200M = 2,
RX_CLK_300M = 3,
RX_CLK_40M = 4,
RX_CLK_80M = 5,
RX_CLK_MAX
} hal_rx_clk_e;
/*******************************************************************************
* 4.Global variable extern declarations
*******************************************************************************/
/*******************************************************************************
* 5.Global function prototypes
*******************************************************************************/
/**
* @brief dsi rx ctrl handle (hal_dsi_rx_ctrl_release_handle)
* @param none
* @retval dsi rx handle
*/
hal_dsi_rx_ctrl_handle_t *hal_dsi_rx_ctrl_create_handle(void);
/**
* @brief dsi rx ctrl handle
* @param rx_ctrl_handle: dsi rx handle
* @retval true/false
*/
bool hal_dsi_rx_ctrl_release_handle(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle);
/**
* @brief rx ctrl handle PPS
* @param rx_ctrl_handle: dsi rx handle
* @param pps: pps
* @param pps_size: pps
* @retval true/false
*/
bool hal_dsi_rx_ctrl_pre_init_pps(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, uint8_t pps[], uint32_t pps_size);
/**
* @brief dsi rx
* @param rx_ctrl_handle: dsi rx handle
* @retval true/false
*/
bool hal_dsi_rx_ctrl_init(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle);
/**
* @brief dsi rx
* @param rx_ctrl_handle: dsi rx handle
* @retval true/false
*/
bool hal_dsi_rx_ctrl_deinit(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle);
/**
* @brief dsi rx
* @param rx_ctrl_handle: dsi rx handle
* @retval true/false
*/
bool hal_dsi_rx_ctrl_start(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle);
/**
* @brief dsi rx参数并恢复状态 (debug使用, rx_ctrl_handle参数后调用该接口重启)
* @param rx_ctrl_handle: dsi rx handle
* @retval true/false
*/
bool hal_dsi_rx_ctrl_restart(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle);
/**
* @brief dsi rx
* @param rx_ctrl_handle: dsi rx handle
* @retval true/false
*/
bool hal_dsi_rx_ctrl_stop(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle);
/**
* @brief RX clk,RX CLK ,video mode场景出现FIFO FULL情况调试使用
* @param rxbr_clk: rx clk, hs_lane_rate/8
* @retval true/false
*/
bool hal_dsi_rx_ctrl_set_rx_clk(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, hal_rx_clk_e rxbr_clk);
/**
* @brief MIPI HOST的读响应 CMD
* @param rx_ctrl_handle: dsi rx handle
* @param data_type: data type
* @param vc: virtual channel
* @param cmd_count: ack command
* @param ... : command(cmd_count )
* @retval true/false
*/
bool hal_dsi_rx_ctrl_send_ack_cmd(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, dsi_ack_data_type_e data_type, dsi_virtual_channel_e vc, uint8_t cmd_count, ...);
/**
* @brief 使,hal_dsi_rx_ctrl_send_ack_cmd功能一致
* @param rx_ctrl_handle: dsi rx handle
* @param data_size: ,4
* @param data: cmd数据,:
* data[0]:DI(data type)
* data[1]:data 0
* data[2]:data 1
* data[3]:pkt type,0
* @retval true/false
*/
bool hal_dsi_rx_ctrl_ack_short_cmd(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, uint8_t data_size, uint8_t data[]);
/**
* @brief 使,hal_dsi_rx_ctrl_send_ack_cmd功能一致
* @param rx_ctrl_handle: dsi rx handle
* @param data_size: ,Word Count + header长度 (header固定为4)
* @param data: cmd数据,:
* data[0]:DI(data type)
* data[1]:wc 0 (Word Count )
* data[2]:wc 1 (Word Count )
* data[3]:pkt type,1
* data[N]:
* @retval true/false
*/
bool hal_dsi_rx_ctrl_ack_long_cmd(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, uint8_t data_size, uint8_t data[]);
/**
* @brief DSC接口,cus_dcs_entry_table里对应DCS immediately_func为false的函数
* @param rx_ctrl_handle: dsi rx handle
* @retval true - 1DSC , false - DSC
*/
bool hal_dsi_rx_ctrl_dcs_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 使pattern代替mipi输入()
* @param rx_ctrl_handle: dsi rx handle
* @param pg_orient: pattern (0:Vertical mode ; 1:Horizontal mode)
* @param enable: /pattern
* @param frame_rate: 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, int frame_rate);
/**
* @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
* @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 RX escape clk
* @param rx_ctrl_handle: dsi rx handle
* @param esc_clk: escape clk Hz,10000000CMD为10Mhz
* @retval true/false
*/
bool hal_dsi_rx_ctrl_set_cus_esc_clk(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, uint32_t esc_clk);
/**
* @brief filter
* @param rx_ctrl_handle: dsi rx handle
* @param enable: / filter
* @retval true/false
*/
bool hal_dsi_rx_ctrl_set_auto_hw_filter(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, bool enable);
/*
* @brief (video mode)
* @param rx_ctrl_handle: dsi rx handle
* @param frame_rateframe rate
*/
bool hal_dsi_rx_ctrl_toggle_input_frame_rate(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, dsi_video_frame_rate_e frame_rate);
/*
* @brief ,.
hal_dsi_rx_ctrl_set_auto_hw_filter关闭hw filter用于获取所有软件CMD
* @param rx_ctrl_handle: dsi rx handle
* @param
* @retval none
*/
void hal_dsi_rx_ctrl_register_write_cmd_entry(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, hal_dsi_rx_ctrl_dcs_execute execute_func);
/**
* @brief
* 64,AP需要配置set_max_return_size后并且对比一直才会自动回复,
*
* @param RXBR: registers struct
* @param qresp_number: qresp (0-7)
* @param data_type: datatype
* @param cmd_code:
* @param cmd_count: ,size为64,set_max_return_size一致才会回复
* @param ...:
* @retval true/false
*/
bool hal_dsi_rx_ctrl_set_auto_ack(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, hal_rx_dcs_qresp_e qresp_number, dsi_ack_data_type_e data_type, uint32_t cmd_code, uint8_t cmd_count, ...);
/*
* @brief
* @param rx_ctrl_handle: dsi rx handle
* @param draw_en: 使
* @param pxl_init_en: ,true:使init_value赋值,false:使
* @param color_mode: dsi_color_code_e
* @param init_value: ,bit[23:16]--Rbit[15:8]--Gbit[7:0]--B
* @retval none
*/
void hal_dsi_rx_ctrl_draw_mode_init(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, bool draw_en, bool pxl_init_en, dsi_color_code_e color_mode, uint32_t init_value);
/*
* @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 video mode下强制将数据设置为特定的color mode,type见dsi_color_code_e
* @param rx_ctrl_handle: dsi rx handle
* @param enable: 使
* @param frc_vid_code:
* @retval none
*/
void hal_dsi_rx_ctrl_force_video_crtl(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, bool enable, dsi_color_code_e frc_vid_code);
/**
* @brief RX
* @param rx_ctrl_handle: dsi rx handle
* @param event_cb:
* @param event_mask: ,hal_rx_event_e(eg:HAL_RX_FS_EVENT|HAL_RX_LINE_EVENT)
* @param enable:
* @param user_data: ,
* @retval none
*/
void hal_dsi_rx_ctrl_register_callback(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, hal_dsi_rx_ctrl_event_entry event_cb, uint32_t event_mask, bool enable, void *user_data);
/**
* @brief CRC检查
* @param rx_ctrl_handle: dsi rx handle
* @param enable: CRC检测
* @retval none
*/
void hal_dsi_rx_ctrl_set_check_crc(hal_dsi_rx_ctrl_handle_t *rx_ctrl_handle, bool enable);
/**
* @brief rx log
* @param rx_drv_level: rx log等级见枚举log_level_e
* @retval none
*/
void hal_dsi_rx_ctrl_set_log_level(log_level_e rx_drv_level);
#endif //__HAL_DSI_RX_CTRL_H__

View File

@ -0,0 +1,347 @@
/*******************************************************************************
*
*
* File: hal_dsi_tx_ctrl.h
* Description: hal mipi dsi tx
* Version: V0.1
* Date: 2021-04-23
* Author: jaya
*******************************************************************************/
#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 "hal_gpio.h"
/*******************************************************************************
* 2.Global constant and macro definitions using #define
*******************************************************************************/
/*******************************************************************************
* 3.Global structures, unions and enumerations using typedef
*******************************************************************************/
/**
* @brief blank display configure type
*/
typedef struct
{
uint16_t st_col; /* 补黑区域起始坐标RGBG格式以子像素计数*/
uint16_t width; /* 补黑区域宽度RGBG格式以子像素计数*/
uint8_t remap_en; /* 补黑区域是否参与子像素重排*/
uint8_t blank_en; /* 补黑区域开关*/
} blank_disp_t;
/**
* @brief pentile remap rule configuration type in rom code
*/
typedef uint8_t (remap_rule_t)[24];
/**
* @brief MIPI TX参数结构体
*/
typedef struct
{
bool pentile_enable; /* 是否pentile输出*/
bool pentile_reverse_en; /* 是否打开芯片本身行翻转功能*/
bool pentile_24b; /* 是否以RGB IC搭配RGBG玻璃*/
uint32_t rgb_hact; /* RGB IC搭配RGBG玻璃使用时IC水平方向分辨率*/
remap_rule_t *remapl_rule; /* RGB IC搭配RGBG玻璃使用时remap规则1*/
remap_rule_t *remapr_rule; /* RGB IC搭配RGBG玻璃使用时remap规则2*/
blank_disp_t blank_info0; /* 补黑参数配置信息*/
blank_disp_t blank_info1; /* 补黑参数配置信息*/
} dsi_tx_pent_info_t;
/**
* @brief MIPI TX clk/data lane是否自动进LP控制枚举类型
* driver IC spec不同,Lane rate范围要求也不同
*
*/
typedef enum
{
ALWAYS_HS = 0, // vid输出默认此模式仅VSA自动进LP; cmd输出暂不支持此模式
ONLY_DATA_LANE_AUTO_LP = 1, // cmd输出默认此模式data lane行间自动进LP clk保持HS
CLK_DATA_LANE_AUTO_LP = 2, // data/clk lane行间自动进LP
} dsi_tx_lane_lp_e;
/**
* @brief tx pq filter index
* 使OPT
*/
typedef enum
{
TX_FLT_OPT = 0,
TX_FLT_LINEAR = 1,
TX_FLT_MAX
} hal_dsi_tx_pq_filter_e;
/**
* @brief MIPI TX参数结构体
*/
typedef struct
{
dsi_base_trans_info_t base_info; /* mipi video 转换基本信息 */
uint32_t dpi_vsa; /* DPI VSA*/
uint32_t dpi_vbp; /* DPI VBP*/
uint32_t dpi_vfp; /* DPI VFP*/
uint32_t dpi_hsa; /* DPI HSA*/
uint32_t dpi_hbp; /* DPI HBP*/
uint32_t dpi_hfp; /* DPI HFP*/
float tx_frame_rate; /* 默认60Hz输出,不建议配置为其他,仅作为debug使用 */
uint8_t lane_num; /* TX 使用的 lane 数量*/
bool used; /* handle使用标志位 内部自动更新状态,不需要操作*/
bool lp_exit_lpdt; /* 每一条LP CMD都退出LPDT */
dsi_tx_lane_lp_e tx_lane_lp; /* clk/data lane是否自动进LP模式配置 */
dsi_virtual_channel_e channel_id; /* 虚拟通道ID默认为0*/
dsi_video_mode_type_e vid_mode; /* video输出时选择输出的vid模式种类 */
dsi_tx_cmd_tx_type_e cmd_tx_type; /* 初始化模式传输命令方式0:HS; 1:LP */
dsi_tx_pent_info_t pentile_info; /* pentile屏基本信息 */
hal_dsi_tx_pq_filter_e tx_pq_index; /* 画质调整滤波器,默认为OPT最优效果 */
} hal_dsi_tx_ctrl_handle_t;
/**
* @brief TE
*/
typedef enum
{
TE_60HZ_MODE = 0,
TE_USER_MODE = 1, /* 底层不产生TE, 由hal_dsi_tx_ctrl_gen_a_tear_signal 接口产生 */
TE_STOP_MODE = 1,
TE_90HZ_MODE = 2,
TE_120HZ_MODE = 3,
TE_MODE_MAX
} te_mode_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_MAX
} dsi_tx_vpg_style_e;
/**
* @brief MIPI TX初始化
* @param tx_ctrl_handle: MIPI TX实例
* @retval true/false
*/
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 true/false
*/
bool hal_dsi_tx_ctrl_deinit(hal_dsi_tx_ctrl_handle_t *tx_ctrl_handle);
/**
* @brief MIPI TX创建实例
* @param None
* @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 true/false
*/
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 true/false
*/
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 true/false
*/
bool hal_dsi_tx_ctrl_stop(hal_dsi_tx_ctrl_handle_t *tx_ctrl_handle);
/**
* @brief MIPI TX接收命令
* @param data_type: dsi_data_type_e
* @param vc: dsi_virtual_channel_e
* @param cmd: DCS指令
* @param size:
* @param data:
* @retval None
*/
void hal_dsi_tx_ctrl_read_cmd(uint8_t data_type, uint8_t vc, uint8_t cmd, uint8_t size, uint8_t *data);
/**
* @brief video高速数据传输时V porch阶段进行bta回读接口
* @param data_type: dsi_data_type_e
* @param cmd: DCS指令
* @param size:
* @param data:
* @retval true-BTA回复获取有效false-BTA回复未获得
* @attention V porch时长是否足够size长度的寄存器回读TX数据通路出错
*/
bool hal_dsi_tx_ctrl_vporch_bta_opera(uint8_t data_type, uint8_t cmd, uint8_t size, uint8_t *data);
/**
* @brief MIPI TX发送命令
* @param data_type: dsi_data_type_e
* @param vc: dsi_virtual_channel_e
* @param cmd_count:
* @param ...:
* @retval true-command发送正常false-TX当前状态不能发送command
*/
bool hal_dsi_tx_ctrl_write_cmd(uint8_t data_type, uint8_t vc, uint8_t cmd_count, ...);
/**
* @brief MIPI TX发送命令
* @param data_type: dsi_data_type_e
* @param vc: dsi_virtual_channel_e
* @param size: data个数
* @param data: data数组
* @retval true-command发送正常false-TX当前状态不能发送command
*/
bool hal_dsi_tx_ctrl_write_array_cmd(uint8_t data_type, uint8_t vc, uint8_t size, const uint8_t *data);
/**
* @brief LP cmd发送模式
* @param enable: true-cmd发送false-LP cmd发送
* @retval None
* @attention AP enter sleep后传输发送LP cmd
*/
void hal_dsi_tx_ctrl_cmd_mode(bool enable);
/**
* @brief TX escape mode时钟
* @param esc_clk: escape clk Hz,10000000CMD为10Mhz
* @retval None
*/
void hal_dsi_tx_ctrl_set_escape_clock_div(uint32_t esc_clk);
/**
* @brief RGB或BGR
* @param endianness: RGB或BGR显示dsi_endianness_e
* @attention hal_dsi_tx_ctrl_init调用前才能生效
* @retval None
*/
void hal_dsi_tx_ctrl_set_endianness(dsi_endianness_e endianness);
/**
* @brief CCM参数
* @param coef: ccm_coef_t
* @retval None
*/
void hal_dsi_tx_ctrl_set_ccm(ccm_coef_t *ccm);
/**
* @brief
* @param edge_dect_para: dsi_tx_edge_dect_t;NULL
* @param edge_dect_en:
* @retval None
*/
void hal_dsi_tx_ctrl_set_edge_dect(dsi_tx_edge_dect_t *edge_dect_para, bool edge_dect_en);
/**
* @brief
* @param edge_enh_para: dsi_tx_edge_enh_t;NULL
* @param edge_enh_en:
* @retval None
*/
void hal_dsi_tx_ctrl_set_edge_enhance(dsi_tx_edge_enh_t *edge_enh_para, bool edge_enh_en);
/**
* @brief False Color remove算法参数
* @param fc_para: false color参数 dsi_tx_fc_t;NULL
* @param fc_en: false color配置模块
* @retval None
*/
void hal_dsi_tx_ctrl_set_fc(dsi_tx_fc_t *fc_para, bool fc_en);
/**
* @brief bcs参数
* @param bcs_para: // dsi_tx_bcs_t;NULL
* @param bcs_en: bcs配置模块
* @retval None
*/
void hal_dsi_tx_ctrl_set_bcs(dsi_tx_bcs_t *bcs_para, bool bcs_en);
/**
* @brief
* @param R: RGB的R分量
* @param G: RGB的G分量
* @param B: RGB的B分量
* @retval None
*/
void hal_dsi_tx_ctrl_set_overwrite_rgb(uint8_t R, uint8_t G, uint8_t B);
/**
* @brief overwrite功能
* @param enable: true-overwrite false-overwrite
* @retval None
*/
void hal_dsi_tx_ctrl_overwrite_enable(bool enable);
/**
* @brief
* @param enable: true-partial显示 false-partial显示
* @param par_disp_cfg display区域和背景色设置 dsi_tx_par_dis_t; NULL
* @retval None
*/
void hal_dsi_tx_ctrl_partial_disp_enable(bool enable, dsi_tx_par_dis_t *par_disp_cfg);
/**
* @brief TX VPG的输出
* @param vpg_en: 使VPG
* @param style: VPG的样式
* @param vpg_hline_adj: false-使true-VPG显示滚动情况下使用
* @attention vpg_hline_adj此参数只能解决带宽余量相差不大的情况VPG显示滚动问题
* @retval None
*/
void hal_dsi_tx_ctrl_set_vpg(bool vpg_en, dsi_tx_vpg_style_e style, bool vpg_hline_adj);
/**
* @brief TE模式
* @param tx_ctrl_handle: dsi tx handle
* @param te: te mode
* @retval None
*/
void hal_dsi_tx_ctrl_set_tear_mode(hal_dsi_tx_ctrl_handle_t *tx_ctrl_handle, te_mode_e te);
/**
* @brief TE信号
* @param None
* @retval None
*/
void hal_dsi_tx_ctrl_gen_a_tear_signal(void);
/**
* @brief command mode输出模式下产生一帧数据
* @param None
* @retval None
*/
bool hal_dsi_tx_ctrl_gen_a_frame(void);
/**
* @brief ,
* @param tx_ctrl_handle: dsi tx handle
* @param line_num: ,1 ~ output height
* @retval true/false
*/
bool hal_dsi_tx_ctrl_set_cus_sync_line(hal_dsi_tx_ctrl_handle_t *tx_ctrl_handle, uint32_t line_num);
/**
* @brief TX当前显示行号
* @param tx_ctrl_handle: dsi tx handle
* @retval ,vsa + vbp + vactive + vfp
*/
uint32_t hal_dsi_tx_ctrl_get_disp_line(hal_dsi_tx_ctrl_handle_t *tx_ctrl_handle);
#endif //__HAL_DSI_TX_CTRL_H__

Some files were not shown because too many files have changed in this diff Show More