OV528-OmniVision - User Manual
OV528-OmniVision - User Manual
OV528-OmniVision - User Manual
Preliminary
User Manual
Rev. 1.1
ShangHai OmniVision IC Design, Inc. reserves the right to make changes without further notice to any product herein
to improve reliability, function or design. OmniVision does not assume any liability arising out of the application or use
of any project, circuit described herein; neither does it convey any license under its patent nor the right of others.
This document contains information of a proprietary nature. None of this information shall be divulged to persons other
than ShangHai OmniVision IC Design, Inc. employee authorized by the nature of their duties to receive such
information, or individuals or organizations authorized by ShangHai OmniVision IC Design, Inc.
Table of Contents
1. Introduction .........................................................................................................................................1
1.1 OV528.....................................................................................................................2
1.2 Sensors ................................................................................................................2
1.3 Boards .........................................................................................................................2
1.3.1 Evaluation Board................................................................................ 2
1.3.2 Demo Board.......................................................................................................2
Index of functions.....................................................................................................40
References...................................................................................................40
1. Introduction
This document aims at providing a guideline to the user or developer of OV528 system in case the
system will be maintained and developed.
1.1 OV528
OV528 is the back-end chip for the Serial Bus Camera System that can be attached to a wireless or
PDA host and performs as a video camera or a JPEG compressed still camera. It provides camera
(sensor) interface, serial interface and JPEG image compression engine to act as a low cost and
low powered single chip solution for the high-resolution serial bus PDA or cellular phone camera
accessory applications (See Fig. 1-1).
For detailed information of OV528, please refer [1].
1.2 Sensors
So far, OV528 supports four kinds of image sensors: OV7620, OV7635, OV6630 and OV6640.
OV7620 and OV7635 are CMOS digital video camera sensors with VGA (640x480) or QVGA
(320x240) resolution. The frequency of the output frame is up to 30 Hz (VGA). Different data
formats, YCrCb 4:2:2, GRB 4:2:2 and RGB raw data, are supported. 16Bit or 8Bit video data,
namely ZV Port, CCIR601 or CCIR656 are outputted.
OV6630 and OV6640 image sensors provide CIF (352x288) or QCIF (176x144) data output
format. Maximum FPS (frame per second) can achieve to 60.
Some advanced and attractive functions are also integrated into the sensors, such as the exposure
control, gamma correction, gain control, automatic white balance, bloomings drastically reduction,
etc. All these functions or algorithms together guarantee the output images quality to reach the
satisfactory level.
For more information and specifications about the image sensors, please refer materials [2] [5].
Note: The supplied powers for these four types of sensors are not the same. OV7620 needs 5VDC
to support while the other three types need 3.0-3.6 VDC. Therefore, before a sensor is connected
with a board, please make sure the power provided by board is correct.
1.3 Board
1.3.1 Evaluation Board
Jumpers on evaluation board must be correctly set before any field usage. Table 1-1 gives a
reference of the jumper and button positions. Fig.1-2 shows the sketch map of jumpers and buttons
on OV528 evaluation board.
Legend:
Sensor
Data Path
OV7620 OV7635
OV6630 OV6640 Control Path
Interface
Micro
SCCB Controller
RS232
Serial
Interface
Program
Buffer
Fig. 1-2 Sketch Map of Jumpers and Buttons on OV528 Evaluation Board
2. DownLoad/Update Firmware
If its the first time to use the OV528 system, firmware should be downloaded into the EEPROM
at first. While, if an old version firmware has already been in the EEPROM and a newer one exists,
user can update the old one by the new firmware (in the latter situation, downloading can also be
effective but we dont recommend user to do so).
An application program named OV528DL.exe is used to undertake such work.
Double click the ICON of OV528DL.exe to run the program, the main interface will look like
Fig.2-1:
Operation Specify the
Mode Available
Select COM Port
Select
Binary File
Baud to Download
Rate Select
Select Binary File
to Update
Progress
of Operation
If it is downloading firmware, user should set Jumper J108 at position 1, otherwise, set it at 0
(refer Table 1-1 and Fig. 1-1).
Besides this, user also needs to do some additional things before downloading or updating the
firmware
1. select the binary firmware file with the name *.bin
If the operation mode is Download->Update Firmware, user needs to select two *.bin files,
one is to be downloaded into OV528, the other is to be saved into EEPROM.
2. select an available COM (COM1 or COM2) port through which host can communicate
with the firmware
ShangHai OmniVision IC Design, Inc. 5 Version 1.1, July 18, 2002
Tel: (021)50803390 Fax: (021)50803389
E_Mail: support@ovt.com.cn
Website: http://www.ovt.com.cn
3. select the supported baud rate, default one is 14400 for both downloading and updating.
Only after all the three requirements mentioned above are met, can the operation be carried out
(See Fig. 2-2), otherwise, error message will appear (See Fig. 2-3).
If an error message box like Fig.2-3 is shown, user should follow the instructions to find out the
problem. If not, Fig. 2-4 tells user that the operation has been finished and the system is all set.
Note: After successfully downloading the firmware, J108 should be placed at position
0 (refer Table 1-1). Then push S11 (Reset button) to reset the system before running
the application program.
ShangHai OmniVision IC Design, Inc. 6 Version 1.1, July 18, 2002
Tel: (021)50803390 Fax: (021)50803389
E_Mail: support@ovt.com.cn
Website: http://www.ovt.com.cn
3. JPEGDecoder.dll: dynamic link library, decode JPEG image into Bitmap file.
Copy these three files to the same folder then double click OV528Ap.exe to run the program. The
two DLLs can also be placed under the windows default directories. If OV528Ap.exe cant find
any of the two DLLs, an error message similar with Fig. 3-1 will appear (under Windows 2000).
3.2 Initialization
The first of all things that the software will do is to initialize the Serial Interface (COM or SPI) of
the Host (PC, PDA, Cell-phone, etc.) in order to set up the communication way between host and
OV528.
When searching the available communication port and the supported baud rate, a little time will be
cost. Therefore, the driver will create a processing bar to show the status.
Unfortunately, sometimes the function may fail to initialize the system. In this case, a dialog box
If this happens, please push S12 (Reset button) then run OV528Ap.exe once again.
a. External power has been correctly connected with the board (5V DC)
b. The mounted sensor is compatible with the board (For OV7620, the sensors input power is
5V DC, for others, the input power is 3.3V DC. Just because of this reason, there is a minor
c. RS-232 cable has been correctly established between the board and host
Therefore, sometime user needs to check and reset the system for several more times.
SnapShot
Picture
View
Window
Thumbnail
Window
SnapShot
Group
A still image will be displayed in the SnapShot Picture View Window if user snapshots an image.
Meanwhile, a copy of this image will appear in the Thumbnail Window in a smaller size. Totally,
there can be 11 such small images being displayed within the bound of the Thumbnail Window at
most. Which means that when more images are got, latter ones will overwrite the former images.
For convenience, we give them the name Thumbnail. User can review any one of these 11
thumbnails by clicking it with the cursor. Then, the image interest you will appear in the
SnapShot Picture View Window again.
If you want to save the image in any small thumbnail into a file, you can double click with your
mouses left button on it, then, a JPEG file will be generated, the files name is shown to you in a
message box.
The image in the DSC group is the one that you load from the flash memory. In Flash Memory
Picture View Window, you will view the last picture you load from the flash memory in a
minified size. By clicking it with the cursor, it can also be displayed in the SnapShot Picture
View Window where you can see more details of it.
If the sensor type is OV66#0 (CIF) and the flash memory is supported, the Main Interface will be
another one (see. Fig.3-4). Except the previewing and still images sizes, all the other functions are
the same with that of VGA system.
BMP
Image
Parameters
Light
Frequency
Select
SnapShot
Image Resolution
a. for 7620 or 7635 b. for 6630 or 6640
Fig 3-5. Sensor Parameters Setting Dialog
SnapShot. That means some other types even the standard JPEG files cant meet our demands at
the moment. Otherwise, an error message will be posted and the function will return FALSE
(Fig.3-7 and Fig.3-8).
If the file meets the standard, a dialog box (Fig.3-9) will be created to inform the user to select the
destination Bmp files properties. And, of course, the decoded files size must be no larger than the
source files.
Double-click any
list of the table to
load up the file Picture
List
Table
Delete
ID Edit Box Last
Picture
Delete
All
View Area Pictures
(Only Jpeg Image)
Fig.3-10 Flash Memory Picture View Dialog
1. When you double click an item listed in the table, the ID of this item will appear in the ID Edit
Box, at the same time, the real image (JPEG type) will show in the View Area. So far, the image
ShangHai OmniVision IC Design, Inc. 11 Version 1.1, July 18, 2002
Tel: (021)50803390 Fax: (021)50803389
E_Mail: support@ovt.com.cn
Website: http://www.ovt.com.cn
has been loaded out even you exit the dialog now.
2. You can also put the ID number into the ID Edit Box then by pressing the Load This button to
load the image with the given ID number.
The foregoing two ways can produce the same effect.
The total memory of the flash is 8 Mega bytes and has been divided into 1000 blocks. So each
locks size is 8 K bytes.
Save Image button of DSC group corresponds to the function of saving the current live image into
the flash memory. A message box will appear after this operation to inform whether it has been
successfully finished or not.
Unlike Save Image, Save Disc File will save a disc file rather than a current displayed image into
the flash memory. Thus, an object file must be specified by the user at first (See Fig.3-11).
4.2.1 Commands
There are totally15 own-defined commands in OV528 system. OV528Drv.dll talks
with firmware (default name is Rsrunner.bin) by means of these commands. With
them, software and firmware have their own language. Only after driver got in touch
with firmware through commands, can the whole system run up. What is more, only
after driver got the affirmative answer (again, it is command) from firmware, can any
operation be successful.
Any command is composed with eight bytes.
Starting with three bytes of 0xFF, the fourth byte is the ID number of the command,
following them are four parameters. Commands ID number ranges from 1 (0x01) to
15 (0x0F). It is used by firmware to identify which is which. The last four bytes, or
namely parameters, are the content of the command. Therefore, any command will
look like this: 0xFFFFFF0?P1P2P3 (? is from 1 to F).
Table 4-8 lists all the commands name, ID and parameters.
Note: * If the parameter is 0xFF, the command is a special Reset command and the firmware
responds to it immediately.
Table 4-9 gives out the explanations of these commands.
Host can control cameras internal register value by using this command.
SET Register Type:
REGISTER OV528 Register: 0x00 Sensor Register: 0x01
Host sends this command to inform OV528 to keep a JPEG image in its
memory.
Snap Shot Type:
SNAP Compressed Picture: 0x00 Uncompressed Picture: 0x01
SHOT (unused)
Picture skip count:
Host can define how many frame pictures to skip before compression.
0 means keep current picture. 1 means compress next frame. Est.
By using this command, host can save data to OV528 or Flash Memory,
change snapshot resolution and delete Flash Memory Files.
Destination:
Serial bus to SRAM (buffer in OV528): 0x01
Serial bus to OV528 FIFO RAM: 0x02 (unused)
Serial bus to EEPROM: 0x03 Serial bus to Flash Memory: 0x04
SRAM to EEPROM: 0x05 SRAM to Flash Memory: 0x06
Change JPEG Resolution for Snapshot Button: 0x07
SAVE Delete Flash Memory Last File: 0xF0 Format Flash Memory: 0xFF
DATA
Length Byte 0 / JPEG Resolution:
If Destination is Change JPEG Resolution for Snapshot Button, this
byte is JPEG Resolution. If Destination is Flash Memory, this byte is
0x00. Otherwise, it represents the low byte of downloading programs
length.
Length Byte 1:
If saving file into Flash Memory, it is 0x00. Otherwise, it represents the
middle byte of downloading programs length.
ShangHai OmniVision IC Design, Inc. 17 Version 1.1, July 18, 2002
Tel: (021)50803390 Fax: (021)50803389
E_Mail: support@ovt.com.cn
Website: http://www.ovt.com.cn
Host downloads or system sends data back by using this command. The unit
for the length is byte and it doesnt include the length of command itself.
Data Type:
Register Data: 0x00
SnapShot Picture: 0x01
Preview Picture: 0x02
Program: 0x03
Flash Memory File: 0x04
JPEG Preview Picture: 0x05
Decode Picture: 0x06
DATA Check Sum Data: 0x07 (unused)
Flash Memory Free Space Data: 0x08
Flash Memory File Size: 0x09
Host can read systems internal register value by using this command. System
GET will send back the register value by using DATA command.
REGISTER Register Type:
OV528 Register: 0x00 Sensor Register: 0x01
Host can download program to OV528 by using this command. After host
downloads program into systems program RAM, host needs to send SYNC
command and wait ACK command from firmware.
DOWNLOAD
PROGRAM Destination:
Program RAM: 0x05
Length:
These three bytes represent the last two bytes of the download programs
length.
Either host or OV528 can send this command. ACK command is sent back
SYNC after receiving this command.
This command is used to indicate the success of the last operation. After
receiving any valid command, ACK command is sent out except downloading
program or getting preview data.
This command is used to indicate the fail of the last communication or any
unsupported feature.
Function description:
If its the first time for the system to be used and no firmware in it, this function
will fulfill the order of downloading file. This function is used to write firmware file
into OV528 and check its validity. If the file is valid, the function will return TURE
and program should invoke function SaveToEEPROM to re-write the file into
EEPROM and store the file there.
Parameters:
hWnd: handle of the main window
lpBuffer: buffer for firmware file (Rsrunner.bin)
dwBufferSize: size of firmware file
hProgressBar: handle of the progressing bar which indicates the progress of
Functions the downloading or updating operation
Function description:
This function will update the old firmware with a new version. In fact, it writes
a new firmware into EEPROM. We recommend user to use this function instead of
the first one as long as there is usable firmware in the system.
Parameters:
All the parameters are the same with that in function
DownloadProgramToOV528.
HOST OV528
DownLoad
DOWNLOAD
Program
Program File
SYNC
ACK
SYNC
ACK
Update
Protocol
SYNC
ACK
SYNC
ACK
SAVE DATA
(Destination:0x03
ACK
DATA
(Type:0x03)
Program File
ACK
Parameters:
hInstance: handle of the application programs instance
hWnd: handle of main window
pOVTSensorType: sensor type, see Table 4-1
HOST OV528
Get COM Port Handle
& Set Baud Rate
SYNC
ACK
Protocol
SYNC
ACK
INITIAL
ACK
SET
BAUDRATE
ACK
Function Description:
Invoking this function will inform the driver to apply a lot of source and begin
Parameters:
reading a frame of image. Because the rate of image datas reading through
RS-232 port is a little slow in a sense, the processing bar will inform the
value must be 50 or 60, otherwise, it will return FALSE. If the system works
under the natural light condition, such as outdoors, this parameter is an invalid
one.
It must be uniform with the electronic frequency to guarantee the exposure time
of any frame to be identical. Otherwise, many black and white strips will appear
on the image.
HOST OV528
Apply Memory
INITIAL
ACK
GET PICTURE
(Type:0x02)
Protocol NAK
GET PICTURE
(Type:0x02) ACK
DATA
(Type: 0x02)
Preview Image
Data
ACK
DATA
(Type: 0x02)
Preview Image
Data
ACK
DATA
(Type: 0x02)
Preview Image
Data
Function Description:
Functions When user needs to change the previewing image format or take snapshot still
image, he should stop the previewing video. If the application exits, user should also
Release Memory
Protocol
RESET
(Type:0x01,
Parameter4:0xFF) ACK
Function Description:
Once the application program exit, it should reset the device and set the camera to
Functions
power off status to save energy. The driver should also free the COM port handle
which have been applied to program. (Before invoking this function, user needs to
INITIAL
ACK
SET
Protocol BAUDRATE
ACK
POWER OFF
ACK
Release COM
Port Handle
from the driver one frame by one frame. If the driver is not ready for one frame
image data, it will return FALSE, otherwise, it will return TRUE. And the image data
If the driver gets a whole frame of image data, driver will decode the data and
convert them to RGB24 format according to the requirement from the application
program, then return them to the latter to show on screen (Preview Window, see
Functions
Fig.3-3)
Parameters:
video data.
Function Description:
This function is to get the JPEG image data from the hardware and save to
memory buffer allocated by application program, then return the image data to the
latter to show on screen (SnapShot Picture View Window, see Fig.3-3).
Parameters:
pVideoBuffer: buffer allocated by application program beforehand for still JPEG
image data.
dwBufferSize: size of the video buffer.
Function Description:
This function is to change the size of the JPEG image (see Table 4-3 for the size
type). Here, the JPEG image is got by pressing button SNAP mounted on
evaluation or demo board and saved directly into flash memory. It differs from that
got by driver and send to application program to display (just as function
SnapShotJPEGImage does).
Parameters:
Select_Param, nLightFreq: the same with that in function SnapShotJPEGImage.
HOST OV528
SnapShotJPEGImage
RESET
(Type:0x01,
Parameter4:0xFF) ACK
INITIAL
ACK
SNAPSHOT
(Type: 0x00) ACK
Protocol
GET PICTURE
(Type: 0x01) ACK
DATA
(Type: 0x01)
JPEG Image
Data
ACK
SAVE DATA
(Type:0x07)
ACK
Function Description:
This functions will load either the file table or the specified file from the flash
memory then save into a disc file on the hard disc. The files extension name can be
one of the two types : jpg and bmp or no extension name exists if the file is neither a
JPEG nor a Bitmap file.
Parameters:
PFlash_FileTableItem: flash memory file information (see Table 4-6). If this
parameter is NULL, driver will think that application program want to load the
file table from the flash memory. Otherwise, driver consider it to be the
information of the specified file in flash memory.
pFileBuffer: buffer contain the file content.
dwFileBufferSize: size of the file buffer.
pNumberOfBytesWritten: total number of the bytes that read into the file
buffer.
byMediumType: the type of the storage medium, MT_PFLASH is the only
Functions choice in current system
BOOL DSCSave(SELECT_PARAM SelectParam, int nLightFreq, WORD
wSkipFrame, BOOL bCompressed, BYTE byMediumType)
Function Description:
It will save the current image in the RAM into the flash memory. The total
number of the image is from 1 to 511. Single files maximum size is less than 16 M
bytes (limited by flash memorys size, such as Samsung and Toshiba, this number is
only 8 M bytes in our current system).
Parameters:
Select_Param: Snapshot image information, see Table 4-5.
nLightFreq: light frequency, 50Hz or 60Hz.
wSkipFrame: save which image, current or not. If it is 0, current image will be
saved. Otherwise, firmware will skip wSkipFrame frames of image and save the
next one.
bCompressed: Is the image saved in compressed format or not. In fact,
Function Description:
If this function is called, all the images in flash memory will be deleted without
recoverability. Thus, application program should remind user of the aftermath before
invoking this function.
Parameters:
byMediumType: the type of the storage medium, MT_PFLASH is the only
choice in current system
BOOL DSCDeleteLastFile(BYTE byMedeiumType)
Function Description:
This function will inform the firmware to delete the last file from the flash
memory.
Parameters:
byMediumType: the type of the storage medium, MT_PFLASH is the only
choice in current system
Functions BOOL DSCTransmitFile(const BYTE *pBuffer, DWORD dwBufferSize, BYTE
bySaveDataType, BYTE byMediumType)
Function Description:
Unlike DSCSave, this function will save a disc image file rather than a currently
displayed one into the flash memory. Thus, an object image file must be specified by
the user at first. File of any type can be saved as long as the files size is within the
bound of limitation.
Parameters:
pBuffer: buffer that contains the file to be saved into flash memory.
dwBufferSize: size of the file buffer.
bySaveDataType: this parameter is used by application program to classify the
files. Now, we roughly divided the files in flash memory into 3 types, JPEG, BMP
and Others. According to this parameter, application program will apply different
operation methods on them and save into different files.
byMediumType: the type of the storage medium, MT_PFLASH is the only
choice in current system
BOOL DSCGetFreeSpace(DWORD *pFreeSpaceSize, BYTE byMediumType)
Function Description:
To get the remained space in flash memory.
Parameters:
pFreeSpaceSize: quantity (in bytes) of the free space.
ShangHai OmniVision IC Design, Inc. 30 Version 1.1, July 18, 2002
Tel: (021)50803390 Fax: (021)50803389
E_Mail: support@ovt.com.cn
Website: http://www.ovt.com.cn
HOST OV528
DSCLoad
GET PICTURE
(Type:0x04 ID: 0x00)
NAK
END or
ACK
DATA
Protocol
ACK
GET PICTURE
(Type:0x04 ID:1-511)
ACK
DATA
(not the last package)
File Data
ACK
DATA
(the last package)
File Data
ACK
HOST OV528
DSCSave
RESET
(Type:0x01,
Parameter4:0xFF) ACK
INITIAL
Protocol ACK
SNAP SHOT
ACK
SAVE DATA
(Destination: 0x06)
ACK
DSCFormat
RESET
(Type:0x01,
Parameter4:0xFF) ACK
SAVE DATA
(Destination: 0xFF)
ACK
DSCDeleteLastFile
SAVE DATA
(Destination: 0xF0)
ACK
HOST OV528
DSCTransmitFile
SAVE DATA
(Destination: 0x04)
ACK
DATA
(Type: 0x09)
ACK
DATA
(Type: 0x04, not
Protocol
the Last Package)
ACK
DATA
(Type: 0x04, the
Last Package)
ACK
DSCGetFreeSpace
GET PICTURE
(Type:0x08)
ACK
DATA
(TYPE: 0x08)
ACK
Function Description:
This function will decode a JPEG image file into a 24-bit Bitmap file. JPEG files
size, width and height will be read out inside this function.
Parameters:
ucSourceBuffer: source buffer for JPEG image data.
ucDestBuffer: destination buffer for Bitmap image data.
Function Description:
This function can also decode a JPEG file into a Bitmap one. Unlike function
JPGDecoder, this one decodes the JPEG file by means of hardware (OV528)
but not by software. And, there are some limitations on this functions usage. The
limitations are:
Functions 1. Source files size must be one of the following 4 kinds: 320*240, 640*480,
176*144, 352*288.
2. JPEG files must be those being created from OV528 system especially those
generated by operation SnapShot.
Parameters:
Select_Param: source image files information, see Table 4-5.
pPictureBuffer: source image files buffer.
dwBufferSize: size of source image files buffer
pBMPBuffer: object image files buffer
JPGDecoder
HOST OV528
DecodePicture
SAVE DATA
(Destination: 0x01)
ACK
Protocol
DATA
(Type:0x06)
Data
ACK
GET PICTURE
(Type:0x06)
ACK
DATA
(Type: 0x06)
Decoded Data
ACK
Function Description:
This function is designed to read the value of OV528 registers.
Parameters:
nRegisterAdd: address of the object register
pRegisterValue: address where the value read out from register is saved.
BOOL WriteRegister(int nRegisterAdd, int nRegisterValue)
Function Description:
This function is designed to write a number into OV528 registers.
Parameters:
nRegisterAdd: address of the object register
pRegisterValue: value that will be written into the object register.
BOOL ReadI2CRegister(int nRegisterAdd, int *pRegisterValue)
Functions
Function Description:
This function is designed to read the value of sensor registers.
Parameters:
nRegisterAdd: address of the object register
pRegisterValue: address where the value read out from register is saved.
BOOL WriteI2CRegister(int nRegisterAdd, int nRegisterValue)
Function Description:
This function is designed to write a number into sensor registers.
Parameters:
nRegisterAdd: address of the object register
pRegisterValue: value that will be written into the object register.
BOOL GetFirmwareVersion(BYTE *pMajorVersion, BYTE *pMinorVersion)
Function Description:
This function will read the firmware version from a given register.
Parameters:
pMajorVersion and pMinorVersion: version value.
DWORD OVGetLastError(void)
Function Description:
This function will return the error codes defined in firmware to the application
program or the driver.
Functions
BOOL PowerOff(void);
Function Description:
Set the system into sleep mode in order to save energy.
BOOL WakeUp(void);
Function Description:
Wake up the system who is sleeping to work.
HOST OV528
ReadRegister
GET REGISTER
(Type:0x00)
ACK
DATA
(Type: 0x00)
Protocol
Register Value
ACK
WriteRegister
SET REGISTER
(Type:0x00)
ACK
OVGetLastError
HOST OV528
GetFirmwareVersion
GET REGISTER
(Type:0x00
P1: 0xF0) ACK
DATA
(Type: 0x00)
Register Value
ACK
ReadI2CRegister
DATA
(Type: 0x00)
Register Value
ACK
WriteI2CRegister
SET REGISTER
(Type:0x01)
ACK
PowerOff
RESET
(Type:0x01,
Parameter4:0xFF) ACK
POWER OFF
ACK
HOST OV528
Wake Up
SYNC
ACK
SYNC
ACK
In function VideoStart, a thread is created to read in image data from hardware. Because this
thread has been regarded as a global variable, we give name g_hReadImageThreadHandle to
the handle of this thread. Once the thread is executed, image data will be continually read in until
an error engenders or the operation is stopped by user.
In windows, several synchronization objects are provided to permit the threads to synchronize
their actions. Therefore, depending on them, we can inform the thread to stop reading the image
data. Here, we use Event which is created in function VideoStart to take on the work, and it is
initialized to be manual-reset and unsignaled.
In function VideoStop, the Event Object (the name of its handle is g_hStopReadEvent) will be
manually reset to be signaled. So, the thread function (ReadImageThread) needs to check the
state of g_hStopReadEvent at proper positions to make sure whether the reading operation should
be continued or not. To be specific, if the Event Object is signaled, function should stop
immediately. Otherwise, continue.
Beyond reading image data from hardware, OV528Drv.dll still needs to send the data to the
application program. For the sake of not interrupting both of the operations, we allocate two image
data buffers (g_Img_Data_Buf ) to receive the image data alternately. Each buffer has its owe flag
which has four states now and can be used to indicate the current state of the buffer. The four
states are :
0 no data, no operation; 1 writing data into; 2 reading data out; 3 has data, no operation.
However, only state 0 and state 3 have been utilized now.
Another synchronization object concerning with g_Img_Data_Buf is Semaphore, it indicates the
status of the source (image buffers). Signaled Semaphore Object means there is available source.
With Semaphore Object, the image buffers are guaranteed not to be illegally occupied.
(In fact, the functions of Semaphore Object and image buffers flag are overlapped to some extend,
user can develop their own synchronization mechanism.)
ShangHai OmniVision IC Design, Inc. 39 Version 1.1, July 18, 2002
Tel: (021)50803390 Fax: (021)50803389
E_Mail: support@ovt.com.cn
Website: http://www.ovt.com.cn
Index of Functions
Totally, there are 24 exported functions from OV528Drv.dll, all of them are described in this
manual. For convenience, we give out the index of each function.
References
[1]. Chip OV528 Datasheet
[2]. OV7620 Product Specifications Rev.1.3
[3]. OV7635 Advanced Information Preliminary
[4]. OV6630 Advanced Information Preliminary
[5]. OV6640 Advanced Information Preliminary