2024-05-30 18:32:23 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2023 - 2024 MINRES Technologies GmbH
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
2024-08-02 09:55:38 +02:00
|
|
|
* Generated at 2024-08-02 08:46:07 UTC
|
|
|
|
* by peakrdl_mnrs version 1.2.7
|
2024-05-30 18:32:23 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _BSP_CAMERA_H
|
|
|
|
#define _BSP_CAMERA_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
typedef struct __attribute((__packed__)) {
|
|
|
|
volatile uint32_t PIXEL;
|
|
|
|
volatile uint32_t CONTROL;
|
|
|
|
volatile uint32_t STATUS;
|
|
|
|
volatile uint32_t CAMERA_CLOCK_CTRL;
|
|
|
|
volatile uint32_t IE;
|
|
|
|
volatile uint32_t IP;
|
|
|
|
}camera_t;
|
|
|
|
|
|
|
|
#define CAMERA_PIXEL_OFFS 0
|
|
|
|
#define CAMERA_PIXEL_MASK 0x7ff
|
|
|
|
#define CAMERA_PIXEL(V) ((V & CAMERA_PIXEL_MASK) << CAMERA_PIXEL_OFFS)
|
|
|
|
|
|
|
|
#define CAMERA_CONTROL_OFFS 0
|
|
|
|
#define CAMERA_CONTROL_MASK 0x1
|
|
|
|
#define CAMERA_CONTROL(V) ((V & CAMERA_CONTROL_MASK) << CAMERA_CONTROL_OFFS)
|
|
|
|
|
|
|
|
#define CAMERA_STATUS_ENABLED_OFFS 0
|
|
|
|
#define CAMERA_STATUS_ENABLED_MASK 0x1
|
|
|
|
#define CAMERA_STATUS_ENABLED(V) ((V & CAMERA_STATUS_ENABLED_MASK) << CAMERA_STATUS_ENABLED_OFFS)
|
|
|
|
|
|
|
|
#define CAMERA_STATUS_ACTIVE_OFFS 1
|
|
|
|
#define CAMERA_STATUS_ACTIVE_MASK 0x1
|
|
|
|
#define CAMERA_STATUS_ACTIVE(V) ((V & CAMERA_STATUS_ACTIVE_MASK) << CAMERA_STATUS_ACTIVE_OFFS)
|
|
|
|
|
|
|
|
#define CAMERA_STATUS_PIXEL_AVAIL_OFFS 2
|
|
|
|
#define CAMERA_STATUS_PIXEL_AVAIL_MASK 0x1
|
|
|
|
#define CAMERA_STATUS_PIXEL_AVAIL(V) ((V & CAMERA_STATUS_PIXEL_AVAIL_MASK) << CAMERA_STATUS_PIXEL_AVAIL_OFFS)
|
|
|
|
|
|
|
|
#define CAMERA_CAMERA_CLOCK_CTRL_OFFS 0
|
|
|
|
#define CAMERA_CAMERA_CLOCK_CTRL_MASK 0xfffff
|
|
|
|
#define CAMERA_CAMERA_CLOCK_CTRL(V) ((V & CAMERA_CAMERA_CLOCK_CTRL_MASK) << CAMERA_CAMERA_CLOCK_CTRL_OFFS)
|
|
|
|
|
|
|
|
#define CAMERA_IE_EN_PIXEL_AVAIL_OFFS 0
|
|
|
|
#define CAMERA_IE_EN_PIXEL_AVAIL_MASK 0x1
|
|
|
|
#define CAMERA_IE_EN_PIXEL_AVAIL(V) ((V & CAMERA_IE_EN_PIXEL_AVAIL_MASK) << CAMERA_IE_EN_PIXEL_AVAIL_OFFS)
|
|
|
|
|
|
|
|
#define CAMERA_IE_EN_FRAME_FINISHED_OFFS 1
|
|
|
|
#define CAMERA_IE_EN_FRAME_FINISHED_MASK 0x1
|
|
|
|
#define CAMERA_IE_EN_FRAME_FINISHED(V) ((V & CAMERA_IE_EN_FRAME_FINISHED_MASK) << CAMERA_IE_EN_FRAME_FINISHED_OFFS)
|
|
|
|
|
|
|
|
#define CAMERA_IP_PIXEL_AVAIL_IRQ_PEND_OFFS 0
|
|
|
|
#define CAMERA_IP_PIXEL_AVAIL_IRQ_PEND_MASK 0x1
|
|
|
|
#define CAMERA_IP_PIXEL_AVAIL_IRQ_PEND(V) ((V & CAMERA_IP_PIXEL_AVAIL_IRQ_PEND_MASK) << CAMERA_IP_PIXEL_AVAIL_IRQ_PEND_OFFS)
|
|
|
|
|
|
|
|
#define CAMERA_IP_FRAME_FINISHED_IRQ_PEND_OFFS 1
|
|
|
|
#define CAMERA_IP_FRAME_FINISHED_IRQ_PEND_MASK 0x1
|
|
|
|
#define CAMERA_IP_FRAME_FINISHED_IRQ_PEND(V) ((V & CAMERA_IP_FRAME_FINISHED_IRQ_PEND_MASK) << CAMERA_IP_FRAME_FINISHED_IRQ_PEND_OFFS)
|
|
|
|
|
|
|
|
//CAMERA_PIXEL
|
|
|
|
inline uint32_t get_camera_pixel(volatile camera_t* reg){
|
2024-08-02 09:55:38 +02:00
|
|
|
return reg->PIXEL;
|
|
|
|
}
|
|
|
|
inline void set_camera_pixel(volatile camera_t* reg, uint32_t value){
|
|
|
|
reg->PIXEL = value;
|
|
|
|
}
|
|
|
|
inline uint32_t get_camera_pixel_data(volatile camera_t* reg){
|
2024-05-30 18:32:23 +02:00
|
|
|
return (reg->PIXEL >> 0) & 0x7ff;
|
|
|
|
}
|
2024-08-02 09:55:38 +02:00
|
|
|
inline void set_camera_pixel_data(volatile camera_t* reg, uint16_t value){
|
2024-05-30 18:32:23 +02:00
|
|
|
reg->PIXEL = (reg->PIXEL & ~(0x7ffU << 0)) | (value << 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
//CAMERA_CONTROL
|
|
|
|
inline uint32_t get_camera_control(volatile camera_t* reg){
|
2024-08-02 09:55:38 +02:00
|
|
|
return reg->CONTROL;
|
|
|
|
}
|
|
|
|
inline void set_camera_control(volatile camera_t* reg, uint32_t value){
|
|
|
|
reg->CONTROL = value;
|
|
|
|
}
|
|
|
|
inline uint32_t get_camera_control_active_clock(volatile camera_t* reg){
|
2024-05-30 18:32:23 +02:00
|
|
|
return (reg->CONTROL >> 0) & 0x1;
|
|
|
|
}
|
2024-08-02 09:55:38 +02:00
|
|
|
inline void set_camera_control_active_clock(volatile camera_t* reg, uint8_t value){
|
2024-05-30 18:32:23 +02:00
|
|
|
reg->CONTROL = (reg->CONTROL & ~(0x1U << 0)) | (value << 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
//CAMERA_STATUS
|
|
|
|
inline uint32_t get_camera_status(volatile camera_t* reg){
|
|
|
|
return reg->STATUS;
|
|
|
|
}
|
|
|
|
inline uint32_t get_camera_status_enabled(volatile camera_t* reg){
|
|
|
|
return (reg->STATUS >> 0) & 0x1;
|
|
|
|
}
|
|
|
|
inline uint32_t get_camera_status_active(volatile camera_t* reg){
|
|
|
|
return (reg->STATUS >> 1) & 0x1;
|
|
|
|
}
|
|
|
|
inline uint32_t get_camera_status_pixel_avail(volatile camera_t* reg){
|
|
|
|
return (reg->STATUS >> 2) & 0x1;
|
|
|
|
}
|
|
|
|
|
|
|
|
//CAMERA_CAMERA_CLOCK_CTRL
|
|
|
|
inline uint32_t get_camera_camera_clock_ctrl(volatile camera_t* reg){
|
2024-08-02 09:55:38 +02:00
|
|
|
return reg->CAMERA_CLOCK_CTRL;
|
2024-05-30 18:32:23 +02:00
|
|
|
}
|
|
|
|
inline void set_camera_camera_clock_ctrl(volatile camera_t* reg, uint32_t value){
|
2024-08-02 09:55:38 +02:00
|
|
|
reg->CAMERA_CLOCK_CTRL = value;
|
|
|
|
}
|
|
|
|
inline uint32_t get_camera_camera_clock_ctrl_divider(volatile camera_t* reg){
|
|
|
|
return (reg->CAMERA_CLOCK_CTRL >> 0) & 0xfffff;
|
|
|
|
}
|
|
|
|
inline void set_camera_camera_clock_ctrl_divider(volatile camera_t* reg, uint32_t value){
|
2024-05-30 18:32:23 +02:00
|
|
|
reg->CAMERA_CLOCK_CTRL = (reg->CAMERA_CLOCK_CTRL & ~(0xfffffU << 0)) | (value << 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
//CAMERA_IE
|
|
|
|
inline uint32_t get_camera_ie(volatile camera_t* reg){
|
|
|
|
return reg->IE;
|
|
|
|
}
|
|
|
|
inline void set_camera_ie(volatile camera_t* reg, uint32_t value){
|
|
|
|
reg->IE = value;
|
|
|
|
}
|
|
|
|
inline uint32_t get_camera_ie_en_pixel_avail(volatile camera_t* reg){
|
|
|
|
return (reg->IE >> 0) & 0x1;
|
|
|
|
}
|
|
|
|
inline void set_camera_ie_en_pixel_avail(volatile camera_t* reg, uint8_t value){
|
|
|
|
reg->IE = (reg->IE & ~(0x1U << 0)) | (value << 0);
|
|
|
|
}
|
|
|
|
inline uint32_t get_camera_ie_en_frame_finished(volatile camera_t* reg){
|
|
|
|
return (reg->IE >> 1) & 0x1;
|
|
|
|
}
|
|
|
|
inline void set_camera_ie_en_frame_finished(volatile camera_t* reg, uint8_t value){
|
|
|
|
reg->IE = (reg->IE & ~(0x1U << 1)) | (value << 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
//CAMERA_IP
|
|
|
|
inline uint32_t get_camera_ip(volatile camera_t* reg){
|
|
|
|
return reg->IP;
|
|
|
|
}
|
|
|
|
inline void set_camera_ip(volatile camera_t* reg, uint32_t value){
|
|
|
|
reg->IP = value;
|
|
|
|
}
|
|
|
|
inline uint32_t get_camera_ip_pixel_avail_irq_pend(volatile camera_t* reg){
|
|
|
|
return (reg->IP >> 0) & 0x1;
|
|
|
|
}
|
|
|
|
inline void set_camera_ip_pixel_avail_irq_pend(volatile camera_t* reg, uint8_t value){
|
|
|
|
reg->IP = (reg->IP & ~(0x1U << 0)) | (value << 0);
|
|
|
|
}
|
|
|
|
inline uint32_t get_camera_ip_frame_finished_irq_pend(volatile camera_t* reg){
|
|
|
|
return (reg->IP >> 1) & 0x1;
|
|
|
|
}
|
|
|
|
inline void set_camera_ip_frame_finished_irq_pend(volatile camera_t* reg, uint8_t value){
|
|
|
|
reg->IP = (reg->IP & ~(0x1U << 1)) | (value << 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* _BSP_CAMERA_H */
|