2012-04-26 20:11:46 +00:00
|
|
|
/****************************************************************************
|
2021-03-08 18:39:04 -03:00
|
|
|
* boards/mips/pic32mx/ubw32/src/pic32_appinit.c
|
2012-04-26 20:11:46 +00:00
|
|
|
*
|
2021-03-16 16:01:04 +01:00
|
|
|
* 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
|
2012-04-26 20:11:46 +00:00
|
|
|
*
|
2021-03-16 16:01:04 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2012-04-26 20:11:46 +00:00
|
|
|
*
|
2021-03-16 16:01:04 +01:00
|
|
|
* 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.
|
2012-04-26 20:11:46 +00:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2014-10-08 14:28:55 -06:00
|
|
|
#include <syslog.h>
|
2012-04-26 20:11:46 +00:00
|
|
|
|
2015-03-31 10:21:31 -06:00
|
|
|
#include <nuttx/board.h>
|
|
|
|
|
2015-12-29 18:07:27 -06:00
|
|
|
#include "pic32mx.h"
|
2015-12-29 15:44:56 -06:00
|
|
|
#include "ubw32.h"
|
2012-04-26 20:11:46 +00:00
|
|
|
|
|
|
|
/****************************************************************************
|
2015-03-21 09:59:52 -06:00
|
|
|
* Pre-processor Definitions
|
2012-04-26 20:11:46 +00:00
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Private Data
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Private Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: nsh_usbdevinitialize
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Initialize SPI-based microSD.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_USBDEV
|
|
|
|
static int nsh_usbdevinitialize(void)
|
|
|
|
{
|
|
|
|
/* The UBW32 has no way to know when the USB is connected. So we will fake
|
|
|
|
* it and tell the USB driver that the USB is connected now.
|
|
|
|
*/
|
|
|
|
|
|
|
|
pic32mx_usbattach();
|
|
|
|
return OK;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
# define nsh_usbdevinitialize() (OK)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
2015-03-31 10:21:31 -06:00
|
|
|
* Name: board_app_initialize
|
2012-04-26 20:11:46 +00:00
|
|
|
*
|
|
|
|
* Description:
|
2016-05-24 10:51:22 -06:00
|
|
|
* Perform application specific initialization. This function is never
|
|
|
|
* called directly from application code, but only indirectly via the
|
|
|
|
* (non-standard) boardctl() interface using the command BOARDIOC_INIT.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* arg - The boardctl() argument is passed to the board_app_initialize()
|
|
|
|
* implementation without modification. The argument has no
|
|
|
|
* meaning to NuttX; the meaning of the argument is a contract
|
2019-08-21 09:32:59 -06:00
|
|
|
* between the board-specific initialization logic and the
|
2020-05-14 11:52:49 -04:00
|
|
|
* matching application logic. The value could be such things as a
|
2016-05-24 10:51:22 -06:00
|
|
|
* mode enumeration value, a set of DIP switch switch settings, a
|
|
|
|
* pointer to configuration data read from a file or serial FLASH,
|
|
|
|
* or whatever you would like to do with it. Every implementation
|
|
|
|
* should accept zero/NULL as a default configuration.
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Zero (OK) is returned on success; a negated errno value is returned on
|
|
|
|
* any failure to indicate the nature of the failure.
|
2012-04-26 20:11:46 +00:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2016-05-24 10:51:22 -06:00
|
|
|
int board_app_initialize(uintptr_t arg)
|
2012-04-26 20:11:46 +00:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
/* Initialize USB device */
|
|
|
|
|
|
|
|
ret = nsh_usbdevinitialize();
|
|
|
|
return ret;
|
|
|
|
}
|