STM32H735xx HAL User Manual
Defines | Functions | Variables
stm32h7xx_hal_nor.c File Reference

NOR HAL module driver. This file provides a generic firmware to drive NOR memories mounted as external device. More...

#include "stm32h7xx_hal.h"

Go to the source code of this file.

Defines

#define NOR_CMD_ADDRESS_FIRST   (uint16_t)0x0555
#define NOR_CMD_ADDRESS_FIRST_CFI   (uint16_t)0x0055
#define NOR_CMD_ADDRESS_SECOND   (uint16_t)0x02AA
#define NOR_CMD_ADDRESS_THIRD   (uint16_t)0x0555
#define NOR_CMD_ADDRESS_FOURTH   (uint16_t)0x0555
#define NOR_CMD_ADDRESS_FIFTH   (uint16_t)0x02AA
#define NOR_CMD_ADDRESS_SIXTH   (uint16_t)0x0555
#define NOR_CMD_DATA_READ_RESET   (uint16_t)0x00F0
#define NOR_CMD_DATA_FIRST   (uint16_t)0x00AA
#define NOR_CMD_DATA_SECOND   (uint16_t)0x0055
#define NOR_CMD_DATA_AUTO_SELECT   (uint16_t)0x0090
#define NOR_CMD_DATA_PROGRAM   (uint16_t)0x00A0
#define NOR_CMD_DATA_CHIP_BLOCK_ERASE_THIRD   (uint16_t)0x0080
#define NOR_CMD_DATA_CHIP_BLOCK_ERASE_FOURTH   (uint16_t)0x00AA
#define NOR_CMD_DATA_CHIP_BLOCK_ERASE_FIFTH   (uint16_t)0x0055
#define NOR_CMD_DATA_CHIP_ERASE   (uint16_t)0x0010
#define NOR_CMD_DATA_CFI   (uint16_t)0x0098
#define NOR_CMD_DATA_BUFFER_AND_PROG   (uint8_t)0x25
#define NOR_CMD_DATA_BUFFER_AND_PROG_CONFIRM   (uint8_t)0x29
#define NOR_CMD_DATA_BLOCK_ERASE   (uint8_t)0x30
#define NOR_CMD_READ_ARRAY   (uint16_t)0x00FF
#define NOR_CMD_WORD_PROGRAM   (uint16_t)0x0040
#define NOR_CMD_BUFFERED_PROGRAM   (uint16_t)0x00E8
#define NOR_CMD_CONFIRM   (uint16_t)0x00D0
#define NOR_CMD_BLOCK_ERASE   (uint16_t)0x0020
#define NOR_CMD_BLOCK_UNLOCK   (uint16_t)0x0060
#define NOR_CMD_READ_STATUS_REG   (uint16_t)0x0070
#define NOR_CMD_CLEAR_STATUS_REG   (uint16_t)0x0050
#define NOR_MASK_STATUS_DQ4   (uint16_t)0x0010
#define NOR_MASK_STATUS_DQ5   (uint16_t)0x0020
#define NOR_MASK_STATUS_DQ6   (uint16_t)0x0040
#define NOR_MASK_STATUS_DQ7   (uint16_t)0x0080
#define NOR_ADDRESS_COMMAND_SET   (uint16_t)0x0013
#define NOR_INTEL_SHARP_EXT_COMMAND_SET   (uint16_t)0x0001 /* Supported in this driver */
#define NOR_AMD_FUJITSU_COMMAND_SET   (uint16_t)0x0002 /* Supported in this driver */
#define NOR_INTEL_STANDARD_COMMAND_SET   (uint16_t)0x0003 /* Not Supported in this driver */
#define NOR_AMD_FUJITSU_EXT_COMMAND_SET   (uint16_t)0x0004 /* Not Supported in this driver */
#define NOR_WINDBOND_STANDARD_COMMAND_SET   (uint16_t)0x0006 /* Not Supported in this driver */
#define NOR_MITSUBISHI_STANDARD_COMMAND_SET   (uint16_t)0x0100 /* Not Supported in this driver */
#define NOR_MITSUBISHI_EXT_COMMAND_SET   (uint16_t)0x0101 /* Not Supported in this driver */
#define NOR_PAGE_WRITE_COMMAND_SET   (uint16_t)0x0102 /* Not Supported in this driver */
#define NOR_INTEL_PERFORMANCE_COMMAND_SET   (uint16_t)0x0200 /* Not Supported in this driver */
#define NOR_INTEL_DATA_COMMAND_SET   (uint16_t)0x0210 /* Not Supported in this driver */

