DVT
This commit is contained in:
67
A5H_9225_8108_SPIV3.0/APP/vsync/VsyncApi.c
Normal file
67
A5H_9225_8108_SPIV3.0/APP/vsync/VsyncApi.c
Normal file
@@ -0,0 +1,67 @@
|
||||
#include "VsyncApi.h"
|
||||
#include "SocApi.h"
|
||||
#include "SpbApi.h"
|
||||
|
||||
|
||||
void VsyncApi_PinConfig(void)
|
||||
{
|
||||
GPIO_InitType GPIO_InitStruct;
|
||||
|
||||
RCC_AHB_Peripheral_Clock_Enable(RCC_AHB_PERIPH_GPIOC);
|
||||
|
||||
GPIO_Structure_Initialize(&GPIO_InitStruct);
|
||||
GPIO_InitStruct.GPIO_Mode=GPIO_MODE_INPUT;
|
||||
GPIO_InitStruct.GPIO_Pull=GPIO_PULL_DOWN;
|
||||
GPIO_InitStruct.GPIO_Slew_Rate=GPIO_SLEW_RATE_FAST;
|
||||
GPIO_InitStruct.Pin=SYS_VSYNC_PIN;
|
||||
GPIO_Peripheral_Initialize(SYS_VSYNC_PORT,&GPIO_InitStruct);
|
||||
}
|
||||
|
||||
void VsyncApi_StartCap(void)
|
||||
{
|
||||
EXTI->RT_CFG |=SYS_VSYNC_PIN;
|
||||
}
|
||||
|
||||
void VsyncApi_StopCap(void)
|
||||
{
|
||||
EXTI->RT_CFG &=~SYS_VSYNC_PIN;
|
||||
}
|
||||
|
||||
void VsyncApi_Init(void)
|
||||
{
|
||||
EXTI_InitType EXTI_InitStructure;
|
||||
VsyncApi_PinConfig();
|
||||
|
||||
RCC_APB2_Peripheral_Clock_Enable(RCC_APB2_PERIPH_AFIO);
|
||||
|
||||
GPIO_EXTI_Line_Set(EXTI_LINE_SOURCE13, AFIO_EXTI_PC13);
|
||||
|
||||
/*Configure key EXTI line*/
|
||||
EXTI_InitStructure.EXTI_Line = VSYNC_EXTI_LINE;
|
||||
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
|
||||
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
|
||||
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
|
||||
EXTI_Peripheral_Initializes(&EXTI_InitStructure);
|
||||
|
||||
VsyncApi_StopCap();
|
||||
}
|
||||
|
||||
void EXTI15_10_IRQHandler(void) {
|
||||
if (((EXTI->PEND & EXTI_LINE14) != (uint32_t)RESET) && ((EXTI->IMASK & EXTI_LINE14) != (uint32_t)RESET))
|
||||
{
|
||||
EXTI->PEND = EXTI_LINE14;
|
||||
SpbApi_DosCapFunction();
|
||||
}
|
||||
if (((EXTI->PEND & EXTI_LINE15) != (uint32_t)RESET) && ((EXTI->IMASK & EXTI_LINE15) != (uint32_t)RESET))
|
||||
{
|
||||
EXTI->PEND = EXTI_LINE15;
|
||||
SpbApi_DosCapFunction();
|
||||
}
|
||||
if (((EXTI->PEND & EXTI_LINE13) != (uint32_t)RESET) && ((EXTI->IMASK & EXTI_LINE13) != (uint32_t)RESET))
|
||||
{
|
||||
SYS_SPI2_RXDMA_CH->CHCFG &= (~((uint32_t)0x0001));
|
||||
SYS_SPIx->CTRL1 &= 0xffbf;
|
||||
EXTI_Flag_Status_Clear(EXTI_LINE13);
|
||||
SocAPI_StartRecv(machine.soc_spi_len);
|
||||
}
|
||||
}
|
||||
81
A5H_9225_8108_SPIV3.0/APP/vsync/VsyncApi.c.orig
Normal file
81
A5H_9225_8108_SPIV3.0/APP/vsync/VsyncApi.c.orig
Normal file
@@ -0,0 +1,81 @@
|
||||
#include "VsyncApi.h"
|
||||
#include "SocApi.h"
|
||||
#include "SpbApi.h"
|
||||
|
||||
|
||||
void VsyncApi_PinConfig(void)
|
||||
{
|
||||
GPIO_InitType GPIO_InitSt;
|
||||
RCC_AHB_Peripheral_Clock_Enable(RCC_AHB_PERIPH_GPIOB);
|
||||
|
||||
GPIO_Structure_Initialize(&GPIO_InitSt);
|
||||
GPIO_InitSt.GPIO_Mode=GPIO_MODE_INPUT;
|
||||
GPIO_InitSt.GPIO_Pull=GPIO_PULL_DOWN;
|
||||
GPIO_InitSt.GPIO_Slew_Rate=GPIO_SLEW_RATE_FAST;
|
||||
GPIO_InitSt.Pin=SYS_VSYNC_PIN;
|
||||
GPIO_Peripheral_Initialize(SYS_VSYNC_PORT,&GPIO_InitSt);
|
||||
}
|
||||
|
||||
void Start_Cap_Vsync(void)
|
||||
{
|
||||
EXTI->IMASK |=SYS_VSYNC_PIN;
|
||||
}
|
||||
|
||||
void VsyncApi_StopCap(void)
|
||||
{
|
||||
EXTI->IMASK &=~SYS_VSYNC_PIN;
|
||||
}
|
||||
|
||||
void Sys_Vsync_Init(void)
|
||||
{
|
||||
EXTI_InitType EXTI_InitSt;
|
||||
|
||||
VsyncApi_PinConfig();
|
||||
|
||||
RCC_APB2_Peripheral_Clock_Enable(RCC_APB2_PERIPH_AFIO);
|
||||
|
||||
GPIO_EXTI_Line_Set(EXTI_LINE_SOURCE9, AFIO_EXTI_PB9);
|
||||
|
||||
EXTI_Structure_Initializes(&EXTI_InitSt);
|
||||
/*Configure key EXTI line*/
|
||||
EXTI_InitSt.EXTI_Line = VSYNC_EXTI_LINE;
|
||||
EXTI_InitSt.EXTI_Mode = EXTI_Mode_Interrupt;
|
||||
EXTI_InitSt.EXTI_Trigger = EXTI_Trigger_Rising;
|
||||
EXTI_InitSt.EXTI_LineCmd = ENABLE;
|
||||
EXTI_Peripheral_Initializes(&EXTI_InitSt);
|
||||
|
||||
VsyncApi_StopCap();
|
||||
}
|
||||
|
||||
|
||||
extern volatile uint16_t soc_spi1_checksum;
|
||||
extern volatile uint16_t soc_spi2_checksum;
|
||||
extern volatile uint8_t lock_ldm;
|
||||
|
||||
void EXTI9_5_IRQHandler(void)
|
||||
{
|
||||
if (((EXTI->PEND & EXTI_LINE8) != (uint32_t)RESET) && ((EXTI->IMASK & EXTI_LINE8) != (uint32_t)RESET))
|
||||
{
|
||||
EXTI->PEND = EXTI_LINE8;
|
||||
SpbApi_DosCapFunction();
|
||||
}
|
||||
if (((EXTI->PEND & EXTI_LINE9) != (uint32_t)RESET) && ((EXTI->IMASK & EXTI_LINE9) != (uint32_t)RESET))
|
||||
{
|
||||
EXTI_Flag_Status_Clear(EXTI_LINE9);
|
||||
soc_status.recv_cnt=0;
|
||||
soc_status.recv_cnt2=0;
|
||||
soc_status.flag=false;
|
||||
soc_status.flag2=false;
|
||||
soc_status.frame_len=0;
|
||||
soc_status.frame_len2=0;
|
||||
soc_status.recv_ing[0]=soc_data[0].bufa;
|
||||
soc_status.recv_done[0]=soc_data[0].bufb;
|
||||
soc_status.recv_ing[1]=soc_data[1].bufa;
|
||||
soc_status.recv_done[1]=soc_data[1].bufb;
|
||||
soc_spi1_checksum=0;
|
||||
soc_spi2_checksum=0;
|
||||
lock_ldm=1;
|
||||
SOcAPI_StartRecv(SOC_HEAD_LENGTH);
|
||||
}
|
||||
}
|
||||
|
||||
21
A5H_9225_8108_SPIV3.0/APP/vsync/VsyncApi.h
Normal file
21
A5H_9225_8108_SPIV3.0/APP/vsync/VsyncApi.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef __VSYNCAPI_H__
|
||||
#define __VSYNCAPI_H__
|
||||
|
||||
#include "hy9225.h"
|
||||
|
||||
//#define SYS_VSYNC_PORT GPIOB
|
||||
//#define SYS_VSYNC_PIN GPIO_PIN_9
|
||||
#define SYS_VSYNC_PORT GPIOC
|
||||
#define SYS_VSYNC_PIN GPIO_PIN_13
|
||||
|
||||
//#define VSYNC_PORT_SOURCE GPIOB_PORT_SOURCE
|
||||
//#define VSYNC_PIN_SOURCE GPIO_PIN_SOURCE9
|
||||
#define VSYNC_EXTI_LINE EXTI_LINE13
|
||||
|
||||
void VsyncApi_StartCap(void);
|
||||
void VsyncApi_StopCap(void);
|
||||
void VsyncApi_Init(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user