# stmicroelectronics/stm32-lan8742 architecture

> Architecture diagram of the GitHub repository stmicroelectronics/stm32-lan8742, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/stmicroelectronics/stm32-lan8742
- Repository: https://github.com/stmicroelectronics/stm32-lan8742

## Overview

This repository is a small STM32Cube LAN8742 PHY driver, not a complete networking stack. Its workflow is for a board-level caller to register hardware bus callbacks, initialize and identify the PHY, then query or configure link and device features through the driver. The implementation uses the supplied I/O callbacks for register access. The excerpts show initialization, link management, power and loopback controls, and interrupt operations; other public capabilities are represented by the driver node without inferring unsampled behavior.

Main entry points: [`lan8742.c`](https://github.com/stmicroelectronics/stm32-lan8742/blob/main/lan8742.c) (PHY setup), [`lan8742.h`](https://github.com/stmicroelectronics/stm32-lan8742/blob/main/lan8742.h) (Driver contract)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_caller(("Board caller"))
node_contract["Driver contract<br/>[lan8742.h]"]
node_init["PHY setup<br/>[lan8742.c]"]
node_link["Link management<br/>[lan8742.c]"]
node_controls["PHY controls<br/>[lan8742.c]"]
node_interrupts["Interrupt handling<br/>[lan8742.c]"]
node_callbacks["Bus callbacks"]
node_phy{{"LAN8742 PHY"}}

node_caller -.->|"uses API"| node_contract
node_init -->|"implements"| node_contract
node_init -->|"registers and reads"| node_callbacks
node_link -->|"reads registers"| node_callbacks
node_controls -->|"reads and writes"| node_callbacks
node_interrupts -->|"reads and writes"| node_callbacks
node_callbacks -.->|"accesses registers"| node_phy

click node_contract "https://github.com/stmicroelectronics/stm32-lan8742/blob/main/lan8742.h"
click node_init "https://github.com/stmicroelectronics/stm32-lan8742/blob/main/lan8742.c"
click node_link "https://github.com/stmicroelectronics/stm32-lan8742/blob/main/lan8742.c"
click node_controls "https://github.com/stmicroelectronics/stm32-lan8742/blob/main/lan8742.c"
click node_interrupts "https://github.com/stmicroelectronics/stm32-lan8742/blob/main/lan8742.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_caller,node_callbacks,node_phy toneIndigo
class node_contract,node_init,node_link,node_controls,node_interrupts toneTeal
```

## Components

### Other components

- **Board caller**
- [Driver contract](https://github.com/stmicroelectronics/stm32-lan8742/blob/main/lan8742.h): `lan8742.h`
- [PHY setup](https://github.com/stmicroelectronics/stm32-lan8742/blob/main/lan8742.c): `lan8742.c`
- [Link management](https://github.com/stmicroelectronics/stm32-lan8742/blob/main/lan8742.c): `lan8742.c`
- [PHY controls](https://github.com/stmicroelectronics/stm32-lan8742/blob/main/lan8742.c): `lan8742.c`
- [Interrupt handling](https://github.com/stmicroelectronics/stm32-lan8742/blob/main/lan8742.c): `lan8742.c`
- **Bus callbacks**
- **LAN8742 PHY**

## Connections

- Board caller → Driver contract: uses API (evidence: `README.md`)
- PHY setup → Driver contract: implements (evidence: `lan8742.c`)
- PHY setup → Bus callbacks: registers and reads (evidence: `lan8742.c`)
- Link management → Bus callbacks: reads registers (evidence: `lan8742.c`)
- PHY controls → Bus callbacks: reads and writes (evidence: `lan8742.c`)
- Interrupt handling → Bus callbacks: reads and writes (evidence: `lan8742.c`)
- Bus callbacks → LAN8742 PHY: accesses registers
