Add SAMA5D2 MCAN support

Update arch/arm/src/sama5/sam_mcan.c

Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>

Update arch/arm/src/sama5/sam_mcan.c

Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>

Update arch/arm/src/sama5/sam_mcan.c

Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>

Update arch/arm/src/sama5/sam_mcan.c

Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>

Update arch/arm/src/sama5/sam_mcan.c

Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>

Update arch/arm/src/sama5/sam_mcan.c

Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
TimJTi
2022-12-20 16:52:22 +00:00
committed by Alan Carvalho de Assis
parent 18beaaa480
commit e1b8c02f96
6 changed files with 5842 additions and 10 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -170,6 +170,14 @@ CHIP_CSRCS += sam_can.c
endif
endif
ifeq ($(CONFIG_SAMA5_MCAN0),y)
CHIP_CSRCS += sam_mcan.c
else
ifeq ($(CONFIG_SAMA5_MCAN1),y)
CHIP_CSRCS += sam_mcan.c
endif
endif
ifeq ($(CONFIG_SAMA5_TWI0),y)
CHIP_CSRCS += sam_twi.c
else

View File

@@ -140,7 +140,7 @@
/* 0x0004b000-0x0004bfff: Reserved */
# define SAM_SFC_OFFSET 0x0004c000 /* 0x0004c000-0x0004ffff: SFC */
# define SAM_I2SC0_OFFSET 0x00050000 /* 0x00050000-0x00053fff: I2SC0 */
# define SAM_CAN0_OFFSET 0x00054000 /* 0x00054000-0x00057fff: CAN0 */
# define SAM_MCAN0_OFFSET 0x00054000 /* 0x00054000-0x00057fff: MCAN0 */
# define SAM_SYSC_PSECTION 0xf8048000 /* 0xf8048000-0xf8048fff: System Controller */
# define SAM_SYSC_PADDR 0xf8048000 /* 0xf8048000-0xf8048fff: System Controller */
@@ -165,7 +165,7 @@
# define SAM_TDES_OFFSET 0x00044000 /* 0x00044000-0x00047fff: TDES */
# define SAM_CLASSD_OFFSET 0x00048000 /* 0x00048000-0x0004bfff: Class D */
# define SAM_I2SC1_OFFSET 0x0004c000 /* 0x0004c000-0x0004ffff: I2SC1 */
# define SAM_CAN1_OFFSET 0x00050000 /* 0x00050000-0x00053fff: CAN1 */
# define SAM_MCAN1_OFFSET 0x00050000 /* 0x00050000-0x00053fff: MCAN1 */
# define SAM_UTMI_OFFSET 0x00054000 /* 0x00054000-0x00057fff: UTMI */
/* 0x00058000-0x0005bfff: Reserved */
# define SAM_SFRBU_OFFSET 0x0005c000 /* 0x0005c000-0x0005ffff: SFRBU */
@@ -492,7 +492,7 @@
#define SAM_ACC_VBASE (SAM_PERIPHB_VSECTION+SAM_ACC_OFFSET)
#define SAM_SFC_VBASE (SAM_PERIPHB_VSECTION+SAM_SFC_OFFSET)
#define SAM_I2SC0_VBASE (SAM_PERIPHB_VSECTION+SAM_I2SC0_OFFSET)
#define SAM_CAN0_VBASE (SAM_PERIPHB_VSECTION+SAM_CAN0_OFFSET)
#define SAM_MCAN0_VBASE (SAM_PERIPHB_VSECTION+SAM_MCAN0_OFFSET)
#define SAM_SPI1_VBASE (SAM_PERIPHC_VSECTION+SAM_SPI1_OFFSET)
#define SAM_SSC1_VBASE (SAM_PERIPHC_VSECTION+SAM_SSC1_OFFSET)
@@ -512,7 +512,7 @@
#define SAM_TDES_VBASE (SAM_PERIPHC_VSECTION+SAM_TDES_OFFSET)
#define SAM_CLASSD_VBASE (SAM_PERIPHC_VSECTION+SAM_CLASSD_OFFSET)
#define SAM_I2SC1_VBASE (SAM_PERIPHC_VSECTION+SAM_I2SC1_OFFSET)
#define SAM_CAN1_VBASE (SAM_PERIPHC_VSECTION+SAM_CAN1_OFFSET)
#define SAM_MCAN1_VBASE (SAM_PERIPHC_VSECTION+SAM_MCAN1_OFFSET)
#define SAM_UTMI_VBASE (SAM_PERIPHC_VSECTION+SAM_UTMI_OFFSET)
#define SAM_SFRBU_VBASE (SAM_PERIPHC_VSECTION+SAM_SFRBU_OFFSET)
#define SAM_CHIPID_VBASE (SAM_PERIPHC_VSECTION+SAM_CHIPID_OFFSET)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,95 @@
/****************************************************************************
* arch/arm/src/sama5/sam_mcan.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_SAMA5_SAM_MCAN_H
#define __ARCH_ARM_SRC_SAMA5_SAM_MCAN_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include "chip.h"
#include "hardware/sam_mcan.h"
#include <nuttx/can/can.h>
#if defined(CONFIG_CAN) && (defined(CONFIG_SAMA5_MCAN0) || \
defined(CONFIG_SAMA5_MCAN1))
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Port numbers for use with sam_mcan_initialize() */
#define MCAN0 0
#define MCAN1 1
/****************************************************************************
* Public Types
****************************************************************************/
#ifndef __ASSEMBLY__
/****************************************************************************
* Public Data
****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Public Functions Prototypes
****************************************************************************/
/****************************************************************************
* Name: sam_mcan_initialize
*
* Description:
* Initialize the selected MCAN port
*
* Input Parameters:
* port - Port number (for hardware that has multiple CAN interfaces),
* 0=MCAN0, 1=NCAN1
*
* Returned Value:
* Valid CAN device structure reference on success; a NULL on failure
*
****************************************************************************/
struct can_dev_s;
struct can_dev_s *sam_mcan_initialize(int port);
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* CONFIG_CAN && (CONFIG_SAMA5_MCAN0 || CONFIG_SAMA5_MCAN1) */
#endif /* __ARCH_ARM_SRC_SAMA5_SAM_MCAN_H */