Skip to content

Commit

Permalink
Merge branch 'feat/csi_driver' into 'master'
Browse files Browse the repository at this point in the history
feat(csi): added csi driver

See merge request espressif/esp-idf!28751
  • Loading branch information
Icarus113 committed Feb 5, 2024
2 parents 5454d37 + 46cf31e commit 116c949
Show file tree
Hide file tree
Showing 36 changed files with 1,658 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitlab/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
/components/esp_adc/ @esp-idf-codeowners/peripherals
/components/esp_app_format/ @esp-idf-codeowners/system @esp-idf-codeowners/app-utilities
/components/esp_bootloader_format/ @esp-idf-codeowners/system @esp-idf-codeowners/app-utilities
/components/esp_cam_ctlr/ @esp-idf-codeowners/peripherals
/components/esp_coex/ @esp-idf-codeowners/wifi @esp-idf-codeowners/bluetooth @esp-idf-codeowners/ieee802154
/components/esp_common/ @esp-idf-codeowners/system
/components/esp_driver_*/ @esp-idf-codeowners/peripherals
Expand Down
13 changes: 13 additions & 0 deletions components/esp_cam_ctlr/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
set(srcs "esp_cam_ctlr.c")

set(include "include" "interface")

if(CONFIG_SOC_MIPI_CSI_SUPPORTED)
list(APPEND srcs "csi/src/esp_cam_ctlr_csi.c")
list(APPEND include "csi/include")
endif()

idf_component_register(SRCS ${srcs}
INCLUDE_DIRS ${include}
PRIV_REQUIRES esp_mm
)
11 changes: 11 additions & 0 deletions components/esp_cam_ctlr/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
menu "ESP Camera Controller Configurations"
depends on SOC_MIPI_CSI_SUPPORTED

config MIPI_CSI_ISR_IRAM_SAFE
bool "CSI ISR IRAM-Safe"
default n
help
Ensure the CSI driver ISR is IRAM-Safe. When enabled, the ISR handler
will be available when the cache is disabled.

endmenu # ESP Camera Controller Configurations
56 changes: 56 additions & 0 deletions components/esp_cam_ctlr/csi/include/esp_cam_ctlr_csi.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once

#include <stdint.h>
#include <stdbool.h>
#include "esp_err.h"
#include "hal/mipi_csi_types.h"
#include "esp_cam_ctlr_types.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* @brief ESP CAM controller max timeout value
*/
#define ESP_CAM_CTLR_MAX_DELAY UINT32_MAX

/**
* @brief ESP CAM CSI controller configurations
*/
typedef struct {
int ctlr_id; ///< CSI controller ID
mipi_csi_phy_clock_source_t clk_src; ///< CSI phy clock source
uint32_t h_res; ///< Input horizontal resolution, i.e. the number of pixels in a line
uint32_t v_res; ///< Input vertical resolution, i.e. the number of lines in a frame
uint8_t data_lane_num; ///< Data lane num
int clk_freq_hz; ///< Frequency of CLK, in Hz.
mipi_csi_color_t input_data_color_type; ///< Input color type
mipi_csi_color_t output_data_color_type; ///< Output color type
bool byte_swap_en; ///< Enable byte swap
int queue_items; ///< Queue itmes
} esp_cam_ctlr_csi_config_t;

/**
* @brief New ESP CAM CSI controller
*
* @param[in] config CSI controller configurations
* @param[out] ret_handle Returned ESP CAM controller handle
*
* @return
* - ESP_OK
* - ESP_ERR_INVALID_ARG: Invalid argument
* - ESP_ERR_NO_MEM: Out of memory
* - ESP_ERR_NOT_SUPPORTED: Currently not support modes or types
* - ESP_ERR_NOT_FOUND: CSI is registered already
*/
esp_err_t esp_cam_new_csi_ctlr(const esp_cam_ctlr_csi_config_t *config, esp_cam_ctlr_handle_t *ret_handle);

#ifdef __cplusplus
}
#endif
Loading

0 comments on commit 116c949

Please sign in to comment.