xiaoxiang781216 commented on code in PR #18951: URL: https://github.com/apache/nuttx/pull/18951#discussion_r3409731866
########## arch/sim/src/sim/sim_gpiochip.h: ########## @@ -44,17 +44,24 @@ * Type Definitions ****************************************************************************/ +/* FT2232H could redefine it, so avoid collision */ + +#ifndef CONFIG_SIM_GPIOCHIP_FT2232H struct host_gpiochip_dev Review Comment: move to nuttx/arch/sim/src/sim/posix/sim_linux_gpiochip.c directly ########## arch/sim/src/sim/sim_ft2232h_ioexpander.h: ########## @@ -0,0 +1,57 @@ +/**************************************************************************** + * arch/sim/src/sim/sim_ft2232h_ioexpander.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 __ARCH_SIM_SRC_SIM_FT2232H_IOEXPANDER_H +#define __ARCH_SIM_SRC_SIM_FT2232H_IOEXPANDER_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#ifdef __SIM__ +# include "config.h" +#endif + +#include <stdint.h> +#include <ftdi.h> + +#include "sim_gpiochip.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define FT2232H_GPIO_LINE_BASE 20 Review Comment: move to sim_ft2232h.c ########## arch/sim/Kconfig: ########## @@ -716,16 +716,37 @@ config SIM_GPIOCHIP_LINUX interface. To achieve a SPI port on Linux host, it is recommended to use a USB<>GPIO device such as CH341A/B. +config SIM_GPIOCHIP_FT2232H + bool "Support FT2232H USB bridge to control external devices" + depends on ARCH_SIM Review Comment: remove ########## arch/sim/src/sim/posix/sim_ft2232h.c: ########## @@ -0,0 +1,307 @@ +/**************************************************************************** + * arch/sim/src/sim/posix/sim_ft2232h.c Review Comment: change to sim_ftdi_gpiochip.c ########## arch/sim/src/sim/sim_ft2232h_ioexpander.c: ########## @@ -0,0 +1,336 @@ +/**************************************************************************** + * arch/sim/src/sim/sim_ft2232h_ioexpander.c Review Comment: why not reuse nuttx/arch/sim/src/sim/sim_gpiochip.c ########## arch/sim/Kconfig: ########## @@ -716,16 +716,37 @@ config SIM_GPIOCHIP_LINUX interface. To achieve a SPI port on Linux host, it is recommended to use a USB<>GPIO device such as CH341A/B. +config SIM_GPIOCHIP_FT2232H Review Comment: should we name SIM_GPIOCHIP_FTDI since this driver should work for other similar devices -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
