pkarashchenko commented on code in PR #11002: URL: https://github.com/apache/nuttx/pull/11002#discussion_r1369804188
########## arch/arm/src/samv7/sam_lin_sock.c: ########## @@ -0,0 +1,1305 @@ +/**************************************************************************** + * arch/arm/src/samv7/sam_lin_sock.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 <inttypes.h> +#include <stdio.h> +#include <sys/types.h> +#include <stdint.h> +#include <stdbool.h> +#include <assert.h> +#include <errno.h> +#include <debug.h> + +#include <arch/board/board.h> +#include <nuttx/irq.h> +#include <nuttx/arch.h> + +#include <nuttx/wqueue.h> +#include <nuttx/can.h> +#include <nuttx/net/netdev.h> +#include <nuttx/net/can.h> +#include <netpacket/can.h> + +#include "arm_internal.h" +#include "chip.h" +#include "hardware/sam_pinmap.h" +#include "hardware/sam_uart.h" +#include "sam_periphclks.h" +#include "sam_lin.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Delays *******************************************************************/ + +#ifndef CONFIG_DEBUG_CAN_INFO +# undef CONFIG_SAMV7_LIN_REGDEBUG Review Comment: Will take a look here ########## arch/arm/src/samv7/sam_lin.h: ########## @@ -0,0 +1,81 @@ +/**************************************************************************** + * arch/arm/src/samv7/sam_lin.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_ARM_SRC_SAMV7_SAM_LIN_H +#define __ARCH_ARM_SRC_SAMV7_SAM_LIN_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ +#ifdef CONFIG_SAMV7_LIN_SOCKET + +/**************************************************************************** + * Name: sam_linsockinitialize + * + * Description: + * Initialize the selected LIN port as CAN socket interface + * + * Input Parameters: + * Port number (for hardware that has multiple LIN interfaces) + * + * Returned Value: + * OK on success; Negated errno on failure. + * + ****************************************************************************/ + +int sam_linsockinitialize(int port); Review Comment: This is a draft version and I plan to move `arm_netinitialize` to a separate file `sam_netinit.c` that will be used in case of `CONFIG_NETDEV_LATEINIT` and will handle both Ethernet, CAN and LIN socket initialization. Currently it is more like a copy paste, but really not sure if `sam_linsockinitialize` should depend on `CONFIG_NETDEV_LATEINIT`. I will need to explore how it is done in other similar places -- 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]
