mirror of
https://github.com/apache/nuttx.git
synced 2026-05-23 23:28:29 +08:00
coresight: add coresight_core
Signed-off-by: liaoao <liaoao@xiaomi.com>
This commit is contained in:
@@ -2284,6 +2284,39 @@ config DEBUG_RPMSG_INFO
|
||||
Enable RPMSG driver informational output to SYSLOG.
|
||||
|
||||
endif # DEBUG_RPMSG
|
||||
|
||||
config DEBUG_CORESIGHT
|
||||
bool "Coresight Debug Features"
|
||||
default n
|
||||
depends on CORESIGHT
|
||||
---help---
|
||||
Enable coresight debug features.
|
||||
|
||||
if DEBUG_CORESIGHT
|
||||
|
||||
config DEBUG_CORESIGHT_ERROR
|
||||
bool "Coresight Error Output"
|
||||
default n
|
||||
depends on DEBUG_ERROR
|
||||
---help---
|
||||
Enable coresight driver error output to SYSLOG.
|
||||
|
||||
config DEBUG_CORESIGHT_WARN
|
||||
bool "Coresight Warnings Output"
|
||||
default n
|
||||
depends on DEBUG_WARN
|
||||
---help---
|
||||
Enable coresight warning output to SYSLOG.
|
||||
|
||||
config DEBUG_CORESIGHT_INFO
|
||||
bool "Coresight Informational Output"
|
||||
default n
|
||||
depends on DEBUG_INFO
|
||||
---help---
|
||||
Enable coresight driver informational output to SYSLOG.
|
||||
|
||||
endif # DEBUG_CORESIGHT
|
||||
|
||||
endif # DEBUG_FEATURES
|
||||
|
||||
config ARCH_HAVE_STACKCHECK
|
||||
|
||||
@@ -60,3 +60,4 @@ source "drivers/dma/Kconfig"
|
||||
source "drivers/devicetree/Kconfig"
|
||||
source "drivers/reset/Kconfig"
|
||||
source "drivers/pci/Kconfig"
|
||||
source "drivers/coresight/Kconfig"
|
||||
|
||||
@@ -78,6 +78,7 @@ include segger/Make.defs
|
||||
include usrsock/Make.defs
|
||||
include reset/Make.defs
|
||||
include pci/Make.defs
|
||||
include coresight/Make.defs
|
||||
|
||||
ifeq ($(CONFIG_SPECIFIC_DRIVERS),y)
|
||||
-include platform/Make.defs
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
# ##############################################################################
|
||||
# drivers/coresight/CMakeLists.txt
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
|
||||
# license agreements. See the NOTICE file distributed with this work for
|
||||
# additional information regarding copyright ownership. The ASF licenses this
|
||||
# file to you under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy of
|
||||
# the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations under
|
||||
# the License.
|
||||
#
|
||||
# ##############################################################################
|
||||
|
||||
if(CONFIG_CORESIGHT)
|
||||
set(SRCS coresight_core.c)
|
||||
|
||||
target_sources(drivers PRIVATE ${SRCS})
|
||||
endif()
|
||||
@@ -0,0 +1,18 @@
|
||||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
||||
|
||||
menuconfig CORESIGHT
|
||||
bool "Coresight Driver Support"
|
||||
default n
|
||||
---help---
|
||||
Coresight drivers support.
|
||||
|
||||
if CORESIGHT
|
||||
|
||||
config CORESIGHT_MAX_OUTPORT_NUM
|
||||
int "Max outport number of coresight device"
|
||||
default 2
|
||||
|
||||
endif # CORESIGHT
|
||||
@@ -0,0 +1,31 @@
|
||||
############################################################################
|
||||
# drivers/coresight/Make.defs
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership. The
|
||||
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance with the
|
||||
# License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
# Include coresight driver build surrport
|
||||
|
||||
ifeq ($(CONFIG_CORESIGHT),y)
|
||||
|
||||
CSRCS += coresight_core.c
|
||||
|
||||
DEPPATH += --dep-path coresight
|
||||
VPATH += :coresight
|
||||
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)drivers$(DELIM)coresight
|
||||
|
||||
endif # CONFIG_CORESIGHT
|
||||
File diff suppressed because it is too large
Load Diff
@@ -956,6 +956,24 @@
|
||||
# define rpmsginfo _none
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_CORESIGHT_ERROR
|
||||
# define cserr _err
|
||||
#else
|
||||
# define cserr _none
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_CORESIGHT_WARN
|
||||
# define cswarn _warn
|
||||
#else
|
||||
# define cswarn _none
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_CORESIGHT_INFO
|
||||
# define csinfo _info
|
||||
#else
|
||||
# define csinfo _none
|
||||
#endif
|
||||
|
||||
/* Buffer dumping macros do not depend on varargs */
|
||||
|
||||
#ifdef CONFIG_DEBUG_ERROR
|
||||
|
||||
@@ -0,0 +1,241 @@
|
||||
/****************************************************************************
|
||||
* include/nuttx/coresight/coresight.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __INCLUDE_NUTTX_CORESIGHT_CORESIGHT_H
|
||||
#define __INCLUDE_NUTTX_CORESIGHT_CORESIGHT_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <nuttx/list.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
enum coresight_dev_type_e
|
||||
{
|
||||
CORESIGHT_DEV_TYPE_SOURCE,
|
||||
CORESIGHT_DEV_TYPE_LINK,
|
||||
CORESIGHT_DEV_TYPE_SINK,
|
||||
CORESIGHT_DEV_TYPE_MAX
|
||||
};
|
||||
|
||||
enum coresight_dev_subtype_source_e
|
||||
{
|
||||
CORESIGHT_DEV_SUBTYPE_SOURCE_PROC, /* ETM */
|
||||
CORESIGHT_DEV_SUBTYPE_SOURCE_SOFTWARE, /* STM */
|
||||
};
|
||||
|
||||
enum coresight_dev_subtype_link_e
|
||||
{
|
||||
CORESIGHT_DEV_SUBTYPE_LINK_MERG, /* Funnel */
|
||||
CORESIGHT_DEV_SUBTYPE_LINK_SPLIT, /* Replocator */
|
||||
CORESIGHT_DEV_SUBTYPE_LINK_FIFO, /* TMC ETR */
|
||||
};
|
||||
|
||||
enum coresight_dev_subtype_sink_e
|
||||
{
|
||||
CORESIGHT_DEV_SUBTYPE_SINK_PORT, /* TPIU */
|
||||
CORESIGHT_DEV_SUBTYPE_SINK_BUFFER, /* ETB */
|
||||
};
|
||||
|
||||
/* This structure is used to unify different subtype of devices. */
|
||||
|
||||
union coresight_dev_subtype_u
|
||||
{
|
||||
enum coresight_dev_subtype_source_e source_subtype;
|
||||
enum coresight_dev_subtype_link_e link_subtype;
|
||||
enum coresight_dev_subtype_sink_e sink_subtype;
|
||||
};
|
||||
|
||||
struct coresight_dev_s;
|
||||
|
||||
struct coresight_sink_ops_s
|
||||
{
|
||||
int (*enable)(FAR struct coresight_dev_s *csdev);
|
||||
void (*disable)(FAR struct coresight_dev_s *csdev);
|
||||
};
|
||||
|
||||
struct coresight_link_ops_s
|
||||
{
|
||||
int (*enable)(FAR struct coresight_dev_s *csdev, int iport, int oport);
|
||||
void (*disable)(FAR struct coresight_dev_s *csdev, int iport, int oport);
|
||||
};
|
||||
|
||||
struct coresight_source_ops_s
|
||||
{
|
||||
int (*enable)(FAR struct coresight_dev_s *csdev);
|
||||
void (*disable)(FAR struct coresight_dev_s *csdev);
|
||||
};
|
||||
|
||||
/* This structure is used to unify different operations of devices. */
|
||||
|
||||
struct coresight_ops_s
|
||||
{
|
||||
union
|
||||
{
|
||||
FAR const struct coresight_sink_ops_s *sink_ops;
|
||||
FAR const struct coresight_link_ops_s *link_ops;
|
||||
FAR const struct coresight_source_ops_s *source_ops;
|
||||
};
|
||||
};
|
||||
|
||||
struct coresight_portdesc_s
|
||||
{
|
||||
/* Coresight device's name this port connects to. */
|
||||
|
||||
FAR const char *remote;
|
||||
|
||||
/* Port connects to. */
|
||||
|
||||
int port;
|
||||
};
|
||||
|
||||
struct coresight_desc_s
|
||||
{
|
||||
FAR const char *name;
|
||||
uintptr_t addr;
|
||||
enum coresight_dev_type_e type;
|
||||
union coresight_dev_subtype_u subtype;
|
||||
|
||||
/* Description of outports of current device. */
|
||||
|
||||
int outport_num;
|
||||
struct coresight_portdesc_s outports[CONFIG_CORESIGHT_MAX_OUTPORT_NUM];
|
||||
};
|
||||
|
||||
/* Use to build the trace path. */
|
||||
|
||||
struct coresight_connect_s
|
||||
{
|
||||
int srcport;
|
||||
int destport;
|
||||
|
||||
/* Used to find the dest device when build the trace path. */
|
||||
|
||||
FAR const char *destname;
|
||||
FAR struct coresight_dev_s *srcdev;
|
||||
FAR struct coresight_dev_s *destdev;
|
||||
};
|
||||
|
||||
struct coresight_dev_s
|
||||
{
|
||||
FAR const char *name;
|
||||
|
||||
/* Memory-mapped base address of current coresight device. */
|
||||
|
||||
uintptr_t addr;
|
||||
enum coresight_dev_type_e type;
|
||||
union coresight_dev_subtype_u subtype;
|
||||
FAR const struct coresight_ops_s *ops;
|
||||
|
||||
/* Used to connect all the coresight device register to coresight bus. */
|
||||
|
||||
struct list_node node;
|
||||
|
||||
/* Used in source coresight device as trace path's list head. */
|
||||
|
||||
struct list_node path;
|
||||
|
||||
/* Out port number current coresight device have. */
|
||||
|
||||
int outport_num;
|
||||
|
||||
/* Pointer to an array of connections, array size is equal
|
||||
* to the outport number.
|
||||
*/
|
||||
|
||||
FAR struct coresight_connect_s *outconns;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: coresight_register
|
||||
*
|
||||
* Description:
|
||||
* Register a coresight device to the coresight bus.
|
||||
*
|
||||
* Input Parameters:
|
||||
* csdev - Pointer to the coresight device that needs to be registered.
|
||||
* desc - Pointer to the attribute description of this coresight device.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero on success; a negative value on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int coresight_register(FAR struct coresight_dev_s *csdev,
|
||||
FAR const struct coresight_desc_s *desc);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: coresight_unregister
|
||||
*
|
||||
* Description:
|
||||
* Unregister a coresight device from coresight bus.
|
||||
*
|
||||
* Input Parameters:
|
||||
* csdev - Pointer to the coresight device that needs to be unregistered.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void coresight_unregister(FAR struct coresight_dev_s *csdev);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: coresight_enable
|
||||
*
|
||||
* Description:
|
||||
* Enable trace start from srcdev to destdev.
|
||||
*
|
||||
* Input Parameters:
|
||||
* srcdev - Source device that generates trace data.
|
||||
* destdev - Sink device that finally accepts the trace data.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero on success; a negative value on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int coresight_enable(FAR struct coresight_dev_s *srcdev,
|
||||
FAR struct coresight_dev_s *destdev);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: coresight_disable
|
||||
*
|
||||
* Description:
|
||||
* Disable the trace start from srcdev to destdev.
|
||||
*
|
||||
* Input Parameters:
|
||||
* srcdev - Source device that generates trace data.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void coresight_disable(FAR struct coresight_dev_s *srcdev);
|
||||
|
||||
#endif /* __INCLUDE_NUTTX_CORESIGHT_CORESIGHT_H */
|
||||
Reference in New Issue
Block a user