Skip to content

Commit a177b01

Browse files
committed
NEEDS REVIEW: Clean up code references, and use extlinks extension to link to github
1 parent db4ac95 commit a177b01

File tree

7 files changed

+88
-233
lines changed

7 files changed

+88
-233
lines changed

docs/conf.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
# Add any Sphinx extension module names here, as strings. They can be extensions
2727
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
28-
extensions = []
28+
extensions = ['sphinx.ext.extlinks']
2929

3030
# Add any paths that contain templates here, relative to this directory.
3131
templates_path = ['_templates']
@@ -240,3 +240,6 @@
240240

241241
# How to display URL addresses: 'footnote', 'no', or 'inline'.
242242
#texinfo_show_urls = 'footnote'
243+
244+
# extlinks configuration -- github sourcecode pages
245+
extlinks = {'gh-src': ('https://github.com/qca/open-plc-utils/blob/master/%s','')}

docs/overview.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ MDIO Programming
596596
A command line utility to read and display Atheros MDIO custom modules in human readable format. This program is installed in folder :file:`/usr/local/bin` with 0555 file permissions. The main source code is located in folder :file:`./mdio`. See the `mdiodump <mdiodump.7.html>`_ man page for more information.
597597

598598
:program:`mdiogen`
599-
A rudimentary command line utility that write a custom MDIO block to a fixed file. The user must edit a data statements, in the main program, to define MDIO command fields. A series of macros then mask, shift and merge the fields to create complete Clause 22 or Clause 45 MDIO commands on output. The program has no dependencies on other toolkit modules and so it will compile anywhere. This program must be manually compiled and it is not automatically installed. The main source code is located in folder :file:`./mdio` and file `mdio.h <mdio.h.html>`_ is required for compilation. There are no help files available at this time. If you do not understand how to use it then you may not need it.
599+
A rudimentary command line utility that write a custom MDIO block to a fixed file. The user must edit a data statements, in the main program, to define MDIO command fields. A series of macros then mask, shift and merge the fields to create complete Clause 22 or Clause 45 MDIO commands on output. The program has no dependencies on other toolkit modules and so it will compile anywhere. This program must be manually compiled and it is not automatically installed. The main source code is located in folder :file:`./mdio` and file :gh-src:`mdio.h <mdio/mdio.h>` is required for compilation. There are no help files available at this time. If you do not understand how to use it then you may not need it.
600600

601601
.. _programs-serial:
602602

@@ -655,14 +655,14 @@ Folder descriptions appear below in alphabetical order:
655655
Miscellaneous shell scripts that call various programs in this package to perform tasks such as flashing a FW2.0 device. Care must be taken here to ensure that environment variables at the start of each script are appropriate for your system.
656656

657657
./ram
658-
Support modules for reading, printing and checking NVRAM and SDRAM configuration files. The :file:`.cfg` files in this folder have a different format than the :file:`.config` files released with the Atheros Windows :program:`Device Manager`. The files distributed with the Windows :program:`Device Manger` are 64 ASCII character with no checksum. The files in this directory are 32 binary bites with trailing checksum. Users may create new sdram configuration files by compiling `sdram.c <sdram.c.html>`_, using :command:`gcc -o sdram sdram.c` and running it without any command line arguments.
658+
Support modules for reading, printing and checking NVRAM and SDRAM configuration files. The :file:`.cfg` files in this folder have a different format than the :file:`.config` files released with the Atheros Windows :program:`Device Manager`. The files distributed with the Windows :program:`Device Manger` are 64 ASCII character with no checksum. The files in this directory are 32 binary bites with trailing checksum. Users may create new sdram configuration files by compiling :gh-src:`sdram.c <ram/sdram.c>`, using :command:`gcc -o sdram sdram.c` and running it without any command line arguments.
659659

660660
./tools
661661
Source code and header files used by virtually all programs in the toolkit. These files are generic and have application beyond this package. They provide GNU/Linux-style or POSIX-style functionality to programs running in environments that do not have either. They also implement operations like checksum computation and multi-byte hexadecimal encoding and decoding. See :ref:`Support Function Reference <support-functions>` for more information.
662662

