| M480 BSP V3.05.001 The Board Support Package for M480 Series

ccap.c
Go to the documentation of this file.
1 /**************************************************************************/
10 #include "NuMicro.h"
58 void CCAP_Open(uint32_t u32InFormat, uint32_t u32OutFormet)
59 {
60 CCAP->PAR = (CCAP->PAR & ~(0x000007BFUL)) | u32InFormat;
61 CCAP->CTL = (CCAP->CTL & ~(0x00000040UL)) | u32OutFormet;
62 }
63
79 void CCAP_SetCroppingWindow(uint32_t u32VStart,uint32_t u32HStart, uint32_t u32Height, uint32_t u32Width)
80 {
81 CCAP->CWSP = (CCAP->CWSP & ~(CCAP_CWSP_CWSADDRV_Msk | CCAP_CWSP_CWSADDRH_Msk))
82 | (((u32VStart << 16) | u32HStart));
83
84 CCAP->CWS = (CCAP->CWS & ~(CCAP_CWS_CWH_Msk | CCAP_CWS_CWW_Msk))
85 | ((u32Height << 16)| u32Width);
86 }
87
88
98 void CCAP_SetPacketBuf(uint32_t u32Address )
99 {
100 CCAP->PKTBA0 = u32Address;
101 CCAP->CTL |= CCAP_CTL_UPDATE_Msk;
102 }
103
109 void CCAP_Close(void)
110 {
111 CCAP->CTL &= ~CCAP_CTL_CCAPEN;
112 }
113
114
129 void CCAP_EnableInt(uint32_t u32IntMask)
130 {
131 CCAP->INT = (CCAP->INT & ~(CCAP_INT_VIEN_Msk | CCAP_INT_MEIEN_Msk | CCAP_INT_ADDRMIEN_Msk ) )
132 | u32IntMask;
133 }
134
150 void CCAP_DisableInt(uint32_t u32IntMask)
151 {
152 CCAP->INT = (CCAP->INT & ~(u32IntMask) ) ;
153 }
154
155
165 void CCAP_EnableMono(uint32_t u32Interface)
166 {
167 CCAP->CTL = (CCAP->CTL & ~CCAP_CTL_MY8_MY4) | CCAP_CTL_MONO_Msk |u32Interface;
168 }
169
176 void CCAP_DisableMono(void)
177 {
178 CCAP->CTL |= CCAP_CTL_MONO_Msk;
179 }
180
189 void CCAP_EnableLumaYOne(uint32_t u32th)
190 {
191 CCAP->CTL |= CCAP_CTL_Luma_Y_One_Msk;
192 CCAP->LUMA_Y1_THD = u32th & 0xff;
193 }
194
201 void CCAP_DisableLumaYOne(void)
202 {
203 CCAP->CTL &= ~CCAP_CTL_Luma_Y_One_Msk;
204 }
205
211 void CCAP_Start(void)
212 {
213 CCAP->CTL |= CCAP_CTL_CCAPEN;
214 }
215
226 void CCAP_Stop(uint32_t u32FrameComplete)
227 {
228 if(u32FrameComplete==FALSE)
229 CCAP->CTL &= ~CCAP_CTL_CCAPEN;
230 else
231 {
232 CCAP->CTL |= CCAP_CTL_SHUTTER_Msk;
233 while(CCAP_IS_STOPPED());
234 }
235 }
236
251 void CCAP_SetPacketScaling(uint32_t u32VNumerator, uint32_t u32VDenominator, uint32_t u32HNumerator, uint32_t u32HDenominator)
252 {
253 uint32_t u32NumeratorL, u32NumeratorH;
254 uint32_t u32DenominatorL, u32DenominatorH;
255
256 u32NumeratorL = u32VNumerator&0xFF;
257 u32NumeratorH=u32VNumerator>>8;
258 u32DenominatorL = u32VDenominator&0xFF;
259 u32DenominatorH = u32VDenominator>>8;
260 CCAP->PKTSL = (CCAP->PKTSL & ~(CCAP_PKTSL_PKTSVNL_Msk | CCAP_PKTSL_PKTSVML_Msk))
261 | ((u32NumeratorL << 24)| (u32DenominatorL << 16));
262 CCAP->PKTSM = (CCAP->PKTSM & ~(CCAP_PKTSM_PKTSVNH_Msk | CCAP_PKTSM_PKTSVMH_Msk))
263 | ((u32NumeratorH << 24) | (u32DenominatorH << 16));
264
265 u32NumeratorL = u32HNumerator&0xFF;
266 u32NumeratorH=u32HNumerator>>8;
267 u32DenominatorL = u32HDenominator&0xFF;
268 u32DenominatorH = u32HDenominator>>8;
269 CCAP->PKTSL = (CCAP->PKTSL & ~(CCAP_PKTSL_PKTSHNL_Msk | CCAP_PKTSL_PKTSHML_Msk))
270 | ((u32NumeratorL << 8)| u32DenominatorL);
271 CCAP->PKTSM = (CCAP->PKTSM & ~(CCAP_PKTSM_PKTSHNH_Msk | CCAP_PKTSM_PKTSHMH_Msk))
272 | ((u32NumeratorH << 8) | u32DenominatorH);
273 }
274
284 void CCAP_SetPacketStride(uint32_t u32Stride )
285 {
286 CCAP->STRIDE = (CCAP->STRIDE & ~CCAP_STRIDE_PKTSTRIDE_Msk) | u32Stride;
287 }
288
289 /* end of group CCAP_EXPORTED_FUNCTIONS */
291 /* end of group CCAP_Driver */
293 /* end of group Standard_Driver */
295
296 /*** (C) COPYRIGHT 2016 Nuvoton Technology Corp. ***/
CCAP_INT_ADDRMIEN_Msk
#define CCAP_INT_ADDRMIEN_Msk
Definition: ccap_reg.h:808
CCAP_CTL_CCAPEN
#define CCAP_CTL_CCAPEN
Definition: ccap.h:32
CCAP_Stop
void CCAP_Stop(uint32_t u32FrameComplete)
Stop Camera Capture Interface.
Definition: ccap.c:226
CCAP_EnableInt
void CCAP_EnableInt(uint32_t u32IntMask)
Set CCAP Interrupt.
Definition: ccap.c:129
CCAP_CWSP_CWSADDRH_Msk
#define CCAP_CWSP_CWSADDRH_Msk
Definition: ccap_reg.h:811
CCAP_SetPacketScaling
void CCAP_SetPacketScaling(uint32_t u32VNumerator, uint32_t u32VDenominator, uint32_t u32HNumerator, uint32_t u32HDenominator)
Set Packet Scaling Vertical and Horizontal Factor Register.
Definition: ccap.c:251
CCAP_CWS_CWW_Msk
#define CCAP_CWS_CWW_Msk
Definition: ccap_reg.h:817
CCAP_PKTSM_PKTSVNH_Msk
#define CCAP_PKTSM_PKTSVNH_Msk
Definition: ccap_reg.h:873
CCAP_Close
void CCAP_Close(void)
Close Camera Capture Interface.
Definition: ccap.c:109
CCAP_PKTSM_PKTSHNH_Msk
#define CCAP_PKTSM_PKTSHNH_Msk
Definition: ccap_reg.h:867
CCAP_PKTSL_PKTSHML_Msk
#define CCAP_PKTSL_PKTSHML_Msk
Definition: ccap_reg.h:822
CCAP
#define CCAP
Definition: M480.h:458
CCAP_Start
void CCAP_Start(void)
Start Camera Capture Interface.
Definition: ccap.c:211
CCAP_PKTSL_PKTSVML_Msk
#define CCAP_PKTSL_PKTSVML_Msk
Definition: ccap_reg.h:828
CCAP_CWS_CWH_Msk
#define CCAP_CWS_CWH_Msk
Definition: ccap_reg.h:819
CCAP_STRIDE_PKTSTRIDE_Msk
#define CCAP_STRIDE_PKTSTRIDE_Msk
Definition: ccap_reg.h:840
CCAP_SetPacketBuf
void CCAP_SetPacketBuf(uint32_t u32Address)
Set System Memory Packet Base Address0 Register.
Definition: ccap.c:98
NuMicro.h
NuMicro peripheral access layer header file.
CCAP_PKTSL_PKTSVNL_Msk
#define CCAP_PKTSL_PKTSVNL_Msk
Definition: ccap_reg.h:831
CCAP_SetPacketStride
void CCAP_SetPacketStride(uint32_t u32Stride)
Set Packet Frame Output Pixel Stride Width.
Definition: ccap.c:284
CCAP_DisableInt
void CCAP_DisableInt(uint32_t u32IntMask)
Disable CCAP Interrupt.
Definition: ccap.c:150
CCAP_CTL_MY8_MY4
#define CCAP_CTL_MY8_MY4
Definition: ccap.h:39
FALSE
#define FALSE
Boolean false, define to use in API parameters or return value.
Definition: M480.h:608
CCAP_IS_STOPPED
#define CCAP_IS_STOPPED()
Is CCAP module Enable.
Definition: ccap.h:108
CCAP_CWSP_CWSADDRV_Msk
#define CCAP_CWSP_CWSADDRV_Msk
Definition: ccap_reg.h:814
CCAP_CTL_MONO_Msk
#define CCAP_CTL_MONO_Msk
Definition: ccap_reg.h:736
CCAP_PKTSM_PKTSVMH_Msk
#define CCAP_PKTSM_PKTSVMH_Msk
Definition: ccap_reg.h:870
CCAP_INT_VIEN_Msk
#define CCAP_INT_VIEN_Msk
Definition: ccap_reg.h:802
CCAP_CTL_SHUTTER_Msk
#define CCAP_CTL_SHUTTER_Msk
Definition: ccap_reg.h:739
CCAP_PKTSL_PKTSHNL_Msk
#define CCAP_PKTSL_PKTSHNL_Msk
Definition: ccap_reg.h:825
CCAP_DisableLumaYOne
void CCAP_DisableLumaYOne(void)
Disable Luminance 8-bit Y to 1-bit Y Conversion.
Definition: ccap.c:201
CCAP_PKTSM_PKTSHMH_Msk
#define CCAP_PKTSM_PKTSHMH_Msk
Definition: ccap_reg.h:864
CCAP_EnableMono
void CCAP_EnableMono(uint32_t u32Interface)
Enable Monochrome CMOS Sensor.
Definition: ccap.c:165
CCAP_CTL_Luma_Y_One_Msk
#define CCAP_CTL_Luma_Y_One_Msk
Definition: ccap_reg.h:748
CCAP_EnableLumaYOne
void CCAP_EnableLumaYOne(uint32_t u32th)
Enable Luminance 8-bit Y to 1-bit Y Conversion.
Definition: ccap.c:189
CCAP_CTL_UPDATE_Msk
#define CCAP_CTL_UPDATE_Msk
Definition: ccap_reg.h:751
CCAP_SetCroppingWindow
void CCAP_SetCroppingWindow(uint32_t u32VStart, uint32_t u32HStart, uint32_t u32Height, uint32_t u32Width)
Set Cropping Window Starting Address and Size.
Definition: ccap.c:79
CCAP_Open
void CCAP_Open(uint32_t u32InFormat, uint32_t u32OutFormet)
Open engine clock and sensor clock.
Definition: ccap.c:58
CCAP_DisableMono
void CCAP_DisableMono(void)
Disable Monochrome CMOS Sensor.
Definition: ccap.c:176
CCAP_INT_MEIEN_Msk
#define CCAP_INT_MEIEN_Msk
Definition: ccap_reg.h:805