S32K1xx boards - Remove unused files (should have been renamed)
This commit is contained in:
parent
7a046358d9
commit
5cc54ba15d
@ -1,94 +0,0 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k118evb/src/s32k118_appinit.c
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 <nuttx/board.h>
|
||||
|
||||
#include "s32k118evb.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef OK
|
||||
# define OK 0
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_app_initialize
|
||||
*
|
||||
* Description:
|
||||
* 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
|
||||
* between the board-specific initialization logic and the
|
||||
* matching application logic. The value cold be such things as a
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_app_initialize(uintptr_t arg)
|
||||
{
|
||||
#ifdef CONFIG_BOARD_LATE_INITIALIZE
|
||||
/* Board initialization already performed by board_late_initialize() */
|
||||
|
||||
return OK;
|
||||
#else
|
||||
/* Perform board-specific initialization */
|
||||
|
||||
return s32k118_bringup();
|
||||
#endif
|
||||
}
|
@ -1,164 +0,0 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k118evb/src/s32k118_autoleds.c
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
/* The S32K118EVB has one RGB LED:
|
||||
*
|
||||
* RedLED PTD16 (FTM0CH1)
|
||||
* GreenLED PTD15 (FTM0CH0)
|
||||
* BlueLED PTE8 (FTM0CH6)
|
||||
*
|
||||
* An output of '1' illuminates the LED.
|
||||
*
|
||||
* If CONFIG_ARCH_LEDs is defined, then NuttX will control the LED on board
|
||||
* the Freedom K66F. The following definitions describe how NuttX controls
|
||||
* the LEDs:
|
||||
*
|
||||
* SYMBOL Meaning LED state
|
||||
* RED GREEN BLUE
|
||||
* ------------------- ----------------------- -----------------
|
||||
* LED_STARTED NuttX has been started OFF OFF OFF
|
||||
* LED_HEAPALLOCATE Heap has been allocated OFF OFF ON
|
||||
* LED_IRQSENABLED Interrupts enabled OFF OFF ON
|
||||
* LED_STACKCREATED Idle stack created OFF ON OFF
|
||||
* LED_INIRQ In an interrupt (no change)
|
||||
* LED_SIGNAL In a signal handler (no change)
|
||||
* LED_ASSERTION An assertion failed (no change)
|
||||
* LED_PANIC The system has crashed FLASH OFF OFF
|
||||
* LED_IDLE K66 is in sleep mode (Optional, not used)
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
#include "s32k1xx_pin.h"
|
||||
#include "s32k118evb.h"
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Summary of all possible settings */
|
||||
|
||||
#define LED_NOCHANGE 0 /* LED_IRQSENABLED, LED_INIRQ, LED_SIGNAL, LED_ASSERTION */
|
||||
#define LED_OFF_OFF_OFF 1 /* LED_STARTED */
|
||||
#define LED_OFF_OFF_ON 2 /* LED_HEAPALLOCATE */
|
||||
#define LED_OFF_ON_OFF 3 /* LED_STACKCREATED */
|
||||
#define LED_ON_OFF_OFF 4 /* LED_PANIC */
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_initialize
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_initialize(void)
|
||||
{
|
||||
/* Configure LED GPIOs for output */
|
||||
|
||||
s32k1xx_pinconfig(GPIO_LED_R);
|
||||
s32k1xx_pinconfig(GPIO_LED_G);
|
||||
s32k1xx_pinconfig(GPIO_LED_B);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_on
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_on(int led)
|
||||
{
|
||||
if (led != LED_NOCHANGE)
|
||||
{
|
||||
bool redon = false;
|
||||
bool greenon = false;
|
||||
bool blueon = false;
|
||||
|
||||
switch (led)
|
||||
{
|
||||
default:
|
||||
case LED_OFF_OFF_OFF:
|
||||
break;
|
||||
|
||||
case LED_OFF_OFF_ON:
|
||||
blueon = true;
|
||||
break;
|
||||
|
||||
case LED_OFF_ON_OFF:
|
||||
greenon = true;
|
||||
break;
|
||||
|
||||
case LED_ON_OFF_OFF:
|
||||
redon = true;
|
||||
break;
|
||||
}
|
||||
|
||||
s32k1xx_gpiowrite(GPIO_LED_R, redon);
|
||||
s32k1xx_gpiowrite(GPIO_LED_G, greenon);
|
||||
s32k1xx_gpiowrite(GPIO_LED_B, blueon);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_off
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_off(int led)
|
||||
{
|
||||
if (led == LED_ON_OFF_OFF)
|
||||
{
|
||||
s32k1xx_gpiowrite(GPIO_LED_R, true);
|
||||
s32k1xx_gpiowrite(GPIO_LED_G, false);
|
||||
s32k1xx_gpiowrite(GPIO_LED_B, false);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ARCH_LEDS */
|
@ -1,101 +0,0 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k118evb/src/s32k118_boot.c
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "s32k118evb.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: s32k1xx_board_initialize
|
||||
*
|
||||
* Description:
|
||||
* All S32K1XX architectures must provide the following entry point. This
|
||||
* entry point is called early in the initialization -- after all memory
|
||||
* has been configured and mapped but before any devices have been
|
||||
* initialized.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void s32k1xx_board_initialize(void)
|
||||
{
|
||||
#ifdef CONFIG_S32K1XX_SPI
|
||||
/* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak
|
||||
* function s32k118_spidev_initialize() has been brought into the link.
|
||||
*/
|
||||
|
||||
s32k118_spidev_initialize();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
/* Configure on-board LEDs if LED support has been selected. */
|
||||
|
||||
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)
|
||||
{
|
||||
/* Perform board-specific initialization */
|
||||
|
||||
s32k118_bringup();
|
||||
}
|
||||
#endif
|
@ -1,109 +0,0 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k118evb/src/s32k118_bringup.c
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 <syslog.h>
|
||||
|
||||
#ifdef CONFIG_BUTTONS
|
||||
# include <nuttx/input/buttons.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USERLED
|
||||
# include <nuttx/leds/userled.h>
|
||||
#endif
|
||||
|
||||
#include "s32k118evb.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: s32k118_bringup
|
||||
*
|
||||
* Description:
|
||||
* Perform architecture-specific initialization
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=y :
|
||||
* Called from board_late_initialize().
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_LIB_BOARDCTL=y :
|
||||
* Called from the NSH library
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int s32k118_bringup(void)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
#ifdef CONFIG_BUTTONS
|
||||
/* Register the BUTTON driver */
|
||||
|
||||
ret = btn_lower_initialize("/dev/buttons");
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: btn_lower_initialize() failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USERLED
|
||||
/* Register the LED driver */
|
||||
|
||||
ret = userled_lower_initialize("/dev/userleds");
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FS_PROCFS
|
||||
/* 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
|
||||
|
||||
return ret;
|
||||
}
|
@ -1,164 +0,0 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k118evb/src/s32k118_buttons.c
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
/* The S32K118EVB supports two buttons:
|
||||
*
|
||||
* SW2 PTD3
|
||||
* SW3 PTD5
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "s32k1xx_pin.h"
|
||||
#include "s32k118evb.h"
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#ifdef CONFIG_ARCH_BUTTONS
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_button_initialize
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_button_initialize(void)
|
||||
{
|
||||
/* Configure the GPIO pins as interrupting inputs. */
|
||||
|
||||
s32k1xx_pinconfig(GPIO_SW2);
|
||||
s32k1xx_pinconfig(GPIO_SW3);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint32_t ret = 0;
|
||||
|
||||
if (s32k1xx_gpioread(GPIO_SW2))
|
||||
{
|
||||
ret |= BUTTON_SW2_BIT;
|
||||
}
|
||||
|
||||
if (s32k1xx_gpioread(GPIO_SW3))
|
||||
{
|
||||
ret |= BUTTON_SW3_BIT;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Button support.
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
* board_button_irq() may be called to register an interrupt handler that will
|
||||
* be called when a button is depressed or released. The ID value is a
|
||||
* button enumeration value that uniquely identifies a button resource. See the
|
||||
* BUTTON_* definitions in board.h for the meaning of enumeration
|
||||
* value.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
uint32_t pinset;
|
||||
int ret;
|
||||
|
||||
/* Map the button id to the GPIO bit set. */
|
||||
|
||||
if (id == BUTTON_SW2)
|
||||
{
|
||||
pinset = GPIO_SW2;
|
||||
}
|
||||
else if (id == BUTTON_SW3)
|
||||
{
|
||||
pinset = GPIO_SW3;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* The button has already been configured as an interrupting input (by
|
||||
* board_button_initialize() above).
|
||||
*
|
||||
* Attach the new button handler.
|
||||
*/
|
||||
|
||||
ret = s32k1xx_pinirqattach(pinset, irqhandler, NULL);
|
||||
if (ret >= 0)
|
||||
{
|
||||
/* Then make sure that interrupts are enabled on the pin */
|
||||
|
||||
s32k1xx_pinirqenable(pinset);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
#endif /* CONFIG_ARCH_BUTTONS */
|
@ -1,206 +0,0 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k118evb/src/s32k118_clockconfig.c
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Most of the settings within this file derives from NXP sample code for
|
||||
* the S32K118 MCUs. That sample code has this licensing information:
|
||||
*
|
||||
* Copyright (c) 2013 - 2015, Freescale Semiconductor, Inc.
|
||||
* Copyright 2016-2018 NXP
|
||||
* All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED 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 NXP OR ITS 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 <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "s32k1xx_clockconfig.h"
|
||||
#include "s32k1xx_start.h"
|
||||
#include "s32k118evb.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/* Each S32K1xx board must provide the following initialized structure. This is
|
||||
* needed to establish the initial board clocking.
|
||||
*/
|
||||
|
||||
const struct clock_configuration_s g_initial_clkconfig =
|
||||
{
|
||||
.scg =
|
||||
{
|
||||
.sirc =
|
||||
{
|
||||
.range = SCG_SIRC_RANGE_HIGH, /* RANGE - High range (8 MHz) */
|
||||
.div1 = SCG_ASYNC_CLOCK_DIV_BY_1, /* SIRCDIV1 */
|
||||
.div2 = SCG_ASYNC_CLOCK_DIV_BY_1, /* SIRCDIV2 */
|
||||
.initialize = true, /* Initialize */
|
||||
.stopmode = false, /* SIRCSTEN */
|
||||
.lowpower = true, /* SIRCLPEN */
|
||||
.locked = false, /* LK */
|
||||
},
|
||||
.firc =
|
||||
{
|
||||
.range = SCG_FIRC_RANGE_48M, /* RANGE */
|
||||
.div1 = SCG_ASYNC_CLOCK_DIV_BY_1, /* FIRCDIV1 */
|
||||
.div2 = SCG_ASYNC_CLOCK_DIV_BY_1, /* FIRCDIV2 */
|
||||
.initialize = true, /* Initialize */
|
||||
.stopmode = false, /* */
|
||||
.lowpower = false, /* */
|
||||
.regulator = true, /* FIRCREGOFF */
|
||||
.locked = false, /* LK */
|
||||
},
|
||||
.sosc =
|
||||
{
|
||||
.mode = SCG_SOSC_MONITOR_DISABLE, /* SOSCCM */
|
||||
.gain = SCG_SOSC_GAIN_LOW, /* HGO */
|
||||
.range = SCG_SOSC_RANGE_HIGH, /* RANGE */
|
||||
.extref = SCG_SOSC_REF_OSC, /* EREFS */
|
||||
.div1 = SCG_ASYNC_CLOCK_DIV_BY_1, /* SOSCDIV1 */
|
||||
.div2 = SCG_ASYNC_CLOCK_DIV_BY_1, /* SOSCDIV2 */
|
||||
.initialize = true, /* Initialize */
|
||||
.stopmode = false, /* */
|
||||
.lowpower = false, /* */
|
||||
.locked = false, /* LK */
|
||||
},
|
||||
.rtc =
|
||||
{
|
||||
.initialize = true, /* Initialize */
|
||||
.clkin = 0 /* RTC_CLKIN */
|
||||
},
|
||||
.clockout =
|
||||
{
|
||||
.source = SCG_CLOCKOUT_SRC_FIRC, /* SCG CLKOUTSEL */
|
||||
.initialize = true, /* Initialize */
|
||||
},
|
||||
.clockmode =
|
||||
{
|
||||
.rccr = /* RCCR - Run Clock Control Register */
|
||||
{
|
||||
.src = SCG_SYSTEM_CLOCK_SRC_FIRC, /* SCS */
|
||||
.divslow = 2, /* DIVSLOW, range 1..16 */
|
||||
.divbus = 2, /* DIVBUS, range 1..16 */
|
||||
.divcore = 1 /* DIVCORE, range 1..16 */
|
||||
},
|
||||
.vccr = /* VCCR - VLPR Clock Control Register */
|
||||
{
|
||||
.src = SCG_SYSTEM_CLOCK_SRC_SIRC, /* SCS */
|
||||
.divslow = 4, /* DIVSLOW, range 1..16 */
|
||||
.divbus = 1, /* DIVBUS, range 1..16 */
|
||||
.divcore = 2 /* DIVCORE, range 1..16 */
|
||||
},
|
||||
/* .altclk */
|
||||
.initialize = true, /* Initialize */
|
||||
},
|
||||
},
|
||||
.sim =
|
||||
{
|
||||
.clockout = /* Clock Out configuration. */
|
||||
{
|
||||
.source = SIM_CLKOUT_SEL_SYSTEM_SCG_CLKOUT, /* CLKOUTSEL */
|
||||
.divider = 1, /* CLKOUTDIV, range 1..8 */
|
||||
.initialize = true, /* Initialize */
|
||||
.enable = false, /* CLKOUTEN */
|
||||
},
|
||||
.lpoclk = /* Low Power Clock configuration. */
|
||||
{
|
||||
.rtc_source = SIM_RTCCLK_SEL_SOSCDIV1_CLK, /* RTCCLKSEL */
|
||||
.lpo_source = SIM_LPO_CLK_SEL_LPO_128K, /* LPOCLKSEL */
|
||||
.initialize = true, /* Initialize */
|
||||
.lpo32k = true, /* LPO32KCLKEN */
|
||||
.lpo1k = true, /* LPO1KCLKEN */
|
||||
},
|
||||
.tclk = /* TCLK CLOCK configuration. */
|
||||
{
|
||||
.tclkfreq[0] = 0, /* TCLK0 */
|
||||
.tclkfreq[1] = 0, /* TCLK1 */
|
||||
.tclkfreq[2] = 0, /* TCLK2 */
|
||||
.initialize = true, /* Initialize */
|
||||
},
|
||||
.platgate = /* Platform Gate Clock configuration. */
|
||||
{
|
||||
.initialize = true, /* Initialize */
|
||||
.mscm = true, /* CGCMSCM */
|
||||
.mpu = true, /* CGCMPU */
|
||||
.dma = true, /* CGCDMA */
|
||||
.erm = true, /* CGCERM */
|
||||
.eim = true, /* CGCEIM */
|
||||
},
|
||||
.traceclk = /* Debug trace Clock Configuration. */
|
||||
{
|
||||
.source = CLOCK_TRACE_SRC_CORE_CLK, /* TRACECLK_SEL */
|
||||
.divider = 1, /* TRACEDIV, range 1..8 */
|
||||
.initialize = true, /* Initialize */
|
||||
.enable = true, /* TRACEDIVEN */
|
||||
.fraction = false, /* TRACEFRAC */
|
||||
},
|
||||
#ifdef CONFIG_S32K1XX_HAVE_QSPI
|
||||
.qspirefclk = /* Quad Spi Internal Reference Clock Gating. */
|
||||
{
|
||||
.refclk = false, /* Qspi reference clock gating */
|
||||
},
|
||||
#endif
|
||||
},
|
||||
.pcc =
|
||||
{
|
||||
.count = NUM_OF_PERIPHERAL_CLOCKS_0, /* Number peripheral clock configurations */
|
||||
.pclks = g_peripheral_clockconfig0 /* Peripheral clock configurations */
|
||||
},
|
||||
.pmc =
|
||||
{
|
||||
.lpoclk = /* Low Power Clock configuration. */
|
||||
{
|
||||
.trim = 0, /* Trimming value for LPO */
|
||||
.initialize = true, /* Initialize */
|
||||
.enable = true, /* Enable/disable LPO */
|
||||
},
|
||||
}
|
||||
};
|
@ -1,152 +0,0 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k118evb/src/s32k118_periphclks.c
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Most of the settings within this file derives from NXP sample code for
|
||||
* the S32K118 MCUs. That sample code has this licensing information:
|
||||
*
|
||||
* Copyright (c) 2013 - 2015, Freescale Semiconductor, Inc.
|
||||
* Copyright 2016-2018 NXP
|
||||
* All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED 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 NXP OR ITS 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 "s32k1xx_periphclocks.h"
|
||||
#include "s32k118evb.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/* Each S32K1xx board must provide the following initialized structure. This is
|
||||
* needed to establish the initial peripheral clocking.
|
||||
*/
|
||||
|
||||
const struct peripheral_clock_config_s g_peripheral_clockconfig0[] =
|
||||
{
|
||||
{
|
||||
.clkname = ADC0_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_SIRC_DIV2,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = DMAMUX0_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_OFF,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = LPTMR0_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_SIRC_DIV2,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = LPUART0_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_SIRC_DIV2,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = LPUART1_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_SIRC_DIV2,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = PORTA_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_OFF,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = PORTB_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_OFF,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = PORTC_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_OFF,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = PORTD_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_OFF,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = PORTE_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_OFF,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
};
|
@ -1,116 +0,0 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k118evb/src/s32k118_userleds.c
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
#include "s32k1xx_pin.h"
|
||||
#include "s32k118evb.h"
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#ifndef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled_initialize
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled_initialize(void)
|
||||
{
|
||||
/* Configure LED GPIOs for output */
|
||||
|
||||
s32k1xx_pinconfig(GPIO_LED_R);
|
||||
s32k1xx_pinconfig(GPIO_LED_G);
|
||||
s32k1xx_pinconfig(GPIO_LED_B);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled(int led, bool ledon)
|
||||
{
|
||||
uint32_t ledcfg;
|
||||
|
||||
if (led == BOARD_LED_R)
|
||||
{
|
||||
ledcfg = GPIO_LED_R;
|
||||
}
|
||||
else if (led == BOARD_LED_G)
|
||||
{
|
||||
ledcfg = GPIO_LED_G;
|
||||
}
|
||||
else if (led == BOARD_LED_B)
|
||||
{
|
||||
ledcfg = GPIO_LED_B;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
s32k1xx_gpiowrite(ledcfg, ledon); /* High illuminates */
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled_all
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled_all(uint8_t ledset)
|
||||
{
|
||||
/* Low illuminates */
|
||||
|
||||
s32k1xx_gpiowrite(GPIO_LED_R, (ledset & BOARD_LED_R_BIT) != 0);
|
||||
s32k1xx_gpiowrite(GPIO_LED_G, (ledset & BOARD_LED_G_BIT) != 0);
|
||||
s32k1xx_gpiowrite(GPIO_LED_B, (ledset & BOARD_LED_B_BIT) != 0);
|
||||
}
|
||||
|
||||
#endif /* !CONFIG_ARCH_LEDS */
|
@ -1,94 +0,0 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k146evb/src/s32k146_appinit.c
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 <nuttx/board.h>
|
||||
|
||||
#include "s32k146evb.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef OK
|
||||
# define OK 0
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_app_initialize
|
||||
*
|
||||
* Description:
|
||||
* 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
|
||||
* between the board-specific initialization logic and the
|
||||
* matching application logic. The value cold be such things as a
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_app_initialize(uintptr_t arg)
|
||||
{
|
||||
#ifdef CONFIG_BOARD_LATE_INITIALIZE
|
||||
/* Board initialization already performed by board_late_initialize() */
|
||||
|
||||
return OK;
|
||||
#else
|
||||
/* Perform board-specific initialization */
|
||||
|
||||
return s32k146_bringup();
|
||||
#endif
|
||||
}
|
@ -1,164 +0,0 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k146evb/src/s32k146_autoleds.c
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
/* The S32K146EVB has one RGB LED:
|
||||
*
|
||||
* RedLED PTD15 (FTM0 CH0)
|
||||
* GreenLED PTD16 (FTM0 CH1)
|
||||
* BlueLED PTD0 (FTM0 CH2)
|
||||
*
|
||||
* An output of '1' illuminates the LED.
|
||||
*
|
||||
* If CONFIG_ARCH_LEDs is defined, then NuttX will control the LED on board
|
||||
* the Freedom K66F. The following definitions describe how NuttX controls
|
||||
* the LEDs:
|
||||
*
|
||||
* SYMBOL Meaning LED state
|
||||
* RED GREEN BLUE
|
||||
* ------------------- ----------------------- -----------------
|
||||
* LED_STARTED NuttX has been started OFF OFF OFF
|
||||
* LED_HEAPALLOCATE Heap has been allocated OFF OFF ON
|
||||
* LED_IRQSENABLED Interrupts enabled OFF OFF ON
|
||||
* LED_STACKCREATED Idle stack created OFF ON OFF
|
||||
* LED_INIRQ In an interrupt (no change)
|
||||
* LED_SIGNAL In a signal handler (no change)
|
||||
* LED_ASSERTION An assertion failed (no change)
|
||||
* LED_PANIC The system has crashed FLASH OFF OFF
|
||||
* LED_IDLE K66 is in sleep mode (Optional, not used)
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
#include "s32k1xx_pin.h"
|
||||
#include "s32k146evb.h"
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Summary of all possible settings */
|
||||
|
||||
#define LED_NOCHANGE 0 /* LED_IRQSENABLED, LED_INIRQ, LED_SIGNAL, LED_ASSERTION */
|
||||
#define LED_OFF_OFF_OFF 1 /* LED_STARTED */
|
||||
#define LED_OFF_OFF_ON 2 /* LED_HEAPALLOCATE */
|
||||
#define LED_OFF_ON_OFF 3 /* LED_STACKCREATED */
|
||||
#define LED_ON_OFF_OFF 4 /* LED_PANIC */
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_initialize
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_initialize(void)
|
||||
{
|
||||
/* Configure LED GPIOs for output */
|
||||
|
||||
s32k1xx_pinconfig(GPIO_LED_R);
|
||||
s32k1xx_pinconfig(GPIO_LED_G);
|
||||
s32k1xx_pinconfig(GPIO_LED_B);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_on
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_on(int led)
|
||||
{
|
||||
if (led != LED_NOCHANGE)
|
||||
{
|
||||
bool redon = false;
|
||||
bool greenon = false;
|
||||
bool blueon = false;
|
||||
|
||||
switch (led)
|
||||
{
|
||||
default:
|
||||
case LED_OFF_OFF_OFF:
|
||||
break;
|
||||
|
||||
case LED_OFF_OFF_ON:
|
||||
blueon = true;
|
||||
break;
|
||||
|
||||
case LED_OFF_ON_OFF:
|
||||
greenon = true;
|
||||
break;
|
||||
|
||||
case LED_ON_OFF_OFF:
|
||||
redon = true;
|
||||
break;
|
||||
}
|
||||
|
||||
s32k1xx_gpiowrite(GPIO_LED_R, redon);
|
||||
s32k1xx_gpiowrite(GPIO_LED_G, greenon);
|
||||
s32k1xx_gpiowrite(GPIO_LED_B, blueon);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_off
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_off(int led)
|
||||
{
|
||||
if (led == LED_ON_OFF_OFF)
|
||||
{
|
||||
s32k1xx_gpiowrite(GPIO_LED_R, true);
|
||||
s32k1xx_gpiowrite(GPIO_LED_G, false);
|
||||
s32k1xx_gpiowrite(GPIO_LED_B, false);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ARCH_LEDS */
|
@ -1,101 +0,0 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k146evb/src/s32k146_boot.c
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "s32k146evb.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: s32k1xx_board_initialize
|
||||
*
|
||||
* Description:
|
||||
* All S32K1XX architectures must provide the following entry point. This
|
||||
* entry point is called early in the initialization -- after all memory
|
||||
* has been configured and mapped but before any devices have been
|
||||
* initialized.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void s32k1xx_board_initialize(void)
|
||||
{
|
||||
#ifdef CONFIG_S32K1XX_SPI
|
||||
/* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak
|
||||
* function s32k146_spidev_initialize() has been brought into the link.
|
||||
*/
|
||||
|
||||
s32k146_spidev_initialize();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
/* Configure on-board LEDs if LED support has been selected. */
|
||||
|
||||
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)
|
||||
{
|
||||
/* Perform board-specific initialization */
|
||||
|
||||
s32k146_bringup();
|
||||
}
|
||||
#endif
|
@ -1,109 +0,0 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k146evb/src/s32k146_bringup.c
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 <syslog.h>
|
||||
|
||||
#ifdef CONFIG_BUTTONS
|
||||
# include <nuttx/input/buttons.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USERLED
|
||||
# include <nuttx/leds/userled.h>
|
||||
#endif
|
||||
|
||||
#include "s32k146evb.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: s32k146_bringup
|
||||
*
|
||||
* Description:
|
||||
* Perform architecture-specific initialization
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=y :
|
||||
* Called from board_late_initialize().
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_LIB_BOARDCTL=y :
|
||||
* Called from the NSH library
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int s32k146_bringup(void)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
#ifdef CONFIG_BUTTONS
|
||||
/* Register the BUTTON driver */
|
||||
|
||||
ret = btn_lower_initialize("/dev/buttons");
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: btn_lower_initialize() failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USERLED
|
||||
/* Register the LED driver */
|
||||
|
||||
ret = userled_lower_initialize("/dev/userleds");
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FS_PROCFS
|
||||
/* 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
|
||||
|
||||
return ret;
|
||||
}
|
@ -1,164 +0,0 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k146evb/src/s32k146_buttons.c
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
/* The S32K146EVB supports two buttons:
|
||||
*
|
||||
* SW2 PTC12
|
||||
* SW3 PTC13
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "s32k1xx_pin.h"
|
||||
#include "s32k146evb.h"
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#ifdef CONFIG_ARCH_BUTTONS
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_button_initialize
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_button_initialize(void)
|
||||
{
|
||||
/* Configure the GPIO pins as interrupting inputs. */
|
||||
|
||||
s32k1xx_pinconfig(GPIO_SW2);
|
||||
s32k1xx_pinconfig(GPIO_SW3);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint32_t ret = 0;
|
||||
|
||||
if (s32k1xx_gpioread(GPIO_SW2))
|
||||
{
|
||||
ret |= BUTTON_SW2_BIT;
|
||||
}
|
||||
|
||||
if (s32k1xx_gpioread(GPIO_SW3))
|
||||
{
|
||||
ret |= BUTTON_SW3_BIT;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Button support.
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
* board_button_irq() may be called to register an interrupt handler that will
|
||||
* be called when a button is depressed or released. The ID value is a
|
||||
* button enumeration value that uniquely identifies a button resource. See the
|
||||
* BUTTON_* definitions in board.h for the meaning of enumeration
|
||||
* value.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
uint32_t pinset;
|
||||
int ret;
|
||||
|
||||
/* Map the button id to the GPIO bit set. */
|
||||
|
||||
if (id == BUTTON_SW2)
|
||||
{
|
||||
pinset = GPIO_SW2;
|
||||
}
|
||||
else if (id == BUTTON_SW3)
|
||||
{
|
||||
pinset = GPIO_SW3;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* The button has already been configured as an interrupting input (by
|
||||
* board_button_initialize() above).
|
||||
*
|
||||
* Attach the new button handler.
|
||||
*/
|
||||
|
||||
ret = s32k1xx_pinirqattach(pinset, irqhandler, NULL);
|
||||
if (ret >= 0)
|
||||
{
|
||||
/* Then make sure that interrupts are enabled on the pin */
|
||||
|
||||
s32k1xx_pinirqenable(pinset);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
#endif /* CONFIG_ARCH_BUTTONS */
|
@ -1,225 +0,0 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k146evb/src/s32k146_clockconfig.c
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Most of the settings within this file derives from NXP sample code for
|
||||
* the S32K146 MCUs. That sample code has this licensing information:
|
||||
*
|
||||
* Copyright (c) 2013 - 2015, Freescale Semiconductor, Inc.
|
||||
* Copyright 2016-2018 NXP
|
||||
* All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED 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 NXP OR ITS 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 <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "s32k1xx_clockconfig.h"
|
||||
#include "s32k1xx_start.h"
|
||||
#include "s32k146evb.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/* Each S32K1xx board must provide the following initialized structure. This is
|
||||
* needed to establish the initial board clocking.
|
||||
*/
|
||||
|
||||
const struct clock_configuration_s g_initial_clkconfig =
|
||||
{
|
||||
.scg =
|
||||
{
|
||||
.sirc =
|
||||
{
|
||||
.range = SCG_SIRC_RANGE_HIGH, /* RANGE - High range (8 MHz) */
|
||||
.div1 = SCG_ASYNC_CLOCK_DIV_BY_1, /* SIRCDIV1 */
|
||||
.div2 = SCG_ASYNC_CLOCK_DIV_BY_1, /* SIRCDIV2 */
|
||||
.initialize = true, /* Initialize */
|
||||
.stopmode = false, /* SIRCSTEN */
|
||||
.lowpower = true, /* SIRCLPEN */
|
||||
.locked = false, /* LK */
|
||||
},
|
||||
.firc =
|
||||
{
|
||||
.range = SCG_FIRC_RANGE_48M, /* RANGE */
|
||||
.div1 = SCG_ASYNC_CLOCK_DIV_BY_1, /* FIRCDIV1 */
|
||||
.div2 = SCG_ASYNC_CLOCK_DIV_BY_1, /* FIRCDIV2 */
|
||||
.initialize = true, /* Initialize */
|
||||
.stopmode = false, /* */
|
||||
.lowpower = false, /* */
|
||||
.regulator = true, /* FIRCREGOFF */
|
||||
.locked = false, /* LK */
|
||||
},
|
||||
.sosc =
|
||||
{
|
||||
.mode = SCG_SOSC_MONITOR_DISABLE, /* SOSCCM */
|
||||
.gain = SCG_SOSC_GAIN_LOW, /* HGO */
|
||||
.range = SCG_SOSC_RANGE_MID, /* RANGE */
|
||||
.extref = SCG_SOSC_REF_OSC, /* EREFS */
|
||||
.div1 = SCG_ASYNC_CLOCK_DIV_BY_1, /* SOSCDIV1 */
|
||||
.div2 = SCG_ASYNC_CLOCK_DIV_BY_1, /* SOSCDIV2 */
|
||||
.initialize = true, /* Initialize */
|
||||
.stopmode = false, /* */
|
||||
.lowpower = false, /* */
|
||||
.locked = false, /* LK */
|
||||
},
|
||||
.spll =
|
||||
{
|
||||
.mode = SCG_SPLL_MONITOR_DISABLE, /* SPLLCM */
|
||||
.div1 = SCG_ASYNC_CLOCK_DIV_BY_1, /* SPLLDIV1 */
|
||||
.div2 = SCG_ASYNC_CLOCK_DIV_BY_1, /* SPLLDIV2 */
|
||||
.prediv = 1, /* PREDIV */
|
||||
.mult = 28, /* MULT */
|
||||
.src = 0, /* SOURCE */
|
||||
.initialize = true, /* Initialize */
|
||||
.stopmode = false, /* */
|
||||
.locked = false, /* LK */
|
||||
},
|
||||
.rtc =
|
||||
{
|
||||
.initialize = true, /* Initialize */
|
||||
.clkin = 0 /* RTC_CLKIN */
|
||||
},
|
||||
.clockout =
|
||||
{
|
||||
.source = SCG_CLOCKOUT_SRC_FIRC, /* SCG CLKOUTSEL */
|
||||
.initialize = true, /* Initialize */
|
||||
},
|
||||
.clockmode =
|
||||
{
|
||||
.rccr = /* RCCR - Run Clock Control Register */
|
||||
{
|
||||
.src = SCG_SYSTEM_CLOCK_SRC_FIRC, /* SCS */
|
||||
.divslow = 2, /* DIVSLOW, range 1..16 */
|
||||
.divbus = 2, /* DIVBUS, range 1..16 */
|
||||
.divcore = 1 /* DIVCORE, range 1..16 */
|
||||
},
|
||||
.vccr = /* VCCR - VLPR Clock Control Register */
|
||||
{
|
||||
.src = SCG_SYSTEM_CLOCK_SRC_SIRC, /* SCS */
|
||||
.divslow = 4, /* DIVSLOW, range 1..16 */
|
||||
.divbus = 1, /* DIVBUS, range 1..16 */
|
||||
.divcore = 2 /* DIVCORE, range 1..16 */
|
||||
},
|
||||
.hccr =
|
||||
{
|
||||
.src = SCG_SYSTEM_CLOCK_SRC_SYS_PLL, /* SCS */
|
||||
.divslow = 4, /* DIVSLOW, range 1..16 */
|
||||
.divbus = 2, /* DIVBUS, range 1..16 */
|
||||
.divcore = 1 /* DIVCORE, range 1..16 */
|
||||
},
|
||||
/* .altclk */
|
||||
.initialize = true, /* Initialize */
|
||||
},
|
||||
},
|
||||
.sim =
|
||||
{
|
||||
.clockout = /* Clock Out configuration. */
|
||||
{
|
||||
.source = SIM_CLKOUT_SEL_SYSTEM_SCG_CLKOUT, /* CLKOUTSEL */
|
||||
.divider = 1, /* CLKOUTDIV, range 1..8 */
|
||||
.initialize = true, /* Initialize */
|
||||
.enable = false, /* CLKOUTEN */
|
||||
},
|
||||
.lpoclk = /* Low Power Clock configuration. */
|
||||
{
|
||||
.rtc_source = SIM_RTCCLK_SEL_SOSCDIV1_CLK, /* RTCCLKSEL */
|
||||
.lpo_source = SIM_LPO_CLK_SEL_LPO_128K, /* LPOCLKSEL */
|
||||
.initialize = true, /* Initialize */
|
||||
.lpo32k = true, /* LPO32KCLKEN */
|
||||
.lpo1k = true, /* LPO1KCLKEN */
|
||||
},
|
||||
.tclk = /* TCLK CLOCK configuration. */
|
||||
{
|
||||
.tclkfreq[0] = 0, /* TCLK0 */
|
||||
.tclkfreq[1] = 0, /* TCLK1 */
|
||||
.tclkfreq[2] = 0, /* TCLK2 */
|
||||
.initialize = true, /* Initialize */
|
||||
},
|
||||
.platgate = /* Platform Gate Clock configuration. */
|
||||
{
|
||||
.initialize = true, /* Initialize */
|
||||
.mscm = true, /* CGCMSCM */
|
||||
.mpu = true, /* CGCMPU */
|
||||
.dma = true, /* CGCDMA */
|
||||
.erm = true, /* CGCERM */
|
||||
.eim = true, /* CGCEIM */
|
||||
},
|
||||
.traceclk = /* Debug trace Clock Configuration. */
|
||||
{
|
||||
.source = CLOCK_TRACE_SRC_CORE_CLK, /* TRACECLK_SEL */
|
||||
.divider = 1, /* TRACEDIV, range 1..8 */
|
||||
.initialize = true, /* Initialize */
|
||||
.enable = true, /* TRACEDIVEN */
|
||||
.fraction = false, /* TRACEFRAC */
|
||||
},
|
||||
#ifdef CONFIG_S32K1XX_HAVE_QSPI
|
||||
.qspirefclk = /* Quad Spi Internal Reference Clock Gating. */
|
||||
{
|
||||
.refclk = false, /* Qspi reference clock gating */
|
||||
},
|
||||
#endif
|
||||
},
|
||||
.pcc =
|
||||
{
|
||||
.count = NUM_OF_PERIPHERAL_CLOCKS_0, /* Number peripheral clock configurations */
|
||||
.pclks = g_peripheral_clockconfig0 /* Peripheral clock configurations */
|
||||
},
|
||||
.pmc =
|
||||
{
|
||||
.lpoclk = /* Low Power Clock configuration. */
|
||||
{
|
||||
.trim = 0, /* Trimming value for LPO */
|
||||
.initialize = true, /* Initialize */
|
||||
.enable = true, /* Enable/disable LPO */
|
||||
},
|
||||
}
|
||||
};
|
@ -1,159 +0,0 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k146evb/src/s32k146_periphclks.c
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Most of the settings within this file derives from NXP sample code for
|
||||
* the S32K146 MCUs. That sample code has this licensing information:
|
||||
*
|
||||
* Copyright (c) 2013 - 2015, Freescale Semiconductor, Inc.
|
||||
* Copyright 2016-2018 NXP
|
||||
* All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED 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 NXP OR ITS 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 "s32k1xx_periphclocks.h"
|
||||
#include "s32k146evb.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/* Each S32K1xx board must provide the following initialized structure. This is
|
||||
* needed to establish the initial peripheral clocking.
|
||||
*/
|
||||
|
||||
const struct peripheral_clock_config_s g_peripheral_clockconfig0[] =
|
||||
{
|
||||
{
|
||||
.clkname = ADC0_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_FIRC,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = ADC1_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_FIRC,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = LPTMR0_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_SIRC,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = LPUART0_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_SIRC,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = LPUART1_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_SIRC,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = LPUART2_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_SIRC,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = PORTA_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_OFF,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = PORTB_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_OFF,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = PORTC_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_OFF,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = PORTD_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_OFF,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = PORTE_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_OFF,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
}
|
||||
};
|
@ -1,116 +0,0 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k146evb/src/s32k146_userleds.c
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
#include "s32k1xx_pin.h"
|
||||
#include "s32k146evb.h"
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#ifndef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled_initialize
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled_initialize(void)
|
||||
{
|
||||
/* Configure LED GPIOs for output */
|
||||
|
||||
s32k1xx_pinconfig(GPIO_LED_R);
|
||||
s32k1xx_pinconfig(GPIO_LED_G);
|
||||
s32k1xx_pinconfig(GPIO_LED_B);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled(int led, bool ledon)
|
||||
{
|
||||
uint32_t ledcfg;
|
||||
|
||||
if (led == BOARD_LED_R)
|
||||
{
|
||||
ledcfg = GPIO_LED_R;
|
||||
}
|
||||
else if (led == BOARD_LED_G)
|
||||
{
|
||||
ledcfg = GPIO_LED_G;
|
||||
}
|
||||
else if (led == BOARD_LED_B)
|
||||
{
|
||||
ledcfg = GPIO_LED_B;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
s32k1xx_gpiowrite(ledcfg, ledon); /* High illuminates */
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled_all
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled_all(uint8_t ledset)
|
||||
{
|
||||
/* Low illuminates */
|
||||
|
||||
s32k1xx_gpiowrite(GPIO_LED_R, (ledset & BOARD_LED_R_BIT) != 0);
|
||||
s32k1xx_gpiowrite(GPIO_LED_G, (ledset & BOARD_LED_G_BIT) != 0);
|
||||
s32k1xx_gpiowrite(GPIO_LED_B, (ledset & BOARD_LED_B_BIT) != 0);
|
||||
}
|
||||
|
||||
#endif /* !CONFIG_ARCH_LEDS */
|
@ -1,94 +0,0 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k148evb/src/s32k148_appinit.c
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 <nuttx/board.h>
|
||||
|
||||
#include "s32k148evb.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef OK
|
||||
# define OK 0
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_app_initialize
|
||||
*
|
||||
* Description:
|
||||
* 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
|
||||
* between the board-specific initialization logic and the
|
||||
* matching application logic. The value cold be such things as a
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_app_initialize(uintptr_t arg)
|
||||
{
|
||||
#ifdef CONFIG_BOARD_LATE_INITIALIZE
|
||||
/* Board initialization already performed by board_late_initialize() */
|
||||
|
||||
return OK;
|
||||
#else
|
||||
/* Perform board-specific initialization */
|
||||
|
||||
return s32k148_bringup();
|
||||
#endif
|
||||
}
|
@ -1,164 +0,0 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k148evb/src/s32k148_autoleds.c
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
/* The S32K148EVB has one RGB LED:
|
||||
*
|
||||
* RedLED PTE21
|
||||
* GreenLED PTE22
|
||||
* BlueLED PTE23
|
||||
*
|
||||
* An output of '1' illuminates the LED.
|
||||
*
|
||||
* If CONFIG_ARCH_LEDs is defined, then NuttX will control the LED on board
|
||||
* the Freedom K66F. The following definitions describe how NuttX controls
|
||||
* the LEDs:
|
||||
*
|
||||
* SYMBOL Meaning LED state
|
||||
* RED GREEN BLUE
|
||||
* ------------------- ----------------------- -----------------
|
||||
* LED_STARTED NuttX has been started OFF OFF OFF
|
||||
* LED_HEAPALLOCATE Heap has been allocated OFF OFF ON
|
||||
* LED_IRQSENABLED Interrupts enabled OFF OFF ON
|
||||
* LED_STACKCREATED Idle stack created OFF ON OFF
|
||||
* LED_INIRQ In an interrupt (no change)
|
||||
* LED_SIGNAL In a signal handler (no change)
|
||||
* LED_ASSERTION An assertion failed (no change)
|
||||
* LED_PANIC The system has crashed FLASH OFF OFF
|
||||
* LED_IDLE K66 is in sleep mode (Optional, not used)
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
#include "s32k1xx_pin.h"
|
||||
#include "s32k148evb.h"
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Summary of all possible settings */
|
||||
|
||||
#define LED_NOCHANGE 0 /* LED_IRQSENABLED, LED_INIRQ, LED_SIGNAL, LED_ASSERTION */
|
||||
#define LED_OFF_OFF_OFF 1 /* LED_STARTED */
|
||||
#define LED_OFF_OFF_ON 2 /* LED_HEAPALLOCATE */
|
||||
#define LED_OFF_ON_OFF 3 /* LED_STACKCREATED */
|
||||
#define LED_ON_OFF_OFF 4 /* LED_PANIC */
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_initialize
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_initialize(void)
|
||||
{
|
||||
/* Configure LED GPIOs for output */
|
||||
|
||||
s32k1xx_pinconfig(GPIO_LED_R);
|
||||
s32k1xx_pinconfig(GPIO_LED_G);
|
||||
s32k1xx_pinconfig(GPIO_LED_B);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_on
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_on(int led)
|
||||
{
|
||||
if (led != LED_NOCHANGE)
|
||||
{
|
||||
bool redon = false;
|
||||
bool greenon = false;
|
||||
bool blueon = false;
|
||||
|
||||
switch (led)
|
||||
{
|
||||
default:
|
||||
case LED_OFF_OFF_OFF:
|
||||
break;
|
||||
|
||||
case LED_OFF_OFF_ON:
|
||||
blueon = true;
|
||||
break;
|
||||
|
||||
case LED_OFF_ON_OFF:
|
||||
greenon = true;
|
||||
break;
|
||||
|
||||
case LED_ON_OFF_OFF:
|
||||
redon = true;
|
||||
break;
|
||||
}
|
||||
|
||||
s32k1xx_gpiowrite(GPIO_LED_R, redon);
|
||||
s32k1xx_gpiowrite(GPIO_LED_G, greenon);
|
||||
s32k1xx_gpiowrite(GPIO_LED_B, blueon);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_off
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_off(int led)
|
||||
{
|
||||
if (led == LED_ON_OFF_OFF)
|
||||
{
|
||||
s32k1xx_gpiowrite(GPIO_LED_R, true);
|
||||
s32k1xx_gpiowrite(GPIO_LED_G, false);
|
||||
s32k1xx_gpiowrite(GPIO_LED_B, false);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ARCH_LEDS */
|
@ -1,101 +0,0 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k148evb/src/s32k148_boot.c
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "s32k148evb.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: s32k1xx_board_initialize
|
||||
*
|
||||
* Description:
|
||||
* All S32K1XX architectures must provide the following entry point. This
|
||||
* entry point is called early in the initialization -- after all memory
|
||||
* has been configured and mapped but before any devices have been
|
||||
* initialized.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void s32k1xx_board_initialize(void)
|
||||
{
|
||||
#ifdef CONFIG_S32K1XX_SPI
|
||||
/* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak
|
||||
* function s32k148_spidev_initialize() has been brought into the link.
|
||||
*/
|
||||
|
||||
s32k148_spidev_initialize();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
/* Configure on-board LEDs if LED support has been selected. */
|
||||
|
||||
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)
|
||||
{
|
||||
/* Perform board-specific initialization */
|
||||
|
||||
s32k148_bringup();
|
||||
}
|
||||
#endif
|
@ -1,109 +0,0 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k148evb/src/s32k148_bringup.c
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 <syslog.h>
|
||||
|
||||
#ifdef CONFIG_BUTTONS
|
||||
# include <nuttx/input/buttons.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USERLED
|
||||
# include <nuttx/leds/userled.h>
|
||||
#endif
|
||||
|
||||
#include "s32k148evb.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: s32k148_bringup
|
||||
*
|
||||
* Description:
|
||||
* Perform architecture-specific initialization
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=y :
|
||||
* Called from board_late_initialize().
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_LIB_BOARDCTL=y :
|
||||
* Called from the NSH library
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int s32k148_bringup(void)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
#ifdef CONFIG_BUTTONS
|
||||
/* Register the BUTTON driver */
|
||||
|
||||
ret = btn_lower_initialize("/dev/buttons");
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: btn_lower_initialize() failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USERLED
|
||||
/* Register the LED driver */
|
||||
|
||||
ret = userled_lower_initialize("/dev/userleds");
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FS_PROCFS
|
||||
/* 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
|
||||
|
||||
return ret;
|
||||
}
|
@ -1,164 +0,0 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k148evb/src/s32k148_buttons.c
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
/* The S32K148EVB supports two buttons:
|
||||
*
|
||||
* SW3 PTC12
|
||||
* SW4 PTC13
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "s32k1xx_pin.h"
|
||||
#include "s32k148evb.h"
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#ifdef CONFIG_ARCH_BUTTONS
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_button_initialize
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_button_initialize(void)
|
||||
{
|
||||
/* Configure the GPIO pins as interrupting inputs. */
|
||||
|
||||
s32k1xx_pinconfig(GPIO_SW3);
|
||||
s32k1xx_pinconfig(GPIO_SW4);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint32_t ret = 0;
|
||||
|
||||
if (s32k1xx_gpioread(GPIO_SW3))
|
||||
{
|
||||
ret |= BUTTON_SW3_BIT;
|
||||
}
|
||||
|
||||
if (s32k1xx_gpioread(GPIO_SW4))
|
||||
{
|
||||
ret |= BUTTON_SW4_BIT;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Button support.
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
* board_button_irq() may be called to register an interrupt handler that will
|
||||
* be called when a button is depressed or released. The ID value is a
|
||||
* button enumeration value that uniquely identifies a button resource. See the
|
||||
* BUTTON_* definitions in board.h for the meaning of enumeration
|
||||
* value.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
uint32_t pinset;
|
||||
int ret;
|
||||
|
||||
/* Map the button id to the GPIO bit set. */
|
||||
|
||||
if (id == BUTTON_SW3)
|
||||
{
|
||||
pinset = GPIO_SW3;
|
||||
}
|
||||
else if (id == BUTTON_SW4)
|
||||
{
|
||||
pinset = GPIO_SW4;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* The button has already been configured as an interrupting input (by
|
||||
* board_button_initialize() above).
|
||||
*
|
||||
* Attach the new button handler.
|
||||
*/
|
||||
|
||||
ret = s32k1xx_pinirqattach(pinset, irqhandler, NULL);
|
||||
if (ret >= 0)
|
||||
{
|
||||
/* Then make sure that interrupts are enabled on the pin */
|
||||
|
||||
s32k1xx_pinirqenable(pinset);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
#endif /* CONFIG_ARCH_BUTTONS */
|
@ -1,225 +0,0 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k148evb/src/s32k148_clockconfig.c
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Most of the settings within this file derives from NXP sample code for
|
||||
* the S32K148 MCUs. That sample code has this licensing information:
|
||||
*
|
||||
* Copyright (c) 2013 - 2015, Freescale Semiconductor, Inc.
|
||||
* Copyright 2016-2018 NXP
|
||||
* All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED 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 NXP OR ITS 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 <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "s32k1xx_clockconfig.h"
|
||||
#include "s32k1xx_start.h"
|
||||
#include "s32k148evb.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/* Each S32K1xx board must provide the following initialized structure. This is
|
||||
* needed to establish the initial board clocking.
|
||||
*/
|
||||
|
||||
const struct clock_configuration_s g_initial_clkconfig =
|
||||
{
|
||||
.scg =
|
||||
{
|
||||
.sirc =
|
||||
{
|
||||
.range = SCG_SIRC_RANGE_HIGH, /* RANGE - High range (8 MHz) */
|
||||
.div1 = SCG_ASYNC_CLOCK_DIV_BY_1, /* SIRCDIV1 */
|
||||
.div2 = SCG_ASYNC_CLOCK_DIV_BY_1, /* SIRCDIV2 */
|
||||
.initialize = true, /* Initialize */
|
||||
.stopmode = false, /* SIRCSTEN */
|
||||
.lowpower = true, /* SIRCLPEN */
|
||||
.locked = false, /* LK */
|
||||
},
|
||||
.firc =
|
||||
{
|
||||
.range = SCG_FIRC_RANGE_48M, /* RANGE */
|
||||
.div1 = SCG_ASYNC_CLOCK_DIV_BY_1, /* FIRCDIV1 */
|
||||
.div2 = SCG_ASYNC_CLOCK_DIV_BY_1, /* FIRCDIV2 */
|
||||
.initialize = true, /* Initialize */
|
||||
.stopmode = false, /* */
|
||||
.lowpower = false, /* */
|
||||
.regulator = true, /* FIRCREGOFF */
|
||||
.locked = false, /* LK */
|
||||
},
|
||||
.sosc =
|
||||
{
|
||||
.mode = SCG_SOSC_MONITOR_DISABLE, /* SOSCCM */
|
||||
.gain = SCG_SOSC_GAIN_LOW, /* HGO */
|
||||
.range = SCG_SOSC_RANGE_MID, /* RANGE */
|
||||
.extref = SCG_SOSC_REF_OSC, /* EREFS */
|
||||
.div1 = SCG_ASYNC_CLOCK_DIV_BY_1, /* SOSCDIV1 */
|
||||
.div2 = SCG_ASYNC_CLOCK_DIV_BY_1, /* SOSCDIV2 */
|
||||
.initialize = true, /* Initialize */
|
||||
.stopmode = false, /* */
|
||||
.lowpower = false, /* */
|
||||
.locked = false, /* LK */
|
||||
},
|
||||
.spll =
|
||||
{
|
||||
.mode = SCG_SPLL_MONITOR_DISABLE, /* SPLLCM */
|
||||
.div1 = SCG_ASYNC_CLOCK_DIV_BY_1, /* SPLLDIV1 */
|
||||
.div2 = SCG_ASYNC_CLOCK_DIV_BY_1, /* SPLLDIV2 */
|
||||
.prediv = 1, /* PREDIV */
|
||||
.mult = 28, /* MULT */
|
||||
.src = 0, /* SOURCE */
|
||||
.initialize = true, /* Initialize */
|
||||
.stopmode = false, /* */
|
||||
.locked = false, /* LK */
|
||||
},
|
||||
.rtc =
|
||||
{
|
||||
.initialize = true, /* Initialize */
|
||||
.clkin = 0 /* RTC_CLKIN */
|
||||
},
|
||||
.clockout =
|
||||
{
|
||||
.source = SCG_CLOCKOUT_SRC_FIRC, /* SCG CLKOUTSEL */
|
||||
.initialize = true, /* Initialize */
|
||||
},
|
||||
.clockmode =
|
||||
{
|
||||
.rccr = /* RCCR - Run Clock Control Register */
|
||||
{
|
||||
.src = SCG_SYSTEM_CLOCK_SRC_FIRC, /* SCS */
|
||||
.divslow = 2, /* DIVSLOW, range 1..16 */
|
||||
.divbus = 2, /* DIVBUS, range 1..16 */
|
||||
.divcore = 1 /* DIVCORE, range 1..16 */
|
||||
},
|
||||
.vccr = /* VCCR - VLPR Clock Control Register */
|
||||
{
|
||||
.src = SCG_SYSTEM_CLOCK_SRC_SIRC, /* SCS */
|
||||
.divslow = 4, /* DIVSLOW, range 1..16 */
|
||||
.divbus = 1, /* DIVBUS, range 1..16 */
|
||||
.divcore = 2 /* DIVCORE, range 1..16 */
|
||||
},
|
||||
.hccr =
|
||||
{
|
||||
.src = SCG_SYSTEM_CLOCK_SRC_SYS_PLL, /* SCS */
|
||||
.divslow = 4, /* DIVSLOW, range 1..16 */
|
||||
.divbus = 2, /* DIVBUS, range 1..16 */
|
||||
.divcore = 1 /* DIVCORE, range 1..16 */
|
||||
},
|
||||
/* .altclk */
|
||||
.initialize = true, /* Initialize */
|
||||
},
|
||||
},
|
||||
.sim =
|
||||
{
|
||||
.clockout = /* Clock Out configuration. */
|
||||
{
|
||||
.source = SIM_CLKOUT_SEL_SYSTEM_SCG_CLKOUT, /* CLKOUTSEL */
|
||||
.divider = 1, /* CLKOUTDIV, range 1..8 */
|
||||
.initialize = true, /* Initialize */
|
||||
.enable = false, /* CLKOUTEN */
|
||||
},
|
||||
.lpoclk = /* Low Power Clock configuration. */
|
||||
{
|
||||
.rtc_source = SIM_RTCCLK_SEL_SOSCDIV1_CLK, /* RTCCLKSEL */
|
||||
.lpo_source = SIM_LPO_CLK_SEL_LPO_128K, /* LPOCLKSEL */
|
||||
.initialize = true, /* Initialize */
|
||||
.lpo32k = true, /* LPO32KCLKEN */
|
||||
.lpo1k = true, /* LPO1KCLKEN */
|
||||
},
|
||||
.tclk = /* TCLK CLOCK configuration. */
|
||||
{
|
||||
.tclkfreq[0] = 0, /* TCLK0 */
|
||||
.tclkfreq[1] = 0, /* TCLK1 */
|
||||
.tclkfreq[2] = 0, /* TCLK2 */
|
||||
.initialize = true, /* Initialize */
|
||||
},
|
||||
.platgate = /* Platform Gate Clock configuration. */
|
||||
{
|
||||
.initialize = true, /* Initialize */
|
||||
.mscm = true, /* CGCMSCM */
|
||||
.mpu = true, /* CGCMPU */
|
||||
.dma = true, /* CGCDMA */
|
||||
.erm = true, /* CGCERM */
|
||||
.eim = true, /* CGCEIM */
|
||||
},
|
||||
.traceclk = /* Debug trace Clock Configuration. */
|
||||
{
|
||||
.source = CLOCK_TRACE_SRC_CORE_CLK, /* TRACECLK_SEL */
|
||||
.divider = 1, /* TRACEDIV, range 1..8 */
|
||||
.initialize = true, /* Initialize */
|
||||
.enable = true, /* TRACEDIVEN */
|
||||
.fraction = false, /* TRACEFRAC */
|
||||
},
|
||||
#ifdef CONFIG_S32K1XX_HAVE_QSPI
|
||||
.qspirefclk = /* Quad Spi Internal Reference Clock Gating. */
|
||||
{
|
||||
.refclk = false, /* Qspi reference clock gating */
|
||||
},
|
||||
#endif
|
||||
},
|
||||
.pcc =
|
||||
{
|
||||
.count = NUM_OF_PERIPHERAL_CLOCKS_0, /* Number peripheral clock configurations */
|
||||
.pclks = g_peripheral_clockconfig0 /* Peripheral clock configurations */
|
||||
},
|
||||
.pmc =
|
||||
{
|
||||
.lpoclk = /* Low Power Clock configuration. */
|
||||
{
|
||||
.trim = 0, /* Trimming value for LPO */
|
||||
.initialize = true, /* Initialize */
|
||||
.enable = true, /* Enable/disable LPO */
|
||||
},
|
||||
}
|
||||
};
|
@ -1,159 +0,0 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k148evb/src/s32k148_periphclks.c
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Most of the settings within this file derives from NXP sample code for
|
||||
* the S32K148 MCUs. That sample code has this licensing information:
|
||||
*
|
||||
* Copyright (c) 2013 - 2015, Freescale Semiconductor, Inc.
|
||||
* Copyright 2016-2018 NXP
|
||||
* All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED 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 NXP OR ITS 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 "s32k1xx_periphclocks.h"
|
||||
#include "s32k148evb.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/* Each S32K1xx board must provide the following initialized structure. This is
|
||||
* needed to establish the initial peripheral clocking.
|
||||
*/
|
||||
|
||||
const struct peripheral_clock_config_s g_peripheral_clockconfig0[] =
|
||||
{
|
||||
{
|
||||
.clkname = ADC0_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_FIRC,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = ADC1_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_FIRC,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = LPTMR0_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_SIRC,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = LPUART0_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_SIRC,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = LPUART1_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_SIRC,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = LPUART2_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_SIRC,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = PORTA_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_OFF,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = PORTB_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_OFF,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = PORTC_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_OFF,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = PORTD_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_OFF,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = PORTE_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_OFF,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
}
|
||||
};
|
@ -1,116 +0,0 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k148evb/src/s32k148_userleds.c
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
#include "s32k1xx_pin.h"
|
||||
#include "s32k148evb.h"
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#ifndef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled_initialize
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled_initialize(void)
|
||||
{
|
||||
/* Configure LED GPIOs for output */
|
||||
|
||||
s32k1xx_pinconfig(GPIO_LED_R);
|
||||
s32k1xx_pinconfig(GPIO_LED_G);
|
||||
s32k1xx_pinconfig(GPIO_LED_B);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled(int led, bool ledon)
|
||||
{
|
||||
uint32_t ledcfg;
|
||||
|
||||
if (led == BOARD_LED_R)
|
||||
{
|
||||
ledcfg = GPIO_LED_R;
|
||||
}
|
||||
else if (led == BOARD_LED_G)
|
||||
{
|
||||
ledcfg = GPIO_LED_G;
|
||||
}
|
||||
else if (led == BOARD_LED_B)
|
||||
{
|
||||
ledcfg = GPIO_LED_B;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
s32k1xx_gpiowrite(ledcfg, ledon); /* High illuminates */
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled_all
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled_all(uint8_t ledset)
|
||||
{
|
||||
/* Low illuminates */
|
||||
|
||||
s32k1xx_gpiowrite(GPIO_LED_R, (ledset & BOARD_LED_R_BIT) != 0);
|
||||
s32k1xx_gpiowrite(GPIO_LED_G, (ledset & BOARD_LED_G_BIT) != 0);
|
||||
s32k1xx_gpiowrite(GPIO_LED_B, (ledset & BOARD_LED_B_BIT) != 0);
|
||||
}
|
||||
|
||||
#endif /* !CONFIG_ARCH_LEDS */
|
Loading…
Reference in New Issue
Block a user