From b56dcf06e561729f87670d32f3b75c4aeddfee29 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Tue, 17 Jun 2008 22:57:36 +0200 Subject: * digital/avr/modules/utils: - updated doc. --- digital/avr/modules/utils/Makefile | 2 +- digital/avr/modules/utils/avrconfig.h | 2 +- digital/avr/modules/utils/byte.h | 2 +- digital/avr/modules/utils/utils.avr.h | 8 ++++---- digital/avr/modules/utils/utils.txt | 32 ++++++++++++++++++++++++++++---- 5 files changed, 35 insertions(+), 11 deletions(-) diff --git a/digital/avr/modules/utils/Makefile b/digital/avr/modules/utils/Makefile index 72c9ce66..3dee5cc3 100644 --- a/digital/avr/modules/utils/Makefile +++ b/digital/avr/modules/utils/Makefile @@ -1,5 +1,5 @@ BASE = ../.. DOC = utils.html -EXTRACTDOC = utils.h byte.h avrconfig.h +EXTRACTDOC = utils.h +utils.avr.h byte.h avrconfig.h include $(BASE)/make/Makefile.gen diff --git a/digital/avr/modules/utils/avrconfig.h b/digital/avr/modules/utils/avrconfig.h index f3ace725..b1c04cda 100644 --- a/digital/avr/modules/utils/avrconfig.h +++ b/digital/avr/modules/utils/avrconfig.h @@ -25,7 +25,7 @@ * * }}} */ -/* global */ +/* utils */ /** AVR Frequency : 1000000, 1843200, 2000000, 3686400, 4000000, 7372800, * 8000000, 11059200, 14745600, 16000000, 18432000, 20000000. */ #define AC_FREQ 14745600 diff --git a/digital/avr/modules/utils/byte.h b/digital/avr/modules/utils/byte.h index 436e0054..f3565755 100644 --- a/digital/avr/modules/utils/byte.h +++ b/digital/avr/modules/utils/byte.h @@ -27,7 +27,7 @@ /** WARNING: Theses functions only works on little endian processor, do not * use them on other processors, prefer the portable bit shifts and or. This - * file only exist to overide bad code production with avr-gcc in the bit + * file only exist to override bad code production with avr-gcc in the bit * shifts idiom. */ /* Union needed for byte access. */ diff --git a/digital/avr/modules/utils/utils.avr.h b/digital/avr/modules/utils/utils.avr.h index b42e92f3..efe9eaa1 100644 --- a/digital/avr/modules/utils/utils.avr.h +++ b/digital/avr/modules/utils/utils.avr.h @@ -27,10 +27,10 @@ #include -/** Helper macro to build register value. Call it like this : - * - * TCCR0 = regv (FOC0, WGM00, COM01, COM0, WGM01, CS02, CS01, CS00, - * 0, 0, 0, 0, 0, 1, 1, 1); +/** Helper macro to build register value. Call it like this:: + * + * TCCR0 = regv (FOC0, WGM00, COM01, COM0, WGM01, CS02, CS01, CS00, + * 0, 0, 0, 0, 0, 1, 1, 1); * * The macro check that the bits are given in the right order and compute the * register value. If the bits are false, the compiler will generate an diff --git a/digital/avr/modules/utils/utils.txt b/digital/avr/modules/utils/utils.txt index 4aa9a571..23c92a5c 100644 --- a/digital/avr/modules/utils/utils.txt +++ b/digital/avr/modules/utils/utils.txt @@ -1,6 +1,30 @@ -*Title: Module AVR Utilitaires -*Author: Ni +================== + Utils AVR module +================== +:Author: Nicolas Schodet -* Doc +Introduction +============ -*File: utils.exd +This module provides general purpose utilities. + +Byte packing/unpacking +====================== + +Theses functions are here to override bad code production with avr-gcc with the +classic shift idiom. + +Functions which unpack from a large type to a smaller type take a ``pos`` +parameter which is the position of the byte or word to extract from the large +type. Small values are for LSB. For example, ``v32_to_v8 (a, 0)`` will +extract the least significant byte from ``a``. + +Functions which pack from a small type to a larger type take as many small +type values as needed to fill the large type number. The first argument is +the MSB. For example, ``v8_to_v32 (0x12, 0x34, 0x56, 0x78)`` will return +``0x12345678``. + +API +=== + +.. include:: utils.exd -- cgit v1.2.3