Author: remi
Date: 2008-12-01 14:47:51 +0100 (Mon, 01 Dec 2008)
New Revision: 2964
Modified:
software_suite_v2/tuxware/tuxdriver/trunk/src/tux_firmware.c
software_suite_v2/tuxware/tuxdriver/trunk/src/tux_firmware.h
Log:
* added comments and doxygen.
Modified: software_suite_v2/tuxware/tuxdriver/trunk/src/tux_firmware.c
===================================================================
--- software_suite_v2/tuxware/tuxdriver/trunk/src/tux_firmware.c
2008-12-01 12:53:37 UTC (rev 2963)
+++ software_suite_v2/tuxware/tuxdriver/trunk/src/tux_firmware.c
2008-12-01 13:47:51 UTC (rev 2964)
@@ -18,6 +18,15 @@
* 02111-1307, USA.
*/
+/**
+ * \file tux_firmware.c
+ * \brief Firmware functions.
+ * \author [EMAIL PROTECTED]
+ * \ingroup firmware
+ * \todo Remove deprecated functions.
+ * \todo Implement the new way to retrieve the RF versions.
+ */
+
#include <stdio.h>
#include <string.h>
@@ -30,16 +39,17 @@
/** State of the versioning state machine. */
static versioning_state_t versioning_state = STDBY;
-
/** Used to hold the CPU number that is currently sending its information as it
* needs multiple commands to send it all. */
static int current_cpu = INVALID_CPU_NUM;
-
+/** Number of cpu */
static int cpu_num;
-
+/** Retries counter of firmware versions */
static int retries;
+/** Descriptor of the firmwares */
LIBLOCAL firmwares_descriptor_t firmwares_desc;
+/** Descriptor of the firmwares package */
LIBLOCAL firmware_descriptor_t firmware_release_desc;
LIBLOCAL char knowed_tuxcore_symbolic_version[256] = "Tuxcore 0.0.0";
@@ -49,9 +59,9 @@
LIBLOCAL char knowed_tuxrf_symbolic_version[256] = "TuxRF 0.0.0";
/**
- * Get the name of a tux cpu.
- * @param id cpu identifier.
- * @return a string.
+ * \brief Get the name of a tux cpu.
+ * \param id cpu identifier.
+ * \return a string.
*/
static const char *
cpu_id_to_name(int id)
@@ -74,7 +84,7 @@
}
/**
- *
+ * \deprecated
*/
static void
load_knowed_symbolic_versions(void)
@@ -113,7 +123,7 @@
}
/**
- *
+ * \deprecated
*/
#ifdef LOCK_TUX
static void
@@ -136,7 +146,7 @@
#endif
/**
- *
+ * \deprecated
*/
LIBLOCAL bool
tux_firmware_check_new_descriptor(bool save)
@@ -172,7 +182,7 @@
}
/**
- * Initilizing the firmware part of the descriptor.
+ * \brief Initilize the firmware part of the descriptor.
*/
LIBLOCAL void
tux_firmware_init_descriptor(void)
@@ -184,7 +194,7 @@
}
/**
- * dumps descriptor, returns pointer to the next free place
+ * \deprecated
*/
static char *
dump_descriptor_of_cpu(char *descriptor, const firmware_descriptor_t *desc)
@@ -221,7 +231,7 @@
}
/**
- *
+ * \deprecated
*/
LIBLOCAL char *
tux_firmware_dump_descriptor(char *p)
@@ -255,7 +265,7 @@
}
/**
- * Update the status of the version of a cpu.
+ * \brief Update the status of the version of a cpu.
*/
LIBLOCAL void
tux_firmware_update_version(void)
@@ -271,7 +281,7 @@
}
/**
- * Update the status of the revision of a cpu.
+ * \brief Update the status of the revision of a cpu.
*/
LIBLOCAL void
tux_firmware_update_revision(void)
@@ -309,7 +319,7 @@
}
/**
- * Update the status of the author of a cpu.
+ * \brief Update the status of the author of a cpu.
*/
LIBLOCAL void
tux_firmware_update_author(void)
@@ -328,9 +338,9 @@
}
/**
- * Request the versionning of a cpu.
- * @param cpu_id cpu identifier.
- * @return 0 or 1
+ * \brief Request the versionning of a cpu.
+ * \param cpu_id cpu identifier.
+ * \return 0 or 1
*/
static int
send_firmware_versionning_request(const int cpu_id)
@@ -362,7 +372,8 @@
}
/**
- *
+ * \brief Special function for old versionning.
+ * \deprecated
*/
static void
special_old_versionning(const int cpu_id)
@@ -394,7 +405,12 @@
}
/**
- *
+ * \brief Test the version of a firmware.
+ * \param firmware Firmware descriptor.
+ * \param major Major number to match.
+ * \param minor Minor number to match.
+ * \param update Update number to match.
+ * \return The firmware version match result.
*/
static bool
test_fw_ver(const firmware_descriptor_t *firmware, int major, int minor,
@@ -413,7 +429,7 @@
}
/**
- *
+ * \brief Function to determine the firmwares package version.
*/
static void
determine_release_package(void)
@@ -569,7 +585,7 @@
}
/**
- *
+ * \brief State machine task to retrieving the firmwares versions.
*/
LIBLOCAL void
tux_firmware_state_machine_call(void)
@@ -676,7 +692,7 @@
}
/**
- *
+ * \brief Start the firmware versions retrieving.
*/
LIBLOCAL void
tux_firmware_get_descriptor(void)
Modified: software_suite_v2/tuxware/tuxdriver/trunk/src/tux_firmware.h
===================================================================
--- software_suite_v2/tuxware/tuxdriver/trunk/src/tux_firmware.h
2008-12-01 12:53:37 UTC (rev 2963)
+++ software_suite_v2/tuxware/tuxdriver/trunk/src/tux_firmware.h
2008-12-01 13:47:51 UTC (rev 2964)
@@ -18,68 +18,89 @@
* 02111-1307, USA.
*/
+/**
+ * \file tux_firmware.h
+ * \brief Firmware header.
+ * \author [EMAIL PROTECTED]
+ * \ingroup firmware
+ */
+
#ifndef _TUX_FIRMWARE_H_
#define _TUX_FIRMWARE_H_
#include <stdbool.h>
+/** \brief First CPU index */
#define LOWEST_CPU_NUM 0
+/** \brief Last CPU index */
#define HIGHEST_CPU_NUM 4
+/** \brief Number of CPU */
#define NUMBER_OF_CPU (HIGHEST_CPU_NUM + 1)
+/** \brief Maximal length of a version string */
#define VERSION_STRING_LENGTH 256
-
+/** \brief Tuxcore CPU name */
#define CPU_STR_NAME_TUXCORE "Tuxcore"
+/** \brief Tuxaudio CPU name */
#define CPU_STR_NAME_TUXAUDIO "Tuxaudio"
+/** \brief Tuxrf CPU name */
#define CPU_STR_NAME_TUXRF "TuxRF"
+/** \brief Fuxrf CPU name */
#define CPU_STR_NAME_FUXRF "FuxRF"
+/** \brief Fuxusb CPU name */
#define CPU_STR_NAME_FUXUSB "FuxUSB"
+/** \brief Package release name */
#define RELEASE_STR_NAME "Global release package"
+/** \brief Unofficial package name */
#define UNOFFICIAL_RELEASE_STR "Unofficial package"
-
+/** \brief Number of retry count for the firmware versions retrieving */
#define TUX_FIRMWARE_RETRY_COUNT 4
+/** \brief CPU identifiers */
typedef enum
{
- TUXCORE_CPU_NUM = 0,
- TUXAUDIO_CPU_NUM = 1,
- TUXRF_CPU_NUM = 2,
- FUXRF_CPU_NUM = 3,
- FUXUSB_CPU_NUM = 4,
- INVALID_CPU_NUM = -1,
+ INVALID_CPU_NUM = -1, /**< Invalid CPU id */
+ TUXCORE_CPU_NUM = LOWEST_CPU_NUM, /**< Tuxcore CPU id */
+ TUXAUDIO_CPU_NUM, /**< Tuxaudio CPU id */
+ TUXRF_CPU_NUM, /**< Tuxrf CPU id */
+ FUXRF_CPU_NUM, /**< Fuxrf CPU id */
+ FUXUSB_CPU_NUM, /**< Fuxusb CPU id */
} CPU_IDENTIFIERS;
-/**
- * Versioning states.
- */
+/** \brief Versioning states. */
typedef enum
{
- STDBY,
- INIT,
- INFO_REQ,
- INFO_GET,
- SPECIAL,
- RELEASE,
- FINALIZE,
+ STDBY, /**< State machine STANDBY */
+ INIT, /**< State machine Initialization */
+ INFO_REQ, /**< State machine Request a firmware version*/
+ INFO_GET, /**< State machine Get a firmware version */
+ SPECIAL, /**< State machine Treats the special cases */
+ RELEASE, /**< State machine Determine the package release version */
+ FINALIZE, /**< State machine Finalization */
} versioning_state_t;
+/** \brief Firmware descriptor structure */
typedef struct
{
- CPU_IDENTIFIERS cpu_id;
- unsigned int version_major;
- unsigned int version_minor;
- unsigned int version_update;
- unsigned int revision;
- bool release;
- bool local_modification;
- bool mixed_revisions;
- unsigned int author;
- unsigned int variation;
+ CPU_IDENTIFIERS cpu_id; /**< CPU identifiant */
+ unsigned int version_major; /**< Major version */
+ unsigned int version_minor; /**< Minor version */
+ unsigned int version_update; /**< Update version */
+ unsigned int revision; /**< SVN revision */
+ bool release; /**< Is released */
+ bool local_modification; /**< Is a local modification */
+ bool mixed_revisions; /**< Is a mixed modification */
+ unsigned int author; /**< Author Id */
+ unsigned int variation; /**< Variation Id */
char version_string[VERSION_STRING_LENGTH];
+ /**< String representation of a firmware version */
} firmware_descriptor_t;
+/** \brief Array structure of firmware descriptors */
typedef firmware_descriptor_t firmwares_descriptor_t[NUMBER_OF_CPU];
+/** \brief Shared : Firmware descriptors */
extern firmwares_descriptor_t firmwares_desc;
+/** \brief Shared : Package release descriptor */
extern firmware_descriptor_t firmware_release_desc;
extern char knowed_tuxcore_symbolic_version[VERSION_STRING_LENGTH];
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn