summaryrefslogtreecommitdiff
path: root/tinyusb/common
diff options
context:
space:
mode:
authorhathach <[email protected]>2012-11-29 10:41:33 +0700
committerhathach <[email protected]>2012-11-29 10:41:33 +0700
commit8cd811e2a9760afc1702ae0a872e999517bfcb40 (patch)
tree09ec2245a515fad540e60ebcf1da915de99e99fd /tinyusb/common
parent851f5bfd06c837626ddf06f1c326970763d07010 (diff)
start to work with doxygen
fix mem_size/mem_base usage with device rom driver
Diffstat (limited to 'tinyusb/common')
-rw-r--r--tinyusb/common/arch/arch.h25
-rw-r--r--tinyusb/common/arch/arch_lpc134x.h19
-rw-r--r--tinyusb/common/arch/arch_lpc43xx.h21
-rw-r--r--tinyusb/common/arch/arm_mx.h20
-rw-r--r--tinyusb/common/common.h21
-rw-r--r--tinyusb/common/compiler/compiler.h22
-rw-r--r--tinyusb/common/compiler/compiler_gcc.h19
-rw-r--r--tinyusb/common/errors.c5
-rw-r--r--tinyusb/common/errors.h18
-rw-r--r--tinyusb/common/fifo.h39
10 files changed, 143 insertions, 66 deletions
diff --git a/tinyusb/common/arch/arch.h b/tinyusb/common/arch/arch.h
index 8580d4208..d641ceefb 100644
--- a/tinyusb/common/arch/arch.h
+++ b/tinyusb/common/arch/arch.h
@@ -35,19 +35,28 @@
* This file is part of the tiny usb stack.
*/
+/** \file
+ * \brief Architecture Header
+ *
+ * \note TBD
+ */
+
+/** \ingroup Group_Common
+ * \defgroup Group_Arch Architecture
+ * \brief Group_Arch brief
+ *
+ * @{
+ */
+
#ifndef _TUSB_ARCH_H_
#define _TUSB_ARCH_H_
-#ifdef __cplusplus
- extern "C" {
-#endif
-
#define ARCH_LPC134X 1
#define ARCH_LPC43XX 2
#define ARCH ARCH_LPC134X
-#define ENDIAN_LITTLE
-#define ALIGNMENT (4)
+#define ENDIAN_LITTLE ///< MCU Endian
+#define ALIGNMENT (4) ///< MCU Alignment
#if ARCH == ARCH_LPC134X
#include "arch_lpc134x.h"
@@ -55,8 +64,4 @@
#endif
-#ifdef __cplusplus
- }
-#endif
-
#endif /* _TUSB_ARCH_H_ */
diff --git a/tinyusb/common/arch/arch_lpc134x.h b/tinyusb/common/arch/arch_lpc134x.h
index 988c562e3..0ac5d971b 100644
--- a/tinyusb/common/arch/arch_lpc134x.h
+++ b/tinyusb/common/arch/arch_lpc134x.h
@@ -35,13 +35,20 @@
* This file is part of the tiny usb stack.
*/
+/** \file
+ * \brief LPC13Uxx Header
+ *
+ * \note TBD
+ */
+
+/** \ingroup Group_Arch
+ *
+ * @{
+ */
+
#ifndef _TUSB_ARCH_LPC134_X_H_
#define _TUSB_ARCH_LPC134_X_H_
-#ifdef __cplusplus
- extern "C" {
-#endif
-
#include "arm_mx.h"
#include "LPC13Uxx.h"
@@ -49,8 +56,4 @@
#define DEVICE_ROMDRIVER
-#ifdef __cplusplus
- }
-#endif
-
#endif /* _TUSB_ARCH_LPC134_X_H_ */
diff --git a/tinyusb/common/arch/arch_lpc43xx.h b/tinyusb/common/arch/arch_lpc43xx.h
index f04dc4f74..05c177cc0 100644
--- a/tinyusb/common/arch/arch_lpc43xx.h
+++ b/tinyusb/common/arch/arch_lpc43xx.h
@@ -35,20 +35,25 @@
* This file is part of the tiny usb stack.
*/
+/** \file
+ * \brief LPC43xx Header
+ *
+ * \note TBD
+ */
+
+/** \ingroup Group_Arch
+ *
+ * @{
+ */
+
#ifndef _TUSB_ARCH_LPC43XX_H_
#define _TUSB_ARCH_LPC43XX_H_
-#ifdef __cplusplus
- extern "C" {
-#endif
-
#define ARM_M4
//#define ARM_M0
#include "arm_mx.h"
-#ifdef __cplusplus
- }
-#endif
-
#endif /* _TUSB_ARCH_LPC43XX_H_ */
+
+/// @}
diff --git a/tinyusb/common/arch/arm_mx.h b/tinyusb/common/arch/arm_mx.h
index 760eea9c9..ea4ac5f36 100644
--- a/tinyusb/common/arch/arm_mx.h
+++ b/tinyusb/common/arch/arm_mx.h
@@ -35,18 +35,22 @@
* This file is part of the tiny usb stack.
*/
+/** \file
+ * \brief ARM Cortex Mx Header
+ *
+ * \note TBD
+ */
+
+/** \ingroup Group_Arch
+ *
+ * @{
+ */
+
#ifndef _TUSB_ARM_MX_H_
#define _TUSB_ARM_MX_H_
-#ifdef __cplusplus
- extern "C" {
-#endif
-
#define ENDIAN_LITTLE
#define ALIGNMENT (4)
-#ifdef __cplusplus
- }
-#endif
-
#endif /* _TUSB_ARM_MX_H_ */
+/// @}
diff --git a/tinyusb/common/common.h b/tinyusb/common/common.h
index 1405b7605..768d9ae1c 100644
--- a/tinyusb/common/common.h
+++ b/tinyusb/common/common.h
@@ -35,13 +35,22 @@
* This file is part of the tiny usb stack.
*/
+/** \file
+ * \brief Common Header File
+ *
+ * \note TBD
+ */
+
+/** \ingroup Group_TinyUSB
+ * \defgroup Group_Common Common Files
+ * \brief Group_Common brief
+ *
+ * @{
+ */
+
#ifndef _TUSB_COMMON_H_
#define _TUSB_COMMON_H_
-#ifdef __cplusplus
- extern "C" {
-#endif
-
#include <stddef.h>
#include <stdbool.h>
#include <string.h>
@@ -78,8 +87,4 @@
#define ASSERT_STATUS(sts) ASSERT_STATUS_MESSAGE(sts, NULL)
-#ifdef __cplusplus
- }
-#endif
-
#endif /* _TUSB_COMMON_H_ */
diff --git a/tinyusb/common/compiler/compiler.h b/tinyusb/common/compiler/compiler.h
index 6621b4160..4aae60f22 100644
--- a/tinyusb/common/compiler/compiler.h
+++ b/tinyusb/common/compiler/compiler.h
@@ -35,19 +35,25 @@
* This file is part of the tiny usb stack.
*/
+/** \file
+ * \brief Compiler Header
+ *
+ * \note TBD
+ */
+
+/** \ingroup Group_Common
+ * \defgroup Group_Compiler Compiler
+ * \brief Group_Compiler brief
+ *
+ * @{
+ */
+
#ifndef _TUSB_COMPILER_H_
#define _TUSB_COMPILER_H_
-#ifdef __cplusplus
- extern "C" {
-#endif
-
#if defined(__GNUC__)
#include "compiler_gcc.h"
#endif
-#ifdef __cplusplus
- }
-#endif
-
#endif /* _TUSB_COMPILER_H_ */
+/// @}
diff --git a/tinyusb/common/compiler/compiler_gcc.h b/tinyusb/common/compiler/compiler_gcc.h
index 38ef5f20f..d3047a544 100644
--- a/tinyusb/common/compiler/compiler_gcc.h
+++ b/tinyusb/common/compiler/compiler_gcc.h
@@ -35,9 +35,16 @@
* This file is part of the tiny usb stack.
*/
-#ifdef __cplusplus
- extern "C" {
-#endif
+/** \file
+ * \brief GCC Header
+ *
+ * \note TBD
+ */
+
+/** \ingroup Group_Compiler
+ *
+ * @{
+ */
#ifndef _TUSB_COMPILER_GCC_H_
#define _TUSB_COMPILER_GCC_H_
@@ -56,8 +63,6 @@
#define ATTR_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))
#define ATTR_ALWAYS_INLINE __attribute__ ((always_inline))
-#ifdef __cplusplus
- }
-#endif
-
#endif /* _TUSB_COMPILER_GCC_H_ */
+
+/// @}
diff --git a/tinyusb/common/errors.c b/tinyusb/common/errors.c
index 90753786b..c0878ef67 100644
--- a/tinyusb/common/errors.c
+++ b/tinyusb/common/errors.c
@@ -35,3 +35,8 @@
* This file is part of the tiny usb stack.
*/
+char const* const TUSB_ErrorStr[] = {
+# define ERROR_ENUM(x) #x,
+# include "errors_def"
+# undef ERROR_ENUM
+};
diff --git a/tinyusb/common/errors.h b/tinyusb/common/errors.h
index e4a75f0e8..20a797792 100644
--- a/tinyusb/common/errors.h
+++ b/tinyusb/common/errors.h
@@ -35,13 +35,31 @@
* This file is part of the tiny usb stack.
*/
+/** \file
+ * \brief Error Header
+ *
+ * \note TBD
+ */
+
+/** \ingroup Group_Common
+ *
+ * @{
+ */
+
#ifndef _TUSB_ERRORS_H_
#define _TUSB_ERRORS_H_
+enum TUSB_ERROR {
+# define ERROR_ENUM(x) x,
+# include "errors_def"
+# undef ERROR_ENUM
+};
+
#ifdef __cplusplus
extern "C" {
#endif
+extern char const* const TUSB_ErrorStr[];
#ifdef __cplusplus
}
diff --git a/tinyusb/common/fifo.h b/tinyusb/common/fifo.h
index 1019c8bde..4a0bfc340 100644
--- a/tinyusb/common/fifo.h
+++ b/tinyusb/common/fifo.h
@@ -35,23 +35,40 @@
* This file is part of the tiny usb stack.
*/
+/** \file
+ * \brief Error Header
+ *
+ * \note TBD
+ */
+
+/** \ingroup Group_Common
+ *
+ * @{
+ */
+
#ifndef _TUSB_FIFO_H_
#define _TUSB_FIFO_H_
#include "common/common.h"
-/* ToDo: Describe each field in fifo_t */
-typedef struct _fifo_t
+/**
+ * \brief Simple FIFO
+ */
+typedef struct
{
- uint8_t* buf;
- uint16_t size;
- volatile uint16_t len;
- volatile uint16_t wr_ptr;
- volatile uint16_t rd_ptr;
- bool overwritable;
- IRQn_Type irq;
+ uint8_t* buf; ///< buffer pointer
+ uint16_t size; ///< buffer size
+ volatile uint16_t len; ///< bytes in fifo
+ volatile uint16_t wr_ptr; ///< write pointer
+ volatile uint16_t rd_ptr; ///< read pointer
+ bool overwritable; ///< allow overwrite data when full
+ IRQn_Type irq; ///< interrupt used to lock fifo
} fifo_t;
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
void fifo_init(fifo_t* f, uint8_t* buffer, uint16_t size, bool overwritable, IRQn_Type irq);
bool fifo_write(fifo_t* f, uint8_t data);
bool fifo_read(fifo_t* f, uint8_t *data);
@@ -73,4 +90,8 @@ static inline uint16_t fifo_getLength(fifo_t* f)
return f->len;
}
+#ifdef __cplusplus
+ }
+#endif
+
#endif /* _TUSB_FIFO_H_ */