Synergy Software Package User's Manual

Driver for the Parallel Data Capture Unit (PDC). More...

Data Structures

struct  pdc_instance_ctrl_t
 

Functions

ssp_err_t R_PDC_Open (pdc_ctrl_t *const p_api_ctrl, pdc_cfg_t const *const p_cfg)
 Powers on PDC, handles required initialization described in the hardware manual. Implements pdc_api_t::open. More...
 
ssp_err_t R_PDC_Close (pdc_ctrl_t *const p_api_ctrl)
 Stops and closes the transfer interface, disables the PDC, powers off the PDC, clears internal driver data and disables interrupts. Implements pdc_api_t::close. More...
 
ssp_err_t R_PDC_CaptureStart (pdc_ctrl_t *const p_api_ctrl, uint8_t *const p_buffer)
 Starts a capture. Enables interrupts. Implements pdc_api_t::captureStart. More...
 
ssp_err_t R_PDC_StateGet (pdc_ctrl_t *const p_api_ctrl, pdc_state_t *p_state)
 Returns the state of the VSYNC and HSYNC pins.Implements pdc_api_t::stateGet. More...
 
ssp_err_t R_PDC_VersionGet (ssp_version_t *const p_data)
 Return PDC HAL driver version. Implements pdc_api_t::versionGet. More...
 

Detailed Description

Driver for the Parallel Data Capture Unit (PDC).

Summary

extends PDC Interface The PDC interface allows the capturing of an image from a camera module.

Function Documentation

◆ R_PDC_CaptureStart()

ssp_err_t R_PDC_CaptureStart ( pdc_ctrl_t *const  p_api_ctrl,
uint8_t *const  p_buffer 
)

Starts a capture. Enables interrupts. Implements pdc_api_t::captureStart.

Sets up the transfer interface to transfer data from the PDC into the specified buffer. Configures the PDC settings as previously set by the pdc_api_t::open API. These settings are configured here as the PIXCLK input must be active for the PDC reset operation. When a capture is complete the callback registered during pdc_api_t::open API call will be called.

Return values
SSP_SUCCESSCapture start successful.
SSP_ERR_ASSERTIONOne of the following parameters is incorrect. Either
  • p_api_ctrl is NULL, OR
  • low level transfer is not assigned, OR
  • low level transfer APIs are not assigned
  • buffer is not assigned, assign buffer
SSP_ERR_NOT_OPENOpen has not been successfully called.
SSP_ERR_IN_USEPdc transfer is already in progress, wait for transfer to complete.
SSP_ERR_TIMEOUTReset operation timed out.
Returns
See Common Error Codes or functions called by this function for other possible return codes. This function calls:
Note
If the PIXCLK is being generated by a camera module the camera must be configured after the call to pdc_api_t::open and before the call to pdc_api_t::captureStart. This function is not reentrant.

The user is responsible to ensuring that the memory pointed to by p_buffer is both valid and large enough to store a complete image. The amount of space required, in bytes can be calculated as shown:

size (bytes) = image width (pixels) * image height (lines) * number of bytes per pixel

Set up transfer interface

Configure the transfer interface

Open transfer interface

Wait for reset to complete

Set horizontal capture range

Set horizontal capture size

Set vertical capture range

Set vertical capture size

Set VSYNC polarity

Set HSYNC polarity

Set endianess of capture data

Enable interrupts: Receive data ready interrupt, Underrun interrupt, Overrun interrupt, Frame end interrupt, Vertical line number setting error interrupt, Horizontal byte number setting error interrupt

◆ R_PDC_Close()

ssp_err_t R_PDC_Close ( pdc_ctrl_t *const  p_api_ctrl)

Stops and closes the transfer interface, disables the PDC, powers off the PDC, clears internal driver data and disables interrupts. Implements pdc_api_t::close.

Return values
SSP_SUCCESSSuccessful close.
SSP_ERR_ASSERTIONOne of the following parameters is incorrect. Either
  • p_api_ctrl is NULL, OR
  • low level transfer is not assigned, OR
  • low level transfer APIs are not assigned
SSP_ERR_NOT_OPENOpen has not been successfully called.
Returns
See Common Error Codes or functions called by this function for other possible return codes. This function calls:
Note
This API will close the PDC driver. If a capture is in progress it will be stopped. This function is reentrant.

Disable all interrupts.

Enable module stop mode for PDC

Unlock the PDC Hardware Resource

◆ R_PDC_Open()

ssp_err_t R_PDC_Open ( pdc_ctrl_t *const  p_api_ctrl,
pdc_cfg_t const *const  p_cfg 
)

Powers on PDC, handles required initialization described in the hardware manual. Implements pdc_api_t::open.

The Open function provides initial configuration for the PDC module. It powers on the module and enables the PCLKO output and the PIXCLK input. Further initialization requires the PIXCLK input to be running in order to be able to reset the PDC as part of its initialization. This clock is input from a camera module and so the reset and further initialization is performed in pdc_api_t::captureStart. This function should be called once prior to calling any other PDC API functions. After the PDC is opened the Open function should not be called again without first calling the Close function.

Return values
SSP_SUCCESSInitialization was successful.
SSP_ERR_ASSERTIONOne of the following parameters is incorrect. Either
  • p_cfg is NULL, OR
  • p_api_ctrl is NULL, OR
  • The pointer to the transfer interface in the p_cfg parameter is NULL
SSP_ERR_INVALID_ARGUMENTOne of the following configuration parameters is incorrect. Either
  • bytes_per_pixel is zero, OR
  • x_capture_pixels is zero, OR
  • y_capture_pixels is zero, OR
  • x_capture_start_pixel + x_capture_pixels is greater than 4095, OR
  • y_capture_start_pixel + y_capture_pixels is greater than 4095
SSP_ERR_HW_LOCKEDUnable to reserve BSP hardware lock for this module.
Returns
See Common Error Codes or functions called by this function for other possible return codes. This function calls:
Note
This function is not reentrant.

Lock the PDC Hardware Resource

Disable module stop mode for PDC

Set PCLKB divider

Enable PCLKO output

Enable the PIXCLK input

Mark driver as open by initializing it to "PDC" in its ASCII equivalent

◆ R_PDC_StateGet()

ssp_err_t R_PDC_StateGet ( pdc_ctrl_t *const  p_api_ctrl,
pdc_state_t p_state 
)

Returns the state of the VSYNC and HSYNC pins.Implements pdc_api_t::stateGet.

Return values
SSP_SUCCESSState read successful.
SSP_ERR_ASSERTIONp_api_ctrl is NULL OR p_state is NULL
SSP_ERR_NOT_OPENOpen has not been successfully called.
Note
This function is reentrant.

Check if the driver is open

Get the contents of PCMONR register

Update vsync signal state

Update hsync signal state

◆ R_PDC_VersionGet()

ssp_err_t R_PDC_VersionGet ( ssp_version_t *const  p_data)

Return PDC HAL driver version. Implements pdc_api_t::versionGet.

Return values
SSP_SUCCESSVersion information successfully read.
SSP_ERR_ASSERTIONNull pointer passed as a parameter
Note
This function is reentrant.