mirror of
https://github.com/apache/nuttx.git
synced 2026-06-08 10:32:47 +08:00
Merged nuttx/arch into master
This commit is contained in:
@@ -367,7 +367,7 @@ static uint64_t efm32_get_burtc_tick(void)
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: up_rtcinitialize
|
||||
* Name: up_rtc_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the hardware RTC per the selected configuration. This function is
|
||||
@@ -381,7 +381,7 @@ static uint64_t efm32_get_burtc_tick(void)
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int up_rtcinitialize(void)
|
||||
int up_rtc_initialize(void)
|
||||
{
|
||||
efm32_rtc_burtc_init();
|
||||
|
||||
|
||||
@@ -263,7 +263,7 @@ static int rtc_interrupt(int irq, void *context)
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: up_rtcinitialize
|
||||
* Name: up_rtc_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the hardware RTC per the selected configuration. This function is
|
||||
@@ -277,7 +277,7 @@ static int rtc_interrupt(int irq, void *context)
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int up_rtcinitialize(void)
|
||||
int up_rtc_initialize(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
||||
@@ -351,7 +351,7 @@ static uint32_t rtc_sync(void)
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: up_rtcinitialize
|
||||
* Name: up_rtc_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the hardware RTC per the selected configuration. This function is
|
||||
@@ -365,7 +365,7 @@ static uint32_t rtc_sync(void)
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int up_rtcinitialize(void)
|
||||
int up_rtc_initialize(void)
|
||||
{
|
||||
uint32_t ver;
|
||||
|
||||
|
||||
@@ -308,7 +308,7 @@ static int rtc_interrupt(int irq, void *context)
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: up_rtcinitialize
|
||||
* Name: up_rtc_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the hardware RTC per the selected configuration. This function is
|
||||
@@ -322,7 +322,7 @@ static int rtc_interrupt(int irq, void *context)
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int up_rtcinitialize(void)
|
||||
int up_rtc_initialize(void)
|
||||
{
|
||||
uint32_t ver;
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ CHIP_ASRCS =
|
||||
CHIP_CSRCS = stm32_allocateheap.c stm32_start.c stm32_rcc.c stm32_lse.c
|
||||
CHIP_CSRCS += stm32_lsi.c stm32_gpio.c stm32_exti_gpio.c stm32_flash.c stm32_irq.c
|
||||
CHIP_CSRCS += stm32_dma.c stm32_lowputc.c stm32_serial.c stm32_spi.c
|
||||
CHIP_CSRCS += stm32_sdio.c stm32_tim.c stm32_waste.c stm32_ccm.c
|
||||
CHIP_CSRCS += stm32_sdio.c stm32_tim.c stm32_waste.c stm32_ccm.c stm32_uid.c
|
||||
|
||||
ifeq ($(CONFIG_TIMER),y)
|
||||
CHIP_CSRCS += stm32_tim_lowerhalf.c
|
||||
|
||||
@@ -594,7 +594,7 @@ static int rtc_interrupt(int irq, void *context)
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: up_rtcinitialize
|
||||
* Name: up_rtc_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the hardware RTC per the selected configuration. This function is
|
||||
@@ -608,7 +608,7 @@ static int rtc_interrupt(int irq, void *context)
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int up_rtcinitialize(void)
|
||||
int up_rtc_initialize(void)
|
||||
{
|
||||
uint32_t regval;
|
||||
uint32_t tr_bkp;
|
||||
|
||||
@@ -350,7 +350,7 @@ static int stm32_rtc_interrupt(int irq, void *context)
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: up_rtcinitialize
|
||||
* Name: up_rtc_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the hardware RTC per the selected configuration. This function is
|
||||
@@ -364,7 +364,7 @@ static int stm32_rtc_interrupt(int irq, void *context)
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int up_rtcinitialize(void)
|
||||
int up_rtc_initialize(void)
|
||||
{
|
||||
/* Enable write access to the backup domain (RTC registers, RTC backup data
|
||||
* registers and backup SRAM).
|
||||
|
||||
@@ -201,6 +201,7 @@ int stm32_tim_deinit(FAR struct stm32_tim_dev_s * dev);
|
||||
* to indicate the nature of any failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_TIMER
|
||||
int stm32_timer_initialize(FAR const char *devpath, int timer);
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,63 @@
|
||||
/************************************************************************************
|
||||
* arch/arm/src/stm32/stm32_uid.c
|
||||
*
|
||||
* Copyright (C) 2015 Marawan Ragab. All rights reserved.
|
||||
* Author: Marawan Ragab <marawan31@gmail.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <chip/stm32_memorymap.h>
|
||||
|
||||
#include "stm32_uid.h"
|
||||
|
||||
#ifdef STM32_SYSMEM_UID /* Not defined for the STM32L */
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
void stm32_get_uniqueid(uint8_t uniqueid[12])
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 12; i++)
|
||||
{
|
||||
uniqueid[i] = *((uint8_t*)(STM32_SYSMEM_UID)+i);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* STM32_SYSMEM_UID */
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
/************************************************************************************
|
||||
* arch/arm/src/stm32/stm32_uid.h
|
||||
*
|
||||
* Copyright (C) 2015 Marawan Ragab. All rights reserved.
|
||||
* Author: Marawan Ragab <marawan31@gmail.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ARCH_ARM_SRC_STM32_UID_H
|
||||
#define __ARCH_ARM_SRC_STM32_UID_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/************************************************************************************
|
||||
* Public Function Prototypes
|
||||
************************************************************************************/
|
||||
|
||||
void stm32_get_uniqueid(uint8_t uniqueid[12]);
|
||||
|
||||
#endif /* __ARCH_ARM_SRC_STM32_UID_H */
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/sim/src/up_initialize.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011-2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2011-2015 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -79,6 +79,7 @@ static void up_init_smartfs(void)
|
||||
FAR struct mtd_dev_s *mtd;
|
||||
FAR struct spi_dev_s *spi;
|
||||
|
||||
#ifdef CONFIG_MTD_M25P
|
||||
/* Initialize a simulated SPI FLASH block device m25p MTD driver */
|
||||
|
||||
spi = up_spiflashinitialize();
|
||||
@@ -87,6 +88,18 @@ static void up_init_smartfs(void)
|
||||
/* Now initialize a SMART Flash block device and bind it to the MTD device */
|
||||
|
||||
smart_initialize(0, mtd, NULL);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MTD_W25
|
||||
/* Initialize a simulated SPI FLASH block device m25p MTD driver */
|
||||
|
||||
spi = up_spiflashinitialize();
|
||||
mtd = w25_initialize(spi);
|
||||
|
||||
/* Now initialize a SMART Flash block device and bind it to the MTD device */
|
||||
|
||||
smart_initialize(0, mtd, NULL);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -84,6 +84,11 @@
|
||||
#ifdef CONFIG_SIM_SPIFLASH_1M
|
||||
# define CONFIG_SPIFLASH_SIZE (128 * 1024)
|
||||
# define CONFIG_SPIFLASH_CAPACITY 0x11
|
||||
|
||||
#ifndef CONFIG_SIM_SPIFLASH_SECTORSIZE
|
||||
# define CONFIG_SIM_SPIFLASH_SECTORSIZE 2048
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SIM_SPIFLASH_8M
|
||||
@@ -157,6 +162,7 @@
|
||||
#define SPIFLASH_STATE_READ2 14
|
||||
#define SPIFLASH_STATE_READ3 15
|
||||
#define SPIFLASH_STATE_READ4 16
|
||||
#define SPIFLASH_STATE_FREAD_WAIT 17
|
||||
|
||||
/* Instructions */
|
||||
/* Command Value N Description Addr Dummy Data */
|
||||
@@ -666,6 +672,7 @@ static void spiflash_writeword(FAR struct sim_spiflashdev_s *priv, uint16_t data
|
||||
break;
|
||||
|
||||
case SPIFLASH_READ:
|
||||
case SPIFLASH_FAST_READ:
|
||||
priv->state = SPIFLASH_STATE_READ1;
|
||||
break;
|
||||
|
||||
@@ -780,6 +787,18 @@ static void spiflash_writeword(FAR struct sim_spiflashdev_s *priv, uint16_t data
|
||||
|
||||
case SPIFLASH_STATE_READ3:
|
||||
priv->address |= data;
|
||||
if (priv->last_cmd == SPIFLASH_FAST_READ)
|
||||
{
|
||||
priv->state = SPIFLASH_STATE_FREAD_WAIT;
|
||||
}
|
||||
else
|
||||
{
|
||||
priv->state = SPIFLASH_STATE_READ4;
|
||||
}
|
||||
break;
|
||||
|
||||
case SPIFLASH_STATE_FREAD_WAIT:
|
||||
priv->read_data = 0xff;
|
||||
priv->state = SPIFLASH_STATE_READ4;
|
||||
break;
|
||||
|
||||
@@ -850,6 +869,7 @@ FAR struct spi_dev_s *up_spiflashinitialize()
|
||||
priv->state = SPIFLASH_STATE_IDLE;
|
||||
priv->read_data = 0xFF;
|
||||
priv->last_cmd = 0xFF;
|
||||
memset(&priv->data[0], 0xFF, sizeof(priv->data));
|
||||
|
||||
irqrestore(flags);
|
||||
return (FAR struct spi_dev_s *)priv;
|
||||
|
||||
Reference in New Issue
Block a user