add communication controller register interface

This commit is contained in:
Stanislaw Kaushanski 2024-11-05 13:01:57 +01:00
parent 8e62de5cdf
commit e8cfbbdab0
3 changed files with 205 additions and 0 deletions

View File

@ -21,6 +21,7 @@
#include "ehrenberg/devices/i2s.h" #include "ehrenberg/devices/i2s.h"
#include "ehrenberg/devices/camera.h" #include "ehrenberg/devices/camera.h"
#include "ehrenberg/devices/dma.h" #include "ehrenberg/devices/dma.h"
#include "ehrenberg/devices/msg_if.h"
#define PERIPH(TYPE, ADDR) ((volatile TYPE*) (ADDR)) #define PERIPH(TYPE, ADDR) ((volatile TYPE*) (ADDR))
@ -35,6 +36,7 @@
#define i2s PERIPH(i2s_t, APB_BASE+0x90000) #define i2s PERIPH(i2s_t, APB_BASE+0x90000)
#define camera PERIPH(camera_t, APB_BASE+0xA0000) #define camera PERIPH(camera_t, APB_BASE+0xA0000)
#define dma PERIPH(dma_t, APB_BASE+0xB0000) #define dma PERIPH(dma_t, APB_BASE+0xB0000)
#define msgif PERIPH(msgif_t, APB_BASE+0xC0000)
#define XIP_START_LOC 0xE0040000 #define XIP_START_LOC 0xE0040000

View File

