This is an automated email from the ASF dual-hosted git repository. acassis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 6a9356082082602c09c4a9d6c99ddd1047bd92ec Author: Saravanan Sekar <[email protected]> AuthorDate: Fri Nov 6 21:52:00 2026 +0530 arch/tricore: Add the ASCLIN and port register definitions. The UART driver reaches the ASCLIN and its pins only through the iLLD IfxAsclin and IfxPort. Add the ASCLIN0 base and register offsets of TC3xx and TC4xx, which differ, to hardware/tc3xx_asclin.h and hardware/tc4xx_asclin.h, and the register bits, which are the same, to a new src/common/aurix/tricore_asclin.h, for the AURIX drivers common to both families, as checked against the TC39xB and TC4Dx iLLD headers. Add the port registers and pin modes of the UART pins to hardware/tc3xx_port.h and hardware/tc4xx_port.h. Signed-off-by: Saravanan Sekar <[email protected]> --- arch/tricore/src/common/aurix/tricore_asclin.h | 94 ++++++++++++++++++++++++++ arch/tricore/src/tc3xx/hardware/tc3xx_asclin.h | 48 +++++++++++++ arch/tricore/src/tc3xx/hardware/tc3xx_port.h | 50 ++++++++++++++ arch/tricore/src/tc4xx/hardware/tc4xx_asclin.h | 48 +++++++++++++ arch/tricore/src/tc4xx/hardware/tc4xx_port.h | 40 +++++++++++ 5 files changed, 280 insertions(+) diff --git a/arch/tricore/src/common/aurix/tricore_asclin.h b/arch/tricore/src/common/aurix/tricore_asclin.h new file mode 100644 index 00000000000..c6fa39d8787 --- /dev/null +++ b/arch/tricore/src/common/aurix/tricore_asclin.h @@ -0,0 +1,94 @@ +/**************************************************************************** + * arch/tricore/src/common/aurix/tricore_asclin.h + * + * SPDX-License-Identifier: Apache-2.0 + * + * 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_TRICORE_SRC_COMMON_AURIX_TRICORE_ASCLIN_H +#define __ARCH_TRICORE_SRC_COMMON_AURIX_TRICORE_ASCLIN_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> + +#if defined(CONFIG_ARCH_CHIP_TC3XX) +# include "hardware/tc3xx_asclin.h" +#elif defined(CONFIG_ARCH_CHIP_TC4XX) +# include "hardware/tc4xx_asclin.h" +#endif + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* ASCLIN register bits, the same on TC3xx and TC4xx */ + +#define ASCLIN_CLC_DISR (1 << 0) /* Disable request */ + +#define ASCLIN_IOCR_ALTI_MASK (0x7 << 0) /* RX input select */ +#define ASCLIN_IOCR_LB (1 << 28) /* Loop back */ + +#define ASCLIN_FIFOCON_FLUSH (1 << 0) /* TX and RX FIFOCON */ +#define ASCLIN_FIFOCON_EN (1 << 1) /* TX ENO, RX ENI */ +#define ASCLIN_FIFOCON_FM_MASK (0x3 << 4) /* Interrupt mode */ +#define ASCLIN_FIFOCON_W_SHIFT 6 /* TX INW, RX OUTW */ +#define ASCLIN_FIFOCON_W_MASK (0x3 << ASCLIN_FIFOCON_W_SHIFT) +#define ASCLIN_FIFOCON_INTLEVEL_MASK (0xf << 8) +#define ASCLIN_FIFOCON_FILL_SHIFT 16 +#define ASCLIN_FIFOCON_FILL_MASK (0x1f << ASCLIN_FIFOCON_FILL_SHIFT) + +#define ASCLIN_BITCON_PRESCALER_MASK (0xfff << 0) +#define ASCLIN_BITCON_OVS_SHIFT 16 /* Oversampling - 1 */ +#define ASCLIN_BITCON_OVS_MASK (0xf << ASCLIN_BITCON_OVS_SHIFT) +#define ASCLIN_BITCON_SP_SHIFT 24 /* Sample point */ +#define ASCLIN_BITCON_SP_MASK (0xf << ASCLIN_BITCON_SP_SHIFT) +#define ASCLIN_BITCON_SM (1 << 31) /* Three samples */ + +#define ASCLIN_FRAMECON_IDLE_MASK (0x7 << 6) +#define ASCLIN_FRAMECON_STOP_SHIFT 9 +#define ASCLIN_FRAMECON_STOP_MASK (0x7 << ASCLIN_FRAMECON_STOP_SHIFT) +#define ASCLIN_FRAMECON_MODE_SHIFT 16 +#define ASCLIN_FRAMECON_MODE_MASK (0x3 << ASCLIN_FRAMECON_MODE_SHIFT) +#define ASCLIN_FRAMECON_MODE_INIT (0 << ASCLIN_FRAMECON_MODE_SHIFT) +#define ASCLIN_FRAMECON_MODE_ASC (1 << ASCLIN_FRAMECON_MODE_SHIFT) +#define ASCLIN_FRAMECON_MSB (1 << 28) +#define ASCLIN_FRAMECON_PEN (1 << 30) +#define ASCLIN_FRAMECON_ODD (1 << 31) + +#define ASCLIN_DATCON_DATLEN_MASK (0xf << 0) /* Data length - 1 */ + +#define ASCLIN_BRG_DENOMINATOR_MASK (0xfff << 0) +#define ASCLIN_BRG_NUMERATOR_SHIFT 16 +#define ASCLIN_BRG_NUMERATOR_MASK (0xfff << ASCLIN_BRG_NUMERATOR_SHIFT) + +#define ASCLIN_CSR_CLKSEL_MASK (0x1f << 0) +#define ASCLIN_CSR_CLKSEL_NONE 0 +#define ASCLIN_CSR_CLKSEL_FAST 2 /* fASCLINF */ +#define ASCLIN_CSR_CON (1 << 31) /* Clock on */ + +#define ASCLIN_FLAGS_PE (1 << 16) /* Parity error */ +#define ASCLIN_FLAGS_FE (1 << 18) /* Frame error */ +#define ASCLIN_FLAGS_RFO (1 << 26) /* RX FIFO overflow */ +#define ASCLIN_FLAGS_RFU (1 << 27) /* RX FIFO underflow */ +#define ASCLIN_FLAGS_RFL (1 << 28) /* RX FIFO level */ +#define ASCLIN_FLAGS_TFO (1 << 30) /* TX FIFO overflow */ + +#endif /* __ARCH_TRICORE_SRC_COMMON_AURIX_TRICORE_ASCLIN_H */ diff --git a/arch/tricore/src/tc3xx/hardware/tc3xx_asclin.h b/arch/tricore/src/tc3xx/hardware/tc3xx_asclin.h new file mode 100644 index 00000000000..4a47432179c --- /dev/null +++ b/arch/tricore/src/tc3xx/hardware/tc3xx_asclin.h @@ -0,0 +1,48 @@ +/**************************************************************************** + * arch/tricore/src/tc3xx/hardware/tc3xx_asclin.h + * + * SPDX-License-Identifier: Apache-2.0 + * + * 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_TRICORE_SRC_TC3XX_HARDWARE_TC3XX_ASCLIN_H +#define __ARCH_TRICORE_SRC_TC3XX_HARDWARE_TC3XX_ASCLIN_H + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* ASCLIN0 (UART) and its register offsets */ + +#define TRICORE_ASCLIN0_BASE 0xf0000600 + +#define ASCLIN_CLC_OFFSET 0x000 +#define ASCLIN_IOCR_OFFSET 0x004 +#define ASCLIN_TXFIFOCON_OFFSET 0x00c +#define ASCLIN_RXFIFOCON_OFFSET 0x010 +#define ASCLIN_BITCON_OFFSET 0x014 +#define ASCLIN_FRAMECON_OFFSET 0x018 +#define ASCLIN_DATCON_OFFSET 0x01c +#define ASCLIN_BRG_OFFSET 0x020 +#define ASCLIN_FLAGSCLEAR_OFFSET 0x03c +#define ASCLIN_FLAGSENABLE_OFFSET 0x040 +#define ASCLIN_TXDATA_OFFSET 0x044 +#define ASCLIN_RXDATA_OFFSET 0x048 +#define ASCLIN_CSR_OFFSET 0x04c + +#endif /* __ARCH_TRICORE_SRC_TC3XX_HARDWARE_TC3XX_ASCLIN_H */ diff --git a/arch/tricore/src/tc3xx/hardware/tc3xx_port.h b/arch/tricore/src/tc3xx/hardware/tc3xx_port.h new file mode 100644 index 00000000000..767e269620f --- /dev/null +++ b/arch/tricore/src/tc3xx/hardware/tc3xx_port.h @@ -0,0 +1,50 @@ +/**************************************************************************** + * arch/tricore/src/tc3xx/hardware/tc3xx_port.h + * + * SPDX-License-Identifier: Apache-2.0 + * + * 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_TRICORE_SRC_TC3XX_HARDWARE_TC3XX_PORT_H +#define __ARCH_TRICORE_SRC_TC3XX_HARDWARE_TC3XX_PORT_H + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Port registers: one IOCR byte per pin, one PDR nibble per pin. PDR is + * protected by the CPU ENDINIT. + */ + +#define TC3XX_PORT_IOCR0_OFFSET 0x10 +#define TC3XX_PORT_PDR0_OFFSET 0x40 + +#define TC3XX_PORT_IOCR(p, n) ((p) + TC3XX_PORT_IOCR0_OFFSET + \ + ((n) / 4) * 4) +#define TC3XX_PORT_IOCR_SHIFT(n) (((n) & 3) * 8) +#define TC3XX_PORT_IOCR_MASK 0xff +#define TC3XX_PORT_PDR(p, n) ((p) + TC3XX_PORT_PDR0_OFFSET + \ + ((n) / 8) * 4) +#define TC3XX_PORT_PDR_SHIFT(n) (((n) & 7) * 4) +#define TC3XX_PORT_PDR_MASK 0xf + +#define TC3XX_PORT_IN_PULLUP 0x10 /* Input with pull-up */ +#define TC3XX_PORT_OUT_ALT2 0x90 /* Push-pull, alternate 2 */ +#define TC3XX_PORT_PAD_SPEED1 0 /* CMOS automotive speed 1 */ + +#endif /* __ARCH_TRICORE_SRC_TC3XX_HARDWARE_TC3XX_PORT_H */ diff --git a/arch/tricore/src/tc4xx/hardware/tc4xx_asclin.h b/arch/tricore/src/tc4xx/hardware/tc4xx_asclin.h new file mode 100644 index 00000000000..9449fd91ac4 --- /dev/null +++ b/arch/tricore/src/tc4xx/hardware/tc4xx_asclin.h @@ -0,0 +1,48 @@ +/**************************************************************************** + * arch/tricore/src/tc4xx/hardware/tc4xx_asclin.h + * + * SPDX-License-Identifier: Apache-2.0 + * + * 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_TRICORE_SRC_TC4XX_HARDWARE_TC4XX_ASCLIN_H +#define __ARCH_TRICORE_SRC_TC4XX_HARDWARE_TC4XX_ASCLIN_H + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* ASCLIN0 (UART) and its register offsets */ + +#define TRICORE_ASCLIN0_BASE 0xf46c0000 + +#define ASCLIN_CLC_OFFSET 0x000 +#define ASCLIN_IOCR_OFFSET 0x100 +#define ASCLIN_TXFIFOCON_OFFSET 0x104 +#define ASCLIN_RXFIFOCON_OFFSET 0x108 +#define ASCLIN_BITCON_OFFSET 0x10c +#define ASCLIN_FRAMECON_OFFSET 0x110 +#define ASCLIN_DATCON_OFFSET 0x114 +#define ASCLIN_BRG_OFFSET 0x118 +#define ASCLIN_FLAGSCLEAR_OFFSET 0x134 +#define ASCLIN_FLAGSENABLE_OFFSET 0x138 +#define ASCLIN_CSR_OFFSET 0x13c +#define ASCLIN_TXDATA_OFFSET 0x140 +#define ASCLIN_RXDATA_OFFSET 0x160 + +#endif /* __ARCH_TRICORE_SRC_TC4XX_HARDWARE_TC4XX_ASCLIN_H */ diff --git a/arch/tricore/src/tc4xx/hardware/tc4xx_port.h b/arch/tricore/src/tc4xx/hardware/tc4xx_port.h new file mode 100644 index 00000000000..63e37ceb663 --- /dev/null +++ b/arch/tricore/src/tc4xx/hardware/tc4xx_port.h @@ -0,0 +1,40 @@ +/**************************************************************************** + * arch/tricore/src/tc4xx/hardware/tc4xx_port.h + * + * SPDX-License-Identifier: Apache-2.0 + * + * 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_TRICORE_SRC_TC4XX_HARDWARE_TC4XX_PORT_H +#define __ARCH_TRICORE_SRC_TC4XX_HARDWARE_TC4XX_PORT_H + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Port pad configuration: one DRVCFG register per pin */ + +#define TC4XX_PORT_DRVCFG(p, n) ((p) + 0x304 + (n) * 0x10) +#define TC4XX_PORT_DRVCFG_MODE_MASK 0xf3 /* MODE, OD and DIR */ +#define TC4XX_PORT_DRVCFG_PAD_MASK 0x7700 /* PD and PL */ + +#define TC4XX_PORT_IN_PULLUP 0x20 /* Input with pull-up */ +#define TC4XX_PORT_OUT_ALT2 0x21 /* Push-pull, alternate 2 */ +#define TC4XX_PORT_PAD_SPEED1 0 /* CMOS automotive speed 1 */ + +#endif /* __ARCH_TRICORE_SRC_TC4XX_HARDWARE_TC4XX_PORT_H */
