mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 11:26:12 +08:00
arch/sim: Move the dummy foc driver to drivers/motor/foc
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
@@ -470,11 +470,4 @@ config SIM_UART3_NAME
|
|||||||
default "/dev/ttySIM3"
|
default "/dev/ttySIM3"
|
||||||
depends on SIM_UART_NUMBER >= 4
|
depends on SIM_UART_NUMBER >= 4
|
||||||
|
|
||||||
config SIM_MOTOR_FOC
|
|
||||||
bool "Simulated FOC device"
|
|
||||||
default n
|
|
||||||
depends on MOTOR_FOC
|
|
||||||
---help---
|
|
||||||
Build a simulated lower-half FOC device
|
|
||||||
|
|
||||||
endif # ARCH_SIM
|
endif # ARCH_SIM
|
||||||
|
|||||||
@@ -149,10 +149,6 @@ ifeq ($(CONFIG_ARCH_ROMGETC),y)
|
|||||||
CSRCS += up_romgetc.c
|
CSRCS += up_romgetc.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_SIM_MOTOR_FOC),y)
|
|
||||||
CSRCS += up_foc.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(CONFIG_SIM_NETDEV_TAP),y)
|
ifeq ($(CONFIG_SIM_NETDEV_TAP),y)
|
||||||
CSRCS += up_netdriver.c
|
CSRCS += up_netdriver.c
|
||||||
ifneq ($(CONFIG_WINDOWS_CYGWIN),y)
|
ifneq ($(CONFIG_WINDOWS_CYGWIN),y)
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/power/pm.h>
|
#include <nuttx/power/pm.h>
|
||||||
|
#include <nuttx/motor/foc/foc_dummy.h>
|
||||||
|
|
||||||
#include "up_internal.h"
|
#include "up_internal.h"
|
||||||
|
|
||||||
@@ -112,9 +113,9 @@ void up_idle(void)
|
|||||||
up_timer_update();
|
up_timer_update();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_SIM_MOTOR_FOC
|
#ifdef CONFIG_MOTOR_FOC_DUMMY
|
||||||
/* Update simulated FOC device */
|
/* Update simulated FOC device */
|
||||||
|
|
||||||
sim_foc_update();
|
foc_dummy_update();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,7 +91,6 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
struct tcb_s;
|
struct tcb_s;
|
||||||
struct foc_dev_s;
|
|
||||||
struct ioexpander_dev_s;
|
struct ioexpander_dev_s;
|
||||||
struct i2c_master_s;
|
struct i2c_master_s;
|
||||||
|
|
||||||
@@ -363,12 +362,5 @@ int sim_spi_uninitialize(struct spi_dev_s *dev);
|
|||||||
void up_stack_color(void *stackbase, size_t nbytes);
|
void up_stack_color(void *stackbase, size_t nbytes);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* up_foc.c *****************************************************************/
|
|
||||||
|
|
||||||
#ifdef CONFIG_MOTOR_FOC
|
|
||||||
struct foc_dev_s *sim_foc_initialize(int inst);
|
|
||||||
void sim_foc_update(void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __ASSEMBLY__ */
|
#endif /* __ASSEMBLY__ */
|
||||||
#endif /* __ARCH_SIM_SRC_UP_INTERNAL_H */
|
#endif /* __ARCH_SIM_SRC_UP_INTERNAL_H */
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ CONFIG_LIBC_FLOATINGPOINT=y
|
|||||||
CONFIG_LIBM=y
|
CONFIG_LIBM=y
|
||||||
CONFIG_MOTOR=y
|
CONFIG_MOTOR=y
|
||||||
CONFIG_MOTOR_FOC=y
|
CONFIG_MOTOR_FOC=y
|
||||||
|
CONFIG_MOTOR_FOC_DUMMY=y
|
||||||
CONFIG_MOTOR_FOC_INST=4
|
CONFIG_MOTOR_FOC_INST=4
|
||||||
CONFIG_NSH_ARCHINIT=y
|
CONFIG_NSH_ARCHINIT=y
|
||||||
CONFIG_NSH_ARCHROMFS=y
|
CONFIG_NSH_ARCHROMFS=y
|
||||||
@@ -84,7 +85,6 @@ CONFIG_SCHED_ONEXIT=y
|
|||||||
CONFIG_SCHED_WAITPID=y
|
CONFIG_SCHED_WAITPID=y
|
||||||
CONFIG_SDCLONE_DISABLE=y
|
CONFIG_SDCLONE_DISABLE=y
|
||||||
CONFIG_SIM_M32=y
|
CONFIG_SIM_M32=y
|
||||||
CONFIG_SIM_MOTOR_FOC=y
|
|
||||||
CONFIG_START_MONTH=6
|
CONFIG_START_MONTH=6
|
||||||
CONFIG_START_YEAR=2008
|
CONFIG_START_YEAR=2008
|
||||||
CONFIG_SYSLOG_CONSOLE=y
|
CONFIG_SYSLOG_CONSOLE=y
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y)
|
|||||||
CSRCS += sim_buttons.c
|
CSRCS += sim_buttons.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_SIM_MOTOR_FOC),y)
|
ifeq ($(CONFIG_MOTOR_FOC_DUMMY),y)
|
||||||
CSRCS += sim_foc.c
|
CSRCS += sim_foc.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ int sim_gpio_initialize(void);
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_SIM_MOTOR_FOC
|
#ifdef CONFIG_MOTOR_FOC_DUMMY
|
||||||
int sim_foc_setup(void);
|
int sim_foc_setup(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -425,7 +425,7 @@ int sim_bringup(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_SIM_MOTOR_FOC
|
#ifdef CONFIG_MOTOR_FOC_DUMMY
|
||||||
/* Setup FOC device */
|
/* Setup FOC device */
|
||||||
|
|
||||||
ret = sim_foc_setup();
|
ret = sim_foc_setup();
|
||||||
|
|||||||
@@ -31,9 +31,7 @@
|
|||||||
|
|
||||||
#include <arch/board/board.h>
|
#include <arch/board/board.h>
|
||||||
|
|
||||||
#include <nuttx/motor/foc/foc_lower.h>
|
#include <nuttx/motor/foc/foc_dummy.h>
|
||||||
|
|
||||||
#include "up_internal.h"
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
@@ -76,7 +74,7 @@ int sim_foc_setup(void)
|
|||||||
{
|
{
|
||||||
/* Initialize arch specific FOC lower-half */
|
/* Initialize arch specific FOC lower-half */
|
||||||
|
|
||||||
foc[i] = sim_foc_initialize(i);
|
foc[i] = foc_dummy_initialize(i);
|
||||||
if (foc[i] == NULL)
|
if (foc[i] == NULL)
|
||||||
{
|
{
|
||||||
ret = -errno;
|
ret = -errno;
|
||||||
|
|||||||
@@ -28,4 +28,10 @@ config MOTOR_FOC_TRACE
|
|||||||
---help---
|
---help---
|
||||||
Enables FOC driver trace interface.
|
Enables FOC driver trace interface.
|
||||||
|
|
||||||
|
config MOTOR_FOC_DUMMY
|
||||||
|
bool "Simulated FOC device"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Build a simulated lower-half FOC device
|
||||||
|
|
||||||
endif #MOTOR_FOC
|
endif #MOTOR_FOC
|
||||||
|
|||||||
@@ -22,6 +22,10 @@
|
|||||||
|
|
||||||
CSRCS += foc_dev.c
|
CSRCS += foc_dev.c
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_MOTOR_FOC_DUMMY),y)
|
||||||
|
CSRCS += foc_dummy.c
|
||||||
|
endif
|
||||||
|
|
||||||
# Include FOC driver build support
|
# Include FOC driver build support
|
||||||
|
|
||||||
DEPPATH += --dep-path motor$(DELIM)foc
|
DEPPATH += --dep-path motor$(DELIM)foc
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,52 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* include/nuttx/motor/foc/foc_dummy.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_MOTOR_FOC_FOC_DUMMY_H
|
||||||
|
#define __INCLUDE_NUTTX_MOTOR_FOC_FOC_DUMMY_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/motor/foc/foc.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Function Prototypes
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#define EXTERN extern "C"
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#else
|
||||||
|
#define EXTERN extern
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_MOTOR_FOC_DUMMY
|
||||||
|
FAR struct foc_dev_s *foc_dummy_initialize(int inst);
|
||||||
|
void foc_dummy_update(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef EXTERN
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __INCLUDE_NUTTX_MOTOR_FOC_FOC_DUMMY_H */
|
||||||
Reference in New Issue
Block a user