Remove whitespace and and carriage returns
This commit is contained in:
parent
bfc12bf3a7
commit
d1472cbf2a
@ -1,148 +1,148 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/arm/src/armv7-m/itm_syslog.c
|
* arch/arm/src/armv7-m/itm_syslog.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2014 Pierre-noel Bouteville . All rights reserved.
|
* Copyright (C) 2014 Pierre-noel Bouteville . All rights reserved.
|
||||||
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||||
* Authors: Pierre-noel Bouteville <pnb990@gmail.com>
|
* Authors: Pierre-noel Bouteville <pnb990@gmail.com>
|
||||||
* Gregory Nutt <gnutt@nuttx.org>
|
* Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <nuttx/syslog/syslog.h>
|
#include <nuttx/syslog/syslog.h>
|
||||||
|
|
||||||
#include "nvic.h"
|
#include "nvic.h"
|
||||||
#include "up_arch.h"
|
#include "up_arch.h"
|
||||||
#include "itm_syslog.h"
|
#include "itm_syslog.h"
|
||||||
|
|
||||||
#if defined(CONFIG_SYSLOG) || defined(CONFIG_ARMV7M_ITMSYSLOG)
|
#if defined(CONFIG_SYSLOG) || defined(CONFIG_ARMV7M_ITMSYSLOG)
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef CONFIG_ARMV7M_ITMSYSLOG_SWODIV
|
#ifndef CONFIG_ARMV7M_ITMSYSLOG_SWODIV
|
||||||
# define CONFIG_ARMV7M_ITMSYSLOG_SWODIV 15
|
# define CONFIG_ARMV7M_ITMSYSLOG_SWODIV 15
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CONFIG_ARMV7M_ITMSYSLOG_SWODIV < 0
|
#if CONFIG_ARMV7M_ITMSYSLOG_SWODIV < 0
|
||||||
# error CONFIG_ARMV7M_ITMSYSLOG_SWODIV should be at least equal to 1
|
# error CONFIG_ARMV7M_ITMSYSLOG_SWODIV should be at least equal to 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Use Port #0 at default */
|
/* Use Port #0 at default */
|
||||||
|
|
||||||
#ifndef CONFIG_ARMV7M_ITMSYSLOG_PORT
|
#ifndef CONFIG_ARMV7M_ITMSYSLOG_PORT
|
||||||
# define CONFIG_ARMV7M_ITMSYSLOG_PORT 0
|
# define CONFIG_ARMV7M_ITMSYSLOG_PORT 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: itm_syslog_initialize
|
* Name: itm_syslog_initialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Performs ARM-specific initialize for the ITM SYSLOG functions.
|
* Performs ARM-specific initialize for the ITM SYSLOG functions.
|
||||||
* Additional, board specific logic may be required to:
|
* Additional, board specific logic may be required to:
|
||||||
*
|
*
|
||||||
* - Enable/configured serial wire output pins
|
* - Enable/configured serial wire output pins
|
||||||
* - Enable debug clocking.
|
* - Enable debug clocking.
|
||||||
*
|
*
|
||||||
* Those operations must be performed by MCU-specific logic before this
|
* Those operations must be performed by MCU-specific logic before this
|
||||||
* function is called.
|
* function is called.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void itm_syslog_initialize(void)
|
void itm_syslog_initialize(void)
|
||||||
{
|
{
|
||||||
uint32_t regval;
|
uint32_t regval;
|
||||||
|
|
||||||
/* Enable trace in core debug */
|
/* Enable trace in core debug */
|
||||||
|
|
||||||
regval = getreg32(NVIC_DEMCR);
|
regval = getreg32(NVIC_DEMCR);
|
||||||
regval |= NVIC_DEMCR_TRCENA;
|
regval |= NVIC_DEMCR_TRCENA;
|
||||||
putreg32(putreg, NVIC_DEMCR);
|
putreg32(putreg, NVIC_DEMCR);
|
||||||
|
|
||||||
putreg32(0xc5acce55,ITM_LAR);
|
putreg32(0xc5acce55,ITM_LAR);
|
||||||
putreg32(0, ITM_TER);
|
putreg32(0, ITM_TER);
|
||||||
putreg32(0, ITM_TCR);
|
putreg32(0, ITM_TCR);
|
||||||
putreg32(2, TPI_SPPR); /* Pin protocol: 2=> Manchester (USART) */
|
putreg32(2, TPI_SPPR); /* Pin protocol: 2=> Manchester (USART) */
|
||||||
|
|
||||||
/* Default 880kbps */
|
/* Default 880kbps */
|
||||||
|
|
||||||
regval = CONFIG_ARMV7M_ITMSYSLOG_SWODIV - 1;
|
regval = CONFIG_ARMV7M_ITMSYSLOG_SWODIV - 1;
|
||||||
putreg32(regval, TPI_ACPR); /* TRACECLKIN/(ACPR+1) SWO speed */
|
putreg32(regval, TPI_ACPR); /* TRACECLKIN/(ACPR+1) SWO speed */
|
||||||
|
|
||||||
putreg32(0, ITM_TPR);
|
putreg32(0, ITM_TPR);
|
||||||
putreg32(0x400003fe, DWT_CTRL);
|
putreg32(0x400003fe, DWT_CTRL);
|
||||||
putreg32(0x0001000d, ITM_TCR);
|
putreg32(0x0001000d, ITM_TCR);
|
||||||
putreg32(0x00000100, TPI_FFCR);
|
putreg32(0x00000100, TPI_FFCR);
|
||||||
putreg32(0xffffffff, ITM_TER); /* Enable 32 Ports */
|
putreg32(0xffffffff, ITM_TER); /* Enable 32 Ports */
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: syslog_putc
|
* Name: syslog_putc
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This is the low-level system logging interface. The debugging/syslogging
|
* This is the low-level system logging interface. The debugging/syslogging
|
||||||
* interfaces are syslog() and lowsyslog(). The difference is that
|
* interfaces are syslog() and lowsyslog(). The difference is that
|
||||||
* the syslog() internface writes to fd=1 (stdout) whereas lowsyslog() uses
|
* the syslog() internface writes to fd=1 (stdout) whereas lowsyslog() uses
|
||||||
* a lower level interface that works from interrupt handlers. This
|
* a lower level interface that works from interrupt handlers. This
|
||||||
* function is the low-level interface used to implement lowsyslog().
|
* function is the low-level interface used to implement lowsyslog().
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int syslog_putc(int ch);
|
int syslog_putc(int ch);
|
||||||
{
|
{
|
||||||
/* ITM enabled */
|
/* ITM enabled */
|
||||||
|
|
||||||
if ((getreg32(ITM_TCR) & ITM_TCR_ITMENA_Msk) == 0)
|
if ((getreg32(ITM_TCR) & ITM_TCR_ITMENA_Msk) == 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ITM Port "CONFIG_ARMV7M_ITMSYSLOG_PORT" enabled */
|
/* ITM Port "CONFIG_ARMV7M_ITMSYSLOG_PORT" enabled */
|
||||||
|
|
||||||
if (getreg32(ITM_TER) & (1 << CONFIG_ARMV7M_ITMSYSLOG_PORT))
|
if (getreg32(ITM_TER) & (1 << CONFIG_ARMV7M_ITMSYSLOG_PORT))
|
||||||
{
|
{
|
||||||
while (getreg32(ITM_PORT(CONFIG_ARMV7M_ITMSYSLOG_PORT)) == 0);
|
while (getreg32(ITM_PORT(CONFIG_ARMV7M_ITMSYSLOG_PORT)) == 0);
|
||||||
putreg8((uint8_t)ch, ITM_PORT(CONFIG_ARMV7M_ITMSYSLOG_PORT));
|
putreg8((uint8_t)ch, ITM_PORT(CONFIG_ARMV7M_ITMSYSLOG_PORT));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_SYSLOG && CONFIG_ARMV7M_ITMSYSLOG */
|
#endif /* CONFIG_SYSLOG && CONFIG_ARMV7M_ITMSYSLOG */
|
||||||
|
@ -1,66 +1,66 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/arm/src/armv7-m/itm_syslog.h
|
* arch/arm/src/armv7-m/itm_syslog.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2014 Pierre-noel Bouteville . All rights reserved.
|
* Copyright (C) 2014 Pierre-noel Bouteville . All rights reserved.
|
||||||
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
||||||
* Authors: Pierre-noel Bouteville <pnb990@gmail.com>
|
* Authors: Pierre-noel Bouteville <pnb990@gmail.com>
|
||||||
* Gregory Nutt <gnutt@nuttx.org>
|
* Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef __ARCH_ARM_SRC_ARMV7_M_ITM_SYSLOG_H
|
#ifndef __ARCH_ARM_SRC_ARMV7_M_ITM_SYSLOG_H
|
||||||
#define __ARCH_ARM_SRC_ARMV7_M_ITM_SYSLOG_H
|
#define __ARCH_ARM_SRC_ARMV7_M_ITM_SYSLOG_H
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: itm_syslog_initialize
|
* Name: itm_syslog_initialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Performs ARM-specific initialize for the ITM SYSLOG functions.
|
* Performs ARM-specific initialize for the ITM SYSLOG functions.
|
||||||
* Additional, board specific logic may be required to:
|
* Additional, board specific logic may be required to:
|
||||||
*
|
*
|
||||||
* - Enable/configured serial wire output pins
|
* - Enable/configured serial wire output pins
|
||||||
* - Enable debug clocking.
|
* - Enable debug clocking.
|
||||||
*
|
*
|
||||||
* Those operations must be performed by MCU-specific logic before this
|
* Those operations must be performed by MCU-specific logic before this
|
||||||
* function is called.
|
* function is called.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if defined(CONFIG_SYSLOG) || defined(CONFIG_ARMV7M_ITMSYSLOG)
|
#if defined(CONFIG_SYSLOG) || defined(CONFIG_ARMV7M_ITMSYSLOG)
|
||||||
void itm_syslog_initialize(void);
|
void itm_syslog_initialize(void);
|
||||||
#else
|
#else
|
||||||
# define itm_syslog_initialize()
|
# define itm_syslog_initialize()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __ARCH_ARM_SRC_ARMV7_M_ITM_SYSLOG_H */
|
#endif /* __ARCH_ARM_SRC_ARMV7_M_ITM_SYSLOG_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user