drivers/net: Add base driver for the OA-T6 protocol MAC-PHYs

Add base driver common for OPEN Alliance 10BASE-T1x MAC-PHY Serial Interface (OA-TC6)
protocol SPI MAC-PHYs.

Signed-off-by: michal matias <mich4l.matias@gmail.com>
This commit is contained in:
michal matias
2025-08-25 01:19:00 +02:00
committed by Xiang Xiao
parent f44766611a
commit 95b3b65778
9 changed files with 2868 additions and 0 deletions
+2
View File
@@ -109,4 +109,6 @@ if(CONFIG_NET)
endif()
target_sources(drivers PRIVATE ${SRCS})
nuttx_add_subdirectory()
endif()
+2
View File
@@ -851,4 +851,6 @@ config NET_IGC_INT_INTERVAL
endif # NET_IGC
source "drivers/net/oa_tc6/Kconfig"
endif # NETDEVICES
+2
View File
@@ -111,6 +111,8 @@ ifeq ($(CONFIG_DRIVERS_WIFI_SIM),y)
CSRCS += wifi_sim.c
endif
include net/oa_tc6/Make.defs
# Include network build support
DEPPATH += --dep-path net
+27
View File
@@ -0,0 +1,27 @@
# ##############################################################################
# drivers/net/oa_tc6/CMakeLists.txt
#
# 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.
#
# ##############################################################################
if(CONFIG_NET_OA_TC6)
set(SRCS oa_tc6.c)
target_sources(drivers PRIVATE ${SRCS})
endif()
+11
View File
@@ -0,0 +1,11 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
menuconfig NET_OA_TC6
bool "OPEN Alliance 10BASE-T1x MAC-PHYs"
default n
depends on NETDEVICES
---help---
Enable support for OPEN Alliance protocol SPI MAC-PHYs.
+31
View File
@@ -0,0 +1,31 @@
############################################################################
# drivers/net/oa_tc6/Make.defs
#
# 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.
#
############################################################################
ifeq ($(CONFIG_NET_OA_TC6),y)
CSRCS += oa_tc6.c
DEPPATH += --dep-path net/oa_tc6
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)drivers$(DELIM)net$(DELIM)oa_tc6
VPATH += :net/oa_tc6
endif
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+102
View File
@@ -0,0 +1,102 @@
/****************************************************************************
* include/nuttx/net/oa_tc6.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 __INCLUDE_NUTTX_NET_OA_TC6_H
#define __INCLUDE_NUTTX_NET_OA_TC6_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <stdint.h>
#include <stdbool.h>
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Public Types
****************************************************************************/
/* A reference to a structure of this type must be passed to the OA-TC6
* driver when the driver is instantiated. This structure provides
* information about the configuration of the MAC-PHY.
*
* Memory for this structure is provided by the caller. It is not copied by
* the driver and is presumed to persist while the driver is active.
*/
struct oa_tc6_config_s
{
uint32_t id; /* Field used to guide SPI chip select
* and interrupt pin selection */
uint32_t frequency; /* SPI frequency */
uint8_t chunk_payload_size; /* 64, 32, 16, or 8 */
bool rx_cut_through; /* Enable / disable RX cut through mode */
/* Attach handler to the falling edge of the interrupt pin. */
CODE int (*attach)(FAR const struct oa_tc6_config_s *config,
xcpt_t handler, FAR void *arg);
/* Enable / disable the interrupt. */
CODE int (*enable)(FAR const struct oa_tc6_config_s *config, bool enable);
};
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: oa_tc6_initialize
*
* Description:
* Read the PHYID of the MAC-PHY device and initialize the matching
* driver.
*
* Input Parameters:
* spi - pointer to the initialized SPI interface
* config - pointer to the initialized MAC-PHY configuration
*
* Returned Value:
* On success OK is returned, otherwise negated errno is returned.
*
****************************************************************************/
struct spi_dev_s; /* forward declaration, see nuttx/spi/spi.h */
int oa_tc6_initialize(FAR struct spi_dev_s *spi,
FAR const struct oa_tc6_config_s *config);
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif /* __INCLUDE_NUTTX_NET_OA_TC6_H */