SXXXXXXX_RadarDataReader/_src_cpp/IDD/files/DspSignalMemoryLayout.h
VALLONGOL 5de2650675 add
2025-11-12 13:43:30 +01:00

219 lines
6.7 KiB
C++

//!;;Rpy::+
//!;;Rpy::ModelElement: idd_comm::DspSignalMemoryLayout
//!;;Rpy::
//!;;Rpy::Component: IDDComponent
//!;;Rpy::Configuration: IDDConfig
//!;;Rpy::Project: IDD
//!;;Rpy::
//!;;Rpy::FilePath: DspSignalMemoryLayout.h
//!;;Rpy::Tag: $Tag
//!;;Rpy::
//!;;Rpy::Copyright: Leonardocompany - COMPANY RESTRICTED
//!;;Rpy::
//!;;Rpy::Generated by Rhapsody: 7.5.3
//!;;Rpy::-
#ifndef DspSignalMemoryLayout_H
#define DspSignalMemoryLayout_H
//## dependency stdint
#include <stdint.h>
namespace idd_comm
{
//## package idd_comm::idd_shared_memory
//## class DspSignalMemoryLayout
// Enstablish the memory layout of the shared memory between Signal and Header dispatcher (FW) and the DSP.
//
// The default DPS base address shall be 0x80000000.
//
// The entity responsable for the FW distacher setup shall fill the distacher control structure with the address as:
//
// DspSignalMemoryLayout dsp;
// for(unsigned int i=0; i<2; ++) //double buffer
// {
// dispatcher[i].hader=dsp.haderAddress(i);
// for(unsigned int c=0; c<dsp.getMaxChannels(); ++c)
// dispatcher[i].channel[c]=dsp-channelAddress(i, c);
//
// dispatcher[i].doorbell=dsp.eventCode(i);
//
// dispatcher[i].destinationId=0x13;
// }
//
class DspSignalMemoryLayout
{
public :
//#[ type signal_input_t
struct signal_input_t
{
enum {
max_ch=15,
max_samples=4096*64,
header_size_word32=1024
};
typedef uint32_t sample_iq_t;
uint32_t header[header_size_word32];
sample_iq_t samples[max_ch][max_samples];
sample_iq_t sampls_spare[max_samples-header_size_word32];
}
;
//#]
//#[ type signal_input_memory_layout_t
struct signal_input_memory_layout_t
{
enum { max_buffers=2};
signal_input_t signal_data[max_buffers];
};
//#]
//#[ type constant_t
enum constant_t
{
DSP_MAX_BUFFERS=2,
DSP_BASE_ADDRESS=0x80000000U,
DSP_EVENT_CODE_A=1U,
DSP_EVENT_CODE_B=2U,
DSP_MAX_CHANNELS=12
};
//#]
//// Constructors and destructors ////
//## operation DspSignalMemoryLayout(const void*)
inline DspSignalMemoryLayout(const void* aBaseAddress = reinterpret_cast<const void*>(DspSignalMemoryLayout::DSP_BASE_ADDRESS));
//// Operations ////
//## operation channelAddress(unsigned int,unsigned int) const
inline const void * channelAddress(unsigned int n, unsigned int ch) const;
//## operation channelOffset(unsigned int,unsigned int) const
inline unsigned int channelOffset(unsigned int n, unsigned int ch) const;
//## operation eventCode(unsigned int) const
inline unsigned int eventCode(unsigned int n) const;
//## operation getDefaultMemoryBase() const
inline unsigned int getDefaultMemoryBase() const;
//## operation getMaxChannels() const
inline unsigned int getMaxChannels() const;
//## operation getMemoryBase() const
inline unsigned int getMemoryBase() const;
//## operation headerAddress(unsigned int) const
inline const void * headerAddress(unsigned int n) const;
//## operation headerOffset(unsigned int) const
inline unsigned int headerOffset(unsigned int n) const;
//## operation setMemoryBase(unsigned int)
inline void setMemoryBase(unsigned int base);
//## operation singleChannelSize() const
inline unsigned int singleChannelSize() const;
//## operation sizeOf() const
unsigned int sizeOf() const;
//// Attributes ////
protected :
const signal_input_memory_layout_t* mem_template; //## attribute mem_template
};
inline DspSignalMemoryLayout::DspSignalMemoryLayout(const void* aBaseAddress) : mem_template(reinterpret_cast<const signal_input_memory_layout_t*>(/*DSP_BASE_ADDRESS*/aBaseAddress))
{
//#[ operation DspSignalMemoryLayout(const void*)
//#]
}
inline const void * DspSignalMemoryLayout::channelAddress(unsigned int n, unsigned int ch) const
{
//#[ operation channelAddress(unsigned int,unsigned int) const
return (&(mem_template->signal_data[n].samples[ch][0]));
//#]
}
inline unsigned int DspSignalMemoryLayout::channelOffset(unsigned int n, unsigned int ch) const
{
//#[ operation channelOffset(unsigned int,unsigned int) const
const signal_input_memory_layout_t* x=0;
return reinterpret_cast<unsigned int>(&(x->signal_data[n].samples[ch][0]));
//#]
}
inline unsigned int DspSignalMemoryLayout::eventCode(unsigned int n) const
{
//#[ operation eventCode(unsigned int) const
return n==0 ? DSP_EVENT_CODE_A : DSP_EVENT_CODE_B;
//#]
}
inline unsigned int DspSignalMemoryLayout::getDefaultMemoryBase() const
{
//#[ operation getDefaultMemoryBase() const
return (DSP_BASE_ADDRESS);
//#]
}
inline unsigned int DspSignalMemoryLayout::getMaxChannels() const
{
//#[ operation getMaxChannels() const
return (DSP_MAX_CHANNELS);
//#]
}
inline unsigned int DspSignalMemoryLayout::getMemoryBase() const
{
//#[ operation getMemoryBase() const
return reinterpret_cast<unsigned int>(mem_template);
//#]
}
inline const void * DspSignalMemoryLayout::headerAddress(unsigned int n) const
{
//#[ operation headerAddress(unsigned int) const
return (&(mem_template->signal_data[n].header[0]));
//#]
}
inline unsigned int DspSignalMemoryLayout::headerOffset(unsigned int n) const
{
//#[ operation headerOffset(unsigned int) const
const signal_input_memory_layout_t* x=0;
return reinterpret_cast<unsigned int>(&(x->signal_data[n].header[0]));
//#]
}
inline void DspSignalMemoryLayout::setMemoryBase(unsigned int base)
{
//#[ operation setMemoryBase(unsigned int)
mem_template=reinterpret_cast<const signal_input_memory_layout_t*>(base);
//#]
}
inline unsigned int DspSignalMemoryLayout::singleChannelSize() const
{
//#[ operation singleChannelSize() const
return sizeof mem_template->signal_data[0].samples[0];
//#]
}
}
#endif
//;;Rpy:: end