PMSIS BSP
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Camera

Content

 Himax
 
 Mt9v
 

Data Structures

struct  pi_camera_slicing_conf_t
 
struct  pi_camera_slicing_conf
 Camera slice mode configuration. More...
 

Enumerations

enum  pi_camera_cmd_e
 Command ID for pi_camera_control. More...
 
enum  pi_camera_opts_e
 Camera comand options. More...
 
enum  pi_camera_format_e
 Camera format. More...
 
enum  pi_camera_color_mode_e
 Camera color mode. More...
 

Functions

int32_t pi_camera_open (struct pi_device *device)
 Open an image sensor device. More...
 
static int32_t pi_camera_control (struct pi_device *device, pi_camera_cmd_e cmd, void *arg)
 Control the Camera device. More...
 
void pi_camera_capture (struct pi_device *device, void *buffer, uint32_t size)
 Capture a sequence of samples. More...
 
static void pi_camera_capture_async (struct pi_device *device, void *buffer, uint32_t size, pi_task_t *task)
 Capture a sequence of samples. More...
 
static void pi_camera_close (struct pi_device *device)
 Close an opened Camera device. More...
 
static int32_t pi_camera_reg_set (struct pi_device *device, uint32_t reg_addr, uint8_t *value)
 Set camera register. More...
 
static int32_t pi_camera_reg_get (struct pi_device *device, uint32_t reg_addr, uint8_t *value)
 Get camera register. More...
 

Description

The camera driver provides support for capture data from an external camera and getting the data into the chip running this driver.

Enumeration Type Documentation

Enumerator
PI_CAMERA_CMD_ON 

Power-up the camera.

PI_CAMERA_CMD_OFF 

Power-off the camera.

PI_CAMERA_CMD_START 

Start the camera, i.e. it will start sending data on the interface.

PI_CAMERA_CMD_STOP 

Stop the camera, i.e. it will stop sending data on the interface.

PI_CAMERA_CMD_CONTINUE_MODE 

Switch to continue mode in the camera.

PI_CAMERA_CMD_TRIGGER_MODE 

Switch to trigger mode in the camera.

PI_CAMERA_CMD_POWERDOWN_MODE 

Power-down the camera.

This can be given within the camera configuration when it is opened.

Enumerator
PI_CAMERA_GRAY8 

8 bit grayscale.

PI_CAMERA_RGB565 

16 bit RGB .

PI_CAMERA_RGB888 

24 bit RGB .

PI_CAMERA_YUV 

24 bit YUV .

This can be given within the camera configuration when it is opened.

Enumerator
PI_CAMERA_VGA 

VGA format (640 x 480).

PI_CAMERA_QVGA 

QVGA format (320 x 240).

PI_CAMERA_QQVGA 

QQVGA format (160 x 120).

This is the comand ID option passed as third argument to pi_camera_control.

Enumerator
PI_CAMERA_NO_OPT 

No option (for back compatibility).

PI_CAMERA_OPT_NO_REG_INIT 

Do not initialize camera register, nor reset it.

Function Documentation

void pi_camera_capture ( struct pi_device *  device,
void *  buffer,
uint32_t  size 
)

Queue a buffer that will receive Camera samples. The samples will start being stored in the provided buffer as soon as the camera is started. If it is already started, it starts storing them immediately. On some chips, the start of the sampling may be differed to the next start of frame, see chip-specific section for more details. The caller is blocked until the transfer is finished.

Parameters
deviceThe device structure of the device where to capture samples.
bufferThe memory buffer where the captured samples will be transfered.
sizeThe size in bytes of the memory buffer.
static void pi_camera_capture_async ( struct pi_device *  device,
void *  buffer,
uint32_t  size,
pi_task_t *  task 
)
inlinestatic

Queue a buffer that will receive Camera samples. The samples will start being stored in the provided buffer as soon as the camera is started. If it is already started, it starts storing them immediately. On some chips, the start of the sampling may be differed to the next start of frame, see chip-specific section for more details. It is possible to call this function asynchronously and several times in order to queue several buffers. At a minimum 2 buffers should be queued to ensure that no data sampled is lost. This is also the most efficient way to retrieve data from the Camera device. You should always make sure that at least 2 buffers are always queued, by queuing a new one as soon as the current one is full. Can only be called from fabric-controller side. A task must be specified in order to specify how the caller should be notified when the transfer is finished.

Parameters
deviceThe device structure of the device where to capture samples.
bufferThe memory buffer where the captured samples will be transfered.
sizeThe size in bytes of the memory buffer.
taskThe task used to notify the end of transfer. See the documentation of pi_task_t for more details.
static void pi_camera_close ( struct pi_device *  device)
inlinestatic

This function can be called to close an opened Camera device once it is not needed anymore in order to free all allocated resources. Once this function is called, the device is not accessible anymore and must be opened again before being used.

Parameters
deviceThe device structure of the device to close.
static int32_t pi_camera_control ( struct pi_device *  device,
pi_camera_cmd_e  cmd,
void *  arg 
)
inlinestatic

This function is used to control and configure the Camera device. For each command, the arguments necessary are listed below:

CMD Type of argument
CMD_ON NULL
CMD_OFF NULL
CMD_START NULL
CMD_STOP NULL
Parameters
deviceThe device structure of the device to control.
cmdThe command for controlling or configuring the camera. Check the description of pi_camera_cmd_e for further information.
*argA pointer to the arguments of the command.
Returns
0 if the operation is successfull, -1 if there was an error.
int32_t pi_camera_open ( struct pi_device *  device)

This function must be called before the Camera device can be used. It will do all the needed configuration to make it usable and initialize the handle used to refer to this opened device when calling other functions.

Parameters
deviceA pointer to the device structure of the device to open.
Returns
0 if the operation is successfull, -1 if there was an error.
static int32_t pi_camera_reg_get ( struct pi_device *  device,
uint32_t  reg_addr,
uint8_t *  value 
)
inlinestatic

This can be called to get a camera register. The list of registers is specific to each camera, see the documentation of the camera for more information.

Parameters
deviceThe device structure of the camera.
reg_addrThe register address.
valueA pointer to the value where the read value will be stored. The size of this variable depends on the register being accessed.
static int32_t pi_camera_reg_set ( struct pi_device *  device,
uint32_t  reg_addr,
uint8_t *  value 
)
inlinestatic

This can be called to set a camera register. This must be used carefully as this can disturb the behavior of the other calls. The list of registers is specific to each camera, see the documentation of the camera for more information.

Parameters
deviceThe device structure of the camera.
reg_addrThe register address.
valueA pointer to the value to be set. The size of this variable depends on the register being accessed.