Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Driver development guide #343

Open
wants to merge 9 commits into
base: freedom-metal-next
Choose a base branch
from
Open
2,537 changes: 2,537 additions & 0 deletions Doxyfile

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions doc/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM sphinxdoc/sphinx

RUN apt-get update \
&& apt install -y doxygen graphviz \
&& apt-get autoremove \
&& apt-get clean

RUN python3 -m pip install breathe pydot

WORKDIR /
54 changes: 54 additions & 0 deletions doc/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Copyright (c) 2019 SiFive Inc.
#
# Documentation Build

export RELEASE_TAG ?= unreleased

.PHONY: all
all: html pdf

.PHONY: clean
clean: clean-pdf clean-html clean-xml

##########################
# Build PDF Documentation
##########################

.PHONY: pdf
pdf: latex/FreedomMetal.pdf

latex/FreedomMetal.pdf: latex/FreedomMetal.tex
$(MAKE) -C latex

latex/FreedomMetal.tex: xml/index.xml sphinx/*
sphinx-build -b latex sphinx latex

.PHONY: clean-pdf
clean-pdf:
rm -rf latex

###########################
# Build HTML Documentation
###########################

.PHONY: html
html: html/index.html

# Use Sphinx to build HTML from Doxygen XML
html/index.html: xml/index.xml sphinx/*
sphinx-build -b html sphinx html

.PHONY: clean-html
clean-html:
rm -rf html/* html/.buildinfo html/.doctrees

##########################
# Build XML Documentation
##########################

xml/index.xml: ../metal/*.h
cd .. && doxygen

.PHONY: clean-xml
clean-xml:
rm -rf xml
55 changes: 55 additions & 0 deletions doc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Documentation Generation

## Requirements

You'll need the following software:
- [Doxygen](http://www.doxygen.nl/index.html)
- [Sphinx](http://www.sphinx-doc.org/en/master/index.html)
- LaTeX (For building a PDF)

### Ubuntu

You can install the required software on Ubuntu with the following:

```
sudo apt install doxygen python3-sphinx python3-breathe graphviz python3-pydot
sudo apt install texlive-full latexmk
```

The second line can be omitted if you don't intend to build the PDF.

### MacOS

You can install the required software on MacOS with the following:

```
brew install doxygen sphinx-doc graphviz
brew cask install mactex
```

The second line can be omitted if you don't intend to build the PDF.

## Building the Docs

You can generate both the HTML and PDF documentation with
```
make
```

Or only the HTML or PDF docs using

```
make html
```
or

```
make pdf
```

You can clean the build files and outputs with

```
make clean
```

1 change: 1 addition & 0 deletions doc/doc-old/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
xml/
17 changes: 17 additions & 0 deletions doc/sphinx/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.. _api-reference-label:

*************
API Reference
*************

.. _apireference:

The API documentation aims to provide a complete reference to the
Freedom Metal API. The API documentation is split into sections
corresponding to each feature.

.. toctree::
:glob:

apiref/*

6 changes: 6 additions & 0 deletions doc/sphinx/apiref/atomic.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Atomics
=======

.. doxygenfile:: metal/atomic.h
:project: metal

6 changes: 6 additions & 0 deletions doc/sphinx/apiref/button.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Buttons
=======

.. doxygenfile:: metal/button.h
:project: metal

6 changes: 6 additions & 0 deletions doc/sphinx/apiref/cache.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Caches
======

.. doxygenfile:: metal/cache.h
:project: metal

26 changes: 26 additions & 0 deletions doc/sphinx/apiref/clock.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Clocks
======

.. doxygenfile:: metal/clock.h
:project: metal

Abstract Clock Devices
----------------------

.. doxygenfile:: metal/drivers/fixed_clock.h
:project: metal

.. doxygenfile:: metal/drivers/fixed_factor_clock.h
:project: metal

SiFive Clock Devices
--------------------

.. doxygenfile:: metal/drivers/sifive_fe310_g000_hfrosc.h
:project: metal

.. doxygenfile:: metal/drivers/sifive_fe310_g000_hfxosc.h
:project: metal

.. doxygenfile:: metal/drivers/sifive_fe310_g000_lfrosc.h
:project:metal
6 changes: 6 additions & 0 deletions doc/sphinx/apiref/cpu.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CPU
===

.. doxygenfile:: metal/cpu.h
:project: metal

6 changes: 6 additions & 0 deletions doc/sphinx/apiref/csr.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CSR
===

.. doxygenfile:: metal/csr.h
:project: metal

5 changes: 5 additions & 0 deletions doc/sphinx/apiref/exception.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Exception Handlers
==================

.. doxygenfile:: metal/exception.h
:project: metal
5 changes: 5 additions & 0 deletions doc/sphinx/apiref/gpio.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
GPIO
====

.. doxygenfile:: metal/gpio.h
:project: metal
6 changes: 6 additions & 0 deletions doc/sphinx/apiref/hpm.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Hardware Performance Monitors
=============================

.. doxygenfile:: metal/hpm.h
:project: metal

6 changes: 6 additions & 0 deletions doc/sphinx/apiref/i2c.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
I2C
===

.. doxygenfile:: metal/i2c.h
:project: metal

7 changes: 7 additions & 0 deletions doc/sphinx/apiref/init.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Constructors
============

.. doxygenfile:: metal/init.h
:project: metal
:no-link:

11 changes: 11 additions & 0 deletions doc/sphinx/apiref/interrupt.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Interrupts
==========

.. doxygenfile:: metal/interrupt.h
:project: metal

.. doxygenfile:: metal/drivers/riscv_cpu_intc.h
:project: metal

.. doxygenfile:: metal/drivers/riscv_plic0.h
:project: metal
5 changes: 5 additions & 0 deletions doc/sphinx/apiref/io.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Input/Output declarations
=========================

.. doxygenfile:: metal/io.h
:project: metal
7 changes: 7 additions & 0 deletions doc/sphinx/apiref/itim.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ITIM
====

.. doxygenfile:: metal/itim.h
:project: metal
:no-link:

6 changes: 6 additions & 0 deletions doc/sphinx/apiref/led.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
LEDs
====

.. doxygenfile:: metal/led.h
:project: metal

6 changes: 6 additions & 0 deletions doc/sphinx/apiref/lock.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Locks
=======

.. doxygenfile:: metal/lock.h
:project: metal

6 changes: 6 additions & 0 deletions doc/sphinx/apiref/pmp.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
PMPs
====

.. doxygenfile:: metal/pmp.h
:project: metal

5 changes: 5 additions & 0 deletions doc/sphinx/apiref/privilege.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Privilege Modes
===============

.. doxygenfile:: metal/privilege.h
:project: metal
6 changes: 6 additions & 0 deletions doc/sphinx/apiref/pwm.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
PWM
===

.. doxygenfile:: metal/pwm.h
:project: metal

5 changes: 5 additions & 0 deletions doc/sphinx/apiref/riscv.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
RISC-V Processor Definitions
============================

.. doxygenfile:: metal/riscv.h
:project: metal
6 changes: 6 additions & 0 deletions doc/sphinx/apiref/rtc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Real-Time Clock
===============

.. doxygenfile:: metal/rtc.h
:project: metal

6 changes: 6 additions & 0 deletions doc/sphinx/apiref/shutdown.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Shutdown
========

.. doxygenfile:: metal/shutdown.h
:project: metal

6 changes: 6 additions & 0 deletions doc/sphinx/apiref/spi.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SPI
===

.. doxygenfile:: metal/spi.h
:project: metal

6 changes: 6 additions & 0 deletions doc/sphinx/apiref/switch.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Switches
========

.. doxygenfile:: metal/switch.h
:project: metal

6 changes: 6 additions & 0 deletions doc/sphinx/apiref/time.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Time
====

.. doxygenfile:: metal/time.h
:project: metal

6 changes: 6 additions & 0 deletions doc/sphinx/apiref/timer.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Timer API
=========

.. doxygenfile:: metal/timer.h
:project: metal

6 changes: 6 additions & 0 deletions doc/sphinx/apiref/tty.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
TTY
===

.. doxygenfile:: metal/tty.h
:project: metal

5 changes: 5 additions & 0 deletions doc/sphinx/apiref/uart.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
UART
====

.. doxygenfile:: metal/uart.h
:project: metal
6 changes: 6 additions & 0 deletions doc/sphinx/apiref/watchdog.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Watchdog
========

.. doxygenfile:: metal/watchdog.h
:project: metal

Loading