v3/ec: enable C++17

Pigweed requires C++17 to build, so add the necessary config values
and the `extern "C"` so that all of the C code can compile for use
in C++ programs.

BUG=None
TEST=run ad-hoc tests in doc/README.md

Change-Id: I4e16784cf9fc967210299946e772d5f540f6156d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/chameleon/+/3179861
Tested-by: Paul Fagerburg <pfagerburg@chromium.org>
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org>
diff --git a/v3/ec/include/Si5338-CLK24-Registers.h b/v3/ec/include/Si5338-CLK24-Registers.h
index 8656198..7b6ec1b 100644
--- a/v3/ec/include/Si5338-CLK24-Registers.h
+++ b/v3/ec/include/Si5338-CLK24-Registers.h
@@ -78,6 +78,10 @@
 //Initial phase offset 3 (ns) = 0.000
 //SSC is disabled
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define NUM_REGS_MAX 350
 
 typedef struct Reg_Data{
@@ -437,3 +441,8 @@
 { 94,0x00,0x00},
 {255, 0, 0xFF} }; // set page bit to 0
 //End of file
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/v3/ec/include/fpgaboot.h b/v3/ec/include/fpgaboot.h
index e1af125..0bc1549 100644
--- a/v3/ec/include/fpgaboot.h
+++ b/v3/ec/include/fpgaboot.h
@@ -10,6 +10,10 @@
 
 #include <zephyr.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * Define the boot source for the FPGA
  *
@@ -66,4 +70,8 @@
  */
 int fpgaboot_power_off(void);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/v3/ec/include/fpgaboot_sm.h b/v3/ec/include/fpgaboot_sm.h
index 71dbafc..87147dc 100644
--- a/v3/ec/include/fpgaboot_sm.h
+++ b/v3/ec/include/fpgaboot_sm.h
@@ -15,6 +15,10 @@
 #include <stdbool.h>
 #include <zephyr.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 enum fpga_state {
 	FPGABOOT_OFF,
 	FPGABOOT_PWR_GOOD,
@@ -83,4 +87,8 @@
  */
 bool fpgaboot_is_steady_state(enum fpga_state state);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/v3/ec/include/i2c_switch.h b/v3/ec/include/i2c_switch.h
index 3d79639..f72ba0f 100644
--- a/v3/ec/include/i2c_switch.h
+++ b/v3/ec/include/i2c_switch.h
@@ -10,6 +10,10 @@
 
 #include <zephyr.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 enum i2c_switch_reset_value {
 	RESET_ASSERTED = 0,
 	RESET_DEASSERTED
@@ -62,4 +66,8 @@
  */
 int i2c_switch_get_int_status(void);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/v3/ec/include/io.h b/v3/ec/include/io.h
index 694d1bd..dad5a8e 100644
--- a/v3/ec/include/io.h
+++ b/v3/ec/include/io.h
@@ -11,6 +11,10 @@
 #include <zephyr.h>
 #include <drivers/gpio.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 enum gpio_signal {
 	power_good_led,
 	sd_mux_sel,
@@ -131,4 +135,8 @@
  */
 gpio_pin_t gpio_get_pin(enum gpio_signal signal);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/v3/ec/include/misc_io.h b/v3/ec/include/misc_io.h
index fe6b94f..fd8a200 100644
--- a/v3/ec/include/misc_io.h
+++ b/v3/ec/include/misc_io.h
@@ -10,6 +10,10 @@
 
 #include <zephyr.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @brief Get the board version number.
  *
@@ -21,4 +25,8 @@
  */
 int misc_io_get_board_version(void);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/v3/ec/include/sd.h b/v3/ec/include/sd.h
index 2a52f3c..65da5f7 100644
--- a/v3/ec/include/sd.h
+++ b/v3/ec/include/sd.h
@@ -10,6 +10,10 @@
 
 #include <zephyr.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 enum sd_state {
 	SD_MUX_OFF,	/**< Disconnect the SD card. */
 	SD_MUX_FPGA,	/**< Connect the SD card to the FPGA. */
@@ -44,4 +48,8 @@
  */
 int sd_get_cd_det(void);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/v3/ec/include/sysmon.h b/v3/ec/include/sysmon.h
index cc10a03..47f0658 100644
--- a/v3/ec/include/sysmon.h
+++ b/v3/ec/include/sysmon.h
@@ -10,6 +10,10 @@
 
 #include <zephyr.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * @brief Define all of the monitored inputs.
  */
@@ -57,4 +61,8 @@
  */
 float sysmon_get_val(enum sysmon_input input);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/v3/ec/include/videomux.h b/v3/ec/include/videomux.h
index e8fb85b..937564c 100644
--- a/v3/ec/include/videomux.h
+++ b/v3/ec/include/videomux.h
@@ -10,6 +10,10 @@
 
 #include <zephyr.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /*
  * The Chameleon v3 hardware has a series of muxes to route the HDMI or the
  * DisplayPort (after going through a DP/HDMI converter) signals to the
@@ -84,4 +88,8 @@
  */
 int videomux_select(enum video_source_t src, enum video_dest_t dest);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/v3/ec/prj.conf b/v3/ec/prj.conf
index 5aad6df..9e13bd2 100644
--- a/v3/ec/prj.conf
+++ b/v3/ec/prj.conf
@@ -4,6 +4,11 @@
 #
 # SPDX-License-Identifier: BSD-3-Clause
 
+CONFIG_NEWLIB_LIBC=y
+CONFIG_CPLUSPLUS=y
+CONFIG_LIB_CPLUSPLUS=y
+CONFIG_STD_CPP17=y
+
 CONFIG_ASSERT=y
 
 CONFIG_CBPRINTF_FP_SUPPORT=y