DeviceDataStructure.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. #ifndef DEVICEDATASTRUCTURE
  2. #define DEVICEDATASTRUCTURE
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #define R_ACCESS 0x0
  7. #define W_ACCESS 0x1
  8. #define RW_ACCESS 0x2
  9. #define RWE_ACCESS 0x3
  10. /* -------------------------------------------------------------------------------------------- */
  11. /* OB Data Structures */
  12. /* -------------------------------------------------------------------------------------------- */
  13. /**
  14. * \struct bankSector.
  15. * \brief This stucture indicates the sectors parameters.
  16. */
  17. typedef struct bankSector
  18. {
  19. unsigned int index ; /**< Index of the sector. */
  20. unsigned int size ; /**< Sector size. */
  21. unsigned int address ; /**< Sector starting address. */
  22. }bankSector;
  23. /**
  24. * \struct deviceBank.
  25. * \brief This stucture defines the memory sectors for each bank.
  26. */
  27. typedef struct deviceBank
  28. {
  29. unsigned int sectorsNumber; /**< Number of sectors of the considered bank. */
  30. bankSector* sectors; /**< Sectors specifications #Bank_Sector. */
  31. }deviceBank;
  32. /**
  33. * \struct storageStructure.
  34. * \brief This stucture describes sotrage characterization.
  35. */
  36. typedef struct storageStructure
  37. {
  38. unsigned int banksNumber; /**< Number of exsisted banks. */
  39. deviceBank* banks; /**< Banks sectors definition #Device_Bank. */
  40. }storageStructure;
  41. /**
  42. * \struct bitCoefficient_C.
  43. * \brief This stucture indicates the coefficients to access to the adequate option bit.
  44. */
  45. typedef struct bitCoefficient_C
  46. {
  47. unsigned int multiplier; /**< Bit multiplier. */
  48. unsigned int offset; /**< Bit offset. */
  49. }bitCoefficient_C;
  50. /**
  51. * \struct bitValue_C.
  52. * \brief This stucture describes the option Bit value.
  53. */
  54. typedef struct bitValue_C
  55. {
  56. unsigned int value; /**< Option bit value. */
  57. char description[200]; /**< Option bit description. */
  58. }bitValue_C;
  59. /**
  60. * \struct bit_C.
  61. * \brief This stucture will be filled by values which characterize the device's option bytes.
  62. * \note See product reference manual for more details.
  63. */
  64. typedef struct bit_C
  65. {
  66. char name[32]; /**< Bit name such as RDP, BOR_LEV, nBOOT0... */
  67. char description[300]; /**< Config description. */
  68. unsigned int wordOffset; /**< Word offset. */
  69. unsigned int bitOffset; /**< Bit offset. */
  70. unsigned int bitWidth; /**< Number of bits build the option. */
  71. unsigned char access; /**< Access Read/Write. */
  72. unsigned int valuesNbr; /**< Number of possible values. */
  73. bitValue_C** values; /**< Bits value, #BitValue_C. */
  74. bitCoefficient_C equation; /**< Bits equation, #BitCoefficient_C. */
  75. unsigned char* reference;
  76. unsigned int bitValue;
  77. }bit_C;
  78. /**
  79. * \struct category_C
  80. * \brief Get option bytes banks categories descriptions.
  81. */
  82. typedef struct category_C
  83. {
  84. char name[100]; /**< Get category name such as Read Out Protection, BOR Level... */
  85. unsigned int bitsNbr; /**< Get bits number of the considered category. */
  86. bit_C** bits; /**< Get internal bits descriptions. */
  87. }category_C;
  88. /**
  89. * \struct bank_C
  90. * \brief Get option bytes banks internal descriptions.
  91. * \note STLINK and Bootloader interfaces have different addresses to access to option bytes registres.
  92. */
  93. typedef struct bank_C
  94. {
  95. unsigned int size; /**< Bank size. */
  96. unsigned int address; /**< Bank starting address. */
  97. unsigned char access; /**< Bank access Read/Write. */
  98. unsigned int categoriesNbr; /**< Number of option bytes categories. */
  99. category_C** categories; /**< Get bank categories descriptions #Category_C. */
  100. }bank_C;
  101. /**
  102. * \struct peripheral_C
  103. * \brief Get peripheral option bytes general informations.
  104. */
  105. typedef struct peripheral_C
  106. {
  107. char name[32]; /**< Peripheral name. */
  108. char description[200]; /**< Peripheral description. */
  109. unsigned int banksNbr; /**< Number of existed banks. */
  110. bank_C** banks; /**< Get banks descriptions #Bank_C. */
  111. }peripheral_C;
  112. #ifdef __cplusplus
  113. }
  114. #endif
  115. #endif // DEVICEDATASTRUCTURE