2017-08-02 21:05:07 +09:00
|
|
|
/****************************************************************************
|
|
|
|
* configs/lc823450-xgevk/src/lc823450_bringup.c
|
|
|
|
*
|
2018-04-04 12:35:47 +00:00
|
|
|
* Copyright 2017,2018 Sony Video & Sound Products Inc.
|
2017-08-02 21:05:07 +09:00
|
|
|
* Author: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.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 <sys/types.h>
|
|
|
|
#include <sys/mount.h>
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <syslog.h>
|
|
|
|
|
2017-12-08 12:31:34 +00:00
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
# include <sched.h>
|
|
|
|
#endif
|
|
|
|
|
2018-01-30 11:07:36 -06:00
|
|
|
#include <nuttx/sched.h>
|
|
|
|
|
2017-11-28 04:31:16 +00:00
|
|
|
#ifdef CONFIG_RNDIS
|
|
|
|
# include <nuttx/usb/rndis.h>
|
|
|
|
#endif
|
|
|
|
|
2017-09-15 14:42:24 -06:00
|
|
|
#ifdef CONFIG_WATCHDOG
|
|
|
|
# include "lc823450_wdt.h"
|
|
|
|
#endif
|
|
|
|
|
2018-01-10 15:36:16 +09:00
|
|
|
#ifdef CONFIG_DVFS
|
|
|
|
# include "lc823450_dvfs2.h"
|
|
|
|
#endif
|
|
|
|
|
2017-08-02 21:05:07 +09:00
|
|
|
#include "lc823450-xgevk.h"
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: lc823450_bringup
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Bring up board features
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
int lc823450_bringup(void)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
2017-09-12 01:00:32 +00:00
|
|
|
#ifdef CONFIG_WATCHDOG
|
|
|
|
lc823450_wdt_initialize();
|
|
|
|
#endif
|
|
|
|
|
2017-08-02 21:05:07 +09:00
|
|
|
#ifdef CONFIG_FS_PROCFS
|
2018-01-10 15:36:16 +09:00
|
|
|
|
|
|
|
#ifdef CONFIG_DVFS
|
|
|
|
(void)dvfs_procfs_register();
|
|
|
|
#endif
|
|
|
|
|
2017-08-02 21:05:07 +09:00
|
|
|
/* Mount the procfs file system */
|
|
|
|
|
|
|
|
ret = mount(NULL, "/proc", "procfs", 0, NULL);
|
|
|
|
if (ret < 0)
|
|
|
|
{
|
|
|
|
syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-11-28 04:31:16 +00:00
|
|
|
#ifdef CONFIG_FS_FAT
|
|
|
|
ret = mount("/dev/mtdblock0p10", "/mnt/sd0", "vfat", 0, NULL);
|
|
|
|
if (ret < 0)
|
|
|
|
{
|
|
|
|
syslog(LOG_ERR, "ERROR: Failed to mount vfat at /mnt/sd0: %d\n", ret);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-08-02 21:05:07 +09:00
|
|
|
#ifdef CONFIG_BMA250
|
|
|
|
lc823450_bma250initialize("/dev/accel");
|
|
|
|
#endif
|
|
|
|
|
2017-11-08 12:25:13 +00:00
|
|
|
#ifdef CONFIG_AUDIO_WM8776
|
|
|
|
lc823450_wm8776initialize(0);
|
|
|
|
#endif
|
|
|
|
|
2017-11-28 04:31:16 +00:00
|
|
|
#if defined(CONFIG_RNDIS) && defined(CONFIG_NSH_MACADDR)
|
|
|
|
uint8_t mac[6];
|
|
|
|
mac[0] = 0xaa; /* TODO */
|
|
|
|
mac[1] = (CONFIG_NSH_MACADDR >> (8 * 4)) & 0xff;
|
|
|
|
mac[2] = (CONFIG_NSH_MACADDR >> (8 * 3)) & 0xff;
|
|
|
|
mac[3] = (CONFIG_NSH_MACADDR >> (8 * 2)) & 0xff;
|
|
|
|
mac[4] = (CONFIG_NSH_MACADDR >> (8 * 1)) & 0xff;
|
|
|
|
mac[5] = (CONFIG_NSH_MACADDR >> (8 * 0)) & 0xff;
|
|
|
|
usbdev_rndis_initialize(mac);
|
|
|
|
#endif
|
|
|
|
|
2017-12-08 12:31:34 +00:00
|
|
|
#if defined(CONFIG_SMP) && defined (CONFIG_RNDIS)
|
|
|
|
cpu_set_t cpuset;
|
|
|
|
CPU_ZERO(&cpuset);
|
|
|
|
CPU_SET(1, &cpuset); /* assigned to CPU1 */
|
|
|
|
|
|
|
|
/* NOTE: pid=4 is assumed to be lpwork */
|
|
|
|
|
2018-01-30 11:07:36 -06:00
|
|
|
(void)nxsched_setaffinity(4, sizeof(cpu_set_t), &cpuset);
|
2017-12-08 12:31:34 +00:00
|
|
|
#endif
|
|
|
|
|
2017-08-02 21:05:07 +09:00
|
|
|
/* If we got here then perhaps not all initialization was successful, but
|
|
|
|
* at least enough succeeded to bring-up NSH with perhaps reduced
|
|
|
|
* capabilities.
|
|
|
|
*/
|
|
|
|
|
|
|
|
UNUSED(ret);
|
|
|
|
return OK;
|
|
|
|
}
|