You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

198 lines
6.1 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __CLASSSOC_H_INCL__
  2. #define __CLASSSOC_H_INCL__
  3. #include <stdint.h>
  4. #include "../../components/base/basicLogCollection.h"
  5. #define _XOPEN_SOURCE 700
  6. #include <fcntl.h> /* open */
  7. #include <stdint.h> /* uint64_t */
  8. #include <stdio.h> /* printf */
  9. #include <stdlib.h> /* size_t */
  10. #include <unistd.h> /* pread, sysconf */
  11. typedef struct {
  12. uint64_t pfn : 54;
  13. unsigned int soft_dirty : 1;
  14. unsigned int file_page : 1;
  15. unsigned int swapped : 1;
  16. unsigned int present : 1;
  17. } PagemapEntry;
  18. #include "general/3DLRF.h"
  19. #include "general/am437x_prmcm.h"
  20. #include "modules/gpio/gpio_ss.h"
  21. #include "modules/adc/adc_ss.h"
  22. #include "modules/pru/tupus_ext.h"
  23. #include "modules/pru/pru_ss.h"
  24. #include "modules/pwmss/sys_pwmss.h"
  25. #include "modules/pwmss/pwm_ss.h"
  26. /**
  27. * TODO: Add class description
  28. *
  29. * @author gagua
  30. */
  31. class classSOC {
  32. private:
  33. bool m_bPRMCM_OK;
  34. bool m_bPWM_SS0_OK;
  35. bool m_bPWM_SS1_OK;
  36. bool m_bPWM_SS2_OK;
  37. bool m_bPWM_SS3_OK;
  38. bool m_bPWM_SS4_OK;
  39. bool m_bPWM_SS5_OK;
  40. bool m_bPRU_ICSS0_OK;
  41. bool m_bPRU_ICSS1_OK;
  42. bool m_bADC0_OK;
  43. bool m_bADC1_OK;
  44. bool m_bTH_OK;
  45. bool m_bEVT_OK;
  46. void *m_pPRMCM_MMAP;
  47. void *m_pPRU_ICSS0_MMAP;
  48. void *m_pPRU_ICSS1_MMAP;
  49. void *m_pPWM_SS0_MMAP;
  50. void *m_pPWM_SS1_MMAP;
  51. void *m_pPWM_SS2_MMAP;
  52. void *m_pPWM_SS3_MMAP;
  53. void *m_pPWM_SS4_MMAP;
  54. void *m_pPWM_SS5_MMAP;
  55. void *m_pADC0_MMAP;
  56. void *m_pADC1_MMAP;
  57. void *m_pTH_ZONE_MMAP;
  58. void *m_pEVT_ZONE_MMAP;
  59. basicLogCollection *m_pLog;
  60. public:
  61. // Method to fetch singleton instance.
  62. static classSOC* getInstance();
  63. // Destructor
  64. virtual ~classSOC();
  65. protected:
  66. // Constructor - protected so users cannot call it.
  67. classSOC();
  68. private:
  69. // private static member referencing the single instance of the object
  70. // TODO: Replace classSOC with the type of object you want to
  71. // return the single instance of
  72. static classSOC* _instance;
  73. // Copy constructor
  74. // Declared but not defined to prevent auto-generated
  75. // copy constructor. Refer to "Effective C++" by Meyers
  76. classSOC(const classSOC& src);
  77. // Assignment operator
  78. // Declared but not defined to prevent auto-generated
  79. // assignment operator. Refer to "Effective C++" by Meyers
  80. classSOC& operator=(const classSOC& src);
  81. bool access_PRCM_MODULE( void );
  82. bool access_PRUSS_MODULE( uint32_t MODID );
  83. bool access_PWMSS_MODULE( uint32_t MODID );
  84. bool access_ADC_MODULE( uint32_t MODID );
  85. bool enable_SYSTEM_BUSSES( void );
  86. bool enable_PRUSS_MODULE( void );
  87. bool enable_PWMSS_MODULE( uint32_t MODID );
  88. bool enable_ADC01_MODULE( void );
  89. bool reset_PRUSS_MODULE( void );
  90. bool disable_PRUSS_MODULE( void );
  91. public:
  92. /* Reg Accessebility */
  93. volatile structTUPUS *getTUPUS( uint8_t MODID, uint8_t unit );
  94. volatile pruCfg *getPRUSS_GFG( uint8_t MODID );
  95. volatile sysPwmss *getPWMSS_CTRL( uint8_t MODID );
  96. volatile pruCtrl *getPRU_CTRL( uint8_t MODID, uint8_t unit );
  97. volatile sysAdc0TscSs *getADC0_CTRL( void );
  98. volatile sysAdc1MagSs *getADC1_CTRL( void );
  99. bool cleanTUPUS( uint8_t MODID, uint8_t unit );
  100. /* PRUSS Functionality */
  101. bool pru_disable( uint8_t MODID, uint8_t unit );
  102. bool pru_enable( uint8_t MODID, uint8_t unit );
  103. bool pru_clk_disable( uint8_t MODID, uint8_t unit );
  104. bool pru_clk_enable( uint8_t MODID, uint8_t unit );
  105. bool pru_save( uint8_t MODID, uint8_t unit, CSTR Name, bool AsForPRUSS0 = true );
  106. bool pru_load( uint8_t MODID, uint8_t unit, CSTR Name, bool AsForPRUSS0 = true );
  107. bool pru_run( uint8_t MODID, uint8_t unit );
  108. bool pru_stop( uint8_t MODID, uint8_t unit );
  109. bool pru_sreset( uint8_t MODID, uint8_t unit );
  110. /* PRU Core specific */
  111. bool setCoreOnLine( uint8_t unit );
  112. bool sendTUPUSCommand( uint8_t MODID, uint8_t unit, uint32_t cmd, uint32_t address, uint32_t data );
  113. /* LRF specific */
  114. // Motor Controll Core (0)
  115. bool setSunbitMode( bool Val );
  116. bool setMotorMonitoringMode( bool MirrorBlock, bool BaseBlock );
  117. bool setMotorSetPoints( uint32_t V_Freq, uint32_t H_Freq );
  118. bool setMotorInterleaveMode( uint8_t Mode );
  119. bool setLrfPulseMode( bool Mode );
  120. bool setSimulationMode( bool Mode );
  121. bool getSimulationMode( void );
  122. uint32_t getMotorStatus( void );
  123. uint32_t getVMotorFreq( void );
  124. uint32_t getHMotorFreq( void );
  125. // TH Control Core (3)
  126. bool setAutoBuildThMode( bool Mode );
  127. bool setGoodPointsCnt( uint8_t Cnt );
  128. //bool setThCoreParams( uint8_t Offset, uint8_t Order );
  129. bool setShifts( uint32_t BaseShift, uint32_t MirrorShift );
  130. uint32_t getBaseShift( void );
  131. uint32_t getMirrorShift( void );
  132. bool setThCoreParams( TH_PARAMS *Params );
  133. bool setThCoreStatus( DT_STATUS *Status );
  134. bool setScansPerFlip( uint16_t Cnt );
  135. bool setToWork( bool Mode );
  136. uint32_t getThCoreParams( void );
  137. uint32_t getThCoreRequest( void );
  138. void injectThCoreRequest( uint32_t req );
  139. bool clearThCoreRequest( void );
  140. uint32_t getThCoreStatus( void );
  141. uint32_t getPRU_ID( uint8_t coreID );
  142. uint32_t getPRU_TYPE( uint8_t coreID );
  143. bool resetThDetector( bool FullReset );
  144. uint32_t getMirrorPRF( void );
  145. uint32_t getBasePRF( void );
  146. /* SOC-OS Specific */
  147. void *getPhysicalAddressOf( void *virt );
  148. /* LRF Functionality */
  149. uint32_t *getTH_MEMORY( void );
  150. uint32_t *getEVT_MEMORY( void );
  151. };
  152. // TODO: Uncomment the copy constructor when you need it.
  153. //inline classSOC::classSOC(const classSOC& src)
  154. //{
  155. // // TODO: copy
  156. //}
  157. // TODO: Uncomment the assignment operator when you need it.
  158. //inline classSOC& classSOC::operator=(const classSOC& rhs)
  159. //{
  160. // if (this == &rhs) {
  161. // return *this;
  162. // }
  163. //
  164. // // TODO: assignment
  165. //
  166. // return *this;
  167. //}
  168. #endif // __CLASSSOC_H_INCL__