update camera module

This commit is contained in:
Stanislaw Kaushanski 2024-11-27 09:02:20 +01:00
parent 7fc7e97fe3
commit 800dd52519

View File

@ -3,8 +3,8 @@
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Generated at 2024-09-10 14:29:50 UTC * Generated at 2024-11-26 17:02:43 UTC
* by peakrdl_mnrs version 1.2.9 * by peakrdl_mnrs version 1.2.7
*/ */
#ifndef _BSP_CAMERA_H #ifndef _BSP_CAMERA_H
@ -14,6 +14,9 @@
typedef struct { typedef struct {
volatile uint32_t PIXEL; volatile uint32_t PIXEL;
volatile uint32_t CONFIG;
volatile uint32_t DATA_SIZE;
volatile uint32_t START;
volatile uint32_t STATUS; volatile uint32_t STATUS;
volatile uint32_t CAMERA_CLOCK_CTRL; volatile uint32_t CAMERA_CLOCK_CTRL;
volatile uint32_t IE; volatile uint32_t IE;
@ -21,9 +24,73 @@ typedef struct {
}camera_t; }camera_t;
#define CAMERA_PIXEL_OFFS 0 #define CAMERA_PIXEL_OFFS 0
#define CAMERA_PIXEL_MASK 0x7ff #define CAMERA_PIXEL_MASK 0xffffffff
#define CAMERA_PIXEL(V) ((V & CAMERA_PIXEL_MASK) << CAMERA_PIXEL_OFFS) #define CAMERA_PIXEL(V) ((V & CAMERA_PIXEL_MASK) << CAMERA_PIXEL_OFFS)
#define CAMERA_CONFIG_ROWS_IN_RESET_OFFS 0
#define CAMERA_CONFIG_ROWS_IN_RESET_MASK 0xff
#define CAMERA_CONFIG_ROWS_IN_RESET(V) ((V & CAMERA_CONFIG_ROWS_IN_RESET_MASK) << CAMERA_CONFIG_ROWS_IN_RESET_OFFS)
#define CAMERA_CONFIG_VRST_PIX_OFFS 8
#define CAMERA_CONFIG_VRST_PIX_MASK 0x3
#define CAMERA_CONFIG_VRST_PIX(V) ((V & CAMERA_CONFIG_VRST_PIX_MASK) << CAMERA_CONFIG_VRST_PIX_OFFS)
#define CAMERA_CONFIG_RAMP_GAIN_OFFS 10
#define CAMERA_CONFIG_RAMP_GAIN_MASK 0x3
#define CAMERA_CONFIG_RAMP_GAIN(V) ((V & CAMERA_CONFIG_RAMP_GAIN_MASK) << CAMERA_CONFIG_RAMP_GAIN_OFFS)
#define CAMERA_CONFIG_OFFSET_RAMP_OFFS 12
#define CAMERA_CONFIG_OFFSET_RAMP_MASK 0x3
#define CAMERA_CONFIG_OFFSET_RAMP(V) ((V & CAMERA_CONFIG_OFFSET_RAMP_MASK) << CAMERA_CONFIG_OFFSET_RAMP_OFFS)
#define CAMERA_CONFIG_OUTPUT_CURR_OFFS 14
#define CAMERA_CONFIG_OUTPUT_CURR_MASK 0x3
#define CAMERA_CONFIG_OUTPUT_CURR(V) ((V & CAMERA_CONFIG_OUTPUT_CURR_MASK) << CAMERA_CONFIG_OUTPUT_CURR_OFFS)
#define CAMERA_CONFIG_ROWS_DELAY_OFFS 16
#define CAMERA_CONFIG_ROWS_DELAY_MASK 0x1f
#define CAMERA_CONFIG_ROWS_DELAY(V) ((V & CAMERA_CONFIG_ROWS_DELAY_MASK) << CAMERA_CONFIG_ROWS_DELAY_OFFS)
#define CAMERA_CONFIG_BIAS_CURR_INCREASE_OFFS 21
#define CAMERA_CONFIG_BIAS_CURR_INCREASE_MASK 0x1
#define CAMERA_CONFIG_BIAS_CURR_INCREASE(V) ((V & CAMERA_CONFIG_BIAS_CURR_INCREASE_MASK) << CAMERA_CONFIG_BIAS_CURR_INCREASE_OFFS)
#define CAMERA_CONFIG_CDS_GAIN_OFFS 22
#define CAMERA_CONFIG_CDS_GAIN_MASK 0x1
#define CAMERA_CONFIG_CDS_GAIN(V) ((V & CAMERA_CONFIG_CDS_GAIN_MASK) << CAMERA_CONFIG_CDS_GAIN_OFFS)
#define CAMERA_CONFIG_OUTPUT_MODE_OFFS 23
#define CAMERA_CONFIG_OUTPUT_MODE_MASK 0x1
#define CAMERA_CONFIG_OUTPUT_MODE(V) ((V & CAMERA_CONFIG_OUTPUT_MODE_MASK) << CAMERA_CONFIG_OUTPUT_MODE_OFFS)
#define CAMERA_CONFIG_MCLK_MODE_OFFS 24
#define CAMERA_CONFIG_MCLK_MODE_MASK 0x3
#define CAMERA_CONFIG_MCLK_MODE(V) ((V & CAMERA_CONFIG_MCLK_MODE_MASK) << CAMERA_CONFIG_MCLK_MODE_OFFS)
#define CAMERA_CONFIG_VREF_OFFS 26
#define CAMERA_CONFIG_VREF_MASK 0x3
#define CAMERA_CONFIG_VREF(V) ((V & CAMERA_CONFIG_VREF_MASK) << CAMERA_CONFIG_VREF_OFFS)
#define CAMERA_CONFIG_CVC_CURR_OFFS 28
#define CAMERA_CONFIG_CVC_CURR_MASK 0x3
#define CAMERA_CONFIG_CVC_CURR(V) ((V & CAMERA_CONFIG_CVC_CURR_MASK) << CAMERA_CONFIG_CVC_CURR_OFFS)
#define CAMERA_CONFIG_IDLE_MODE_OFFS 30
#define CAMERA_CONFIG_IDLE_MODE_MASK 0x1
#define CAMERA_CONFIG_IDLE_MODE(V) ((V & CAMERA_CONFIG_IDLE_MODE_MASK) << CAMERA_CONFIG_IDLE_MODE_OFFS)
#define CAMERA_CONFIG_HIGH_SPEED_OFFS 31
#define CAMERA_CONFIG_HIGH_SPEED_MASK 0x1
#define CAMERA_CONFIG_HIGH_SPEED(V) ((V & CAMERA_CONFIG_HIGH_SPEED_MASK) << CAMERA_CONFIG_HIGH_SPEED_OFFS)
#define CAMERA_DATA_SIZE_OFFS 0
#define CAMERA_DATA_SIZE_MASK 0xf
#define CAMERA_DATA_SIZE(V) ((V & CAMERA_DATA_SIZE_MASK) << CAMERA_DATA_SIZE_OFFS)
#define CAMERA_START_OFFS 0
#define CAMERA_START_MASK 0x1
#define CAMERA_START(V) ((V & CAMERA_START_MASK) << CAMERA_START_OFFS)
#define CAMERA_STATUS_OFFS 0 #define CAMERA_STATUS_OFFS 0
#define CAMERA_STATUS_MASK 0x1 #define CAMERA_STATUS_MASK 0x1
#define CAMERA_STATUS(V) ((V & CAMERA_STATUS_MASK) << CAMERA_STATUS_OFFS) #define CAMERA_STATUS(V) ((V & CAMERA_STATUS_MASK) << CAMERA_STATUS_OFFS)
@ -50,16 +117,130 @@ typedef struct {
//CAMERA_PIXEL //CAMERA_PIXEL
inline uint32_t get_camera_pixel(volatile camera_t* reg){ inline uint32_t get_camera_pixel(volatile camera_t* reg){
return reg->PIXEL; return (reg->PIXEL >> 0) & 0xffffffff;
} }
inline void set_camera_pixel(volatile camera_t* reg, uint32_t value){ inline void set_camera_pixel(volatile camera_t* reg, uint32_t value){
reg->PIXEL = value; reg->PIXEL = (reg->PIXEL & ~(0xffffffffU << 0)) | (value << 0);
} }
inline uint32_t get_camera_pixel_data(volatile camera_t* reg){
return (reg->PIXEL >> 0) & 0x7ff; //CAMERA_CONFIG
inline uint32_t get_camera_config(volatile camera_t* reg){
return reg->CONFIG;
} }
inline void set_camera_pixel_data(volatile camera_t* reg, uint16_t value){ inline void set_camera_config(volatile camera_t* reg, uint32_t value){
reg->PIXEL = (reg->PIXEL & ~(0x7ffU << 0)) | (value << 0); reg->CONFIG = value;
}
inline uint32_t get_camera_config_rows_in_reset(volatile camera_t* reg){
return (reg->CONFIG >> 0) & 0xff;
}
inline void set_camera_config_rows_in_reset(volatile camera_t* reg, uint8_t value){
reg->CONFIG = (reg->CONFIG & ~(0xffU << 0)) | (value << 0);
}
inline uint32_t get_camera_config_vrst_pix(volatile camera_t* reg){
return (reg->CONFIG >> 8) & 0x3;
}
inline void set_camera_config_vrst_pix(volatile camera_t* reg, uint8_t value){
reg->CONFIG = (reg->CONFIG & ~(0x3U << 8)) | (value << 8);
}
inline uint32_t get_camera_config_ramp_gain(volatile camera_t* reg){
return (reg->CONFIG >> 10) & 0x3;
}
inline void set_camera_config_ramp_gain(volatile camera_t* reg, uint8_t value){
reg->CONFIG = (reg->CONFIG & ~(0x3U << 10)) | (value << 10);
}
inline uint32_t get_camera_config_offset_ramp(volatile camera_t* reg){
return (reg->CONFIG >> 12) & 0x3;
}
inline void set_camera_config_offset_ramp(volatile camera_t* reg, uint8_t value){
reg->CONFIG = (reg->CONFIG & ~(0x3U << 12)) | (value << 12);
}
inline uint32_t get_camera_config_output_curr(volatile camera_t* reg){
return (reg->CONFIG >> 14) & 0x3;
}
inline void set_camera_config_output_curr(volatile camera_t* reg, uint8_t value){
reg->CONFIG = (reg->CONFIG & ~(0x3U << 14)) | (value << 14);
}
inline uint32_t get_camera_config_rows_delay(volatile camera_t* reg){
return (reg->CONFIG >> 16) & 0x1f;
}
inline void set_camera_config_rows_delay(volatile camera_t* reg, uint8_t value){
reg->CONFIG = (reg->CONFIG & ~(0x1fU << 16)) | (value << 16);
}
inline uint32_t get_camera_config_bias_curr_increase(volatile camera_t* reg){
return (reg->CONFIG >> 21) & 0x1;
}
inline void set_camera_config_bias_curr_increase(volatile camera_t* reg, uint8_t value){
reg->CONFIG = (reg->CONFIG & ~(0x1U << 21)) | (value << 21);
}
inline uint32_t get_camera_config_cds_gain(volatile camera_t* reg){
return (reg->CONFIG >> 22) & 0x1;
}
inline void set_camera_config_cds_gain(volatile camera_t* reg, uint8_t value){
reg->CONFIG = (reg->CONFIG & ~(0x1U << 22)) | (value << 22);
}
inline uint32_t get_camera_config_output_mode(volatile camera_t* reg){
return (reg->CONFIG >> 23) & 0x1;
}
inline void set_camera_config_output_mode(volatile camera_t* reg, uint8_t value){
reg->CONFIG = (reg->CONFIG & ~(0x1U << 23)) | (value << 23);
}
inline uint32_t get_camera_config_mclk_mode(volatile camera_t* reg){
return (reg->CONFIG >> 24) & 0x3;
}
inline void set_camera_config_mclk_mode(volatile camera_t* reg, uint8_t value){
reg->CONFIG = (reg->CONFIG & ~(0x3U << 24)) | (value << 24);
}
inline uint32_t get_camera_config_vref(volatile camera_t* reg){
return (reg->CONFIG >> 26) & 0x3;
}
inline void set_camera_config_vref(volatile camera_t* reg, uint8_t value){
reg->CONFIG = (reg->CONFIG & ~(0x3U << 26)) | (value << 26);
}
inline uint32_t get_camera_config_cvc_curr(volatile camera_t* reg){
return (reg->CONFIG >> 28) & 0x3;
}
inline void set_camera_config_cvc_curr(volatile camera_t* reg, uint8_t value){
reg->CONFIG = (reg->CONFIG & ~(0x3U << 28)) | (value << 28);
}
inline uint32_t get_camera_config_idle_mode(volatile camera_t* reg){
return (reg->CONFIG >> 30) & 0x1;
}
inline void set_camera_config_idle_mode(volatile camera_t* reg, uint8_t value){
reg->CONFIG = (reg->CONFIG & ~(0x1U << 30)) | (value << 30);
}
inline uint32_t get_camera_config_high_speed(volatile camera_t* reg){
return (reg->CONFIG >> 31) & 0x1;
}
inline void set_camera_config_high_speed(volatile camera_t* reg, uint8_t value){
reg->CONFIG = (reg->CONFIG & ~(0x1U << 31)) | (value << 31);
}
//CAMERA_DATA_SIZE
inline uint32_t get_camera_data_size(volatile camera_t* reg){
return reg->DATA_SIZE;
}
inline void set_camera_data_size(volatile camera_t* reg, uint32_t value){
reg->DATA_SIZE = value;
}
inline uint32_t get_camera_data_size_data_size(volatile camera_t* reg){
return (reg->DATA_SIZE >> 0) & 0xf;
}
inline void set_camera_data_size_data_size(volatile camera_t* reg, uint8_t value){
reg->DATA_SIZE = (reg->DATA_SIZE & ~(0xfU << 0)) | (value << 0);
}
//CAMERA_START
inline uint32_t get_camera_start(volatile camera_t* reg){
return reg->START;
}
inline void set_camera_start(volatile camera_t* reg, uint32_t value){
reg->START = value;
}
inline uint32_t get_camera_start_start(volatile camera_t* reg){
return (reg->START >> 0) & 0x1;
}
inline void set_camera_start_start(volatile camera_t* reg, uint8_t value){
reg->START = (reg->START & ~(0x1U << 0)) | (value << 0);
} }
//CAMERA_STATUS //CAMERA_STATUS