2014-12-10 22:56:49 +01:00
|
|
|
/****************************************************************************
|
2019-08-16 15:40:59 +02:00
|
|
|
* boards/arm/tiva/tm4c123g-launchpad/src/tm4c_bringup.c
|
2014-12-10 22:56:49 +01:00
|
|
|
*
|
2021-03-17 18:14:12 +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
|
2014-12-10 22:56:49 +01:00
|
|
|
*
|
2021-03-17 18:14:12 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2014-12-10 22:56:49 +01:00
|
|
|
*
|
2021-03-17 18:14:12 +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.
|
2014-12-10 22:56:49 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
|
|
|
#include <syslog.h>
|
|
|
|
|
|
|
|
#include "tm4c123g-launchpad.h"
|
|
|
|
|
|
|
|
/****************************************************************************
|
2015-04-08 17:15:17 +02:00
|
|
|
* Pre-processor Definitions
|
2014-12-10 22:56:49 +01:00
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: tm4c_bringup
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Bring up board features
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
int tm4c_bringup(void)
|
|
|
|
{
|
2015-03-23 17:05:50 +01:00
|
|
|
int ret = OK;
|
2014-12-10 22:56:49 +01:00
|
|
|
|
2016-12-06 00:06:08 +01:00
|
|
|
#ifdef CONFIG_TIVA_ADC
|
|
|
|
/* Initialize ADC and register the ADC driver. */
|
|
|
|
|
|
|
|
ret = tm4c_adc_setup();
|
|
|
|
if (ret < 0)
|
|
|
|
{
|
|
|
|
syslog(LOG_ERR, "ERROR: tm4c_adc_setup failed: %d\n", ret);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-02-05 20:51:32 +01:00
|
|
|
#ifdef HAVE_AT24
|
2014-12-10 22:56:49 +01:00
|
|
|
/* Initialize the AT24 driver */
|
|
|
|
|
|
|
|
ret = tm4c_at24_automount(AT24_MINOR);
|
|
|
|
if (ret < 0)
|
|
|
|
{
|
|
|
|
syslog(LOG_ERR, "ERROR: tm4c_at24_automount failed: %d\n", ret);
|
2015-02-05 20:51:32 +01:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
#endif /* HAVE_AT24 */
|
|
|
|
|
|
|
|
#ifdef CONFIG_TIVA_TIMER
|
|
|
|
/* Initialize the timer driver */
|
|
|
|
|
2016-05-23 16:26:46 +02:00
|
|
|
ret = tiva_timer_configure();
|
2015-02-05 20:51:32 +01:00
|
|
|
if (ret < 0)
|
|
|
|
{
|
2016-05-23 16:26:46 +02:00
|
|
|
syslog(LOG_ERR, "ERROR: tiva_timer_configure failed: %d\n", ret);
|
2015-02-05 20:51:32 +01:00
|
|
|
return ret;
|
2014-12-10 22:56:49 +01:00
|
|
|
}
|
2015-02-05 20:51:32 +01:00
|
|
|
#endif /* CONFIG_TIVA_TIMER */
|
2014-12-10 22:56:49 +01:00
|
|
|
|
2019-10-05 22:18:08 +02:00
|
|
|
#ifdef CONFIG_CAN_MCP2515
|
|
|
|
/* Configure and initialize the MCP2515 CAN device */
|
|
|
|
|
|
|
|
ret = tiva_mcp2515initialize("/dev/can0");
|
|
|
|
if (ret < 0)
|
|
|
|
{
|
|
|
|
syslog(LOG_ERR, "ERROR: stm32_mcp2515initialize() failed: %d\n", ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-12-06 00:06:08 +01:00
|
|
|
UNUSED(ret);
|
2015-03-23 17:05:50 +01:00
|
|
|
return ret;
|
2014-12-10 22:56:49 +01:00
|
|
|
}
|