patacongo commented on a change in pull request #1728: URL: https://github.com/apache/incubator-nuttx/pull/1728#discussion_r484444631
########## File path: boards/arm/sama5/giant-board/src/sam_bringup.c ########## @@ -0,0 +1,401 @@ +/**************************************************************************** + * boards/arm/sama5/giant-board/src/sam_bringup.c + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> + +#include <sys/mount.h> +#include <stdlib.h> +#include <syslog.h> +#include <debug.h> +#include <string.h> + +#include <nuttx/irq.h> +#include <nuttx/kthread.h> +#include <nuttx/usb/usbdev.h> +#include <nuttx/usb/usbhost.h> +#include <nuttx/usb/usbdev_trace.h> + +#include "giant-board.h" + +#ifdef CONFIG_CDCACM +# include <nuttx/usb/cdcacm.h> +#endif + +#ifdef CONFIG_NET_CDCECM +# include <nuttx/usb/cdcecm.h> +# include <net/if.h> +#endif + +#ifdef CONFIG_USBMONITOR +# include <nuttx/usb/usbmonitor.h> +#endif + +#ifdef CONFIG_RNDIS +# include <nuttx/usb/rndis.h> +#endif + +#ifdef CONFIG_MMCSD +# include <nuttx/mmcsd.h> +# include "sam_sdmmc.h" +#endif + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define NSECTORS(n) \ + (((n)+CONFIG_GIANTBOARD_ROMFS_ROMDISK_SECTSIZE-1) / \ + CONFIG_GIANTBOARD_ROMFS_ROMDISK_SECTSIZE) + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: sam_i2c_register + * + * Description: + * Register one I2C drivers for the I2C tool. + * + ****************************************************************************/ + +#ifdef HAVE_I2CTOOL +static void sam_i2c_register(int bus) +{ + FAR struct i2c_master_s *i2c; + int ret; + + i2c = sam_i2cbus_initialize(bus); + if (i2c == NULL) + { + _err("ERROR: Failed to get I2C%d interface\n", bus); Review comment: ```suggestion i2cerr("ERROR: Failed to get I2C%d interface\n", bus); ``` Please do not use _err(). That is intended only for internal use within debug.h. Please change to ########## File path: boards/arm/sama5/giant-board/src/sam_bringup.c ########## @@ -0,0 +1,401 @@ +/**************************************************************************** + * boards/arm/sama5/giant-board/src/sam_bringup.c + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> + +#include <sys/mount.h> +#include <stdlib.h> +#include <syslog.h> +#include <debug.h> +#include <string.h> + +#include <nuttx/irq.h> +#include <nuttx/kthread.h> +#include <nuttx/usb/usbdev.h> +#include <nuttx/usb/usbhost.h> +#include <nuttx/usb/usbdev_trace.h> + +#include "giant-board.h" + +#ifdef CONFIG_CDCACM +# include <nuttx/usb/cdcacm.h> +#endif + +#ifdef CONFIG_NET_CDCECM +# include <nuttx/usb/cdcecm.h> +# include <net/if.h> +#endif + +#ifdef CONFIG_USBMONITOR +# include <nuttx/usb/usbmonitor.h> +#endif + +#ifdef CONFIG_RNDIS +# include <nuttx/usb/rndis.h> +#endif + +#ifdef CONFIG_MMCSD +# include <nuttx/mmcsd.h> +# include "sam_sdmmc.h" +#endif + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define NSECTORS(n) \ + (((n)+CONFIG_GIANTBOARD_ROMFS_ROMDISK_SECTSIZE-1) / \ + CONFIG_GIANTBOARD_ROMFS_ROMDISK_SECTSIZE) + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: sam_i2c_register + * + * Description: + * Register one I2C drivers for the I2C tool. + * + ****************************************************************************/ + +#ifdef HAVE_I2CTOOL +static void sam_i2c_register(int bus) +{ + FAR struct i2c_master_s *i2c; + int ret; + + i2c = sam_i2cbus_initialize(bus); + if (i2c == NULL) + { + _err("ERROR: Failed to get I2C%d interface\n", bus); + } + else + { + ret = i2c_register(i2c, bus); + if (ret < 0) + { + _err("ERROR: Failed to register I2C%d driver: %d\n", bus, ret); Review comment: ```suggestion i2cerr("ERROR: Failed to register I2C%d driver: %d\n", bus, ret); ``` ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected]