Functions

HAL_StatusTypeDef HAL_NOR_Init (NOR_HandleTypeDef *hnor, FMC_NORSRAM_TimingTypeDef *Timing, FMC_NORSRAM_TimingTypeDef *ExtTiming)
 Perform the NOR memory Initialization sequence.
HAL_StatusTypeDef HAL_NOR_DeInit (NOR_HandleTypeDef *hnor)
 Perform NOR memory De-Initialization sequence.
__weak void HAL_NOR_MspInit (NOR_HandleTypeDef *hnor)
 NOR MSP Init.
__weak void HAL_NOR_MspDeInit (NOR_HandleTypeDef *hnor)
 NOR MSP DeInit.
__weak void HAL_NOR_MspWait (NOR_HandleTypeDef *hnor, uint32_t Timeout)
 NOR MSP Wait for Ready/Busy signal.
HAL_StatusTypeDef HAL_NOR_Read_ID (NOR_HandleTypeDef *hnor, NOR_IDTypeDef *pNOR_ID)
 Read NOR flash IDs.
HAL_StatusTypeDef HAL_NOR_ReturnToReadMode (NOR_HandleTypeDef *hnor)
 Returns the NOR memory to Read mode.
HAL_StatusTypeDef HAL_NOR_Read (NOR_HandleTypeDef *hnor, uint32_t *pAddress, uint16_t *pData)
 Read data from NOR memory.
HAL_StatusTypeDef HAL_NOR_Program (NOR_HandleTypeDef *hnor, uint32_t *pAddress, uint16_t *pData)
 Program data to NOR memory.
HAL_StatusTypeDef HAL_NOR_ReadBuffer (NOR_HandleTypeDef *hnor, uint32_t uwAddress, uint16_t *pData, uint32_t uwBufferSize)
 Reads a half-word buffer from the NOR memory.
HAL_StatusTypeDef HAL_NOR_ProgramBuffer (NOR_HandleTypeDef *hnor, uint32_t uwAddress, uint16_t *pData, uint32_t uwBufferSize)
 Writes a half-word buffer to the NOR memory.
HAL_StatusTypeDef HAL_NOR_Erase_Block (NOR_HandleTypeDef *hnor, uint32_t BlockAddress, uint32_t Address)
 Erase the specified block of the NOR memory.
HAL_StatusTypeDef HAL_NOR_Erase_Chip (NOR_HandleTypeDef *hnor, uint32_t Address)
 Erase the entire NOR chip.
HAL_StatusTypeDef HAL_NOR_Read_CFI (NOR_HandleTypeDef *hnor, NOR_CFITypeDef *pNOR_CFI)
 Read NOR flash CFI IDs.
HAL_StatusTypeDef HAL_NOR_RegisterCallback (NOR_HandleTypeDef *hnor, HAL_NOR_CallbackIDTypeDef CallbackId, pNOR_CallbackTypeDef pCallback)
 Register a User NOR Callback To be used instead of the weak (surcharged) predefined callback.
HAL_StatusTypeDef HAL_NOR_UnRegisterCallback (NOR_HandleTypeDef *hnor, HAL_NOR_CallbackIDTypeDef CallbackId)
 Unregister a User NOR Callback NOR Callback is redirected to the weak (surcharged) predefined callback.
HAL_StatusTypeDef HAL_NOR_WriteOperation_Enable (NOR_HandleTypeDef *hnor)
 Enables dynamically NOR write operation.
HAL_StatusTypeDef HAL_NOR_WriteOperation_Disable (NOR_HandleTypeDef *hnor)
 Disables dynamically NOR write operation.
HAL_NOR_StateTypeDef HAL_NOR_GetState (NOR_HandleTypeDef *hnor)
 return the NOR controller state
HAL_NOR_StatusTypeDef HAL_NOR_GetStatus (NOR_HandleTypeDef *hnor, uint32_t Address, uint32_t Timeout)
 Returns the NOR operation status.

Variables

