[PATCH 3/6] cmdline support for rpi bsp
YANG QIAO
yangqiao0505 at me.com
Mon Aug 10 12:47:12 UTC 2015
From: YANG Qiao <yangqiao0505 at me.com>
---
c/src/lib/libbsp/arm/raspberrypi/include/bsp.h | 6 ++++
.../lib/libbsp/arm/raspberrypi/startup/bspstart.c | 1 +
.../libbsp/arm/raspberrypi/startup/bspstarthooks.c | 2 ++
c/src/lib/libbsp/arm/raspberrypi/startup/cmdline.c | 40 ++++++++++++++++++++++
4 files changed, 49 insertions(+)
create mode 100644 c/src/lib/libbsp/arm/raspberrypi/startup/cmdline.c
diff --git a/c/src/lib/libbsp/arm/raspberrypi/include/bsp.h b/c/src/lib/libbsp/arm/raspberrypi/include/bsp.h
index c05a410..4029d52 100644
--- a/c/src/lib/libbsp/arm/raspberrypi/include/bsp.h
+++ b/c/src/lib/libbsp/arm/raspberrypi/include/bsp.h
@@ -7,6 +7,8 @@
*/
/*
+ * Copyright (c) 2015 Yang Qiao
+ * based on work by:
* Copyright (c) 2013 Alan Cudmore
*
* The license and distribution terms for this file may be
@@ -33,6 +35,10 @@ extern "C" {
#define BSP_FEATURE_IRQ_EXTENSION
+void rpi_init_cmdline(void);
+const char* rpi_cmdline(void);
+const char* rpi_cmdline_arg(const char* arg);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/c/src/lib/libbsp/arm/raspberrypi/startup/bspstart.c b/c/src/lib/libbsp/arm/raspberrypi/startup/bspstart.c
index c5786bf..884d5ef 100644
--- a/c/src/lib/libbsp/arm/raspberrypi/startup/bspstart.c
+++ b/c/src/lib/libbsp/arm/raspberrypi/startup/bspstart.c
@@ -26,4 +26,5 @@
void bsp_start(void)
{
bsp_interrupt_initialize();
+ rpi_init_cmdline();
}
diff --git a/c/src/lib/libbsp/arm/raspberrypi/startup/bspstarthooks.c b/c/src/lib/libbsp/arm/raspberrypi/startup/bspstarthooks.c
index 047c8ad..7d72fe7 100644
--- a/c/src/lib/libbsp/arm/raspberrypi/startup/bspstarthooks.c
+++ b/c/src/lib/libbsp/arm/raspberrypi/startup/bspstarthooks.c
@@ -7,6 +7,7 @@
*/
/*
+ * Copyright (c) 2015 Yang Qiao
* Copyright (c) 2013. Hesham AL-Matary
* Copyright (c) 2013 by Alan Cudmore
* based on work by:
@@ -29,6 +30,7 @@
void BSP_START_TEXT_SECTION bsp_start_hook_0(void)
{
+ rpi_init_cmdline();
}
diff --git a/c/src/lib/libbsp/arm/raspberrypi/startup/cmdline.c b/c/src/lib/libbsp/arm/raspberrypi/startup/cmdline.c
new file mode 100644
index 0000000..c1ed29a
--- /dev/null
+++ b/c/src/lib/libbsp/arm/raspberrypi/startup/cmdline.c
@@ -0,0 +1,40 @@
+/**
+ * @file
+ *
+ * @ingroup raspberrypi
+ *
+ * @brief mailbox support.
+ */
+/*
+ * Copyright (c) 2015 Yang Qiao
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ *
+ * http://www.rtems.org/license/LICENSE
+ *
+ */
+
+#include <bsp.h>
+#include <bsp/vc.h>
+
+#define MAX_CMDLINE_LENGTH 1024
+static char* _rpi_cmdline;
+static bcm2835_get_cmdline_entries get_cmdline_entries;
+
+void rpi_init_cmdline(void)
+{
+ bcm2835_get_cmdline_entries get_cmdline_entries;
+ bcm2835_mailbox_get_cmdline(&get_cmdline_entries);
+ _rpi_cmdline = get_cmdline_entries.cmdline;
+}
+
+const char* rpi_cmdline(void)
+{
+ return _rpi_cmdline;
+}
+
+const char* rpi_cmdline_arg(const char* arg)
+{
+ return strstr (rpi_cmdline (), arg);
+}
--
2.1.0
More information about the devel
mailing list