nu_cap.c 52 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520
  1. /**************************************************************************//**
  2. * @file cap.c
  3. * @version V1.00
  4. * @brief N9H30 CAP driver source file
  5. *
  6. * SPDX-License-Identifier: Apache-2.0
  7. * @copyright (C) 2018 Nuvoton Technology Corp. All rights reserved.
  8. *****************************************************************************/
  9. #include <stdio.h>
  10. #include <string.h>
  11. #include "N9H30.h"
  12. #include "nu_sys.h"
  13. #include "nu_cap.h"
  14. /** @addtogroup N9H30_Device_Driver N9H30 Device Driver
  15. @{
  16. */
  17. /** @addtogroup N9H30_CAP_Driver CAP Driver
  18. @{
  19. */
  20. /** @addtogroup N9H30_CAP_EXPORTED_FUNCTIONS CAP Exported Functions
  21. @{
  22. */
  23. /// @cond HIDDEN_SYMBOLS
  24. PFN_CAP_CALLBACK(pfnCAP_IntHandlerTable)[4] = {0};
  25. /// @endcond HIDDEN_SYMBOLS
  26. /**
  27. * @brief CAP interrupt Handler
  28. *
  29. * @param None
  30. *
  31. * @return None
  32. *
  33. * @details Driver internal use API to process the interrupt of CAP
  34. * As interrupt occurrence, the register call back function will be executed
  35. */
  36. static UINT32 u32EscapeFrame = 0;
  37. //static UINT32 g_u32DeviceType = 0;
  38. static void CAP_IntHandler(void)
  39. {
  40. UINT32 u32CapInt;
  41. UINT32 uBuf = 0;
  42. if ((inp32(REG_CLK_HCLKEN) & (0x1 << 26)) == (0x1 << 26)) /* CMOS sensor interface controller clock enabled */
  43. {
  44. u32CapInt = inp32(REG_CAP_INT);
  45. if ((u32CapInt & (VIEN | VINTF)) == (VIEN | VINTF))
  46. {
  47. if (pfnCAP_IntHandlerTable[0] != 0)
  48. pfnCAP_IntHandlerTable[0](uBuf, uBuf, u32EscapeFrame);
  49. outp32(REG_CAP_INT, (u32CapInt & ~(MDINTF | ADDRMINTF | MEINTF))); /* Clear Frame end interrupt */
  50. u32EscapeFrame = u32EscapeFrame + 1;
  51. }
  52. else if ((u32CapInt & (ADDRMIEN | ADDRMINTF)) == (ADDRMIEN | ADDRMINTF))
  53. {
  54. if (pfnCAP_IntHandlerTable[1] != 0)
  55. pfnCAP_IntHandlerTable[1](uBuf, uBuf, u32EscapeFrame);
  56. outp32(REG_CAP_INT, (u32CapInt & ~(MDINTF | VINTF | MEINTF))); /* Clear Address match interrupt */
  57. }
  58. else if ((u32CapInt & (MEIEN | MEINTF)) == (MEIEN | MEINTF))
  59. {
  60. if (pfnCAP_IntHandlerTable[2] != 0)
  61. pfnCAP_IntHandlerTable[2](uBuf, uBuf, u32EscapeFrame);
  62. outp32(REG_CAP_INT, (u32CapInt & ~(MDINTF | VINTF | ADDRMINTF))); /* Clear Memory error interrupt */
  63. }
  64. else if ((u32CapInt & (MDIEN | MDINTF)) == (MDIEN | MDINTF))
  65. {
  66. if (pfnCAP_IntHandlerTable[3] != 0)
  67. pfnCAP_IntHandlerTable[3](uBuf, uBuf, u32EscapeFrame);
  68. outp32(REG_CAP_INT, (u32CapInt & ~(VINTF | MEINTF | ADDRMINTF))); /* Clear Memory error interrupt */
  69. }
  70. }
  71. }
  72. /**
  73. * @brief Set Inital Frame
  74. *
  75. * @return None
  76. *
  77. * @details If enable interrupt, there is internal counter that records how many frames have pass.
  78. * Set the internal counters to zero. The internal counter may be not a constant
  79. */
  80. void CAP_SetInitFrame(void)
  81. {
  82. u32EscapeFrame = 0;
  83. }
  84. /**
  85. * @brief Get Inital Frame
  86. *
  87. * @retval >0 Internal counters
  88. *
  89. * @details If enable interrupt, there is internal counter that records how many frames have pass.
  90. * Get the internal counters. The internal counter may be not a constant
  91. */
  92. UINT32 CAP_GetSkipFrame(void)
  93. {
  94. return u32EscapeFrame;
  95. }
  96. /**
  97. * @brief CAP Initial
  98. *
  99. * @param[in] bIsEnableSnrClock Enable/Disable sensor clock
  100. * 1 : Enable
  101. * 0 : Disable
  102. * @param[in] eSnrSrc Set CAP clock source. Including :
  103. * - \ref eCAP_SNR_APLL
  104. * - \ref eCAP_SNR_UPLL
  105. * @param[in] u32SensorFreqKHz Specify the sensor clock
  106. *
  107. * @return None
  108. *
  109. * @details To Initial sensor source clock and frequency for CAP interface
  110. */
  111. void CAP_Init(BOOL bIsEnableSnrClock, E_CAP_SNR_SRC eSnrSrc, UINT32 u32SensorFreqKHz/*KHz unit*/)
  112. {
  113. UINT32 u32PllClock, u32SenDiv;// u32ExtFreq;
  114. UINT32 u32Div0, u32Div1;
  115. UINT32 u32SenSrc;
  116. volatile UINT32 u32Divider;
  117. /* MFP_GPI_L : I3=SEN_CLK0, I4=SEN_PCLK, I5=SEN_HSYNC, I6=SEN_VSYNC, I7=SEN_FIFLD*/
  118. outpw(REG_SYS_GPI_MFPL, (inpw(REG_SYS_GPI_MFPL) & (0x00000FFF)) | 0x33333000);
  119. /* MFP_GPI_H : SEN_PDATA[0~7]*/
  120. outpw(REG_SYS_GPI_MFPH, (inpw(REG_SYS_GPI_MFPH) & (0xFFFFFFFF)) | 0x33333333);
  121. u32SensorFreqKHz = u32SensorFreqKHz * 1000;
  122. switch (eSnrSrc)
  123. {
  124. case eCAP_SNR_APLL:
  125. u32PllClock = sysGetClock(SYS_APLL) * 1000000;
  126. u32SenSrc = 0x2 << 19; //APLL for sensor clock
  127. break;
  128. case eCAP_SNR_UPLL:
  129. u32PllClock = sysGetClock(SYS_UPLL) * 1000000;
  130. u32SenSrc = 0x3 << 19; //UPLL for sensor clock
  131. break;
  132. }
  133. u32SenDiv = u32PllClock / (u32SensorFreqKHz);
  134. if (u32PllClock % u32SensorFreqKHz != 0) u32SenDiv = u32SenDiv + 1;
  135. for (u32Div1 = 1; u32Div1 <= 16; u32Div1 = u32Div1 + 1)
  136. {
  137. for (u32Div0 = 1; u32Div0 <= 8; u32Div0 = u32Div0 + 1)
  138. if (u32SenDiv == u32Div0 * u32Div1) break;
  139. if (u32Div0 >= 9) continue;
  140. if (u32SenDiv == u32Div0 * u32Div1) break;
  141. }
  142. //sysprintf("Div0 and Div1 = %d, %d ", u32Div0, u32Div1);
  143. u32Div0 = u32Div0 - 1;
  144. u32Div1 = u32Div1 - 1;
  145. if (bIsEnableSnrClock)
  146. {
  147. outp32(REG_CLK_HCLKEN, inp32(REG_CLK_HCLKEN) | (1 << 27)); /* CMOS Sensor Reference Clock Output Enable */
  148. outp32(REG_CLK_HCLKEN, inp32(REG_CLK_HCLKEN) | (1 << 26)); /* CMOS Sensor Interface Controller Clock Enable */
  149. }
  150. else
  151. {
  152. outp32(REG_CLK_HCLKEN, inp32(REG_CLK_HCLKEN) & ~(1 << 27)); /* CMOS Sensor Reference Clock Output Disabled */
  153. outp32(REG_CLK_HCLKEN, inp32(REG_CLK_HCLKEN) & ~(1 << 26)); /* CMOS Sensor Interface Controller Clock Disabled */
  154. }
  155. u32Divider = u32SenSrc | ((u32Div0 << 16) | (u32Div1 << 24)) ;
  156. //sysprintf("Sensor Divider = 0x%08x\n", u32Divider);
  157. outp32(REG_CLK_DIVCTL3, (inp32(REG_CLK_DIVCTL3) & ~((0x3 << 19) | (0x7 << 16) | (0xF << 24))) | u32Divider);
  158. }
  159. /**
  160. * @brief CAP Open
  161. *
  162. * @param[in] u32SensorFreqKHz Specify the sensor clock
  163. *
  164. * @retval 0 Success
  165. * @retval <0 Error code
  166. *
  167. * @details Initialize the CAP engine. Register a call back for driver internal using
  168. */
  169. INT32 CAP_Open(UINT32 u32SensorFreqKHz)
  170. {
  171. UINT32 u32PllClock;// u32ExtFreq;
  172. UINT32 u32SenDiv;
  173. UINT32 u32Div0, u32Div1;
  174. UINT32 u32SenSrc;
  175. volatile UINT32 u32Divider;
  176. u32SensorFreqKHz = u32SensorFreqKHz * 1000;
  177. outp32(REG_CLK_PMCON, inpw(REG_CLK_PMCON) | (0x1 << 4)) ; /* Sensor clock keep on high level */
  178. outp32(REG_CLK_HCLKEN, inpw(REG_CLK_HCLKEN) | (0x1 << 26)); /* CMOS sensor interface controller clock enable */
  179. outp32(REG_SYS_AHBIPRST, inp32(REG_SYS_AHBIPRST) | (1 << 10)); /* Video capture (CMOS sensor interface) reset enable. */
  180. outp32(REG_SYS_AHBIPRST, inp32(REG_SYS_AHBIPRST) & ~(1 << 10)); /* Video capture (CMOS sensor interface) reset disable */
  181. switch ((inpw(REG_CLK_DIVCTL3) >> 19) & 0x3)
  182. {
  183. case eCAP_SNR_APLL:
  184. u32PllClock = sysGetClock(SYS_APLL) * 1000000;
  185. u32SenSrc = 0x2 << 19; //APLL for sensor clock
  186. break;
  187. case eCAP_SNR_UPLL:
  188. u32PllClock = sysGetClock(SYS_UPLL) * 1000000;
  189. u32SenSrc = 0x3 << 19; //APLL for sensor clock
  190. break;
  191. }
  192. u32SenDiv = u32PllClock / (u32SensorFreqKHz);
  193. if (u32PllClock % u32SensorFreqKHz != 0)
  194. u32SenDiv = u32SenDiv + 1;
  195. for (u32Div1 = 1; u32Div1 <= 16; u32Div1 = u32Div1 + 1)
  196. {
  197. for (u32Div0 = 1; u32Div0 <= 8; u32Div0 = u32Div0 + 1)
  198. {
  199. if (u32SenDiv == u32Div0 * u32Div1)
  200. break;
  201. }
  202. if (u32Div0 >= 9) continue;
  203. if (u32SenDiv == u32Div0 * u32Div1)
  204. break;
  205. }
  206. //sysprintf("Div0 and Div1 = %d, %d ", u32Div0, u32Div1);
  207. u32Div0 = u32Div0 - 1;
  208. u32Div1 = u32Div1 - 1;
  209. u32Divider = u32SenSrc | ((u32Div0 << 16) | (u32Div1 << 24)) ;
  210. //sysprintf("Sensor Divider = 0x%08x\n", u32Divider);
  211. outp32(REG_CLK_DIVCTL3, (inp32(REG_CLK_DIVCTL3) & ~((0x3 << 19) | (0x7 << 16) | (0xF << 24))) | u32Divider);
  212. sysInstallISR(IRQ_LEVEL_1, CAP_IRQn, (PVOID)CAP_IntHandler);
  213. sysEnableInterrupt(CAP_IRQn);
  214. return Successful;
  215. }
  216. /**
  217. * @brief videoIn Reset
  218. *
  219. * @return None
  220. *
  221. * @details Capture interface reset.
  222. */
  223. void CAP_Reset(void)
  224. {
  225. outp32(REG_CAP_CTL, inp32(REG_CAP_CTL) | (VPRST));
  226. outp32(REG_CAP_CTL, inp32(REG_CAP_CTL) & (~VPRST));
  227. }
  228. /**
  229. * @brief videoIn Close
  230. *
  231. * @return None
  232. *
  233. * @details Disable pin function,engine clock and interrupt
  234. */
  235. void CAP_Close(void)
  236. {
  237. // 1. Disable IP's interrupt
  238. sysDisableInterrupt(CAP_IRQn);
  239. // 2. Disable IP's clock
  240. outp32(REG_CLK_HCLKEN, inp32(REG_CLK_HCLKEN) & ~(0x1 << 25));
  241. CAP_Reset();
  242. outp32(REG_CLK_HCLKEN, inp32(REG_CLK_HCLKEN) & ~(0x1 << 26));
  243. // 3. Disable Capture pin function
  244. }
  245. /**
  246. * @brief Configure packet frame buffer.
  247. *
  248. * @param[in] bFrameSwitch Software mode buffer select
  249. * 0: Packet buffer 0
  250. * 1: Packet buffer 1
  251. * @return None
  252. *
  253. * @details This function set packet frame buffer control
  254. */
  255. void CAP_SetPacketFrameBufferControl(BOOL bFrameSwitch)
  256. {
  257. UINT32 u32Ctl;
  258. u32Ctl = inp32(REG_CAP_CTL) & ~(ADDRSW);
  259. outp32(REG_CAP_CTL, u32Ctl | (bFrameSwitch ? ADDRSW : 0));
  260. }
  261. /**
  262. * @brief Get packet frame buffer.
  263. *
  264. * @param pbFrameSwitch Software mode buffer select
  265. * 0: Packet buffer 0
  266. * 1: Packet buffer 1
  267. * @return None
  268. *
  269. * @details This function get packet frame buffer control
  270. */
  271. void CAP_GetPacketFrameBufferControl(PBOOL pbFrameSwitch)
  272. {
  273. UINT32 u32Ctl = inp32(REG_CAP_CTL);
  274. *pbFrameSwitch = (u32Ctl & ADDRSW) >> 3;
  275. }
  276. /**
  277. * @brief Configure callback function
  278. *
  279. * @param[in] eIntType Set interrupt type. Including :
  280. * - \ref eCAP_MDINTF
  281. * - \ref eCAP_ADDRMINTF
  282. * - \ref eCAP_MEINTF
  283. * - \ref eCAP_VINTF
  284. * @param[in] pfnCallback Set Callback function.
  285. * The callbakc function :
  286. * void (*PFN_CAP_CALLBACK)(UINT8 u8PacketBufID,UINT8 u8PlanarBufID, UINT8 u8FrameRate);
  287. * @param[in] pfnOldCallback Set Old callback function
  288. * The callbakc function :
  289. * void *(*PFN_CAP_CALLBACK)(UINT8 u8PacketBufID,UINT8 u8PlanarBufID, UINT8 u8FrameRate);
  290. * @retval 0 Success
  291. * @retval <0 Error code
  292. *
  293. * @details This function configure callback function and set trigger level
  294. */
  295. INT32 CAP_InstallCallback(E_CAP_INT_TYPE eIntType, PFN_CAP_CALLBACK pfnCallback, PFN_CAP_CALLBACK *pfnOldCallback)
  296. {
  297. if (eIntType == eCAP_VINTF)
  298. {
  299. *pfnOldCallback = pfnCAP_IntHandlerTable[0];
  300. pfnCAP_IntHandlerTable[0] = (PFN_CAP_CALLBACK)(pfnCallback);
  301. }
  302. else if (eIntType == eCAP_ADDRMINTF)
  303. {
  304. *pfnOldCallback = pfnCAP_IntHandlerTable[1];
  305. pfnCAP_IntHandlerTable[1] = (PFN_CAP_CALLBACK)(pfnCallback);
  306. }
  307. else if (eIntType == eCAP_MEINTF)
  308. {
  309. *pfnOldCallback = pfnCAP_IntHandlerTable[2];
  310. pfnCAP_IntHandlerTable[2] = (PFN_CAP_CALLBACK)(pfnCallback);
  311. }
  312. else if (eIntType == eCAP_MDINTF)
  313. {
  314. *pfnOldCallback = pfnCAP_IntHandlerTable[3];
  315. pfnCAP_IntHandlerTable[3] = (PFN_CAP_CALLBACK)(pfnCallback);
  316. }
  317. else
  318. return E_CAP_INVALID_INT;
  319. return Successful;
  320. }
  321. /**
  322. * @brief Enable videoIn interrupt.
  323. *
  324. * @param[in] eIntType Interrupt type. Incuding:
  325. * - \ref eCAP_MDINTF
  326. * - \ref eCAP_ADDRMINTF
  327. * - \ref eCAP_MEINTF
  328. * - \ref eCAP_VINTF
  329. * @retval 0 Success
  330. * @retval <0 Error code
  331. *
  332. * @details This function is used to enable videoIn interrupt.
  333. */
  334. INT32 CAP_EnableInt(E_CAP_INT_TYPE eIntType)
  335. {
  336. switch (eIntType)
  337. {
  338. case eCAP_MDINTF:
  339. case eCAP_ADDRMINTF:
  340. case eCAP_MEINTF:
  341. case eCAP_VINTF:
  342. outp32(REG_CAP_INT, inp32(REG_CAP_INT) | eIntType);
  343. break;
  344. default:
  345. return E_CAP_INVALID_INT;
  346. }
  347. return Successful;
  348. }
  349. /**
  350. * @brief Disable videoIn interrupt
  351. *
  352. * @param[in] eIntType Interrupt type. Incuding:
  353. * - \ref eCAP_MDINTF
  354. * - \ref eCAP_ADDRMINTF
  355. * - \ref eCAP_MEINTF
  356. * - \ref eCAP_VINTF
  357. * @retval 0 Success
  358. * @retval <0 Error code
  359. *
  360. * @details This function is used to disable videoIn interrupt.
  361. */
  362. INT32 CAP_DisableInt(E_CAP_INT_TYPE eIntType)
  363. {
  364. switch (eIntType)
  365. {
  366. case eCAP_MDINTF:
  367. case eCAP_ADDRMINTF:
  368. case eCAP_MEINTF:
  369. case eCAP_VINTF:
  370. outp32(REG_CAP_INT, inp32(REG_CAP_INT) & ~eIntType);
  371. break;
  372. default:
  373. return E_CAP_INVALID_INT;
  374. }
  375. return Successful;
  376. }
  377. /**
  378. * @brief Check videoIn interrupt
  379. *
  380. * @param[in] eIntType Interrupt type. Incuding:
  381. * - \ref eCAP_MDINTF
  382. * - \ref eCAP_ADDRMINTF
  383. * - \ref eCAP_MEINTF
  384. * - \ref eCAP_VINTF
  385. * @retval 1 Enable
  386. * @retval 0 Disable
  387. *
  388. * @details This function is used to check videoIn interrupt.
  389. */
  390. BOOL CAP_IsIntEnabled(E_CAP_INT_TYPE eIntType)
  391. {
  392. UINT32 u32IntEnable = inp32(REG_CAP_INT);
  393. switch (eIntType)
  394. {
  395. case eCAP_MDINTF:
  396. u32IntEnable = u32IntEnable & eCAP_MDINTF;
  397. break;
  398. case eCAP_ADDRMINTF:
  399. u32IntEnable = u32IntEnable & eCAP_ADDRMINTF;
  400. break;
  401. case eCAP_MEINTF:
  402. u32IntEnable = u32IntEnable & eCAP_MEINTF;
  403. break;
  404. case eCAP_VINTF:
  405. u32IntEnable = u32IntEnable & eCAP_VINTF;
  406. break;
  407. }
  408. return (u32IntEnable ? TRUE : FALSE);
  409. }
  410. /**
  411. * @brief Clear videoIn interrupt flag.
  412. *
  413. * @param[in] eIntType Interrupt type. Incuding:
  414. * - \ref eCAP_MDINTF
  415. * - \ref eCAP_ADDRMINTF
  416. * - \ref eCAP_MEINTF
  417. * - \ref eCAP_VINTF
  418. * @retval 0 Success
  419. * @retval <0 Error code
  420. *
  421. * @details This function is used to clear videoIn interrupt flag.
  422. */
  423. INT32 CAP_ClearInt(E_CAP_INT_TYPE eIntType)
  424. {
  425. UINT32 u32IntChannel = eIntType >> 16;
  426. switch (eIntType)
  427. {
  428. case eCAP_MDINTF:
  429. outp32(REG_CAP_INT, (inp32(REG_CAP_INT) & ~((eCAP_ADDRMINTF | eCAP_MEINTF | eCAP_VINTF) >> 16)) |
  430. u32IntChannel);
  431. break;
  432. case eCAP_ADDRMINTF:
  433. outp32(REG_CAP_INT, (inp32(REG_CAP_INT) & ~((eCAP_MDINTF | eCAP_MEINTF | eCAP_VINTF) >> 16)) |
  434. u32IntChannel);
  435. break;
  436. case eCAP_MEINTF:
  437. outp32(REG_CAP_INT, (inp32(REG_CAP_INT) & ~((eCAP_MDINTF | eCAP_ADDRMINTF | eCAP_VINTF) >> 16)) |
  438. u32IntChannel);
  439. break;
  440. case eCAP_VINTF:
  441. outp32(REG_CAP_INT, (inp32(REG_CAP_INT) & ~((eCAP_MDINTF | eCAP_MEINTF | eCAP_ADDRMINTF) >> 16)) |
  442. u32IntChannel);
  443. break;
  444. default:
  445. return E_CAP_INVALID_INT;
  446. }
  447. return Successful;
  448. }
  449. /**
  450. * @brief Polling videoIn interrupt flag.
  451. *
  452. * @param[in] eIntType Interrupt type. Incuding:
  453. * - \ref eCAP_MDINTF
  454. * - \ref eCAP_ADDRMINTF
  455. * - \ref eCAP_MEINTF
  456. * - \ref eCAP_VINTF
  457. * @retval 0 Success
  458. * @retval <0 Error code
  459. *
  460. * @details This function is used to poll videoIn interrupt flag.
  461. */
  462. BOOL CAP_PollInt(E_CAP_INT_TYPE eIntType)
  463. {
  464. UINT32 u32IntStatus = inp32(REG_CAP_INT);
  465. switch (eIntType)
  466. {
  467. case eCAP_MDINTF:
  468. u32IntStatus = u32IntStatus & (eCAP_MDINTF >> 16);
  469. break;
  470. case eCAP_ADDRMINTF:
  471. u32IntStatus = u32IntStatus & (eCAP_ADDRMINTF >> 16);
  472. break;
  473. case eCAP_MEINTF:
  474. u32IntStatus = u32IntStatus & (eCAP_MEINTF >> 16);
  475. break;
  476. case eCAP_VINTF:
  477. u32IntStatus = u32IntStatus & (eCAP_VINTF >> 16);
  478. break;
  479. }
  480. return (u32IntStatus ? TRUE : FALSE);
  481. }
  482. /**
  483. * @brief Enable engine clock and turn on the pipe.
  484. *
  485. * @param[in] bEngEnable Enable engine clock.
  486. * 1 : Enable engine clock.
  487. * 0 : Disable engine clock.
  488. * @param[in] ePipeEnable Enable pipe type. Incuding:
  489. * - \ref eCAP_BOTH_PIPE_DISABLE
  490. * - \ref eCAP_PLANAR
  491. * - \ref eCAP_PACKET
  492. * - \ref eCAP_BOTH_PIPE_ENABLE
  493. * @retval 0 Success
  494. * @retval <0 Error code
  495. *
  496. * @details This function is used to enable engine clock and pipe type.
  497. */
  498. void CAP_SetPipeEnable(
  499. BOOL bEngEnable,
  500. E_CAP_PIPE ePipeEnable
  501. )
  502. {
  503. outp32(REG_CAP_CTL, (inp32(REG_CAP_CTL) & ~(CAPEN | PKTEN | PLNEN))
  504. | (((bEngEnable ? CAPEN : 0x0))
  505. // | ((ePipeEnable & ~(PKTEN | PLNEN))<<5)) );
  506. | ((ePipeEnable & 0x03) << 5)));
  507. } // DrvVideoIn_SetPipeEnable
  508. /**
  509. * @brief Get engine clock and pipe type.
  510. *
  511. * @param[out] pbEngEnable Enable engine clock.
  512. * 1 : Enable engine clock.
  513. * 0 : Disable engine clock.
  514. * @param[out] pePipeEnable Pipe type. Incuding:
  515. * - \ref eCAP_BOTH_PIPE_DISABLE
  516. * - \ref eCAP_PLANAR
  517. * - \ref eCAP_PACKET
  518. * - \ref eCAP_BOTH_PIPE_ENABLE
  519. * @return None
  520. *
  521. * @details This function is used to get engin clock and pipe type.
  522. */
  523. void CAP_GetPipeEnable(PBOOL pbEngEnable, E_CAP_PIPE *pePipeEnable)
  524. {
  525. UINT32 u32Temp = inp32(REG_CAP_CTL);
  526. *pbEngEnable = (u32Temp & CAPEN) ? TRUE : FALSE;
  527. *pePipeEnable = (E_CAP_PIPE)((u32Temp & (PKTEN | PLNEN)) >> 5);
  528. } // DrvVideoIn_GetPipeEnable
  529. /**
  530. * @brief Set Shadow(Update) Register
  531. *
  532. * @details This function is used to reload frame buffer address after
  533. * setting shoaw(update) register.
  534. */
  535. void CAP_SetShadowRegister(void)
  536. {
  537. outp32(REG_CAP_CTL, inp32(REG_CAP_CTL) | UPDATE);
  538. } // DrvVideoIn_SetShadowRegister
  539. /**
  540. * @brief Set sensor polarity.
  541. *
  542. * @param[in] bVsync Sensor Vsync Polarity.
  543. * 1 : High Active
  544. * 0 : Low Active
  545. * @param[in] bHsync Sensor Hsync Polarity.
  546. * 1 : High Active
  547. * 0 : Low Active
  548. * @param[in] bPixelClk Sensor Vsync Polarity.
  549. * 1 : Falling Edge
  550. * 0 : Rising Edig
  551. * @return None
  552. *
  553. * @details This function is used to set sensor polarity.
  554. */
  555. void CAP_SetSensorPolarity(BOOL bVsync, BOOL bHsync, BOOL bPixelClk)
  556. {
  557. UINT32 u32Polarity, u32RegVal;
  558. u32RegVal = inp32(REG_CAP_PAR);
  559. //sysprintf("Enter Register addr = 0x%x\n", (REG_CAP_PAR));
  560. //sysprintf("Enter Register value = 0x%x\n", u32RegVal);
  561. u32Polarity = (((bVsync ? VSP : 0x0) | (bHsync ? HSP : 0x0)) | (bPixelClk ? PCLKP : 0x0));
  562. u32RegVal = (inp32(REG_CAP_PAR) & ~(VSP | HSP | PCLKP)) ;
  563. //sysprintf("REG_VPEPAR = 0x%x", (u32RegVal | u32Polarity));
  564. outp32((REG_CAP_PAR), (u32RegVal | u32Polarity));
  565. }
  566. /**
  567. * @brief Get sensor polarity.
  568. *
  569. * @param[out] pbVsync Sensor Vsync Polarity.
  570. * 1 : High Active
  571. * 0 : Low Active
  572. * @param[out] pbHsync Sensor Hsync Polarity.
  573. * 1 : High Active
  574. * 0 : Low Active
  575. * @param[out] pbPixelClk Sensor Vsync Polarity.
  576. * 1 : Falling Edge
  577. * 0 : Rising Edig
  578. * @return None
  579. *
  580. * @details This function is used to get sensor polarity.
  581. */
  582. void CAP_GetSensorPolarity(PBOOL pbVsync, PBOOL pbHsync, PBOOL pbPixelClk)
  583. {
  584. UINT32 u32Temp = inp32(REG_CAP_PAR);
  585. *pbVsync = (u32Temp & VSP) ? TRUE : FALSE;
  586. *pbHsync = (u32Temp & HSP) ? TRUE : FALSE;
  587. *pbPixelClk = (u32Temp & PCLKP) ? TRUE : FALSE;
  588. }
  589. /**
  590. * @brief Set data format and order.
  591. *
  592. * @param[in] eInputOrder Data order for input format.Including :
  593. * - \ref eCAP_IN_UYVY = Y0 U0 Y1 V0
  594. * - \ref eCAP_IN_YUYV = Y0 V0 Y1 U0
  595. * - \ref eCAP_IN_VYUY = U0 Y0 V0 Y1
  596. * - \ref eCAP_IN_YVYU = V0 Y0 U0 Y1
  597. * @param[in] eInputFormat Input data format.Including :
  598. * - \ref eCAP_IN_YUV422
  599. * - \ref eCAP_IN_RGB565
  600. * @param[in] eOutputFormat Sensor Vsync Polarity.Including :
  601. * - \ref eCAP_OUT_YUV422 = YCbCr422
  602. * - \ref eCAP_OUT_ONLY_Y = only output Y
  603. * - \ref eCAP_OUT_RGB555 = rgb555
  604. * - \ref eCAP_OUT_RGB565 = rgb565
  605. * @return None
  606. *
  607. * @details This function is used to set data format and order.
  608. */
  609. void CAP_SetDataFormatAndOrder(E_CAP_ORDER eInputOrder, E_CAP_IN_FORMAT eInputFormat, E_CAP_OUT_FORMAT eOutputFormat)
  610. {
  611. outp32((REG_CAP_PAR), (inp32(REG_CAP_PAR) & ~(OUTFMT | INDATORD | INFMT))
  612. | ((((eInputOrder << 2) & INDATORD)
  613. | (eInputFormat & INFMT))
  614. | ((eOutputFormat << 4) & OUTFMT)));
  615. } // DrvVideoIn_SetDataFormatAndOrder
  616. /**
  617. * @brief Get data format and order.
  618. *
  619. * @param[out] peInputOrder Data order for input format.Including :
  620. * - \ref eCAP_IN_UYVY
  621. * - \ref eCAP_IN_YUYV
  622. * - \ref eCAP_IN_VYUY
  623. * - \ref eCAP_IN_YVYU
  624. * @param[out] peInputFormat Input data format.Including :
  625. * - \ref eCAP_IN_YUV422
  626. * - \ref eCAP_IN_RGB565
  627. * @param[out] peOutputFormat Sensor Vsync Polarity.Including :
  628. * - \ref eCAP_OUT_YUV422 = YCbCr422
  629. * - \ref eCAP_OUT_ONLY_Y = only output Y
  630. * - \ref eCAP_OUT_RGB555 = rgb555
  631. * - \ref eCAP_OUT_RGB565 = rgb565
  632. * @return None
  633. *
  634. * @details This function is used to get data format and order.
  635. */
  636. void CAP_GetDataFormatAndOrder(E_CAP_ORDER *peInputOrder, E_CAP_IN_FORMAT *peInputFormat, E_CAP_OUT_FORMAT *peOutputFormat)
  637. {
  638. UINT32 u32Temp = inp32(REG_CAP_PAR);
  639. *peInputOrder = (E_CAP_ORDER)((u32Temp & INDATORD) >> 2);
  640. *peInputFormat = (E_CAP_IN_FORMAT)(u32Temp & INFMT);
  641. *peOutputFormat = (E_CAP_OUT_FORMAT)((u32Temp & OUTFMT) >> 4);
  642. }
  643. /**
  644. * @brief Set planar format.
  645. *
  646. * @param[in] ePlanarFmt Data order for input format.Including :
  647. * - \ref eCAP_PLANAR_YUV422
  648. * - \ref eCAP_PLANAR_YUV420
  649. * @return None
  650. *
  651. * @details This function is used to set planar format.
  652. */
  653. void CAP_SetPlanarFormat(E_CAP_PLANAR_FORMAT ePlanarFmt)
  654. {
  655. switch (ePlanarFmt)
  656. {
  657. case eCAP_PLANAR_YUV422:
  658. outp32((REG_CAP_PAR), (inp32(REG_CAP_PAR) & ~(PLNFMT)));
  659. break;
  660. case eCAP_PLANAR_YUV420:
  661. outp32((REG_CAP_PAR), ((inp32(REG_CAP_PAR) | (PLNFMT))));
  662. break;
  663. }
  664. }
  665. /**
  666. * @brief Get planar format.
  667. *
  668. * @retval - \ref eCAP_PLANAR_YUV422 : Planar format is YUV420.
  669. * @retval - \ref eCAP_PLANAR_YUV420 : Planar format is YUV422.
  670. *
  671. * @details This function is used to get planar format.
  672. */
  673. BOOL CAP_GetPlanarFormat(void)
  674. {
  675. return ((inp32(REG_CAP_PAR) & PLNFMT) >> 7);
  676. }
  677. /**
  678. * @brief Set motion detection parameter.
  679. *
  680. * @param[in] bEnable Enable Motion Detection.Including :
  681. * 0 : Disable motion detection.
  682. * 1 : Enable motion detection.
  683. * @param[in] bBlockSize Motion Detection Block Size.Including :
  684. * 0 : Block size is set to 16x16.
  685. * 1 : Block size is set to 8x8.
  686. * @param[in] bSaveMode Motion Detection Save Mode.Including :
  687. * 0 : 1 bit DIFF + 7 Y Differential.
  688. * 1 : 1 bit DIFF only.
  689. * @return None
  690. *
  691. * @details This function is used to set motion detection parameter.
  692. */
  693. void CAP_SetMotionDet(BOOL bEnable, BOOL bBlockSize, BOOL bSaveMode)
  694. {
  695. outp32(REG_CAP_MD, (inp32(REG_CAP_MD) & ~(MDSM | MDBS | MDEN)) |
  696. (((bEnable ? MDEN : 0) | (bBlockSize ? MDBS : 0)) |
  697. (bSaveMode ? MDSM : 0)));
  698. }
  699. /**
  700. * @brief Get motion detection parameter.
  701. *
  702. * @param[out] pbEnable Enable Motion Detection.Including :
  703. * 0 : Disable motion detection.
  704. * 1 : Enable motion detection.
  705. * @param[out] pbBlockSize Motion Detection Block Size.Including :
  706. * 0 : Block size is set to 16x16.
  707. * 1 : Block size is set to 8x8.
  708. * @param[out] pbSaveMode Motion Detection Save Mode.Including :
  709. * 0 : 1 bit DIFF + 7 Y Differential.
  710. * 1 : 1 bit DIFF only.
  711. * @return None
  712. *
  713. * @details This function is used to get motion detection parameter.
  714. */
  715. void CAP_GetMotionDet(PBOOL pbEnable, PBOOL pbBlockSize, PBOOL pbSaveMode)
  716. {
  717. UINT32 u32RegData = inp32(REG_CAP_MD);
  718. *pbEnable = (u32RegData & MDEN);
  719. *pbBlockSize = (u32RegData & MDBS) >> 8;
  720. *pbSaveMode = (u32RegData & MDSM) >> 9;
  721. }
  722. /**
  723. * @brief Set motion detection parameter externtion.
  724. *
  725. * @param[in] u32DetFreq Motion Detection frequency.Including :
  726. * 0 : Each frame
  727. * 1 : Every 2 frame
  728. * 2 : Every 3 frame
  729. * 3 : Every 4 frame
  730. * @param[in] u32Threshold Motion detection threshold.It should be 0~31.
  731. *
  732. * @param[in] u32OutBuffer Motion Detection Output Address Register.(Word Alignment)
  733. *
  734. * @param[in] u32LumBuffer Motion Detection Temp Y Output Address Register.(Word Alignment)
  735. *
  736. * @return None
  737. *
  738. * @details This function is used to set motion detection parameter externtion.
  739. */
  740. void CAP_SetMotionDetEx(UINT32 u32DetFreq, UINT32 u32Threshold, UINT32 u32OutBuffer, UINT32 u32LumBuffer)
  741. {
  742. outp32(REG_CAP_MD, (inp32(REG_CAP_MD) & ~MDDF) | ((u32DetFreq << 10) & MDDF));
  743. outp32(REG_CAP_MD, (inp32(REG_CAP_MD) & ~MDTHR) | ((u32Threshold << 16) & MDTHR));
  744. outp32(REG_CAP_MDADDR, u32OutBuffer);
  745. outp32(REG_CAP_MDYADDR, u32LumBuffer);
  746. }
  747. /**
  748. * @brief Get motion detection parameter externtion.
  749. *
  750. * @param[out] pu32DetFreq Motion Detection frequency.Including :
  751. * 0 : Each frame
  752. * 1 : Every 2 frame
  753. * 2 : Every 3 frame
  754. * 3 : Every 4 frame
  755. * @param[out] pu32Threshold Motion detection threshold.It should be 0~31.
  756. *
  757. * @param[out] pu32OutBuffer Motion Detection Output Address Register.(Word Alignment)
  758. *
  759. * @param[out] pu32LumBuffer Motion Detection Temp Y Output Address Register.(Word Alignment)
  760. *
  761. * @return None
  762. *
  763. * @details This function is used to get motion detection parameter externtion.
  764. */
  765. void CAP_GetMotionDetEx(PUINT32 pu32DetFreq, PUINT32 pu32Threshold, PUINT32 pu32OutBuffer, PUINT32 pu32LumBuffer)
  766. {
  767. UINT32 u32RegData;
  768. u32RegData = inp32(REG_CAP_MD);
  769. *pu32DetFreq = u32RegData & MDDF;
  770. *pu32Threshold = u32RegData & MDTHR;
  771. *pu32OutBuffer = inp32(REG_CAP_MDADDR);
  772. *pu32LumBuffer = inp32(REG_CAP_MDYADDR);
  773. }
  774. /**
  775. * @brief Set motion detection frequency.
  776. *
  777. * @param[in] u32DetFreq Motion Detection frequency.Including :
  778. * 0 : Each frame
  779. * 1 : Every 2 frame
  780. * 2 : Every 3 frame
  781. * 3 : Every 4 frame
  782. * @return None
  783. *
  784. * @details This function is used to set motion detection frequency.
  785. */
  786. void CAP_SetMotionDetFreq(UINT32 u32DetFreq)
  787. {
  788. outp32(REG_CAP_MD, (inp32(REG_CAP_MD) & ~MDDF) |
  789. ((u32DetFreq << 10) & MDDF));
  790. }
  791. /**
  792. * @brief Get motion detection frequency.
  793. *
  794. * @param[out] pu32DetFreq Motion Detection frequency.Including :
  795. * 0 : Each frame
  796. * 1 : Every 2 frame
  797. * 2 : Every 3 frame
  798. * 3 : Every 4 frame
  799. * @return None
  800. *
  801. * @details This function is used to get motion detection frequency.
  802. */
  803. void CAP_GetMotionDetFreq(PUINT32 pu32DetFreq)
  804. {
  805. UINT32 u32RegData;
  806. u32RegData = inp32(REG_CAP_MD);
  807. *pu32DetFreq = u32RegData & MDDF;
  808. }
  809. /**
  810. * @brief Set One shutte or continuous mode.
  811. *
  812. * @param[in] bIsOneSutterMode Enable One shutte.Including :
  813. * 1 : Enable One shutte mode.
  814. * 0 : Disable One shutte mode.
  815. * @return None
  816. *
  817. * @details This function is used to set one shutte or continuous mode.
  818. * Image capture interface automatically disable the capture
  819. * inteface after a frame bad been captured.
  820. */
  821. void CAP_SetOperationMode(BOOL bIsOneSutterMode)
  822. {
  823. outp32(REG_CAP_CTL, (inp32(REG_CAP_CTL) & ~SHUTTER) |
  824. ((bIsOneSutterMode << 16) & SHUTTER));
  825. } // DrvVideoIn_SetOperationMode
  826. /**
  827. * @brief Get One shutte or continuous mode.
  828. *
  829. * @retval 1 : Disable one shutte mode
  830. * @retval 0 : Enable one shutte mode
  831. *
  832. * @details This function is used to get one shutte or continuous mode.
  833. * Image capture interface automatically disable the capture
  834. * inteface after a frame bad been captured.
  835. */
  836. BOOL CAP_GetOperationMode(void)
  837. {
  838. return ((inp32(REG_CAP_CTL) & SHUTTER) ? TRUE : FALSE);
  839. } // DrvVideoIn_GetOperationMode
  840. /**
  841. * @brief Get packet/planar processed data count.
  842. *
  843. * @param[in] ePipe Pipe type. Including :
  844. * - \ref eCAP_PACKET
  845. * - \ref eCAP_PLANAR
  846. *
  847. * @return Get current packet/planar processed data count.
  848. *
  849. * @details This function is used to get packet/planar processed data count.
  850. */
  851. UINT32 CAP_GetProcessedDataCount(E_CAP_PIPE ePipe)
  852. {
  853. if (ePipe == eCAP_PACKET)
  854. return inp32(REG_CAP_CURADDRP); /* Packet pipe */
  855. else if (ePipe == eCAP_PLANAR)
  856. return inp32(REG_CAP_CURADDRY); /* Planar pipe */
  857. else
  858. return 0;
  859. }
  860. /**
  861. * @brief Set cropping window vertical/horizontal starting address.
  862. *
  863. * @param[in] u32VerticalStart Cropping window vertical starting address.
  864. * @param[in] u32HorizontalStart Cropping window horizontal starting address.
  865. *
  866. * @return None.
  867. *
  868. * @details This function is used to set cropping window vertical/horizontal starting address.
  869. */
  870. void CAP_SetCropWinStartAddr(UINT32 u32VerticalStart, UINT32 u32HorizontalStart)
  871. {
  872. outp32(REG_CAP_CWSP, (inp32(REG_CAP_CWSP) & ~(CWSADDRV | CWSADDRH)) //(Y|X)
  873. | ((u32VerticalStart << 16)
  874. | u32HorizontalStart));
  875. }
  876. /**
  877. * @brief Get cropping window vertical/horizontal starting address.
  878. *
  879. * @param[out] pu32VerticalStart Cropping window vertical starting address.
  880. * @param[out] pu32HorizontalStart Cropping window horizontal starting address.
  881. *
  882. * @return None.
  883. *
  884. * @details This function is used to get cropping window vertical/horizontal starting address.
  885. */
  886. void CAP_GetCropWinStartAddr(PUINT32 pu32VerticalStart, PUINT32 pu32HorizontalStart)
  887. {
  888. UINT32 u32Temp = inp32(REG_CAP_CWSP);
  889. *pu32VerticalStart = (u32Temp & CWSADDRV) >> 16;
  890. *pu32HorizontalStart = u32Temp & CWSADDRH;
  891. }
  892. /**
  893. * @brief Set cropping window size.
  894. *
  895. * @param[in] u32Width Cropping window width.
  896. * @param[in] u32Height Cropping window heigh.
  897. *
  898. * @return None.
  899. *
  900. * @details This function is used to set cropping window size.
  901. */
  902. void CAP_SetCropWinSize(UINT32 u32Height, UINT32 u32Width)
  903. {
  904. outp32(REG_CAP_CWS, (inp32(REG_CAP_CWS) & ~(CWH | CWW))
  905. | ((u32Height << 16)
  906. | u32Width));
  907. }
  908. /**
  909. * @brief Get cropping window size.
  910. *
  911. * @param[out] pu32Width Cropping window width.
  912. * @param[out] pu32Height Cropping window heigh.
  913. *
  914. * @return None.
  915. *
  916. * @details This function is used to get cropping window size.
  917. */
  918. void CAP_GetCropWinSize(PUINT32 pu32Height, PUINT32 pu32Width)
  919. {
  920. UINT32 u32Temp = inp32(REG_CAP_CWS);
  921. *pu32Height = (u32Temp & CWH) >> 16;
  922. *pu32Width = u32Temp & CWW;
  923. }
  924. /**
  925. * @brief Set packet/planar scaling vertical factor.
  926. *
  927. * @param[in] ePipe Pipe type.Including.
  928. * - \ref eCAP_PACKET.
  929. * - \ref eCAP_PLANAR.
  930. * @param[in] u16Numerator Scaling Vertical Factor N.
  931. * @param[in] u16Denominator Scaling Vertical Factor M.
  932. *
  933. * @retval 0 Success
  934. * @retval <0 Error code
  935. *
  936. * @details This function is used to set packet/planar scaling vertical factor.
  937. * The output image width will be equal to the image width * N/M.
  938. * Note: The value of N must be equal to or less than M
  939. */
  940. INT32 CAP_SetVerticalScaleFactor(E_CAP_PIPE ePipe, UINT16 u16Numerator, UINT16 u16Denominator)
  941. {
  942. UINT8 u8NumeratorL = u16Numerator & 0xFF, u8NumeratorH = u16Numerator >> 8;
  943. UINT8 u8DenominatorL = u16Denominator & 0xFF, u8DenominatorH = u16Denominator >> 8;
  944. if (ePipe == eCAP_PACKET)
  945. {
  946. outp32(REG_CAP_PKTSL, (inp32(REG_CAP_PKTSL) & ~(PKTSVNL | PKTSVML))
  947. | ((u8NumeratorL << 24)
  948. | (u8DenominatorL << 16)));
  949. outp32(REG_CAP_PKTSM, (inp32(REG_CAP_PKTSM) & ~(PKTSHMH | PKTSVMH))
  950. | ((u8NumeratorH << 24)
  951. | (u8DenominatorH << 16)));
  952. }
  953. else if (ePipe == eCAP_PLANAR)
  954. {
  955. outp32(REG_CAP_PLNSL, (inp32(REG_CAP_PLNSL) & ~(PKTSVNL | PKTSVML))
  956. | ((u8NumeratorL << 24)
  957. | (u8DenominatorL << 16)));
  958. outp32(REG_CAP_PLNSM, (inp32(REG_CAP_PLNSM) & ~(PKTSHMH | PKTSVMH))
  959. | ((u8NumeratorH << 24)
  960. | (u8DenominatorH << 16)));
  961. }
  962. else
  963. return E_CAP_INVALID_PIPE;
  964. return Successful;
  965. }
  966. /**
  967. * @brief Get packet/planar scaling vertical factor.
  968. *
  969. * @param[in] ePipe Pipe type.Including.
  970. * - \ref eCAP_PACKET.
  971. * - \ref eCAP_PLANAR.
  972. * @param[out] pu16Numerator Scaling Vertical Factor N.
  973. * @param[out] pu16Denominator Scaling Vertical Factor M.
  974. *
  975. * @retval 0 Success
  976. * @retval <0 Error code
  977. *
  978. * @details This function is used to get packet/planar scaling vertical factor.
  979. * The output image width will be equal to the image width * N/M.
  980. * Note: The value of N must be equal to or less than M
  981. */
  982. INT32 DrvCAP_GetVerticalScaleFactor(E_CAP_PIPE ePipe, PUINT16 pu16Numerator, PUINT16 pu16Denominator)
  983. {
  984. UINT32 u32Temp1, u32Temp2;
  985. if (ePipe == eCAP_PACKET)
  986. {
  987. u32Temp1 = inp32(REG_CAP_PKTSL);
  988. u32Temp2 = inp32(REG_CAP_PKTSM);
  989. }
  990. else if (ePipe == eCAP_PLANAR)
  991. {
  992. u32Temp1 = inp32(REG_CAP_PLNSL);
  993. u32Temp2 = inp32(REG_CAP_PLNSM);
  994. }
  995. else
  996. return E_CAP_INVALID_PIPE;
  997. *pu16Numerator = ((u32Temp1 & PKTSVNL) >> 24) | (((u32Temp2 & PKTSHMH) >> 24) << 8);
  998. *pu16Denominator = (u32Temp1 & PKTSVML) >> 16 | (((u32Temp2 & PKTSVMH) >> 16) << 8);
  999. return Successful;
  1000. }
  1001. /**
  1002. * @brief Set packet/planar scaling horizontal factor.
  1003. *
  1004. * @param[in] bPipe Pipe type.Including.
  1005. * - \ref eCAP_PACKET.
  1006. * - \ref eCAP_PLANAR.
  1007. * @param[in] u16Numerator Scaling Horizontal Factor N.
  1008. * @param[in] u16Denominator Scaling Horizontal Factor M.
  1009. *
  1010. * @retval 0 Success
  1011. * @retval <0 Error code
  1012. *
  1013. * @details This function is used to set packet/planar scaling horizontal factor.
  1014. * The output image width will be equal to the image width * N/M.
  1015. * Note: The value of N must be equal to or less than M
  1016. */
  1017. INT32 CAP_SetHorizontalScaleFactor(E_CAP_PIPE bPipe, UINT16 u16Numerator, UINT16 u16Denominator)
  1018. {
  1019. UINT8 u8NumeratorL = u16Numerator & 0xFF, u8NumeratorH = u16Numerator >> 8;
  1020. UINT8 u8DenominatorL = u16Denominator & 0xFF, u8DenominatorH = u16Denominator >> 8;
  1021. if (bPipe == eCAP_PACKET)
  1022. {
  1023. outp32(REG_CAP_PKTSL, (inp32(REG_CAP_PKTSL) & ~(PKTSHNL | PKTSHML))
  1024. | ((u8NumeratorL << 8)
  1025. | u8DenominatorL));
  1026. outp32(REG_CAP_PKTSM, (inp32(REG_CAP_PKTSM) & ~(PKTSHNH | PKTSHMH))
  1027. | ((u8NumeratorH << 8)
  1028. | u8DenominatorH));
  1029. }
  1030. else if (bPipe == eCAP_PLANAR)
  1031. {
  1032. outp32(REG_CAP_PLNSL, (inp32(REG_CAP_PLNSL) & ~(PKTSHNL | PKTSHML))
  1033. | ((u8NumeratorL << 8)
  1034. | u8DenominatorL));
  1035. outp32(REG_CAP_PLNSM, (inp32(REG_CAP_PLNSM) & ~(PKTSHNH | PKTSHMH))
  1036. | ((u8NumeratorH << 8)
  1037. | u8DenominatorH));
  1038. }
  1039. else
  1040. return E_CAP_INVALID_PIPE;
  1041. return Successful;
  1042. }
  1043. /**
  1044. * @brief Get packet/planar scaling horizontal factor.
  1045. *
  1046. * @param[in] bPipe Pipe type.Including.
  1047. * - \ref eCAP_PACKET.
  1048. * - \ref eCAP_PLANAR.
  1049. * @param[out] pu16Numerator Scaling Horizontal Factor N.
  1050. * @param[out] pu16Denominator Scaling Horizontal Factor M.
  1051. *
  1052. * @retval 0 Success
  1053. * @retval <0 Error code
  1054. *
  1055. * @details This function is used to get packet/planar scaling horizontal factor.
  1056. * The output image width will be equal to the image width * N/M.
  1057. * Note: The value of N must be equal to or less than M.
  1058. */
  1059. INT32 CAP_GetHorizontalScaleFactor(E_CAP_PIPE bPipe, PUINT16 pu16Numerator, PUINT16 pu16Denominator)
  1060. {
  1061. UINT32 u32Temp1, u32Temp2;
  1062. if (bPipe == eCAP_PACKET)
  1063. {
  1064. u32Temp1 = inp32(REG_CAP_PKTSL);
  1065. u32Temp2 = inp32(REG_CAP_PKTSM);
  1066. }
  1067. else if (bPipe == eCAP_PLANAR)
  1068. {
  1069. u32Temp1 = inp32(REG_CAP_PLNSL);
  1070. u32Temp2 = inp32(REG_CAP_PLNSM);
  1071. }
  1072. else
  1073. return E_CAP_INVALID_PIPE;
  1074. *pu16Numerator = ((u32Temp1 & PKTSHNL) >> 8) | (u32Temp2 & PKTSHNH);
  1075. *pu16Denominator = (u32Temp1 & PKTSHML) | ((u32Temp2 & PKTSHMH) << 8);
  1076. return Successful;
  1077. }
  1078. /**
  1079. * @brief Set scaling frame rate factor.
  1080. *
  1081. * @param[in] u8Numerator Scaling Frame Rate Factor N.
  1082. * @param[in] u8Denominator Scaling Frame Rate Factor M.
  1083. *
  1084. * @return None.
  1085. *
  1086. * @details This function is used to set scaling frame rate factor..
  1087. * The output image frame rate will be equal to input image frame rate * (N/M).
  1088. * Note: The value of N must be equal to or less than M.
  1089. */
  1090. void DrvCAP_SetFrameRateScaleFactor(UINT8 u8Numerator, UINT8 u8Denominator)
  1091. {
  1092. outp32(REG_CAP_FRCTL, (inp32(REG_CAP_FRCTL) & ~(FRN | FRM))
  1093. | (((u8Numerator << 8) & FRN)
  1094. | (u8Denominator & FRM)));
  1095. } // DrvVideoIn_SetFrameRateScaleFactor
  1096. /**
  1097. * @brief Get scaling frame rate factor.
  1098. *
  1099. * @param[out] pu8Numerator Scaling Frame Rate Factor N.
  1100. * @param[out] pu8Denominator Scaling Frame Rate Factor M.
  1101. *
  1102. * @return None.
  1103. *
  1104. * @details This function is used to get scaling frame rate factor..
  1105. * The output image frame rate will be equal to input image frame rate * (N/M).
  1106. * Note: The value of N must be equal to or less than M.
  1107. */
  1108. void DrvCAP_GetFrameRateScaleFactor(PUINT8 pu8Numerator, PUINT8 pu8Denominator)
  1109. {
  1110. UINT32 u32Temp = inp32(REG_CAP_FRCTL);
  1111. *pu8Numerator = (u32Temp & FRN) >> 8;
  1112. *pu8Denominator = u32Temp & FRM;
  1113. }
  1114. /**
  1115. * @brief Set address match
  1116. *
  1117. * @param[in] u32AddressMatch Compare Memory Base Address.It should be 0~0xFFFFFFFF.
  1118. *
  1119. * @return None.
  1120. *
  1121. * @details This function is used to set compare memory base address.
  1122. */
  1123. void DrvCAP_SetAddressMatch(UINT32 u32AddressMatch)
  1124. {
  1125. outp32(REG_CAP_CMPADDR, u32AddressMatch);
  1126. }
  1127. /**
  1128. * @brief Get address match
  1129. *
  1130. * @param[out] pu32AddressMatch Compare Memory Base Address.It should be 0~0xFFFFFFFF.
  1131. *
  1132. * @return None.
  1133. *
  1134. * @details This function is used to get compare memory base address.
  1135. */
  1136. void CAP_GetAddressMatch(PUINT32 pu32AddressMatch)
  1137. {
  1138. *pu32AddressMatch = inp32(REG_CAP_CMPADDR);
  1139. }
  1140. /**
  1141. * @brief Set frame output pixel stride width.
  1142. *
  1143. * @param[in] u32PacketStride Packet frame output pixel stride width.It should be 0~0x3FFF.
  1144. * @param[in] u32PlanarStride Planar frame output pixel stride width.It should be 0~0x3FFF.
  1145. *
  1146. * @return None.
  1147. *
  1148. * @details This function is used to set frame output pixel stride width.
  1149. */
  1150. void CAP_SetStride(UINT32 u32PacketStride, UINT32 u32PlanarStride)
  1151. {
  1152. outp32(REG_CAP_STRIDE, ((u32PlanarStride << 16) & PLNSTRIDE) |
  1153. (u32PacketStride & PKTSTRIDE));
  1154. }
  1155. /**
  1156. * @brief Get frame output pixel stride width.
  1157. *
  1158. * @param[out] pu32PacketStride Packet frame output pixel stride width.It should be 0~0x3FFF.
  1159. * @param[out] pu32PlanarStride Planar frame output pixel stride width.It should be 0~0x3FFF.
  1160. *
  1161. * @return None.
  1162. *
  1163. * @details This function is used to get frame output pixel stride width.
  1164. */
  1165. void CAP_GetStride(PUINT32 pu32PacketStride, PUINT32 pu32PlanarStride)
  1166. {
  1167. UINT32 u32Tmp = inp32(REG_CAP_STRIDE);
  1168. *pu32PlanarStride = (u32Tmp & PLNSTRIDE) >> 16;
  1169. *pu32PacketStride = u32Tmp & PKTSTRIDE;
  1170. }
  1171. /**
  1172. * @brief Set system memory packet/planar base address.
  1173. *
  1174. * @param[in] ePipe Pipe type.Including:
  1175. * - \ref eCAP_PACKET
  1176. * - \ref eCAP_PLANAR
  1177. *
  1178. * @param[in] eBuf Packet/Planar buffer address.
  1179. * - \ref eCAP_BUF0 :
  1180. * Packet : Packet base address 0
  1181. * Planar : Planar Y base address
  1182. * - \ref eCAP_BUF1
  1183. * Packet : Packet base address 1
  1184. * Planar : Planar U base address
  1185. * - \ref eCAP_BUF2
  1186. * Packet : None.
  1187. * Planar : Planar V base address
  1188. *
  1189. * @param[in] u32BaseStartAddr System Memory Base Address.It should be 0~0xFFFFFFFF.
  1190. *
  1191. * @retval 0 Success
  1192. * @retval <0 Error code
  1193. *
  1194. * @details This function is used to set system memory packet/planar base address.
  1195. */
  1196. INT32 CAP_SetBaseStartAddress(E_CAP_PIPE ePipe, E_CAP_BUFFER eBuf, UINT32 u32BaseStartAddr)
  1197. {
  1198. if (ePipe == eCAP_PACKET)
  1199. {
  1200. if (eBuf > eCAP_BUF1)
  1201. return E_CAP_INVALID_BUF;
  1202. outp32(REG_CAP_PKTBA0 + eBuf * 4, u32BaseStartAddr);
  1203. }
  1204. else if (ePipe == eCAP_PLANAR)
  1205. {
  1206. if (eBuf > eCAP_BUF2)
  1207. return E_CAP_INVALID_BUF;
  1208. outp32(REG_CAP_YBA + eBuf * 4, u32BaseStartAddr);
  1209. }
  1210. else
  1211. return E_CAP_INVALID_PIPE;
  1212. return Successful;
  1213. }
  1214. /**
  1215. * @brief Get system memory packet/planar base address.
  1216. *
  1217. * @param[in] ePipe Pipe type.Including:
  1218. * - \ref eCAP_PACKET
  1219. * - \ref eCAP_PLANAR
  1220. *
  1221. * @param[in] eBuf Packet/Planar buffer address.
  1222. * - \ref eCAP_BUF0 :
  1223. * Packet : Packet base address 0
  1224. * Planar : Planar Y base address
  1225. * - \ref eCAP_BUF1
  1226. * Packet : Packet base address 1
  1227. * Planar : Planar U base address
  1228. * - \ref eCAP_BUF2
  1229. * Packet : None.
  1230. * Planar : Planar V base address
  1231. *
  1232. * @param[out] pu32BaseStartAddr System Memory Base Address.It should be 0~0xFFFFFFFF.
  1233. *
  1234. * @retval 0 Success
  1235. * @retval <0 Error code
  1236. *
  1237. * @details This function is used to get system memory packet/planar base address.
  1238. */
  1239. INT32 CAP_GetBaseStartAddress(E_CAP_PIPE ePipe, E_CAP_BUFFER eBuf, PUINT32 pu32BaseStartAddr)
  1240. {
  1241. if (ePipe == eCAP_PACKET)
  1242. {
  1243. if (eBuf > eCAP_BUF1)
  1244. return E_CAP_INVALID_BUF;
  1245. *pu32BaseStartAddr = inp32(REG_CAP_PKTBA0 + eBuf * 4);
  1246. }
  1247. else if (ePipe == eCAP_PLANAR)
  1248. {
  1249. if (eBuf > eCAP_BUF2)
  1250. return E_CAP_INVALID_BUF;
  1251. *pu32BaseStartAddr = inp32(REG_CAP_YBA + eBuf * 4);
  1252. }
  1253. else
  1254. return E_CAP_INVALID_PIPE;
  1255. return Successful;
  1256. }
  1257. /**
  1258. * @brief Set standard CCIR656.
  1259. *
  1260. * @param[in] bIsStandard Standard CCIR656.
  1261. * - 1 : Standard CCIR656 mode.
  1262. * - 0 : Non-Standard CCIR656 mode. (OV7725 or Hynix 702)
  1263. * @return None.
  1264. *
  1265. * @details This function is used to set standard CCIR65/non-standard CCIR65.
  1266. */
  1267. void CAP_SetStandardCCIR656(BOOL bIsStandard)
  1268. {
  1269. if (bIsStandard == TRUE)
  1270. outp32(REG_CAP_PAR, inp32(REG_CAP_PAR) & ~FBB); // Standard
  1271. else
  1272. outp32(REG_CAP_PAR, inp32(REG_CAP_PAR) | FBB); // Non-Standard
  1273. }
  1274. /**
  1275. * @brief Set color effect
  1276. *
  1277. * @param[in] eColorMode Available as following.
  1278. * - \ref eCAP_CEF_NORMAL : Normal Color.
  1279. * - \ref eCAP_CEF_SEPIA : Sepia effect,
  1280. * corresponding U,V component value is set at register - \ref REG_CAP_SEPIA.
  1281. * - \ref eCAP_CEF_NEGATIVE : Negative picture.
  1282. * - \ref eCAP_CEF_POSTERIZE : Posterize image,
  1283. * the Y, U, V components posterizing factor are set at register - \ref REG_CAP_POSTERIZE.
  1284. *
  1285. * @retval 0 Success
  1286. * @retval <0 Error code
  1287. *
  1288. * @details This function is used to set color effect.
  1289. */
  1290. INT32 CAP_SetColorEffect(E_CAP_CEF eColorMode)
  1291. {
  1292. if (eColorMode > eCAP_CEF_POSTERIZE)
  1293. return E_CAP_INVALID_COLOR_MODE;
  1294. outp32(REG_CAP_PAR, (inp32(REG_CAP_PAR) & ~COLORCTL) |
  1295. (eColorMode << 11));
  1296. return Successful;
  1297. }
  1298. /**
  1299. * @brief Get color effect
  1300. *
  1301. * @param[out] peColorMode Available as following.
  1302. * - \ref eCAP_CEF_NORMAL : Normal Color.
  1303. * - \ref eCAP_CEF_SEPIA : Sepia effect,
  1304. * corresponding U,V component value is set at register - \ref REG_CAP_SEPIA.
  1305. * - \ref eCAP_CEF_NEGATIVE : Negative picture.
  1306. * - \ref eCAP_CEF_POSTERIZE : Posterize image,
  1307. * the Y, U, V components posterizing factor are set at register - \ref REG_CAP_POSTERIZE.
  1308. *
  1309. * @return None.
  1310. *
  1311. * @details This function is used to get color effect.
  1312. */
  1313. void DrvCAP_GetColorEffect(E_CAP_CEF *peColorMode)
  1314. {
  1315. UINT32 u32Tmp = inp32(REG_CAP_PAR);
  1316. *peColorMode = (E_CAP_CEF)((u32Tmp & COLORCTL) >> 11);
  1317. }
  1318. /**
  1319. * @brief Set color effect parameter
  1320. *
  1321. * @param[in] u8YComp The constant Y component.If eColorMode is set to
  1322. * eCAP_CEF_SEPIA : the constant Y component in - \ref REG_CAP_SEPIA.
  1323. * eCAP_CEF_POSTERIZE : the constant Y component in - \ref REG_CAP_POSTERIZE.
  1324. * @param[in] u8UComp The constant U component.
  1325. * eCAP_CEF_SEPIA : the constant U component in - \ref REG_CAP_SEPIA.
  1326. * eCAP_CEF_POSTERIZE : the constant U component in - \ref REG_CAP_POSTERIZE.
  1327. * @param[in] u8VComp The constant V component.
  1328. * eCAP_CEF_SEPIA : the constant V component in - \ref REG_CAP_SEPIA.
  1329. * eCAP_CEF_POSTERIZE : the constant V component in - \ref REG_CAP_POSTERIZE.
  1330. * @retval 0 Success
  1331. * @retval <0 Error code
  1332. *
  1333. * @details This function is used to set color effect parameter.
  1334. */
  1335. INT32 CAP_SetColorEffectParameter(UINT8 u8YComp, UINT8 u8UComp, UINT8 u8VComp)
  1336. {
  1337. UINT32 u32Tmp = inp32(REG_CAP_PAR);
  1338. UINT32 u32ColorMode = (u32Tmp & COLORCTL) >> 11;
  1339. if (u32ColorMode == eCAP_CEF_SEPIA)
  1340. {
  1341. outp32(REG_CAP_SEPIA, (((UINT32)u8UComp << 8) | u8VComp));
  1342. }
  1343. else if (u32ColorMode == eCAP_CEF_POSTERIZE)
  1344. {
  1345. outp32(REG_CAP_POSTERIZE, (((UINT32)u8YComp << 16) | ((UINT32)u8UComp << 8) | u8VComp));
  1346. }
  1347. else
  1348. {
  1349. return E_CAP_WRONG_COLOR_PARAMETER;
  1350. }
  1351. return Successful;
  1352. }
  1353. /**
  1354. * @brief Get color effect parameter
  1355. *
  1356. * @param[out] pu8YComp The constant Y component.If eColorMode is set to
  1357. * eCAP_CEF_SEPIA : the constant Y component in - \ref REG_CAP_SEPIA.
  1358. * eCAP_CEF_POSTERIZE : the constant Y component in - \ref REG_CAP_POSTERIZE.
  1359. * @param[out] pu8UComp The constant U component.
  1360. * eCAP_CEF_SEPIA : the constant U component in - \ref REG_CAP_SEPIA.
  1361. * eCAP_CEF_POSTERIZE : the constant U component in - \ref REG_CAP_POSTERIZE.
  1362. * @param[out] pu8VComp The constant V component.
  1363. * eCAP_CEF_SEPIA : the constant V component in - \ref REG_CAP_SEPIA.
  1364. * eCAP_CEF_POSTERIZE : the constant V component in - \ref REG_CAP_POSTERIZE.
  1365. * @retval 0 Success
  1366. * @retval <0 Error code
  1367. *
  1368. * @details This function is used to get color effect parameter.
  1369. */
  1370. INT32 CAP_GetColorEffectParameter(PUINT8 pu8YComp, PUINT8 pu8UComp, PUINT8 pu8VComp)
  1371. {
  1372. UINT32 u32Tmp = inp32(REG_CAP_PAR);
  1373. UINT32 u32ColorMode = (u32Tmp & COLORCTL) >> 11;
  1374. if (u32ColorMode == eCAP_CEF_SEPIA)
  1375. {
  1376. u32Tmp = inp32(REG_CAP_SEPIA);
  1377. *pu8UComp = (u32Tmp & 0xFF00) >> 8;
  1378. *pu8VComp = u32Tmp & 0xFF;
  1379. }
  1380. else if (u32ColorMode == eCAP_CEF_POSTERIZE)
  1381. {
  1382. u32Tmp = inp32(REG_CAP_POSTERIZE);
  1383. *pu8YComp = (u32Tmp & 0xFF0000) >> 16;
  1384. *pu8UComp = (u32Tmp & 0xFF00) >> 8;
  1385. *pu8VComp = u32Tmp & 0xFF;
  1386. }
  1387. else
  1388. {
  1389. return E_CAP_WRONG_COLOR_PARAMETER;
  1390. }
  1391. return Successful;
  1392. }
  1393. /// @cond HIDDEN_SYMBOLS
  1394. CAPDEV_T CAP =
  1395. {
  1396. CAP_Init, // void (*Init)(BOOL bIsEnableSnrClock, E_CAP_SNR_SRC eSnrSrc, UINT32 u32SensorFreqKHz, E_CAP_DEV_TYPE eDevType):
  1397. CAP_Open, // INT32 (*Open)(UINT32 u32SensorFreqKHz);
  1398. CAP_Close, // void (*Close)(void);
  1399. CAP_SetPipeEnable, // void (*SetPipeEnable)(BOOL bEngEnable, E_CAP_PIPE ePipeEnable);
  1400. CAP_SetPlanarFormat, // void (*SetPlanarFormat)(E_CAP_PLANAR_FORMAT ePlanarFmt);
  1401. CAP_SetCropWinSize, // void (*SetCropWinSize)(UINT32 u32height, UINT32 u32width);
  1402. CAP_SetCropWinStartAddr, // void (*SetCropWinStartAddr)(UINT32 u32VerticalStart, UINT32 u32HorizontalStart);
  1403. CAP_SetStride, // void (*SetStride)(UINT32 u16packetstride, UINT32 u32planarstride);
  1404. CAP_GetStride, // void (*GetStride)(PUINT32 pu32PacketStride, PUINT32 pu32PlanarStride);
  1405. CAP_EnableInt, // INT32 (*EnableInt)(E_CAP_INT_TYPE eIntType);
  1406. CAP_DisableInt, // INT32 (*DisableInt)(E_CAP_INT_TYPE eIntType);
  1407. CAP_InstallCallback, // INT32 (*InstallCallback)(E_CAP_INT_TYPE eIntType, PFN_CAP_CALLBACK pfnCallback, PFN_CAP_CALLBACK *pfnOldCallback);
  1408. CAP_SetBaseStartAddress, // INT32 (*SetBaseStartAddress(E_CAP_PIPE ePipe, E_CAP_BUFFER eBuf, UINT32 u32BaseStartAddr);
  1409. CAP_SetOperationMode, // void (*SetOperationMode(BOOL bIsOneSutterMode);
  1410. CAP_GetOperationMode, // BOOL (*GetOperationMode)(void);
  1411. CAP_SetPacketFrameBufferControl, // void (*videoIn1_SetPacketFrameBufferControl)(BOOL bFrameSwitch, BOOL bFrameBufferSel);
  1412. CAP_SetSensorPolarity, // void (*videoIn1_SetSensorPolarity)(BOOL bVsync, BOOL bHsync, BOOL bPixelClk);
  1413. CAP_SetColorEffectParameter, // INT32 (*SetColorEffectParameter)(UINT8 u8YComp, UINT8 u8UComp, UINT8 u8VComp);
  1414. CAP_SetDataFormatAndOrder, // void (*SetDataFormatAndOrder)(E_CAP_ORDER eInputOrder, E_CAP_IN_FORMAT eInputFormat, E_CAP_OUT_FORMAT eOutputFormat)
  1415. CAP_SetMotionDet, // void (*SetMotionDet)(BOOL bEnable, BOOL bBlockSize,BOOL bSaveMode);
  1416. CAP_SetMotionDetEx, // void (*SetMotionDetEx)(UINT32 u32Threshold, UINT32 u32OutBuffer, UINT32 u32LumBuffer);
  1417. CAP_SetStandardCCIR656, // void (*SetStandardCcir656)(BOOL);
  1418. CAP_SetShadowRegister // void (*SetShadowRegister)(void);
  1419. };
  1420. /// @endcond HIDDEN_SYMBOLS
  1421. /*@}*/ /* end of group N9H30_CAP_EXPORTED_FUNCTIONS */
  1422. /*@}*/ /* end of group N9H30_CAP_Driver */
  1423. /*@}*/ /* end of group N9H30_Device_Driver */