nfm_base_excls.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. #ifndef NFM_BASE_EXTENDED_CLASS_H
  2. #define NFM_BASE_EXTENDED_CLASS_H
  3. #include "app/nfm/nfm_base.h"
  4. typedef struct
  5. {
  6. NFMClass_t public;
  7. struct
  8. {
  9. struct
  10. {
  11. // device class constructor
  12. void (* classInit)( void );
  13. // Get model name (description) by DeviceID
  14. /*const char * (* getModelNameById)( uint16_t deviceId );*/
  15. // Get model name (description)
  16. const char * (* getModelName)();
  17. // Get device id
  18. bool (* getModelId)( uint16_t * pDeviceId );
  19. struct
  20. {
  21. bool ( * setProtect )( bool desiredStatus );
  22. bool ( * getProtect )( );
  23. const sEcalHeader_t * ( * getCommonHeader )( uint8_t * buffer, size_t size );
  24. const sEcalDataHeader_t * ( * getDataHeader )( eChrz_t tableId, uint8_t * buffer, size_t size );
  25. const sEcalTCompHeader_t * ( * getTCompHeader )( uint8_t * buffer, size_t size );
  26. size_t ( * getChrzTableIndex)(ePortComb_t portCombination, ePortStateId_t portState );
  27. size_t ( * getTCompTableIndex)(ePortComb_t portCombination, ePortStateId_t portState );
  28. // getChrzTableHeader = NFM_ROM_ReadChrzTableHeader
  29. size_t ( * getChrzTableHeader)( eChrz_t sectorId,
  30. ePortComb_t portCombination,
  31. ePortStateId_t portState,
  32. size_t nPoints,
  33. sEcalChrzTableHeader_t * pHeader,
  34. unsigned int * pErrCode
  35. );
  36. size_t ( * getChrzPoints)( /*const*/ sNFMGetPoints_t * pContext );
  37. size_t ( * getTCompMagnTableHeader)(
  38. ePortComb_t portCombination,
  39. ePortStateId_t portState,
  40. size_t nPoints,
  41. sEcalTCompTableMagnHeader_t * pHeader,
  42. unsigned int * pErrCode
  43. );
  44. size_t ( * getTCompPhaseTableHeader)(
  45. ePortComb_t portCombination,
  46. ePortStateId_t portState,
  47. size_t nPoints,
  48. sEcalTCompTablePhaseHeader_t * pHeader,
  49. unsigned int * pErrCode
  50. );
  51. size_t ( * getTCompMagnPoints)( /*const*/ sNFMGetPoints_t * pContext );
  52. size_t ( * getTCompPhasePoints)( /*const*/ sNFMGetPoints_t * pContext );
  53. size_t ( * setSettingsBlock)(
  54. uint8_t * buffer,
  55. size_t nOffset,
  56. size_t nBytesToWrite );
  57. size_t ( * getSettingsBlock)(
  58. uint8_t * buffer,
  59. size_t nOffset,
  60. size_t nBytesToRead );
  61. size_t ( * getSettingsBlockSize)();
  62. bool ( * validateSettings )();
  63. }
  64. memory;
  65. }
  66. methods;
  67. struct
  68. {
  69. // Device Model ID
  70. uint16_t deviceId;
  71. // Device Model Profile
  72. const sNFMModel_t * modelProfile;
  73. // Memory profile
  74. const sSwitchMemoryProfile_t * memProfile;
  75. }
  76. properties;
  77. }
  78. private;
  79. }
  80. NFMClassEx_t;
  81. // sNFMGetFreqPoints_t
  82. // Control structure to retieve the frequency points
  83. typedef struct
  84. {
  85. double Fdesc; // Frequency discrette
  86. sEcalSegment_t Segment; // segment data
  87. uint16_t nSegments; // number of segments
  88. size_t BufferCapacity; // user buffer capacity [pDataArray]
  89. double * pDataArray; // Pointer to the buffer to store frequency points
  90. uint16_t nStartPoint; // Starting point
  91. uint16_t nStartSegment; // Starting segment
  92. // make to take 32-bit
  93. union
  94. {
  95. struct
  96. {
  97. eChrz_t tableId; // characterization id
  98. eChrzScaleType_t scaleType; // scale type
  99. };
  100. uint32_t reserved0_for_make_u32;
  101. };
  102. }
  103. sNFMGetFreqPoints_t;
  104. // sSWGetTablePoints_t
  105. // Control structure to retieve the table points
  106. typedef struct
  107. {
  108. size_t BufferCapacity; // user buffer capacity [pDataArray]
  109. sSWTablePoint_t * pDataArray; // Pointer to the buffer to store table points
  110. uint16_t nStartPoint; // Starting point
  111. uint16_t nNumberOfPoints; // Number of table points
  112. sTableTablePoint_t TablePoint; //Current readed point value
  113. // make to take 32-bit
  114. union
  115. {
  116. struct
  117. {
  118. eChrz_t tableId; // characterization id
  119. };
  120. uint32_t reserved0_for_make_u32;
  121. };
  122. }
  123. sSWGetTablePoints_t;
  124. // sNFMGetPointsSimplified_t
  125. // Control structure to retieve the data points
  126. typedef struct
  127. {
  128. size_t BufferCapacity; // user buffer capacity [pDataArray]
  129. sNFMGetPoints_t intCtx;
  130. // make to take 32-bit
  131. union
  132. {
  133. struct
  134. {
  135. eChrz_t sectorId;
  136. ePortComb_t portComb;
  137. ePortStateId_t portState;
  138. uint8_t isThermoPhase; // only for NFMGetPointsThermo_Begin: 0 - magnitue, 1 - phase
  139. };
  140. uint32_t reserved0_for_make_u32;
  141. };
  142. }
  143. sNFMGetPointsSimplified_t;
  144. #endif