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.

126 lines
3.7 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __CLASSSOC_H_INCL__
  2. #define __CLASSSOC_H_INCL__
  3. #include "../../components/base/basicLogCollection.h"
  4. #include "../../../include/device/modules/pru/pru_ss.h"
  5. #include "../../../include/device/modules/pru/tupus_ext.h"
  6. #include "../../../include/device/modules/pwmss/sys_pwmss.h"
  7. /**
  8. * TODO: Add class description
  9. *
  10. * @author gagua
  11. */
  12. class classSOC {
  13. private:
  14. bool m_bPRMCM_OK;
  15. bool m_bPWM_SS0_OK;
  16. bool m_bPWM_SS1_OK;
  17. bool m_bPWM_SS2_OK;
  18. bool m_bPWM_SS3_OK;
  19. bool m_bPWM_SS4_OK;
  20. bool m_bPWM_SS5_OK;
  21. bool m_bPRU_ICSS0_OK;
  22. bool m_bPRU_ICSS1_OK;
  23. bool m_bADC0_OK;
  24. bool m_bADC1_OK;
  25. void *m_pPRMCM_MMAP;
  26. void *m_pPRU_ICSS0_MMAP;
  27. void *m_pPRU_ICSS1_MMAP;
  28. void *m_pPWM_SS0_MMAP;
  29. void *m_pPWM_SS1_MMAP;
  30. void *m_pPWM_SS2_MMAP;
  31. void *m_pPWM_SS3_MMAP;
  32. void *m_pPWM_SS4_MMAP;
  33. void *m_pPWM_SS5_MMAP;
  34. void *m_pADC0_MMAP;
  35. void *m_pADC1_MMAP;
  36. basicLogCollection *m_pLog;
  37. public:
  38. // Method to fetch singleton instance.
  39. static classSOC* getInstance();
  40. // Destructor
  41. virtual ~classSOC();
  42. protected:
  43. // Constructor - protected so users cannot call it.
  44. classSOC();
  45. private:
  46. // private static member referencing the single instance of the object
  47. // TODO: Replace classSOC with the type of object you want to
  48. // return the single instance of
  49. static classSOC* _instance;
  50. // Copy constructor
  51. // Declared but not defined to prevent auto-generated
  52. // copy constructor. Refer to "Effective C++" by Meyers
  53. classSOC(const classSOC& src);
  54. // Assignment operator
  55. // Declared but not defined to prevent auto-generated
  56. // assignment operator. Refer to "Effective C++" by Meyers
  57. classSOC& operator=(const classSOC& src);
  58. bool access_PRCM_MODULE( void );
  59. bool access_PRUSS_MODULE( uint32_t MODID );
  60. bool access_PWMSS_MODULE( uint32_t MODID );
  61. bool access_ADC_MODULE( uint32_t MODID );
  62. bool enable_SYSTEM_BUSSES( void );
  63. bool enable_PRUSS_MODULE( void );
  64. bool enable_PWMSS_MODULE( uint32_t MODID );
  65. bool enable_ADC01_MODULE( void );
  66. bool reset_PRUSS_MODULE( void );
  67. bool disable_PRUSS_MODULE( void );
  68. public:
  69. /* Reg Accessebility */
  70. volatile structTUPUS *getTUPUS( uint8_t MODID, uint8_t unit );
  71. volatile pruCfg *getPRUSS_GFG( uint8_t MODID );
  72. volatile sysPwmss *getPWMSS_CTRL( uint8_t MODID );
  73. volatile pruCtrl *getPRU_CTRL( uint8_t MODID, uint8_t unit );
  74. bool cleanTUPUS( uint8_t MODID, uint8_t unit );
  75. /* PRUSS Functionality */
  76. bool pru_disable( uint8_t MODID, uint8_t unit );
  77. bool pru_enable( uint8_t MODID, uint8_t unit );
  78. bool pru_clk_disable( uint8_t MODID, uint8_t unit );
  79. bool pru_clk_enable( uint8_t MODID, uint8_t unit );
  80. bool pru_save( uint8_t MODID, uint8_t unit, CSTR Name );
  81. bool pru_load( uint8_t MODID, uint8_t unit, CSTR Name );
  82. bool pru_run( uint8_t MODID, uint8_t unit );
  83. bool pru_stop( uint8_t MODID, uint8_t unit );
  84. bool pru_sreset( uint8_t MODID, uint8_t unit );
  85. /* PRU Core specific */
  86. bool setCoreOnLine( uint8_t unit );
  87. bool sendCoreCommand( uint8_t MODID, uint8_t unit, uint32_t cmd, uint32_t address, uint32_t data );
  88. };
  89. // TODO: Uncomment the copy constructor when you need it.
  90. //inline classSOC::classSOC(const classSOC& src)
  91. //{
  92. // // TODO: copy
  93. //}
  94. // TODO: Uncomment the assignment operator when you need it.
  95. //inline classSOC& classSOC::operator=(const classSOC& rhs)
  96. //{
  97. // if (this == &rhs) {
  98. // return *this;
  99. // }
  100. //
  101. // // TODO: assignment
  102. //
  103. // return *this;
  104. //}
  105. #endif // __CLASSSOC_H_INCL__