drivers/video: Correct the code style

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao
2022-12-04 03:46:15 +08:00
committed by archer
parent 21e35362a3
commit 243983328a
7 changed files with 445 additions and 534 deletions
+251 -353
View File
File diff suppressed because it is too large Load Diff
+14 -15
View File
@@ -21,23 +21,23 @@
/****************************************************************************
* Included Files
****************************************************************************/
#include "video_framebuff.h"
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <nuttx/irq.h>
#include <nuttx/kmalloc.h>
#include "video_framebuff.h"
/****************************************************************************
* Private Functions
****************************************************************************/
static void init_buf_chain(video_framebuff_t *fbuf)
{
int i;
vbuf_container_t *tmp;
int i;
fbuf->vbuf_empty = fbuf->vbuf_alloced;
fbuf->vbuf_next = NULL;
@@ -53,14 +53,15 @@ static void init_buf_chain(video_framebuff_t *fbuf)
}
}
static inline int is_last_one(video_framebuff_t *fbuf)
static inline bool is_last_one(video_framebuff_t *fbuf)
{
return fbuf->vbuf_top == fbuf->vbuf_tail ? 1 : 0;
return fbuf->vbuf_top == fbuf->vbuf_tail;
}
static inline vbuf_container_t *dequeue_vbuf_unsafe(video_framebuff_t *fbuf)
{
vbuf_container_t *ret = fbuf->vbuf_top;
if (is_last_one(fbuf))
{
fbuf->vbuf_top = NULL;
@@ -125,7 +126,7 @@ vbuf_container_t *video_framebuff_get_container(video_framebuff_t *fbuf)
nxmutex_lock(&fbuf->lock_empty);
ret = fbuf->vbuf_empty;
if (ret)
if (ret != NULL)
{
fbuf->vbuf_empty = ret->next;
ret->next = NULL;
@@ -150,7 +151,7 @@ void video_framebuff_queue_container(video_framebuff_t *fbuf,
irqstate_t flags;
flags = enter_critical_section();
if (fbuf->vbuf_top)
if (fbuf->vbuf_top != NULL)
{
fbuf->vbuf_tail->next = tgt;
fbuf->vbuf_tail = tgt;
@@ -179,8 +180,8 @@ void video_framebuff_queue_container(video_framebuff_t *fbuf,
vbuf_container_t *video_framebuff_dq_valid_container(video_framebuff_t *fbuf)
{
irqstate_t flags;
vbuf_container_t *ret = NULL;
irqstate_t flags;
flags = enter_critical_section();
if (fbuf->vbuf_top != NULL && fbuf->vbuf_top != fbuf->vbuf_next)
@@ -189,15 +190,14 @@ vbuf_container_t *video_framebuff_dq_valid_container(video_framebuff_t *fbuf)
}
leave_critical_section(flags);
return ret;
}
vbuf_container_t *video_framebuff_get_vacant_container
(video_framebuff_t *fbuf)
vbuf_container_t *
video_framebuff_get_vacant_container(video_framebuff_t *fbuf)
{
irqstate_t flags;
vbuf_container_t *ret;
irqstate_t flags;
flags = enter_critical_section();
ret = fbuf->vbuf_curr = fbuf->vbuf_next;
@@ -209,7 +209,7 @@ vbuf_container_t *video_framebuff_get_vacant_container
void video_framebuff_capture_done(video_framebuff_t *fbuf)
{
fbuf->vbuf_curr = NULL;
if (fbuf->vbuf_next)
if (fbuf->vbuf_next != NULL)
{
fbuf->vbuf_next = fbuf->vbuf_next->next;
if (fbuf->vbuf_next == fbuf->vbuf_top) /* RING mode case. */
@@ -249,8 +249,8 @@ void video_framebuff_change_mode(video_framebuff_t *fbuf,
vbuf_container_t *video_framebuff_pop_curr_container(video_framebuff_t *fbuf)
{
irqstate_t flags;
vbuf_container_t *ret = NULL;
irqstate_t flags;
flags = enter_critical_section();
if (fbuf->vbuf_top != NULL)
@@ -259,6 +259,5 @@ vbuf_container_t *video_framebuff_pop_curr_container(video_framebuff_t *fbuf)
}
leave_critical_section(flags);
return ret;
}
+1 -1
View File
@@ -35,7 +35,7 @@
struct vbuf_container_s
{
struct v4l2_buffer buf; /* Buffer information */
struct vbuf_container_s *next; /* pointer to next buffer */
struct vbuf_container_s *next; /* Pointer to next buffer */
};
typedef struct vbuf_container_s vbuf_container_t;
+1 -1
View File
@@ -49,7 +49,7 @@
* Public Types
****************************************************************************/
/* structure for validate_frame_setting() and start_capture() */
/* Structure for validate_frame_setting() and start_capture() */
typedef struct imgdata_format_s
{
+16 -16
View File
@@ -94,7 +94,7 @@
#define IMGSENSOR_CLIP_INDEX_WIDTH (2)
#define IMGSENSOR_CLIP_INDEX_HEIGHT (3)
/* bit definition for IMGSENSOR_ID_3A_LOCK */
/* Bit definition for IMGSENSOR_ID_3A_LOCK */
#define IMGSENSOR_LOCK_EXPOSURE (1 << 0)
#define IMGSENSOR_LOCK_WHITE_BALANCE (1 << 1)
@@ -125,7 +125,7 @@
* Public Types
****************************************************************************/
/* enumeration for VIDEO_ID_COLORFX */
/* Enumeration for VIDEO_ID_COLORFX */
typedef enum imgsensor_colorfx_e
{
@@ -148,28 +148,28 @@ typedef enum imgsensor_colorfx_e
IMGSENSOR_COLORFX_PASTEL = 16,
} imgsensor_colorfx_t;
/* enumeration for IMGSENSOR_ID_EXPOSURE_AUTO */
/* Enumeration for IMGSENSOR_ID_EXPOSURE_AUTO */
typedef enum imgsensor_exposure_auto_type_e
{
/* exposure time:auto, iris aperture:auto */
/* Exposure time:auto, iris aperture:auto */
IMGSENSOR_EXPOSURE_AUTO = 0,
/* exposure time:manual, iris aperture:manual */
/* Exposure time:manual, iris aperture:manual */
IMGSENSOR_EXPOSURE_MANUAL = 1,
/* exposure time:manual, iris aperture:auto */
/* Exposure time:manual, iris aperture:auto */
IMGSENSOR_EXPOSURE_SHUTTER_PRIORITY = 2,
/* exposure time:auto, iris aperture:manual */
/* Exposure time:auto, iris aperture:manual */
IMGSENSOR_EXPOSURE_APERTURE_PRIORITY = 3
} imgsensor_exposure_auto_type_t;
/* enumeration for IMGSENSOR_ID_AUTO_N_PRESET_WHITE_BALANCE */
/* Enumeration for IMGSENSOR_ID_AUTO_N_PRESET_WHITE_BALANCE */
typedef enum imgsensor_white_balance_e
{
@@ -185,7 +185,7 @@ typedef enum imgsensor_white_balance_e
IMGSENSOR_WHITE_BALANCE_SHADE = 9,
} imgsensor_white_balance_t;
/* enumeration for IMGSENSOR_ID_ISO_SENSITIVITY_AUTO */
/* Enumeration for IMGSENSOR_ID_ISO_SENSITIVITY_AUTO */
typedef enum imgsensor_iso_sensitivity_auto_type_e
{
@@ -193,7 +193,7 @@ typedef enum imgsensor_iso_sensitivity_auto_type_e
IMGSENSOR_ISO_SENSITIVITY_AUTO = 1,
} imgsensor_iso_sensitivity_auto_type_t;
/* enumeration for IMGSENSOR_ID_EXPOSURE_METERING */
/* Enumeration for IMGSENSOR_ID_EXPOSURE_METERING */
typedef enum imgsensor_exposure_metering_e
{
@@ -203,7 +203,7 @@ typedef enum imgsensor_exposure_metering_e
IMGSENSOR_EXPOSURE_METERING_MATRIX = 3,
} imgsensor_exposure_metering_t;
/* enumeration for IMGSENSOR_ID_FLASH_LED_MODE */
/* Enumeration for IMGSENSOR_ID_FLASH_LED_MODE */
typedef enum imgsensor_flash_led_mode_e
{
@@ -212,7 +212,7 @@ typedef enum imgsensor_flash_led_mode_e
IMGSENSOR_FLASH_LED_MODE_TORCH = 2,
} imgsensor_flash_led_mode_t;
/* enumeration for get_supported_value() */
/* Enumeration for get_supported_value() */
typedef enum imgsensor_ctrl_type_e
{
@@ -229,7 +229,7 @@ typedef enum imgsensor_ctrl_type_e
IMGSENSOR_CTRL_TYPE_U32 = 0x0102,
} imgsensor_ctrl_type_t;
/* enumeration for stream */
/* Enumeration for stream */
typedef enum imgsensor_stream_type_e
{
@@ -237,7 +237,7 @@ typedef enum imgsensor_stream_type_e
IMGSENSOR_STREAM_TYPE_STILL = 1,
} imgsensor_stream_type_t;
/* structure for validate_frame_setting() and start_capture() */
/* Structure for validate_frame_setting() and start_capture() */
typedef struct imgsensor_format_s
{
@@ -252,7 +252,7 @@ typedef struct imgsensor_interval_s
uint32_t denominator;
} imgsensor_interval_t;
/* structure for get_supported_value() */
/* Structure for get_supported_value() */
typedef struct imgsensor_capability_range_s
{
@@ -279,7 +279,7 @@ typedef struct imgsensor_capability_elems_s
typedef struct imgsensor_supported_value_s
{
imgsensor_ctrl_type_t type; /* control type */
imgsensor_ctrl_type_t type; /* Control type */
union
{
/* Use 'range' member in the following types cases.
File diff suppressed because it is too large Load Diff
+13 -13
View File
@@ -56,14 +56,14 @@
#define V4L2_CID_COLOR_KILLER (15) /**< Color killer */
#define V4L2_CID_COLORFX (16) /**< Color effect */
/** enumeration for V4L2_CID_COLORFX */
/** Enumeration for V4L2_CID_COLORFX */
enum v4l2_colorfx
{
V4L2_COLORFX_NONE = 0, /**< no effect */
V4L2_COLORFX_NONE = 0, /**< No effect */
V4L2_COLORFX_BW = 1, /**< Black/white */
V4L2_COLORFX_SEPIA = 2, /**< Sepia */
V4L2_COLORFX_NEGATIVE = 3, /**< positive/negative inversion */
V4L2_COLORFX_NEGATIVE = 3, /**< Positive/negative inversion */
V4L2_COLORFX_EMBOSS = 4, /**< Emboss */
V4L2_COLORFX_SKETCH = 5, /**< Sketch */
V4L2_COLORFX_SKY_BLUE = 6, /**< Sky blue */
@@ -85,23 +85,23 @@ enum v4l2_colorfx
#define V4L2_CID_EXPOSURE_AUTO (0) /**< Auto exposure */
/** enumeration for V4L2_CID_EXPOSURE_AUTO */
/** Enumeration for V4L2_CID_EXPOSURE_AUTO */
enum v4l2_exposure_auto_type
{
/** exposure time:auto, iris aperture:auto */
/** Exposure time:auto, iris aperture:auto */
V4L2_EXPOSURE_AUTO = 0,
/** exposure time:manual, iris aperture:manual */
/** Exposure time:manual, iris aperture:manual */
V4L2_EXPOSURE_MANUAL = 1,
/** exposure time:manual, iris aperture:auto */
/** Exposure time:manual, iris aperture:auto */
V4L2_EXPOSURE_SHUTTER_PRIORITY = 2,
/** exposure time:auto, iris aperture:manual */
/** Exposure time:auto, iris aperture:manual */
V4L2_EXPOSURE_APERTURE_PRIORITY = 3
};
@@ -120,7 +120,7 @@ enum v4l2_exposure_auto_type
#define V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE (10) /**< Preset white balance */
/** enumeration for V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE */
/** Enumeration for V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE */
enum v4l2_auto_n_preset_white_balance
{
@@ -142,7 +142,7 @@ enum v4l2_auto_n_preset_white_balance
#define V4L2_CID_ISO_SENSITIVITY (13) /**< ISO sensitivity */
#define V4L2_CID_ISO_SENSITIVITY_AUTO (14) /**< Auto ISO sensitivity */
/** enumeration for V4L2_CID_ISO_SENSITIVITY_AUTO */
/** Enumeration for V4L2_CID_ISO_SENSITIVITY_AUTO */
enum v4l2_iso_sensitivity_auto_type
{
@@ -152,7 +152,7 @@ enum v4l2_iso_sensitivity_auto_type
#define V4L2_CID_EXPOSURE_METERING (15) /**< Exposure metering */
/** enumeration for V4L2_CID_EXPOSURE_METERING */
/** Enumeration for V4L2_CID_EXPOSURE_METERING */
enum v4l2_exposure_metering
{
@@ -164,7 +164,7 @@ enum v4l2_exposure_metering
#define V4L2_CID_SCENE_MODE (16) /**< Scene selection */
/** enumeration for V4L2_CID_SCENE_MODE */
/** Enumeration for V4L2_CID_SCENE_MODE */
enum v4l2_scene_mode
{
@@ -206,7 +206,7 @@ enum v4l2_scene_mode
#define V4L2_CID_FLASH_LED_MODE (0)
/** enumeration for V4L2_CID_FLASH_LED_MODE */
/** Enumeration for V4L2_CID_FLASH_LED_MODE */
enum v4l2_flash_led_mode
{