|
|
#ifndef __CLASSSOC_H_INCL__
#define __CLASSSOC_H_INCL__
#include <stdint.h>
#include "../../components/base/basicLogCollection.h"
#define _XOPEN_SOURCE 700
#include <fcntl.h> /* open */
#include <stdint.h> /* uint64_t */
#include <stdio.h> /* printf */
#include <stdlib.h> /* size_t */
#include <unistd.h> /* pread, sysconf */
typedef struct { uint64_t pfn : 54; unsigned int soft_dirty : 1; unsigned int file_page : 1; unsigned int swapped : 1; unsigned int present : 1;} PagemapEntry;
#include "general/3DLRF.h"
#include "general/am437x_prmcm.h"
#include "modules/gpio/gpio_ss.h"
#include "modules/adc/adc_ss.h"
#include "modules/pru/tupus_ext.h"
#include "modules/pru/pru_ss.h"
#include "modules/pwmss/sys_pwmss.h"
#include "modules/pwmss/pwm_ss.h"
/**
* TODO: Add class description * * @author gagua */class classSOC { private: bool m_bPRMCM_OK; bool m_bPWM_SS0_OK; bool m_bPWM_SS1_OK; bool m_bPWM_SS2_OK; bool m_bPWM_SS3_OK; bool m_bPWM_SS4_OK; bool m_bPWM_SS5_OK; bool m_bPRU_ICSS0_OK; bool m_bPRU_ICSS1_OK; bool m_bADC0_OK; bool m_bADC1_OK; bool m_bTH_OK; bool m_bEVT_OK;
void *m_pPRMCM_MMAP; void *m_pPRU_ICSS0_MMAP; void *m_pPRU_ICSS1_MMAP; void *m_pPWM_SS0_MMAP; void *m_pPWM_SS1_MMAP; void *m_pPWM_SS2_MMAP; void *m_pPWM_SS3_MMAP; void *m_pPWM_SS4_MMAP; void *m_pPWM_SS5_MMAP; void *m_pADC0_MMAP; void *m_pADC1_MMAP; void *m_pTH_ZONE_MMAP; void *m_pEVT_ZONE_MMAP;
basicLogCollection *m_pLog; public: // Method to fetch singleton instance.
static classSOC* getInstance();
// Destructor
virtual ~classSOC();
protected: // Constructor - protected so users cannot call it.
classSOC();
private: // private static member referencing the single instance of the object
// TODO: Replace classSOC with the type of object you want to
// return the single instance of
static classSOC* _instance;
// Copy constructor
// Declared but not defined to prevent auto-generated
// copy constructor. Refer to "Effective C++" by Meyers
classSOC(const classSOC& src);
// Assignment operator
// Declared but not defined to prevent auto-generated
// assignment operator. Refer to "Effective C++" by Meyers
classSOC& operator=(const classSOC& src);
bool access_PRCM_MODULE( void ); bool access_PRUSS_MODULE( uint32_t MODID ); bool access_PWMSS_MODULE( uint32_t MODID ); bool access_ADC_MODULE( uint32_t MODID );
bool enable_SYSTEM_BUSSES( void ); bool enable_PRUSS_MODULE( void ); bool enable_PWMSS_MODULE( uint32_t MODID ); bool enable_ADC01_MODULE( void );
bool reset_PRUSS_MODULE( void );
bool disable_PRUSS_MODULE( void ); public:
/* Reg Accessebility */ volatile structTUPUS *getTUPUS( uint8_t MODID, uint8_t unit ); volatile pruCfg *getPRUSS_GFG( uint8_t MODID ); volatile sysPwmss *getPWMSS_CTRL( uint8_t MODID ); volatile pruCtrl *getPRU_CTRL( uint8_t MODID, uint8_t unit ); volatile sysAdc0TscSs *getADC0_CTRL( void ); volatile sysAdc1MagSs *getADC1_CTRL( void );
bool cleanTUPUS( uint8_t MODID, uint8_t unit );
/* PRUSS Functionality */ bool pru_disable( uint8_t MODID, uint8_t unit ); bool pru_enable( uint8_t MODID, uint8_t unit ); bool pru_clk_disable( uint8_t MODID, uint8_t unit ); bool pru_clk_enable( uint8_t MODID, uint8_t unit ); bool pru_save( uint8_t MODID, uint8_t unit, CSTR Name, bool AsForPRUSS0 = true ); bool pru_load( uint8_t MODID, uint8_t unit, CSTR Name, bool AsForPRUSS0 = true ); bool pru_run( uint8_t MODID, uint8_t unit ); bool pru_stop( uint8_t MODID, uint8_t unit ); bool pru_sreset( uint8_t MODID, uint8_t unit );
/* PRU Core specific */ bool setCoreOnLine( uint8_t unit ); bool sendTUPUSCommand( uint8_t MODID, uint8_t unit, uint32_t cmd, uint32_t address, uint32_t data );
/* LRF specific */ // Motor Controll Core (0)
bool setSunbitMode( bool Val ); bool setMotorMonitoringMode( bool MirrorBlock, bool BaseBlock ); bool setMotorSetPoints( uint32_t V_Freq, uint32_t H_Freq ); bool setMotorInterleaveMode( uint8_t Mode ); bool setLrfPulseMode( bool Mode ); bool setSimulationMode( bool Mode ); bool getSimulationMode( void ); uint32_t getMotorStatus( void ); uint32_t getVMotorFreq( void ); uint32_t getHMotorFreq( void ); // TH Control Core (3)
bool setAutoBuildThMode( bool Mode ); bool setGoodPointsCnt( uint8_t Cnt ); //bool setThCoreParams( uint8_t Offset, uint8_t Order );
bool setShifts( uint32_t BaseShift, uint32_t MirrorShift ); uint32_t getBaseShift( void ); uint32_t getMirrorShift( void ); bool setThCoreParams( TH_PARAMS *Params ); bool setThCoreStatus( DT_STATUS *Status ); bool setScansPerFlip( uint16_t Cnt ); bool setToWork( bool Mode ); uint32_t getThCoreParams( void ); uint32_t getThCoreRequest( void ); void injectThCoreRequest( uint32_t req ); bool clearThCoreRequest( void ); uint32_t getThCoreStatus( void ); uint32_t getPRU_ID( uint8_t coreID ); uint32_t getPRU_TYPE( uint8_t coreID ); bool resetThDetector( bool FullReset );
uint32_t getMirrorPRF( void ); uint32_t getBasePRF( void );
/* SOC-OS Specific */ void *getPhysicalAddressOf( void *virt );
/* LRF Functionality */ uint32_t *getTH_MEMORY( void ); uint32_t *getEVT_MEMORY( void );};
// TODO: Uncomment the copy constructor when you need it.
//inline classSOC::classSOC(const classSOC& src)
//{
// // TODO: copy
//}
// TODO: Uncomment the assignment operator when you need it.
//inline classSOC& classSOC::operator=(const classSOC& rhs)
//{
// if (this == &rhs) {
// return *this;
// }
//
// // TODO: assignment
//
// return *this;
//}
#endif // __CLASSSOC_H_INCL__
|