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.

stm32l1xx_hal_sram.h 5.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. /**
  2. ******************************************************************************
  3. * @file stm32l1xx_hal_sram.h
  4. * @author MCD Application Team
  5. * @brief Header file of SRAM HAL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by ST under BSD 3-Clause license,
  13. * the "License"; You may not use this file except in compliance with the
  14. * License. You may obtain a copy of the License at:
  15. * opensource.org/licenses/BSD-3-Clause
  16. *
  17. ******************************************************************************
  18. */
  19. /* Define to prevent recursive inclusion -------------------------------------*/
  20. #ifndef __STM32L1xx_HAL_SRAM_H
  21. #define __STM32L1xx_HAL_SRAM_H
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /* Includes ------------------------------------------------------------------*/
  26. #include "stm32l1xx_ll_fsmc.h"
  27. /** @addtogroup STM32L1xx_HAL_Driver
  28. * @{
  29. */
  30. #if defined (STM32L151xD) || defined (STM32L152xD) || defined (STM32L162xD)
  31. /** @addtogroup SRAM
  32. * @{
  33. */
  34. /* Exported typedef ----------------------------------------------------------*/
  35. /** @defgroup SRAM_Exported_Types SRAM Exported Types
  36. * @{
  37. */
  38. /**
  39. * @brief HAL SRAM State structures definition
  40. */
  41. typedef enum
  42. {
  43. HAL_SRAM_STATE_RESET = 0x00, /*!< SRAM not yet initialized or disabled */
  44. HAL_SRAM_STATE_READY = 0x01, /*!< SRAM initialized and ready for use */
  45. HAL_SRAM_STATE_BUSY = 0x02, /*!< SRAM internal process is ongoing */
  46. HAL_SRAM_STATE_ERROR = 0x03, /*!< SRAM error state */
  47. HAL_SRAM_STATE_PROTECTED = 0x04 /*!< SRAM peripheral NORSRAM device write protected */
  48. }HAL_SRAM_StateTypeDef;
  49. /**
  50. * @brief SRAM handle Structure definition
  51. */
  52. typedef struct
  53. {
  54. FSMC_NORSRAM_TypeDef *Instance; /*!< Register base address */
  55. FSMC_NORSRAM_EXTENDED_TypeDef *Extended; /*!< Extended mode register base address */
  56. FSMC_NORSRAM_InitTypeDef Init; /*!< SRAM device control configuration parameters */
  57. HAL_LockTypeDef Lock; /*!< SRAM locking object */
  58. __IO HAL_SRAM_StateTypeDef State; /*!< SRAM device access state */
  59. DMA_HandleTypeDef *hdma; /*!< Pointer DMA handler */
  60. }SRAM_HandleTypeDef;
  61. /**
  62. * @}
  63. */
  64. /* Exported constants --------------------------------------------------------*/
  65. /* Exported macro ------------------------------------------------------------*/
  66. /** @defgroup SRAM_Exported_Macros SRAM Exported Macros
  67. * @{
  68. */
  69. /** @brief Reset SRAM handle state
  70. * @param __HANDLE__ SRAM handle
  71. * @retval None
  72. */
  73. #define __HAL_SRAM_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SRAM_STATE_RESET)
  74. /**
  75. * @}
  76. */
  77. /* Exported functions --------------------------------------------------------*/
  78. /** @addtogroup SRAM_Exported_Functions
  79. * @{
  80. */
  81. /** @addtogroup SRAM_Exported_Functions_Group1
  82. * @{
  83. */
  84. /* Initialization/de-initialization functions **********************************/
  85. HAL_StatusTypeDef HAL_SRAM_Init(SRAM_HandleTypeDef *hsram, FSMC_NORSRAM_TimingTypeDef *Timing, FSMC_NORSRAM_TimingTypeDef *ExtTiming);
  86. HAL_StatusTypeDef HAL_SRAM_DeInit(SRAM_HandleTypeDef *hsram);
  87. void HAL_SRAM_MspInit(SRAM_HandleTypeDef *hsram);
  88. void HAL_SRAM_MspDeInit(SRAM_HandleTypeDef *hsram);
  89. void HAL_SRAM_DMA_XferCpltCallback(DMA_HandleTypeDef *hdma);
  90. void HAL_SRAM_DMA_XferErrorCallback(DMA_HandleTypeDef *hdma);
  91. /**
  92. * @}
  93. */
  94. /** @addtogroup SRAM_Exported_Functions_Group2
  95. * @{
  96. */
  97. /* I/O operation functions *****************************************************/
  98. HAL_StatusTypeDef HAL_SRAM_Read_8b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint8_t *pDstBuffer, uint32_t BufferSize);
  99. HAL_StatusTypeDef HAL_SRAM_Write_8b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint8_t *pSrcBuffer, uint32_t BufferSize);
  100. HAL_StatusTypeDef HAL_SRAM_Read_16b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint16_t *pDstBuffer, uint32_t BufferSize);
  101. HAL_StatusTypeDef HAL_SRAM_Write_16b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint16_t *pSrcBuffer, uint32_t BufferSize);
  102. HAL_StatusTypeDef HAL_SRAM_Read_32b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pDstBuffer, uint32_t BufferSize);
  103. HAL_StatusTypeDef HAL_SRAM_Write_32b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pSrcBuffer, uint32_t BufferSize);
  104. HAL_StatusTypeDef HAL_SRAM_Read_DMA(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pDstBuffer, uint32_t BufferSize);
  105. HAL_StatusTypeDef HAL_SRAM_Write_DMA(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pSrcBuffer, uint32_t BufferSize);
  106. /**
  107. * @}
  108. */
  109. /** @addtogroup SRAM_Exported_Functions_Group3
  110. * @{
  111. */
  112. /* SRAM Control functions ******************************************************/
  113. HAL_StatusTypeDef HAL_SRAM_WriteOperation_Enable(SRAM_HandleTypeDef *hsram);
  114. HAL_StatusTypeDef HAL_SRAM_WriteOperation_Disable(SRAM_HandleTypeDef *hsram);
  115. /**
  116. * @}
  117. */
  118. /** @addtogroup SRAM_Exported_Functions_Group4
  119. * @{
  120. */
  121. /* SRAM State functions *********************************************************/
  122. HAL_SRAM_StateTypeDef HAL_SRAM_GetState(SRAM_HandleTypeDef *hsram);
  123. /**
  124. * @}
  125. */
  126. /**
  127. * @}
  128. */
  129. /**
  130. * @}
  131. */
  132. #endif /* STM32L151xD || STM32L152xD || STM32L162xD */
  133. /**
  134. * @}
  135. */
  136. #ifdef __cplusplus
  137. }
  138. #endif
  139. #endif /* __STM32L1xx_HAL_SRAM_H */
  140. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/