STM32L4xx_HAL_Driver  1.14.0

Peripheral State functions. More...

Functions

HAL_NOR_StateTypeDef HAL_NOR_GetState (NOR_HandleTypeDef *hnor)
 Return the NOR controller state. More...
 
HAL_NOR_StatusTypeDef HAL_NOR_GetStatus (NOR_HandleTypeDef *hnor, uint32_t Address, uint32_t Timeout)
 Return the NOR operation status. More...
 

Detailed Description

Peripheral State functions.

  ==============================================================================
                      ##### NOR State functions #####
  ==============================================================================
  [..]
    This subsection permits to get in run-time the status of the NOR controller
    and the data flow.

Function Documentation

◆ HAL_NOR_GetState()

HAL_NOR_StateTypeDef HAL_NOR_GetState ( NOR_HandleTypeDef hnor)

Return the NOR controller state.

Parameters
hnorpointer to a NOR_HandleTypeDef structure that contains the configuration information for NOR module.
Return values
NORcontroller state

Definition at line 945 of file stm32l4xx_hal_nor.c.

946 {
947  /* Return NOR handle state */
948  return hnor->State;
949 }
__IO HAL_NOR_StateTypeDef State

◆ HAL_NOR_GetStatus()

HAL_NOR_StatusTypeDef HAL_NOR_GetStatus ( NOR_HandleTypeDef hnor,
uint32_t  Address,
uint32_t  Timeout 
)

Return the NOR operation status.

Parameters
hnorpointer to a NOR_HandleTypeDef structure that contains the configuration information for NOR module.
AddressDevice address
TimeoutNOR programming Timeout
Return values
NOR_StatusThe returned value can be: HAL_NOR_STATUS_SUCCESS, HAL_NOR_STATUS_ERROR or HAL_NOR_STATUS_TIMEOUT

Definition at line 960 of file stm32l4xx_hal_nor.c.

961 {
963  uint16_t tmpSR1 = 0, tmpSR2 = 0;
964  uint32_t tickstart = 0;
965 
966  /* Poll on NOR memory Ready/Busy signal ------------------------------------*/
967  HAL_NOR_MspWait(hnor, Timeout);
968 
969  /* Get the NOR memory operation status -------------------------------------*/
970 
971  /* Get tick */
972  tickstart = HAL_GetTick();
973  while((status != HAL_NOR_STATUS_SUCCESS) && (status != HAL_NOR_STATUS_TIMEOUT))
974  {
975  /* Check for the Timeout */
976  if(Timeout != HAL_MAX_DELAY)
977  {
978  if((Timeout == 0)||((HAL_GetTick() - tickstart ) > Timeout))
979  {
980  status = HAL_NOR_STATUS_TIMEOUT;
981  }
982  }
983 
984  /* Read NOR status register (DQ6 and DQ5) */
985  tmpSR1 = *(__IO uint16_t *)Address;
986  tmpSR2 = *(__IO uint16_t *)Address;
987 
988  /* If DQ6 did not toggle between the two reads then return HAL_NOR_STATUS_SUCCESS */
989  if ((tmpSR1 & NOR_MASK_STATUS_DQ6) == (tmpSR2 & NOR_MASK_STATUS_DQ6))
990  {
991  return HAL_NOR_STATUS_SUCCESS;
992  }
993 
994  if((tmpSR1 & NOR_MASK_STATUS_DQ5) != NOR_MASK_STATUS_DQ5)
995  {
996  status = HAL_NOR_STATUS_ONGOING;
997  }
998 
999  tmpSR1 = *(__IO uint16_t *)Address;
1000  tmpSR2 = *(__IO uint16_t *)Address;
1001 
1002  /* If DQ6 did not toggle between the two reads then return HAL_NOR_STATUS_SUCCESS */
1003  if ((tmpSR1 & NOR_MASK_STATUS_DQ6) == (tmpSR2 & NOR_MASK_STATUS_DQ6))
1004  {
1005  return HAL_NOR_STATUS_SUCCESS;
1006  }
1007  if ((tmpSR1 & NOR_MASK_STATUS_DQ5) == NOR_MASK_STATUS_DQ5)
1008  {
1009  return HAL_NOR_STATUS_ERROR;
1010  }
1011  }
1012 
1013  /* Return the operation status */
1014  return status;
1015 }
void HAL_NOR_MspWait(NOR_HandleTypeDef *hnor, uint32_t Timeout)
NOR MSP Wait for Ready/Busy signal.
uint32_t HAL_GetTick(void)
Provide a tick value in millisecond.
HAL_NOR_StatusTypeDef
FMC NOR Status typedef.