tiva/lm3s6965-ek: Add bringup() function

A shrinked copy of the sim version.
I changed the license to apache 2.0 with a permisson from @patacongo.
This commit is contained in:
YAMAMOTO Takashi
2020-02-14 10:26:03 -06:00
committed by Gregory Nutt
parent 75e3af0985
commit 6be378221a
5 changed files with 133 additions and 2 deletions
+6
View File
@@ -46,4 +46,10 @@ ifeq ($(CONFIG_NX_LCDDRIVER),y)
CSRCS += lm_oled.c
endif
ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y)
CSRCS += lm_bringup.c
else ifeq ($(CONFIG_LIB_BOARDCTL),y)
CSRCS += lm_bringup.c
endif
include $(TOPDIR)/boards/Board.mk
+22 -2
View File
@@ -62,7 +62,7 @@
# undef CONFIG_TIVA_SSI1
#endif
/* LM3S6965 Eval Kit ***************************************************************/
/* LM3S6965 Eval Kit ********************************************************/
/* GPIO Usage
*
@@ -112,12 +112,32 @@
#define OLEDEN_GPIO (GPIO_FUNC_OUTPUT | GPIO_PADTYPE_STD | GPIO_STRENGTH_8MA | \
GPIO_VALUE_ONE | GPIO_PORTC | 6)
/* procfs File System */
#ifdef CONFIG_FS_PROCFS
# ifdef CONFIG_NSH_PROC_MOUNTPOINT
# define LM_PROCFS_MOUNTPOINT CONFIG_NSH_PROC_MOUNTPOINT
# else
# define LM_PROCFS_MOUNTPOINT "/proc"
# endif
#endif
/****************************************************************************
* Public Functions
* Public Function Prototypes
****************************************************************************/
#ifndef __ASSEMBLY__
/****************************************************************************
* Name: lm_bringup
*
* Description:
* Bring up board features
*
****************************************************************************/
int lm_bringup(void);
/****************************************************************************
* Name: lm_ssidev_initialize
*
@@ -48,6 +48,7 @@
#include <nuttx/spi/spi.h>
#include <nuttx/mmcsd.h>
#include "lm3s6965-ek.h"
#include "tiva_ssi.h"
/****************************************************************************
@@ -152,6 +153,9 @@ int board_app_initialize(uintptr_t arg)
mcinfo("Successfully bound SPI port %d to MMC/SD slot %d\n",
CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO);
#endif
#ifndef CONFIG_BOARD_LATE_INITIALIZE
lm_bringup();
#endif
return OK;
}
+20
View File
@@ -94,3 +94,23 @@ void tiva_boardinitialize(void)
board_autoled_initialize();
#endif
}
/****************************************************************************
* Name: board_late_initialize
*
* Description:
* If CONFIG_BOARD_LATE_INITIALIZE is selected, then an additional
* initialization call will be performed in the boot-up sequence to a
* function called board_late_initialize(). board_late_initialize() will be
* called immediately after up_initialize() is called and just before the
* initial application is started. This additional initialization phase
* may be used, for example, to initialize board-specific device drivers.
*
****************************************************************************/
#ifdef CONFIG_BOARD_LATE_INITIALIZE
void board_late_initialize(void)
{
lm_bringup();
}
#endif /* CONFIG_BOARD_LATE_INITIALIZE */
@@ -0,0 +1,81 @@
/****************************************************************************
* boards/arm/tiva/lm3s6965-ek/src/lm_bringup.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/mount.h>
#include <debug.h>
#include "lm3s6965-ek.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: lm_bringup
*
* Description:
* Bring up board features
*
****************************************************************************/
int lm_bringup(void)
{
int ret = 0;
#ifdef CONFIG_FS_BINFS
/* Mount the binfs file system */
ret = mount(NULL, "/bin", "binfs", 0, NULL);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to mount binfs at /bin: %d\n", ret);
}
#endif
#ifdef CONFIG_FS_PROCFS
/* Mount the procfs file system */
ret = mount(NULL, LM_PROCFS_MOUNTPOINT, "procfs", 0, NULL);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to mount procfs at %s: %d\n",
LM_PROCFS_MOUNTPOINT, ret);
}
#endif
#ifdef CONFIG_FS_TMPFS
/* Mount the tmpfs file system */
ret = mount(NULL, CONFIG_LIBC_TMPDIR, "tmpfs", 0, NULL);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to mount tmpfs at %s: %d\n",
CONFIG_LIBC_TMPDIR, ret);
}
#endif
return ret;
}