@ -0,0 +1,197 @@
/*
* Copyright (c) 2023 - 2024 MINRES Technologies GmbH
*
* SPDX-License-Identifier: Apache-2.0
*
* Generated at 2024-11-05 12:12:15 UTC
* by peakrdl_mnrs version 1.2.7
*/
#ifndef _BSP_MSGIF_H
#define _BSP_MSGIF_H
#include <stdint.h>
typedef struct {
volatile uint32_t REG_SEND;
volatile uint32_t REG_HEADER;
volatile uint32_t REG_ACK;
volatile uint32_t REG_RECV_ID;
volatile uint32_t REG_RECV_PAYLOAD;
uint8_t fill0[12];
volatile uint32_t REG_PAYLOAD_0;
volatile uint32_t REG_PAYLOAD_1;
volatile uint32_t REG_PAYLOAD_2;
volatile uint32_t REG_PAYLOAD_3;
volatile uint32_t REG_PAYLOAD_4;
volatile uint32_t REG_PAYLOAD_5;
volatile uint32_t REG_PAYLOAD_6;
volatile uint32_t REG_PAYLOAD_7;
}msgif_t;
#define MSGIF_REG_SEND_OFFS 0
#define MSGIF_REG_SEND_MASK 0x1
#define MSGIF_REG_SEND(V) ((V & MSGIF_REG_SEND_MASK) << MSGIF_REG_SEND_OFFS)
#define MSGIF_REG_HEADER_RECIPIENT_COMPONENT_OFFS 0
#define MSGIF_REG_HEADER_RECIPIENT_COMPONENT_MASK 0x7
#define MSGIF_REG_HEADER_RECIPIENT_COMPONENT(V) ((V & MSGIF_REG_HEADER_RECIPIENT_COMPONENT_MASK) << MSGIF_REG_HEADER_RECIPIENT_COMPONENT_OFFS)
#define MSGIF_REG_HEADER_RECIPIENT_CLUSTER_OFFS 3
#define MSGIF_REG_HEADER_RECIPIENT_CLUSTER_MASK 0x3
#define MSGIF_REG_HEADER_RECIPIENT_CLUSTER(V) ((V & MSGIF_REG_HEADER_RECIPIENT_CLUSTER_MASK) << MSGIF_REG_HEADER_RECIPIENT_CLUSTER_OFFS)
#define MSGIF_REG_HEADER_MESSAGE_LENGTH_OFFS 5
#define MSGIF_REG_HEADER_MESSAGE_LENGTH_MASK 0xf
#define MSGIF_REG_HEADER_MESSAGE_LENGTH(V) ((V & MSGIF_REG_HEADER_MESSAGE_LENGTH_MASK) << MSGIF_REG_HEADER_MESSAGE_LENGTH_OFFS)
#define MSGIF_REG_HEADER_MESSAGE_ID_OFFS 9
#define MSGIF_REG_HEADER_MESSAGE_ID_MASK 0xf
#define MSGIF_REG_HEADER_MESSAGE_ID(V) ((V & MSGIF_REG_HEADER_MESSAGE_ID_MASK) << MSGIF_REG_HEADER_MESSAGE_ID_OFFS)
#define MSGIF_REG_ACK_OFFS 0
#define MSGIF_REG_ACK_MASK 0x1
#define MSGIF_REG_ACK(V) ((V & MSGIF_REG_ACK_MASK) << MSGIF_REG_ACK_OFFS)
#define MSGIF_REG_RECV_ID_OFFS 0
#define MSGIF_REG_RECV_ID_MASK 0xf
#define MSGIF_REG_RECV_ID(V) ((V & MSGIF_REG_RECV_ID_MASK) << MSGIF_REG_RECV_ID_OFFS)
#define MSGIF_REG_RECV_PAYLOAD_OFFS 0
#define MSGIF_REG_RECV_PAYLOAD_MASK 0xffffffff
#define MSGIF_REG_RECV_PAYLOAD(V) ((V & MSGIF_REG_RECV_PAYLOAD_MASK) << MSGIF_REG_RECV_PAYLOAD_OFFS)
#define MSGIF_REG_PAYLOAD_0_OFFS 0
#define MSGIF_REG_PAYLOAD_0_MASK 0xffffffff
#define MSGIF_REG_PAYLOAD_0(V) ((V & MSGIF_REG_PAYLOAD_0_MASK) << MSGIF_REG_PAYLOAD_0_OFFS)
#define MSGIF_REG_PAYLOAD_1_OFFS 0
#define MSGIF_REG_PAYLOAD_1_MASK 0xffffffff
#define MSGIF_REG_PAYLOAD_1(V) ((V & MSGIF_REG_PAYLOAD_1_MASK) << MSGIF_REG_PAYLOAD_1_OFFS)
#define MSGIF_REG_PAYLOAD_2_OFFS 0
#define MSGIF_REG_PAYLOAD_2_MASK 0xffffffff
#define MSGIF_REG_PAYLOAD_2(V) ((V & MSGIF_REG_PAYLOAD_2_MASK) << MSGIF_REG_PAYLOAD_2_OFFS)
#define MSGIF_REG_PAYLOAD_3_OFFS 0
#define MSGIF_REG_PAYLOAD_3_MASK 0xffffffff
#define MSGIF_REG_PAYLOAD_3(V) ((V & MSGIF_REG_PAYLOAD_3_MASK) << MSGIF_REG_PAYLOAD_3_OFFS)
#define MSGIF_REG_PAYLOAD_4_OFFS 0
#define MSGIF_REG_PAYLOAD_4_MASK 0xffffffff
#define MSGIF_REG_PAYLOAD_4(V) ((V & MSGIF_REG_PAYLOAD_4_MASK) << MSGIF_REG_PAYLOAD_4_OFFS)
#define MSGIF_REG_PAYLOAD_5_OFFS 0
#define MSGIF_REG_PAYLOAD_5_MASK 0xffffffff
#define MSGIF_REG_PAYLOAD_5(V) ((V & MSGIF_REG_PAYLOAD_5_MASK) << MSGIF_REG_PAYLOAD_5_OFFS)
#define MSGIF_REG_PAYLOAD_6_OFFS 0
#define MSGIF_REG_PAYLOAD_6_MASK 0xffffffff
#define MSGIF_REG_PAYLOAD_6(V) ((V & MSGIF_REG_PAYLOAD_6_MASK) << MSGIF_REG_PAYLOAD_6_OFFS)
#define MSGIF_REG_PAYLOAD_7_OFFS 0
#define MSGIF_REG_PAYLOAD_7_MASK 0xffffffff
#define MSGIF_REG_PAYLOAD_7(V) ((V & MSGIF_REG_PAYLOAD_7_MASK) << MSGIF_REG_PAYLOAD_7_OFFS)
//MSGIF_REG_SEND
inline void set_msgif_REG_SEND(volatile msgif_t* reg, uint32_t value){
reg->REG_SEND = value;
}
inline void set_msgif_REG_SEND_SEND(volatile msgif_t* reg, uint8_t value){
reg->REG_SEND = (reg->REG_SEND & ~(0x1U << 0)) | (value << 0);
}
//MSGIF_REG_HEADER
inline uint32_t get_msgif_REG_HEADER(volatile msgif_t* reg){
return reg->REG_HEADER;
}
inline void set_msgif_REG_HEADER(volatile msgif_t* reg, uint32_t value){
reg->REG_HEADER = value;
}
inline uint32_t get_msgif_REG_HEADER_RECIPIENT_COMPONENT(volatile msgif_t* reg){
return (reg->REG_HEADER >> 0) & 0x7;
}
inline void set_msgif_REG_HEADER_RECIPIENT_COMPONENT(volatile msgif_t* reg, uint8_t value){
reg->REG_HEADER = (reg->REG_HEADER & ~(0x7U << 0)) | (value << 0);
}
inline uint32_t get_msgif_REG_HEADER_RECIPIENT_CLUSTER(volatile msgif_t* reg){
return (reg->REG_HEADER >> 3) & 0x3;
}
inline void set_msgif_REG_HEADER_RECIPIENT_CLUSTER(volatile msgif_t* reg, uint8_t value){
reg->REG_HEADER = (reg->REG_HEADER & ~(0x3U << 3)) | (value << 3);
}
inline uint32_t get_msgif_REG_HEADER_MESSAGE_LENGTH(volatile msgif_t* reg){
return (reg->REG_HEADER >> 5) & 0xf;
}
inline void set_msgif_REG_HEADER_MESSAGE_LENGTH(volatile msgif_t* reg, uint8_t value){
reg->REG_HEADER = (reg->REG_HEADER & ~(0xfU << 5)) | (value << 5);
}
inline uint32_t get_msgif_REG_HEADER_MESSAGE_ID(volatile msgif_t* reg){
return (reg->REG_HEADER >> 9) & 0xf;
}
inline void set_msgif_REG_HEADER_MESSAGE_ID(volatile msgif_t* reg, uint8_t value){
reg->REG_HEADER = (reg->REG_HEADER & ~(0xfU << 9)) | (value << 9);
}
//MSGIF_REG_ACK
inline void set_msgif_REG_ACK(volatile msgif_t* reg, uint32_t value){
reg->REG_ACK = value;
}
inline void set_msgif_REG_ACK_ACK(volatile msgif_t* reg, uint8_t value){
reg->REG_ACK = (reg->REG_ACK & ~(0x1U << 0)) | (value << 0);
}
//MSGIF_REG_RECV_ID
inline uint32_t get_msgif_REG_RECV_ID(volatile msgif_t* reg){
return reg->REG_RECV_ID;
}
inline uint32_t get_msgif_REG_RECV_ID_RECV_ID(volatile msgif_t* reg){
return (reg->REG_RECV_ID >> 0) & 0xf;
}
//MSGIF_REG_RECV_PAYLOAD
inline uint32_t get_msgif_REG_RECV_PAYLOAD(volatile msgif_t* reg){
return (reg->REG_RECV_PAYLOAD >> 0) & 0xffffffff;
}
//MSGIF_REG_PAYLOAD_0
inline void set_msgif_REG_PAYLOAD_0(volatile msgif_t* reg, uint32_t value){
reg->REG_PAYLOAD_0 = (reg->REG_PAYLOAD_0 & ~(0xffffffffU << 0)) | (value << 0);
}
//MSGIF_REG_PAYLOAD_1
inline void set_msgif_REG_PAYLOAD_1(volatile msgif_t* reg, uint32_t value){
reg->REG_PAYLOAD_1 = (reg->REG_PAYLOAD_1 & ~(0xffffffffU << 0)) | (value << 0);
}
//MSGIF_REG_PAYLOAD_2
inline void set_msgif_REG_PAYLOAD_2(volatile msgif_t* reg, uint32_t value){
reg->REG_PAYLOAD_2 = (reg->REG_PAYLOAD_2 & ~(0xffffffffU << 0)) | (value << 0);
}
//MSGIF_REG_PAYLOAD_3
inline void set_msgif_REG_PAYLOAD_3(volatile msgif_t* reg, uint32_t value){
reg->REG_PAYLOAD_3 = (reg->REG_PAYLOAD_3 & ~(0xffffffffU << 0)) | (value << 0);
}
//MSGIF_REG_PAYLOAD_4
inline void set_msgif_REG_PAYLOAD_4(volatile msgif_t* reg, uint32_t value){
reg->REG_PAYLOAD_4 = (reg->REG_PAYLOAD_4 & ~(0xffffffffU << 0)) | (value << 0);
}
//MSGIF_REG_PAYLOAD_5
inline void set_msgif_REG_PAYLOAD_5(volatile msgif_t* reg, uint32_t value){
reg->REG_PAYLOAD_5 = (reg->REG_PAYLOAD_5 & ~(0xffffffffU << 0)) | (value << 0);
}
//MSGIF_REG_PAYLOAD_6
inline void set_msgif_REG_PAYLOAD_6(volatile msgif_t* reg, uint32_t value){
reg->REG_PAYLOAD_6 = (reg->REG_PAYLOAD_6 & ~(0xffffffffU << 0)) | (value << 0);
}
//MSGIF_REG_PAYLOAD_7
inline void set_msgif_REG_PAYLOAD_7(volatile msgif_t* reg, uint32_t value){
reg->REG_PAYLOAD_7 = (reg->REG_PAYLOAD_7 & ~(0xffffffffU << 0)) | (value << 0);
}
#endif /* _BSP_MSGIF_H */

View File

@ -0,0 +1,6 @@
#ifndef _DEVICES_MSG_IF_H
#define _DEVICES_MSG_IF_H
#include "gen/msgif.h"
#endif /* _DEVICES_MSG_IF_H */