663663
./VisualStudioNET
664664
Components unique to Microsoft Windows are kept in and under this folder. Specifically, it contains a *Visual Studio .NET* solution to compile most of the programs in this package using only Microsoft and WinPcap libraries. Compiled .exe files can be run on Windows enabled systems having :program:`WinPcap` installed. Adjustments may be necessary depending on your environment.
665-
Microsoft does not provide full POSIX support on Windows platforms. Consequently, alternative headers and libraries are included under this folder. For example, an abridged version of `unistd.h <unistd.h.html>`_ and an alternative version of `stdint.h <stdint.h.html>`_ are included under :file:`VisualStudioNET/include`. Other significant header files included here are `ethernet.h <ethernet.h.html>`_, `if_ether.h <if_ether.h.html>`_ and `in.h <in.h.html>`_. Subfolder :file:`VisualStudio\\Library` contains *WinPcap* libraries. These folders are referenced in appropriate compiler and linker options for Microsoft Development environments.
665+
Microsoft does not provide full POSIX support on Windows platforms. Consequently, alternative headers and libraries are included under this folder. For example, an abridged version of :gh-src:`unistd.h <VisualStudioNET/include/unistd.h>` and an alternative version of :gh-src:`stdint.h <VisualStudioNET/include/stdint.h>` are included under :file:`VisualStudioNET/include`. Other significant header files included here are :gh-src:`ethernet.h <VisualStudioNET/include/net/ethernet.h>`, :gh-src:`if_ether.h <VisualStudioNET/include/netinet/if_ether.h>` and :gh-src:`in.h <VisualStudioNET/include/netinet/in.h>`. Subfolder :file:`VisualStudio\\Library` contains *WinPcap* libraries. These folders are referenced in appropriate compiler and linker options for Microsoft Development environments.
666666

667667
.. _overview-packages:
668668

docs/software.rst

+8-10
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,11 @@ The Atheros :program:`Open Powerline Toolkit` includes a *Visual Studio .NET* so
236236

237237
- All projects should globally define preprocessor constant ``MAKEFILE`` to prevent proliferation of "already defined" link errors. See :ref:`Stand-alone Compiling on GNU/Linux <software-stand-alone>` for an explanation of this constant.
238238

239-
- All projects search folder :file:`..\\include` for `stdint.h <stdint.h.html>`_ and `unistd.h <unistd.h.html>`_ because Microsoft does not provide them. These header files are customized or abbreviated versions of their POSIX counterparts and should be used when originals are available.
239+
- All projects search folder :file:`..\\include` for :gh-src:`stdint.h <VisualStudioNET/include/stdint.h>` and :gh-src:`unistd.h <VisualStudioNET/include/unistd.h>` because Microsoft does not provide them. These header files are customized or abbreviated versions of their POSIX counterparts and should be used when originals are available.
240240

241241
- Projects that perform raw Ethernet I/O should globally define preprocessor constant ``WINPCAP`` to enable appropriate code segments. Preprocessor error statements should (but may not) alert you if ``WINPCAP`` is not defined on *Windows* platforms.
242242

243-
- Projects that perform raw Ethernet I/O search folder :file:`..\\include` for :program:`WinPcap` header files. These files are taken from the :program:`WinPcap` development package and may require periodic updates. Header files `pcap.h <pcap.h.html>`_, `pca-stdinc.h <pcap-stdinc.h.html>`_, `pcap-bpf.h <pcap-bpf.h.html>`_, `ipv6_misc.h <ipv6_misc.h.html>`_ and `bittypes.h <bittypes.h.html>`_ belong in folder :file:`VisualStudioNET\\include`. Other header files belong in folder :file:`VisualStudioNET\\include\\pcap`.
243+
- Projects that perform raw Ethernet I/O search folder :file:`..\\include` for :program:`WinPcap` header files. These files are taken from the :program:`WinPcap` development package and may require periodic updates. Header files :gh-src:`pcap.h <VisualStudioNET/include/pcap.h>`, :gh-src:`pcap-stdinc.h <VisualStudioNET/include/pcap-stdinc.h>`, :gh-src:`pcap-pbf.h <VisualStudioNET/include/pcap-bpf.h>`, and :gh-src:`bittypes.h <VisualStudioNET/include/bittypes.h>` belong in folder :file:`VisualStudioNET\\include`. Other header files belong in folder :file:`VisualStudioNET\\include\\pcap`.
244244