static uint32_t uwNORMemoryDataWidth = NOR_MEMORY_8B

Detailed Description

NOR HAL module driver. This file provides a generic firmware to drive NOR memories mounted as external device.

Author:
MCD Application Team
Attention:

Copyright (c) 2017 STMicroelectronics. All rights reserved.

This software is licensed under terms that can be found in the LICENSE file in the root directory of this software component. If no LICENSE file comes with this software, it is provided AS-IS.

  ==============================================================================
                     ##### How to use this driver #####
  ==============================================================================
    [..]
      This driver is a generic layered driver which contains a set of APIs used to
      control NOR flash memories. It uses the FMC layer functions to interface
      with NOR devices. This driver is used as follows:

      (+) NOR flash memory configuration sequence using the function HAL_NOR_Init()
          with control and timing parameters for both normal and extended mode.

      (+) Read NOR flash memory manufacturer code and device IDs using the function
          HAL_NOR_Read_ID(). The read information is stored in the NOR_ID_TypeDef
          structure declared by the function caller.

      (+) Access NOR flash memory by read/write data unit operations using the functions
          HAL_NOR_Read(), HAL_NOR_Program().

      (+) Perform NOR flash erase block/chip operations using the functions
          HAL_NOR_Erase_Block() and HAL_NOR_Erase_Chip().

      (+) Read the NOR flash CFI (common flash interface) IDs using the function
          HAL_NOR_Read_CFI(). The read information is stored in the NOR_CFI_TypeDef
          structure declared by the function caller.

      (+) You can also control the NOR device by calling the control APIs HAL_NOR_WriteOperation_Enable()/
          HAL_NOR_WriteOperation_Disable() to respectively enable/disable the NOR write operation

      (+) You can monitor the NOR device HAL state by calling the function
          HAL_NOR_GetState()
    [..]
     (@) This driver is a set of generic APIs which handle standard NOR flash operations.
         If a NOR flash device contains different operations and/or implementations,
         it should be implemented separately.

     *** NOR HAL driver macros list ***
     =============================================
     [..]
       Below the list of most used macros in NOR HAL driver.

      (+) NOR_WRITE : NOR memory write data to specified address

    *** Callback registration ***
    =============================================
    [..]
      The compilation define  USE_HAL_NOR_REGISTER_CALLBACKS when set to 1
      allows the user to configure dynamically the driver callbacks.

      Use Functions HAL_NOR_RegisterCallback() to register a user callback,
      it allows to register following callbacks:
        (+) MspInitCallback    : NOR MspInit.
        (+) MspDeInitCallback  : NOR MspDeInit.
      This function takes as parameters the HAL peripheral handle, the Callback ID
      and a pointer to the user callback function.

      Use function HAL_NOR_UnRegisterCallback() to reset a callback to the default
      weak (surcharged) function. It allows to reset following callbacks:
        (+) MspInitCallback    : NOR MspInit.
        (+) MspDeInitCallback  : NOR MspDeInit.
      This function) takes as parameters the HAL peripheral handle and the Callback ID.

      By default, after the HAL_NOR_Init and if the state is HAL_NOR_STATE_RESET
      all callbacks are reset to the corresponding legacy weak (surcharged) functions.
      Exception done for MspInit and MspDeInit callbacks that are respectively
      reset to the legacy weak (surcharged) functions in the HAL_NOR_Init
      and  HAL_NOR_DeInit only when these callbacks are null (not registered beforehand).
      If not, MspInit or MspDeInit are not null, the HAL_NOR_Init and HAL_NOR_DeInit
      keep and use the user MspInit/MspDeInit callbacks (registered beforehand)

      Callbacks can be registered/unregistered in READY state only.
      Exception done for MspInit/MspDeInit callbacks that can be registered/unregistered
      in READY or RESET state, thus registered (user) MspInit/DeInit callbacks can be used
      during the Init/DeInit.
      In that case first register the MspInit/MspDeInit user callbacks
      using HAL_NOR_RegisterCallback before calling HAL_NOR_DeInit
      or HAL_NOR_Init function.

      When The compilation define USE_HAL_NOR_REGISTER_CALLBACKS is set to 0 or
      not defined, the callback registering feature is not available
      and weak (surcharged) callbacks are used.

  

Definition in file stm32h7xx_hal_nor.c.