summaryrefslogtreecommitdiff
path: root/apps/examples/usbstorage/usbstrg.h
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-07-25 22:21:38 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-07-25 22:21:38 +0000
commit1e931fd487f9661633ec8d5f952bbaa65d48b876 (patch)
treea85830897a5fc26e1672cc9f5a527cd649498a85 /apps/examples/usbstorage/usbstrg.h
parent73624b6e68013b718cee96dc8d3c628cb84431ba (diff)
downloadnuttx-1e931fd487f9661633ec8d5f952bbaa65d48b876.tar.gz
nuttx-1e931fd487f9661633ec8d5f952bbaa65d48b876.tar.bz2
nuttx-1e931fd487f9661633ec8d5f952bbaa65d48b876.zip
Add memory usage monitor to USB storage example
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3817 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps/examples/usbstorage/usbstrg.h')
-rw-r--r--apps/examples/usbstorage/usbstrg.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/apps/examples/usbstorage/usbstrg.h b/apps/examples/usbstorage/usbstrg.h
index 4b50dfe77..a179bc054 100644
--- a/apps/examples/usbstorage/usbstrg.h
+++ b/apps/examples/usbstorage/usbstrg.h
@@ -41,6 +41,7 @@
****************************************************************************/
#include <nuttx/config.h>
+#include <stdlib.h>
/****************************************************************************
* Pre-Processor Definitions
@@ -101,6 +102,52 @@
#endif
/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+/* All global variables used by this example are packed into a structure in
+ * order to avoid name collisions.
+ */
+
+#if defined(CONFIG_EXAMPLES_USBSTRG_BUILTIN) || defined(CONFIG_EXAMPLES_USBSTRG_DEBUGMM)
+struct usbstrg_state_s
+{
+ /* This is the handle that references to this particular USB storage driver
+ * instance. It is only needed if the USB mass storage device example is
+ * built using CONFIG_EXAMPLES_USBSTRG_BUILTIN. In this case, the value
+ * of the driver handle must be remembered between the 'msconn' and 'msdis'
+ * commands.
+ */
+
+#ifdef CONFIG_EXAMPLES_USBSTRG_BUILTIN
+ FAR void *mshandle;
+#endif
+
+ /* Heap usage samples. These are useful for checking USB storage memory
+ * usage and for tracking down memoryh leaks.
+ */
+
+#ifdef CONFIG_EXAMPLES_USBSTRG_DEBUGMM
+ struct mallinfo mmstart; /* Memory usage before the connection */
+ struct mallinfo mmprevious; /* The last memory usage sample */
+ struct mallinfo mmcurrent; /* The current memory usage sample */
+#endif
+};
+#endif
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/* All global variables used by this example are packed into a structure in
+ * order to avoid name collisions.
+ */
+
+#if defined(CONFIG_EXAMPLES_USBSTRG_BUILTIN) || defined(CONFIG_EXAMPLES_USBSTRG_DEBUGMM)
+extern struct usbstrg_state_s g_usbstrg;
+#endif
+
+/****************************************************************************
* Public Functions
****************************************************************************/