![]() |
![]() |
TI-RTOS Drivers
tidrivers_full_2_20_01_10
|
Camera driver interface.
============================================================================
The Camera header file should be included in an application as follows:
The Camera driver is used to retrieve the data being transferred by the Camera sensor. This driver provides API for capturing the image from the Camera sensor. The camera sensor control and implementation is the responsibility of the application using the interface.
The application initializes the Camera driver by calling Camera_init() and is then ready to open a Camera by calling Camera_open() and passing in a Camera parameters data structure.
The APIs in this driver serve as an interface to a typical TI-RTOS application. The specific peripheral implementations are responsible to create all the OSAL specific primitives to allow for thread-safe operation.
This module serves as the main interface for TI-RTOS applications. Its purpose is to redirect the module's APIs to specific peripheral implementations which are specified using a pointer to a Camera_FxnTable.
The Camera driver interface module is joined (at link time) to a NULL-terminated array of Camera_Config data structures named Camera_config. Camera_config is implemented in the application with each entry being an instance of a Camera peripheral. Each entry in Camera_config contains a:
#include <stdint.h>
#include <stddef.h>
Go to the source code of this file.
Data Structures | |
struct | Camera_Params |
Camera Parameters. More... | |
struct | Camera_FxnTable |
The definition of a Camera function table that contains the required set of functions to control a specific Camera driver implementation. More... | |
struct | Camera_Config |
Camera Global configuration. More... | |
Macros | |
#define | CAMERA_CMD_RESERVED 32 |
#define | CAMERA_STATUS_RESERVED -32 |
#define | CAMERA_STATUS_SUCCESS 0 |
Successful status code returned by Camera_control(). More... | |
#define | CAMERA_STATUS_ERROR -1 |
Generic error status code returned by Camera_control(). More... | |
#define | CAMERA_STATUS_UNDEFINEDCMD -2 |
An error status code returned by Camera_control() for undefined command codes. More... | |
#define | Camera_WAIT_FOREVER ~(0) |
Wait forever define. More... | |
Typedefs | |
typedef struct Camera_Config * | Camera_Handle |
A handle that is returned from a Camera_open() call. More... | |
typedef void(* | Camera_Callback) (Camera_Handle, void *buf, size_t bufferLength) |
The definition of a callback function used by the Camera driver when used in Camera_MODE_CALLBACK. More... | |
typedef enum Camera_CaptureMode | Camera_CaptureMode |
Camera capture mode settings. More... | |
typedef enum Camera_HSyncPolarity | Camera_HSyncPolarity |
Camera HSync polarity. More... | |
typedef enum Camera_VSyncPolarity | Camera_VSyncPolarity |
Camera VSync polarity. More... | |
typedef enum Camera_PixelClkConfig | Camera_PixelClkConfig |
Camera pixel clock configuration. More... | |
typedef enum Camera_ByteOrder | Camera_ByteOrder |
Camera byte order. More... | |
typedef enum Camera_IfSynchoronisation | Camera_IfSynchoronisation |
Camera interface synchoronisation. More... | |
typedef enum Camera_StopCaptureConfig | Camera_StopCaptureConfig |
Camera stop capture configuration. More... | |
typedef enum Camera_StartCaptureConfig | Camera_StartCaptureConfig |
Camera start capture configuration. More... | |
typedef struct Camera_Params | Camera_Params |
Camera Parameters. More... | |
typedef void(* | Camera_CloseFxn) (Camera_Handle handle) |
A function pointer to a driver specific implementation of Camera_close(). More... | |
typedef int(* | Camera_ControlFxn) (Camera_Handle handle, unsigned int cmd, void *arg) |
A function pointer to a driver specific implementation of Camera_control(). More... | |
typedef void(* | Camera_InitFxn) (Camera_Handle handle) |
A function pointer to a driver specific implementation of Camera_init(). More... | |
typedef Camera_Handle(* | Camera_OpenFxn) (Camera_Handle handle, Camera_Params *params) |
A function pointer to a driver specific implementation of Camera_open(). More... | |
typedef int(* | Camera_CaptureFxn) (Camera_Handle handle, void *buffer, size_t bufferlen) |
A function pointer to a driver specific implementation of Camera_capture(). More... | |
typedef struct Camera_FxnTable | Camera_FxnTable |
The definition of a Camera function table that contains the required set of functions to control a specific Camera driver implementation. More... | |
typedef struct Camera_Config | Camera_Config |
Camera Global configuration. More... | |
Functions | |
void | Camera_close (Camera_Handle handle) |
Function to close a Camera peripheral specified by the Camera handle. More... | |
int | Camera_control (Camera_Handle handle, uint32_t cmd, void *arg) |
Function performs implementation specific features on a given Camera_Handle. More... | |
void | Camera_init (void) |
Function to initializes the Camera module. More... | |
Camera_Handle | Camera_open (uint32_t index, Camera_Params *params) |
Function to initialize a given Camera peripheral specified by the particular index value. The parameter specifies which mode the Camera will operate. More... | |
void | Camera_Params_init (Camera_Params *params) |
Function to initialize the Camera_Params structure to its defaults. More... | |
int | Camera_capture (Camera_Handle handle, void *buffer, size_t bufferlen) |
Function that handles the Camera capture of a frame. More... | |
#define Camera_WAIT_FOREVER ~(0) |
Wait forever define.
typedef struct Camera_Config* Camera_Handle |
A handle that is returned from a Camera_open() call.
typedef void(* Camera_Callback) (Camera_Handle, void *buf, size_t bufferLength) |
The definition of a callback function used by the Camera driver when used in Camera_MODE_CALLBACK.
Camera_Handle | Camera_Handle |
buf | Pointer to capture buffer |
bufferLength | length of frame |
typedef enum Camera_CaptureMode Camera_CaptureMode |
Camera capture mode settings.
This enum defines the capture mode for the configured Camera.
typedef enum Camera_HSyncPolarity Camera_HSyncPolarity |
Camera HSync polarity.
This enum defines the polarity of the HSync signal.
typedef enum Camera_VSyncPolarity Camera_VSyncPolarity |
Camera VSync polarity.
This enum defines the polarity of the VSync signal.
typedef enum Camera_PixelClkConfig Camera_PixelClkConfig |
Camera pixel clock configuration.
This enum defines the pixel clock configuration.
typedef enum Camera_ByteOrder Camera_ByteOrder |
Camera byte order.
This enum defines the byte order of camera capture.
In normal mode, the byte order is: | byte3 | byte2 | byte1 | byte0 |
In swap mode, the bytes are ordered as: | byte2 | byte3 | byte0 | byte1 |
typedef enum Camera_IfSynchoronisation Camera_IfSynchoronisation |
Camera interface synchoronisation.
This enum defines the sensor to camera inteface synchoronisation configuration.
typedef enum Camera_StopCaptureConfig Camera_StopCaptureConfig |
Camera stop capture configuration.
This enum defines the stop capture configuration.
typedef enum Camera_StartCaptureConfig Camera_StartCaptureConfig |
Camera start capture configuration.
This enum defines the start capture configuration.
typedef struct Camera_Params Camera_Params |
Camera Parameters.
Camera parameters are used to with the Camera_open() call. Default values for these parameters are set using Camera_Params_init().
If Camera_CaptureMode is set to Camera_MODE_BLOCKING then Camera_capture function calls will block thread execution until the capture has completed.
If Camera_CaptureMode is set to Camera_MODE_CALLBACK then Camera_capture will not block thread execution and it will call the function specified by captureCallbackFxn.
typedef void(* Camera_CloseFxn) (Camera_Handle handle) |
A function pointer to a driver specific implementation of Camera_close().
typedef int(* Camera_ControlFxn) (Camera_Handle handle, unsigned int cmd, void *arg) |
A function pointer to a driver specific implementation of Camera_control().
typedef void(* Camera_InitFxn) (Camera_Handle handle) |
A function pointer to a driver specific implementation of Camera_init().
typedef Camera_Handle(* Camera_OpenFxn) (Camera_Handle handle, Camera_Params *params) |
A function pointer to a driver specific implementation of Camera_open().
typedef int(* Camera_CaptureFxn) (Camera_Handle handle, void *buffer, size_t bufferlen) |
A function pointer to a driver specific implementation of Camera_capture().
typedef struct Camera_FxnTable Camera_FxnTable |
The definition of a Camera function table that contains the required set of functions to control a specific Camera driver implementation.
typedef struct Camera_Config Camera_Config |
Camera Global configuration.
The Camera_Config structure contains a set of pointers used to characterize the Camera driver implementation.
This structure needs to be defined before calling Camera_init() and it must not be changed thereafter.
enum Camera_CaptureMode |
Camera capture mode settings.
This enum defines the capture mode for the configured Camera.
enum Camera_HSyncPolarity |
enum Camera_VSyncPolarity |
enum Camera_ByteOrder |
void Camera_close | ( | Camera_Handle | handle | ) |
Function to close a Camera peripheral specified by the Camera handle.
handle | A Camera_Handle returned from Camera_open |
int Camera_control | ( | Camera_Handle | handle, |
uint32_t | cmd, | ||
void * | arg | ||
) |
Function performs implementation specific features on a given Camera_Handle.
Commands for Camera_control can originate from Camera.h or from implementation specific Camera*.h (CameraCC3200.h, etc.. ) files. While commands from Camera.h are API portable across driver implementations, not all implementations may support all these commands. Conversely, commands from driver implementation specific Camera*.h files add unique driver capabilities but are not API portable across all Camera driver implementations.
Commands supported by Camera.h follow a Camera_CMD_<cmd> naming convention.
Commands supported by Camera*.h follow a Camera*_CMD_<cmd> naming convention.
Each control command defines arg differently. The types of arg are documented with each command.
See Camera_control command codes for command codes.
See Camera_control return status codes for status codes.
handle | A Camera handle returned from Camera_open() |
cmd | Camera.h or Camera*.h commands. |
arg | An optional R/W (read/write) command argument accompanied with cmd |
void Camera_init | ( | void | ) |
Function to initializes the Camera module.
Camera_Handle Camera_open | ( | uint32_t | index, |
Camera_Params * | params | ||
) |
Function to initialize a given Camera peripheral specified by the particular index value. The parameter specifies which mode the Camera will operate.
index | Logical peripheral number for the Camera indexed into the Camera_config table |
params | Pointer to an parameter block, if NULL it will use default values. All the fields in this structure are RO (read-only). |
void Camera_Params_init | ( | Camera_Params * | params | ) |
Function to initialize the Camera_Params structure to its defaults.
params | An pointer to Camera_Params structure for initialization |
Defaults values are: captureMode = Camera_MODE_BLOCKING; outputClock = 24000000; hsyncPolarity = Camera_HSYNC_POLARITY_HIGH; vsyncPolarity = Camera_VSYNC_POLARITY_HIGH; pixelClkConfig = Camera_PCLK_CONFIG_RISING_EDGE; byteOrder = Camera_BYTE_ORDER_NORMAL; interfaceSync = Camera_INTERFACE_SYNC_ON; stopConfig = Camera_STOP_CAPTURE_FRAME_END; startConfig = Camera_START_CAPTURE_FRAME_START; captureTimeout = Camera_WAIT_FOREVER; captureCallback = NULL;
int Camera_capture | ( | Camera_Handle | handle, |
void * | buffer, | ||
size_t | bufferlen | ||
) |
Function that handles the Camera capture of a frame.
In Camera_MODE_BLOCKING, Camera_capture will block task execution until the capture is complete.
In Camera_MODE_CALLBACK, Camera_capture does not block task execution and calls a callback function specified by captureCallbackFxn. The Camera buffer must stay persistent until the Camera_capture function has completed!
handle | A Camera_Handle |
buffer | A pointer to a WO (write-only) buffer into which the captured frame is placed |
bufferlen | Length (in bytes) of the capture buffer |