MNRS-BM-BSP/include/ehrenberg/devices/gen/camera.h

127 lines
4.3 KiB
C

/*
* Copyright (c) 2023 - 2024 MINRES Technologies GmbH
*
* SPDX-License-Identifier: Apache-2.0
*
* Generated at 2024-09-10 14:29:50 UTC
* by peakrdl_mnrs version 1.2.9
*/
#ifndef _BSP_CAMERA_H
#define _BSP_CAMERA_H
#include <stdint.h>
typedef struct {
volatile uint32_t PIXEL;
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_STATUS_OFFS 0
#define CAMERA_STATUS_MASK 0x1
#define CAMERA_STATUS(V) ((V & CAMERA_STATUS_MASK) << CAMERA_STATUS_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){
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){
return (reg->PIXEL >> 0) & 0x7ff;
}
inline void set_camera_pixel_data(volatile camera_t* reg, uint16_t value){
reg->PIXEL = (reg->PIXEL & ~(0x7ffU << 0)) | (value << 0);
}
//CAMERA_STATUS
inline uint32_t get_camera_status(volatile camera_t* reg){
return reg->STATUS;
}
inline uint32_t get_camera_status_pixel_avail(volatile camera_t* reg){
return (reg->STATUS >> 0) & 0x1;
}
//CAMERA_CAMERA_CLOCK_CTRL
inline uint32_t get_camera_camera_clock_ctrl(volatile camera_t* reg){
return reg->CAMERA_CLOCK_CTRL;
}
inline void set_camera_camera_clock_ctrl(volatile camera_t* reg, uint32_t value){
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){
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 */