245245
- Projects that perform raw Ethernet I/O should include folder :file:`..\\library` for core :program:`WinPcap` libraries.
246246

@@ -251,9 +251,9 @@ The Atheros :program:`Open Powerline Toolkit` includes a *Visual Studio .NET* so
251251
Header Files
252252
============
253253

254-
Atheros :program:`Open Powerline Toolkit` programs reference POSIX functions and constants where possible. Specifically, they make wide use of the data types ``uint8_t``, ``uint16_t`` and ``uint32_t`` which are defined in file :file:`stdint.h`. Microsoft *Visual C* and *.NET* environments do not include this file. Consequently, Atheros provides an `alternative stdint.h <stdint.h.html>`_ in folder :file:`../Windows/include`. This file is open source and was designed to be compatible with the Microsoft development environments; however, you may occassionally experience warnings about the "benign redefinition" for some of these data types.
254+
Atheros :program:`Open Powerline Toolkit` programs reference POSIX functions and constants where possible. Specifically, they make wide use of the data types ``uint8_t``, ``uint16_t`` and ``uint32_t`` which are defined in file :file:`stdint.h`. Microsoft *Visual C* and *.NET* environments do not include this file. Consequently, Atheros provides an :gh-src:`alternative stdint.h <VisualStudioNET/include/stdint.h>` in folder :file:`../Windows/include`. This file is open source and was designed to be compatible with the Microsoft development environments; however, you may occassionally experience warnings about the "benign redefinition" for some of these data types.
255255

256-
Where possible, this toolkit includes *OpenBSD* network constants because the OpenBSD project pioneered many of the common network protocols and applications used today. Some systems do not include all *OpenBSD* network header files or do not define all *OpenBSD* network constants. Specifically, Microsoft systems do not provide file :file:`netinet/if_ether.h` and so an `alternative if_ether.h <if_ether.h.html>`_ is included in folder :file:`../Windows/include/netinet` and *Windows* applications should include it.
256+
Where possible, this toolkit includes *OpenBSD* network constants because the OpenBSD project pioneered many of the common network protocols and applications used today. Some systems do not include all *OpenBSD* network header files or do not define all *OpenBSD* network constants. Specifically, Microsoft systems do not provide file :file:`netinet/if_ether.h` and so an :gh-src:`alternative if_ether.h <VisualStudioNET/include/netinet/if_ether.h>` is included in folder :file:`../Windows/include/netinet` and *Windows* applications should include it.
257257

258258
When the :command:`gcc -std=iso9899:1999` option is enabled, some *OpenBSD* header files found on :program:`GNU/Linux` systems will exclude required constant definitions because they do not conform to that standard. Atheros is investigating the best way to address this problem.
259259

@@ -419,7 +419,7 @@ Endian-ness
419419

420420
Atheros vendor-specific messages contain information in mixed endian format. The Ethernet header portion is sent *big endian* but the Atheros header and payload are sent in *little endian*. The traditional endian converstion functions ``htons()``, ``htonl()``, ``ntohs()`` and ``ntohl()`` can be used to perform platform independent conversions on the Ethernet header but not the Atheros header payload.
421421

422-
The Open Powerline Toolkit includes similar macros ``HTOLE16``, ``HTOLE32``, ``LE16TOH`` and ``LE32TOH`` in `endian.h <endian.h.html>`_ which serve the same function but conform to recommendations for standarized byte order function on Linux, OpenBSD and FreeBSD. Observe that the names are independent of any network implications.
422+
The Open Powerline Toolkit includes similar macros ``HTOLE16``, ``HTOLE32``, ``LE16TOH`` and ``LE32TOH`` in :gh-src:`endian.h <tools/endian.h>` which serve the same function but conform to recommendations for standarized byte order function on Linux, OpenBSD and FreeBSD. Observe that the names are independent of any network implications.
423423

424424
.. code-block:: c
425425
@@ -441,8 +441,6 @@ The Open Powerline Toolkit includes similar macros ``HTOLE16``, ``HTOLE32``, ``L
441441
#error "Undefined host byte order."
442442
#endif
443443
444-
In addition, the Open Powerline Toolkit includes function :ref:`endian <support-endian>` that reverses byte order over a variable-length memory region.
445-
446444
.. _packet-basics:
447445

448446
Packet Basics
@@ -458,15 +456,15 @@ The Ethernet header must be transmitted in newtwork byte order which is big-endi
458456
| Ethernet Header | Ethernet Payload |
459457
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ ... +---+---+
460458

461-
Ethernet headers consist of a destination address (``ODA``), a source address (``OSA``) and an ethertype (``MTYPE``). The ethertype is always 0x88E1 for Homeplug frames of any type. Programmers may use either function `EthernetHeader.c <EthernetHeader.c.html>`_ or `EncodeEthernetHeader <EncodeEthernetHeader.c.html>`_ to encode a buffer with the ODA and OSA and the HomePlug ethertype. An example appears later on. Structure ``header_eth`` is defined in `ihp.h <ihp.h.html>`_ for this purpose.
459+
Ethernet headers consist of a destination address (``ODA``), a source address (``OSA``) and an ethertype (``MTYPE``). The ethertype is always 0x88E1 for Homeplug frames of any type. Programmers may use either function :gh-src:`EthernetHeader.c <mme/EthernetHeader.c>` to encode a buffer with the ODA and OSA and the HomePlug ethertype. An example appears later on. Structure ``ethernet_hdr`` is defined in :gh-src:`mme.h <mme/mme.h>` for this purpose.
462460

463461
::
464462

465463
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ ... +---+---+
466464
| ODA | OSA | MTYPE | Ethernet Payload |
467465
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ ... +---+---+
468466

469-
Management messages consist of a message header (MMHEADER) and a message entry (MMENTRY). The message header identifies the nature of the message entry that follows it. The acronyms MME and MMENTRY both mean Management Message Entry but they are often used to mean the entire management message or Ethernet frame. This imprecise usage can be confusing at times. Structure ``header_mme`` is defined in `ihp.h <ihp.h.html>`_ for this purpose.
467+
Management messages consist of a message header (MMHEADER) and a message entry (MMENTRY). The message header identifies the nature of the message entry that follows it. The acronyms MME and MMENTRY both mean Management Message Entry but they are often used to mean the entire management message or Ethernet frame. This imprecise usage can be confusing at times. Structure ``homeplug_hdr`` is defined in :gh-src:`mme.h <mme/mme.h>` for this purpose.
470468

471469
::
472470

@@ -484,7 +482,7 @@ The message header contains message protocol version (MMV), message type (MMTYPE
484482

485483
The MMV value, within MMHEADER, indicates the Homeplug AV Management Message protocol version which determines how the message should be interpreted. The protocol version is defined in the HomePlug AV Specification and may change from time to time. One notable change is the recent insertion of an FMI (Fragment Management Information ) field between MMTYPE and OUI , as shown below.
486484

487-
In most cases, protocol changes are hidden from the application by the Atheros API functions; however, software developers should set the ``HOMEPLUG_MMV`` constant, defined in `ihp.h <ihp.h.html>`_, to the version appropriate for their firmware or application. The value of this constant enables or disables conditional compilation statements throughout the HomePlug API code base.
485+
In most cases, protocol changes are hidden from the application by the Atheros API functions; however, software developers should set the ``HOMEPLUG_MMV`` constant, defined in :gh-src:`homeplug.h <mme/homeplug.h>`, to the version appropriate for their firmware or application. The value of this constant enables or disables conditional compilation statements throughout the HomePlug API code base.
488486

489487
To send an MME, you must encode an Ethernet frame buffer with information and transmit it. To read an MME, you must read an Ethernet frame buffer and decode it. The information necessary to encode or decode Atheros vendor-specific Ethernet frames is covered in the INT6000 Firmware Technical Reference Manual; however, the Atheros HomePlug API includes many buffer encode and decode functions that support basic operational requirements.
490488

0 commit comments

Comments
 (0)