You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2017/11/10 20:24:56 UTC

[GitHub] ccollins476ad closed pull request #655: Support for APOLLO 2 and emspi HCI transport

ccollins476ad closed pull request #655: Support for APOLLO 2 and emspi HCI transport
URL: https://github.com/apache/mynewt-core/pull/655
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/apps/bleprph-emspi/pkg.yml b/apps/bleprph-emspi/pkg.yml
new file mode 100644
index 000000000..bb0fc9af9
--- /dev/null
+++ b/apps/bleprph-emspi/pkg.yml
@@ -0,0 +1,44 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+pkg.name: apps/bleprph-emspi
+pkg.type: app
+pkg.description: >
+        Simple BLE peripheral application.  It uses the emspi transport (EM
+        SPI protocol).
+pkg.author: "Apache Mynewt <de...@mynewt.apache.org>"
+pkg.homepage: "http://mynewt.apache.org/"
+pkg.keywords:
+
+pkg.deps: 
+    - boot/bootutil
+    - boot/split
+    - kernel/os 
+    - mgmt/imgmgr
+    - mgmt/newtmgr
+    - mgmt/newtmgr/transport/ble
+    - net/nimble/host
+    - net/nimble/host/services/ans
+    - net/nimble/host/services/gap
+    - net/nimble/host/services/gatt
+    - net/nimble/host/store/config
+    - net/nimble/transport/emspi
+    - sys/console/full
+    - sys/id
+    - sys/log/full
+    - sys/stats/full
+    - sys/sysinit
diff --git a/apps/bleprph-emspi/src/bleprph.h b/apps/bleprph-emspi/src/bleprph.h
new file mode 100644
index 000000000..ec1444594
--- /dev/null
+++ b/apps/bleprph-emspi/src/bleprph.h
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLEPRPH_
+#define H_BLEPRPH_
+
+#include <stdbool.h>
+#include "log/log.h"
+#include "nimble/ble.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct ble_hs_cfg;
+struct ble_gatt_register_ctxt;
+
+extern struct log bleprph_log;
+
+/* bleprph uses the first "peruser" log module. */
+#define BLEPRPH_LOG_MODULE  (LOG_MODULE_PERUSER + 0)
+
+/* Convenience macro for logging to the bleprph module. */
+#define BLEPRPH_LOG(lvl, ...) \
+    LOG_ ## lvl(&bleprph_log, BLEPRPH_LOG_MODULE, __VA_ARGS__)
+
+/** GATT server. */
+#define GATT_SVR_SVC_ALERT_UUID               0x1811
+#define GATT_SVR_CHR_SUP_NEW_ALERT_CAT_UUID   0x2A47
+#define GATT_SVR_CHR_NEW_ALERT                0x2A46
+#define GATT_SVR_CHR_SUP_UNR_ALERT_CAT_UUID   0x2A48
+#define GATT_SVR_CHR_UNR_ALERT_STAT_UUID      0x2A45
+#define GATT_SVR_CHR_ALERT_NOT_CTRL_PT        0x2A44
+
+void gatt_svr_register_cb(struct ble_gatt_register_ctxt *ctxt, void *arg);
+int gatt_svr_init(void);
+
+/* PHY support */
+#if MYNEWT_VAL(BLEPRPH_LE_PHY_SUPPORT)
+#define CONN_HANDLE_INVALID     0xffff
+
+void phy_init(void);
+void phy_conn_changed(uint16_t handle);
+void phy_update(uint8_t phy);
+#endif
+
+/** Misc. */
+void print_bytes(const uint8_t *bytes, int len);
+void print_addr(const void *addr);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/apps/bleprph-emspi/src/gatt_svr.c b/apps/bleprph-emspi/src/gatt_svr.c
new file mode 100644
index 000000000..7025aaf35
--- /dev/null
+++ b/apps/bleprph-emspi/src/gatt_svr.c
@@ -0,0 +1,204 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
+#include "bsp/bsp.h"
+#include "host/ble_hs.h"
+#include "host/ble_uuid.h"
+#include "bleprph.h"
+
+/**
+ * The vendor specific security test service consists of two characteristics:
+ *     o random-number-generator: generates a random 32-bit number each time
+ *       it is read.  This characteristic can only be read over an encrypted
+ *       connection.
+ *     o static-value: a single-byte characteristic that can always be read,
+ *       but can only be written over an encrypted connection.
+ */
+
+/* 59462f12-9543-9999-12c8-58b459a2712d */
+static const ble_uuid128_t gatt_svr_svc_sec_test_uuid =
+    BLE_UUID128_INIT(0x2d, 0x71, 0xa2, 0x59, 0xb4, 0x58, 0xc8, 0x12,
+                     0x99, 0x99, 0x43, 0x95, 0x12, 0x2f, 0x46, 0x59);
+
+/* 5c3a659e-897e-45e1-b016-007107c96df6 */
+static const ble_uuid128_t gatt_svr_chr_sec_test_rand_uuid =
+        BLE_UUID128_INIT(0xf6, 0x6d, 0xc9, 0x07, 0x71, 0x00, 0x16, 0xb0,
+                         0xe1, 0x45, 0x7e, 0x89, 0x9e, 0x65, 0x3a, 0x5c);
+
+/* 5c3a659e-897e-45e1-b016-007107c96df7 */
+static const ble_uuid128_t gatt_svr_chr_sec_test_static_uuid =
+        BLE_UUID128_INIT(0xf7, 0x6d, 0xc9, 0x07, 0x71, 0x00, 0x16, 0xb0,
+                         0xe1, 0x45, 0x7e, 0x89, 0x9e, 0x65, 0x3a, 0x5c);
+
+static uint8_t gatt_svr_sec_test_static_val;
+
+static int
+gatt_svr_chr_access_sec_test(uint16_t conn_handle, uint16_t attr_handle,
+                             struct ble_gatt_access_ctxt *ctxt,
+                             void *arg);
+
+static const struct ble_gatt_svc_def gatt_svr_svcs[] = {
+    {
+        /*** Service: Security test. */
+        .type = BLE_GATT_SVC_TYPE_PRIMARY,
+        .uuid = &gatt_svr_svc_sec_test_uuid.u,
+        .characteristics = (struct ble_gatt_chr_def[]) { {
+            /*** Characteristic: Random number generator. */
+            .uuid = &gatt_svr_chr_sec_test_rand_uuid.u,
+            .access_cb = gatt_svr_chr_access_sec_test,
+            .flags = BLE_GATT_CHR_F_READ | BLE_GATT_CHR_F_READ_ENC,
+        }, {
+            /*** Characteristic: Static value. */
+            .uuid = &gatt_svr_chr_sec_test_static_uuid.u,
+            .access_cb = gatt_svr_chr_access_sec_test,
+            .flags = BLE_GATT_CHR_F_READ |
+                     BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_WRITE_ENC,
+        }, {
+            0, /* No more characteristics in this service. */
+        } },
+    },
+
+    {
+        0, /* No more services. */
+    },
+};
+
+static int
+gatt_svr_chr_write(struct os_mbuf *om, uint16_t min_len, uint16_t max_len,
+                   void *dst, uint16_t *len)
+{
+    uint16_t om_len;
+    int rc;
+
+    om_len = OS_MBUF_PKTLEN(om);
+    if (om_len < min_len || om_len > max_len) {
+        return BLE_ATT_ERR_INVALID_ATTR_VALUE_LEN;
+    }
+
+    rc = ble_hs_mbuf_to_flat(om, dst, max_len, len);
+    if (rc != 0) {
+        return BLE_ATT_ERR_UNLIKELY;
+    }
+
+    return 0;
+}
+
+static int
+gatt_svr_chr_access_sec_test(uint16_t conn_handle, uint16_t attr_handle,
+                             struct ble_gatt_access_ctxt *ctxt,
+                             void *arg)
+{
+    const ble_uuid_t *uuid;
+    int rand_num;
+    int rc;
+
+    uuid = ctxt->chr->uuid;
+
+    /* Determine which characteristic is being accessed by examining its
+     * 128-bit UUID.
+     */
+
+    if (ble_uuid_cmp(uuid, &gatt_svr_chr_sec_test_rand_uuid.u) == 0) {
+        assert(ctxt->op == BLE_GATT_ACCESS_OP_READ_CHR);
+
+        /* Respond with a 32-bit random number. */
+        rand_num = rand();
+        rc = os_mbuf_append(ctxt->om, &rand_num, sizeof rand_num);
+        return rc == 0 ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES;
+    }
+
+    if (ble_uuid_cmp(uuid, &gatt_svr_chr_sec_test_static_uuid.u) == 0) {
+        switch (ctxt->op) {
+        case BLE_GATT_ACCESS_OP_READ_CHR:
+            rc = os_mbuf_append(ctxt->om, &gatt_svr_sec_test_static_val,
+                                sizeof gatt_svr_sec_test_static_val);
+            return rc == 0 ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES;
+
+        case BLE_GATT_ACCESS_OP_WRITE_CHR:
+            rc = gatt_svr_chr_write(ctxt->om,
+                                    sizeof gatt_svr_sec_test_static_val,
+                                    sizeof gatt_svr_sec_test_static_val,
+                                    &gatt_svr_sec_test_static_val, NULL);
+            return rc;
+
+        default:
+            assert(0);
+            return BLE_ATT_ERR_UNLIKELY;
+        }
+    }
+
+    /* Unknown characteristic; the nimble stack should not have called this
+     * function.
+     */
+    assert(0);
+    return BLE_ATT_ERR_UNLIKELY;
+}
+
+void
+gatt_svr_register_cb(struct ble_gatt_register_ctxt *ctxt, void *arg)
+{
+    char buf[BLE_UUID_STR_LEN];
+
+    switch (ctxt->op) {
+    case BLE_GATT_REGISTER_OP_SVC:
+        BLEPRPH_LOG(DEBUG, "registered service %s with handle=%d\n",
+                    ble_uuid_to_str(ctxt->svc.svc_def->uuid, buf),
+                    ctxt->svc.handle);
+        break;
+
+    case BLE_GATT_REGISTER_OP_CHR:
+        BLEPRPH_LOG(DEBUG, "registering characteristic %s with "
+                           "def_handle=%d val_handle=%d\n",
+                    ble_uuid_to_str(ctxt->chr.chr_def->uuid, buf),
+                    ctxt->chr.def_handle,
+                    ctxt->chr.val_handle);
+        break;
+
+    case BLE_GATT_REGISTER_OP_DSC:
+        BLEPRPH_LOG(DEBUG, "registering descriptor %s with handle=%d\n",
+                    ble_uuid_to_str(ctxt->dsc.dsc_def->uuid, buf),
+                    ctxt->dsc.handle);
+        break;
+
+    default:
+        assert(0);
+        break;
+    }
+}
+
+int
+gatt_svr_init(void)
+{
+    int rc;
+
+    rc = ble_gatts_count_cfg(gatt_svr_svcs);
+    if (rc != 0) {
+        return rc;
+    }
+
+    rc = ble_gatts_add_svcs(gatt_svr_svcs);
+    if (rc != 0) {
+        return rc;
+    }
+
+    return 0;
+}
diff --git a/apps/bleprph-emspi/src/main.c b/apps/bleprph-emspi/src/main.c
new file mode 100755
index 000000000..82c834c72
--- /dev/null
+++ b/apps/bleprph-emspi/src/main.c
@@ -0,0 +1,346 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <assert.h>
+#include <string.h>
+#include <stdio.h>
+#include <errno.h>
+#include "sysinit/sysinit.h"
+#include "bsp/bsp.h"
+#include "os/os.h"
+#include "bsp/bsp.h"
+#include "hal/hal_gpio.h"
+#include "console/console.h"
+#include "hal/hal_system.h"
+#include "config/config.h"
+#include "split/split.h"
+
+/* BLE */
+#include "nimble/ble.h"
+#include "host/ble_hs.h"
+#include "services/gap/ble_svc_gap.h"
+
+/* Application-specified header. */
+#include "bleprph.h"
+
+/** Log data. */
+struct log bleprph_log;
+
+static int bleprph_gap_event(struct ble_gap_event *event, void *arg);
+
+/**
+ * Logs information about a connection to the console.
+ */
+static void
+bleprph_print_conn_desc(struct ble_gap_conn_desc *desc)
+{
+    BLEPRPH_LOG(INFO, "handle=%d our_ota_addr_type=%d our_ota_addr=",
+                desc->conn_handle, desc->our_ota_addr.type);
+    print_addr(desc->our_ota_addr.val);
+    BLEPRPH_LOG(INFO, " our_id_addr_type=%d our_id_addr=",
+                desc->our_id_addr.type);
+    print_addr(desc->our_id_addr.val);
+    BLEPRPH_LOG(INFO, " peer_ota_addr_type=%d peer_ota_addr=",
+                desc->peer_ota_addr.type);
+    print_addr(desc->peer_ota_addr.val);
+    BLEPRPH_LOG(INFO, " peer_id_addr_type=%d peer_id_addr=",
+                desc->peer_id_addr.type);
+    print_addr(desc->peer_id_addr.val);
+    BLEPRPH_LOG(INFO, " conn_itvl=%d conn_latency=%d supervision_timeout=%d "
+                "encrypted=%d authenticated=%d bonded=%d\n",
+                desc->conn_itvl, desc->conn_latency,
+                desc->supervision_timeout,
+                desc->sec_state.encrypted,
+                desc->sec_state.authenticated,
+                desc->sec_state.bonded);
+}
+
+/**
+ * Enables advertising with the following parameters:
+ *     o General discoverable mode.
+ *     o Undirected connectable mode.
+ */
+static void
+bleprph_advertise(void)
+{
+    struct ble_gap_adv_params adv_params;
+    struct ble_hs_adv_fields fields;
+    const char *name;
+    int rc;
+
+    /**
+     *  Set the advertisement data included in our advertisements:
+     *     o Flags (indicates advertisement type and other general info).
+     *     o Advertising tx power.
+     *     o Device name.
+     *     o 16-bit service UUIDs (alert notifications).
+     */
+
+    memset(&fields, 0, sizeof fields);
+
+    /* Advertise two flags:
+     *     o Discoverability in forthcoming advertisement (general)
+     *     o BLE-only (BR/EDR unsupported).
+     */
+    fields.flags = BLE_HS_ADV_F_DISC_GEN |
+                   BLE_HS_ADV_F_BREDR_UNSUP;
+
+    /* Indicate that the TX power level field should be included; have the
+     * stack fill this value automatically.  This is done by assiging the
+     * special value BLE_HS_ADV_TX_PWR_LVL_AUTO.
+     */
+    fields.tx_pwr_lvl_is_present = 1;
+    fields.tx_pwr_lvl = BLE_HS_ADV_TX_PWR_LVL_AUTO;
+
+    name = ble_svc_gap_device_name();
+    fields.name = (uint8_t *)name;
+    fields.name_len = strlen(name);
+    fields.name_is_complete = 1;
+
+    fields.uuids16 = (ble_uuid16_t[]){
+        BLE_UUID16_INIT(GATT_SVR_SVC_ALERT_UUID)
+    };
+    fields.num_uuids16 = 1;
+    fields.uuids16_is_complete = 1;
+
+    rc = ble_gap_adv_set_fields(&fields);
+    if (rc != 0) {
+        BLEPRPH_LOG(ERROR, "error setting advertisement data; rc=%d\n", rc);
+        return;
+    }
+
+    /* Begin advertising. */
+    memset(&adv_params, 0, sizeof adv_params);
+    adv_params.conn_mode = BLE_GAP_CONN_MODE_UND;
+    adv_params.disc_mode = BLE_GAP_DISC_MODE_GEN;
+    rc = ble_gap_adv_start(BLE_OWN_ADDR_PUBLIC, NULL, BLE_HS_FOREVER,
+                           &adv_params, bleprph_gap_event, NULL);
+    if (rc != 0) {
+        BLEPRPH_LOG(ERROR, "error enabling advertisement; rc=%d\n", rc);
+        return;
+    }
+}
+
+/**
+ * The nimble host executes this callback when a GAP event occurs.  The
+ * application associates a GAP event callback with each connection that forms.
+ * bleprph uses the same callback for all connections.
+ *
+ * @param event                 The type of event being signalled.
+ * @param ctxt                  Various information pertaining to the event.
+ * @param arg                   Application-specified argument; unuesd by
+ *                                  bleprph.
+ *
+ * @return                      0 if the application successfully handled the
+ *                                  event; nonzero on failure.  The semantics
+ *                                  of the return code is specific to the
+ *                                  particular GAP event being signalled.
+ */
+static int
+bleprph_gap_event(struct ble_gap_event *event, void *arg)
+{
+    struct ble_gap_conn_desc desc;
+    int rc;
+
+    switch (event->type) {
+    case BLE_GAP_EVENT_CONNECT:
+        /* A new connection was established or a connection attempt failed. */
+        BLEPRPH_LOG(INFO, "connection %s; status=%d ",
+                       event->connect.status == 0 ? "established" : "failed",
+                       event->connect.status);
+        if (event->connect.status == 0) {
+            rc = ble_gap_conn_find(event->connect.conn_handle, &desc);
+            assert(rc == 0);
+            bleprph_print_conn_desc(&desc);
+
+#if MYNEWT_VAL(BLEPRPH_LE_PHY_SUPPORT)
+            phy_conn_changed(event->connect.conn_handle);
+#endif
+        }
+        BLEPRPH_LOG(INFO, "\n");
+
+        if (event->connect.status != 0) {
+            /* Connection failed; resume advertising. */
+            bleprph_advertise();
+        }
+        return 0;
+
+    case BLE_GAP_EVENT_DISCONNECT:
+        BLEPRPH_LOG(INFO, "disconnect; reason=%d ", event->disconnect.reason);
+        bleprph_print_conn_desc(&event->disconnect.conn);
+        BLEPRPH_LOG(INFO, "\n");
+
+#if MYNEWT_VAL(BLEPRPH_LE_PHY_SUPPORT)
+        phy_conn_changed(CONN_HANDLE_INVALID);
+#endif
+
+        /* Connection terminated; resume advertising. */
+        bleprph_advertise();
+        return 0;
+
+    case BLE_GAP_EVENT_CONN_UPDATE:
+        /* The central has updated the connection parameters. */
+        BLEPRPH_LOG(INFO, "connection updated; status=%d ",
+                    event->conn_update.status);
+        rc = ble_gap_conn_find(event->connect.conn_handle, &desc);
+        assert(rc == 0);
+        bleprph_print_conn_desc(&desc);
+        BLEPRPH_LOG(INFO, "\n");
+        return 0;
+
+    case BLE_GAP_EVENT_ADV_COMPLETE:
+        BLEPRPH_LOG(INFO, "advertise complete; reason=%d",
+                    event->adv_complete.reason);
+        bleprph_advertise();
+        return 0;
+
+    case BLE_GAP_EVENT_ENC_CHANGE:
+        /* Encryption has been enabled or disabled for this connection. */
+        BLEPRPH_LOG(INFO, "encryption change event; status=%d ",
+                    event->enc_change.status);
+        rc = ble_gap_conn_find(event->connect.conn_handle, &desc);
+        assert(rc == 0);
+        bleprph_print_conn_desc(&desc);
+        BLEPRPH_LOG(INFO, "\n");
+        return 0;
+
+    case BLE_GAP_EVENT_SUBSCRIBE:
+        BLEPRPH_LOG(INFO, "subscribe event; conn_handle=%d attr_handle=%d "
+                          "reason=%d prevn=%d curn=%d previ=%d curi=%d\n",
+                    event->subscribe.conn_handle,
+                    event->subscribe.attr_handle,
+                    event->subscribe.reason,
+                    event->subscribe.prev_notify,
+                    event->subscribe.cur_notify,
+                    event->subscribe.prev_indicate,
+                    event->subscribe.cur_indicate);
+        return 0;
+
+    case BLE_GAP_EVENT_MTU:
+        BLEPRPH_LOG(INFO, "mtu update event; conn_handle=%d cid=%d mtu=%d\n",
+                    event->mtu.conn_handle,
+                    event->mtu.channel_id,
+                    event->mtu.value);
+        return 0;
+
+    case BLE_GAP_EVENT_REPEAT_PAIRING:
+        /* We already have a bond with the peer, but it is attempting to
+         * establish a new secure link.  This app sacrifices security for
+         * convenience: just throw away the old bond and accept the new link.
+         */
+
+        /* Delete the old bond. */
+        rc = ble_gap_conn_find(event->repeat_pairing.conn_handle, &desc);
+        assert(rc == 0);
+        ble_store_util_delete_peer(&desc.peer_id_addr);
+
+        /* Return BLE_GAP_REPEAT_PAIRING_RETRY to indicate that the host should
+         * continue with the pairing operation.
+         */
+        return BLE_GAP_REPEAT_PAIRING_RETRY;
+
+#if MYNEWT_VAL(BLEPRPH_LE_PHY_SUPPORT)
+    case BLE_GAP_EVENT_PHY_UPDATE_COMPLETE:
+        /* XXX: assume symmetric phy for now */
+        phy_update(event->phy_updated.tx_phy);
+        return 0;
+#endif
+    }
+
+    return 0;
+}
+
+static void
+bleprph_on_reset(int reason)
+{
+    BLEPRPH_LOG(ERROR, "Resetting state; reason=%d\n", reason);
+}
+
+static void
+bleprph_on_sync(void)
+{
+    /* Begin advertising. */
+    bleprph_advertise();
+}
+
+/**
+ * main
+ *
+ * The main task for the project. This function initializes the packages,
+ * then starts serving events from default event queue.
+ *
+ * @return int NOTE: this function should never return!
+ */
+int
+main(void)
+{
+    int rc;
+
+    /* Set initial BLE device address. */
+    //memcpy(g_dev_addr, (uint8_t[6]){0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a}, 6);
+
+    /* Initialize OS */
+    sysinit();
+
+    /* Initialize the bleprph log. */
+    log_register("bleprph", &bleprph_log, &log_console_handler, NULL,
+                 LOG_SYSLEVEL);
+
+    /* Initialize the NimBLE host configuration. */
+    log_register("ble_hs", &ble_hs_log, &log_console_handler, NULL,
+                 LOG_SYSLEVEL);
+    ble_hs_cfg.reset_cb = bleprph_on_reset;
+    ble_hs_cfg.sync_cb = bleprph_on_sync;
+    ble_hs_cfg.gatts_register_cb = gatt_svr_register_cb;
+    ble_hs_cfg.store_status_cb = ble_store_util_status_rr;
+
+    rc = gatt_svr_init();
+    assert(rc == 0);
+
+    /* Set the default device name. */
+    rc = ble_svc_gap_device_name_set("bleprph-emspi");
+    assert(rc == 0);
+
+#if MYNEWT_VAL(BLEPRPH_LE_PHY_SUPPORT)
+    phy_init();
+#endif
+
+    conf_load();
+
+    /* If this app is acting as the loader in a split image setup, jump into
+     * the second stage application instead of starting the OS.
+     */
+#if MYNEWT_VAL(SPLIT_LOADER)
+    {
+        void *entry;
+        rc = split_app_go(&entry, true);
+        if (rc == 0) {
+            hal_system_start(entry);
+        }
+    }
+#endif
+
+    /*
+     * As the last thing, process events from default event queue.
+     */
+    while (1) {
+        os_eventq_run(os_eventq_dflt_get());
+    }
+    return 0;
+}
diff --git a/apps/bleprph-emspi/src/misc.c b/apps/bleprph-emspi/src/misc.c
new file mode 100644
index 000000000..8ec785e51
--- /dev/null
+++ b/apps/bleprph-emspi/src/misc.c
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "bleprph.h"
+
+/**
+ * Utility function to log an array of bytes.
+ */
+void
+print_bytes(const uint8_t *bytes, int len)
+{
+    int i;
+
+    for (i = 0; i < len; i++) {
+        BLEPRPH_LOG(INFO, "%s0x%02x", i != 0 ? ":" : "", bytes[i]);
+    }
+}
+
+void
+print_addr(const void *addr)
+{
+    const uint8_t *u8p;
+
+    u8p = addr;
+    BLEPRPH_LOG(INFO, "%02x:%02x:%02x:%02x:%02x:%02x",
+                u8p[5], u8p[4], u8p[3], u8p[2], u8p[1], u8p[0]);
+}
diff --git a/apps/bleprph-emspi/src/phy.c b/apps/bleprph-emspi/src/phy.c
new file mode 100755
index 000000000..55c367ea3
--- /dev/null
+++ b/apps/bleprph-emspi/src/phy.c
@@ -0,0 +1,129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "bsp/bsp.h"
+#include "hal/hal_gpio.h"
+#include "host/ble_gap.h"
+#include "os/os_eventq.h"
+#include "syscfg/syscfg.h"
+#include "bleprph.h"
+
+#if MYNEWT_VAL(BLEPRPH_LE_PHY_SUPPORT)
+
+static const int button_gpio[4] = MYNEWT_VAL(BLEPRPH_LE_PHY_BUTTON_GPIO);
+static const int led_gpio[3] = MYNEWT_VAL(BLEPRPH_LE_PHY_LED_GPIO);
+
+#define PHY_TO_PTR(_mask, _opts) (void *)(((_opts) << 16) | ((_mask)))
+#define PTR_TO_PHY_MASK(_ptr) (uint8_t)(((int)_ptr) & 0x0ff)
+#define PTR_TO_PHY_OPTS(_ptr) (uint8_t)(((int)_ptr) >> 16)
+
+static struct os_event gpio_event;
+
+static uint16_t conn_handle = CONN_HANDLE_INVALID;
+
+static void
+gpio_irq_handler(void *arg)
+{
+    gpio_event.ev_arg = arg;
+    os_eventq_put(os_eventq_dflt_get(), &gpio_event);
+}
+
+static void
+gpio_event_handler(struct os_event *ev)
+{
+    uint8_t phy_mask;
+    uint8_t phy_opts;
+    int sr;
+
+    OS_ENTER_CRITICAL(sr);
+    phy_mask = PTR_TO_PHY_MASK(ev->ev_arg);
+    phy_opts = PTR_TO_PHY_OPTS(ev->ev_arg);
+    OS_EXIT_CRITICAL(sr);
+
+    if (conn_handle != CONN_HANDLE_INVALID) {
+        ble_gap_set_prefered_le_phy(conn_handle, phy_mask, phy_mask, phy_opts);
+    }
+}
+
+static void
+setup_button_gpio(int button, uint8_t phy_mask, uint8_t phy_opts)
+{
+    if (button < 0) {
+        return;
+    }
+
+    hal_gpio_irq_init(button, gpio_irq_handler, PHY_TO_PTR(phy_mask, phy_opts),
+                      HAL_GPIO_TRIG_FALLING, HAL_GPIO_PULL_UP);
+    hal_gpio_irq_enable(button);
+}
+
+void
+phy_init(void)
+{
+    gpio_event.ev_cb = gpio_event_handler;
+
+    /*
+     * XXX: we could make this configurable, but for now assume all pins are
+     * valid, buttons gpio pins are pulled-up and LEDs are active-low - this
+     * is valid for nRF52840 PDK.
+     */
+    setup_button_gpio(button_gpio[0], BLE_GAP_LE_PHY_1M_MASK,
+                      BLE_GAP_LE_PHY_CODED_ANY);
+    setup_button_gpio(button_gpio[1], BLE_GAP_LE_PHY_2M_MASK,
+                      BLE_GAP_LE_PHY_CODED_ANY);
+    setup_button_gpio(button_gpio[2], BLE_GAP_LE_PHY_CODED_MASK,
+                      BLE_GAP_LE_PHY_CODED_S2);
+    setup_button_gpio(button_gpio[3], BLE_GAP_LE_PHY_CODED_MASK,
+                      BLE_GAP_LE_PHY_CODED_S8);
+
+    hal_gpio_init_out(led_gpio[0], 1);
+    hal_gpio_init_out(led_gpio[1], 1);
+    hal_gpio_init_out(led_gpio[2], 1);
+}
+
+void
+phy_conn_changed(uint16_t handle)
+{
+    uint8_t phy = 0;
+
+    conn_handle = handle;
+
+    if (handle != CONN_HANDLE_INVALID) {
+        /* XXX: assume symmetric phy for now */
+        ble_gap_read_le_phy(handle, &phy, &phy);
+    }
+
+    phy_update(phy);
+}
+
+void
+phy_update(uint8_t phy)
+{
+    if (conn_handle == CONN_HANDLE_INVALID) {
+        hal_gpio_write(led_gpio[0], 1);
+        hal_gpio_write(led_gpio[1], 1);
+        hal_gpio_write(led_gpio[2], 1);
+    } else {
+        hal_gpio_write(led_gpio[0], !(phy == BLE_GAP_LE_PHY_1M));
+        hal_gpio_write(led_gpio[1], !(phy == BLE_GAP_LE_PHY_2M));
+        hal_gpio_write(led_gpio[2], !(phy == BLE_GAP_LE_PHY_CODED));
+    }
+}
+
+#endif
diff --git a/apps/bleprph-emspi/syscfg.yml b/apps/bleprph-emspi/syscfg.yml
new file mode 100644
index 000000000..ec1ee64eb
--- /dev/null
+++ b/apps/bleprph-emspi/syscfg.yml
@@ -0,0 +1,65 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# Package: apps/bleprph
+
+syscfg.defs:
+    BLEPRPH_LE_PHY_SUPPORT:
+        description: >
+            Enable support for changing PHY preference on active connection.
+            PHY preference change is triggered by configured GPIO pins.
+            Current PHY is indicated using LEDs connected to configured
+            GPIO pins.
+        value: 0
+    BLEPRPH_LE_PHY_BUTTON_GPIO:
+        description: >
+            GPIO pins for changing PHY preference on active connection. This
+            is an array of 4 GPIO pin numbers for 1M, 2M, LE Coded S=2 and
+            LE Coded S=8 respectively.
+        value: "(int[]){ BUTTON_1, BUTTON_2, BUTTON_3, BUTTON_4 }"
+    BLEPRPH_LE_PHY_LED_GPIO:
+        description: >
+            GPIO pins for indicating current PHY on active connection. This
+            is an array of 3 GPIO pin numbers for 1M, 2M and LE Coded
+            respectively.
+        value: "(int[]){ LED_1, LED_2, LED_3 }"
+
+syscfg.vals:
+    # Disable central and observer roles.
+    BLE_ROLE_BROADCASTER: 1
+    BLE_ROLE_CENTRAL: 0
+    BLE_ROLE_OBSERVER: 0
+    BLE_ROLE_PERIPHERAL: 1
+
+    # Log reboot messages to a flash circular buffer.
+    REBOOT_LOG_FCB: 1
+    LOG_FCB: 1
+    CONFIG_FCB: 1
+
+    # Enable newtmgr commands.
+    STATS_NEWTMGR: 1
+    LOG_NEWTMGR: 1
+    CONFIG_NEWTMGR: 1
+
+    # OS main/default task
+    OS_MAIN_STACK_SIZE: 468
+
+    # Lots of smaller mbufs are required for newtmgr using typical BLE ATT MTU
+    # values.
+    MSYS_1_BLOCK_COUNT: 22
+    MSYS_1_BLOCK_SIZE: 110
diff --git a/hw/bsp/apollo2_evb/apollo2.ld b/hw/bsp/apollo2_evb/apollo2.ld
new file mode 100755
index 000000000..1090ccde3
--- /dev/null
+++ b/hw/bsp/apollo2_evb/apollo2.ld
@@ -0,0 +1,25 @@
+/* Linker script for Nordic Semiconductor nRF5 devices
+ *
+ * Version: Sourcery G++ 4.5-1
+ * Support: https://support.codesourcery.com/GNUToolchain/
+ *
+ * Copyright (c) 2007, 2008, 2009, 2010 CodeSourcery, Inc.
+ *
+ * The authors hereby grant permission to use, copy, modify, distribute,
+ * and license this software and its documentation for any purpose, provided
+ * that existing copyright notices are retained in all copies and that this
+ * notice is included verbatim in any distributions.  No written agreement,
+ * license, or royalty fee is required for any of the authorized uses.
+ * Modifications to this software may be copyrighted by their authors
+ * and need not follow the licensing terms described here, provided that
+ * the new terms are clearly indicated on the first page of each file where
+ * they apply.
+ */
+MEMORY
+{
+  FLASH (rx) : ORIGIN = 0x00008000, LENGTH = 0x3a000
+  RAM (rwx) : ORIGIN = 0x10000000, LENGTH = 0x40000
+}
+
+/* This linker script is used for images and thus contains an image header */
+_imghdr_size = 0x20;
diff --git a/hw/bsp/apollo2_evb/apollo2_evb_debug.sh b/hw/bsp/apollo2_evb/apollo2_evb_debug.sh
new file mode 100755
index 000000000..7d99ddecf
--- /dev/null
+++ b/hw/bsp/apollo2_evb/apollo2_evb_debug.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# Called with following variables set:
+#  - CORE_PATH is absolute path to @apache-mynewt-core
+#  - BSP_PATH is absolute path to hw/bsp/bsp_name
+#  - BIN_BASENAME is the path to prefix to target binary,
+#    .elf appended to name is the ELF file
+#  - FEATURES holds the target features string
+#  - EXTRA_JTAG_CMD holds extra parameters to pass to jtag software
+#  - RESET set if target should be reset when attaching
+#  - NO_GDB set if we should not start gdb to debug
+#
+
+. $CORE_PATH/hw/scripts/jlink.sh
+
+FILE_NAME=$BIN_BASENAME.elf
+
+if [ $# -gt 2 ]; then
+    SPLIT_ELF_NAME=$3.elf
+    # TODO -- this magic number 0x42000 is the location of the second image
+    # slot. we should either get this from a flash map file or somehow learn
+    # this from the image itself
+    EXTRA_GDB_CMDS="add-symbol-file $SPLIT_ELF_NAME 0x8000 -readnow"
+fi
+
+JLINK_DEV="APOLLO2"
+
+jlink_debug
diff --git a/hw/bsp/apollo2_evb/apollo2_evb_download.sh b/hw/bsp/apollo2_evb/apollo2_evb_download.sh
new file mode 100755
index 000000000..48f0bf990
--- /dev/null
+++ b/hw/bsp/apollo2_evb/apollo2_evb_download.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Called with following variables set:
+#  - CORE_PATH is absolute path to @apache-mynewt-core
+#  - BSP_PATH is absolute path to hw/bsp/bsp_name
+#  - BIN_BASENAME is the path to prefix to target binary,
+#    .elf appended to name is the ELF file
+#  - IMAGE_SLOT is the image slot to download to (for non-mfg-image, non-boot)
+#  - FEATURES holds the target features string
+#  - EXTRA_JTAG_CMD holds extra parameters to pass to jtag software
+#  - MFG_IMAGE is "1" if this is a manufacturing image
+#  - FLASH_OFFSET contains the flash offset to download to
+#  - BOOT_LOADER is set if downloading a bootloader
+
+. $CORE_PATH/hw/scripts/jlink.sh
+
+if [ "$MFG_IMAGE" ]; then
+    FLASH_OFFSET=0x0
+fi
+
+JLINK_DEV="APOLLO2"
+
+common_file_to_load
+jlink_load
diff --git a/hw/bsp/apollo2_evb/boot-apollo2.ld b/hw/bsp/apollo2_evb/boot-apollo2.ld
new file mode 100755
index 000000000..6cac33462
--- /dev/null
+++ b/hw/bsp/apollo2_evb/boot-apollo2.ld
@@ -0,0 +1,25 @@
+/* Linker script for Nordic Semiconductor nRF5 devices
+ *
+ * Version: Sourcery G++ 4.5-1
+ * Support: https://support.codesourcery.com/GNUToolchain/
+ *
+ * Copyright (c) 2007, 2008, 2009, 2010 CodeSourcery, Inc.
+ *
+ * The authors hereby grant permission to use, copy, modify, distribute,
+ * and license this software and its documentation for any purpose, provided
+ * that existing copyright notices are retained in all copies and that this
+ * notice is included verbatim in any distributions.  No written agreement,
+ * license, or royalty fee is required for any of the authorized uses.
+ * Modifications to this software may be copyrighted by their authors
+ * and need not follow the licensing terms described here, provided that
+ * the new terms are clearly indicated on the first page of each file where
+ * they apply.
+ */
+MEMORY
+{
+  FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x100000
+  RAM (rwx) : ORIGIN = 0x10000000, LENGTH = 0x40000
+}
+
+/* The bootloader does not contain an image header */
+_imghdr_size = 0x0;
diff --git a/hw/bsp/apollo2_evb/bsp.yml b/hw/bsp/apollo2_evb/bsp.yml
new file mode 100644
index 000000000..c3ca996d2
--- /dev/null
+++ b/hw/bsp/apollo2_evb/bsp.yml
@@ -0,0 +1,68 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# Flash sector size: 8 kB.
+
+bsp.arch: cortex_m4
+bsp.compiler: compiler/arm-none-eabi-m4 
+bsp.linkerscript:
+    - "hw/bsp/apollo2_evb/apollo2.ld"
+    - "hw/mcu/ambiq/apollo2/apollo2.ld"
+bsp.linkerscript.BOOT_LOADER.OVERWRITE:
+    - "hw/bsp/apollo2_evb/boot-apollo2.ld"
+    - "hw/mcu/ambiq/apollo2/apollo2.ld"
+bsp.downloadscript: "hw/bsp/apollo2_evb/apollo2_evb_download.sh"
+bsp.debugscript: "hw/bsp/apollo2_evb/apollo2_evb_debug.sh"
+
+bsp.flash_map:
+    areas:
+        # System areas.
+        FLASH_AREA_BOOTLOADER:
+            device: 0
+            offset: 0x00000000
+            size: 16kB
+        FLASH_AREA_IMAGE_0:
+            device: 0
+            offset: 0x00008000
+            size: 224kB
+        FLASH_AREA_IMAGE_1:
+            device: 0
+            offset: 0x00040000
+            size: 224kB
+
+        ###
+        # 12 kB unused flash.
+        ###
+
+        FLASH_AREA_IMAGE_SCRATCH:
+            device: 0
+            offset: 0x0007b000
+            size: 8kB
+
+        # User areas.
+        FLASH_AREA_REBOOT_LOG:
+            user_id: 0
+            device: 0
+            offset: 0x00004000
+            size: 16kB
+        FLASH_AREA_NFFS:
+            user_id: 1
+            device: 0
+            offset: 0x0007d000
+            size: 16kB
diff --git a/hw/bsp/apollo2_evb/include/bsp/apollo_nvic.h b/hw/bsp/apollo2_evb/include/bsp/apollo_nvic.h
new file mode 100644
index 000000000..d10bbc485
--- /dev/null
+++ b/hw/bsp/apollo2_evb/include/bsp/apollo_nvic.h
@@ -0,0 +1,324 @@
+//*****************************************************************************
+//
+//! @file am_reg_nvic.h
+//!
+//! @brief Register macros for the NVIC module
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_REG_NVIC_H
+#define AM_REG_NVIC_H
+
+//*****************************************************************************
+//
+// Instance finder. (1 instance(s) available)
+//
+//*****************************************************************************
+#define AM_REG_NVIC_NUM_MODULES                      1
+#define AM_REG_NVICn(n) \
+    (REG_NVIC_BASEADDR + 0x00000000 * n)
+
+//*****************************************************************************
+//
+// Register offsets.
+//
+//*****************************************************************************
+#define AM_REG_NVIC_ISER0_O                          0xE000E100
+#define AM_REG_NVIC_ICER0_O                          0xE000E180
+#define AM_REG_NVIC_ISPR0_O                          0xE000E200
+#define AM_REG_NVIC_ICPR0_O                          0xE000E280
+#define AM_REG_NVIC_IABR0_O                          0xE000E300
+#define AM_REG_NVIC_IPR0_O                           0xE000E400
+#define AM_REG_NVIC_IPR1_O                           0xE000E404
+#define AM_REG_NVIC_IPR2_O                           0xE000E408
+#define AM_REG_NVIC_IPR3_O                           0xE000E40C
+#define AM_REG_NVIC_IPR4_O                           0xE000E410
+#define AM_REG_NVIC_IPR5_O                           0xE000E414
+#define AM_REG_NVIC_IPR6_O                           0xE000E418
+#define AM_REG_NVIC_IPR7_O                           0xE000E41C
+
+//*****************************************************************************
+//
+// NVIC_ISER0 - Interrupt Set-Enable Register 0
+//
+//*****************************************************************************
+// NVIC_ISERn[31:0] are the set-enable bits for interrupts 31 through 0.
+#define AM_REG_NVIC_ISER0_BITS_S                     0
+#define AM_REG_NVIC_ISER0_BITS_M                     0xFFFFFFFF
+#define AM_REG_NVIC_ISER0_BITS(n)                    (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// NVIC_ICER0 - Interrupt Clear-Enable Register 0
+//
+//*****************************************************************************
+// NVIC_ISERn[31:0] are the clear-enable bits for interrupts 31 through 0.
+#define AM_REG_NVIC_ICER0_BITS_S                     0
+#define AM_REG_NVIC_ICER0_BITS_M                     0xFFFFFFFF
+#define AM_REG_NVIC_ICER0_BITS(n)                    (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// NVIC_ISPR0 - Interrupt Set-Pending Register 0
+//
+//*****************************************************************************
+// NVIC_ISERn[31:0] are the set-pending bits for interrupts 31 through 0.
+#define AM_REG_NVIC_ISPR0_BITS_S                     0
+#define AM_REG_NVIC_ISPR0_BITS_M                     0xFFFFFFFF
+#define AM_REG_NVIC_ISPR0_BITS(n)                    (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// NVIC_ICPR0 - Interrupt Clear-Pending Register 0
+//
+//*****************************************************************************
+// NVIC_ISERn[31:0] are the clear-pending bits for interrupts 31 through 0.
+#define AM_REG_NVIC_ICPR0_BITS_S                     0
+#define AM_REG_NVIC_ICPR0_BITS_M                     0xFFFFFFFF
+#define AM_REG_NVIC_ICPR0_BITS(n)                    (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// NVIC_IABR0 - Interrupt Active Bit Register 0
+//
+//*****************************************************************************
+// NVIC_ISERn[31:0] are the interrupt active bits for interrupts 31 through 0.
+#define AM_REG_NVIC_IABR0_BITS_S                     0
+#define AM_REG_NVIC_IABR0_BITS_M                     0xFFFFFFFF
+#define AM_REG_NVIC_IABR0_BITS(n)                    (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// NVIC_IPR0 - Interrupt Priority Register 0
+//
+//*****************************************************************************
+// Priority assignment for interrupt vector 3.
+#define AM_REG_NVIC_IPR0_PRI_N3_S                    24
+#define AM_REG_NVIC_IPR0_PRI_N3_M                    0xFF000000
+#define AM_REG_NVIC_IPR0_PRI_N3(n)                   (((uint32_t)(n) << 24) & 0xFF000000)
+
+// Priority assignment for interrupt vector 2.
+#define AM_REG_NVIC_IPR0_PRI_N2_S                    16
+#define AM_REG_NVIC_IPR0_PRI_N2_M                    0x00FF0000
+#define AM_REG_NVIC_IPR0_PRI_N2(n)                   (((uint32_t)(n) << 16) & 0x00FF0000)
+
+// Priority assignment for interrupt vector 1.
+#define AM_REG_NVIC_IPR0_PRI_N1_S                    8
+#define AM_REG_NVIC_IPR0_PRI_N1_M                    0x0000FF00
+#define AM_REG_NVIC_IPR0_PRI_N1(n)                   (((uint32_t)(n) << 8) & 0x0000FF00)
+
+// Priority assignment for interrupt vector 0.
+#define AM_REG_NVIC_IPR0_PRI_N0_S                    0
+#define AM_REG_NVIC_IPR0_PRI_N0_M                    0x000000FF
+#define AM_REG_NVIC_IPR0_PRI_N0(n)                   (((uint32_t)(n) << 0) & 0x000000FF)
+
+//*****************************************************************************
+//
+// NVIC_IPR1 - Interrupt Priority Register 1
+//
+//*****************************************************************************
+// Priority assignment for interrupt vector 7.
+#define AM_REG_NVIC_IPR1_PRI_N3_S                    24
+#define AM_REG_NVIC_IPR1_PRI_N3_M                    0xFF000000
+#define AM_REG_NVIC_IPR1_PRI_N3(n)                   (((uint32_t)(n) << 24) & 0xFF000000)
+
+// Priority assignment for interrupt vector 6.
+#define AM_REG_NVIC_IPR1_PRI_N2_S                    16
+#define AM_REG_NVIC_IPR1_PRI_N2_M                    0x00FF0000
+#define AM_REG_NVIC_IPR1_PRI_N2(n)                   (((uint32_t)(n) << 16) & 0x00FF0000)
+
+// Priority assignment for interrupt vector 5.
+#define AM_REG_NVIC_IPR1_PRI_N1_S                    8
+#define AM_REG_NVIC_IPR1_PRI_N1_M                    0x0000FF00
+#define AM_REG_NVIC_IPR1_PRI_N1(n)                   (((uint32_t)(n) << 8) & 0x0000FF00)
+
+// Priority assignment for interrupt vector 4.
+#define AM_REG_NVIC_IPR1_PRI_N0_S                    0
+#define AM_REG_NVIC_IPR1_PRI_N0_M                    0x000000FF
+#define AM_REG_NVIC_IPR1_PRI_N0(n)                   (((uint32_t)(n) << 0) & 0x000000FF)
+
+//*****************************************************************************
+//
+// NVIC_IPR2 - Interrupt Priority Register 2
+//
+//*****************************************************************************
+// Priority assignment for interrupt vector 11.
+#define AM_REG_NVIC_IPR2_PRI_N3_S                    24
+#define AM_REG_NVIC_IPR2_PRI_N3_M                    0xFF000000
+#define AM_REG_NVIC_IPR2_PRI_N3(n)                   (((uint32_t)(n) << 24) & 0xFF000000)
+
+// Priority assignment for interrupt vector 10.
+#define AM_REG_NVIC_IPR2_PRI_N2_S                    16
+#define AM_REG_NVIC_IPR2_PRI_N2_M                    0x00FF0000
+#define AM_REG_NVIC_IPR2_PRI_N2(n)                   (((uint32_t)(n) << 16) & 0x00FF0000)
+
+// Priority assignment for interrupt vector 9.
+#define AM_REG_NVIC_IPR2_PRI_N1_S                    8
+#define AM_REG_NVIC_IPR2_PRI_N1_M                    0x0000FF00
+#define AM_REG_NVIC_IPR2_PRI_N1(n)                   (((uint32_t)(n) << 8) & 0x0000FF00)
+
+// Priority assignment for interrupt vector 8.
+#define AM_REG_NVIC_IPR2_PRI_N0_S                    0
+#define AM_REG_NVIC_IPR2_PRI_N0_M                    0x000000FF
+#define AM_REG_NVIC_IPR2_PRI_N0(n)                   (((uint32_t)(n) << 0) & 0x000000FF)
+
+//*****************************************************************************
+//
+// NVIC_IPR3 - Interrupt Priority Register 3
+//
+//*****************************************************************************
+// Priority assignment for interrupt vector 15.
+#define AM_REG_NVIC_IPR3_PRI_N3_S                    24
+#define AM_REG_NVIC_IPR3_PRI_N3_M                    0xFF000000
+#define AM_REG_NVIC_IPR3_PRI_N3(n)                   (((uint32_t)(n) << 24) & 0xFF000000)
+
+// Priority assignment for interrupt vector 14.
+#define AM_REG_NVIC_IPR3_PRI_N2_S                    16
+#define AM_REG_NVIC_IPR3_PRI_N2_M                    0x00FF0000
+#define AM_REG_NVIC_IPR3_PRI_N2(n)                   (((uint32_t)(n) << 16) & 0x00FF0000)
+
+// Priority assignment for interrupt vector 13.
+#define AM_REG_NVIC_IPR3_PRI_N1_S                    8
+#define AM_REG_NVIC_IPR3_PRI_N1_M                    0x0000FF00
+#define AM_REG_NVIC_IPR3_PRI_N1(n)                   (((uint32_t)(n) << 8) & 0x0000FF00)
+
+// Priority assignment for interrupt vector 12.
+#define AM_REG_NVIC_IPR3_PRI_N0_S                    0
+#define AM_REG_NVIC_IPR3_PRI_N0_M                    0x000000FF
+#define AM_REG_NVIC_IPR3_PRI_N0(n)                   (((uint32_t)(n) << 0) & 0x000000FF)
+
+//*****************************************************************************
+//
+// NVIC_IPR4 - Interrupt Priority Register 4
+//
+//*****************************************************************************
+// Priority assignment for interrupt vector 19.
+#define AM_REG_NVIC_IPR4_PRI_N3_S                    24
+#define AM_REG_NVIC_IPR4_PRI_N3_M                    0xFF000000
+#define AM_REG_NVIC_IPR4_PRI_N3(n)                   (((uint32_t)(n) << 24) & 0xFF000000)
+
+// Priority assignment for interrupt vector 18.
+#define AM_REG_NVIC_IPR4_PRI_N2_S                    16
+#define AM_REG_NVIC_IPR4_PRI_N2_M                    0x00FF0000
+#define AM_REG_NVIC_IPR4_PRI_N2(n)                   (((uint32_t)(n) << 16) & 0x00FF0000)
+
+// Priority assignment for interrupt vector 17.
+#define AM_REG_NVIC_IPR4_PRI_N1_S                    8
+#define AM_REG_NVIC_IPR4_PRI_N1_M                    0x0000FF00
+#define AM_REG_NVIC_IPR4_PRI_N1(n)                   (((uint32_t)(n) << 8) & 0x0000FF00)
+
+// Priority assignment for interrupt vector 16.
+#define AM_REG_NVIC_IPR4_PRI_N0_S                    0
+#define AM_REG_NVIC_IPR4_PRI_N0_M                    0x000000FF
+#define AM_REG_NVIC_IPR4_PRI_N0(n)                   (((uint32_t)(n) << 0) & 0x000000FF)
+
+//*****************************************************************************
+//
+// NVIC_IPR5 - Interrupt Priority Register 5
+//
+//*****************************************************************************
+// Priority assignment for interrupt vector 23.
+#define AM_REG_NVIC_IPR5_PRI_N3_S                    24
+#define AM_REG_NVIC_IPR5_PRI_N3_M                    0xFF000000
+#define AM_REG_NVIC_IPR5_PRI_N3(n)                   (((uint32_t)(n) << 24) & 0xFF000000)
+
+// Priority assignment for interrupt vector 22.
+#define AM_REG_NVIC_IPR5_PRI_N2_S                    16
+#define AM_REG_NVIC_IPR5_PRI_N2_M                    0x00FF0000
+#define AM_REG_NVIC_IPR5_PRI_N2(n)                   (((uint32_t)(n) << 16) & 0x00FF0000)
+
+// Priority assignment for interrupt vector 21.
+#define AM_REG_NVIC_IPR5_PRI_N1_S                    8
+#define AM_REG_NVIC_IPR5_PRI_N1_M                    0x0000FF00
+#define AM_REG_NVIC_IPR5_PRI_N1(n)                   (((uint32_t)(n) << 8) & 0x0000FF00)
+
+// Priority assignment for interrupt vector 20.
+#define AM_REG_NVIC_IPR5_PRI_N0_S                    0
+#define AM_REG_NVIC_IPR5_PRI_N0_M                    0x000000FF
+#define AM_REG_NVIC_IPR5_PRI_N0(n)                   (((uint32_t)(n) << 0) & 0x000000FF)
+
+//*****************************************************************************
+//
+// NVIC_IPR6 - Interrupt Priority Register 6
+//
+//*****************************************************************************
+// Priority assignment for interrupt vector 27.
+#define AM_REG_NVIC_IPR6_PRI_N3_S                    24
+#define AM_REG_NVIC_IPR6_PRI_N3_M                    0xFF000000
+#define AM_REG_NVIC_IPR6_PRI_N3(n)                   (((uint32_t)(n) << 24) & 0xFF000000)
+
+// Priority assignment for interrupt vector 26.
+#define AM_REG_NVIC_IPR6_PRI_N2_S                    16
+#define AM_REG_NVIC_IPR6_PRI_N2_M                    0x00FF0000
+#define AM_REG_NVIC_IPR6_PRI_N2(n)                   (((uint32_t)(n) << 16) & 0x00FF0000)
+
+// Priority assignment for interrupt vector 25.
+#define AM_REG_NVIC_IPR6_PRI_N1_S                    8
+#define AM_REG_NVIC_IPR6_PRI_N1_M                    0x0000FF00
+#define AM_REG_NVIC_IPR6_PRI_N1(n)                   (((uint32_t)(n) << 8) & 0x0000FF00)
+
+// Priority assignment for interrupt vector 24.
+#define AM_REG_NVIC_IPR6_PRI_N0_S                    0
+#define AM_REG_NVIC_IPR6_PRI_N0_M                    0x000000FF
+#define AM_REG_NVIC_IPR6_PRI_N0(n)                   (((uint32_t)(n) << 0) & 0x000000FF)
+
+//*****************************************************************************
+//
+// NVIC_IPR7 - Interrupt Priority Register 7
+//
+//*****************************************************************************
+// Priority assignment for interrupt vector 31.
+#define AM_REG_NVIC_IPR7_PRI_N3_S                    24
+#define AM_REG_NVIC_IPR7_PRI_N3_M                    0xFF000000
+#define AM_REG_NVIC_IPR7_PRI_N3(n)                   (((uint32_t)(n) << 24) & 0xFF000000)
+
+// Priority assignment for interrupt vector 30.
+#define AM_REG_NVIC_IPR7_PRI_N2_S                    16
+#define AM_REG_NVIC_IPR7_PRI_N2_M                    0x00FF0000
+#define AM_REG_NVIC_IPR7_PRI_N2(n)                   (((uint32_t)(n) << 16) & 0x00FF0000)
+
+// Priority assignment for interrupt vector 29.
+#define AM_REG_NVIC_IPR7_PRI_N1_S                    8
+#define AM_REG_NVIC_IPR7_PRI_N1_M                    0x0000FF00
+#define AM_REG_NVIC_IPR7_PRI_N1(n)                   (((uint32_t)(n) << 8) & 0x0000FF00)
+
+// Priority assignment for interrupt vector 28.
+#define AM_REG_NVIC_IPR7_PRI_N0_S                    0
+#define AM_REG_NVIC_IPR7_PRI_N0_M                    0x000000FF
+#define AM_REG_NVIC_IPR7_PRI_N0(n)                   (((uint32_t)(n) << 0) & 0x000000FF)
+
+#endif // AM_REG_NVIC_H
diff --git a/hw/bsp/apollo2_evb/include/bsp/bsp.h b/hw/bsp/apollo2_evb/include/bsp/bsp.h
new file mode 100644
index 000000000..0e70e7943
--- /dev/null
+++ b/hw/bsp/apollo2_evb/include/bsp/bsp.h
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+#ifndef H_BSP_H
+#define H_BSP_H
+
+#include <inttypes.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Define special stackos sections */
+#define sec_data_core   __attribute__((section(".data.core")))
+#define sec_bss_core    __attribute__((section(".bss.core")))
+#define sec_bss_nz_core __attribute__((section(".bss.core.nz")))
+
+/* More convenient section placement macros. */
+#define bssnz_t         sec_bss_nz_core
+
+extern uint8_t _ram_start;
+
+#define LED_BLINK_PIN   10
+
+#define RAM_SIZE        (256 * 1024)
+
+/* UART */
+#define UART_CNT        (2)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* H_BSP_H */
diff --git a/hw/bsp/apollo2_evb/include/bsp/bsp_sysid.h b/hw/bsp/apollo2_evb/include/bsp/bsp_sysid.h
new file mode 100644
index 000000000..7b0a24b67
--- /dev/null
+++ b/hw/bsp/apollo2_evb/include/bsp/bsp_sysid.h
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+#ifndef BSP_SYSID_H
+#define BSP_SYSID_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* stub until this BSP gets new HAL */
+enum system_device_id  
+{
+    RESERVED,
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BSP_SYSID_H */
\ No newline at end of file
diff --git a/hw/bsp/apollo2_evb/include/bsp/cmsis_nvic.h b/hw/bsp/apollo2_evb/include/bsp/cmsis_nvic.h
new file mode 100644
index 000000000..1e8fec1d8
--- /dev/null
+++ b/hw/bsp/apollo2_evb/include/bsp/cmsis_nvic.h
@@ -0,0 +1,29 @@
+/* mbed Microcontroller Library - cmsis_nvic
+ * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
+ *
+ * CMSIS-style functionality to support dynamic vectors
+ */
+
+#ifndef MBED_CMSIS_NVIC_H
+#define MBED_CMSIS_NVIC_H
+
+#include <stdint.h>
+
+#define NVIC_NUM_VECTORS      (16 + 26)   // CORE + MCU Peripherals
+#define NVIC_USER_IRQ_OFFSET  16
+
+#include "mcu/apollo2.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void NVIC_Relocate(void);
+void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector);
+uint32_t NVIC_GetVector(IRQn_Type IRQn);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/hw/bsp/apollo2_evb/pkg.yml b/hw/bsp/apollo2_evb/pkg.yml
new file mode 100644
index 000000000..67693b341
--- /dev/null
+++ b/hw/bsp/apollo2_evb/pkg.yml
@@ -0,0 +1,38 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+pkg.name: hw/bsp/apollo2_evb
+pkg.type: bsp
+pkg.description: BSP definition for the Apollo I Evaluation board
+pkg.author: "Apache Mynewt <de...@mynewt.incubator.apache.org>"
+pkg.homepage: "http://mynewt.apache.org/"
+pkg.keywords:
+    - apollo2
+    - ambiq
+    - evaluation
+
+pkg.cflags.HARDFLOAT:
+    - -mfloat-abi=hard -mfpu=fpv4-sp-d16
+
+pkg.deps:
+    - hw/mcu/ambiq/apollo2
+    - libc/baselibc
+
+pkg.deps.UART_0:
+    - hw/drivers/uart/uart_hal
diff --git a/hw/bsp/apollo2_evb/src/arch/cortex_m4/gcc_startup.s b/hw/bsp/apollo2_evb/src/arch/cortex_m4/gcc_startup.s
new file mode 100755
index 000000000..4196dd21b
--- /dev/null
+++ b/hw/bsp/apollo2_evb/src/arch/cortex_m4/gcc_startup.s
@@ -0,0 +1,297 @@
+/*
+Copyright (c) 2015, Nordic Semiconductor ASA
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+  list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+  this list of conditions and the following disclaimer in the documentation
+  and/or other materials provided with the distribution.
+
+* Neither the name of Nordic Semiconductor ASA nor the names of its
+  contributors may be used to endorse or promote products derived from
+  this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/*
+NOTE: Template files (including this one) are application specific and therefore
+expected to be copied into the application project folder prior to its use!
+*/
+
+    .syntax unified
+    .arch armv7-m
+
+    .section .stack
+    .align 3
+    .equ    Stack_Size, 432
+    .globl    __StackTop
+    .globl    __StackLimit
+__StackLimit:
+    .space    Stack_Size
+    .size __StackLimit, . - __StackLimit
+__StackTop:
+    .size __StackTop, . - __StackTop
+
+    .section .heap
+    .align 3
+#ifdef __HEAP_SIZE
+    .equ    Heap_Size, __HEAP_SIZE
+#else
+    .equ    Heap_Size, 0
+#endif
+    .globl    __HeapBase
+    .globl    __HeapLimit
+__HeapBase:
+    .if    Heap_Size
+    .space    Heap_Size
+    .endif
+    .size __HeapBase, . - __HeapBase
+__HeapLimit:
+    .size __HeapLimit, . - __HeapLimit
+
+    .section .isr_vector
+    .align 2
+    .globl __isr_vector
+__isr_vector:
+    .long    __StackTop            /* Top of Stack */
+    .long   Reset_Handler               /* Reset Handler */
+    .long   NMI_Handler                 /* NMI Handler */
+    .long   HardFault_Handler           /* Hard Fault Handler */
+    .long   MemoryManagement_Handler    /* Memory Fault */
+    .long   BusFault_Handler            /* Bus Fault */
+    .long   UsageFault_Handler          /* Usage Fault */
+    .long   0                           /* Reserved */
+    .long   0                           /* Reserved */
+    .long   0                           /* Reserved */
+    .long   0                           /* Reserved */
+    .long   SVC_Handler                 /* SVCall Handler */
+    .long   DebugMon_Handler            /* Debug Monitor */
+    .long   0                           /* Reserved */
+    .long   PendSV_Handler              /* PendSV Handler */
+    .long   SysTick_Handler             /* SysTick Handler */
+
+  /* External Interrupts */
+    .long   BROWNOUT_IRQHandler
+    .long   WATCHDOG_IRQHandler
+    .long   CLKGEN_IRQHandler
+    .long   VCOMP_IRQHandler
+    .long   IOSLAVE_IOS_IRQHandler
+    .long   IOSLAVE_ACC_IRQHandler
+    .long   IOMASTER0_IRQHandler
+    .long   IOMASTER1_IRQHandler
+    .long   IOMASTER2_IRQHandler
+    .long   IOMASTER3_IRQHandler
+    .long   IOMASTER4_IRQHandler
+    .long   IOMASTER5_IRQHandler
+    .long   GPIO_IRQHandler
+    .long   CTIMER_IRQHandler
+    .long   UART0_IRQHandler
+    .long   UART1_IRQHandler
+    .long   ADC_IRQHandler
+    .long   PDM_IRQHandler
+    .long   STIMER_IRQHandler
+    .long   STIMER_CMPR0_IRQHandler
+    .long   STIMER_CMPR1_IRQHandler
+    .long   STIMER_CMPR2_IRQHandler
+    .long   STIMER_CMPR3_IRQHandler
+    .long   STIMER_CMPR4_IRQHandler
+    .long   STIMER_CMPR5_IRQHandler
+    .long   STIMER_CMPR6_IRQHandler
+    .long   STIMER_CMPR7_IRQHandler
+    .long   FLASH_IRQHandler
+    .long   SOFTWARE0_IRQHandler
+    .long   SOFTWARE1_IRQHandler
+    .long   SOFTWARE2_IRQHandler
+    .long   SOFTWARE3_IRQHandler
+
+    .size    __isr_vector, . - __isr_vector
+
+/* Reset Handler */
+
+    .text
+    .thumb
+    .thumb_func
+    .align 1
+    .globl    Reset_Handler
+    .type    Reset_Handler, %function
+Reset_Handler:
+    .fnstart
+
+    /* Clear BSS */
+    mov     r0, #0
+    ldr     r2, =__bss_start__
+    ldr     r3, =__bss_end__
+.bss_zero_loop:
+    cmp     r2, r3
+    itt     lt
+    strlt   r0, [r2], #4
+    blt    .bss_zero_loop
+
+
+/*     Loop to copy data from read only memory to RAM. The ranges
+ *      of copy from/to are specified by following symbols evaluated in
+ *      linker script.
+ *      __etext: End of code section, i.e., begin of data sections to copy from.
+ *      __data_start__/__data_end__: RAM address range that data should be
+ *      copied to. Both must be aligned to 4 bytes boundary.  */
+    ldr    r1, =__etext
+    ldr    r2, =__data_start__
+    ldr    r3, =__data_end__
+
+    subs    r3, r2
+    ble     .LC0
+
+.LC1:
+    subs    r3, 4
+    ldr    r0, [r1,r3]
+    str    r0, [r2,r3]
+    bgt    .LC1
+
+.LC0:
+
+    LDR     R0, =__HeapBase
+    LDR     R1, =__HeapLimit
+
+    LDR     R0, =SystemInit
+    BLX     R0
+
+    BL      hal_system_init
+
+    LDR     R0, =_start
+    BX      R0
+
+    .pool
+    .cantunwind
+    .fnend
+    .size   Reset_Handler,.-Reset_Handler
+
+    .section ".text"
+
+
+/* Dummy Exception Handlers (infinite loops which can be modified) */
+
+    .weak   NMI_Handler
+    .type   NMI_Handler, %function
+NMI_Handler:
+    B       .
+    .size   NMI_Handler, . - NMI_Handler
+
+
+    .weak   HardFault_Handler
+    .type   HardFault_Handler, %function
+HardFault_Handler:
+    B       .
+    .size   HardFault_Handler, . - HardFault_Handler
+
+
+    .weak   MemoryManagement_Handler
+    .type   MemoryManagement_Handler, %function
+MemoryManagement_Handler:
+    B       .
+    .size   MemoryManagement_Handler, . - MemoryManagement_Handler
+
+
+    .weak   BusFault_Handler
+    .type   BusFault_Handler, %function
+BusFault_Handler:
+    B       .
+    .size   BusFault_Handler, . - BusFault_Handler
+
+
+    .weak   UsageFault_Handler
+    .type   UsageFault_Handler, %function
+UsageFault_Handler:
+    B       .
+    .size   UsageFault_Handler, . - UsageFault_Handler
+
+
+    .weak   SVC_Handler
+    .type   SVC_Handler, %function
+SVC_Handler:
+    B       .
+    .size   SVC_Handler, . - SVC_Handler
+
+
+    .weak   DebugMon_Handler
+    .type   DebugMon_Handler, %function
+DebugMon_Handler:
+    B       .
+    .size   DebugMon_Handler, . - DebugMon_Handler
+
+
+    .weak   PendSV_Handler
+    .type   PendSV_Handler, %function
+PendSV_Handler:
+    B       .
+    .size   PendSV_Handler, . - PendSV_Handler
+
+
+    .weak   SysTick_Handler
+    .type   SysTick_Handler, %function
+SysTick_Handler:
+    B       .
+    .size   SysTick_Handler, . - SysTick_Handler
+
+
+/* IRQ Handlers */
+
+    .globl  Default_Handler
+    .type   Default_Handler, %function
+Default_Handler:
+    B       .
+    .size   Default_Handler, . - Default_Handler
+
+    .macro  IRQ handler
+    .weak   \handler
+    .set    \handler, Default_Handler
+    .endm
+
+    IRQ BROWNOUT_IRQHandler
+    IRQ WATCHDOG_IRQHandler
+    IRQ CLKGEN_IRQHandler
+    IRQ VCOMP_IRQHandler
+    IRQ IOSLAVE_IOS_IRQHandler
+    IRQ IOSLAVE_ACC_IRQHandler
+    IRQ IOMASTER0_IRQHandler
+    IRQ IOMASTER1_IRQHandler
+    IRQ IOMASTER2_IRQHandler
+    IRQ IOMASTER3_IRQHandler
+    IRQ IOMASTER4_IRQHandler
+    IRQ IOMASTER5_IRQHandler
+    IRQ GPIO_IRQHandler
+    IRQ CTIMER_IRQHandler
+    IRQ UART0_IRQHandler
+    IRQ UART1_IRQHandler
+    IRQ ADC_IRQHandler
+    IRQ PDM_IRQHandler
+    IRQ STIMER_IRQHandler
+    IRQ STIMER_CMPR0_IRQHandler
+    IRQ STIMER_CMPR1_IRQHandler
+    IRQ STIMER_CMPR2_IRQHandler
+    IRQ STIMER_CMPR3_IRQHandler
+    IRQ STIMER_CMPR4_IRQHandler
+    IRQ STIMER_CMPR5_IRQHandler
+    IRQ STIMER_CMPR6_IRQHandler
+    IRQ STIMER_CMPR7_IRQHandler
+    IRQ FLASH_IRQHandler
+    IRQ SOFTWARE0_IRQHandler
+    IRQ SOFTWARE1_IRQHandler
+    IRQ SOFTWARE2_IRQHandler
+    IRQ SOFTWARE3_IRQHandler
+
+  .end
diff --git a/hw/bsp/apollo2_evb/src/hal_bsp.c b/hw/bsp/apollo2_evb/src/hal_bsp.c
new file mode 100644
index 000000000..9a0688324
--- /dev/null
+++ b/hw/bsp/apollo2_evb/src/hal_bsp.c
@@ -0,0 +1,178 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+#include <assert.h>
+
+#include <syscfg/syscfg.h>
+
+#include <hal/hal_bsp.h>
+#include <bsp/bsp.h>
+#include <hal/hal_spi.h>
+#include <mcu/hal_apollo2.h>
+
+#if MYNEWT_VAL(UART_0)
+#include "uart/uart.h"
+#include "uart_hal/uart_hal.h"
+#endif
+
+#if MYNEWT_VAL(UART_0)
+static struct uart_dev os_bsp_uart0;
+static const struct apollo2_uart_cfg os_bsp_uart0_cfg = {
+    .suc_pin_tx = MYNEWT_VAL(UART_0_PIN_TX),
+    .suc_pin_rx = MYNEWT_VAL(UART_0_PIN_RX),
+    .suc_pin_rts = MYNEWT_VAL(UART_0_PIN_RTS),
+    .suc_pin_cts = MYNEWT_VAL(UART_0_PIN_CTS),
+};
+#endif
+
+/*
+ * What memory to include in coredump.
+ */
+static const struct hal_bsp_mem_dump dump_cfg[] = {
+    [0] = {
+        .hbmd_start = &_ram_start,
+        .hbmd_size = RAM_SIZE
+    }
+};
+
+/*
+ * NOTE: Our HAL expects that the SS pin, if used, is treated as a gpio line
+ * and is handled outside the SPI routines.
+ */
+
+#if MYNEWT_VAL(SPI_0_MASTER)
+static const struct apollo2_spi_cfg hal_bsp_spi0m_cfg = {
+    .sck_pin      = 5,
+    .mosi_pin     = 7,
+    .miso_pin     = 6,
+};
+#endif
+
+#if MYNEWT_VAL(SPI_1_MASTER)
+static const struct apollo2_spi_cfg hal_bsp_spi1m_cfg = {
+    .sck_pin      = 8,
+    .mosi_pin     = 10,
+    .miso_pin     = 9,
+};
+#endif
+
+#if MYNEWT_VAL(SPI_2_MASTER)
+static const struct apollo2_spi_cfg hal_bsp_spi2m_cfg = {
+    .sck_pin      = 0,
+    .mosi_pin     = 1,
+    .miso_pin     = 2,
+};
+#endif
+
+#if MYNEWT_VAL(SPI_3_MASTER)
+static const struct apollo2_spi_cfg hal_bsp_spi3m_cfg = {
+    .sck_pin      = 42,
+    .mosi_pin     = 38,
+    .miso_pin     = 43,
+};
+#endif
+
+#if MYNEWT_VAL(SPI_4_MASTER)
+static const struct apollo2_spi_cfg hal_bsp_spi4m_cfg = {
+    .sck_pin      = 39,
+    .mosi_pin     = 44,
+    .miso_pin     = 40,
+};
+#endif
+
+#if MYNEWT_VAL(SPI_5_MASTER)
+static const struct apollo2_spi_cfg hal_bsp_spi5m_cfg = {
+    .sck_pin      = 48,
+    .mosi_pin     = 47,
+    .miso_pin     = 49,
+};
+#endif
+
+const struct hal_flash *
+hal_bsp_flash_dev(uint8_t id)
+{
+    if (id != 0) {
+        return (NULL);
+    }
+    return &apollo2_flash_dev;
+}
+
+const struct hal_bsp_mem_dump *
+hal_bsp_core_dump(int *area_cnt)
+{
+    *area_cnt = sizeof(dump_cfg) / sizeof(dump_cfg[0]);
+    return dump_cfg;
+}
+
+void
+hal_bsp_init(void)
+{
+    int rc;
+
+    (void) rc;
+
+#if MYNEWT_VAL(UART_0)
+    rc = os_dev_create((struct os_dev *) &os_bsp_uart0, "uart0",
+            OS_DEV_INIT_PRIMARY, 0, uart_hal_init, (void *) &os_bsp_uart0_cfg);
+    assert(rc == 0);
+#endif
+
+#if MYNEWT_VAL(SPI_0_MASTER)
+    rc = hal_spi_init(0, (void *)&hal_bsp_spi0m_cfg, HAL_SPI_TYPE_MASTER);
+    assert(rc == 0);
+#endif
+
+#if MYNEWT_VAL(SPI_1_MASTER)
+    rc = hal_spi_init(1, (void *)&hal_bsp_spi1m_cfg, HAL_SPI_TYPE_MASTER);
+    assert(rc == 0);
+#endif
+
+#if MYNEWT_VAL(SPI_2_MASTER)
+    rc = hal_spi_init(2, (void *)&hal_bsp_spi2m_cfg, HAL_SPI_TYPE_MASTER);
+    assert(rc == 0);
+#endif
+
+#if MYNEWT_VAL(SPI_3_MASTER)
+    rc = hal_spi_init(3, (void *)&hal_bsp_spi3m_cfg, HAL_SPI_TYPE_MASTER);
+    assert(rc == 0);
+#endif
+
+#if MYNEWT_VAL(SPI_4_MASTER)
+    rc = hal_spi_init(4, (void *)&hal_bsp_spi4m_cfg, HAL_SPI_TYPE_MASTER);
+    assert(rc == 0);
+#endif
+
+#if MYNEWT_VAL(SPI_5_MASTER)
+    rc = hal_spi_init(5, (void *)&hal_bsp_spi5m_cfg, HAL_SPI_TYPE_MASTER);
+    assert(rc == 0);
+#endif
+}
+
+int
+hal_bsp_hw_id(uint8_t *id, int max_len)
+{
+#if 0
+    if (max_len > sizeof(DEVID)) {
+        max_len = sizeof(DEVID);
+    }
+
+    memcpy(id, &DEVID, max_len);
+    return max_len;
+#endif
+    return 0;
+}
diff --git a/hw/bsp/apollo2_evb/src/sbrk.c b/hw/bsp/apollo2_evb/src/sbrk.c
new file mode 100644
index 000000000..804c8f9f4
--- /dev/null
+++ b/hw/bsp/apollo2_evb/src/sbrk.c
@@ -0,0 +1,51 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+extern char __HeapBase;
+extern char __HeapLimit;
+
+void *
+_sbrk(int incr)
+{
+    static char *brk = &__HeapBase;
+
+    void *prev_brk;
+
+    if (incr < 0) {
+        /* Returning memory to the heap. */
+        incr = -incr;
+        if (brk - incr < &__HeapBase) {
+            prev_brk = (void *)-1;
+        } else {
+            prev_brk = brk;
+            brk -= incr;
+        }
+    } else {
+        /* Allocating memory from the heap. */
+        if (&__HeapLimit - brk >= incr) {
+            prev_brk = brk;
+            brk += incr;
+        } else {
+            prev_brk = (void *)-1;
+        }
+    }
+
+    return prev_brk;
+}
diff --git a/hw/bsp/apollo2_evb/src/system_apollo2.c b/hw/bsp/apollo2_evb/src/system_apollo2.c
new file mode 100644
index 000000000..046511c17
--- /dev/null
+++ b/hw/bsp/apollo2_evb/src/system_apollo2.c
@@ -0,0 +1,115 @@
+//*****************************************************************************
+//
+//! @file system_apollo2.c
+//!
+//! @brief Ambiq Micro Apollo2 MCU specific functions.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//*****************************************************************************
+
+#include <stdint.h>
+#include "mcu/system_apollo2.h"
+#include "mcu/apollo2.h"
+#include "cmsis_nvic.h"
+
+//*****************************************************************************
+//
+// Defines
+//
+//*****************************************************************************
+
+//
+// Clocks
+//
+#define __HSI             (6000000UL)
+#define __XTAL            (32768UL)         // Crystal Oscillator frequency
+#define __SYS_OSC_CLK     (48000000)        // Main oscillator frequency
+#define __SYSTEM_CLOCK    (1*__SYS_OSC_CLK)
+
+//
+// Initialize SystemCoreClock with the system core clock frequency value
+// achieved after system intitialization.
+// This means system core clock frequency after call to SystemInit()
+//
+uint32_t SystemCoreClock = __SYSTEM_CLOCK;  // System Clock Frequency (Core Clock)
+
+//*****************************************************************************
+//
+//! @brief Set the global clock frequncy.
+//!
+//! This function sets the global clock frequency.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+SystemCoreClockUpdate(void)
+{
+    //
+    // Calculate the system frequency based upon the current register settings.
+    // This function can be used to retrieve the system core clock frequeny
+    // after user changed register sittings.
+    //
+    SystemCoreClock = __SYS_OSC_CLK / (CLKGEN->CCTRL_b.CORESEL + 1);
+}
+
+//*****************************************************************************
+//
+//! @brief Initialize the system.
+//!
+//! This function sets up the microcontroller system.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+SystemInit(void)
+{
+    //
+    // Initialize the system
+    // Do not use global variables because this function is called before
+    // reaching pre-main. RW section maybe overwritten afterwards.
+    //
+    SystemCoreClock = __SYSTEM_CLOCK;
+
+    CLKGEN->CLKKEY = 0x47;              // Enable write to CCTRL
+    CLKGEN->CCTRL_b.CORESEL = 0;        // Div by 1 for 48MHz
+    CLKGEN->CLKKEY = 0;                 // Disable write to CCTRL
+
+    SystemCoreClockUpdate();
+
+    NVIC_Relocate();
+}
+
diff --git a/hw/bsp/apollo2_evb/syscfg.yml b/hw/bsp/apollo2_evb/syscfg.yml
new file mode 100644
index 000000000..73768fd2f
--- /dev/null
+++ b/hw/bsp/apollo2_evb/syscfg.yml
@@ -0,0 +1,47 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# Package: hw/bsp/apollo2_evb
+
+syscfg.defs:
+    BSP_APOLLO2:
+        description: 'Set to indicate that BSP has the APOLLO2 processor'
+        value: 1
+    UART_0:
+        description: 'Whether to enable UART0'
+        value: 1
+    UART_0_PIN_TX:
+        description: 'TX pin for UART0'
+        value: 22
+    UART_0_PIN_RX:
+        description: 'RX pin for UART0'
+        value: 23
+    UART_0_PIN_RTS:
+        description: 'RTS pin for UART0'
+        value: 37
+    UART_0_PIN_CTS:
+        description: 'CTS pin for UART0'
+        value: 38
+
+
+syscfg.vals:
+    CONFIG_FCB_FLASH_AREA: FLASH_AREA_NFFS
+    REBOOT_LOG_FLASH_AREA: FLASH_AREA_REBOOT_LOG
+    NFFS_FLASH_AREA: FLASH_AREA_NFFS
+    COREDUMP_FLASH_AREA: FLASH_AREA_IMAGE_1
diff --git a/hw/hal/include/hal/hal_spi.h b/hw/hal/include/hal/hal_spi.h
index 5fdc1f3ff..d987e3d0d 100644
--- a/hw/hal/include/hal/hal_spi.h
+++ b/hw/hal/include/hal/hal_spi.h
@@ -216,6 +216,11 @@ int hal_spi_slave_set_def_tx_val(int spi_num, uint16_t val);
  */
 int hal_spi_abort(int spi_num);
 
+/** Utility functions; defined once for all MCUs. */
+int hal_spi_data_mode_breakout(uint8_t data_mode,
+                               int *out_cpol, int *out_cpha);
+
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/hw/hal/src/hal_common.c b/hw/hal/src/hal_common.c
index c8e61c8bb..e13358517 100644
--- a/hw/hal/src/hal_common.c
+++ b/hw/hal/src/hal_common.c
@@ -17,6 +17,7 @@
  * under the License.
  */
 
+#include "hal/hal_spi.h"
 #include "hal/hal_system.h"
 
 void _exit(int status);
@@ -26,3 +27,41 @@ _exit(int status)
 {
     hal_system_reset();
 }
+
+/**
+ * Extracts CPOL and CPHA values from a data-mode constant.
+ *
+ * @param data_mode             The HAL_SPI_MODE value to convert.
+ * @param out_cpol              The CPOL gets written here on success.
+ * @param out_cpha              The CPHA gets written here on success.
+ *
+ * @return                      0 on success; nonzero on invalid input.
+ */
+int
+hal_spi_data_mode_breakout(uint8_t data_mode, int *out_cpol, int *out_cpha)
+{
+    switch (data_mode) {
+    case HAL_SPI_MODE0:
+        *out_cpol = 0;
+        *out_cpha = 0;
+        return 0;
+
+    case HAL_SPI_MODE1:
+        *out_cpol = 0;
+        *out_cpha = 1;
+        return 0;
+
+    case HAL_SPI_MODE2:
+        *out_cpol = 1;
+        *out_cpha = 0;
+        return 0;
+
+    case HAL_SPI_MODE3:
+        *out_cpol = 1;
+        *out_cpha = 1;
+        return 0;
+
+    default:
+        return -1;
+    }
+}
diff --git a/hw/mcu/ambiq/apollo2/apollo2.ld b/hw/mcu/ambiq/apollo2/apollo2.ld
new file mode 100755
index 000000000..aaeed7a11
--- /dev/null
+++ b/hw/mcu/ambiq/apollo2/apollo2.ld
@@ -0,0 +1,195 @@
+/* Linker script for Nordic Semiconductor nRF5 devices
+ *
+ * Version: Sourcery G++ 4.5-1
+ * Support: https://support.codesourcery.com/GNUToolchain/
+ *
+ * Copyright (c) 2007, 2008, 2009, 2010 CodeSourcery, Inc.
+ *
+ * The authors hereby grant permission to use, copy, modify, distribute,
+ * and license this software and its documentation for any purpose, provided
+ * that existing copyright notices are retained in all copies and that this
+ * notice is included verbatim in any distributions.  No written agreement,
+ * license, or royalty fee is required for any of the authorized uses.
+ * Modifications to this software may be copyrighted by their authors
+ * and need not follow the licensing terms described here, provided that
+ * the new terms are clearly indicated on the first page of each file where
+ * they apply.
+ */
+OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
+
+/* Linker script to place sections and symbol values. Should be used together
+ * with other linker script that defines memory regions FLASH and RAM.
+ * It references following symbols, which must be defined in code:
+ *   Reset_Handler : Entry of reset handler
+ *
+ * It defines following symbols, which code can use without definition:
+ *   __exidx_start
+ *   __exidx_end
+ *   __etext
+ *   __data_start__
+ *   __preinit_array_start
+ *   __preinit_array_end
+ *   __init_array_start
+ *   __init_array_end
+ *   __fini_array_start
+ *   __fini_array_end
+ *   __data_end__
+ *   __bss_start__
+ *   __bss_end__
+ *   __HeapBase
+ *   __HeapLimit
+ *   __StackLimit
+ *   __StackTop
+ *   __stack
+ *   __bssnz_start__
+ *   __bssnz_end__
+ */
+ENTRY(Reset_Handler)
+
+SECTIONS
+{
+    .imghdr (NOLOAD):
+    {
+        . = . + _imghdr_size;
+    } > FLASH
+
+    .text :
+    {
+        __isr_vector_start = .;
+        KEEP(*(.isr_vector))
+        __isr_vector_end = .;
+        *(.text*)
+
+        KEEP(*(.init))
+        KEEP(*(.fini))
+
+        /* .ctors */
+        *crtbegin.o(.ctors)
+        *crtbegin?.o(.ctors)
+        *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
+        *(SORT(.ctors.*))
+        *(.ctors)
+
+        /* .dtors */
+        *crtbegin.o(.dtors)
+        *crtbegin?.o(.dtors)
+        *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
+        *(SORT(.dtors.*))
+        *(.dtors)
+
+        *(.rodata*)
+
+        *(.eh_frame*)
+        . = ALIGN(4);
+    } > FLASH
+
+
+    .ARM.extab :
+    {
+        *(.ARM.extab* .gnu.linkonce.armextab.*)
+        . = ALIGN(4);
+    } > FLASH
+
+    __exidx_start = .;
+    .ARM.exidx :
+    {
+        *(.ARM.exidx* .gnu.linkonce.armexidx.*)
+        . = ALIGN(4);
+    } > FLASH
+    __exidx_end = .;
+
+    __etext = .;
+
+    .vector_relocation :
+    {
+        . = ALIGN(4);
+        __vector_tbl_reloc__ = .;
+        . = . + (__isr_vector_end - __isr_vector_start);
+        . = ALIGN(4);
+    } > RAM
+
+    .data :
+    {
+        __data_start__ = .;
+        *(vtable)
+        *(.data*)
+
+        . = ALIGN(4);
+        /* preinit data */
+        PROVIDE_HIDDEN (__preinit_array_start = .);
+        *(.preinit_array)
+        PROVIDE_HIDDEN (__preinit_array_end = .);
+
+        . = ALIGN(4);
+        /* init data */
+        PROVIDE_HIDDEN (__init_array_start = .);
+        *(SORT(.init_array.*))
+        *(.init_array)
+        PROVIDE_HIDDEN (__init_array_end = .);
+
+
+        . = ALIGN(4);
+        /* finit data */
+        PROVIDE_HIDDEN (__fini_array_start = .);
+        *(SORT(.fini_array.*))
+        *(.fini_array)
+        PROVIDE_HIDDEN (__fini_array_end = .);
+
+        *(.jcr)
+        . = ALIGN(4);
+        /* All data end */
+        __data_end__ = .;
+    } > RAM AT > FLASH
+
+    /* Non-zeroed BSS.  This section is similar to BSS, with the following two
+     * caveats:
+     *    1. It does not get zeroed at init-time.
+     *    2. You cannot use it as source memory for EasyDMA.
+     *
+     * This section exists because of a hardware defect; see errata 33 and 34
+     * in nrf52 errata sheet.
+     */
+    .bssnz :
+    {
+        . = ALIGN(4);
+        __bssnz_start__ = .;
+        *(.bss.core.nz*)
+        . = ALIGN(4);
+        __bssnz_end__ = .;
+    } > RAM
+
+    .bss :
+    {
+        . = ALIGN(4);
+        __bss_start__ = .;
+        *(.bss*)
+        *(COMMON)
+        . = ALIGN(4);
+        __bss_end__ = .;
+    } > RAM
+
+    /* Heap starts after BSS */
+    __HeapBase = .;
+
+    /* .stack_dummy section doesn't contains any symbols. It is only
+     * used for linker to calculate size of stack sections, and assign
+     * values to stack symbols later */
+    .stack_dummy (COPY):
+    {
+        *(.stack*)
+    } > RAM
+
+    _ram_start = ORIGIN(RAM);
+
+    /* Set stack top to end of RAM, and stack limit move down by
+     * size of stack_dummy section */
+    __StackTop = ORIGIN(RAM) + LENGTH(RAM);
+    __StackLimit = __StackTop - SIZEOF(.stack_dummy);
+    PROVIDE(__stack = __StackTop);
+
+    /* Top of head is the bottom of the stack */
+    __HeapLimit = __StackLimit;
+
+    /* Check if data + heap + stack exceeds RAM limit */
+    ASSERT(__HeapBase <= __HeapLimit, "region RAM overflowed with stack")
+}
diff --git a/hw/mcu/ambiq/apollo2/include/mcu/apollo2.h b/hw/mcu/ambiq/apollo2/include/mcu/apollo2.h
new file mode 100644
index 000000000..e7a31d832
--- /dev/null
+++ b/hw/mcu/ambiq/apollo2/include/mcu/apollo2.h
@@ -0,0 +1,8449 @@
+/*
+ * Copyright (C) 2015-2017, Ambiq Micro
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * 
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 
+ * 3. Neither the name of the copyright holder nor the names of itscontributors may be used to endorse
+ * or promote products derived from thissoftware without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @file     apollo2.h
+ * @brief    CMSIS HeaderFile
+ * @version  1.0
+ * @date     13. March 2017
+ * @note     Generated by SVDConv V3.2.53 on Monday, 13.03.2017 18:37:05
+ *           from File 'apollo2.svd',
+ *           last modified on Monday, 13.03.2017 23:37:02
+ */
+
+
+
+/** @addtogroup Ambiq Micro
+  * @{
+  */
+
+
+/** @addtogroup apollo2
+  * @{
+  */
+
+
+#ifndef APOLLO2_H
+#define APOLLO2_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/** @addtogroup Configuration_of_CMSIS
+  * @{
+  */
+
+
+
+/* =========================================================================================================================== */
+/* ================                                Interrupt Number Definition                                ================ */
+/* =========================================================================================================================== */
+
+typedef enum {
+/* =======================================  ARM Cortex-M4 Specific Interrupt Numbers  ======================================== */
+  Reset_IRQn                = -15,              /*!< -15  Reset Vector, invoked on Power up and warm reset                     */
+  NonMaskableInt_IRQn       = -14,              /*!< -14  Non maskable Interrupt, cannot be stopped or preempted               */
+  HardFault_IRQn            = -13,              /*!< -13  Hard Fault, all classes of Fault                                     */
+  MemoryManagement_IRQn     = -12,              /*!< -12  Memory Management, MPU mismatch, including Access Violation
+                                                      and No Match                                                             */
+  BusFault_IRQn             = -11,              /*!< -11  Bus Fault, Pre-Fetch-, Memory Access Fault, other address/memory
+                                                      related Fault                                                            */
+  UsageFault_IRQn           = -10,              /*!< -10  Usage Fault, i.e. Undef Instruction, Illegal State Transition        */
+  SVCall_IRQn               =  -5,              /*!< -5 System Service Call via SVC instruction                                */
+  DebugMonitor_IRQn         =  -4,              /*!< -4 Debug Monitor                                                          */
+  PendSV_IRQn               =  -2,              /*!< -2 Pendable request for system service                                    */
+  SysTick_IRQn              =  -1,              /*!< -1 System Tick Timer                                                      */
+/* ==========================================  apollo2 Specific Interrupt Numbers  =========================================== */
+  BROWNOUT_IRQn             =   0,              /*!< 0  BROWNOUT                                                               */
+  WDT_IRQn                  =   1,              /*!< 1  WDT                                                                    */
+  CLKGEN_RTC_IRQn           =   2,              /*!< 2  CLKGEN_RTC                                                             */
+  VCOMP_IRQn                =   3,              /*!< 3  VCOMP                                                                  */
+  IOSLAVE_IRQn              =   4,              /*!< 4  IOSLAVE                                                                */
+  IOSLAVEACC_IRQn           =   5,              /*!< 5  IOSLAVEACC                                                             */
+  IOMSTR0_IRQn              =   6,              /*!< 6  IOMSTR0                                                                */
+  IOMSTR1_IRQn              =   7,              /*!< 7  IOMSTR1                                                                */
+  IOMSTR2_IRQn              =   8,              /*!< 8  IOMSTR2                                                                */
+  IOMSTR3_IRQn              =   9,              /*!< 9  IOMSTR3                                                                */
+  IOMSTR4_IRQn              =  10,              /*!< 10 IOMSTR4                                                                */
+  IOMSTR5_IRQn              =  11,              /*!< 11 IOMSTR5                                                                */
+  GPIO_IRQn                 =  12,              /*!< 12 GPIO                                                                   */
+  CTIMER_IRQn               =  13,              /*!< 13 CTIMER                                                                 */
+  UART0_IRQn                =  14,              /*!< 14 UART0                                                                  */
+  UART1_IRQn                =  15,              /*!< 15 UART1                                                                  */
+  ADC_IRQn                  =  16,              /*!< 16 ADC                                                                    */
+  PDM_IRQn                  =  17,              /*!< 17 PDM                                                                    */
+  STIMER_IRQn               =  18,              /*!< 18 STIMER                                                                 */
+  STIMER_CMPR0_IRQn         =  19,              /*!< 19 STIMER_CMPR0                                                           */
+  STIMER_CMPR1_IRQn         =  20,              /*!< 20 STIMER_CMPR1                                                           */
+  STIMER_CMPR2_IRQn         =  21,              /*!< 21 STIMER_CMPR2                                                           */
+  STIMER_CMPR3_IRQn         =  22,              /*!< 22 STIMER_CMPR3                                                           */
+  STIMER_CMPR4_IRQn         =  23,              /*!< 23 STIMER_CMPR4                                                           */
+  STIMER_CMPR5_IRQn         =  24,              /*!< 24 STIMER_CMPR5                                                           */
+  STIMER_CMPR6_IRQn         =  25,              /*!< 25 STIMER_CMPR6                                                           */
+  STIMER_CMPR7_IRQn         =  26               /*!< 26 STIMER_CMPR7                                                           */
+} IRQn_Type;
+
+
+
+/* =========================================================================================================================== */
+/* ================                           Processor and Core Peripheral Section                           ================ */
+/* =========================================================================================================================== */
+
+/* ===========================  Configuration of the ARM Cortex-M4 Processor and Core Peripherals  =========================== */
+#define __CM4_REV                 0x0100U       /*!< CM4 Core Revision                                                         */
+#define __NVIC_PRIO_BITS               3        /*!< Number of Bits used for Priority Levels                                   */
+#define __Vendor_SysTickConfig         0        /*!< Set to 1 if different SysTick Config is used                              */
+#define __MPU_PRESENT                  1        /*!< MPU present or not                                                        */
+#define __FPU_PRESENT                  1        /*!< FPU present or not                                                        */
+
+
+/** @} */ /* End of group Configuration_of_CMSIS */
+
+#include "core_cm4.h"                           /*!< ARM Cortex-M4 processor and core peripherals                              */
+#include "system_apollo2.h"                     /*!< apollo2 System                                                            */
+
+#ifndef __IM                                    /*!< Fallback for older CMSIS versions                                         */
+  #define __IM   __I
+#endif
+#ifndef __OM                                    /*!< Fallback for older CMSIS versions                                         */
+  #define __OM   __O
+#endif
+#ifndef __IOM                                   /*!< Fallback for older CMSIS versions                                         */
+  #define __IOM  __IO
+#endif
+
+
+/* ========================================  Start of section using anonymous unions  ======================================== */
+#if defined (__CC_ARM)
+  #pragma push
+  #pragma anon_unions
+#elif defined (__ICCARM__)
+  #pragma language=extended
+#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+  #pragma clang diagnostic push
+  #pragma clang diagnostic ignored "-Wc11-extensions"
+  #pragma clang diagnostic ignored "-Wreserved-id-macro"
+#elif defined (__GNUC__)
+  /* anonymous unions are enabled by default */
+#elif defined (__TMS470__)
+  /* anonymous unions are enabled by default */
+#elif defined (__TASKING__)
+  #pragma warning 586
+#elif defined (__CSMC__)
+  /* anonymous unions are enabled by default */
+#else
+  #warning Not supported compiler type
+#endif
+
+
+/* =========================================================================================================================== */
+/* ================                            Device Specific Peripheral Section                             ================ */
+/* =========================================================================================================================== */
+
+
+/** @addtogroup Device_Peripheral_peripherals
+  * @{
+  */
+
+
+
+/* =========================================================================================================================== */
+/* ================                                            ADC                                            ================ */
+/* =========================================================================================================================== */
+
+
+/**
+  * @brief Analog Digital Converter Control (ADC)
+  */
+
+typedef struct {                                /*!< (@ 0x50010000) ADC Structure                                              */
+  
+  union {
+    __IOM uint32_t CFG;                         /*!< (@ 0x00000000) Configuration Register                                     */
+    
+    struct {
+      __IOM uint32_t ADCEN      : 1;            /*!< (@ 0x00000000) This bit enables the ADC module. While the ADC
+                                                                    is enabled, the ADCCFG and SLOT Configuration
+                                                                    regsiter settings must remain stable and
+                                                                    unchanged. All configuration register settings,
+                                                                    slot configuration settings and window
+                                                                    comparison settings should be written prior
+                                                                    to setting the ADCEN bit to '1'.                           */
+      __IM  uint32_t            : 1;
+      __IOM uint32_t RPTEN      : 1;            /*!< (@ 0x00000002) This bit enables Repeating Scan Mode.                      */
+      __IOM uint32_t LPMODE     : 1;            /*!< (@ 0x00000003) Select power mode to enter between active scans.           */
+      __IOM uint32_t CKMODE     : 1;            /*!< (@ 0x00000004) Clock mode register                                        */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t REFSEL     : 2;            /*!< (@ 0x00000008) Select the ADC reference voltage.                          */
+      __IM  uint32_t            : 6;
+      __IOM uint32_t TRIGSEL    : 3;            /*!< (@ 0x00000010) Select the ADC trigger source.                             */
+      __IOM uint32_t TRIGPOL    : 1;            /*!< (@ 0x00000013) This bit selects the ADC trigger polarity for
+                                                                    external off chip triggers.                                */
+      __IM  uint32_t            : 4;
+      __IOM uint32_t CLKSEL     : 2;            /*!< (@ 0x00000018) Select the source and frequency for the ADC clock.
+                                                                    All values not enumerated below are undefined.             */
+    } CFG_b;
+  } ;
+  
+  union {
+    __IOM uint32_t STAT;                        /*!< (@ 0x00000004) ADC Power Status                                           */
+    
+    struct {
+      __IOM uint32_t PWDSTAT    : 1;            /*!< (@ 0x00000000) Indicates the power-status of the ADC.                     */
+    } STAT_b;
+  } ;
+  
+  union {
+    __IOM uint32_t SWT;                         /*!< (@ 0x00000008) Software trigger                                           */
+    
+    struct {
+      __IOM uint32_t SWT        : 8;            /*!< (@ 0x00000000) Writing 0x37 to this register generates a software
+                                                                    trigger.                                                   */
+    } SWT_b;
+  } ;
+  
+  union {
+    __IOM uint32_t SL0CFG;                      /*!< (@ 0x0000000C) Slot 0 Configuration Register                              */
+    
+    struct {
+      __IOM uint32_t SLEN0      : 1;            /*!< (@ 0x00000000) This bit enables slot 0 for ADC conversions.               */
+      __IOM uint32_t WCEN0      : 1;            /*!< (@ 0x00000001) This bit enables the window compare function
+                                                                    for slot 0.                                                */
+      __IM  uint32_t            : 6;
+      __IOM uint32_t CHSEL0     : 4;            /*!< (@ 0x00000008) Select one of the 14 channel inputs for this
+                                                                    slot.                                                      */
+      __IM  uint32_t            : 4;
+      __IOM uint32_t PRMODE0    : 2;            /*!< (@ 0x00000010) Set the Precision Mode For Slot.                           */
+      __IM  uint32_t            : 6;
+      __IOM uint32_t ADSEL0     : 3;            /*!< (@ 0x00000018) Select the number of measurements to average
+                                                                    in the accumulate divide module for this
+                                                                    slot.                                                      */
+    } SL0CFG_b;
+  } ;
+  
+  union {
+    __IOM uint32_t SL1CFG;                      /*!< (@ 0x00000010) Slot 1 Configuration Register                              */
+    
+    struct {
+      __IOM uint32_t SLEN1      : 1;            /*!< (@ 0x00000000) This bit enables slot 1 for ADC conversions.               */
+      __IOM uint32_t WCEN1      : 1;            /*!< (@ 0x00000001) This bit enables the window compare function
+                                                                    for slot 1.                                                */
+      __IM  uint32_t            : 6;
+      __IOM uint32_t CHSEL1     : 4;            /*!< (@ 0x00000008) Select one of the 14 channel inputs for this
+                                                                    slot.                                                      */
+      __IM  uint32_t            : 4;
+      __IOM uint32_t PRMODE1    : 2;            /*!< (@ 0x00000010) Set the Precision Mode For Slot.                           */
+      __IM  uint32_t            : 6;
+      __IOM uint32_t ADSEL1     : 3;            /*!< (@ 0x00000018) Select the number of measurements to average
+                                                                    in the accumulate divide module for this
+                                                                    slot.                                                      */
+    } SL1CFG_b;
+  } ;
+  
+  union {
+    __IOM uint32_t SL2CFG;                      /*!< (@ 0x00000014) Slot 2 Configuration Register                              */
+    
+    struct {
+      __IOM uint32_t SLEN2      : 1;            /*!< (@ 0x00000000) This bit enables slot 2 for ADC conversions.               */
+      __IOM uint32_t WCEN2      : 1;            /*!< (@ 0x00000001) This bit enables the window compare function
+                                                                    for slot 2.                                                */
+      __IM  uint32_t            : 6;
+      __IOM uint32_t CHSEL2     : 4;            /*!< (@ 0x00000008) Select one of the 14 channel inputs for this
+                                                                    slot.                                                      */
+      __IM  uint32_t            : 4;
+      __IOM uint32_t PRMODE2    : 2;            /*!< (@ 0x00000010) Set the Precision Mode For Slot.                           */
+      __IM  uint32_t            : 6;
+      __IOM uint32_t ADSEL2     : 3;            /*!< (@ 0x00000018) Select the number of measurements to average
+                                                                    in the accumulate divide module for this
+                                                                    slot.                                                      */
+    } SL2CFG_b;
+  } ;
+  
+  union {
+    __IOM uint32_t SL3CFG;                      /*!< (@ 0x00000018) Slot 3 Configuration Register                              */
+    
+    struct {
+      __IOM uint32_t SLEN3      : 1;            /*!< (@ 0x00000000) This bit enables slot 3 for ADC conversions.               */
+      __IOM uint32_t WCEN3      : 1;            /*!< (@ 0x00000001) This bit enables the window compare function
+                                                                    for slot 3.                                                */
+      __IM  uint32_t            : 6;
+      __IOM uint32_t CHSEL3     : 4;            /*!< (@ 0x00000008) Select one of the 14 channel inputs for this
+                                                                    slot.                                                      */
+      __IM  uint32_t            : 4;
+      __IOM uint32_t PRMODE3    : 2;            /*!< (@ 0x00000010) Set the Precision Mode For Slot.                           */
+      __IM  uint32_t            : 6;
+      __IOM uint32_t ADSEL3     : 3;            /*!< (@ 0x00000018) Select the number of measurements to average
+                                                                    in the accumulate divide module for this
+                                                                    slot.                                                      */
+    } SL3CFG_b;
+  } ;
+  
+  union {
+    __IOM uint32_t SL4CFG;                      /*!< (@ 0x0000001C) Slot 4 Configuration Register                              */
+    
+    struct {
+      __IOM uint32_t SLEN4      : 1;            /*!< (@ 0x00000000) This bit enables slot 4 for ADC conversions.               */
+      __IOM uint32_t WCEN4      : 1;            /*!< (@ 0x00000001) This bit enables the window compare function
+                                                                    for slot 4.                                                */
+      __IM  uint32_t            : 6;
+      __IOM uint32_t CHSEL4     : 4;            /*!< (@ 0x00000008) Select one of the 14 channel inputs for this
+                                                                    slot.                                                      */
+      __IM  uint32_t            : 4;
+      __IOM uint32_t PRMODE4    : 2;            /*!< (@ 0x00000010) Set the Precision Mode For Slot.                           */
+      __IM  uint32_t            : 6;
+      __IOM uint32_t ADSEL4     : 3;            /*!< (@ 0x00000018) Select the number of measurements to average
+                                                                    in the accumulate divide module for this
+                                                                    slot.                                                      */
+    } SL4CFG_b;
+  } ;
+  
+  union {
+    __IOM uint32_t SL5CFG;                      /*!< (@ 0x00000020) Slot 5 Configuration Register                              */
+    
+    struct {
+      __IOM uint32_t SLEN5      : 1;            /*!< (@ 0x00000000) This bit enables slot 5 for ADC conversions.               */
+      __IOM uint32_t WCEN5      : 1;            /*!< (@ 0x00000001) This bit enables the window compare function
+                                                                    for slot 5.                                                */
+      __IM  uint32_t            : 6;
+      __IOM uint32_t CHSEL5     : 4;            /*!< (@ 0x00000008) Select one of the 14 channel inputs for this
+                                                                    slot.                                                      */
+      __IM  uint32_t            : 4;
+      __IOM uint32_t PRMODE5    : 2;            /*!< (@ 0x00000010) Set the Precision Mode For Slot.                           */
+      __IM  uint32_t            : 6;
+      __IOM uint32_t ADSEL5     : 3;            /*!< (@ 0x00000018) Select number of measurements to average in the
+                                                                    accumulate divide module for this slot.                    */
+    } SL5CFG_b;
+  } ;
+  
+  union {
+    __IOM uint32_t SL6CFG;                      /*!< (@ 0x00000024) Slot 6 Configuration Register                              */
+    
+    struct {
+      __IOM uint32_t SLEN6      : 1;            /*!< (@ 0x00000000) This bit enables slot 6 for ADC conversions.               */
+      __IOM uint32_t WCEN6      : 1;            /*!< (@ 0x00000001) This bit enables the window compare function
+                                                                    for slot 6.                                                */
+      __IM  uint32_t            : 6;
+      __IOM uint32_t CHSEL6     : 4;            /*!< (@ 0x00000008) Select one of the 14 channel inputs for this
+                                                                    slot.                                                      */
+      __IM  uint32_t            : 4;
+      __IOM uint32_t PRMODE6    : 2;            /*!< (@ 0x00000010) Set the Precision Mode For Slot.                           */
+      __IM  uint32_t            : 6;
+      __IOM uint32_t ADSEL6     : 3;            /*!< (@ 0x00000018) Select the number of measurements to average
+                                                                    in the accumulate divide module for this
+                                                                    slot.                                                      */
+    } SL6CFG_b;
+  } ;
+  
+  union {
+    __IOM uint32_t SL7CFG;                      /*!< (@ 0x00000028) Slot 7 Configuration Register                              */
+    
+    struct {
+      __IOM uint32_t SLEN7      : 1;            /*!< (@ 0x00000000) This bit enables slot 7 for ADC conversions.               */
+      __IOM uint32_t WCEN7      : 1;            /*!< (@ 0x00000001) This bit enables the window compare function
+                                                                    for slot 7.                                                */
+      __IM  uint32_t            : 6;
+      __IOM uint32_t CHSEL7     : 4;            /*!< (@ 0x00000008) Select one of the 14 channel inputs for this
+                                                                    slot.                                                      */
+      __IM  uint32_t            : 4;
+      __IOM uint32_t PRMODE7    : 2;            /*!< (@ 0x00000010) Set the Precision Mode For Slot.                           */
+      __IM  uint32_t            : 6;
+      __IOM uint32_t ADSEL7     : 3;            /*!< (@ 0x00000018) Select the number of measurements to average
+                                                                    in the accumulate divide module for this
+                                                                    slot.                                                      */
+    } SL7CFG_b;
+  } ;
+  
+  union {
+    __IOM uint32_t WULIM;                       /*!< (@ 0x0000002C) Window Comparator Upper Limits Register                    */
+    
+    struct {
+      __IOM uint32_t ULIM       : 20;           /*!< (@ 0x00000000) Sets the upper limit for the wondow comparator.            */
+    } WULIM_b;
+  } ;
+  
+  union {
+    __IOM uint32_t WLLIM;                       /*!< (@ 0x00000030) Window Comparator Lower Limits Register                    */
+    
+    struct {
+      __IOM uint32_t LLIM       : 20;           /*!< (@ 0x00000000) Sets the lower limit for the wondow comparator.            */
+    } WLLIM_b;
+  } ;
+  __IM  uint32_t  RESERVED;
+  
+  union {
+    __IOM uint32_t FIFO;                        /*!< (@ 0x00000038) FIFO Data and Valid Count Register                         */
+    
+    struct {
+      __IOM uint32_t DATA       : 20;           /*!< (@ 0x00000000) Oldest data in the FIFO.                                   */
+      __IOM uint32_t COUNT      : 8;            /*!< (@ 0x00000014) Number of valid entries in the ADC FIFO.                   */
+      __IOM uint32_t SLOTNUM    : 3;            /*!< (@ 0x0000001C) Slot number associated with this FIFO data.                */
+      __IOM uint32_t RSVD       : 1;            /*!< (@ 0x0000001F) RESERVED.                                                  */
+    } FIFO_b;
+  } ;
+  __IM  uint32_t  RESERVED1[113];
+  
+  union {
+    __IOM uint32_t INTEN;                       /*!< (@ 0x00000200) ADC Interrupt registers: Enable                            */
+    
+    struct {
+      __IOM uint32_t CNVCMP     : 1;            /*!< (@ 0x00000000) ADC conversion complete interrupt.                         */
+      __IOM uint32_t SCNCMP     : 1;            /*!< (@ 0x00000001) ADC scan complete interrupt.                               */
+      __IOM uint32_t FIFOOVR1   : 1;            /*!< (@ 0x00000002) FIFO 75 percent full interrupt.                            */
+      __IOM uint32_t FIFOOVR2   : 1;            /*!< (@ 0x00000003) FIFO 100 percent full interrupt.                           */
+      __IOM uint32_t WCEXC      : 1;            /*!< (@ 0x00000004) Window comparator voltage excursion interrupt.             */
+      __IOM uint32_t WCINC      : 1;            /*!< (@ 0x00000005) Window comparator voltage incursion interrupt.             */
+    } INTEN_b;
+  } ;
+  
+  union {
+    __IOM uint32_t INTSTAT;                     /*!< (@ 0x00000204) ADC Interrupt registers: Status                            */
+    
+    struct {
+      __IOM uint32_t CNVCMP     : 1;            /*!< (@ 0x00000000) ADC conversion complete interrupt.                         */
+      __IOM uint32_t SCNCMP     : 1;            /*!< (@ 0x00000001) ADC scan complete interrupt.                               */
+      __IOM uint32_t FIFOOVR1   : 1;            /*!< (@ 0x00000002) FIFO 75 percent full interrupt.                            */
+      __IOM uint32_t FIFOOVR2   : 1;            /*!< (@ 0x00000003) FIFO 100 percent full interrupt.                           */
+      __IOM uint32_t WCEXC      : 1;            /*!< (@ 0x00000004) Window comparator voltage excursion interrupt.             */
+      __IOM uint32_t WCINC      : 1;            /*!< (@ 0x00000005) Window comparator voltage incursion interrupt.             */
+    } INTSTAT_b;
+  } ;
+  
+  union {
+    __IOM uint32_t INTCLR;                      /*!< (@ 0x00000208) ADC Interrupt registers: Clear                             */
+    
+    struct {
+      __IOM uint32_t CNVCMP     : 1;            /*!< (@ 0x00000000) ADC conversion complete interrupt.                         */
+      __IOM uint32_t SCNCMP     : 1;            /*!< (@ 0x00000001) ADC scan complete interrupt.                               */
+      __IOM uint32_t FIFOOVR1   : 1;            /*!< (@ 0x00000002) FIFO 75 percent full interrupt.                            */
+      __IOM uint32_t FIFOOVR2   : 1;            /*!< (@ 0x00000003) FIFO 100 percent full interrupt.                           */
+      __IOM uint32_t WCEXC      : 1;            /*!< (@ 0x00000004) Window comparator voltage excursion interrupt.             */
+      __IOM uint32_t WCINC      : 1;            /*!< (@ 0x00000005) Window comparator voltage incursion interrupt.             */
+    } INTCLR_b;
+  } ;
+  
+  union {
+    __IOM uint32_t INTSET;                      /*!< (@ 0x0000020C) ADC Interrupt registers: Set                               */
+    
+    struct {
+      __IOM uint32_t CNVCMP     : 1;            /*!< (@ 0x00000000) ADC conversion complete interrupt.                         */
+      __IOM uint32_t SCNCMP     : 1;            /*!< (@ 0x00000001) ADC scan complete interrupt.                               */
+      __IOM uint32_t FIFOOVR1   : 1;            /*!< (@ 0x00000002) FIFO 75 percent full interrupt.                            */
+      __IOM uint32_t FIFOOVR2   : 1;            /*!< (@ 0x00000003) FIFO 100 percent full interrupt.                           */
+      __IOM uint32_t WCEXC      : 1;            /*!< (@ 0x00000004) Window comparator voltage excursion interrupt.             */
+      __IOM uint32_t WCINC      : 1;            /*!< (@ 0x00000005) Window comparator voltage incursion interrupt.             */
+    } INTSET_b;
+  } ;
+} ADC_Type;                                     /*!< Size = 528 (0x210)                                                        */
+
+
+
+/* =========================================================================================================================== */
+/* ================                                         CACHECTRL                                         ================ */
+/* =========================================================================================================================== */
+
+
+/**
+  * @brief Flash Cache Controller (CACHECTRL)
+  */
+
+typedef struct {                                /*!< (@ 0x40018000) CACHECTRL Structure                                        */
+  
+  union {
+    __IOM uint32_t CACHECFG;                    /*!< (@ 0x00000000) Flash Cache Control Register                               */
+    
+    struct {
+      __IOM uint32_t ENABLE     : 1;            /*!< (@ 0x00000000) Enables the flash cache controller. I/D caching
+                                                                    enabled independently.                                     */
+      __IOM uint32_t LRU        : 1;            /*!< (@ 0x00000001) Sets the cache replacement policy. 0=LRR (least
+                                                                    recently replaced), 1=LRU (least recently
+                                                                    used). LRR minimizes writes to the TAG
+                                                                    SRAM.                                                      */
+      __IOM uint32_t ENABLE_NC0 : 1;            /*!< (@ 0x00000002) Enable Non-cacheable region 0                              */
+      __IOM uint32_t ENABLE_NC1 : 1;            /*!< (@ 0x00000003) Enable Non-cacheable region 1                              */
+      __IOM uint32_t CONFIG     : 3;            /*!< (@ 0x00000004) Sets the cache configuration                               */
+      __IOM uint32_t SERIAL     : 1;            /*!< (@ 0x00000007) Bitfield should always be programmed to 0.                 */
+      __IOM uint32_t ICACHE_ENABLE : 1;         /*!< (@ 0x00000008) Enable Flash Instruction Caching                           */
+      __IOM uint32_t DCACHE_ENABLE : 1;         /*!< (@ 0x00000009) Enable Flash Instruction Caching                           */
+      __IOM uint32_t CACHE_CLKGATE : 1;         /*!< (@ 0x0000000A) Enable clock gating of cache RAMs                          */
+      __IOM uint32_t CACHE_LS   : 1;            /*!< (@ 0x0000000B) Enable LS (light sleep) of cache RAMs. When this
+                                                                    bit is set, the cache's RAMS will be put
+                                                                    into light sleep mode while inactive. NOTE:
+                                                                    if the cache is actively used, this may
+                                                                    have an adverse affect on power since entering/exiting
+                                                                    LS mode may consume more power than would
+                                                                    be saved.                                                  */
+      __IOM uint32_t DLY        : 4;            /*!< (@ 0x0000000C) Data RAM delay                                             */
+      __IOM uint32_t SMDLY      : 4;            /*!< (@ 0x00000010) Data RAM delay                                             */
+      __IOM uint32_t DATA_CLKGATE : 1;          /*!< (@ 0x00000014) Enable clock gating of entire data array                   */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t ENABLE_MONITOR : 1;        /*!< (@ 0x00000018) Enable Cache Monitoring Stats                              */
+    } CACHECFG_b;
+  } ;
+  
+  union {
+    __IOM uint32_t FLASHCFG;                    /*!< (@ 0x00000004) Flash Control Register                                     */
+    
+    struct {
+      __IOM uint32_t RD_WAIT    : 3;            /*!< (@ 0x00000000) Sets read waitstates (HCLK cycles)                         */
+    } FLASHCFG_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CACHECTRL;                   /*!< (@ 0x00000008) Cache Control                                              */
+    
+    struct {
+      __IOM uint32_t INVALIDATE : 1;            /*!< (@ 0x00000000) Writing a 1 to this bitfield invalidates the
+                                                                    flash cache contents.                                      */
+      __IOM uint32_t RESET_STAT : 1;            /*!< (@ 0x00000001) Writing a 1 to this bitfield will reset the cache
+                                                                    monitor statistics (DMON0-3, IMON0-3).
+                                                                    Statistic gathering can be paused/stopped
+                                                                    by disabling the MONITOR_ENABLE bit in
+                                                                    CACHECFG, which will maintain the count
+                                                                    values until the stats are reset by writing
+                                                                    this bitfield.                                             */
+      __IOM uint32_t CACHE_READY : 1;           /*!< (@ 0x00000002) Cache Ready Status (enabled and not processing
+                                                                    an invalidate operation)                                   */
+      __IM  uint32_t            : 1;
+      __IOM uint32_t FLASH0_SLM_STATUS : 1;     /*!< (@ 0x00000004) Flash Sleep Mode Status                                    */
+      __IOM uint32_t FLASH0_SLM_DISABLE : 1;    /*!< (@ 0x00000005) Disable Flash Sleep Mode                                   */
+      __IOM uint32_t FLASH0_SLM_ENABLE : 1;     /*!< (@ 0x00000006) Enable Flash Sleep Mode                                    */
+      __IM  uint32_t            : 1;
+      __IOM uint32_t FLASH1_SLM_STATUS : 1;     /*!< (@ 0x00000008) Flash Sleep Mode Status                                    */
+      __IOM uint32_t FLASH1_SLM_DISABLE : 1;    /*!< (@ 0x00000009) Disable Flash Sleep Mode                                   */
+      __IOM uint32_t FLASH1_SLM_ENABLE : 1;     /*!< (@ 0x0000000A) Enable Flash Sleep Mode                                    */
+    } CACHECTRL_b;
+  } ;
+  __IM  uint32_t  RESERVED;
+  
+  union {
+    __IOM uint32_t NCR0START;                   /*!< (@ 0x00000010) Flash Cache Noncachable Region 0 Start Address.            */
+    
+    struct {
+      __IM  uint32_t            : 4;
+      __IOM uint32_t ADDR       : 16;           /*!< (@ 0x00000004) Start address for non-cacheable region 0. The
+                                                                    physical address of the start of this region
+                                                                    should be programmed to this register and
+                                                                    must be aligned to a 16-byte boundary (thus
+                                                                    the lower 4 address bits are unused).                      */
+    } NCR0START_b;
+  } ;
+  
+  union {
+    __IOM uint32_t NCR0END;                     /*!< (@ 0x00000014) Flash Cache Noncachable Region 0 End                       */
+    
+    struct {
+      __IM  uint32_t            : 4;
+      __IOM uint32_t ADDR       : 16;           /*!< (@ 0x00000004) End address for non-cacheable region 0. The physical
+                                                                    address of the end of this region should
+                                                                    be programmed to this register and must
+                                                                    be aligned to a 16-byte boundary (thus
+                                                                    the lower 4 address bits are unused).                      */
+    } NCR0END_b;
+  } ;
+  
+  union {
+    __IOM uint32_t NCR1START;                   /*!< (@ 0x00000018) Flash Cache Noncachable Region 1 Start                     */
+    
+    struct {
+      __IM  uint32_t            : 4;
+      __IOM uint32_t ADDR       : 16;           /*!< (@ 0x00000004) Start address for non-cacheable region 1. The
+                                                                    physical address of the start of this region
+                                                                    should be programmed to this register and
+                                                                    must be aligned to a 16-byte boundary (thus
+                                                                    the lower 4 address bits are unused).                      */
+    } NCR1START_b;
+  } ;
+  
+  union {
+    __IOM uint32_t NCR1END;                     /*!< (@ 0x0000001C) Flash Cache Noncachable Region 1 End                       */
+    
+    struct {
+      __IM  uint32_t            : 4;
+      __IOM uint32_t ADDR       : 16;           /*!< (@ 0x00000004) End address for non-cacheable region 1. The physical
+                                                                    address of the end of this region should
+                                                                    be programmed to this register and must
+                                                                    be aligned to a 16-byte boundary (thus
+                                                                    the lower 4 address bits are unused).                      */
+    } NCR1END_b;
+  } ;
+  __IM  uint32_t  RESERVED1[4];
+  
+  union {
+    __IOM uint32_t CACHEMODE;                   /*!< (@ 0x00000030) Flash Cache Mode Register. Used to trim performance/power. */
+    
+    struct {
+      __IOM uint32_t THROTTLE1  : 1;            /*!< (@ 0x00000000) Disallow cache data RAM writes on tag RAM fill
+                                                                    cycles                                                     */
+      __IOM uint32_t THROTTLE2  : 1;            /*!< (@ 0x00000001) Disallow cache data RAM writes on tag RAM read
+                                                                    cycles                                                     */
+      __IOM uint32_t THROTTLE3  : 1;            /*!< (@ 0x00000002) Disallow cache data RAM writes on data RAM read
+                                                                    cycles                                                     */
+      __IOM uint32_t THROTTLE4  : 1;            /*!< (@ 0x00000003) Disallow Data RAM reads (from line hits) on tag
+                                                                    RAM fill cycles                                            */
+      __IOM uint32_t THROTTLE5  : 1;            /*!< (@ 0x00000004) Disallow Data RAM reads (from line hits) during
+                                                                    lookup read ops                                            */
+      __IOM uint32_t THROTTLE6  : 1;            /*!< (@ 0x00000005) Disallow Simultaneous Data RAM reads (from 2
+                                                                    line hits on each bus)                                     */
+    } CACHEMODE_b;
+  } ;
+  __IM  uint32_t  RESERVED2[3];
+  
+  union {
+    __IOM uint32_t DMON0;                       /*!< (@ 0x00000040) Data Cache Total Accesses                                  */
+    
+    struct {
+      __IOM uint32_t DACCESS_COUNT : 32;        /*!< (@ 0x00000000) Total accesses to data cache                               */
+    } DMON0_b;
+  } ;
+  
+  union {
+    __IOM uint32_t DMON1;                       /*!< (@ 0x00000044) Data Cache Tag Lookups                                     */
+    
+    struct {
+      __IOM uint32_t DLOOKUP_COUNT : 32;        /*!< (@ 0x00000000) Total tag lookups from data cache                          */
+    } DMON1_b;
+  } ;
+  
+  union {
+    __IOM uint32_t DMON2;                       /*!< (@ 0x00000048) Data Cache Hits                                            */
+    
+    struct {
+      __IOM uint32_t DHIT_COUNT : 32;           /*!< (@ 0x00000000) Cache hits from lookup operations                          */
+    } DMON2_b;
+  } ;
+  
+  union {
+    __IOM uint32_t DMON3;                       /*!< (@ 0x0000004C) Data Cache Line Hits                                       */
+    
+    struct {
+      __IOM uint32_t DLINE_COUNT : 32;          /*!< (@ 0x00000000) Cache hits from line cache                                 */
+    } DMON3_b;
+  } ;
+  
+  union {
+    __IOM uint32_t IMON0;                       /*!< (@ 0x00000050) Instruction Cache Total Accesses                           */
+    
+    struct {
+      __IOM uint32_t IACCESS_COUNT : 32;        /*!< (@ 0x00000000) Total accesses to Instruction cache                        */
+    } IMON0_b;
+  } ;
+  
+  union {
+    __IOM uint32_t IMON1;                       /*!< (@ 0x00000054) Instruction Cache Tag Lookups                              */
+    
+    struct {
+      __IOM uint32_t ILOOKUP_COUNT : 32;        /*!< (@ 0x00000000) Total tag lookups from Instruction cache                   */
+    } IMON1_b;
+  } ;
+  
+  union {
+    __IOM uint32_t IMON2;                       /*!< (@ 0x00000058) Instruction Cache Hits                                     */
+    
+    struct {
+      __IOM uint32_t IHIT_COUNT : 32;           /*!< (@ 0x00000000) Cache hits from lookup operations                          */
+    } IMON2_b;
+  } ;
+  
+  union {
+    __IOM uint32_t IMON3;                       /*!< (@ 0x0000005C) Instruction Cache Line Hits                                */
+    
+    struct {
+      __IOM uint32_t ILINE_COUNT : 32;          /*!< (@ 0x00000000) Cache hits from line cache                                 */
+    } IMON3_b;
+  } ;
+} CACHECTRL_Type;                               /*!< Size = 96 (0x60)                                                          */
+
+
+
+/* =========================================================================================================================== */
+/* ================                                          CTIMER                                           ================ */
+/* =========================================================================================================================== */
+
+
+/**
+  * @brief Counter/Timer (CTIMER)
+  */
+
+typedef struct {                                /*!< (@ 0x40008000) CTIMER Structure                                           */
+  
+  union {
+    __IOM uint32_t TMR0;                        /*!< (@ 0x00000000) Counter/Timer Register                                     */
+    
+    struct {
+      __IOM uint32_t CTTMRA0    : 16;           /*!< (@ 0x00000000) Counter/Timer A0.                                          */
+      __IOM uint32_t CTTMRB0    : 16;           /*!< (@ 0x00000010) Counter/Timer B0.                                          */
+    } TMR0_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CMPRA0;                      /*!< (@ 0x00000004) Counter/Timer A0 Compare Registers                         */
+    
+    struct {
+      __IOM uint32_t CMPR0A0    : 16;           /*!< (@ 0x00000000) Counter/Timer A0 Compare Register 0. Holds the
+                                                                    lower limit for timer half A.                              */
+      __IOM uint32_t CMPR1A0    : 16;           /*!< (@ 0x00000010) Counter/Timer A0 Compare Register 1. Holds the
+                                                                    upper limit for timer half A.                              */
+    } CMPRA0_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CMPRB0;                      /*!< (@ 0x00000008) Counter/Timer B0 Compare Registers                         */
+    
+    struct {
+      __IOM uint32_t CMPR0B0    : 16;           /*!< (@ 0x00000000) Counter/Timer B0 Compare Register 0. Holds the
+                                                                    lower limit for timer half B.                              */
+      __IOM uint32_t CMPR1B0    : 16;           /*!< (@ 0x00000010) Counter/Timer B0 Compare Register 1. Holds the
+                                                                    upper limit for timer half B.                              */
+    } CMPRB0_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CTRL0;                       /*!< (@ 0x0000000C) Counter/Timer Control                                      */
+    
+    struct {
+      __IOM uint32_t TMRA0EN    : 1;            /*!< (@ 0x00000000) Counter/Timer A0 Enable bit.                               */
+      __IOM uint32_t TMRA0CLK   : 5;            /*!< (@ 0x00000001) Counter/Timer A0 Clock Select.                             */
+      __IOM uint32_t TMRA0FN    : 3;            /*!< (@ 0x00000006) Counter/Timer A0 Function Select.                          */
+      __IOM uint32_t TMRA0IE0   : 1;            /*!< (@ 0x00000009) Counter/Timer A0 Interrupt Enable bit based on
+                                                                    COMPR0.                                                    */
+      __IOM uint32_t TMRA0IE1   : 1;            /*!< (@ 0x0000000A) Counter/Timer A0 Interrupt Enable bit based on
+                                                                    COMPR1.                                                    */
+      __IOM uint32_t TMRA0CLR   : 1;            /*!< (@ 0x0000000B) Counter/Timer A0 Clear bit.                                */
+      __IOM uint32_t TMRA0POL   : 1;            /*!< (@ 0x0000000C) Counter/Timer A0 output polarity.                          */
+      __IOM uint32_t TMRA0PE    : 1;            /*!< (@ 0x0000000D) Counter/Timer A0 Output Enable bit.                        */
+      __IM  uint32_t            : 2;
+      __IOM uint32_t TMRB0EN    : 1;            /*!< (@ 0x00000010) Counter/Timer B0 Enable bit.                               */
+      __IOM uint32_t TMRB0CLK   : 5;            /*!< (@ 0x00000011) Counter/Timer B0 Clock Select.                             */
+      __IOM uint32_t TMRB0FN    : 3;            /*!< (@ 0x00000016) Counter/Timer B0 Function Select.                          */
+      __IOM uint32_t TMRB0IE0   : 1;            /*!< (@ 0x00000019) Counter/Timer B0 Interrupt Enable bit for COMPR0.          */
+      __IOM uint32_t TMRB0IE1   : 1;            /*!< (@ 0x0000001A) Counter/Timer B0 Interrupt Enable bit for COMPR1.          */
+      __IOM uint32_t TMRB0CLR   : 1;            /*!< (@ 0x0000001B) Counter/Timer B0 Clear bit.                                */
+      __IOM uint32_t TMRB0POL   : 1;            /*!< (@ 0x0000001C) Counter/Timer B0 output polarity.                          */
+      __IOM uint32_t TMRB0PE    : 1;            /*!< (@ 0x0000001D) Counter/Timer B0 Output Enable bit.                        */
+      __IM  uint32_t            : 1;
+      __IOM uint32_t CTLINK0    : 1;            /*!< (@ 0x0000001F) Counter/Timer A0/B0 Link bit.                              */
+    } CTRL0_b;
+  } ;
+  
+  union {
+    __IOM uint32_t TMR1;                        /*!< (@ 0x00000010) Counter/Timer Register                                     */
+    
+    struct {
+      __IOM uint32_t CTTMRA1    : 16;           /*!< (@ 0x00000000) Counter/Timer A1.                                          */
+      __IOM uint32_t CTTMRB1    : 16;           /*!< (@ 0x00000010) Counter/Timer B1.                                          */
+    } TMR1_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CMPRA1;                      /*!< (@ 0x00000014) Counter/Timer A1 Compare Registers                         */
+    
+    struct {
+      __IOM uint32_t CMPR0A1    : 16;           /*!< (@ 0x00000000) Counter/Timer A1 Compare Register 0.                       */
+      __IOM uint32_t CMPR1A1    : 16;           /*!< (@ 0x00000010) Counter/Timer A1 Compare Register 1.                       */
+    } CMPRA1_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CMPRB1;                      /*!< (@ 0x00000018) Counter/Timer B1 Compare Registers                         */
+    
+    struct {
+      __IOM uint32_t CMPR0B1    : 16;           /*!< (@ 0x00000000) Counter/Timer B1 Compare Register 0.                       */
+      __IOM uint32_t CMPR1B1    : 16;           /*!< (@ 0x00000010) Counter/Timer B1 Compare Register 1.                       */
+    } CMPRB1_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CTRL1;                       /*!< (@ 0x0000001C) Counter/Timer Control                                      */
+    
+    struct {
+      __IOM uint32_t TMRA1EN    : 1;            /*!< (@ 0x00000000) Counter/Timer A1 Enable bit.                               */
+      __IOM uint32_t TMRA1CLK   : 5;            /*!< (@ 0x00000001) Counter/Timer A1 Clock Select.                             */
+      __IOM uint32_t TMRA1FN    : 3;            /*!< (@ 0x00000006) Counter/Timer A1 Function Select.                          */
+      __IOM uint32_t TMRA1IE0   : 1;            /*!< (@ 0x00000009) Counter/Timer A1 Interrupt Enable bit based on
+                                                                    COMPR0.                                                    */
+      __IOM uint32_t TMRA1IE1   : 1;            /*!< (@ 0x0000000A) Counter/Timer A1 Interrupt Enable bit based on
+                                                                    COMPR1.                                                    */
+      __IOM uint32_t TMRA1CLR   : 1;            /*!< (@ 0x0000000B) Counter/Timer A1 Clear bit.                                */
+      __IOM uint32_t TMRA1POL   : 1;            /*!< (@ 0x0000000C) Counter/Timer A1 output polarity.                          */
+      __IOM uint32_t TMRA1PE    : 1;            /*!< (@ 0x0000000D) Counter/Timer A1 Output Enable bit.                        */
+      __IM  uint32_t            : 2;
+      __IOM uint32_t TMRB1EN    : 1;            /*!< (@ 0x00000010) Counter/Timer B1 Enable bit.                               */
+      __IOM uint32_t TMRB1CLK   : 5;            /*!< (@ 0x00000011) Counter/Timer B1 Clock Select.                             */
+      __IOM uint32_t TMRB1FN    : 3;            /*!< (@ 0x00000016) Counter/Timer B1 Function Select.                          */
+      __IOM uint32_t TMRB1IE0   : 1;            /*!< (@ 0x00000019) Counter/Timer B1 Interrupt Enable bit for COMPR0.          */
+      __IOM uint32_t TMRB1IE1   : 1;            /*!< (@ 0x0000001A) Counter/Timer B1 Interrupt Enable bit for COMPR1.          */
+      __IOM uint32_t TMRB1CLR   : 1;            /*!< (@ 0x0000001B) Counter/Timer B1 Clear bit.                                */
+      __IOM uint32_t TMRB1POL   : 1;            /*!< (@ 0x0000001C) Counter/Timer B1 output polarity.                          */
+      __IOM uint32_t TMRB1PE    : 1;            /*!< (@ 0x0000001D) Counter/Timer B1 Output Enable bit.                        */
+      __IM  uint32_t            : 1;
+      __IOM uint32_t CTLINK1    : 1;            /*!< (@ 0x0000001F) Counter/Timer A1/B1 Link bit.                              */
+    } CTRL1_b;
+  } ;
+  
+  union {
+    __IOM uint32_t TMR2;                        /*!< (@ 0x00000020) Counter/Timer Register                                     */
+    
+    struct {
+      __IOM uint32_t CTTMRA2    : 16;           /*!< (@ 0x00000000) Counter/Timer A2.                                          */
+      __IOM uint32_t CTTMRB2    : 16;           /*!< (@ 0x00000010) Counter/Timer B2.                                          */
+    } TMR2_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CMPRA2;                      /*!< (@ 0x00000024) Counter/Timer A2 Compare Registers                         */
+    
+    struct {
+      __IOM uint32_t CMPR0A2    : 16;           /*!< (@ 0x00000000) Counter/Timer A2 Compare Register 0.                       */
+      __IOM uint32_t CMPR1A2    : 16;           /*!< (@ 0x00000010) Counter/Timer A2 Compare Register 1.                       */
+    } CMPRA2_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CMPRB2;                      /*!< (@ 0x00000028) Counter/Timer B2 Compare Registers                         */
+    
+    struct {
+      __IOM uint32_t CMPR0B2    : 16;           /*!< (@ 0x00000000) Counter/Timer B2 Compare Register 0.                       */
+      __IOM uint32_t CMPR1B2    : 16;           /*!< (@ 0x00000010) Counter/Timer B2 Compare Register 1.                       */
+    } CMPRB2_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CTRL2;                       /*!< (@ 0x0000002C) Counter/Timer Control                                      */
+    
+    struct {
+      __IOM uint32_t TMRA2EN    : 1;            /*!< (@ 0x00000000) Counter/Timer A2 Enable bit.                               */
+      __IOM uint32_t TMRA2CLK   : 5;            /*!< (@ 0x00000001) Counter/Timer A2 Clock Select.                             */
+      __IOM uint32_t TMRA2FN    : 3;            /*!< (@ 0x00000006) Counter/Timer A2 Function Select.                          */
+      __IOM uint32_t TMRA2IE0   : 1;            /*!< (@ 0x00000009) Counter/Timer A2 Interrupt Enable bit based on
+                                                                    COMPR0.                                                    */
+      __IOM uint32_t TMRA2IE1   : 1;            /*!< (@ 0x0000000A) Counter/Timer A2 Interrupt Enable bit based on
+                                                                    COMPR1.                                                    */
+      __IOM uint32_t TMRA2CLR   : 1;            /*!< (@ 0x0000000B) Counter/Timer A2 Clear bit.                                */
+      __IOM uint32_t TMRA2POL   : 1;            /*!< (@ 0x0000000C) Counter/Timer A2 output polarity.                          */
+      __IOM uint32_t TMRA2PE    : 1;            /*!< (@ 0x0000000D) Counter/Timer A2 Output Enable bit.                        */
+      __IM  uint32_t            : 2;
+      __IOM uint32_t TMRB2EN    : 1;            /*!< (@ 0x00000010) Counter/Timer B2 Enable bit.                               */
+      __IOM uint32_t TMRB2CLK   : 5;            /*!< (@ 0x00000011) Counter/Timer B2 Clock Select.                             */
+      __IOM uint32_t TMRB2FN    : 3;            /*!< (@ 0x00000016) Counter/Timer B2 Function Select.                          */
+      __IOM uint32_t TMRB2IE0   : 1;            /*!< (@ 0x00000019) Counter/Timer B2 Interrupt Enable bit for COMPR0.          */
+      __IOM uint32_t TMRB2IE1   : 1;            /*!< (@ 0x0000001A) Counter/Timer B2 Interrupt Enable bit for COMPR1.          */
+      __IOM uint32_t TMRB2CLR   : 1;            /*!< (@ 0x0000001B) Counter/Timer B2 Clear bit.                                */
+      __IOM uint32_t TMRB2POL   : 1;            /*!< (@ 0x0000001C) Counter/Timer B2 output polarity.                          */
+      __IOM uint32_t TMRB2PE    : 1;            /*!< (@ 0x0000001D) Counter/Timer B2 Output Enable bit.                        */
+      __IM  uint32_t            : 1;
+      __IOM uint32_t CTLINK2    : 1;            /*!< (@ 0x0000001F) Counter/Timer A2/B2 Link bit.                              */
+    } CTRL2_b;
+  } ;
+  
+  union {
+    __IOM uint32_t TMR3;                        /*!< (@ 0x00000030) Counter/Timer Register                                     */
+    
+    struct {
+      __IOM uint32_t CTTMRA3    : 16;           /*!< (@ 0x00000000) Counter/Timer A3.                                          */
+      __IOM uint32_t CTTMRB3    : 16;           /*!< (@ 0x00000010) Counter/Timer B3.                                          */
+    } TMR3_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CMPRA3;                      /*!< (@ 0x00000034) Counter/Timer A3 Compare Registers                         */
+    
+    struct {
+      __IOM uint32_t CMPR0A3    : 16;           /*!< (@ 0x00000000) Counter/Timer A3 Compare Register 0.                       */
+      __IOM uint32_t CMPR1A3    : 16;           /*!< (@ 0x00000010) Counter/Timer A3 Compare Register 1.                       */
+    } CMPRA3_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CMPRB3;                      /*!< (@ 0x00000038) Counter/Timer B3 Compare Registers                         */
+    
+    struct {
+      __IOM uint32_t CMPR0B3    : 16;           /*!< (@ 0x00000000) Counter/Timer B3 Compare Register 0.                       */
+      __IOM uint32_t CMPR1B3    : 16;           /*!< (@ 0x00000010) Counter/Timer B3 Compare Register 1.                       */
+    } CMPRB3_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CTRL3;                       /*!< (@ 0x0000003C) Counter/Timer Control                                      */
+    
+    struct {
+      __IOM uint32_t TMRA3EN    : 1;            /*!< (@ 0x00000000) Counter/Timer A3 Enable bit.                               */
+      __IOM uint32_t TMRA3CLK   : 5;            /*!< (@ 0x00000001) Counter/Timer A3 Clock Select.                             */
+      __IOM uint32_t TMRA3FN    : 3;            /*!< (@ 0x00000006) Counter/Timer A3 Function Select.                          */
+      __IOM uint32_t TMRA3IE0   : 1;            /*!< (@ 0x00000009) Counter/Timer A3 Interrupt Enable bit based on
+                                                                    COMPR0.                                                    */
+      __IOM uint32_t TMRA3IE1   : 1;            /*!< (@ 0x0000000A) Counter/Timer A3 Interrupt Enable bit based on
+                                                                    COMPR1.                                                    */
+      __IOM uint32_t TMRA3CLR   : 1;            /*!< (@ 0x0000000B) Counter/Timer A3 Clear bit.                                */
+      __IOM uint32_t TMRA3POL   : 1;            /*!< (@ 0x0000000C) Counter/Timer A3 output polarity.                          */
+      __IOM uint32_t TMRA3PE    : 1;            /*!< (@ 0x0000000D) Counter/Timer A3 Output Enable bit.                        */
+      __IM  uint32_t            : 1;
+      __IOM uint32_t ADCEN      : 1;            /*!< (@ 0x0000000F) Special Timer A3 enable for ADC function.                  */
+      __IOM uint32_t TMRB3EN    : 1;            /*!< (@ 0x00000010) Counter/Timer B3 Enable bit.                               */
+      __IOM uint32_t TMRB3CLK   : 5;            /*!< (@ 0x00000011) Counter/Timer B3 Clock Select.                             */
+      __IOM uint32_t TMRB3FN    : 3;            /*!< (@ 0x00000016) Counter/Timer B3 Function Select.                          */
+      __IOM uint32_t TMRB3IE0   : 1;            /*!< (@ 0x00000019) Counter/Timer B3 Interrupt Enable bit for COMPR0.          */
+      __IOM uint32_t TMRB3IE1   : 1;            /*!< (@ 0x0000001A) Counter/Timer B3 Interrupt Enable bit for COMPR1.          */
+      __IOM uint32_t TMRB3CLR   : 1;            /*!< (@ 0x0000001B) Counter/Timer B3 Clear bit.                                */
+      __IOM uint32_t TMRB3POL   : 1;            /*!< (@ 0x0000001C) Counter/Timer B3 output polarity.                          */
+      __IOM uint32_t TMRB3PE    : 1;            /*!< (@ 0x0000001D) Counter/Timer B3 Output Enable bit.                        */
+      __IM  uint32_t            : 1;
+      __IOM uint32_t CTLINK3    : 1;            /*!< (@ 0x0000001F) Counter/Timer A3/B3 Link bit.                              */
+    } CTRL3_b;
+  } ;
+  __IM  uint32_t  RESERVED[48];
+  
+  union {
+    __IOM uint32_t STCFG;                       /*!< (@ 0x00000100) Configuration Register                                     */
+    
+    struct {
+      __IOM uint32_t CLKSEL     : 4;            /*!< (@ 0x00000000) Selects an appropriate clock source and divider
+                                                                    to use for the System Timer clock.                         */
+      __IM  uint32_t            : 4;
+      __IOM uint32_t COMPARE_A_EN : 1;          /*!< (@ 0x00000008) Selects whether compare is enabled for the corresponding
+                                                                    SCMPR register. If compare is enabled,
+                                                                    the interrupt status is set once the comparision
+                                                                    is met.                                                    */
+      __IOM uint32_t COMPARE_B_EN : 1;          /*!< (@ 0x00000009) Selects whether compare is enabled for the corresponding
+                                                                    SCMPR register. If compare is enabled,
+                                                                    the interrupt status is set once the comparision
+                                                                    is met.                                                    */
+      __IOM uint32_t COMPARE_C_EN : 1;          /*!< (@ 0x0000000A) Selects whether compare is enabled for the corresponding
+                                                                    SCMPR register. If compare is enabled,
+                                                                    the interrupt status is set once the comparision
+                                                                    is met.                                                    */
+      __IOM uint32_t COMPARE_D_EN : 1;          /*!< (@ 0x0000000B) Selects whether compare is enabled for the corresponding
+                                                                    SCMPR register. If compare is enabled,
+                                                                    the interrupt status is set once the comparision
+                                                                    is met.                                                    */
+      __IOM uint32_t COMPARE_E_EN : 1;          /*!< (@ 0x0000000C) Selects whether compare is enabled for the corresponding
+                                                                    SCMPR register. If compare is enabled,
+                                                                    the interrupt status is set once the comparision
+                                                                    is met.                                                    */
+      __IOM uint32_t COMPARE_F_EN : 1;          /*!< (@ 0x0000000D) Selects whether compare is enabled for the corresponding
+                                                                    SCMPR register. If compare is enabled,
+                                                                    the interrupt status is set once the comparision
+                                                                    is met.                                                    */
+      __IOM uint32_t COMPARE_G_EN : 1;          /*!< (@ 0x0000000E) Selects whether compare is enabled for the corresponding
+                                                                    SCMPR register. If compare is enabled,
+                                                                    the interrupt status is set once the comparision
+                                                                    is met.                                                    */
+      __IOM uint32_t COMPARE_H_EN : 1;          /*!< (@ 0x0000000F) Selects whether compare is enabled for the corresponding
+                                                                    SCMPR register. If compare is enabled,
+                                                                    the interrupt status is set once the comparision
+                                                                    is met.                                                    */
+      __IM  uint32_t            : 14;
+      __IOM uint32_t CLEAR      : 1;            /*!< (@ 0x0000001E) Set this bit to one to clear the System Timer
+                                                                    register. If this bit is set to '1', the
+                                                                    system timer register will stay cleared.
+                                                                    It needs to be set to '0' for the system
+                                                                    timer to start running.                                    */
+      __IOM uint32_t FREEZE     : 1;            /*!< (@ 0x0000001F) Set this bit to one to freeze the clock input
+                                                                    to the COUNTER register. Once frozen, the
+                                                                    value can be safely written from the MCU.
+                                                                    Unfreeze to resume.                                        */
+    } STCFG_b;
+  } ;
+  
+  union {
+    __IOM uint32_t STTMR;                       /*!< (@ 0x00000104) System Timer Count Register (Real Time Counter)            */
+    
+    struct {
+      __IOM uint32_t VALUE      : 32;           /*!< (@ 0x00000000) Value of the 32-bit counter as it ticks over.              */
+    } STTMR_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CAPTURE_CONTROL;             /*!< (@ 0x00000108) Capture Control Register                                   */
+    
+    struct {
+      __IOM uint32_t CAPTURE_A  : 1;            /*!< (@ 0x00000000) Selects whether capture is enabled for the specified
+                                                                    capture register.                                          */
+      __IOM uint32_t CAPTURE_B  : 1;            /*!< (@ 0x00000001) Selects whether capture is enabled for the specified
+                                                                    capture register.                                          */
+      __IOM uint32_t CAPTURE_C  : 1;            /*!< (@ 0x00000002) Selects whether capture is enabled for the specified
+                                                                    capture register.                                          */
+      __IOM uint32_t CAPTURE_D  : 1;            /*!< (@ 0x00000003) Selects whether capture is enabled for the specified
+                                                                    capture register.                                          */
+    } CAPTURE_CONTROL_b;
+  } ;
+  __IM  uint32_t  RESERVED1;
+  
+  union {
+    __IOM uint32_t SCMPR0;                      /*!< (@ 0x00000110) Compare Register A                                         */
+    
+    struct {
+      __IOM uint32_t VALUE      : 32;           /*!< (@ 0x00000000) Compare this value to the value in the COUNTER
+                                                                    register according to the match criterion,
+                                                                    as selected in the COMPARE_A_EN bit in
+                                                                    the REG_CTIMER_STCGF register.                             */
+    } SCMPR0_b;
+  } ;
+  
+  union {
+    __IOM uint32_t SCMPR1;                      /*!< (@ 0x00000114) Compare Register B                                         */
+    
+    struct {
+      __IOM uint32_t VALUE      : 32;           /*!< (@ 0x00000000) Compare this value to the value in the COUNTER
+                                                                    register according to the match criterion,
+                                                                    as selected in the COMPARE_B_EN bit in
+                                                                    the REG_CTIMER_STCGF register.                             */
+    } SCMPR1_b;
+  } ;
+  
+  union {
+    __IOM uint32_t SCMPR2;                      /*!< (@ 0x00000118) Compare Register C                                         */
+    
+    struct {
+      __IOM uint32_t VALUE      : 32;           /*!< (@ 0x00000000) Compare this value to the value in the COUNTER
+                                                                    register according to the match criterion,
+                                                                    as selected in the COMPARE_C_EN bit in
+                                                                    the REG_CTIMER_STCGF register.                             */
+    } SCMPR2_b;
+  } ;
+  
+  union {
+    __IOM uint32_t SCMPR3;                      /*!< (@ 0x0000011C) Compare Register D                                         */
+    
+    struct {
+      __IOM uint32_t VALUE      : 32;           /*!< (@ 0x00000000) Compare this value to the value in the COUNTER
+                                                                    register according to the match criterion,
+                                                                    as selected in the COMPARE_D_EN bit in
+                                                                    the REG_CTIMER_STCGF register.                             */
+    } SCMPR3_b;
+  } ;
+  
+  union {
+    __IOM uint32_t SCMPR4;                      /*!< (@ 0x00000120) Compare Register E                                         */
+    
+    struct {
+      __IOM uint32_t VALUE      : 32;           /*!< (@ 0x00000000) Compare this value to the value in the COUNTER
+                                                                    register according to the match criterion,
+                                                                    as selected in the COMPARE_E_EN bit in
+                                                                    the REG_CTIMER_STCGF register.                             */
+    } SCMPR4_b;
+  } ;
+  
+  union {
+    __IOM uint32_t SCMPR5;                      /*!< (@ 0x00000124) Compare Register F                                         */
+    
+    struct {
+      __IOM uint32_t VALUE      : 32;           /*!< (@ 0x00000000) Compare this value to the value in the COUNTER
+                                                                    register according to the match criterion,
+                                                                    as selected in the COMPARE_F_EN bit in
+                                                                    the REG_CTIMER_STCGF register.                             */
+    } SCMPR5_b;
+  } ;
+  
+  union {
+    __IOM uint32_t SCMPR6;                      /*!< (@ 0x00000128) Compare Register G                                         */
+    
+    struct {
+      __IOM uint32_t VALUE      : 32;           /*!< (@ 0x00000000) Compare this value to the value in the COUNTER
+                                                                    register according to the match criterion,
+                                                                    as selected in the COMPARE_G_EN bit in
+                                                                    the REG_CTIMER_STCGF register.                             */
+    } SCMPR6_b;
+  } ;
+  
+  union {
+    __IOM uint32_t SCMPR7;                      /*!< (@ 0x0000012C) Compare Register H                                         */
+    
+    struct {
+      __IOM uint32_t VALUE      : 32;           /*!< (@ 0x00000000) Compare this value to the value in the COUNTER
+                                                                    register according to the match criterion,
+                                                                    as selected in the COMPARE_H_EN bit in
+                                                                    the REG_CTIMER_STCGF register.                             */
+    } SCMPR7_b;
+  } ;
+  __IM  uint32_t  RESERVED2[44];
+  
+  union {
+    __IOM uint32_t SCAPT0;                      /*!< (@ 0x000001E0) Capture Register A                                         */
+    
+    struct {
+      __IOM uint32_t VALUE      : 32;           /*!< (@ 0x00000000) Whenever the event is detected, the value in
+                                                                    the COUNTER is copied into this register
+                                                                    and the corresponding interrupt status
+                                                                    bit is set.                                                */
+    } SCAPT0_b;
+  } ;
+  
+  union {
+    __IOM uint32_t SCAPT1;                      /*!< (@ 0x000001E4) Capture Register B                                         */
+    
+    struct {
+      __IOM uint32_t VALUE      : 32;           /*!< (@ 0x00000000) Whenever the event is detected, the value in
+                                                                    the COUNTER is copied into this register
+                                                                    and the corresponding interrupt status
+                                                                    bit is set.                                                */
+    } SCAPT1_b;
+  } ;
+  
+  union {
+    __IOM uint32_t SCAPT2;                      /*!< (@ 0x000001E8) Capture Register C                                         */
+    
+    struct {
+      __IOM uint32_t VALUE      : 32;           /*!< (@ 0x00000000) Whenever the event is detected, the value in
+                                                                    the COUNTER is copied into this register
+                                                                    and the corresponding interrupt status
+                                                                    bit is set.                                                */
+    } SCAPT2_b;
+  } ;
+  
+  union {
+    __IOM uint32_t SCAPT3;                      /*!< (@ 0x000001EC) Capture Register D                                         */
+    
+    struct {
+      __IOM uint32_t VALUE      : 32;           /*!< (@ 0x00000000) Whenever the event is detected, the value in
+                                                                    the COUNTER is copied into this register
+                                                                    and the corresponding interrupt status
+                                                                    bit is set.                                                */
+    } SCAPT3_b;
+  } ;
+  
+  union {
+    __IOM uint32_t SNVR0;                       /*!< (@ 0x000001F0) System Timer NVRAM_A Register                              */
+    
+    struct {
+      __IOM uint32_t VALUE      : 32;           /*!< (@ 0x00000000) Value of the 32-bit counter as it ticks over.              */
+    } SNVR0_b;
+  } ;
+  
+  union {
+    __IOM uint32_t SNVR1;                       /*!< (@ 0x000001F4) System Timer NVRAM_B Register                              */
+    
+    struct {
+      __IOM uint32_t VALUE      : 32;           /*!< (@ 0x00000000) Value of the 32-bit counter as it ticks over.              */
+    } SNVR1_b;
+  } ;
+  
+  union {
+    __IOM uint32_t SNVR2;                       /*!< (@ 0x000001F8) System Timer NVRAM_C Register                              */
+    
+    struct {
+      __IOM uint32_t VALUE      : 32;           /*!< (@ 0x00000000) Value of the 32-bit counter as it ticks over.              */
+    } SNVR2_b;
+  } ;
+  __IM  uint32_t  RESERVED3;
+  
+  union {
+    __IOM uint32_t INTEN;                       /*!< (@ 0x00000200) Counter/Timer Interrupts: Enable                           */
+    
+    struct {
+      __IOM uint32_t CTMRA0C0INT : 1;           /*!< (@ 0x00000000) Counter/Timer A0 interrupt based on COMPR0.                */
+      __IOM uint32_t CTMRB0C0INT : 1;           /*!< (@ 0x00000001) Counter/Timer B0 interrupt based on COMPR0.                */
+      __IOM uint32_t CTMRA1C0INT : 1;           /*!< (@ 0x00000002) Counter/Timer A1 interrupt based on COMPR0.                */
+      __IOM uint32_t CTMRB1C0INT : 1;           /*!< (@ 0x00000003) Counter/Timer B1 interrupt based on COMPR0.                */
+      __IOM uint32_t CTMRA2C0INT : 1;           /*!< (@ 0x00000004) Counter/Timer A2 interrupt based on COMPR0.                */
+      __IOM uint32_t CTMRB2C0INT : 1;           /*!< (@ 0x00000005) Counter/Timer B2 interrupt based on COMPR0.                */
+      __IOM uint32_t CTMRA3C0INT : 1;           /*!< (@ 0x00000006) Counter/Timer A3 interrupt based on COMPR0.                */
+      __IOM uint32_t CTMRB3C0INT : 1;           /*!< (@ 0x00000007) Counter/Timer B3 interrupt based on COMPR0.                */
+      __IOM uint32_t CTMRA0C1INT : 1;           /*!< (@ 0x00000008) Counter/Timer A0 interrupt based on COMPR1.                */
+      __IOM uint32_t CTMRB0C1INT : 1;           /*!< (@ 0x00000009) Counter/Timer B0 interrupt based on COMPR1.                */
+      __IOM uint32_t CTMRA1C1INT : 1;           /*!< (@ 0x0000000A) Counter/Timer A1 interrupt based on COMPR1.                */
+      __IOM uint32_t CTMRB1C1INT : 1;           /*!< (@ 0x0000000B) Counter/Timer B1 interrupt based on COMPR1.                */
+      __IOM uint32_t CTMRA2C1INT : 1;           /*!< (@ 0x0000000C) Counter/Timer A2 interrupt based on COMPR1.                */
+      __IOM uint32_t CTMRB2C1INT : 1;           /*!< (@ 0x0000000D) Counter/Timer B2 interrupt based on COMPR1.                */
+      __IOM uint32_t CTMRA3C1INT : 1;           /*!< (@ 0x0000000E) Counter/Timer A3 interrupt based on COMPR1.                */
+      __IOM uint32_t CTMRB3C1INT : 1;           /*!< (@ 0x0000000F) Counter/Timer B3 interrupt based on COMPR1.                */
+    } INTEN_b;
+  } ;
+  
+  union {
+    __IOM uint32_t INTSTAT;                     /*!< (@ 0x00000204) Counter/Timer Interrupts: Status                           */
+    
+    struct {
+      __IOM uint32_t CTMRA0C0INT : 1;           /*!< (@ 0x00000000) Counter/Timer A0 interrupt based on COMPR0.                */
+      __IOM uint32_t CTMRB0C0INT : 1;           /*!< (@ 0x00000001) Counter/Timer B0 interrupt based on COMPR0.                */
+      __IOM uint32_t CTMRA1C0INT : 1;           /*!< (@ 0x00000002) Counter/Timer A1 interrupt based on COMPR0.                */
+      __IOM uint32_t CTMRB1C0INT : 1;           /*!< (@ 0x00000003) Counter/Timer B1 interrupt based on COMPR0.                */
+      __IOM uint32_t CTMRA2C0INT : 1;           /*!< (@ 0x00000004) Counter/Timer A2 interrupt based on COMPR0.                */
+      __IOM uint32_t CTMRB2C0INT : 1;           /*!< (@ 0x00000005) Counter/Timer B2 interrupt based on COMPR0.                */
+      __IOM uint32_t CTMRA3C0INT : 1;           /*!< (@ 0x00000006) Counter/Timer A3 interrupt based on COMPR0.                */
+      __IOM uint32_t CTMRB3C0INT : 1;           /*!< (@ 0x00000007) Counter/Timer B3 interrupt based on COMPR0.                */
+      __IOM uint32_t CTMRA0C1INT : 1;           /*!< (@ 0x00000008) Counter/Timer A0 interrupt based on COMPR1.                */
+      __IOM uint32_t CTMRB0C1INT : 1;           /*!< (@ 0x00000009) Counter/Timer B0 interrupt based on COMPR1.                */
+      __IOM uint32_t CTMRA1C1INT : 1;           /*!< (@ 0x0000000A) Counter/Timer A1 interrupt based on COMPR1.                */
+      __IOM uint32_t CTMRB1C1INT : 1;           /*!< (@ 0x0000000B) Counter/Timer B1 interrupt based on COMPR1.                */
+      __IOM uint32_t CTMRA2C1INT : 1;           /*!< (@ 0x0000000C) Counter/Timer A2 interrupt based on COMPR1.                */
+      __IOM uint32_t CTMRB2C1INT : 1;           /*!< (@ 0x0000000D) Counter/Timer B2 interrupt based on COMPR1.                */
+      __IOM uint32_t CTMRA3C1INT : 1;           /*!< (@ 0x0000000E) Counter/Timer A3 interrupt based on COMPR1.                */
+      __IOM uint32_t CTMRB3C1INT : 1;           /*!< (@ 0x0000000F) Counter/Timer B3 interrupt based on COMPR1.                */
+    } INTSTAT_b;
+  } ;
+  
+  union {
+    __IOM uint32_t INTCLR;                      /*!< (@ 0x00000208) Counter/Timer Interrupts: Clear                            */
+    
+    struct {
+      __IOM uint32_t CTMRA0C0INT : 1;           /*!< (@ 0x00000000) Counter/Timer A0 interrupt based on COMPR0.                */
+      __IOM uint32_t CTMRB0C0INT : 1;           /*!< (@ 0x00000001) Counter/Timer B0 interrupt based on COMPR0.                */
+      __IOM uint32_t CTMRA1C0INT : 1;           /*!< (@ 0x00000002) Counter/Timer A1 interrupt based on COMPR0.                */
+      __IOM uint32_t CTMRB1C0INT : 1;           /*!< (@ 0x00000003) Counter/Timer B1 interrupt based on COMPR0.                */
+      __IOM uint32_t CTMRA2C0INT : 1;           /*!< (@ 0x00000004) Counter/Timer A2 interrupt based on COMPR0.                */
+      __IOM uint32_t CTMRB2C0INT : 1;           /*!< (@ 0x00000005) Counter/Timer B2 interrupt based on COMPR0.                */
+      __IOM uint32_t CTMRA3C0INT : 1;           /*!< (@ 0x00000006) Counter/Timer A3 interrupt based on COMPR0.                */
+      __IOM uint32_t CTMRB3C0INT : 1;           /*!< (@ 0x00000007) Counter/Timer B3 interrupt based on COMPR0.                */
+      __IOM uint32_t CTMRA0C1INT : 1;           /*!< (@ 0x00000008) Counter/Timer A0 interrupt based on COMPR1.                */
+      __IOM uint32_t CTMRB0C1INT : 1;           /*!< (@ 0x00000009) Counter/Timer B0 interrupt based on COMPR1.                */
+      __IOM uint32_t CTMRA1C1INT : 1;           /*!< (@ 0x0000000A) Counter/Timer A1 interrupt based on COMPR1.                */
+      __IOM uint32_t CTMRB1C1INT : 1;           /*!< (@ 0x0000000B) Counter/Timer B1 interrupt based on COMPR1.                */
+      __IOM uint32_t CTMRA2C1INT : 1;           /*!< (@ 0x0000000C) Counter/Timer A2 interrupt based on COMPR1.                */
+      __IOM uint32_t CTMRB2C1INT : 1;           /*!< (@ 0x0000000D) Counter/Timer B2 interrupt based on COMPR1.                */
+      __IOM uint32_t CTMRA3C1INT : 1;           /*!< (@ 0x0000000E) Counter/Timer A3 interrupt based on COMPR1.                */
+      __IOM uint32_t CTMRB3C1INT : 1;           /*!< (@ 0x0000000F) Counter/Timer B3 interrupt based on COMPR1.                */
+    } INTCLR_b;
+  } ;
+  
+  union {
+    __IOM uint32_t INTSET;                      /*!< (@ 0x0000020C) Counter/Timer Interrupts: Set                              */
+    
+    struct {
+      __IOM uint32_t CTMRA0C0INT : 1;           /*!< (@ 0x00000000) Counter/Timer A0 interrupt based on COMPR0.                */
+      __IOM uint32_t CTMRB0C0INT : 1;           /*!< (@ 0x00000001) Counter/Timer B0 interrupt based on COMPR0.                */
+      __IOM uint32_t CTMRA1C0INT : 1;           /*!< (@ 0x00000002) Counter/Timer A1 interrupt based on COMPR0.                */
+      __IOM uint32_t CTMRB1C0INT : 1;           /*!< (@ 0x00000003) Counter/Timer B1 interrupt based on COMPR0.                */
+      __IOM uint32_t CTMRA2C0INT : 1;           /*!< (@ 0x00000004) Counter/Timer A2 interrupt based on COMPR0.                */
+      __IOM uint32_t CTMRB2C0INT : 1;           /*!< (@ 0x00000005) Counter/Timer B2 interrupt based on COMPR0.                */
+      __IOM uint32_t CTMRA3C0INT : 1;           /*!< (@ 0x00000006) Counter/Timer A3 interrupt based on COMPR0.                */
+      __IOM uint32_t CTMRB3C0INT : 1;           /*!< (@ 0x00000007) Counter/Timer B3 interrupt based on COMPR0.                */
+      __IOM uint32_t CTMRA0C1INT : 1;           /*!< (@ 0x00000008) Counter/Timer A0 interrupt based on COMPR1.                */
+      __IOM uint32_t CTMRB0C1INT : 1;           /*!< (@ 0x00000009) Counter/Timer B0 interrupt based on COMPR1.                */
+      __IOM uint32_t CTMRA1C1INT : 1;           /*!< (@ 0x0000000A) Counter/Timer A1 interrupt based on COMPR1.                */
+      __IOM uint32_t CTMRB1C1INT : 1;           /*!< (@ 0x0000000B) Counter/Timer B1 interrupt based on COMPR1.                */
+      __IOM uint32_t CTMRA2C1INT : 1;           /*!< (@ 0x0000000C) Counter/Timer A2 interrupt based on COMPR1.                */
+      __IOM uint32_t CTMRB2C1INT : 1;           /*!< (@ 0x0000000D) Counter/Timer B2 interrupt based on COMPR1.                */
+      __IOM uint32_t CTMRA3C1INT : 1;           /*!< (@ 0x0000000E) Counter/Timer A3 interrupt based on COMPR1.                */
+      __IOM uint32_t CTMRB3C1INT : 1;           /*!< (@ 0x0000000F) Counter/Timer B3 interrupt based on COMPR1.                */
+    } INTSET_b;
+  } ;
+  __IM  uint32_t  RESERVED4[60];
+  
+  union {
+    __IOM uint32_t STMINTEN;                    /*!< (@ 0x00000300) STIMER Interrupt registers: Enable                         */
+    
+    struct {
+      __IOM uint32_t COMPAREA   : 1;            /*!< (@ 0x00000000) COUNTER is greater than or equal to COMPARE register
+                                                                    A.                                                         */
+      __IOM uint32_t COMPAREB   : 1;            /*!< (@ 0x00000001) COUNTER is greater than or equal to COMPARE register
+                                                                    B.                                                         */
+      __IOM uint32_t COMPAREC   : 1;            /*!< (@ 0x00000002) COUNTER is greater than or equal to COMPARE register
+                                                                    C.                                                         */
+      __IOM uint32_t COMPARED   : 1;            /*!< (@ 0x00000003) COUNTER is greater than or equal to COMPARE register
+                                                                    D.                                                         */
+      __IOM uint32_t COMPAREE   : 1;            /*!< (@ 0x00000004) COUNTER is greater than or equal to COMPARE register
+                                                                    E.                                                         */
+      __IOM uint32_t COMPAREF   : 1;            /*!< (@ 0x00000005) COUNTER is greater than or equal to COMPARE register
+                                                                    F.                                                         */
+      __IOM uint32_t COMPAREG   : 1;            /*!< (@ 0x00000006) COUNTER is greater than or equal to COMPARE register
+                                                                    G.                                                         */
+      __IOM uint32_t COMPAREH   : 1;            /*!< (@ 0x00000007) COUNTER is greater than or equal to COMPARE register
+                                                                    H.                                                         */
+      __IOM uint32_t OVERFLOW   : 1;            /*!< (@ 0x00000008) COUNTER over flowed from 0xFFFFFFFF back to 0x00000000.    */
+      __IOM uint32_t CAPTUREA   : 1;            /*!< (@ 0x00000009) CAPTURE register A has grabbed the value in the
+                                                                    counter                                                    */
+      __IOM uint32_t CAPTUREB   : 1;            /*!< (@ 0x0000000A) CAPTURE register B has grabbed the value in the
+                                                                    counter                                                    */
+      __IOM uint32_t CAPTUREC   : 1;            /*!< (@ 0x0000000B) CAPTURE register C has grabbed the value in the
+                                                                    counter                                                    */
+      __IOM uint32_t CAPTURED   : 1;            /*!< (@ 0x0000000C) CAPTURE register D has grabbed the value in the
+                                                                    counter                                                    */
+    } STMINTEN_b;
+  } ;
+  
+  union {
+    __IOM uint32_t STMINTSTAT;                  /*!< (@ 0x00000304) STIMER Interrupt registers: Status                         */
+    
+    struct {
+      __IOM uint32_t COMPAREA   : 1;            /*!< (@ 0x00000000) COUNTER is greater than or equal to COMPARE register
+                                                                    A.                                                         */
+      __IOM uint32_t COMPAREB   : 1;            /*!< (@ 0x00000001) COUNTER is greater than or equal to COMPARE register
+                                                                    B.                                                         */
+      __IOM uint32_t COMPAREC   : 1;            /*!< (@ 0x00000002) COUNTER is greater than or equal to COMPARE register
+                                                                    C.                                                         */
+      __IOM uint32_t COMPARED   : 1;            /*!< (@ 0x00000003) COUNTER is greater than or equal to COMPARE register
+                                                                    D.                                                         */
+      __IOM uint32_t COMPAREE   : 1;            /*!< (@ 0x00000004) COUNTER is greater than or equal to COMPARE register
+                                                                    E.                                                         */
+      __IOM uint32_t COMPAREF   : 1;            /*!< (@ 0x00000005) COUNTER is greater than or equal to COMPARE register
+                                                                    F.                                                         */
+      __IOM uint32_t COMPAREG   : 1;            /*!< (@ 0x00000006) COUNTER is greater than or equal to COMPARE register
+                                                                    G.                                                         */
+      __IOM uint32_t COMPAREH   : 1;            /*!< (@ 0x00000007) COUNTER is greater than or equal to COMPARE register
+                                                                    H.                                                         */
+      __IOM uint32_t OVERFLOW   : 1;            /*!< (@ 0x00000008) COUNTER over flowed from 0xFFFFFFFF back to 0x00000000.    */
+      __IOM uint32_t CAPTUREA   : 1;            /*!< (@ 0x00000009) CAPTURE register A has grabbed the value in the
+                                                                    counter                                                    */
+      __IOM uint32_t CAPTUREB   : 1;            /*!< (@ 0x0000000A) CAPTURE register B has grabbed the value in the
+                                                                    counter                                                    */
+      __IOM uint32_t CAPTUREC   : 1;            /*!< (@ 0x0000000B) CAPTURE register C has grabbed the value in the
+                                                                    counter                                                    */
+      __IOM uint32_t CAPTURED   : 1;            /*!< (@ 0x0000000C) CAPTURE register D has grabbed the value in the
+                                                                    counter                                                    */
+    } STMINTSTAT_b;
+  } ;
+  
+  union {
+    __IOM uint32_t STMINTCLR;                   /*!< (@ 0x00000308) STIMER Interrupt registers: Clear                          */
+    
+    struct {
+      __IOM uint32_t COMPAREA   : 1;            /*!< (@ 0x00000000) COUNTER is greater than or equal to COMPARE register
+                                                                    A.                                                         */
+      __IOM uint32_t COMPAREB   : 1;            /*!< (@ 0x00000001) COUNTER is greater than or equal to COMPARE register
+                                                                    B.                                                         */
+      __IOM uint32_t COMPAREC   : 1;            /*!< (@ 0x00000002) COUNTER is greater than or equal to COMPARE register
+                                                                    C.                                                         */
+      __IOM uint32_t COMPARED   : 1;            /*!< (@ 0x00000003) COUNTER is greater than or equal to COMPARE register
+                                                                    D.                                                         */
+      __IOM uint32_t COMPAREE   : 1;            /*!< (@ 0x00000004) COUNTER is greater than or equal to COMPARE register
+                                                                    E.                                                         */
+      __IOM uint32_t COMPAREF   : 1;            /*!< (@ 0x00000005) COUNTER is greater than or equal to COMPARE register
+                                                                    F.                                                         */
+      __IOM uint32_t COMPAREG   : 1;            /*!< (@ 0x00000006) COUNTER is greater than or equal to COMPARE register
+                                                                    G.                                                         */
+      __IOM uint32_t COMPAREH   : 1;            /*!< (@ 0x00000007) COUNTER is greater than or equal to COMPARE register
+                                                                    H.                                                         */
+      __IOM uint32_t OVERFLOW   : 1;            /*!< (@ 0x00000008) COUNTER over flowed from 0xFFFFFFFF back to 0x00000000.    */
+      __IOM uint32_t CAPTUREA   : 1;            /*!< (@ 0x00000009) CAPTURE register A has grabbed the value in the
+                                                                    counter                                                    */
+      __IOM uint32_t CAPTUREB   : 1;            /*!< (@ 0x0000000A) CAPTURE register B has grabbed the value in the
+                                                                    counter                                                    */
+      __IOM uint32_t CAPTUREC   : 1;            /*!< (@ 0x0000000B) CAPTURE register C has grabbed the value in the
+                                                                    counter                                                    */
+      __IOM uint32_t CAPTURED   : 1;            /*!< (@ 0x0000000C) CAPTURE register D has grabbed the value in the
+                                                                    counter                                                    */
+    } STMINTCLR_b;
+  } ;
+  
+  union {
+    __IOM uint32_t STMINTSET;                   /*!< (@ 0x0000030C) STIMER Interrupt registers: Set                            */
+    
+    struct {
+      __IOM uint32_t COMPAREA   : 1;            /*!< (@ 0x00000000) COUNTER is greater than or equal to COMPARE register
+                                                                    A.                                                         */
+      __IOM uint32_t COMPAREB   : 1;            /*!< (@ 0x00000001) COUNTER is greater than or equal to COMPARE register
+                                                                    B.                                                         */
+      __IOM uint32_t COMPAREC   : 1;            /*!< (@ 0x00000002) COUNTER is greater than or equal to COMPARE register
+                                                                    C.                                                         */
+      __IOM uint32_t COMPARED   : 1;            /*!< (@ 0x00000003) COUNTER is greater than or equal to COMPARE register
+                                                                    D.                                                         */
+      __IOM uint32_t COMPAREE   : 1;            /*!< (@ 0x00000004) COUNTER is greater than or equal to COMPARE register
+                                                                    E.                                                         */
+      __IOM uint32_t COMPAREF   : 1;            /*!< (@ 0x00000005) COUNTER is greater than or equal to COMPARE register
+                                                                    F.                                                         */
+      __IOM uint32_t COMPAREG   : 1;            /*!< (@ 0x00000006) COUNTER is greater than or equal to COMPARE register
+                                                                    G.                                                         */
+      __IOM uint32_t COMPAREH   : 1;            /*!< (@ 0x00000007) COUNTER is greater than or equal to COMPARE register
+                                                                    H.                                                         */
+      __IOM uint32_t OVERFLOW   : 1;            /*!< (@ 0x00000008) COUNTER over flowed from 0xFFFFFFFF back to 0x00000000.    */
+      __IOM uint32_t CAPTUREA   : 1;            /*!< (@ 0x00000009) CAPTURE register A has grabbed the value in the
+                                                                    counter                                                    */
+      __IOM uint32_t CAPTUREB   : 1;            /*!< (@ 0x0000000A) CAPTURE register B has grabbed the value in the
+                                                                    counter                                                    */
+      __IOM uint32_t CAPTUREC   : 1;            /*!< (@ 0x0000000B) CAPTURE register C has grabbed the value in the
+                                                                    counter                                                    */
+      __IOM uint32_t CAPTURED   : 1;            /*!< (@ 0x0000000C) CAPTURE register D has grabbed the value in the
+                                                                    counter                                                    */
+    } STMINTSET_b;
+  } ;
+} CTIMER_Type;                                  /*!< Size = 784 (0x310)                                                        */
+
+
+
+/* =========================================================================================================================== */
+/* ================                                           GPIO                                            ================ */
+/* =========================================================================================================================== */
+
+
+/**
+  * @brief General Purpose IO (GPIO)
+  */
+
+typedef struct {                                /*!< (@ 0x40010000) GPIO Structure                                             */
+  
+  union {
+    __IOM uint32_t PADREGA;                     /*!< (@ 0x00000000) Pad Configuration Register A                               */
+    
+    struct {
+      __IOM uint32_t PAD0PULL   : 1;            /*!< (@ 0x00000000) Pad 0 pullup enable                                        */
+      __IOM uint32_t PAD0INPEN  : 1;            /*!< (@ 0x00000001) Pad 0 input enable                                         */
+      __IOM uint32_t PAD0STRNG  : 1;            /*!< (@ 0x00000002) Pad 0 drive strength                                       */
+      __IOM uint32_t PAD0FNCSEL : 3;            /*!< (@ 0x00000003) Pad 0 function select                                      */
+      __IOM uint32_t PAD0RSEL   : 2;            /*!< (@ 0x00000006) Pad 0 pullup resistor selection.                           */
+      __IOM uint32_t PAD1PULL   : 1;            /*!< (@ 0x00000008) Pad 1 pullup enable                                        */
+      __IOM uint32_t PAD1INPEN  : 1;            /*!< (@ 0x00000009) Pad 1 input enable                                         */
+      __IOM uint32_t PAD1STRNG  : 1;            /*!< (@ 0x0000000A) Pad 1 drive strength                                       */
+      __IOM uint32_t PAD1FNCSEL : 3;            /*!< (@ 0x0000000B) Pad 1 function select                                      */
+      __IOM uint32_t PAD1RSEL   : 2;            /*!< (@ 0x0000000E) Pad 1 pullup resistor selection.                           */
+      __IOM uint32_t PAD2PULL   : 1;            /*!< (@ 0x00000010) Pad 2 pullup enable                                        */
+      __IOM uint32_t PAD2INPEN  : 1;            /*!< (@ 0x00000011) Pad 2 input enable                                         */
+      __IOM uint32_t PAD2STRNG  : 1;            /*!< (@ 0x00000012) Pad 2 drive strength                                       */
+      __IOM uint32_t PAD2FNCSEL : 3;            /*!< (@ 0x00000013) Pad 2 function select                                      */
+      __IM  uint32_t            : 2;
+      __IOM uint32_t PAD3PULL   : 1;            /*!< (@ 0x00000018) Pad 3 pullup enable                                        */
+      __IOM uint32_t PAD3INPEN  : 1;            /*!< (@ 0x00000019) Pad 3 input enable.                                        */
+      __IOM uint32_t PAD3STRNG  : 1;            /*!< (@ 0x0000001A) Pad 3 drive strength.                                      */
+      __IOM uint32_t PAD3FNCSEL : 3;            /*!< (@ 0x0000001B) Pad 3 function select                                      */
+    } PADREGA_b;
+  } ;
+  
+  union {
+    __IOM uint32_t PADREGB;                     /*!< (@ 0x00000004) Pad Configuration Register B                               */
+    
+    struct {
+      __IOM uint32_t PAD4PULL   : 1;            /*!< (@ 0x00000000) Pad 4 pullup enable                                        */
+      __IOM uint32_t PAD4INPEN  : 1;            /*!< (@ 0x00000001) Pad 4 input enable                                         */
+      __IOM uint32_t PAD4STRNG  : 1;            /*!< (@ 0x00000002) Pad 4 drive strength                                       */
+      __IOM uint32_t PAD4FNCSEL : 3;            /*!< (@ 0x00000003) Pad 4 function select                                      */
+      __IM  uint32_t            : 1;
+      __IOM uint32_t PAD4PWRDN  : 1;            /*!< (@ 0x00000007) Pad 4 VSS power switch enable                              */
+      __IOM uint32_t PAD5PULL   : 1;            /*!< (@ 0x00000008) Pad 5 pullup enable                                        */
+      __IOM uint32_t PAD5INPEN  : 1;            /*!< (@ 0x00000009) Pad 5 input enable                                         */
+      __IOM uint32_t PAD5STRNG  : 1;            /*!< (@ 0x0000000A) Pad 5 drive strength                                       */
+      __IOM uint32_t PAD5FNCSEL : 3;            /*!< (@ 0x0000000B) Pad 5 function select                                      */
+      __IOM uint32_t PAD5RSEL   : 2;            /*!< (@ 0x0000000E) Pad 5 pullup resistor selection.                           */
+      __IOM uint32_t PAD6PULL   : 1;            /*!< (@ 0x00000010) Pad 6 pullup enable                                        */
+      __IOM uint32_t PAD6INPEN  : 1;            /*!< (@ 0x00000011) Pad 6 input enable                                         */
+      __IOM uint32_t PAD6STRNG  : 1;            /*!< (@ 0x00000012) Pad 6 drive strength                                       */
+      __IOM uint32_t PAD6FNCSEL : 3;            /*!< (@ 0x00000013) Pad 6 function select                                      */
+      __IOM uint32_t PAD6RSEL   : 2;            /*!< (@ 0x00000016) Pad 6 pullup resistor selection.                           */
+      __IOM uint32_t PAD7PULL   : 1;            /*!< (@ 0x00000018) Pad 7 pullup enable                                        */
+      __IOM uint32_t PAD7INPEN  : 1;            /*!< (@ 0x00000019) Pad 7 input enable                                         */
+      __IOM uint32_t PAD7STRNG  : 1;            /*!< (@ 0x0000001A) Pad 7 drive strentgh                                       */
+      __IOM uint32_t PAD7FNCSEL : 3;            /*!< (@ 0x0000001B) Pad 7 function select                                      */
+    } PADREGB_b;
+  } ;
+  
+  union {
+    __IOM uint32_t PADREGC;                     /*!< (@ 0x00000008) Pad Configuration Register C                               */
+    
+    struct {
+      __IOM uint32_t PAD8PULL   : 1;            /*!< (@ 0x00000000) Pad 8 pullup enable                                        */
+      __IOM uint32_t PAD8INPEN  : 1;            /*!< (@ 0x00000001) Pad 8 input enable                                         */
+      __IOM uint32_t PAD8STRNG  : 1;            /*!< (@ 0x00000002) Pad 8 drive strength                                       */
+      __IOM uint32_t PAD8FNCSEL : 3;            /*!< (@ 0x00000003) Pad 8 function select                                      */
+      __IOM uint32_t PAD8RSEL   : 2;            /*!< (@ 0x00000006) Pad 8 pullup resistor selection.                           */
+      __IOM uint32_t PAD9PULL   : 1;            /*!< (@ 0x00000008) Pad 9 pullup enable                                        */
+      __IOM uint32_t PAD9INPEN  : 1;            /*!< (@ 0x00000009) Pad 9 input enable                                         */
+      __IOM uint32_t PAD9STRNG  : 1;            /*!< (@ 0x0000000A) Pad 9 drive strength                                       */
+      __IOM uint32_t PAD9FNCSEL : 3;            /*!< (@ 0x0000000B) Pad 9 function select                                      */
+      __IOM uint32_t PAD9RSEL   : 2;            /*!< (@ 0x0000000E) Pad 9 pullup resistor selection                            */
+      __IOM uint32_t PAD10PULL  : 1;            /*!< (@ 0x00000010) Pad 10 pullup enable                                       */
+      __IOM uint32_t PAD10INPEN : 1;            /*!< (@ 0x00000011) Pad 10 input enable                                        */
+      __IOM uint32_t PAD10STRNG : 1;            /*!< (@ 0x00000012) Pad 10 drive strength                                      */
+      __IOM uint32_t PAD10FNCSEL : 3;           /*!< (@ 0x00000013) Pad 10 function select                                     */
+      __IM  uint32_t            : 2;
+      __IOM uint32_t PAD11PULL  : 1;            /*!< (@ 0x00000018) Pad 11 pullup enable                                       */
+      __IOM uint32_t PAD11INPEN : 1;            /*!< (@ 0x00000019) Pad 11 input enable                                        */
+      __IOM uint32_t PAD11STRNG : 1;            /*!< (@ 0x0000001A) Pad 11 drive strentgh                                      */
+      __IOM uint32_t PAD11FNCSEL : 3;           /*!< (@ 0x0000001B) Pad 11 function select                                     */
+    } PADREGC_b;
+  } ;
+  
+  union {
+    __IOM uint32_t PADREGD;                     /*!< (@ 0x0000000C) Pad Configuration Register D                               */
+    
+    struct {
+      __IOM uint32_t PAD12PULL  : 1;            /*!< (@ 0x00000000) Pad 12 pullup enable                                       */
+      __IOM uint32_t PAD12INPEN : 1;            /*!< (@ 0x00000001) Pad 12 input enable                                        */
+      __IOM uint32_t PAD12STRNG : 1;            /*!< (@ 0x00000002) Pad 12 drive strength                                      */
+      __IOM uint32_t PAD12FNCSEL : 3;           /*!< (@ 0x00000003) Pad 12 function select                                     */
+      __IM  uint32_t            : 2;
+      __IOM uint32_t PAD13PULL  : 1;            /*!< (@ 0x00000008) Pad 13 pullup enable                                       */
+      __IOM uint32_t PAD13INPEN : 1;            /*!< (@ 0x00000009) Pad 13 input enable                                        */
+      __IOM uint32_t PAD13STRNG : 1;            /*!< (@ 0x0000000A) Pad 13 drive strength                                      */
+      __IOM uint32_t PAD13FNCSEL : 3;           /*!< (@ 0x0000000B) Pad 13 function select                                     */
+      __IM  uint32_t            : 2;
+      __IOM uint32_t PAD14PULL  : 1;            /*!< (@ 0x00000010) Pad 14 pullup enable                                       */
+      __IOM uint32_t PAD14INPEN : 1;            /*!< (@ 0x00000011) Pad 14 input enable                                        */
+      __IOM uint32_t PAD14STRNG : 1;            /*!< (@ 0x00000012) Pad 14 drive strength                                      */
+      __IOM uint32_t PAD14FNCSEL : 3;           /*!< (@ 0x00000013) Pad 14 function select                                     */
+      __IM  uint32_t            : 2;
+      __IOM uint32_t PAD15PULL  : 1;            /*!< (@ 0x00000018) Pad 15 pullup enable                                       */
+      __IOM uint32_t PAD15INPEN : 1;            /*!< (@ 0x00000019) Pad 15 input enable                                        */
+      __IOM uint32_t PAD15STRNG : 1;            /*!< (@ 0x0000001A) Pad 15 drive strentgh                                      */
+      __IOM uint32_t PAD15FNCSEL : 3;           /*!< (@ 0x0000001B) Pad 15 function select                                     */
+    } PADREGD_b;
+  } ;
+  
+  union {
+    __IOM uint32_t PADREGE;                     /*!< (@ 0x00000010) Pad Configuration Register E                               */
+    
+    struct {
+      __IOM uint32_t PAD16PULL  : 1;            /*!< (@ 0x00000000) Pad 16 pullup enable                                       */
+      __IOM uint32_t PAD16INPEN : 1;            /*!< (@ 0x00000001) Pad 16 input enable                                        */
+      __IOM uint32_t PAD16STRNG : 1;            /*!< (@ 0x00000002) Pad 16 drive strength                                      */
+      __IOM uint32_t PAD16FNCSEL : 3;           /*!< (@ 0x00000003) Pad 16 function select                                     */
+      __IM  uint32_t            : 2;
+      __IOM uint32_t PAD17PULL  : 1;            /*!< (@ 0x00000008) Pad 17 pullup enable                                       */
+      __IOM uint32_t PAD17INPEN : 1;            /*!< (@ 0x00000009) Pad 17 input enable                                        */
+      __IOM uint32_t PAD17STRNG : 1;            /*!< (@ 0x0000000A) Pad 17 drive strength                                      */
+      __IOM uint32_t PAD17FNCSEL : 3;           /*!< (@ 0x0000000B) Pad 17 function select                                     */
+      __IM  uint32_t            : 2;
+      __IOM uint32_t PAD18PULL  : 1;            /*!< (@ 0x00000010) Pad 18 pullup enable                                       */
+      __IOM uint32_t PAD18INPEN : 1;            /*!< (@ 0x00000011) Pad 18 input enable                                        */
+      __IOM uint32_t PAD18STRNG : 1;            /*!< (@ 0x00000012) Pad 18 drive strength                                      */
+      __IOM uint32_t PAD18FNCSEL : 3;           /*!< (@ 0x00000013) Pad 18 function select                                     */
+      __IM  uint32_t            : 2;
+      __IOM uint32_t PAD19PULL  : 1;            /*!< (@ 0x00000018) Pad 19 pullup enable                                       */
+      __IOM uint32_t PAD19INPEN : 1;            /*!< (@ 0x00000019) Pad 19 input enable                                        */
+      __IOM uint32_t PAD19STRNG : 1;            /*!< (@ 0x0000001A) Pad 19 drive strentgh                                      */
+      __IOM uint32_t PAD19FNCSEL : 3;           /*!< (@ 0x0000001B) Pad 19 function select                                     */
+    } PADREGE_b;
+  } ;
+  
+  union {
+    __IOM uint32_t PADREGF;                     /*!< (@ 0x00000014) Pad Configuration Register F                               */
+    
+    struct {
+      __IOM uint32_t PAD20PULL  : 1;            /*!< (@ 0x00000000) Pad 20 pulldown enable                                     */
+      __IOM uint32_t PAD20INPEN : 1;            /*!< (@ 0x00000001) Pad 20 input enable                                        */
+      __IOM uint32_t PAD20STRNG : 1;            /*!< (@ 0x00000002) Pad 20 drive strength                                      */
+      __IOM uint32_t PAD20FNCSEL : 3;           /*!< (@ 0x00000003) Pad 20 function select                                     */
+      __IM  uint32_t            : 2;
+      __IOM uint32_t PAD21PULL  : 1;            /*!< (@ 0x00000008) Pad 21 pullup enable                                       */
+      __IOM uint32_t PAD21INPEN : 1;            /*!< (@ 0x00000009) Pad 21 input enable                                        */
+      __IOM uint32_t PAD21STRNG : 1;            /*!< (@ 0x0000000A) Pad 21 drive strength                                      */
+      __IOM uint32_t PAD21FNCSEL : 3;           /*!< (@ 0x0000000B) Pad 21 function select                                     */
+      __IM  uint32_t            : 2;
+      __IOM uint32_t PAD22PULL  : 1;            /*!< (@ 0x00000010) Pad 22 pullup enable                                       */
+      __IOM uint32_t PAD22INPEN : 1;            /*!< (@ 0x00000011) Pad 22 input enable                                        */
+      __IOM uint32_t PAD22STRNG : 1;            /*!< (@ 0x00000012) Pad 22 drive strength                                      */
+      __IOM uint32_t PAD22FNCSEL : 3;           /*!< (@ 0x00000013) Pad 22 function select                                     */
+      __IM  uint32_t            : 1;
+      __IOM uint32_t PAD22PWRUP : 1;            /*!< (@ 0x00000017) Pad 22 upper power switch enable                           */
+      __IOM uint32_t PAD23PULL  : 1;            /*!< (@ 0x00000018) Pad 23 pullup enable                                       */
+      __IOM uint32_t PAD23INPEN : 1;            /*!< (@ 0x00000019) Pad 23 input enable                                        */
+      __IOM uint32_t PAD23STRNG : 1;            /*!< (@ 0x0000001A) Pad 23 drive strentgh                                      */
+      __IOM uint32_t PAD23FNCSEL : 3;           /*!< (@ 0x0000001B) Pad 23 function select                                     */
+    } PADREGF_b;
+  } ;
+  
+  union {
+    __IOM uint32_t PADREGG;                     /*!< (@ 0x00000018) Pad Configuration Register G                               */
+    
+    struct {
+      __IOM uint32_t PAD24PULL  : 1;            /*!< (@ 0x00000000) Pad 24 pullup enable                                       */
+      __IOM uint32_t PAD24INPEN : 1;            /*!< (@ 0x00000001) Pad 24 input enable                                        */
+      __IOM uint32_t PAD24STRNG : 1;            /*!< (@ 0x00000002) Pad 24 drive strength                                      */
+      __IOM uint32_t PAD24FNCSEL : 3;           /*!< (@ 0x00000003) Pad 24 function select                                     */
+      __IM  uint32_t            : 2;
+      __IOM uint32_t PAD25PULL  : 1;            /*!< (@ 0x00000008) Pad 25 pullup enable                                       */
+      __IOM uint32_t PAD25INPEN : 1;            /*!< (@ 0x00000009) Pad 25 input enable                                        */
+      __IOM uint32_t PAD25STRNG : 1;            /*!< (@ 0x0000000A) Pad 25 drive strength                                      */
+      __IOM uint32_t PAD25FNCSEL : 3;           /*!< (@ 0x0000000B) Pad 25 function select                                     */
+      __IOM uint32_t PAD25RSEL  : 2;            /*!< (@ 0x0000000E) Pad 25 pullup resistor selection.                          */
+      __IOM uint32_t PAD26PULL  : 1;            /*!< (@ 0x00000010) Pad 26 pullup enable                                       */
+      __IOM uint32_t PAD26INPEN : 1;            /*!< (@ 0x00000011) Pad 26 input enable                                        */
+      __IOM uint32_t PAD26STRNG : 1;            /*!< (@ 0x00000012) Pad 26 drive strength                                      */
+      __IOM uint32_t PAD26FNCSEL : 3;           /*!< (@ 0x00000013) Pad 26 function select                                     */
+      __IM  uint32_t            : 2;
+      __IOM uint32_t PAD27PULL  : 1;            /*!< (@ 0x00000018) Pad 27 pullup enable                                       */
+      __IOM uint32_t PAD27INPEN : 1;            /*!< (@ 0x00000019) Pad 27 input enable                                        */
+      __IOM uint32_t PAD27STRNG : 1;            /*!< (@ 0x0000001A) Pad 27 drive strentgh                                      */
+      __IOM uint32_t PAD27FNCSEL : 3;           /*!< (@ 0x0000001B) Pad 27 function select                                     */
+      __IOM uint32_t PAD27RSEL  : 2;            /*!< (@ 0x0000001E) Pad 27 pullup resistor selection.                          */
+    } PADREGG_b;
+  } ;
+  
+  union {
+    __IOM uint32_t PADREGH;                     /*!< (@ 0x0000001C) Pad Configuration Register H                               */
+    
+    struct {
+      __IOM uint32_t PAD28PULL  : 1;            /*!< (@ 0x00000000) Pad 28 pullup enable                                       */
+      __IOM uint32_t PAD28INPEN : 1;            /*!< (@ 0x00000001) Pad 28 input enable                                        */
+      __IOM uint32_t PAD28STRNG : 1;            /*!< (@ 0x00000002) Pad 28 drive strength                                      */
+      __IOM uint32_t PAD28FNCSEL : 3;           /*!< (@ 0x00000003) Pad 28 function select                                     */
+      __IM  uint32_t            : 2;
+      __IOM uint32_t PAD29PULL  : 1;            /*!< (@ 0x00000008) Pad 29 pullup enable                                       */
+      __IOM uint32_t PAD29INPEN : 1;            /*!< (@ 0x00000009) Pad 29 input enable                                        */
+      __IOM uint32_t PAD29STRNG : 1;            /*!< (@ 0x0000000A) Pad 29 drive strength                                      */
+      __IOM uint32_t PAD29FNCSEL : 3;           /*!< (@ 0x0000000B) Pad 29 function select                                     */
+      __IM  uint32_t            : 2;
+      __IOM uint32_t PAD30PULL  : 1;            /*!< (@ 0x00000010) Pad 30 pullup enable                                       */
+      __IOM uint32_t PAD30INPEN : 1;            /*!< (@ 0x00000011) Pad 30 input enable                                        */
+      __IOM uint32_t PAD30STRNG : 1;            /*!< (@ 0x00000012) Pad 30 drive strength                                      */
+      __IOM uint32_t PAD30FNCSEL : 3;           /*!< (@ 0x00000013) Pad 30 function select                                     */
+      __IM  uint32_t            : 2;
+      __IOM uint32_t PAD31PULL  : 1;            /*!< (@ 0x00000018) Pad 31 pullup enable                                       */
+      __IOM uint32_t PAD31INPEN : 1;            /*!< (@ 0x00000019) Pad 31 input enable                                        */
+      __IOM uint32_t PAD31STRNG : 1;            /*!< (@ 0x0000001A) Pad 31 drive strentgh                                      */
+      __IOM uint32_t PAD31FNCSEL : 3;           /*!< (@ 0x0000001B) Pad 31 function select                                     */
+    } PADREGH_b;
+  } ;
+  
+  union {
+    __IOM uint32_t PADREGI;                     /*!< (@ 0x00000020) Pad Configuration Register I                               */
+    
+    struct {
+      __IOM uint32_t PAD32PULL  : 1;            /*!< (@ 0x00000000) Pad 32 pullup enable                                       */
+      __IOM uint32_t PAD32INPEN : 1;            /*!< (@ 0x00000001) Pad 32 input enable                                        */
+      __IOM uint32_t PAD32STRNG : 1;            /*!< (@ 0x00000002) Pad 32 drive strength                                      */
+      __IOM uint32_t PAD32FNCSEL : 3;           /*!< (@ 0x00000003) Pad 32 function select                                     */
+      __IM  uint32_t            : 2;
+      __IOM uint32_t PAD33PULL  : 1;            /*!< (@ 0x00000008) Pad 33 pullup enable                                       */
+      __IOM uint32_t PAD33INPEN : 1;            /*!< (@ 0x00000009) Pad 33 input enable                                        */
+      __IOM uint32_t PAD33STRNG : 1;            /*!< (@ 0x0000000A) Pad 33 drive strength                                      */
+      __IOM uint32_t PAD33FNCSEL : 3;           /*!< (@ 0x0000000B) Pad 33 function select                                     */
+      __IM  uint32_t            : 2;
+      __IOM uint32_t PAD34PULL  : 1;            /*!< (@ 0x00000010) Pad 34 pullup enable                                       */
+      __IOM uint32_t PAD34INPEN : 1;            /*!< (@ 0x00000011) Pad 34 input enable                                        */
+      __IOM uint32_t PAD34STRNG : 1;            /*!< (@ 0x00000012) Pad 34 drive strength                                      */
+      __IOM uint32_t PAD34FNCSEL : 3;           /*!< (@ 0x00000013) Pad 34 function select                                     */
+      __IM  uint32_t            : 2;
+      __IOM uint32_t PAD35PULL  : 1;            /*!< (@ 0x00000018) Pad 35 pullup enable                                       */
+      __IOM uint32_t PAD35INPEN : 1;            /*!< (@ 0x00000019) Pad 35 input enable                                        */
+      __IOM uint32_t PAD35STRNG : 1;            /*!< (@ 0x0000001A) Pad 35 drive strentgh                                      */
+      __IOM uint32_t PAD35FNCSEL : 3;           /*!< (@ 0x0000001B) Pad 35 function select                                     */
+    } PADREGI_b;
+  } ;
+  
+  union {
+    __IOM uint32_t PADREGJ;                     /*!< (@ 0x00000024) Pad Configuration Register J                               */
+    
+    struct {
+      __IOM uint32_t PAD36PULL  : 1;            /*!< (@ 0x00000000) Pad 36 pullup enable                                       */
+      __IOM uint32_t PAD36INPEN : 1;            /*!< (@ 0x00000001) Pad 36 input enable                                        */
+      __IOM uint32_t PAD36STRNG : 1;            /*!< (@ 0x00000002) Pad 36 drive strength                                      */
+      __IOM uint32_t PAD36FNCSEL : 3;           /*!< (@ 0x00000003) Pad 36 function select                                     */
+      __IM  uint32_t            : 2;
+      __IOM uint32_t PAD37PULL  : 1;            /*!< (@ 0x00000008) Pad 37 pullup enable                                       */
+      __IOM uint32_t PAD37INPEN : 1;            /*!< (@ 0x00000009) Pad 37 input enable                                        */
+      __IOM uint32_t PAD37STRNG : 1;            /*!< (@ 0x0000000A) Pad 37 drive strength                                      */
+      __IOM uint32_t PAD37FNCSEL : 3;           /*!< (@ 0x0000000B) Pad 37 function select                                     */
+      __IM  uint32_t            : 2;
+      __IOM uint32_t PAD38PULL  : 1;            /*!< (@ 0x00000010) Pad 38 pullup enable                                       */
+      __IOM uint32_t PAD38INPEN : 1;            /*!< (@ 0x00000011) Pad 38 input enable                                        */
+      __IOM uint32_t PAD38STRNG : 1;            /*!< (@ 0x00000012) Pad 38 drive strength                                      */
+      __IOM uint32_t PAD38FNCSEL : 3;           /*!< (@ 0x00000013) Pad 38 function select                                     */
+      __IM  uint32_t            : 2;
+      __IOM uint32_t PAD39PULL  : 1;            /*!< (@ 0x00000018) Pad 39 pullup enable                                       */
+      __IOM uint32_t PAD39INPEN : 1;            /*!< (@ 0x00000019) Pad 39 input enable                                        */
+      __IOM uint32_t PAD39STRNG : 1;            /*!< (@ 0x0000001A) Pad 39 drive strentgh                                      */
+      __IOM uint32_t PAD39FNCSEL : 3;           /*!< (@ 0x0000001B) Pad 39 function select                                     */
+      __IOM uint32_t PAD39RSEL  : 2;            /*!< (@ 0x0000001E) Pad 39 pullup resistor selection.                          */
+    } PADREGJ_b;
+  } ;
+  
+  union {
+    __IOM uint32_t PADREGK;                     /*!< (@ 0x00000028) Pad Configuration Register K                               */
+    
+    struct {
+      __IOM uint32_t PAD40PULL  : 1;            /*!< (@ 0x00000000) Pad 40 pullup enable                                       */
+      __IOM uint32_t PAD40INPEN : 1;            /*!< (@ 0x00000001) Pad 40 input enable                                        */
+      __IOM uint32_t PAD40STRNG : 1;            /*!< (@ 0x00000002) Pad 40 drive strength                                      */
+      __IOM uint32_t PAD40FNCSEL : 3;           /*!< (@ 0x00000003) Pad 40 function select                                     */
+      __IOM uint32_t PAD40RSEL  : 2;            /*!< (@ 0x00000006) Pad 40 pullup resistor selection.                          */
+      __IOM uint32_t PAD41PULL  : 1;            /*!< (@ 0x00000008) Pad 41 pullup enable                                       */
+      __IOM uint32_t PAD41INPEN : 1;            /*!< (@ 0x00000009) Pad 41 input enable                                        */
+      __IOM uint32_t PAD41STRNG : 1;            /*!< (@ 0x0000000A) Pad 41 drive strength                                      */
+      __IOM uint32_t PAD41FNCSEL : 3;           /*!< (@ 0x0000000B) Pad 41 function select                                     */
+      __IM  uint32_t            : 1;
+      __IOM uint32_t PAD41PWRUP : 1;            /*!< (@ 0x0000000F) Pad 41 upper power switch enable                           */
+      __IOM uint32_t PAD42PULL  : 1;            /*!< (@ 0x00000010) Pad 42 pullup enable                                       */
+      __IOM uint32_t PAD42INPEN : 1;            /*!< (@ 0x00000011) Pad 42 input enable                                        */
+      __IOM uint32_t PAD42STRNG : 1;            /*!< (@ 0x00000012) Pad 42 drive strength                                      */
+      __IOM uint32_t PAD42FNCSEL : 3;           /*!< (@ 0x00000013) Pad 42 function select                                     */
+      __IOM uint32_t PAD42RSEL  : 2;            /*!< (@ 0x00000016) Pad 42 pullup resistor selection.                          */
+      __IOM uint32_t PAD43PULL  : 1;            /*!< (@ 0x00000018) Pad 43 pullup enable                                       */
+      __IOM uint32_t PAD43INPEN : 1;            /*!< (@ 0x00000019) Pad 43 input enable                                        */
+      __IOM uint32_t PAD43STRNG : 1;            /*!< (@ 0x0000001A) Pad 43 drive strentgh                                      */
+      __IOM uint32_t PAD43FNCSEL : 3;           /*!< (@ 0x0000001B) Pad 43 function select                                     */
+      __IOM uint32_t PAD43RSEL  : 2;            /*!< (@ 0x0000001E) Pad 43 pullup resistor selection.                          */
+    } PADREGK_b;
+  } ;
+  
+  union {
+    __IOM uint32_t PADREGL;                     /*!< (@ 0x0000002C) Pad Configuration Register L                               */
+    
+    struct {
+      __IOM uint32_t PAD44PULL  : 1;            /*!< (@ 0x00000000) Pad 44 pullup enable                                       */
+      __IOM uint32_t PAD44INPEN : 1;            /*!< (@ 0x00000001) Pad 44 input enable                                        */
+      __IOM uint32_t PAD44STRNG : 1;            /*!< (@ 0x00000002) Pad 44 drive strength                                      */
+      __IOM uint32_t PAD44FNCSEL : 3;           /*!< (@ 0x00000003) Pad 44 function select                                     */
+      __IM  uint32_t            : 2;
+      __IOM uint32_t PAD45PULL  : 1;            /*!< (@ 0x00000008) Pad 45 pullup enable                                       */
+      __IOM uint32_t PAD45INPEN : 1;            /*!< (@ 0x00000009) Pad 45 input enable                                        */
+      __IOM uint32_t PAD45STRNG : 1;            /*!< (@ 0x0000000A) Pad 45 drive strength                                      */
+      __IOM uint32_t PAD45FNCSEL : 3;           /*!< (@ 0x0000000B) Pad 45 function select                                     */
+      __IM  uint32_t            : 2;
+      __IOM uint32_t PAD46PULL  : 1;            /*!< (@ 0x00000010) Pad 46 pullup enable                                       */
+      __IOM uint32_t PAD46INPEN : 1;            /*!< (@ 0x00000011) Pad 46 input enable                                        */
+      __IOM uint32_t PAD46STRNG : 1;            /*!< (@ 0x00000012) Pad 46 drive strength                                      */
+      __IOM uint32_t PAD46FNCSEL : 3;           /*!< (@ 0x00000013) Pad 46 function select                                     */
+      __IM  uint32_t            : 2;
+      __IOM uint32_t PAD47PULL  : 1;            /*!< (@ 0x00000018) Pad 47 pullup enable                                       */
+      __IOM uint32_t PAD47INPEN : 1;            /*!< (@ 0x00000019) Pad 47 input enable                                        */
+      __IOM uint32_t PAD47STRNG : 1;            /*!< (@ 0x0000001A) Pad 47 drive strentgh                                      */
+      __IOM uint32_t PAD47FNCSEL : 3;           /*!< (@ 0x0000001B) Pad 47 function select                                     */
+    } PADREGL_b;
+  } ;
+  
+  union {
+    __IOM uint32_t PADREGM;                     /*!< (@ 0x00000030) Pad Configuration Register M                               */
+    
+    struct {
+      __IOM uint32_t PAD48PULL  : 1;            /*!< (@ 0x00000000) Pad 48 pullup enable                                       */
+      __IOM uint32_t PAD48INPEN : 1;            /*!< (@ 0x00000001) Pad 48 input enable                                        */
+      __IOM uint32_t PAD48STRNG : 1;            /*!< (@ 0x00000002) Pad 48 drive strength                                      */
+      __IOM uint32_t PAD48FNCSEL : 3;           /*!< (@ 0x00000003) Pad 48 function select                                     */
+      __IOM uint32_t PAD48RSEL  : 2;            /*!< (@ 0x00000006) Pad 48 pullup resistor selection.                          */
+      __IOM uint32_t PAD49PULL  : 1;            /*!< (@ 0x00000008) Pad 49 pullup enable                                       */
+      __IOM uint32_t PAD49INPEN : 1;            /*!< (@ 0x00000009) Pad 49 input enable                                        */
+      __IOM uint32_t PAD49STRNG : 1;            /*!< (@ 0x0000000A) Pad 49 drive strength                                      */
+      __IOM uint32_t PAD49FNCSEL : 3;           /*!< (@ 0x0000000B) Pad 49 function select                                     */
+      __IOM uint32_t PAD49RSEL  : 2;            /*!< (@ 0x0000000E) Pad 49 pullup resistor selection.                          */
+    } PADREGM_b;
+  } ;
+  __IM  uint32_t  RESERVED[3];
+  
+  union {
+    __IOM uint32_t CFGA;                        /*!< (@ 0x00000040) GPIO Configuration Register A                              */
+    
+    struct {
+      __IOM uint32_t GPIO0INCFG : 1;            /*!< (@ 0x00000000) GPIO0 input enable.                                        */
+      __IOM uint32_t GPIO0OUTCFG : 2;           /*!< (@ 0x00000001) GPIO0 output configuration.                                */
+      __IOM uint32_t GPIO0INTD  : 1;            /*!< (@ 0x00000003) GPIO0 interrupt direction.                                 */
+      __IOM uint32_t GPIO1INCFG : 1;            /*!< (@ 0x00000004) GPIO1 input enable.                                        */
+      __IOM uint32_t GPIO1OUTCFG : 2;           /*!< (@ 0x00000005) GPIO1 output configuration.                                */
+      __IOM uint32_t GPIO1INTD  : 1;            /*!< (@ 0x00000007) GPIO1 interrupt direction.                                 */
+      __IOM uint32_t GPIO2INCFG : 1;            /*!< (@ 0x00000008) GPIO2 input enable.                                        */
+      __IOM uint32_t GPIO2OUTCFG : 2;           /*!< (@ 0x00000009) GPIO2 output configuration.                                */
+      __IOM uint32_t GPIO2INTD  : 1;            /*!< (@ 0x0000000B) GPIO2 interrupt direction.                                 */
+      __IOM uint32_t GPIO3INCFG : 1;            /*!< (@ 0x0000000C) GPIO3 input enable.                                        */
+      __IOM uint32_t GPIO3OUTCFG : 2;           /*!< (@ 0x0000000D) GPIO3 output configuration.                                */
+      __IOM uint32_t GPIO3INTD  : 1;            /*!< (@ 0x0000000F) GPIO3 interrupt direction.                                 */
+      __IOM uint32_t GPIO4INCFG : 1;            /*!< (@ 0x00000010) GPIO4 input enable.                                        */
+      __IOM uint32_t GPIO4OUTCFG : 2;           /*!< (@ 0x00000011) GPIO4 output configuration.                                */
+      __IOM uint32_t GPIO4INTD  : 1;            /*!< (@ 0x00000013) GPIO4 interrupt direction.                                 */
+      __IOM uint32_t GPIO5INCFG : 1;            /*!< (@ 0x00000014) GPIO5 input enable.                                        */
+      __IOM uint32_t GPIO5OUTCFG : 2;           /*!< (@ 0x00000015) GPIO5 output configuration.                                */
+      __IOM uint32_t GPIO5INTD  : 1;            /*!< (@ 0x00000017) GPIO5 interrupt direction.                                 */
+      __IOM uint32_t GPIO6INCFG : 1;            /*!< (@ 0x00000018) GPIO6 input enable.                                        */
+      __IOM uint32_t GPIO6OUTCFG : 2;           /*!< (@ 0x00000019) GPIO6 output configuration.                                */
+      __IOM uint32_t GPIO6INTD  : 1;            /*!< (@ 0x0000001B) GPIO6 interrupt direction.                                 */
+      __IOM uint32_t GPIO7INCFG : 1;            /*!< (@ 0x0000001C) GPIO7 input enable.                                        */
+      __IOM uint32_t GPIO7OUTCFG : 2;           /*!< (@ 0x0000001D) GPIO7 output configuration.                                */
+      __IOM uint32_t GPIO7INTD  : 1;            /*!< (@ 0x0000001F) GPIO7 interrupt direction.                                 */
+    } CFGA_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CFGB;                        /*!< (@ 0x00000044) GPIO Configuration Register B                              */
+    
+    struct {
+      __IOM uint32_t GPIO8INCFG : 1;            /*!< (@ 0x00000000) GPIO8 input enable.                                        */
+      __IOM uint32_t GPIO8OUTCFG : 2;           /*!< (@ 0x00000001) GPIO8 output configuration.                                */
+      __IOM uint32_t GPIO8INTD  : 1;            /*!< (@ 0x00000003) GPIO8 interrupt direction.                                 */
+      __IOM uint32_t GPIO9INCFG : 1;            /*!< (@ 0x00000004) GPIO9 input enable.                                        */
+      __IOM uint32_t GPIO9OUTCFG : 2;           /*!< (@ 0x00000005) GPIO9 output configuration.                                */
+      __IOM uint32_t GPIO9INTD  : 1;            /*!< (@ 0x00000007) GPIO9 interrupt direction.                                 */
+      __IOM uint32_t GPIO10INCFG : 1;           /*!< (@ 0x00000008) GPIO10 input enable.                                       */
+      __IOM uint32_t GPIO10OUTCFG : 2;          /*!< (@ 0x00000009) GPIO10 output configuration.                               */
+      __IOM uint32_t GPIO10INTD : 1;            /*!< (@ 0x0000000B) GPIO10 interrupt direction.                                */
+      __IOM uint32_t GPIO11INCFG : 1;           /*!< (@ 0x0000000C) GPIO11 input enable.                                       */
+      __IOM uint32_t GPIO11OUTCFG : 2;          /*!< (@ 0x0000000D) GPIO11 output configuration.                               */
+      __IOM uint32_t GPIO11INTD : 1;            /*!< (@ 0x0000000F) GPIO11 interrupt direction.                                */
+      __IOM uint32_t GPIO12INCFG : 1;           /*!< (@ 0x00000010) GPIO12 input enable.                                       */
+      __IOM uint32_t GPIO12OUTCFG : 2;          /*!< (@ 0x00000011) GPIO12 output configuration.                               */
+      __IOM uint32_t GPIO12INTD : 1;            /*!< (@ 0x00000013) GPIO12 interrupt direction.                                */
+      __IOM uint32_t GPIO13INCFG : 1;           /*!< (@ 0x00000014) GPIO13 input enable.                                       */
+      __IOM uint32_t GPIO13OUTCFG : 2;          /*!< (@ 0x00000015) GPIO13 output configuration.                               */
+      __IOM uint32_t GPIO13INTD : 1;            /*!< (@ 0x00000017) GPIO13 interrupt direction.                                */
+      __IOM uint32_t GPIO14INCFG : 1;           /*!< (@ 0x00000018) GPIO14 input enable.                                       */
+      __IOM uint32_t GPIO14OUTCFG : 2;          /*!< (@ 0x00000019) GPIO14 output configuration.                               */
+      __IOM uint32_t GPIO14INTD : 1;            /*!< (@ 0x0000001B) GPIO14 interrupt direction.                                */
+      __IOM uint32_t GPIO15INCFG : 1;           /*!< (@ 0x0000001C) GPIO15 input enable.                                       */
+      __IOM uint32_t GPIO15OUTCFG : 2;          /*!< (@ 0x0000001D) GPIO15 output configuration.                               */
+      __IOM uint32_t GPIO15INTD : 1;            /*!< (@ 0x0000001F) GPIO15 interrupt direction.                                */
+    } CFGB_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CFGC;                        /*!< (@ 0x00000048) GPIO Configuration Register C                              */
+    
+    struct {
+      __IOM uint32_t GPIO16INCFG : 1;           /*!< (@ 0x00000000) GPIO16 input enable.                                       */
+      __IOM uint32_t GPIO16OUTCFG : 2;          /*!< (@ 0x00000001) GPIO16 output configuration.                               */
+      __IOM uint32_t GPIO16INTD : 1;            /*!< (@ 0x00000003) GPIO16 interrupt direction.                                */
+      __IOM uint32_t GPIO17INCFG : 1;           /*!< (@ 0x00000004) GPIO17 input enable.                                       */
+      __IOM uint32_t GPIO17OUTCFG : 2;          /*!< (@ 0x00000005) GPIO17 output configuration.                               */
+      __IOM uint32_t GPIO17INTD : 1;            /*!< (@ 0x00000007) GPIO17 interrupt direction.                                */
+      __IOM uint32_t GPIO18INCFG : 1;           /*!< (@ 0x00000008) GPIO18 input enable.                                       */
+      __IOM uint32_t GPIO18OUTCFG : 2;          /*!< (@ 0x00000009) GPIO18 output configuration.                               */
+      __IOM uint32_t GPIO18INTD : 1;            /*!< (@ 0x0000000B) GPIO18 interrupt direction.                                */
+      __IOM uint32_t GPIO19INCFG : 1;           /*!< (@ 0x0000000C) GPIO19 input enable.                                       */
+      __IOM uint32_t GPIO19OUTCFG : 2;          /*!< (@ 0x0000000D) GPIO19 output configuration.                               */
+      __IOM uint32_t GPIO19INTD : 1;            /*!< (@ 0x0000000F) GPIO19 interrupt direction.                                */
+      __IOM uint32_t GPIO20INCFG : 1;           /*!< (@ 0x00000010) GPIO20 input enable.                                       */
+      __IOM uint32_t GPIO20OUTCFG : 2;          /*!< (@ 0x00000011) GPIO20 output configuration.                               */
+      __IOM uint32_t GPIO20INTD : 1;            /*!< (@ 0x00000013) GPIO20 interrupt direction.                                */
+      __IOM uint32_t GPIO21INCFG : 1;           /*!< (@ 0x00000014) GPIO21 input enable.                                       */
+      __IOM uint32_t GPIO21OUTCFG : 2;          /*!< (@ 0x00000015) GPIO21 output configuration.                               */
+      __IOM uint32_t GPIO21INTD : 1;            /*!< (@ 0x00000017) GPIO21 interrupt direction.                                */
+      __IOM uint32_t GPIO22INCFG : 1;           /*!< (@ 0x00000018) GPIO22 input enable.                                       */
+      __IOM uint32_t GPIO22OUTCFG : 2;          /*!< (@ 0x00000019) GPIO22 output configuration.                               */
+      __IOM uint32_t GPIO22INTD : 1;            /*!< (@ 0x0000001B) GPIO22 interrupt direction.                                */
+      __IOM uint32_t GPIO23INCFG : 1;           /*!< (@ 0x0000001C) GPIO23 input enable.                                       */
+      __IOM uint32_t GPIO23OUTCFG : 2;          /*!< (@ 0x0000001D) GPIO23 output configuration.                               */
+      __IOM uint32_t GPIO23INTD : 1;            /*!< (@ 0x0000001F) GPIO23 interrupt direction.                                */
+    } CFGC_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CFGD;                        /*!< (@ 0x0000004C) GPIO Configuration Register D                              */
+    
+    struct {
+      __IOM uint32_t GPIO24INCFG : 1;           /*!< (@ 0x00000000) GPIO24 input enable.                                       */
+      __IOM uint32_t GPIO24OUTCFG : 2;          /*!< (@ 0x00000001) GPIO24 output configuration.                               */
+      __IOM uint32_t GPIO24INTD : 1;            /*!< (@ 0x00000003) GPIO24 interrupt direction.                                */
+      __IOM uint32_t GPIO25INCFG : 1;           /*!< (@ 0x00000004) GPIO25 input enable.                                       */
+      __IOM uint32_t GPIO25OUTCFG : 2;          /*!< (@ 0x00000005) GPIO25 output configuration.                               */
+      __IOM uint32_t GPIO25INTD : 1;            /*!< (@ 0x00000007) GPIO25 interrupt direction.                                */
+      __IOM uint32_t GPIO26INCFG : 1;           /*!< (@ 0x00000008) GPIO26 input enable.                                       */
+      __IOM uint32_t GPIO26OUTCFG : 2;          /*!< (@ 0x00000009) GPIO26 output configuration.                               */
+      __IOM uint32_t GPIO26INTD : 1;            /*!< (@ 0x0000000B) GPIO26 interrupt direction.                                */
+      __IOM uint32_t GPIO27INCFG : 1;           /*!< (@ 0x0000000C) GPIO27 input enable.                                       */
+      __IOM uint32_t GPIO27OUTCFG : 2;          /*!< (@ 0x0000000D) GPIO27 output configuration.                               */
+      __IOM uint32_t GPIO27INTD : 1;            /*!< (@ 0x0000000F) GPIO27 interrupt direction.                                */
+      __IOM uint32_t GPIO28INCFG : 1;           /*!< (@ 0x00000010) GPIO28 input enable.                                       */
+      __IOM uint32_t GPIO28OUTCFG : 2;          /*!< (@ 0x00000011) GPIO28 output configuration.                               */
+      __IOM uint32_t GPIO28INTD : 1;            /*!< (@ 0x00000013) GPIO28 interrupt direction.                                */
+      __IOM uint32_t GPIO29INCFG : 1;           /*!< (@ 0x00000014) GPIO29 input enable.                                       */
+      __IOM uint32_t GPIO29OUTCFG : 2;          /*!< (@ 0x00000015) GPIO29 output configuration.                               */
+      __IOM uint32_t GPIO29INTD : 1;            /*!< (@ 0x00000017) GPIO29 interrupt direction.                                */
+      __IOM uint32_t GPIO30INCFG : 1;           /*!< (@ 0x00000018) GPIO30 input enable.                                       */
+      __IOM uint32_t GPIO30OUTCFG : 2;          /*!< (@ 0x00000019) GPIO30 output configuration.                               */
+      __IOM uint32_t GPIO30INTD : 1;            /*!< (@ 0x0000001B) GPIO30 interrupt direction.                                */
+      __IOM uint32_t GPIO31INCFG : 1;           /*!< (@ 0x0000001C) GPIO31 input enable.                                       */
+      __IOM uint32_t GPIO31OUTCFG : 2;          /*!< (@ 0x0000001D) GPIO31 output configuration.                               */
+      __IOM uint32_t GPIO31INTD : 1;            /*!< (@ 0x0000001F) GPIO31 interrupt direction.                                */
+    } CFGD_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CFGE;                        /*!< (@ 0x00000050) GPIO Configuration Register E                              */
+    
+    struct {
+      __IOM uint32_t GPIO32INCFG : 1;           /*!< (@ 0x00000000) GPIO32 input enable.                                       */
+      __IOM uint32_t GPIO32OUTCFG : 2;          /*!< (@ 0x00000001) GPIO32 output configuration.                               */
+      __IOM uint32_t GPIO32INTD : 1;            /*!< (@ 0x00000003) GPIO32 interrupt direction.                                */
+      __IOM uint32_t GPIO33INCFG : 1;           /*!< (@ 0x00000004) GPIO33 input enable.                                       */
+      __IOM uint32_t GPIO33OUTCFG : 2;          /*!< (@ 0x00000005) GPIO33 output configuration.                               */
+      __IOM uint32_t GPIO33INTD : 1;            /*!< (@ 0x00000007) GPIO33 interrupt direction.                                */
+      __IOM uint32_t GPIO34INCFG : 1;           /*!< (@ 0x00000008) GPIO34 input enable.                                       */
+      __IOM uint32_t GPIO34OUTCFG : 2;          /*!< (@ 0x00000009) GPIO34 output configuration.                               */
+      __IOM uint32_t GPIO34INTD : 1;            /*!< (@ 0x0000000B) GPIO34 interrupt direction.                                */
+      __IOM uint32_t GPIO35INCFG : 1;           /*!< (@ 0x0000000C) GPIO35 input enable.                                       */
+      __IOM uint32_t GPIO35OUTCFG : 2;          /*!< (@ 0x0000000D) GPIO35 output configuration.                               */
+      __IOM uint32_t GPIO35INTD : 1;            /*!< (@ 0x0000000F) GPIO35 interrupt direction.                                */
+      __IOM uint32_t GPIO36INCFG : 1;           /*!< (@ 0x00000010) GPIO36 input enable.                                       */
+      __IOM uint32_t GPIO36OUTCFG : 2;          /*!< (@ 0x00000011) GPIO36 output configuration.                               */
+      __IOM uint32_t GPIO36INTD : 1;            /*!< (@ 0x00000013) GPIO36 interrupt direction.                                */
+      __IOM uint32_t GPIO37INCFG : 1;           /*!< (@ 0x00000014) GPIO37 input enable.                                       */
+      __IOM uint32_t GPIO37OUTCFG : 2;          /*!< (@ 0x00000015) GPIO37 output configuration.                               */
+      __IOM uint32_t GPIO37INTD : 1;            /*!< (@ 0x00000017) GPIO37 interrupt direction.                                */
+      __IOM uint32_t GPIO38INCFG : 1;           /*!< (@ 0x00000018) GPIO38 input enable.                                       */
+      __IOM uint32_t GPIO38OUTCFG : 2;          /*!< (@ 0x00000019) GPIO38 output configuration.                               */
+      __IOM uint32_t GPIO38INTD : 1;            /*!< (@ 0x0000001B) GPIO38 interrupt direction.                                */
+      __IOM uint32_t GPIO39INCFG : 1;           /*!< (@ 0x0000001C) GPIO39 input enable.                                       */
+      __IOM uint32_t GPIO39OUTCFG : 2;          /*!< (@ 0x0000001D) GPIO39 output configuration.                               */
+      __IOM uint32_t GPIO39INTD : 1;            /*!< (@ 0x0000001F) GPIO39 interrupt direction.                                */
+    } CFGE_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CFGF;                        /*!< (@ 0x00000054) GPIO Configuration Register F                              */
+    
+    struct {
+      __IOM uint32_t GPIO40INCFG : 1;           /*!< (@ 0x00000000) GPIO40 input enable.                                       */
+      __IOM uint32_t GPIO40OUTCFG : 2;          /*!< (@ 0x00000001) GPIO40 output configuration.                               */
+      __IOM uint32_t GPIO40INTD : 1;            /*!< (@ 0x00000003) GPIO40 interrupt direction.                                */
+      __IOM uint32_t GPIO41INCFG : 1;           /*!< (@ 0x00000004) GPIO41 input enable.                                       */
+      __IOM uint32_t GPIO41OUTCFG : 2;          /*!< (@ 0x00000005) GPIO41 output configuration.                               */
+      __IOM uint32_t GPIO41INTD : 1;            /*!< (@ 0x00000007) GPIO41 interrupt direction.                                */
+      __IOM uint32_t GPIO42INCFG : 1;           /*!< (@ 0x00000008) GPIO42 input enable.                                       */
+      __IOM uint32_t GPIO42OUTCFG : 2;          /*!< (@ 0x00000009) GPIO42 output configuration.                               */
+      __IOM uint32_t GPIO42INTD : 1;            /*!< (@ 0x0000000B) GPIO42 interrupt direction.                                */
+      __IOM uint32_t GPIO43INCFG : 1;           /*!< (@ 0x0000000C) GPIO43 input enable.                                       */
+      __IOM uint32_t GPIO43OUTCFG : 2;          /*!< (@ 0x0000000D) GPIO43 output configuration.                               */
+      __IOM uint32_t GPIO43INTD : 1;            /*!< (@ 0x0000000F) GPIO43 interrupt direction.                                */
+      __IOM uint32_t GPIO44INCFG : 1;           /*!< (@ 0x00000010) GPIO44 input enable.                                       */
+      __IOM uint32_t GPIO44OUTCFG : 2;          /*!< (@ 0x00000011) GPIO44 output configuration.                               */
+      __IOM uint32_t GPIO44INTD : 1;            /*!< (@ 0x00000013) GPIO44 interrupt direction.                                */
+      __IOM uint32_t GPIO45INCFG : 1;           /*!< (@ 0x00000014) GPIO45 input enable.                                       */
+      __IOM uint32_t GPIO45OUTCFG : 2;          /*!< (@ 0x00000015) GPIO45 output configuration.                               */
+      __IOM uint32_t GPIO45INTD : 1;            /*!< (@ 0x00000017) GPIO45 interrupt direction.                                */
+      __IOM uint32_t GPIO46INCFG : 1;           /*!< (@ 0x00000018) GPIO46 input enable.                                       */
+      __IOM uint32_t GPIO46OUTCFG : 2;          /*!< (@ 0x00000019) GPIO46 output configuration.                               */
+      __IOM uint32_t GPIO46INTD : 1;            /*!< (@ 0x0000001B) GPIO46 interrupt direction.                                */
+      __IOM uint32_t GPIO47INCFG : 1;           /*!< (@ 0x0000001C) GPIO47 input enable.                                       */
+      __IOM uint32_t GPIO47OUTCFG : 2;          /*!< (@ 0x0000001D) GPIO47 output configuration.                               */
+      __IOM uint32_t GPIO47INTD : 1;            /*!< (@ 0x0000001F) GPIO47 interrupt direction.                                */
+    } CFGF_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CFGG;                        /*!< (@ 0x00000058) GPIO Configuration Register G                              */
+    
+    struct {
+      __IOM uint32_t GPIO48INCFG : 1;           /*!< (@ 0x00000000) GPIO48 input enable.                                       */
+      __IOM uint32_t GPIO48OUTCFG : 2;          /*!< (@ 0x00000001) GPIO48 output configuration.                               */
+      __IOM uint32_t GPIO48INTD : 1;            /*!< (@ 0x00000003) GPIO48 interrupt direction.                                */
+      __IOM uint32_t GPIO49INCFG : 1;           /*!< (@ 0x00000004) GPIO49 input enable.                                       */
+      __IOM uint32_t GPIO49OUTCFG : 2;          /*!< (@ 0x00000005) GPIO49 output configuration.                               */
+      __IOM uint32_t GPIO49INTD : 1;            /*!< (@ 0x00000007) GPIO49 interrupt direction.                                */
+    } CFGG_b;
+  } ;
+  __IM  uint32_t  RESERVED1;
+  
+  union {
+    __IOM uint32_t PADKEY;                      /*!< (@ 0x00000060) Key Register for all pad configuration registers           */
+    
+    struct {
+      __IOM uint32_t PADKEY     : 32;           /*!< (@ 0x00000000) Key register value.                                        */
+    } PADKEY_b;
+  } ;
+  __IM  uint32_t  RESERVED2[7];
+  
+  union {
+    __IOM uint32_t RDA;                         /*!< (@ 0x00000080) GPIO Input Register A                                      */
+    
+    struct {
+      __IOM uint32_t RDA        : 32;           /*!< (@ 0x00000000) GPIO31-0 read data.                                        */
+    } RDA_b;
+  } ;
+  
+  union {
+    __IOM uint32_t RDB;                         /*!< (@ 0x00000084) GPIO Input Register B                                      */
+    
+    struct {
+      __IOM uint32_t RDB        : 18;           /*!< (@ 0x00000000) GPIO49-32 read data.                                       */
+    } RDB_b;
+  } ;
+  
+  union {
+    __IOM uint32_t WTA;                         /*!< (@ 0x00000088) GPIO Output Register A                                     */
+    
+    struct {
+      __IOM uint32_t WTA        : 32;           /*!< (@ 0x00000000) GPIO31-0 write data.                                       */
+    } WTA_b;
+  } ;
+  
+  union {
+    __IOM uint32_t WTB;                         /*!< (@ 0x0000008C) GPIO Output Register B                                     */
+    
+    struct {
+      __IOM uint32_t WTB        : 18;           /*!< (@ 0x00000000) GPIO49-32 write data.                                      */
+    } WTB_b;
+  } ;
+  
+  union {
+    __IOM uint32_t WTSA;                        /*!< (@ 0x00000090) GPIO Output Register A Set                                 */
+    
+    struct {
+      __IOM uint32_t WTSA       : 32;           /*!< (@ 0x00000000) Set the GPIO31-0 write data.                               */
+    } WTSA_b;
+  } ;
+  
+  union {
+    __IOM uint32_t WTSB;                        /*!< (@ 0x00000094) GPIO Output Register B Set                                 */
+    
+    struct {
+      __IOM uint32_t WTSB       : 18;           /*!< (@ 0x00000000) Set the GPIO49-32 write data.                              */
+    } WTSB_b;
+  } ;
+  
+  union {
+    __IOM uint32_t WTCA;                        /*!< (@ 0x00000098) GPIO Output Register A Clear                               */
+    
+    struct {
+      __IOM uint32_t WTCA       : 32;           /*!< (@ 0x00000000) Clear the GPIO31-0 write data.                             */
+    } WTCA_b;
+  } ;
+  
+  union {
+    __IOM uint32_t WTCB;                        /*!< (@ 0x0000009C) GPIO Output Register B Clear                               */
+    
+    struct {
+      __IOM uint32_t WTCB       : 18;           /*!< (@ 0x00000000) Clear the GPIO49-32 write data.                            */
+    } WTCB_b;
+  } ;
+  
+  union {
+    __IOM uint32_t ENA;                         /*!< (@ 0x000000A0) GPIO Enable Register A                                     */
+    
+    struct {
+      __IOM uint32_t ENA        : 32;           /*!< (@ 0x00000000) GPIO31-0 output enables                                    */
+    } ENA_b;
+  } ;
+  
+  union {
+    __IOM uint32_t ENB;                         /*!< (@ 0x000000A4) GPIO Enable Register B                                     */
+    
+    struct {
+      __IOM uint32_t ENB        : 18;           /*!< (@ 0x00000000) GPIO49-32 output enables                                   */
+    } ENB_b;
+  } ;
+  
+  union {
+    __IOM uint32_t ENSA;                        /*!< (@ 0x000000A8) GPIO Enable Register A Set                                 */
+    
+    struct {
+      __IOM uint32_t ENSA       : 32;           /*!< (@ 0x00000000) Set the GPIO31-0 output enables                            */
+    } ENSA_b;
+  } ;
+  
+  union {
+    __IOM uint32_t ENSB;                        /*!< (@ 0x000000AC) GPIO Enable Register B Set                                 */
+    
+    struct {
+      __IOM uint32_t ENSB       : 18;           /*!< (@ 0x00000000) Set the GPIO49-32 output enables                           */
+    } ENSB_b;
+  } ;
+  __IM  uint32_t  RESERVED3;
+  
+  union {
+    __IOM uint32_t ENCA;                        /*!< (@ 0x000000B4) GPIO Enable Register A Clear                               */
+    
+    struct {
+      __IOM uint32_t ENCA       : 32;           /*!< (@ 0x00000000) Clear the GPIO31-0 output enables                          */
+    } ENCA_b;
+  } ;
+  
+  union {
+    __IOM uint32_t ENCB;                        /*!< (@ 0x000000B8) GPIO Enable Register B Clear                               */
+    
+    struct {
+      __IOM uint32_t ENCB       : 18;           /*!< (@ 0x00000000) Clear the GPIO49-32 output enables                         */
+    } ENCB_b;
+  } ;
+  
+  union {
+    __IOM uint32_t STMRCAP;                     /*!< (@ 0x000000BC) STIMER Capture Control                                     */
+    
+    struct {
+      __IOM uint32_t STSEL0     : 6;            /*!< (@ 0x00000000) STIMER Capture 0 Select.                                   */
+      __IOM uint32_t STPOL0     : 1;            /*!< (@ 0x00000006) STIMER Capture 0 Polarity.                                 */
+      __IM  uint32_t            : 1;
+      __IOM uint32_t STSEL1     : 6;            /*!< (@ 0x00000008) STIMER Capture 1 Select.                                   */
+      __IOM uint32_t STPOL1     : 1;            /*!< (@ 0x0000000E) STIMER Capture 1 Polarity.                                 */
+      __IM  uint32_t            : 1;
+      __IOM uint32_t STSEL2     : 6;            /*!< (@ 0x00000010) STIMER Capture 2 Select.                                   */
+      __IOM uint32_t STPOL2     : 1;            /*!< (@ 0x00000016) STIMER Capture 2 Polarity.                                 */
+      __IM  uint32_t            : 1;
+      __IOM uint32_t STSEL3     : 6;            /*!< (@ 0x00000018) STIMER Capture 3 Select.                                   */
+      __IOM uint32_t STPOL3     : 1;            /*!< (@ 0x0000001E) STIMER Capture 3 Polarity.                                 */
+    } STMRCAP_b;
+  } ;
+  
+  union {
+    __IOM uint32_t IOM0IRQ;                     /*!< (@ 0x000000C0) IOM0 Flow Control IRQ Select                               */
+    
+    struct {
+      __IOM uint32_t IOM0IRQ    : 6;            /*!< (@ 0x00000000) IOMSTR0 IRQ pad select.                                    */
+    } IOM0IRQ_b;
+  } ;
+  
+  union {
+    __IOM uint32_t IOM1IRQ;                     /*!< (@ 0x000000C4) IOM1 Flow Control IRQ Select                               */
+    
+    struct {
+      __IOM uint32_t IOM1IRQ    : 6;            /*!< (@ 0x00000000) IOMSTR1 IRQ pad select.                                    */
+    } IOM1IRQ_b;
+  } ;
+  
+  union {
+    __IOM uint32_t IOM2IRQ;                     /*!< (@ 0x000000C8) IOM2 Flow Control IRQ Select                               */
+    
+    struct {
+      __IOM uint32_t IOM2IRQ    : 6;            /*!< (@ 0x00000000) IOMSTR2 IRQ pad select.                                    */
+    } IOM2IRQ_b;
+  } ;
+  
+  union {
+    __IOM uint32_t IOM3IRQ;                     /*!< (@ 0x000000CC) IOM3 Flow Control IRQ Select                               */
+    
+    struct {
+      __IOM uint32_t IOM3IRQ    : 6;            /*!< (@ 0x00000000) IOMSTR3 IRQ pad select.                                    */
+    } IOM3IRQ_b;
+  } ;
+  
+  union {
+    __IOM uint32_t IOM4IRQ;                     /*!< (@ 0x000000D0) IOM4 Flow Control IRQ Select                               */
+    
+    struct {
+      __IOM uint32_t IOM4IRQ    : 6;            /*!< (@ 0x00000000) IOMSTR4 IRQ pad select.                                    */
+    } IOM4IRQ_b;
+  } ;
+  
+  union {
+    __IOM uint32_t IOM5IRQ;                     /*!< (@ 0x000000D4) IOM5 Flow Control IRQ Select                               */
+    
+    struct {
+      __IOM uint32_t IOM5IRQ    : 6;            /*!< (@ 0x00000000) IOMSTR5 IRQ pad select.                                    */
+    } IOM5IRQ_b;
+  } ;
+  
+  union {
+    __IOM uint32_t LOOPBACK;                    /*!< (@ 0x000000D8) IOM to IOS Loopback Control                                */
+    
+    struct {
+      __IOM uint32_t LOOPBACK   : 3;            /*!< (@ 0x00000000) IOM to IOS loopback control.                               */
+    } LOOPBACK_b;
+  } ;
+  
+  union {
+    __IOM uint32_t GPIOOBS;                     /*!< (@ 0x000000DC) GPIO Observation Mode Sample register                      */
+    
+    struct {
+      __IOM uint32_t OBS_DATA   : 16;           /*!< (@ 0x00000000) Sample of the data output on the GPIO observation
+                                                                    port. May have async sampling issues, as
+                                                                    the data is not synronized to the read
+                                                                    operation. Intended for debug purposes
+                                                                    only                                                       */
+    } GPIOOBS_b;
+  } ;
+  
+  union {
+    __IOM uint32_t ALTPADCFGA;                  /*!< (@ 0x000000E0) Alternate Pad Configuration reg0 (Pads 3,2,1,0)            */
+    
+    struct {
+      __IOM uint32_t PAD0_DS1   : 1;            /*!< (@ 0x00000000) Pad 0 high order drive strength selection. Used
+                                                                    in conjunction with PAD0STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD0_SR    : 1;            /*!< (@ 0x00000004) Pad 0 slew rate selection.                                 */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD1_DS1   : 1;            /*!< (@ 0x00000008) Pad 1 high order drive strength selection. Used
+                                                                    in conjunction with PAD1STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD1_SR    : 1;            /*!< (@ 0x0000000C) Pad 1 slew rate selection.                                 */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD2_DS1   : 1;            /*!< (@ 0x00000010) Pad 2 high order drive strength selection. Used
+                                                                    in conjunction with PAD2STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD2_SR    : 1;            /*!< (@ 0x00000014) Pad 2 slew rate selection.                                 */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD3_DS1   : 1;            /*!< (@ 0x00000018) Pad 3 high order drive strength selection. Used
+                                                                    in conjunction with PAD3STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD3_SR    : 1;            /*!< (@ 0x0000001C) Pad 3 slew rate selection.                                 */
+    } ALTPADCFGA_b;
+  } ;
+  
+  union {
+    __IOM uint32_t ALTPADCFGB;                  /*!< (@ 0x000000E4) Alternate Pad Configuration reg1 (Pads 7,6,5,4)            */
+    
+    struct {
+      __IOM uint32_t PAD4_DS1   : 1;            /*!< (@ 0x00000000) Pad 4 high order drive strength selection. Used
+                                                                    in conjunction with PAD4STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD4_SR    : 1;            /*!< (@ 0x00000004) Pad 4 slew rate selection.                                 */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD5_DS1   : 1;            /*!< (@ 0x00000008) Pad 5 high order drive strength selection. Used
+                                                                    in conjunction with PAD5STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD5_SR    : 1;            /*!< (@ 0x0000000C) Pad 5 slew rate selection.                                 */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD6_DS1   : 1;            /*!< (@ 0x00000010) Pad 6 high order drive strength selection. Used
+                                                                    in conjunction with PAD6STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD6_SR    : 1;            /*!< (@ 0x00000014) Pad 6 slew rate selection.                                 */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD7_DS1   : 1;            /*!< (@ 0x00000018) Pad 7 high order drive strength selection. Used
+                                                                    in conjunction with PAD7STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD7_SR    : 1;            /*!< (@ 0x0000001C) Pad 7 slew rate selection.                                 */
+    } ALTPADCFGB_b;
+  } ;
+  
+  union {
+    __IOM uint32_t ALTPADCFGC;                  /*!< (@ 0x000000E8) Alternate Pad Configuration reg2 (Pads 11,10,9,8)          */
+    
+    struct {
+      __IOM uint32_t PAD8_DS1   : 1;            /*!< (@ 0x00000000) Pad 8 high order drive strength selection. Used
+                                                                    in conjunction with PAD8STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD8_SR    : 1;            /*!< (@ 0x00000004) Pad 8 slew rate selection.                                 */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD9_DS1   : 1;            /*!< (@ 0x00000008) Pad 9 high order drive strength selection. Used
+                                                                    in conjunction with PAD9STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD9_SR    : 1;            /*!< (@ 0x0000000C) Pad 9 slew rate selection.                                 */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD10_DS1  : 1;            /*!< (@ 0x00000010) Pad 10 high order drive strength selection. Used
+                                                                    in conjunction with PAD10STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD10_SR   : 1;            /*!< (@ 0x00000014) Pad 10 slew rate selection.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD11_DS1  : 1;            /*!< (@ 0x00000018) Pad 11 high order drive strength selection. Used
+                                                                    in conjunction with PAD11STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD11_SR   : 1;            /*!< (@ 0x0000001C) Pad 11 slew rate selection.                                */
+    } ALTPADCFGC_b;
+  } ;
+  
+  union {
+    __IOM uint32_t ALTPADCFGD;                  /*!< (@ 0x000000EC) Alternate Pad Configuration reg3 (Pads 15,14,13,12)        */
+    
+    struct {
+      __IOM uint32_t PAD12_DS1  : 1;            /*!< (@ 0x00000000) Pad 12 high order drive strength selection. Used
+                                                                    in conjunction with PAD12STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD12_SR   : 1;            /*!< (@ 0x00000004) Pad 12 slew rate selection.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD13_DS1  : 1;            /*!< (@ 0x00000008) Pad 13 high order drive strength selection. Used
+                                                                    in conjunction with PAD13STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD13_SR   : 1;            /*!< (@ 0x0000000C) Pad 13 slew rate selection.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD14_DS1  : 1;            /*!< (@ 0x00000010) Pad 14 high order drive strength selection. Used
+                                                                    in conjunction with PAD14STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD14_SR   : 1;            /*!< (@ 0x00000014) Pad 14 slew rate selection.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD15_DS1  : 1;            /*!< (@ 0x00000018) Pad 15 high order drive strength selection. Used
+                                                                    in conjunction with PAD15STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD15_SR   : 1;            /*!< (@ 0x0000001C) Pad 15 slew rate selection.                                */
+    } ALTPADCFGD_b;
+  } ;
+  
+  union {
+    __IOM uint32_t ALTPADCFGE;                  /*!< (@ 0x000000F0) Alternate Pad Configuration reg4 (Pads 19,18,17,16)        */
+    
+    struct {
+      __IOM uint32_t PAD16_DS1  : 1;            /*!< (@ 0x00000000) Pad 16 high order drive strength selection. Used
+                                                                    in conjunction with PAD16STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD16_SR   : 1;            /*!< (@ 0x00000004) Pad 16 slew rate selection.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD17_DS1  : 1;            /*!< (@ 0x00000008) Pad 17 high order drive strength selection. Used
+                                                                    in conjunction with PAD17STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD17_SR   : 1;            /*!< (@ 0x0000000C) Pad 17 slew rate selection.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD18_DS1  : 1;            /*!< (@ 0x00000010) Pad 18 high order drive strength selection. Used
+                                                                    in conjunction with PAD18STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD18_SR   : 1;            /*!< (@ 0x00000014) Pad 18 slew rate selection.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD19_DS1  : 1;            /*!< (@ 0x00000018) Pad 19 high order drive strength selection. Used
+                                                                    in conjunction with PAD19STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD19_SR   : 1;            /*!< (@ 0x0000001C) Pad 19 slew rate selection.                                */
+    } ALTPADCFGE_b;
+  } ;
+  
+  union {
+    __IOM uint32_t ALTPADCFGF;                  /*!< (@ 0x000000F4) Alternate Pad Configuration reg5 (Pads 23,22,21,20)        */
+    
+    struct {
+      __IOM uint32_t PAD20_DS1  : 1;            /*!< (@ 0x00000000) Pad 20 high order drive strength selection. Used
+                                                                    in conjunction with PAD20STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD20_SR   : 1;            /*!< (@ 0x00000004) Pad 20 slew rate selection.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD21_DS1  : 1;            /*!< (@ 0x00000008) Pad 21 high order drive strength selection. Used
+                                                                    in conjunction with PAD21STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD21_SR   : 1;            /*!< (@ 0x0000000C) Pad 21 slew rate selection.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD22_DS1  : 1;            /*!< (@ 0x00000010) Pad 22 high order drive strength selection. Used
+                                                                    in conjunction with PAD22STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD22_SR   : 1;            /*!< (@ 0x00000014) Pad 22 slew rate selection.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD23_DS1  : 1;            /*!< (@ 0x00000018) Pad 23 high order drive strength selection. Used
+                                                                    in conjunction with PAD23STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD23_SR   : 1;            /*!< (@ 0x0000001C) Pad 23 slew rate selection.                                */
+    } ALTPADCFGF_b;
+  } ;
+  
+  union {
+    __IOM uint32_t ALTPADCFGG;                  /*!< (@ 0x000000F8) Alternate Pad Configuration reg6 (Pads 27,26,25,24)        */
+    
+    struct {
+      __IOM uint32_t PAD24_DS1  : 1;            /*!< (@ 0x00000000) Pad 24 high order drive strength selection. Used
+                                                                    in conjunction with PAD24STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD24_SR   : 1;            /*!< (@ 0x00000004) Pad 24 slew rate selection.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD25_DS1  : 1;            /*!< (@ 0x00000008) Pad 25 high order drive strength selection. Used
+                                                                    in conjunction with PAD25STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD25_SR   : 1;            /*!< (@ 0x0000000C) Pad 25 slew rate selection.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD26_DS1  : 1;            /*!< (@ 0x00000010) Pad 26 high order drive strength selection. Used
+                                                                    in conjunction with PAD26STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD26_SR   : 1;            /*!< (@ 0x00000014) Pad 26 slew rate selection.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD27_DS1  : 1;            /*!< (@ 0x00000018) Pad 27 high order drive strength selection. Used
+                                                                    in conjunction with PAD27STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD27_SR   : 1;            /*!< (@ 0x0000001C) Pad 27 slew rate selection.                                */
+    } ALTPADCFGG_b;
+  } ;
+  
+  union {
+    __IOM uint32_t ALTPADCFGH;                  /*!< (@ 0x000000FC) Alternate Pad Configuration reg7 (Pads 31,30,29,28)        */
+    
+    struct {
+      __IOM uint32_t PAD28_DS1  : 1;            /*!< (@ 0x00000000) Pad 28 high order drive strength selection. Used
+                                                                    in conjunction with PAD28STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD28_SR   : 1;            /*!< (@ 0x00000004) Pad 28 slew rate selection.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD29_DS1  : 1;            /*!< (@ 0x00000008) Pad 29 high order drive strength selection. Used
+                                                                    in conjunction with PAD29STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD29_SR   : 1;            /*!< (@ 0x0000000C) Pad 29 slew rate selection.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD30_DS1  : 1;            /*!< (@ 0x00000010) Pad 30 high order drive strength selection. Used
+                                                                    in conjunction with PAD30STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD30_SR   : 1;            /*!< (@ 0x00000014) Pad 30 slew rate selection.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD31_DS1  : 1;            /*!< (@ 0x00000018) Pad 31 high order drive strength selection. Used
+                                                                    in conjunction with PAD31STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD31_SR   : 1;            /*!< (@ 0x0000001C) Pad 31 slew rate selection.                                */
+    } ALTPADCFGH_b;
+  } ;
+  
+  union {
+    __IOM uint32_t ALTPADCFGI;                  /*!< (@ 0x00000100) Alternate Pad Configuration reg8 (Pads 35,34,33,32)        */
+    
+    struct {
+      __IOM uint32_t PAD32_DS1  : 1;            /*!< (@ 0x00000000) Pad 32 high order drive strength selection. Used
+                                                                    in conjunction with PAD32STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD32_SR   : 1;            /*!< (@ 0x00000004) Pad 32 slew rate selection.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD33_DS1  : 1;            /*!< (@ 0x00000008) Pad 33 high order drive strength selection. Used
+                                                                    in conjunction with PAD33STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD33_SR   : 1;            /*!< (@ 0x0000000C) Pad 33 slew rate selection.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD34_DS1  : 1;            /*!< (@ 0x00000010) Pad 34 high order drive strength selection. Used
+                                                                    in conjunction with PAD34STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD34_SR   : 1;            /*!< (@ 0x00000014) Pad 34 slew rate selection.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD35_DS1  : 1;            /*!< (@ 0x00000018) Pad 35 high order drive strength selection. Used
+                                                                    in conjunction with PAD35STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD35_SR   : 1;            /*!< (@ 0x0000001C) Pad 35 slew rate selection.                                */
+    } ALTPADCFGI_b;
+  } ;
+  
+  union {
+    __IOM uint32_t ALTPADCFGJ;                  /*!< (@ 0x00000104) Alternate Pad Configuration reg9 (Pads 39,38,37,36)        */
+    
+    struct {
+      __IOM uint32_t PAD36_DS1  : 1;            /*!< (@ 0x00000000) Pad 36 high order drive strength selection. Used
+                                                                    in conjunction with PAD36STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD36_SR   : 1;            /*!< (@ 0x00000004) Pad 36 slew rate selection.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD37_DS1  : 1;            /*!< (@ 0x00000008) Pad 37 high order drive strength selection. Used
+                                                                    in conjunction with PAD37STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD37_SR   : 1;            /*!< (@ 0x0000000C) Pad 37 slew rate selection.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD38_DS1  : 1;            /*!< (@ 0x00000010) Pad 38 high order drive strength selection. Used
+                                                                    in conjunction with PAD38STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD38_SR   : 1;            /*!< (@ 0x00000014) Pad 38 slew rate selection.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD39_DS1  : 1;            /*!< (@ 0x00000018) Pad 39 high order drive strength selection. Used
+                                                                    in conjunction with PAD39STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD39_SR   : 1;            /*!< (@ 0x0000001C) Pad 39 slew rate selection.                                */
+    } ALTPADCFGJ_b;
+  } ;
+  
+  union {
+    __IOM uint32_t ALTPADCFGK;                  /*!< (@ 0x00000108) Alternate Pad Configuration reg10 (Pads 43,42,41,40)       */
+    
+    struct {
+      __IOM uint32_t PAD40_DS1  : 1;            /*!< (@ 0x00000000) Pad 40 high order drive strength selection. Used
+                                                                    in conjunction with PAD40STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD40_SR   : 1;            /*!< (@ 0x00000004) Pad 40 slew rate selection.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD41_DS1  : 1;            /*!< (@ 0x00000008) Pad 41 high order drive strength selection. Used
+                                                                    in conjunction with PAD41STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD41_SR   : 1;            /*!< (@ 0x0000000C) Pad 41 slew rate selection.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD42_DS1  : 1;            /*!< (@ 0x00000010) Pad 42 high order drive strength selection. Used
+                                                                    in conjunction with PAD42STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD42_SR   : 1;            /*!< (@ 0x00000014) Pad 42 slew rate selection.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD43_DS1  : 1;            /*!< (@ 0x00000018) Pad 43 high order drive strength selection. Used
+                                                                    in conjunction with PAD43STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD43_SR   : 1;            /*!< (@ 0x0000001C) Pad 43 slew rate selection.                                */
+    } ALTPADCFGK_b;
+  } ;
+  
+  union {
+    __IOM uint32_t ALTPADCFGL;                  /*!< (@ 0x0000010C) Alternate Pad Configuration reg11 (Pads 47,46,45,44)       */
+    
+    struct {
+      __IOM uint32_t PAD44_DS1  : 1;            /*!< (@ 0x00000000) Pad 44 high order drive strength selection. Used
+                                                                    in conjunction with PAD44STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD44_SR   : 1;            /*!< (@ 0x00000004) Pad 44 slew rate selection.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD45_DS1  : 1;            /*!< (@ 0x00000008) Pad 45 high order drive strength selection. Used
+                                                                    in conjunction with PAD45STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD45_SR   : 1;            /*!< (@ 0x0000000C) Pad 45 slew rate selection.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD46_DS1  : 1;            /*!< (@ 0x00000010) Pad 46 high order drive strength selection. Used
+                                                                    in conjunction with PAD46STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD46_SR   : 1;            /*!< (@ 0x00000014) Pad 46 slew rate selection.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD47_DS1  : 1;            /*!< (@ 0x00000018) Pad 47 high order drive strength selection. Used
+                                                                    in conjunction with PAD47STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD47_SR   : 1;            /*!< (@ 0x0000001C) Pad 47 slew rate selection.                                */
+    } ALTPADCFGL_b;
+  } ;
+  
+  union {
+    __IOM uint32_t ALTPADCFGM;                  /*!< (@ 0x00000110) Alternate Pad Configuration reg12 (Pads 49,48)             */
+    
+    struct {
+      __IOM uint32_t PAD48_DS1  : 1;            /*!< (@ 0x00000000) Pad 48 high order drive strength selection. Used
+                                                                    in conjunction with PAD48STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD48_SR   : 1;            /*!< (@ 0x00000004) Pad 48 slew rate selection.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD49_DS1  : 1;            /*!< (@ 0x00000008) Pad 49 high order drive strength selection. Used
+                                                                    in conjunction with PAD49STRNG field to
+                                                                    set the pad drive strength.                                */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PAD49_SR   : 1;            /*!< (@ 0x0000000C) Pad 49 slew rate selection.                                */
+    } ALTPADCFGM_b;
+  } ;
+  __IM  uint32_t  RESERVED4[59];
+  
+  union {
+    __IOM uint32_t INT0EN;                      /*!< (@ 0x00000200) GPIO Interrupt Registers 31-0: Enable                      */
+    
+    struct {
+      __IOM uint32_t GPIO0      : 1;            /*!< (@ 0x00000000) GPIO0 interrupt.                                           */
+      __IOM uint32_t GPIO1      : 1;            /*!< (@ 0x00000001) GPIO1 interrupt.                                           */
+      __IOM uint32_t GPIO2      : 1;            /*!< (@ 0x00000002) GPIO2 interrupt.                                           */
+      __IOM uint32_t GPIO3      : 1;            /*!< (@ 0x00000003) GPIO3 interrupt.                                           */
+      __IOM uint32_t GPIO4      : 1;            /*!< (@ 0x00000004) GPIO4 interrupt.                                           */
+      __IOM uint32_t GPIO5      : 1;            /*!< (@ 0x00000005) GPIO5 interrupt.                                           */
+      __IOM uint32_t GPIO6      : 1;            /*!< (@ 0x00000006) GPIO6 interrupt.                                           */
+      __IOM uint32_t GPIO7      : 1;            /*!< (@ 0x00000007) GPIO7 interrupt.                                           */
+      __IOM uint32_t GPIO8      : 1;            /*!< (@ 0x00000008) GPIO8 interrupt.                                           */
+      __IOM uint32_t GPIO9      : 1;            /*!< (@ 0x00000009) GPIO9 interrupt.                                           */
+      __IOM uint32_t GPIO10     : 1;            /*!< (@ 0x0000000A) GPIO10 interrupt.                                          */
+      __IOM uint32_t GPIO11     : 1;            /*!< (@ 0x0000000B) GPIO11 interrupt.                                          */
+      __IOM uint32_t GPIO12     : 1;            /*!< (@ 0x0000000C) GPIO12 interrupt.                                          */
+      __IOM uint32_t GPIO13     : 1;            /*!< (@ 0x0000000D) GPIO13 interrupt.                                          */
+      __IOM uint32_t GPIO14     : 1;            /*!< (@ 0x0000000E) GPIO14 interrupt.                                          */
+      __IOM uint32_t GPIO15     : 1;            /*!< (@ 0x0000000F) GPIO15 interrupt.                                          */
+      __IOM uint32_t GPIO16     : 1;            /*!< (@ 0x00000010) GPIO16 interrupt.                                          */
+      __IOM uint32_t GPIO17     : 1;            /*!< (@ 0x00000011) GPIO17 interrupt.                                          */
+      __IOM uint32_t GPIO18     : 1;            /*!< (@ 0x00000012) GPIO18interrupt.                                           */
+      __IOM uint32_t GPIO19     : 1;            /*!< (@ 0x00000013) GPIO19 interrupt.                                          */
+      __IOM uint32_t GPIO20     : 1;            /*!< (@ 0x00000014) GPIO20 interrupt.                                          */
+      __IOM uint32_t GPIO21     : 1;            /*!< (@ 0x00000015) GPIO21 interrupt.                                          */
+      __IOM uint32_t GPIO22     : 1;            /*!< (@ 0x00000016) GPIO22 interrupt.                                          */
+      __IOM uint32_t GPIO23     : 1;            /*!< (@ 0x00000017) GPIO23 interrupt.                                          */
+      __IOM uint32_t GPIO24     : 1;            /*!< (@ 0x00000018) GPIO24 interrupt.                                          */
+      __IOM uint32_t GPIO25     : 1;            /*!< (@ 0x00000019) GPIO25 interrupt.                                          */
+      __IOM uint32_t GPIO26     : 1;            /*!< (@ 0x0000001A) GPIO26 interrupt.                                          */
+      __IOM uint32_t GPIO27     : 1;            /*!< (@ 0x0000001B) GPIO27 interrupt.                                          */
+      __IOM uint32_t GPIO28     : 1;            /*!< (@ 0x0000001C) GPIO28 interrupt.                                          */
+      __IOM uint32_t GPIO29     : 1;            /*!< (@ 0x0000001D) GPIO29 interrupt.                                          */
+      __IOM uint32_t GPIO30     : 1;            /*!< (@ 0x0000001E) GPIO30 interrupt.                                          */
+      __IOM uint32_t GPIO31     : 1;            /*!< (@ 0x0000001F) GPIO31 interrupt.                                          */
+    } INT0EN_b;
+  } ;
+  
+  union {
+    __IOM uint32_t INT0STAT;                    /*!< (@ 0x00000204) GPIO Interrupt Registers 31-0: Status                      */
+    
+    struct {
+      __IOM uint32_t GPIO0      : 1;            /*!< (@ 0x00000000) GPIO0 interrupt.                                           */
+      __IOM uint32_t GPIO1      : 1;            /*!< (@ 0x00000001) GPIO1 interrupt.                                           */
+      __IOM uint32_t GPIO2      : 1;            /*!< (@ 0x00000002) GPIO2 interrupt.                                           */
+      __IOM uint32_t GPIO3      : 1;            /*!< (@ 0x00000003) GPIO3 interrupt.                                           */
+      __IOM uint32_t GPIO4      : 1;            /*!< (@ 0x00000004) GPIO4 interrupt.                                           */
+      __IOM uint32_t GPIO5      : 1;            /*!< (@ 0x00000005) GPIO5 interrupt.                                           */
+      __IOM uint32_t GPIO6      : 1;            /*!< (@ 0x00000006) GPIO6 interrupt.                                           */
+      __IOM uint32_t GPIO7      : 1;            /*!< (@ 0x00000007) GPIO7 interrupt.                                           */
+      __IOM uint32_t GPIO8      : 1;            /*!< (@ 0x00000008) GPIO8 interrupt.                                           */
+      __IOM uint32_t GPIO9      : 1;            /*!< (@ 0x00000009) GPIO9 interrupt.                                           */
+      __IOM uint32_t GPIO10     : 1;            /*!< (@ 0x0000000A) GPIO10 interrupt.                                          */
+      __IOM uint32_t GPIO11     : 1;            /*!< (@ 0x0000000B) GPIO11 interrupt.                                          */
+      __IOM uint32_t GPIO12     : 1;            /*!< (@ 0x0000000C) GPIO12 interrupt.                                          */
+      __IOM uint32_t GPIO13     : 1;            /*!< (@ 0x0000000D) GPIO13 interrupt.                                          */
+      __IOM uint32_t GPIO14     : 1;            /*!< (@ 0x0000000E) GPIO14 interrupt.                                          */
+      __IOM uint32_t GPIO15     : 1;            /*!< (@ 0x0000000F) GPIO15 interrupt.                                          */
+      __IOM uint32_t GPIO16     : 1;            /*!< (@ 0x00000010) GPIO16 interrupt.                                          */
+      __IOM uint32_t GPIO17     : 1;            /*!< (@ 0x00000011) GPIO17 interrupt.                                          */
+      __IOM uint32_t GPIO18     : 1;            /*!< (@ 0x00000012) GPIO18interrupt.                                           */
+      __IOM uint32_t GPIO19     : 1;            /*!< (@ 0x00000013) GPIO19 interrupt.                                          */
+      __IOM uint32_t GPIO20     : 1;            /*!< (@ 0x00000014) GPIO20 interrupt.                                          */
+      __IOM uint32_t GPIO21     : 1;            /*!< (@ 0x00000015) GPIO21 interrupt.                                          */
+      __IOM uint32_t GPIO22     : 1;            /*!< (@ 0x00000016) GPIO22 interrupt.                                          */
+      __IOM uint32_t GPIO23     : 1;            /*!< (@ 0x00000017) GPIO23 interrupt.                                          */
+      __IOM uint32_t GPIO24     : 1;            /*!< (@ 0x00000018) GPIO24 interrupt.                                          */
+      __IOM uint32_t GPIO25     : 1;            /*!< (@ 0x00000019) GPIO25 interrupt.                                          */
+      __IOM uint32_t GPIO26     : 1;            /*!< (@ 0x0000001A) GPIO26 interrupt.                                          */
+      __IOM uint32_t GPIO27     : 1;            /*!< (@ 0x0000001B) GPIO27 interrupt.                                          */
+      __IOM uint32_t GPIO28     : 1;            /*!< (@ 0x0000001C) GPIO28 interrupt.                                          */
+      __IOM uint32_t GPIO29     : 1;            /*!< (@ 0x0000001D) GPIO29 interrupt.                                          */
+      __IOM uint32_t GPIO30     : 1;            /*!< (@ 0x0000001E) GPIO30 interrupt.                                          */
+      __IOM uint32_t GPIO31     : 1;            /*!< (@ 0x0000001F) GPIO31 interrupt.                                          */
+    } INT0STAT_b;
+  } ;
+  
+  union {
+    __IOM uint32_t INT0CLR;                     /*!< (@ 0x00000208) GPIO Interrupt Registers 31-0: Clear                       */
+    
+    struct {
+      __IOM uint32_t GPIO0      : 1;            /*!< (@ 0x00000000) GPIO0 interrupt.                                           */
+      __IOM uint32_t GPIO1      : 1;            /*!< (@ 0x00000001) GPIO1 interrupt.                                           */
+      __IOM uint32_t GPIO2      : 1;            /*!< (@ 0x00000002) GPIO2 interrupt.                                           */
+      __IOM uint32_t GPIO3      : 1;            /*!< (@ 0x00000003) GPIO3 interrupt.                                           */
+      __IOM uint32_t GPIO4      : 1;            /*!< (@ 0x00000004) GPIO4 interrupt.                                           */
+      __IOM uint32_t GPIO5      : 1;            /*!< (@ 0x00000005) GPIO5 interrupt.                                           */
+      __IOM uint32_t GPIO6      : 1;            /*!< (@ 0x00000006) GPIO6 interrupt.                                           */
+      __IOM uint32_t GPIO7      : 1;            /*!< (@ 0x00000007) GPIO7 interrupt.                                           */
+      __IOM uint32_t GPIO8      : 1;            /*!< (@ 0x00000008) GPIO8 interrupt.                                           */
+      __IOM uint32_t GPIO9      : 1;            /*!< (@ 0x00000009) GPIO9 interrupt.                                           */
+      __IOM uint32_t GPIO10     : 1;            /*!< (@ 0x0000000A) GPIO10 interrupt.                                          */
+      __IOM uint32_t GPIO11     : 1;            /*!< (@ 0x0000000B) GPIO11 interrupt.                                          */
+      __IOM uint32_t GPIO12     : 1;            /*!< (@ 0x0000000C) GPIO12 interrupt.                                          */
+      __IOM uint32_t GPIO13     : 1;            /*!< (@ 0x0000000D) GPIO13 interrupt.                                          */
+      __IOM uint32_t GPIO14     : 1;            /*!< (@ 0x0000000E) GPIO14 interrupt.                                          */
+      __IOM uint32_t GPIO15     : 1;            /*!< (@ 0x0000000F) GPIO15 interrupt.                                          */
+      __IOM uint32_t GPIO16     : 1;            /*!< (@ 0x00000010) GPIO16 interrupt.                                          */
+      __IOM uint32_t GPIO17     : 1;            /*!< (@ 0x00000011) GPIO17 interrupt.                                          */
+      __IOM uint32_t GPIO18     : 1;            /*!< (@ 0x00000012) GPIO18interrupt.                                           */
+      __IOM uint32_t GPIO19     : 1;            /*!< (@ 0x00000013) GPIO19 interrupt.                                          */
+      __IOM uint32_t GPIO20     : 1;            /*!< (@ 0x00000014) GPIO20 interrupt.                                          */
+      __IOM uint32_t GPIO21     : 1;            /*!< (@ 0x00000015) GPIO21 interrupt.                                          */
+      __IOM uint32_t GPIO22     : 1;            /*!< (@ 0x00000016) GPIO22 interrupt.                                          */
+      __IOM uint32_t GPIO23     : 1;            /*!< (@ 0x00000017) GPIO23 interrupt.                                          */
+      __IOM uint32_t GPIO24     : 1;            /*!< (@ 0x00000018) GPIO24 interrupt.                                          */
+      __IOM uint32_t GPIO25     : 1;            /*!< (@ 0x00000019) GPIO25 interrupt.                                          */
+      __IOM uint32_t GPIO26     : 1;            /*!< (@ 0x0000001A) GPIO26 interrupt.                                          */
+      __IOM uint32_t GPIO27     : 1;            /*!< (@ 0x0000001B) GPIO27 interrupt.                                          */
+      __IOM uint32_t GPIO28     : 1;            /*!< (@ 0x0000001C) GPIO28 interrupt.                                          */
+      __IOM uint32_t GPIO29     : 1;            /*!< (@ 0x0000001D) GPIO29 interrupt.                                          */
+      __IOM uint32_t GPIO30     : 1;            /*!< (@ 0x0000001E) GPIO30 interrupt.                                          */
+      __IOM uint32_t GPIO31     : 1;            /*!< (@ 0x0000001F) GPIO31 interrupt.                                          */
+    } INT0CLR_b;
+  } ;
+  
+  union {
+    __IOM uint32_t INT0SET;                     /*!< (@ 0x0000020C) GPIO Interrupt Registers 31-0: Set                         */
+    
+    struct {
+      __IOM uint32_t GPIO0      : 1;            /*!< (@ 0x00000000) GPIO0 interrupt.                                           */
+      __IOM uint32_t GPIO1      : 1;            /*!< (@ 0x00000001) GPIO1 interrupt.                                           */
+      __IOM uint32_t GPIO2      : 1;            /*!< (@ 0x00000002) GPIO2 interrupt.                                           */
+      __IOM uint32_t GPIO3      : 1;            /*!< (@ 0x00000003) GPIO3 interrupt.                                           */
+      __IOM uint32_t GPIO4      : 1;            /*!< (@ 0x00000004) GPIO4 interrupt.                                           */
+      __IOM uint32_t GPIO5      : 1;            /*!< (@ 0x00000005) GPIO5 interrupt.                                           */
+      __IOM uint32_t GPIO6      : 1;            /*!< (@ 0x00000006) GPIO6 interrupt.                                           */
+      __IOM uint32_t GPIO7      : 1;            /*!< (@ 0x00000007) GPIO7 interrupt.                                           */
+      __IOM uint32_t GPIO8      : 1;            /*!< (@ 0x00000008) GPIO8 interrupt.                                           */
+      __IOM uint32_t GPIO9      : 1;            /*!< (@ 0x00000009) GPIO9 interrupt.                                           */
+      __IOM uint32_t GPIO10     : 1;            /*!< (@ 0x0000000A) GPIO10 interrupt.                                          */
+      __IOM uint32_t GPIO11     : 1;            /*!< (@ 0x0000000B) GPIO11 interrupt.                                          */
+      __IOM uint32_t GPIO12     : 1;            /*!< (@ 0x0000000C) GPIO12 interrupt.                                          */
+      __IOM uint32_t GPIO13     : 1;            /*!< (@ 0x0000000D) GPIO13 interrupt.                                          */
+      __IOM uint32_t GPIO14     : 1;            /*!< (@ 0x0000000E) GPIO14 interrupt.                                          */
+      __IOM uint32_t GPIO15     : 1;            /*!< (@ 0x0000000F) GPIO15 interrupt.                                          */
+      __IOM uint32_t GPIO16     : 1;            /*!< (@ 0x00000010) GPIO16 interrupt.                                          */
+      __IOM uint32_t GPIO17     : 1;            /*!< (@ 0x00000011) GPIO17 interrupt.                                          */
+      __IOM uint32_t GPIO18     : 1;            /*!< (@ 0x00000012) GPIO18interrupt.                                           */
+      __IOM uint32_t GPIO19     : 1;            /*!< (@ 0x00000013) GPIO19 interrupt.                                          */
+      __IOM uint32_t GPIO20     : 1;            /*!< (@ 0x00000014) GPIO20 interrupt.                                          */
+      __IOM uint32_t GPIO21     : 1;            /*!< (@ 0x00000015) GPIO21 interrupt.                                          */
+      __IOM uint32_t GPIO22     : 1;            /*!< (@ 0x00000016) GPIO22 interrupt.                                          */
+      __IOM uint32_t GPIO23     : 1;            /*!< (@ 0x00000017) GPIO23 interrupt.                                          */
+      __IOM uint32_t GPIO24     : 1;            /*!< (@ 0x00000018) GPIO24 interrupt.                                          */
+      __IOM uint32_t GPIO25     : 1;            /*!< (@ 0x00000019) GPIO25 interrupt.                                          */
+      __IOM uint32_t GPIO26     : 1;            /*!< (@ 0x0000001A) GPIO26 interrupt.                                          */
+      __IOM uint32_t GPIO27     : 1;            /*!< (@ 0x0000001B) GPIO27 interrupt.                                          */
+      __IOM uint32_t GPIO28     : 1;            /*!< (@ 0x0000001C) GPIO28 interrupt.                                          */
+      __IOM uint32_t GPIO29     : 1;            /*!< (@ 0x0000001D) GPIO29 interrupt.                                          */
+      __IOM uint32_t GPIO30     : 1;            /*!< (@ 0x0000001E) GPIO30 interrupt.                                          */
+      __IOM uint32_t GPIO31     : 1;            /*!< (@ 0x0000001F) GPIO31 interrupt.                                          */
+    } INT0SET_b;
+  } ;
+  
+  union {
+    __IOM uint32_t INT1EN;                      /*!< (@ 0x00000210) GPIO Interrupt Registers 49-32: Enable                     */
+    
+    struct {
+      __IOM uint32_t GPIO32     : 1;            /*!< (@ 0x00000000) GPIO32 interrupt.                                          */
+      __IOM uint32_t GPIO33     : 1;            /*!< (@ 0x00000001) GPIO33 interrupt.                                          */
+      __IOM uint32_t GPIO34     : 1;            /*!< (@ 0x00000002) GPIO34 interrupt.                                          */
+      __IOM uint32_t GPIO35     : 1;            /*!< (@ 0x00000003) GPIO35 interrupt.                                          */
+      __IOM uint32_t GPIO36     : 1;            /*!< (@ 0x00000004) GPIO36 interrupt.                                          */
+      __IOM uint32_t GPIO37     : 1;            /*!< (@ 0x00000005) GPIO37 interrupt.                                          */
+      __IOM uint32_t GPIO38     : 1;            /*!< (@ 0x00000006) GPIO38 interrupt.                                          */
+      __IOM uint32_t GPIO39     : 1;            /*!< (@ 0x00000007) GPIO39 interrupt.                                          */
+      __IOM uint32_t GPIO40     : 1;            /*!< (@ 0x00000008) GPIO40 interrupt.                                          */
+      __IOM uint32_t GPIO41     : 1;            /*!< (@ 0x00000009) GPIO41 interrupt.                                          */
+      __IOM uint32_t GPIO42     : 1;            /*!< (@ 0x0000000A) GPIO42 interrupt.                                          */
+      __IOM uint32_t GPIO43     : 1;            /*!< (@ 0x0000000B) GPIO43 interrupt.                                          */
+      __IOM uint32_t GPIO44     : 1;            /*!< (@ 0x0000000C) GPIO44 interrupt.                                          */
+      __IOM uint32_t GPIO45     : 1;            /*!< (@ 0x0000000D) GPIO45 interrupt.                                          */
+      __IOM uint32_t GPIO46     : 1;            /*!< (@ 0x0000000E) GPIO46 interrupt.                                          */
+      __IOM uint32_t GPIO47     : 1;            /*!< (@ 0x0000000F) GPIO47 interrupt.                                          */
+      __IOM uint32_t GPIO48     : 1;            /*!< (@ 0x00000010) GPIO48 interrupt.                                          */
+      __IOM uint32_t GPIO49     : 1;            /*!< (@ 0x00000011) GPIO49 interrupt.                                          */
+    } INT1EN_b;
+  } ;
+  
+  union {
+    __IOM uint32_t INT1STAT;                    /*!< (@ 0x00000214) GPIO Interrupt Registers 49-32: Status                     */
+    
+    struct {
+      __IOM uint32_t GPIO32     : 1;            /*!< (@ 0x00000000) GPIO32 interrupt.                                          */
+      __IOM uint32_t GPIO33     : 1;            /*!< (@ 0x00000001) GPIO33 interrupt.                                          */
+      __IOM uint32_t GPIO34     : 1;            /*!< (@ 0x00000002) GPIO34 interrupt.                                          */
+      __IOM uint32_t GPIO35     : 1;            /*!< (@ 0x00000003) GPIO35 interrupt.                                          */
+      __IOM uint32_t GPIO36     : 1;            /*!< (@ 0x00000004) GPIO36 interrupt.                                          */
+      __IOM uint32_t GPIO37     : 1;            /*!< (@ 0x00000005) GPIO37 interrupt.                                          */
+      __IOM uint32_t GPIO38     : 1;            /*!< (@ 0x00000006) GPIO38 interrupt.                                          */
+      __IOM uint32_t GPIO39     : 1;            /*!< (@ 0x00000007) GPIO39 interrupt.                                          */
+      __IOM uint32_t GPIO40     : 1;            /*!< (@ 0x00000008) GPIO40 interrupt.                                          */
+      __IOM uint32_t GPIO41     : 1;            /*!< (@ 0x00000009) GPIO41 interrupt.                                          */
+      __IOM uint32_t GPIO42     : 1;            /*!< (@ 0x0000000A) GPIO42 interrupt.                                          */
+      __IOM uint32_t GPIO43     : 1;            /*!< (@ 0x0000000B) GPIO43 interrupt.                                          */
+      __IOM uint32_t GPIO44     : 1;            /*!< (@ 0x0000000C) GPIO44 interrupt.                                          */
+      __IOM uint32_t GPIO45     : 1;            /*!< (@ 0x0000000D) GPIO45 interrupt.                                          */
+      __IOM uint32_t GPIO46     : 1;            /*!< (@ 0x0000000E) GPIO46 interrupt.                                          */
+      __IOM uint32_t GPIO47     : 1;            /*!< (@ 0x0000000F) GPIO47 interrupt.                                          */
+      __IOM uint32_t GPIO48     : 1;            /*!< (@ 0x00000010) GPIO48 interrupt.                                          */
+      __IOM uint32_t GPIO49     : 1;            /*!< (@ 0x00000011) GPIO49 interrupt.                                          */
+    } INT1STAT_b;
+  } ;
+  
+  union {
+    __IOM uint32_t INT1CLR;                     /*!< (@ 0x00000218) GPIO Interrupt Registers 49-32: Clear                      */
+    
+    struct {
+      __IOM uint32_t GPIO32     : 1;            /*!< (@ 0x00000000) GPIO32 interrupt.                                          */
+      __IOM uint32_t GPIO33     : 1;            /*!< (@ 0x00000001) GPIO33 interrupt.                                          */
+      __IOM uint32_t GPIO34     : 1;            /*!< (@ 0x00000002) GPIO34 interrupt.                                          */
+      __IOM uint32_t GPIO35     : 1;            /*!< (@ 0x00000003) GPIO35 interrupt.                                          */
+      __IOM uint32_t GPIO36     : 1;            /*!< (@ 0x00000004) GPIO36 interrupt.                                          */
+      __IOM uint32_t GPIO37     : 1;            /*!< (@ 0x00000005) GPIO37 interrupt.                                          */
+      __IOM uint32_t GPIO38     : 1;            /*!< (@ 0x00000006) GPIO38 interrupt.                                          */
+      __IOM uint32_t GPIO39     : 1;            /*!< (@ 0x00000007) GPIO39 interrupt.                                          */
+      __IOM uint32_t GPIO40     : 1;            /*!< (@ 0x00000008) GPIO40 interrupt.                                          */
+      __IOM uint32_t GPIO41     : 1;            /*!< (@ 0x00000009) GPIO41 interrupt.                                          */
+      __IOM uint32_t GPIO42     : 1;            /*!< (@ 0x0000000A) GPIO42 interrupt.                                          */
+      __IOM uint32_t GPIO43     : 1;            /*!< (@ 0x0000000B) GPIO43 interrupt.                                          */
+      __IOM uint32_t GPIO44     : 1;            /*!< (@ 0x0000000C) GPIO44 interrupt.                                          */
+      __IOM uint32_t GPIO45     : 1;            /*!< (@ 0x0000000D) GPIO45 interrupt.                                          */
+      __IOM uint32_t GPIO46     : 1;            /*!< (@ 0x0000000E) GPIO46 interrupt.                                          */
+      __IOM uint32_t GPIO47     : 1;            /*!< (@ 0x0000000F) GPIO47 interrupt.                                          */
+      __IOM uint32_t GPIO48     : 1;            /*!< (@ 0x00000010) GPIO48 interrupt.                                          */
+      __IOM uint32_t GPIO49     : 1;            /*!< (@ 0x00000011) GPIO49 interrupt.                                          */
+    } INT1CLR_b;
+  } ;
+  
+  union {
+    __IOM uint32_t INT1SET;                     /*!< (@ 0x0000021C) GPIO Interrupt Registers 49-32: Set                        */
+    
+    struct {
+      __IOM uint32_t GPIO32     : 1;            /*!< (@ 0x00000000) GPIO32 interrupt.                                          */
+      __IOM uint32_t GPIO33     : 1;            /*!< (@ 0x00000001) GPIO33 interrupt.                                          */
+      __IOM uint32_t GPIO34     : 1;            /*!< (@ 0x00000002) GPIO34 interrupt.                                          */
+      __IOM uint32_t GPIO35     : 1;            /*!< (@ 0x00000003) GPIO35 interrupt.                                          */
+      __IOM uint32_t GPIO36     : 1;            /*!< (@ 0x00000004) GPIO36 interrupt.                                          */
+      __IOM uint32_t GPIO37     : 1;            /*!< (@ 0x00000005) GPIO37 interrupt.                                          */
+      __IOM uint32_t GPIO38     : 1;            /*!< (@ 0x00000006) GPIO38 interrupt.                                          */
+      __IOM uint32_t GPIO39     : 1;            /*!< (@ 0x00000007) GPIO39 interrupt.                                          */
+      __IOM uint32_t GPIO40     : 1;            /*!< (@ 0x00000008) GPIO40 interrupt.                                          */
+      __IOM uint32_t GPIO41     : 1;            /*!< (@ 0x00000009) GPIO41 interrupt.                                          */
+      __IOM uint32_t GPIO42     : 1;            /*!< (@ 0x0000000A) GPIO42 interrupt.                                          */
+      __IOM uint32_t GPIO43     : 1;            /*!< (@ 0x0000000B) GPIO43 interrupt.                                          */
+      __IOM uint32_t GPIO44     : 1;            /*!< (@ 0x0000000C) GPIO44 interrupt.                                          */
+      __IOM uint32_t GPIO45     : 1;            /*!< (@ 0x0000000D) GPIO45 interrupt.                                          */
+      __IOM uint32_t GPIO46     : 1;            /*!< (@ 0x0000000E) GPIO46 interrupt.                                          */
+      __IOM uint32_t GPIO47     : 1;            /*!< (@ 0x0000000F) GPIO47 interrupt.                                          */
+      __IOM uint32_t GPIO48     : 1;            /*!< (@ 0x00000010) GPIO48 interrupt.                                          */
+      __IOM uint32_t GPIO49     : 1;            /*!< (@ 0x00000011) GPIO49 interrupt.                                          */
+    } INT1SET_b;
+  } ;
+} GPIO_Type;                                    /*!< Size = 544 (0x220)                                                        */
+
+
+
+/* =========================================================================================================================== */
+/* ================                                          IOMSTR0                                          ================ */
+/* =========================================================================================================================== */
+
+
+/**
+  * @brief I2C/SPI Master (IOMSTR0)
+  */
+
+typedef struct {                                /*!< (@ 0x50004000) IOMSTR0 Structure                                          */
+  
+  union {
+    __IOM uint32_t FIFO;                        /*!< (@ 0x00000000) FIFO Access Port                                           */
+    
+    struct {
+      __IOM uint32_t FIFO       : 32;           /*!< (@ 0x00000000) FIFO access port.                                          */
+    } FIFO_b;
+  } ;
+  __IM  uint32_t  RESERVED[63];
+  
+  union {
+    __IOM uint32_t FIFOPTR;                     /*!< (@ 0x00000100) Current FIFO Pointers                                      */
+    
+    struct {
+      __IOM uint32_t FIFOSIZ    : 8;            /*!< (@ 0x00000000) The number of bytes currently in the FIFO.                 */
+      __IM  uint32_t            : 8;
+      __IOM uint32_t FIFOREM    : 8;            /*!< (@ 0x00000010) The number of bytes remaining in the FIFO (i.e.
+                                                                    128-FIFOSIZ if FULLDUP = 0 or 64-FIFOSIZ
+                                                                    if FULLDUP = 1)).                                          */
+    } FIFOPTR_b;
+  } ;
+  
+  union {
+    __IOM uint32_t TLNGTH;                      /*!< (@ 0x00000104) Transfer Length                                            */
+    
+    struct {
+      __IOM uint32_t TLNGTH     : 12;           /*!< (@ 0x00000000) Remaining transfer length.                                 */
+    } TLNGTH_b;
+  } ;
+  
+  union {
+    __IOM uint32_t FIFOTHR;                     /*!< (@ 0x00000108) FIFO Threshold Configuration                               */
+    
+    struct {
+      __IOM uint32_t FIFORTHR   : 7;            /*!< (@ 0x00000000) FIFO read threshold.                                       */
+      __IM  uint32_t            : 1;
+      __IOM uint32_t FIFOWTHR   : 7;            /*!< (@ 0x00000008) FIFO write threshold.                                      */
+    } FIFOTHR_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CLKCFG;                      /*!< (@ 0x0000010C) I/O Clock Configuration                                    */
+    
+    struct {
+      __IM  uint32_t            : 8;
+      __IOM uint32_t FSEL       : 3;            /*!< (@ 0x00000008) Select the input clock frequency.                          */
+      __IOM uint32_t DIV3       : 1;            /*!< (@ 0x0000000B) Enable divide by 3.                                        */
+      __IOM uint32_t DIVEN      : 1;            /*!< (@ 0x0000000C) Enable clock division by TOTPER.                           */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t LOWPER     : 8;            /*!< (@ 0x00000010) Clock low count minus 1.                                   */
+      __IOM uint32_t TOTPER     : 8;            /*!< (@ 0x00000018) Clock total count minus 1.                                 */
+    } CLKCFG_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CMD;                         /*!< (@ 0x00000110) Command Register                                           */
+    
+    struct {
+      __IOM uint32_t CMD        : 32;           /*!< (@ 0x00000000) This register holds the I/O Command                        */
+    } CMD_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CMDRPT;                      /*!< (@ 0x00000114) Command Repeat Register                                    */
+    
+    struct {
+      __IOM uint32_t CMDRPT     : 5;            /*!< (@ 0x00000000) These bits hold the Command repeat count.                  */
+    } CMDRPT_b;
+  } ;
+  
+  union {
+    __IOM uint32_t STATUS;                      /*!< (@ 0x00000118) Status Register                                            */
+    
+    struct {
+      __IOM uint32_t ERR        : 1;            /*!< (@ 0x00000000) This bit indicates if an error interrupt has
+                                                                    occurred.                                                  */
+      __IOM uint32_t CMDACT     : 1;            /*!< (@ 0x00000001) This bit indicates if the I/O Command is active.           */
+      __IOM uint32_t IDLEST     : 1;            /*!< (@ 0x00000002) This bit indicates if the I/O state machine is
+                                                                    IDLE.                                                      */
+    } STATUS_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CFG;                         /*!< (@ 0x0000011C) I/O Master Configuration                                   */
+    
+    struct {
+      __IOM uint32_t IFCSEL     : 1;            /*!< (@ 0x00000000) This bit selects the I/O interface.                        */
+      __IOM uint32_t SPOL       : 1;            /*!< (@ 0x00000001) This bit selects SPI polarity.                             */
+      __IOM uint32_t SPHA       : 1;            /*!< (@ 0x00000002) This bit selects SPI phase.                                */
+      __IOM uint32_t FULLDUP    : 1;            /*!< (@ 0x00000003) This bit selects full duplex mode.                         */
+      __IOM uint32_t STARTRD    : 2;            /*!< (@ 0x00000004) This bit selects the preread timing.                       */
+      __IM  uint32_t            : 2;
+      __IOM uint32_t WTFC       : 1;            /*!< (@ 0x00000008) This bit enables write mode flow control.                  */
+      __IOM uint32_t RDFC       : 1;            /*!< (@ 0x00000009) This bit enables read mode flow control.                   */
+      __IOM uint32_t MOSIINV    : 1;            /*!< (@ 0x0000000A) This bit invewrts MOSI when flow control is enabled.       */
+      __IOM uint32_t FCDEL      : 1;            /*!< (@ 0x0000000B) This bit must be left at the default value of
+                                                                    0.                                                         */
+      __IOM uint32_t WTFCIRQ    : 1;            /*!< (@ 0x0000000C) This bit selects the write mode flow control
+                                                                    signal.                                                    */
+      __IOM uint32_t WTFCPOL    : 1;            /*!< (@ 0x0000000D) This bit selects the write flow control signal
+                                                                    polarity.                                                  */
+      __IOM uint32_t RDFCPOL    : 1;            /*!< (@ 0x0000000E) This bit selects the read flow control signal
+                                                                    polarity.                                                  */
+      __IM  uint32_t            : 16;
+      __IOM uint32_t IFCEN      : 1;            /*!< (@ 0x0000001F) This bit enables the IO Master.                            */
+    } CFG_b;
+  } ;
+  __IM  uint32_t  RESERVED1[56];
+  
+  union {
+    __IOM uint32_t INTEN;                       /*!< (@ 0x00000200) IO Master Interrupts: Enable                               */
+    
+    struct {
+      __IOM uint32_t CMDCMP     : 1;            /*!< (@ 0x00000000) This is the Command Complete interrupt.                    */
+      __IOM uint32_t THR        : 1;            /*!< (@ 0x00000001) This is the FIFO Threshold interrupt.                      */
+      __IOM uint32_t FUNDFL     : 1;            /*!< (@ 0x00000002) This is the Read FIFO Underflow interrupt. An
+                                                                    attempt was made to read FIFO when empty
+                                                                    (i.e. while FIFOSIZ less than 4).                          */
+      __IOM uint32_t FOVFL      : 1;            /*!< (@ 0x00000003) This is the Write FIFO Overflow interrupt. An
+                                                                    attempt was made to write the FIFO while
+                                                                    it was full (i.e. while FIFOSIZ > 124).                    */
+      __IOM uint32_t NAK        : 1;            /*!< (@ 0x00000004) This is the I2C NAK interrupt. The expected ACK
+                                                                    from the slave was not received by the
+                                                                    IOM.                                                       */
+      __IOM uint32_t WTLEN      : 1;            /*!< (@ 0x00000005) This is the WTLEN interrupt.                               */
+      __IOM uint32_t IACC       : 1;            /*!< (@ 0x00000006) This is the illegal FIFO access interrupt. An
+                                                                    attempt was made to read the FIFO during
+                                                                    a write CMD. Or an attempt was made to
+                                                                    write the FIFO on a read CMD.                              */
+      __IOM uint32_t ICMD       : 1;            /*!< (@ 0x00000007) This is the illegal command interrupt. Software
+                                                                    attempted to issue a CMD while another
+                                                                    CMD was already in progress. Or an attempt
+                                                                    was made to issue a non-zero-length write
+                                                                    CMD with an empty FIFO.                                    */
+      __IOM uint32_t START      : 1;            /*!< (@ 0x00000008) This is the START command interrupt. A START
+                                                                    from another master was detected. Software
+                                                                    must wait for a STOP before proceeding.                    */
+      __IOM uint32_t STOP       : 1;            /*!< (@ 0x00000009) This is the STOP command interrupt. A STOP bit
+                                                                    was detected by the IOM.                                   */
+      __IOM uint32_t ARB        : 1;            /*!< (@ 0x0000000A) This is the arbitration loss interrupt. This
+                                                                    error occurs if another master collides
+                                                                    with an IO Master transfer. Generally,
+                                                                    the IOM started an operation but found
+                                                                    SDA already low.                                           */
+    } INTEN_b;
+  } ;
+  
+  union {
+    __IOM uint32_t INTSTAT;                     /*!< (@ 0x00000204) IO Master Interrupts: Status                               */
+    
+    struct {
+      __IOM uint32_t CMDCMP     : 1;            /*!< (@ 0x00000000) This is the Command Complete interrupt.                    */
+      __IOM uint32_t THR        : 1;            /*!< (@ 0x00000001) This is the FIFO Threshold interrupt.                      */
+      __IOM uint32_t FUNDFL     : 1;            /*!< (@ 0x00000002) This is the Read FIFO Underflow interrupt. An
+                                                                    attempt was made to read FIFO when empty
+                                                                    (i.e. while FIFOSIZ less than 4).                          */
+      __IOM uint32_t FOVFL      : 1;            /*!< (@ 0x00000003) This is the Write FIFO Overflow interrupt. An
+                                                                    attempt was made to write the FIFO while
+                                                                    it was full (i.e. while FIFOSIZ > 124).                    */
+      __IOM uint32_t NAK        : 1;            /*!< (@ 0x00000004) This is the I2C NAK interrupt. The expected ACK
+                                                                    from the slave was not received by the
+                                                                    IOM.                                                       */
+      __IOM uint32_t WTLEN      : 1;            /*!< (@ 0x00000005) This is the WTLEN interrupt.                               */
+      __IOM uint32_t IACC       : 1;            /*!< (@ 0x00000006) This is the illegal FIFO access interrupt. An
+                                                                    attempt was made to read the FIFO during
+                                                                    a write CMD. Or an attempt was made to
+                                                                    write the FIFO on a read CMD.                              */
+      __IOM uint32_t ICMD       : 1;            /*!< (@ 0x00000007) This is the illegal command interrupt. Software
+                                                                    attempted to issue a CMD while another
+                                                                    CMD was already in progress. Or an attempt
+                                                                    was made to issue a non-zero-length write
+                                                                    CMD with an empty FIFO.                                    */
+      __IOM uint32_t START      : 1;            /*!< (@ 0x00000008) This is the START command interrupt. A START
+                                                                    from another master was detected. Software
+                                                                    must wait for a STOP before proceeding.                    */
+      __IOM uint32_t STOP       : 1;            /*!< (@ 0x00000009) This is the STOP command interrupt. A STOP bit
+                                                                    was detected by the IOM.                                   */
+      __IOM uint32_t ARB        : 1;            /*!< (@ 0x0000000A) This is the arbitration loss interrupt. This
+                                                                    error occurs if another master collides
+                                                                    with an IO Master transfer. Generally,
+                                                                    the IOM started an operation but found
+                                                                    SDA already low.                                           */
+    } INTSTAT_b;
+  } ;
+  
+  union {
+    __IOM uint32_t INTCLR;                      /*!< (@ 0x00000208) IO Master Interrupts: Clear                                */
+    
+    struct {
+      __IOM uint32_t CMDCMP     : 1;            /*!< (@ 0x00000000) This is the Command Complete interrupt.                    */
+      __IOM uint32_t THR        : 1;            /*!< (@ 0x00000001) This is the FIFO Threshold interrupt.                      */
+      __IOM uint32_t FUNDFL     : 1;            /*!< (@ 0x00000002) This is the Read FIFO Underflow interrupt. An
+                                                                    attempt was made to read FIFO when empty
+                                                                    (i.e. while FIFOSIZ less than 4).                          */
+      __IOM uint32_t FOVFL      : 1;            /*!< (@ 0x00000003) This is the Write FIFO Overflow interrupt. An
+                                                                    attempt was made to write the FIFO while
+                                                                    it was full (i.e. while FIFOSIZ > 124).                    */
+      __IOM uint32_t NAK        : 1;            /*!< (@ 0x00000004) This is the I2C NAK interrupt. The expected ACK
+                                                                    from the slave was not received by the
+                                                                    IOM.                                                       */
+      __IOM uint32_t WTLEN      : 1;            /*!< (@ 0x00000005) This is the WTLEN interrupt.                               */
+      __IOM uint32_t IACC       : 1;            /*!< (@ 0x00000006) This is the illegal FIFO access interrupt. An
+                                                                    attempt was made to read the FIFO during
+                                                                    a write CMD. Or an attempt was made to
+                                                                    write the FIFO on a read CMD.                              */
+      __IOM uint32_t ICMD       : 1;            /*!< (@ 0x00000007) This is the illegal command interrupt. Software
+                                                                    attempted to issue a CMD while another
+                                                                    CMD was already in progress. Or an attempt
+                                                                    was made to issue a non-zero-length write
+                                                                    CMD with an empty FIFO.                                    */
+      __IOM uint32_t START      : 1;            /*!< (@ 0x00000008) This is the START command interrupt. A START
+                                                                    from another master was detected. Software
+                                                                    must wait for a STOP before proceeding.                    */
+      __IOM uint32_t STOP       : 1;            /*!< (@ 0x00000009) This is the STOP command interrupt. A STOP bit
+                                                                    was detected by the IOM.                                   */
+      __IOM uint32_t ARB        : 1;            /*!< (@ 0x0000000A) This is the arbitration loss interrupt. This
+                                                                    error occurs if another master collides
+                                                                    with an IO Master transfer. Generally,
+                                                                    the IOM started an operation but found
+                                                                    SDA already low.                                           */
+    } INTCLR_b;
+  } ;
+  
+  union {
+    __IOM uint32_t INTSET;                      /*!< (@ 0x0000020C) IO Master Interrupts: Set                                  */
+    
+    struct {
+      __IOM uint32_t CMDCMP     : 1;            /*!< (@ 0x00000000) This is the Command Complete interrupt.                    */
+      __IOM uint32_t THR        : 1;            /*!< (@ 0x00000001) This is the FIFO Threshold interrupt.                      */
+      __IOM uint32_t FUNDFL     : 1;            /*!< (@ 0x00000002) This is the Read FIFO Underflow interrupt. An
+                                                                    attempt was made to read FIFO when empty
+                                                                    (i.e. while FIFOSIZ less than 4).                          */
+      __IOM uint32_t FOVFL      : 1;            /*!< (@ 0x00000003) This is the Write FIFO Overflow interrupt. An
+                                                                    attempt was made to write the FIFO while
+                                                                    it was full (i.e. while FIFOSIZ > 124).                    */
+      __IOM uint32_t NAK        : 1;            /*!< (@ 0x00000004) This is the I2C NAK interrupt. The expected ACK
+                                                                    from the slave was not received by the
+                                                                    IOM.                                                       */
+      __IOM uint32_t WTLEN      : 1;            /*!< (@ 0x00000005) This is the WTLEN interrupt.                               */
+      __IOM uint32_t IACC       : 1;            /*!< (@ 0x00000006) This is the illegal FIFO access interrupt. An
+                                                                    attempt was made to read the FIFO during
+                                                                    a write CMD. Or an attempt was made to
+                                                                    write the FIFO on a read CMD.                              */
+      __IOM uint32_t ICMD       : 1;            /*!< (@ 0x00000007) This is the illegal command interrupt. Software
+                                                                    attempted to issue a CMD while another
+                                                                    CMD was already in progress. Or an attempt
+                                                                    was made to issue a non-zero-length write
+                                                                    CMD with an empty FIFO.                                    */
+      __IOM uint32_t START      : 1;            /*!< (@ 0x00000008) This is the START command interrupt. A START
+                                                                    from another master was detected. Software
+                                                                    must wait for a STOP before proceeding.                    */
+      __IOM uint32_t STOP       : 1;            /*!< (@ 0x00000009) This is the STOP command interrupt. A STOP bit
+                                                                    was detected by the IOM.                                   */
+      __IOM uint32_t ARB        : 1;            /*!< (@ 0x0000000A) This is the arbitration loss interrupt. This
+                                                                    error occurs if another master collides
+                                                                    with an IO Master transfer. Generally,
+                                                                    the IOM started an operation but found
+                                                                    SDA already low.                                           */
+    } INTSET_b;
+  } ;
+} IOMSTR0_Type;                                 /*!< Size = 528 (0x210)                                                        */
+
+
+
+/* =========================================================================================================================== */
+/* ================                                          IOSLAVE                                          ================ */
+/* =========================================================================================================================== */
+
+
+/**
+  * @brief I2C/SPI Slave (IOSLAVE)
+  */
+
+typedef struct {                                /*!< (@ 0x50000000) IOSLAVE Structure                                          */
+  __IM  uint32_t  RESERVED[64];
+  
+  union {
+    __IOM uint32_t FIFOPTR;                     /*!< (@ 0x00000100) Current FIFO Pointer                                       */
+    
+    struct {
+      __IOM uint32_t FIFOPTR    : 8;            /*!< (@ 0x00000000) Current FIFO pointer.                                      */
+      __IOM uint32_t FIFOSIZ    : 8;            /*!< (@ 0x00000008) The number of bytes currently in the hardware
+                                                                    FIFO.                                                      */
+    } FIFOPTR_b;
+  } ;
+  
+  union {
+    __IOM uint32_t FIFOCFG;                     /*!< (@ 0x00000104) FIFO Configuration                                         */
+    
+    struct {
+      __IOM uint32_t FIFOBASE   : 5;            /*!< (@ 0x00000000) These bits hold the base address of the I/O FIFO
+                                                                    in 8 byte segments. The IO Slave FIFO is
+                                                                    situated in LRAM at (FIFOBASE*8) to (FIFOMAX*8-1).         */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t FIFOMAX    : 6;            /*!< (@ 0x00000008) These bits hold the maximum FIFO address in 8
+                                                                    byte segments. It is also the beginning
+                                                                    of the RAM area of the LRAM. Note that
+                                                                    no RAM area is configured if FIFOMAX is
+                                                                    set to 0x1F.                                               */
+      __IM  uint32_t            : 10;
+      __IOM uint32_t ROBASE     : 6;            /*!< (@ 0x00000018) Defines the read-only area. The IO Slave read-only
+                                                                    area is situated in LRAM at (ROBASE*8)
+                                                                    to (FIFOOBASE*8-1)                                         */
+    } FIFOCFG_b;
+  } ;
+  
+  union {
+    __IOM uint32_t FIFOTHR;                     /*!< (@ 0x00000108) FIFO Threshold Configuration                               */
+    
+    struct {
+      __IOM uint32_t FIFOTHR    : 8;            /*!< (@ 0x00000000) FIFO size interrupt threshold.                             */
+    } FIFOTHR_b;
+  } ;
+  
+  union {
+    __IOM uint32_t FUPD;                        /*!< (@ 0x0000010C) FIFO Update Status                                         */
+    
+    struct {
+      __IOM uint32_t FIFOUPD    : 1;            /*!< (@ 0x00000000) This bit indicates that a FIFO update is underway.         */
+      __IOM uint32_t IOREAD     : 1;            /*!< (@ 0x00000001) This bitfield indicates an IO read is active.              */
+    } FUPD_b;
+  } ;
+  
+  union {
+    __IOM uint32_t FIFOCTR;                     /*!< (@ 0x00000110) Overall FIFO Counter                                       */
+    
+    struct {
+      __IOM uint32_t FIFOCTR    : 10;           /*!< (@ 0x00000000) Virtual FIFO byte count                                    */
+    } FIFOCTR_b;
+  } ;
+  
+  union {
+    __IOM uint32_t FIFOINC;                     /*!< (@ 0x00000114) Overall FIFO Counter Increment                             */
+    
+    struct {
+      __IOM uint32_t FIFOINC    : 10;           /*!< (@ 0x00000000) Increment the Overall FIFO Counter by this value
+                                                                    on a write                                                 */
+    } FIFOINC_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CFG;                         /*!< (@ 0x00000118) I/O Slave Configuration                                    */
+    
+    struct {
+      __IOM uint32_t IFCSEL     : 1;            /*!< (@ 0x00000000) This bit selects the I/O interface.                        */
+      __IOM uint32_t SPOL       : 1;            /*!< (@ 0x00000001) This bit selects SPI polarity.                             */
+      __IOM uint32_t LSB        : 1;            /*!< (@ 0x00000002) This bit selects the transfer bit ordering.                */
+      __IM  uint32_t            : 1;
+      __IOM uint32_t STARTRD    : 1;            /*!< (@ 0x00000004) This bit holds the cycle to initiate an I/O RAM
+                                                                    read.                                                      */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t I2CADDR    : 12;           /*!< (@ 0x00000008) 7-bit or 10-bit I2C device address.                        */
+      __IM  uint32_t            : 11;
+      __IOM uint32_t IFCEN      : 1;            /*!< (@ 0x0000001F) IOSLAVE interface enable.                                  */
+    } CFG_b;
+  } ;
+  
+  union {
+    __IOM uint32_t PRENC;                       /*!< (@ 0x0000011C) I/O Slave Interrupt Priority Encode                        */
+    
+    struct {
+      __IOM uint32_t PRENC      : 5;            /*!< (@ 0x00000000) These bits hold the priority encode of the REGACC
+                                                                    interrupts.                                                */
+    } PRENC_b;
+  } ;
+  
+  union {
+    __IOM uint32_t IOINTCTL;                    /*!< (@ 0x00000120) I/O Interrupt Control                                      */
+    
+    struct {
+      __IOM uint32_t IOINTEN    : 8;            /*!< (@ 0x00000000) These read-only bits indicate whether the IOINT
+                                                                    interrupts are enabled.                                    */
+      __IOM uint32_t IOINT      : 8;            /*!< (@ 0x00000008) These bits read the IOINT interrupts.                      */
+      __IOM uint32_t IOINTCLR   : 1;            /*!< (@ 0x00000010) This bit clears all of the IOINT interrupts when
+                                                                    written with a 1.                                          */
+      __IM  uint32_t            : 7;
+      __IOM uint32_t IOINTSET   : 8;            /*!< (@ 0x00000018) These bits set the IOINT interrupts when written
+                                                                    with a 1.                                                  */
+    } IOINTCTL_b;
+  } ;
+  
+  union {
+    __IOM uint32_t GENADD;                      /*!< (@ 0x00000124) General Address Data                                       */
+    
+    struct {
+      __IOM uint32_t GADATA     : 8;            /*!< (@ 0x00000000) The data supplied on the last General Address
+                                                                    reference.                                                 */
+    } GENADD_b;
+  } ;
+  __IM  uint32_t  RESERVED1[54];
+  
+  union {
+    __IOM uint32_t INTEN;                       /*!< (@ 0x00000200) IO Slave Interrupts: Enable                                */
+    
+    struct {
+      __IOM uint32_t FSIZE      : 1;            /*!< (@ 0x00000000) FIFO Size interrupt.                                       */
+      __IOM uint32_t FOVFL      : 1;            /*!< (@ 0x00000001) FIFO Overflow interrupt.                                   */
+      __IOM uint32_t FUNDFL     : 1;            /*!< (@ 0x00000002) FIFO Underflow interrupt.                                  */
+      __IOM uint32_t FRDERR     : 1;            /*!< (@ 0x00000003) FIFO Read Error interrupt.                                 */
+      __IOM uint32_t GENAD      : 1;            /*!< (@ 0x00000004) I2C General Address interrupt.                             */
+      __IOM uint32_t IOINTW     : 1;            /*!< (@ 0x00000005) I2C Interrupt Write interrupt.                             */
+      __IOM uint32_t XCMPRF     : 1;            /*!< (@ 0x00000006) Transfer complete interrupt, read from FIFO space.         */
+      __IOM uint32_t XCMPRR     : 1;            /*!< (@ 0x00000007) Transfer complete interrupt, read from register
+                                                                    space.                                                     */
+      __IOM uint32_t XCMPWF     : 1;            /*!< (@ 0x00000008) Transfer complete interrupt, write to FIFO space.          */
+      __IOM uint32_t XCMPWR     : 1;            /*!< (@ 0x00000009) Transfer complete interrupt, write to register
+                                                                    space.                                                     */
+    } INTEN_b;
+  } ;
+  
+  union {
+    __IOM uint32_t INTSTAT;                     /*!< (@ 0x00000204) IO Slave Interrupts: Status                                */
+    
+    struct {
+      __IOM uint32_t FSIZE      : 1;            /*!< (@ 0x00000000) FIFO Size interrupt.                                       */
+      __IOM uint32_t FOVFL      : 1;            /*!< (@ 0x00000001) FIFO Overflow interrupt.                                   */
+      __IOM uint32_t FUNDFL     : 1;            /*!< (@ 0x00000002) FIFO Underflow interrupt.                                  */
+      __IOM uint32_t FRDERR     : 1;            /*!< (@ 0x00000003) FIFO Read Error interrupt.                                 */
+      __IOM uint32_t GENAD      : 1;            /*!< (@ 0x00000004) I2C General Address interrupt.                             */
+      __IOM uint32_t IOINTW     : 1;            /*!< (@ 0x00000005) I2C Interrupt Write interrupt.                             */
+      __IOM uint32_t XCMPRF     : 1;            /*!< (@ 0x00000006) Transfer complete interrupt, read from FIFO space.         */
+      __IOM uint32_t XCMPRR     : 1;            /*!< (@ 0x00000007) Transfer complete interrupt, read from register
+                                                                    space.                                                     */
+      __IOM uint32_t XCMPWF     : 1;            /*!< (@ 0x00000008) Transfer complete interrupt, write to FIFO space.          */
+      __IOM uint32_t XCMPWR     : 1;            /*!< (@ 0x00000009) Transfer complete interrupt, write to register
+                                                                    space.                                                     */
+    } INTSTAT_b;
+  } ;
+  
+  union {
+    __IOM uint32_t INTCLR;                      /*!< (@ 0x00000208) IO Slave Interrupts: Clear                                 */
+    
+    struct {
+      __IOM uint32_t FSIZE      : 1;            /*!< (@ 0x00000000) FIFO Size interrupt.                                       */
+      __IOM uint32_t FOVFL      : 1;            /*!< (@ 0x00000001) FIFO Overflow interrupt.                                   */
+      __IOM uint32_t FUNDFL     : 1;            /*!< (@ 0x00000002) FIFO Underflow interrupt.                                  */
+      __IOM uint32_t FRDERR     : 1;            /*!< (@ 0x00000003) FIFO Read Error interrupt.                                 */
+      __IOM uint32_t GENAD      : 1;            /*!< (@ 0x00000004) I2C General Address interrupt.                             */
+      __IOM uint32_t IOINTW     : 1;            /*!< (@ 0x00000005) I2C Interrupt Write interrupt.                             */
+      __IOM uint32_t XCMPRF     : 1;            /*!< (@ 0x00000006) Transfer complete interrupt, read from FIFO space.         */
+      __IOM uint32_t XCMPRR     : 1;            /*!< (@ 0x00000007) Transfer complete interrupt, read from register
+                                                                    space.                                                     */
+      __IOM uint32_t XCMPWF     : 1;            /*!< (@ 0x00000008) Transfer complete interrupt, write to FIFO space.          */
+      __IOM uint32_t XCMPWR     : 1;            /*!< (@ 0x00000009) Transfer complete interrupt, write to register
+                                                                    space.                                                     */
+    } INTCLR_b;
+  } ;
+  
+  union {
+    __IOM uint32_t INTSET;                      /*!< (@ 0x0000020C) IO Slave Interrupts: Set                                   */
+    
+    struct {
+      __IOM uint32_t FSIZE      : 1;            /*!< (@ 0x00000000) FIFO Size interrupt.                                       */
+      __IOM uint32_t FOVFL      : 1;            /*!< (@ 0x00000001) FIFO Overflow interrupt.                                   */
+      __IOM uint32_t FUNDFL     : 1;            /*!< (@ 0x00000002) FIFO Underflow interrupt.                                  */
+      __IOM uint32_t FRDERR     : 1;            /*!< (@ 0x00000003) FIFO Read Error interrupt.                                 */
+      __IOM uint32_t GENAD      : 1;            /*!< (@ 0x00000004) I2C General Address interrupt.                             */
+      __IOM uint32_t IOINTW     : 1;            /*!< (@ 0x00000005) I2C Interrupt Write interrupt.                             */
+      __IOM uint32_t XCMPRF     : 1;            /*!< (@ 0x00000006) Transfer complete interrupt, read from FIFO space.         */
+      __IOM uint32_t XCMPRR     : 1;            /*!< (@ 0x00000007) Transfer complete interrupt, read from register
+                                                                    space.                                                     */
+      __IOM uint32_t XCMPWF     : 1;            /*!< (@ 0x00000008) Transfer complete interrupt, write to FIFO space.          */
+      __IOM uint32_t XCMPWR     : 1;            /*!< (@ 0x00000009) Transfer complete interrupt, write to register
+                                                                    space.                                                     */
+    } INTSET_b;
+  } ;
+  
+  union {
+    __IOM uint32_t REGACCINTEN;                 /*!< (@ 0x00000210) Register Access Interrupts: Enable                         */
+    
+    struct {
+      __IOM uint32_t REGACC     : 32;           /*!< (@ 0x00000000) Register access interrupts.                                */
+    } REGACCINTEN_b;
+  } ;
+  
+  union {
+    __IOM uint32_t REGACCINTSTAT;               /*!< (@ 0x00000214) Register Access Interrupts: Status                         */
+    
+    struct {
+      __IOM uint32_t REGACC     : 32;           /*!< (@ 0x00000000) Register access interrupts.                                */
+    } REGACCINTSTAT_b;
+  } ;
+  
+  union {
+    __IOM uint32_t REGACCINTCLR;                /*!< (@ 0x00000218) Register Access Interrupts: Clear                          */
+    
+    struct {
+      __IOM uint32_t REGACC     : 32;           /*!< (@ 0x00000000) Register access interrupts.                                */
+    } REGACCINTCLR_b;
+  } ;
+  
+  union {
+    __IOM uint32_t REGACCINTSET;                /*!< (@ 0x0000021C) Register Access Interrupts: Set                            */
+    
+    struct {
+      __IOM uint32_t REGACC     : 32;           /*!< (@ 0x00000000) Register access interrupts.                                */
+    } REGACCINTSET_b;
+  } ;
+} IOSLAVE_Type;                                 /*!< Size = 544 (0x220)                                                        */
+
+
+
+/* =========================================================================================================================== */
+/* ================                                          MCUCTRL                                          ================ */
+/* =========================================================================================================================== */
+
+
+/**
+  * @brief MCU Miscellaneous Control Logic (MCUCTRL)
+  */
+
+typedef struct {                                /*!< (@ 0x40020000) MCUCTRL Structure                                          */
+  
+  union {
+    __IOM uint32_t CHIP_INFO;                   /*!< (@ 0x00000000) Chip Information Register                                  */
+    
+    struct {
+      __IOM uint32_t PARTNUM    : 32;           /*!< (@ 0x00000000) BCD part number.                                           */
+    } CHIP_INFO_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CHIPID0;                     /*!< (@ 0x00000004) Unique Chip ID 0                                           */
+    
+    struct {
+      __IOM uint32_t VALUE      : 32;           /*!< (@ 0x00000000) Unique chip ID 0.                                          */
+    } CHIPID0_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CHIPID1;                     /*!< (@ 0x00000008) Unique Chip ID 1                                           */
+    
+    struct {
+      __IOM uint32_t VALUE      : 32;           /*!< (@ 0x00000000) Unique chip ID 1.                                          */
+    } CHIPID1_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CHIPREV;                     /*!< (@ 0x0000000C) Chip Revision                                              */
+    
+    struct {
+      __IOM uint32_t REVMIN     : 4;            /*!< (@ 0x00000000) Minor Revision ID.                                         */
+      __IOM uint32_t REVMAJ     : 4;            /*!< (@ 0x00000004) Major Revision ID.                                         */
+    } CHIPREV_b;
+  } ;
+  
+  union {
+    __IOM uint32_t VENDORID;                    /*!< (@ 0x00000010) Unique Vendor ID                                           */
+    
+    struct {
+      __IOM uint32_t VALUE      : 32;           /*!< (@ 0x00000000) Unique Vendor ID                                           */
+    } VENDORID_b;
+  } ;
+  
+  union {
+    __IOM uint32_t DEBUGGER;                    /*!< (@ 0x00000014) Debugger Access Control                                    */
+    
+    struct {
+      __IOM uint32_t LOCKOUT    : 1;            /*!< (@ 0x00000000) Lockout of debugger (SWD).                                 */
+    } DEBUGGER_b;
+  } ;
+  __IM  uint32_t  RESERVED[18];
+  
+  union {
+    __IOM uint32_t BUCK;                        /*!< (@ 0x00000060) Analog Buck Control                                        */
+    
+    struct {
+      __IOM uint32_t BUCKSWE    : 1;            /*!< (@ 0x00000000) Buck Register Software Override Enable. This
+                                                                    will enable the override values for MEMBUCKPWD,
+                                                                    COREBUCKPWD, COREBUCKRST, MEMBUCKRST, all
+                                                                    to be propagated to the control logic,
+                                                                    instead of the normal power control module
+                                                                    signal. Note - Must take care to have correct
+                                                                    value for ALL the register bits when this
+                                                                    SWE is enabled.                                            */
+      __IOM uint32_t BYPBUCKCORE : 1;           /*!< (@ 0x00000001) Not used. Additional control of buck is available
+                                                                    in the power control module                                */
+      __IOM uint32_t COREBUCKPWD : 1;           /*!< (@ 0x00000002) Core buck power down override. 1=Powered Down;
+                                                                    0=Enabled; Value is propagated only when
+                                                                    the BUCKSWE bit is active, otherwise control
+                                                                    is from the power control module.                          */
+      __IOM uint32_t SLEEPBUCKANA : 1;          /*!< (@ 0x00000003) HFRC clkgen bit 0 override. When set, this will
+                                                                    override to 0 bit 0 of the hfrc_freq_clkgen
+                                                                    internal bus (see internal Shelby-1473)                    */
+      __IOM uint32_t MEMBUCKPWD : 1;            /*!< (@ 0x00000004) Memory buck power down override. 1=Powered Down;
+                                                                    0=Enabled; Value is propagated only when
+                                                                    the BUCKSWE bit is active, otherwise control
+                                                                    is from the power control module.                          */
+      __IOM uint32_t BYPBUCKMEM : 1;            /*!< (@ 0x00000005) Not used. Additional control of buck is available
+                                                                    in the power control module                                */
+      __IOM uint32_t COREBUCKRST : 1;           /*!< (@ 0x00000006) Reset control override for Core Buck; 0=enabled,
+                                                                    1=reset; Value is propagated only when
+                                                                    the BUCKSWE bit is active, otherwise control
+                                                                    is from the power control module.                          */
+      __IOM uint32_t MEMBUCKRST : 1;            /*!< (@ 0x00000007) Reset control override for Mem Buck; 0=enabled,
+                                                                    1=reset; Value is propagated only when
+                                                                    the BUCKSWE bit is active, otherwise contrl
+                                                                    is from the power control module.                          */
+    } BUCK_b;
+  } ;
+  
+  union {
+    __IOM uint32_t BUCK2;                       /*!< (@ 0x00000064) Buck Control Reg2                                          */
+    
+    struct {
+      __IOM uint32_t BCORETONSEL : 4;           /*!< (@ 0x00000000) Core Buck low turn on trim                                 */
+      __IOM uint32_t BMEMTONSEL : 4;            /*!< (@ 0x00000004) Flash Buck high turn on trim                               */
+      __IOM uint32_t HYSTBUCKMEM : 1;           /*!< (@ 0x00000008) Enable/disable hysteresis on memory buck converters
+                                                                    internal comparators.                                      */
+      __IOM uint32_t HYSTBUCKCORE : 1;          /*!< (@ 0x00000009) Enable/disable hysteresis on core buck converters
+                                                                    internal comparators.                                      */
+      __IOM uint32_t BUCKLFCLKSEL : 2;          /*!< (@ 0x0000000A) Buck clkgen divider trim. 00 = 1.5MHz; 01 = 750kHz;
+                                                                    10 = 375kHz; 11 = 187.5kHz                                 */
+    } BUCK2_b;
+  } ;
+  
+  union {
+    __IOM uint32_t BUCK3;                       /*!< (@ 0x00000068) Buck control reg 3                                         */
+    
+    struct {
+      __IOM uint32_t COREBUCKHYSTTRIM : 2;      /*!< (@ 0x00000000) Hysterisis trim for core buck                              */
+      __IOM uint32_t COREBUCKZXTRIM : 4;        /*!< (@ 0x00000002) Core buck zero crossing trim value                         */
+      __IOM uint32_t COREBUCKBURSTEN : 1;       /*!< (@ 0x00000006) Core Buck burst enable. 0=disabled, 1=enabled              */
+      __IOM uint32_t COREBUCKLOTON : 4;         /*!< (@ 0x00000007) Core Buck low TON trim value                               */
+      __IOM uint32_t MEMBUCKHYSTTRIM : 2;       /*!< (@ 0x0000000B) Hysterisis trim for mem buck                               */
+      __IOM uint32_t MEMBUCKZXTRIM : 4;         /*!< (@ 0x0000000D) Memory buck zero crossing trim value                       */
+      __IOM uint32_t MEMBUCKBURSTEN : 1;        /*!< (@ 0x00000011) MEM Buck burst enable 0=disable, 0=disabled,
+                                                                    1=enable.                                                  */
+      __IOM uint32_t MEMBUCKLOTON : 4;          /*!< (@ 0x00000012) MEM Buck low TON trim value                                */
+    } BUCK3_b;
+  } ;
+  __IM  uint32_t  RESERVED1[5];
+  
+  union {
+    __IOM uint32_t LDOREG1;                     /*!< (@ 0x00000080) Analog LDO Reg 1                                           */
+    
+    struct {
+      __IOM uint32_t TRIMCORELDOR1 : 10;        /*!< (@ 0x00000000) CORE LDO Active mode ouput trim (R1).                      */
+      __IOM uint32_t TRIMCORELDOR3 : 4;         /*!< (@ 0x0000000A) CORE LDO tempco trim (R3).                                 */
+      __IOM uint32_t CORELDOLPTRIM : 6;         /*!< (@ 0x0000000E) CORE LDO Low Power Trim                                    */
+      __IOM uint32_t CORELDOIBSTRM : 1;         /*!< (@ 0x00000014) CORE LDO IBIAS Trim                                        */
+    } LDOREG1_b;
+  } ;
+  
+  union {
+    __IOM uint32_t LDOREG2;                     /*!< (@ 0x00000084) LDO Control Register 2                                     */
+    
+    struct {
+      __IOM uint32_t LDO2SWE    : 1;            /*!< (@ 0x00000000) LDO2 Software Override Enable. If enabled (=1),
+                                                                    this will enable the override values from
+                                                                    this register to be used instead of the
+                                                                    normal control signals for the following
+                                                                    fields: CORELDOVDDLEN, RAMLDOLPMODE, PWDRAMLDO,
+                                                                    PWDANALDO, PWDMEMLDO, PWDCORELDO, SLEEPANALDO,
+                                                                    SLEEPMEMLDO, SLEEPCORELDO.                                 */
+      __IOM uint32_t RAMLDOTRIM : 5;            /*!< (@ 0x00000001) RAM LDO TRIM                                               */
+      __IOM uint32_t TRIMANALDO : 4;            /*!< (@ 0x00000006) Analog LDO Trim.                                           */
+      __IOM uint32_t VREFSELCORELDO : 1;        /*!< (@ 0x0000000A) CONTROL BIT IS NOT USED. PLEASE TREAT AS RESERVED          */
+      __IOM uint32_t VREFSELFLASHLDO : 1;       /*!< (@ 0x0000000B) CONTROL BIT IS NOT USED. PLEASE TREAT AS RESERVED          */
+      __IOM uint32_t VREFSELSRAMLDO : 1;        /*!< (@ 0x0000000C) CONTROL BIT IS NOT USED. PLEASE TREAT AS RESERVED          */
+      __IOM uint32_t VREFSELANALDO : 1;         /*!< (@ 0x0000000D) CONTROL BIT IS NOT USED. PLEASE TREAT AS RESERVED          */
+      __IOM uint32_t SLEEPCORELDO : 1;          /*!< (@ 0x0000000E) CORE LDO Sleep. This value is propagated only
+                                                                    when LDO2SWE bit is active(1).                             */
+      __IOM uint32_t SLEEPMEMLDO : 1;           /*!< (@ 0x0000000F) FLASH LDO Sleep. This value is propagated only
+                                                                    when LDO2SWE bit is active(1).                             */
+      __IOM uint32_t SLEEPANALDO : 1;           /*!< (@ 0x00000010) Analog LDO Sleep. This value is propagated only
+                                                                    when LDO2SWE bit is active(1).                             */
+      __IOM uint32_t PWDCORELDO : 1;            /*!< (@ 0x00000011) CORE LDO Power Down. This value is propagated
+                                                                    only when LDO2SWE bit is active(1).                        */
+      __IOM uint32_t PWDMEMLDO  : 1;            /*!< (@ 0x00000012) MEM LDO Power Down. This value is propagated
+                                                                    only when LDO2SWE bit is active(1).                        */
+      __IOM uint32_t PWDANALDO  : 1;            /*!< (@ 0x00000013) Analog LDO Power Down. This value is propagated
+                                                                    only when LDO2SWE bit is active(1).                        */
+      __IOM uint32_t PWDRAMLDO  : 1;            /*!< (@ 0x00000014) RAM LDO Power Down. 0=powered up, 1=powered down
+                                                                    ; This value is propagated only when LDO2SWE
+                                                                    bit is active(1).                                          */
+      __IOM uint32_t RAMLDOLPMODE : 1;          /*!< (@ 0x00000015) RAM LDO LP Mode. 0=normal mode, 1=low power mode;
+                                                                    This value is propagated only when LDO2SWE
+                                                                    bit is active(1).                                          */
+      __IOM uint32_t CORELDOVDDLEN : 1;         /*!< (@ 0x00000016) Core LDO output enable. 0=Hi-Z, 1=enable. This
+                                                                    value is propagated only when LDO2SWE bit
+                                                                    is active(1).                                              */
+    } LDOREG2_b;
+  } ;
+  
+  union {
+    __IOM uint32_t LDOREG3;                     /*!< (@ 0x00000088) LDO Control Register 3                                     */
+    
+    struct {
+      __IOM uint32_t MEMLDOLPTRIM : 6;          /*!< (@ 0x00000000) MEM LDO TRIM for low power mode with ADC inactive          */
+      __IOM uint32_t MEMLDOLPALTTRIM : 6;       /*!< (@ 0x00000006) MEM LDO TRIM for low power mode with ADC active            */
+      __IOM uint32_t TRIMMEMLDOR1 : 6;          /*!< (@ 0x0000000C) MEM LDO active mode trim (R1).                             */
+    } LDOREG3_b;
+  } ;
+  __IM  uint32_t  RESERVED2[29];
+  
+  union {
+    __IOM uint32_t BODPORCTRL;                  /*!< (@ 0x00000100) BOD and PDR control Register                               */
+    
+    struct {
+      __IOM uint32_t PWDPDR     : 1;            /*!< (@ 0x00000000) PDR Power Down.                                            */
+      __IOM uint32_t PWDBOD     : 1;            /*!< (@ 0x00000001) BOD Power Down.                                            */
+      __IOM uint32_t PDREXTREFSEL : 1;          /*!< (@ 0x00000002) PDR External Reference Select.                             */
+      __IOM uint32_t BODEXTREFSEL : 1;          /*!< (@ 0x00000003) BOD External Reference Select.                             */
+    } BODPORCTRL_b;
+  } ;
+  
+  union {
+    __IOM uint32_t ADCPWRDLY;                   /*!< (@ 0x00000104) ADC Power Up Delay Control                                 */
+    
+    struct {
+      __IOM uint32_t ADCPWR0    : 8;            /*!< (@ 0x00000000) ADC Reference Buffer Power Enable delay in 64
+                                                                    ADC CLK increments for ADC_CLKSEL = 0x1,
+                                                                    32 ADC CLOCK increments for ADC_CLKSEL
+                                                                    = 0x2.                                                     */
+      __IOM uint32_t ADCPWR1    : 8;            /*!< (@ 0x00000008) ADC Reference Keeper enable delay in 16 ADC CLK
+                                                                    increments for ADC_CLKSEL = 0x1, 8 ADC
+                                                                    CLOCK increments for ADC_CLKSEL = 0x2.                     */
+    } ADCPWRDLY_b;
+  } ;
+  __IM  uint32_t  RESERVED3;
+  
+  union {
+    __IOM uint32_t ADCCAL;                      /*!< (@ 0x0000010C) ADC Calibration Control                                    */
+    
+    struct {
+      __IOM uint32_t CALONPWRUP : 1;            /*!< (@ 0x00000000) Run ADC Calibration on initial power up sequence           */
+      __IOM uint32_t ADCCALIBRATED : 1;         /*!< (@ 0x00000001) Status for ADC Calibration                                 */
+    } ADCCAL_b;
+  } ;
+  
+  union {
+    __IOM uint32_t ADCBATTLOAD;                 /*!< (@ 0x00000110) ADC Battery Load Enable                                    */
+    
+    struct {
+      __IOM uint32_t BATTLOAD   : 1;            /*!< (@ 0x00000000) Enable the ADC battery load resistor                       */
+    } ADCBATTLOAD_b;
+  } ;
+  
+  union {
+    __IOM uint32_t BUCKTRIM;                    /*!< (@ 0x00000114) Trim settings for Core and Mem buck modules                */
+    
+    struct {
+      __IOM uint32_t MEMBUCKR1  : 6;            /*!< (@ 0x00000000) Trim values for BUCK regulator.                            */
+      __IM  uint32_t            : 2;
+      __IOM uint32_t COREBUCKR1_LO : 6;         /*!< (@ 0x00000008) Core Buck voltage output trim bits[5:0], Concatenate
+                                                                    with field COREBUCKR1_HI for the full trim
+                                                                    value.                                                     */
+      __IM  uint32_t            : 2;
+      __IOM uint32_t COREBUCKR1_HI : 4;         /*!< (@ 0x00000010) Core Buck voltage output trim bits[9:6]. Concatenate
+                                                                    with field COREBUCKR1_LO for the full trim
+                                                                    value.                                                     */
+      __IM  uint32_t            : 4;
+      __IOM uint32_t RSVD2      : 6;            /*!< (@ 0x00000018) RESERVED.                                                  */
+    } BUCKTRIM_b;
+  } ;
+  
+  union {
+    __IOM uint32_t ADCTRIM;                     /*!< (@ 0x00000118) ADC Trims                                                  */
+    
+    struct {
+      __IOM uint32_t ADCREFKEEPIBTRIM : 2;      /*!< (@ 0x00000000) ADC Reference Ibias trim                                   */
+      __IM  uint32_t            : 4;
+      __IOM uint32_t ADCREFBUFTRIM : 5;         /*!< (@ 0x00000006) ADC Reference buffer trim                                  */
+      __IOM uint32_t ADCRFBUFIBTRIM : 2;        /*!< (@ 0x0000000B) ADC reference buffer input bias trim                       */
+    } ADCTRIM_b;
+  } ;
+  
+  union {
+    __IOM uint32_t ADCREFCOMP;                  /*!< (@ 0x0000011C) ADC Reference Keeper and Comparator Control                */
+    
+    struct {
+      __IOM uint32_t ADC_REFCOMP_OUT : 1;       /*!< (@ 0x00000000) Output of the ADC reference comparator                     */
+      __IM  uint32_t            : 7;
+      __IOM uint32_t ADCREFKEEPTRIM : 5;        /*!< (@ 0x00000008) ADC Reference Keeper Trim                                  */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t ADCRFCMPEN : 1;            /*!< (@ 0x00000010) ADC Reference comparator power down                        */
+    } ADCREFCOMP_b;
+  } ;
+  __IM  uint32_t  RESERVED4;
+  
+  union {
+    __IOM uint32_t XTALGENCTRL;                 /*!< (@ 0x00000124) XTAL Oscillator General Control                            */
+    
+    struct {
+      __IOM uint32_t ACWARMUP   : 2;            /*!< (@ 0x00000000) Auto-calibration delay control                             */
+      __IOM uint32_t XTALBIASTRIM : 6;          /*!< (@ 0x00000002) XTAL IBIAS trim                                            */
+      __IOM uint32_t XTALKSBIASTRIM : 6;        /*!< (@ 0x00000008) XTAL IBIAS Kick start trim . This trim value
+                                                                    is used during the startup process to enable
+                                                                    a faster lock and is applied when the kickstart
+                                                                    signal is active.                                          */
+    } XTALGENCTRL_b;
+  } ;
+  __IM  uint32_t  RESERVED5[14];
+  
+  union {
+    __IOM uint32_t EXTCLKSEL;                   /*!< (@ 0x00000160) Source selection of LFRC, HFRC and XTAL clock
+                                                                    sources                                                    */
+    
+    struct {
+      __IOM uint32_t EXT_XT     : 1;            /*!< (@ 0x00000000) XTAL External Clock Source Select.                         */
+      __IOM uint32_t EXT_LF     : 1;            /*!< (@ 0x00000001) LFRC External Clock Source Select.                         */
+      __IOM uint32_t EXT_HF     : 1;            /*!< (@ 0x00000002) HFRC External Clock Source Select.                         */
+    } EXTCLKSEL_b;
+  } ;
+  __IM  uint32_t  RESERVED6[15];
+  
+  union {
+    __IOM uint32_t BOOTLOADERLOW;               /*!< (@ 0x000001A0) Determines whether the bootloader code is visible
+                                                                    at address 0x00000000                                      */
+    
+    struct {
+      __IOM uint32_t VALUE      : 1;            /*!< (@ 0x00000000) Determines whether the bootloader code is visible
+                                                                    at address 0x00000000 or not.                              */
+    } BOOTLOADERLOW_b;
+  } ;
+  
+  union {
+    __IOM uint32_t SHADOWVALID;                 /*!< (@ 0x000001A4) Register to indicate whether the shadow registers
+                                                                    have been successfully loaded from the
+                                                                    Flash Information Space.                                   */
+    
+    struct {
+      __IOM uint32_t VALID      : 1;            /*!< (@ 0x00000000) Indicates whether the shadow registers contain
+                                                                    valid data from the Flash Information Space.               */
+      __IOM uint32_t BL_DSLEEP  : 1;            /*!< (@ 0x00000001) Indicates whether the bootloader should sleep
+                                                                    or deep sleep if no image loaded.                          */
+    } SHADOWVALID_b;
+  } ;
+  __IM  uint32_t  RESERVED7[6];
+  
+  union {
+    __IOM uint32_t ICODEFAULTADDR;              /*!< (@ 0x000001C0) ICODE bus address which was present when a bus
+                                                                    fault occurred.                                            */
+    
+    struct {
+      __IOM uint32_t ADDR       : 32;           /*!< (@ 0x00000000) The ICODE bus address observed when a Bus Fault
+                                                                    occurred. Once an address is captured in
+                                                                    this field, it is held until the corresponding
+                                                                    Fault Observed bit is cleared in the FAULTSTATUS
+                                                                    register.                                                  */
+    } ICODEFAULTADDR_b;
+  } ;
+  
+  union {
+    __IOM uint32_t DCODEFAULTADDR;              /*!< (@ 0x000001C4) DCODE bus address which was present when a bus
+                                                                    fault occurred.                                            */
+    
+    struct {
+      __IOM uint32_t ADDR       : 32;           /*!< (@ 0x00000000) The DCODE bus address observed when a Bus Fault
+                                                                    occurred. Once an address is captured in
+                                                                    this field, it is held until the corresponding
+                                                                    Fault Observed bit is cleared in the FAULTSTATUS
+                                                                    register.                                                  */
+    } DCODEFAULTADDR_b;
+  } ;
+  
+  union {
+    __IOM uint32_t SYSFAULTADDR;                /*!< (@ 0x000001C8) System bus address which was present when a bus
+                                                                    fault occurred.                                            */
+    
+    struct {
+      __IOM uint32_t ADDR       : 32;           /*!< (@ 0x00000000) SYS bus address observed when a Bus Fault occurred.
+                                                                    Once an address is captured in this field,
+                                                                    it is held until the corresponding Fault
+                                                                    Observed bit is cleared in the FAULTSTATUS
+                                                                    register.                                                  */
+    } SYSFAULTADDR_b;
+  } ;
+  
+  union {
+    __IOM uint32_t FAULTSTATUS;                 /*!< (@ 0x000001CC) Reflects the status of the bus decoders' fault
+                                                                    detection. Any write to this register will
+                                                                    clear all of the status bits within the
+                                                                    register.                                                  */
+    
+    struct {
+      __IOM uint32_t ICODE      : 1;            /*!< (@ 0x00000000) The ICODE Bus Decoder Fault Detected bit. When
+                                                                    set, a fault has been detected, and the
+                                                                    ICODEFAULTADDR register will contain the
+                                                                    bus address which generated the fault.                     */
+      __IOM uint32_t DCODE      : 1;            /*!< (@ 0x00000001) DCODE Bus Decoder Fault Detected bit. When set,
+                                                                    a fault has been detected, and the DCODEFAULTADDR
+                                                                    register will contain the bus address which
+                                                                    generated the fault.                                       */
+      __IOM uint32_t SYS        : 1;            /*!< (@ 0x00000002) SYS Bus Decoder Fault Detected bit. When set,
+                                                                    a fault has been detected, and the SYSFAULTADDR
+                                                                    register will contain the bus address which
+                                                                    generated the fault.                                       */
+    } FAULTSTATUS_b;
+  } ;
+  
+  union {
+    __IOM uint32_t FAULTCAPTUREEN;              /*!< (@ 0x000001D0) Enable the fault capture registers                         */
+    
+    struct {
+      __IOM uint32_t ENABLE     : 1;            /*!< (@ 0x00000000) Fault Capture Enable field. When set, the Fault
+                                                                    Capture monitors are enabled and addresses
+                                                                    which generate a hard fault are captured
+                                                                    into the FAULTADDR registers.                              */
+    } FAULTCAPTUREEN_b;
+  } ;
+  __IM  uint32_t  RESERVED8[11];
+  
+  union {
+    __IOM uint32_t DBGR1;                       /*!< (@ 0x00000200) Read-only debug register 1                                 */
+    
+    struct {
+      __IOM uint32_t ONETO8     : 32;           /*!< (@ 0x00000000) Read-only register for communication validation            */
+    } DBGR1_b;
+  } ;
+  
+  union {
+    __IOM uint32_t DBGR2;                       /*!< (@ 0x00000204) Read-only debug register 2                                 */
+    
+    struct {
+      __IOM uint32_t COOLCODE   : 32;           /*!< (@ 0x00000000) Read-only register for communication validation            */
+    } DBGR2_b;
+  } ;
+  __IM  uint32_t  RESERVED9[6];
+  
+  union {
+    __IOM uint32_t PMUENABLE;                   /*!< (@ 0x00000220) Control bit to enable/disable the PMU                      */
+    
+    struct {
+      __IOM uint32_t ENABLE     : 1;            /*!< (@ 0x00000000) PMU Enable Control bit. When set, the MCU's PMU
+                                                                    will place the MCU into the lowest power
+                                                                    consuming Deep Sleep mode upon execution
+                                                                    of a WFI instruction (dependent on the
+                                                                    setting of the SLEEPDEEP bit in the ARM
+                                                                    SCR register). When cleared, regardless
+                                                                    of the requested sleep mode, the PMU will
+                                                                    not enter the lowest power Deep Sleep mode,
+                                                                    instead entering the Sleep mode.                           */
+    } PMUENABLE_b;
+  } ;
+  __IM  uint32_t  RESERVED10[11];
+  
+  union {
+    __IOM uint32_t TPIUCTRL;                    /*!< (@ 0x00000250) TPIU Control Register. Determines the clock enable
+                                                                    and frequency for the M4's TPIU interface.                 */
+    
+    struct {
+      __IOM uint32_t ENABLE     : 1;            /*!< (@ 0x00000000) TPIU Enable field. When set, the ARM M4 TPIU
+                                                                    is enabled and data can be streamed out
+                                                                    of the MCU's SWO port using the ARM ITM
+                                                                    and TPIU modules.                                          */
+      __IM  uint32_t            : 7;
+      __IOM uint32_t CLKSEL     : 3;            /*!< (@ 0x00000008) This field selects the frequency of the ARM M4
+                                                                    TPIU port.                                                 */
+    } TPIUCTRL_b;
+  } ;
+  __IM  uint32_t  RESERVED11[61];
+  
+  union {
+    __IOM uint32_t KEXTCLKSEL;                  /*!< (@ 0x00000348) Key Register to enable the use of external clock
+                                                                    selects via the EXTCLKSEL reg                              */
+    
+    struct {
+      __IOM uint32_t KEXTCLKSEL : 32;           /*!< (@ 0x00000000) Key register value.                                        */
+    } KEXTCLKSEL_b;
+  } ;
+} MCUCTRL_Type;                                 /*!< Size = 844 (0x34c)                                                        */
+
+
+
+/* =========================================================================================================================== */
+/* ================                                            PDM                                            ================ */
+/* =========================================================================================================================== */
+
+
+/**
+  * @brief PDM Audio (PDM)
+  */
+
+typedef struct {                                /*!< (@ 0x50011000) PDM Structure                                              */
+  
+  union {
+    __IOM uint32_t PCFG;                        /*!< (@ 0x00000000) PDM Configuration Register                                 */
+    
+    struct {
+      __IOM uint32_t PDMCORE    : 1;            /*!< (@ 0x00000000) Data Streaming Control.                                    */
+      __IOM uint32_t SOFTMUTE   : 1;            /*!< (@ 0x00000001) Soft mute control.                                         */
+      __IOM uint32_t CYCLES     : 3;            /*!< (@ 0x00000002) Number of clocks during gain-setting changes.              */
+      __IOM uint32_t HPCUTOFF   : 4;            /*!< (@ 0x00000005) High pass filter coefficients.                             */
+      __IOM uint32_t ADCHPD     : 1;            /*!< (@ 0x00000009) High pass filter control.                                  */
+      __IOM uint32_t SINCRATE   : 7;            /*!< (@ 0x0000000A) SINC decimation rate.                                      */
+      __IOM uint32_t MCLKDIV    : 2;            /*!< (@ 0x00000011) PDM_CLK frequency divisor.                                 */
+      __IM  uint32_t            : 4;
+      __IOM uint32_t PGALEFT    : 4;            /*!< (@ 0x00000017) Left channel PGA gain.                                     */
+      __IOM uint32_t PGARIGHT   : 4;            /*!< (@ 0x0000001B) Right channel PGA gain.                                    */
+      __IOM uint32_t LRSWAP     : 1;            /*!< (@ 0x0000001F) Left/right channel swap.                                   */
+    } PCFG_b;
+  } ;
+  
+  union {
+    __IOM uint32_t VCFG;                        /*!< (@ 0x00000004) Voice Configuration Register                               */
+    
+    struct {
+      __IM  uint32_t            : 3;
+      __IOM uint32_t CHSET      : 2;            /*!< (@ 0x00000003) Set PCM channels.                                          */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t PCMPACK    : 1;            /*!< (@ 0x00000008) PCM data packing enable.                                   */
+      __IM  uint32_t            : 7;
+      __IOM uint32_t SELAP      : 1;            /*!< (@ 0x00000010) Select PDM input clock source.                             */
+      __IOM uint32_t DMICKDEL   : 1;            /*!< (@ 0x00000011) PDM clock sampling delay.                                  */
+      __IM  uint32_t            : 1;
+      __IOM uint32_t BCLKINV    : 1;            /*!< (@ 0x00000013) I2S BCLK input inversion.                                  */
+      __IOM uint32_t I2SMODE    : 1;            /*!< (@ 0x00000014) I2S interface enable.                                      */
+      __IM  uint32_t            : 5;
+      __IOM uint32_t PDMCLK     : 1;            /*!< (@ 0x0000001A) Enable the serial clock.                                   */
+      __IOM uint32_t PDMCLKSEL  : 3;            /*!< (@ 0x0000001B) Select the PDM input clock.                                */
+      __IOM uint32_t RSTB       : 1;            /*!< (@ 0x0000001E) Reset the IP core.                                         */
+      __IOM uint32_t IOCLKEN    : 1;            /*!< (@ 0x0000001F) Enable the IO clock.                                       */
+    } VCFG_b;
+  } ;
+  
+  union {
+    __IOM uint32_t FR;                          /*!< (@ 0x00000008) Voice Status Register                                      */
+    
+    struct {
+      __IOM uint32_t FIFOCNT    : 9;            /*!< (@ 0x00000000) Valid 32-bit entries currently in the FIFO.                */
+    } FR_b;
+  } ;
+  
+  union {
+    __IOM uint32_t FRD;                         /*!< (@ 0x0000000C) FIFO Read                                                  */
+    
+    struct {
+      __IOM uint32_t FIFOREAD   : 32;           /*!< (@ 0x00000000) FIFO read data.                                            */
+    } FRD_b;
+  } ;
+  
+  union {
+    __IOM uint32_t FLUSH;                       /*!< (@ 0x00000010) FIFO Flush                                                 */
+    
+    struct {
+      __IOM uint32_t FIFOFLUSH  : 1;            /*!< (@ 0x00000000) FIFO FLUSH.                                                */
+    } FLUSH_b;
+  } ;
+  
+  union {
+    __IOM uint32_t FTHR;                        /*!< (@ 0x00000014) FIFO Threshold                                             */
+    
+    struct {
+      __IOM uint32_t FIFOTHR    : 8;            /*!< (@ 0x00000000) FIFO interrupt threshold.                                  */
+    } FTHR_b;
+  } ;
+  __IM  uint32_t  RESERVED[122];
+  
+  union {
+    __IOM uint32_t INTEN;                       /*!< (@ 0x00000200) IO Master Interrupts: Enable                               */
+    
+    struct {
+      __IOM uint32_t THR        : 1;            /*!< (@ 0x00000000) This is the FIFO threshold interrupt.                      */
+      __IOM uint32_t OVF        : 1;            /*!< (@ 0x00000001) This is the FIFO overflow interrupt.                       */
+      __IOM uint32_t UNDFL      : 1;            /*!< (@ 0x00000002) This is the FIFO underflow interrupt.                      */
+    } INTEN_b;
+  } ;
+  
+  union {
+    __IOM uint32_t INTSTAT;                     /*!< (@ 0x00000204) IO Master Interrupts: Status                               */
+    
+    struct {
+      __IOM uint32_t THR        : 1;            /*!< (@ 0x00000000) This is the FIFO threshold interrupt.                      */
+      __IOM uint32_t OVF        : 1;            /*!< (@ 0x00000001) This is the FIFO overflow interrupt.                       */
+      __IOM uint32_t UNDFL      : 1;            /*!< (@ 0x00000002) This is the FIFO underflow interrupt.                      */
+    } INTSTAT_b;
+  } ;
+  
+  union {
+    __IOM uint32_t INTCLR;                      /*!< (@ 0x00000208) IO Master Interrupts: Clear                                */
+    
+    struct {
+      __IOM uint32_t THR        : 1;            /*!< (@ 0x00000000) This is the FIFO threshold interrupt.                      */
+      __IOM uint32_t OVF        : 1;            /*!< (@ 0x00000001) This is the FIFO overflow interrupt.                       */
+      __IOM uint32_t UNDFL      : 1;            /*!< (@ 0x00000002) This is the FIFO underflow interrupt.                      */
+    } INTCLR_b;
+  } ;
+  
+  union {
+    __IOM uint32_t INTSET;                      /*!< (@ 0x0000020C) IO Master Interrupts: Set                                  */
+    
+    struct {
+      __IOM uint32_t THR        : 1;            /*!< (@ 0x00000000) This is the FIFO threshold interrupt.                      */
+      __IOM uint32_t OVF        : 1;            /*!< (@ 0x00000001) This is the FIFO overflow interrupt.                       */
+      __IOM uint32_t UNDFL      : 1;            /*!< (@ 0x00000002) This is the FIFO underflow interrupt.                      */
+    } INTSET_b;
+  } ;
+} PDM_Type;                                     /*!< Size = 528 (0x210)                                                        */
+
+
+
+/* =========================================================================================================================== */
+/* ================                                          PWRCTRL                                          ================ */
+/* =========================================================================================================================== */
+
+
+/**
+  * @brief PWR Controller Register Bank (PWRCTRL)
+  */
+
+typedef struct {                                /*!< (@ 0x40021000) PWRCTRL Structure                                          */
+  
+  union {
+    __IOM uint32_t SUPPLYSRC;                   /*!< (@ 0x00000000) Memory and Core Voltage Supply Source Select
+                                                                    Register                                                   */
+    
+    struct {
+      __IOM uint32_t MEMBUCKEN  : 1;            /*!< (@ 0x00000000) Enables and select the Memory Buck as the supply
+                                                                    for the Flash and SRAM power domain.                       */
+      __IOM uint32_t COREBUCKEN : 1;            /*!< (@ 0x00000001) Enables and Selects the Core Buck as the supply
+                                                                    for the low-voltage power domain.                          */
+      __IOM uint32_t SWITCH_LDO_IN_SLEEP : 1;   /*!< (@ 0x00000002) Switches the CORE DOMAIN from BUCK mode (if enabled)
+                                                                    to LDO when CPU is in DEEP SLEEP. If all
+                                                                    the devices are off then this does not
+                                                                    matter and LDO (low power mode) is used                    */
+    } SUPPLYSRC_b;
+  } ;
+  
+  union {
+    __IOM uint32_t POWERSTATUS;                 /*!< (@ 0x00000004) Power Status Register for MCU supplies and peripherals     */
+    
+    struct {
+      __IOM uint32_t MEMBUCKON  : 1;            /*!< (@ 0x00000000) Indicate whether the Memory power domain is supplied
+                                                                    from the LDO or the Buck.                                  */
+      __IOM uint32_t COREBUCKON : 1;            /*!< (@ 0x00000001) Indicates whether the Core low-voltage domain
+                                                                    is supplied from the LDO or the Buck.                      */
+    } POWERSTATUS_b;
+  } ;
+  
+  union {
+    __IOM uint32_t DEVICEEN;                    /*!< (@ 0x00000008) DEVICE ENABLES for SHELBY                                  */
+    
+    struct {
+      __IOM uint32_t IO_SLAVE   : 1;            /*!< (@ 0x00000000) Enable IO SLAVE                                            */
+      __IOM uint32_t IO_MASTER0 : 1;            /*!< (@ 0x00000001) Enable IO MASTER 0                                         */
+      __IOM uint32_t IO_MASTER1 : 1;            /*!< (@ 0x00000002) Enable IO MASTER 1                                         */
+      __IOM uint32_t IO_MASTER2 : 1;            /*!< (@ 0x00000003) Enable IO MASTER 2                                         */
+      __IOM uint32_t IO_MASTER3 : 1;            /*!< (@ 0x00000004) Enable IO MASTER 3                                         */
+      __IOM uint32_t IO_MASTER4 : 1;            /*!< (@ 0x00000005) Enable IO MASTER 4                                         */
+      __IOM uint32_t IO_MASTER5 : 1;            /*!< (@ 0x00000006) Enable IO MASTER 5                                         */
+      __IOM uint32_t UART0      : 1;            /*!< (@ 0x00000007) Enable UART 0                                              */
+      __IOM uint32_t UART1      : 1;            /*!< (@ 0x00000008) Enable UART 1                                              */
+      __IOM uint32_t ADC        : 1;            /*!< (@ 0x00000009) Enable ADC Digital Block                                   */
+      __IOM uint32_t PDM        : 1;            /*!< (@ 0x0000000A) Enable PDM Digital Block                                   */
+    } DEVICEEN_b;
+  } ;
+  
+  union {
+    __IOM uint32_t SRAMPWDINSLEEP;              /*!< (@ 0x0000000C) Powerdown an SRAM Banks in Deep Sleep mode                 */
+    
+    struct {
+      __IOM uint32_t SRAMSLEEPPOWERDOWN : 11;   /*!< (@ 0x00000000) Selects which SRAM banks are powered down in
+                                                                    deep sleep mode, causing the contents of
+                                                                    the bank to be lost.                                       */
+      __IM  uint32_t            : 20;
+      __IOM uint32_t CACHE_PWD_SLP : 1;         /*!< (@ 0x0000001F) Enable CACHE BANKS to power down in deep sleep             */
+    } SRAMPWDINSLEEP_b;
+  } ;
+  
+  union {
+    __IOM uint32_t MEMEN;                       /*!< (@ 0x00000010) Disables individual banks of the MEMORY array              */
+    
+    struct {
+      __IOM uint32_t SRAMEN     : 11;           /*!< (@ 0x00000000) Enables power for selected SRAM banks (else an
+                                                                    access to its address space to generate
+                                                                    a Hard Fault).                                             */
+      __IOM uint32_t FLASH0     : 1;            /*!< (@ 0x0000000B) Enable FLASH 0                                             */
+      __IOM uint32_t FLASH1     : 1;            /*!< (@ 0x0000000C) Enable FLASH1                                              */
+      __IM  uint32_t            : 16;
+      __IOM uint32_t CACHEB0    : 1;            /*!< (@ 0x0000001D) Enable CACHE BANK 0                                        */
+      __IM  uint32_t            : 1;
+      __IOM uint32_t CACHEB2    : 1;            /*!< (@ 0x0000001F) Enable CACHE BANK 2                                        */
+    } MEMEN_b;
+  } ;
+  
+  union {
+    __IOM uint32_t PWRONSTATUS;                 /*!< (@ 0x00000014) POWER ON Status                                            */
+    
+    struct {
+      __IM  uint32_t            : 1;
+      __IOM uint32_t PDA        : 1;            /*!< (@ 0x00000001) This bit is 1 if power is supplied to power domain
+                                                                    A, which supplies IOS and UART0,1.                         */
+      __IOM uint32_t PDB        : 1;            /*!< (@ 0x00000002) This bit is 1 if power is supplied to power domain
+                                                                    B, which supplies IOM0-2.                                  */
+      __IOM uint32_t PDC        : 1;            /*!< (@ 0x00000003) This bit is 1 if power is supplied to power domain
+                                                                    C, which supplies IOM3-5.                                  */
+      __IOM uint32_t PD_PDM     : 1;            /*!< (@ 0x00000004) This bit is 1 if power is supplied to domain
+                                                                    PD_PDM                                                     */
+      __IOM uint32_t PD_FLAM0   : 1;            /*!< (@ 0x00000005) This bit is 1 if power is supplied to domain
+                                                                    PD_FLAM0                                                   */
+      __IOM uint32_t PD_FLAM1   : 1;            /*!< (@ 0x00000006) This bit is 1 if power is supplied to domain
+                                                                    PD_FLAM1                                                   */
+      __IOM uint32_t PDADC      : 1;            /*!< (@ 0x00000007) This bit is 1 if power is supplied to domain
+                                                                    PD_ADC                                                     */
+      __IOM uint32_t PD_GRP0_SRAM0 : 1;         /*!< (@ 0x00000008) This bit is 1 if power is supplied to SRAM domain
+                                                                    SRAM0_0                                                    */
+      __IOM uint32_t PD_GRP0_SRAM1 : 1;         /*!< (@ 0x00000009) This bit is 1 if power is supplied to SRAM domain
+                                                                    SRAM0_1                                                    */
+      __IOM uint32_t PD_GRP0_SRAM2 : 1;         /*!< (@ 0x0000000A) This bit is 1 if power is supplied to SRAM domain
+                                                                    PD_SRAM0_2                                                 */
+      __IOM uint32_t PD_GRP0_SRAM3 : 1;         /*!< (@ 0x0000000B) This bit is 1 if power is supplied to SRAM domain
+                                                                    PD_SRAM0_3                                                 */
+      __IOM uint32_t PD_GRP1_SRAM : 1;          /*!< (@ 0x0000000C) This bit is 1 if power is supplied to SRAM domain
+                                                                    PD_GRP1                                                    */
+      __IOM uint32_t PD_GRP2_SRAM : 1;          /*!< (@ 0x0000000D) This bit is 1 if power is supplied to SRAM domain
+                                                                    PD_GRP2                                                    */
+      __IOM uint32_t PD_GRP3_SRAM : 1;          /*!< (@ 0x0000000E) This bit is 1 if power is supplied to SRAM domain
+                                                                    PD_GRP3                                                    */
+      __IOM uint32_t PD_GRP4_SRAM : 1;          /*!< (@ 0x0000000F) This bit is 1 if power is supplied to SRAM domain
+                                                                    PD_GRP4                                                    */
+      __IOM uint32_t PD_GRP5_SRAM : 1;          /*!< (@ 0x00000010) This bit is 1 if power is supplied to SRAM domain
+                                                                    PD_GRP5                                                    */
+      __IOM uint32_t PD_GRP6_SRAM : 1;          /*!< (@ 0x00000011) This bit is 1 if power is supplied to SRAM domain
+                                                                    PD_GRP6                                                    */
+      __IOM uint32_t PD_GRP7_SRAM : 1;          /*!< (@ 0x00000012) This bit is 1 if power is supplied to SRAM domain
+                                                                    PD_GRP7                                                    */
+      __IOM uint32_t PD_CACHEB0 : 1;            /*!< (@ 0x00000013) This bit is 1 if power is supplied to CACHE BANK
+                                                                    0                                                          */
+      __IM  uint32_t            : 1;
+      __IOM uint32_t PD_CACHEB2 : 1;            /*!< (@ 0x00000015) This bit is 1 if power is supplied to CACHE BANK
+                                                                    2                                                          */
+    } PWRONSTATUS_b;
+  } ;
+  
+  union {
+    __IOM uint32_t SRAMCTRL;                    /*!< (@ 0x00000018) SRAM Control register                                      */
+    
+    struct {
+      __IOM uint32_t SRAM_LIGHT_SLEEP : 1;      /*!< (@ 0x00000000) Enable LS (light sleep) of cache RAMs. When this
+                                                                    bit is set, the RAMS will be put into light
+                                                                    sleep mode while inactive. NOTE: if the
+                                                                    SRAM is actively used, this may have an
+                                                                    adverse affect on power since entering/exiting
+                                                                    LS mode may consume more power than would
+                                                                    be saved.                                                  */
+      __IOM uint32_t SRAM_CLKGATE : 1;          /*!< (@ 0x00000001) Enables individual per-RAM clock gating in the
+                                                                    SRAM block. This bit should be enabled
+                                                                    for lowest power operation.                                */
+      __IOM uint32_t SRAM_MASTER_CLKGATE : 1;   /*!< (@ 0x00000002) Enables top-level clock gating in the SRAM block.
+                                                                    This bit should be enabled for lowest power
+                                                                    operation.                                                 */
+    } SRAMCTRL_b;
+  } ;
+  
+  union {
+    __IOM uint32_t ADCSTATUS;                   /*!< (@ 0x0000001C) Power Status Register for ADC Block                        */
+    
+    struct {
+      __IOM uint32_t ADC_PWD    : 1;            /*!< (@ 0x00000000) This bit indicates that the ADC is powered down            */
+      __IOM uint32_t ADC_BGT_PWD : 1;           /*!< (@ 0x00000001) This bit indicates that the ADC Band Gap is powered
+                                                                    down                                                       */
+      __IOM uint32_t ADC_VPTAT_PWD : 1;         /*!< (@ 0x00000002) This bit indicates that the ADC temperature sensor
+                                                                    input buffer is powered down                               */
+      __IOM uint32_t ADC_VBAT_PWD : 1;          /*!< (@ 0x00000003) This bit indicates that the ADC VBAT resistor
+                                                                    divider is powered down                                    */
+      __IOM uint32_t ADC_REFKEEP_PWD : 1;       /*!< (@ 0x00000004) This bit indicates that the ADC REFKEEP is powered
+                                                                    down                                                       */
+      __IOM uint32_t ADC_REFBUF_PWD : 1;        /*!< (@ 0x00000005) This bit indicates that the ADC REFBUF is powered
+                                                                    down                                                       */
+    } ADCSTATUS_b;
+  } ;
+  
+  union {
+    __IOM uint32_t MISCOPT;                     /*!< (@ 0x00000020) Power Optimization Control Bits                            */
+    
+    struct {
+      __IOM uint32_t ADC_EN_MASK : 1;           /*!< (@ 0x00000000) Control Bit to mask the ADC_EN in the adc_pwr_down
+                                                                    equation.                                                  */
+      __IOM uint32_t DIS_LDOLPMODE_HFRC : 1;    /*!< (@ 0x00000001) Setting this bit will enable the Core LDO to
+                                                                    be in LPMODE during deep sleep even when
+                                                                    HFRC is enabled.                                           */
+      __IOM uint32_t DIS_LDOLPMODE_TIMERS : 1;  /*!< (@ 0x00000002) Setting this bit will enable the MEM LDO to be
+                                                                    in LPMODE during deep sleep even when the
+                                                                    ctimers or stimers are running                             */
+    } MISCOPT_b;
+  } ;
+} PWRCTRL_Type;                                 /*!< Size = 36 (0x24)                                                          */
+
+
+
+/* =========================================================================================================================== */
+/* ================                                          RSTGEN                                           ================ */
+/* =========================================================================================================================== */
+
+
+/**
+  * @brief MCU Reset Generator (RSTGEN)
+  */
+
+typedef struct {                                /*!< (@ 0x40000000) RSTGEN Structure                                           */
+  
+  union {
+    __IOM uint32_t CFG;                         /*!< (@ 0x00000000) Configuration Register                                     */
+    
+    struct {
+      __IOM uint32_t BODHREN    : 1;            /*!< (@ 0x00000000) Brown out high (2.1v) reset enable.                        */
+      __IOM uint32_t WDREN      : 1;            /*!< (@ 0x00000001) Watchdog Timer Reset Enable. NOTE: The WDT module
+                                                                    must also be configured for WDT reset.                     */
+    } CFG_b;
+  } ;
+  
+  union {
+    __IOM uint32_t SWPOI;                       /*!< (@ 0x00000004) Software POI Reset                                         */
+    
+    struct {
+      __IOM uint32_t SWPOIKEY   : 8;            /*!< (@ 0x00000000) 0x1B generates a software POI reset.                       */
+    } SWPOI_b;
+  } ;
+  
+  union {
+    __IOM uint32_t SWPOR;                       /*!< (@ 0x00000008) Software POR Reset                                         */
+    
+    struct {
+      __IOM uint32_t SWPORKEY   : 8;            /*!< (@ 0x00000000) 0xD4 generates a software POR reset.                       */
+    } SWPOR_b;
+  } ;
+  
+  union {
+    __IOM uint32_t STAT;                        /*!< (@ 0x0000000C) Status Register                                            */
+    
+    struct {
+      __IOM uint32_t EXRSTAT    : 1;            /*!< (@ 0x00000000) Reset was initiated by an External Reset.                  */
+      __IOM uint32_t PORSTAT    : 1;            /*!< (@ 0x00000001) Reset was initiated by a Power-On Reset.                   */
+      __IOM uint32_t BORSTAT    : 1;            /*!< (@ 0x00000002) Reset was initiated by a Brown-Out Reset.                  */
+      __IOM uint32_t SWRSTAT    : 1;            /*!< (@ 0x00000003) Reset was a initiated by SW POR or AIRCR Reset.            */
+      __IOM uint32_t POIRSTAT   : 1;            /*!< (@ 0x00000004) Reset was a initiated by Software POI Reset.               */
+      __IOM uint32_t DBGRSTAT   : 1;            /*!< (@ 0x00000005) Reset was a initiated by Debugger Reset.                   */
+      __IOM uint32_t WDRSTAT    : 1;            /*!< (@ 0x00000006) Reset was initiated by a Watchdog Timer Reset.             */
+    } STAT_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CLRSTAT;                     /*!< (@ 0x00000010) Clear the status register                                  */
+    
+    struct {
+      __IOM uint32_t CLRSTAT    : 1;            /*!< (@ 0x00000000) Writing a 1 to this bit clears all bits in the
+                                                                    RST_STAT.                                                  */
+    } CLRSTAT_b;
+  } ;
+  
+  union {
+    __IOM uint32_t TPIU_RST;                    /*!< (@ 0x00000014) TPIU reset                                                 */
+    
+    struct {
+      __IOM uint32_t TPIURST    : 1;            /*!< (@ 0x00000000) Static reset for the TPIU. Write to '1' to assert
+                                                                    reset to TPIU. Write to '0' to clear the
+                                                                    reset.                                                     */
+    } TPIU_RST_b;
+  } ;
+  __IM  uint32_t  RESERVED[122];
+  
+  union {
+    __IOM uint32_t INTEN;                       /*!< (@ 0x00000200) Reset Interrupt register: Enable                           */
+    
+    struct {
+      __IOM uint32_t BODH       : 1;            /*!< (@ 0x00000000) Enables an interrupt that triggers when VCC is
+                                                                    below BODH level.                                          */
+    } INTEN_b;
+  } ;
+  
+  union {
+    __IOM uint32_t INTSTAT;                     /*!< (@ 0x00000204) Reset Interrupt register: Status                           */
+    
+    struct {
+      __IOM uint32_t BODH       : 1;            /*!< (@ 0x00000000) Enables an interrupt that triggers when VCC is
+                                                                    below BODH level.                                          */
+    } INTSTAT_b;
+  } ;
+  
+  union {
+    __IOM uint32_t INTCLR;                      /*!< (@ 0x00000208) Reset Interrupt register: Clear                            */
+    
+    struct {
+      __IOM uint32_t BODH       : 1;            /*!< (@ 0x00000000) Enables an interrupt that triggers when VCC is
+                                                                    below BODH level.                                          */
+    } INTCLR_b;
+  } ;
+  
+  union {
+    __IOM uint32_t INTSET;                      /*!< (@ 0x0000020C) Reset Interrupt register: Set                              */
+    
+    struct {
+      __IOM uint32_t BODH       : 1;            /*!< (@ 0x00000000) Enables an interrupt that triggers when VCC is
+                                                                    below BODH level.                                          */
+    } INTSET_b;
+  } ;
+} RSTGEN_Type;                                  /*!< Size = 528 (0x210)                                                        */
+
+
+
+/* =========================================================================================================================== */
+/* ================                                           UART0                                           ================ */
+/* =========================================================================================================================== */
+
+
+/**
+  * @brief Serial UART (UART0)
+  */
+
+typedef struct {                                /*!< (@ 0x4001C000) UART0 Structure                                            */
+  
+  union {
+    __IOM uint32_t DR;                          /*!< (@ 0x00000000) UART Data Register                                         */
+    
+    struct {
+      __IOM uint32_t DATA       : 8;            /*!< (@ 0x00000000) This is the UART data port.                                */
+      __IOM uint32_t FEDATA     : 1;            /*!< (@ 0x00000008) This is the framing error indicator.                       */
+      __IOM uint32_t PEDATA     : 1;            /*!< (@ 0x00000009) This is the parity error indicator.                        */
+      __IOM uint32_t BEDATA     : 1;            /*!< (@ 0x0000000A) This is the break error indicator.                         */
+      __IOM uint32_t OEDATA     : 1;            /*!< (@ 0x0000000B) This is the overrun error indicator.                       */
+    } DR_b;
+  } ;
+  
+  union {
+    __IOM uint32_t RSR;                         /*!< (@ 0x00000004) UART Status Register                                       */
+    
+    struct {
+      __IOM uint32_t FESTAT     : 1;            /*!< (@ 0x00000000) This is the framing error indicator.                       */
+      __IOM uint32_t PESTAT     : 1;            /*!< (@ 0x00000001) This is the parity error indicator.                        */
+      __IOM uint32_t BESTAT     : 1;            /*!< (@ 0x00000002) This is the break error indicator.                         */
+      __IOM uint32_t OESTAT     : 1;            /*!< (@ 0x00000003) This is the overrun error indicator.                       */
+    } RSR_b;
+  } ;
+  __IM  uint32_t  RESERVED[4];
+  
+  union {
+    __IOM uint32_t FR;                          /*!< (@ 0x00000018) Flag Register                                              */
+    
+    struct {
+      __IOM uint32_t CTS        : 1;            /*!< (@ 0x00000000) This bit holds the clear to send indicator.                */
+      __IOM uint32_t DSR        : 1;            /*!< (@ 0x00000001) This bit holds the data set ready indicator.               */
+      __IOM uint32_t DCD        : 1;            /*!< (@ 0x00000002) This bit holds the data carrier detect indicator.          */
+      __IOM uint32_t BUSY       : 1;            /*!< (@ 0x00000003) This bit holds the busy indicator.                         */
+      __IOM uint32_t RXFE       : 1;            /*!< (@ 0x00000004) This bit holds the receive FIFO empty indicator.           */
+      __IOM uint32_t TXFF       : 1;            /*!< (@ 0x00000005) This bit holds the transmit FIFO full indicator.           */
+      __IOM uint32_t RXFF       : 1;            /*!< (@ 0x00000006) This bit holds the receive FIFO full indicator.            */
+      __IOM uint32_t TXFE       : 1;            /*!< (@ 0x00000007) This bit holds the transmit FIFO empty indicator.          */
+      __IOM uint32_t TXBUSY     : 1;            /*!< (@ 0x00000008) This bit holds the transmit BUSY indicator.                */
+    } FR_b;
+  } ;
+  __IM  uint32_t  RESERVED1;
+  
+  union {
+    __IOM uint32_t ILPR;                        /*!< (@ 0x00000020) IrDA Counter                                               */
+    
+    struct {
+      __IOM uint32_t ILPDVSR    : 8;            /*!< (@ 0x00000000) These bits hold the IrDA counter divisor.                  */
+    } ILPR_b;
+  } ;
+  
+  union {
+    __IOM uint32_t IBRD;                        /*!< (@ 0x00000024) Integer Baud Rate Divisor                                  */
+    
+    struct {
+      __IOM uint32_t DIVINT     : 16;           /*!< (@ 0x00000000) These bits hold the baud integer divisor.                  */
+    } IBRD_b;
+  } ;
+  
+  union {
+    __IOM uint32_t FBRD;                        /*!< (@ 0x00000028) Fractional Baud Rate Divisor                               */
+    
+    struct {
+      __IOM uint32_t DIVFRAC    : 6;            /*!< (@ 0x00000000) These bits hold the baud fractional divisor.               */
+    } FBRD_b;
+  } ;
+  
+  union {
+    __IOM uint32_t LCRH;                        /*!< (@ 0x0000002C) Line Control High                                          */
+    
+    struct {
+      __IOM uint32_t BRK        : 1;            /*!< (@ 0x00000000) This bit holds the break set.                              */
+      __IOM uint32_t PEN        : 1;            /*!< (@ 0x00000001) This bit holds the parity enable.                          */
+      __IOM uint32_t EPS        : 1;            /*!< (@ 0x00000002) This bit holds the even parity select.                     */
+      __IOM uint32_t STP2       : 1;            /*!< (@ 0x00000003) This bit holds the two stop bits select.                   */
+      __IOM uint32_t FEN        : 1;            /*!< (@ 0x00000004) This bit holds the FIFO enable.                            */
+      __IOM uint32_t WLEN       : 2;            /*!< (@ 0x00000005) These bits hold the write length.                          */
+      __IOM uint32_t SPS        : 1;            /*!< (@ 0x00000007) This bit holds the stick parity select.                    */
+    } LCRH_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CR;                          /*!< (@ 0x00000030) Control Register                                           */
+    
+    struct {
+      __IOM uint32_t UARTEN     : 1;            /*!< (@ 0x00000000) This bit is the UART enable.                               */
+      __IOM uint32_t SIREN      : 1;            /*!< (@ 0x00000001) This bit is the SIR ENDEC enable.                          */
+      __IOM uint32_t SIRLP      : 1;            /*!< (@ 0x00000002) This bit is the SIR low power select.                      */
+      __IOM uint32_t CLKEN      : 1;            /*!< (@ 0x00000003) This bit is the UART clock enable.                         */
+      __IOM uint32_t CLKSEL     : 3;            /*!< (@ 0x00000004) This bitfield is the UART clock select.                    */
+      __IOM uint32_t LBE        : 1;            /*!< (@ 0x00000007) This bit is the loopback enable.                           */
+      __IOM uint32_t TXE        : 1;            /*!< (@ 0x00000008) This bit is the transmit enable.                           */
+      __IOM uint32_t RXE        : 1;            /*!< (@ 0x00000009) This bit is the receive enable.                            */
+      __IOM uint32_t DTR        : 1;            /*!< (@ 0x0000000A) This bit enables data transmit ready.                      */
+      __IOM uint32_t RTS        : 1;            /*!< (@ 0x0000000B) This bit enables request to send.                          */
+      __IOM uint32_t OUT1       : 1;            /*!< (@ 0x0000000C) This bit holds modem Out1.                                 */
+      __IOM uint32_t OUT2       : 1;            /*!< (@ 0x0000000D) This bit holds modem Out2.                                 */
+      __IOM uint32_t RTSEN      : 1;            /*!< (@ 0x0000000E) This bit enables RTS hardware flow control.                */
+      __IOM uint32_t CTSEN      : 1;            /*!< (@ 0x0000000F) This bit enables CTS hardware flow control.                */
+    } CR_b;
+  } ;
+  
+  union {
+    __IOM uint32_t IFLS;                        /*!< (@ 0x00000034) FIFO Interrupt Level Select                                */
+    
+    struct {
+      __IOM uint32_t TXIFLSEL   : 3;            /*!< (@ 0x00000000) These bits hold the transmit FIFO interrupt level.         */
+      __IOM uint32_t RXIFLSEL   : 3;            /*!< (@ 0x00000003) These bits hold the receive FIFO interrupt level.          */
+    } IFLS_b;
+  } ;
+  
+  union {
+    __IOM uint32_t IER;                         /*!< (@ 0x00000038) Interrupt Enable                                           */
+    
+    struct {
+      __IOM uint32_t TXCMPMIM   : 1;            /*!< (@ 0x00000000) This bit holds the modem TXCMP interrupt enable.           */
+      __IOM uint32_t CTSMIM     : 1;            /*!< (@ 0x00000001) This bit holds the modem CTS interrupt enable.             */
+      __IOM uint32_t DCDMIM     : 1;            /*!< (@ 0x00000002) This bit holds the modem DCD interrupt enable.             */
+      __IOM uint32_t DSRMIM     : 1;            /*!< (@ 0x00000003) This bit holds the modem DSR interrupt enable.             */
+      __IOM uint32_t RXIM       : 1;            /*!< (@ 0x00000004) This bit holds the receive interrupt enable.               */
+      __IOM uint32_t TXIM       : 1;            /*!< (@ 0x00000005) This bit holds the transmit interrupt enable.              */
+      __IOM uint32_t RTIM       : 1;            /*!< (@ 0x00000006) This bit holds the receive timeout interrupt
+                                                                    enable.                                                    */
+      __IOM uint32_t FEIM       : 1;            /*!< (@ 0x00000007) This bit holds the framing error interrupt enable.         */
+      __IOM uint32_t PEIM       : 1;            /*!< (@ 0x00000008) This bit holds the parity error interrupt enable.          */
+      __IOM uint32_t BEIM       : 1;            /*!< (@ 0x00000009) This bit holds the break error interrupt enable.           */
+      __IOM uint32_t OEIM       : 1;            /*!< (@ 0x0000000A) This bit holds the overflow interrupt enable.              */
+    } IER_b;
+  } ;
+  
+  union {
+    __IOM uint32_t IES;                         /*!< (@ 0x0000003C) Interrupt Status                                           */
+    
+    struct {
+      __IOM uint32_t TXCMPMRIS  : 1;            /*!< (@ 0x00000000) This bit holds the modem TXCMP interrupt status.           */
+      __IOM uint32_t CTSMRIS    : 1;            /*!< (@ 0x00000001) This bit holds the modem CTS interrupt status.             */
+      __IOM uint32_t DCDMRIS    : 1;            /*!< (@ 0x00000002) This bit holds the modem DCD interrupt status.             */
+      __IOM uint32_t DSRMRIS    : 1;            /*!< (@ 0x00000003) This bit holds the modem DSR interrupt status.             */
+      __IOM uint32_t RXRIS      : 1;            /*!< (@ 0x00000004) This bit holds the receive interrupt status.               */
+      __IOM uint32_t TXRIS      : 1;            /*!< (@ 0x00000005) This bit holds the transmit interrupt status.              */
+      __IOM uint32_t RTRIS      : 1;            /*!< (@ 0x00000006) This bit holds the receive timeout interrupt
+                                                                    status.                                                    */
+      __IOM uint32_t FERIS      : 1;            /*!< (@ 0x00000007) This bit holds the framing error interrupt status.         */
+      __IOM uint32_t PERIS      : 1;            /*!< (@ 0x00000008) This bit holds the parity error interrupt status.          */
+      __IOM uint32_t BERIS      : 1;            /*!< (@ 0x00000009) This bit holds the break error interrupt status.           */
+      __IOM uint32_t OERIS      : 1;            /*!< (@ 0x0000000A) This bit holds the overflow interrupt status.              */
+    } IES_b;
+  } ;
+  
+  union {
+    __IOM uint32_t MIS;                         /*!< (@ 0x00000040) Masked Interrupt Status                                    */
+    
+    struct {
+      __IOM uint32_t TXCMPMMIS  : 1;            /*!< (@ 0x00000000) This bit holds the modem TXCMP interrupt status
+                                                                    masked.                                                    */
+      __IOM uint32_t CTSMMIS    : 1;            /*!< (@ 0x00000001) This bit holds the modem CTS interrupt status
+                                                                    masked.                                                    */
+      __IOM uint32_t DCDMMIS    : 1;            /*!< (@ 0x00000002) This bit holds the modem DCD interrupt status
+                                                                    masked.                                                    */
+      __IOM uint32_t DSRMMIS    : 1;            /*!< (@ 0x00000003) This bit holds the modem DSR interrupt status
+                                                                    masked.                                                    */
+      __IOM uint32_t RXMIS      : 1;            /*!< (@ 0x00000004) This bit holds the receive interrupt status masked.        */
+      __IOM uint32_t TXMIS      : 1;            /*!< (@ 0x00000005) This bit holds the transmit interrupt status
+                                                                    masked.                                                    */
+      __IOM uint32_t RTMIS      : 1;            /*!< (@ 0x00000006) This bit holds the receive timeout interrupt
+                                                                    status masked.                                             */
+      __IOM uint32_t FEMIS      : 1;            /*!< (@ 0x00000007) This bit holds the framing error interrupt status
+                                                                    masked.                                                    */
+      __IOM uint32_t PEMIS      : 1;            /*!< (@ 0x00000008) This bit holds the parity error interrupt status
+                                                                    masked.                                                    */
+      __IOM uint32_t BEMIS      : 1;            /*!< (@ 0x00000009) This bit holds the break error interrupt status
+                                                                    masked.                                                    */
+      __IOM uint32_t OEMIS      : 1;            /*!< (@ 0x0000000A) This bit holds the overflow interrupt status
+                                                                    masked.                                                    */
+    } MIS_b;
+  } ;
+  
+  union {
+    __IOM uint32_t IEC;                         /*!< (@ 0x00000044) Interrupt Clear                                            */
+    
+    struct {
+      __IOM uint32_t TXCMPMIC   : 1;            /*!< (@ 0x00000000) This bit holds the modem TXCMP interrupt clear.            */
+      __IOM uint32_t CTSMIC     : 1;            /*!< (@ 0x00000001) This bit holds the modem CTS interrupt clear.              */
+      __IOM uint32_t DCDMIC     : 1;            /*!< (@ 0x00000002) This bit holds the modem DCD interrupt clear.              */
+      __IOM uint32_t DSRMIC     : 1;            /*!< (@ 0x00000003) This bit holds the modem DSR interrupt clear.              */
+      __IOM uint32_t RXIC       : 1;            /*!< (@ 0x00000004) This bit holds the receive interrupt clear.                */
+      __IOM uint32_t TXIC       : 1;            /*!< (@ 0x00000005) This bit holds the transmit interrupt clear.               */
+      __IOM uint32_t RTIC       : 1;            /*!< (@ 0x00000006) This bit holds the receive timeout interrupt
+                                                                    clear.                                                     */
+      __IOM uint32_t FEIC       : 1;            /*!< (@ 0x00000007) This bit holds the framing error interrupt clear.          */
+      __IOM uint32_t PEIC       : 1;            /*!< (@ 0x00000008) This bit holds the parity error interrupt clear.           */
+      __IOM uint32_t BEIC       : 1;            /*!< (@ 0x00000009) This bit holds the break error interrupt clear.            */
+      __IOM uint32_t OEIC       : 1;            /*!< (@ 0x0000000A) This bit holds the overflow interrupt clear.               */
+    } IEC_b;
+  } ;
+} UART0_Type;                                   /*!< Size = 72 (0x48)                                                          */
+
+
+
+/* =========================================================================================================================== */
+/* ================                                           VCOMP                                           ================ */
+/* =========================================================================================================================== */
+
+
+/**
+  * @brief Voltage Comparator (VCOMP)
+  */
+
+typedef struct {                                /*!< (@ 0x4000C000) VCOMP Structure                                            */
+  
+  union {
+    __IOM uint32_t CFG;                         /*!< (@ 0x00000000) Configuration Register                                     */
+    
+    struct {
+      __IOM uint32_t PSEL       : 2;            /*!< (@ 0x00000000) This bitfield selects the positive input to the
+                                                                    comparator.                                                */
+      __IM  uint32_t            : 6;
+      __IOM uint32_t NSEL       : 2;            /*!< (@ 0x00000008) This bitfield selects the negative input to the
+                                                                    comparator.                                                */
+      __IM  uint32_t            : 6;
+      __IOM uint32_t LVLSEL     : 4;            /*!< (@ 0x00000010) When the reference input NSEL is set to NSEL_DAC,
+                                                                    this bitfield selects the voltage level
+                                                                    for the negative input to the comparator.                  */
+    } CFG_b;
+  } ;
+  
+  union {
+    __IOM uint32_t STAT;                        /*!< (@ 0x00000004) Status Register                                            */
+    
+    struct {
+      __IOM uint32_t CMPOUT     : 1;            /*!< (@ 0x00000000) This bit is 1 if the positive input of the comparator
+                                                                    is greater than the negative input.                        */
+      __IOM uint32_t PWDSTAT    : 1;            /*!< (@ 0x00000001) This bit indicates the power down state of the
+                                                                    voltage comparator.                                        */
+    } STAT_b;
+  } ;
+  
+  union {
+    __IOM uint32_t PWDKEY;                      /*!< (@ 0x00000008) Key Register for Powering Down the Voltage Comparator      */
+    
+    struct {
+      __IOM uint32_t PWDKEY     : 32;           /*!< (@ 0x00000000) Key register value.                                        */
+    } PWDKEY_b;
+  } ;
+  __IM  uint32_t  RESERVED[125];
+  
+  union {
+    __IOM uint32_t INTEN;                       /*!< (@ 0x00000200) Voltage Comparator Interrupt registers: Enable             */
+    
+    struct {
+      __IOM uint32_t OUTLOW     : 1;            /*!< (@ 0x00000000) This bit is the vcompout low interrupt.                    */
+      __IOM uint32_t OUTHI      : 1;            /*!< (@ 0x00000001) This bit is the vcompout high interrupt.                   */
+    } INTEN_b;
+  } ;
+  
+  union {
+    __IOM uint32_t INTSTAT;                     /*!< (@ 0x00000204) Voltage Comparator Interrupt registers: Status             */
+    
+    struct {
+      __IOM uint32_t OUTLOW     : 1;            /*!< (@ 0x00000000) This bit is the vcompout low interrupt.                    */
+      __IOM uint32_t OUTHI      : 1;            /*!< (@ 0x00000001) This bit is the vcompout high interrupt.                   */
+    } INTSTAT_b;
+  } ;
+  
+  union {
+    __IOM uint32_t INTCLR;                      /*!< (@ 0x00000208) Voltage Comparator Interrupt registers: Clear              */
+    
+    struct {
+      __IOM uint32_t OUTLOW     : 1;            /*!< (@ 0x00000000) This bit is the vcompout low interrupt.                    */
+      __IOM uint32_t OUTHI      : 1;            /*!< (@ 0x00000001) This bit is the vcompout high interrupt.                   */
+    } INTCLR_b;
+  } ;
+  
+  union {
+    __IOM uint32_t INTSET;                      /*!< (@ 0x0000020C) Voltage Comparator Interrupt registers: Set                */
+    
+    struct {
+      __IOM uint32_t OUTLOW     : 1;            /*!< (@ 0x00000000) This bit is the vcompout low interrupt.                    */
+      __IOM uint32_t OUTHI      : 1;            /*!< (@ 0x00000001) This bit is the vcompout high interrupt.                   */
+    } INTSET_b;
+  } ;
+} VCOMP_Type;                                   /*!< Size = 528 (0x210)                                                        */
+
+
+
+/* =========================================================================================================================== */
+/* ================                                            WDT                                            ================ */
+/* =========================================================================================================================== */
+
+
+/**
+  * @brief Watchdog Timer (WDT)
+  */
+
+typedef struct {                                /*!< (@ 0x40024000) WDT Structure                                              */
+  
+  union {
+    __IOM uint32_t CFG;                         /*!< (@ 0x00000000) Configuration Register                                     */
+    
+    struct {
+      __IOM uint32_t WDTEN      : 1;            /*!< (@ 0x00000000) This bitfield enables the WDT.                             */
+      __IOM uint32_t INTEN      : 1;            /*!< (@ 0x00000001) This bitfield enables the WDT interrupt. Note
+                                                                    : This bit must be set before the interrupt
+                                                                    status bit will reflect a watchdog timer
+                                                                    expiration. The IER interrupt register
+                                                                    must also be enabled for a WDT interrupt
+                                                                    to be sent to the NVIC.                                    */
+      __IOM uint32_t RESEN      : 1;            /*!< (@ 0x00000002) This bitfield enables the WDT reset.                       */
+      __IM  uint32_t            : 5;
+      __IOM uint32_t RESVAL     : 8;            /*!< (@ 0x00000008) This bitfield is the compare value for counter
+                                                                    bits 7:0 to generate a watchdog reset.                     */
+      __IOM uint32_t INTVAL     : 8;            /*!< (@ 0x00000010) This bitfield is the compare value for counter
+                                                                    bits 7:0 to generate a watchdog interrupt.                 */
+      __IOM uint32_t CLKSEL     : 3;            /*!< (@ 0x00000018) Select the frequency for the WDT. All values
+                                                                    not enumerated below are undefined.                        */
+    } CFG_b;
+  } ;
+  
+  union {
+    __IOM uint32_t RSTRT;                       /*!< (@ 0x00000004) Restart the watchdog timer                                 */
+    
+    struct {
+      __IOM uint32_t RSTRT      : 8;            /*!< (@ 0x00000000) Writing 0xB2 to WDTRSTRT restarts the watchdog
+                                                                    timer.                                                     */
+    } RSTRT_b;
+  } ;
+  
+  union {
+    __IOM uint32_t LOCK;                        /*!< (@ 0x00000008) Locks the WDT                                              */
+    
+    struct {
+      __IOM uint32_t LOCK       : 8;            /*!< (@ 0x00000000) Writing 0x3A locks the watchdog timer. Once locked,
+                                                                    the WDTCFG reg cannot be written and WDTEN
+                                                                    is set.                                                    */
+    } LOCK_b;
+  } ;
+  
+  union {
+    __IOM uint32_t COUNT;                       /*!< (@ 0x0000000C) Current Counter Value for WDT                              */
+    
+    struct {
+      __IOM uint32_t COUNT      : 8;            /*!< (@ 0x00000000) Read-Only current value of the WDT counter                 */
+    } COUNT_b;
+  } ;
+  __IM  uint32_t  RESERVED[124];
+  
+  union {
+    __IOM uint32_t INTEN;                       /*!< (@ 0x00000200) WDT Interrupt register: Enable                             */
+    
+    struct {
+      __IOM uint32_t WDT        : 1;            /*!< (@ 0x00000000) Watchdog Timer Interrupt.                                  */
+    } INTEN_b;
+  } ;
+  
+  union {
+    __IOM uint32_t INTSTAT;                     /*!< (@ 0x00000204) WDT Interrupt register: Status                             */
+    
+    struct {
+      __IOM uint32_t WDT        : 1;            /*!< (@ 0x00000000) Watchdog Timer Interrupt.                                  */
+    } INTSTAT_b;
+  } ;
+  
+  union {
+    __IOM uint32_t INTCLR;                      /*!< (@ 0x00000208) WDT Interrupt register: Clear                              */
+    
+    struct {
+      __IOM uint32_t WDT        : 1;            /*!< (@ 0x00000000) Watchdog Timer Interrupt.                                  */
+    } INTCLR_b;
+  } ;
+  
+  union {
+    __IOM uint32_t INTSET;                      /*!< (@ 0x0000020C) WDT Interrupt register: Set                                */
+    
+    struct {
+      __IOM uint32_t WDT        : 1;            /*!< (@ 0x00000000) Watchdog Timer Interrupt.                                  */
+    } INTSET_b;
+  } ;
+} WDT_Type;                                     /*!< Size = 528 (0x210)                                                        */
+
+
+
+/* =========================================================================================================================== */
+/* ================                                          CLKGEN                                           ================ */
+/* =========================================================================================================================== */
+
+
+/**
+  * @brief Clock Generator (CLKGEN)
+  */
+
+typedef struct {                                /*!< (@ 0x40004000) CLKGEN Structure                                           */
+  
+  union {
+    __IOM uint32_t CALXT;                       /*!< (@ 0x00000000) XT Oscillator Control                                      */
+    
+    struct {
+      __IOM uint32_t CALXT      : 11;           /*!< (@ 0x00000000) XT Oscillator calibration value                            */
+    } CALXT_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CALRC;                       /*!< (@ 0x00000004) RC Oscillator Control                                      */
+    
+    struct {
+      __IOM uint32_t CALRC      : 18;           /*!< (@ 0x00000000) LFRC Oscillator calibration value                          */
+    } CALRC_b;
+  } ;
+  
+  union {
+    __IOM uint32_t ACALCTR;                     /*!< (@ 0x00000008) Autocalibration Counter                                    */
+    
+    struct {
+      __IOM uint32_t ACALCTR    : 24;           /*!< (@ 0x00000000) Autocalibration Counter result.                            */
+    } ACALCTR_b;
+  } ;
+  
+  union {
+    __IOM uint32_t OCTRL;                       /*!< (@ 0x0000000C) Oscillator Control                                         */
+    
+    struct {
+      __IOM uint32_t STOPXT     : 1;            /*!< (@ 0x00000000) Stop the XT Oscillator to the RTC                          */
+      __IOM uint32_t STOPRC     : 1;            /*!< (@ 0x00000001) Stop the LFRC Oscillator to the RTC                        */
+      __IM  uint32_t            : 4;
+      __IOM uint32_t FOS        : 1;            /*!< (@ 0x00000006) Oscillator switch on failure function                      */
+      __IOM uint32_t OSEL       : 1;            /*!< (@ 0x00000007) Selects the RTC oscillator (1 => LFRC, 0 => XT)            */
+      __IOM uint32_t ACAL       : 3;            /*!< (@ 0x00000008) Autocalibration control                                    */
+    } OCTRL_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CLKOUT;                      /*!< (@ 0x00000010) CLKOUT Frequency Select                                    */
+    
+    struct {
+      __IOM uint32_t CKSEL      : 6;            /*!< (@ 0x00000000) CLKOUT signal select                                       */
+      __IM  uint32_t            : 1;
+      __IOM uint32_t CKEN       : 1;            /*!< (@ 0x00000007) Enable the CLKOUT signal                                   */
+    } CLKOUT_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CLKKEY;                      /*!< (@ 0x00000014) Key Register for Clock Control Register                    */
+    
+    struct {
+      __IOM uint32_t CLKKEY     : 32;           /*!< (@ 0x00000000) Key register value.                                        */
+    } CLKKEY_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CCTRL;                       /*!< (@ 0x00000018) HFRC Clock Control                                         */
+    
+    struct {
+      __IOM uint32_t CORESEL    : 1;            /*!< (@ 0x00000000) Core Clock divisor                                         */
+    } CCTRL_b;
+  } ;
+  
+  union {
+    __IOM uint32_t STATUS;                      /*!< (@ 0x0000001C) Clock Generator Status                                     */
+    
+    struct {
+      __IOM uint32_t OMODE      : 1;            /*!< (@ 0x00000000) Current RTC oscillator (1 => LFRC, 0 => XT)                */
+      __IOM uint32_t OSCF       : 1;            /*!< (@ 0x00000001) XT Oscillator is enabled but not oscillating               */
+    } STATUS_b;
+  } ;
+  
+  union {
+    __IOM uint32_t HFADJ;                       /*!< (@ 0x00000020) HFRC Adjustment                                            */
+    
+    struct {
+      __IOM uint32_t HFADJEN    : 1;            /*!< (@ 0x00000000) HFRC adjustment control                                    */
+      __IOM uint32_t HFADJCK    : 3;            /*!< (@ 0x00000001) Repeat period for HFRC adjustment                          */
+      __IM  uint32_t            : 4;
+      __IOM uint32_t HFXTADJ    : 12;           /*!< (@ 0x00000008) Target HFRC adjustment value.                              */
+      __IOM uint32_t HFWARMUP   : 1;            /*!< (@ 0x00000014) XT warmup period for HFRC adjustment                       */
+      __IOM uint32_t HFADJ_GAIN : 3;            /*!< (@ 0x00000015) Gain control for HFRC adjustment                           */
+    } HFADJ_b;
+  } ;
+  
+  union {
+    __IOM uint32_t HFVAL;                       /*!< (@ 0x00000024) HFADJ readback                                             */
+    
+    struct {
+      __IOM uint32_t HFTUNERB   : 11;           /*!< (@ 0x00000000) Current HFTUNE value                                       */
+    } HFVAL_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CLOCKEN;                     /*!< (@ 0x00000028) Clock Enable Status                                        */
+    
+    struct {
+      __IOM uint32_t CLOCKEN    : 32;           /*!< (@ 0x00000000) Clock enable status                                        */
+    } CLOCKEN_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CLOCKEN2;                    /*!< (@ 0x0000002C) Clock Enable Status                                        */
+    
+    struct {
+      __IOM uint32_t CLOCKEN2   : 32;           /*!< (@ 0x00000000) Clock enable status 2                                      */
+    } CLOCKEN2_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CLOCKEN3;                    /*!< (@ 0x00000030) Clock Enable Status                                        */
+    
+    struct {
+      __IOM uint32_t CLOCKEN3   : 32;           /*!< (@ 0x00000000) Clock enable status 3                                      */
+    } CLOCKEN3_b;
+  } ;
+  
+  union {
+    __IOM uint32_t UARTEN;                      /*!< (@ 0x00000034) UART Enable                                                */
+    
+    struct {
+      __IOM uint32_t UART0EN    : 2;            /*!< (@ 0x00000000) UART0 system clock control                                 */
+      __IM  uint32_t            : 6;
+      __IOM uint32_t UART1EN    : 2;            /*!< (@ 0x00000008) UART1 system clock control                                 */
+    } UARTEN_b;
+  } ;
+  __IM  uint32_t  RESERVED[2];
+  
+  union {
+    __IOM uint32_t CTRLOW;                      /*!< (@ 0x00000040) RTC Counters Lower                                         */
+    
+    struct {
+      __IOM uint32_t CTR100     : 8;            /*!< (@ 0x00000000) 100ths of a second Counter                                 */
+      __IOM uint32_t CTRSEC     : 7;            /*!< (@ 0x00000008) Seconds Counter                                            */
+      __IM  uint32_t            : 1;
+      __IOM uint32_t CTRMIN     : 7;            /*!< (@ 0x00000010) Minutes Counter                                            */
+      __IM  uint32_t            : 1;
+      __IOM uint32_t CTRHR      : 6;            /*!< (@ 0x00000018) Hours Counter                                              */
+    } CTRLOW_b;
+  } ;
+  
+  union {
+    __IOM uint32_t CTRUP;                       /*!< (@ 0x00000044) RTC Counters Upper                                         */
+    
+    struct {
+      __IOM uint32_t CTRDATE    : 6;            /*!< (@ 0x00000000) Date Counter                                               */
+      __IM  uint32_t            : 2;
+      __IOM uint32_t CTRMO      : 5;            /*!< (@ 0x00000008) Months Counter                                             */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t CTRYR      : 8;            /*!< (@ 0x00000010) Years Counter                                              */
+      __IOM uint32_t CTRWKDY    : 3;            /*!< (@ 0x00000018) Weekdays Counter                                           */
+      __IOM uint32_t CB         : 1;            /*!< (@ 0x0000001B) Century                                                    */
+      __IOM uint32_t CEB        : 1;            /*!< (@ 0x0000001C) Century enable                                             */
+      __IM  uint32_t            : 2;
+      __IOM uint32_t CTERR      : 1;            /*!< (@ 0x0000001F) Counter read error status                                  */
+    } CTRUP_b;
+  } ;
+  
+  union {
+    __IOM uint32_t ALMLOW;                      /*!< (@ 0x00000048) RTC Alarms Lower                                           */
+    
+    struct {
+      __IOM uint32_t ALM100     : 8;            /*!< (@ 0x00000000) 100ths of a second Alarm                                   */
+      __IOM uint32_t ALMSEC     : 7;            /*!< (@ 0x00000008) Seconds Alarm                                              */
+      __IM  uint32_t            : 1;
+      __IOM uint32_t ALMMIN     : 7;            /*!< (@ 0x00000010) Minutes Alarm                                              */
+      __IM  uint32_t            : 1;
+      __IOM uint32_t ALMHR      : 6;            /*!< (@ 0x00000018) Hours Alarm                                                */
+    } ALMLOW_b;
+  } ;
+  
+  union {
+    __IOM uint32_t ALMUP;                       /*!< (@ 0x0000004C) RTC Alarms Upper                                           */
+    
+    struct {
+      __IOM uint32_t ALMDATE    : 6;            /*!< (@ 0x00000000) Date Alarm                                                 */
+      __IM  uint32_t            : 2;
+      __IOM uint32_t ALMMO      : 5;            /*!< (@ 0x00000008) Months Alarm                                               */
+      __IM  uint32_t            : 3;
+      __IOM uint32_t ALMWKDY    : 3;            /*!< (@ 0x00000010) Weekdays Alarm                                             */
+    } ALMUP_b;
+  } ;
+  
+  union {
+    __IOM uint32_t RTCCTL;                      /*!< (@ 0x00000050) RTC Control Register                                       */
+    
+    struct {
+      __IOM uint32_t WRTC       : 1;            /*!< (@ 0x00000000) Counter write control                                      */
+      __IOM uint32_t RPT        : 3;            /*!< (@ 0x00000001) Alarm repeat interval                                      */
+      __IOM uint32_t RSTOP      : 1;            /*!< (@ 0x00000004) RTC input clock control                                    */
+      __IOM uint32_t HR1224     : 1;            /*!< (@ 0x00000005) Hours Counter mode                                         */
+    } RTCCTL_b;
+  } ;
+  __IM  uint32_t  RESERVED1[43];
+  
+  union {
+    __IOM uint32_t INTEN;                       /*!< (@ 0x00000100) CLKGEN Interrupt Register: Enable                          */
+    
+    struct {
+      __IOM uint32_t ACF        : 1;            /*!< (@ 0x00000000) Autocalibration Fail interrupt                             */
+      __IOM uint32_t ACC        : 1;            /*!< (@ 0x00000001) Autocalibration Complete interrupt                         */
+      __IOM uint32_t OF         : 1;            /*!< (@ 0x00000002) XT Oscillator Fail interrupt                               */
+      __IOM uint32_t ALM        : 1;            /*!< (@ 0x00000003) RTC Alarm interrupt                                        */
+    } INTEN_b;
+  } ;
+  
+  union {
+    __IOM uint32_t INTSTAT;                     /*!< (@ 0x00000104) CLKGEN Interrupt Register: Status                          */
+    
+    struct {
+      __IOM uint32_t ACF        : 1;            /*!< (@ 0x00000000) Autocalibration Fail interrupt                             */
+      __IOM uint32_t ACC        : 1;            /*!< (@ 0x00000001) Autocalibration Complete interrupt                         */
+      __IOM uint32_t OF         : 1;            /*!< (@ 0x00000002) XT Oscillator Fail interrupt                               */
+      __IOM uint32_t ALM        : 1;            /*!< (@ 0x00000003) RTC Alarm interrupt                                        */
+    } INTSTAT_b;
+  } ;
+  
+  union {
+    __IOM uint32_t INTCLR;                      /*!< (@ 0x00000108) CLKGEN Interrupt Register: Clear                           */
+    
+    struct {
+      __IOM uint32_t ACF        : 1;            /*!< (@ 0x00000000) Autocalibration Fail interrupt                             */
+      __IOM uint32_t ACC        : 1;            /*!< (@ 0x00000001) Autocalibration Complete interrupt                         */
+      __IOM uint32_t OF         : 1;            /*!< (@ 0x00000002) XT Oscillator Fail interrupt                               */
+      __IOM uint32_t ALM        : 1;            /*!< (@ 0x00000003) RTC Alarm interrupt                                        */
+    } INTCLR_b;
+  } ;
+  
+  union {
+    __IOM uint32_t INTSET;                      /*!< (@ 0x0000010C) CLKGEN Interrupt Register: Set                             */
+    
+    struct {
+      __IOM uint32_t ACF        : 1;            /*!< (@ 0x00000000) Autocalibration Fail interrupt                             */
+      __IOM uint32_t ACC        : 1;            /*!< (@ 0x00000001) Autocalibration Complete interrupt                         */
+      __IOM uint32_t OF         : 1;            /*!< (@ 0x00000002) XT Oscillator Fail interrupt                               */
+      __IOM uint32_t ALM        : 1;            /*!< (@ 0x00000003) RTC Alarm interrupt                                        */
+    } INTSET_b;
+  } ;
+} CLKGEN_Type;                                  /*!< Size = 272 (0x110)                                                        */
+
+
+/** @} */ /* End of group Device_Peripheral_peripherals */
+
+
+/* =========================================  End of section using anonymous unions  ========================================= */
+#if defined (__CC_ARM)
+  #pragma pop
+#elif defined (__ICCARM__)
+  /* leave anonymous unions enabled */
+#elif (__ARMCC_VERSION >= 6010050)
+  #pragma clang diagnostic pop
+#elif defined (__GNUC__)
+  /* anonymous unions are enabled by default */
+#elif defined (__TMS470__)
+  /* anonymous unions are enabled by default */
+#elif defined (__TASKING__)
+  #pragma warning restore
+#elif defined (__CSMC__)
+  /* anonymous unions are enabled by default */
+#endif
+
+
+/* =========================================================================================================================== */
+/* ================                          Device Specific Peripheral Address Map                           ================ */
+/* =========================================================================================================================== */
+
+
+/** @addtogroup Device_Peripheral_peripheralAddr
+  * @{
+  */
+
+#define ADC_BASE                    0x50010000UL
+#define CACHECTRL_BASE              0x40018000UL
+#define CTIMER_BASE                 0x40008000UL
+#define GPIO_BASE                   0x40010000UL
+#define IOMSTR0_BASE                0x50004000UL
+#define IOMSTR1_BASE                0x50005000UL
+#define IOMSTR2_BASE                0x50006000UL
+#define IOMSTR3_BASE                0x50007000UL
+#define IOMSTR4_BASE                0x50008000UL
+#define IOMSTR5_BASE                0x50009000UL
+#define IOSLAVE_BASE                0x50000000UL
+#define MCUCTRL_BASE                0x40020000UL
+#define PDM_BASE                    0x50011000UL
+#define PWRCTRL_BASE                0x40021000UL
+#define RSTGEN_BASE                 0x40000000UL
+#define UART0_BASE                  0x4001C000UL
+#define UART1_BASE                  0x4001D000UL
+#define VCOMP_BASE                  0x4000C000UL
+#define WDT_BASE                    0x40024000UL
+#define CLKGEN_BASE                 0x40004000UL
+
+/** @} */ /* End of group Device_Peripheral_peripheralAddr */
+
+
+/* =========================================================================================================================== */
+/* ================                                  Peripheral declaration                                   ================ */
+/* =========================================================================================================================== */
+
+
+/** @addtogroup Device_Peripheral_declaration
+  * @{
+  */
+
+#define ADC                         ((ADC_Type*)               ADC_BASE)
+#define CACHECTRL                   ((CACHECTRL_Type*)         CACHECTRL_BASE)
+#define CTIMER                      ((CTIMER_Type*)            CTIMER_BASE)
+#define GPIO                        ((GPIO_Type*)              GPIO_BASE)
+#define IOMSTR0                     ((IOMSTR0_Type*)           IOMSTR0_BASE)
+#define IOMSTR1                     ((IOMSTR0_Type*)           IOMSTR1_BASE)
+#define IOMSTR2                     ((IOMSTR0_Type*)           IOMSTR2_BASE)
+#define IOMSTR3                     ((IOMSTR0_Type*)           IOMSTR3_BASE)
+#define IOMSTR4                     ((IOMSTR0_Type*)           IOMSTR4_BASE)
+#define IOMSTR5                     ((IOMSTR0_Type*)           IOMSTR5_BASE)
+#define IOSLAVE                     ((IOSLAVE_Type*)           IOSLAVE_BASE)
+#define MCUCTRL                     ((MCUCTRL_Type*)           MCUCTRL_BASE)
+#define PDM                         ((PDM_Type*)               PDM_BASE)
+#define PWRCTRL                     ((PWRCTRL_Type*)           PWRCTRL_BASE)
+#define RSTGEN                      ((RSTGEN_Type*)            RSTGEN_BASE)
+#define UART0                       ((UART0_Type*)             UART0_BASE)
+#define UART1                       ((UART0_Type*)             UART1_BASE)
+#define VCOMP                       ((VCOMP_Type*)             VCOMP_BASE)
+#define WDT                         ((WDT_Type*)               WDT_BASE)
+#define CLKGEN                      ((CLKGEN_Type*)            CLKGEN_BASE)
+
+/** @} */ /* End of group Device_Peripheral_declaration */
+
+
+/* =========================================================================================================================== */
+/* ================                                Pos/Mask Peripheral Section                                ================ */
+/* =========================================================================================================================== */
+
+
+/** @addtogroup PosMask_peripherals
+  * @{
+  */
+
+
+
+/* =========================================================================================================================== */
+/* ================                                            ADC                                            ================ */
+/* =========================================================================================================================== */
+
+/* ==========================================================  CFG  ========================================================== */
+#define ADC_CFG_CLKSEL_Pos                (24UL)                    /*!< ADC CFG: CLKSEL (Bit 24)                              */
+#define ADC_CFG_CLKSEL_Msk                (0x3000000UL)             /*!< ADC CFG: CLKSEL (Bitfield-Mask: 0x03)                 */
+#define ADC_CFG_TRIGPOL_Pos               (19UL)                    /*!< ADC CFG: TRIGPOL (Bit 19)                             */
+#define ADC_CFG_TRIGPOL_Msk               (0x80000UL)               /*!< ADC CFG: TRIGPOL (Bitfield-Mask: 0x01)                */
+#define ADC_CFG_TRIGSEL_Pos               (16UL)                    /*!< ADC CFG: TRIGSEL (Bit 16)                             */
+#define ADC_CFG_TRIGSEL_Msk               (0x70000UL)               /*!< ADC CFG: TRIGSEL (Bitfield-Mask: 0x07)                */
+#define ADC_CFG_REFSEL_Pos                (8UL)                     /*!< ADC CFG: REFSEL (Bit 8)                               */
+#define ADC_CFG_REFSEL_Msk                (0x300UL)                 /*!< ADC CFG: REFSEL (Bitfield-Mask: 0x03)                 */
+#define ADC_CFG_CKMODE_Pos                (4UL)                     /*!< ADC CFG: CKMODE (Bit 4)                               */
+#define ADC_CFG_CKMODE_Msk                (0x10UL)                  /*!< ADC CFG: CKMODE (Bitfield-Mask: 0x01)                 */
+#define ADC_CFG_LPMODE_Pos                (3UL)                     /*!< ADC CFG: LPMODE (Bit 3)                               */
+#define ADC_CFG_LPMODE_Msk                (0x8UL)                   /*!< ADC CFG: LPMODE (Bitfield-Mask: 0x01)                 */
+#define ADC_CFG_RPTEN_Pos                 (2UL)                     /*!< ADC CFG: RPTEN (Bit 2)                                */
+#define ADC_CFG_RPTEN_Msk                 (0x4UL)                   /*!< ADC CFG: RPTEN (Bitfield-Mask: 0x01)                  */
+#define ADC_CFG_ADCEN_Pos                 (0UL)                     /*!< ADC CFG: ADCEN (Bit 0)                                */
+#define ADC_CFG_ADCEN_Msk                 (0x1UL)                   /*!< ADC CFG: ADCEN (Bitfield-Mask: 0x01)                  */
+/* =========================================================  STAT  ========================================================== */
+#define ADC_STAT_PWDSTAT_Pos              (0UL)                     /*!< ADC STAT: PWDSTAT (Bit 0)                             */
+#define ADC_STAT_PWDSTAT_Msk              (0x1UL)                   /*!< ADC STAT: PWDSTAT (Bitfield-Mask: 0x01)               */
+/* ==========================================================  SWT  ========================================================== */
+#define ADC_SWT_SWT_Pos                   (0UL)                     /*!< ADC SWT: SWT (Bit 0)                                  */
+#define ADC_SWT_SWT_Msk                   (0xffUL)                  /*!< ADC SWT: SWT (Bitfield-Mask: 0xff)                    */
+/* ========================================================  SL0CFG  ========================================================= */
+#define ADC_SL0CFG_ADSEL0_Pos             (24UL)                    /*!< ADC SL0CFG: ADSEL0 (Bit 24)                           */
+#define ADC_SL0CFG_ADSEL0_Msk             (0x7000000UL)             /*!< ADC SL0CFG: ADSEL0 (Bitfield-Mask: 0x07)              */
+#define ADC_SL0CFG_PRMODE0_Pos            (16UL)                    /*!< ADC SL0CFG: PRMODE0 (Bit 16)                          */
+#define ADC_SL0CFG_PRMODE0_Msk            (0x30000UL)               /*!< ADC SL0CFG: PRMODE0 (Bitfield-Mask: 0x03)             */
+#define ADC_SL0CFG_CHSEL0_Pos             (8UL)                     /*!< ADC SL0CFG: CHSEL0 (Bit 8)                            */
+#define ADC_SL0CFG_CHSEL0_Msk             (0xf00UL)                 /*!< ADC SL0CFG: CHSEL0 (Bitfield-Mask: 0x0f)              */
+#define ADC_SL0CFG_WCEN0_Pos              (1UL)                     /*!< ADC SL0CFG: WCEN0 (Bit 1)                             */
+#define ADC_SL0CFG_WCEN0_Msk              (0x2UL)                   /*!< ADC SL0CFG: WCEN0 (Bitfield-Mask: 0x01)               */
+#define ADC_SL0CFG_SLEN0_Pos              (0UL)                     /*!< ADC SL0CFG: SLEN0 (Bit 0)                             */
+#define ADC_SL0CFG_SLEN0_Msk              (0x1UL)                   /*!< ADC SL0CFG: SLEN0 (Bitfield-Mask: 0x01)               */
+/* ========================================================  SL1CFG  ========================================================= */
+#define ADC_SL1CFG_ADSEL1_Pos             (24UL)                    /*!< ADC SL1CFG: ADSEL1 (Bit 24)                           */
+#define ADC_SL1CFG_ADSEL1_Msk             (0x7000000UL)             /*!< ADC SL1CFG: ADSEL1 (Bitfield-Mask: 0x07)              */
+#define ADC_SL1CFG_PRMODE1_Pos            (16UL)                    /*!< ADC SL1CFG: PRMODE1 (Bit 16)                          */
+#define ADC_SL1CFG_PRMODE1_Msk            (0x30000UL)               /*!< ADC SL1CFG: PRMODE1 (Bitfield-Mask: 0x03)             */
+#define ADC_SL1CFG_CHSEL1_Pos             (8UL)                     /*!< ADC SL1CFG: CHSEL1 (Bit 8)                            */
+#define ADC_SL1CFG_CHSEL1_Msk             (0xf00UL)                 /*!< ADC SL1CFG: CHSEL1 (Bitfield-Mask: 0x0f)              */
+#define ADC_SL1CFG_WCEN1_Pos              (1UL)                     /*!< ADC SL1CFG: WCEN1 (Bit 1)                             */
+#define ADC_SL1CFG_WCEN1_Msk              (0x2UL)                   /*!< ADC SL1CFG: WCEN1 (Bitfield-Mask: 0x01)               */
+#define ADC_SL1CFG_SLEN1_Pos              (0UL)                     /*!< ADC SL1CFG: SLEN1 (Bit 0)                             */
+#define ADC_SL1CFG_SLEN1_Msk              (0x1UL)                   /*!< ADC SL1CFG: SLEN1 (Bitfield-Mask: 0x01)               */
+/* ========================================================  SL2CFG  ========================================================= */
+#define ADC_SL2CFG_ADSEL2_Pos             (24UL)                    /*!< ADC SL2CFG: ADSEL2 (Bit 24)                           */
+#define ADC_SL2CFG_ADSEL2_Msk             (0x7000000UL)             /*!< ADC SL2CFG: ADSEL2 (Bitfield-Mask: 0x07)              */
+#define ADC_SL2CFG_PRMODE2_Pos            (16UL)                    /*!< ADC SL2CFG: PRMODE2 (Bit 16)                          */
+#define ADC_SL2CFG_PRMODE2_Msk            (0x30000UL)               /*!< ADC SL2CFG: PRMODE2 (Bitfield-Mask: 0x03)             */
+#define ADC_SL2CFG_CHSEL2_Pos             (8UL)                     /*!< ADC SL2CFG: CHSEL2 (Bit 8)                            */
+#define ADC_SL2CFG_CHSEL2_Msk             (0xf00UL)                 /*!< ADC SL2CFG: CHSEL2 (Bitfield-Mask: 0x0f)              */
+#define ADC_SL2CFG_WCEN2_Pos              (1UL)                     /*!< ADC SL2CFG: WCEN2 (Bit 1)                             */
+#define ADC_SL2CFG_WCEN2_Msk              (0x2UL)                   /*!< ADC SL2CFG: WCEN2 (Bitfield-Mask: 0x01)               */
+#define ADC_SL2CFG_SLEN2_Pos              (0UL)                     /*!< ADC SL2CFG: SLEN2 (Bit 0)                             */
+#define ADC_SL2CFG_SLEN2_Msk              (0x1UL)                   /*!< ADC SL2CFG: SLEN2 (Bitfield-Mask: 0x01)               */
+/* ========================================================  SL3CFG  ========================================================= */
+#define ADC_SL3CFG_ADSEL3_Pos             (24UL)                    /*!< ADC SL3CFG: ADSEL3 (Bit 24)                           */
+#define ADC_SL3CFG_ADSEL3_Msk             (0x7000000UL)             /*!< ADC SL3CFG: ADSEL3 (Bitfield-Mask: 0x07)              */
+#define ADC_SL3CFG_PRMODE3_Pos            (16UL)                    /*!< ADC SL3CFG: PRMODE3 (Bit 16)                          */
+#define ADC_SL3CFG_PRMODE3_Msk            (0x30000UL)               /*!< ADC SL3CFG: PRMODE3 (Bitfield-Mask: 0x03)             */
+#define ADC_SL3CFG_CHSEL3_Pos             (8UL)                     /*!< ADC SL3CFG: CHSEL3 (Bit 8)                            */
+#define ADC_SL3CFG_CHSEL3_Msk             (0xf00UL)                 /*!< ADC SL3CFG: CHSEL3 (Bitfield-Mask: 0x0f)              */
+#define ADC_SL3CFG_WCEN3_Pos              (1UL)                     /*!< ADC SL3CFG: WCEN3 (Bit 1)                             */
+#define ADC_SL3CFG_WCEN3_Msk              (0x2UL)                   /*!< ADC SL3CFG: WCEN3 (Bitfield-Mask: 0x01)               */
+#define ADC_SL3CFG_SLEN3_Pos              (0UL)                     /*!< ADC SL3CFG: SLEN3 (Bit 0)                             */
+#define ADC_SL3CFG_SLEN3_Msk              (0x1UL)                   /*!< ADC SL3CFG: SLEN3 (Bitfield-Mask: 0x01)               */
+/* ========================================================  SL4CFG  ========================================================= */
+#define ADC_SL4CFG_ADSEL4_Pos             (24UL)                    /*!< ADC SL4CFG: ADSEL4 (Bit 24)                           */
+#define ADC_SL4CFG_ADSEL4_Msk             (0x7000000UL)             /*!< ADC SL4CFG: ADSEL4 (Bitfield-Mask: 0x07)              */
+#define ADC_SL4CFG_PRMODE4_Pos            (16UL)                    /*!< ADC SL4CFG: PRMODE4 (Bit 16)                          */
+#define ADC_SL4CFG_PRMODE4_Msk            (0x30000UL)               /*!< ADC SL4CFG: PRMODE4 (Bitfield-Mask: 0x03)             */
+#define ADC_SL4CFG_CHSEL4_Pos             (8UL)                     /*!< ADC SL4CFG: CHSEL4 (Bit 8)                            */
+#define ADC_SL4CFG_CHSEL4_Msk             (0xf00UL)                 /*!< ADC SL4CFG: CHSEL4 (Bitfield-Mask: 0x0f)              */
+#define ADC_SL4CFG_WCEN4_Pos              (1UL)                     /*!< ADC SL4CFG: WCEN4 (Bit 1)                             */
+#define ADC_SL4CFG_WCEN4_Msk              (0x2UL)                   /*!< ADC SL4CFG: WCEN4 (Bitfield-Mask: 0x01)               */
+#define ADC_SL4CFG_SLEN4_Pos              (0UL)                     /*!< ADC SL4CFG: SLEN4 (Bit 0)                             */
+#define ADC_SL4CFG_SLEN4_Msk              (0x1UL)                   /*!< ADC SL4CFG: SLEN4 (Bitfield-Mask: 0x01)               */
+/* ========================================================  SL5CFG  ========================================================= */
+#define ADC_SL5CFG_ADSEL5_Pos             (24UL)                    /*!< ADC SL5CFG: ADSEL5 (Bit 24)                           */
+#define ADC_SL5CFG_ADSEL5_Msk             (0x7000000UL)             /*!< ADC SL5CFG: ADSEL5 (Bitfield-Mask: 0x07)              */
+#define ADC_SL5CFG_PRMODE5_Pos            (16UL)                    /*!< ADC SL5CFG: PRMODE5 (Bit 16)                          */
+#define ADC_SL5CFG_PRMODE5_Msk            (0x30000UL)               /*!< ADC SL5CFG: PRMODE5 (Bitfield-Mask: 0x03)             */
+#define ADC_SL5CFG_CHSEL5_Pos             (8UL)                     /*!< ADC SL5CFG: CHSEL5 (Bit 8)                            */
+#define ADC_SL5CFG_CHSEL5_Msk             (0xf00UL)                 /*!< ADC SL5CFG: CHSEL5 (Bitfield-Mask: 0x0f)              */
+#define ADC_SL5CFG_WCEN5_Pos              (1UL)                     /*!< ADC SL5CFG: WCEN5 (Bit 1)                             */
+#define ADC_SL5CFG_WCEN5_Msk              (0x2UL)                   /*!< ADC SL5CFG: WCEN5 (Bitfield-Mask: 0x01)               */
+#define ADC_SL5CFG_SLEN5_Pos              (0UL)                     /*!< ADC SL5CFG: SLEN5 (Bit 0)                             */
+#define ADC_SL5CFG_SLEN5_Msk              (0x1UL)                   /*!< ADC SL5CFG: SLEN5 (Bitfield-Mask: 0x01)               */
+/* ========================================================  SL6CFG  ========================================================= */
+#define ADC_SL6CFG_ADSEL6_Pos             (24UL)                    /*!< ADC SL6CFG: ADSEL6 (Bit 24)                           */
+#define ADC_SL6CFG_ADSEL6_Msk             (0x7000000UL)             /*!< ADC SL6CFG: ADSEL6 (Bitfield-Mask: 0x07)              */
+#define ADC_SL6CFG_PRMODE6_Pos            (16UL)                    /*!< ADC SL6CFG: PRMODE6 (Bit 16)                          */
+#define ADC_SL6CFG_PRMODE6_Msk            (0x30000UL)               /*!< ADC SL6CFG: PRMODE6 (Bitfield-Mask: 0x03)             */
+#define ADC_SL6CFG_CHSEL6_Pos             (8UL)                     /*!< ADC SL6CFG: CHSEL6 (Bit 8)                            */
+#define ADC_SL6CFG_CHSEL6_Msk             (0xf00UL)                 /*!< ADC SL6CFG: CHSEL6 (Bitfield-Mask: 0x0f)              */
+#define ADC_SL6CFG_WCEN6_Pos              (1UL)                     /*!< ADC SL6CFG: WCEN6 (Bit 1)                             */
+#define ADC_SL6CFG_WCEN6_Msk              (0x2UL)                   /*!< ADC SL6CFG: WCEN6 (Bitfield-Mask: 0x01)               */
+#define ADC_SL6CFG_SLEN6_Pos              (0UL)                     /*!< ADC SL6CFG: SLEN6 (Bit 0)                             */
+#define ADC_SL6CFG_SLEN6_Msk              (0x1UL)                   /*!< ADC SL6CFG: SLEN6 (Bitfield-Mask: 0x01)               */
+/* ========================================================  SL7CFG  ========================================================= */
+#define ADC_SL7CFG_ADSEL7_Pos             (24UL)                    /*!< ADC SL7CFG: ADSEL7 (Bit 24)                           */
+#define ADC_SL7CFG_ADSEL7_Msk             (0x7000000UL)             /*!< ADC SL7CFG: ADSEL7 (Bitfield-Mask: 0x07)              */
+#define ADC_SL7CFG_PRMODE7_Pos            (16UL)                    /*!< ADC SL7CFG: PRMODE7 (Bit 16)                          */
+#define ADC_SL7CFG_PRMODE7_Msk            (0x30000UL)               /*!< ADC SL7CFG: PRMODE7 (Bitfield-Mask: 0x03)             */
+#define ADC_SL7CFG_CHSEL7_Pos             (8UL)                     /*!< ADC SL7CFG: CHSEL7 (Bit 8)                            */
+#define ADC_SL7CFG_CHSEL7_Msk             (0xf00UL)                 /*!< ADC SL7CFG: CHSEL7 (Bitfield-Mask: 0x0f)              */
+#define ADC_SL7CFG_WCEN7_Pos              (1UL)                     /*!< ADC SL7CFG: WCEN7 (Bit 1)                             */
+#define ADC_SL7CFG_WCEN7_Msk              (0x2UL)                   /*!< ADC SL7CFG: WCEN7 (Bitfield-Mask: 0x01)               */
+#define ADC_SL7CFG_SLEN7_Pos              (0UL)                     /*!< ADC SL7CFG: SLEN7 (Bit 0)                             */
+#define ADC_SL7CFG_SLEN7_Msk              (0x1UL)                   /*!< ADC SL7CFG: SLEN7 (Bitfield-Mask: 0x01)               */
+/* =========================================================  WULIM  ========================================================= */
+#define ADC_WULIM_ULIM_Pos                (0UL)                     /*!< ADC WULIM: ULIM (Bit 0)                               */
+#define ADC_WULIM_ULIM_Msk                (0xfffffUL)               /*!< ADC WULIM: ULIM (Bitfield-Mask: 0xfffff)              */
+/* =========================================================  WLLIM  ========================================================= */
+#define ADC_WLLIM_LLIM_Pos                (0UL)                     /*!< ADC WLLIM: LLIM (Bit 0)                               */
+#define ADC_WLLIM_LLIM_Msk                (0xfffffUL)               /*!< ADC WLLIM: LLIM (Bitfield-Mask: 0xfffff)              */
+/* =========================================================  FIFO  ========================================================== */
+#define ADC_FIFO_RSVD_Pos                 (31UL)                    /*!< ADC FIFO: RSVD (Bit 31)                               */
+#define ADC_FIFO_RSVD_Msk                 (0x80000000UL)            /*!< ADC FIFO: RSVD (Bitfield-Mask: 0x01)                  */
+#define ADC_FIFO_SLOTNUM_Pos              (28UL)                    /*!< ADC FIFO: SLOTNUM (Bit 28)                            */
+#define ADC_FIFO_SLOTNUM_Msk              (0x70000000UL)            /*!< ADC FIFO: SLOTNUM (Bitfield-Mask: 0x07)               */
+#define ADC_FIFO_COUNT_Pos                (20UL)                    /*!< ADC FIFO: COUNT (Bit 20)                              */
+#define ADC_FIFO_COUNT_Msk                (0xff00000UL)             /*!< ADC FIFO: COUNT (Bitfield-Mask: 0xff)                 */
+#define ADC_FIFO_DATA_Pos                 (0UL)                     /*!< ADC FIFO: DATA (Bit 0)                                */
+#define ADC_FIFO_DATA_Msk                 (0xfffffUL)               /*!< ADC FIFO: DATA (Bitfield-Mask: 0xfffff)               */
+/* =========================================================  INTEN  ========================================================= */
+#define ADC_INTEN_WCINC_Pos               (5UL)                     /*!< ADC INTEN: WCINC (Bit 5)                              */
+#define ADC_INTEN_WCINC_Msk               (0x20UL)                  /*!< ADC INTEN: WCINC (Bitfield-Mask: 0x01)                */
+#define ADC_INTEN_WCEXC_Pos               (4UL)                     /*!< ADC INTEN: WCEXC (Bit 4)                              */
+#define ADC_INTEN_WCEXC_Msk               (0x10UL)                  /*!< ADC INTEN: WCEXC (Bitfield-Mask: 0x01)                */
+#define ADC_INTEN_FIFOOVR2_Pos            (3UL)                     /*!< ADC INTEN: FIFOOVR2 (Bit 3)                           */
+#define ADC_INTEN_FIFOOVR2_Msk            (0x8UL)                   /*!< ADC INTEN: FIFOOVR2 (Bitfield-Mask: 0x01)             */
+#define ADC_INTEN_FIFOOVR1_Pos            (2UL)                     /*!< ADC INTEN: FIFOOVR1 (Bit 2)                           */
+#define ADC_INTEN_FIFOOVR1_Msk            (0x4UL)                   /*!< ADC INTEN: FIFOOVR1 (Bitfield-Mask: 0x01)             */
+#define ADC_INTEN_SCNCMP_Pos              (1UL)                     /*!< ADC INTEN: SCNCMP (Bit 1)                             */
+#define ADC_INTEN_SCNCMP_Msk              (0x2UL)                   /*!< ADC INTEN: SCNCMP (Bitfield-Mask: 0x01)               */
+#define ADC_INTEN_CNVCMP_Pos              (0UL)                     /*!< ADC INTEN: CNVCMP (Bit 0)                             */
+#define ADC_INTEN_CNVCMP_Msk              (0x1UL)                   /*!< ADC INTEN: CNVCMP (Bitfield-Mask: 0x01)               */
+/* ========================================================  INTSTAT  ======================================================== */
+#define ADC_INTSTAT_WCINC_Pos             (5UL)                     /*!< ADC INTSTAT: WCINC (Bit 5)                            */
+#define ADC_INTSTAT_WCINC_Msk             (0x20UL)                  /*!< ADC INTSTAT: WCINC (Bitfield-Mask: 0x01)              */
+#define ADC_INTSTAT_WCEXC_Pos             (4UL)                     /*!< ADC INTSTAT: WCEXC (Bit 4)                            */
+#define ADC_INTSTAT_WCEXC_Msk             (0x10UL)                  /*!< ADC INTSTAT: WCEXC (Bitfield-Mask: 0x01)              */
+#define ADC_INTSTAT_FIFOOVR2_Pos          (3UL)                     /*!< ADC INTSTAT: FIFOOVR2 (Bit 3)                         */
+#define ADC_INTSTAT_FIFOOVR2_Msk          (0x8UL)                   /*!< ADC INTSTAT: FIFOOVR2 (Bitfield-Mask: 0x01)           */
+#define ADC_INTSTAT_FIFOOVR1_Pos          (2UL)                     /*!< ADC INTSTAT: FIFOOVR1 (Bit 2)                         */
+#define ADC_INTSTAT_FIFOOVR1_Msk          (0x4UL)                   /*!< ADC INTSTAT: FIFOOVR1 (Bitfield-Mask: 0x01)           */
+#define ADC_INTSTAT_SCNCMP_Pos            (1UL)                     /*!< ADC INTSTAT: SCNCMP (Bit 1)                           */
+#define ADC_INTSTAT_SCNCMP_Msk            (0x2UL)                   /*!< ADC INTSTAT: SCNCMP (Bitfield-Mask: 0x01)             */
+#define ADC_INTSTAT_CNVCMP_Pos            (0UL)                     /*!< ADC INTSTAT: CNVCMP (Bit 0)                           */
+#define ADC_INTSTAT_CNVCMP_Msk            (0x1UL)                   /*!< ADC INTSTAT: CNVCMP (Bitfield-Mask: 0x01)             */
+/* ========================================================  INTCLR  ========================================================= */
+#define ADC_INTCLR_WCINC_Pos              (5UL)                     /*!< ADC INTCLR: WCINC (Bit 5)                             */
+#define ADC_INTCLR_WCINC_Msk              (0x20UL)                  /*!< ADC INTCLR: WCINC (Bitfield-Mask: 0x01)               */
+#define ADC_INTCLR_WCEXC_Pos              (4UL)                     /*!< ADC INTCLR: WCEXC (Bit 4)                             */
+#define ADC_INTCLR_WCEXC_Msk              (0x10UL)                  /*!< ADC INTCLR: WCEXC (Bitfield-Mask: 0x01)               */
+#define ADC_INTCLR_FIFOOVR2_Pos           (3UL)                     /*!< ADC INTCLR: FIFOOVR2 (Bit 3)                          */
+#define ADC_INTCLR_FIFOOVR2_Msk           (0x8UL)                   /*!< ADC INTCLR: FIFOOVR2 (Bitfield-Mask: 0x01)            */
+#define ADC_INTCLR_FIFOOVR1_Pos           (2UL)                     /*!< ADC INTCLR: FIFOOVR1 (Bit 2)                          */
+#define ADC_INTCLR_FIFOOVR1_Msk           (0x4UL)                   /*!< ADC INTCLR: FIFOOVR1 (Bitfield-Mask: 0x01)            */
+#define ADC_INTCLR_SCNCMP_Pos             (1UL)                     /*!< ADC INTCLR: SCNCMP (Bit 1)                            */
+#define ADC_INTCLR_SCNCMP_Msk             (0x2UL)                   /*!< ADC INTCLR: SCNCMP (Bitfield-Mask: 0x01)              */
+#define ADC_INTCLR_CNVCMP_Pos             (0UL)                     /*!< ADC INTCLR: CNVCMP (Bit 0)                            */
+#define ADC_INTCLR_CNVCMP_Msk             (0x1UL)                   /*!< ADC INTCLR: CNVCMP (Bitfield-Mask: 0x01)              */
+/* ========================================================  INTSET  ========================================================= */
+#define ADC_INTSET_WCINC_Pos              (5UL)                     /*!< ADC INTSET: WCINC (Bit 5)                             */
+#define ADC_INTSET_WCINC_Msk              (0x20UL)                  /*!< ADC INTSET: WCINC (Bitfield-Mask: 0x01)               */
+#define ADC_INTSET_WCEXC_Pos              (4UL)                     /*!< ADC INTSET: WCEXC (Bit 4)                             */
+#define ADC_INTSET_WCEXC_Msk              (0x10UL)                  /*!< ADC INTSET: WCEXC (Bitfield-Mask: 0x01)               */
+#define ADC_INTSET_FIFOOVR2_Pos           (3UL)                     /*!< ADC INTSET: FIFOOVR2 (Bit 3)                          */
+#define ADC_INTSET_FIFOOVR2_Msk           (0x8UL)                   /*!< ADC INTSET: FIFOOVR2 (Bitfield-Mask: 0x01)            */
+#define ADC_INTSET_FIFOOVR1_Pos           (2UL)                     /*!< ADC INTSET: FIFOOVR1 (Bit 2)                          */
+#define ADC_INTSET_FIFOOVR1_Msk           (0x4UL)                   /*!< ADC INTSET: FIFOOVR1 (Bitfield-Mask: 0x01)            */
+#define ADC_INTSET_SCNCMP_Pos             (1UL)                     /*!< ADC INTSET: SCNCMP (Bit 1)                            */
+#define ADC_INTSET_SCNCMP_Msk             (0x2UL)                   /*!< ADC INTSET: SCNCMP (Bitfield-Mask: 0x01)              */
+#define ADC_INTSET_CNVCMP_Pos             (0UL)                     /*!< ADC INTSET: CNVCMP (Bit 0)                            */
+#define ADC_INTSET_CNVCMP_Msk             (0x1UL)                   /*!< ADC INTSET: CNVCMP (Bitfield-Mask: 0x01)              */
+
+
+/* =========================================================================================================================== */
+/* ================                                         CACHECTRL                                         ================ */
+/* =========================================================================================================================== */
+
+/* =======================================================  CACHECFG  ======================================================== */
+#define CACHECTRL_CACHECFG_ENABLE_MONITOR_Pos (24UL)                /*!< CACHECTRL CACHECFG: ENABLE_MONITOR (Bit 24)           */
+#define CACHECTRL_CACHECFG_ENABLE_MONITOR_Msk (0x1000000UL)         /*!< CACHECTRL CACHECFG: ENABLE_MONITOR (Bitfield-Mask: 0x01) */
+#define CACHECTRL_CACHECFG_DATA_CLKGATE_Pos (20UL)                  /*!< CACHECTRL CACHECFG: DATA_CLKGATE (Bit 20)             */
+#define CACHECTRL_CACHECFG_DATA_CLKGATE_Msk (0x100000UL)            /*!< CACHECTRL CACHECFG: DATA_CLKGATE (Bitfield-Mask: 0x01) */
+#define CACHECTRL_CACHECFG_SMDLY_Pos      (16UL)                    /*!< CACHECTRL CACHECFG: SMDLY (Bit 16)                    */
+#define CACHECTRL_CACHECFG_SMDLY_Msk      (0xf0000UL)               /*!< CACHECTRL CACHECFG: SMDLY (Bitfield-Mask: 0x0f)       */
+#define CACHECTRL_CACHECFG_DLY_Pos        (12UL)                    /*!< CACHECTRL CACHECFG: DLY (Bit 12)                      */
+#define CACHECTRL_CACHECFG_DLY_Msk        (0xf000UL)                /*!< CACHECTRL CACHECFG: DLY (Bitfield-Mask: 0x0f)         */
+#define CACHECTRL_CACHECFG_CACHE_LS_Pos   (11UL)                    /*!< CACHECTRL CACHECFG: CACHE_LS (Bit 11)                 */
+#define CACHECTRL_CACHECFG_CACHE_LS_Msk   (0x800UL)                 /*!< CACHECTRL CACHECFG: CACHE_LS (Bitfield-Mask: 0x01)    */
+#define CACHECTRL_CACHECFG_CACHE_CLKGATE_Pos (10UL)                 /*!< CACHECTRL CACHECFG: CACHE_CLKGATE (Bit 10)            */
+#define CACHECTRL_CACHECFG_CACHE_CLKGATE_Msk (0x400UL)              /*!< CACHECTRL CACHECFG: CACHE_CLKGATE (Bitfield-Mask: 0x01) */
+#define CACHECTRL_CACHECFG_DCACHE_ENABLE_Pos (9UL)                  /*!< CACHECTRL CACHECFG: DCACHE_ENABLE (Bit 9)             */
+#define CACHECTRL_CACHECFG_DCACHE_ENABLE_Msk (0x200UL)              /*!< CACHECTRL CACHECFG: DCACHE_ENABLE (Bitfield-Mask: 0x01) */
+#define CACHECTRL_CACHECFG_ICACHE_ENABLE_Pos (8UL)                  /*!< CACHECTRL CACHECFG: ICACHE_ENABLE (Bit 8)             */
+#define CACHECTRL_CACHECFG_ICACHE_ENABLE_Msk (0x100UL)              /*!< CACHECTRL CACHECFG: ICACHE_ENABLE (Bitfield-Mask: 0x01) */
+#define CACHECTRL_CACHECFG_SERIAL_Pos     (7UL)                     /*!< CACHECTRL CACHECFG: SERIAL (Bit 7)                    */
+#define CACHECTRL_CACHECFG_SERIAL_Msk     (0x80UL)                  /*!< CACHECTRL CACHECFG: SERIAL (Bitfield-Mask: 0x01)      */
+#define CACHECTRL_CACHECFG_CONFIG_Pos     (4UL)                     /*!< CACHECTRL CACHECFG: CONFIG (Bit 4)                    */
+#define CACHECTRL_CACHECFG_CONFIG_Msk     (0x70UL)                  /*!< CACHECTRL CACHECFG: CONFIG (Bitfield-Mask: 0x07)      */
+#define CACHECTRL_CACHECFG_ENABLE_NC1_Pos (3UL)                     /*!< CACHECTRL CACHECFG: ENABLE_NC1 (Bit 3)                */
+#define CACHECTRL_CACHECFG_ENABLE_NC1_Msk (0x8UL)                   /*!< CACHECTRL CACHECFG: ENABLE_NC1 (Bitfield-Mask: 0x01)  */
+#define CACHECTRL_CACHECFG_ENABLE_NC0_Pos (2UL)                     /*!< CACHECTRL CACHECFG: ENABLE_NC0 (Bit 2)                */
+#define CACHECTRL_CACHECFG_ENABLE_NC0_Msk (0x4UL)                   /*!< CACHECTRL CACHECFG: ENABLE_NC0 (Bitfield-Mask: 0x01)  */
+#define CACHECTRL_CACHECFG_LRU_Pos        (1UL)                     /*!< CACHECTRL CACHECFG: LRU (Bit 1)                       */
+#define CACHECTRL_CACHECFG_LRU_Msk        (0x2UL)                   /*!< CACHECTRL CACHECFG: LRU (Bitfield-Mask: 0x01)         */
+#define CACHECTRL_CACHECFG_ENABLE_Pos     (0UL)                     /*!< CACHECTRL CACHECFG: ENABLE (Bit 0)                    */
+#define CACHECTRL_CACHECFG_ENABLE_Msk     (0x1UL)                   /*!< CACHECTRL CACHECFG: ENABLE (Bitfield-Mask: 0x01)      */
+/* =======================================================  FLASHCFG  ======================================================== */
+#define CACHECTRL_FLASHCFG_RD_WAIT_Pos    (0UL)                     /*!< CACHECTRL FLASHCFG: RD_WAIT (Bit 0)                   */
+#define CACHECTRL_FLASHCFG_RD_WAIT_Msk    (0x7UL)                   /*!< CACHECTRL FLASHCFG: RD_WAIT (Bitfield-Mask: 0x07)     */
+/* =======================================================  CACHECTRL  ======================================================= */
+#define CACHECTRL_CACHECTRL_FLASH1_SLM_ENABLE_Pos (10UL)            /*!< CACHECTRL CACHECTRL: FLASH1_SLM_ENABLE (Bit 10)       */
+#define CACHECTRL_CACHECTRL_FLASH1_SLM_ENABLE_Msk (0x400UL)         /*!< CACHECTRL CACHECTRL: FLASH1_SLM_ENABLE (Bitfield-Mask: 0x01) */
+#define CACHECTRL_CACHECTRL_FLASH1_SLM_DISABLE_Pos (9UL)            /*!< CACHECTRL CACHECTRL: FLASH1_SLM_DISABLE (Bit 9)       */
+#define CACHECTRL_CACHECTRL_FLASH1_SLM_DISABLE_Msk (0x200UL)        /*!< CACHECTRL CACHECTRL: FLASH1_SLM_DISABLE (Bitfield-Mask: 0x01) */
+#define CACHECTRL_CACHECTRL_FLASH1_SLM_STATUS_Pos (8UL)             /*!< CACHECTRL CACHECTRL: FLASH1_SLM_STATUS (Bit 8)        */
+#define CACHECTRL_CACHECTRL_FLASH1_SLM_STATUS_Msk (0x100UL)         /*!< CACHECTRL CACHECTRL: FLASH1_SLM_STATUS (Bitfield-Mask: 0x01) */
+#define CACHECTRL_CACHECTRL_FLASH0_SLM_ENABLE_Pos (6UL)             /*!< CACHECTRL CACHECTRL: FLASH0_SLM_ENABLE (Bit 6)        */
+#define CACHECTRL_CACHECTRL_FLASH0_SLM_ENABLE_Msk (0x40UL)          /*!< CACHECTRL CACHECTRL: FLASH0_SLM_ENABLE (Bitfield-Mask: 0x01) */
+#define CACHECTRL_CACHECTRL_FLASH0_SLM_DISABLE_Pos (5UL)            /*!< CACHECTRL CACHECTRL: FLASH0_SLM_DISABLE (Bit 5)       */
+#define CACHECTRL_CACHECTRL_FLASH0_SLM_DISABLE_Msk (0x20UL)         /*!< CACHECTRL CACHECTRL: FLASH0_SLM_DISABLE (Bitfield-Mask: 0x01) */
+#define CACHECTRL_CACHECTRL_FLASH0_SLM_STATUS_Pos (4UL)             /*!< CACHECTRL CACHECTRL: FLASH0_SLM_STATUS (Bit 4)        */
+#define CACHECTRL_CACHECTRL_FLASH0_SLM_STATUS_Msk (0x10UL)          /*!< CACHECTRL CACHECTRL: FLASH0_SLM_STATUS (Bitfield-Mask: 0x01) */
+#define CACHECTRL_CACHECTRL_CACHE_READY_Pos (2UL)                   /*!< CACHECTRL CACHECTRL: CACHE_READY (Bit 2)              */
+#define CACHECTRL_CACHECTRL_CACHE_READY_Msk (0x4UL)                 /*!< CACHECTRL CACHECTRL: CACHE_READY (Bitfield-Mask: 0x01) */
+#define CACHECTRL_CACHECTRL_RESET_STAT_Pos (1UL)                    /*!< CACHECTRL CACHECTRL: RESET_STAT (Bit 1)               */
+#define CACHECTRL_CACHECTRL_RESET_STAT_Msk (0x2UL)                  /*!< CACHECTRL CACHECTRL: RESET_STAT (Bitfield-Mask: 0x01) */
+#define CACHECTRL_CACHECTRL_INVALIDATE_Pos (0UL)                    /*!< CACHECTRL CACHECTRL: INVALIDATE (Bit 0)               */
+#define CACHECTRL_CACHECTRL_INVALIDATE_Msk (0x1UL)                  /*!< CACHECTRL CACHECTRL: INVALIDATE (Bitfield-Mask: 0x01) */
+/* =======================================================  NCR0START  ======================================================= */
+#define CACHECTRL_NCR0START_ADDR_Pos      (4UL)                     /*!< CACHECTRL NCR0START: ADDR (Bit 4)                     */
+#define CACHECTRL_NCR0START_ADDR_Msk      (0xffff0UL)               /*!< CACHECTRL NCR0START: ADDR (Bitfield-Mask: 0xffff)     */
+/* ========================================================  NCR0END  ======================================================== */
+#define CACHECTRL_NCR0END_ADDR_Pos        (4UL)                     /*!< CACHECTRL NCR0END: ADDR (Bit 4)                       */
+#define CACHECTRL_NCR0END_ADDR_Msk        (0xffff0UL)               /*!< CACHECTRL NCR0END: ADDR (Bitfield-Mask: 0xffff)       */
+/* =======================================================  NCR1START  ======================================================= */
+#define CACHECTRL_NCR1START_ADDR_Pos      (4UL)                     /*!< CACHECTRL NCR1START: ADDR (Bit 4)                     */
+#define CACHECTRL_NCR1START_ADDR_Msk      (0xffff0UL)               /*!< CACHECTRL NCR1START: ADDR (Bitfield-Mask: 0xffff)     */
+/* ========================================================  NCR1END  ======================================================== */
+#define CACHECTRL_NCR1END_ADDR_Pos        (4UL)                     /*!< CACHECTRL NCR1END: ADDR (Bit 4)                       */
+#define CACHECTRL_NCR1END_ADDR_Msk        (0xffff0UL)               /*!< CACHECTRL NCR1END: ADDR (Bitfield-Mask: 0xffff)       */
+/* =======================================================  CACHEMODE  ======================================================= */
+#define CACHECTRL_CACHEMODE_THROTTLE6_Pos (5UL)                     /*!< CACHECTRL CACHEMODE: THROTTLE6 (Bit 5)                */
+#define CACHECTRL_CACHEMODE_THROTTLE6_Msk (0x20UL)                  /*!< CACHECTRL CACHEMODE: THROTTLE6 (Bitfield-Mask: 0x01)  */
+#define CACHECTRL_CACHEMODE_THROTTLE5_Pos (4UL)                     /*!< CACHECTRL CACHEMODE: THROTTLE5 (Bit 4)                */
+#define CACHECTRL_CACHEMODE_THROTTLE5_Msk (0x10UL)                  /*!< CACHECTRL CACHEMODE: THROTTLE5 (Bitfield-Mask: 0x01)  */
+#define CACHECTRL_CACHEMODE_THROTTLE4_Pos (3UL)                     /*!< CACHECTRL CACHEMODE: THROTTLE4 (Bit 3)                */
+#define CACHECTRL_CACHEMODE_THROTTLE4_Msk (0x8UL)                   /*!< CACHECTRL CACHEMODE: THROTTLE4 (Bitfield-Mask: 0x01)  */
+#define CACHECTRL_CACHEMODE_THROTTLE3_Pos (2UL)                     /*!< CACHECTRL CACHEMODE: THROTTLE3 (Bit 2)                */
+#define CACHECTRL_CACHEMODE_THROTTLE3_Msk (0x4UL)                   /*!< CACHECTRL CACHEMODE: THROTTLE3 (Bitfield-Mask: 0x01)  */
+#define CACHECTRL_CACHEMODE_THROTTLE2_Pos (1UL)                     /*!< CACHECTRL CACHEMODE: THROTTLE2 (Bit 1)                */
+#define CACHECTRL_CACHEMODE_THROTTLE2_Msk (0x2UL)                   /*!< CACHECTRL CACHEMODE: THROTTLE2 (Bitfield-Mask: 0x01)  */
+#define CACHECTRL_CACHEMODE_THROTTLE1_Pos (0UL)                     /*!< CACHECTRL CACHEMODE: THROTTLE1 (Bit 0)                */
+#define CACHECTRL_CACHEMODE_THROTTLE1_Msk (0x1UL)                   /*!< CACHECTRL CACHEMODE: THROTTLE1 (Bitfield-Mask: 0x01)  */
+/* =========================================================  DMON0  ========================================================= */
+#define CACHECTRL_DMON0_DACCESS_COUNT_Pos (0UL)                     /*!< CACHECTRL DMON0: DACCESS_COUNT (Bit 0)                */
+#define CACHECTRL_DMON0_DACCESS_COUNT_Msk (0xffffffffUL)            /*!< CACHECTRL DMON0: DACCESS_COUNT (Bitfield-Mask: 0xffffffff) */
+/* =========================================================  DMON1  ========================================================= */
+#define CACHECTRL_DMON1_DLOOKUP_COUNT_Pos (0UL)                     /*!< CACHECTRL DMON1: DLOOKUP_COUNT (Bit 0)                */
+#define CACHECTRL_DMON1_DLOOKUP_COUNT_Msk (0xffffffffUL)            /*!< CACHECTRL DMON1: DLOOKUP_COUNT (Bitfield-Mask: 0xffffffff) */
+/* =========================================================  DMON2  ========================================================= */
+#define CACHECTRL_DMON2_DHIT_COUNT_Pos    (0UL)                     /*!< CACHECTRL DMON2: DHIT_COUNT (Bit 0)                   */
+#define CACHECTRL_DMON2_DHIT_COUNT_Msk    (0xffffffffUL)            /*!< CACHECTRL DMON2: DHIT_COUNT (Bitfield-Mask: 0xffffffff) */
+/* =========================================================  DMON3  ========================================================= */
+#define CACHECTRL_DMON3_DLINE_COUNT_Pos   (0UL)                     /*!< CACHECTRL DMON3: DLINE_COUNT (Bit 0)                  */
+#define CACHECTRL_DMON3_DLINE_COUNT_Msk   (0xffffffffUL)            /*!< CACHECTRL DMON3: DLINE_COUNT (Bitfield-Mask: 0xffffffff) */
+/* =========================================================  IMON0  ========================================================= */
+#define CACHECTRL_IMON0_IACCESS_COUNT_Pos (0UL)                     /*!< CACHECTRL IMON0: IACCESS_COUNT (Bit 0)                */
+#define CACHECTRL_IMON0_IACCESS_COUNT_Msk (0xffffffffUL)            /*!< CACHECTRL IMON0: IACCESS_COUNT (Bitfield-Mask: 0xffffffff) */
+/* =========================================================  IMON1  ========================================================= */
+#define CACHECTRL_IMON1_ILOOKUP_COUNT_Pos (0UL)                     /*!< CACHECTRL IMON1: ILOOKUP_COUNT (Bit 0)                */
+#define CACHECTRL_IMON1_ILOOKUP_COUNT_Msk (0xffffffffUL)            /*!< CACHECTRL IMON1: ILOOKUP_COUNT (Bitfield-Mask: 0xffffffff) */
+/* =========================================================  IMON2  ========================================================= */
+#define CACHECTRL_IMON2_IHIT_COUNT_Pos    (0UL)                     /*!< CACHECTRL IMON2: IHIT_COUNT (Bit 0)                   */
+#define CACHECTRL_IMON2_IHIT_COUNT_Msk    (0xffffffffUL)            /*!< CACHECTRL IMON2: IHIT_COUNT (Bitfield-Mask: 0xffffffff) */
+/* =========================================================  IMON3  ========================================================= */
+#define CACHECTRL_IMON3_ILINE_COUNT_Pos   (0UL)                     /*!< CACHECTRL IMON3: ILINE_COUNT (Bit 0)                  */
+#define CACHECTRL_IMON3_ILINE_COUNT_Msk   (0xffffffffUL)            /*!< CACHECTRL IMON3: ILINE_COUNT (Bitfield-Mask: 0xffffffff) */
+
+
+/* =========================================================================================================================== */
+/* ================                                          CTIMER                                           ================ */
+/* =========================================================================================================================== */
+
+/* =========================================================  TMR0  ========================================================== */
+#define CTIMER_TMR0_CTTMRB0_Pos           (16UL)                    /*!< CTIMER TMR0: CTTMRB0 (Bit 16)                         */
+#define CTIMER_TMR0_CTTMRB0_Msk           (0xffff0000UL)            /*!< CTIMER TMR0: CTTMRB0 (Bitfield-Mask: 0xffff)          */
+#define CTIMER_TMR0_CTTMRA0_Pos           (0UL)                     /*!< CTIMER TMR0: CTTMRA0 (Bit 0)                          */
+#define CTIMER_TMR0_CTTMRA0_Msk           (0xffffUL)                /*!< CTIMER TMR0: CTTMRA0 (Bitfield-Mask: 0xffff)          */
+/* ========================================================  CMPRA0  ========================================================= */
+#define CTIMER_CMPRA0_CMPR1A0_Pos         (16UL)                    /*!< CTIMER CMPRA0: CMPR1A0 (Bit 16)                       */
+#define CTIMER_CMPRA0_CMPR1A0_Msk         (0xffff0000UL)            /*!< CTIMER CMPRA0: CMPR1A0 (Bitfield-Mask: 0xffff)        */
+#define CTIMER_CMPRA0_CMPR0A0_Pos         (0UL)                     /*!< CTIMER CMPRA0: CMPR0A0 (Bit 0)                        */
+#define CTIMER_CMPRA0_CMPR0A0_Msk         (0xffffUL)                /*!< CTIMER CMPRA0: CMPR0A0 (Bitfield-Mask: 0xffff)        */
+/* ========================================================  CMPRB0  ========================================================= */
+#define CTIMER_CMPRB0_CMPR1B0_Pos         (16UL)                    /*!< CTIMER CMPRB0: CMPR1B0 (Bit 16)                       */
+#define CTIMER_CMPRB0_CMPR1B0_Msk         (0xffff0000UL)            /*!< CTIMER CMPRB0: CMPR1B0 (Bitfield-Mask: 0xffff)        */
+#define CTIMER_CMPRB0_CMPR0B0_Pos         (0UL)                     /*!< CTIMER CMPRB0: CMPR0B0 (Bit 0)                        */
+#define CTIMER_CMPRB0_CMPR0B0_Msk         (0xffffUL)                /*!< CTIMER CMPRB0: CMPR0B0 (Bitfield-Mask: 0xffff)        */
+/* =========================================================  CTRL0  ========================================================= */
+#define CTIMER_CTRL0_CTLINK0_Pos          (31UL)                    /*!< CTIMER CTRL0: CTLINK0 (Bit 31)                        */
+#define CTIMER_CTRL0_CTLINK0_Msk          (0x80000000UL)            /*!< CTIMER CTRL0: CTLINK0 (Bitfield-Mask: 0x01)           */
+#define CTIMER_CTRL0_TMRB0PE_Pos          (29UL)                    /*!< CTIMER CTRL0: TMRB0PE (Bit 29)                        */
+#define CTIMER_CTRL0_TMRB0PE_Msk          (0x20000000UL)            /*!< CTIMER CTRL0: TMRB0PE (Bitfield-Mask: 0x01)           */
+#define CTIMER_CTRL0_TMRB0POL_Pos         (28UL)                    /*!< CTIMER CTRL0: TMRB0POL (Bit 28)                       */
+#define CTIMER_CTRL0_TMRB0POL_Msk         (0x10000000UL)            /*!< CTIMER CTRL0: TMRB0POL (Bitfield-Mask: 0x01)          */
+#define CTIMER_CTRL0_TMRB0CLR_Pos         (27UL)                    /*!< CTIMER CTRL0: TMRB0CLR (Bit 27)                       */
+#define CTIMER_CTRL0_TMRB0CLR_Msk         (0x8000000UL)             /*!< CTIMER CTRL0: TMRB0CLR (Bitfield-Mask: 0x01)          */
+#define CTIMER_CTRL0_TMRB0IE1_Pos         (26UL)                    /*!< CTIMER CTRL0: TMRB0IE1 (Bit 26)                       */
+#define CTIMER_CTRL0_TMRB0IE1_Msk         (0x4000000UL)             /*!< CTIMER CTRL0: TMRB0IE1 (Bitfield-Mask: 0x01)          */
+#define CTIMER_CTRL0_TMRB0IE0_Pos         (25UL)                    /*!< CTIMER CTRL0: TMRB0IE0 (Bit 25)                       */
+#define CTIMER_CTRL0_TMRB0IE0_Msk         (0x2000000UL)             /*!< CTIMER CTRL0: TMRB0IE0 (Bitfield-Mask: 0x01)          */
+#define CTIMER_CTRL0_TMRB0FN_Pos          (22UL)                    /*!< CTIMER CTRL0: TMRB0FN (Bit 22)                        */
+#define CTIMER_CTRL0_TMRB0FN_Msk          (0x1c00000UL)             /*!< CTIMER CTRL0: TMRB0FN (Bitfield-Mask: 0x07)           */
+#define CTIMER_CTRL0_TMRB0CLK_Pos         (17UL)                    /*!< CTIMER CTRL0: TMRB0CLK (Bit 17)                       */
+#define CTIMER_CTRL0_TMRB0CLK_Msk         (0x3e0000UL)              /*!< CTIMER CTRL0: TMRB0CLK (Bitfield-Mask: 0x1f)          */
+#define CTIMER_CTRL0_TMRB0EN_Pos          (16UL)                    /*!< CTIMER CTRL0: TMRB0EN (Bit 16)                        */
+#define CTIMER_CTRL0_TMRB0EN_Msk          (0x10000UL)               /*!< CTIMER CTRL0: TMRB0EN (Bitfield-Mask: 0x01)           */
+#define CTIMER_CTRL0_TMRA0PE_Pos          (13UL)                    /*!< CTIMER CTRL0: TMRA0PE (Bit 13)                        */
+#define CTIMER_CTRL0_TMRA0PE_Msk          (0x2000UL)                /*!< CTIMER CTRL0: TMRA0PE (Bitfield-Mask: 0x01)           */
+#define CTIMER_CTRL0_TMRA0POL_Pos         (12UL)                    /*!< CTIMER CTRL0: TMRA0POL (Bit 12)                       */
+#define CTIMER_CTRL0_TMRA0POL_Msk         (0x1000UL)                /*!< CTIMER CTRL0: TMRA0POL (Bitfield-Mask: 0x01)          */
+#define CTIMER_CTRL0_TMRA0CLR_Pos         (11UL)                    /*!< CTIMER CTRL0: TMRA0CLR (Bit 11)                       */
+#define CTIMER_CTRL0_TMRA0CLR_Msk         (0x800UL)                 /*!< CTIMER CTRL0: TMRA0CLR (Bitfield-Mask: 0x01)          */
+#define CTIMER_CTRL0_TMRA0IE1_Pos         (10UL)                    /*!< CTIMER CTRL0: TMRA0IE1 (Bit 10)                       */
+#define CTIMER_CTRL0_TMRA0IE1_Msk         (0x400UL)                 /*!< CTIMER CTRL0: TMRA0IE1 (Bitfield-Mask: 0x01)          */
+#define CTIMER_CTRL0_TMRA0IE0_Pos         (9UL)                     /*!< CTIMER CTRL0: TMRA0IE0 (Bit 9)                        */
+#define CTIMER_CTRL0_TMRA0IE0_Msk         (0x200UL)                 /*!< CTIMER CTRL0: TMRA0IE0 (Bitfield-Mask: 0x01)          */
+#define CTIMER_CTRL0_TMRA0FN_Pos          (6UL)                     /*!< CTIMER CTRL0: TMRA0FN (Bit 6)                         */
+#define CTIMER_CTRL0_TMRA0FN_Msk          (0x1c0UL)                 /*!< CTIMER CTRL0: TMRA0FN (Bitfield-Mask: 0x07)           */
+#define CTIMER_CTRL0_TMRA0CLK_Pos         (1UL)                     /*!< CTIMER CTRL0: TMRA0CLK (Bit 1)                        */
+#define CTIMER_CTRL0_TMRA0CLK_Msk         (0x3eUL)                  /*!< CTIMER CTRL0: TMRA0CLK (Bitfield-Mask: 0x1f)          */
+#define CTIMER_CTRL0_TMRA0EN_Pos          (0UL)                     /*!< CTIMER CTRL0: TMRA0EN (Bit 0)                         */
+#define CTIMER_CTRL0_TMRA0EN_Msk          (0x1UL)                   /*!< CTIMER CTRL0: TMRA0EN (Bitfield-Mask: 0x01)           */
+/* =========================================================  TMR1  ========================================================== */
+#define CTIMER_TMR1_CTTMRB1_Pos           (16UL)                    /*!< CTIMER TMR1: CTTMRB1 (Bit 16)                         */
+#define CTIMER_TMR1_CTTMRB1_Msk           (0xffff0000UL)            /*!< CTIMER TMR1: CTTMRB1 (Bitfield-Mask: 0xffff)          */
+#define CTIMER_TMR1_CTTMRA1_Pos           (0UL)                     /*!< CTIMER TMR1: CTTMRA1 (Bit 0)                          */
+#define CTIMER_TMR1_CTTMRA1_Msk           (0xffffUL)                /*!< CTIMER TMR1: CTTMRA1 (Bitfield-Mask: 0xffff)          */
+/* ========================================================  CMPRA1  ========================================================= */
+#define CTIMER_CMPRA1_CMPR1A1_Pos         (16UL)                    /*!< CTIMER CMPRA1: CMPR1A1 (Bit 16)                       */
+#define CTIMER_CMPRA1_CMPR1A1_Msk         (0xffff0000UL)            /*!< CTIMER CMPRA1: CMPR1A1 (Bitfield-Mask: 0xffff)        */
+#define CTIMER_CMPRA1_CMPR0A1_Pos         (0UL)                     /*!< CTIMER CMPRA1: CMPR0A1 (Bit 0)                        */
+#define CTIMER_CMPRA1_CMPR0A1_Msk         (0xffffUL)                /*!< CTIMER CMPRA1: CMPR0A1 (Bitfield-Mask: 0xffff)        */
+/* ========================================================  CMPRB1  ========================================================= */
+#define CTIMER_CMPRB1_CMPR1B1_Pos         (16UL)                    /*!< CTIMER CMPRB1: CMPR1B1 (Bit 16)                       */
+#define CTIMER_CMPRB1_CMPR1B1_Msk         (0xffff0000UL)            /*!< CTIMER CMPRB1: CMPR1B1 (Bitfield-Mask: 0xffff)        */
+#define CTIMER_CMPRB1_CMPR0B1_Pos         (0UL)                     /*!< CTIMER CMPRB1: CMPR0B1 (Bit 0)                        */
+#define CTIMER_CMPRB1_CMPR0B1_Msk         (0xffffUL)                /*!< CTIMER CMPRB1: CMPR0B1 (Bitfield-Mask: 0xffff)        */
+/* =========================================================  CTRL1  ========================================================= */
+#define CTIMER_CTRL1_CTLINK1_Pos          (31UL)                    /*!< CTIMER CTRL1: CTLINK1 (Bit 31)                        */
+#define CTIMER_CTRL1_CTLINK1_Msk          (0x80000000UL)            /*!< CTIMER CTRL1: CTLINK1 (Bitfield-Mask: 0x01)           */
+#define CTIMER_CTRL1_TMRB1PE_Pos          (29UL)                    /*!< CTIMER CTRL1: TMRB1PE (Bit 29)                        */
+#define CTIMER_CTRL1_TMRB1PE_Msk          (0x20000000UL)            /*!< CTIMER CTRL1: TMRB1PE (Bitfield-Mask: 0x01)           */
+#define CTIMER_CTRL1_TMRB1POL_Pos         (28UL)                    /*!< CTIMER CTRL1: TMRB1POL (Bit 28)                       */
+#define CTIMER_CTRL1_TMRB1POL_Msk         (0x10000000UL)            /*!< CTIMER CTRL1: TMRB1POL (Bitfield-Mask: 0x01)          */
+#define CTIMER_CTRL1_TMRB1CLR_Pos         (27UL)                    /*!< CTIMER CTRL1: TMRB1CLR (Bit 27)                       */
+#define CTIMER_CTRL1_TMRB1CLR_Msk         (0x8000000UL)             /*!< CTIMER CTRL1: TMRB1CLR (Bitfield-Mask: 0x01)          */
+#define CTIMER_CTRL1_TMRB1IE1_Pos         (26UL)                    /*!< CTIMER CTRL1: TMRB1IE1 (Bit 26)                       */
+#define CTIMER_CTRL1_TMRB1IE1_Msk         (0x4000000UL)             /*!< CTIMER CTRL1: TMRB1IE1 (Bitfield-Mask: 0x01)          */
+#define CTIMER_CTRL1_TMRB1IE0_Pos         (25UL)                    /*!< CTIMER CTRL1: TMRB1IE0 (Bit 25)                       */
+#define CTIMER_CTRL1_TMRB1IE0_Msk         (0x2000000UL)             /*!< CTIMER CTRL1: TMRB1IE0 (Bitfield-Mask: 0x01)          */
+#define CTIMER_CTRL1_TMRB1FN_Pos          (22UL)                    /*!< CTIMER CTRL1: TMRB1FN (Bit 22)                        */
+#define CTIMER_CTRL1_TMRB1FN_Msk          (0x1c00000UL)             /*!< CTIMER CTRL1: TMRB1FN (Bitfield-Mask: 0x07)           */
+#define CTIMER_CTRL1_TMRB1CLK_Pos         (17UL)                    /*!< CTIMER CTRL1: TMRB1CLK (Bit 17)                       */
+#define CTIMER_CTRL1_TMRB1CLK_Msk         (0x3e0000UL)              /*!< CTIMER CTRL1: TMRB1CLK (Bitfield-Mask: 0x1f)          */
+#define CTIMER_CTRL1_TMRB1EN_Pos          (16UL)                    /*!< CTIMER CTRL1: TMRB1EN (Bit 16)                        */
+#define CTIMER_CTRL1_TMRB1EN_Msk          (0x10000UL)               /*!< CTIMER CTRL1: TMRB1EN (Bitfield-Mask: 0x01)           */
+#define CTIMER_CTRL1_TMRA1PE_Pos          (13UL)                    /*!< CTIMER CTRL1: TMRA1PE (Bit 13)                        */
+#define CTIMER_CTRL1_TMRA1PE_Msk          (0x2000UL)                /*!< CTIMER CTRL1: TMRA1PE (Bitfield-Mask: 0x01)           */
+#define CTIMER_CTRL1_TMRA1POL_Pos         (12UL)                    /*!< CTIMER CTRL1: TMRA1POL (Bit 12)                       */
+#define CTIMER_CTRL1_TMRA1POL_Msk         (0x1000UL)                /*!< CTIMER CTRL1: TMRA1POL (Bitfield-Mask: 0x01)          */
+#define CTIMER_CTRL1_TMRA1CLR_Pos         (11UL)                    /*!< CTIMER CTRL1: TMRA1CLR (Bit 11)                       */
+#define CTIMER_CTRL1_TMRA1CLR_Msk         (0x800UL)                 /*!< CTIMER CTRL1: TMRA1CLR (Bitfield-Mask: 0x01)          */
+#define CTIMER_CTRL1_TMRA1IE1_Pos         (10UL)                    /*!< CTIMER CTRL1: TMRA1IE1 (Bit 10)                       */
+#define CTIMER_CTRL1_TMRA1IE1_Msk         (0x400UL)                 /*!< CTIMER CTRL1: TMRA1IE1 (Bitfield-Mask: 0x01)          */
+#define CTIMER_CTRL1_TMRA1IE0_Pos         (9UL)                     /*!< CTIMER CTRL1: TMRA1IE0 (Bit 9)                        */
+#define CTIMER_CTRL1_TMRA1IE0_Msk         (0x200UL)                 /*!< CTIMER CTRL1: TMRA1IE0 (Bitfield-Mask: 0x01)          */
+#define CTIMER_CTRL1_TMRA1FN_Pos          (6UL)                     /*!< CTIMER CTRL1: TMRA1FN (Bit 6)                         */
+#define CTIMER_CTRL1_TMRA1FN_Msk          (0x1c0UL)                 /*!< CTIMER CTRL1: TMRA1FN (Bitfield-Mask: 0x07)           */
+#define CTIMER_CTRL1_TMRA1CLK_Pos         (1UL)                     /*!< CTIMER CTRL1: TMRA1CLK (Bit 1)                        */
+#define CTIMER_CTRL1_TMRA1CLK_Msk         (0x3eUL)                  /*!< CTIMER CTRL1: TMRA1CLK (Bitfield-Mask: 0x1f)          */
+#define CTIMER_CTRL1_TMRA1EN_Pos          (0UL)                     /*!< CTIMER CTRL1: TMRA1EN (Bit 0)                         */
+#define CTIMER_CTRL1_TMRA1EN_Msk          (0x1UL)                   /*!< CTIMER CTRL1: TMRA1EN (Bitfield-Mask: 0x01)           */
+/* =========================================================  TMR2  ========================================================== */
+#define CTIMER_TMR2_CTTMRB2_Pos           (16UL)                    /*!< CTIMER TMR2: CTTMRB2 (Bit 16)                         */
+#define CTIMER_TMR2_CTTMRB2_Msk           (0xffff0000UL)            /*!< CTIMER TMR2: CTTMRB2 (Bitfield-Mask: 0xffff)          */
+#define CTIMER_TMR2_CTTMRA2_Pos           (0UL)                     /*!< CTIMER TMR2: CTTMRA2 (Bit 0)                          */
+#define CTIMER_TMR2_CTTMRA2_Msk           (0xffffUL)                /*!< CTIMER TMR2: CTTMRA2 (Bitfield-Mask: 0xffff)          */
+/* ========================================================  CMPRA2  ========================================================= */
+#define CTIMER_CMPRA2_CMPR1A2_Pos         (16UL)                    /*!< CTIMER CMPRA2: CMPR1A2 (Bit 16)                       */
+#define CTIMER_CMPRA2_CMPR1A2_Msk         (0xffff0000UL)            /*!< CTIMER CMPRA2: CMPR1A2 (Bitfield-Mask: 0xffff)        */
+#define CTIMER_CMPRA2_CMPR0A2_Pos         (0UL)                     /*!< CTIMER CMPRA2: CMPR0A2 (Bit 0)                        */
+#define CTIMER_CMPRA2_CMPR0A2_Msk         (0xffffUL)                /*!< CTIMER CMPRA2: CMPR0A2 (Bitfield-Mask: 0xffff)        */
+/* ========================================================  CMPRB2  ========================================================= */
+#define CTIMER_CMPRB2_CMPR1B2_Pos         (16UL)                    /*!< CTIMER CMPRB2: CMPR1B2 (Bit 16)                       */
+#define CTIMER_CMPRB2_CMPR1B2_Msk         (0xffff0000UL)            /*!< CTIMER CMPRB2: CMPR1B2 (Bitfield-Mask: 0xffff)        */
+#define CTIMER_CMPRB2_CMPR0B2_Pos         (0UL)                     /*!< CTIMER CMPRB2: CMPR0B2 (Bit 0)                        */
+#define CTIMER_CMPRB2_CMPR0B2_Msk         (0xffffUL)                /*!< CTIMER CMPRB2: CMPR0B2 (Bitfield-Mask: 0xffff)        */
+/* =========================================================  CTRL2  ========================================================= */
+#define CTIMER_CTRL2_CTLINK2_Pos          (31UL)                    /*!< CTIMER CTRL2: CTLINK2 (Bit 31)                        */
+#define CTIMER_CTRL2_CTLINK2_Msk          (0x80000000UL)            /*!< CTIMER CTRL2: CTLINK2 (Bitfield-Mask: 0x01)           */
+#define CTIMER_CTRL2_TMRB2PE_Pos          (29UL)                    /*!< CTIMER CTRL2: TMRB2PE (Bit 29)                        */
+#define CTIMER_CTRL2_TMRB2PE_Msk          (0x20000000UL)            /*!< CTIMER CTRL2: TMRB2PE (Bitfield-Mask: 0x01)           */
+#define CTIMER_CTRL2_TMRB2POL_Pos         (28UL)                    /*!< CTIMER CTRL2: TMRB2POL (Bit 28)                       */
+#define CTIMER_CTRL2_TMRB2POL_Msk         (0x10000000UL)            /*!< CTIMER CTRL2: TMRB2POL (Bitfield-Mask: 0x01)          */
+#define CTIMER_CTRL2_TMRB2CLR_Pos         (27UL)                    /*!< CTIMER CTRL2: TMRB2CLR (Bit 27)                       */
+#define CTIMER_CTRL2_TMRB2CLR_Msk         (0x8000000UL)             /*!< CTIMER CTRL2: TMRB2CLR (Bitfield-Mask: 0x01)          */
+#define CTIMER_CTRL2_TMRB2IE1_Pos         (26UL)                    /*!< CTIMER CTRL2: TMRB2IE1 (Bit 26)                       */
+#define CTIMER_CTRL2_TMRB2IE1_Msk         (0x4000000UL)             /*!< CTIMER CTRL2: TMRB2IE1 (Bitfield-Mask: 0x01)          */
+#define CTIMER_CTRL2_TMRB2IE0_Pos         (25UL)                    /*!< CTIMER CTRL2: TMRB2IE0 (Bit 25)                       */
+#define CTIMER_CTRL2_TMRB2IE0_Msk         (0x2000000UL)             /*!< CTIMER CTRL2: TMRB2IE0 (Bitfield-Mask: 0x01)          */
+#define CTIMER_CTRL2_TMRB2FN_Pos          (22UL)                    /*!< CTIMER CTRL2: TMRB2FN (Bit 22)                        */
+#define CTIMER_CTRL2_TMRB2FN_Msk          (0x1c00000UL)             /*!< CTIMER CTRL2: TMRB2FN (Bitfield-Mask: 0x07)           */
+#define CTIMER_CTRL2_TMRB2CLK_Pos         (17UL)                    /*!< CTIMER CTRL2: TMRB2CLK (Bit 17)                       */
+#define CTIMER_CTRL2_TMRB2CLK_Msk         (0x3e0000UL)              /*!< CTIMER CTRL2: TMRB2CLK (Bitfield-Mask: 0x1f)          */
+#define CTIMER_CTRL2_TMRB2EN_Pos          (16UL)                    /*!< CTIMER CTRL2: TMRB2EN (Bit 16)                        */
+#define CTIMER_CTRL2_TMRB2EN_Msk          (0x10000UL)               /*!< CTIMER CTRL2: TMRB2EN (Bitfield-Mask: 0x01)           */
+#define CTIMER_CTRL2_TMRA2PE_Pos          (13UL)                    /*!< CTIMER CTRL2: TMRA2PE (Bit 13)                        */
+#define CTIMER_CTRL2_TMRA2PE_Msk          (0x2000UL)                /*!< CTIMER CTRL2: TMRA2PE (Bitfield-Mask: 0x01)           */
+#define CTIMER_CTRL2_TMRA2POL_Pos         (12UL)                    /*!< CTIMER CTRL2: TMRA2POL (Bit 12)                       */
+#define CTIMER_CTRL2_TMRA2POL_Msk         (0x1000UL)                /*!< CTIMER CTRL2: TMRA2POL (Bitfield-Mask: 0x01)          */
+#define CTIMER_CTRL2_TMRA2CLR_Pos         (11UL)                    /*!< CTIMER CTRL2: TMRA2CLR (Bit 11)                       */
+#define CTIMER_CTRL2_TMRA2CLR_Msk         (0x800UL)                 /*!< CTIMER CTRL2: TMRA2CLR (Bitfield-Mask: 0x01)          */
+#define CTIMER_CTRL2_TMRA2IE1_Pos         (10UL)                    /*!< CTIMER CTRL2: TMRA2IE1 (Bit 10)                       */
+#define CTIMER_CTRL2_TMRA2IE1_Msk         (0x400UL)                 /*!< CTIMER CTRL2: TMRA2IE1 (Bitfield-Mask: 0x01)          */
+#define CTIMER_CTRL2_TMRA2IE0_Pos         (9UL)                     /*!< CTIMER CTRL2: TMRA2IE0 (Bit 9)                        */
+#define CTIMER_CTRL2_TMRA2IE0_Msk         (0x200UL)                 /*!< CTIMER CTRL2: TMRA2IE0 (Bitfield-Mask: 0x01)          */
+#define CTIMER_CTRL2_TMRA2FN_Pos          (6UL)                     /*!< CTIMER CTRL2: TMRA2FN (Bit 6)                         */
+#define CTIMER_CTRL2_TMRA2FN_Msk          (0x1c0UL)                 /*!< CTIMER CTRL2: TMRA2FN (Bitfield-Mask: 0x07)           */
+#define CTIMER_CTRL2_TMRA2CLK_Pos         (1UL)                     /*!< CTIMER CTRL2: TMRA2CLK (Bit 1)                        */
+#define CTIMER_CTRL2_TMRA2CLK_Msk         (0x3eUL)                  /*!< CTIMER CTRL2: TMRA2CLK (Bitfield-Mask: 0x1f)          */
+#define CTIMER_CTRL2_TMRA2EN_Pos          (0UL)                     /*!< CTIMER CTRL2: TMRA2EN (Bit 0)                         */
+#define CTIMER_CTRL2_TMRA2EN_Msk          (0x1UL)                   /*!< CTIMER CTRL2: TMRA2EN (Bitfield-Mask: 0x01)           */
+/* =========================================================  TMR3  ========================================================== */
+#define CTIMER_TMR3_CTTMRB3_Pos           (16UL)                    /*!< CTIMER TMR3: CTTMRB3 (Bit 16)                         */
+#define CTIMER_TMR3_CTTMRB3_Msk           (0xffff0000UL)            /*!< CTIMER TMR3: CTTMRB3 (Bitfield-Mask: 0xffff)          */
+#define CTIMER_TMR3_CTTMRA3_Pos           (0UL)                     /*!< CTIMER TMR3: CTTMRA3 (Bit 0)                          */
+#define CTIMER_TMR3_CTTMRA3_Msk           (0xffffUL)                /*!< CTIMER TMR3: CTTMRA3 (Bitfield-Mask: 0xffff)          */
+/* ========================================================  CMPRA3  ========================================================= */
+#define CTIMER_CMPRA3_CMPR1A3_Pos         (16UL)                    /*!< CTIMER CMPRA3: CMPR1A3 (Bit 16)                       */
+#define CTIMER_CMPRA3_CMPR1A3_Msk         (0xffff0000UL)            /*!< CTIMER CMPRA3: CMPR1A3 (Bitfield-Mask: 0xffff)        */
+#define CTIMER_CMPRA3_CMPR0A3_Pos         (0UL)                     /*!< CTIMER CMPRA3: CMPR0A3 (Bit 0)                        */
+#define CTIMER_CMPRA3_CMPR0A3_Msk         (0xffffUL)                /*!< CTIMER CMPRA3: CMPR0A3 (Bitfield-Mask: 0xffff)        */
+/* ========================================================  CMPRB3  ========================================================= */
+#define CTIMER_CMPRB3_CMPR1B3_Pos         (16UL)                    /*!< CTIMER CMPRB3: CMPR1B3 (Bit 16)                       */
+#define CTIMER_CMPRB3_CMPR1B3_Msk         (0xffff0000UL)            /*!< CTIMER CMPRB3: CMPR1B3 (Bitfield-Mask: 0xffff)        */
+#define CTIMER_CMPRB3_CMPR0B3_Pos         (0UL)                     /*!< CTIMER CMPRB3: CMPR0B3 (Bit 0)                        */
+#define CTIMER_CMPRB3_CMPR0B3_Msk         (0xffffUL)                /*!< CTIMER CMPRB3: CMPR0B3 (Bitfield-Mask: 0xffff)        */
+/* =========================================================  CTRL3  ========================================================= */
+#define CTIMER_CTRL3_CTLINK3_Pos          (31UL)                    /*!< CTIMER CTRL3: CTLINK3 (Bit 31)                        */
+#define CTIMER_CTRL3_CTLINK3_Msk          (0x80000000UL)            /*!< CTIMER CTRL3: CTLINK3 (Bitfield-Mask: 0x01)           */
+#define CTIMER_CTRL3_TMRB3PE_Pos          (29UL)                    /*!< CTIMER CTRL3: TMRB3PE (Bit 29)                        */
+#define CTIMER_CTRL3_TMRB3PE_Msk          (0x20000000UL)            /*!< CTIMER CTRL3: TMRB3PE (Bitfield-Mask: 0x01)           */
+#define CTIMER_CTRL3_TMRB3POL_Pos         (28UL)                    /*!< CTIMER CTRL3: TMRB3POL (Bit 28)                       */
+#define CTIMER_CTRL3_TMRB3POL_Msk         (0x10000000UL)            /*!< CTIMER CTRL3: TMRB3POL (Bitfield-Mask: 0x01)          */
+#define CTIMER_CTRL3_TMRB3CLR_Pos         (27UL)                    /*!< CTIMER CTRL3: TMRB3CLR (Bit 27)                       */
+#define CTIMER_CTRL3_TMRB3CLR_Msk         (0x8000000UL)             /*!< CTIMER CTRL3: TMRB3CLR (Bitfield-Mask: 0x01)          */
+#define CTIMER_CTRL3_TMRB3IE1_Pos         (26UL)                    /*!< CTIMER CTRL3: TMRB3IE1 (Bit 26)                       */
+#define CTIMER_CTRL3_TMRB3IE1_Msk         (0x4000000UL)             /*!< CTIMER CTRL3: TMRB3IE1 (Bitfield-Mask: 0x01)          */
+#define CTIMER_CTRL3_TMRB3IE0_Pos         (25UL)                    /*!< CTIMER CTRL3: TMRB3IE0 (Bit 25)                       */
+#define CTIMER_CTRL3_TMRB3IE0_Msk         (0x2000000UL)             /*!< CTIMER CTRL3: TMRB3IE0 (Bitfield-Mask: 0x01)          */
+#define CTIMER_CTRL3_TMRB3FN_Pos          (22UL)                    /*!< CTIMER CTRL3: TMRB3FN (Bit 22)                        */
+#define CTIMER_CTRL3_TMRB3FN_Msk          (0x1c00000UL)             /*!< CTIMER CTRL3: TMRB3FN (Bitfield-Mask: 0x07)           */
+#define CTIMER_CTRL3_TMRB3CLK_Pos         (17UL)                    /*!< CTIMER CTRL3: TMRB3CLK (Bit 17)                       */
+#define CTIMER_CTRL3_TMRB3CLK_Msk         (0x3e0000UL)              /*!< CTIMER CTRL3: TMRB3CLK (Bitfield-Mask: 0x1f)          */
+#define CTIMER_CTRL3_TMRB3EN_Pos          (16UL)                    /*!< CTIMER CTRL3: TMRB3EN (Bit 16)                        */
+#define CTIMER_CTRL3_TMRB3EN_Msk          (0x10000UL)               /*!< CTIMER CTRL3: TMRB3EN (Bitfield-Mask: 0x01)           */
+#define CTIMER_CTRL3_ADCEN_Pos            (15UL)                    /*!< CTIMER CTRL3: ADCEN (Bit 15)                          */
+#define CTIMER_CTRL3_ADCEN_Msk            (0x8000UL)                /*!< CTIMER CTRL3: ADCEN (Bitfield-Mask: 0x01)             */
+#define CTIMER_CTRL3_TMRA3PE_Pos          (13UL)                    /*!< CTIMER CTRL3: TMRA3PE (Bit 13)                        */
+#define CTIMER_CTRL3_TMRA3PE_Msk          (0x2000UL)                /*!< CTIMER CTRL3: TMRA3PE (Bitfield-Mask: 0x01)           */
+#define CTIMER_CTRL3_TMRA3POL_Pos         (12UL)                    /*!< CTIMER CTRL3: TMRA3POL (Bit 12)                       */
+#define CTIMER_CTRL3_TMRA3POL_Msk         (0x1000UL)                /*!< CTIMER CTRL3: TMRA3POL (Bitfield-Mask: 0x01)          */
+#define CTIMER_CTRL3_TMRA3CLR_Pos         (11UL)                    /*!< CTIMER CTRL3: TMRA3CLR (Bit 11)                       */
+#define CTIMER_CTRL3_TMRA3CLR_Msk         (0x800UL)                 /*!< CTIMER CTRL3: TMRA3CLR (Bitfield-Mask: 0x01)          */
+#define CTIMER_CTRL3_TMRA3IE1_Pos         (10UL)                    /*!< CTIMER CTRL3: TMRA3IE1 (Bit 10)                       */
+#define CTIMER_CTRL3_TMRA3IE1_Msk         (0x400UL)                 /*!< CTIMER CTRL3: TMRA3IE1 (Bitfield-Mask: 0x01)          */
+#define CTIMER_CTRL3_TMRA3IE0_Pos         (9UL)                     /*!< CTIMER CTRL3: TMRA3IE0 (Bit 9)                        */
+#define CTIMER_CTRL3_TMRA3IE0_Msk         (0x200UL)                 /*!< CTIMER CTRL3: TMRA3IE0 (Bitfield-Mask: 0x01)          */
+#define CTIMER_CTRL3_TMRA3FN_Pos          (6UL)                     /*!< CTIMER CTRL3: TMRA3FN (Bit 6)                         */
+#define CTIMER_CTRL3_TMRA3FN_Msk          (0x1c0UL)                 /*!< CTIMER CTRL3: TMRA3FN (Bitfield-Mask: 0x07)           */
+#define CTIMER_CTRL3_TMRA3CLK_Pos         (1UL)                     /*!< CTIMER CTRL3: TMRA3CLK (Bit 1)                        */
+#define CTIMER_CTRL3_TMRA3CLK_Msk         (0x3eUL)                  /*!< CTIMER CTRL3: TMRA3CLK (Bitfield-Mask: 0x1f)          */
+#define CTIMER_CTRL3_TMRA3EN_Pos          (0UL)                     /*!< CTIMER CTRL3: TMRA3EN (Bit 0)                         */
+#define CTIMER_CTRL3_TMRA3EN_Msk          (0x1UL)                   /*!< CTIMER CTRL3: TMRA3EN (Bitfield-Mask: 0x01)           */
+/* =========================================================  STCFG  ========================================================= */
+#define CTIMER_STCFG_FREEZE_Pos           (31UL)                    /*!< CTIMER STCFG: FREEZE (Bit 31)                         */
+#define CTIMER_STCFG_FREEZE_Msk           (0x80000000UL)            /*!< CTIMER STCFG: FREEZE (Bitfield-Mask: 0x01)            */
+#define CTIMER_STCFG_CLEAR_Pos            (30UL)                    /*!< CTIMER STCFG: CLEAR (Bit 30)                          */
+#define CTIMER_STCFG_CLEAR_Msk            (0x40000000UL)            /*!< CTIMER STCFG: CLEAR (Bitfield-Mask: 0x01)             */
+#define CTIMER_STCFG_COMPARE_H_EN_Pos     (15UL)                    /*!< CTIMER STCFG: COMPARE_H_EN (Bit 15)                   */
+#define CTIMER_STCFG_COMPARE_H_EN_Msk     (0x8000UL)                /*!< CTIMER STCFG: COMPARE_H_EN (Bitfield-Mask: 0x01)      */
+#define CTIMER_STCFG_COMPARE_G_EN_Pos     (14UL)                    /*!< CTIMER STCFG: COMPARE_G_EN (Bit 14)                   */
+#define CTIMER_STCFG_COMPARE_G_EN_Msk     (0x4000UL)                /*!< CTIMER STCFG: COMPARE_G_EN (Bitfield-Mask: 0x01)      */
+#define CTIMER_STCFG_COMPARE_F_EN_Pos     (13UL)                    /*!< CTIMER STCFG: COMPARE_F_EN (Bit 13)                   */
+#define CTIMER_STCFG_COMPARE_F_EN_Msk     (0x2000UL)                /*!< CTIMER STCFG: COMPARE_F_EN (Bitfield-Mask: 0x01)      */
+#define CTIMER_STCFG_COMPARE_E_EN_Pos     (12UL)                    /*!< CTIMER STCFG: COMPARE_E_EN (Bit 12)                   */
+#define CTIMER_STCFG_COMPARE_E_EN_Msk     (0x1000UL)                /*!< CTIMER STCFG: COMPARE_E_EN (Bitfield-Mask: 0x01)      */
+#define CTIMER_STCFG_COMPARE_D_EN_Pos     (11UL)                    /*!< CTIMER STCFG: COMPARE_D_EN (Bit 11)                   */
+#define CTIMER_STCFG_COMPARE_D_EN_Msk     (0x800UL)                 /*!< CTIMER STCFG: COMPARE_D_EN (Bitfield-Mask: 0x01)      */
+#define CTIMER_STCFG_COMPARE_C_EN_Pos     (10UL)                    /*!< CTIMER STCFG: COMPARE_C_EN (Bit 10)                   */
+#define CTIMER_STCFG_COMPARE_C_EN_Msk     (0x400UL)                 /*!< CTIMER STCFG: COMPARE_C_EN (Bitfield-Mask: 0x01)      */
+#define CTIMER_STCFG_COMPARE_B_EN_Pos     (9UL)                     /*!< CTIMER STCFG: COMPARE_B_EN (Bit 9)                    */
+#define CTIMER_STCFG_COMPARE_B_EN_Msk     (0x200UL)                 /*!< CTIMER STCFG: COMPARE_B_EN (Bitfield-Mask: 0x01)      */
+#define CTIMER_STCFG_COMPARE_A_EN_Pos     (8UL)                     /*!< CTIMER STCFG: COMPARE_A_EN (Bit 8)                    */
+#define CTIMER_STCFG_COMPARE_A_EN_Msk     (0x100UL)                 /*!< CTIMER STCFG: COMPARE_A_EN (Bitfield-Mask: 0x01)      */
+#define CTIMER_STCFG_CLKSEL_Pos           (0UL)                     /*!< CTIMER STCFG: CLKSEL (Bit 0)                          */
+#define CTIMER_STCFG_CLKSEL_Msk           (0xfUL)                   /*!< CTIMER STCFG: CLKSEL (Bitfield-Mask: 0x0f)            */
+/* =========================================================  STTMR  ========================================================= */
+#define CTIMER_STTMR_VALUE_Pos            (0UL)                     /*!< CTIMER STTMR: VALUE (Bit 0)                           */
+#define CTIMER_STTMR_VALUE_Msk            (0xffffffffUL)            /*!< CTIMER STTMR: VALUE (Bitfield-Mask: 0xffffffff)       */
+/* ====================================================  CAPTURE_CONTROL  ==================================================== */
+#define CTIMER_CAPTURE_CONTROL_CAPTURE_D_Pos (3UL)                  /*!< CTIMER CAPTURE_CONTROL: CAPTURE_D (Bit 3)             */
+#define CTIMER_CAPTURE_CONTROL_CAPTURE_D_Msk (0x8UL)                /*!< CTIMER CAPTURE_CONTROL: CAPTURE_D (Bitfield-Mask: 0x01) */
+#define CTIMER_CAPTURE_CONTROL_CAPTURE_C_Pos (2UL)                  /*!< CTIMER CAPTURE_CONTROL: CAPTURE_C (Bit 2)             */
+#define CTIMER_CAPTURE_CONTROL_CAPTURE_C_Msk (0x4UL)                /*!< CTIMER CAPTURE_CONTROL: CAPTURE_C (Bitfield-Mask: 0x01) */
+#define CTIMER_CAPTURE_CONTROL_CAPTURE_B_Pos (1UL)                  /*!< CTIMER CAPTURE_CONTROL: CAPTURE_B (Bit 1)             */
+#define CTIMER_CAPTURE_CONTROL_CAPTURE_B_Msk (0x2UL)                /*!< CTIMER CAPTURE_CONTROL: CAPTURE_B (Bitfield-Mask: 0x01) */
+#define CTIMER_CAPTURE_CONTROL_CAPTURE_A_Pos (0UL)                  /*!< CTIMER CAPTURE_CONTROL: CAPTURE_A (Bit 0)             */
+#define CTIMER_CAPTURE_CONTROL_CAPTURE_A_Msk (0x1UL)                /*!< CTIMER CAPTURE_CONTROL: CAPTURE_A (Bitfield-Mask: 0x01) */
+/* ========================================================  SCMPR0  ========================================================= */
+#define CTIMER_SCMPR0_VALUE_Pos           (0UL)                     /*!< CTIMER SCMPR0: VALUE (Bit 0)                          */
+#define CTIMER_SCMPR0_VALUE_Msk           (0xffffffffUL)            /*!< CTIMER SCMPR0: VALUE (Bitfield-Mask: 0xffffffff)      */
+/* ========================================================  SCMPR1  ========================================================= */
+#define CTIMER_SCMPR1_VALUE_Pos           (0UL)                     /*!< CTIMER SCMPR1: VALUE (Bit 0)                          */
+#define CTIMER_SCMPR1_VALUE_Msk           (0xffffffffUL)            /*!< CTIMER SCMPR1: VALUE (Bitfield-Mask: 0xffffffff)      */
+/* ========================================================  SCMPR2  ========================================================= */
+#define CTIMER_SCMPR2_VALUE_Pos           (0UL)                     /*!< CTIMER SCMPR2: VALUE (Bit 0)                          */
+#define CTIMER_SCMPR2_VALUE_Msk           (0xffffffffUL)            /*!< CTIMER SCMPR2: VALUE (Bitfield-Mask: 0xffffffff)      */
+/* ========================================================  SCMPR3  ========================================================= */
+#define CTIMER_SCMPR3_VALUE_Pos           (0UL)                     /*!< CTIMER SCMPR3: VALUE (Bit 0)                          */
+#define CTIMER_SCMPR3_VALUE_Msk           (0xffffffffUL)            /*!< CTIMER SCMPR3: VALUE (Bitfield-Mask: 0xffffffff)      */
+/* ========================================================  SCMPR4  ========================================================= */
+#define CTIMER_SCMPR4_VALUE_Pos           (0UL)                     /*!< CTIMER SCMPR4: VALUE (Bit 0)                          */
+#define CTIMER_SCMPR4_VALUE_Msk           (0xffffffffUL)            /*!< CTIMER SCMPR4: VALUE (Bitfield-Mask: 0xffffffff)      */
+/* ========================================================  SCMPR5  ========================================================= */
+#define CTIMER_SCMPR5_VALUE_Pos           (0UL)                     /*!< CTIMER SCMPR5: VALUE (Bit 0)                          */
+#define CTIMER_SCMPR5_VALUE_Msk           (0xffffffffUL)            /*!< CTIMER SCMPR5: VALUE (Bitfield-Mask: 0xffffffff)      */
+/* ========================================================  SCMPR6  ========================================================= */
+#define CTIMER_SCMPR6_VALUE_Pos           (0UL)                     /*!< CTIMER SCMPR6: VALUE (Bit 0)                          */
+#define CTIMER_SCMPR6_VALUE_Msk           (0xffffffffUL)            /*!< CTIMER SCMPR6: VALUE (Bitfield-Mask: 0xffffffff)      */
+/* ========================================================  SCMPR7  ========================================================= */
+#define CTIMER_SCMPR7_VALUE_Pos           (0UL)                     /*!< CTIMER SCMPR7: VALUE (Bit 0)                          */
+#define CTIMER_SCMPR7_VALUE_Msk           (0xffffffffUL)            /*!< CTIMER SCMPR7: VALUE (Bitfield-Mask: 0xffffffff)      */
+/* ========================================================  SCAPT0  ========================================================= */
+#define CTIMER_SCAPT0_VALUE_Pos           (0UL)                     /*!< CTIMER SCAPT0: VALUE (Bit 0)                          */
+#define CTIMER_SCAPT0_VALUE_Msk           (0xffffffffUL)            /*!< CTIMER SCAPT0: VALUE (Bitfield-Mask: 0xffffffff)      */
+/* ========================================================  SCAPT1  ========================================================= */
+#define CTIMER_SCAPT1_VALUE_Pos           (0UL)                     /*!< CTIMER SCAPT1: VALUE (Bit 0)                          */
+#define CTIMER_SCAPT1_VALUE_Msk           (0xffffffffUL)            /*!< CTIMER SCAPT1: VALUE (Bitfield-Mask: 0xffffffff)      */
+/* ========================================================  SCAPT2  ========================================================= */
+#define CTIMER_SCAPT2_VALUE_Pos           (0UL)                     /*!< CTIMER SCAPT2: VALUE (Bit 0)                          */
+#define CTIMER_SCAPT2_VALUE_Msk           (0xffffffffUL)            /*!< CTIMER SCAPT2: VALUE (Bitfield-Mask: 0xffffffff)      */
+/* ========================================================  SCAPT3  ========================================================= */
+#define CTIMER_SCAPT3_VALUE_Pos           (0UL)                     /*!< CTIMER SCAPT3: VALUE (Bit 0)                          */
+#define CTIMER_SCAPT3_VALUE_Msk           (0xffffffffUL)            /*!< CTIMER SCAPT3: VALUE (Bitfield-Mask: 0xffffffff)      */
+/* =========================================================  SNVR0  ========================================================= */
+#define CTIMER_SNVR0_VALUE_Pos            (0UL)                     /*!< CTIMER SNVR0: VALUE (Bit 0)                           */
+#define CTIMER_SNVR0_VALUE_Msk            (0xffffffffUL)            /*!< CTIMER SNVR0: VALUE (Bitfield-Mask: 0xffffffff)       */
+/* =========================================================  SNVR1  ========================================================= */
+#define CTIMER_SNVR1_VALUE_Pos            (0UL)                     /*!< CTIMER SNVR1: VALUE (Bit 0)                           */
+#define CTIMER_SNVR1_VALUE_Msk            (0xffffffffUL)            /*!< CTIMER SNVR1: VALUE (Bitfield-Mask: 0xffffffff)       */
+/* =========================================================  SNVR2  ========================================================= */
+#define CTIMER_SNVR2_VALUE_Pos            (0UL)                     /*!< CTIMER SNVR2: VALUE (Bit 0)                           */
+#define CTIMER_SNVR2_VALUE_Msk            (0xffffffffUL)            /*!< CTIMER SNVR2: VALUE (Bitfield-Mask: 0xffffffff)       */
+/* =========================================================  INTEN  ========================================================= */
+#define CTIMER_INTEN_CTMRB3C1INT_Pos      (15UL)                    /*!< CTIMER INTEN: CTMRB3C1INT (Bit 15)                    */
+#define CTIMER_INTEN_CTMRB3C1INT_Msk      (0x8000UL)                /*!< CTIMER INTEN: CTMRB3C1INT (Bitfield-Mask: 0x01)       */
+#define CTIMER_INTEN_CTMRA3C1INT_Pos      (14UL)                    /*!< CTIMER INTEN: CTMRA3C1INT (Bit 14)                    */
+#define CTIMER_INTEN_CTMRA3C1INT_Msk      (0x4000UL)                /*!< CTIMER INTEN: CTMRA3C1INT (Bitfield-Mask: 0x01)       */
+#define CTIMER_INTEN_CTMRB2C1INT_Pos      (13UL)                    /*!< CTIMER INTEN: CTMRB2C1INT (Bit 13)                    */
+#define CTIMER_INTEN_CTMRB2C1INT_Msk      (0x2000UL)                /*!< CTIMER INTEN: CTMRB2C1INT (Bitfield-Mask: 0x01)       */
+#define CTIMER_INTEN_CTMRA2C1INT_Pos      (12UL)                    /*!< CTIMER INTEN: CTMRA2C1INT (Bit 12)                    */
+#define CTIMER_INTEN_CTMRA2C1INT_Msk      (0x1000UL)                /*!< CTIMER INTEN: CTMRA2C1INT (Bitfield-Mask: 0x01)       */
+#define CTIMER_INTEN_CTMRB1C1INT_Pos      (11UL)                    /*!< CTIMER INTEN: CTMRB1C1INT (Bit 11)                    */
+#define CTIMER_INTEN_CTMRB1C1INT_Msk      (0x800UL)                 /*!< CTIMER INTEN: CTMRB1C1INT (Bitfield-Mask: 0x01)       */
+#define CTIMER_INTEN_CTMRA1C1INT_Pos      (10UL)                    /*!< CTIMER INTEN: CTMRA1C1INT (Bit 10)                    */
+#define CTIMER_INTEN_CTMRA1C1INT_Msk      (0x400UL)                 /*!< CTIMER INTEN: CTMRA1C1INT (Bitfield-Mask: 0x01)       */
+#define CTIMER_INTEN_CTMRB0C1INT_Pos      (9UL)                     /*!< CTIMER INTEN: CTMRB0C1INT (Bit 9)                     */
+#define CTIMER_INTEN_CTMRB0C1INT_Msk      (0x200UL)                 /*!< CTIMER INTEN: CTMRB0C1INT (Bitfield-Mask: 0x01)       */
+#define CTIMER_INTEN_CTMRA0C1INT_Pos      (8UL)                     /*!< CTIMER INTEN: CTMRA0C1INT (Bit 8)                     */
+#define CTIMER_INTEN_CTMRA0C1INT_Msk      (0x100UL)                 /*!< CTIMER INTEN: CTMRA0C1INT (Bitfield-Mask: 0x01)       */
+#define CTIMER_INTEN_CTMRB3C0INT_Pos      (7UL)                     /*!< CTIMER INTEN: CTMRB3C0INT (Bit 7)                     */
+#define CTIMER_INTEN_CTMRB3C0INT_Msk      (0x80UL)                  /*!< CTIMER INTEN: CTMRB3C0INT (Bitfield-Mask: 0x01)       */
+#define CTIMER_INTEN_CTMRA3C0INT_Pos      (6UL)                     /*!< CTIMER INTEN: CTMRA3C0INT (Bit 6)                     */
+#define CTIMER_INTEN_CTMRA3C0INT_Msk      (0x40UL)                  /*!< CTIMER INTEN: CTMRA3C0INT (Bitfield-Mask: 0x01)       */
+#define CTIMER_INTEN_CTMRB2C0INT_Pos      (5UL)                     /*!< CTIMER INTEN: CTMRB2C0INT (Bit 5)                     */
+#define CTIMER_INTEN_CTMRB2C0INT_Msk      (0x20UL)                  /*!< CTIMER INTEN: CTMRB2C0INT (Bitfield-Mask: 0x01)       */
+#define CTIMER_INTEN_CTMRA2C0INT_Pos      (4UL)                     /*!< CTIMER INTEN: CTMRA2C0INT (Bit 4)                     */
+#define CTIMER_INTEN_CTMRA2C0INT_Msk      (0x10UL)                  /*!< CTIMER INTEN: CTMRA2C0INT (Bitfield-Mask: 0x01)       */
+#define CTIMER_INTEN_CTMRB1C0INT_Pos      (3UL)                     /*!< CTIMER INTEN: CTMRB1C0INT (Bit 3)                     */
+#define CTIMER_INTEN_CTMRB1C0INT_Msk      (0x8UL)                   /*!< CTIMER INTEN: CTMRB1C0INT (Bitfield-Mask: 0x01)       */
+#define CTIMER_INTEN_CTMRA1C0INT_Pos      (2UL)                     /*!< CTIMER INTEN: CTMRA1C0INT (Bit 2)                     */
+#define CTIMER_INTEN_CTMRA1C0INT_Msk      (0x4UL)                   /*!< CTIMER INTEN: CTMRA1C0INT (Bitfield-Mask: 0x01)       */
+#define CTIMER_INTEN_CTMRB0C0INT_Pos      (1UL)                     /*!< CTIMER INTEN: CTMRB0C0INT (Bit 1)                     */
+#define CTIMER_INTEN_CTMRB0C0INT_Msk      (0x2UL)                   /*!< CTIMER INTEN: CTMRB0C0INT (Bitfield-Mask: 0x01)       */
+#define CTIMER_INTEN_CTMRA0C0INT_Pos      (0UL)                     /*!< CTIMER INTEN: CTMRA0C0INT (Bit 0)                     */
+#define CTIMER_INTEN_CTMRA0C0INT_Msk      (0x1UL)                   /*!< CTIMER INTEN: CTMRA0C0INT (Bitfield-Mask: 0x01)       */
+/* ========================================================  INTSTAT  ======================================================== */
+#define CTIMER_INTSTAT_CTMRB3C1INT_Pos    (15UL)                    /*!< CTIMER INTSTAT: CTMRB3C1INT (Bit 15)                  */
+#define CTIMER_INTSTAT_CTMRB3C1INT_Msk    (0x8000UL)                /*!< CTIMER INTSTAT: CTMRB3C1INT (Bitfield-Mask: 0x01)     */
+#define CTIMER_INTSTAT_CTMRA3C1INT_Pos    (14UL)                    /*!< CTIMER INTSTAT: CTMRA3C1INT (Bit 14)                  */
+#define CTIMER_INTSTAT_CTMRA3C1INT_Msk    (0x4000UL)                /*!< CTIMER INTSTAT: CTMRA3C1INT (Bitfield-Mask: 0x01)     */
+#define CTIMER_INTSTAT_CTMRB2C1INT_Pos    (13UL)                    /*!< CTIMER INTSTAT: CTMRB2C1INT (Bit 13)                  */
+#define CTIMER_INTSTAT_CTMRB2C1INT_Msk    (0x2000UL)                /*!< CTIMER INTSTAT: CTMRB2C1INT (Bitfield-Mask: 0x01)     */
+#define CTIMER_INTSTAT_CTMRA2C1INT_Pos    (12UL)                    /*!< CTIMER INTSTAT: CTMRA2C1INT (Bit 12)                  */
+#define CTIMER_INTSTAT_CTMRA2C1INT_Msk    (0x1000UL)                /*!< CTIMER INTSTAT: CTMRA2C1INT (Bitfield-Mask: 0x01)     */
+#define CTIMER_INTSTAT_CTMRB1C1INT_Pos    (11UL)                    /*!< CTIMER INTSTAT: CTMRB1C1INT (Bit 11)                  */
+#define CTIMER_INTSTAT_CTMRB1C1INT_Msk    (0x800UL)                 /*!< CTIMER INTSTAT: CTMRB1C1INT (Bitfield-Mask: 0x01)     */
+#define CTIMER_INTSTAT_CTMRA1C1INT_Pos    (10UL)                    /*!< CTIMER INTSTAT: CTMRA1C1INT (Bit 10)                  */
+#define CTIMER_INTSTAT_CTMRA1C1INT_Msk    (0x400UL)                 /*!< CTIMER INTSTAT: CTMRA1C1INT (Bitfield-Mask: 0x01)     */
+#define CTIMER_INTSTAT_CTMRB0C1INT_Pos    (9UL)                     /*!< CTIMER INTSTAT: CTMRB0C1INT (Bit 9)                   */
+#define CTIMER_INTSTAT_CTMRB0C1INT_Msk    (0x200UL)                 /*!< CTIMER INTSTAT: CTMRB0C1INT (Bitfield-Mask: 0x01)     */
+#define CTIMER_INTSTAT_CTMRA0C1INT_Pos    (8UL)                     /*!< CTIMER INTSTAT: CTMRA0C1INT (Bit 8)                   */
+#define CTIMER_INTSTAT_CTMRA0C1INT_Msk    (0x100UL)                 /*!< CTIMER INTSTAT: CTMRA0C1INT (Bitfield-Mask: 0x01)     */
+#define CTIMER_INTSTAT_CTMRB3C0INT_Pos    (7UL)                     /*!< CTIMER INTSTAT: CTMRB3C0INT (Bit 7)                   */
+#define CTIMER_INTSTAT_CTMRB3C0INT_Msk    (0x80UL)                  /*!< CTIMER INTSTAT: CTMRB3C0INT (Bitfield-Mask: 0x01)     */
+#define CTIMER_INTSTAT_CTMRA3C0INT_Pos    (6UL)                     /*!< CTIMER INTSTAT: CTMRA3C0INT (Bit 6)                   */
+#define CTIMER_INTSTAT_CTMRA3C0INT_Msk    (0x40UL)                  /*!< CTIMER INTSTAT: CTMRA3C0INT (Bitfield-Mask: 0x01)     */
+#define CTIMER_INTSTAT_CTMRB2C0INT_Pos    (5UL)                     /*!< CTIMER INTSTAT: CTMRB2C0INT (Bit 5)                   */
+#define CTIMER_INTSTAT_CTMRB2C0INT_Msk    (0x20UL)                  /*!< CTIMER INTSTAT: CTMRB2C0INT (Bitfield-Mask: 0x01)     */
+#define CTIMER_INTSTAT_CTMRA2C0INT_Pos    (4UL)                     /*!< CTIMER INTSTAT: CTMRA2C0INT (Bit 4)                   */
+#define CTIMER_INTSTAT_CTMRA2C0INT_Msk    (0x10UL)                  /*!< CTIMER INTSTAT: CTMRA2C0INT (Bitfield-Mask: 0x01)     */
+#define CTIMER_INTSTAT_CTMRB1C0INT_Pos    (3UL)                     /*!< CTIMER INTSTAT: CTMRB1C0INT (Bit 3)                   */
+#define CTIMER_INTSTAT_CTMRB1C0INT_Msk    (0x8UL)                   /*!< CTIMER INTSTAT: CTMRB1C0INT (Bitfield-Mask: 0x01)     */
+#define CTIMER_INTSTAT_CTMRA1C0INT_Pos    (2UL)                     /*!< CTIMER INTSTAT: CTMRA1C0INT (Bit 2)                   */
+#define CTIMER_INTSTAT_CTMRA1C0INT_Msk    (0x4UL)                   /*!< CTIMER INTSTAT: CTMRA1C0INT (Bitfield-Mask: 0x01)     */
+#define CTIMER_INTSTAT_CTMRB0C0INT_Pos    (1UL)                     /*!< CTIMER INTSTAT: CTMRB0C0INT (Bit 1)                   */
+#define CTIMER_INTSTAT_CTMRB0C0INT_Msk    (0x2UL)                   /*!< CTIMER INTSTAT: CTMRB0C0INT (Bitfield-Mask: 0x01)     */
+#define CTIMER_INTSTAT_CTMRA0C0INT_Pos    (0UL)                     /*!< CTIMER INTSTAT: CTMRA0C0INT (Bit 0)                   */
+#define CTIMER_INTSTAT_CTMRA0C0INT_Msk    (0x1UL)                   /*!< CTIMER INTSTAT: CTMRA0C0INT (Bitfield-Mask: 0x01)     */
+/* ========================================================  INTCLR  ========================================================= */
+#define CTIMER_INTCLR_CTMRB3C1INT_Pos     (15UL)                    /*!< CTIMER INTCLR: CTMRB3C1INT (Bit 15)                   */
+#define CTIMER_INTCLR_CTMRB3C1INT_Msk     (0x8000UL)                /*!< CTIMER INTCLR: CTMRB3C1INT (Bitfield-Mask: 0x01)      */
+#define CTIMER_INTCLR_CTMRA3C1INT_Pos     (14UL)                    /*!< CTIMER INTCLR: CTMRA3C1INT (Bit 14)                   */
+#define CTIMER_INTCLR_CTMRA3C1INT_Msk     (0x4000UL)                /*!< CTIMER INTCLR: CTMRA3C1INT (Bitfield-Mask: 0x01)      */
+#define CTIMER_INTCLR_CTMRB2C1INT_Pos     (13UL)                    /*!< CTIMER INTCLR: CTMRB2C1INT (Bit 13)                   */
+#define CTIMER_INTCLR_CTMRB2C1INT_Msk     (0x2000UL)                /*!< CTIMER INTCLR: CTMRB2C1INT (Bitfield-Mask: 0x01)      */
+#define CTIMER_INTCLR_CTMRA2C1INT_Pos     (12UL)                    /*!< CTIMER INTCLR: CTMRA2C1INT (Bit 12)                   */
+#define CTIMER_INTCLR_CTMRA2C1INT_Msk     (0x1000UL)                /*!< CTIMER INTCLR: CTMRA2C1INT (Bitfield-Mask: 0x01)      */
+#define CTIMER_INTCLR_CTMRB1C1INT_Pos     (11UL)                    /*!< CTIMER INTCLR: CTMRB1C1INT (Bit 11)                   */
+#define CTIMER_INTCLR_CTMRB1C1INT_Msk     (0x800UL)                 /*!< CTIMER INTCLR: CTMRB1C1INT (Bitfield-Mask: 0x01)      */
+#define CTIMER_INTCLR_CTMRA1C1INT_Pos     (10UL)                    /*!< CTIMER INTCLR: CTMRA1C1INT (Bit 10)                   */
+#define CTIMER_INTCLR_CTMRA1C1INT_Msk     (0x400UL)                 /*!< CTIMER INTCLR: CTMRA1C1INT (Bitfield-Mask: 0x01)      */
+#define CTIMER_INTCLR_CTMRB0C1INT_Pos     (9UL)                     /*!< CTIMER INTCLR: CTMRB0C1INT (Bit 9)                    */
+#define CTIMER_INTCLR_CTMRB0C1INT_Msk     (0x200UL)                 /*!< CTIMER INTCLR: CTMRB0C1INT (Bitfield-Mask: 0x01)      */
+#define CTIMER_INTCLR_CTMRA0C1INT_Pos     (8UL)                     /*!< CTIMER INTCLR: CTMRA0C1INT (Bit 8)                    */
+#define CTIMER_INTCLR_CTMRA0C1INT_Msk     (0x100UL)                 /*!< CTIMER INTCLR: CTMRA0C1INT (Bitfield-Mask: 0x01)      */
+#define CTIMER_INTCLR_CTMRB3C0INT_Pos     (7UL)                     /*!< CTIMER INTCLR: CTMRB3C0INT (Bit 7)                    */
+#define CTIMER_INTCLR_CTMRB3C0INT_Msk     (0x80UL)                  /*!< CTIMER INTCLR: CTMRB3C0INT (Bitfield-Mask: 0x01)      */
+#define CTIMER_INTCLR_CTMRA3C0INT_Pos     (6UL)                     /*!< CTIMER INTCLR: CTMRA3C0INT (Bit 6)                    */
+#define CTIMER_INTCLR_CTMRA3C0INT_Msk     (0x40UL)                  /*!< CTIMER INTCLR: CTMRA3C0INT (Bitfield-Mask: 0x01)      */
+#define CTIMER_INTCLR_CTMRB2C0INT_Pos     (5UL)                     /*!< CTIMER INTCLR: CTMRB2C0INT (Bit 5)                    */
+#define CTIMER_INTCLR_CTMRB2C0INT_Msk     (0x20UL)                  /*!< CTIMER INTCLR: CTMRB2C0INT (Bitfield-Mask: 0x01)      */
+#define CTIMER_INTCLR_CTMRA2C0INT_Pos     (4UL)                     /*!< CTIMER INTCLR: CTMRA2C0INT (Bit 4)                    */
+#define CTIMER_INTCLR_CTMRA2C0INT_Msk     (0x10UL)                  /*!< CTIMER INTCLR: CTMRA2C0INT (Bitfield-Mask: 0x01)      */
+#define CTIMER_INTCLR_CTMRB1C0INT_Pos     (3UL)                     /*!< CTIMER INTCLR: CTMRB1C0INT (Bit 3)                    */
+#define CTIMER_INTCLR_CTMRB1C0INT_Msk     (0x8UL)                   /*!< CTIMER INTCLR: CTMRB1C0INT (Bitfield-Mask: 0x01)      */
+#define CTIMER_INTCLR_CTMRA1C0INT_Pos     (2UL)                     /*!< CTIMER INTCLR: CTMRA1C0INT (Bit 2)                    */
+#define CTIMER_INTCLR_CTMRA1C0INT_Msk     (0x4UL)                   /*!< CTIMER INTCLR: CTMRA1C0INT (Bitfield-Mask: 0x01)      */
+#define CTIMER_INTCLR_CTMRB0C0INT_Pos     (1UL)                     /*!< CTIMER INTCLR: CTMRB0C0INT (Bit 1)                    */
+#define CTIMER_INTCLR_CTMRB0C0INT_Msk     (0x2UL)                   /*!< CTIMER INTCLR: CTMRB0C0INT (Bitfield-Mask: 0x01)      */
+#define CTIMER_INTCLR_CTMRA0C0INT_Pos     (0UL)                     /*!< CTIMER INTCLR: CTMRA0C0INT (Bit 0)                    */
+#define CTIMER_INTCLR_CTMRA0C0INT_Msk     (0x1UL)                   /*!< CTIMER INTCLR: CTMRA0C0INT (Bitfield-Mask: 0x01)      */
+/* ========================================================  INTSET  ========================================================= */
+#define CTIMER_INTSET_CTMRB3C1INT_Pos     (15UL)                    /*!< CTIMER INTSET: CTMRB3C1INT (Bit 15)                   */
+#define CTIMER_INTSET_CTMRB3C1INT_Msk     (0x8000UL)                /*!< CTIMER INTSET: CTMRB3C1INT (Bitfield-Mask: 0x01)      */
+#define CTIMER_INTSET_CTMRA3C1INT_Pos     (14UL)                    /*!< CTIMER INTSET: CTMRA3C1INT (Bit 14)                   */
+#define CTIMER_INTSET_CTMRA3C1INT_Msk     (0x4000UL)                /*!< CTIMER INTSET: CTMRA3C1INT (Bitfield-Mask: 0x01)      */
+#define CTIMER_INTSET_CTMRB2C1INT_Pos     (13UL)                    /*!< CTIMER INTSET: CTMRB2C1INT (Bit 13)                   */
+#define CTIMER_INTSET_CTMRB2C1INT_Msk     (0x2000UL)                /*!< CTIMER INTSET: CTMRB2C1INT (Bitfield-Mask: 0x01)      */
+#define CTIMER_INTSET_CTMRA2C1INT_Pos     (12UL)                    /*!< CTIMER INTSET: CTMRA2C1INT (Bit 12)                   */
+#define CTIMER_INTSET_CTMRA2C1INT_Msk     (0x1000UL)                /*!< CTIMER INTSET: CTMRA2C1INT (Bitfield-Mask: 0x01)      */
+#define CTIMER_INTSET_CTMRB1C1INT_Pos     (11UL)                    /*!< CTIMER INTSET: CTMRB1C1INT (Bit 11)                   */
+#define CTIMER_INTSET_CTMRB1C1INT_Msk     (0x800UL)                 /*!< CTIMER INTSET: CTMRB1C1INT (Bitfield-Mask: 0x01)      */
+#define CTIMER_INTSET_CTMRA1C1INT_Pos     (10UL)                    /*!< CTIMER INTSET: CTMRA1C1INT (Bit 10)                   */
+#define CTIMER_INTSET_CTMRA1C1INT_Msk     (0x400UL)                 /*!< CTIMER INTSET: CTMRA1C1INT (Bitfield-Mask: 0x01)      */
+#define CTIMER_INTSET_CTMRB0C1INT_Pos     (9UL)                     /*!< CTIMER INTSET: CTMRB0C1INT (Bit 9)                    */
+#define CTIMER_INTSET_CTMRB0C1INT_Msk     (0x200UL)                 /*!< CTIMER INTSET: CTMRB0C1INT (Bitfield-Mask: 0x01)      */
+#define CTIMER_INTSET_CTMRA0C1INT_Pos     (8UL)                     /*!< CTIMER INTSET: CTMRA0C1INT (Bit 8)                    */
+#define CTIMER_INTSET_CTMRA0C1INT_Msk     (0x100UL)                 /*!< CTIMER INTSET: CTMRA0C1INT (Bitfield-Mask: 0x01)      */
+#define CTIMER_INTSET_CTMRB3C0INT_Pos     (7UL)                     /*!< CTIMER INTSET: CTMRB3C0INT (Bit 7)                    */
+#define CTIMER_INTSET_CTMRB3C0INT_Msk     (0x80UL)                  /*!< CTIMER INTSET: CTMRB3C0INT (Bitfield-Mask: 0x01)      */
+#define CTIMER_INTSET_CTMRA3C0INT_Pos     (6UL)                     /*!< CTIMER INTSET: CTMRA3C0INT (Bit 6)                    */
+#define CTIMER_INTSET_CTMRA3C0INT_Msk     (0x40UL)                  /*!< CTIMER INTSET: CTMRA3C0INT (Bitfield-Mask: 0x01)      */
+#define CTIMER_INTSET_CTMRB2C0INT_Pos     (5UL)                     /*!< CTIMER INTSET: CTMRB2C0INT (Bit 5)                    */
+#define CTIMER_INTSET_CTMRB2C0INT_Msk     (0x20UL)                  /*!< CTIMER INTSET: CTMRB2C0INT (Bitfield-Mask: 0x01)      */
+#define CTIMER_INTSET_CTMRA2C0INT_Pos     (4UL)                     /*!< CTIMER INTSET: CTMRA2C0INT (Bit 4)                    */
+#define CTIMER_INTSET_CTMRA2C0INT_Msk     (0x10UL)                  /*!< CTIMER INTSET: CTMRA2C0INT (Bitfield-Mask: 0x01)      */
+#define CTIMER_INTSET_CTMRB1C0INT_Pos     (3UL)                     /*!< CTIMER INTSET: CTMRB1C0INT (Bit 3)                    */
+#define CTIMER_INTSET_CTMRB1C0INT_Msk     (0x8UL)                   /*!< CTIMER INTSET: CTMRB1C0INT (Bitfield-Mask: 0x01)      */
+#define CTIMER_INTSET_CTMRA1C0INT_Pos     (2UL)                     /*!< CTIMER INTSET: CTMRA1C0INT (Bit 2)                    */
+#define CTIMER_INTSET_CTMRA1C0INT_Msk     (0x4UL)                   /*!< CTIMER INTSET: CTMRA1C0INT (Bitfield-Mask: 0x01)      */
+#define CTIMER_INTSET_CTMRB0C0INT_Pos     (1UL)                     /*!< CTIMER INTSET: CTMRB0C0INT (Bit 1)                    */
+#define CTIMER_INTSET_CTMRB0C0INT_Msk     (0x2UL)                   /*!< CTIMER INTSET: CTMRB0C0INT (Bitfield-Mask: 0x01)      */
+#define CTIMER_INTSET_CTMRA0C0INT_Pos     (0UL)                     /*!< CTIMER INTSET: CTMRA0C0INT (Bit 0)                    */
+#define CTIMER_INTSET_CTMRA0C0INT_Msk     (0x1UL)                   /*!< CTIMER INTSET: CTMRA0C0INT (Bitfield-Mask: 0x01)      */
+/* =======================================================  STMINTEN  ======================================================== */
+#define CTIMER_STMINTEN_CAPTURED_Pos      (12UL)                    /*!< CTIMER STMINTEN: CAPTURED (Bit 12)                    */
+#define CTIMER_STMINTEN_CAPTURED_Msk      (0x1000UL)                /*!< CTIMER STMINTEN: CAPTURED (Bitfield-Mask: 0x01)       */
+#define CTIMER_STMINTEN_CAPTUREC_Pos      (11UL)                    /*!< CTIMER STMINTEN: CAPTUREC (Bit 11)                    */
+#define CTIMER_STMINTEN_CAPTUREC_Msk      (0x800UL)                 /*!< CTIMER STMINTEN: CAPTUREC (Bitfield-Mask: 0x01)       */
+#define CTIMER_STMINTEN_CAPTUREB_Pos      (10UL)                    /*!< CTIMER STMINTEN: CAPTUREB (Bit 10)                    */
+#define CTIMER_STMINTEN_CAPTUREB_Msk      (0x400UL)                 /*!< CTIMER STMINTEN: CAPTUREB (Bitfield-Mask: 0x01)       */
+#define CTIMER_STMINTEN_CAPTUREA_Pos      (9UL)                     /*!< CTIMER STMINTEN: CAPTUREA (Bit 9)                     */
+#define CTIMER_STMINTEN_CAPTUREA_Msk      (0x200UL)                 /*!< CTIMER STMINTEN: CAPTUREA (Bitfield-Mask: 0x01)       */
+#define CTIMER_STMINTEN_OVERFLOW_Pos      (8UL)                     /*!< CTIMER STMINTEN: OVERFLOW (Bit 8)                     */
+#define CTIMER_STMINTEN_OVERFLOW_Msk      (0x100UL)                 /*!< CTIMER STMINTEN: OVERFLOW (Bitfield-Mask: 0x01)       */
+#define CTIMER_STMINTEN_COMPAREH_Pos      (7UL)                     /*!< CTIMER STMINTEN: COMPAREH (Bit 7)                     */
+#define CTIMER_STMINTEN_COMPAREH_Msk      (0x80UL)                  /*!< CTIMER STMINTEN: COMPAREH (Bitfield-Mask: 0x01)       */
+#define CTIMER_STMINTEN_COMPAREG_Pos      (6UL)                     /*!< CTIMER STMINTEN: COMPAREG (Bit 6)                     */
+#define CTIMER_STMINTEN_COMPAREG_Msk      (0x40UL)                  /*!< CTIMER STMINTEN: COMPAREG (Bitfield-Mask: 0x01)       */
+#define CTIMER_STMINTEN_COMPAREF_Pos      (5UL)                     /*!< CTIMER STMINTEN: COMPAREF (Bit 5)                     */
+#define CTIMER_STMINTEN_COMPAREF_Msk      (0x20UL)                  /*!< CTIMER STMINTEN: COMPAREF (Bitfield-Mask: 0x01)       */
+#define CTIMER_STMINTEN_COMPAREE_Pos      (4UL)                     /*!< CTIMER STMINTEN: COMPAREE (Bit 4)                     */
+#define CTIMER_STMINTEN_COMPAREE_Msk      (0x10UL)                  /*!< CTIMER STMINTEN: COMPAREE (Bitfield-Mask: 0x01)       */
+#define CTIMER_STMINTEN_COMPARED_Pos      (3UL)                     /*!< CTIMER STMINTEN: COMPARED (Bit 3)                     */
+#define CTIMER_STMINTEN_COMPARED_Msk      (0x8UL)                   /*!< CTIMER STMINTEN: COMPARED (Bitfield-Mask: 0x01)       */
+#define CTIMER_STMINTEN_COMPAREC_Pos      (2UL)                     /*!< CTIMER STMINTEN: COMPAREC (Bit 2)                     */
+#define CTIMER_STMINTEN_COMPAREC_Msk      (0x4UL)                   /*!< CTIMER STMINTEN: COMPAREC (Bitfield-Mask: 0x01)       */
+#define CTIMER_STMINTEN_COMPAREB_Pos      (1UL)                     /*!< CTIMER STMINTEN: COMPAREB (Bit 1)                     */
+#define CTIMER_STMINTEN_COMPAREB_Msk      (0x2UL)                   /*!< CTIMER STMINTEN: COMPAREB (Bitfield-Mask: 0x01)       */
+#define CTIMER_STMINTEN_COMPAREA_Pos      (0UL)                     /*!< CTIMER STMINTEN: COMPAREA (Bit 0)                     */
+#define CTIMER_STMINTEN_COMPAREA_Msk      (0x1UL)                   /*!< CTIMER STMINTEN: COMPAREA (Bitfield-Mask: 0x01)       */
+/* ======================================================  STMINTSTAT  ======================================================= */
+#define CTIMER_STMINTSTAT_CAPTURED_Pos    (12UL)                    /*!< CTIMER STMINTSTAT: CAPTURED (Bit 12)                  */
+#define CTIMER_STMINTSTAT_CAPTURED_Msk    (0x1000UL)                /*!< CTIMER STMINTSTAT: CAPTURED (Bitfield-Mask: 0x01)     */
+#define CTIMER_STMINTSTAT_CAPTUREC_Pos    (11UL)                    /*!< CTIMER STMINTSTAT: CAPTUREC (Bit 11)                  */
+#define CTIMER_STMINTSTAT_CAPTUREC_Msk    (0x800UL)                 /*!< CTIMER STMINTSTAT: CAPTUREC (Bitfield-Mask: 0x01)     */
+#define CTIMER_STMINTSTAT_CAPTUREB_Pos    (10UL)                    /*!< CTIMER STMINTSTAT: CAPTUREB (Bit 10)                  */
+#define CTIMER_STMINTSTAT_CAPTUREB_Msk    (0x400UL)                 /*!< CTIMER STMINTSTAT: CAPTUREB (Bitfield-Mask: 0x01)     */
+#define CTIMER_STMINTSTAT_CAPTUREA_Pos    (9UL)                     /*!< CTIMER STMINTSTAT: CAPTUREA (Bit 9)                   */
+#define CTIMER_STMINTSTAT_CAPTUREA_Msk    (0x200UL)                 /*!< CTIMER STMINTSTAT: CAPTUREA (Bitfield-Mask: 0x01)     */
+#define CTIMER_STMINTSTAT_OVERFLOW_Pos    (8UL)                     /*!< CTIMER STMINTSTAT: OVERFLOW (Bit 8)                   */
+#define CTIMER_STMINTSTAT_OVERFLOW_Msk    (0x100UL)                 /*!< CTIMER STMINTSTAT: OVERFLOW (Bitfield-Mask: 0x01)     */
+#define CTIMER_STMINTSTAT_COMPAREH_Pos    (7UL)                     /*!< CTIMER STMINTSTAT: COMPAREH (Bit 7)                   */
+#define CTIMER_STMINTSTAT_COMPAREH_Msk    (0x80UL)                  /*!< CTIMER STMINTSTAT: COMPAREH (Bitfield-Mask: 0x01)     */
+#define CTIMER_STMINTSTAT_COMPAREG_Pos    (6UL)                     /*!< CTIMER STMINTSTAT: COMPAREG (Bit 6)                   */
+#define CTIMER_STMINTSTAT_COMPAREG_Msk    (0x40UL)                  /*!< CTIMER STMINTSTAT: COMPAREG (Bitfield-Mask: 0x01)     */
+#define CTIMER_STMINTSTAT_COMPAREF_Pos    (5UL)                     /*!< CTIMER STMINTSTAT: COMPAREF (Bit 5)                   */
+#define CTIMER_STMINTSTAT_COMPAREF_Msk    (0x20UL)                  /*!< CTIMER STMINTSTAT: COMPAREF (Bitfield-Mask: 0x01)     */
+#define CTIMER_STMINTSTAT_COMPAREE_Pos    (4UL)                     /*!< CTIMER STMINTSTAT: COMPAREE (Bit 4)                   */
+#define CTIMER_STMINTSTAT_COMPAREE_Msk    (0x10UL)                  /*!< CTIMER STMINTSTAT: COMPAREE (Bitfield-Mask: 0x01)     */
+#define CTIMER_STMINTSTAT_COMPARED_Pos    (3UL)                     /*!< CTIMER STMINTSTAT: COMPARED (Bit 3)                   */
+#define CTIMER_STMINTSTAT_COMPARED_Msk    (0x8UL)                   /*!< CTIMER STMINTSTAT: COMPARED (Bitfield-Mask: 0x01)     */
+#define CTIMER_STMINTSTAT_COMPAREC_Pos    (2UL)                     /*!< CTIMER STMINTSTAT: COMPAREC (Bit 2)                   */
+#define CTIMER_STMINTSTAT_COMPAREC_Msk    (0x4UL)                   /*!< CTIMER STMINTSTAT: COMPAREC (Bitfield-Mask: 0x01)     */
+#define CTIMER_STMINTSTAT_COMPAREB_Pos    (1UL)                     /*!< CTIMER STMINTSTAT: COMPAREB (Bit 1)                   */
+#define CTIMER_STMINTSTAT_COMPAREB_Msk    (0x2UL)                   /*!< CTIMER STMINTSTAT: COMPAREB (Bitfield-Mask: 0x01)     */
+#define CTIMER_STMINTSTAT_COMPAREA_Pos    (0UL)                     /*!< CTIMER STMINTSTAT: COMPAREA (Bit 0)                   */
+#define CTIMER_STMINTSTAT_COMPAREA_Msk    (0x1UL)                   /*!< CTIMER STMINTSTAT: COMPAREA (Bitfield-Mask: 0x01)     */
+/* =======================================================  STMINTCLR  ======================================================= */
+#define CTIMER_STMINTCLR_CAPTURED_Pos     (12UL)                    /*!< CTIMER STMINTCLR: CAPTURED (Bit 12)                   */
+#define CTIMER_STMINTCLR_CAPTURED_Msk     (0x1000UL)                /*!< CTIMER STMINTCLR: CAPTURED (Bitfield-Mask: 0x01)      */
+#define CTIMER_STMINTCLR_CAPTUREC_Pos     (11UL)                    /*!< CTIMER STMINTCLR: CAPTUREC (Bit 11)                   */
+#define CTIMER_STMINTCLR_CAPTUREC_Msk     (0x800UL)                 /*!< CTIMER STMINTCLR: CAPTUREC (Bitfield-Mask: 0x01)      */
+#define CTIMER_STMINTCLR_CAPTUREB_Pos     (10UL)                    /*!< CTIMER STMINTCLR: CAPTUREB (Bit 10)                   */
+#define CTIMER_STMINTCLR_CAPTUREB_Msk     (0x400UL)                 /*!< CTIMER STMINTCLR: CAPTUREB (Bitfield-Mask: 0x01)      */
+#define CTIMER_STMINTCLR_CAPTUREA_Pos     (9UL)                     /*!< CTIMER STMINTCLR: CAPTUREA (Bit 9)                    */
+#define CTIMER_STMINTCLR_CAPTUREA_Msk     (0x200UL)                 /*!< CTIMER STMINTCLR: CAPTUREA (Bitfield-Mask: 0x01)      */
+#define CTIMER_STMINTCLR_OVERFLOW_Pos     (8UL)                     /*!< CTIMER STMINTCLR: OVERFLOW (Bit 8)                    */
+#define CTIMER_STMINTCLR_OVERFLOW_Msk     (0x100UL)                 /*!< CTIMER STMINTCLR: OVERFLOW (Bitfield-Mask: 0x01)      */
+#define CTIMER_STMINTCLR_COMPAREH_Pos     (7UL)                     /*!< CTIMER STMINTCLR: COMPAREH (Bit 7)                    */
+#define CTIMER_STMINTCLR_COMPAREH_Msk     (0x80UL)                  /*!< CTIMER STMINTCLR: COMPAREH (Bitfield-Mask: 0x01)      */
+#define CTIMER_STMINTCLR_COMPAREG_Pos     (6UL)                     /*!< CTIMER STMINTCLR: COMPAREG (Bit 6)                    */
+#define CTIMER_STMINTCLR_COMPAREG_Msk     (0x40UL)                  /*!< CTIMER STMINTCLR: COMPAREG (Bitfield-Mask: 0x01)      */
+#define CTIMER_STMINTCLR_COMPAREF_Pos     (5UL)                     /*!< CTIMER STMINTCLR: COMPAREF (Bit 5)                    */
+#define CTIMER_STMINTCLR_COMPAREF_Msk     (0x20UL)                  /*!< CTIMER STMINTCLR: COMPAREF (Bitfield-Mask: 0x01)      */
+#define CTIMER_STMINTCLR_COMPAREE_Pos     (4UL)                     /*!< CTIMER STMINTCLR: COMPAREE (Bit 4)                    */
+#define CTIMER_STMINTCLR_COMPAREE_Msk     (0x10UL)                  /*!< CTIMER STMINTCLR: COMPAREE (Bitfield-Mask: 0x01)      */
+#define CTIMER_STMINTCLR_COMPARED_Pos     (3UL)                     /*!< CTIMER STMINTCLR: COMPARED (Bit 3)                    */
+#define CTIMER_STMINTCLR_COMPARED_Msk     (0x8UL)                   /*!< CTIMER STMINTCLR: COMPARED (Bitfield-Mask: 0x01)      */
+#define CTIMER_STMINTCLR_COMPAREC_Pos     (2UL)                     /*!< CTIMER STMINTCLR: COMPAREC (Bit 2)                    */
+#define CTIMER_STMINTCLR_COMPAREC_Msk     (0x4UL)                   /*!< CTIMER STMINTCLR: COMPAREC (Bitfield-Mask: 0x01)      */
+#define CTIMER_STMINTCLR_COMPAREB_Pos     (1UL)                     /*!< CTIMER STMINTCLR: COMPAREB (Bit 1)                    */
+#define CTIMER_STMINTCLR_COMPAREB_Msk     (0x2UL)                   /*!< CTIMER STMINTCLR: COMPAREB (Bitfield-Mask: 0x01)      */
+#define CTIMER_STMINTCLR_COMPAREA_Pos     (0UL)                     /*!< CTIMER STMINTCLR: COMPAREA (Bit 0)                    */
+#define CTIMER_STMINTCLR_COMPAREA_Msk     (0x1UL)                   /*!< CTIMER STMINTCLR: COMPAREA (Bitfield-Mask: 0x01)      */
+/* =======================================================  STMINTSET  ======================================================= */
+#define CTIMER_STMINTSET_CAPTURED_Pos     (12UL)                    /*!< CTIMER STMINTSET: CAPTURED (Bit 12)                   */
+#define CTIMER_STMINTSET_CAPTURED_Msk     (0x1000UL)                /*!< CTIMER STMINTSET: CAPTURED (Bitfield-Mask: 0x01)      */
+#define CTIMER_STMINTSET_CAPTUREC_Pos     (11UL)                    /*!< CTIMER STMINTSET: CAPTUREC (Bit 11)                   */
+#define CTIMER_STMINTSET_CAPTUREC_Msk     (0x800UL)                 /*!< CTIMER STMINTSET: CAPTUREC (Bitfield-Mask: 0x01)      */
+#define CTIMER_STMINTSET_CAPTUREB_Pos     (10UL)                    /*!< CTIMER STMINTSET: CAPTUREB (Bit 10)                   */
+#define CTIMER_STMINTSET_CAPTUREB_Msk     (0x400UL)                 /*!< CTIMER STMINTSET: CAPTUREB (Bitfield-Mask: 0x01)      */
+#define CTIMER_STMINTSET_CAPTUREA_Pos     (9UL)                     /*!< CTIMER STMINTSET: CAPTUREA (Bit 9)                    */
+#define CTIMER_STMINTSET_CAPTUREA_Msk     (0x200UL)                 /*!< CTIMER STMINTSET: CAPTUREA (Bitfield-Mask: 0x01)      */
+#define CTIMER_STMINTSET_OVERFLOW_Pos     (8UL)                     /*!< CTIMER STMINTSET: OVERFLOW (Bit 8)                    */
+#define CTIMER_STMINTSET_OVERFLOW_Msk     (0x100UL)                 /*!< CTIMER STMINTSET: OVERFLOW (Bitfield-Mask: 0x01)      */
+#define CTIMER_STMINTSET_COMPAREH_Pos     (7UL)                     /*!< CTIMER STMINTSET: COMPAREH (Bit 7)                    */
+#define CTIMER_STMINTSET_COMPAREH_Msk     (0x80UL)                  /*!< CTIMER STMINTSET: COMPAREH (Bitfield-Mask: 0x01)      */
+#define CTIMER_STMINTSET_COMPAREG_Pos     (6UL)                     /*!< CTIMER STMINTSET: COMPAREG (Bit 6)                    */
+#define CTIMER_STMINTSET_COMPAREG_Msk     (0x40UL)                  /*!< CTIMER STMINTSET: COMPAREG (Bitfield-Mask: 0x01)      */
+#define CTIMER_STMINTSET_COMPAREF_Pos     (5UL)                     /*!< CTIMER STMINTSET: COMPAREF (Bit 5)                    */
+#define CTIMER_STMINTSET_COMPAREF_Msk     (0x20UL)                  /*!< CTIMER STMINTSET: COMPAREF (Bitfield-Mask: 0x01)      */
+#define CTIMER_STMINTSET_COMPAREE_Pos     (4UL)                     /*!< CTIMER STMINTSET: COMPAREE (Bit 4)                    */
+#define CTIMER_STMINTSET_COMPAREE_Msk     (0x10UL)                  /*!< CTIMER STMINTSET: COMPAREE (Bitfield-Mask: 0x01)      */
+#define CTIMER_STMINTSET_COMPARED_Pos     (3UL)                     /*!< CTIMER STMINTSET: COMPARED (Bit 3)                    */
+#define CTIMER_STMINTSET_COMPARED_Msk     (0x8UL)                   /*!< CTIMER STMINTSET: COMPARED (Bitfield-Mask: 0x01)      */
+#define CTIMER_STMINTSET_COMPAREC_Pos     (2UL)                     /*!< CTIMER STMINTSET: COMPAREC (Bit 2)                    */
+#define CTIMER_STMINTSET_COMPAREC_Msk     (0x4UL)                   /*!< CTIMER STMINTSET: COMPAREC (Bitfield-Mask: 0x01)      */
+#define CTIMER_STMINTSET_COMPAREB_Pos     (1UL)                     /*!< CTIMER STMINTSET: COMPAREB (Bit 1)                    */
+#define CTIMER_STMINTSET_COMPAREB_Msk     (0x2UL)                   /*!< CTIMER STMINTSET: COMPAREB (Bitfield-Mask: 0x01)      */
+#define CTIMER_STMINTSET_COMPAREA_Pos     (0UL)                     /*!< CTIMER STMINTSET: COMPAREA (Bit 0)                    */
+#define CTIMER_STMINTSET_COMPAREA_Msk     (0x1UL)                   /*!< CTIMER STMINTSET: COMPAREA (Bitfield-Mask: 0x01)      */
+
+
+/* =========================================================================================================================== */
+/* ================                                           GPIO                                            ================ */
+/* =========================================================================================================================== */
+
+/* ========================================================  PADREGA  ======================================================== */
+#define GPIO_PADREGA_PAD3FNCSEL_Pos       (27UL)                    /*!< GPIO PADREGA: PAD3FNCSEL (Bit 27)                     */
+#define GPIO_PADREGA_PAD3FNCSEL_Msk       (0x38000000UL)            /*!< GPIO PADREGA: PAD3FNCSEL (Bitfield-Mask: 0x07)        */
+#define GPIO_PADREGA_PAD3STRNG_Pos        (26UL)                    /*!< GPIO PADREGA: PAD3STRNG (Bit 26)                      */
+#define GPIO_PADREGA_PAD3STRNG_Msk        (0x4000000UL)             /*!< GPIO PADREGA: PAD3STRNG (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGA_PAD3INPEN_Pos        (25UL)                    /*!< GPIO PADREGA: PAD3INPEN (Bit 25)                      */
+#define GPIO_PADREGA_PAD3INPEN_Msk        (0x2000000UL)             /*!< GPIO PADREGA: PAD3INPEN (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGA_PAD3PULL_Pos         (24UL)                    /*!< GPIO PADREGA: PAD3PULL (Bit 24)                       */
+#define GPIO_PADREGA_PAD3PULL_Msk         (0x1000000UL)             /*!< GPIO PADREGA: PAD3PULL (Bitfield-Mask: 0x01)          */
+#define GPIO_PADREGA_PAD2FNCSEL_Pos       (19UL)                    /*!< GPIO PADREGA: PAD2FNCSEL (Bit 19)                     */
+#define GPIO_PADREGA_PAD2FNCSEL_Msk       (0x380000UL)              /*!< GPIO PADREGA: PAD2FNCSEL (Bitfield-Mask: 0x07)        */
+#define GPIO_PADREGA_PAD2STRNG_Pos        (18UL)                    /*!< GPIO PADREGA: PAD2STRNG (Bit 18)                      */
+#define GPIO_PADREGA_PAD2STRNG_Msk        (0x40000UL)               /*!< GPIO PADREGA: PAD2STRNG (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGA_PAD2INPEN_Pos        (17UL)                    /*!< GPIO PADREGA: PAD2INPEN (Bit 17)                      */
+#define GPIO_PADREGA_PAD2INPEN_Msk        (0x20000UL)               /*!< GPIO PADREGA: PAD2INPEN (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGA_PAD2PULL_Pos         (16UL)                    /*!< GPIO PADREGA: PAD2PULL (Bit 16)                       */
+#define GPIO_PADREGA_PAD2PULL_Msk         (0x10000UL)               /*!< GPIO PADREGA: PAD2PULL (Bitfield-Mask: 0x01)          */
+#define GPIO_PADREGA_PAD1RSEL_Pos         (14UL)                    /*!< GPIO PADREGA: PAD1RSEL (Bit 14)                       */
+#define GPIO_PADREGA_PAD1RSEL_Msk         (0xc000UL)                /*!< GPIO PADREGA: PAD1RSEL (Bitfield-Mask: 0x03)          */
+#define GPIO_PADREGA_PAD1FNCSEL_Pos       (11UL)                    /*!< GPIO PADREGA: PAD1FNCSEL (Bit 11)                     */
+#define GPIO_PADREGA_PAD1FNCSEL_Msk       (0x3800UL)                /*!< GPIO PADREGA: PAD1FNCSEL (Bitfield-Mask: 0x07)        */
+#define GPIO_PADREGA_PAD1STRNG_Pos        (10UL)                    /*!< GPIO PADREGA: PAD1STRNG (Bit 10)                      */
+#define GPIO_PADREGA_PAD1STRNG_Msk        (0x400UL)                 /*!< GPIO PADREGA: PAD1STRNG (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGA_PAD1INPEN_Pos        (9UL)                     /*!< GPIO PADREGA: PAD1INPEN (Bit 9)                       */
+#define GPIO_PADREGA_PAD1INPEN_Msk        (0x200UL)                 /*!< GPIO PADREGA: PAD1INPEN (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGA_PAD1PULL_Pos         (8UL)                     /*!< GPIO PADREGA: PAD1PULL (Bit 8)                        */
+#define GPIO_PADREGA_PAD1PULL_Msk         (0x100UL)                 /*!< GPIO PADREGA: PAD1PULL (Bitfield-Mask: 0x01)          */
+#define GPIO_PADREGA_PAD0RSEL_Pos         (6UL)                     /*!< GPIO PADREGA: PAD0RSEL (Bit 6)                        */
+#define GPIO_PADREGA_PAD0RSEL_Msk         (0xc0UL)                  /*!< GPIO PADREGA: PAD0RSEL (Bitfield-Mask: 0x03)          */
+#define GPIO_PADREGA_PAD0FNCSEL_Pos       (3UL)                     /*!< GPIO PADREGA: PAD0FNCSEL (Bit 3)                      */
+#define GPIO_PADREGA_PAD0FNCSEL_Msk       (0x38UL)                  /*!< GPIO PADREGA: PAD0FNCSEL (Bitfield-Mask: 0x07)        */
+#define GPIO_PADREGA_PAD0STRNG_Pos        (2UL)                     /*!< GPIO PADREGA: PAD0STRNG (Bit 2)                       */
+#define GPIO_PADREGA_PAD0STRNG_Msk        (0x4UL)                   /*!< GPIO PADREGA: PAD0STRNG (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGA_PAD0INPEN_Pos        (1UL)                     /*!< GPIO PADREGA: PAD0INPEN (Bit 1)                       */
+#define GPIO_PADREGA_PAD0INPEN_Msk        (0x2UL)                   /*!< GPIO PADREGA: PAD0INPEN (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGA_PAD0PULL_Pos         (0UL)                     /*!< GPIO PADREGA: PAD0PULL (Bit 0)                        */
+#define GPIO_PADREGA_PAD0PULL_Msk         (0x1UL)                   /*!< GPIO PADREGA: PAD0PULL (Bitfield-Mask: 0x01)          */
+/* ========================================================  PADREGB  ======================================================== */
+#define GPIO_PADREGB_PAD7FNCSEL_Pos       (27UL)                    /*!< GPIO PADREGB: PAD7FNCSEL (Bit 27)                     */
+#define GPIO_PADREGB_PAD7FNCSEL_Msk       (0x38000000UL)            /*!< GPIO PADREGB: PAD7FNCSEL (Bitfield-Mask: 0x07)        */
+#define GPIO_PADREGB_PAD7STRNG_Pos        (26UL)                    /*!< GPIO PADREGB: PAD7STRNG (Bit 26)                      */
+#define GPIO_PADREGB_PAD7STRNG_Msk        (0x4000000UL)             /*!< GPIO PADREGB: PAD7STRNG (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGB_PAD7INPEN_Pos        (25UL)                    /*!< GPIO PADREGB: PAD7INPEN (Bit 25)                      */
+#define GPIO_PADREGB_PAD7INPEN_Msk        (0x2000000UL)             /*!< GPIO PADREGB: PAD7INPEN (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGB_PAD7PULL_Pos         (24UL)                    /*!< GPIO PADREGB: PAD7PULL (Bit 24)                       */
+#define GPIO_PADREGB_PAD7PULL_Msk         (0x1000000UL)             /*!< GPIO PADREGB: PAD7PULL (Bitfield-Mask: 0x01)          */
+#define GPIO_PADREGB_PAD6RSEL_Pos         (22UL)                    /*!< GPIO PADREGB: PAD6RSEL (Bit 22)                       */
+#define GPIO_PADREGB_PAD6RSEL_Msk         (0xc00000UL)              /*!< GPIO PADREGB: PAD6RSEL (Bitfield-Mask: 0x03)          */
+#define GPIO_PADREGB_PAD6FNCSEL_Pos       (19UL)                    /*!< GPIO PADREGB: PAD6FNCSEL (Bit 19)                     */
+#define GPIO_PADREGB_PAD6FNCSEL_Msk       (0x380000UL)              /*!< GPIO PADREGB: PAD6FNCSEL (Bitfield-Mask: 0x07)        */
+#define GPIO_PADREGB_PAD6STRNG_Pos        (18UL)                    /*!< GPIO PADREGB: PAD6STRNG (Bit 18)                      */
+#define GPIO_PADREGB_PAD6STRNG_Msk        (0x40000UL)               /*!< GPIO PADREGB: PAD6STRNG (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGB_PAD6INPEN_Pos        (17UL)                    /*!< GPIO PADREGB: PAD6INPEN (Bit 17)                      */
+#define GPIO_PADREGB_PAD6INPEN_Msk        (0x20000UL)               /*!< GPIO PADREGB: PAD6INPEN (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGB_PAD6PULL_Pos         (16UL)                    /*!< GPIO PADREGB: PAD6PULL (Bit 16)                       */
+#define GPIO_PADREGB_PAD6PULL_Msk         (0x10000UL)               /*!< GPIO PADREGB: PAD6PULL (Bitfield-Mask: 0x01)          */
+#define GPIO_PADREGB_PAD5RSEL_Pos         (14UL)                    /*!< GPIO PADREGB: PAD5RSEL (Bit 14)                       */
+#define GPIO_PADREGB_PAD5RSEL_Msk         (0xc000UL)                /*!< GPIO PADREGB: PAD5RSEL (Bitfield-Mask: 0x03)          */
+#define GPIO_PADREGB_PAD5FNCSEL_Pos       (11UL)                    /*!< GPIO PADREGB: PAD5FNCSEL (Bit 11)                     */
+#define GPIO_PADREGB_PAD5FNCSEL_Msk       (0x3800UL)                /*!< GPIO PADREGB: PAD5FNCSEL (Bitfield-Mask: 0x07)        */
+#define GPIO_PADREGB_PAD5STRNG_Pos        (10UL)                    /*!< GPIO PADREGB: PAD5STRNG (Bit 10)                      */
+#define GPIO_PADREGB_PAD5STRNG_Msk        (0x400UL)                 /*!< GPIO PADREGB: PAD5STRNG (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGB_PAD5INPEN_Pos        (9UL)                     /*!< GPIO PADREGB: PAD5INPEN (Bit 9)                       */
+#define GPIO_PADREGB_PAD5INPEN_Msk        (0x200UL)                 /*!< GPIO PADREGB: PAD5INPEN (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGB_PAD5PULL_Pos         (8UL)                     /*!< GPIO PADREGB: PAD5PULL (Bit 8)                        */
+#define GPIO_PADREGB_PAD5PULL_Msk         (0x100UL)                 /*!< GPIO PADREGB: PAD5PULL (Bitfield-Mask: 0x01)          */
+#define GPIO_PADREGB_PAD4PWRDN_Pos        (7UL)                     /*!< GPIO PADREGB: PAD4PWRDN (Bit 7)                       */
+#define GPIO_PADREGB_PAD4PWRDN_Msk        (0x80UL)                  /*!< GPIO PADREGB: PAD4PWRDN (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGB_PAD4FNCSEL_Pos       (3UL)                     /*!< GPIO PADREGB: PAD4FNCSEL (Bit 3)                      */
+#define GPIO_PADREGB_PAD4FNCSEL_Msk       (0x38UL)                  /*!< GPIO PADREGB: PAD4FNCSEL (Bitfield-Mask: 0x07)        */
+#define GPIO_PADREGB_PAD4STRNG_Pos        (2UL)                     /*!< GPIO PADREGB: PAD4STRNG (Bit 2)                       */
+#define GPIO_PADREGB_PAD4STRNG_Msk        (0x4UL)                   /*!< GPIO PADREGB: PAD4STRNG (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGB_PAD4INPEN_Pos        (1UL)                     /*!< GPIO PADREGB: PAD4INPEN (Bit 1)                       */
+#define GPIO_PADREGB_PAD4INPEN_Msk        (0x2UL)                   /*!< GPIO PADREGB: PAD4INPEN (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGB_PAD4PULL_Pos         (0UL)                     /*!< GPIO PADREGB: PAD4PULL (Bit 0)                        */
+#define GPIO_PADREGB_PAD4PULL_Msk         (0x1UL)                   /*!< GPIO PADREGB: PAD4PULL (Bitfield-Mask: 0x01)          */
+/* ========================================================  PADREGC  ======================================================== */
+#define GPIO_PADREGC_PAD11FNCSEL_Pos      (27UL)                    /*!< GPIO PADREGC: PAD11FNCSEL (Bit 27)                    */
+#define GPIO_PADREGC_PAD11FNCSEL_Msk      (0x38000000UL)            /*!< GPIO PADREGC: PAD11FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGC_PAD11STRNG_Pos       (26UL)                    /*!< GPIO PADREGC: PAD11STRNG (Bit 26)                     */
+#define GPIO_PADREGC_PAD11STRNG_Msk       (0x4000000UL)             /*!< GPIO PADREGC: PAD11STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGC_PAD11INPEN_Pos       (25UL)                    /*!< GPIO PADREGC: PAD11INPEN (Bit 25)                     */
+#define GPIO_PADREGC_PAD11INPEN_Msk       (0x2000000UL)             /*!< GPIO PADREGC: PAD11INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGC_PAD11PULL_Pos        (24UL)                    /*!< GPIO PADREGC: PAD11PULL (Bit 24)                      */
+#define GPIO_PADREGC_PAD11PULL_Msk        (0x1000000UL)             /*!< GPIO PADREGC: PAD11PULL (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGC_PAD10FNCSEL_Pos      (19UL)                    /*!< GPIO PADREGC: PAD10FNCSEL (Bit 19)                    */
+#define GPIO_PADREGC_PAD10FNCSEL_Msk      (0x380000UL)              /*!< GPIO PADREGC: PAD10FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGC_PAD10STRNG_Pos       (18UL)                    /*!< GPIO PADREGC: PAD10STRNG (Bit 18)                     */
+#define GPIO_PADREGC_PAD10STRNG_Msk       (0x40000UL)               /*!< GPIO PADREGC: PAD10STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGC_PAD10INPEN_Pos       (17UL)                    /*!< GPIO PADREGC: PAD10INPEN (Bit 17)                     */
+#define GPIO_PADREGC_PAD10INPEN_Msk       (0x20000UL)               /*!< GPIO PADREGC: PAD10INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGC_PAD10PULL_Pos        (16UL)                    /*!< GPIO PADREGC: PAD10PULL (Bit 16)                      */
+#define GPIO_PADREGC_PAD10PULL_Msk        (0x10000UL)               /*!< GPIO PADREGC: PAD10PULL (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGC_PAD9RSEL_Pos         (14UL)                    /*!< GPIO PADREGC: PAD9RSEL (Bit 14)                       */
+#define GPIO_PADREGC_PAD9RSEL_Msk         (0xc000UL)                /*!< GPIO PADREGC: PAD9RSEL (Bitfield-Mask: 0x03)          */
+#define GPIO_PADREGC_PAD9FNCSEL_Pos       (11UL)                    /*!< GPIO PADREGC: PAD9FNCSEL (Bit 11)                     */
+#define GPIO_PADREGC_PAD9FNCSEL_Msk       (0x3800UL)                /*!< GPIO PADREGC: PAD9FNCSEL (Bitfield-Mask: 0x07)        */
+#define GPIO_PADREGC_PAD9STRNG_Pos        (10UL)                    /*!< GPIO PADREGC: PAD9STRNG (Bit 10)                      */
+#define GPIO_PADREGC_PAD9STRNG_Msk        (0x400UL)                 /*!< GPIO PADREGC: PAD9STRNG (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGC_PAD9INPEN_Pos        (9UL)                     /*!< GPIO PADREGC: PAD9INPEN (Bit 9)                       */
+#define GPIO_PADREGC_PAD9INPEN_Msk        (0x200UL)                 /*!< GPIO PADREGC: PAD9INPEN (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGC_PAD9PULL_Pos         (8UL)                     /*!< GPIO PADREGC: PAD9PULL (Bit 8)                        */
+#define GPIO_PADREGC_PAD9PULL_Msk         (0x100UL)                 /*!< GPIO PADREGC: PAD9PULL (Bitfield-Mask: 0x01)          */
+#define GPIO_PADREGC_PAD8RSEL_Pos         (6UL)                     /*!< GPIO PADREGC: PAD8RSEL (Bit 6)                        */
+#define GPIO_PADREGC_PAD8RSEL_Msk         (0xc0UL)                  /*!< GPIO PADREGC: PAD8RSEL (Bitfield-Mask: 0x03)          */
+#define GPIO_PADREGC_PAD8FNCSEL_Pos       (3UL)                     /*!< GPIO PADREGC: PAD8FNCSEL (Bit 3)                      */
+#define GPIO_PADREGC_PAD8FNCSEL_Msk       (0x38UL)                  /*!< GPIO PADREGC: PAD8FNCSEL (Bitfield-Mask: 0x07)        */
+#define GPIO_PADREGC_PAD8STRNG_Pos        (2UL)                     /*!< GPIO PADREGC: PAD8STRNG (Bit 2)                       */
+#define GPIO_PADREGC_PAD8STRNG_Msk        (0x4UL)                   /*!< GPIO PADREGC: PAD8STRNG (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGC_PAD8INPEN_Pos        (1UL)                     /*!< GPIO PADREGC: PAD8INPEN (Bit 1)                       */
+#define GPIO_PADREGC_PAD8INPEN_Msk        (0x2UL)                   /*!< GPIO PADREGC: PAD8INPEN (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGC_PAD8PULL_Pos         (0UL)                     /*!< GPIO PADREGC: PAD8PULL (Bit 0)                        */
+#define GPIO_PADREGC_PAD8PULL_Msk         (0x1UL)                   /*!< GPIO PADREGC: PAD8PULL (Bitfield-Mask: 0x01)          */
+/* ========================================================  PADREGD  ======================================================== */
+#define GPIO_PADREGD_PAD15FNCSEL_Pos      (27UL)                    /*!< GPIO PADREGD: PAD15FNCSEL (Bit 27)                    */
+#define GPIO_PADREGD_PAD15FNCSEL_Msk      (0x38000000UL)            /*!< GPIO PADREGD: PAD15FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGD_PAD15STRNG_Pos       (26UL)                    /*!< GPIO PADREGD: PAD15STRNG (Bit 26)                     */
+#define GPIO_PADREGD_PAD15STRNG_Msk       (0x4000000UL)             /*!< GPIO PADREGD: PAD15STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGD_PAD15INPEN_Pos       (25UL)                    /*!< GPIO PADREGD: PAD15INPEN (Bit 25)                     */
+#define GPIO_PADREGD_PAD15INPEN_Msk       (0x2000000UL)             /*!< GPIO PADREGD: PAD15INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGD_PAD15PULL_Pos        (24UL)                    /*!< GPIO PADREGD: PAD15PULL (Bit 24)                      */
+#define GPIO_PADREGD_PAD15PULL_Msk        (0x1000000UL)             /*!< GPIO PADREGD: PAD15PULL (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGD_PAD14FNCSEL_Pos      (19UL)                    /*!< GPIO PADREGD: PAD14FNCSEL (Bit 19)                    */
+#define GPIO_PADREGD_PAD14FNCSEL_Msk      (0x380000UL)              /*!< GPIO PADREGD: PAD14FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGD_PAD14STRNG_Pos       (18UL)                    /*!< GPIO PADREGD: PAD14STRNG (Bit 18)                     */
+#define GPIO_PADREGD_PAD14STRNG_Msk       (0x40000UL)               /*!< GPIO PADREGD: PAD14STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGD_PAD14INPEN_Pos       (17UL)                    /*!< GPIO PADREGD: PAD14INPEN (Bit 17)                     */
+#define GPIO_PADREGD_PAD14INPEN_Msk       (0x20000UL)               /*!< GPIO PADREGD: PAD14INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGD_PAD14PULL_Pos        (16UL)                    /*!< GPIO PADREGD: PAD14PULL (Bit 16)                      */
+#define GPIO_PADREGD_PAD14PULL_Msk        (0x10000UL)               /*!< GPIO PADREGD: PAD14PULL (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGD_PAD13FNCSEL_Pos      (11UL)                    /*!< GPIO PADREGD: PAD13FNCSEL (Bit 11)                    */
+#define GPIO_PADREGD_PAD13FNCSEL_Msk      (0x3800UL)                /*!< GPIO PADREGD: PAD13FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGD_PAD13STRNG_Pos       (10UL)                    /*!< GPIO PADREGD: PAD13STRNG (Bit 10)                     */
+#define GPIO_PADREGD_PAD13STRNG_Msk       (0x400UL)                 /*!< GPIO PADREGD: PAD13STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGD_PAD13INPEN_Pos       (9UL)                     /*!< GPIO PADREGD: PAD13INPEN (Bit 9)                      */
+#define GPIO_PADREGD_PAD13INPEN_Msk       (0x200UL)                 /*!< GPIO PADREGD: PAD13INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGD_PAD13PULL_Pos        (8UL)                     /*!< GPIO PADREGD: PAD13PULL (Bit 8)                       */
+#define GPIO_PADREGD_PAD13PULL_Msk        (0x100UL)                 /*!< GPIO PADREGD: PAD13PULL (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGD_PAD12FNCSEL_Pos      (3UL)                     /*!< GPIO PADREGD: PAD12FNCSEL (Bit 3)                     */
+#define GPIO_PADREGD_PAD12FNCSEL_Msk      (0x38UL)                  /*!< GPIO PADREGD: PAD12FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGD_PAD12STRNG_Pos       (2UL)                     /*!< GPIO PADREGD: PAD12STRNG (Bit 2)                      */
+#define GPIO_PADREGD_PAD12STRNG_Msk       (0x4UL)                   /*!< GPIO PADREGD: PAD12STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGD_PAD12INPEN_Pos       (1UL)                     /*!< GPIO PADREGD: PAD12INPEN (Bit 1)                      */
+#define GPIO_PADREGD_PAD12INPEN_Msk       (0x2UL)                   /*!< GPIO PADREGD: PAD12INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGD_PAD12PULL_Pos        (0UL)                     /*!< GPIO PADREGD: PAD12PULL (Bit 0)                       */
+#define GPIO_PADREGD_PAD12PULL_Msk        (0x1UL)                   /*!< GPIO PADREGD: PAD12PULL (Bitfield-Mask: 0x01)         */
+/* ========================================================  PADREGE  ======================================================== */
+#define GPIO_PADREGE_PAD19FNCSEL_Pos      (27UL)                    /*!< GPIO PADREGE: PAD19FNCSEL (Bit 27)                    */
+#define GPIO_PADREGE_PAD19FNCSEL_Msk      (0x38000000UL)            /*!< GPIO PADREGE: PAD19FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGE_PAD19STRNG_Pos       (26UL)                    /*!< GPIO PADREGE: PAD19STRNG (Bit 26)                     */
+#define GPIO_PADREGE_PAD19STRNG_Msk       (0x4000000UL)             /*!< GPIO PADREGE: PAD19STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGE_PAD19INPEN_Pos       (25UL)                    /*!< GPIO PADREGE: PAD19INPEN (Bit 25)                     */
+#define GPIO_PADREGE_PAD19INPEN_Msk       (0x2000000UL)             /*!< GPIO PADREGE: PAD19INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGE_PAD19PULL_Pos        (24UL)                    /*!< GPIO PADREGE: PAD19PULL (Bit 24)                      */
+#define GPIO_PADREGE_PAD19PULL_Msk        (0x1000000UL)             /*!< GPIO PADREGE: PAD19PULL (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGE_PAD18FNCSEL_Pos      (19UL)                    /*!< GPIO PADREGE: PAD18FNCSEL (Bit 19)                    */
+#define GPIO_PADREGE_PAD18FNCSEL_Msk      (0x380000UL)              /*!< GPIO PADREGE: PAD18FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGE_PAD18STRNG_Pos       (18UL)                    /*!< GPIO PADREGE: PAD18STRNG (Bit 18)                     */
+#define GPIO_PADREGE_PAD18STRNG_Msk       (0x40000UL)               /*!< GPIO PADREGE: PAD18STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGE_PAD18INPEN_Pos       (17UL)                    /*!< GPIO PADREGE: PAD18INPEN (Bit 17)                     */
+#define GPIO_PADREGE_PAD18INPEN_Msk       (0x20000UL)               /*!< GPIO PADREGE: PAD18INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGE_PAD18PULL_Pos        (16UL)                    /*!< GPIO PADREGE: PAD18PULL (Bit 16)                      */
+#define GPIO_PADREGE_PAD18PULL_Msk        (0x10000UL)               /*!< GPIO PADREGE: PAD18PULL (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGE_PAD17FNCSEL_Pos      (11UL)                    /*!< GPIO PADREGE: PAD17FNCSEL (Bit 11)                    */
+#define GPIO_PADREGE_PAD17FNCSEL_Msk      (0x3800UL)                /*!< GPIO PADREGE: PAD17FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGE_PAD17STRNG_Pos       (10UL)                    /*!< GPIO PADREGE: PAD17STRNG (Bit 10)                     */
+#define GPIO_PADREGE_PAD17STRNG_Msk       (0x400UL)                 /*!< GPIO PADREGE: PAD17STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGE_PAD17INPEN_Pos       (9UL)                     /*!< GPIO PADREGE: PAD17INPEN (Bit 9)                      */
+#define GPIO_PADREGE_PAD17INPEN_Msk       (0x200UL)                 /*!< GPIO PADREGE: PAD17INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGE_PAD17PULL_Pos        (8UL)                     /*!< GPIO PADREGE: PAD17PULL (Bit 8)                       */
+#define GPIO_PADREGE_PAD17PULL_Msk        (0x100UL)                 /*!< GPIO PADREGE: PAD17PULL (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGE_PAD16FNCSEL_Pos      (3UL)                     /*!< GPIO PADREGE: PAD16FNCSEL (Bit 3)                     */
+#define GPIO_PADREGE_PAD16FNCSEL_Msk      (0x38UL)                  /*!< GPIO PADREGE: PAD16FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGE_PAD16STRNG_Pos       (2UL)                     /*!< GPIO PADREGE: PAD16STRNG (Bit 2)                      */
+#define GPIO_PADREGE_PAD16STRNG_Msk       (0x4UL)                   /*!< GPIO PADREGE: PAD16STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGE_PAD16INPEN_Pos       (1UL)                     /*!< GPIO PADREGE: PAD16INPEN (Bit 1)                      */
+#define GPIO_PADREGE_PAD16INPEN_Msk       (0x2UL)                   /*!< GPIO PADREGE: PAD16INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGE_PAD16PULL_Pos        (0UL)                     /*!< GPIO PADREGE: PAD16PULL (Bit 0)                       */
+#define GPIO_PADREGE_PAD16PULL_Msk        (0x1UL)                   /*!< GPIO PADREGE: PAD16PULL (Bitfield-Mask: 0x01)         */
+/* ========================================================  PADREGF  ======================================================== */
+#define GPIO_PADREGF_PAD23FNCSEL_Pos      (27UL)                    /*!< GPIO PADREGF: PAD23FNCSEL (Bit 27)                    */
+#define GPIO_PADREGF_PAD23FNCSEL_Msk      (0x38000000UL)            /*!< GPIO PADREGF: PAD23FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGF_PAD23STRNG_Pos       (26UL)                    /*!< GPIO PADREGF: PAD23STRNG (Bit 26)                     */
+#define GPIO_PADREGF_PAD23STRNG_Msk       (0x4000000UL)             /*!< GPIO PADREGF: PAD23STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGF_PAD23INPEN_Pos       (25UL)                    /*!< GPIO PADREGF: PAD23INPEN (Bit 25)                     */
+#define GPIO_PADREGF_PAD23INPEN_Msk       (0x2000000UL)             /*!< GPIO PADREGF: PAD23INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGF_PAD23PULL_Pos        (24UL)                    /*!< GPIO PADREGF: PAD23PULL (Bit 24)                      */
+#define GPIO_PADREGF_PAD23PULL_Msk        (0x1000000UL)             /*!< GPIO PADREGF: PAD23PULL (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGF_PAD22PWRUP_Pos       (23UL)                    /*!< GPIO PADREGF: PAD22PWRUP (Bit 23)                     */
+#define GPIO_PADREGF_PAD22PWRUP_Msk       (0x800000UL)              /*!< GPIO PADREGF: PAD22PWRUP (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGF_PAD22FNCSEL_Pos      (19UL)                    /*!< GPIO PADREGF: PAD22FNCSEL (Bit 19)                    */
+#define GPIO_PADREGF_PAD22FNCSEL_Msk      (0x380000UL)              /*!< GPIO PADREGF: PAD22FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGF_PAD22STRNG_Pos       (18UL)                    /*!< GPIO PADREGF: PAD22STRNG (Bit 18)                     */
+#define GPIO_PADREGF_PAD22STRNG_Msk       (0x40000UL)               /*!< GPIO PADREGF: PAD22STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGF_PAD22INPEN_Pos       (17UL)                    /*!< GPIO PADREGF: PAD22INPEN (Bit 17)                     */
+#define GPIO_PADREGF_PAD22INPEN_Msk       (0x20000UL)               /*!< GPIO PADREGF: PAD22INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGF_PAD22PULL_Pos        (16UL)                    /*!< GPIO PADREGF: PAD22PULL (Bit 16)                      */
+#define GPIO_PADREGF_PAD22PULL_Msk        (0x10000UL)               /*!< GPIO PADREGF: PAD22PULL (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGF_PAD21FNCSEL_Pos      (11UL)                    /*!< GPIO PADREGF: PAD21FNCSEL (Bit 11)                    */
+#define GPIO_PADREGF_PAD21FNCSEL_Msk      (0x3800UL)                /*!< GPIO PADREGF: PAD21FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGF_PAD21STRNG_Pos       (10UL)                    /*!< GPIO PADREGF: PAD21STRNG (Bit 10)                     */
+#define GPIO_PADREGF_PAD21STRNG_Msk       (0x400UL)                 /*!< GPIO PADREGF: PAD21STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGF_PAD21INPEN_Pos       (9UL)                     /*!< GPIO PADREGF: PAD21INPEN (Bit 9)                      */
+#define GPIO_PADREGF_PAD21INPEN_Msk       (0x200UL)                 /*!< GPIO PADREGF: PAD21INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGF_PAD21PULL_Pos        (8UL)                     /*!< GPIO PADREGF: PAD21PULL (Bit 8)                       */
+#define GPIO_PADREGF_PAD21PULL_Msk        (0x100UL)                 /*!< GPIO PADREGF: PAD21PULL (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGF_PAD20FNCSEL_Pos      (3UL)                     /*!< GPIO PADREGF: PAD20FNCSEL (Bit 3)                     */
+#define GPIO_PADREGF_PAD20FNCSEL_Msk      (0x38UL)                  /*!< GPIO PADREGF: PAD20FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGF_PAD20STRNG_Pos       (2UL)                     /*!< GPIO PADREGF: PAD20STRNG (Bit 2)                      */
+#define GPIO_PADREGF_PAD20STRNG_Msk       (0x4UL)                   /*!< GPIO PADREGF: PAD20STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGF_PAD20INPEN_Pos       (1UL)                     /*!< GPIO PADREGF: PAD20INPEN (Bit 1)                      */
+#define GPIO_PADREGF_PAD20INPEN_Msk       (0x2UL)                   /*!< GPIO PADREGF: PAD20INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGF_PAD20PULL_Pos        (0UL)                     /*!< GPIO PADREGF: PAD20PULL (Bit 0)                       */
+#define GPIO_PADREGF_PAD20PULL_Msk        (0x1UL)                   /*!< GPIO PADREGF: PAD20PULL (Bitfield-Mask: 0x01)         */
+/* ========================================================  PADREGG  ======================================================== */
+#define GPIO_PADREGG_PAD27RSEL_Pos        (30UL)                    /*!< GPIO PADREGG: PAD27RSEL (Bit 30)                      */
+#define GPIO_PADREGG_PAD27RSEL_Msk        (0xc0000000UL)            /*!< GPIO PADREGG: PAD27RSEL (Bitfield-Mask: 0x03)         */
+#define GPIO_PADREGG_PAD27FNCSEL_Pos      (27UL)                    /*!< GPIO PADREGG: PAD27FNCSEL (Bit 27)                    */
+#define GPIO_PADREGG_PAD27FNCSEL_Msk      (0x38000000UL)            /*!< GPIO PADREGG: PAD27FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGG_PAD27STRNG_Pos       (26UL)                    /*!< GPIO PADREGG: PAD27STRNG (Bit 26)                     */
+#define GPIO_PADREGG_PAD27STRNG_Msk       (0x4000000UL)             /*!< GPIO PADREGG: PAD27STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGG_PAD27INPEN_Pos       (25UL)                    /*!< GPIO PADREGG: PAD27INPEN (Bit 25)                     */
+#define GPIO_PADREGG_PAD27INPEN_Msk       (0x2000000UL)             /*!< GPIO PADREGG: PAD27INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGG_PAD27PULL_Pos        (24UL)                    /*!< GPIO PADREGG: PAD27PULL (Bit 24)                      */
+#define GPIO_PADREGG_PAD27PULL_Msk        (0x1000000UL)             /*!< GPIO PADREGG: PAD27PULL (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGG_PAD26FNCSEL_Pos      (19UL)                    /*!< GPIO PADREGG: PAD26FNCSEL (Bit 19)                    */
+#define GPIO_PADREGG_PAD26FNCSEL_Msk      (0x380000UL)              /*!< GPIO PADREGG: PAD26FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGG_PAD26STRNG_Pos       (18UL)                    /*!< GPIO PADREGG: PAD26STRNG (Bit 18)                     */
+#define GPIO_PADREGG_PAD26STRNG_Msk       (0x40000UL)               /*!< GPIO PADREGG: PAD26STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGG_PAD26INPEN_Pos       (17UL)                    /*!< GPIO PADREGG: PAD26INPEN (Bit 17)                     */
+#define GPIO_PADREGG_PAD26INPEN_Msk       (0x20000UL)               /*!< GPIO PADREGG: PAD26INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGG_PAD26PULL_Pos        (16UL)                    /*!< GPIO PADREGG: PAD26PULL (Bit 16)                      */
+#define GPIO_PADREGG_PAD26PULL_Msk        (0x10000UL)               /*!< GPIO PADREGG: PAD26PULL (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGG_PAD25RSEL_Pos        (14UL)                    /*!< GPIO PADREGG: PAD25RSEL (Bit 14)                      */
+#define GPIO_PADREGG_PAD25RSEL_Msk        (0xc000UL)                /*!< GPIO PADREGG: PAD25RSEL (Bitfield-Mask: 0x03)         */
+#define GPIO_PADREGG_PAD25FNCSEL_Pos      (11UL)                    /*!< GPIO PADREGG: PAD25FNCSEL (Bit 11)                    */
+#define GPIO_PADREGG_PAD25FNCSEL_Msk      (0x3800UL)                /*!< GPIO PADREGG: PAD25FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGG_PAD25STRNG_Pos       (10UL)                    /*!< GPIO PADREGG: PAD25STRNG (Bit 10)                     */
+#define GPIO_PADREGG_PAD25STRNG_Msk       (0x400UL)                 /*!< GPIO PADREGG: PAD25STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGG_PAD25INPEN_Pos       (9UL)                     /*!< GPIO PADREGG: PAD25INPEN (Bit 9)                      */
+#define GPIO_PADREGG_PAD25INPEN_Msk       (0x200UL)                 /*!< GPIO PADREGG: PAD25INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGG_PAD25PULL_Pos        (8UL)                     /*!< GPIO PADREGG: PAD25PULL (Bit 8)                       */
+#define GPIO_PADREGG_PAD25PULL_Msk        (0x100UL)                 /*!< GPIO PADREGG: PAD25PULL (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGG_PAD24FNCSEL_Pos      (3UL)                     /*!< GPIO PADREGG: PAD24FNCSEL (Bit 3)                     */
+#define GPIO_PADREGG_PAD24FNCSEL_Msk      (0x38UL)                  /*!< GPIO PADREGG: PAD24FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGG_PAD24STRNG_Pos       (2UL)                     /*!< GPIO PADREGG: PAD24STRNG (Bit 2)                      */
+#define GPIO_PADREGG_PAD24STRNG_Msk       (0x4UL)                   /*!< GPIO PADREGG: PAD24STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGG_PAD24INPEN_Pos       (1UL)                     /*!< GPIO PADREGG: PAD24INPEN (Bit 1)                      */
+#define GPIO_PADREGG_PAD24INPEN_Msk       (0x2UL)                   /*!< GPIO PADREGG: PAD24INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGG_PAD24PULL_Pos        (0UL)                     /*!< GPIO PADREGG: PAD24PULL (Bit 0)                       */
+#define GPIO_PADREGG_PAD24PULL_Msk        (0x1UL)                   /*!< GPIO PADREGG: PAD24PULL (Bitfield-Mask: 0x01)         */
+/* ========================================================  PADREGH  ======================================================== */
+#define GPIO_PADREGH_PAD31FNCSEL_Pos      (27UL)                    /*!< GPIO PADREGH: PAD31FNCSEL (Bit 27)                    */
+#define GPIO_PADREGH_PAD31FNCSEL_Msk      (0x38000000UL)            /*!< GPIO PADREGH: PAD31FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGH_PAD31STRNG_Pos       (26UL)                    /*!< GPIO PADREGH: PAD31STRNG (Bit 26)                     */
+#define GPIO_PADREGH_PAD31STRNG_Msk       (0x4000000UL)             /*!< GPIO PADREGH: PAD31STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGH_PAD31INPEN_Pos       (25UL)                    /*!< GPIO PADREGH: PAD31INPEN (Bit 25)                     */
+#define GPIO_PADREGH_PAD31INPEN_Msk       (0x2000000UL)             /*!< GPIO PADREGH: PAD31INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGH_PAD31PULL_Pos        (24UL)                    /*!< GPIO PADREGH: PAD31PULL (Bit 24)                      */
+#define GPIO_PADREGH_PAD31PULL_Msk        (0x1000000UL)             /*!< GPIO PADREGH: PAD31PULL (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGH_PAD30FNCSEL_Pos      (19UL)                    /*!< GPIO PADREGH: PAD30FNCSEL (Bit 19)                    */
+#define GPIO_PADREGH_PAD30FNCSEL_Msk      (0x380000UL)              /*!< GPIO PADREGH: PAD30FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGH_PAD30STRNG_Pos       (18UL)                    /*!< GPIO PADREGH: PAD30STRNG (Bit 18)                     */
+#define GPIO_PADREGH_PAD30STRNG_Msk       (0x40000UL)               /*!< GPIO PADREGH: PAD30STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGH_PAD30INPEN_Pos       (17UL)                    /*!< GPIO PADREGH: PAD30INPEN (Bit 17)                     */
+#define GPIO_PADREGH_PAD30INPEN_Msk       (0x20000UL)               /*!< GPIO PADREGH: PAD30INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGH_PAD30PULL_Pos        (16UL)                    /*!< GPIO PADREGH: PAD30PULL (Bit 16)                      */
+#define GPIO_PADREGH_PAD30PULL_Msk        (0x10000UL)               /*!< GPIO PADREGH: PAD30PULL (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGH_PAD29FNCSEL_Pos      (11UL)                    /*!< GPIO PADREGH: PAD29FNCSEL (Bit 11)                    */
+#define GPIO_PADREGH_PAD29FNCSEL_Msk      (0x3800UL)                /*!< GPIO PADREGH: PAD29FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGH_PAD29STRNG_Pos       (10UL)                    /*!< GPIO PADREGH: PAD29STRNG (Bit 10)                     */
+#define GPIO_PADREGH_PAD29STRNG_Msk       (0x400UL)                 /*!< GPIO PADREGH: PAD29STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGH_PAD29INPEN_Pos       (9UL)                     /*!< GPIO PADREGH: PAD29INPEN (Bit 9)                      */
+#define GPIO_PADREGH_PAD29INPEN_Msk       (0x200UL)                 /*!< GPIO PADREGH: PAD29INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGH_PAD29PULL_Pos        (8UL)                     /*!< GPIO PADREGH: PAD29PULL (Bit 8)                       */
+#define GPIO_PADREGH_PAD29PULL_Msk        (0x100UL)                 /*!< GPIO PADREGH: PAD29PULL (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGH_PAD28FNCSEL_Pos      (3UL)                     /*!< GPIO PADREGH: PAD28FNCSEL (Bit 3)                     */
+#define GPIO_PADREGH_PAD28FNCSEL_Msk      (0x38UL)                  /*!< GPIO PADREGH: PAD28FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGH_PAD28STRNG_Pos       (2UL)                     /*!< GPIO PADREGH: PAD28STRNG (Bit 2)                      */
+#define GPIO_PADREGH_PAD28STRNG_Msk       (0x4UL)                   /*!< GPIO PADREGH: PAD28STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGH_PAD28INPEN_Pos       (1UL)                     /*!< GPIO PADREGH: PAD28INPEN (Bit 1)                      */
+#define GPIO_PADREGH_PAD28INPEN_Msk       (0x2UL)                   /*!< GPIO PADREGH: PAD28INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGH_PAD28PULL_Pos        (0UL)                     /*!< GPIO PADREGH: PAD28PULL (Bit 0)                       */
+#define GPIO_PADREGH_PAD28PULL_Msk        (0x1UL)                   /*!< GPIO PADREGH: PAD28PULL (Bitfield-Mask: 0x01)         */
+/* ========================================================  PADREGI  ======================================================== */
+#define GPIO_PADREGI_PAD35FNCSEL_Pos      (27UL)                    /*!< GPIO PADREGI: PAD35FNCSEL (Bit 27)                    */
+#define GPIO_PADREGI_PAD35FNCSEL_Msk      (0x38000000UL)            /*!< GPIO PADREGI: PAD35FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGI_PAD35STRNG_Pos       (26UL)                    /*!< GPIO PADREGI: PAD35STRNG (Bit 26)                     */
+#define GPIO_PADREGI_PAD35STRNG_Msk       (0x4000000UL)             /*!< GPIO PADREGI: PAD35STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGI_PAD35INPEN_Pos       (25UL)                    /*!< GPIO PADREGI: PAD35INPEN (Bit 25)                     */
+#define GPIO_PADREGI_PAD35INPEN_Msk       (0x2000000UL)             /*!< GPIO PADREGI: PAD35INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGI_PAD35PULL_Pos        (24UL)                    /*!< GPIO PADREGI: PAD35PULL (Bit 24)                      */
+#define GPIO_PADREGI_PAD35PULL_Msk        (0x1000000UL)             /*!< GPIO PADREGI: PAD35PULL (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGI_PAD34FNCSEL_Pos      (19UL)                    /*!< GPIO PADREGI: PAD34FNCSEL (Bit 19)                    */
+#define GPIO_PADREGI_PAD34FNCSEL_Msk      (0x380000UL)              /*!< GPIO PADREGI: PAD34FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGI_PAD34STRNG_Pos       (18UL)                    /*!< GPIO PADREGI: PAD34STRNG (Bit 18)                     */
+#define GPIO_PADREGI_PAD34STRNG_Msk       (0x40000UL)               /*!< GPIO PADREGI: PAD34STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGI_PAD34INPEN_Pos       (17UL)                    /*!< GPIO PADREGI: PAD34INPEN (Bit 17)                     */
+#define GPIO_PADREGI_PAD34INPEN_Msk       (0x20000UL)               /*!< GPIO PADREGI: PAD34INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGI_PAD34PULL_Pos        (16UL)                    /*!< GPIO PADREGI: PAD34PULL (Bit 16)                      */
+#define GPIO_PADREGI_PAD34PULL_Msk        (0x10000UL)               /*!< GPIO PADREGI: PAD34PULL (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGI_PAD33FNCSEL_Pos      (11UL)                    /*!< GPIO PADREGI: PAD33FNCSEL (Bit 11)                    */
+#define GPIO_PADREGI_PAD33FNCSEL_Msk      (0x3800UL)                /*!< GPIO PADREGI: PAD33FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGI_PAD33STRNG_Pos       (10UL)                    /*!< GPIO PADREGI: PAD33STRNG (Bit 10)                     */
+#define GPIO_PADREGI_PAD33STRNG_Msk       (0x400UL)                 /*!< GPIO PADREGI: PAD33STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGI_PAD33INPEN_Pos       (9UL)                     /*!< GPIO PADREGI: PAD33INPEN (Bit 9)                      */
+#define GPIO_PADREGI_PAD33INPEN_Msk       (0x200UL)                 /*!< GPIO PADREGI: PAD33INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGI_PAD33PULL_Pos        (8UL)                     /*!< GPIO PADREGI: PAD33PULL (Bit 8)                       */
+#define GPIO_PADREGI_PAD33PULL_Msk        (0x100UL)                 /*!< GPIO PADREGI: PAD33PULL (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGI_PAD32FNCSEL_Pos      (3UL)                     /*!< GPIO PADREGI: PAD32FNCSEL (Bit 3)                     */
+#define GPIO_PADREGI_PAD32FNCSEL_Msk      (0x38UL)                  /*!< GPIO PADREGI: PAD32FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGI_PAD32STRNG_Pos       (2UL)                     /*!< GPIO PADREGI: PAD32STRNG (Bit 2)                      */
+#define GPIO_PADREGI_PAD32STRNG_Msk       (0x4UL)                   /*!< GPIO PADREGI: PAD32STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGI_PAD32INPEN_Pos       (1UL)                     /*!< GPIO PADREGI: PAD32INPEN (Bit 1)                      */
+#define GPIO_PADREGI_PAD32INPEN_Msk       (0x2UL)                   /*!< GPIO PADREGI: PAD32INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGI_PAD32PULL_Pos        (0UL)                     /*!< GPIO PADREGI: PAD32PULL (Bit 0)                       */
+#define GPIO_PADREGI_PAD32PULL_Msk        (0x1UL)                   /*!< GPIO PADREGI: PAD32PULL (Bitfield-Mask: 0x01)         */
+/* ========================================================  PADREGJ  ======================================================== */
+#define GPIO_PADREGJ_PAD39RSEL_Pos        (30UL)                    /*!< GPIO PADREGJ: PAD39RSEL (Bit 30)                      */
+#define GPIO_PADREGJ_PAD39RSEL_Msk        (0xc0000000UL)            /*!< GPIO PADREGJ: PAD39RSEL (Bitfield-Mask: 0x03)         */
+#define GPIO_PADREGJ_PAD39FNCSEL_Pos      (27UL)                    /*!< GPIO PADREGJ: PAD39FNCSEL (Bit 27)                    */
+#define GPIO_PADREGJ_PAD39FNCSEL_Msk      (0x38000000UL)            /*!< GPIO PADREGJ: PAD39FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGJ_PAD39STRNG_Pos       (26UL)                    /*!< GPIO PADREGJ: PAD39STRNG (Bit 26)                     */
+#define GPIO_PADREGJ_PAD39STRNG_Msk       (0x4000000UL)             /*!< GPIO PADREGJ: PAD39STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGJ_PAD39INPEN_Pos       (25UL)                    /*!< GPIO PADREGJ: PAD39INPEN (Bit 25)                     */
+#define GPIO_PADREGJ_PAD39INPEN_Msk       (0x2000000UL)             /*!< GPIO PADREGJ: PAD39INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGJ_PAD39PULL_Pos        (24UL)                    /*!< GPIO PADREGJ: PAD39PULL (Bit 24)                      */
+#define GPIO_PADREGJ_PAD39PULL_Msk        (0x1000000UL)             /*!< GPIO PADREGJ: PAD39PULL (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGJ_PAD38FNCSEL_Pos      (19UL)                    /*!< GPIO PADREGJ: PAD38FNCSEL (Bit 19)                    */
+#define GPIO_PADREGJ_PAD38FNCSEL_Msk      (0x380000UL)              /*!< GPIO PADREGJ: PAD38FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGJ_PAD38STRNG_Pos       (18UL)                    /*!< GPIO PADREGJ: PAD38STRNG (Bit 18)                     */
+#define GPIO_PADREGJ_PAD38STRNG_Msk       (0x40000UL)               /*!< GPIO PADREGJ: PAD38STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGJ_PAD38INPEN_Pos       (17UL)                    /*!< GPIO PADREGJ: PAD38INPEN (Bit 17)                     */
+#define GPIO_PADREGJ_PAD38INPEN_Msk       (0x20000UL)               /*!< GPIO PADREGJ: PAD38INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGJ_PAD38PULL_Pos        (16UL)                    /*!< GPIO PADREGJ: PAD38PULL (Bit 16)                      */
+#define GPIO_PADREGJ_PAD38PULL_Msk        (0x10000UL)               /*!< GPIO PADREGJ: PAD38PULL (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGJ_PAD37FNCSEL_Pos      (11UL)                    /*!< GPIO PADREGJ: PAD37FNCSEL (Bit 11)                    */
+#define GPIO_PADREGJ_PAD37FNCSEL_Msk      (0x3800UL)                /*!< GPIO PADREGJ: PAD37FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGJ_PAD37STRNG_Pos       (10UL)                    /*!< GPIO PADREGJ: PAD37STRNG (Bit 10)                     */
+#define GPIO_PADREGJ_PAD37STRNG_Msk       (0x400UL)                 /*!< GPIO PADREGJ: PAD37STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGJ_PAD37INPEN_Pos       (9UL)                     /*!< GPIO PADREGJ: PAD37INPEN (Bit 9)                      */
+#define GPIO_PADREGJ_PAD37INPEN_Msk       (0x200UL)                 /*!< GPIO PADREGJ: PAD37INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGJ_PAD37PULL_Pos        (8UL)                     /*!< GPIO PADREGJ: PAD37PULL (Bit 8)                       */
+#define GPIO_PADREGJ_PAD37PULL_Msk        (0x100UL)                 /*!< GPIO PADREGJ: PAD37PULL (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGJ_PAD36FNCSEL_Pos      (3UL)                     /*!< GPIO PADREGJ: PAD36FNCSEL (Bit 3)                     */
+#define GPIO_PADREGJ_PAD36FNCSEL_Msk      (0x38UL)                  /*!< GPIO PADREGJ: PAD36FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGJ_PAD36STRNG_Pos       (2UL)                     /*!< GPIO PADREGJ: PAD36STRNG (Bit 2)                      */
+#define GPIO_PADREGJ_PAD36STRNG_Msk       (0x4UL)                   /*!< GPIO PADREGJ: PAD36STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGJ_PAD36INPEN_Pos       (1UL)                     /*!< GPIO PADREGJ: PAD36INPEN (Bit 1)                      */
+#define GPIO_PADREGJ_PAD36INPEN_Msk       (0x2UL)                   /*!< GPIO PADREGJ: PAD36INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGJ_PAD36PULL_Pos        (0UL)                     /*!< GPIO PADREGJ: PAD36PULL (Bit 0)                       */
+#define GPIO_PADREGJ_PAD36PULL_Msk        (0x1UL)                   /*!< GPIO PADREGJ: PAD36PULL (Bitfield-Mask: 0x01)         */
+/* ========================================================  PADREGK  ======================================================== */
+#define GPIO_PADREGK_PAD43RSEL_Pos        (30UL)                    /*!< GPIO PADREGK: PAD43RSEL (Bit 30)                      */
+#define GPIO_PADREGK_PAD43RSEL_Msk        (0xc0000000UL)            /*!< GPIO PADREGK: PAD43RSEL (Bitfield-Mask: 0x03)         */
+#define GPIO_PADREGK_PAD43FNCSEL_Pos      (27UL)                    /*!< GPIO PADREGK: PAD43FNCSEL (Bit 27)                    */
+#define GPIO_PADREGK_PAD43FNCSEL_Msk      (0x38000000UL)            /*!< GPIO PADREGK: PAD43FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGK_PAD43STRNG_Pos       (26UL)                    /*!< GPIO PADREGK: PAD43STRNG (Bit 26)                     */
+#define GPIO_PADREGK_PAD43STRNG_Msk       (0x4000000UL)             /*!< GPIO PADREGK: PAD43STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGK_PAD43INPEN_Pos       (25UL)                    /*!< GPIO PADREGK: PAD43INPEN (Bit 25)                     */
+#define GPIO_PADREGK_PAD43INPEN_Msk       (0x2000000UL)             /*!< GPIO PADREGK: PAD43INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGK_PAD43PULL_Pos        (24UL)                    /*!< GPIO PADREGK: PAD43PULL (Bit 24)                      */
+#define GPIO_PADREGK_PAD43PULL_Msk        (0x1000000UL)             /*!< GPIO PADREGK: PAD43PULL (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGK_PAD42RSEL_Pos        (22UL)                    /*!< GPIO PADREGK: PAD42RSEL (Bit 22)                      */
+#define GPIO_PADREGK_PAD42RSEL_Msk        (0xc00000UL)              /*!< GPIO PADREGK: PAD42RSEL (Bitfield-Mask: 0x03)         */
+#define GPIO_PADREGK_PAD42FNCSEL_Pos      (19UL)                    /*!< GPIO PADREGK: PAD42FNCSEL (Bit 19)                    */
+#define GPIO_PADREGK_PAD42FNCSEL_Msk      (0x380000UL)              /*!< GPIO PADREGK: PAD42FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGK_PAD42STRNG_Pos       (18UL)                    /*!< GPIO PADREGK: PAD42STRNG (Bit 18)                     */
+#define GPIO_PADREGK_PAD42STRNG_Msk       (0x40000UL)               /*!< GPIO PADREGK: PAD42STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGK_PAD42INPEN_Pos       (17UL)                    /*!< GPIO PADREGK: PAD42INPEN (Bit 17)                     */
+#define GPIO_PADREGK_PAD42INPEN_Msk       (0x20000UL)               /*!< GPIO PADREGK: PAD42INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGK_PAD42PULL_Pos        (16UL)                    /*!< GPIO PADREGK: PAD42PULL (Bit 16)                      */
+#define GPIO_PADREGK_PAD42PULL_Msk        (0x10000UL)               /*!< GPIO PADREGK: PAD42PULL (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGK_PAD41PWRUP_Pos       (15UL)                    /*!< GPIO PADREGK: PAD41PWRUP (Bit 15)                     */
+#define GPIO_PADREGK_PAD41PWRUP_Msk       (0x8000UL)                /*!< GPIO PADREGK: PAD41PWRUP (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGK_PAD41FNCSEL_Pos      (11UL)                    /*!< GPIO PADREGK: PAD41FNCSEL (Bit 11)                    */
+#define GPIO_PADREGK_PAD41FNCSEL_Msk      (0x3800UL)                /*!< GPIO PADREGK: PAD41FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGK_PAD41STRNG_Pos       (10UL)                    /*!< GPIO PADREGK: PAD41STRNG (Bit 10)                     */
+#define GPIO_PADREGK_PAD41STRNG_Msk       (0x400UL)                 /*!< GPIO PADREGK: PAD41STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGK_PAD41INPEN_Pos       (9UL)                     /*!< GPIO PADREGK: PAD41INPEN (Bit 9)                      */
+#define GPIO_PADREGK_PAD41INPEN_Msk       (0x200UL)                 /*!< GPIO PADREGK: PAD41INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGK_PAD41PULL_Pos        (8UL)                     /*!< GPIO PADREGK: PAD41PULL (Bit 8)                       */
+#define GPIO_PADREGK_PAD41PULL_Msk        (0x100UL)                 /*!< GPIO PADREGK: PAD41PULL (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGK_PAD40RSEL_Pos        (6UL)                     /*!< GPIO PADREGK: PAD40RSEL (Bit 6)                       */
+#define GPIO_PADREGK_PAD40RSEL_Msk        (0xc0UL)                  /*!< GPIO PADREGK: PAD40RSEL (Bitfield-Mask: 0x03)         */
+#define GPIO_PADREGK_PAD40FNCSEL_Pos      (3UL)                     /*!< GPIO PADREGK: PAD40FNCSEL (Bit 3)                     */
+#define GPIO_PADREGK_PAD40FNCSEL_Msk      (0x38UL)                  /*!< GPIO PADREGK: PAD40FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGK_PAD40STRNG_Pos       (2UL)                     /*!< GPIO PADREGK: PAD40STRNG (Bit 2)                      */
+#define GPIO_PADREGK_PAD40STRNG_Msk       (0x4UL)                   /*!< GPIO PADREGK: PAD40STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGK_PAD40INPEN_Pos       (1UL)                     /*!< GPIO PADREGK: PAD40INPEN (Bit 1)                      */
+#define GPIO_PADREGK_PAD40INPEN_Msk       (0x2UL)                   /*!< GPIO PADREGK: PAD40INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGK_PAD40PULL_Pos        (0UL)                     /*!< GPIO PADREGK: PAD40PULL (Bit 0)                       */
+#define GPIO_PADREGK_PAD40PULL_Msk        (0x1UL)                   /*!< GPIO PADREGK: PAD40PULL (Bitfield-Mask: 0x01)         */
+/* ========================================================  PADREGL  ======================================================== */
+#define GPIO_PADREGL_PAD47FNCSEL_Pos      (27UL)                    /*!< GPIO PADREGL: PAD47FNCSEL (Bit 27)                    */
+#define GPIO_PADREGL_PAD47FNCSEL_Msk      (0x38000000UL)            /*!< GPIO PADREGL: PAD47FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGL_PAD47STRNG_Pos       (26UL)                    /*!< GPIO PADREGL: PAD47STRNG (Bit 26)                     */
+#define GPIO_PADREGL_PAD47STRNG_Msk       (0x4000000UL)             /*!< GPIO PADREGL: PAD47STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGL_PAD47INPEN_Pos       (25UL)                    /*!< GPIO PADREGL: PAD47INPEN (Bit 25)                     */
+#define GPIO_PADREGL_PAD47INPEN_Msk       (0x2000000UL)             /*!< GPIO PADREGL: PAD47INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGL_PAD47PULL_Pos        (24UL)                    /*!< GPIO PADREGL: PAD47PULL (Bit 24)                      */
+#define GPIO_PADREGL_PAD47PULL_Msk        (0x1000000UL)             /*!< GPIO PADREGL: PAD47PULL (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGL_PAD46FNCSEL_Pos      (19UL)                    /*!< GPIO PADREGL: PAD46FNCSEL (Bit 19)                    */
+#define GPIO_PADREGL_PAD46FNCSEL_Msk      (0x380000UL)              /*!< GPIO PADREGL: PAD46FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGL_PAD46STRNG_Pos       (18UL)                    /*!< GPIO PADREGL: PAD46STRNG (Bit 18)                     */
+#define GPIO_PADREGL_PAD46STRNG_Msk       (0x40000UL)               /*!< GPIO PADREGL: PAD46STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGL_PAD46INPEN_Pos       (17UL)                    /*!< GPIO PADREGL: PAD46INPEN (Bit 17)                     */
+#define GPIO_PADREGL_PAD46INPEN_Msk       (0x20000UL)               /*!< GPIO PADREGL: PAD46INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGL_PAD46PULL_Pos        (16UL)                    /*!< GPIO PADREGL: PAD46PULL (Bit 16)                      */
+#define GPIO_PADREGL_PAD46PULL_Msk        (0x10000UL)               /*!< GPIO PADREGL: PAD46PULL (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGL_PAD45FNCSEL_Pos      (11UL)                    /*!< GPIO PADREGL: PAD45FNCSEL (Bit 11)                    */
+#define GPIO_PADREGL_PAD45FNCSEL_Msk      (0x3800UL)                /*!< GPIO PADREGL: PAD45FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGL_PAD45STRNG_Pos       (10UL)                    /*!< GPIO PADREGL: PAD45STRNG (Bit 10)                     */
+#define GPIO_PADREGL_PAD45STRNG_Msk       (0x400UL)                 /*!< GPIO PADREGL: PAD45STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGL_PAD45INPEN_Pos       (9UL)                     /*!< GPIO PADREGL: PAD45INPEN (Bit 9)                      */
+#define GPIO_PADREGL_PAD45INPEN_Msk       (0x200UL)                 /*!< GPIO PADREGL: PAD45INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGL_PAD45PULL_Pos        (8UL)                     /*!< GPIO PADREGL: PAD45PULL (Bit 8)                       */
+#define GPIO_PADREGL_PAD45PULL_Msk        (0x100UL)                 /*!< GPIO PADREGL: PAD45PULL (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGL_PAD44FNCSEL_Pos      (3UL)                     /*!< GPIO PADREGL: PAD44FNCSEL (Bit 3)                     */
+#define GPIO_PADREGL_PAD44FNCSEL_Msk      (0x38UL)                  /*!< GPIO PADREGL: PAD44FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGL_PAD44STRNG_Pos       (2UL)                     /*!< GPIO PADREGL: PAD44STRNG (Bit 2)                      */
+#define GPIO_PADREGL_PAD44STRNG_Msk       (0x4UL)                   /*!< GPIO PADREGL: PAD44STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGL_PAD44INPEN_Pos       (1UL)                     /*!< GPIO PADREGL: PAD44INPEN (Bit 1)                      */
+#define GPIO_PADREGL_PAD44INPEN_Msk       (0x2UL)                   /*!< GPIO PADREGL: PAD44INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGL_PAD44PULL_Pos        (0UL)                     /*!< GPIO PADREGL: PAD44PULL (Bit 0)                       */
+#define GPIO_PADREGL_PAD44PULL_Msk        (0x1UL)                   /*!< GPIO PADREGL: PAD44PULL (Bitfield-Mask: 0x01)         */
+/* ========================================================  PADREGM  ======================================================== */
+#define GPIO_PADREGM_PAD49RSEL_Pos        (14UL)                    /*!< GPIO PADREGM: PAD49RSEL (Bit 14)                      */
+#define GPIO_PADREGM_PAD49RSEL_Msk        (0xc000UL)                /*!< GPIO PADREGM: PAD49RSEL (Bitfield-Mask: 0x03)         */
+#define GPIO_PADREGM_PAD49FNCSEL_Pos      (11UL)                    /*!< GPIO PADREGM: PAD49FNCSEL (Bit 11)                    */
+#define GPIO_PADREGM_PAD49FNCSEL_Msk      (0x3800UL)                /*!< GPIO PADREGM: PAD49FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGM_PAD49STRNG_Pos       (10UL)                    /*!< GPIO PADREGM: PAD49STRNG (Bit 10)                     */
+#define GPIO_PADREGM_PAD49STRNG_Msk       (0x400UL)                 /*!< GPIO PADREGM: PAD49STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGM_PAD49INPEN_Pos       (9UL)                     /*!< GPIO PADREGM: PAD49INPEN (Bit 9)                      */
+#define GPIO_PADREGM_PAD49INPEN_Msk       (0x200UL)                 /*!< GPIO PADREGM: PAD49INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGM_PAD49PULL_Pos        (8UL)                     /*!< GPIO PADREGM: PAD49PULL (Bit 8)                       */
+#define GPIO_PADREGM_PAD49PULL_Msk        (0x100UL)                 /*!< GPIO PADREGM: PAD49PULL (Bitfield-Mask: 0x01)         */
+#define GPIO_PADREGM_PAD48RSEL_Pos        (6UL)                     /*!< GPIO PADREGM: PAD48RSEL (Bit 6)                       */
+#define GPIO_PADREGM_PAD48RSEL_Msk        (0xc0UL)                  /*!< GPIO PADREGM: PAD48RSEL (Bitfield-Mask: 0x03)         */
+#define GPIO_PADREGM_PAD48FNCSEL_Pos      (3UL)                     /*!< GPIO PADREGM: PAD48FNCSEL (Bit 3)                     */
+#define GPIO_PADREGM_PAD48FNCSEL_Msk      (0x38UL)                  /*!< GPIO PADREGM: PAD48FNCSEL (Bitfield-Mask: 0x07)       */
+#define GPIO_PADREGM_PAD48STRNG_Pos       (2UL)                     /*!< GPIO PADREGM: PAD48STRNG (Bit 2)                      */
+#define GPIO_PADREGM_PAD48STRNG_Msk       (0x4UL)                   /*!< GPIO PADREGM: PAD48STRNG (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGM_PAD48INPEN_Pos       (1UL)                     /*!< GPIO PADREGM: PAD48INPEN (Bit 1)                      */
+#define GPIO_PADREGM_PAD48INPEN_Msk       (0x2UL)                   /*!< GPIO PADREGM: PAD48INPEN (Bitfield-Mask: 0x01)        */
+#define GPIO_PADREGM_PAD48PULL_Pos        (0UL)                     /*!< GPIO PADREGM: PAD48PULL (Bit 0)                       */
+#define GPIO_PADREGM_PAD48PULL_Msk        (0x1UL)                   /*!< GPIO PADREGM: PAD48PULL (Bitfield-Mask: 0x01)         */
+/* =========================================================  CFGA  ========================================================== */
+#define GPIO_CFGA_GPIO7INTD_Pos           (31UL)                    /*!< GPIO CFGA: GPIO7INTD (Bit 31)                         */
+#define GPIO_CFGA_GPIO7INTD_Msk           (0x80000000UL)            /*!< GPIO CFGA: GPIO7INTD (Bitfield-Mask: 0x01)            */
+#define GPIO_CFGA_GPIO7OUTCFG_Pos         (29UL)                    /*!< GPIO CFGA: GPIO7OUTCFG (Bit 29)                       */
+#define GPIO_CFGA_GPIO7OUTCFG_Msk         (0x60000000UL)            /*!< GPIO CFGA: GPIO7OUTCFG (Bitfield-Mask: 0x03)          */
+#define GPIO_CFGA_GPIO7INCFG_Pos          (28UL)                    /*!< GPIO CFGA: GPIO7INCFG (Bit 28)                        */
+#define GPIO_CFGA_GPIO7INCFG_Msk          (0x10000000UL)            /*!< GPIO CFGA: GPIO7INCFG (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGA_GPIO6INTD_Pos           (27UL)                    /*!< GPIO CFGA: GPIO6INTD (Bit 27)                         */
+#define GPIO_CFGA_GPIO6INTD_Msk           (0x8000000UL)             /*!< GPIO CFGA: GPIO6INTD (Bitfield-Mask: 0x01)            */
+#define GPIO_CFGA_GPIO6OUTCFG_Pos         (25UL)                    /*!< GPIO CFGA: GPIO6OUTCFG (Bit 25)                       */
+#define GPIO_CFGA_GPIO6OUTCFG_Msk         (0x6000000UL)             /*!< GPIO CFGA: GPIO6OUTCFG (Bitfield-Mask: 0x03)          */
+#define GPIO_CFGA_GPIO6INCFG_Pos          (24UL)                    /*!< GPIO CFGA: GPIO6INCFG (Bit 24)                        */
+#define GPIO_CFGA_GPIO6INCFG_Msk          (0x1000000UL)             /*!< GPIO CFGA: GPIO6INCFG (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGA_GPIO5INTD_Pos           (23UL)                    /*!< GPIO CFGA: GPIO5INTD (Bit 23)                         */
+#define GPIO_CFGA_GPIO5INTD_Msk           (0x800000UL)              /*!< GPIO CFGA: GPIO5INTD (Bitfield-Mask: 0x01)            */
+#define GPIO_CFGA_GPIO5OUTCFG_Pos         (21UL)                    /*!< GPIO CFGA: GPIO5OUTCFG (Bit 21)                       */
+#define GPIO_CFGA_GPIO5OUTCFG_Msk         (0x600000UL)              /*!< GPIO CFGA: GPIO5OUTCFG (Bitfield-Mask: 0x03)          */
+#define GPIO_CFGA_GPIO5INCFG_Pos          (20UL)                    /*!< GPIO CFGA: GPIO5INCFG (Bit 20)                        */
+#define GPIO_CFGA_GPIO5INCFG_Msk          (0x100000UL)              /*!< GPIO CFGA: GPIO5INCFG (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGA_GPIO4INTD_Pos           (19UL)                    /*!< GPIO CFGA: GPIO4INTD (Bit 19)                         */
+#define GPIO_CFGA_GPIO4INTD_Msk           (0x80000UL)               /*!< GPIO CFGA: GPIO4INTD (Bitfield-Mask: 0x01)            */
+#define GPIO_CFGA_GPIO4OUTCFG_Pos         (17UL)                    /*!< GPIO CFGA: GPIO4OUTCFG (Bit 17)                       */
+#define GPIO_CFGA_GPIO4OUTCFG_Msk         (0x60000UL)               /*!< GPIO CFGA: GPIO4OUTCFG (Bitfield-Mask: 0x03)          */
+#define GPIO_CFGA_GPIO4INCFG_Pos          (16UL)                    /*!< GPIO CFGA: GPIO4INCFG (Bit 16)                        */
+#define GPIO_CFGA_GPIO4INCFG_Msk          (0x10000UL)               /*!< GPIO CFGA: GPIO4INCFG (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGA_GPIO3INTD_Pos           (15UL)                    /*!< GPIO CFGA: GPIO3INTD (Bit 15)                         */
+#define GPIO_CFGA_GPIO3INTD_Msk           (0x8000UL)                /*!< GPIO CFGA: GPIO3INTD (Bitfield-Mask: 0x01)            */
+#define GPIO_CFGA_GPIO3OUTCFG_Pos         (13UL)                    /*!< GPIO CFGA: GPIO3OUTCFG (Bit 13)                       */
+#define GPIO_CFGA_GPIO3OUTCFG_Msk         (0x6000UL)                /*!< GPIO CFGA: GPIO3OUTCFG (Bitfield-Mask: 0x03)          */
+#define GPIO_CFGA_GPIO3INCFG_Pos          (12UL)                    /*!< GPIO CFGA: GPIO3INCFG (Bit 12)                        */
+#define GPIO_CFGA_GPIO3INCFG_Msk          (0x1000UL)                /*!< GPIO CFGA: GPIO3INCFG (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGA_GPIO2INTD_Pos           (11UL)                    /*!< GPIO CFGA: GPIO2INTD (Bit 11)                         */
+#define GPIO_CFGA_GPIO2INTD_Msk           (0x800UL)                 /*!< GPIO CFGA: GPIO2INTD (Bitfield-Mask: 0x01)            */
+#define GPIO_CFGA_GPIO2OUTCFG_Pos         (9UL)                     /*!< GPIO CFGA: GPIO2OUTCFG (Bit 9)                        */
+#define GPIO_CFGA_GPIO2OUTCFG_Msk         (0x600UL)                 /*!< GPIO CFGA: GPIO2OUTCFG (Bitfield-Mask: 0x03)          */
+#define GPIO_CFGA_GPIO2INCFG_Pos          (8UL)                     /*!< GPIO CFGA: GPIO2INCFG (Bit 8)                         */
+#define GPIO_CFGA_GPIO2INCFG_Msk          (0x100UL)                 /*!< GPIO CFGA: GPIO2INCFG (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGA_GPIO1INTD_Pos           (7UL)                     /*!< GPIO CFGA: GPIO1INTD (Bit 7)                          */
+#define GPIO_CFGA_GPIO1INTD_Msk           (0x80UL)                  /*!< GPIO CFGA: GPIO1INTD (Bitfield-Mask: 0x01)            */
+#define GPIO_CFGA_GPIO1OUTCFG_Pos         (5UL)                     /*!< GPIO CFGA: GPIO1OUTCFG (Bit 5)                        */
+#define GPIO_CFGA_GPIO1OUTCFG_Msk         (0x60UL)                  /*!< GPIO CFGA: GPIO1OUTCFG (Bitfield-Mask: 0x03)          */
+#define GPIO_CFGA_GPIO1INCFG_Pos          (4UL)                     /*!< GPIO CFGA: GPIO1INCFG (Bit 4)                         */
+#define GPIO_CFGA_GPIO1INCFG_Msk          (0x10UL)                  /*!< GPIO CFGA: GPIO1INCFG (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGA_GPIO0INTD_Pos           (3UL)                     /*!< GPIO CFGA: GPIO0INTD (Bit 3)                          */
+#define GPIO_CFGA_GPIO0INTD_Msk           (0x8UL)                   /*!< GPIO CFGA: GPIO0INTD (Bitfield-Mask: 0x01)            */
+#define GPIO_CFGA_GPIO0OUTCFG_Pos         (1UL)                     /*!< GPIO CFGA: GPIO0OUTCFG (Bit 1)                        */
+#define GPIO_CFGA_GPIO0OUTCFG_Msk         (0x6UL)                   /*!< GPIO CFGA: GPIO0OUTCFG (Bitfield-Mask: 0x03)          */
+#define GPIO_CFGA_GPIO0INCFG_Pos          (0UL)                     /*!< GPIO CFGA: GPIO0INCFG (Bit 0)                         */
+#define GPIO_CFGA_GPIO0INCFG_Msk          (0x1UL)                   /*!< GPIO CFGA: GPIO0INCFG (Bitfield-Mask: 0x01)           */
+/* =========================================================  CFGB  ========================================================== */
+#define GPIO_CFGB_GPIO15INTD_Pos          (31UL)                    /*!< GPIO CFGB: GPIO15INTD (Bit 31)                        */
+#define GPIO_CFGB_GPIO15INTD_Msk          (0x80000000UL)            /*!< GPIO CFGB: GPIO15INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGB_GPIO15OUTCFG_Pos        (29UL)                    /*!< GPIO CFGB: GPIO15OUTCFG (Bit 29)                      */
+#define GPIO_CFGB_GPIO15OUTCFG_Msk        (0x60000000UL)            /*!< GPIO CFGB: GPIO15OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGB_GPIO15INCFG_Pos         (28UL)                    /*!< GPIO CFGB: GPIO15INCFG (Bit 28)                       */
+#define GPIO_CFGB_GPIO15INCFG_Msk         (0x10000000UL)            /*!< GPIO CFGB: GPIO15INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGB_GPIO14INTD_Pos          (27UL)                    /*!< GPIO CFGB: GPIO14INTD (Bit 27)                        */
+#define GPIO_CFGB_GPIO14INTD_Msk          (0x8000000UL)             /*!< GPIO CFGB: GPIO14INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGB_GPIO14OUTCFG_Pos        (25UL)                    /*!< GPIO CFGB: GPIO14OUTCFG (Bit 25)                      */
+#define GPIO_CFGB_GPIO14OUTCFG_Msk        (0x6000000UL)             /*!< GPIO CFGB: GPIO14OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGB_GPIO14INCFG_Pos         (24UL)                    /*!< GPIO CFGB: GPIO14INCFG (Bit 24)                       */
+#define GPIO_CFGB_GPIO14INCFG_Msk         (0x1000000UL)             /*!< GPIO CFGB: GPIO14INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGB_GPIO13INTD_Pos          (23UL)                    /*!< GPIO CFGB: GPIO13INTD (Bit 23)                        */
+#define GPIO_CFGB_GPIO13INTD_Msk          (0x800000UL)              /*!< GPIO CFGB: GPIO13INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGB_GPIO13OUTCFG_Pos        (21UL)                    /*!< GPIO CFGB: GPIO13OUTCFG (Bit 21)                      */
+#define GPIO_CFGB_GPIO13OUTCFG_Msk        (0x600000UL)              /*!< GPIO CFGB: GPIO13OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGB_GPIO13INCFG_Pos         (20UL)                    /*!< GPIO CFGB: GPIO13INCFG (Bit 20)                       */
+#define GPIO_CFGB_GPIO13INCFG_Msk         (0x100000UL)              /*!< GPIO CFGB: GPIO13INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGB_GPIO12INTD_Pos          (19UL)                    /*!< GPIO CFGB: GPIO12INTD (Bit 19)                        */
+#define GPIO_CFGB_GPIO12INTD_Msk          (0x80000UL)               /*!< GPIO CFGB: GPIO12INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGB_GPIO12OUTCFG_Pos        (17UL)                    /*!< GPIO CFGB: GPIO12OUTCFG (Bit 17)                      */
+#define GPIO_CFGB_GPIO12OUTCFG_Msk        (0x60000UL)               /*!< GPIO CFGB: GPIO12OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGB_GPIO12INCFG_Pos         (16UL)                    /*!< GPIO CFGB: GPIO12INCFG (Bit 16)                       */
+#define GPIO_CFGB_GPIO12INCFG_Msk         (0x10000UL)               /*!< GPIO CFGB: GPIO12INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGB_GPIO11INTD_Pos          (15UL)                    /*!< GPIO CFGB: GPIO11INTD (Bit 15)                        */
+#define GPIO_CFGB_GPIO11INTD_Msk          (0x8000UL)                /*!< GPIO CFGB: GPIO11INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGB_GPIO11OUTCFG_Pos        (13UL)                    /*!< GPIO CFGB: GPIO11OUTCFG (Bit 13)                      */
+#define GPIO_CFGB_GPIO11OUTCFG_Msk        (0x6000UL)                /*!< GPIO CFGB: GPIO11OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGB_GPIO11INCFG_Pos         (12UL)                    /*!< GPIO CFGB: GPIO11INCFG (Bit 12)                       */
+#define GPIO_CFGB_GPIO11INCFG_Msk         (0x1000UL)                /*!< GPIO CFGB: GPIO11INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGB_GPIO10INTD_Pos          (11UL)                    /*!< GPIO CFGB: GPIO10INTD (Bit 11)                        */
+#define GPIO_CFGB_GPIO10INTD_Msk          (0x800UL)                 /*!< GPIO CFGB: GPIO10INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGB_GPIO10OUTCFG_Pos        (9UL)                     /*!< GPIO CFGB: GPIO10OUTCFG (Bit 9)                       */
+#define GPIO_CFGB_GPIO10OUTCFG_Msk        (0x600UL)                 /*!< GPIO CFGB: GPIO10OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGB_GPIO10INCFG_Pos         (8UL)                     /*!< GPIO CFGB: GPIO10INCFG (Bit 8)                        */
+#define GPIO_CFGB_GPIO10INCFG_Msk         (0x100UL)                 /*!< GPIO CFGB: GPIO10INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGB_GPIO9INTD_Pos           (7UL)                     /*!< GPIO CFGB: GPIO9INTD (Bit 7)                          */
+#define GPIO_CFGB_GPIO9INTD_Msk           (0x80UL)                  /*!< GPIO CFGB: GPIO9INTD (Bitfield-Mask: 0x01)            */
+#define GPIO_CFGB_GPIO9OUTCFG_Pos         (5UL)                     /*!< GPIO CFGB: GPIO9OUTCFG (Bit 5)                        */
+#define GPIO_CFGB_GPIO9OUTCFG_Msk         (0x60UL)                  /*!< GPIO CFGB: GPIO9OUTCFG (Bitfield-Mask: 0x03)          */
+#define GPIO_CFGB_GPIO9INCFG_Pos          (4UL)                     /*!< GPIO CFGB: GPIO9INCFG (Bit 4)                         */
+#define GPIO_CFGB_GPIO9INCFG_Msk          (0x10UL)                  /*!< GPIO CFGB: GPIO9INCFG (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGB_GPIO8INTD_Pos           (3UL)                     /*!< GPIO CFGB: GPIO8INTD (Bit 3)                          */
+#define GPIO_CFGB_GPIO8INTD_Msk           (0x8UL)                   /*!< GPIO CFGB: GPIO8INTD (Bitfield-Mask: 0x01)            */
+#define GPIO_CFGB_GPIO8OUTCFG_Pos         (1UL)                     /*!< GPIO CFGB: GPIO8OUTCFG (Bit 1)                        */
+#define GPIO_CFGB_GPIO8OUTCFG_Msk         (0x6UL)                   /*!< GPIO CFGB: GPIO8OUTCFG (Bitfield-Mask: 0x03)          */
+#define GPIO_CFGB_GPIO8INCFG_Pos          (0UL)                     /*!< GPIO CFGB: GPIO8INCFG (Bit 0)                         */
+#define GPIO_CFGB_GPIO8INCFG_Msk          (0x1UL)                   /*!< GPIO CFGB: GPIO8INCFG (Bitfield-Mask: 0x01)           */
+/* =========================================================  CFGC  ========================================================== */
+#define GPIO_CFGC_GPIO23INTD_Pos          (31UL)                    /*!< GPIO CFGC: GPIO23INTD (Bit 31)                        */
+#define GPIO_CFGC_GPIO23INTD_Msk          (0x80000000UL)            /*!< GPIO CFGC: GPIO23INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGC_GPIO23OUTCFG_Pos        (29UL)                    /*!< GPIO CFGC: GPIO23OUTCFG (Bit 29)                      */
+#define GPIO_CFGC_GPIO23OUTCFG_Msk        (0x60000000UL)            /*!< GPIO CFGC: GPIO23OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGC_GPIO23INCFG_Pos         (28UL)                    /*!< GPIO CFGC: GPIO23INCFG (Bit 28)                       */
+#define GPIO_CFGC_GPIO23INCFG_Msk         (0x10000000UL)            /*!< GPIO CFGC: GPIO23INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGC_GPIO22INTD_Pos          (27UL)                    /*!< GPIO CFGC: GPIO22INTD (Bit 27)                        */
+#define GPIO_CFGC_GPIO22INTD_Msk          (0x8000000UL)             /*!< GPIO CFGC: GPIO22INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGC_GPIO22OUTCFG_Pos        (25UL)                    /*!< GPIO CFGC: GPIO22OUTCFG (Bit 25)                      */
+#define GPIO_CFGC_GPIO22OUTCFG_Msk        (0x6000000UL)             /*!< GPIO CFGC: GPIO22OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGC_GPIO22INCFG_Pos         (24UL)                    /*!< GPIO CFGC: GPIO22INCFG (Bit 24)                       */
+#define GPIO_CFGC_GPIO22INCFG_Msk         (0x1000000UL)             /*!< GPIO CFGC: GPIO22INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGC_GPIO21INTD_Pos          (23UL)                    /*!< GPIO CFGC: GPIO21INTD (Bit 23)                        */
+#define GPIO_CFGC_GPIO21INTD_Msk          (0x800000UL)              /*!< GPIO CFGC: GPIO21INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGC_GPIO21OUTCFG_Pos        (21UL)                    /*!< GPIO CFGC: GPIO21OUTCFG (Bit 21)                      */
+#define GPIO_CFGC_GPIO21OUTCFG_Msk        (0x600000UL)              /*!< GPIO CFGC: GPIO21OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGC_GPIO21INCFG_Pos         (20UL)                    /*!< GPIO CFGC: GPIO21INCFG (Bit 20)                       */
+#define GPIO_CFGC_GPIO21INCFG_Msk         (0x100000UL)              /*!< GPIO CFGC: GPIO21INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGC_GPIO20INTD_Pos          (19UL)                    /*!< GPIO CFGC: GPIO20INTD (Bit 19)                        */
+#define GPIO_CFGC_GPIO20INTD_Msk          (0x80000UL)               /*!< GPIO CFGC: GPIO20INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGC_GPIO20OUTCFG_Pos        (17UL)                    /*!< GPIO CFGC: GPIO20OUTCFG (Bit 17)                      */
+#define GPIO_CFGC_GPIO20OUTCFG_Msk        (0x60000UL)               /*!< GPIO CFGC: GPIO20OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGC_GPIO20INCFG_Pos         (16UL)                    /*!< GPIO CFGC: GPIO20INCFG (Bit 16)                       */
+#define GPIO_CFGC_GPIO20INCFG_Msk         (0x10000UL)               /*!< GPIO CFGC: GPIO20INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGC_GPIO19INTD_Pos          (15UL)                    /*!< GPIO CFGC: GPIO19INTD (Bit 15)                        */
+#define GPIO_CFGC_GPIO19INTD_Msk          (0x8000UL)                /*!< GPIO CFGC: GPIO19INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGC_GPIO19OUTCFG_Pos        (13UL)                    /*!< GPIO CFGC: GPIO19OUTCFG (Bit 13)                      */
+#define GPIO_CFGC_GPIO19OUTCFG_Msk        (0x6000UL)                /*!< GPIO CFGC: GPIO19OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGC_GPIO19INCFG_Pos         (12UL)                    /*!< GPIO CFGC: GPIO19INCFG (Bit 12)                       */
+#define GPIO_CFGC_GPIO19INCFG_Msk         (0x1000UL)                /*!< GPIO CFGC: GPIO19INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGC_GPIO18INTD_Pos          (11UL)                    /*!< GPIO CFGC: GPIO18INTD (Bit 11)                        */
+#define GPIO_CFGC_GPIO18INTD_Msk          (0x800UL)                 /*!< GPIO CFGC: GPIO18INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGC_GPIO18OUTCFG_Pos        (9UL)                     /*!< GPIO CFGC: GPIO18OUTCFG (Bit 9)                       */
+#define GPIO_CFGC_GPIO18OUTCFG_Msk        (0x600UL)                 /*!< GPIO CFGC: GPIO18OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGC_GPIO18INCFG_Pos         (8UL)                     /*!< GPIO CFGC: GPIO18INCFG (Bit 8)                        */
+#define GPIO_CFGC_GPIO18INCFG_Msk         (0x100UL)                 /*!< GPIO CFGC: GPIO18INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGC_GPIO17INTD_Pos          (7UL)                     /*!< GPIO CFGC: GPIO17INTD (Bit 7)                         */
+#define GPIO_CFGC_GPIO17INTD_Msk          (0x80UL)                  /*!< GPIO CFGC: GPIO17INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGC_GPIO17OUTCFG_Pos        (5UL)                     /*!< GPIO CFGC: GPIO17OUTCFG (Bit 5)                       */
+#define GPIO_CFGC_GPIO17OUTCFG_Msk        (0x60UL)                  /*!< GPIO CFGC: GPIO17OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGC_GPIO17INCFG_Pos         (4UL)                     /*!< GPIO CFGC: GPIO17INCFG (Bit 4)                        */
+#define GPIO_CFGC_GPIO17INCFG_Msk         (0x10UL)                  /*!< GPIO CFGC: GPIO17INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGC_GPIO16INTD_Pos          (3UL)                     /*!< GPIO CFGC: GPIO16INTD (Bit 3)                         */
+#define GPIO_CFGC_GPIO16INTD_Msk          (0x8UL)                   /*!< GPIO CFGC: GPIO16INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGC_GPIO16OUTCFG_Pos        (1UL)                     /*!< GPIO CFGC: GPIO16OUTCFG (Bit 1)                       */
+#define GPIO_CFGC_GPIO16OUTCFG_Msk        (0x6UL)                   /*!< GPIO CFGC: GPIO16OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGC_GPIO16INCFG_Pos         (0UL)                     /*!< GPIO CFGC: GPIO16INCFG (Bit 0)                        */
+#define GPIO_CFGC_GPIO16INCFG_Msk         (0x1UL)                   /*!< GPIO CFGC: GPIO16INCFG (Bitfield-Mask: 0x01)          */
+/* =========================================================  CFGD  ========================================================== */
+#define GPIO_CFGD_GPIO31INTD_Pos          (31UL)                    /*!< GPIO CFGD: GPIO31INTD (Bit 31)                        */
+#define GPIO_CFGD_GPIO31INTD_Msk          (0x80000000UL)            /*!< GPIO CFGD: GPIO31INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGD_GPIO31OUTCFG_Pos        (29UL)                    /*!< GPIO CFGD: GPIO31OUTCFG (Bit 29)                      */
+#define GPIO_CFGD_GPIO31OUTCFG_Msk        (0x60000000UL)            /*!< GPIO CFGD: GPIO31OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGD_GPIO31INCFG_Pos         (28UL)                    /*!< GPIO CFGD: GPIO31INCFG (Bit 28)                       */
+#define GPIO_CFGD_GPIO31INCFG_Msk         (0x10000000UL)            /*!< GPIO CFGD: GPIO31INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGD_GPIO30INTD_Pos          (27UL)                    /*!< GPIO CFGD: GPIO30INTD (Bit 27)                        */
+#define GPIO_CFGD_GPIO30INTD_Msk          (0x8000000UL)             /*!< GPIO CFGD: GPIO30INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGD_GPIO30OUTCFG_Pos        (25UL)                    /*!< GPIO CFGD: GPIO30OUTCFG (Bit 25)                      */
+#define GPIO_CFGD_GPIO30OUTCFG_Msk        (0x6000000UL)             /*!< GPIO CFGD: GPIO30OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGD_GPIO30INCFG_Pos         (24UL)                    /*!< GPIO CFGD: GPIO30INCFG (Bit 24)                       */
+#define GPIO_CFGD_GPIO30INCFG_Msk         (0x1000000UL)             /*!< GPIO CFGD: GPIO30INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGD_GPIO29INTD_Pos          (23UL)                    /*!< GPIO CFGD: GPIO29INTD (Bit 23)                        */
+#define GPIO_CFGD_GPIO29INTD_Msk          (0x800000UL)              /*!< GPIO CFGD: GPIO29INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGD_GPIO29OUTCFG_Pos        (21UL)                    /*!< GPIO CFGD: GPIO29OUTCFG (Bit 21)                      */
+#define GPIO_CFGD_GPIO29OUTCFG_Msk        (0x600000UL)              /*!< GPIO CFGD: GPIO29OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGD_GPIO29INCFG_Pos         (20UL)                    /*!< GPIO CFGD: GPIO29INCFG (Bit 20)                       */
+#define GPIO_CFGD_GPIO29INCFG_Msk         (0x100000UL)              /*!< GPIO CFGD: GPIO29INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGD_GPIO28INTD_Pos          (19UL)                    /*!< GPIO CFGD: GPIO28INTD (Bit 19)                        */
+#define GPIO_CFGD_GPIO28INTD_Msk          (0x80000UL)               /*!< GPIO CFGD: GPIO28INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGD_GPIO28OUTCFG_Pos        (17UL)                    /*!< GPIO CFGD: GPIO28OUTCFG (Bit 17)                      */
+#define GPIO_CFGD_GPIO28OUTCFG_Msk        (0x60000UL)               /*!< GPIO CFGD: GPIO28OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGD_GPIO28INCFG_Pos         (16UL)                    /*!< GPIO CFGD: GPIO28INCFG (Bit 16)                       */
+#define GPIO_CFGD_GPIO28INCFG_Msk         (0x10000UL)               /*!< GPIO CFGD: GPIO28INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGD_GPIO27INTD_Pos          (15UL)                    /*!< GPIO CFGD: GPIO27INTD (Bit 15)                        */
+#define GPIO_CFGD_GPIO27INTD_Msk          (0x8000UL)                /*!< GPIO CFGD: GPIO27INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGD_GPIO27OUTCFG_Pos        (13UL)                    /*!< GPIO CFGD: GPIO27OUTCFG (Bit 13)                      */
+#define GPIO_CFGD_GPIO27OUTCFG_Msk        (0x6000UL)                /*!< GPIO CFGD: GPIO27OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGD_GPIO27INCFG_Pos         (12UL)                    /*!< GPIO CFGD: GPIO27INCFG (Bit 12)                       */
+#define GPIO_CFGD_GPIO27INCFG_Msk         (0x1000UL)                /*!< GPIO CFGD: GPIO27INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGD_GPIO26INTD_Pos          (11UL)                    /*!< GPIO CFGD: GPIO26INTD (Bit 11)                        */
+#define GPIO_CFGD_GPIO26INTD_Msk          (0x800UL)                 /*!< GPIO CFGD: GPIO26INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGD_GPIO26OUTCFG_Pos        (9UL)                     /*!< GPIO CFGD: GPIO26OUTCFG (Bit 9)                       */
+#define GPIO_CFGD_GPIO26OUTCFG_Msk        (0x600UL)                 /*!< GPIO CFGD: GPIO26OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGD_GPIO26INCFG_Pos         (8UL)                     /*!< GPIO CFGD: GPIO26INCFG (Bit 8)                        */
+#define GPIO_CFGD_GPIO26INCFG_Msk         (0x100UL)                 /*!< GPIO CFGD: GPIO26INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGD_GPIO25INTD_Pos          (7UL)                     /*!< GPIO CFGD: GPIO25INTD (Bit 7)                         */
+#define GPIO_CFGD_GPIO25INTD_Msk          (0x80UL)                  /*!< GPIO CFGD: GPIO25INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGD_GPIO25OUTCFG_Pos        (5UL)                     /*!< GPIO CFGD: GPIO25OUTCFG (Bit 5)                       */
+#define GPIO_CFGD_GPIO25OUTCFG_Msk        (0x60UL)                  /*!< GPIO CFGD: GPIO25OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGD_GPIO25INCFG_Pos         (4UL)                     /*!< GPIO CFGD: GPIO25INCFG (Bit 4)                        */
+#define GPIO_CFGD_GPIO25INCFG_Msk         (0x10UL)                  /*!< GPIO CFGD: GPIO25INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGD_GPIO24INTD_Pos          (3UL)                     /*!< GPIO CFGD: GPIO24INTD (Bit 3)                         */
+#define GPIO_CFGD_GPIO24INTD_Msk          (0x8UL)                   /*!< GPIO CFGD: GPIO24INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGD_GPIO24OUTCFG_Pos        (1UL)                     /*!< GPIO CFGD: GPIO24OUTCFG (Bit 1)                       */
+#define GPIO_CFGD_GPIO24OUTCFG_Msk        (0x6UL)                   /*!< GPIO CFGD: GPIO24OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGD_GPIO24INCFG_Pos         (0UL)                     /*!< GPIO CFGD: GPIO24INCFG (Bit 0)                        */
+#define GPIO_CFGD_GPIO24INCFG_Msk         (0x1UL)                   /*!< GPIO CFGD: GPIO24INCFG (Bitfield-Mask: 0x01)          */
+/* =========================================================  CFGE  ========================================================== */
+#define GPIO_CFGE_GPIO39INTD_Pos          (31UL)                    /*!< GPIO CFGE: GPIO39INTD (Bit 31)                        */
+#define GPIO_CFGE_GPIO39INTD_Msk          (0x80000000UL)            /*!< GPIO CFGE: GPIO39INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGE_GPIO39OUTCFG_Pos        (29UL)                    /*!< GPIO CFGE: GPIO39OUTCFG (Bit 29)                      */
+#define GPIO_CFGE_GPIO39OUTCFG_Msk        (0x60000000UL)            /*!< GPIO CFGE: GPIO39OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGE_GPIO39INCFG_Pos         (28UL)                    /*!< GPIO CFGE: GPIO39INCFG (Bit 28)                       */
+#define GPIO_CFGE_GPIO39INCFG_Msk         (0x10000000UL)            /*!< GPIO CFGE: GPIO39INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGE_GPIO38INTD_Pos          (27UL)                    /*!< GPIO CFGE: GPIO38INTD (Bit 27)                        */
+#define GPIO_CFGE_GPIO38INTD_Msk          (0x8000000UL)             /*!< GPIO CFGE: GPIO38INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGE_GPIO38OUTCFG_Pos        (25UL)                    /*!< GPIO CFGE: GPIO38OUTCFG (Bit 25)                      */
+#define GPIO_CFGE_GPIO38OUTCFG_Msk        (0x6000000UL)             /*!< GPIO CFGE: GPIO38OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGE_GPIO38INCFG_Pos         (24UL)                    /*!< GPIO CFGE: GPIO38INCFG (Bit 24)                       */
+#define GPIO_CFGE_GPIO38INCFG_Msk         (0x1000000UL)             /*!< GPIO CFGE: GPIO38INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGE_GPIO37INTD_Pos          (23UL)                    /*!< GPIO CFGE: GPIO37INTD (Bit 23)                        */
+#define GPIO_CFGE_GPIO37INTD_Msk          (0x800000UL)              /*!< GPIO CFGE: GPIO37INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGE_GPIO37OUTCFG_Pos        (21UL)                    /*!< GPIO CFGE: GPIO37OUTCFG (Bit 21)                      */
+#define GPIO_CFGE_GPIO37OUTCFG_Msk        (0x600000UL)              /*!< GPIO CFGE: GPIO37OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGE_GPIO37INCFG_Pos         (20UL)                    /*!< GPIO CFGE: GPIO37INCFG (Bit 20)                       */
+#define GPIO_CFGE_GPIO37INCFG_Msk         (0x100000UL)              /*!< GPIO CFGE: GPIO37INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGE_GPIO36INTD_Pos          (19UL)                    /*!< GPIO CFGE: GPIO36INTD (Bit 19)                        */
+#define GPIO_CFGE_GPIO36INTD_Msk          (0x80000UL)               /*!< GPIO CFGE: GPIO36INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGE_GPIO36OUTCFG_Pos        (17UL)                    /*!< GPIO CFGE: GPIO36OUTCFG (Bit 17)                      */
+#define GPIO_CFGE_GPIO36OUTCFG_Msk        (0x60000UL)               /*!< GPIO CFGE: GPIO36OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGE_GPIO36INCFG_Pos         (16UL)                    /*!< GPIO CFGE: GPIO36INCFG (Bit 16)                       */
+#define GPIO_CFGE_GPIO36INCFG_Msk         (0x10000UL)               /*!< GPIO CFGE: GPIO36INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGE_GPIO35INTD_Pos          (15UL)                    /*!< GPIO CFGE: GPIO35INTD (Bit 15)                        */
+#define GPIO_CFGE_GPIO35INTD_Msk          (0x8000UL)                /*!< GPIO CFGE: GPIO35INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGE_GPIO35OUTCFG_Pos        (13UL)                    /*!< GPIO CFGE: GPIO35OUTCFG (Bit 13)                      */
+#define GPIO_CFGE_GPIO35OUTCFG_Msk        (0x6000UL)                /*!< GPIO CFGE: GPIO35OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGE_GPIO35INCFG_Pos         (12UL)                    /*!< GPIO CFGE: GPIO35INCFG (Bit 12)                       */
+#define GPIO_CFGE_GPIO35INCFG_Msk         (0x1000UL)                /*!< GPIO CFGE: GPIO35INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGE_GPIO34INTD_Pos          (11UL)                    /*!< GPIO CFGE: GPIO34INTD (Bit 11)                        */
+#define GPIO_CFGE_GPIO34INTD_Msk          (0x800UL)                 /*!< GPIO CFGE: GPIO34INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGE_GPIO34OUTCFG_Pos        (9UL)                     /*!< GPIO CFGE: GPIO34OUTCFG (Bit 9)                       */
+#define GPIO_CFGE_GPIO34OUTCFG_Msk        (0x600UL)                 /*!< GPIO CFGE: GPIO34OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGE_GPIO34INCFG_Pos         (8UL)                     /*!< GPIO CFGE: GPIO34INCFG (Bit 8)                        */
+#define GPIO_CFGE_GPIO34INCFG_Msk         (0x100UL)                 /*!< GPIO CFGE: GPIO34INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGE_GPIO33INTD_Pos          (7UL)                     /*!< GPIO CFGE: GPIO33INTD (Bit 7)                         */
+#define GPIO_CFGE_GPIO33INTD_Msk          (0x80UL)                  /*!< GPIO CFGE: GPIO33INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGE_GPIO33OUTCFG_Pos        (5UL)                     /*!< GPIO CFGE: GPIO33OUTCFG (Bit 5)                       */
+#define GPIO_CFGE_GPIO33OUTCFG_Msk        (0x60UL)                  /*!< GPIO CFGE: GPIO33OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGE_GPIO33INCFG_Pos         (4UL)                     /*!< GPIO CFGE: GPIO33INCFG (Bit 4)                        */
+#define GPIO_CFGE_GPIO33INCFG_Msk         (0x10UL)                  /*!< GPIO CFGE: GPIO33INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGE_GPIO32INTD_Pos          (3UL)                     /*!< GPIO CFGE: GPIO32INTD (Bit 3)                         */
+#define GPIO_CFGE_GPIO32INTD_Msk          (0x8UL)                   /*!< GPIO CFGE: GPIO32INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGE_GPIO32OUTCFG_Pos        (1UL)                     /*!< GPIO CFGE: GPIO32OUTCFG (Bit 1)                       */
+#define GPIO_CFGE_GPIO32OUTCFG_Msk        (0x6UL)                   /*!< GPIO CFGE: GPIO32OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGE_GPIO32INCFG_Pos         (0UL)                     /*!< GPIO CFGE: GPIO32INCFG (Bit 0)                        */
+#define GPIO_CFGE_GPIO32INCFG_Msk         (0x1UL)                   /*!< GPIO CFGE: GPIO32INCFG (Bitfield-Mask: 0x01)          */
+/* =========================================================  CFGF  ========================================================== */
+#define GPIO_CFGF_GPIO47INTD_Pos          (31UL)                    /*!< GPIO CFGF: GPIO47INTD (Bit 31)                        */
+#define GPIO_CFGF_GPIO47INTD_Msk          (0x80000000UL)            /*!< GPIO CFGF: GPIO47INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGF_GPIO47OUTCFG_Pos        (29UL)                    /*!< GPIO CFGF: GPIO47OUTCFG (Bit 29)                      */
+#define GPIO_CFGF_GPIO47OUTCFG_Msk        (0x60000000UL)            /*!< GPIO CFGF: GPIO47OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGF_GPIO47INCFG_Pos         (28UL)                    /*!< GPIO CFGF: GPIO47INCFG (Bit 28)                       */
+#define GPIO_CFGF_GPIO47INCFG_Msk         (0x10000000UL)            /*!< GPIO CFGF: GPIO47INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGF_GPIO46INTD_Pos          (27UL)                    /*!< GPIO CFGF: GPIO46INTD (Bit 27)                        */
+#define GPIO_CFGF_GPIO46INTD_Msk          (0x8000000UL)             /*!< GPIO CFGF: GPIO46INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGF_GPIO46OUTCFG_Pos        (25UL)                    /*!< GPIO CFGF: GPIO46OUTCFG (Bit 25)                      */
+#define GPIO_CFGF_GPIO46OUTCFG_Msk        (0x6000000UL)             /*!< GPIO CFGF: GPIO46OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGF_GPIO46INCFG_Pos         (24UL)                    /*!< GPIO CFGF: GPIO46INCFG (Bit 24)                       */
+#define GPIO_CFGF_GPIO46INCFG_Msk         (0x1000000UL)             /*!< GPIO CFGF: GPIO46INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGF_GPIO45INTD_Pos          (23UL)                    /*!< GPIO CFGF: GPIO45INTD (Bit 23)                        */
+#define GPIO_CFGF_GPIO45INTD_Msk          (0x800000UL)              /*!< GPIO CFGF: GPIO45INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGF_GPIO45OUTCFG_Pos        (21UL)                    /*!< GPIO CFGF: GPIO45OUTCFG (Bit 21)                      */
+#define GPIO_CFGF_GPIO45OUTCFG_Msk        (0x600000UL)              /*!< GPIO CFGF: GPIO45OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGF_GPIO45INCFG_Pos         (20UL)                    /*!< GPIO CFGF: GPIO45INCFG (Bit 20)                       */
+#define GPIO_CFGF_GPIO45INCFG_Msk         (0x100000UL)              /*!< GPIO CFGF: GPIO45INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGF_GPIO44INTD_Pos          (19UL)                    /*!< GPIO CFGF: GPIO44INTD (Bit 19)                        */
+#define GPIO_CFGF_GPIO44INTD_Msk          (0x80000UL)               /*!< GPIO CFGF: GPIO44INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGF_GPIO44OUTCFG_Pos        (17UL)                    /*!< GPIO CFGF: GPIO44OUTCFG (Bit 17)                      */
+#define GPIO_CFGF_GPIO44OUTCFG_Msk        (0x60000UL)               /*!< GPIO CFGF: GPIO44OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGF_GPIO44INCFG_Pos         (16UL)                    /*!< GPIO CFGF: GPIO44INCFG (Bit 16)                       */
+#define GPIO_CFGF_GPIO44INCFG_Msk         (0x10000UL)               /*!< GPIO CFGF: GPIO44INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGF_GPIO43INTD_Pos          (15UL)                    /*!< GPIO CFGF: GPIO43INTD (Bit 15)                        */
+#define GPIO_CFGF_GPIO43INTD_Msk          (0x8000UL)                /*!< GPIO CFGF: GPIO43INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGF_GPIO43OUTCFG_Pos        (13UL)                    /*!< GPIO CFGF: GPIO43OUTCFG (Bit 13)                      */
+#define GPIO_CFGF_GPIO43OUTCFG_Msk        (0x6000UL)                /*!< GPIO CFGF: GPIO43OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGF_GPIO43INCFG_Pos         (12UL)                    /*!< GPIO CFGF: GPIO43INCFG (Bit 12)                       */
+#define GPIO_CFGF_GPIO43INCFG_Msk         (0x1000UL)                /*!< GPIO CFGF: GPIO43INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGF_GPIO42INTD_Pos          (11UL)                    /*!< GPIO CFGF: GPIO42INTD (Bit 11)                        */
+#define GPIO_CFGF_GPIO42INTD_Msk          (0x800UL)                 /*!< GPIO CFGF: GPIO42INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGF_GPIO42OUTCFG_Pos        (9UL)                     /*!< GPIO CFGF: GPIO42OUTCFG (Bit 9)                       */
+#define GPIO_CFGF_GPIO42OUTCFG_Msk        (0x600UL)                 /*!< GPIO CFGF: GPIO42OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGF_GPIO42INCFG_Pos         (8UL)                     /*!< GPIO CFGF: GPIO42INCFG (Bit 8)                        */
+#define GPIO_CFGF_GPIO42INCFG_Msk         (0x100UL)                 /*!< GPIO CFGF: GPIO42INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGF_GPIO41INTD_Pos          (7UL)                     /*!< GPIO CFGF: GPIO41INTD (Bit 7)                         */
+#define GPIO_CFGF_GPIO41INTD_Msk          (0x80UL)                  /*!< GPIO CFGF: GPIO41INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGF_GPIO41OUTCFG_Pos        (5UL)                     /*!< GPIO CFGF: GPIO41OUTCFG (Bit 5)                       */
+#define GPIO_CFGF_GPIO41OUTCFG_Msk        (0x60UL)                  /*!< GPIO CFGF: GPIO41OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGF_GPIO41INCFG_Pos         (4UL)                     /*!< GPIO CFGF: GPIO41INCFG (Bit 4)                        */
+#define GPIO_CFGF_GPIO41INCFG_Msk         (0x10UL)                  /*!< GPIO CFGF: GPIO41INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGF_GPIO40INTD_Pos          (3UL)                     /*!< GPIO CFGF: GPIO40INTD (Bit 3)                         */
+#define GPIO_CFGF_GPIO40INTD_Msk          (0x8UL)                   /*!< GPIO CFGF: GPIO40INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGF_GPIO40OUTCFG_Pos        (1UL)                     /*!< GPIO CFGF: GPIO40OUTCFG (Bit 1)                       */
+#define GPIO_CFGF_GPIO40OUTCFG_Msk        (0x6UL)                   /*!< GPIO CFGF: GPIO40OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGF_GPIO40INCFG_Pos         (0UL)                     /*!< GPIO CFGF: GPIO40INCFG (Bit 0)                        */
+#define GPIO_CFGF_GPIO40INCFG_Msk         (0x1UL)                   /*!< GPIO CFGF: GPIO40INCFG (Bitfield-Mask: 0x01)          */
+/* =========================================================  CFGG  ========================================================== */
+#define GPIO_CFGG_GPIO49INTD_Pos          (7UL)                     /*!< GPIO CFGG: GPIO49INTD (Bit 7)                         */
+#define GPIO_CFGG_GPIO49INTD_Msk          (0x80UL)                  /*!< GPIO CFGG: GPIO49INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGG_GPIO49OUTCFG_Pos        (5UL)                     /*!< GPIO CFGG: GPIO49OUTCFG (Bit 5)                       */
+#define GPIO_CFGG_GPIO49OUTCFG_Msk        (0x60UL)                  /*!< GPIO CFGG: GPIO49OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGG_GPIO49INCFG_Pos         (4UL)                     /*!< GPIO CFGG: GPIO49INCFG (Bit 4)                        */
+#define GPIO_CFGG_GPIO49INCFG_Msk         (0x10UL)                  /*!< GPIO CFGG: GPIO49INCFG (Bitfield-Mask: 0x01)          */
+#define GPIO_CFGG_GPIO48INTD_Pos          (3UL)                     /*!< GPIO CFGG: GPIO48INTD (Bit 3)                         */
+#define GPIO_CFGG_GPIO48INTD_Msk          (0x8UL)                   /*!< GPIO CFGG: GPIO48INTD (Bitfield-Mask: 0x01)           */
+#define GPIO_CFGG_GPIO48OUTCFG_Pos        (1UL)                     /*!< GPIO CFGG: GPIO48OUTCFG (Bit 1)                       */
+#define GPIO_CFGG_GPIO48OUTCFG_Msk        (0x6UL)                   /*!< GPIO CFGG: GPIO48OUTCFG (Bitfield-Mask: 0x03)         */
+#define GPIO_CFGG_GPIO48INCFG_Pos         (0UL)                     /*!< GPIO CFGG: GPIO48INCFG (Bit 0)                        */
+#define GPIO_CFGG_GPIO48INCFG_Msk         (0x1UL)                   /*!< GPIO CFGG: GPIO48INCFG (Bitfield-Mask: 0x01)          */
+/* ========================================================  PADKEY  ========================================================= */
+#define GPIO_PADKEY_PADKEY_Pos            (0UL)                     /*!< GPIO PADKEY: PADKEY (Bit 0)                           */
+#define GPIO_PADKEY_PADKEY_Msk            (0xffffffffUL)            /*!< GPIO PADKEY: PADKEY (Bitfield-Mask: 0xffffffff)       */
+/* ==========================================================  RDA  ========================================================== */
+#define GPIO_RDA_RDA_Pos                  (0UL)                     /*!< GPIO RDA: RDA (Bit 0)                                 */
+#define GPIO_RDA_RDA_Msk                  (0xffffffffUL)            /*!< GPIO RDA: RDA (Bitfield-Mask: 0xffffffff)             */
+/* ==========================================================  RDB  ========================================================== */
+#define GPIO_RDB_RDB_Pos                  (0UL)                     /*!< GPIO RDB: RDB (Bit 0)                                 */
+#define GPIO_RDB_RDB_Msk                  (0x3ffffUL)               /*!< GPIO RDB: RDB (Bitfield-Mask: 0x3ffff)                */
+/* ==========================================================  WTA  ========================================================== */
+#define GPIO_WTA_WTA_Pos                  (0UL)                     /*!< GPIO WTA: WTA (Bit 0)                                 */
+#define GPIO_WTA_WTA_Msk                  (0xffffffffUL)            /*!< GPIO WTA: WTA (Bitfield-Mask: 0xffffffff)             */
+/* ==========================================================  WTB  ========================================================== */
+#define GPIO_WTB_WTB_Pos                  (0UL)                     /*!< GPIO WTB: WTB (Bit 0)                                 */
+#define GPIO_WTB_WTB_Msk                  (0x3ffffUL)               /*!< GPIO WTB: WTB (Bitfield-Mask: 0x3ffff)                */
+/* =========================================================  WTSA  ========================================================== */
+#define GPIO_WTSA_WTSA_Pos                (0UL)                     /*!< GPIO WTSA: WTSA (Bit 0)                               */
+#define GPIO_WTSA_WTSA_Msk                (0xffffffffUL)            /*!< GPIO WTSA: WTSA (Bitfield-Mask: 0xffffffff)           */
+/* =========================================================  WTSB  ========================================================== */
+#define GPIO_WTSB_WTSB_Pos                (0UL)                     /*!< GPIO WTSB: WTSB (Bit 0)                               */
+#define GPIO_WTSB_WTSB_Msk                (0x3ffffUL)               /*!< GPIO WTSB: WTSB (Bitfield-Mask: 0x3ffff)              */
+/* =========================================================  WTCA  ========================================================== */
+#define GPIO_WTCA_WTCA_Pos                (0UL)                     /*!< GPIO WTCA: WTCA (Bit 0)                               */
+#define GPIO_WTCA_WTCA_Msk                (0xffffffffUL)            /*!< GPIO WTCA: WTCA (Bitfield-Mask: 0xffffffff)           */
+/* =========================================================  WTCB  ========================================================== */
+#define GPIO_WTCB_WTCB_Pos                (0UL)                     /*!< GPIO WTCB: WTCB (Bit 0)                               */
+#define GPIO_WTCB_WTCB_Msk                (0x3ffffUL)               /*!< GPIO WTCB: WTCB (Bitfield-Mask: 0x3ffff)              */
+/* ==========================================================  ENA  ========================================================== */
+#define GPIO_ENA_ENA_Pos                  (0UL)                     /*!< GPIO ENA: ENA (Bit 0)                                 */
+#define GPIO_ENA_ENA_Msk                  (0xffffffffUL)            /*!< GPIO ENA: ENA (Bitfield-Mask: 0xffffffff)             */
+/* ==========================================================  ENB  ========================================================== */
+#define GPIO_ENB_ENB_Pos                  (0UL)                     /*!< GPIO ENB: ENB (Bit 0)                                 */
+#define GPIO_ENB_ENB_Msk                  (0x3ffffUL)               /*!< GPIO ENB: ENB (Bitfield-Mask: 0x3ffff)                */
+/* =========================================================  ENSA  ========================================================== */
+#define GPIO_ENSA_ENSA_Pos                (0UL)                     /*!< GPIO ENSA: ENSA (Bit 0)                               */
+#define GPIO_ENSA_ENSA_Msk                (0xffffffffUL)            /*!< GPIO ENSA: ENSA (Bitfield-Mask: 0xffffffff)           */
+/* =========================================================  ENSB  ========================================================== */
+#define GPIO_ENSB_ENSB_Pos                (0UL)                     /*!< GPIO ENSB: ENSB (Bit 0)                               */
+#define GPIO_ENSB_ENSB_Msk                (0x3ffffUL)               /*!< GPIO ENSB: ENSB (Bitfield-Mask: 0x3ffff)              */
+/* =========================================================  ENCA  ========================================================== */
+#define GPIO_ENCA_ENCA_Pos                (0UL)                     /*!< GPIO ENCA: ENCA (Bit 0)                               */
+#define GPIO_ENCA_ENCA_Msk                (0xffffffffUL)            /*!< GPIO ENCA: ENCA (Bitfield-Mask: 0xffffffff)           */
+/* =========================================================  ENCB  ========================================================== */
+#define GPIO_ENCB_ENCB_Pos                (0UL)                     /*!< GPIO ENCB: ENCB (Bit 0)                               */
+#define GPIO_ENCB_ENCB_Msk                (0x3ffffUL)               /*!< GPIO ENCB: ENCB (Bitfield-Mask: 0x3ffff)              */
+/* ========================================================  STMRCAP  ======================================================== */
+#define GPIO_STMRCAP_STPOL3_Pos           (30UL)                    /*!< GPIO STMRCAP: STPOL3 (Bit 30)                         */
+#define GPIO_STMRCAP_STPOL3_Msk           (0x40000000UL)            /*!< GPIO STMRCAP: STPOL3 (Bitfield-Mask: 0x01)            */
+#define GPIO_STMRCAP_STSEL3_Pos           (24UL)                    /*!< GPIO STMRCAP: STSEL3 (Bit 24)                         */
+#define GPIO_STMRCAP_STSEL3_Msk           (0x3f000000UL)            /*!< GPIO STMRCAP: STSEL3 (Bitfield-Mask: 0x3f)            */
+#define GPIO_STMRCAP_STPOL2_Pos           (22UL)                    /*!< GPIO STMRCAP: STPOL2 (Bit 22)                         */
+#define GPIO_STMRCAP_STPOL2_Msk           (0x400000UL)              /*!< GPIO STMRCAP: STPOL2 (Bitfield-Mask: 0x01)            */
+#define GPIO_STMRCAP_STSEL2_Pos           (16UL)                    /*!< GPIO STMRCAP: STSEL2 (Bit 16)                         */
+#define GPIO_STMRCAP_STSEL2_Msk           (0x3f0000UL)              /*!< GPIO STMRCAP: STSEL2 (Bitfield-Mask: 0x3f)            */
+#define GPIO_STMRCAP_STPOL1_Pos           (14UL)                    /*!< GPIO STMRCAP: STPOL1 (Bit 14)                         */
+#define GPIO_STMRCAP_STPOL1_Msk           (0x4000UL)                /*!< GPIO STMRCAP: STPOL1 (Bitfield-Mask: 0x01)            */
+#define GPIO_STMRCAP_STSEL1_Pos           (8UL)                     /*!< GPIO STMRCAP: STSEL1 (Bit 8)                          */
+#define GPIO_STMRCAP_STSEL1_Msk           (0x3f00UL)                /*!< GPIO STMRCAP: STSEL1 (Bitfield-Mask: 0x3f)            */
+#define GPIO_STMRCAP_STPOL0_Pos           (6UL)                     /*!< GPIO STMRCAP: STPOL0 (Bit 6)                          */
+#define GPIO_STMRCAP_STPOL0_Msk           (0x40UL)                  /*!< GPIO STMRCAP: STPOL0 (Bitfield-Mask: 0x01)            */
+#define GPIO_STMRCAP_STSEL0_Pos           (0UL)                     /*!< GPIO STMRCAP: STSEL0 (Bit 0)                          */
+#define GPIO_STMRCAP_STSEL0_Msk           (0x3fUL)                  /*!< GPIO STMRCAP: STSEL0 (Bitfield-Mask: 0x3f)            */
+/* ========================================================  IOM0IRQ  ======================================================== */
+#define GPIO_IOM0IRQ_IOM0IRQ_Pos          (0UL)                     /*!< GPIO IOM0IRQ: IOM0IRQ (Bit 0)                         */
+#define GPIO_IOM0IRQ_IOM0IRQ_Msk          (0x3fUL)                  /*!< GPIO IOM0IRQ: IOM0IRQ (Bitfield-Mask: 0x3f)           */
+/* ========================================================  IOM1IRQ  ======================================================== */
+#define GPIO_IOM1IRQ_IOM1IRQ_Pos          (0UL)                     /*!< GPIO IOM1IRQ: IOM1IRQ (Bit 0)                         */
+#define GPIO_IOM1IRQ_IOM1IRQ_Msk          (0x3fUL)                  /*!< GPIO IOM1IRQ: IOM1IRQ (Bitfield-Mask: 0x3f)           */
+/* ========================================================  IOM2IRQ  ======================================================== */
+#define GPIO_IOM2IRQ_IOM2IRQ_Pos          (0UL)                     /*!< GPIO IOM2IRQ: IOM2IRQ (Bit 0)                         */
+#define GPIO_IOM2IRQ_IOM2IRQ_Msk          (0x3fUL)                  /*!< GPIO IOM2IRQ: IOM2IRQ (Bitfield-Mask: 0x3f)           */
+/* ========================================================  IOM3IRQ  ======================================================== */
+#define GPIO_IOM3IRQ_IOM3IRQ_Pos          (0UL)                     /*!< GPIO IOM3IRQ: IOM3IRQ (Bit 0)                         */
+#define GPIO_IOM3IRQ_IOM3IRQ_Msk          (0x3fUL)                  /*!< GPIO IOM3IRQ: IOM3IRQ (Bitfield-Mask: 0x3f)           */
+/* ========================================================  IOM4IRQ  ======================================================== */
+#define GPIO_IOM4IRQ_IOM4IRQ_Pos          (0UL)                     /*!< GPIO IOM4IRQ: IOM4IRQ (Bit 0)                         */
+#define GPIO_IOM4IRQ_IOM4IRQ_Msk          (0x3fUL)                  /*!< GPIO IOM4IRQ: IOM4IRQ (Bitfield-Mask: 0x3f)           */
+/* ========================================================  IOM5IRQ  ======================================================== */
+#define GPIO_IOM5IRQ_IOM5IRQ_Pos          (0UL)                     /*!< GPIO IOM5IRQ: IOM5IRQ (Bit 0)                         */
+#define GPIO_IOM5IRQ_IOM5IRQ_Msk          (0x3fUL)                  /*!< GPIO IOM5IRQ: IOM5IRQ (Bitfield-Mask: 0x3f)           */
+/* =======================================================  LOOPBACK  ======================================================== */
+#define GPIO_LOOPBACK_LOOPBACK_Pos        (0UL)                     /*!< GPIO LOOPBACK: LOOPBACK (Bit 0)                       */
+#define GPIO_LOOPBACK_LOOPBACK_Msk        (0x7UL)                   /*!< GPIO LOOPBACK: LOOPBACK (Bitfield-Mask: 0x07)         */
+/* ========================================================  GPIOOBS  ======================================================== */
+#define GPIO_GPIOOBS_OBS_DATA_Pos         (0UL)                     /*!< GPIO GPIOOBS: OBS_DATA (Bit 0)                        */
+#define GPIO_GPIOOBS_OBS_DATA_Msk         (0xffffUL)                /*!< GPIO GPIOOBS: OBS_DATA (Bitfield-Mask: 0xffff)        */
+/* ======================================================  ALTPADCFGA  ======================================================= */
+#define GPIO_ALTPADCFGA_PAD3_SR_Pos       (28UL)                    /*!< GPIO ALTPADCFGA: PAD3_SR (Bit 28)                     */
+#define GPIO_ALTPADCFGA_PAD3_SR_Msk       (0x10000000UL)            /*!< GPIO ALTPADCFGA: PAD3_SR (Bitfield-Mask: 0x01)        */
+#define GPIO_ALTPADCFGA_PAD3_DS1_Pos      (24UL)                    /*!< GPIO ALTPADCFGA: PAD3_DS1 (Bit 24)                    */
+#define GPIO_ALTPADCFGA_PAD3_DS1_Msk      (0x1000000UL)             /*!< GPIO ALTPADCFGA: PAD3_DS1 (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGA_PAD2_SR_Pos       (20UL)                    /*!< GPIO ALTPADCFGA: PAD2_SR (Bit 20)                     */
+#define GPIO_ALTPADCFGA_PAD2_SR_Msk       (0x100000UL)              /*!< GPIO ALTPADCFGA: PAD2_SR (Bitfield-Mask: 0x01)        */
+#define GPIO_ALTPADCFGA_PAD2_DS1_Pos      (16UL)                    /*!< GPIO ALTPADCFGA: PAD2_DS1 (Bit 16)                    */
+#define GPIO_ALTPADCFGA_PAD2_DS1_Msk      (0x10000UL)               /*!< GPIO ALTPADCFGA: PAD2_DS1 (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGA_PAD1_SR_Pos       (12UL)                    /*!< GPIO ALTPADCFGA: PAD1_SR (Bit 12)                     */
+#define GPIO_ALTPADCFGA_PAD1_SR_Msk       (0x1000UL)                /*!< GPIO ALTPADCFGA: PAD1_SR (Bitfield-Mask: 0x01)        */
+#define GPIO_ALTPADCFGA_PAD1_DS1_Pos      (8UL)                     /*!< GPIO ALTPADCFGA: PAD1_DS1 (Bit 8)                     */
+#define GPIO_ALTPADCFGA_PAD1_DS1_Msk      (0x100UL)                 /*!< GPIO ALTPADCFGA: PAD1_DS1 (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGA_PAD0_SR_Pos       (4UL)                     /*!< GPIO ALTPADCFGA: PAD0_SR (Bit 4)                      */
+#define GPIO_ALTPADCFGA_PAD0_SR_Msk       (0x10UL)                  /*!< GPIO ALTPADCFGA: PAD0_SR (Bitfield-Mask: 0x01)        */
+#define GPIO_ALTPADCFGA_PAD0_DS1_Pos      (0UL)                     /*!< GPIO ALTPADCFGA: PAD0_DS1 (Bit 0)                     */
+#define GPIO_ALTPADCFGA_PAD0_DS1_Msk      (0x1UL)                   /*!< GPIO ALTPADCFGA: PAD0_DS1 (Bitfield-Mask: 0x01)       */
+/* ======================================================  ALTPADCFGB  ======================================================= */
+#define GPIO_ALTPADCFGB_PAD7_SR_Pos       (28UL)                    /*!< GPIO ALTPADCFGB: PAD7_SR (Bit 28)                     */
+#define GPIO_ALTPADCFGB_PAD7_SR_Msk       (0x10000000UL)            /*!< GPIO ALTPADCFGB: PAD7_SR (Bitfield-Mask: 0x01)        */
+#define GPIO_ALTPADCFGB_PAD7_DS1_Pos      (24UL)                    /*!< GPIO ALTPADCFGB: PAD7_DS1 (Bit 24)                    */
+#define GPIO_ALTPADCFGB_PAD7_DS1_Msk      (0x1000000UL)             /*!< GPIO ALTPADCFGB: PAD7_DS1 (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGB_PAD6_SR_Pos       (20UL)                    /*!< GPIO ALTPADCFGB: PAD6_SR (Bit 20)                     */
+#define GPIO_ALTPADCFGB_PAD6_SR_Msk       (0x100000UL)              /*!< GPIO ALTPADCFGB: PAD6_SR (Bitfield-Mask: 0x01)        */
+#define GPIO_ALTPADCFGB_PAD6_DS1_Pos      (16UL)                    /*!< GPIO ALTPADCFGB: PAD6_DS1 (Bit 16)                    */
+#define GPIO_ALTPADCFGB_PAD6_DS1_Msk      (0x10000UL)               /*!< GPIO ALTPADCFGB: PAD6_DS1 (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGB_PAD5_SR_Pos       (12UL)                    /*!< GPIO ALTPADCFGB: PAD5_SR (Bit 12)                     */
+#define GPIO_ALTPADCFGB_PAD5_SR_Msk       (0x1000UL)                /*!< GPIO ALTPADCFGB: PAD5_SR (Bitfield-Mask: 0x01)        */
+#define GPIO_ALTPADCFGB_PAD5_DS1_Pos      (8UL)                     /*!< GPIO ALTPADCFGB: PAD5_DS1 (Bit 8)                     */
+#define GPIO_ALTPADCFGB_PAD5_DS1_Msk      (0x100UL)                 /*!< GPIO ALTPADCFGB: PAD5_DS1 (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGB_PAD4_SR_Pos       (4UL)                     /*!< GPIO ALTPADCFGB: PAD4_SR (Bit 4)                      */
+#define GPIO_ALTPADCFGB_PAD4_SR_Msk       (0x10UL)                  /*!< GPIO ALTPADCFGB: PAD4_SR (Bitfield-Mask: 0x01)        */
+#define GPIO_ALTPADCFGB_PAD4_DS1_Pos      (0UL)                     /*!< GPIO ALTPADCFGB: PAD4_DS1 (Bit 0)                     */
+#define GPIO_ALTPADCFGB_PAD4_DS1_Msk      (0x1UL)                   /*!< GPIO ALTPADCFGB: PAD4_DS1 (Bitfield-Mask: 0x01)       */
+/* ======================================================  ALTPADCFGC  ======================================================= */
+#define GPIO_ALTPADCFGC_PAD11_SR_Pos      (28UL)                    /*!< GPIO ALTPADCFGC: PAD11_SR (Bit 28)                    */
+#define GPIO_ALTPADCFGC_PAD11_SR_Msk      (0x10000000UL)            /*!< GPIO ALTPADCFGC: PAD11_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGC_PAD11_DS1_Pos     (24UL)                    /*!< GPIO ALTPADCFGC: PAD11_DS1 (Bit 24)                   */
+#define GPIO_ALTPADCFGC_PAD11_DS1_Msk     (0x1000000UL)             /*!< GPIO ALTPADCFGC: PAD11_DS1 (Bitfield-Mask: 0x01)      */
+#define GPIO_ALTPADCFGC_PAD10_SR_Pos      (20UL)                    /*!< GPIO ALTPADCFGC: PAD10_SR (Bit 20)                    */
+#define GPIO_ALTPADCFGC_PAD10_SR_Msk      (0x100000UL)              /*!< GPIO ALTPADCFGC: PAD10_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGC_PAD10_DS1_Pos     (16UL)                    /*!< GPIO ALTPADCFGC: PAD10_DS1 (Bit 16)                   */
+#define GPIO_ALTPADCFGC_PAD10_DS1_Msk     (0x10000UL)               /*!< GPIO ALTPADCFGC: PAD10_DS1 (Bitfield-Mask: 0x01)      */
+#define GPIO_ALTPADCFGC_PAD9_SR_Pos       (12UL)                    /*!< GPIO ALTPADCFGC: PAD9_SR (Bit 12)                     */
+#define GPIO_ALTPADCFGC_PAD9_SR_Msk       (0x1000UL)                /*!< GPIO ALTPADCFGC: PAD9_SR (Bitfield-Mask: 0x01)        */
+#define GPIO_ALTPADCFGC_PAD9_DS1_Pos      (8UL)                     /*!< GPIO ALTPADCFGC: PAD9_DS1 (Bit 8)                     */
+#define GPIO_ALTPADCFGC_PAD9_DS1_Msk      (0x100UL)                 /*!< GPIO ALTPADCFGC: PAD9_DS1 (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGC_PAD8_SR_Pos       (4UL)                     /*!< GPIO ALTPADCFGC: PAD8_SR (Bit 4)                      */
+#define GPIO_ALTPADCFGC_PAD8_SR_Msk       (0x10UL)                  /*!< GPIO ALTPADCFGC: PAD8_SR (Bitfield-Mask: 0x01)        */
+#define GPIO_ALTPADCFGC_PAD8_DS1_Pos      (0UL)                     /*!< GPIO ALTPADCFGC: PAD8_DS1 (Bit 0)                     */
+#define GPIO_ALTPADCFGC_PAD8_DS1_Msk      (0x1UL)                   /*!< GPIO ALTPADCFGC: PAD8_DS1 (Bitfield-Mask: 0x01)       */
+/* ======================================================  ALTPADCFGD  ======================================================= */
+#define GPIO_ALTPADCFGD_PAD15_SR_Pos      (28UL)                    /*!< GPIO ALTPADCFGD: PAD15_SR (Bit 28)                    */
+#define GPIO_ALTPADCFGD_PAD15_SR_Msk      (0x10000000UL)            /*!< GPIO ALTPADCFGD: PAD15_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGD_PAD15_DS1_Pos     (24UL)                    /*!< GPIO ALTPADCFGD: PAD15_DS1 (Bit 24)                   */
+#define GPIO_ALTPADCFGD_PAD15_DS1_Msk     (0x1000000UL)             /*!< GPIO ALTPADCFGD: PAD15_DS1 (Bitfield-Mask: 0x01)      */
+#define GPIO_ALTPADCFGD_PAD14_SR_Pos      (20UL)                    /*!< GPIO ALTPADCFGD: PAD14_SR (Bit 20)                    */
+#define GPIO_ALTPADCFGD_PAD14_SR_Msk      (0x100000UL)              /*!< GPIO ALTPADCFGD: PAD14_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGD_PAD14_DS1_Pos     (16UL)                    /*!< GPIO ALTPADCFGD: PAD14_DS1 (Bit 16)                   */
+#define GPIO_ALTPADCFGD_PAD14_DS1_Msk     (0x10000UL)               /*!< GPIO ALTPADCFGD: PAD14_DS1 (Bitfield-Mask: 0x01)      */
+#define GPIO_ALTPADCFGD_PAD13_SR_Pos      (12UL)                    /*!< GPIO ALTPADCFGD: PAD13_SR (Bit 12)                    */
+#define GPIO_ALTPADCFGD_PAD13_SR_Msk      (0x1000UL)                /*!< GPIO ALTPADCFGD: PAD13_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGD_PAD13_DS1_Pos     (8UL)                     /*!< GPIO ALTPADCFGD: PAD13_DS1 (Bit 8)                    */
+#define GPIO_ALTPADCFGD_PAD13_DS1_Msk     (0x100UL)                 /*!< GPIO ALTPADCFGD: PAD13_DS1 (Bitfield-Mask: 0x01)      */
+#define GPIO_ALTPADCFGD_PAD12_SR_Pos      (4UL)                     /*!< GPIO ALTPADCFGD: PAD12_SR (Bit 4)                     */
+#define GPIO_ALTPADCFGD_PAD12_SR_Msk      (0x10UL)                  /*!< GPIO ALTPADCFGD: PAD12_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGD_PAD12_DS1_Pos     (0UL)                     /*!< GPIO ALTPADCFGD: PAD12_DS1 (Bit 0)                    */
+#define GPIO_ALTPADCFGD_PAD12_DS1_Msk     (0x1UL)                   /*!< GPIO ALTPADCFGD: PAD12_DS1 (Bitfield-Mask: 0x01)      */
+/* ======================================================  ALTPADCFGE  ======================================================= */
+#define GPIO_ALTPADCFGE_PAD19_SR_Pos      (28UL)                    /*!< GPIO ALTPADCFGE: PAD19_SR (Bit 28)                    */
+#define GPIO_ALTPADCFGE_PAD19_SR_Msk      (0x10000000UL)            /*!< GPIO ALTPADCFGE: PAD19_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGE_PAD19_DS1_Pos     (24UL)                    /*!< GPIO ALTPADCFGE: PAD19_DS1 (Bit 24)                   */
+#define GPIO_ALTPADCFGE_PAD19_DS1_Msk     (0x1000000UL)             /*!< GPIO ALTPADCFGE: PAD19_DS1 (Bitfield-Mask: 0x01)      */
+#define GPIO_ALTPADCFGE_PAD18_SR_Pos      (20UL)                    /*!< GPIO ALTPADCFGE: PAD18_SR (Bit 20)                    */
+#define GPIO_ALTPADCFGE_PAD18_SR_Msk      (0x100000UL)              /*!< GPIO ALTPADCFGE: PAD18_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGE_PAD18_DS1_Pos     (16UL)                    /*!< GPIO ALTPADCFGE: PAD18_DS1 (Bit 16)                   */
+#define GPIO_ALTPADCFGE_PAD18_DS1_Msk     (0x10000UL)               /*!< GPIO ALTPADCFGE: PAD18_DS1 (Bitfield-Mask: 0x01)      */
+#define GPIO_ALTPADCFGE_PAD17_SR_Pos      (12UL)                    /*!< GPIO ALTPADCFGE: PAD17_SR (Bit 12)                    */
+#define GPIO_ALTPADCFGE_PAD17_SR_Msk      (0x1000UL)                /*!< GPIO ALTPADCFGE: PAD17_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGE_PAD17_DS1_Pos     (8UL)                     /*!< GPIO ALTPADCFGE: PAD17_DS1 (Bit 8)                    */
+#define GPIO_ALTPADCFGE_PAD17_DS1_Msk     (0x100UL)                 /*!< GPIO ALTPADCFGE: PAD17_DS1 (Bitfield-Mask: 0x01)      */
+#define GPIO_ALTPADCFGE_PAD16_SR_Pos      (4UL)                     /*!< GPIO ALTPADCFGE: PAD16_SR (Bit 4)                     */
+#define GPIO_ALTPADCFGE_PAD16_SR_Msk      (0x10UL)                  /*!< GPIO ALTPADCFGE: PAD16_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGE_PAD16_DS1_Pos     (0UL)                     /*!< GPIO ALTPADCFGE: PAD16_DS1 (Bit 0)                    */
+#define GPIO_ALTPADCFGE_PAD16_DS1_Msk     (0x1UL)                   /*!< GPIO ALTPADCFGE: PAD16_DS1 (Bitfield-Mask: 0x01)      */
+/* ======================================================  ALTPADCFGF  ======================================================= */
+#define GPIO_ALTPADCFGF_PAD23_SR_Pos      (28UL)                    /*!< GPIO ALTPADCFGF: PAD23_SR (Bit 28)                    */
+#define GPIO_ALTPADCFGF_PAD23_SR_Msk      (0x10000000UL)            /*!< GPIO ALTPADCFGF: PAD23_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGF_PAD23_DS1_Pos     (24UL)                    /*!< GPIO ALTPADCFGF: PAD23_DS1 (Bit 24)                   */
+#define GPIO_ALTPADCFGF_PAD23_DS1_Msk     (0x1000000UL)             /*!< GPIO ALTPADCFGF: PAD23_DS1 (Bitfield-Mask: 0x01)      */
+#define GPIO_ALTPADCFGF_PAD22_SR_Pos      (20UL)                    /*!< GPIO ALTPADCFGF: PAD22_SR (Bit 20)                    */
+#define GPIO_ALTPADCFGF_PAD22_SR_Msk      (0x100000UL)              /*!< GPIO ALTPADCFGF: PAD22_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGF_PAD22_DS1_Pos     (16UL)                    /*!< GPIO ALTPADCFGF: PAD22_DS1 (Bit 16)                   */
+#define GPIO_ALTPADCFGF_PAD22_DS1_Msk     (0x10000UL)               /*!< GPIO ALTPADCFGF: PAD22_DS1 (Bitfield-Mask: 0x01)      */
+#define GPIO_ALTPADCFGF_PAD21_SR_Pos      (12UL)                    /*!< GPIO ALTPADCFGF: PAD21_SR (Bit 12)                    */
+#define GPIO_ALTPADCFGF_PAD21_SR_Msk      (0x1000UL)                /*!< GPIO ALTPADCFGF: PAD21_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGF_PAD21_DS1_Pos     (8UL)                     /*!< GPIO ALTPADCFGF: PAD21_DS1 (Bit 8)                    */
+#define GPIO_ALTPADCFGF_PAD21_DS1_Msk     (0x100UL)                 /*!< GPIO ALTPADCFGF: PAD21_DS1 (Bitfield-Mask: 0x01)      */
+#define GPIO_ALTPADCFGF_PAD20_SR_Pos      (4UL)                     /*!< GPIO ALTPADCFGF: PAD20_SR (Bit 4)                     */
+#define GPIO_ALTPADCFGF_PAD20_SR_Msk      (0x10UL)                  /*!< GPIO ALTPADCFGF: PAD20_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGF_PAD20_DS1_Pos     (0UL)                     /*!< GPIO ALTPADCFGF: PAD20_DS1 (Bit 0)                    */
+#define GPIO_ALTPADCFGF_PAD20_DS1_Msk     (0x1UL)                   /*!< GPIO ALTPADCFGF: PAD20_DS1 (Bitfield-Mask: 0x01)      */
+/* ======================================================  ALTPADCFGG  ======================================================= */
+#define GPIO_ALTPADCFGG_PAD27_SR_Pos      (28UL)                    /*!< GPIO ALTPADCFGG: PAD27_SR (Bit 28)                    */
+#define GPIO_ALTPADCFGG_PAD27_SR_Msk      (0x10000000UL)            /*!< GPIO ALTPADCFGG: PAD27_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGG_PAD27_DS1_Pos     (24UL)                    /*!< GPIO ALTPADCFGG: PAD27_DS1 (Bit 24)                   */
+#define GPIO_ALTPADCFGG_PAD27_DS1_Msk     (0x1000000UL)             /*!< GPIO ALTPADCFGG: PAD27_DS1 (Bitfield-Mask: 0x01)      */
+#define GPIO_ALTPADCFGG_PAD26_SR_Pos      (20UL)                    /*!< GPIO ALTPADCFGG: PAD26_SR (Bit 20)                    */
+#define GPIO_ALTPADCFGG_PAD26_SR_Msk      (0x100000UL)              /*!< GPIO ALTPADCFGG: PAD26_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGG_PAD26_DS1_Pos     (16UL)                    /*!< GPIO ALTPADCFGG: PAD26_DS1 (Bit 16)                   */
+#define GPIO_ALTPADCFGG_PAD26_DS1_Msk     (0x10000UL)               /*!< GPIO ALTPADCFGG: PAD26_DS1 (Bitfield-Mask: 0x01)      */
+#define GPIO_ALTPADCFGG_PAD25_SR_Pos      (12UL)                    /*!< GPIO ALTPADCFGG: PAD25_SR (Bit 12)                    */
+#define GPIO_ALTPADCFGG_PAD25_SR_Msk      (0x1000UL)                /*!< GPIO ALTPADCFGG: PAD25_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGG_PAD25_DS1_Pos     (8UL)                     /*!< GPIO ALTPADCFGG: PAD25_DS1 (Bit 8)                    */
+#define GPIO_ALTPADCFGG_PAD25_DS1_Msk     (0x100UL)                 /*!< GPIO ALTPADCFGG: PAD25_DS1 (Bitfield-Mask: 0x01)      */
+#define GPIO_ALTPADCFGG_PAD24_SR_Pos      (4UL)                     /*!< GPIO ALTPADCFGG: PAD24_SR (Bit 4)                     */
+#define GPIO_ALTPADCFGG_PAD24_SR_Msk      (0x10UL)                  /*!< GPIO ALTPADCFGG: PAD24_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGG_PAD24_DS1_Pos     (0UL)                     /*!< GPIO ALTPADCFGG: PAD24_DS1 (Bit 0)                    */
+#define GPIO_ALTPADCFGG_PAD24_DS1_Msk     (0x1UL)                   /*!< GPIO ALTPADCFGG: PAD24_DS1 (Bitfield-Mask: 0x01)      */
+/* ======================================================  ALTPADCFGH  ======================================================= */
+#define GPIO_ALTPADCFGH_PAD31_SR_Pos      (28UL)                    /*!< GPIO ALTPADCFGH: PAD31_SR (Bit 28)                    */
+#define GPIO_ALTPADCFGH_PAD31_SR_Msk      (0x10000000UL)            /*!< GPIO ALTPADCFGH: PAD31_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGH_PAD31_DS1_Pos     (24UL)                    /*!< GPIO ALTPADCFGH: PAD31_DS1 (Bit 24)                   */
+#define GPIO_ALTPADCFGH_PAD31_DS1_Msk     (0x1000000UL)             /*!< GPIO ALTPADCFGH: PAD31_DS1 (Bitfield-Mask: 0x01)      */
+#define GPIO_ALTPADCFGH_PAD30_SR_Pos      (20UL)                    /*!< GPIO ALTPADCFGH: PAD30_SR (Bit 20)                    */
+#define GPIO_ALTPADCFGH_PAD30_SR_Msk      (0x100000UL)              /*!< GPIO ALTPADCFGH: PAD30_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGH_PAD30_DS1_Pos     (16UL)                    /*!< GPIO ALTPADCFGH: PAD30_DS1 (Bit 16)                   */
+#define GPIO_ALTPADCFGH_PAD30_DS1_Msk     (0x10000UL)               /*!< GPIO ALTPADCFGH: PAD30_DS1 (Bitfield-Mask: 0x01)      */
+#define GPIO_ALTPADCFGH_PAD29_SR_Pos      (12UL)                    /*!< GPIO ALTPADCFGH: PAD29_SR (Bit 12)                    */
+#define GPIO_ALTPADCFGH_PAD29_SR_Msk      (0x1000UL)                /*!< GPIO ALTPADCFGH: PAD29_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGH_PAD29_DS1_Pos     (8UL)                     /*!< GPIO ALTPADCFGH: PAD29_DS1 (Bit 8)                    */
+#define GPIO_ALTPADCFGH_PAD29_DS1_Msk     (0x100UL)                 /*!< GPIO ALTPADCFGH: PAD29_DS1 (Bitfield-Mask: 0x01)      */
+#define GPIO_ALTPADCFGH_PAD28_SR_Pos      (4UL)                     /*!< GPIO ALTPADCFGH: PAD28_SR (Bit 4)                     */
+#define GPIO_ALTPADCFGH_PAD28_SR_Msk      (0x10UL)                  /*!< GPIO ALTPADCFGH: PAD28_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGH_PAD28_DS1_Pos     (0UL)                     /*!< GPIO ALTPADCFGH: PAD28_DS1 (Bit 0)                    */
+#define GPIO_ALTPADCFGH_PAD28_DS1_Msk     (0x1UL)                   /*!< GPIO ALTPADCFGH: PAD28_DS1 (Bitfield-Mask: 0x01)      */
+/* ======================================================  ALTPADCFGI  ======================================================= */
+#define GPIO_ALTPADCFGI_PAD35_SR_Pos      (28UL)                    /*!< GPIO ALTPADCFGI: PAD35_SR (Bit 28)                    */
+#define GPIO_ALTPADCFGI_PAD35_SR_Msk      (0x10000000UL)            /*!< GPIO ALTPADCFGI: PAD35_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGI_PAD35_DS1_Pos     (24UL)                    /*!< GPIO ALTPADCFGI: PAD35_DS1 (Bit 24)                   */
+#define GPIO_ALTPADCFGI_PAD35_DS1_Msk     (0x1000000UL)             /*!< GPIO ALTPADCFGI: PAD35_DS1 (Bitfield-Mask: 0x01)      */
+#define GPIO_ALTPADCFGI_PAD34_SR_Pos      (20UL)                    /*!< GPIO ALTPADCFGI: PAD34_SR (Bit 20)                    */
+#define GPIO_ALTPADCFGI_PAD34_SR_Msk      (0x100000UL)              /*!< GPIO ALTPADCFGI: PAD34_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGI_PAD34_DS1_Pos     (16UL)                    /*!< GPIO ALTPADCFGI: PAD34_DS1 (Bit 16)                   */
+#define GPIO_ALTPADCFGI_PAD34_DS1_Msk     (0x10000UL)               /*!< GPIO ALTPADCFGI: PAD34_DS1 (Bitfield-Mask: 0x01)      */
+#define GPIO_ALTPADCFGI_PAD33_SR_Pos      (12UL)                    /*!< GPIO ALTPADCFGI: PAD33_SR (Bit 12)                    */
+#define GPIO_ALTPADCFGI_PAD33_SR_Msk      (0x1000UL)                /*!< GPIO ALTPADCFGI: PAD33_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGI_PAD33_DS1_Pos     (8UL)                     /*!< GPIO ALTPADCFGI: PAD33_DS1 (Bit 8)                    */
+#define GPIO_ALTPADCFGI_PAD33_DS1_Msk     (0x100UL)                 /*!< GPIO ALTPADCFGI: PAD33_DS1 (Bitfield-Mask: 0x01)      */
+#define GPIO_ALTPADCFGI_PAD32_SR_Pos      (4UL)                     /*!< GPIO ALTPADCFGI: PAD32_SR (Bit 4)                     */
+#define GPIO_ALTPADCFGI_PAD32_SR_Msk      (0x10UL)                  /*!< GPIO ALTPADCFGI: PAD32_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGI_PAD32_DS1_Pos     (0UL)                     /*!< GPIO ALTPADCFGI: PAD32_DS1 (Bit 0)                    */
+#define GPIO_ALTPADCFGI_PAD32_DS1_Msk     (0x1UL)                   /*!< GPIO ALTPADCFGI: PAD32_DS1 (Bitfield-Mask: 0x01)      */
+/* ======================================================  ALTPADCFGJ  ======================================================= */
+#define GPIO_ALTPADCFGJ_PAD39_SR_Pos      (28UL)                    /*!< GPIO ALTPADCFGJ: PAD39_SR (Bit 28)                    */
+#define GPIO_ALTPADCFGJ_PAD39_SR_Msk      (0x10000000UL)            /*!< GPIO ALTPADCFGJ: PAD39_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGJ_PAD39_DS1_Pos     (24UL)                    /*!< GPIO ALTPADCFGJ: PAD39_DS1 (Bit 24)                   */
+#define GPIO_ALTPADCFGJ_PAD39_DS1_Msk     (0x1000000UL)             /*!< GPIO ALTPADCFGJ: PAD39_DS1 (Bitfield-Mask: 0x01)      */
+#define GPIO_ALTPADCFGJ_PAD38_SR_Pos      (20UL)                    /*!< GPIO ALTPADCFGJ: PAD38_SR (Bit 20)                    */
+#define GPIO_ALTPADCFGJ_PAD38_SR_Msk      (0x100000UL)              /*!< GPIO ALTPADCFGJ: PAD38_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGJ_PAD38_DS1_Pos     (16UL)                    /*!< GPIO ALTPADCFGJ: PAD38_DS1 (Bit 16)                   */
+#define GPIO_ALTPADCFGJ_PAD38_DS1_Msk     (0x10000UL)               /*!< GPIO ALTPADCFGJ: PAD38_DS1 (Bitfield-Mask: 0x01)      */
+#define GPIO_ALTPADCFGJ_PAD37_SR_Pos      (12UL)                    /*!< GPIO ALTPADCFGJ: PAD37_SR (Bit 12)                    */
+#define GPIO_ALTPADCFGJ_PAD37_SR_Msk      (0x1000UL)                /*!< GPIO ALTPADCFGJ: PAD37_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGJ_PAD37_DS1_Pos     (8UL)                     /*!< GPIO ALTPADCFGJ: PAD37_DS1 (Bit 8)                    */
+#define GPIO_ALTPADCFGJ_PAD37_DS1_Msk     (0x100UL)                 /*!< GPIO ALTPADCFGJ: PAD37_DS1 (Bitfield-Mask: 0x01)      */
+#define GPIO_ALTPADCFGJ_PAD36_SR_Pos      (4UL)                     /*!< GPIO ALTPADCFGJ: PAD36_SR (Bit 4)                     */
+#define GPIO_ALTPADCFGJ_PAD36_SR_Msk      (0x10UL)                  /*!< GPIO ALTPADCFGJ: PAD36_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGJ_PAD36_DS1_Pos     (0UL)                     /*!< GPIO ALTPADCFGJ: PAD36_DS1 (Bit 0)                    */
+#define GPIO_ALTPADCFGJ_PAD36_DS1_Msk     (0x1UL)                   /*!< GPIO ALTPADCFGJ: PAD36_DS1 (Bitfield-Mask: 0x01)      */
+/* ======================================================  ALTPADCFGK  ======================================================= */
+#define GPIO_ALTPADCFGK_PAD43_SR_Pos      (28UL)                    /*!< GPIO ALTPADCFGK: PAD43_SR (Bit 28)                    */
+#define GPIO_ALTPADCFGK_PAD43_SR_Msk      (0x10000000UL)            /*!< GPIO ALTPADCFGK: PAD43_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGK_PAD43_DS1_Pos     (24UL)                    /*!< GPIO ALTPADCFGK: PAD43_DS1 (Bit 24)                   */
+#define GPIO_ALTPADCFGK_PAD43_DS1_Msk     (0x1000000UL)             /*!< GPIO ALTPADCFGK: PAD43_DS1 (Bitfield-Mask: 0x01)      */
+#define GPIO_ALTPADCFGK_PAD42_SR_Pos      (20UL)                    /*!< GPIO ALTPADCFGK: PAD42_SR (Bit 20)                    */
+#define GPIO_ALTPADCFGK_PAD42_SR_Msk      (0x100000UL)              /*!< GPIO ALTPADCFGK: PAD42_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGK_PAD42_DS1_Pos     (16UL)                    /*!< GPIO ALTPADCFGK: PAD42_DS1 (Bit 16)                   */
+#define GPIO_ALTPADCFGK_PAD42_DS1_Msk     (0x10000UL)               /*!< GPIO ALTPADCFGK: PAD42_DS1 (Bitfield-Mask: 0x01)      */
+#define GPIO_ALTPADCFGK_PAD41_SR_Pos      (12UL)                    /*!< GPIO ALTPADCFGK: PAD41_SR (Bit 12)                    */
+#define GPIO_ALTPADCFGK_PAD41_SR_Msk      (0x1000UL)                /*!< GPIO ALTPADCFGK: PAD41_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGK_PAD41_DS1_Pos     (8UL)                     /*!< GPIO ALTPADCFGK: PAD41_DS1 (Bit 8)                    */
+#define GPIO_ALTPADCFGK_PAD41_DS1_Msk     (0x100UL)                 /*!< GPIO ALTPADCFGK: PAD41_DS1 (Bitfield-Mask: 0x01)      */
+#define GPIO_ALTPADCFGK_PAD40_SR_Pos      (4UL)                     /*!< GPIO ALTPADCFGK: PAD40_SR (Bit 4)                     */
+#define GPIO_ALTPADCFGK_PAD40_SR_Msk      (0x10UL)                  /*!< GPIO ALTPADCFGK: PAD40_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGK_PAD40_DS1_Pos     (0UL)                     /*!< GPIO ALTPADCFGK: PAD40_DS1 (Bit 0)                    */
+#define GPIO_ALTPADCFGK_PAD40_DS1_Msk     (0x1UL)                   /*!< GPIO ALTPADCFGK: PAD40_DS1 (Bitfield-Mask: 0x01)      */
+/* ======================================================  ALTPADCFGL  ======================================================= */
+#define GPIO_ALTPADCFGL_PAD47_SR_Pos      (28UL)                    /*!< GPIO ALTPADCFGL: PAD47_SR (Bit 28)                    */
+#define GPIO_ALTPADCFGL_PAD47_SR_Msk      (0x10000000UL)            /*!< GPIO ALTPADCFGL: PAD47_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGL_PAD47_DS1_Pos     (24UL)                    /*!< GPIO ALTPADCFGL: PAD47_DS1 (Bit 24)                   */
+#define GPIO_ALTPADCFGL_PAD47_DS1_Msk     (0x1000000UL)             /*!< GPIO ALTPADCFGL: PAD47_DS1 (Bitfield-Mask: 0x01)      */
+#define GPIO_ALTPADCFGL_PAD46_SR_Pos      (20UL)                    /*!< GPIO ALTPADCFGL: PAD46_SR (Bit 20)                    */
+#define GPIO_ALTPADCFGL_PAD46_SR_Msk      (0x100000UL)              /*!< GPIO ALTPADCFGL: PAD46_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGL_PAD46_DS1_Pos     (16UL)                    /*!< GPIO ALTPADCFGL: PAD46_DS1 (Bit 16)                   */
+#define GPIO_ALTPADCFGL_PAD46_DS1_Msk     (0x10000UL)               /*!< GPIO ALTPADCFGL: PAD46_DS1 (Bitfield-Mask: 0x01)      */
+#define GPIO_ALTPADCFGL_PAD45_SR_Pos      (12UL)                    /*!< GPIO ALTPADCFGL: PAD45_SR (Bit 12)                    */
+#define GPIO_ALTPADCFGL_PAD45_SR_Msk      (0x1000UL)                /*!< GPIO ALTPADCFGL: PAD45_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGL_PAD45_DS1_Pos     (8UL)                     /*!< GPIO ALTPADCFGL: PAD45_DS1 (Bit 8)                    */
+#define GPIO_ALTPADCFGL_PAD45_DS1_Msk     (0x100UL)                 /*!< GPIO ALTPADCFGL: PAD45_DS1 (Bitfield-Mask: 0x01)      */
+#define GPIO_ALTPADCFGL_PAD44_SR_Pos      (4UL)                     /*!< GPIO ALTPADCFGL: PAD44_SR (Bit 4)                     */
+#define GPIO_ALTPADCFGL_PAD44_SR_Msk      (0x10UL)                  /*!< GPIO ALTPADCFGL: PAD44_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGL_PAD44_DS1_Pos     (0UL)                     /*!< GPIO ALTPADCFGL: PAD44_DS1 (Bit 0)                    */
+#define GPIO_ALTPADCFGL_PAD44_DS1_Msk     (0x1UL)                   /*!< GPIO ALTPADCFGL: PAD44_DS1 (Bitfield-Mask: 0x01)      */
+/* ======================================================  ALTPADCFGM  ======================================================= */
+#define GPIO_ALTPADCFGM_PAD49_SR_Pos      (12UL)                    /*!< GPIO ALTPADCFGM: PAD49_SR (Bit 12)                    */
+#define GPIO_ALTPADCFGM_PAD49_SR_Msk      (0x1000UL)                /*!< GPIO ALTPADCFGM: PAD49_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGM_PAD49_DS1_Pos     (8UL)                     /*!< GPIO ALTPADCFGM: PAD49_DS1 (Bit 8)                    */
+#define GPIO_ALTPADCFGM_PAD49_DS1_Msk     (0x100UL)                 /*!< GPIO ALTPADCFGM: PAD49_DS1 (Bitfield-Mask: 0x01)      */
+#define GPIO_ALTPADCFGM_PAD48_SR_Pos      (4UL)                     /*!< GPIO ALTPADCFGM: PAD48_SR (Bit 4)                     */
+#define GPIO_ALTPADCFGM_PAD48_SR_Msk      (0x10UL)                  /*!< GPIO ALTPADCFGM: PAD48_SR (Bitfield-Mask: 0x01)       */
+#define GPIO_ALTPADCFGM_PAD48_DS1_Pos     (0UL)                     /*!< GPIO ALTPADCFGM: PAD48_DS1 (Bit 0)                    */
+#define GPIO_ALTPADCFGM_PAD48_DS1_Msk     (0x1UL)                   /*!< GPIO ALTPADCFGM: PAD48_DS1 (Bitfield-Mask: 0x01)      */
+/* ========================================================  INT0EN  ========================================================= */
+#define GPIO_INT0EN_GPIO31_Pos            (31UL)                    /*!< GPIO INT0EN: GPIO31 (Bit 31)                          */
+#define GPIO_INT0EN_GPIO31_Msk            (0x80000000UL)            /*!< GPIO INT0EN: GPIO31 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0EN_GPIO30_Pos            (30UL)                    /*!< GPIO INT0EN: GPIO30 (Bit 30)                          */
+#define GPIO_INT0EN_GPIO30_Msk            (0x40000000UL)            /*!< GPIO INT0EN: GPIO30 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0EN_GPIO29_Pos            (29UL)                    /*!< GPIO INT0EN: GPIO29 (Bit 29)                          */
+#define GPIO_INT0EN_GPIO29_Msk            (0x20000000UL)            /*!< GPIO INT0EN: GPIO29 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0EN_GPIO28_Pos            (28UL)                    /*!< GPIO INT0EN: GPIO28 (Bit 28)                          */
+#define GPIO_INT0EN_GPIO28_Msk            (0x10000000UL)            /*!< GPIO INT0EN: GPIO28 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0EN_GPIO27_Pos            (27UL)                    /*!< GPIO INT0EN: GPIO27 (Bit 27)                          */
+#define GPIO_INT0EN_GPIO27_Msk            (0x8000000UL)             /*!< GPIO INT0EN: GPIO27 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0EN_GPIO26_Pos            (26UL)                    /*!< GPIO INT0EN: GPIO26 (Bit 26)                          */
+#define GPIO_INT0EN_GPIO26_Msk            (0x4000000UL)             /*!< GPIO INT0EN: GPIO26 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0EN_GPIO25_Pos            (25UL)                    /*!< GPIO INT0EN: GPIO25 (Bit 25)                          */
+#define GPIO_INT0EN_GPIO25_Msk            (0x2000000UL)             /*!< GPIO INT0EN: GPIO25 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0EN_GPIO24_Pos            (24UL)                    /*!< GPIO INT0EN: GPIO24 (Bit 24)                          */
+#define GPIO_INT0EN_GPIO24_Msk            (0x1000000UL)             /*!< GPIO INT0EN: GPIO24 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0EN_GPIO23_Pos            (23UL)                    /*!< GPIO INT0EN: GPIO23 (Bit 23)                          */
+#define GPIO_INT0EN_GPIO23_Msk            (0x800000UL)              /*!< GPIO INT0EN: GPIO23 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0EN_GPIO22_Pos            (22UL)                    /*!< GPIO INT0EN: GPIO22 (Bit 22)                          */
+#define GPIO_INT0EN_GPIO22_Msk            (0x400000UL)              /*!< GPIO INT0EN: GPIO22 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0EN_GPIO21_Pos            (21UL)                    /*!< GPIO INT0EN: GPIO21 (Bit 21)                          */
+#define GPIO_INT0EN_GPIO21_Msk            (0x200000UL)              /*!< GPIO INT0EN: GPIO21 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0EN_GPIO20_Pos            (20UL)                    /*!< GPIO INT0EN: GPIO20 (Bit 20)                          */
+#define GPIO_INT0EN_GPIO20_Msk            (0x100000UL)              /*!< GPIO INT0EN: GPIO20 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0EN_GPIO19_Pos            (19UL)                    /*!< GPIO INT0EN: GPIO19 (Bit 19)                          */
+#define GPIO_INT0EN_GPIO19_Msk            (0x80000UL)               /*!< GPIO INT0EN: GPIO19 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0EN_GPIO18_Pos            (18UL)                    /*!< GPIO INT0EN: GPIO18 (Bit 18)                          */
+#define GPIO_INT0EN_GPIO18_Msk            (0x40000UL)               /*!< GPIO INT0EN: GPIO18 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0EN_GPIO17_Pos            (17UL)                    /*!< GPIO INT0EN: GPIO17 (Bit 17)                          */
+#define GPIO_INT0EN_GPIO17_Msk            (0x20000UL)               /*!< GPIO INT0EN: GPIO17 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0EN_GPIO16_Pos            (16UL)                    /*!< GPIO INT0EN: GPIO16 (Bit 16)                          */
+#define GPIO_INT0EN_GPIO16_Msk            (0x10000UL)               /*!< GPIO INT0EN: GPIO16 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0EN_GPIO15_Pos            (15UL)                    /*!< GPIO INT0EN: GPIO15 (Bit 15)                          */
+#define GPIO_INT0EN_GPIO15_Msk            (0x8000UL)                /*!< GPIO INT0EN: GPIO15 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0EN_GPIO14_Pos            (14UL)                    /*!< GPIO INT0EN: GPIO14 (Bit 14)                          */
+#define GPIO_INT0EN_GPIO14_Msk            (0x4000UL)                /*!< GPIO INT0EN: GPIO14 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0EN_GPIO13_Pos            (13UL)                    /*!< GPIO INT0EN: GPIO13 (Bit 13)                          */
+#define GPIO_INT0EN_GPIO13_Msk            (0x2000UL)                /*!< GPIO INT0EN: GPIO13 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0EN_GPIO12_Pos            (12UL)                    /*!< GPIO INT0EN: GPIO12 (Bit 12)                          */
+#define GPIO_INT0EN_GPIO12_Msk            (0x1000UL)                /*!< GPIO INT0EN: GPIO12 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0EN_GPIO11_Pos            (11UL)                    /*!< GPIO INT0EN: GPIO11 (Bit 11)                          */
+#define GPIO_INT0EN_GPIO11_Msk            (0x800UL)                 /*!< GPIO INT0EN: GPIO11 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0EN_GPIO10_Pos            (10UL)                    /*!< GPIO INT0EN: GPIO10 (Bit 10)                          */
+#define GPIO_INT0EN_GPIO10_Msk            (0x400UL)                 /*!< GPIO INT0EN: GPIO10 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0EN_GPIO9_Pos             (9UL)                     /*!< GPIO INT0EN: GPIO9 (Bit 9)                            */
+#define GPIO_INT0EN_GPIO9_Msk             (0x200UL)                 /*!< GPIO INT0EN: GPIO9 (Bitfield-Mask: 0x01)              */
+#define GPIO_INT0EN_GPIO8_Pos             (8UL)                     /*!< GPIO INT0EN: GPIO8 (Bit 8)                            */
+#define GPIO_INT0EN_GPIO8_Msk             (0x100UL)                 /*!< GPIO INT0EN: GPIO8 (Bitfield-Mask: 0x01)              */
+#define GPIO_INT0EN_GPIO7_Pos             (7UL)                     /*!< GPIO INT0EN: GPIO7 (Bit 7)                            */
+#define GPIO_INT0EN_GPIO7_Msk             (0x80UL)                  /*!< GPIO INT0EN: GPIO7 (Bitfield-Mask: 0x01)              */
+#define GPIO_INT0EN_GPIO6_Pos             (6UL)                     /*!< GPIO INT0EN: GPIO6 (Bit 6)                            */
+#define GPIO_INT0EN_GPIO6_Msk             (0x40UL)                  /*!< GPIO INT0EN: GPIO6 (Bitfield-Mask: 0x01)              */
+#define GPIO_INT0EN_GPIO5_Pos             (5UL)                     /*!< GPIO INT0EN: GPIO5 (Bit 5)                            */
+#define GPIO_INT0EN_GPIO5_Msk             (0x20UL)                  /*!< GPIO INT0EN: GPIO5 (Bitfield-Mask: 0x01)              */
+#define GPIO_INT0EN_GPIO4_Pos             (4UL)                     /*!< GPIO INT0EN: GPIO4 (Bit 4)                            */
+#define GPIO_INT0EN_GPIO4_Msk             (0x10UL)                  /*!< GPIO INT0EN: GPIO4 (Bitfield-Mask: 0x01)              */
+#define GPIO_INT0EN_GPIO3_Pos             (3UL)                     /*!< GPIO INT0EN: GPIO3 (Bit 3)                            */
+#define GPIO_INT0EN_GPIO3_Msk             (0x8UL)                   /*!< GPIO INT0EN: GPIO3 (Bitfield-Mask: 0x01)              */
+#define GPIO_INT0EN_GPIO2_Pos             (2UL)                     /*!< GPIO INT0EN: GPIO2 (Bit 2)                            */
+#define GPIO_INT0EN_GPIO2_Msk             (0x4UL)                   /*!< GPIO INT0EN: GPIO2 (Bitfield-Mask: 0x01)              */
+#define GPIO_INT0EN_GPIO1_Pos             (1UL)                     /*!< GPIO INT0EN: GPIO1 (Bit 1)                            */
+#define GPIO_INT0EN_GPIO1_Msk             (0x2UL)                   /*!< GPIO INT0EN: GPIO1 (Bitfield-Mask: 0x01)              */
+#define GPIO_INT0EN_GPIO0_Pos             (0UL)                     /*!< GPIO INT0EN: GPIO0 (Bit 0)                            */
+#define GPIO_INT0EN_GPIO0_Msk             (0x1UL)                   /*!< GPIO INT0EN: GPIO0 (Bitfield-Mask: 0x01)              */
+/* =======================================================  INT0STAT  ======================================================== */
+#define GPIO_INT0STAT_GPIO31_Pos          (31UL)                    /*!< GPIO INT0STAT: GPIO31 (Bit 31)                        */
+#define GPIO_INT0STAT_GPIO31_Msk          (0x80000000UL)            /*!< GPIO INT0STAT: GPIO31 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT0STAT_GPIO30_Pos          (30UL)                    /*!< GPIO INT0STAT: GPIO30 (Bit 30)                        */
+#define GPIO_INT0STAT_GPIO30_Msk          (0x40000000UL)            /*!< GPIO INT0STAT: GPIO30 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT0STAT_GPIO29_Pos          (29UL)                    /*!< GPIO INT0STAT: GPIO29 (Bit 29)                        */
+#define GPIO_INT0STAT_GPIO29_Msk          (0x20000000UL)            /*!< GPIO INT0STAT: GPIO29 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT0STAT_GPIO28_Pos          (28UL)                    /*!< GPIO INT0STAT: GPIO28 (Bit 28)                        */
+#define GPIO_INT0STAT_GPIO28_Msk          (0x10000000UL)            /*!< GPIO INT0STAT: GPIO28 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT0STAT_GPIO27_Pos          (27UL)                    /*!< GPIO INT0STAT: GPIO27 (Bit 27)                        */
+#define GPIO_INT0STAT_GPIO27_Msk          (0x8000000UL)             /*!< GPIO INT0STAT: GPIO27 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT0STAT_GPIO26_Pos          (26UL)                    /*!< GPIO INT0STAT: GPIO26 (Bit 26)                        */
+#define GPIO_INT0STAT_GPIO26_Msk          (0x4000000UL)             /*!< GPIO INT0STAT: GPIO26 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT0STAT_GPIO25_Pos          (25UL)                    /*!< GPIO INT0STAT: GPIO25 (Bit 25)                        */
+#define GPIO_INT0STAT_GPIO25_Msk          (0x2000000UL)             /*!< GPIO INT0STAT: GPIO25 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT0STAT_GPIO24_Pos          (24UL)                    /*!< GPIO INT0STAT: GPIO24 (Bit 24)                        */
+#define GPIO_INT0STAT_GPIO24_Msk          (0x1000000UL)             /*!< GPIO INT0STAT: GPIO24 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT0STAT_GPIO23_Pos          (23UL)                    /*!< GPIO INT0STAT: GPIO23 (Bit 23)                        */
+#define GPIO_INT0STAT_GPIO23_Msk          (0x800000UL)              /*!< GPIO INT0STAT: GPIO23 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT0STAT_GPIO22_Pos          (22UL)                    /*!< GPIO INT0STAT: GPIO22 (Bit 22)                        */
+#define GPIO_INT0STAT_GPIO22_Msk          (0x400000UL)              /*!< GPIO INT0STAT: GPIO22 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT0STAT_GPIO21_Pos          (21UL)                    /*!< GPIO INT0STAT: GPIO21 (Bit 21)                        */
+#define GPIO_INT0STAT_GPIO21_Msk          (0x200000UL)              /*!< GPIO INT0STAT: GPIO21 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT0STAT_GPIO20_Pos          (20UL)                    /*!< GPIO INT0STAT: GPIO20 (Bit 20)                        */
+#define GPIO_INT0STAT_GPIO20_Msk          (0x100000UL)              /*!< GPIO INT0STAT: GPIO20 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT0STAT_GPIO19_Pos          (19UL)                    /*!< GPIO INT0STAT: GPIO19 (Bit 19)                        */
+#define GPIO_INT0STAT_GPIO19_Msk          (0x80000UL)               /*!< GPIO INT0STAT: GPIO19 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT0STAT_GPIO18_Pos          (18UL)                    /*!< GPIO INT0STAT: GPIO18 (Bit 18)                        */
+#define GPIO_INT0STAT_GPIO18_Msk          (0x40000UL)               /*!< GPIO INT0STAT: GPIO18 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT0STAT_GPIO17_Pos          (17UL)                    /*!< GPIO INT0STAT: GPIO17 (Bit 17)                        */
+#define GPIO_INT0STAT_GPIO17_Msk          (0x20000UL)               /*!< GPIO INT0STAT: GPIO17 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT0STAT_GPIO16_Pos          (16UL)                    /*!< GPIO INT0STAT: GPIO16 (Bit 16)                        */
+#define GPIO_INT0STAT_GPIO16_Msk          (0x10000UL)               /*!< GPIO INT0STAT: GPIO16 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT0STAT_GPIO15_Pos          (15UL)                    /*!< GPIO INT0STAT: GPIO15 (Bit 15)                        */
+#define GPIO_INT0STAT_GPIO15_Msk          (0x8000UL)                /*!< GPIO INT0STAT: GPIO15 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT0STAT_GPIO14_Pos          (14UL)                    /*!< GPIO INT0STAT: GPIO14 (Bit 14)                        */
+#define GPIO_INT0STAT_GPIO14_Msk          (0x4000UL)                /*!< GPIO INT0STAT: GPIO14 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT0STAT_GPIO13_Pos          (13UL)                    /*!< GPIO INT0STAT: GPIO13 (Bit 13)                        */
+#define GPIO_INT0STAT_GPIO13_Msk          (0x2000UL)                /*!< GPIO INT0STAT: GPIO13 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT0STAT_GPIO12_Pos          (12UL)                    /*!< GPIO INT0STAT: GPIO12 (Bit 12)                        */
+#define GPIO_INT0STAT_GPIO12_Msk          (0x1000UL)                /*!< GPIO INT0STAT: GPIO12 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT0STAT_GPIO11_Pos          (11UL)                    /*!< GPIO INT0STAT: GPIO11 (Bit 11)                        */
+#define GPIO_INT0STAT_GPIO11_Msk          (0x800UL)                 /*!< GPIO INT0STAT: GPIO11 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT0STAT_GPIO10_Pos          (10UL)                    /*!< GPIO INT0STAT: GPIO10 (Bit 10)                        */
+#define GPIO_INT0STAT_GPIO10_Msk          (0x400UL)                 /*!< GPIO INT0STAT: GPIO10 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT0STAT_GPIO9_Pos           (9UL)                     /*!< GPIO INT0STAT: GPIO9 (Bit 9)                          */
+#define GPIO_INT0STAT_GPIO9_Msk           (0x200UL)                 /*!< GPIO INT0STAT: GPIO9 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0STAT_GPIO8_Pos           (8UL)                     /*!< GPIO INT0STAT: GPIO8 (Bit 8)                          */
+#define GPIO_INT0STAT_GPIO8_Msk           (0x100UL)                 /*!< GPIO INT0STAT: GPIO8 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0STAT_GPIO7_Pos           (7UL)                     /*!< GPIO INT0STAT: GPIO7 (Bit 7)                          */
+#define GPIO_INT0STAT_GPIO7_Msk           (0x80UL)                  /*!< GPIO INT0STAT: GPIO7 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0STAT_GPIO6_Pos           (6UL)                     /*!< GPIO INT0STAT: GPIO6 (Bit 6)                          */
+#define GPIO_INT0STAT_GPIO6_Msk           (0x40UL)                  /*!< GPIO INT0STAT: GPIO6 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0STAT_GPIO5_Pos           (5UL)                     /*!< GPIO INT0STAT: GPIO5 (Bit 5)                          */
+#define GPIO_INT0STAT_GPIO5_Msk           (0x20UL)                  /*!< GPIO INT0STAT: GPIO5 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0STAT_GPIO4_Pos           (4UL)                     /*!< GPIO INT0STAT: GPIO4 (Bit 4)                          */
+#define GPIO_INT0STAT_GPIO4_Msk           (0x10UL)                  /*!< GPIO INT0STAT: GPIO4 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0STAT_GPIO3_Pos           (3UL)                     /*!< GPIO INT0STAT: GPIO3 (Bit 3)                          */
+#define GPIO_INT0STAT_GPIO3_Msk           (0x8UL)                   /*!< GPIO INT0STAT: GPIO3 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0STAT_GPIO2_Pos           (2UL)                     /*!< GPIO INT0STAT: GPIO2 (Bit 2)                          */
+#define GPIO_INT0STAT_GPIO2_Msk           (0x4UL)                   /*!< GPIO INT0STAT: GPIO2 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0STAT_GPIO1_Pos           (1UL)                     /*!< GPIO INT0STAT: GPIO1 (Bit 1)                          */
+#define GPIO_INT0STAT_GPIO1_Msk           (0x2UL)                   /*!< GPIO INT0STAT: GPIO1 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0STAT_GPIO0_Pos           (0UL)                     /*!< GPIO INT0STAT: GPIO0 (Bit 0)                          */
+#define GPIO_INT0STAT_GPIO0_Msk           (0x1UL)                   /*!< GPIO INT0STAT: GPIO0 (Bitfield-Mask: 0x01)            */
+/* ========================================================  INT0CLR  ======================================================== */
+#define GPIO_INT0CLR_GPIO31_Pos           (31UL)                    /*!< GPIO INT0CLR: GPIO31 (Bit 31)                         */
+#define GPIO_INT0CLR_GPIO31_Msk           (0x80000000UL)            /*!< GPIO INT0CLR: GPIO31 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0CLR_GPIO30_Pos           (30UL)                    /*!< GPIO INT0CLR: GPIO30 (Bit 30)                         */
+#define GPIO_INT0CLR_GPIO30_Msk           (0x40000000UL)            /*!< GPIO INT0CLR: GPIO30 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0CLR_GPIO29_Pos           (29UL)                    /*!< GPIO INT0CLR: GPIO29 (Bit 29)                         */
+#define GPIO_INT0CLR_GPIO29_Msk           (0x20000000UL)            /*!< GPIO INT0CLR: GPIO29 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0CLR_GPIO28_Pos           (28UL)                    /*!< GPIO INT0CLR: GPIO28 (Bit 28)                         */
+#define GPIO_INT0CLR_GPIO28_Msk           (0x10000000UL)            /*!< GPIO INT0CLR: GPIO28 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0CLR_GPIO27_Pos           (27UL)                    /*!< GPIO INT0CLR: GPIO27 (Bit 27)                         */
+#define GPIO_INT0CLR_GPIO27_Msk           (0x8000000UL)             /*!< GPIO INT0CLR: GPIO27 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0CLR_GPIO26_Pos           (26UL)                    /*!< GPIO INT0CLR: GPIO26 (Bit 26)                         */
+#define GPIO_INT0CLR_GPIO26_Msk           (0x4000000UL)             /*!< GPIO INT0CLR: GPIO26 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0CLR_GPIO25_Pos           (25UL)                    /*!< GPIO INT0CLR: GPIO25 (Bit 25)                         */
+#define GPIO_INT0CLR_GPIO25_Msk           (0x2000000UL)             /*!< GPIO INT0CLR: GPIO25 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0CLR_GPIO24_Pos           (24UL)                    /*!< GPIO INT0CLR: GPIO24 (Bit 24)                         */
+#define GPIO_INT0CLR_GPIO24_Msk           (0x1000000UL)             /*!< GPIO INT0CLR: GPIO24 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0CLR_GPIO23_Pos           (23UL)                    /*!< GPIO INT0CLR: GPIO23 (Bit 23)                         */
+#define GPIO_INT0CLR_GPIO23_Msk           (0x800000UL)              /*!< GPIO INT0CLR: GPIO23 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0CLR_GPIO22_Pos           (22UL)                    /*!< GPIO INT0CLR: GPIO22 (Bit 22)                         */
+#define GPIO_INT0CLR_GPIO22_Msk           (0x400000UL)              /*!< GPIO INT0CLR: GPIO22 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0CLR_GPIO21_Pos           (21UL)                    /*!< GPIO INT0CLR: GPIO21 (Bit 21)                         */
+#define GPIO_INT0CLR_GPIO21_Msk           (0x200000UL)              /*!< GPIO INT0CLR: GPIO21 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0CLR_GPIO20_Pos           (20UL)                    /*!< GPIO INT0CLR: GPIO20 (Bit 20)                         */
+#define GPIO_INT0CLR_GPIO20_Msk           (0x100000UL)              /*!< GPIO INT0CLR: GPIO20 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0CLR_GPIO19_Pos           (19UL)                    /*!< GPIO INT0CLR: GPIO19 (Bit 19)                         */
+#define GPIO_INT0CLR_GPIO19_Msk           (0x80000UL)               /*!< GPIO INT0CLR: GPIO19 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0CLR_GPIO18_Pos           (18UL)                    /*!< GPIO INT0CLR: GPIO18 (Bit 18)                         */
+#define GPIO_INT0CLR_GPIO18_Msk           (0x40000UL)               /*!< GPIO INT0CLR: GPIO18 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0CLR_GPIO17_Pos           (17UL)                    /*!< GPIO INT0CLR: GPIO17 (Bit 17)                         */
+#define GPIO_INT0CLR_GPIO17_Msk           (0x20000UL)               /*!< GPIO INT0CLR: GPIO17 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0CLR_GPIO16_Pos           (16UL)                    /*!< GPIO INT0CLR: GPIO16 (Bit 16)                         */
+#define GPIO_INT0CLR_GPIO16_Msk           (0x10000UL)               /*!< GPIO INT0CLR: GPIO16 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0CLR_GPIO15_Pos           (15UL)                    /*!< GPIO INT0CLR: GPIO15 (Bit 15)                         */
+#define GPIO_INT0CLR_GPIO15_Msk           (0x8000UL)                /*!< GPIO INT0CLR: GPIO15 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0CLR_GPIO14_Pos           (14UL)                    /*!< GPIO INT0CLR: GPIO14 (Bit 14)                         */
+#define GPIO_INT0CLR_GPIO14_Msk           (0x4000UL)                /*!< GPIO INT0CLR: GPIO14 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0CLR_GPIO13_Pos           (13UL)                    /*!< GPIO INT0CLR: GPIO13 (Bit 13)                         */
+#define GPIO_INT0CLR_GPIO13_Msk           (0x2000UL)                /*!< GPIO INT0CLR: GPIO13 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0CLR_GPIO12_Pos           (12UL)                    /*!< GPIO INT0CLR: GPIO12 (Bit 12)                         */
+#define GPIO_INT0CLR_GPIO12_Msk           (0x1000UL)                /*!< GPIO INT0CLR: GPIO12 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0CLR_GPIO11_Pos           (11UL)                    /*!< GPIO INT0CLR: GPIO11 (Bit 11)                         */
+#define GPIO_INT0CLR_GPIO11_Msk           (0x800UL)                 /*!< GPIO INT0CLR: GPIO11 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0CLR_GPIO10_Pos           (10UL)                    /*!< GPIO INT0CLR: GPIO10 (Bit 10)                         */
+#define GPIO_INT0CLR_GPIO10_Msk           (0x400UL)                 /*!< GPIO INT0CLR: GPIO10 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0CLR_GPIO9_Pos            (9UL)                     /*!< GPIO INT0CLR: GPIO9 (Bit 9)                           */
+#define GPIO_INT0CLR_GPIO9_Msk            (0x200UL)                 /*!< GPIO INT0CLR: GPIO9 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0CLR_GPIO8_Pos            (8UL)                     /*!< GPIO INT0CLR: GPIO8 (Bit 8)                           */
+#define GPIO_INT0CLR_GPIO8_Msk            (0x100UL)                 /*!< GPIO INT0CLR: GPIO8 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0CLR_GPIO7_Pos            (7UL)                     /*!< GPIO INT0CLR: GPIO7 (Bit 7)                           */
+#define GPIO_INT0CLR_GPIO7_Msk            (0x80UL)                  /*!< GPIO INT0CLR: GPIO7 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0CLR_GPIO6_Pos            (6UL)                     /*!< GPIO INT0CLR: GPIO6 (Bit 6)                           */
+#define GPIO_INT0CLR_GPIO6_Msk            (0x40UL)                  /*!< GPIO INT0CLR: GPIO6 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0CLR_GPIO5_Pos            (5UL)                     /*!< GPIO INT0CLR: GPIO5 (Bit 5)                           */
+#define GPIO_INT0CLR_GPIO5_Msk            (0x20UL)                  /*!< GPIO INT0CLR: GPIO5 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0CLR_GPIO4_Pos            (4UL)                     /*!< GPIO INT0CLR: GPIO4 (Bit 4)                           */
+#define GPIO_INT0CLR_GPIO4_Msk            (0x10UL)                  /*!< GPIO INT0CLR: GPIO4 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0CLR_GPIO3_Pos            (3UL)                     /*!< GPIO INT0CLR: GPIO3 (Bit 3)                           */
+#define GPIO_INT0CLR_GPIO3_Msk            (0x8UL)                   /*!< GPIO INT0CLR: GPIO3 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0CLR_GPIO2_Pos            (2UL)                     /*!< GPIO INT0CLR: GPIO2 (Bit 2)                           */
+#define GPIO_INT0CLR_GPIO2_Msk            (0x4UL)                   /*!< GPIO INT0CLR: GPIO2 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0CLR_GPIO1_Pos            (1UL)                     /*!< GPIO INT0CLR: GPIO1 (Bit 1)                           */
+#define GPIO_INT0CLR_GPIO1_Msk            (0x2UL)                   /*!< GPIO INT0CLR: GPIO1 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0CLR_GPIO0_Pos            (0UL)                     /*!< GPIO INT0CLR: GPIO0 (Bit 0)                           */
+#define GPIO_INT0CLR_GPIO0_Msk            (0x1UL)                   /*!< GPIO INT0CLR: GPIO0 (Bitfield-Mask: 0x01)             */
+/* ========================================================  INT0SET  ======================================================== */
+#define GPIO_INT0SET_GPIO31_Pos           (31UL)                    /*!< GPIO INT0SET: GPIO31 (Bit 31)                         */
+#define GPIO_INT0SET_GPIO31_Msk           (0x80000000UL)            /*!< GPIO INT0SET: GPIO31 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0SET_GPIO30_Pos           (30UL)                    /*!< GPIO INT0SET: GPIO30 (Bit 30)                         */
+#define GPIO_INT0SET_GPIO30_Msk           (0x40000000UL)            /*!< GPIO INT0SET: GPIO30 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0SET_GPIO29_Pos           (29UL)                    /*!< GPIO INT0SET: GPIO29 (Bit 29)                         */
+#define GPIO_INT0SET_GPIO29_Msk           (0x20000000UL)            /*!< GPIO INT0SET: GPIO29 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0SET_GPIO28_Pos           (28UL)                    /*!< GPIO INT0SET: GPIO28 (Bit 28)                         */
+#define GPIO_INT0SET_GPIO28_Msk           (0x10000000UL)            /*!< GPIO INT0SET: GPIO28 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0SET_GPIO27_Pos           (27UL)                    /*!< GPIO INT0SET: GPIO27 (Bit 27)                         */
+#define GPIO_INT0SET_GPIO27_Msk           (0x8000000UL)             /*!< GPIO INT0SET: GPIO27 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0SET_GPIO26_Pos           (26UL)                    /*!< GPIO INT0SET: GPIO26 (Bit 26)                         */
+#define GPIO_INT0SET_GPIO26_Msk           (0x4000000UL)             /*!< GPIO INT0SET: GPIO26 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0SET_GPIO25_Pos           (25UL)                    /*!< GPIO INT0SET: GPIO25 (Bit 25)                         */
+#define GPIO_INT0SET_GPIO25_Msk           (0x2000000UL)             /*!< GPIO INT0SET: GPIO25 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0SET_GPIO24_Pos           (24UL)                    /*!< GPIO INT0SET: GPIO24 (Bit 24)                         */
+#define GPIO_INT0SET_GPIO24_Msk           (0x1000000UL)             /*!< GPIO INT0SET: GPIO24 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0SET_GPIO23_Pos           (23UL)                    /*!< GPIO INT0SET: GPIO23 (Bit 23)                         */
+#define GPIO_INT0SET_GPIO23_Msk           (0x800000UL)              /*!< GPIO INT0SET: GPIO23 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0SET_GPIO22_Pos           (22UL)                    /*!< GPIO INT0SET: GPIO22 (Bit 22)                         */
+#define GPIO_INT0SET_GPIO22_Msk           (0x400000UL)              /*!< GPIO INT0SET: GPIO22 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0SET_GPIO21_Pos           (21UL)                    /*!< GPIO INT0SET: GPIO21 (Bit 21)                         */
+#define GPIO_INT0SET_GPIO21_Msk           (0x200000UL)              /*!< GPIO INT0SET: GPIO21 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0SET_GPIO20_Pos           (20UL)                    /*!< GPIO INT0SET: GPIO20 (Bit 20)                         */
+#define GPIO_INT0SET_GPIO20_Msk           (0x100000UL)              /*!< GPIO INT0SET: GPIO20 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0SET_GPIO19_Pos           (19UL)                    /*!< GPIO INT0SET: GPIO19 (Bit 19)                         */
+#define GPIO_INT0SET_GPIO19_Msk           (0x80000UL)               /*!< GPIO INT0SET: GPIO19 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0SET_GPIO18_Pos           (18UL)                    /*!< GPIO INT0SET: GPIO18 (Bit 18)                         */
+#define GPIO_INT0SET_GPIO18_Msk           (0x40000UL)               /*!< GPIO INT0SET: GPIO18 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0SET_GPIO17_Pos           (17UL)                    /*!< GPIO INT0SET: GPIO17 (Bit 17)                         */
+#define GPIO_INT0SET_GPIO17_Msk           (0x20000UL)               /*!< GPIO INT0SET: GPIO17 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0SET_GPIO16_Pos           (16UL)                    /*!< GPIO INT0SET: GPIO16 (Bit 16)                         */
+#define GPIO_INT0SET_GPIO16_Msk           (0x10000UL)               /*!< GPIO INT0SET: GPIO16 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0SET_GPIO15_Pos           (15UL)                    /*!< GPIO INT0SET: GPIO15 (Bit 15)                         */
+#define GPIO_INT0SET_GPIO15_Msk           (0x8000UL)                /*!< GPIO INT0SET: GPIO15 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0SET_GPIO14_Pos           (14UL)                    /*!< GPIO INT0SET: GPIO14 (Bit 14)                         */
+#define GPIO_INT0SET_GPIO14_Msk           (0x4000UL)                /*!< GPIO INT0SET: GPIO14 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0SET_GPIO13_Pos           (13UL)                    /*!< GPIO INT0SET: GPIO13 (Bit 13)                         */
+#define GPIO_INT0SET_GPIO13_Msk           (0x2000UL)                /*!< GPIO INT0SET: GPIO13 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0SET_GPIO12_Pos           (12UL)                    /*!< GPIO INT0SET: GPIO12 (Bit 12)                         */
+#define GPIO_INT0SET_GPIO12_Msk           (0x1000UL)                /*!< GPIO INT0SET: GPIO12 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0SET_GPIO11_Pos           (11UL)                    /*!< GPIO INT0SET: GPIO11 (Bit 11)                         */
+#define GPIO_INT0SET_GPIO11_Msk           (0x800UL)                 /*!< GPIO INT0SET: GPIO11 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0SET_GPIO10_Pos           (10UL)                    /*!< GPIO INT0SET: GPIO10 (Bit 10)                         */
+#define GPIO_INT0SET_GPIO10_Msk           (0x400UL)                 /*!< GPIO INT0SET: GPIO10 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT0SET_GPIO9_Pos            (9UL)                     /*!< GPIO INT0SET: GPIO9 (Bit 9)                           */
+#define GPIO_INT0SET_GPIO9_Msk            (0x200UL)                 /*!< GPIO INT0SET: GPIO9 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0SET_GPIO8_Pos            (8UL)                     /*!< GPIO INT0SET: GPIO8 (Bit 8)                           */
+#define GPIO_INT0SET_GPIO8_Msk            (0x100UL)                 /*!< GPIO INT0SET: GPIO8 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0SET_GPIO7_Pos            (7UL)                     /*!< GPIO INT0SET: GPIO7 (Bit 7)                           */
+#define GPIO_INT0SET_GPIO7_Msk            (0x80UL)                  /*!< GPIO INT0SET: GPIO7 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0SET_GPIO6_Pos            (6UL)                     /*!< GPIO INT0SET: GPIO6 (Bit 6)                           */
+#define GPIO_INT0SET_GPIO6_Msk            (0x40UL)                  /*!< GPIO INT0SET: GPIO6 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0SET_GPIO5_Pos            (5UL)                     /*!< GPIO INT0SET: GPIO5 (Bit 5)                           */
+#define GPIO_INT0SET_GPIO5_Msk            (0x20UL)                  /*!< GPIO INT0SET: GPIO5 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0SET_GPIO4_Pos            (4UL)                     /*!< GPIO INT0SET: GPIO4 (Bit 4)                           */
+#define GPIO_INT0SET_GPIO4_Msk            (0x10UL)                  /*!< GPIO INT0SET: GPIO4 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0SET_GPIO3_Pos            (3UL)                     /*!< GPIO INT0SET: GPIO3 (Bit 3)                           */
+#define GPIO_INT0SET_GPIO3_Msk            (0x8UL)                   /*!< GPIO INT0SET: GPIO3 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0SET_GPIO2_Pos            (2UL)                     /*!< GPIO INT0SET: GPIO2 (Bit 2)                           */
+#define GPIO_INT0SET_GPIO2_Msk            (0x4UL)                   /*!< GPIO INT0SET: GPIO2 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0SET_GPIO1_Pos            (1UL)                     /*!< GPIO INT0SET: GPIO1 (Bit 1)                           */
+#define GPIO_INT0SET_GPIO1_Msk            (0x2UL)                   /*!< GPIO INT0SET: GPIO1 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT0SET_GPIO0_Pos            (0UL)                     /*!< GPIO INT0SET: GPIO0 (Bit 0)                           */
+#define GPIO_INT0SET_GPIO0_Msk            (0x1UL)                   /*!< GPIO INT0SET: GPIO0 (Bitfield-Mask: 0x01)             */
+/* ========================================================  INT1EN  ========================================================= */
+#define GPIO_INT1EN_GPIO49_Pos            (17UL)                    /*!< GPIO INT1EN: GPIO49 (Bit 17)                          */
+#define GPIO_INT1EN_GPIO49_Msk            (0x20000UL)               /*!< GPIO INT1EN: GPIO49 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT1EN_GPIO48_Pos            (16UL)                    /*!< GPIO INT1EN: GPIO48 (Bit 16)                          */
+#define GPIO_INT1EN_GPIO48_Msk            (0x10000UL)               /*!< GPIO INT1EN: GPIO48 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT1EN_GPIO47_Pos            (15UL)                    /*!< GPIO INT1EN: GPIO47 (Bit 15)                          */
+#define GPIO_INT1EN_GPIO47_Msk            (0x8000UL)                /*!< GPIO INT1EN: GPIO47 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT1EN_GPIO46_Pos            (14UL)                    /*!< GPIO INT1EN: GPIO46 (Bit 14)                          */
+#define GPIO_INT1EN_GPIO46_Msk            (0x4000UL)                /*!< GPIO INT1EN: GPIO46 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT1EN_GPIO45_Pos            (13UL)                    /*!< GPIO INT1EN: GPIO45 (Bit 13)                          */
+#define GPIO_INT1EN_GPIO45_Msk            (0x2000UL)                /*!< GPIO INT1EN: GPIO45 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT1EN_GPIO44_Pos            (12UL)                    /*!< GPIO INT1EN: GPIO44 (Bit 12)                          */
+#define GPIO_INT1EN_GPIO44_Msk            (0x1000UL)                /*!< GPIO INT1EN: GPIO44 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT1EN_GPIO43_Pos            (11UL)                    /*!< GPIO INT1EN: GPIO43 (Bit 11)                          */
+#define GPIO_INT1EN_GPIO43_Msk            (0x800UL)                 /*!< GPIO INT1EN: GPIO43 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT1EN_GPIO42_Pos            (10UL)                    /*!< GPIO INT1EN: GPIO42 (Bit 10)                          */
+#define GPIO_INT1EN_GPIO42_Msk            (0x400UL)                 /*!< GPIO INT1EN: GPIO42 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT1EN_GPIO41_Pos            (9UL)                     /*!< GPIO INT1EN: GPIO41 (Bit 9)                           */
+#define GPIO_INT1EN_GPIO41_Msk            (0x200UL)                 /*!< GPIO INT1EN: GPIO41 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT1EN_GPIO40_Pos            (8UL)                     /*!< GPIO INT1EN: GPIO40 (Bit 8)                           */
+#define GPIO_INT1EN_GPIO40_Msk            (0x100UL)                 /*!< GPIO INT1EN: GPIO40 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT1EN_GPIO39_Pos            (7UL)                     /*!< GPIO INT1EN: GPIO39 (Bit 7)                           */
+#define GPIO_INT1EN_GPIO39_Msk            (0x80UL)                  /*!< GPIO INT1EN: GPIO39 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT1EN_GPIO38_Pos            (6UL)                     /*!< GPIO INT1EN: GPIO38 (Bit 6)                           */
+#define GPIO_INT1EN_GPIO38_Msk            (0x40UL)                  /*!< GPIO INT1EN: GPIO38 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT1EN_GPIO37_Pos            (5UL)                     /*!< GPIO INT1EN: GPIO37 (Bit 5)                           */
+#define GPIO_INT1EN_GPIO37_Msk            (0x20UL)                  /*!< GPIO INT1EN: GPIO37 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT1EN_GPIO36_Pos            (4UL)                     /*!< GPIO INT1EN: GPIO36 (Bit 4)                           */
+#define GPIO_INT1EN_GPIO36_Msk            (0x10UL)                  /*!< GPIO INT1EN: GPIO36 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT1EN_GPIO35_Pos            (3UL)                     /*!< GPIO INT1EN: GPIO35 (Bit 3)                           */
+#define GPIO_INT1EN_GPIO35_Msk            (0x8UL)                   /*!< GPIO INT1EN: GPIO35 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT1EN_GPIO34_Pos            (2UL)                     /*!< GPIO INT1EN: GPIO34 (Bit 2)                           */
+#define GPIO_INT1EN_GPIO34_Msk            (0x4UL)                   /*!< GPIO INT1EN: GPIO34 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT1EN_GPIO33_Pos            (1UL)                     /*!< GPIO INT1EN: GPIO33 (Bit 1)                           */
+#define GPIO_INT1EN_GPIO33_Msk            (0x2UL)                   /*!< GPIO INT1EN: GPIO33 (Bitfield-Mask: 0x01)             */
+#define GPIO_INT1EN_GPIO32_Pos            (0UL)                     /*!< GPIO INT1EN: GPIO32 (Bit 0)                           */
+#define GPIO_INT1EN_GPIO32_Msk            (0x1UL)                   /*!< GPIO INT1EN: GPIO32 (Bitfield-Mask: 0x01)             */
+/* =======================================================  INT1STAT  ======================================================== */
+#define GPIO_INT1STAT_GPIO49_Pos          (17UL)                    /*!< GPIO INT1STAT: GPIO49 (Bit 17)                        */
+#define GPIO_INT1STAT_GPIO49_Msk          (0x20000UL)               /*!< GPIO INT1STAT: GPIO49 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT1STAT_GPIO48_Pos          (16UL)                    /*!< GPIO INT1STAT: GPIO48 (Bit 16)                        */
+#define GPIO_INT1STAT_GPIO48_Msk          (0x10000UL)               /*!< GPIO INT1STAT: GPIO48 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT1STAT_GPIO47_Pos          (15UL)                    /*!< GPIO INT1STAT: GPIO47 (Bit 15)                        */
+#define GPIO_INT1STAT_GPIO47_Msk          (0x8000UL)                /*!< GPIO INT1STAT: GPIO47 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT1STAT_GPIO46_Pos          (14UL)                    /*!< GPIO INT1STAT: GPIO46 (Bit 14)                        */
+#define GPIO_INT1STAT_GPIO46_Msk          (0x4000UL)                /*!< GPIO INT1STAT: GPIO46 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT1STAT_GPIO45_Pos          (13UL)                    /*!< GPIO INT1STAT: GPIO45 (Bit 13)                        */
+#define GPIO_INT1STAT_GPIO45_Msk          (0x2000UL)                /*!< GPIO INT1STAT: GPIO45 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT1STAT_GPIO44_Pos          (12UL)                    /*!< GPIO INT1STAT: GPIO44 (Bit 12)                        */
+#define GPIO_INT1STAT_GPIO44_Msk          (0x1000UL)                /*!< GPIO INT1STAT: GPIO44 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT1STAT_GPIO43_Pos          (11UL)                    /*!< GPIO INT1STAT: GPIO43 (Bit 11)                        */
+#define GPIO_INT1STAT_GPIO43_Msk          (0x800UL)                 /*!< GPIO INT1STAT: GPIO43 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT1STAT_GPIO42_Pos          (10UL)                    /*!< GPIO INT1STAT: GPIO42 (Bit 10)                        */
+#define GPIO_INT1STAT_GPIO42_Msk          (0x400UL)                 /*!< GPIO INT1STAT: GPIO42 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT1STAT_GPIO41_Pos          (9UL)                     /*!< GPIO INT1STAT: GPIO41 (Bit 9)                         */
+#define GPIO_INT1STAT_GPIO41_Msk          (0x200UL)                 /*!< GPIO INT1STAT: GPIO41 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT1STAT_GPIO40_Pos          (8UL)                     /*!< GPIO INT1STAT: GPIO40 (Bit 8)                         */
+#define GPIO_INT1STAT_GPIO40_Msk          (0x100UL)                 /*!< GPIO INT1STAT: GPIO40 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT1STAT_GPIO39_Pos          (7UL)                     /*!< GPIO INT1STAT: GPIO39 (Bit 7)                         */
+#define GPIO_INT1STAT_GPIO39_Msk          (0x80UL)                  /*!< GPIO INT1STAT: GPIO39 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT1STAT_GPIO38_Pos          (6UL)                     /*!< GPIO INT1STAT: GPIO38 (Bit 6)                         */
+#define GPIO_INT1STAT_GPIO38_Msk          (0x40UL)                  /*!< GPIO INT1STAT: GPIO38 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT1STAT_GPIO37_Pos          (5UL)                     /*!< GPIO INT1STAT: GPIO37 (Bit 5)                         */
+#define GPIO_INT1STAT_GPIO37_Msk          (0x20UL)                  /*!< GPIO INT1STAT: GPIO37 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT1STAT_GPIO36_Pos          (4UL)                     /*!< GPIO INT1STAT: GPIO36 (Bit 4)                         */
+#define GPIO_INT1STAT_GPIO36_Msk          (0x10UL)                  /*!< GPIO INT1STAT: GPIO36 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT1STAT_GPIO35_Pos          (3UL)                     /*!< GPIO INT1STAT: GPIO35 (Bit 3)                         */
+#define GPIO_INT1STAT_GPIO35_Msk          (0x8UL)                   /*!< GPIO INT1STAT: GPIO35 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT1STAT_GPIO34_Pos          (2UL)                     /*!< GPIO INT1STAT: GPIO34 (Bit 2)                         */
+#define GPIO_INT1STAT_GPIO34_Msk          (0x4UL)                   /*!< GPIO INT1STAT: GPIO34 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT1STAT_GPIO33_Pos          (1UL)                     /*!< GPIO INT1STAT: GPIO33 (Bit 1)                         */
+#define GPIO_INT1STAT_GPIO33_Msk          (0x2UL)                   /*!< GPIO INT1STAT: GPIO33 (Bitfield-Mask: 0x01)           */
+#define GPIO_INT1STAT_GPIO32_Pos          (0UL)                     /*!< GPIO INT1STAT: GPIO32 (Bit 0)                         */
+#define GPIO_INT1STAT_GPIO32_Msk          (0x1UL)                   /*!< GPIO INT1STAT: GPIO32 (Bitfield-Mask: 0x01)           */
+/* ========================================================  INT1CLR  ======================================================== */
+#define GPIO_INT1CLR_GPIO49_Pos           (17UL)                    /*!< GPIO INT1CLR: GPIO49 (Bit 17)                         */
+#define GPIO_INT1CLR_GPIO49_Msk           (0x20000UL)               /*!< GPIO INT1CLR: GPIO49 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT1CLR_GPIO48_Pos           (16UL)                    /*!< GPIO INT1CLR: GPIO48 (Bit 16)                         */
+#define GPIO_INT1CLR_GPIO48_Msk           (0x10000UL)               /*!< GPIO INT1CLR: GPIO48 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT1CLR_GPIO47_Pos           (15UL)                    /*!< GPIO INT1CLR: GPIO47 (Bit 15)                         */
+#define GPIO_INT1CLR_GPIO47_Msk           (0x8000UL)                /*!< GPIO INT1CLR: GPIO47 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT1CLR_GPIO46_Pos           (14UL)                    /*!< GPIO INT1CLR: GPIO46 (Bit 14)                         */
+#define GPIO_INT1CLR_GPIO46_Msk           (0x4000UL)                /*!< GPIO INT1CLR: GPIO46 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT1CLR_GPIO45_Pos           (13UL)                    /*!< GPIO INT1CLR: GPIO45 (Bit 13)                         */
+#define GPIO_INT1CLR_GPIO45_Msk           (0x2000UL)                /*!< GPIO INT1CLR: GPIO45 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT1CLR_GPIO44_Pos           (12UL)                    /*!< GPIO INT1CLR: GPIO44 (Bit 12)                         */
+#define GPIO_INT1CLR_GPIO44_Msk           (0x1000UL)                /*!< GPIO INT1CLR: GPIO44 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT1CLR_GPIO43_Pos           (11UL)                    /*!< GPIO INT1CLR: GPIO43 (Bit 11)                         */
+#define GPIO_INT1CLR_GPIO43_Msk           (0x800UL)                 /*!< GPIO INT1CLR: GPIO43 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT1CLR_GPIO42_Pos           (10UL)                    /*!< GPIO INT1CLR: GPIO42 (Bit 10)                         */
+#define GPIO_INT1CLR_GPIO42_Msk           (0x400UL)                 /*!< GPIO INT1CLR: GPIO42 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT1CLR_GPIO41_Pos           (9UL)                     /*!< GPIO INT1CLR: GPIO41 (Bit 9)                          */
+#define GPIO_INT1CLR_GPIO41_Msk           (0x200UL)                 /*!< GPIO INT1CLR: GPIO41 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT1CLR_GPIO40_Pos           (8UL)                     /*!< GPIO INT1CLR: GPIO40 (Bit 8)                          */
+#define GPIO_INT1CLR_GPIO40_Msk           (0x100UL)                 /*!< GPIO INT1CLR: GPIO40 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT1CLR_GPIO39_Pos           (7UL)                     /*!< GPIO INT1CLR: GPIO39 (Bit 7)                          */
+#define GPIO_INT1CLR_GPIO39_Msk           (0x80UL)                  /*!< GPIO INT1CLR: GPIO39 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT1CLR_GPIO38_Pos           (6UL)                     /*!< GPIO INT1CLR: GPIO38 (Bit 6)                          */
+#define GPIO_INT1CLR_GPIO38_Msk           (0x40UL)                  /*!< GPIO INT1CLR: GPIO38 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT1CLR_GPIO37_Pos           (5UL)                     /*!< GPIO INT1CLR: GPIO37 (Bit 5)                          */
+#define GPIO_INT1CLR_GPIO37_Msk           (0x20UL)                  /*!< GPIO INT1CLR: GPIO37 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT1CLR_GPIO36_Pos           (4UL)                     /*!< GPIO INT1CLR: GPIO36 (Bit 4)                          */
+#define GPIO_INT1CLR_GPIO36_Msk           (0x10UL)                  /*!< GPIO INT1CLR: GPIO36 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT1CLR_GPIO35_Pos           (3UL)                     /*!< GPIO INT1CLR: GPIO35 (Bit 3)                          */
+#define GPIO_INT1CLR_GPIO35_Msk           (0x8UL)                   /*!< GPIO INT1CLR: GPIO35 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT1CLR_GPIO34_Pos           (2UL)                     /*!< GPIO INT1CLR: GPIO34 (Bit 2)                          */
+#define GPIO_INT1CLR_GPIO34_Msk           (0x4UL)                   /*!< GPIO INT1CLR: GPIO34 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT1CLR_GPIO33_Pos           (1UL)                     /*!< GPIO INT1CLR: GPIO33 (Bit 1)                          */
+#define GPIO_INT1CLR_GPIO33_Msk           (0x2UL)                   /*!< GPIO INT1CLR: GPIO33 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT1CLR_GPIO32_Pos           (0UL)                     /*!< GPIO INT1CLR: GPIO32 (Bit 0)                          */
+#define GPIO_INT1CLR_GPIO32_Msk           (0x1UL)                   /*!< GPIO INT1CLR: GPIO32 (Bitfield-Mask: 0x01)            */
+/* ========================================================  INT1SET  ======================================================== */
+#define GPIO_INT1SET_GPIO49_Pos           (17UL)                    /*!< GPIO INT1SET: GPIO49 (Bit 17)                         */
+#define GPIO_INT1SET_GPIO49_Msk           (0x20000UL)               /*!< GPIO INT1SET: GPIO49 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT1SET_GPIO48_Pos           (16UL)                    /*!< GPIO INT1SET: GPIO48 (Bit 16)                         */
+#define GPIO_INT1SET_GPIO48_Msk           (0x10000UL)               /*!< GPIO INT1SET: GPIO48 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT1SET_GPIO47_Pos           (15UL)                    /*!< GPIO INT1SET: GPIO47 (Bit 15)                         */
+#define GPIO_INT1SET_GPIO47_Msk           (0x8000UL)                /*!< GPIO INT1SET: GPIO47 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT1SET_GPIO46_Pos           (14UL)                    /*!< GPIO INT1SET: GPIO46 (Bit 14)                         */
+#define GPIO_INT1SET_GPIO46_Msk           (0x4000UL)                /*!< GPIO INT1SET: GPIO46 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT1SET_GPIO45_Pos           (13UL)                    /*!< GPIO INT1SET: GPIO45 (Bit 13)                         */
+#define GPIO_INT1SET_GPIO45_Msk           (0x2000UL)                /*!< GPIO INT1SET: GPIO45 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT1SET_GPIO44_Pos           (12UL)                    /*!< GPIO INT1SET: GPIO44 (Bit 12)                         */
+#define GPIO_INT1SET_GPIO44_Msk           (0x1000UL)                /*!< GPIO INT1SET: GPIO44 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT1SET_GPIO43_Pos           (11UL)                    /*!< GPIO INT1SET: GPIO43 (Bit 11)                         */
+#define GPIO_INT1SET_GPIO43_Msk           (0x800UL)                 /*!< GPIO INT1SET: GPIO43 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT1SET_GPIO42_Pos           (10UL)                    /*!< GPIO INT1SET: GPIO42 (Bit 10)                         */
+#define GPIO_INT1SET_GPIO42_Msk           (0x400UL)                 /*!< GPIO INT1SET: GPIO42 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT1SET_GPIO41_Pos           (9UL)                     /*!< GPIO INT1SET: GPIO41 (Bit 9)                          */
+#define GPIO_INT1SET_GPIO41_Msk           (0x200UL)                 /*!< GPIO INT1SET: GPIO41 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT1SET_GPIO40_Pos           (8UL)                     /*!< GPIO INT1SET: GPIO40 (Bit 8)                          */
+#define GPIO_INT1SET_GPIO40_Msk           (0x100UL)                 /*!< GPIO INT1SET: GPIO40 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT1SET_GPIO39_Pos           (7UL)                     /*!< GPIO INT1SET: GPIO39 (Bit 7)                          */
+#define GPIO_INT1SET_GPIO39_Msk           (0x80UL)                  /*!< GPIO INT1SET: GPIO39 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT1SET_GPIO38_Pos           (6UL)                     /*!< GPIO INT1SET: GPIO38 (Bit 6)                          */
+#define GPIO_INT1SET_GPIO38_Msk           (0x40UL)                  /*!< GPIO INT1SET: GPIO38 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT1SET_GPIO37_Pos           (5UL)                     /*!< GPIO INT1SET: GPIO37 (Bit 5)                          */
+#define GPIO_INT1SET_GPIO37_Msk           (0x20UL)                  /*!< GPIO INT1SET: GPIO37 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT1SET_GPIO36_Pos           (4UL)                     /*!< GPIO INT1SET: GPIO36 (Bit 4)                          */
+#define GPIO_INT1SET_GPIO36_Msk           (0x10UL)                  /*!< GPIO INT1SET: GPIO36 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT1SET_GPIO35_Pos           (3UL)                     /*!< GPIO INT1SET: GPIO35 (Bit 3)                          */
+#define GPIO_INT1SET_GPIO35_Msk           (0x8UL)                   /*!< GPIO INT1SET: GPIO35 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT1SET_GPIO34_Pos           (2UL)                     /*!< GPIO INT1SET: GPIO34 (Bit 2)                          */
+#define GPIO_INT1SET_GPIO34_Msk           (0x4UL)                   /*!< GPIO INT1SET: GPIO34 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT1SET_GPIO33_Pos           (1UL)                     /*!< GPIO INT1SET: GPIO33 (Bit 1)                          */
+#define GPIO_INT1SET_GPIO33_Msk           (0x2UL)                   /*!< GPIO INT1SET: GPIO33 (Bitfield-Mask: 0x01)            */
+#define GPIO_INT1SET_GPIO32_Pos           (0UL)                     /*!< GPIO INT1SET: GPIO32 (Bit 0)                          */
+#define GPIO_INT1SET_GPIO32_Msk           (0x1UL)                   /*!< GPIO INT1SET: GPIO32 (Bitfield-Mask: 0x01)            */
+
+
+/* =========================================================================================================================== */
+/* ================                                          IOMSTR0                                          ================ */
+/* =========================================================================================================================== */
+
+/* =========================================================  FIFO  ========================================================== */
+#define IOMSTR0_FIFO_FIFO_Pos             (0UL)                     /*!< IOMSTR0 FIFO: FIFO (Bit 0)                            */
+#define IOMSTR0_FIFO_FIFO_Msk             (0xffffffffUL)            /*!< IOMSTR0 FIFO: FIFO (Bitfield-Mask: 0xffffffff)        */
+/* ========================================================  FIFOPTR  ======================================================== */
+#define IOMSTR0_FIFOPTR_FIFOREM_Pos       (16UL)                    /*!< IOMSTR0 FIFOPTR: FIFOREM (Bit 16)                     */
+#define IOMSTR0_FIFOPTR_FIFOREM_Msk       (0xff0000UL)              /*!< IOMSTR0 FIFOPTR: FIFOREM (Bitfield-Mask: 0xff)        */
+#define IOMSTR0_FIFOPTR_FIFOSIZ_Pos       (0UL)                     /*!< IOMSTR0 FIFOPTR: FIFOSIZ (Bit 0)                      */
+#define IOMSTR0_FIFOPTR_FIFOSIZ_Msk       (0xffUL)                  /*!< IOMSTR0 FIFOPTR: FIFOSIZ (Bitfield-Mask: 0xff)        */
+/* ========================================================  TLNGTH  ========================================================= */
+#define IOMSTR0_TLNGTH_TLNGTH_Pos         (0UL)                     /*!< IOMSTR0 TLNGTH: TLNGTH (Bit 0)                        */
+#define IOMSTR0_TLNGTH_TLNGTH_Msk         (0xfffUL)                 /*!< IOMSTR0 TLNGTH: TLNGTH (Bitfield-Mask: 0xfff)         */
+/* ========================================================  FIFOTHR  ======================================================== */
+#define IOMSTR0_FIFOTHR_FIFOWTHR_Pos      (8UL)                     /*!< IOMSTR0 FIFOTHR: FIFOWTHR (Bit 8)                     */
+#define IOMSTR0_FIFOTHR_FIFOWTHR_Msk      (0x7f00UL)                /*!< IOMSTR0 FIFOTHR: FIFOWTHR (Bitfield-Mask: 0x7f)       */
+#define IOMSTR0_FIFOTHR_FIFORTHR_Pos      (0UL)                     /*!< IOMSTR0 FIFOTHR: FIFORTHR (Bit 0)                     */
+#define IOMSTR0_FIFOTHR_FIFORTHR_Msk      (0x7fUL)                  /*!< IOMSTR0 FIFOTHR: FIFORTHR (Bitfield-Mask: 0x7f)       */
+/* ========================================================  CLKCFG  ========================================================= */
+#define IOMSTR0_CLKCFG_TOTPER_Pos         (24UL)                    /*!< IOMSTR0 CLKCFG: TOTPER (Bit 24)                       */
+#define IOMSTR0_CLKCFG_TOTPER_Msk         (0xff000000UL)            /*!< IOMSTR0 CLKCFG: TOTPER (Bitfield-Mask: 0xff)          */
+#define IOMSTR0_CLKCFG_LOWPER_Pos         (16UL)                    /*!< IOMSTR0 CLKCFG: LOWPER (Bit 16)                       */
+#define IOMSTR0_CLKCFG_LOWPER_Msk         (0xff0000UL)              /*!< IOMSTR0 CLKCFG: LOWPER (Bitfield-Mask: 0xff)          */
+#define IOMSTR0_CLKCFG_DIVEN_Pos          (12UL)                    /*!< IOMSTR0 CLKCFG: DIVEN (Bit 12)                        */
+#define IOMSTR0_CLKCFG_DIVEN_Msk          (0x1000UL)                /*!< IOMSTR0 CLKCFG: DIVEN (Bitfield-Mask: 0x01)           */
+#define IOMSTR0_CLKCFG_DIV3_Pos           (11UL)                    /*!< IOMSTR0 CLKCFG: DIV3 (Bit 11)                         */
+#define IOMSTR0_CLKCFG_DIV3_Msk           (0x800UL)                 /*!< IOMSTR0 CLKCFG: DIV3 (Bitfield-Mask: 0x01)            */
+#define IOMSTR0_CLKCFG_FSEL_Pos           (8UL)                     /*!< IOMSTR0 CLKCFG: FSEL (Bit 8)                          */
+#define IOMSTR0_CLKCFG_FSEL_Msk           (0x700UL)                 /*!< IOMSTR0 CLKCFG: FSEL (Bitfield-Mask: 0x07)            */
+/* ==========================================================  CMD  ========================================================== */
+#define IOMSTR0_CMD_CMD_Pos               (0UL)                     /*!< IOMSTR0 CMD: CMD (Bit 0)                              */
+#define IOMSTR0_CMD_CMD_Msk               (0xffffffffUL)            /*!< IOMSTR0 CMD: CMD (Bitfield-Mask: 0xffffffff)          */
+/* ========================================================  CMDRPT  ========================================================= */
+#define IOMSTR0_CMDRPT_CMDRPT_Pos         (0UL)                     /*!< IOMSTR0 CMDRPT: CMDRPT (Bit 0)                        */
+#define IOMSTR0_CMDRPT_CMDRPT_Msk         (0x1fUL)                  /*!< IOMSTR0 CMDRPT: CMDRPT (Bitfield-Mask: 0x1f)          */
+/* ========================================================  STATUS  ========================================================= */
+#define IOMSTR0_STATUS_IDLEST_Pos         (2UL)                     /*!< IOMSTR0 STATUS: IDLEST (Bit 2)                        */
+#define IOMSTR0_STATUS_IDLEST_Msk         (0x4UL)                   /*!< IOMSTR0 STATUS: IDLEST (Bitfield-Mask: 0x01)          */
+#define IOMSTR0_STATUS_CMDACT_Pos         (1UL)                     /*!< IOMSTR0 STATUS: CMDACT (Bit 1)                        */
+#define IOMSTR0_STATUS_CMDACT_Msk         (0x2UL)                   /*!< IOMSTR0 STATUS: CMDACT (Bitfield-Mask: 0x01)          */
+#define IOMSTR0_STATUS_ERR_Pos            (0UL)                     /*!< IOMSTR0 STATUS: ERR (Bit 0)                           */
+#define IOMSTR0_STATUS_ERR_Msk            (0x1UL)                   /*!< IOMSTR0 STATUS: ERR (Bitfield-Mask: 0x01)             */
+/* ==========================================================  CFG  ========================================================== */
+#define IOMSTR0_CFG_IFCEN_Pos             (31UL)                    /*!< IOMSTR0 CFG: IFCEN (Bit 31)                           */
+#define IOMSTR0_CFG_IFCEN_Msk             (0x80000000UL)            /*!< IOMSTR0 CFG: IFCEN (Bitfield-Mask: 0x01)              */
+#define IOMSTR0_CFG_RDFCPOL_Pos           (14UL)                    /*!< IOMSTR0 CFG: RDFCPOL (Bit 14)                         */
+#define IOMSTR0_CFG_RDFCPOL_Msk           (0x4000UL)                /*!< IOMSTR0 CFG: RDFCPOL (Bitfield-Mask: 0x01)            */
+#define IOMSTR0_CFG_WTFCPOL_Pos           (13UL)                    /*!< IOMSTR0 CFG: WTFCPOL (Bit 13)                         */
+#define IOMSTR0_CFG_WTFCPOL_Msk           (0x2000UL)                /*!< IOMSTR0 CFG: WTFCPOL (Bitfield-Mask: 0x01)            */
+#define IOMSTR0_CFG_WTFCIRQ_Pos           (12UL)                    /*!< IOMSTR0 CFG: WTFCIRQ (Bit 12)                         */
+#define IOMSTR0_CFG_WTFCIRQ_Msk           (0x1000UL)                /*!< IOMSTR0 CFG: WTFCIRQ (Bitfield-Mask: 0x01)            */
+#define IOMSTR0_CFG_FCDEL_Pos             (11UL)                    /*!< IOMSTR0 CFG: FCDEL (Bit 11)                           */
+#define IOMSTR0_CFG_FCDEL_Msk             (0x800UL)                 /*!< IOMSTR0 CFG: FCDEL (Bitfield-Mask: 0x01)              */
+#define IOMSTR0_CFG_MOSIINV_Pos           (10UL)                    /*!< IOMSTR0 CFG: MOSIINV (Bit 10)                         */
+#define IOMSTR0_CFG_MOSIINV_Msk           (0x400UL)                 /*!< IOMSTR0 CFG: MOSIINV (Bitfield-Mask: 0x01)            */
+#define IOMSTR0_CFG_RDFC_Pos              (9UL)                     /*!< IOMSTR0 CFG: RDFC (Bit 9)                             */
+#define IOMSTR0_CFG_RDFC_Msk              (0x200UL)                 /*!< IOMSTR0 CFG: RDFC (Bitfield-Mask: 0x01)               */
+#define IOMSTR0_CFG_WTFC_Pos              (8UL)                     /*!< IOMSTR0 CFG: WTFC (Bit 8)                             */
+#define IOMSTR0_CFG_WTFC_Msk              (0x100UL)                 /*!< IOMSTR0 CFG: WTFC (Bitfield-Mask: 0x01)               */
+#define IOMSTR0_CFG_STARTRD_Pos           (4UL)                     /*!< IOMSTR0 CFG: STARTRD (Bit 4)                          */
+#define IOMSTR0_CFG_STARTRD_Msk           (0x30UL)                  /*!< IOMSTR0 CFG: STARTRD (Bitfield-Mask: 0x03)            */
+#define IOMSTR0_CFG_FULLDUP_Pos           (3UL)                     /*!< IOMSTR0 CFG: FULLDUP (Bit 3)                          */
+#define IOMSTR0_CFG_FULLDUP_Msk           (0x8UL)                   /*!< IOMSTR0 CFG: FULLDUP (Bitfield-Mask: 0x01)            */
+#define IOMSTR0_CFG_SPHA_Pos              (2UL)                     /*!< IOMSTR0 CFG: SPHA (Bit 2)                             */
+#define IOMSTR0_CFG_SPHA_Msk              (0x4UL)                   /*!< IOMSTR0 CFG: SPHA (Bitfield-Mask: 0x01)               */
+#define IOMSTR0_CFG_SPOL_Pos              (1UL)                     /*!< IOMSTR0 CFG: SPOL (Bit 1)                             */
+#define IOMSTR0_CFG_SPOL_Msk              (0x2UL)                   /*!< IOMSTR0 CFG: SPOL (Bitfield-Mask: 0x01)               */
+#define IOMSTR0_CFG_IFCSEL_Pos            (0UL)                     /*!< IOMSTR0 CFG: IFCSEL (Bit 0)                           */
+#define IOMSTR0_CFG_IFCSEL_Msk            (0x1UL)                   /*!< IOMSTR0 CFG: IFCSEL (Bitfield-Mask: 0x01)             */
+/* =========================================================  INTEN  ========================================================= */
+#define IOMSTR0_INTEN_ARB_Pos             (10UL)                    /*!< IOMSTR0 INTEN: ARB (Bit 10)                           */
+#define IOMSTR0_INTEN_ARB_Msk             (0x400UL)                 /*!< IOMSTR0 INTEN: ARB (Bitfield-Mask: 0x01)              */
+#define IOMSTR0_INTEN_STOP_Pos            (9UL)                     /*!< IOMSTR0 INTEN: STOP (Bit 9)                           */
+#define IOMSTR0_INTEN_STOP_Msk            (0x200UL)                 /*!< IOMSTR0 INTEN: STOP (Bitfield-Mask: 0x01)             */
+#define IOMSTR0_INTEN_START_Pos           (8UL)                     /*!< IOMSTR0 INTEN: START (Bit 8)                          */
+#define IOMSTR0_INTEN_START_Msk           (0x100UL)                 /*!< IOMSTR0 INTEN: START (Bitfield-Mask: 0x01)            */
+#define IOMSTR0_INTEN_ICMD_Pos            (7UL)                     /*!< IOMSTR0 INTEN: ICMD (Bit 7)                           */
+#define IOMSTR0_INTEN_ICMD_Msk            (0x80UL)                  /*!< IOMSTR0 INTEN: ICMD (Bitfield-Mask: 0x01)             */
+#define IOMSTR0_INTEN_IACC_Pos            (6UL)                     /*!< IOMSTR0 INTEN: IACC (Bit 6)                           */
+#define IOMSTR0_INTEN_IACC_Msk            (0x40UL)                  /*!< IOMSTR0 INTEN: IACC (Bitfield-Mask: 0x01)             */
+#define IOMSTR0_INTEN_WTLEN_Pos           (5UL)                     /*!< IOMSTR0 INTEN: WTLEN (Bit 5)                          */
+#define IOMSTR0_INTEN_WTLEN_Msk           (0x20UL)                  /*!< IOMSTR0 INTEN: WTLEN (Bitfield-Mask: 0x01)            */
+#define IOMSTR0_INTEN_NAK_Pos             (4UL)                     /*!< IOMSTR0 INTEN: NAK (Bit 4)                            */
+#define IOMSTR0_INTEN_NAK_Msk             (0x10UL)                  /*!< IOMSTR0 INTEN: NAK (Bitfield-Mask: 0x01)              */
+#define IOMSTR0_INTEN_FOVFL_Pos           (3UL)                     /*!< IOMSTR0 INTEN: FOVFL (Bit 3)                          */
+#define IOMSTR0_INTEN_FOVFL_Msk           (0x8UL)                   /*!< IOMSTR0 INTEN: FOVFL (Bitfield-Mask: 0x01)            */
+#define IOMSTR0_INTEN_FUNDFL_Pos          (2UL)                     /*!< IOMSTR0 INTEN: FUNDFL (Bit 2)                         */
+#define IOMSTR0_INTEN_FUNDFL_Msk          (0x4UL)                   /*!< IOMSTR0 INTEN: FUNDFL (Bitfield-Mask: 0x01)           */
+#define IOMSTR0_INTEN_THR_Pos             (1UL)                     /*!< IOMSTR0 INTEN: THR (Bit 1)                            */
+#define IOMSTR0_INTEN_THR_Msk             (0x2UL)                   /*!< IOMSTR0 INTEN: THR (Bitfield-Mask: 0x01)              */
+#define IOMSTR0_INTEN_CMDCMP_Pos          (0UL)                     /*!< IOMSTR0 INTEN: CMDCMP (Bit 0)                         */
+#define IOMSTR0_INTEN_CMDCMP_Msk          (0x1UL)                   /*!< IOMSTR0 INTEN: CMDCMP (Bitfield-Mask: 0x01)           */
+/* ========================================================  INTSTAT  ======================================================== */
+#define IOMSTR0_INTSTAT_ARB_Pos           (10UL)                    /*!< IOMSTR0 INTSTAT: ARB (Bit 10)                         */
+#define IOMSTR0_INTSTAT_ARB_Msk           (0x400UL)                 /*!< IOMSTR0 INTSTAT: ARB (Bitfield-Mask: 0x01)            */
+#define IOMSTR0_INTSTAT_STOP_Pos          (9UL)                     /*!< IOMSTR0 INTSTAT: STOP (Bit 9)                         */
+#define IOMSTR0_INTSTAT_STOP_Msk          (0x200UL)                 /*!< IOMSTR0 INTSTAT: STOP (Bitfield-Mask: 0x01)           */
+#define IOMSTR0_INTSTAT_START_Pos         (8UL)                     /*!< IOMSTR0 INTSTAT: START (Bit 8)                        */
+#define IOMSTR0_INTSTAT_START_Msk         (0x100UL)                 /*!< IOMSTR0 INTSTAT: START (Bitfield-Mask: 0x01)          */
+#define IOMSTR0_INTSTAT_ICMD_Pos          (7UL)                     /*!< IOMSTR0 INTSTAT: ICMD (Bit 7)                         */
+#define IOMSTR0_INTSTAT_ICMD_Msk          (0x80UL)                  /*!< IOMSTR0 INTSTAT: ICMD (Bitfield-Mask: 0x01)           */
+#define IOMSTR0_INTSTAT_IACC_Pos          (6UL)                     /*!< IOMSTR0 INTSTAT: IACC (Bit 6)                         */
+#define IOMSTR0_INTSTAT_IACC_Msk          (0x40UL)                  /*!< IOMSTR0 INTSTAT: IACC (Bitfield-Mask: 0x01)           */
+#define IOMSTR0_INTSTAT_WTLEN_Pos         (5UL)                     /*!< IOMSTR0 INTSTAT: WTLEN (Bit 5)                        */
+#define IOMSTR0_INTSTAT_WTLEN_Msk         (0x20UL)                  /*!< IOMSTR0 INTSTAT: WTLEN (Bitfield-Mask: 0x01)          */
+#define IOMSTR0_INTSTAT_NAK_Pos           (4UL)                     /*!< IOMSTR0 INTSTAT: NAK (Bit 4)                          */
+#define IOMSTR0_INTSTAT_NAK_Msk           (0x10UL)                  /*!< IOMSTR0 INTSTAT: NAK (Bitfield-Mask: 0x01)            */
+#define IOMSTR0_INTSTAT_FOVFL_Pos         (3UL)                     /*!< IOMSTR0 INTSTAT: FOVFL (Bit 3)                        */
+#define IOMSTR0_INTSTAT_FOVFL_Msk         (0x8UL)                   /*!< IOMSTR0 INTSTAT: FOVFL (Bitfield-Mask: 0x01)          */
+#define IOMSTR0_INTSTAT_FUNDFL_Pos        (2UL)                     /*!< IOMSTR0 INTSTAT: FUNDFL (Bit 2)                       */
+#define IOMSTR0_INTSTAT_FUNDFL_Msk        (0x4UL)                   /*!< IOMSTR0 INTSTAT: FUNDFL (Bitfield-Mask: 0x01)         */
+#define IOMSTR0_INTSTAT_THR_Pos           (1UL)                     /*!< IOMSTR0 INTSTAT: THR (Bit 1)                          */
+#define IOMSTR0_INTSTAT_THR_Msk           (0x2UL)                   /*!< IOMSTR0 INTSTAT: THR (Bitfield-Mask: 0x01)            */
+#define IOMSTR0_INTSTAT_CMDCMP_Pos        (0UL)                     /*!< IOMSTR0 INTSTAT: CMDCMP (Bit 0)                       */
+#define IOMSTR0_INTSTAT_CMDCMP_Msk        (0x1UL)                   /*!< IOMSTR0 INTSTAT: CMDCMP (Bitfield-Mask: 0x01)         */
+/* ========================================================  INTCLR  ========================================================= */
+#define IOMSTR0_INTCLR_ARB_Pos            (10UL)                    /*!< IOMSTR0 INTCLR: ARB (Bit 10)                          */
+#define IOMSTR0_INTCLR_ARB_Msk            (0x400UL)                 /*!< IOMSTR0 INTCLR: ARB (Bitfield-Mask: 0x01)             */
+#define IOMSTR0_INTCLR_STOP_Pos           (9UL)                     /*!< IOMSTR0 INTCLR: STOP (Bit 9)                          */
+#define IOMSTR0_INTCLR_STOP_Msk           (0x200UL)                 /*!< IOMSTR0 INTCLR: STOP (Bitfield-Mask: 0x01)            */
+#define IOMSTR0_INTCLR_START_Pos          (8UL)                     /*!< IOMSTR0 INTCLR: START (Bit 8)                         */
+#define IOMSTR0_INTCLR_START_Msk          (0x100UL)                 /*!< IOMSTR0 INTCLR: START (Bitfield-Mask: 0x01)           */
+#define IOMSTR0_INTCLR_ICMD_Pos           (7UL)                     /*!< IOMSTR0 INTCLR: ICMD (Bit 7)                          */
+#define IOMSTR0_INTCLR_ICMD_Msk           (0x80UL)                  /*!< IOMSTR0 INTCLR: ICMD (Bitfield-Mask: 0x01)            */
+#define IOMSTR0_INTCLR_IACC_Pos           (6UL)                     /*!< IOMSTR0 INTCLR: IACC (Bit 6)                          */
+#define IOMSTR0_INTCLR_IACC_Msk           (0x40UL)                  /*!< IOMSTR0 INTCLR: IACC (Bitfield-Mask: 0x01)            */
+#define IOMSTR0_INTCLR_WTLEN_Pos          (5UL)                     /*!< IOMSTR0 INTCLR: WTLEN (Bit 5)                         */
+#define IOMSTR0_INTCLR_WTLEN_Msk          (0x20UL)                  /*!< IOMSTR0 INTCLR: WTLEN (Bitfield-Mask: 0x01)           */
+#define IOMSTR0_INTCLR_NAK_Pos            (4UL)                     /*!< IOMSTR0 INTCLR: NAK (Bit 4)                           */
+#define IOMSTR0_INTCLR_NAK_Msk            (0x10UL)                  /*!< IOMSTR0 INTCLR: NAK (Bitfield-Mask: 0x01)             */
+#define IOMSTR0_INTCLR_FOVFL_Pos          (3UL)                     /*!< IOMSTR0 INTCLR: FOVFL (Bit 3)                         */
+#define IOMSTR0_INTCLR_FOVFL_Msk          (0x8UL)                   /*!< IOMSTR0 INTCLR: FOVFL (Bitfield-Mask: 0x01)           */
+#define IOMSTR0_INTCLR_FUNDFL_Pos         (2UL)                     /*!< IOMSTR0 INTCLR: FUNDFL (Bit 2)                        */
+#define IOMSTR0_INTCLR_FUNDFL_Msk         (0x4UL)                   /*!< IOMSTR0 INTCLR: FUNDFL (Bitfield-Mask: 0x01)          */
+#define IOMSTR0_INTCLR_THR_Pos            (1UL)                     /*!< IOMSTR0 INTCLR: THR (Bit 1)                           */
+#define IOMSTR0_INTCLR_THR_Msk            (0x2UL)                   /*!< IOMSTR0 INTCLR: THR (Bitfield-Mask: 0x01)             */
+#define IOMSTR0_INTCLR_CMDCMP_Pos         (0UL)                     /*!< IOMSTR0 INTCLR: CMDCMP (Bit 0)                        */
+#define IOMSTR0_INTCLR_CMDCMP_Msk         (0x1UL)                   /*!< IOMSTR0 INTCLR: CMDCMP (Bitfield-Mask: 0x01)          */
+/* ========================================================  INTSET  ========================================================= */
+#define IOMSTR0_INTSET_ARB_Pos            (10UL)                    /*!< IOMSTR0 INTSET: ARB (Bit 10)                          */
+#define IOMSTR0_INTSET_ARB_Msk            (0x400UL)                 /*!< IOMSTR0 INTSET: ARB (Bitfield-Mask: 0x01)             */
+#define IOMSTR0_INTSET_STOP_Pos           (9UL)                     /*!< IOMSTR0 INTSET: STOP (Bit 9)                          */
+#define IOMSTR0_INTSET_STOP_Msk           (0x200UL)                 /*!< IOMSTR0 INTSET: STOP (Bitfield-Mask: 0x01)            */
+#define IOMSTR0_INTSET_START_Pos          (8UL)                     /*!< IOMSTR0 INTSET: START (Bit 8)                         */
+#define IOMSTR0_INTSET_START_Msk          (0x100UL)                 /*!< IOMSTR0 INTSET: START (Bitfield-Mask: 0x01)           */
+#define IOMSTR0_INTSET_ICMD_Pos           (7UL)                     /*!< IOMSTR0 INTSET: ICMD (Bit 7)                          */
+#define IOMSTR0_INTSET_ICMD_Msk           (0x80UL)                  /*!< IOMSTR0 INTSET: ICMD (Bitfield-Mask: 0x01)            */
+#define IOMSTR0_INTSET_IACC_Pos           (6UL)                     /*!< IOMSTR0 INTSET: IACC (Bit 6)                          */
+#define IOMSTR0_INTSET_IACC_Msk           (0x40UL)                  /*!< IOMSTR0 INTSET: IACC (Bitfield-Mask: 0x01)            */
+#define IOMSTR0_INTSET_WTLEN_Pos          (5UL)                     /*!< IOMSTR0 INTSET: WTLEN (Bit 5)                         */
+#define IOMSTR0_INTSET_WTLEN_Msk          (0x20UL)                  /*!< IOMSTR0 INTSET: WTLEN (Bitfield-Mask: 0x01)           */
+#define IOMSTR0_INTSET_NAK_Pos            (4UL)                     /*!< IOMSTR0 INTSET: NAK (Bit 4)                           */
+#define IOMSTR0_INTSET_NAK_Msk            (0x10UL)                  /*!< IOMSTR0 INTSET: NAK (Bitfield-Mask: 0x01)             */
+#define IOMSTR0_INTSET_FOVFL_Pos          (3UL)                     /*!< IOMSTR0 INTSET: FOVFL (Bit 3)                         */
+#define IOMSTR0_INTSET_FOVFL_Msk          (0x8UL)                   /*!< IOMSTR0 INTSET: FOVFL (Bitfield-Mask: 0x01)           */
+#define IOMSTR0_INTSET_FUNDFL_Pos         (2UL)                     /*!< IOMSTR0 INTSET: FUNDFL (Bit 2)                        */
+#define IOMSTR0_INTSET_FUNDFL_Msk         (0x4UL)                   /*!< IOMSTR0 INTSET: FUNDFL (Bitfield-Mask: 0x01)          */
+#define IOMSTR0_INTSET_THR_Pos            (1UL)                     /*!< IOMSTR0 INTSET: THR (Bit 1)                           */
+#define IOMSTR0_INTSET_THR_Msk            (0x2UL)                   /*!< IOMSTR0 INTSET: THR (Bitfield-Mask: 0x01)             */
+#define IOMSTR0_INTSET_CMDCMP_Pos         (0UL)                     /*!< IOMSTR0 INTSET: CMDCMP (Bit 0)                        */
+#define IOMSTR0_INTSET_CMDCMP_Msk         (0x1UL)                   /*!< IOMSTR0 INTSET: CMDCMP (Bitfield-Mask: 0x01)          */
+
+
+/* =========================================================================================================================== */
+/* ================                                          IOSLAVE                                          ================ */
+/* =========================================================================================================================== */
+
+/* ========================================================  FIFOPTR  ======================================================== */
+#define IOSLAVE_FIFOPTR_FIFOSIZ_Pos       (8UL)                     /*!< IOSLAVE FIFOPTR: FIFOSIZ (Bit 8)                      */
+#define IOSLAVE_FIFOPTR_FIFOSIZ_Msk       (0xff00UL)                /*!< IOSLAVE FIFOPTR: FIFOSIZ (Bitfield-Mask: 0xff)        */
+#define IOSLAVE_FIFOPTR_FIFOPTR_Pos       (0UL)                     /*!< IOSLAVE FIFOPTR: FIFOPTR (Bit 0)                      */
+#define IOSLAVE_FIFOPTR_FIFOPTR_Msk       (0xffUL)                  /*!< IOSLAVE FIFOPTR: FIFOPTR (Bitfield-Mask: 0xff)        */
+/* ========================================================  FIFOCFG  ======================================================== */
+#define IOSLAVE_FIFOCFG_ROBASE_Pos        (24UL)                    /*!< IOSLAVE FIFOCFG: ROBASE (Bit 24)                      */
+#define IOSLAVE_FIFOCFG_ROBASE_Msk        (0x3f000000UL)            /*!< IOSLAVE FIFOCFG: ROBASE (Bitfield-Mask: 0x3f)         */
+#define IOSLAVE_FIFOCFG_FIFOMAX_Pos       (8UL)                     /*!< IOSLAVE FIFOCFG: FIFOMAX (Bit 8)                      */
+#define IOSLAVE_FIFOCFG_FIFOMAX_Msk       (0x3f00UL)                /*!< IOSLAVE FIFOCFG: FIFOMAX (Bitfield-Mask: 0x3f)        */
+#define IOSLAVE_FIFOCFG_FIFOBASE_Pos      (0UL)                     /*!< IOSLAVE FIFOCFG: FIFOBASE (Bit 0)                     */
+#define IOSLAVE_FIFOCFG_FIFOBASE_Msk      (0x1fUL)                  /*!< IOSLAVE FIFOCFG: FIFOBASE (Bitfield-Mask: 0x1f)       */
+/* ========================================================  FIFOTHR  ======================================================== */
+#define IOSLAVE_FIFOTHR_FIFOTHR_Pos       (0UL)                     /*!< IOSLAVE FIFOTHR: FIFOTHR (Bit 0)                      */
+#define IOSLAVE_FIFOTHR_FIFOTHR_Msk       (0xffUL)                  /*!< IOSLAVE FIFOTHR: FIFOTHR (Bitfield-Mask: 0xff)        */
+/* =========================================================  FUPD  ========================================================== */
+#define IOSLAVE_FUPD_IOREAD_Pos           (1UL)                     /*!< IOSLAVE FUPD: IOREAD (Bit 1)                          */
+#define IOSLAVE_FUPD_IOREAD_Msk           (0x2UL)                   /*!< IOSLAVE FUPD: IOREAD (Bitfield-Mask: 0x01)            */
+#define IOSLAVE_FUPD_FIFOUPD_Pos          (0UL)                     /*!< IOSLAVE FUPD: FIFOUPD (Bit 0)                         */
+#define IOSLAVE_FUPD_FIFOUPD_Msk          (0x1UL)                   /*!< IOSLAVE FUPD: FIFOUPD (Bitfield-Mask: 0x01)           */
+/* ========================================================  FIFOCTR  ======================================================== */
+#define IOSLAVE_FIFOCTR_FIFOCTR_Pos       (0UL)                     /*!< IOSLAVE FIFOCTR: FIFOCTR (Bit 0)                      */
+#define IOSLAVE_FIFOCTR_FIFOCTR_Msk       (0x3ffUL)                 /*!< IOSLAVE FIFOCTR: FIFOCTR (Bitfield-Mask: 0x3ff)       */
+/* ========================================================  FIFOINC  ======================================================== */
+#define IOSLAVE_FIFOINC_FIFOINC_Pos       (0UL)                     /*!< IOSLAVE FIFOINC: FIFOINC (Bit 0)                      */
+#define IOSLAVE_FIFOINC_FIFOINC_Msk       (0x3ffUL)                 /*!< IOSLAVE FIFOINC: FIFOINC (Bitfield-Mask: 0x3ff)       */
+/* ==========================================================  CFG  ========================================================== */
+#define IOSLAVE_CFG_IFCEN_Pos             (31UL)                    /*!< IOSLAVE CFG: IFCEN (Bit 31)                           */
+#define IOSLAVE_CFG_IFCEN_Msk             (0x80000000UL)            /*!< IOSLAVE CFG: IFCEN (Bitfield-Mask: 0x01)              */
+#define IOSLAVE_CFG_I2CADDR_Pos           (8UL)                     /*!< IOSLAVE CFG: I2CADDR (Bit 8)                          */
+#define IOSLAVE_CFG_I2CADDR_Msk           (0xfff00UL)               /*!< IOSLAVE CFG: I2CADDR (Bitfield-Mask: 0xfff)           */
+#define IOSLAVE_CFG_STARTRD_Pos           (4UL)                     /*!< IOSLAVE CFG: STARTRD (Bit 4)                          */
+#define IOSLAVE_CFG_STARTRD_Msk           (0x10UL)                  /*!< IOSLAVE CFG: STARTRD (Bitfield-Mask: 0x01)            */
+#define IOSLAVE_CFG_LSB_Pos               (2UL)                     /*!< IOSLAVE CFG: LSB (Bit 2)                              */
+#define IOSLAVE_CFG_LSB_Msk               (0x4UL)                   /*!< IOSLAVE CFG: LSB (Bitfield-Mask: 0x01)                */
+#define IOSLAVE_CFG_SPOL_Pos              (1UL)                     /*!< IOSLAVE CFG: SPOL (Bit 1)                             */
+#define IOSLAVE_CFG_SPOL_Msk              (0x2UL)                   /*!< IOSLAVE CFG: SPOL (Bitfield-Mask: 0x01)               */
+#define IOSLAVE_CFG_IFCSEL_Pos            (0UL)                     /*!< IOSLAVE CFG: IFCSEL (Bit 0)                           */
+#define IOSLAVE_CFG_IFCSEL_Msk            (0x1UL)                   /*!< IOSLAVE CFG: IFCSEL (Bitfield-Mask: 0x01)             */
+/* =========================================================  PRENC  ========================================================= */
+#define IOSLAVE_PRENC_PRENC_Pos           (0UL)                     /*!< IOSLAVE PRENC: PRENC (Bit 0)                          */
+#define IOSLAVE_PRENC_PRENC_Msk           (0x1fUL)                  /*!< IOSLAVE PRENC: PRENC (Bitfield-Mask: 0x1f)            */
+/* =======================================================  IOINTCTL  ======================================================== */
+#define IOSLAVE_IOINTCTL_IOINTSET_Pos     (24UL)                    /*!< IOSLAVE IOINTCTL: IOINTSET (Bit 24)                   */
+#define IOSLAVE_IOINTCTL_IOINTSET_Msk     (0xff000000UL)            /*!< IOSLAVE IOINTCTL: IOINTSET (Bitfield-Mask: 0xff)      */
+#define IOSLAVE_IOINTCTL_IOINTCLR_Pos     (16UL)                    /*!< IOSLAVE IOINTCTL: IOINTCLR (Bit 16)                   */
+#define IOSLAVE_IOINTCTL_IOINTCLR_Msk     (0x10000UL)               /*!< IOSLAVE IOINTCTL: IOINTCLR (Bitfield-Mask: 0x01)      */
+#define IOSLAVE_IOINTCTL_IOINT_Pos        (8UL)                     /*!< IOSLAVE IOINTCTL: IOINT (Bit 8)                       */
+#define IOSLAVE_IOINTCTL_IOINT_Msk        (0xff00UL)                /*!< IOSLAVE IOINTCTL: IOINT (Bitfield-Mask: 0xff)         */
+#define IOSLAVE_IOINTCTL_IOINTEN_Pos      (0UL)                     /*!< IOSLAVE IOINTCTL: IOINTEN (Bit 0)                     */
+#define IOSLAVE_IOINTCTL_IOINTEN_Msk      (0xffUL)                  /*!< IOSLAVE IOINTCTL: IOINTEN (Bitfield-Mask: 0xff)       */
+/* ========================================================  GENADD  ========================================================= */
+#define IOSLAVE_GENADD_GADATA_Pos         (0UL)                     /*!< IOSLAVE GENADD: GADATA (Bit 0)                        */
+#define IOSLAVE_GENADD_GADATA_Msk         (0xffUL)                  /*!< IOSLAVE GENADD: GADATA (Bitfield-Mask: 0xff)          */
+/* =========================================================  INTEN  ========================================================= */
+#define IOSLAVE_INTEN_XCMPWR_Pos          (9UL)                     /*!< IOSLAVE INTEN: XCMPWR (Bit 9)                         */
+#define IOSLAVE_INTEN_XCMPWR_Msk          (0x200UL)                 /*!< IOSLAVE INTEN: XCMPWR (Bitfield-Mask: 0x01)           */
+#define IOSLAVE_INTEN_XCMPWF_Pos          (8UL)                     /*!< IOSLAVE INTEN: XCMPWF (Bit 8)                         */
+#define IOSLAVE_INTEN_XCMPWF_Msk          (0x100UL)                 /*!< IOSLAVE INTEN: XCMPWF (Bitfield-Mask: 0x01)           */
+#define IOSLAVE_INTEN_XCMPRR_Pos          (7UL)                     /*!< IOSLAVE INTEN: XCMPRR (Bit 7)                         */
+#define IOSLAVE_INTEN_XCMPRR_Msk          (0x80UL)                  /*!< IOSLAVE INTEN: XCMPRR (Bitfield-Mask: 0x01)           */
+#define IOSLAVE_INTEN_XCMPRF_Pos          (6UL)                     /*!< IOSLAVE INTEN: XCMPRF (Bit 6)                         */
+#define IOSLAVE_INTEN_XCMPRF_Msk          (0x40UL)                  /*!< IOSLAVE INTEN: XCMPRF (Bitfield-Mask: 0x01)           */
+#define IOSLAVE_INTEN_IOINTW_Pos          (5UL)                     /*!< IOSLAVE INTEN: IOINTW (Bit 5)                         */
+#define IOSLAVE_INTEN_IOINTW_Msk          (0x20UL)                  /*!< IOSLAVE INTEN: IOINTW (Bitfield-Mask: 0x01)           */
+#define IOSLAVE_INTEN_GENAD_Pos           (4UL)                     /*!< IOSLAVE INTEN: GENAD (Bit 4)                          */
+#define IOSLAVE_INTEN_GENAD_Msk           (0x10UL)                  /*!< IOSLAVE INTEN: GENAD (Bitfield-Mask: 0x01)            */
+#define IOSLAVE_INTEN_FRDERR_Pos          (3UL)                     /*!< IOSLAVE INTEN: FRDERR (Bit 3)                         */
+#define IOSLAVE_INTEN_FRDERR_Msk          (0x8UL)                   /*!< IOSLAVE INTEN: FRDERR (Bitfield-Mask: 0x01)           */
+#define IOSLAVE_INTEN_FUNDFL_Pos          (2UL)                     /*!< IOSLAVE INTEN: FUNDFL (Bit 2)                         */
+#define IOSLAVE_INTEN_FUNDFL_Msk          (0x4UL)                   /*!< IOSLAVE INTEN: FUNDFL (Bitfield-Mask: 0x01)           */
+#define IOSLAVE_INTEN_FOVFL_Pos           (1UL)                     /*!< IOSLAVE INTEN: FOVFL (Bit 1)                          */
+#define IOSLAVE_INTEN_FOVFL_Msk           (0x2UL)                   /*!< IOSLAVE INTEN: FOVFL (Bitfield-Mask: 0x01)            */
+#define IOSLAVE_INTEN_FSIZE_Pos           (0UL)                     /*!< IOSLAVE INTEN: FSIZE (Bit 0)                          */
+#define IOSLAVE_INTEN_FSIZE_Msk           (0x1UL)                   /*!< IOSLAVE INTEN: FSIZE (Bitfield-Mask: 0x01)            */
+/* ========================================================  INTSTAT  ======================================================== */
+#define IOSLAVE_INTSTAT_XCMPWR_Pos        (9UL)                     /*!< IOSLAVE INTSTAT: XCMPWR (Bit 9)                       */
+#define IOSLAVE_INTSTAT_XCMPWR_Msk        (0x200UL)                 /*!< IOSLAVE INTSTAT: XCMPWR (Bitfield-Mask: 0x01)         */
+#define IOSLAVE_INTSTAT_XCMPWF_Pos        (8UL)                     /*!< IOSLAVE INTSTAT: XCMPWF (Bit 8)                       */
+#define IOSLAVE_INTSTAT_XCMPWF_Msk        (0x100UL)                 /*!< IOSLAVE INTSTAT: XCMPWF (Bitfield-Mask: 0x01)         */
+#define IOSLAVE_INTSTAT_XCMPRR_Pos        (7UL)                     /*!< IOSLAVE INTSTAT: XCMPRR (Bit 7)                       */
+#define IOSLAVE_INTSTAT_XCMPRR_Msk        (0x80UL)                  /*!< IOSLAVE INTSTAT: XCMPRR (Bitfield-Mask: 0x01)         */
+#define IOSLAVE_INTSTAT_XCMPRF_Pos        (6UL)                     /*!< IOSLAVE INTSTAT: XCMPRF (Bit 6)                       */
+#define IOSLAVE_INTSTAT_XCMPRF_Msk        (0x40UL)                  /*!< IOSLAVE INTSTAT: XCMPRF (Bitfield-Mask: 0x01)         */
+#define IOSLAVE_INTSTAT_IOINTW_Pos        (5UL)                     /*!< IOSLAVE INTSTAT: IOINTW (Bit 5)                       */
+#define IOSLAVE_INTSTAT_IOINTW_Msk        (0x20UL)                  /*!< IOSLAVE INTSTAT: IOINTW (Bitfield-Mask: 0x01)         */
+#define IOSLAVE_INTSTAT_GENAD_Pos         (4UL)                     /*!< IOSLAVE INTSTAT: GENAD (Bit 4)                        */
+#define IOSLAVE_INTSTAT_GENAD_Msk         (0x10UL)                  /*!< IOSLAVE INTSTAT: GENAD (Bitfield-Mask: 0x01)          */
+#define IOSLAVE_INTSTAT_FRDERR_Pos        (3UL)                     /*!< IOSLAVE INTSTAT: FRDERR (Bit 3)                       */
+#define IOSLAVE_INTSTAT_FRDERR_Msk        (0x8UL)                   /*!< IOSLAVE INTSTAT: FRDERR (Bitfield-Mask: 0x01)         */
+#define IOSLAVE_INTSTAT_FUNDFL_Pos        (2UL)                     /*!< IOSLAVE INTSTAT: FUNDFL (Bit 2)                       */
+#define IOSLAVE_INTSTAT_FUNDFL_Msk        (0x4UL)                   /*!< IOSLAVE INTSTAT: FUNDFL (Bitfield-Mask: 0x01)         */
+#define IOSLAVE_INTSTAT_FOVFL_Pos         (1UL)                     /*!< IOSLAVE INTSTAT: FOVFL (Bit 1)                        */
+#define IOSLAVE_INTSTAT_FOVFL_Msk         (0x2UL)                   /*!< IOSLAVE INTSTAT: FOVFL (Bitfield-Mask: 0x01)          */
+#define IOSLAVE_INTSTAT_FSIZE_Pos         (0UL)                     /*!< IOSLAVE INTSTAT: FSIZE (Bit 0)                        */
+#define IOSLAVE_INTSTAT_FSIZE_Msk         (0x1UL)                   /*!< IOSLAVE INTSTAT: FSIZE (Bitfield-Mask: 0x01)          */
+/* ========================================================  INTCLR  ========================================================= */
+#define IOSLAVE_INTCLR_XCMPWR_Pos         (9UL)                     /*!< IOSLAVE INTCLR: XCMPWR (Bit 9)                        */
+#define IOSLAVE_INTCLR_XCMPWR_Msk         (0x200UL)                 /*!< IOSLAVE INTCLR: XCMPWR (Bitfield-Mask: 0x01)          */
+#define IOSLAVE_INTCLR_XCMPWF_Pos         (8UL)                     /*!< IOSLAVE INTCLR: XCMPWF (Bit 8)                        */
+#define IOSLAVE_INTCLR_XCMPWF_Msk         (0x100UL)                 /*!< IOSLAVE INTCLR: XCMPWF (Bitfield-Mask: 0x01)          */
+#define IOSLAVE_INTCLR_XCMPRR_Pos         (7UL)                     /*!< IOSLAVE INTCLR: XCMPRR (Bit 7)                        */
+#define IOSLAVE_INTCLR_XCMPRR_Msk         (0x80UL)                  /*!< IOSLAVE INTCLR: XCMPRR (Bitfield-Mask: 0x01)          */
+#define IOSLAVE_INTCLR_XCMPRF_Pos         (6UL)                     /*!< IOSLAVE INTCLR: XCMPRF (Bit 6)                        */
+#define IOSLAVE_INTCLR_XCMPRF_Msk         (0x40UL)                  /*!< IOSLAVE INTCLR: XCMPRF (Bitfield-Mask: 0x01)          */
+#define IOSLAVE_INTCLR_IOINTW_Pos         (5UL)                     /*!< IOSLAVE INTCLR: IOINTW (Bit 5)                        */
+#define IOSLAVE_INTCLR_IOINTW_Msk         (0x20UL)                  /*!< IOSLAVE INTCLR: IOINTW (Bitfield-Mask: 0x01)          */
+#define IOSLAVE_INTCLR_GENAD_Pos          (4UL)                     /*!< IOSLAVE INTCLR: GENAD (Bit 4)                         */
+#define IOSLAVE_INTCLR_GENAD_Msk          (0x10UL)                  /*!< IOSLAVE INTCLR: GENAD (Bitfield-Mask: 0x01)           */
+#define IOSLAVE_INTCLR_FRDERR_Pos         (3UL)                     /*!< IOSLAVE INTCLR: FRDERR (Bit 3)                        */
+#define IOSLAVE_INTCLR_FRDERR_Msk         (0x8UL)                   /*!< IOSLAVE INTCLR: FRDERR (Bitfield-Mask: 0x01)          */
+#define IOSLAVE_INTCLR_FUNDFL_Pos         (2UL)                     /*!< IOSLAVE INTCLR: FUNDFL (Bit 2)                        */
+#define IOSLAVE_INTCLR_FUNDFL_Msk         (0x4UL)                   /*!< IOSLAVE INTCLR: FUNDFL (Bitfield-Mask: 0x01)          */
+#define IOSLAVE_INTCLR_FOVFL_Pos          (1UL)                     /*!< IOSLAVE INTCLR: FOVFL (Bit 1)                         */
+#define IOSLAVE_INTCLR_FOVFL_Msk          (0x2UL)                   /*!< IOSLAVE INTCLR: FOVFL (Bitfield-Mask: 0x01)           */
+#define IOSLAVE_INTCLR_FSIZE_Pos          (0UL)                     /*!< IOSLAVE INTCLR: FSIZE (Bit 0)                         */
+#define IOSLAVE_INTCLR_FSIZE_Msk          (0x1UL)                   /*!< IOSLAVE INTCLR: FSIZE (Bitfield-Mask: 0x01)           */
+/* ========================================================  INTSET  ========================================================= */
+#define IOSLAVE_INTSET_XCMPWR_Pos         (9UL)                     /*!< IOSLAVE INTSET: XCMPWR (Bit 9)                        */
+#define IOSLAVE_INTSET_XCMPWR_Msk         (0x200UL)                 /*!< IOSLAVE INTSET: XCMPWR (Bitfield-Mask: 0x01)          */
+#define IOSLAVE_INTSET_XCMPWF_Pos         (8UL)                     /*!< IOSLAVE INTSET: XCMPWF (Bit 8)                        */
+#define IOSLAVE_INTSET_XCMPWF_Msk         (0x100UL)                 /*!< IOSLAVE INTSET: XCMPWF (Bitfield-Mask: 0x01)          */
+#define IOSLAVE_INTSET_XCMPRR_Pos         (7UL)                     /*!< IOSLAVE INTSET: XCMPRR (Bit 7)                        */
+#define IOSLAVE_INTSET_XCMPRR_Msk         (0x80UL)                  /*!< IOSLAVE INTSET: XCMPRR (Bitfield-Mask: 0x01)          */
+#define IOSLAVE_INTSET_XCMPRF_Pos         (6UL)                     /*!< IOSLAVE INTSET: XCMPRF (Bit 6)                        */
+#define IOSLAVE_INTSET_XCMPRF_Msk         (0x40UL)                  /*!< IOSLAVE INTSET: XCMPRF (Bitfield-Mask: 0x01)          */
+#define IOSLAVE_INTSET_IOINTW_Pos         (5UL)                     /*!< IOSLAVE INTSET: IOINTW (Bit 5)                        */
+#define IOSLAVE_INTSET_IOINTW_Msk         (0x20UL)                  /*!< IOSLAVE INTSET: IOINTW (Bitfield-Mask: 0x01)          */
+#define IOSLAVE_INTSET_GENAD_Pos          (4UL)                     /*!< IOSLAVE INTSET: GENAD (Bit 4)                         */
+#define IOSLAVE_INTSET_GENAD_Msk          (0x10UL)                  /*!< IOSLAVE INTSET: GENAD (Bitfield-Mask: 0x01)           */
+#define IOSLAVE_INTSET_FRDERR_Pos         (3UL)                     /*!< IOSLAVE INTSET: FRDERR (Bit 3)                        */
+#define IOSLAVE_INTSET_FRDERR_Msk         (0x8UL)                   /*!< IOSLAVE INTSET: FRDERR (Bitfield-Mask: 0x01)          */
+#define IOSLAVE_INTSET_FUNDFL_Pos         (2UL)                     /*!< IOSLAVE INTSET: FUNDFL (Bit 2)                        */
+#define IOSLAVE_INTSET_FUNDFL_Msk         (0x4UL)                   /*!< IOSLAVE INTSET: FUNDFL (Bitfield-Mask: 0x01)          */
+#define IOSLAVE_INTSET_FOVFL_Pos          (1UL)                     /*!< IOSLAVE INTSET: FOVFL (Bit 1)                         */
+#define IOSLAVE_INTSET_FOVFL_Msk          (0x2UL)                   /*!< IOSLAVE INTSET: FOVFL (Bitfield-Mask: 0x01)           */
+#define IOSLAVE_INTSET_FSIZE_Pos          (0UL)                     /*!< IOSLAVE INTSET: FSIZE (Bit 0)                         */
+#define IOSLAVE_INTSET_FSIZE_Msk          (0x1UL)                   /*!< IOSLAVE INTSET: FSIZE (Bitfield-Mask: 0x01)           */
+/* ======================================================  REGACCINTEN  ====================================================== */
+#define IOSLAVE_REGACCINTEN_REGACC_Pos    (0UL)                     /*!< IOSLAVE REGACCINTEN: REGACC (Bit 0)                   */
+#define IOSLAVE_REGACCINTEN_REGACC_Msk    (0xffffffffUL)            /*!< IOSLAVE REGACCINTEN: REGACC (Bitfield-Mask: 0xffffffff) */
+/* =====================================================  REGACCINTSTAT  ===================================================== */
+#define IOSLAVE_REGACCINTSTAT_REGACC_Pos  (0UL)                     /*!< IOSLAVE REGACCINTSTAT: REGACC (Bit 0)                 */
+#define IOSLAVE_REGACCINTSTAT_REGACC_Msk  (0xffffffffUL)            /*!< IOSLAVE REGACCINTSTAT: REGACC (Bitfield-Mask: 0xffffffff) */
+/* =====================================================  REGACCINTCLR  ====================================================== */
+#define IOSLAVE_REGACCINTCLR_REGACC_Pos   (0UL)                     /*!< IOSLAVE REGACCINTCLR: REGACC (Bit 0)                  */
+#define IOSLAVE_REGACCINTCLR_REGACC_Msk   (0xffffffffUL)            /*!< IOSLAVE REGACCINTCLR: REGACC (Bitfield-Mask: 0xffffffff) */
+/* =====================================================  REGACCINTSET  ====================================================== */
+#define IOSLAVE_REGACCINTSET_REGACC_Pos   (0UL)                     /*!< IOSLAVE REGACCINTSET: REGACC (Bit 0)                  */
+#define IOSLAVE_REGACCINTSET_REGACC_Msk   (0xffffffffUL)            /*!< IOSLAVE REGACCINTSET: REGACC (Bitfield-Mask: 0xffffffff) */
+
+
+/* =========================================================================================================================== */
+/* ================                                          MCUCTRL                                          ================ */
+/* =========================================================================================================================== */
+
+/* =======================================================  CHIP_INFO  ======================================================= */
+#define MCUCTRL_CHIP_INFO_PARTNUM_Pos     (0UL)                     /*!< MCUCTRL CHIP_INFO: PARTNUM (Bit 0)                    */
+#define MCUCTRL_CHIP_INFO_PARTNUM_Msk     (0xffffffffUL)            /*!< MCUCTRL CHIP_INFO: PARTNUM (Bitfield-Mask: 0xffffffff) */
+/* ========================================================  CHIPID0  ======================================================== */
+#define MCUCTRL_CHIPID0_VALUE_Pos         (0UL)                     /*!< MCUCTRL CHIPID0: VALUE (Bit 0)                        */
+#define MCUCTRL_CHIPID0_VALUE_Msk         (0xffffffffUL)            /*!< MCUCTRL CHIPID0: VALUE (Bitfield-Mask: 0xffffffff)    */
+/* ========================================================  CHIPID1  ======================================================== */
+#define MCUCTRL_CHIPID1_VALUE_Pos         (0UL)                     /*!< MCUCTRL CHIPID1: VALUE (Bit 0)                        */
+#define MCUCTRL_CHIPID1_VALUE_Msk         (0xffffffffUL)            /*!< MCUCTRL CHIPID1: VALUE (Bitfield-Mask: 0xffffffff)    */
+/* ========================================================  CHIPREV  ======================================================== */
+#define MCUCTRL_CHIPREV_REVMAJ_Pos        (4UL)                     /*!< MCUCTRL CHIPREV: REVMAJ (Bit 4)                       */
+#define MCUCTRL_CHIPREV_REVMAJ_Msk        (0xf0UL)                  /*!< MCUCTRL CHIPREV: REVMAJ (Bitfield-Mask: 0x0f)         */
+#define MCUCTRL_CHIPREV_REVMIN_Pos        (0UL)                     /*!< MCUCTRL CHIPREV: REVMIN (Bit 0)                       */
+#define MCUCTRL_CHIPREV_REVMIN_Msk        (0xfUL)                   /*!< MCUCTRL CHIPREV: REVMIN (Bitfield-Mask: 0x0f)         */
+/* =======================================================  VENDORID  ======================================================== */
+#define MCUCTRL_VENDORID_VALUE_Pos        (0UL)                     /*!< MCUCTRL VENDORID: VALUE (Bit 0)                       */
+#define MCUCTRL_VENDORID_VALUE_Msk        (0xffffffffUL)            /*!< MCUCTRL VENDORID: VALUE (Bitfield-Mask: 0xffffffff)   */
+/* =======================================================  DEBUGGER  ======================================================== */
+#define MCUCTRL_DEBUGGER_LOCKOUT_Pos      (0UL)                     /*!< MCUCTRL DEBUGGER: LOCKOUT (Bit 0)                     */
+#define MCUCTRL_DEBUGGER_LOCKOUT_Msk      (0x1UL)                   /*!< MCUCTRL DEBUGGER: LOCKOUT (Bitfield-Mask: 0x01)       */
+/* =========================================================  BUCK  ========================================================== */
+#define MCUCTRL_BUCK_MEMBUCKRST_Pos       (7UL)                     /*!< MCUCTRL BUCK: MEMBUCKRST (Bit 7)                      */
+#define MCUCTRL_BUCK_MEMBUCKRST_Msk       (0x80UL)                  /*!< MCUCTRL BUCK: MEMBUCKRST (Bitfield-Mask: 0x01)        */
+#define MCUCTRL_BUCK_COREBUCKRST_Pos      (6UL)                     /*!< MCUCTRL BUCK: COREBUCKRST (Bit 6)                     */
+#define MCUCTRL_BUCK_COREBUCKRST_Msk      (0x40UL)                  /*!< MCUCTRL BUCK: COREBUCKRST (Bitfield-Mask: 0x01)       */
+#define MCUCTRL_BUCK_BYPBUCKMEM_Pos       (5UL)                     /*!< MCUCTRL BUCK: BYPBUCKMEM (Bit 5)                      */
+#define MCUCTRL_BUCK_BYPBUCKMEM_Msk       (0x20UL)                  /*!< MCUCTRL BUCK: BYPBUCKMEM (Bitfield-Mask: 0x01)        */
+#define MCUCTRL_BUCK_MEMBUCKPWD_Pos       (4UL)                     /*!< MCUCTRL BUCK: MEMBUCKPWD (Bit 4)                      */
+#define MCUCTRL_BUCK_MEMBUCKPWD_Msk       (0x10UL)                  /*!< MCUCTRL BUCK: MEMBUCKPWD (Bitfield-Mask: 0x01)        */
+#define MCUCTRL_BUCK_SLEEPBUCKANA_Pos     (3UL)                     /*!< MCUCTRL BUCK: SLEEPBUCKANA (Bit 3)                    */
+#define MCUCTRL_BUCK_SLEEPBUCKANA_Msk     (0x8UL)                   /*!< MCUCTRL BUCK: SLEEPBUCKANA (Bitfield-Mask: 0x01)      */
+#define MCUCTRL_BUCK_COREBUCKPWD_Pos      (2UL)                     /*!< MCUCTRL BUCK: COREBUCKPWD (Bit 2)                     */
+#define MCUCTRL_BUCK_COREBUCKPWD_Msk      (0x4UL)                   /*!< MCUCTRL BUCK: COREBUCKPWD (Bitfield-Mask: 0x01)       */
+#define MCUCTRL_BUCK_BYPBUCKCORE_Pos      (1UL)                     /*!< MCUCTRL BUCK: BYPBUCKCORE (Bit 1)                     */
+#define MCUCTRL_BUCK_BYPBUCKCORE_Msk      (0x2UL)                   /*!< MCUCTRL BUCK: BYPBUCKCORE (Bitfield-Mask: 0x01)       */
+#define MCUCTRL_BUCK_BUCKSWE_Pos          (0UL)                     /*!< MCUCTRL BUCK: BUCKSWE (Bit 0)                         */
+#define MCUCTRL_BUCK_BUCKSWE_Msk          (0x1UL)                   /*!< MCUCTRL BUCK: BUCKSWE (Bitfield-Mask: 0x01)           */
+/* =========================================================  BUCK2  ========================================================= */
+#define MCUCTRL_BUCK2_BUCKLFCLKSEL_Pos    (10UL)                    /*!< MCUCTRL BUCK2: BUCKLFCLKSEL (Bit 10)                  */
+#define MCUCTRL_BUCK2_BUCKLFCLKSEL_Msk    (0xc00UL)                 /*!< MCUCTRL BUCK2: BUCKLFCLKSEL (Bitfield-Mask: 0x03)     */
+#define MCUCTRL_BUCK2_HYSTBUCKCORE_Pos    (9UL)                     /*!< MCUCTRL BUCK2: HYSTBUCKCORE (Bit 9)                   */
+#define MCUCTRL_BUCK2_HYSTBUCKCORE_Msk    (0x200UL)                 /*!< MCUCTRL BUCK2: HYSTBUCKCORE (Bitfield-Mask: 0x01)     */
+#define MCUCTRL_BUCK2_HYSTBUCKMEM_Pos     (8UL)                     /*!< MCUCTRL BUCK2: HYSTBUCKMEM (Bit 8)                    */
+#define MCUCTRL_BUCK2_HYSTBUCKMEM_Msk     (0x100UL)                 /*!< MCUCTRL BUCK2: HYSTBUCKMEM (Bitfield-Mask: 0x01)      */
+#define MCUCTRL_BUCK2_BMEMTONSEL_Pos      (4UL)                     /*!< MCUCTRL BUCK2: BMEMTONSEL (Bit 4)                     */
+#define MCUCTRL_BUCK2_BMEMTONSEL_Msk      (0xf0UL)                  /*!< MCUCTRL BUCK2: BMEMTONSEL (Bitfield-Mask: 0x0f)       */
+#define MCUCTRL_BUCK2_BCORETONSEL_Pos     (0UL)                     /*!< MCUCTRL BUCK2: BCORETONSEL (Bit 0)                    */
+#define MCUCTRL_BUCK2_BCORETONSEL_Msk     (0xfUL)                   /*!< MCUCTRL BUCK2: BCORETONSEL (Bitfield-Mask: 0x0f)      */
+/* =========================================================  BUCK3  ========================================================= */
+#define MCUCTRL_BUCK3_MEMBUCKLOTON_Pos    (18UL)                    /*!< MCUCTRL BUCK3: MEMBUCKLOTON (Bit 18)                  */
+#define MCUCTRL_BUCK3_MEMBUCKLOTON_Msk    (0x3c0000UL)              /*!< MCUCTRL BUCK3: MEMBUCKLOTON (Bitfield-Mask: 0x0f)     */
+#define MCUCTRL_BUCK3_MEMBUCKBURSTEN_Pos  (17UL)                    /*!< MCUCTRL BUCK3: MEMBUCKBURSTEN (Bit 17)                */
+#define MCUCTRL_BUCK3_MEMBUCKBURSTEN_Msk  (0x20000UL)               /*!< MCUCTRL BUCK3: MEMBUCKBURSTEN (Bitfield-Mask: 0x01)   */
+#define MCUCTRL_BUCK3_MEMBUCKZXTRIM_Pos   (13UL)                    /*!< MCUCTRL BUCK3: MEMBUCKZXTRIM (Bit 13)                 */
+#define MCUCTRL_BUCK3_MEMBUCKZXTRIM_Msk   (0x1e000UL)               /*!< MCUCTRL BUCK3: MEMBUCKZXTRIM (Bitfield-Mask: 0x0f)    */
+#define MCUCTRL_BUCK3_MEMBUCKHYSTTRIM_Pos (11UL)                    /*!< MCUCTRL BUCK3: MEMBUCKHYSTTRIM (Bit 11)               */
+#define MCUCTRL_BUCK3_MEMBUCKHYSTTRIM_Msk (0x1800UL)                /*!< MCUCTRL BUCK3: MEMBUCKHYSTTRIM (Bitfield-Mask: 0x03)  */
+#define MCUCTRL_BUCK3_COREBUCKLOTON_Pos   (7UL)                     /*!< MCUCTRL BUCK3: COREBUCKLOTON (Bit 7)                  */
+#define MCUCTRL_BUCK3_COREBUCKLOTON_Msk   (0x780UL)                 /*!< MCUCTRL BUCK3: COREBUCKLOTON (Bitfield-Mask: 0x0f)    */
+#define MCUCTRL_BUCK3_COREBUCKBURSTEN_Pos (6UL)                     /*!< MCUCTRL BUCK3: COREBUCKBURSTEN (Bit 6)                */
+#define MCUCTRL_BUCK3_COREBUCKBURSTEN_Msk (0x40UL)                  /*!< MCUCTRL BUCK3: COREBUCKBURSTEN (Bitfield-Mask: 0x01)  */
+#define MCUCTRL_BUCK3_COREBUCKZXTRIM_Pos  (2UL)                     /*!< MCUCTRL BUCK3: COREBUCKZXTRIM (Bit 2)                 */
+#define MCUCTRL_BUCK3_COREBUCKZXTRIM_Msk  (0x3cUL)                  /*!< MCUCTRL BUCK3: COREBUCKZXTRIM (Bitfield-Mask: 0x0f)   */
+#define MCUCTRL_BUCK3_COREBUCKHYSTTRIM_Pos (0UL)                    /*!< MCUCTRL BUCK3: COREBUCKHYSTTRIM (Bit 0)               */
+#define MCUCTRL_BUCK3_COREBUCKHYSTTRIM_Msk (0x3UL)                  /*!< MCUCTRL BUCK3: COREBUCKHYSTTRIM (Bitfield-Mask: 0x03) */
+/* ========================================================  LDOREG1  ======================================================== */
+#define MCUCTRL_LDOREG1_CORELDOIBSTRM_Pos (20UL)                    /*!< MCUCTRL LDOREG1: CORELDOIBSTRM (Bit 20)               */
+#define MCUCTRL_LDOREG1_CORELDOIBSTRM_Msk (0x100000UL)              /*!< MCUCTRL LDOREG1: CORELDOIBSTRM (Bitfield-Mask: 0x01)  */
+#define MCUCTRL_LDOREG1_CORELDOLPTRIM_Pos (14UL)                    /*!< MCUCTRL LDOREG1: CORELDOLPTRIM (Bit 14)               */
+#define MCUCTRL_LDOREG1_CORELDOLPTRIM_Msk (0xfc000UL)               /*!< MCUCTRL LDOREG1: CORELDOLPTRIM (Bitfield-Mask: 0x3f)  */
+#define MCUCTRL_LDOREG1_TRIMCORELDOR3_Pos (10UL)                    /*!< MCUCTRL LDOREG1: TRIMCORELDOR3 (Bit 10)               */
+#define MCUCTRL_LDOREG1_TRIMCORELDOR3_Msk (0x3c00UL)                /*!< MCUCTRL LDOREG1: TRIMCORELDOR3 (Bitfield-Mask: 0x0f)  */
+#define MCUCTRL_LDOREG1_TRIMCORELDOR1_Pos (0UL)                     /*!< MCUCTRL LDOREG1: TRIMCORELDOR1 (Bit 0)                */
+#define MCUCTRL_LDOREG1_TRIMCORELDOR1_Msk (0x3ffUL)                 /*!< MCUCTRL LDOREG1: TRIMCORELDOR1 (Bitfield-Mask: 0x3ff) */
+/* ========================================================  LDOREG2  ======================================================== */
+#define MCUCTRL_LDOREG2_CORELDOVDDLEN_Pos (22UL)                    /*!< MCUCTRL LDOREG2: CORELDOVDDLEN (Bit 22)               */
+#define MCUCTRL_LDOREG2_CORELDOVDDLEN_Msk (0x400000UL)              /*!< MCUCTRL LDOREG2: CORELDOVDDLEN (Bitfield-Mask: 0x01)  */
+#define MCUCTRL_LDOREG2_RAMLDOLPMODE_Pos  (21UL)                    /*!< MCUCTRL LDOREG2: RAMLDOLPMODE (Bit 21)                */
+#define MCUCTRL_LDOREG2_RAMLDOLPMODE_Msk  (0x200000UL)              /*!< MCUCTRL LDOREG2: RAMLDOLPMODE (Bitfield-Mask: 0x01)   */
+#define MCUCTRL_LDOREG2_PWDRAMLDO_Pos     (20UL)                    /*!< MCUCTRL LDOREG2: PWDRAMLDO (Bit 20)                   */
+#define MCUCTRL_LDOREG2_PWDRAMLDO_Msk     (0x100000UL)              /*!< MCUCTRL LDOREG2: PWDRAMLDO (Bitfield-Mask: 0x01)      */
+#define MCUCTRL_LDOREG2_PWDANALDO_Pos     (19UL)                    /*!< MCUCTRL LDOREG2: PWDANALDO (Bit 19)                   */
+#define MCUCTRL_LDOREG2_PWDANALDO_Msk     (0x80000UL)               /*!< MCUCTRL LDOREG2: PWDANALDO (Bitfield-Mask: 0x01)      */
+#define MCUCTRL_LDOREG2_PWDMEMLDO_Pos     (18UL)                    /*!< MCUCTRL LDOREG2: PWDMEMLDO (Bit 18)                   */
+#define MCUCTRL_LDOREG2_PWDMEMLDO_Msk     (0x40000UL)               /*!< MCUCTRL LDOREG2: PWDMEMLDO (Bitfield-Mask: 0x01)      */
+#define MCUCTRL_LDOREG2_PWDCORELDO_Pos    (17UL)                    /*!< MCUCTRL LDOREG2: PWDCORELDO (Bit 17)                  */
+#define MCUCTRL_LDOREG2_PWDCORELDO_Msk    (0x20000UL)               /*!< MCUCTRL LDOREG2: PWDCORELDO (Bitfield-Mask: 0x01)     */
+#define MCUCTRL_LDOREG2_SLEEPANALDO_Pos   (16UL)                    /*!< MCUCTRL LDOREG2: SLEEPANALDO (Bit 16)                 */
+#define MCUCTRL_LDOREG2_SLEEPANALDO_Msk   (0x10000UL)               /*!< MCUCTRL LDOREG2: SLEEPANALDO (Bitfield-Mask: 0x01)    */
+#define MCUCTRL_LDOREG2_SLEEPMEMLDO_Pos   (15UL)                    /*!< MCUCTRL LDOREG2: SLEEPMEMLDO (Bit 15)                 */
+#define MCUCTRL_LDOREG2_SLEEPMEMLDO_Msk   (0x8000UL)                /*!< MCUCTRL LDOREG2: SLEEPMEMLDO (Bitfield-Mask: 0x01)    */
+#define MCUCTRL_LDOREG2_SLEEPCORELDO_Pos  (14UL)                    /*!< MCUCTRL LDOREG2: SLEEPCORELDO (Bit 14)                */
+#define MCUCTRL_LDOREG2_SLEEPCORELDO_Msk  (0x4000UL)                /*!< MCUCTRL LDOREG2: SLEEPCORELDO (Bitfield-Mask: 0x01)   */
+#define MCUCTRL_LDOREG2_VREFSELANALDO_Pos (13UL)                    /*!< MCUCTRL LDOREG2: VREFSELANALDO (Bit 13)               */
+#define MCUCTRL_LDOREG2_VREFSELANALDO_Msk (0x2000UL)                /*!< MCUCTRL LDOREG2: VREFSELANALDO (Bitfield-Mask: 0x01)  */
+#define MCUCTRL_LDOREG2_VREFSELSRAMLDO_Pos (12UL)                   /*!< MCUCTRL LDOREG2: VREFSELSRAMLDO (Bit 12)              */
+#define MCUCTRL_LDOREG2_VREFSELSRAMLDO_Msk (0x1000UL)               /*!< MCUCTRL LDOREG2: VREFSELSRAMLDO (Bitfield-Mask: 0x01) */
+#define MCUCTRL_LDOREG2_VREFSELFLASHLDO_Pos (11UL)                  /*!< MCUCTRL LDOREG2: VREFSELFLASHLDO (Bit 11)             */
+#define MCUCTRL_LDOREG2_VREFSELFLASHLDO_Msk (0x800UL)               /*!< MCUCTRL LDOREG2: VREFSELFLASHLDO (Bitfield-Mask: 0x01) */
+#define MCUCTRL_LDOREG2_VREFSELCORELDO_Pos (10UL)                   /*!< MCUCTRL LDOREG2: VREFSELCORELDO (Bit 10)              */
+#define MCUCTRL_LDOREG2_VREFSELCORELDO_Msk (0x400UL)                /*!< MCUCTRL LDOREG2: VREFSELCORELDO (Bitfield-Mask: 0x01) */
+#define MCUCTRL_LDOREG2_TRIMANALDO_Pos    (6UL)                     /*!< MCUCTRL LDOREG2: TRIMANALDO (Bit 6)                   */
+#define MCUCTRL_LDOREG2_TRIMANALDO_Msk    (0x3c0UL)                 /*!< MCUCTRL LDOREG2: TRIMANALDO (Bitfield-Mask: 0x0f)     */
+#define MCUCTRL_LDOREG2_RAMLDOTRIM_Pos    (1UL)                     /*!< MCUCTRL LDOREG2: RAMLDOTRIM (Bit 1)                   */
+#define MCUCTRL_LDOREG2_RAMLDOTRIM_Msk    (0x3eUL)                  /*!< MCUCTRL LDOREG2: RAMLDOTRIM (Bitfield-Mask: 0x1f)     */
+#define MCUCTRL_LDOREG2_LDO2SWE_Pos       (0UL)                     /*!< MCUCTRL LDOREG2: LDO2SWE (Bit 0)                      */
+#define MCUCTRL_LDOREG2_LDO2SWE_Msk       (0x1UL)                   /*!< MCUCTRL LDOREG2: LDO2SWE (Bitfield-Mask: 0x01)        */
+/* ========================================================  LDOREG3  ======================================================== */
+#define MCUCTRL_LDOREG3_TRIMMEMLDOR1_Pos  (12UL)                    /*!< MCUCTRL LDOREG3: TRIMMEMLDOR1 (Bit 12)                */
+#define MCUCTRL_LDOREG3_TRIMMEMLDOR1_Msk  (0x3f000UL)               /*!< MCUCTRL LDOREG3: TRIMMEMLDOR1 (Bitfield-Mask: 0x3f)   */
+#define MCUCTRL_LDOREG3_MEMLDOLPALTTRIM_Pos (6UL)                   /*!< MCUCTRL LDOREG3: MEMLDOLPALTTRIM (Bit 6)              */
+#define MCUCTRL_LDOREG3_MEMLDOLPALTTRIM_Msk (0xfc0UL)               /*!< MCUCTRL LDOREG3: MEMLDOLPALTTRIM (Bitfield-Mask: 0x3f) */
+#define MCUCTRL_LDOREG3_MEMLDOLPTRIM_Pos  (0UL)                     /*!< MCUCTRL LDOREG3: MEMLDOLPTRIM (Bit 0)                 */
+#define MCUCTRL_LDOREG3_MEMLDOLPTRIM_Msk  (0x3fUL)                  /*!< MCUCTRL LDOREG3: MEMLDOLPTRIM (Bitfield-Mask: 0x3f)   */
+/* ======================================================  BODPORCTRL  ======================================================= */
+#define MCUCTRL_BODPORCTRL_BODEXTREFSEL_Pos (3UL)                   /*!< MCUCTRL BODPORCTRL: BODEXTREFSEL (Bit 3)              */
+#define MCUCTRL_BODPORCTRL_BODEXTREFSEL_Msk (0x8UL)                 /*!< MCUCTRL BODPORCTRL: BODEXTREFSEL (Bitfield-Mask: 0x01) */
+#define MCUCTRL_BODPORCTRL_PDREXTREFSEL_Pos (2UL)                   /*!< MCUCTRL BODPORCTRL: PDREXTREFSEL (Bit 2)              */
+#define MCUCTRL_BODPORCTRL_PDREXTREFSEL_Msk (0x4UL)                 /*!< MCUCTRL BODPORCTRL: PDREXTREFSEL (Bitfield-Mask: 0x01) */
+#define MCUCTRL_BODPORCTRL_PWDBOD_Pos     (1UL)                     /*!< MCUCTRL BODPORCTRL: PWDBOD (Bit 1)                    */
+#define MCUCTRL_BODPORCTRL_PWDBOD_Msk     (0x2UL)                   /*!< MCUCTRL BODPORCTRL: PWDBOD (Bitfield-Mask: 0x01)      */
+#define MCUCTRL_BODPORCTRL_PWDPDR_Pos     (0UL)                     /*!< MCUCTRL BODPORCTRL: PWDPDR (Bit 0)                    */
+#define MCUCTRL_BODPORCTRL_PWDPDR_Msk     (0x1UL)                   /*!< MCUCTRL BODPORCTRL: PWDPDR (Bitfield-Mask: 0x01)      */
+/* =======================================================  ADCPWRDLY  ======================================================= */
+#define MCUCTRL_ADCPWRDLY_ADCPWR1_Pos     (8UL)                     /*!< MCUCTRL ADCPWRDLY: ADCPWR1 (Bit 8)                    */
+#define MCUCTRL_ADCPWRDLY_ADCPWR1_Msk     (0xff00UL)                /*!< MCUCTRL ADCPWRDLY: ADCPWR1 (Bitfield-Mask: 0xff)      */
+#define MCUCTRL_ADCPWRDLY_ADCPWR0_Pos     (0UL)                     /*!< MCUCTRL ADCPWRDLY: ADCPWR0 (Bit 0)                    */
+#define MCUCTRL_ADCPWRDLY_ADCPWR0_Msk     (0xffUL)                  /*!< MCUCTRL ADCPWRDLY: ADCPWR0 (Bitfield-Mask: 0xff)      */
+/* ========================================================  ADCCAL  ========================================================= */
+#define MCUCTRL_ADCCAL_ADCCALIBRATED_Pos  (1UL)                     /*!< MCUCTRL ADCCAL: ADCCALIBRATED (Bit 1)                 */
+#define MCUCTRL_ADCCAL_ADCCALIBRATED_Msk  (0x2UL)                   /*!< MCUCTRL ADCCAL: ADCCALIBRATED (Bitfield-Mask: 0x01)   */
+#define MCUCTRL_ADCCAL_CALONPWRUP_Pos     (0UL)                     /*!< MCUCTRL ADCCAL: CALONPWRUP (Bit 0)                    */
+#define MCUCTRL_ADCCAL_CALONPWRUP_Msk     (0x1UL)                   /*!< MCUCTRL ADCCAL: CALONPWRUP (Bitfield-Mask: 0x01)      */
+/* ======================================================  ADCBATTLOAD  ====================================================== */
+#define MCUCTRL_ADCBATTLOAD_BATTLOAD_Pos  (0UL)                     /*!< MCUCTRL ADCBATTLOAD: BATTLOAD (Bit 0)                 */
+#define MCUCTRL_ADCBATTLOAD_BATTLOAD_Msk  (0x1UL)                   /*!< MCUCTRL ADCBATTLOAD: BATTLOAD (Bitfield-Mask: 0x01)   */
+/* =======================================================  BUCKTRIM  ======================================================== */
+#define MCUCTRL_BUCKTRIM_RSVD2_Pos        (24UL)                    /*!< MCUCTRL BUCKTRIM: RSVD2 (Bit 24)                      */
+#define MCUCTRL_BUCKTRIM_RSVD2_Msk        (0x3f000000UL)            /*!< MCUCTRL BUCKTRIM: RSVD2 (Bitfield-Mask: 0x3f)         */
+#define MCUCTRL_BUCKTRIM_COREBUCKR1_HI_Pos (16UL)                   /*!< MCUCTRL BUCKTRIM: COREBUCKR1_HI (Bit 16)              */
+#define MCUCTRL_BUCKTRIM_COREBUCKR1_HI_Msk (0xf0000UL)              /*!< MCUCTRL BUCKTRIM: COREBUCKR1_HI (Bitfield-Mask: 0x0f) */
+#define MCUCTRL_BUCKTRIM_COREBUCKR1_LO_Pos (8UL)                    /*!< MCUCTRL BUCKTRIM: COREBUCKR1_LO (Bit 8)               */
+#define MCUCTRL_BUCKTRIM_COREBUCKR1_LO_Msk (0x3f00UL)               /*!< MCUCTRL BUCKTRIM: COREBUCKR1_LO (Bitfield-Mask: 0x3f) */
+#define MCUCTRL_BUCKTRIM_MEMBUCKR1_Pos    (0UL)                     /*!< MCUCTRL BUCKTRIM: MEMBUCKR1 (Bit 0)                   */
+#define MCUCTRL_BUCKTRIM_MEMBUCKR1_Msk    (0x3fUL)                  /*!< MCUCTRL BUCKTRIM: MEMBUCKR1 (Bitfield-Mask: 0x3f)     */
+/* ========================================================  ADCTRIM  ======================================================== */
+#define MCUCTRL_ADCTRIM_ADCRFBUFIBTRIM_Pos (11UL)                   /*!< MCUCTRL ADCTRIM: ADCRFBUFIBTRIM (Bit 11)              */
+#define MCUCTRL_ADCTRIM_ADCRFBUFIBTRIM_Msk (0x1800UL)               /*!< MCUCTRL ADCTRIM: ADCRFBUFIBTRIM (Bitfield-Mask: 0x03) */
+#define MCUCTRL_ADCTRIM_ADCREFBUFTRIM_Pos (6UL)                     /*!< MCUCTRL ADCTRIM: ADCREFBUFTRIM (Bit 6)                */
+#define MCUCTRL_ADCTRIM_ADCREFBUFTRIM_Msk (0x7c0UL)                 /*!< MCUCTRL ADCTRIM: ADCREFBUFTRIM (Bitfield-Mask: 0x1f)  */
+#define MCUCTRL_ADCTRIM_ADCREFKEEPIBTRIM_Pos (0UL)                  /*!< MCUCTRL ADCTRIM: ADCREFKEEPIBTRIM (Bit 0)             */
+#define MCUCTRL_ADCTRIM_ADCREFKEEPIBTRIM_Msk (0x3UL)                /*!< MCUCTRL ADCTRIM: ADCREFKEEPIBTRIM (Bitfield-Mask: 0x03) */
+/* ======================================================  ADCREFCOMP  ======================================================= */
+#define MCUCTRL_ADCREFCOMP_ADCRFCMPEN_Pos (16UL)                    /*!< MCUCTRL ADCREFCOMP: ADCRFCMPEN (Bit 16)               */
+#define MCUCTRL_ADCREFCOMP_ADCRFCMPEN_Msk (0x10000UL)               /*!< MCUCTRL ADCREFCOMP: ADCRFCMPEN (Bitfield-Mask: 0x01)  */
+#define MCUCTRL_ADCREFCOMP_ADCREFKEEPTRIM_Pos (8UL)                 /*!< MCUCTRL ADCREFCOMP: ADCREFKEEPTRIM (Bit 8)            */
+#define MCUCTRL_ADCREFCOMP_ADCREFKEEPTRIM_Msk (0x1f00UL)            /*!< MCUCTRL ADCREFCOMP: ADCREFKEEPTRIM (Bitfield-Mask: 0x1f) */
+#define MCUCTRL_ADCREFCOMP_ADC_REFCOMP_OUT_Pos (0UL)                /*!< MCUCTRL ADCREFCOMP: ADC_REFCOMP_OUT (Bit 0)           */
+#define MCUCTRL_ADCREFCOMP_ADC_REFCOMP_OUT_Msk (0x1UL)              /*!< MCUCTRL ADCREFCOMP: ADC_REFCOMP_OUT (Bitfield-Mask: 0x01) */
+/* ======================================================  XTALGENCTRL  ====================================================== */
+#define MCUCTRL_XTALGENCTRL_XTALKSBIASTRIM_Pos (8UL)                /*!< MCUCTRL XTALGENCTRL: XTALKSBIASTRIM (Bit 8)           */
+#define MCUCTRL_XTALGENCTRL_XTALKSBIASTRIM_Msk (0x3f00UL)           /*!< MCUCTRL XTALGENCTRL: XTALKSBIASTRIM (Bitfield-Mask: 0x3f) */
+#define MCUCTRL_XTALGENCTRL_XTALBIASTRIM_Pos (2UL)                  /*!< MCUCTRL XTALGENCTRL: XTALBIASTRIM (Bit 2)             */
+#define MCUCTRL_XTALGENCTRL_XTALBIASTRIM_Msk (0xfcUL)               /*!< MCUCTRL XTALGENCTRL: XTALBIASTRIM (Bitfield-Mask: 0x3f) */
+#define MCUCTRL_XTALGENCTRL_ACWARMUP_Pos  (0UL)                     /*!< MCUCTRL XTALGENCTRL: ACWARMUP (Bit 0)                 */
+#define MCUCTRL_XTALGENCTRL_ACWARMUP_Msk  (0x3UL)                   /*!< MCUCTRL XTALGENCTRL: ACWARMUP (Bitfield-Mask: 0x03)   */
+/* =======================================================  EXTCLKSEL  ======================================================= */
+#define MCUCTRL_EXTCLKSEL_EXT_HF_Pos      (2UL)                     /*!< MCUCTRL EXTCLKSEL: EXT_HF (Bit 2)                     */
+#define MCUCTRL_EXTCLKSEL_EXT_HF_Msk      (0x4UL)                   /*!< MCUCTRL EXTCLKSEL: EXT_HF (Bitfield-Mask: 0x01)       */
+#define MCUCTRL_EXTCLKSEL_EXT_LF_Pos      (1UL)                     /*!< MCUCTRL EXTCLKSEL: EXT_LF (Bit 1)                     */
+#define MCUCTRL_EXTCLKSEL_EXT_LF_Msk      (0x2UL)                   /*!< MCUCTRL EXTCLKSEL: EXT_LF (Bitfield-Mask: 0x01)       */
+#define MCUCTRL_EXTCLKSEL_EXT_XT_Pos      (0UL)                     /*!< MCUCTRL EXTCLKSEL: EXT_XT (Bit 0)                     */
+#define MCUCTRL_EXTCLKSEL_EXT_XT_Msk      (0x1UL)                   /*!< MCUCTRL EXTCLKSEL: EXT_XT (Bitfield-Mask: 0x01)       */
+/* =====================================================  BOOTLOADERLOW  ===================================================== */
+#define MCUCTRL_BOOTLOADERLOW_VALUE_Pos   (0UL)                     /*!< MCUCTRL BOOTLOADERLOW: VALUE (Bit 0)                  */
+#define MCUCTRL_BOOTLOADERLOW_VALUE_Msk   (0x1UL)                   /*!< MCUCTRL BOOTLOADERLOW: VALUE (Bitfield-Mask: 0x01)    */
+/* ======================================================  SHADOWVALID  ====================================================== */
+#define MCUCTRL_SHADOWVALID_BL_DSLEEP_Pos (1UL)                     /*!< MCUCTRL SHADOWVALID: BL_DSLEEP (Bit 1)                */
+#define MCUCTRL_SHADOWVALID_BL_DSLEEP_Msk (0x2UL)                   /*!< MCUCTRL SHADOWVALID: BL_DSLEEP (Bitfield-Mask: 0x01)  */
+#define MCUCTRL_SHADOWVALID_VALID_Pos     (0UL)                     /*!< MCUCTRL SHADOWVALID: VALID (Bit 0)                    */
+#define MCUCTRL_SHADOWVALID_VALID_Msk     (0x1UL)                   /*!< MCUCTRL SHADOWVALID: VALID (Bitfield-Mask: 0x01)      */
+/* ====================================================  ICODEFAULTADDR  ===================================================== */
+#define MCUCTRL_ICODEFAULTADDR_ADDR_Pos   (0UL)                     /*!< MCUCTRL ICODEFAULTADDR: ADDR (Bit 0)                  */
+#define MCUCTRL_ICODEFAULTADDR_ADDR_Msk   (0xffffffffUL)            /*!< MCUCTRL ICODEFAULTADDR: ADDR (Bitfield-Mask: 0xffffffff) */
+/* ====================================================  DCODEFAULTADDR  ===================================================== */
+#define MCUCTRL_DCODEFAULTADDR_ADDR_Pos   (0UL)                     /*!< MCUCTRL DCODEFAULTADDR: ADDR (Bit 0)                  */
+#define MCUCTRL_DCODEFAULTADDR_ADDR_Msk   (0xffffffffUL)            /*!< MCUCTRL DCODEFAULTADDR: ADDR (Bitfield-Mask: 0xffffffff) */
+/* =====================================================  SYSFAULTADDR  ====================================================== */
+#define MCUCTRL_SYSFAULTADDR_ADDR_Pos     (0UL)                     /*!< MCUCTRL SYSFAULTADDR: ADDR (Bit 0)                    */
+#define MCUCTRL_SYSFAULTADDR_ADDR_Msk     (0xffffffffUL)            /*!< MCUCTRL SYSFAULTADDR: ADDR (Bitfield-Mask: 0xffffffff) */
+/* ======================================================  FAULTSTATUS  ====================================================== */
+#define MCUCTRL_FAULTSTATUS_SYS_Pos       (2UL)                     /*!< MCUCTRL FAULTSTATUS: SYS (Bit 2)                      */
+#define MCUCTRL_FAULTSTATUS_SYS_Msk       (0x4UL)                   /*!< MCUCTRL FAULTSTATUS: SYS (Bitfield-Mask: 0x01)        */
+#define MCUCTRL_FAULTSTATUS_DCODE_Pos     (1UL)                     /*!< MCUCTRL FAULTSTATUS: DCODE (Bit 1)                    */
+#define MCUCTRL_FAULTSTATUS_DCODE_Msk     (0x2UL)                   /*!< MCUCTRL FAULTSTATUS: DCODE (Bitfield-Mask: 0x01)      */
+#define MCUCTRL_FAULTSTATUS_ICODE_Pos     (0UL)                     /*!< MCUCTRL FAULTSTATUS: ICODE (Bit 0)                    */
+#define MCUCTRL_FAULTSTATUS_ICODE_Msk     (0x1UL)                   /*!< MCUCTRL FAULTSTATUS: ICODE (Bitfield-Mask: 0x01)      */
+/* ====================================================  FAULTCAPTUREEN  ===================================================== */
+#define MCUCTRL_FAULTCAPTUREEN_ENABLE_Pos (0UL)                     /*!< MCUCTRL FAULTCAPTUREEN: ENABLE (Bit 0)                */
+#define MCUCTRL_FAULTCAPTUREEN_ENABLE_Msk (0x1UL)                   /*!< MCUCTRL FAULTCAPTUREEN: ENABLE (Bitfield-Mask: 0x01)  */
+/* =========================================================  DBGR1  ========================================================= */
+#define MCUCTRL_DBGR1_ONETO8_Pos          (0UL)                     /*!< MCUCTRL DBGR1: ONETO8 (Bit 0)                         */
+#define MCUCTRL_DBGR1_ONETO8_Msk          (0xffffffffUL)            /*!< MCUCTRL DBGR1: ONETO8 (Bitfield-Mask: 0xffffffff)     */
+/* =========================================================  DBGR2  ========================================================= */
+#define MCUCTRL_DBGR2_COOLCODE_Pos        (0UL)                     /*!< MCUCTRL DBGR2: COOLCODE (Bit 0)                       */
+#define MCUCTRL_DBGR2_COOLCODE_Msk        (0xffffffffUL)            /*!< MCUCTRL DBGR2: COOLCODE (Bitfield-Mask: 0xffffffff)   */
+/* =======================================================  PMUENABLE  ======================================================= */
+#define MCUCTRL_PMUENABLE_ENABLE_Pos      (0UL)                     /*!< MCUCTRL PMUENABLE: ENABLE (Bit 0)                     */
+#define MCUCTRL_PMUENABLE_ENABLE_Msk      (0x1UL)                   /*!< MCUCTRL PMUENABLE: ENABLE (Bitfield-Mask: 0x01)       */
+/* =======================================================  TPIUCTRL  ======================================================== */
+#define MCUCTRL_TPIUCTRL_CLKSEL_Pos       (8UL)                     /*!< MCUCTRL TPIUCTRL: CLKSEL (Bit 8)                      */
+#define MCUCTRL_TPIUCTRL_CLKSEL_Msk       (0x700UL)                 /*!< MCUCTRL TPIUCTRL: CLKSEL (Bitfield-Mask: 0x07)        */
+#define MCUCTRL_TPIUCTRL_ENABLE_Pos       (0UL)                     /*!< MCUCTRL TPIUCTRL: ENABLE (Bit 0)                      */
+#define MCUCTRL_TPIUCTRL_ENABLE_Msk       (0x1UL)                   /*!< MCUCTRL TPIUCTRL: ENABLE (Bitfield-Mask: 0x01)        */
+/* ======================================================  KEXTCLKSEL  ======================================================= */
+#define MCUCTRL_KEXTCLKSEL_KEXTCLKSEL_Pos (0UL)                     /*!< MCUCTRL KEXTCLKSEL: KEXTCLKSEL (Bit 0)                */
+#define MCUCTRL_KEXTCLKSEL_KEXTCLKSEL_Msk (0xffffffffUL)            /*!< MCUCTRL KEXTCLKSEL: KEXTCLKSEL (Bitfield-Mask: 0xffffffff) */
+
+
+/* =========================================================================================================================== */
+/* ================                                            PDM                                            ================ */
+/* =========================================================================================================================== */
+
+/* =========================================================  PCFG  ========================================================== */
+#define PDM_PCFG_LRSWAP_Pos               (31UL)                    /*!< PDM PCFG: LRSWAP (Bit 31)                             */
+#define PDM_PCFG_LRSWAP_Msk               (0x80000000UL)            /*!< PDM PCFG: LRSWAP (Bitfield-Mask: 0x01)                */
+#define PDM_PCFG_PGARIGHT_Pos             (27UL)                    /*!< PDM PCFG: PGARIGHT (Bit 27)                           */
+#define PDM_PCFG_PGARIGHT_Msk             (0x78000000UL)            /*!< PDM PCFG: PGARIGHT (Bitfield-Mask: 0x0f)              */
+#define PDM_PCFG_PGALEFT_Pos              (23UL)                    /*!< PDM PCFG: PGALEFT (Bit 23)                            */
+#define PDM_PCFG_PGALEFT_Msk              (0x7800000UL)             /*!< PDM PCFG: PGALEFT (Bitfield-Mask: 0x0f)               */
+#define PDM_PCFG_MCLKDIV_Pos              (17UL)                    /*!< PDM PCFG: MCLKDIV (Bit 17)                            */
+#define PDM_PCFG_MCLKDIV_Msk              (0x60000UL)               /*!< PDM PCFG: MCLKDIV (Bitfield-Mask: 0x03)               */
+#define PDM_PCFG_SINCRATE_Pos             (10UL)                    /*!< PDM PCFG: SINCRATE (Bit 10)                           */
+#define PDM_PCFG_SINCRATE_Msk             (0x1fc00UL)               /*!< PDM PCFG: SINCRATE (Bitfield-Mask: 0x7f)              */
+#define PDM_PCFG_ADCHPD_Pos               (9UL)                     /*!< PDM PCFG: ADCHPD (Bit 9)                              */
+#define PDM_PCFG_ADCHPD_Msk               (0x200UL)                 /*!< PDM PCFG: ADCHPD (Bitfield-Mask: 0x01)                */
+#define PDM_PCFG_HPCUTOFF_Pos             (5UL)                     /*!< PDM PCFG: HPCUTOFF (Bit 5)                            */
+#define PDM_PCFG_HPCUTOFF_Msk             (0x1e0UL)                 /*!< PDM PCFG: HPCUTOFF (Bitfield-Mask: 0x0f)              */
+#define PDM_PCFG_CYCLES_Pos               (2UL)                     /*!< PDM PCFG: CYCLES (Bit 2)                              */
+#define PDM_PCFG_CYCLES_Msk               (0x1cUL)                  /*!< PDM PCFG: CYCLES (Bitfield-Mask: 0x07)                */
+#define PDM_PCFG_SOFTMUTE_Pos             (1UL)                     /*!< PDM PCFG: SOFTMUTE (Bit 1)                            */
+#define PDM_PCFG_SOFTMUTE_Msk             (0x2UL)                   /*!< PDM PCFG: SOFTMUTE (Bitfield-Mask: 0x01)              */
+#define PDM_PCFG_PDMCORE_Pos              (0UL)                     /*!< PDM PCFG: PDMCORE (Bit 0)                             */
+#define PDM_PCFG_PDMCORE_Msk              (0x1UL)                   /*!< PDM PCFG: PDMCORE (Bitfield-Mask: 0x01)               */
+/* =========================================================  VCFG  ========================================================== */
+#define PDM_VCFG_IOCLKEN_Pos              (31UL)                    /*!< PDM VCFG: IOCLKEN (Bit 31)                            */
+#define PDM_VCFG_IOCLKEN_Msk              (0x80000000UL)            /*!< PDM VCFG: IOCLKEN (Bitfield-Mask: 0x01)               */
+#define PDM_VCFG_RSTB_Pos                 (30UL)                    /*!< PDM VCFG: RSTB (Bit 30)                               */
+#define PDM_VCFG_RSTB_Msk                 (0x40000000UL)            /*!< PDM VCFG: RSTB (Bitfield-Mask: 0x01)                  */
+#define PDM_VCFG_PDMCLKSEL_Pos            (27UL)                    /*!< PDM VCFG: PDMCLKSEL (Bit 27)                          */
+#define PDM_VCFG_PDMCLKSEL_Msk            (0x38000000UL)            /*!< PDM VCFG: PDMCLKSEL (Bitfield-Mask: 0x07)             */
+#define PDM_VCFG_PDMCLK_Pos               (26UL)                    /*!< PDM VCFG: PDMCLK (Bit 26)                             */
+#define PDM_VCFG_PDMCLK_Msk               (0x4000000UL)             /*!< PDM VCFG: PDMCLK (Bitfield-Mask: 0x01)                */
+#define PDM_VCFG_I2SMODE_Pos              (20UL)                    /*!< PDM VCFG: I2SMODE (Bit 20)                            */
+#define PDM_VCFG_I2SMODE_Msk              (0x100000UL)              /*!< PDM VCFG: I2SMODE (Bitfield-Mask: 0x01)               */
+#define PDM_VCFG_BCLKINV_Pos              (19UL)                    /*!< PDM VCFG: BCLKINV (Bit 19)                            */
+#define PDM_VCFG_BCLKINV_Msk              (0x80000UL)               /*!< PDM VCFG: BCLKINV (Bitfield-Mask: 0x01)               */
+#define PDM_VCFG_DMICKDEL_Pos             (17UL)                    /*!< PDM VCFG: DMICKDEL (Bit 17)                           */
+#define PDM_VCFG_DMICKDEL_Msk             (0x20000UL)               /*!< PDM VCFG: DMICKDEL (Bitfield-Mask: 0x01)              */
+#define PDM_VCFG_SELAP_Pos                (16UL)                    /*!< PDM VCFG: SELAP (Bit 16)                              */
+#define PDM_VCFG_SELAP_Msk                (0x10000UL)               /*!< PDM VCFG: SELAP (Bitfield-Mask: 0x01)                 */
+#define PDM_VCFG_PCMPACK_Pos              (8UL)                     /*!< PDM VCFG: PCMPACK (Bit 8)                             */
+#define PDM_VCFG_PCMPACK_Msk              (0x100UL)                 /*!< PDM VCFG: PCMPACK (Bitfield-Mask: 0x01)               */
+#define PDM_VCFG_CHSET_Pos                (3UL)                     /*!< PDM VCFG: CHSET (Bit 3)                               */
+#define PDM_VCFG_CHSET_Msk                (0x18UL)                  /*!< PDM VCFG: CHSET (Bitfield-Mask: 0x03)                 */
+/* ==========================================================  FR  =========================================================== */
+#define PDM_FR_FIFOCNT_Pos                (0UL)                     /*!< PDM FR: FIFOCNT (Bit 0)                               */
+#define PDM_FR_FIFOCNT_Msk                (0x1ffUL)                 /*!< PDM FR: FIFOCNT (Bitfield-Mask: 0x1ff)                */
+/* ==========================================================  FRD  ========================================================== */
+#define PDM_FRD_FIFOREAD_Pos              (0UL)                     /*!< PDM FRD: FIFOREAD (Bit 0)                             */
+#define PDM_FRD_FIFOREAD_Msk              (0xffffffffUL)            /*!< PDM FRD: FIFOREAD (Bitfield-Mask: 0xffffffff)         */
+/* =========================================================  FLUSH  ========================================================= */
+#define PDM_FLUSH_FIFOFLUSH_Pos           (0UL)                     /*!< PDM FLUSH: FIFOFLUSH (Bit 0)                          */
+#define PDM_FLUSH_FIFOFLUSH_Msk           (0x1UL)                   /*!< PDM FLUSH: FIFOFLUSH (Bitfield-Mask: 0x01)            */
+/* =========================================================  FTHR  ========================================================== */
+#define PDM_FTHR_FIFOTHR_Pos              (0UL)                     /*!< PDM FTHR: FIFOTHR (Bit 0)                             */
+#define PDM_FTHR_FIFOTHR_Msk              (0xffUL)                  /*!< PDM FTHR: FIFOTHR (Bitfield-Mask: 0xff)               */
+/* =========================================================  INTEN  ========================================================= */
+#define PDM_INTEN_UNDFL_Pos               (2UL)                     /*!< PDM INTEN: UNDFL (Bit 2)                              */
+#define PDM_INTEN_UNDFL_Msk               (0x4UL)                   /*!< PDM INTEN: UNDFL (Bitfield-Mask: 0x01)                */
+#define PDM_INTEN_OVF_Pos                 (1UL)                     /*!< PDM INTEN: OVF (Bit 1)                                */
+#define PDM_INTEN_OVF_Msk                 (0x2UL)                   /*!< PDM INTEN: OVF (Bitfield-Mask: 0x01)                  */
+#define PDM_INTEN_THR_Pos                 (0UL)                     /*!< PDM INTEN: THR (Bit 0)                                */
+#define PDM_INTEN_THR_Msk                 (0x1UL)                   /*!< PDM INTEN: THR (Bitfield-Mask: 0x01)                  */
+/* ========================================================  INTSTAT  ======================================================== */
+#define PDM_INTSTAT_UNDFL_Pos             (2UL)                     /*!< PDM INTSTAT: UNDFL (Bit 2)                            */
+#define PDM_INTSTAT_UNDFL_Msk             (0x4UL)                   /*!< PDM INTSTAT: UNDFL (Bitfield-Mask: 0x01)              */
+#define PDM_INTSTAT_OVF_Pos               (1UL)                     /*!< PDM INTSTAT: OVF (Bit 1)                              */
+#define PDM_INTSTAT_OVF_Msk               (0x2UL)                   /*!< PDM INTSTAT: OVF (Bitfield-Mask: 0x01)                */
+#define PDM_INTSTAT_THR_Pos               (0UL)                     /*!< PDM INTSTAT: THR (Bit 0)                              */
+#define PDM_INTSTAT_THR_Msk               (0x1UL)                   /*!< PDM INTSTAT: THR (Bitfield-Mask: 0x01)                */
+/* ========================================================  INTCLR  ========================================================= */
+#define PDM_INTCLR_UNDFL_Pos              (2UL)                     /*!< PDM INTCLR: UNDFL (Bit 2)                             */
+#define PDM_INTCLR_UNDFL_Msk              (0x4UL)                   /*!< PDM INTCLR: UNDFL (Bitfield-Mask: 0x01)               */
+#define PDM_INTCLR_OVF_Pos                (1UL)                     /*!< PDM INTCLR: OVF (Bit 1)                               */
+#define PDM_INTCLR_OVF_Msk                (0x2UL)                   /*!< PDM INTCLR: OVF (Bitfield-Mask: 0x01)                 */
+#define PDM_INTCLR_THR_Pos                (0UL)                     /*!< PDM INTCLR: THR (Bit 0)                               */
+#define PDM_INTCLR_THR_Msk                (0x1UL)                   /*!< PDM INTCLR: THR (Bitfield-Mask: 0x01)                 */
+/* ========================================================  INTSET  ========================================================= */
+#define PDM_INTSET_UNDFL_Pos              (2UL)                     /*!< PDM INTSET: UNDFL (Bit 2)                             */
+#define PDM_INTSET_UNDFL_Msk              (0x4UL)                   /*!< PDM INTSET: UNDFL (Bitfield-Mask: 0x01)               */
+#define PDM_INTSET_OVF_Pos                (1UL)                     /*!< PDM INTSET: OVF (Bit 1)                               */
+#define PDM_INTSET_OVF_Msk                (0x2UL)                   /*!< PDM INTSET: OVF (Bitfield-Mask: 0x01)                 */
+#define PDM_INTSET_THR_Pos                (0UL)                     /*!< PDM INTSET: THR (Bit 0)                               */
+#define PDM_INTSET_THR_Msk                (0x1UL)                   /*!< PDM INTSET: THR (Bitfield-Mask: 0x01)                 */
+
+
+/* =========================================================================================================================== */
+/* ================                                          PWRCTRL                                          ================ */
+/* =========================================================================================================================== */
+
+/* =======================================================  SUPPLYSRC  ======================================================= */
+#define PWRCTRL_SUPPLYSRC_SWITCH_LDO_IN_SLEEP_Pos (2UL)             /*!< PWRCTRL SUPPLYSRC: SWITCH_LDO_IN_SLEEP (Bit 2)        */
+#define PWRCTRL_SUPPLYSRC_SWITCH_LDO_IN_SLEEP_Msk (0x4UL)           /*!< PWRCTRL SUPPLYSRC: SWITCH_LDO_IN_SLEEP (Bitfield-Mask: 0x01) */
+#define PWRCTRL_SUPPLYSRC_COREBUCKEN_Pos  (1UL)                     /*!< PWRCTRL SUPPLYSRC: COREBUCKEN (Bit 1)                 */
+#define PWRCTRL_SUPPLYSRC_COREBUCKEN_Msk  (0x2UL)                   /*!< PWRCTRL SUPPLYSRC: COREBUCKEN (Bitfield-Mask: 0x01)   */
+#define PWRCTRL_SUPPLYSRC_MEMBUCKEN_Pos   (0UL)                     /*!< PWRCTRL SUPPLYSRC: MEMBUCKEN (Bit 0)                  */
+#define PWRCTRL_SUPPLYSRC_MEMBUCKEN_Msk   (0x1UL)                   /*!< PWRCTRL SUPPLYSRC: MEMBUCKEN (Bitfield-Mask: 0x01)    */
+/* ======================================================  POWERSTATUS  ====================================================== */
+#define PWRCTRL_POWERSTATUS_COREBUCKON_Pos (1UL)                    /*!< PWRCTRL POWERSTATUS: COREBUCKON (Bit 1)               */
+#define PWRCTRL_POWERSTATUS_COREBUCKON_Msk (0x2UL)                  /*!< PWRCTRL POWERSTATUS: COREBUCKON (Bitfield-Mask: 0x01) */
+#define PWRCTRL_POWERSTATUS_MEMBUCKON_Pos (0UL)                     /*!< PWRCTRL POWERSTATUS: MEMBUCKON (Bit 0)                */
+#define PWRCTRL_POWERSTATUS_MEMBUCKON_Msk (0x1UL)                   /*!< PWRCTRL POWERSTATUS: MEMBUCKON (Bitfield-Mask: 0x01)  */
+/* =======================================================  DEVICEEN  ======================================================== */
+#define PWRCTRL_DEVICEEN_PDM_Pos          (10UL)                    /*!< PWRCTRL DEVICEEN: PDM (Bit 10)                        */
+#define PWRCTRL_DEVICEEN_PDM_Msk          (0x400UL)                 /*!< PWRCTRL DEVICEEN: PDM (Bitfield-Mask: 0x01)           */
+#define PWRCTRL_DEVICEEN_ADC_Pos          (9UL)                     /*!< PWRCTRL DEVICEEN: ADC (Bit 9)                         */
+#define PWRCTRL_DEVICEEN_ADC_Msk          (0x200UL)                 /*!< PWRCTRL DEVICEEN: ADC (Bitfield-Mask: 0x01)           */
+#define PWRCTRL_DEVICEEN_UART1_Pos        (8UL)                     /*!< PWRCTRL DEVICEEN: UART1 (Bit 8)                       */
+#define PWRCTRL_DEVICEEN_UART1_Msk        (0x100UL)                 /*!< PWRCTRL DEVICEEN: UART1 (Bitfield-Mask: 0x01)         */
+#define PWRCTRL_DEVICEEN_UART0_Pos        (7UL)                     /*!< PWRCTRL DEVICEEN: UART0 (Bit 7)                       */
+#define PWRCTRL_DEVICEEN_UART0_Msk        (0x80UL)                  /*!< PWRCTRL DEVICEEN: UART0 (Bitfield-Mask: 0x01)         */
+#define PWRCTRL_DEVICEEN_IO_MASTER5_Pos   (6UL)                     /*!< PWRCTRL DEVICEEN: IO_MASTER5 (Bit 6)                  */
+#define PWRCTRL_DEVICEEN_IO_MASTER5_Msk   (0x40UL)                  /*!< PWRCTRL DEVICEEN: IO_MASTER5 (Bitfield-Mask: 0x01)    */
+#define PWRCTRL_DEVICEEN_IO_MASTER4_Pos   (5UL)                     /*!< PWRCTRL DEVICEEN: IO_MASTER4 (Bit 5)                  */
+#define PWRCTRL_DEVICEEN_IO_MASTER4_Msk   (0x20UL)                  /*!< PWRCTRL DEVICEEN: IO_MASTER4 (Bitfield-Mask: 0x01)    */
+#define PWRCTRL_DEVICEEN_IO_MASTER3_Pos   (4UL)                     /*!< PWRCTRL DEVICEEN: IO_MASTER3 (Bit 4)                  */
+#define PWRCTRL_DEVICEEN_IO_MASTER3_Msk   (0x10UL)                  /*!< PWRCTRL DEVICEEN: IO_MASTER3 (Bitfield-Mask: 0x01)    */
+#define PWRCTRL_DEVICEEN_IO_MASTER2_Pos   (3UL)                     /*!< PWRCTRL DEVICEEN: IO_MASTER2 (Bit 3)                  */
+#define PWRCTRL_DEVICEEN_IO_MASTER2_Msk   (0x8UL)                   /*!< PWRCTRL DEVICEEN: IO_MASTER2 (Bitfield-Mask: 0x01)    */
+#define PWRCTRL_DEVICEEN_IO_MASTER1_Pos   (2UL)                     /*!< PWRCTRL DEVICEEN: IO_MASTER1 (Bit 2)                  */
+#define PWRCTRL_DEVICEEN_IO_MASTER1_Msk   (0x4UL)                   /*!< PWRCTRL DEVICEEN: IO_MASTER1 (Bitfield-Mask: 0x01)    */
+#define PWRCTRL_DEVICEEN_IO_MASTER0_Pos   (1UL)                     /*!< PWRCTRL DEVICEEN: IO_MASTER0 (Bit 1)                  */
+#define PWRCTRL_DEVICEEN_IO_MASTER0_Msk   (0x2UL)                   /*!< PWRCTRL DEVICEEN: IO_MASTER0 (Bitfield-Mask: 0x01)    */
+#define PWRCTRL_DEVICEEN_IO_SLAVE_Pos     (0UL)                     /*!< PWRCTRL DEVICEEN: IO_SLAVE (Bit 0)                    */
+#define PWRCTRL_DEVICEEN_IO_SLAVE_Msk     (0x1UL)                   /*!< PWRCTRL DEVICEEN: IO_SLAVE (Bitfield-Mask: 0x01)      */
+/* ====================================================  SRAMPWDINSLEEP  ===================================================== */
+#define PWRCTRL_SRAMPWDINSLEEP_CACHE_PWD_SLP_Pos (31UL)             /*!< PWRCTRL SRAMPWDINSLEEP: CACHE_PWD_SLP (Bit 31)        */
+#define PWRCTRL_SRAMPWDINSLEEP_CACHE_PWD_SLP_Msk (0x80000000UL)     /*!< PWRCTRL SRAMPWDINSLEEP: CACHE_PWD_SLP (Bitfield-Mask: 0x01) */
+#define PWRCTRL_SRAMPWDINSLEEP_SRAMSLEEPPOWERDOWN_Pos (0UL)         /*!< PWRCTRL SRAMPWDINSLEEP: SRAMSLEEPPOWERDOWN (Bit 0)    */
+#define PWRCTRL_SRAMPWDINSLEEP_SRAMSLEEPPOWERDOWN_Msk (0x7ffUL)     /*!< PWRCTRL SRAMPWDINSLEEP: SRAMSLEEPPOWERDOWN (Bitfield-Mask: 0x7ff) */
+/* =========================================================  MEMEN  ========================================================= */
+#define PWRCTRL_MEMEN_CACHEB2_Pos         (31UL)                    /*!< PWRCTRL MEMEN: CACHEB2 (Bit 31)                       */
+#define PWRCTRL_MEMEN_CACHEB2_Msk         (0x80000000UL)            /*!< PWRCTRL MEMEN: CACHEB2 (Bitfield-Mask: 0x01)          */
+#define PWRCTRL_MEMEN_CACHEB0_Pos         (29UL)                    /*!< PWRCTRL MEMEN: CACHEB0 (Bit 29)                       */
+#define PWRCTRL_MEMEN_CACHEB0_Msk         (0x20000000UL)            /*!< PWRCTRL MEMEN: CACHEB0 (Bitfield-Mask: 0x01)          */
+#define PWRCTRL_MEMEN_FLASH1_Pos          (12UL)                    /*!< PWRCTRL MEMEN: FLASH1 (Bit 12)                        */
+#define PWRCTRL_MEMEN_FLASH1_Msk          (0x1000UL)                /*!< PWRCTRL MEMEN: FLASH1 (Bitfield-Mask: 0x01)           */
+#define PWRCTRL_MEMEN_FLASH0_Pos          (11UL)                    /*!< PWRCTRL MEMEN: FLASH0 (Bit 11)                        */
+#define PWRCTRL_MEMEN_FLASH0_Msk          (0x800UL)                 /*!< PWRCTRL MEMEN: FLASH0 (Bitfield-Mask: 0x01)           */
+#define PWRCTRL_MEMEN_SRAMEN_Pos          (0UL)                     /*!< PWRCTRL MEMEN: SRAMEN (Bit 0)                         */
+#define PWRCTRL_MEMEN_SRAMEN_Msk          (0x7ffUL)                 /*!< PWRCTRL MEMEN: SRAMEN (Bitfield-Mask: 0x7ff)          */
+/* ======================================================  PWRONSTATUS  ====================================================== */
+#define PWRCTRL_PWRONSTATUS_PD_CACHEB2_Pos (21UL)                   /*!< PWRCTRL PWRONSTATUS: PD_CACHEB2 (Bit 21)              */
+#define PWRCTRL_PWRONSTATUS_PD_CACHEB2_Msk (0x200000UL)             /*!< PWRCTRL PWRONSTATUS: PD_CACHEB2 (Bitfield-Mask: 0x01) */
+#define PWRCTRL_PWRONSTATUS_PD_CACHEB0_Pos (19UL)                   /*!< PWRCTRL PWRONSTATUS: PD_CACHEB0 (Bit 19)              */
+#define PWRCTRL_PWRONSTATUS_PD_CACHEB0_Msk (0x80000UL)              /*!< PWRCTRL PWRONSTATUS: PD_CACHEB0 (Bitfield-Mask: 0x01) */
+#define PWRCTRL_PWRONSTATUS_PD_GRP7_SRAM_Pos (18UL)                 /*!< PWRCTRL PWRONSTATUS: PD_GRP7_SRAM (Bit 18)            */
+#define PWRCTRL_PWRONSTATUS_PD_GRP7_SRAM_Msk (0x40000UL)            /*!< PWRCTRL PWRONSTATUS: PD_GRP7_SRAM (Bitfield-Mask: 0x01) */
+#define PWRCTRL_PWRONSTATUS_PD_GRP6_SRAM_Pos (17UL)                 /*!< PWRCTRL PWRONSTATUS: PD_GRP6_SRAM (Bit 17)            */
+#define PWRCTRL_PWRONSTATUS_PD_GRP6_SRAM_Msk (0x20000UL)            /*!< PWRCTRL PWRONSTATUS: PD_GRP6_SRAM (Bitfield-Mask: 0x01) */
+#define PWRCTRL_PWRONSTATUS_PD_GRP5_SRAM_Pos (16UL)                 /*!< PWRCTRL PWRONSTATUS: PD_GRP5_SRAM (Bit 16)            */
+#define PWRCTRL_PWRONSTATUS_PD_GRP5_SRAM_Msk (0x10000UL)            /*!< PWRCTRL PWRONSTATUS: PD_GRP5_SRAM (Bitfield-Mask: 0x01) */
+#define PWRCTRL_PWRONSTATUS_PD_GRP4_SRAM_Pos (15UL)                 /*!< PWRCTRL PWRONSTATUS: PD_GRP4_SRAM (Bit 15)            */
+#define PWRCTRL_PWRONSTATUS_PD_GRP4_SRAM_Msk (0x8000UL)             /*!< PWRCTRL PWRONSTATUS: PD_GRP4_SRAM (Bitfield-Mask: 0x01) */
+#define PWRCTRL_PWRONSTATUS_PD_GRP3_SRAM_Pos (14UL)                 /*!< PWRCTRL PWRONSTATUS: PD_GRP3_SRAM (Bit 14)            */
+#define PWRCTRL_PWRONSTATUS_PD_GRP3_SRAM_Msk (0x4000UL)             /*!< PWRCTRL PWRONSTATUS: PD_GRP3_SRAM (Bitfield-Mask: 0x01) */
+#define PWRCTRL_PWRONSTATUS_PD_GRP2_SRAM_Pos (13UL)                 /*!< PWRCTRL PWRONSTATUS: PD_GRP2_SRAM (Bit 13)            */
+#define PWRCTRL_PWRONSTATUS_PD_GRP2_SRAM_Msk (0x2000UL)             /*!< PWRCTRL PWRONSTATUS: PD_GRP2_SRAM (Bitfield-Mask: 0x01) */
+#define PWRCTRL_PWRONSTATUS_PD_GRP1_SRAM_Pos (12UL)                 /*!< PWRCTRL PWRONSTATUS: PD_GRP1_SRAM (Bit 12)            */
+#define PWRCTRL_PWRONSTATUS_PD_GRP1_SRAM_Msk (0x1000UL)             /*!< PWRCTRL PWRONSTATUS: PD_GRP1_SRAM (Bitfield-Mask: 0x01) */
+#define PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM3_Pos (11UL)                /*!< PWRCTRL PWRONSTATUS: PD_GRP0_SRAM3 (Bit 11)           */
+#define PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM3_Msk (0x800UL)             /*!< PWRCTRL PWRONSTATUS: PD_GRP0_SRAM3 (Bitfield-Mask: 0x01) */
+#define PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM2_Pos (10UL)                /*!< PWRCTRL PWRONSTATUS: PD_GRP0_SRAM2 (Bit 10)           */
+#define PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM2_Msk (0x400UL)             /*!< PWRCTRL PWRONSTATUS: PD_GRP0_SRAM2 (Bitfield-Mask: 0x01) */
+#define PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM1_Pos (9UL)                 /*!< PWRCTRL PWRONSTATUS: PD_GRP0_SRAM1 (Bit 9)            */
+#define PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM1_Msk (0x200UL)             /*!< PWRCTRL PWRONSTATUS: PD_GRP0_SRAM1 (Bitfield-Mask: 0x01) */
+#define PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM0_Pos (8UL)                 /*!< PWRCTRL PWRONSTATUS: PD_GRP0_SRAM0 (Bit 8)            */
+#define PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM0_Msk (0x100UL)             /*!< PWRCTRL PWRONSTATUS: PD_GRP0_SRAM0 (Bitfield-Mask: 0x01) */
+#define PWRCTRL_PWRONSTATUS_PDADC_Pos     (7UL)                     /*!< PWRCTRL PWRONSTATUS: PDADC (Bit 7)                    */
+#define PWRCTRL_PWRONSTATUS_PDADC_Msk     (0x80UL)                  /*!< PWRCTRL PWRONSTATUS: PDADC (Bitfield-Mask: 0x01)      */
+#define PWRCTRL_PWRONSTATUS_PD_FLAM1_Pos  (6UL)                     /*!< PWRCTRL PWRONSTATUS: PD_FLAM1 (Bit 6)                 */
+#define PWRCTRL_PWRONSTATUS_PD_FLAM1_Msk  (0x40UL)                  /*!< PWRCTRL PWRONSTATUS: PD_FLAM1 (Bitfield-Mask: 0x01)   */
+#define PWRCTRL_PWRONSTATUS_PD_FLAM0_Pos  (5UL)                     /*!< PWRCTRL PWRONSTATUS: PD_FLAM0 (Bit 5)                 */
+#define PWRCTRL_PWRONSTATUS_PD_FLAM0_Msk  (0x20UL)                  /*!< PWRCTRL PWRONSTATUS: PD_FLAM0 (Bitfield-Mask: 0x01)   */
+#define PWRCTRL_PWRONSTATUS_PD_PDM_Pos    (4UL)                     /*!< PWRCTRL PWRONSTATUS: PD_PDM (Bit 4)                   */
+#define PWRCTRL_PWRONSTATUS_PD_PDM_Msk    (0x10UL)                  /*!< PWRCTRL PWRONSTATUS: PD_PDM (Bitfield-Mask: 0x01)     */
+#define PWRCTRL_PWRONSTATUS_PDC_Pos       (3UL)                     /*!< PWRCTRL PWRONSTATUS: PDC (Bit 3)                      */
+#define PWRCTRL_PWRONSTATUS_PDC_Msk       (0x8UL)                   /*!< PWRCTRL PWRONSTATUS: PDC (Bitfield-Mask: 0x01)        */
+#define PWRCTRL_PWRONSTATUS_PDB_Pos       (2UL)                     /*!< PWRCTRL PWRONSTATUS: PDB (Bit 2)                      */
+#define PWRCTRL_PWRONSTATUS_PDB_Msk       (0x4UL)                   /*!< PWRCTRL PWRONSTATUS: PDB (Bitfield-Mask: 0x01)        */
+#define PWRCTRL_PWRONSTATUS_PDA_Pos       (1UL)                     /*!< PWRCTRL PWRONSTATUS: PDA (Bit 1)                      */
+#define PWRCTRL_PWRONSTATUS_PDA_Msk       (0x2UL)                   /*!< PWRCTRL PWRONSTATUS: PDA (Bitfield-Mask: 0x01)        */
+/* =======================================================  SRAMCTRL  ======================================================== */
+#define PWRCTRL_SRAMCTRL_SRAM_MASTER_CLKGATE_Pos (2UL)              /*!< PWRCTRL SRAMCTRL: SRAM_MASTER_CLKGATE (Bit 2)         */
+#define PWRCTRL_SRAMCTRL_SRAM_MASTER_CLKGATE_Msk (0x4UL)            /*!< PWRCTRL SRAMCTRL: SRAM_MASTER_CLKGATE (Bitfield-Mask: 0x01) */
+#define PWRCTRL_SRAMCTRL_SRAM_CLKGATE_Pos (1UL)                     /*!< PWRCTRL SRAMCTRL: SRAM_CLKGATE (Bit 1)                */
+#define PWRCTRL_SRAMCTRL_SRAM_CLKGATE_Msk (0x2UL)                   /*!< PWRCTRL SRAMCTRL: SRAM_CLKGATE (Bitfield-Mask: 0x01)  */
+#define PWRCTRL_SRAMCTRL_SRAM_LIGHT_SLEEP_Pos (0UL)                 /*!< PWRCTRL SRAMCTRL: SRAM_LIGHT_SLEEP (Bit 0)            */
+#define PWRCTRL_SRAMCTRL_SRAM_LIGHT_SLEEP_Msk (0x1UL)               /*!< PWRCTRL SRAMCTRL: SRAM_LIGHT_SLEEP (Bitfield-Mask: 0x01) */
+/* =======================================================  ADCSTATUS  ======================================================= */
+#define PWRCTRL_ADCSTATUS_ADC_REFBUF_PWD_Pos (5UL)                  /*!< PWRCTRL ADCSTATUS: ADC_REFBUF_PWD (Bit 5)             */
+#define PWRCTRL_ADCSTATUS_ADC_REFBUF_PWD_Msk (0x20UL)               /*!< PWRCTRL ADCSTATUS: ADC_REFBUF_PWD (Bitfield-Mask: 0x01) */
+#define PWRCTRL_ADCSTATUS_ADC_REFKEEP_PWD_Pos (4UL)                 /*!< PWRCTRL ADCSTATUS: ADC_REFKEEP_PWD (Bit 4)            */
+#define PWRCTRL_ADCSTATUS_ADC_REFKEEP_PWD_Msk (0x10UL)              /*!< PWRCTRL ADCSTATUS: ADC_REFKEEP_PWD (Bitfield-Mask: 0x01) */
+#define PWRCTRL_ADCSTATUS_ADC_VBAT_PWD_Pos (3UL)                    /*!< PWRCTRL ADCSTATUS: ADC_VBAT_PWD (Bit 3)               */
+#define PWRCTRL_ADCSTATUS_ADC_VBAT_PWD_Msk (0x8UL)                  /*!< PWRCTRL ADCSTATUS: ADC_VBAT_PWD (Bitfield-Mask: 0x01) */
+#define PWRCTRL_ADCSTATUS_ADC_VPTAT_PWD_Pos (2UL)                   /*!< PWRCTRL ADCSTATUS: ADC_VPTAT_PWD (Bit 2)              */
+#define PWRCTRL_ADCSTATUS_ADC_VPTAT_PWD_Msk (0x4UL)                 /*!< PWRCTRL ADCSTATUS: ADC_VPTAT_PWD (Bitfield-Mask: 0x01) */
+#define PWRCTRL_ADCSTATUS_ADC_BGT_PWD_Pos (1UL)                     /*!< PWRCTRL ADCSTATUS: ADC_BGT_PWD (Bit 1)                */
+#define PWRCTRL_ADCSTATUS_ADC_BGT_PWD_Msk (0x2UL)                   /*!< PWRCTRL ADCSTATUS: ADC_BGT_PWD (Bitfield-Mask: 0x01)  */
+#define PWRCTRL_ADCSTATUS_ADC_PWD_Pos     (0UL)                     /*!< PWRCTRL ADCSTATUS: ADC_PWD (Bit 0)                    */
+#define PWRCTRL_ADCSTATUS_ADC_PWD_Msk     (0x1UL)                   /*!< PWRCTRL ADCSTATUS: ADC_PWD (Bitfield-Mask: 0x01)      */
+/* ========================================================  MISCOPT  ======================================================== */
+#define PWRCTRL_MISCOPT_DIS_LDOLPMODE_TIMERS_Pos (2UL)              /*!< PWRCTRL MISCOPT: DIS_LDOLPMODE_TIMERS (Bit 2)         */
+#define PWRCTRL_MISCOPT_DIS_LDOLPMODE_TIMERS_Msk (0x4UL)            /*!< PWRCTRL MISCOPT: DIS_LDOLPMODE_TIMERS (Bitfield-Mask: 0x01) */
+#define PWRCTRL_MISCOPT_DIS_LDOLPMODE_HFRC_Pos (1UL)                /*!< PWRCTRL MISCOPT: DIS_LDOLPMODE_HFRC (Bit 1)           */
+#define PWRCTRL_MISCOPT_DIS_LDOLPMODE_HFRC_Msk (0x2UL)              /*!< PWRCTRL MISCOPT: DIS_LDOLPMODE_HFRC (Bitfield-Mask: 0x01) */
+#define PWRCTRL_MISCOPT_ADC_EN_MASK_Pos   (0UL)                     /*!< PWRCTRL MISCOPT: ADC_EN_MASK (Bit 0)                  */
+#define PWRCTRL_MISCOPT_ADC_EN_MASK_Msk   (0x1UL)                   /*!< PWRCTRL MISCOPT: ADC_EN_MASK (Bitfield-Mask: 0x01)    */
+
+
+/* =========================================================================================================================== */
+/* ================                                          RSTGEN                                           ================ */
+/* =========================================================================================================================== */
+
+/* ==========================================================  CFG  ========================================================== */
+#define RSTGEN_CFG_WDREN_Pos              (1UL)                     /*!< RSTGEN CFG: WDREN (Bit 1)                             */
+#define RSTGEN_CFG_WDREN_Msk              (0x2UL)                   /*!< RSTGEN CFG: WDREN (Bitfield-Mask: 0x01)               */
+#define RSTGEN_CFG_BODHREN_Pos            (0UL)                     /*!< RSTGEN CFG: BODHREN (Bit 0)                           */
+#define RSTGEN_CFG_BODHREN_Msk            (0x1UL)                   /*!< RSTGEN CFG: BODHREN (Bitfield-Mask: 0x01)             */
+/* =========================================================  SWPOI  ========================================================= */
+#define RSTGEN_SWPOI_SWPOIKEY_Pos         (0UL)                     /*!< RSTGEN SWPOI: SWPOIKEY (Bit 0)                        */
+#define RSTGEN_SWPOI_SWPOIKEY_Msk         (0xffUL)                  /*!< RSTGEN SWPOI: SWPOIKEY (Bitfield-Mask: 0xff)          */
+/* =========================================================  SWPOR  ========================================================= */
+#define RSTGEN_SWPOR_SWPORKEY_Pos         (0UL)                     /*!< RSTGEN SWPOR: SWPORKEY (Bit 0)                        */
+#define RSTGEN_SWPOR_SWPORKEY_Msk         (0xffUL)                  /*!< RSTGEN SWPOR: SWPORKEY (Bitfield-Mask: 0xff)          */
+/* =========================================================  STAT  ========================================================== */
+#define RSTGEN_STAT_WDRSTAT_Pos           (6UL)                     /*!< RSTGEN STAT: WDRSTAT (Bit 6)                          */
+#define RSTGEN_STAT_WDRSTAT_Msk           (0x40UL)                  /*!< RSTGEN STAT: WDRSTAT (Bitfield-Mask: 0x01)            */
+#define RSTGEN_STAT_DBGRSTAT_Pos          (5UL)                     /*!< RSTGEN STAT: DBGRSTAT (Bit 5)                         */
+#define RSTGEN_STAT_DBGRSTAT_Msk          (0x20UL)                  /*!< RSTGEN STAT: DBGRSTAT (Bitfield-Mask: 0x01)           */
+#define RSTGEN_STAT_POIRSTAT_Pos          (4UL)                     /*!< RSTGEN STAT: POIRSTAT (Bit 4)                         */
+#define RSTGEN_STAT_POIRSTAT_Msk          (0x10UL)                  /*!< RSTGEN STAT: POIRSTAT (Bitfield-Mask: 0x01)           */
+#define RSTGEN_STAT_SWRSTAT_Pos           (3UL)                     /*!< RSTGEN STAT: SWRSTAT (Bit 3)                          */
+#define RSTGEN_STAT_SWRSTAT_Msk           (0x8UL)                   /*!< RSTGEN STAT: SWRSTAT (Bitfield-Mask: 0x01)            */
+#define RSTGEN_STAT_BORSTAT_Pos           (2UL)                     /*!< RSTGEN STAT: BORSTAT (Bit 2)                          */
+#define RSTGEN_STAT_BORSTAT_Msk           (0x4UL)                   /*!< RSTGEN STAT: BORSTAT (Bitfield-Mask: 0x01)            */
+#define RSTGEN_STAT_PORSTAT_Pos           (1UL)                     /*!< RSTGEN STAT: PORSTAT (Bit 1)                          */
+#define RSTGEN_STAT_PORSTAT_Msk           (0x2UL)                   /*!< RSTGEN STAT: PORSTAT (Bitfield-Mask: 0x01)            */
+#define RSTGEN_STAT_EXRSTAT_Pos           (0UL)                     /*!< RSTGEN STAT: EXRSTAT (Bit 0)                          */
+#define RSTGEN_STAT_EXRSTAT_Msk           (0x1UL)                   /*!< RSTGEN STAT: EXRSTAT (Bitfield-Mask: 0x01)            */
+/* ========================================================  CLRSTAT  ======================================================== */
+#define RSTGEN_CLRSTAT_CLRSTAT_Pos        (0UL)                     /*!< RSTGEN CLRSTAT: CLRSTAT (Bit 0)                       */
+#define RSTGEN_CLRSTAT_CLRSTAT_Msk        (0x1UL)                   /*!< RSTGEN CLRSTAT: CLRSTAT (Bitfield-Mask: 0x01)         */
+/* =======================================================  TPIU_RST  ======================================================== */
+#define RSTGEN_TPIU_RST_TPIURST_Pos       (0UL)                     /*!< RSTGEN TPIU_RST: TPIURST (Bit 0)                      */
+#define RSTGEN_TPIU_RST_TPIURST_Msk       (0x1UL)                   /*!< RSTGEN TPIU_RST: TPIURST (Bitfield-Mask: 0x01)        */
+/* =========================================================  INTEN  ========================================================= */
+#define RSTGEN_INTEN_BODH_Pos             (0UL)                     /*!< RSTGEN INTEN: BODH (Bit 0)                            */
+#define RSTGEN_INTEN_BODH_Msk             (0x1UL)                   /*!< RSTGEN INTEN: BODH (Bitfield-Mask: 0x01)              */
+/* ========================================================  INTSTAT  ======================================================== */
+#define RSTGEN_INTSTAT_BODH_Pos           (0UL)                     /*!< RSTGEN INTSTAT: BODH (Bit 0)                          */
+#define RSTGEN_INTSTAT_BODH_Msk           (0x1UL)                   /*!< RSTGEN INTSTAT: BODH (Bitfield-Mask: 0x01)            */
+/* ========================================================  INTCLR  ========================================================= */
+#define RSTGEN_INTCLR_BODH_Pos            (0UL)                     /*!< RSTGEN INTCLR: BODH (Bit 0)                           */
+#define RSTGEN_INTCLR_BODH_Msk            (0x1UL)                   /*!< RSTGEN INTCLR: BODH (Bitfield-Mask: 0x01)             */
+/* ========================================================  INTSET  ========================================================= */
+#define RSTGEN_INTSET_BODH_Pos            (0UL)                     /*!< RSTGEN INTSET: BODH (Bit 0)                           */
+#define RSTGEN_INTSET_BODH_Msk            (0x1UL)                   /*!< RSTGEN INTSET: BODH (Bitfield-Mask: 0x01)             */
+
+
+/* =========================================================================================================================== */
+/* ================                                           UART0                                           ================ */
+/* =========================================================================================================================== */
+
+/* ==========================================================  DR  =========================================================== */
+#define UART0_DR_OEDATA_Pos               (11UL)                    /*!< UART0 DR: OEDATA (Bit 11)                             */
+#define UART0_DR_OEDATA_Msk               (0x800UL)                 /*!< UART0 DR: OEDATA (Bitfield-Mask: 0x01)                */
+#define UART0_DR_BEDATA_Pos               (10UL)                    /*!< UART0 DR: BEDATA (Bit 10)                             */
+#define UART0_DR_BEDATA_Msk               (0x400UL)                 /*!< UART0 DR: BEDATA (Bitfield-Mask: 0x01)                */
+#define UART0_DR_PEDATA_Pos               (9UL)                     /*!< UART0 DR: PEDATA (Bit 9)                              */
+#define UART0_DR_PEDATA_Msk               (0x200UL)                 /*!< UART0 DR: PEDATA (Bitfield-Mask: 0x01)                */
+#define UART0_DR_FEDATA_Pos               (8UL)                     /*!< UART0 DR: FEDATA (Bit 8)                              */
+#define UART0_DR_FEDATA_Msk               (0x100UL)                 /*!< UART0 DR: FEDATA (Bitfield-Mask: 0x01)                */
+#define UART0_DR_DATA_Pos                 (0UL)                     /*!< UART0 DR: DATA (Bit 0)                                */
+#define UART0_DR_DATA_Msk                 (0xffUL)                  /*!< UART0 DR: DATA (Bitfield-Mask: 0xff)                  */
+/* ==========================================================  RSR  ========================================================== */
+#define UART0_RSR_OESTAT_Pos              (3UL)                     /*!< UART0 RSR: OESTAT (Bit 3)                             */
+#define UART0_RSR_OESTAT_Msk              (0x8UL)                   /*!< UART0 RSR: OESTAT (Bitfield-Mask: 0x01)               */
+#define UART0_RSR_BESTAT_Pos              (2UL)                     /*!< UART0 RSR: BESTAT (Bit 2)                             */
+#define UART0_RSR_BESTAT_Msk              (0x4UL)                   /*!< UART0 RSR: BESTAT (Bitfield-Mask: 0x01)               */
+#define UART0_RSR_PESTAT_Pos              (1UL)                     /*!< UART0 RSR: PESTAT (Bit 1)                             */
+#define UART0_RSR_PESTAT_Msk              (0x2UL)                   /*!< UART0 RSR: PESTAT (Bitfield-Mask: 0x01)               */
+#define UART0_RSR_FESTAT_Pos              (0UL)                     /*!< UART0 RSR: FESTAT (Bit 0)                             */
+#define UART0_RSR_FESTAT_Msk              (0x1UL)                   /*!< UART0 RSR: FESTAT (Bitfield-Mask: 0x01)               */
+/* ==========================================================  FR  =========================================================== */
+#define UART0_FR_TXBUSY_Pos               (8UL)                     /*!< UART0 FR: TXBUSY (Bit 8)                              */
+#define UART0_FR_TXBUSY_Msk               (0x100UL)                 /*!< UART0 FR: TXBUSY (Bitfield-Mask: 0x01)                */
+#define UART0_FR_TXFE_Pos                 (7UL)                     /*!< UART0 FR: TXFE (Bit 7)                                */
+#define UART0_FR_TXFE_Msk                 (0x80UL)                  /*!< UART0 FR: TXFE (Bitfield-Mask: 0x01)                  */
+#define UART0_FR_RXFF_Pos                 (6UL)                     /*!< UART0 FR: RXFF (Bit 6)                                */
+#define UART0_FR_RXFF_Msk                 (0x40UL)                  /*!< UART0 FR: RXFF (Bitfield-Mask: 0x01)                  */
+#define UART0_FR_TXFF_Pos                 (5UL)                     /*!< UART0 FR: TXFF (Bit 5)                                */
+#define UART0_FR_TXFF_Msk                 (0x20UL)                  /*!< UART0 FR: TXFF (Bitfield-Mask: 0x01)                  */
+#define UART0_FR_RXFE_Pos                 (4UL)                     /*!< UART0 FR: RXFE (Bit 4)                                */
+#define UART0_FR_RXFE_Msk                 (0x10UL)                  /*!< UART0 FR: RXFE (Bitfield-Mask: 0x01)                  */
+#define UART0_FR_BUSY_Pos                 (3UL)                     /*!< UART0 FR: BUSY (Bit 3)                                */
+#define UART0_FR_BUSY_Msk                 (0x8UL)                   /*!< UART0 FR: BUSY (Bitfield-Mask: 0x01)                  */
+#define UART0_FR_DCD_Pos                  (2UL)                     /*!< UART0 FR: DCD (Bit 2)                                 */
+#define UART0_FR_DCD_Msk                  (0x4UL)                   /*!< UART0 FR: DCD (Bitfield-Mask: 0x01)                   */
+#define UART0_FR_DSR_Pos                  (1UL)                     /*!< UART0 FR: DSR (Bit 1)                                 */
+#define UART0_FR_DSR_Msk                  (0x2UL)                   /*!< UART0 FR: DSR (Bitfield-Mask: 0x01)                   */
+#define UART0_FR_CTS_Pos                  (0UL)                     /*!< UART0 FR: CTS (Bit 0)                                 */
+#define UART0_FR_CTS_Msk                  (0x1UL)                   /*!< UART0 FR: CTS (Bitfield-Mask: 0x01)                   */
+/* =========================================================  ILPR  ========================================================== */
+#define UART0_ILPR_ILPDVSR_Pos            (0UL)                     /*!< UART0 ILPR: ILPDVSR (Bit 0)                           */
+#define UART0_ILPR_ILPDVSR_Msk            (0xffUL)                  /*!< UART0 ILPR: ILPDVSR (Bitfield-Mask: 0xff)             */
+/* =========================================================  IBRD  ========================================================== */
+#define UART0_IBRD_DIVINT_Pos             (0UL)                     /*!< UART0 IBRD: DIVINT (Bit 0)                            */
+#define UART0_IBRD_DIVINT_Msk             (0xffffUL)                /*!< UART0 IBRD: DIVINT (Bitfield-Mask: 0xffff)            */
+/* =========================================================  FBRD  ========================================================== */
+#define UART0_FBRD_DIVFRAC_Pos            (0UL)                     /*!< UART0 FBRD: DIVFRAC (Bit 0)                           */
+#define UART0_FBRD_DIVFRAC_Msk            (0x3fUL)                  /*!< UART0 FBRD: DIVFRAC (Bitfield-Mask: 0x3f)             */
+/* =========================================================  LCRH  ========================================================== */
+#define UART0_LCRH_SPS_Pos                (7UL)                     /*!< UART0 LCRH: SPS (Bit 7)                               */
+#define UART0_LCRH_SPS_Msk                (0x80UL)                  /*!< UART0 LCRH: SPS (Bitfield-Mask: 0x01)                 */
+#define UART0_LCRH_WLEN_Pos               (5UL)                     /*!< UART0 LCRH: WLEN (Bit 5)                              */
+#define UART0_LCRH_WLEN_Msk               (0x60UL)                  /*!< UART0 LCRH: WLEN (Bitfield-Mask: 0x03)                */
+#define UART0_LCRH_FEN_Pos                (4UL)                     /*!< UART0 LCRH: FEN (Bit 4)                               */
+#define UART0_LCRH_FEN_Msk                (0x10UL)                  /*!< UART0 LCRH: FEN (Bitfield-Mask: 0x01)                 */
+#define UART0_LCRH_STP2_Pos               (3UL)                     /*!< UART0 LCRH: STP2 (Bit 3)                              */
+#define UART0_LCRH_STP2_Msk               (0x8UL)                   /*!< UART0 LCRH: STP2 (Bitfield-Mask: 0x01)                */
+#define UART0_LCRH_EPS_Pos                (2UL)                     /*!< UART0 LCRH: EPS (Bit 2)                               */
+#define UART0_LCRH_EPS_Msk                (0x4UL)                   /*!< UART0 LCRH: EPS (Bitfield-Mask: 0x01)                 */
+#define UART0_LCRH_PEN_Pos                (1UL)                     /*!< UART0 LCRH: PEN (Bit 1)                               */
+#define UART0_LCRH_PEN_Msk                (0x2UL)                   /*!< UART0 LCRH: PEN (Bitfield-Mask: 0x01)                 */
+#define UART0_LCRH_BRK_Pos                (0UL)                     /*!< UART0 LCRH: BRK (Bit 0)                               */
+#define UART0_LCRH_BRK_Msk                (0x1UL)                   /*!< UART0 LCRH: BRK (Bitfield-Mask: 0x01)                 */
+/* ==========================================================  CR  =========================================================== */
+#define UART0_CR_CTSEN_Pos                (15UL)                    /*!< UART0 CR: CTSEN (Bit 15)                              */
+#define UART0_CR_CTSEN_Msk                (0x8000UL)                /*!< UART0 CR: CTSEN (Bitfield-Mask: 0x01)                 */
+#define UART0_CR_RTSEN_Pos                (14UL)                    /*!< UART0 CR: RTSEN (Bit 14)                              */
+#define UART0_CR_RTSEN_Msk                (0x4000UL)                /*!< UART0 CR: RTSEN (Bitfield-Mask: 0x01)                 */
+#define UART0_CR_OUT2_Pos                 (13UL)                    /*!< UART0 CR: OUT2 (Bit 13)                               */
+#define UART0_CR_OUT2_Msk                 (0x2000UL)                /*!< UART0 CR: OUT2 (Bitfield-Mask: 0x01)                  */
+#define UART0_CR_OUT1_Pos                 (12UL)                    /*!< UART0 CR: OUT1 (Bit 12)                               */
+#define UART0_CR_OUT1_Msk                 (0x1000UL)                /*!< UART0 CR: OUT1 (Bitfield-Mask: 0x01)                  */
+#define UART0_CR_RTS_Pos                  (11UL)                    /*!< UART0 CR: RTS (Bit 11)                                */
+#define UART0_CR_RTS_Msk                  (0x800UL)                 /*!< UART0 CR: RTS (Bitfield-Mask: 0x01)                   */
+#define UART0_CR_DTR_Pos                  (10UL)                    /*!< UART0 CR: DTR (Bit 10)                                */
+#define UART0_CR_DTR_Msk                  (0x400UL)                 /*!< UART0 CR: DTR (Bitfield-Mask: 0x01)                   */
+#define UART0_CR_RXE_Pos                  (9UL)                     /*!< UART0 CR: RXE (Bit 9)                                 */
+#define UART0_CR_RXE_Msk                  (0x200UL)                 /*!< UART0 CR: RXE (Bitfield-Mask: 0x01)                   */
+#define UART0_CR_TXE_Pos                  (8UL)                     /*!< UART0 CR: TXE (Bit 8)                                 */
+#define UART0_CR_TXE_Msk                  (0x100UL)                 /*!< UART0 CR: TXE (Bitfield-Mask: 0x01)                   */
+#define UART0_CR_LBE_Pos                  (7UL)                     /*!< UART0 CR: LBE (Bit 7)                                 */
+#define UART0_CR_LBE_Msk                  (0x80UL)                  /*!< UART0 CR: LBE (Bitfield-Mask: 0x01)                   */
+#define UART0_CR_CLKSEL_Pos               (4UL)                     /*!< UART0 CR: CLKSEL (Bit 4)                              */
+#define UART0_CR_CLKSEL_Msk               (0x70UL)                  /*!< UART0 CR: CLKSEL (Bitfield-Mask: 0x07)                */
+#define UART0_CR_CLKEN_Pos                (3UL)                     /*!< UART0 CR: CLKEN (Bit 3)                               */
+#define UART0_CR_CLKEN_Msk                (0x8UL)                   /*!< UART0 CR: CLKEN (Bitfield-Mask: 0x01)                 */
+#define UART0_CR_SIRLP_Pos                (2UL)                     /*!< UART0 CR: SIRLP (Bit 2)                               */
+#define UART0_CR_SIRLP_Msk                (0x4UL)                   /*!< UART0 CR: SIRLP (Bitfield-Mask: 0x01)                 */
+#define UART0_CR_SIREN_Pos                (1UL)                     /*!< UART0 CR: SIREN (Bit 1)                               */
+#define UART0_CR_SIREN_Msk                (0x2UL)                   /*!< UART0 CR: SIREN (Bitfield-Mask: 0x01)                 */
+#define UART0_CR_UARTEN_Pos               (0UL)                     /*!< UART0 CR: UARTEN (Bit 0)                              */
+#define UART0_CR_UARTEN_Msk               (0x1UL)                   /*!< UART0 CR: UARTEN (Bitfield-Mask: 0x01)                */
+/* =========================================================  IFLS  ========================================================== */
+#define UART0_IFLS_RXIFLSEL_Pos           (3UL)                     /*!< UART0 IFLS: RXIFLSEL (Bit 3)                          */
+#define UART0_IFLS_RXIFLSEL_Msk           (0x38UL)                  /*!< UART0 IFLS: RXIFLSEL (Bitfield-Mask: 0x07)            */
+#define UART0_IFLS_TXIFLSEL_Pos           (0UL)                     /*!< UART0 IFLS: TXIFLSEL (Bit 0)                          */
+#define UART0_IFLS_TXIFLSEL_Msk           (0x7UL)                   /*!< UART0 IFLS: TXIFLSEL (Bitfield-Mask: 0x07)            */
+/* ==========================================================  IER  ========================================================== */
+#define UART0_IER_OEIM_Pos                (10UL)                    /*!< UART0 IER: OEIM (Bit 10)                              */
+#define UART0_IER_OEIM_Msk                (0x400UL)                 /*!< UART0 IER: OEIM (Bitfield-Mask: 0x01)                 */
+#define UART0_IER_BEIM_Pos                (9UL)                     /*!< UART0 IER: BEIM (Bit 9)                               */
+#define UART0_IER_BEIM_Msk                (0x200UL)                 /*!< UART0 IER: BEIM (Bitfield-Mask: 0x01)                 */
+#define UART0_IER_PEIM_Pos                (8UL)                     /*!< UART0 IER: PEIM (Bit 8)                               */
+#define UART0_IER_PEIM_Msk                (0x100UL)                 /*!< UART0 IER: PEIM (Bitfield-Mask: 0x01)                 */
+#define UART0_IER_FEIM_Pos                (7UL)                     /*!< UART0 IER: FEIM (Bit 7)                               */
+#define UART0_IER_FEIM_Msk                (0x80UL)                  /*!< UART0 IER: FEIM (Bitfield-Mask: 0x01)                 */
+#define UART0_IER_RTIM_Pos                (6UL)                     /*!< UART0 IER: RTIM (Bit 6)                               */
+#define UART0_IER_RTIM_Msk                (0x40UL)                  /*!< UART0 IER: RTIM (Bitfield-Mask: 0x01)                 */
+#define UART0_IER_TXIM_Pos                (5UL)                     /*!< UART0 IER: TXIM (Bit 5)                               */
+#define UART0_IER_TXIM_Msk                (0x20UL)                  /*!< UART0 IER: TXIM (Bitfield-Mask: 0x01)                 */
+#define UART0_IER_RXIM_Pos                (4UL)                     /*!< UART0 IER: RXIM (Bit 4)                               */
+#define UART0_IER_RXIM_Msk                (0x10UL)                  /*!< UART0 IER: RXIM (Bitfield-Mask: 0x01)                 */
+#define UART0_IER_DSRMIM_Pos              (3UL)                     /*!< UART0 IER: DSRMIM (Bit 3)                             */
+#define UART0_IER_DSRMIM_Msk              (0x8UL)                   /*!< UART0 IER: DSRMIM (Bitfield-Mask: 0x01)               */
+#define UART0_IER_DCDMIM_Pos              (2UL)                     /*!< UART0 IER: DCDMIM (Bit 2)                             */
+#define UART0_IER_DCDMIM_Msk              (0x4UL)                   /*!< UART0 IER: DCDMIM (Bitfield-Mask: 0x01)               */
+#define UART0_IER_CTSMIM_Pos              (1UL)                     /*!< UART0 IER: CTSMIM (Bit 1)                             */
+#define UART0_IER_CTSMIM_Msk              (0x2UL)                   /*!< UART0 IER: CTSMIM (Bitfield-Mask: 0x01)               */
+#define UART0_IER_TXCMPMIM_Pos            (0UL)                     /*!< UART0 IER: TXCMPMIM (Bit 0)                           */
+#define UART0_IER_TXCMPMIM_Msk            (0x1UL)                   /*!< UART0 IER: TXCMPMIM (Bitfield-Mask: 0x01)             */
+/* ==========================================================  IES  ========================================================== */
+#define UART0_IES_OERIS_Pos               (10UL)                    /*!< UART0 IES: OERIS (Bit 10)                             */
+#define UART0_IES_OERIS_Msk               (0x400UL)                 /*!< UART0 IES: OERIS (Bitfield-Mask: 0x01)                */
+#define UART0_IES_BERIS_Pos               (9UL)                     /*!< UART0 IES: BERIS (Bit 9)                              */
+#define UART0_IES_BERIS_Msk               (0x200UL)                 /*!< UART0 IES: BERIS (Bitfield-Mask: 0x01)                */
+#define UART0_IES_PERIS_Pos               (8UL)                     /*!< UART0 IES: PERIS (Bit 8)                              */
+#define UART0_IES_PERIS_Msk               (0x100UL)                 /*!< UART0 IES: PERIS (Bitfield-Mask: 0x01)                */
+#define UART0_IES_FERIS_Pos               (7UL)                     /*!< UART0 IES: FERIS (Bit 7)                              */
+#define UART0_IES_FERIS_Msk               (0x80UL)                  /*!< UART0 IES: FERIS (Bitfield-Mask: 0x01)                */
+#define UART0_IES_RTRIS_Pos               (6UL)                     /*!< UART0 IES: RTRIS (Bit 6)                              */
+#define UART0_IES_RTRIS_Msk               (0x40UL)                  /*!< UART0 IES: RTRIS (Bitfield-Mask: 0x01)                */
+#define UART0_IES_TXRIS_Pos               (5UL)                     /*!< UART0 IES: TXRIS (Bit 5)                              */
+#define UART0_IES_TXRIS_Msk               (0x20UL)                  /*!< UART0 IES: TXRIS (Bitfield-Mask: 0x01)                */
+#define UART0_IES_RXRIS_Pos               (4UL)                     /*!< UART0 IES: RXRIS (Bit 4)                              */
+#define UART0_IES_RXRIS_Msk               (0x10UL)                  /*!< UART0 IES: RXRIS (Bitfield-Mask: 0x01)                */
+#define UART0_IES_DSRMRIS_Pos             (3UL)                     /*!< UART0 IES: DSRMRIS (Bit 3)                            */
+#define UART0_IES_DSRMRIS_Msk             (0x8UL)                   /*!< UART0 IES: DSRMRIS (Bitfield-Mask: 0x01)              */
+#define UART0_IES_DCDMRIS_Pos             (2UL)                     /*!< UART0 IES: DCDMRIS (Bit 2)                            */
+#define UART0_IES_DCDMRIS_Msk             (0x4UL)                   /*!< UART0 IES: DCDMRIS (Bitfield-Mask: 0x01)              */
+#define UART0_IES_CTSMRIS_Pos             (1UL)                     /*!< UART0 IES: CTSMRIS (Bit 1)                            */
+#define UART0_IES_CTSMRIS_Msk             (0x2UL)                   /*!< UART0 IES: CTSMRIS (Bitfield-Mask: 0x01)              */
+#define UART0_IES_TXCMPMRIS_Pos           (0UL)                     /*!< UART0 IES: TXCMPMRIS (Bit 0)                          */
+#define UART0_IES_TXCMPMRIS_Msk           (0x1UL)                   /*!< UART0 IES: TXCMPMRIS (Bitfield-Mask: 0x01)            */
+/* ==========================================================  MIS  ========================================================== */
+#define UART0_MIS_OEMIS_Pos               (10UL)                    /*!< UART0 MIS: OEMIS (Bit 10)                             */
+#define UART0_MIS_OEMIS_Msk               (0x400UL)                 /*!< UART0 MIS: OEMIS (Bitfield-Mask: 0x01)                */
+#define UART0_MIS_BEMIS_Pos               (9UL)                     /*!< UART0 MIS: BEMIS (Bit 9)                              */
+#define UART0_MIS_BEMIS_Msk               (0x200UL)                 /*!< UART0 MIS: BEMIS (Bitfield-Mask: 0x01)                */
+#define UART0_MIS_PEMIS_Pos               (8UL)                     /*!< UART0 MIS: PEMIS (Bit 8)                              */
+#define UART0_MIS_PEMIS_Msk               (0x100UL)                 /*!< UART0 MIS: PEMIS (Bitfield-Mask: 0x01)                */
+#define UART0_MIS_FEMIS_Pos               (7UL)                     /*!< UART0 MIS: FEMIS (Bit 7)                              */
+#define UART0_MIS_FEMIS_Msk               (0x80UL)                  /*!< UART0 MIS: FEMIS (Bitfield-Mask: 0x01)                */
+#define UART0_MIS_RTMIS_Pos               (6UL)                     /*!< UART0 MIS: RTMIS (Bit 6)                              */
+#define UART0_MIS_RTMIS_Msk               (0x40UL)                  /*!< UART0 MIS: RTMIS (Bitfield-Mask: 0x01)                */
+#define UART0_MIS_TXMIS_Pos               (5UL)                     /*!< UART0 MIS: TXMIS (Bit 5)                              */
+#define UART0_MIS_TXMIS_Msk               (0x20UL)                  /*!< UART0 MIS: TXMIS (Bitfield-Mask: 0x01)                */
+#define UART0_MIS_RXMIS_Pos               (4UL)                     /*!< UART0 MIS: RXMIS (Bit 4)                              */
+#define UART0_MIS_RXMIS_Msk               (0x10UL)                  /*!< UART0 MIS: RXMIS (Bitfield-Mask: 0x01)                */
+#define UART0_MIS_DSRMMIS_Pos             (3UL)                     /*!< UART0 MIS: DSRMMIS (Bit 3)                            */
+#define UART0_MIS_DSRMMIS_Msk             (0x8UL)                   /*!< UART0 MIS: DSRMMIS (Bitfield-Mask: 0x01)              */
+#define UART0_MIS_DCDMMIS_Pos             (2UL)                     /*!< UART0 MIS: DCDMMIS (Bit 2)                            */
+#define UART0_MIS_DCDMMIS_Msk             (0x4UL)                   /*!< UART0 MIS: DCDMMIS (Bitfield-Mask: 0x01)              */
+#define UART0_MIS_CTSMMIS_Pos             (1UL)                     /*!< UART0 MIS: CTSMMIS (Bit 1)                            */
+#define UART0_MIS_CTSMMIS_Msk             (0x2UL)                   /*!< UART0 MIS: CTSMMIS (Bitfield-Mask: 0x01)              */
+#define UART0_MIS_TXCMPMMIS_Pos           (0UL)                     /*!< UART0 MIS: TXCMPMMIS (Bit 0)                          */
+#define UART0_MIS_TXCMPMMIS_Msk           (0x1UL)                   /*!< UART0 MIS: TXCMPMMIS (Bitfield-Mask: 0x01)            */
+/* ==========================================================  IEC  ========================================================== */
+#define UART0_IEC_OEIC_Pos                (10UL)                    /*!< UART0 IEC: OEIC (Bit 10)                              */
+#define UART0_IEC_OEIC_Msk                (0x400UL)                 /*!< UART0 IEC: OEIC (Bitfield-Mask: 0x01)                 */
+#define UART0_IEC_BEIC_Pos                (9UL)                     /*!< UART0 IEC: BEIC (Bit 9)                               */
+#define UART0_IEC_BEIC_Msk                (0x200UL)                 /*!< UART0 IEC: BEIC (Bitfield-Mask: 0x01)                 */
+#define UART0_IEC_PEIC_Pos                (8UL)                     /*!< UART0 IEC: PEIC (Bit 8)                               */
+#define UART0_IEC_PEIC_Msk                (0x100UL)                 /*!< UART0 IEC: PEIC (Bitfield-Mask: 0x01)                 */
+#define UART0_IEC_FEIC_Pos                (7UL)                     /*!< UART0 IEC: FEIC (Bit 7)                               */
+#define UART0_IEC_FEIC_Msk                (0x80UL)                  /*!< UART0 IEC: FEIC (Bitfield-Mask: 0x01)                 */
+#define UART0_IEC_RTIC_Pos                (6UL)                     /*!< UART0 IEC: RTIC (Bit 6)                               */
+#define UART0_IEC_RTIC_Msk                (0x40UL)                  /*!< UART0 IEC: RTIC (Bitfield-Mask: 0x01)                 */
+#define UART0_IEC_TXIC_Pos                (5UL)                     /*!< UART0 IEC: TXIC (Bit 5)                               */
+#define UART0_IEC_TXIC_Msk                (0x20UL)                  /*!< UART0 IEC: TXIC (Bitfield-Mask: 0x01)                 */
+#define UART0_IEC_RXIC_Pos                (4UL)                     /*!< UART0 IEC: RXIC (Bit 4)                               */
+#define UART0_IEC_RXIC_Msk                (0x10UL)                  /*!< UART0 IEC: RXIC (Bitfield-Mask: 0x01)                 */
+#define UART0_IEC_DSRMIC_Pos              (3UL)                     /*!< UART0 IEC: DSRMIC (Bit 3)                             */
+#define UART0_IEC_DSRMIC_Msk              (0x8UL)                   /*!< UART0 IEC: DSRMIC (Bitfield-Mask: 0x01)               */
+#define UART0_IEC_DCDMIC_Pos              (2UL)                     /*!< UART0 IEC: DCDMIC (Bit 2)                             */
+#define UART0_IEC_DCDMIC_Msk              (0x4UL)                   /*!< UART0 IEC: DCDMIC (Bitfield-Mask: 0x01)               */
+#define UART0_IEC_CTSMIC_Pos              (1UL)                     /*!< UART0 IEC: CTSMIC (Bit 1)                             */
+#define UART0_IEC_CTSMIC_Msk              (0x2UL)                   /*!< UART0 IEC: CTSMIC (Bitfield-Mask: 0x01)               */
+#define UART0_IEC_TXCMPMIC_Pos            (0UL)                     /*!< UART0 IEC: TXCMPMIC (Bit 0)                           */
+#define UART0_IEC_TXCMPMIC_Msk            (0x1UL)                   /*!< UART0 IEC: TXCMPMIC (Bitfield-Mask: 0x01)             */
+
+
+/* =========================================================================================================================== */
+/* ================                                           VCOMP                                           ================ */
+/* =========================================================================================================================== */
+
+/* ==========================================================  CFG  ========================================================== */
+#define VCOMP_CFG_LVLSEL_Pos              (16UL)                    /*!< VCOMP CFG: LVLSEL (Bit 16)                            */
+#define VCOMP_CFG_LVLSEL_Msk              (0xf0000UL)               /*!< VCOMP CFG: LVLSEL (Bitfield-Mask: 0x0f)               */
+#define VCOMP_CFG_NSEL_Pos                (8UL)                     /*!< VCOMP CFG: NSEL (Bit 8)                               */
+#define VCOMP_CFG_NSEL_Msk                (0x300UL)                 /*!< VCOMP CFG: NSEL (Bitfield-Mask: 0x03)                 */
+#define VCOMP_CFG_PSEL_Pos                (0UL)                     /*!< VCOMP CFG: PSEL (Bit 0)                               */
+#define VCOMP_CFG_PSEL_Msk                (0x3UL)                   /*!< VCOMP CFG: PSEL (Bitfield-Mask: 0x03)                 */
+/* =========================================================  STAT  ========================================================== */
+#define VCOMP_STAT_PWDSTAT_Pos            (1UL)                     /*!< VCOMP STAT: PWDSTAT (Bit 1)                           */
+#define VCOMP_STAT_PWDSTAT_Msk            (0x2UL)                   /*!< VCOMP STAT: PWDSTAT (Bitfield-Mask: 0x01)             */
+#define VCOMP_STAT_CMPOUT_Pos             (0UL)                     /*!< VCOMP STAT: CMPOUT (Bit 0)                            */
+#define VCOMP_STAT_CMPOUT_Msk             (0x1UL)                   /*!< VCOMP STAT: CMPOUT (Bitfield-Mask: 0x01)              */
+/* ========================================================  PWDKEY  ========================================================= */
+#define VCOMP_PWDKEY_PWDKEY_Pos           (0UL)                     /*!< VCOMP PWDKEY: PWDKEY (Bit 0)                          */
+#define VCOMP_PWDKEY_PWDKEY_Msk           (0xffffffffUL)            /*!< VCOMP PWDKEY: PWDKEY (Bitfield-Mask: 0xffffffff)      */
+/* =========================================================  INTEN  ========================================================= */
+#define VCOMP_INTEN_OUTHI_Pos             (1UL)                     /*!< VCOMP INTEN: OUTHI (Bit 1)                            */
+#define VCOMP_INTEN_OUTHI_Msk             (0x2UL)                   /*!< VCOMP INTEN: OUTHI (Bitfield-Mask: 0x01)              */
+#define VCOMP_INTEN_OUTLOW_Pos            (0UL)                     /*!< VCOMP INTEN: OUTLOW (Bit 0)                           */
+#define VCOMP_INTEN_OUTLOW_Msk            (0x1UL)                   /*!< VCOMP INTEN: OUTLOW (Bitfield-Mask: 0x01)             */
+/* ========================================================  INTSTAT  ======================================================== */
+#define VCOMP_INTSTAT_OUTHI_Pos           (1UL)                     /*!< VCOMP INTSTAT: OUTHI (Bit 1)                          */
+#define VCOMP_INTSTAT_OUTHI_Msk           (0x2UL)                   /*!< VCOMP INTSTAT: OUTHI (Bitfield-Mask: 0x01)            */
+#define VCOMP_INTSTAT_OUTLOW_Pos          (0UL)                     /*!< VCOMP INTSTAT: OUTLOW (Bit 0)                         */
+#define VCOMP_INTSTAT_OUTLOW_Msk          (0x1UL)                   /*!< VCOMP INTSTAT: OUTLOW (Bitfield-Mask: 0x01)           */
+/* ========================================================  INTCLR  ========================================================= */
+#define VCOMP_INTCLR_OUTHI_Pos            (1UL)                     /*!< VCOMP INTCLR: OUTHI (Bit 1)                           */
+#define VCOMP_INTCLR_OUTHI_Msk            (0x2UL)                   /*!< VCOMP INTCLR: OUTHI (Bitfield-Mask: 0x01)             */
+#define VCOMP_INTCLR_OUTLOW_Pos           (0UL)                     /*!< VCOMP INTCLR: OUTLOW (Bit 0)                          */
+#define VCOMP_INTCLR_OUTLOW_Msk           (0x1UL)                   /*!< VCOMP INTCLR: OUTLOW (Bitfield-Mask: 0x01)            */
+/* ========================================================  INTSET  ========================================================= */
+#define VCOMP_INTSET_OUTHI_Pos            (1UL)                     /*!< VCOMP INTSET: OUTHI (Bit 1)                           */
+#define VCOMP_INTSET_OUTHI_Msk            (0x2UL)                   /*!< VCOMP INTSET: OUTHI (Bitfield-Mask: 0x01)             */
+#define VCOMP_INTSET_OUTLOW_Pos           (0UL)                     /*!< VCOMP INTSET: OUTLOW (Bit 0)                          */
+#define VCOMP_INTSET_OUTLOW_Msk           (0x1UL)                   /*!< VCOMP INTSET: OUTLOW (Bitfield-Mask: 0x01)            */
+
+
+/* =========================================================================================================================== */
+/* ================                                            WDT                                            ================ */
+/* =========================================================================================================================== */
+
+/* ==========================================================  CFG  ========================================================== */
+#define WDT_CFG_CLKSEL_Pos                (24UL)                    /*!< WDT CFG: CLKSEL (Bit 24)                              */
+#define WDT_CFG_CLKSEL_Msk                (0x7000000UL)             /*!< WDT CFG: CLKSEL (Bitfield-Mask: 0x07)                 */
+#define WDT_CFG_INTVAL_Pos                (16UL)                    /*!< WDT CFG: INTVAL (Bit 16)                              */
+#define WDT_CFG_INTVAL_Msk                (0xff0000UL)              /*!< WDT CFG: INTVAL (Bitfield-Mask: 0xff)                 */
+#define WDT_CFG_RESVAL_Pos                (8UL)                     /*!< WDT CFG: RESVAL (Bit 8)                               */
+#define WDT_CFG_RESVAL_Msk                (0xff00UL)                /*!< WDT CFG: RESVAL (Bitfield-Mask: 0xff)                 */
+#define WDT_CFG_RESEN_Pos                 (2UL)                     /*!< WDT CFG: RESEN (Bit 2)                                */
+#define WDT_CFG_RESEN_Msk                 (0x4UL)                   /*!< WDT CFG: RESEN (Bitfield-Mask: 0x01)                  */
+#define WDT_CFG_INTEN_Pos                 (1UL)                     /*!< WDT CFG: INTEN (Bit 1)                                */
+#define WDT_CFG_INTEN_Msk                 (0x2UL)                   /*!< WDT CFG: INTEN (Bitfield-Mask: 0x01)                  */
+#define WDT_CFG_WDTEN_Pos                 (0UL)                     /*!< WDT CFG: WDTEN (Bit 0)                                */
+#define WDT_CFG_WDTEN_Msk                 (0x1UL)                   /*!< WDT CFG: WDTEN (Bitfield-Mask: 0x01)                  */
+/* =========================================================  RSTRT  ========================================================= */
+#define WDT_RSTRT_RSTRT_Pos               (0UL)                     /*!< WDT RSTRT: RSTRT (Bit 0)                              */
+#define WDT_RSTRT_RSTRT_Msk               (0xffUL)                  /*!< WDT RSTRT: RSTRT (Bitfield-Mask: 0xff)                */
+/* =========================================================  LOCK  ========================================================== */
+#define WDT_LOCK_LOCK_Pos                 (0UL)                     /*!< WDT LOCK: LOCK (Bit 0)                                */
+#define WDT_LOCK_LOCK_Msk                 (0xffUL)                  /*!< WDT LOCK: LOCK (Bitfield-Mask: 0xff)                  */
+/* =========================================================  COUNT  ========================================================= */
+#define WDT_COUNT_COUNT_Pos               (0UL)                     /*!< WDT COUNT: COUNT (Bit 0)                              */
+#define WDT_COUNT_COUNT_Msk               (0xffUL)                  /*!< WDT COUNT: COUNT (Bitfield-Mask: 0xff)                */
+/* =========================================================  INTEN  ========================================================= */
+#define WDT_INTEN_WDT_Pos                 (0UL)                     /*!< WDT INTEN: WDT (Bit 0)                                */
+#define WDT_INTEN_WDT_Msk                 (0x1UL)                   /*!< WDT INTEN: WDT (Bitfield-Mask: 0x01)                  */
+/* ========================================================  INTSTAT  ======================================================== */
+#define WDT_INTSTAT_WDT_Pos               (0UL)                     /*!< WDT INTSTAT: WDT (Bit 0)                              */
+#define WDT_INTSTAT_WDT_Msk               (0x1UL)                   /*!< WDT INTSTAT: WDT (Bitfield-Mask: 0x01)                */
+/* ========================================================  INTCLR  ========================================================= */
+#define WDT_INTCLR_WDT_Pos                (0UL)                     /*!< WDT INTCLR: WDT (Bit 0)                               */
+#define WDT_INTCLR_WDT_Msk                (0x1UL)                   /*!< WDT INTCLR: WDT (Bitfield-Mask: 0x01)                 */
+/* ========================================================  INTSET  ========================================================= */
+#define WDT_INTSET_WDT_Pos                (0UL)                     /*!< WDT INTSET: WDT (Bit 0)                               */
+#define WDT_INTSET_WDT_Msk                (0x1UL)                   /*!< WDT INTSET: WDT (Bitfield-Mask: 0x01)                 */
+
+
+/* =========================================================================================================================== */
+/* ================                                          CLKGEN                                           ================ */
+/* =========================================================================================================================== */
+
+/* =========================================================  CALXT  ========================================================= */
+#define CLKGEN_CALXT_CALXT_Pos            (0UL)                     /*!< CLKGEN CALXT: CALXT (Bit 0)                           */
+#define CLKGEN_CALXT_CALXT_Msk            (0x7ffUL)                 /*!< CLKGEN CALXT: CALXT (Bitfield-Mask: 0x7ff)            */
+/* =========================================================  CALRC  ========================================================= */
+#define CLKGEN_CALRC_CALRC_Pos            (0UL)                     /*!< CLKGEN CALRC: CALRC (Bit 0)                           */
+#define CLKGEN_CALRC_CALRC_Msk            (0x3ffffUL)               /*!< CLKGEN CALRC: CALRC (Bitfield-Mask: 0x3ffff)          */
+/* ========================================================  ACALCTR  ======================================================== */
+#define CLKGEN_ACALCTR_ACALCTR_Pos        (0UL)                     /*!< CLKGEN ACALCTR: ACALCTR (Bit 0)                       */
+#define CLKGEN_ACALCTR_ACALCTR_Msk        (0xffffffUL)              /*!< CLKGEN ACALCTR: ACALCTR (Bitfield-Mask: 0xffffff)     */
+/* =========================================================  OCTRL  ========================================================= */
+#define CLKGEN_OCTRL_ACAL_Pos             (8UL)                     /*!< CLKGEN OCTRL: ACAL (Bit 8)                            */
+#define CLKGEN_OCTRL_ACAL_Msk             (0x700UL)                 /*!< CLKGEN OCTRL: ACAL (Bitfield-Mask: 0x07)              */
+#define CLKGEN_OCTRL_OSEL_Pos             (7UL)                     /*!< CLKGEN OCTRL: OSEL (Bit 7)                            */
+#define CLKGEN_OCTRL_OSEL_Msk             (0x80UL)                  /*!< CLKGEN OCTRL: OSEL (Bitfield-Mask: 0x01)              */
+#define CLKGEN_OCTRL_FOS_Pos              (6UL)                     /*!< CLKGEN OCTRL: FOS (Bit 6)                             */
+#define CLKGEN_OCTRL_FOS_Msk              (0x40UL)                  /*!< CLKGEN OCTRL: FOS (Bitfield-Mask: 0x01)               */
+#define CLKGEN_OCTRL_STOPRC_Pos           (1UL)                     /*!< CLKGEN OCTRL: STOPRC (Bit 1)                          */
+#define CLKGEN_OCTRL_STOPRC_Msk           (0x2UL)                   /*!< CLKGEN OCTRL: STOPRC (Bitfield-Mask: 0x01)            */
+#define CLKGEN_OCTRL_STOPXT_Pos           (0UL)                     /*!< CLKGEN OCTRL: STOPXT (Bit 0)                          */
+#define CLKGEN_OCTRL_STOPXT_Msk           (0x1UL)                   /*!< CLKGEN OCTRL: STOPXT (Bitfield-Mask: 0x01)            */
+/* ========================================================  CLKOUT  ========================================================= */
+#define CLKGEN_CLKOUT_CKEN_Pos            (7UL)                     /*!< CLKGEN CLKOUT: CKEN (Bit 7)                           */
+#define CLKGEN_CLKOUT_CKEN_Msk            (0x80UL)                  /*!< CLKGEN CLKOUT: CKEN (Bitfield-Mask: 0x01)             */
+#define CLKGEN_CLKOUT_CKSEL_Pos           (0UL)                     /*!< CLKGEN CLKOUT: CKSEL (Bit 0)                          */
+#define CLKGEN_CLKOUT_CKSEL_Msk           (0x3fUL)                  /*!< CLKGEN CLKOUT: CKSEL (Bitfield-Mask: 0x3f)            */
+/* ========================================================  CLKKEY  ========================================================= */
+#define CLKGEN_CLKKEY_CLKKEY_Pos          (0UL)                     /*!< CLKGEN CLKKEY: CLKKEY (Bit 0)                         */
+#define CLKGEN_CLKKEY_CLKKEY_Msk          (0xffffffffUL)            /*!< CLKGEN CLKKEY: CLKKEY (Bitfield-Mask: 0xffffffff)     */
+/* =========================================================  CCTRL  ========================================================= */
+#define CLKGEN_CCTRL_CORESEL_Pos          (0UL)                     /*!< CLKGEN CCTRL: CORESEL (Bit 0)                         */
+#define CLKGEN_CCTRL_CORESEL_Msk          (0x1UL)                   /*!< CLKGEN CCTRL: CORESEL (Bitfield-Mask: 0x01)           */
+/* ========================================================  STATUS  ========================================================= */
+#define CLKGEN_STATUS_OSCF_Pos            (1UL)                     /*!< CLKGEN STATUS: OSCF (Bit 1)                           */
+#define CLKGEN_STATUS_OSCF_Msk            (0x2UL)                   /*!< CLKGEN STATUS: OSCF (Bitfield-Mask: 0x01)             */
+#define CLKGEN_STATUS_OMODE_Pos           (0UL)                     /*!< CLKGEN STATUS: OMODE (Bit 0)                          */
+#define CLKGEN_STATUS_OMODE_Msk           (0x1UL)                   /*!< CLKGEN STATUS: OMODE (Bitfield-Mask: 0x01)            */
+/* =========================================================  HFADJ  ========================================================= */
+#define CLKGEN_HFADJ_HFADJ_GAIN_Pos       (21UL)                    /*!< CLKGEN HFADJ: HFADJ_GAIN (Bit 21)                     */
+#define CLKGEN_HFADJ_HFADJ_GAIN_Msk       (0xe00000UL)              /*!< CLKGEN HFADJ: HFADJ_GAIN (Bitfield-Mask: 0x07)        */
+#define CLKGEN_HFADJ_HFWARMUP_Pos         (20UL)                    /*!< CLKGEN HFADJ: HFWARMUP (Bit 20)                       */
+#define CLKGEN_HFADJ_HFWARMUP_Msk         (0x100000UL)              /*!< CLKGEN HFADJ: HFWARMUP (Bitfield-Mask: 0x01)          */
+#define CLKGEN_HFADJ_HFXTADJ_Pos          (8UL)                     /*!< CLKGEN HFADJ: HFXTADJ (Bit 8)                         */
+#define CLKGEN_HFADJ_HFXTADJ_Msk          (0xfff00UL)               /*!< CLKGEN HFADJ: HFXTADJ (Bitfield-Mask: 0xfff)          */
+#define CLKGEN_HFADJ_HFADJCK_Pos          (1UL)                     /*!< CLKGEN HFADJ: HFADJCK (Bit 1)                         */
+#define CLKGEN_HFADJ_HFADJCK_Msk          (0xeUL)                   /*!< CLKGEN HFADJ: HFADJCK (Bitfield-Mask: 0x07)           */
+#define CLKGEN_HFADJ_HFADJEN_Pos          (0UL)                     /*!< CLKGEN HFADJ: HFADJEN (Bit 0)                         */
+#define CLKGEN_HFADJ_HFADJEN_Msk          (0x1UL)                   /*!< CLKGEN HFADJ: HFADJEN (Bitfield-Mask: 0x01)           */
+/* =========================================================  HFVAL  ========================================================= */
+#define CLKGEN_HFVAL_HFTUNERB_Pos         (0UL)                     /*!< CLKGEN HFVAL: HFTUNERB (Bit 0)                        */
+#define CLKGEN_HFVAL_HFTUNERB_Msk         (0x7ffUL)                 /*!< CLKGEN HFVAL: HFTUNERB (Bitfield-Mask: 0x7ff)         */
+/* ========================================================  CLOCKEN  ======================================================== */
+#define CLKGEN_CLOCKEN_CLOCKEN_Pos        (0UL)                     /*!< CLKGEN CLOCKEN: CLOCKEN (Bit 0)                       */
+#define CLKGEN_CLOCKEN_CLOCKEN_Msk        (0xffffffffUL)            /*!< CLKGEN CLOCKEN: CLOCKEN (Bitfield-Mask: 0xffffffff)   */
+/* =======================================================  CLOCKEN2  ======================================================== */
+#define CLKGEN_CLOCKEN2_CLOCKEN2_Pos      (0UL)                     /*!< CLKGEN CLOCKEN2: CLOCKEN2 (Bit 0)                     */
+#define CLKGEN_CLOCKEN2_CLOCKEN2_Msk      (0xffffffffUL)            /*!< CLKGEN CLOCKEN2: CLOCKEN2 (Bitfield-Mask: 0xffffffff) */
+/* =======================================================  CLOCKEN3  ======================================================== */
+#define CLKGEN_CLOCKEN3_CLOCKEN3_Pos      (0UL)                     /*!< CLKGEN CLOCKEN3: CLOCKEN3 (Bit 0)                     */
+#define CLKGEN_CLOCKEN3_CLOCKEN3_Msk      (0xffffffffUL)            /*!< CLKGEN CLOCKEN3: CLOCKEN3 (Bitfield-Mask: 0xffffffff) */
+/* ========================================================  UARTEN  ========================================================= */
+#define CLKGEN_UARTEN_UART1EN_Pos         (8UL)                     /*!< CLKGEN UARTEN: UART1EN (Bit 8)                        */
+#define CLKGEN_UARTEN_UART1EN_Msk         (0x300UL)                 /*!< CLKGEN UARTEN: UART1EN (Bitfield-Mask: 0x03)          */
+#define CLKGEN_UARTEN_UART0EN_Pos         (0UL)                     /*!< CLKGEN UARTEN: UART0EN (Bit 0)                        */
+#define CLKGEN_UARTEN_UART0EN_Msk         (0x3UL)                   /*!< CLKGEN UARTEN: UART0EN (Bitfield-Mask: 0x03)          */
+/* ========================================================  CTRLOW  ========================================================= */
+#define CLKGEN_CTRLOW_CTRHR_Pos           (24UL)                    /*!< CLKGEN CTRLOW: CTRHR (Bit 24)                         */
+#define CLKGEN_CTRLOW_CTRHR_Msk           (0x3f000000UL)            /*!< CLKGEN CTRLOW: CTRHR (Bitfield-Mask: 0x3f)            */
+#define CLKGEN_CTRLOW_CTRMIN_Pos          (16UL)                    /*!< CLKGEN CTRLOW: CTRMIN (Bit 16)                        */
+#define CLKGEN_CTRLOW_CTRMIN_Msk          (0x7f0000UL)              /*!< CLKGEN CTRLOW: CTRMIN (Bitfield-Mask: 0x7f)           */
+#define CLKGEN_CTRLOW_CTRSEC_Pos          (8UL)                     /*!< CLKGEN CTRLOW: CTRSEC (Bit 8)                         */
+#define CLKGEN_CTRLOW_CTRSEC_Msk          (0x7f00UL)                /*!< CLKGEN CTRLOW: CTRSEC (Bitfield-Mask: 0x7f)           */
+#define CLKGEN_CTRLOW_CTR100_Pos          (0UL)                     /*!< CLKGEN CTRLOW: CTR100 (Bit 0)                         */
+#define CLKGEN_CTRLOW_CTR100_Msk          (0xffUL)                  /*!< CLKGEN CTRLOW: CTR100 (Bitfield-Mask: 0xff)           */
+/* =========================================================  CTRUP  ========================================================= */
+#define CLKGEN_CTRUP_CTERR_Pos            (31UL)                    /*!< CLKGEN CTRUP: CTERR (Bit 31)                          */
+#define CLKGEN_CTRUP_CTERR_Msk            (0x80000000UL)            /*!< CLKGEN CTRUP: CTERR (Bitfield-Mask: 0x01)             */
+#define CLKGEN_CTRUP_CEB_Pos              (28UL)                    /*!< CLKGEN CTRUP: CEB (Bit 28)                            */
+#define CLKGEN_CTRUP_CEB_Msk              (0x10000000UL)            /*!< CLKGEN CTRUP: CEB (Bitfield-Mask: 0x01)               */
+#define CLKGEN_CTRUP_CB_Pos               (27UL)                    /*!< CLKGEN CTRUP: CB (Bit 27)                             */
+#define CLKGEN_CTRUP_CB_Msk               (0x8000000UL)             /*!< CLKGEN CTRUP: CB (Bitfield-Mask: 0x01)                */
+#define CLKGEN_CTRUP_CTRWKDY_Pos          (24UL)                    /*!< CLKGEN CTRUP: CTRWKDY (Bit 24)                        */
+#define CLKGEN_CTRUP_CTRWKDY_Msk          (0x7000000UL)             /*!< CLKGEN CTRUP: CTRWKDY (Bitfield-Mask: 0x07)           */
+#define CLKGEN_CTRUP_CTRYR_Pos            (16UL)                    /*!< CLKGEN CTRUP: CTRYR (Bit 16)                          */
+#define CLKGEN_CTRUP_CTRYR_Msk            (0xff0000UL)              /*!< CLKGEN CTRUP: CTRYR (Bitfield-Mask: 0xff)             */
+#define CLKGEN_CTRUP_CTRMO_Pos            (8UL)                     /*!< CLKGEN CTRUP: CTRMO (Bit 8)                           */
+#define CLKGEN_CTRUP_CTRMO_Msk            (0x1f00UL)                /*!< CLKGEN CTRUP: CTRMO (Bitfield-Mask: 0x1f)             */
+#define CLKGEN_CTRUP_CTRDATE_Pos          (0UL)                     /*!< CLKGEN CTRUP: CTRDATE (Bit 0)                         */
+#define CLKGEN_CTRUP_CTRDATE_Msk          (0x3fUL)                  /*!< CLKGEN CTRUP: CTRDATE (Bitfield-Mask: 0x3f)           */
+/* ========================================================  ALMLOW  ========================================================= */
+#define CLKGEN_ALMLOW_ALMHR_Pos           (24UL)                    /*!< CLKGEN ALMLOW: ALMHR (Bit 24)                         */
+#define CLKGEN_ALMLOW_ALMHR_Msk           (0x3f000000UL)            /*!< CLKGEN ALMLOW: ALMHR (Bitfield-Mask: 0x3f)            */
+#define CLKGEN_ALMLOW_ALMMIN_Pos          (16UL)                    /*!< CLKGEN ALMLOW: ALMMIN (Bit 16)                        */
+#define CLKGEN_ALMLOW_ALMMIN_Msk          (0x7f0000UL)              /*!< CLKGEN ALMLOW: ALMMIN (Bitfield-Mask: 0x7f)           */
+#define CLKGEN_ALMLOW_ALMSEC_Pos          (8UL)                     /*!< CLKGEN ALMLOW: ALMSEC (Bit 8)                         */
+#define CLKGEN_ALMLOW_ALMSEC_Msk          (0x7f00UL)                /*!< CLKGEN ALMLOW: ALMSEC (Bitfield-Mask: 0x7f)           */
+#define CLKGEN_ALMLOW_ALM100_Pos          (0UL)                     /*!< CLKGEN ALMLOW: ALM100 (Bit 0)                         */
+#define CLKGEN_ALMLOW_ALM100_Msk          (0xffUL)                  /*!< CLKGEN ALMLOW: ALM100 (Bitfield-Mask: 0xff)           */
+/* =========================================================  ALMUP  ========================================================= */
+#define CLKGEN_ALMUP_ALMWKDY_Pos          (16UL)                    /*!< CLKGEN ALMUP: ALMWKDY (Bit 16)                        */
+#define CLKGEN_ALMUP_ALMWKDY_Msk          (0x70000UL)               /*!< CLKGEN ALMUP: ALMWKDY (Bitfield-Mask: 0x07)           */
+#define CLKGEN_ALMUP_ALMMO_Pos            (8UL)                     /*!< CLKGEN ALMUP: ALMMO (Bit 8)                           */
+#define CLKGEN_ALMUP_ALMMO_Msk            (0x1f00UL)                /*!< CLKGEN ALMUP: ALMMO (Bitfield-Mask: 0x1f)             */
+#define CLKGEN_ALMUP_ALMDATE_Pos          (0UL)                     /*!< CLKGEN ALMUP: ALMDATE (Bit 0)                         */
+#define CLKGEN_ALMUP_ALMDATE_Msk          (0x3fUL)                  /*!< CLKGEN ALMUP: ALMDATE (Bitfield-Mask: 0x3f)           */
+/* ========================================================  RTCCTL  ========================================================= */
+#define CLKGEN_RTCCTL_HR1224_Pos          (5UL)                     /*!< CLKGEN RTCCTL: HR1224 (Bit 5)                         */
+#define CLKGEN_RTCCTL_HR1224_Msk          (0x20UL)                  /*!< CLKGEN RTCCTL: HR1224 (Bitfield-Mask: 0x01)           */
+#define CLKGEN_RTCCTL_RSTOP_Pos           (4UL)                     /*!< CLKGEN RTCCTL: RSTOP (Bit 4)                          */
+#define CLKGEN_RTCCTL_RSTOP_Msk           (0x10UL)                  /*!< CLKGEN RTCCTL: RSTOP (Bitfield-Mask: 0x01)            */
+#define CLKGEN_RTCCTL_RPT_Pos             (1UL)                     /*!< CLKGEN RTCCTL: RPT (Bit 1)                            */
+#define CLKGEN_RTCCTL_RPT_Msk             (0xeUL)                   /*!< CLKGEN RTCCTL: RPT (Bitfield-Mask: 0x07)              */
+#define CLKGEN_RTCCTL_WRTC_Pos            (0UL)                     /*!< CLKGEN RTCCTL: WRTC (Bit 0)                           */
+#define CLKGEN_RTCCTL_WRTC_Msk            (0x1UL)                   /*!< CLKGEN RTCCTL: WRTC (Bitfield-Mask: 0x01)             */
+/* =========================================================  INTEN  ========================================================= */
+#define CLKGEN_INTEN_ALM_Pos              (3UL)                     /*!< CLKGEN INTEN: ALM (Bit 3)                             */
+#define CLKGEN_INTEN_ALM_Msk              (0x8UL)                   /*!< CLKGEN INTEN: ALM (Bitfield-Mask: 0x01)               */
+#define CLKGEN_INTEN_OF_Pos               (2UL)                     /*!< CLKGEN INTEN: OF (Bit 2)                              */
+#define CLKGEN_INTEN_OF_Msk               (0x4UL)                   /*!< CLKGEN INTEN: OF (Bitfield-Mask: 0x01)                */
+#define CLKGEN_INTEN_ACC_Pos              (1UL)                     /*!< CLKGEN INTEN: ACC (Bit 1)                             */
+#define CLKGEN_INTEN_ACC_Msk              (0x2UL)                   /*!< CLKGEN INTEN: ACC (Bitfield-Mask: 0x01)               */
+#define CLKGEN_INTEN_ACF_Pos              (0UL)                     /*!< CLKGEN INTEN: ACF (Bit 0)                             */
+#define CLKGEN_INTEN_ACF_Msk              (0x1UL)                   /*!< CLKGEN INTEN: ACF (Bitfield-Mask: 0x01)               */
+/* ========================================================  INTSTAT  ======================================================== */
+#define CLKGEN_INTSTAT_ALM_Pos            (3UL)                     /*!< CLKGEN INTSTAT: ALM (Bit 3)                           */
+#define CLKGEN_INTSTAT_ALM_Msk            (0x8UL)                   /*!< CLKGEN INTSTAT: ALM (Bitfield-Mask: 0x01)             */
+#define CLKGEN_INTSTAT_OF_Pos             (2UL)                     /*!< CLKGEN INTSTAT: OF (Bit 2)                            */
+#define CLKGEN_INTSTAT_OF_Msk             (0x4UL)                   /*!< CLKGEN INTSTAT: OF (Bitfield-Mask: 0x01)              */
+#define CLKGEN_INTSTAT_ACC_Pos            (1UL)                     /*!< CLKGEN INTSTAT: ACC (Bit 1)                           */
+#define CLKGEN_INTSTAT_ACC_Msk            (0x2UL)                   /*!< CLKGEN INTSTAT: ACC (Bitfield-Mask: 0x01)             */
+#define CLKGEN_INTSTAT_ACF_Pos            (0UL)                     /*!< CLKGEN INTSTAT: ACF (Bit 0)                           */
+#define CLKGEN_INTSTAT_ACF_Msk            (0x1UL)                   /*!< CLKGEN INTSTAT: ACF (Bitfield-Mask: 0x01)             */
+/* ========================================================  INTCLR  ========================================================= */
+#define CLKGEN_INTCLR_ALM_Pos             (3UL)                     /*!< CLKGEN INTCLR: ALM (Bit 3)                            */
+#define CLKGEN_INTCLR_ALM_Msk             (0x8UL)                   /*!< CLKGEN INTCLR: ALM (Bitfield-Mask: 0x01)              */
+#define CLKGEN_INTCLR_OF_Pos              (2UL)                     /*!< CLKGEN INTCLR: OF (Bit 2)                             */
+#define CLKGEN_INTCLR_OF_Msk              (0x4UL)                   /*!< CLKGEN INTCLR: OF (Bitfield-Mask: 0x01)               */
+#define CLKGEN_INTCLR_ACC_Pos             (1UL)                     /*!< CLKGEN INTCLR: ACC (Bit 1)                            */
+#define CLKGEN_INTCLR_ACC_Msk             (0x2UL)                   /*!< CLKGEN INTCLR: ACC (Bitfield-Mask: 0x01)              */
+#define CLKGEN_INTCLR_ACF_Pos             (0UL)                     /*!< CLKGEN INTCLR: ACF (Bit 0)                            */
+#define CLKGEN_INTCLR_ACF_Msk             (0x1UL)                   /*!< CLKGEN INTCLR: ACF (Bitfield-Mask: 0x01)              */
+/* ========================================================  INTSET  ========================================================= */
+#define CLKGEN_INTSET_ALM_Pos             (3UL)                     /*!< CLKGEN INTSET: ALM (Bit 3)                            */
+#define CLKGEN_INTSET_ALM_Msk             (0x8UL)                   /*!< CLKGEN INTSET: ALM (Bitfield-Mask: 0x01)              */
+#define CLKGEN_INTSET_OF_Pos              (2UL)                     /*!< CLKGEN INTSET: OF (Bit 2)                             */
+#define CLKGEN_INTSET_OF_Msk              (0x4UL)                   /*!< CLKGEN INTSET: OF (Bitfield-Mask: 0x01)               */
+#define CLKGEN_INTSET_ACC_Pos             (1UL)                     /*!< CLKGEN INTSET: ACC (Bit 1)                            */
+#define CLKGEN_INTSET_ACC_Msk             (0x2UL)                   /*!< CLKGEN INTSET: ACC (Bitfield-Mask: 0x01)              */
+#define CLKGEN_INTSET_ACF_Pos             (0UL)                     /*!< CLKGEN INTSET: ACF (Bit 0)                            */
+#define CLKGEN_INTSET_ACF_Msk             (0x1UL)                   /*!< CLKGEN INTSET: ACF (Bitfield-Mask: 0x01)              */
+
+/** @} */ /* End of group PosMask_peripherals */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* APOLLO2_H */
+
+
+/** @} */ /* End of group apollo2 */
+
+/** @} */ /* End of group Ambiq Micro */
diff --git a/hw/mcu/ambiq/apollo2/include/mcu/cortex_m4.h b/hw/mcu/ambiq/apollo2/include/mcu/cortex_m4.h
new file mode 100644
index 000000000..1d391786b
--- /dev/null
+++ b/hw/mcu/ambiq/apollo2/include/mcu/cortex_m4.h
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef __MCU_CORTEX_M4_H__
+#define __MCU_CORTEX_M4_H__
+
+#include "syscfg/syscfg.h"
+
+#include "mcu/apollo2.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define OS_TICKS_PER_SEC    (1000)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __MCU_CORTEX_M4_H__ */
diff --git a/hw/mcu/ambiq/apollo2/include/mcu/hal_apollo2.h b/hw/mcu/ambiq/apollo2/include/mcu/hal_apollo2.h
new file mode 100644
index 000000000..5da8c4257
--- /dev/null
+++ b/hw/mcu/ambiq/apollo2/include/mcu/hal_apollo2.h
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef __HAL_APOLLO2_H_
+#define __HAL_APOLLO2_H__
+
+#include "syscfg/syscfg.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct hal_flash;
+extern const struct hal_flash apollo2_flash_dev;
+
+struct apollo2_uart_cfg {
+    uint8_t suc_pin_tx;
+    uint8_t suc_pin_rx;
+    uint8_t suc_pin_rts;
+    uint8_t suc_pin_cts;
+};
+
+/* SPI configuration (used for both master and slave) */
+struct apollo2_spi_cfg {
+    uint8_t sck_pin;
+    uint8_t mosi_pin;
+    uint8_t miso_pin;
+    uint8_t ss_pin;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __HAL_APOLLO2_H__ */
diff --git a/hw/mcu/ambiq/apollo2/include/mcu/system_apollo2.h b/hw/mcu/ambiq/apollo2/include/mcu/system_apollo2.h
new file mode 100644
index 000000000..5a26a1a1a
--- /dev/null
+++ b/hw/mcu/ambiq/apollo2/include/mcu/system_apollo2.h
@@ -0,0 +1,80 @@
+//*****************************************************************************
+//
+//! @file system_apollo2.h
+//!
+//! @brief Ambiq Micro Apollo2 MCU specific functions.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+//*****************************************************************************
+
+#ifndef SYSTEM_APOLLO2_H
+#define SYSTEM_APOLLO2_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+extern uint32_t SystemCoreClock;     // System Clock Frequency (Core Clock)
+
+//*****************************************************************************
+//
+// External function definitions
+//
+//*****************************************************************************
+extern void SystemInit (void);
+extern void SystemCoreClockUpdate (void);
+
+/* Helper functions to enable/disable interrupts. */
+#define __HAL_DISABLE_INTERRUPTS(x)                     \
+    do {                                                \
+        x = __get_PRIMASK();                            \
+        __disable_irq();                                \
+    } while(0);
+
+#define __HAL_ENABLE_INTERRUPTS(x)                      \
+    do {                                                \
+        if (!x) {                                       \
+            __enable_irq();                             \
+        }                                               \
+    } while(0);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  // SYSTEM_APOLLO2_H
+
diff --git a/hw/mcu/ambiq/apollo2/pkg.yml b/hw/mcu/ambiq/apollo2/pkg.yml
new file mode 100644
index 000000000..df339b976
--- /dev/null
+++ b/hw/mcu/ambiq/apollo2/pkg.yml
@@ -0,0 +1,32 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+pkg.name: hw/mcu/ambiq/apollo2
+pkg.description: MCU definition for Ambiq Apollo MCUs
+pkg.author: "Apache Mynewt <de...@mynewt.incubator.apache.org>"
+pkg.homepage: "http://mynewt.apache.org/"
+pkg.keywords:
+    - ambiq
+    - apollo2
+
+pkg.deps:
+    - hw/hal
+    - hw/mcu/ambiq 
+    - hw/cmsis-core
+    - compiler/arm-none-eabi-m4 
diff --git a/hw/mcu/ambiq/apollo2/src/hal_flash.c b/hw/mcu/ambiq/apollo2/src/hal_flash.c
new file mode 100644
index 000000000..73c93ac01
--- /dev/null
+++ b/hw/mcu/ambiq/apollo2/src/hal_flash.c
@@ -0,0 +1,204 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <assert.h>
+#include <string.h>
+#include <os/os.h>
+#include <am_hal_flash.h>
+#include <hal/hal_flash_int.h>
+#include <hal/hal_flash.h>
+#include <mcu/system_apollo2.h>
+
+
+static int
+apollo2_flash_read(const struct hal_flash *dev, uint32_t address, void *dst,
+    uint32_t num_bytes);
+static int
+apollo2_flash_write(const struct hal_flash *dev, uint32_t address,
+        const void *src, uint32_t num_bytes);
+static int
+apollo2_flash_erase_sector(const struct hal_flash *dev, uint32_t sector_addr);
+static int
+apollo2_flash_sector_info(const struct hal_flash *dev, int idx, uint32_t *addr,
+    uint32_t *sz);
+static int
+apollo2_flash_init(const struct hal_flash *dev);
+
+static const struct hal_flash_funcs apollo2_flash_funcs = {
+    .hff_read = apollo2_flash_read,
+    .hff_write = apollo2_flash_write,
+    .hff_erase_sector = apollo2_flash_erase_sector,
+    .hff_sector_info = apollo2_flash_sector_info,
+    .hff_init = apollo2_flash_init
+};
+
+const struct hal_flash apollo2_flash_dev = {
+        .hf_itf = &apollo2_flash_funcs,
+        .hf_base_addr = 0x00000000,
+        .hf_size = 1024 * 1024,
+        .hf_sector_cnt = 128,
+        .hf_align = 1
+};
+
+static int
+apollo2_flash_read(const struct hal_flash *dev, uint32_t address, void *dst,
+    uint32_t num_bytes)
+{
+    memcpy(dst, (void *) address, num_bytes);
+
+    return (0);
+}
+
+static int
+apollo2_flash_write_odd(const struct hal_flash *dev, uint32_t address,
+                        const void *src, uint32_t num_bytes)
+{
+    uint32_t *base;
+    uint32_t word;
+    uint8_t *u8p;
+    int offset;
+    int rc;
+
+    offset = address % 4;
+    assert(offset + num_bytes <= 4);
+
+    base = (uint32_t *)(address - offset);
+    word = *base;
+
+    u8p = (uint8_t *)&word;
+    u8p += offset;
+    memcpy(u8p, src, num_bytes);
+
+    rc = am_hal_flash_program_main(AM_HAL_FLASH_PROGRAM_KEY, &word,
+                                   base, 1);
+    return rc;
+}
+
+static int
+apollo2_flash_write(const struct hal_flash *dev, uint32_t address,
+    const void *src, uint32_t num_bytes)
+{
+    const uint8_t *u8p;
+    int lead_size;
+    int lead_off;
+    int words;
+    int sr;
+    int remainder;
+    int rc;
+    int i;
+
+    __HAL_DISABLE_INTERRUPTS(sr);
+
+    u8p = src;
+
+    /* Write leading partial word, if any. */
+    lead_off = address % 4;
+    if (lead_off != 0) {
+        lead_size = 4 - lead_off;
+        if (lead_size > num_bytes) {
+            lead_size = num_bytes;
+        }
+
+        rc = apollo2_flash_write_odd(dev, address, u8p, lead_size);
+        if (rc != 0) {
+            goto done;
+        }
+
+        u8p += lead_size;
+        num_bytes -= lead_size;
+        address += lead_size;
+    }
+
+    if (num_bytes == 0) {
+        rc = 0;
+        goto done;
+    }
+
+    /* Write aligned words in the middle. */
+    words = num_bytes / 4;
+    if ((uint32_t)u8p % 4 == 0) {
+        rc = am_hal_flash_program_main(AM_HAL_FLASH_PROGRAM_KEY,
+                                       (uint32_t *)u8p, (uint32_t *)address,
+                                       words);
+        if (rc != 0) {
+            goto done;
+        }
+    } else {
+        for (i = 0; i < words; i++) {
+            rc = apollo2_flash_write_odd(dev, address + i * 4, u8p + i * 4, 4);
+            if (rc != 0) {
+                goto done;
+            }
+        }
+    }
+
+    /* Write trailing partial word, if any. */
+    remainder = num_bytes - (words * 4);
+    if (remainder > 0) {
+        rc = apollo2_flash_write_odd(dev,
+                                     address + num_bytes - remainder,
+                                     u8p + num_bytes - remainder,
+                                     remainder);
+        if (rc != 0) {
+            goto done;
+        }
+    }
+
+    rc = 0;
+
+done:
+    __HAL_ENABLE_INTERRUPTS(sr);
+    return rc;
+}
+
+static int
+apollo2_flash_erase_sector(const struct hal_flash *dev, uint32_t sector_addr)
+{
+    uint32_t inst;
+    uint32_t page;
+    int rc;
+
+    inst = AM_HAL_FLASH_ADDR2INST(sector_addr);
+    page = AM_HAL_FLASH_ADDR2PAGE(sector_addr);
+
+    rc = am_hal_flash_page_erase(AM_HAL_FLASH_PROGRAM_KEY, inst, page);
+    if (rc != 0) {
+        goto err;
+    }
+
+    return (0);
+err:
+    return (rc);
+}
+
+static int
+apollo2_flash_sector_info(const struct hal_flash *dev, int idx, uint32_t *addr,
+    uint32_t *sz)
+{
+    *addr = idx * AM_HAL_FLASH_PAGE_SIZE;
+    *sz = AM_HAL_FLASH_PAGE_SIZE;
+
+    return (0);
+}
+
+static int
+apollo2_flash_init(const struct hal_flash *dev)
+{
+    return (0);
+}
diff --git a/hw/mcu/ambiq/apollo2/src/hal_gpio.c b/hw/mcu/ambiq/apollo2/src/hal_gpio.c
new file mode 100644
index 000000000..8e70bb65f
--- /dev/null
+++ b/hw/mcu/ambiq/apollo2/src/hal_gpio.c
@@ -0,0 +1,245 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <assert.h>
+#include <os/os.h>
+#include "hal/hal_gpio.h"
+#include "mcu/apollo2.h"
+#include "bsp/cmsis_nvic.h"
+#include "os/os_trace_api.h"
+#include "defs/error.h"
+#include "am_mcu_apollo.h"
+#include "am_hal_pin.h"
+#include "am_hal_gpio.h"
+
+/* GPIO interrupts */
+#define HAL_GPIO_MAX_IRQ        8
+
+/* Storage for GPIO callbacks. */
+struct hal_gpio_irq {
+    int pin_num;
+    hal_gpio_irq_handler_t func;
+    void *arg;
+};
+
+static struct hal_gpio_irq hal_gpio_irqs[HAL_GPIO_MAX_IRQ];
+
+int
+hal_gpio_init_in(int pin, hal_gpio_pull_t pull)
+{
+    uint32_t cfg;
+
+    cfg = AM_HAL_PIN_INPUT;
+
+    switch (pull)  {
+        case HAL_GPIO_PULL_UP:
+            cfg |= AM_HAL_GPIO_PULLUP;
+            break;
+        default:
+            break;
+    }
+    am_hal_gpio_pin_config(pin, cfg);
+
+    return (0);
+}
+
+int
+hal_gpio_init_out(int pin, int val)
+{
+    am_hal_gpio_pin_config(pin, AM_HAL_GPIO_OUTPUT);
+    hal_gpio_write(pin, val);
+
+    return (0);
+}
+
+
+void
+hal_gpio_write(int pin, int val)
+{
+    if (val) {
+        am_hal_gpio_out_bit_set(pin);
+    } else {
+        am_hal_gpio_out_bit_clear(pin);
+    }
+}
+
+int
+hal_gpio_read(int pin)
+{
+    int state;
+
+    state = am_hal_gpio_input_bit_read(pin);
+
+    return state;
+}
+
+int
+hal_gpio_toggle(int pin)
+{
+    am_hal_gpio_out_bit_toggle(pin);
+
+    return (0);
+}
+
+/*
+ * GPIO irq handler
+ *
+ * Handles the gpio interrupt attached to a gpio pin.
+ *
+ * @param index
+ */
+static void
+hal_gpio_irq_handler(void)
+{
+    const struct hal_gpio_irq *irq;
+    uint64_t status;
+    int i;
+
+    os_trace_enter_isr();
+
+    /* Read and clear the GPIO interrupt status. */
+    status = am_hal_gpio_int_status_get(false);
+    am_hal_gpio_int_clear(status);
+
+    for (i = 0; i < HAL_GPIO_MAX_IRQ; i++) {
+        irq = hal_gpio_irqs + i;
+        if (irq->func != NULL) {
+            if (status & AM_HAL_GPIO_BIT(irq->pin_num)) {
+                irq->func(irq->arg);
+            }
+        }
+    }
+
+    os_trace_exit_isr();
+}
+
+/*
+ * Register IRQ handler for GPIOTE, and enable it.
+ * Only executed once, during first registration.
+ */
+static void
+hal_gpio_irq_setup(void)
+{
+    static uint8_t irq_setup;
+
+    if (!irq_setup) {
+        NVIC_SetVector(GPIO_IRQn, (uint32_t)hal_gpio_irq_handler);
+        NVIC_SetPriority(GPIO_IRQn, (1 << __NVIC_PRIO_BITS) - 1);
+        NVIC_ClearPendingIRQ(GPIO_IRQn);
+        NVIC_EnableIRQ(GPIO_IRQn);
+        irq_setup = 1;
+    }
+}
+
+/*
+ * Find out whether we have an GPIOTE pin event to use.
+ */
+static int
+hal_gpio_find_empty_slot(void)
+{
+    int i;
+
+    for (i = 0; i < HAL_GPIO_MAX_IRQ; i++) {
+        if (hal_gpio_irqs[i].func == NULL) {
+            return i;
+        }
+    }
+    return -1;
+}
+
+static int
+hal_gpio_sdk_trig(hal_gpio_irq_trig_t trig)
+{
+    switch (trig) {
+        case HAL_GPIO_TRIG_FALLING: return AM_HAL_GPIO_FALLING;
+        case HAL_GPIO_TRIG_RISING:  return AM_HAL_GPIO_RISING;
+        default:                    return -1;
+    }
+}
+
+/**
+ * gpio irq init
+ *
+ * Initialize an external interrupt on a gpio pin
+ *
+ * @param pin       Pin number to enable gpio.
+ * @param handler   Interrupt handler
+ * @param arg       Argument to pass to interrupt handler
+ * @param trig      Trigger mode of interrupt
+ * @param pull      Push/pull mode of input.
+ *
+ * @return int
+ */
+int
+hal_gpio_irq_init(int pin, hal_gpio_irq_handler_t handler, void *arg,
+                  hal_gpio_irq_trig_t trig, hal_gpio_pull_t pull)
+{
+    int sdk_trig;
+    int slot;
+
+    sdk_trig = hal_gpio_sdk_trig(trig);
+    if (sdk_trig == -1) {
+        return SYS_EINVAL;
+    }
+
+    slot = hal_gpio_find_empty_slot();
+    if (slot < 0) {
+        return SYS_ENOMEM;
+    }
+    hal_gpio_init_in(pin, pull);
+
+    am_hal_gpio_int_polarity_bit_set(pin, sdk_trig);
+    am_hal_gpio_int_clear(AM_HAL_GPIO_BIT(pin));
+    am_hal_gpio_int_enable(AM_HAL_GPIO_BIT(pin));
+
+    hal_gpio_irqs[slot].pin_num = pin;
+    hal_gpio_irqs[slot].func = handler;
+    hal_gpio_irqs[slot].arg = arg;
+
+    hal_gpio_irq_setup();
+
+    return 0;
+}
+
+/**
+ * gpio irq release
+ *
+ * No longer interrupt when something occurs on the pin. NOTE: this function
+ * does not change the GPIO push/pull setting.
+ * It also does not disable the NVIC interrupt enable setting for the irq.
+ *
+ * @param pin
+ */
+void
+hal_gpio_irq_release(int pin)
+{
+    /* XXX: Unimplemented. */
+}
+
+void
+hal_gpio_irq_enable(int pin)
+{
+    am_hal_gpio_int_enable(AM_HAL_GPIO_BIT(pin));
+}
+
+void
+hal_gpio_irq_disable(int pin)
+{
+    am_hal_gpio_int_disable(AM_HAL_GPIO_BIT(pin));
+}
diff --git a/hw/mcu/ambiq/apollo2/src/hal_os_tick.c b/hw/mcu/ambiq/apollo2/src/hal_os_tick.c
new file mode 100644
index 000000000..d786d6911
--- /dev/null
+++ b/hw/mcu/ambiq/apollo2/src/hal_os_tick.c
@@ -0,0 +1,47 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <assert.h>
+#include <os/os.h>
+#include <mcu/system_apollo2.h>
+#include <hal/hal_os_tick.h>
+
+/*
+ * XXX implement tickless mode.
+ */
+void
+os_tick_idle(os_time_t ticks)
+{
+    OS_ASSERT_CRITICAL();
+    __DSB();
+}
+
+void
+os_tick_init(uint32_t os_ticks_per_sec, int prio)
+{
+    uint32_t reload_val;
+
+    reload_val = ((uint64_t) SystemCoreClock / os_ticks_per_sec) - 1;
+
+    SysTick->LOAD = reload_val;
+    SysTick->VAL = 0;
+    SysTick->CTRL = 0x0007;
+
+    NVIC_SetPriority(SysTick_IRQn, prio);
+}
diff --git a/hw/mcu/ambiq/apollo2/src/hal_spi.c b/hw/mcu/ambiq/apollo2/src/hal_spi.c
new file mode 100644
index 000000000..d2f9bb95b
--- /dev/null
+++ b/hw/mcu/ambiq/apollo2/src/hal_spi.c
@@ -0,0 +1,1035 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+#include <string.h>
+#include <errno.h>
+#include <assert.h>
+#include <stdbool.h>
+#include "syscfg/syscfg.h"
+#include "hal/hal_spi.h"
+#include "mcu/hal_apollo2.h"
+#include "bsp/cmsis_nvic.h"
+#include "defs/error.h"
+
+#include "am_mcu_apollo.h"
+
+/* Prevent CMSIS from breaking apollo2 macros. */
+#undef GPIO
+#undef IOSLAVE
+#undef CLKGEN
+
+#define SPI_0_ENABLED (MYNEWT_VAL(SPI_0_MASTER) || MYNEWT_VAL(SPI_0_SLAVE))
+#define SPI_1_ENABLED (MYNEWT_VAL(SPI_1_MASTER) || MYNEWT_VAL(SPI_1_SLAVE))
+#define SPI_2_ENABLED (MYNEWT_VAL(SPI_2_MASTER) || MYNEWT_VAL(SPI_2_SLAVE))
+#define SPI_3_ENABLED (MYNEWT_VAL(SPI_3_MASTER) || MYNEWT_VAL(SPI_3_SLAVE))
+#define SPI_4_ENABLED (MYNEWT_VAL(SPI_4_MASTER) || MYNEWT_VAL(SPI_4_SLAVE))
+#define SPI_5_ENABLED (MYNEWT_VAL(SPI_5_MASTER) || MYNEWT_VAL(SPI_5_SLAVE))
+
+#define SPI_ANY_ENABLED (       \
+    SPI_0_ENABLED ||            \
+    SPI_1_ENABLED ||            \
+    SPI_2_ENABLED ||            \
+    SPI_3_ENABLED ||            \
+    SPI_4_ENABLED ||            \
+    SPI_5_ENABLED)
+
+#if SPI_ANY_ENABLED
+
+#define SPI_N_MASTER (          \
+    MYNEWT_VAL(SPI_0_MASTER) || \
+    MYNEWT_VAL(SPI_1_MASTER) || \
+    MYNEWT_VAL(SPI_2_MASTER) || \
+    MYNEWT_VAL(SPI_3_MASTER) || \
+    MYNEWT_VAL(SPI_4_MASTER) || \
+    MYNEWT_VAL(SPI_5_MASTER))
+
+#define SPI_N_SLAVE (           \
+    MYNEWT_VAL(SPI_0_SLAVE) ||  \
+    MYNEWT_VAL(SPI_1_SLAVE) ||  \
+    MYNEWT_VAL(SPI_2_SLAVE) ||  \
+    MYNEWT_VAL(SPI_3_SLAVE) ||  \
+    MYNEWT_VAL(SPI_4_SLAVE) ||  \
+    MYNEWT_VAL(SPI_5_SLAVE))
+
+#define APOLLO2_SPI_MAX_CHUNK_SZ    64
+#define APOLLO2_SPI_MAX_CHUNK_WORDS (APOLLO2_SPI_MAX_CHUNK_SZ / 4)
+#define APOLLO2_SPI_MAX_TXR_SZ      4095
+
+#define APOLLO2_SPI_OP_NONE         0
+#define APOLLO2_SPI_OP_BLOCKING     1
+#define APOLLO2_SPI_OP_NONBLOCKING  2
+
+/* IRQ handler type */
+typedef void apollo2_spi_irq_handler(void);
+
+struct apollo2_spi {
+    volatile uint8_t op;
+
+    const uint8_t *txbuf;
+    uint8_t *rxbuf;
+    int buf_num_bytes;
+    int buf_off;
+    uint32_t interrupts;
+    uint16_t buf_len;
+    uint8_t prev_num_bytes;
+    uint8_t spi_num;
+    uint8_t spi_type;
+
+    uint8_t enabled:1;
+
+    hal_spi_txrx_cb txrx_cb_func;
+    void *txrx_cb_arg;
+};
+
+static void apollo2_spi_service_master(struct apollo2_spi *spi,
+                                       uint32_t status);
+
+static uint32_t apollo2_spi_fifo[APOLLO2_SPI_MAX_CHUNK_WORDS];
+
+#if SPI_0_ENABLED
+static struct apollo2_spi apollo2_spi0;
+#endif
+#if SPI_1_ENABLED
+static struct apollo2_spi apollo2_spi1;
+#endif
+#if SPI_2_ENABLED
+static struct apollo2_spi apollo2_spi2;
+#endif
+#if SPI_3_ENABLED
+static struct apollo2_spi apollo2_spi3;
+#endif
+#if SPI_4_ENABLED
+static struct apollo2_spi apollo2_spi4;
+#endif
+#if SPI_5_ENABLED
+static struct apollo2_spi apollo2_spi5;
+#endif
+
+static uint32_t
+apollo2_spi_data_mode_to_ios(int spi_mode)
+{
+    switch (spi_mode) {
+        case HAL_SPI_MODE0:     return AM_HAL_IOS_SPIMODE_0;
+        case HAL_SPI_MODE1:     return AM_HAL_IOS_SPIMODE_1;
+        case HAL_SPI_MODE2:     return AM_HAL_IOS_SPIMODE_2;
+        case HAL_SPI_MODE3:     return AM_HAL_IOS_SPIMODE_3;
+        default:                return -1;
+    }
+}
+
+static struct apollo2_spi *
+apollo2_spi_resolve(int spi_num)
+{
+    switch (spi_num) {
+#if SPI_0_ENABLED
+    case 0:
+        return &apollo2_spi0;
+#endif
+#if SPI_1_ENABLED
+    case 1:
+        return &apollo2_spi1;
+#endif
+#if SPI_2_ENABLED
+    case 2:
+        return &apollo2_spi2;
+#endif
+#if SPI_3_ENABLED
+    case 3:
+        return &apollo2_spi3;
+#endif
+#if SPI_4_ENABLED
+    case 4:
+        return &apollo2_spi4;
+#endif
+#if SPI_5_ENABLED
+    case 5:
+        return &apollo2_spi5;
+#endif
+    default:
+        return NULL;
+    }
+}
+
+static int
+apollo2_spi_fifo_count(int spi_num)
+{
+    return AM_BFRn(IOMSTR, spi_num, FIFOPTR, FIFOSIZ);
+}
+
+static int
+apollo2_spi_fifo_space(int spi_num)
+{
+    return APOLLO2_SPI_MAX_CHUNK_SZ - apollo2_spi_fifo_count(spi_num);
+}
+
+static void
+apollo2_spi_block_until_idle(const struct apollo2_spi *spi)
+{
+    while (spi->op != APOLLO2_SPI_OP_NONE) { }
+}
+
+static void
+apollo2_spi_clear_ints(int spi_num)
+{
+    AM_REGn(IOMSTR, spi_num, INTCLR) = 0xffffffff;
+}
+
+static void
+apollo2_spi_disable_ints(struct apollo2_spi *spi)
+{
+    /* Remember currently-enabled interrupts. */
+    assert(spi->interrupts == 0);
+    spi->interrupts = AM_REGn(IOMSTR, spi->spi_num, INTEN);
+
+    /* Disable interrupts. */
+    AM_REGn(IOMSTR, spi->spi_num, INTEN) = 0;
+}
+
+static void
+apollo2_spi_reenable_ints(struct apollo2_spi *spi)
+{
+    AM_REGn(IOMSTR, spi->spi_num, INTEN) = spi->interrupts;
+    spi->interrupts = 0;
+}
+
+static uint32_t
+apollo2_spi_status(int spi_num)
+{
+    uint32_t status;
+
+    status = AM_REGn(IOMSTR, spi_num, INTSTAT);
+    apollo2_spi_clear_ints(spi_num);
+
+    return status;
+}
+
+static void
+apollo2_spi_irqh_x(int spi_num)
+{
+    struct apollo2_spi *spi;
+    uint32_t status;
+
+    status = apollo2_spi_status(spi_num);
+
+    spi = apollo2_spi_resolve(spi_num);
+    assert(spi != NULL);
+
+    switch (spi->spi_type) {
+    case HAL_SPI_TYPE_MASTER:
+        apollo2_spi_service_master(spi, status);
+        break;
+
+    case HAL_SPI_TYPE_SLAVE:
+        /* XXX: Slave unimplemented. */
+        break;
+
+    default:
+        assert(0);
+        break;
+    }
+}
+
+#if SPI_0_ENABLED
+static void apollo2_spi_irqh_0(void) { apollo2_spi_irqh_x(0); }
+#endif
+#if SPI_1_ENABLED
+static void apollo2_spi_irqh_1(void) { apollo2_spi_irqh_x(1); }
+#endif
+#if SPI_2_ENABLED
+static void apollo2_spi_irqh_2(void) { apollo2_spi_irqh_x(2); }
+#endif
+#if SPI_3_ENABLED
+static void apollo2_spi_irqh_3(void) { apollo2_spi_irqh_x(3); }
+#endif
+#if SPI_4_ENABLED
+static void apollo2_spi_irqh_4(void) { apollo2_spi_irqh_x(4); }
+#endif
+#if SPI_5_ENABLED
+static void apollo2_spi_irqh_5(void) { apollo2_spi_irqh_x(5); }
+#endif
+
+static int
+apollo2_spi_irq_info(int spi_num, int *out_irq_num,
+                     apollo2_spi_irq_handler **out_irqh)
+{
+    switch (spi_num) {
+#if SPI_0_ENABLED
+    case 0:
+        *out_irq_num = IOMSTR0_IRQn;
+        *out_irqh = apollo2_spi_irqh_0;
+        return 0;
+#endif
+#if SPI_1_ENABLED
+    case 1:
+        *out_irq_num = IOMSTR1_IRQn;
+        *out_irqh = apollo2_spi_irqh_1;
+        return 0;
+#endif
+#if SPI_2_ENABLED
+    case 2:
+        *out_irq_num = IOMSTR2_IRQn;
+        *out_irqh = apollo2_spi_irqh_2;
+        return 0;
+#endif
+#if SPI_3_ENABLED
+    case 3:
+        *out_irq_num = IOMSTR3_IRQn;
+        *out_irqh = apollo2_spi_irqh_3;
+        return 0;
+#endif
+#if SPI_4_ENABLED
+    case 4:
+        *out_irq_num = IOMSTR4_IRQn;
+        *out_irqh = apollo2_spi_irqh_4;
+        return 0;
+#endif
+#if SPI_5_ENABLED
+    case 5:
+        *out_irq_num = IOMSTR5_IRQn;
+        *out_irqh = apollo2_spi_irqh_5;
+        return 0;
+#endif
+    default:
+        return SYS_EINVAL;
+    }
+}
+
+static int
+hal_spi_config_master(int spi_num, const struct hal_spi_settings *settings)
+{
+    am_hal_iom_config_t sdk_config;
+    int cpol;
+    int cpha;
+    int rc;
+
+    if (spi_num < 0 || spi_num >= AM_REG_IOMSTR_NUM_MODULES) {
+        return SYS_EINVAL;
+    }
+
+    rc = hal_spi_data_mode_breakout(settings->data_mode, &cpol, &cpha);
+    if (rc != 0) {
+        return SYS_EINVAL;
+    }
+
+    am_hal_iom_pwrctrl_enable(spi_num);
+
+    sdk_config.ui32InterfaceMode =
+        AM_HAL_IOM_SPIMODE | AM_REG_IOMSTR_CFG_FULLDUP_FULLDUP;
+    sdk_config.ui32ClockFrequency = settings->baudrate;
+    sdk_config.bSPHA = cpha;
+    sdk_config.bSPOL = cpol;
+    sdk_config.ui8WriteThreshold = 4;
+    sdk_config.ui8ReadThreshold = 60;
+    am_hal_iom_config(spi_num, &sdk_config);
+
+    return 0;
+}
+
+static int
+hal_spi_config_slave(int spi_num, const struct hal_spi_settings *settings)
+{
+    uint32_t ios_data_mode;
+    uint32_t cfg;
+
+    cfg = AM_REG_IOSLAVE_FIFOCFG_ROBASE(0x78 >> 3);
+    cfg |= AM_REG_IOSLAVE_FIFOCFG_FIFOBASE(0x80 >> 3);
+    cfg |= AM_REG_IOSLAVE_FIFOCFG_FIFOMAX(0x100 >> 3);
+
+    ios_data_mode = apollo2_spi_data_mode_to_ios(settings->data_mode);
+
+    AM_REG(IOSLAVE, CFG) = ios_data_mode;
+    AM_REG(IOSLAVE, FIFOCFG) = cfg;
+    return 0;
+}
+
+/*  | spi:cfg   | sck   | miso  | mosi  |
+ *  |-----------+-------+-------+-------|
+ *  | 0:1       | 5     | 6     | 7     |
+ *  | 1:1       | 8     | 9     | 10    |
+ *  | 2:5       | 0     | 2     | 1     |
+ *  | 2:5       | 27    | 28    | 25    |
+ *  | 3:5       | 42    | 43    | 38    |
+ *  | 4:5       | 39    | 40    | 44    |
+ *  | 5:5       | 48    | 49    | 47    |
+ */
+static int
+hal_spi_pin_config_master(int spi_num, const struct apollo2_spi_cfg *pins)
+{
+    const uint8_t miso = pins->miso_pin;
+    const uint8_t mosi = pins->mosi_pin;
+    const uint8_t sck = pins->sck_pin;
+
+    switch (spi_num) {
+#if SPI_0_ENABLED
+    case 0:
+        if (sck == 5 && miso == 6 && mosi == 7) {
+            return 1;
+        } else {
+            return -1;
+        }
+#endif
+#if SPI_1_ENABLED
+    case 1:
+        if (sck == 8 && miso == 9 && mosi == 10) {
+            return 1;
+        } else {
+            return -1;
+        }
+#endif
+#if SPI_2_ENABLED
+    case 2:
+        if (sck == 0 && miso == 2 && mosi == 1) {
+            return 5;
+        } else if (sck == 27 && miso == 28 && mosi == 25) {
+            return 5;
+        } else {
+            return -1;
+        }
+#endif
+#if SPI_3_ENABLED
+    case 3:
+        if (sck == 42 && miso == 43 && mosi == 38) {
+            return 5;
+        } else {
+            return -1;
+        }
+#endif
+#if SPI_4_ENABLED
+    case 4:
+        if (sck == 39 && miso == 40 && mosi == 44) {
+            return 5;
+        } else {
+            return -1;
+        }
+#endif
+#if SPI_5_ENABLED
+    case 5:
+        if (sck == 48 && miso == 49 && mosi == 47) {
+            return 5;
+        } else {
+            return -1;
+        }
+#endif
+    default:
+        return -1;
+    }
+}
+
+static int
+hal_spi_pin_config(int spi_num, int master, const struct apollo2_spi_cfg *pins)
+{
+    if (master) {
+        return hal_spi_pin_config_master(spi_num, pins);
+    } else {
+        return -1;
+    }
+}
+
+static int
+hal_spi_init_master(int spi_num, const struct apollo2_spi_cfg *cfg)
+{
+    apollo2_spi_irq_handler *irqh;
+    struct apollo2_spi *spi;
+    int pin_cfg;
+    int irq_num;
+    int rc;
+
+    spi = apollo2_spi_resolve(spi_num);
+    if (spi == NULL) {
+        return SYS_EINVAL;
+    }
+
+    pin_cfg = hal_spi_pin_config(spi_num, 1, cfg);
+    if (pin_cfg == -1) {
+        return SYS_EINVAL;
+    }
+
+    am_hal_gpio_pin_config(
+        cfg->sck_pin, AM_HAL_GPIO_FUNC(pin_cfg) | AM_HAL_PIN_DIR_INPUT);
+    am_hal_gpio_pin_config(
+        cfg->miso_pin, AM_HAL_GPIO_FUNC(pin_cfg) | AM_HAL_PIN_DIR_INPUT);
+    am_hal_gpio_pin_config(
+        cfg->mosi_pin, AM_HAL_GPIO_FUNC(pin_cfg));
+
+    memset(spi, 0, sizeof *spi);
+    spi->spi_num = spi_num;
+    spi->spi_type = HAL_SPI_TYPE_MASTER;
+
+    rc = apollo2_spi_irq_info(spi_num, &irq_num, &irqh);
+    if (rc != 0) {
+        return rc;
+    }
+
+    NVIC_SetVector(irq_num, (uint32_t)irqh);
+    NVIC_SetPriority(irq_num, (1 << __NVIC_PRIO_BITS) - 1);
+    NVIC_ClearPendingIRQ(irq_num);
+    NVIC_EnableIRQ(irq_num);
+
+    return 0;
+}
+
+static int
+hal_spi_init_slave(int spi_num, struct apollo2_spi_cfg *cfg)
+{
+    return SYS_ERANGE;
+}
+
+/**
+ * Initialize the SPI, given by spi_num.
+ *
+ * @param spi_num The number of the SPI to initialize
+ * @param cfg HW/MCU specific configuration,
+ *            passed to the underlying implementation, providing extra
+ *            configuration.
+ * @param spi_type SPI type (master or slave)
+ *
+ * @return int 0 on success, non-zero error code on failure.
+ */
+int
+hal_spi_init(int spi_num, void *cfg, uint8_t spi_type)
+{
+    int rc;
+
+    if (cfg == NULL) {
+        return SYS_EINVAL;
+    }
+
+    switch (spi_type) {
+    case HAL_SPI_TYPE_MASTER:
+        rc = hal_spi_init_master(spi_num, cfg);
+        if (rc != 0) {
+            return rc;
+        }
+        break;
+
+    case HAL_SPI_TYPE_SLAVE:
+        rc = hal_spi_init_slave(spi_num, cfg);
+        if (rc != 0) {
+            return rc;
+        }
+        break;
+
+    default:
+        return SYS_EINVAL;
+    }
+
+    return 0;
+}
+
+/**
+ * Configure the spi. Must be called after the spi is initialized (after
+ * hal_spi_init is called) and when the spi is disabled (user must call
+ * hal_spi_disable if the spi has been enabled through hal_spi_enable prior
+ * to calling this function). Can also be used to reconfigure an initialized
+ * SPI (assuming it is disabled as described previously).
+ *
+ * @param spi_num The number of the SPI to configure.
+ * @param psettings The settings to configure this SPI with
+ *
+ * @return int 0 on success, non-zero error code on failure.
+ */
+int
+hal_spi_config(int spi_num, struct hal_spi_settings *settings)
+{
+    const struct apollo2_spi *spi;
+    int rc;
+
+    spi = apollo2_spi_resolve(spi_num);
+    if (spi == NULL) {
+        return SYS_EINVAL;
+    }
+
+    if (spi->spi_type == HAL_SPI_TYPE_MASTER) {
+        rc = hal_spi_config_master(spi_num, settings);
+    } else {
+        rc = hal_spi_config_slave(spi_num, settings);
+    }
+
+    return rc;
+}
+
+/**
+ * Enables the SPI. This does not start a transmit or receive operation;
+ * it is used for power mgmt. Cannot be called when a SPI transfer is in
+ * progress.
+ *
+ * @param spi_num
+ *
+ * @return int 0 on success, non-zero error code on failure.
+ */
+int
+hal_spi_enable(int spi_num)
+{
+    struct apollo2_spi *spi;
+
+    spi = apollo2_spi_resolve(spi_num);
+    if (spi == NULL) {
+        return SYS_EINVAL;
+    }
+
+    if (spi->enabled) {
+        return SYS_EBUSY;
+    }
+
+    switch (spi->spi_type) {
+    case HAL_SPI_TYPE_MASTER:
+        AM_REGn(IOMSTR, spi_num, CFG) |= AM_REG_IOMSTR_CFG_IFCEN(1);
+        AM_REGn(IOMSTR, spi_num, INTEN) = 0xffffffff;
+
+        if (spi_num == 0) {
+            AM_REGn(GPIO, 0, PADKEY) = AM_REG_GPIO_PADKEY_KEYVAL;
+            AM_BFW(GPIO, PADREGB, PAD5INPEN, 1);
+            AM_BFW(GPIO, PADREGB, PAD6INPEN, 1);
+            AM_REGn(GPIO, 0, PADKEY) = 0;
+        } else {
+            AM_REGn(GPIO, 0, PADKEY) = AM_REG_GPIO_PADKEY_KEYVAL;
+            AM_BFW(GPIO, PADREGC, PAD8INPEN, 1);
+            AM_BFW(GPIO, PADREGC, PAD9INPEN, 1);
+            AM_REGn(GPIO, 0, PADKEY) = 0;
+        }
+        break;
+
+    case HAL_SPI_TYPE_SLAVE:
+        AM_REGn(IOSLAVE, spi_num, CFG) |= AM_REG_IOSLAVE_CFG_IFCEN(1);
+        break;
+
+    default:
+        return SYS_EINVAL;
+    }
+
+    spi->enabled = 1;
+    return 0;
+}
+
+/**
+ * Disables the SPI. Used for power mgmt. It will halt any current SPI transfers
+ * in progress.
+ *
+ * @param spi_num
+ *
+ * @return int 0 on success, non-zero error code on failure.
+ */
+int
+hal_spi_disable(int spi_num)
+{
+    struct apollo2_spi *spi;
+
+    spi = apollo2_spi_resolve(spi_num);
+    if (spi == NULL) {
+        return SYS_EINVAL;
+    }
+
+    switch (spi->spi_type) {
+    case HAL_SPI_TYPE_MASTER:
+        apollo2_spi_block_until_idle(spi);
+        AM_REGn(IOMSTR, spi_num, CFG) &= ~AM_REG_IOMSTR_CFG_IFCEN(1);
+        spi->enabled = 0;
+        return 0;
+
+    case HAL_SPI_TYPE_SLAVE:
+        AM_REGn(IOSLAVE, spi_num, CFG) &= ~AM_REG_IOSLAVE_CFG_IFCEN(1);
+        return 0;
+
+    default:
+        return SYS_EINVAL;
+    }
+}
+
+static void
+apollo2_spi_fifo_read(struct apollo2_spi *spi, void *rx_data, int num_bytes)
+{
+    int num_words;
+    int i;
+
+    num_words = (num_bytes + 3) / 4;
+    for (i = 0; i < num_words; i++) {
+        apollo2_spi_fifo[i] = AM_REGn(IOMSTR, spi->spi_num, FIFO);
+    }
+
+    if (rx_data != NULL) {
+        memcpy(rx_data, apollo2_spi_fifo, num_bytes);
+    }
+}
+
+static void
+apollo2_spi_fifo_write(struct apollo2_spi *spi,
+                       const void *tx_data, int num_bytes)
+{
+    uint32_t word;
+    int num_words;
+    int i;
+
+    assert(num_bytes != 0);
+
+    memcpy(apollo2_spi_fifo, tx_data, num_bytes);
+
+    num_words = (num_bytes + 3) / 4;
+    for (i = 0; i < num_words; i++) {
+        if (tx_data == NULL) {
+            word = 0;
+        } else {
+            word = apollo2_spi_fifo[i];
+        }
+        AM_REGn(IOMSTR, spi->spi_num, FIFO) = word;
+    }
+}
+
+static int
+apollo2_spi_next_chunk_sz(int buf_sz, int off, int fifo_space)
+{
+    int bytes_left;
+
+    bytes_left = buf_sz - off;
+    if (bytes_left > fifo_space) {
+        return fifo_space;
+    } else {
+        return bytes_left;
+    }
+}
+
+static int
+apollo2_spi_tx_next_chunk(struct apollo2_spi *spi)
+{
+    int fifo_space;
+    int chunk_sz;
+
+    fifo_space = apollo2_spi_fifo_space(spi->spi_num);
+    chunk_sz = apollo2_spi_next_chunk_sz(spi->buf_num_bytes, spi->buf_off,
+                                         fifo_space);
+    if (chunk_sz <= 0) {
+        return 0;
+    }
+
+    apollo2_spi_clear_ints(spi->spi_num);
+
+    apollo2_spi_fifo_write(spi, spi->txbuf + spi->buf_off, chunk_sz);
+    spi->prev_num_bytes = chunk_sz;
+
+    return SYS_EAGAIN;
+}
+
+static uint32_t
+apollo2_spi_cmd_build(uint16_t num_bytes, uint8_t channel)
+{
+    return 0x40000000  /* Raw write. */     |
+           (num_bytes & 0xF00) << 15        |
+           (num_bytes & 0xFF)               |
+           channel << 16;
+}
+
+static void
+apollo2_spi_tx_first_chunk(struct apollo2_spi *spi)
+{
+    uint32_t cmd;
+
+    apollo2_spi_tx_next_chunk(spi);
+
+    cmd = apollo2_spi_cmd_build(spi->buf_num_bytes, 0);
+    apollo2_spi_disable_ints(spi);
+    AM_REGn(IOMSTR, spi->spi_num, CMD) = cmd;
+    apollo2_spi_reenable_ints(spi);
+}
+
+static void
+apollo2_spi_service_master(struct apollo2_spi *spi, uint32_t status)
+{
+    uint8_t prev_op;
+    int rc;
+
+    if (spi->op == APOLLO2_SPI_OP_NONE) {
+        /* Spurious interrupt or programming error. */
+        return;
+    }
+
+    /* Copy received data. */
+    apollo2_spi_fifo_read(spi, spi->rxbuf + spi->buf_off, spi->prev_num_bytes);
+    spi->buf_off += spi->prev_num_bytes;
+
+    assert(spi->buf_off <= spi->buf_num_bytes);
+
+    if (!(status & AM_HAL_IOM_INT_THR)) {
+        /* Error or command complete. */
+
+        prev_op = spi->op;
+        spi->op = APOLLO2_SPI_OP_NONE;
+
+        if (prev_op == APOLLO2_SPI_OP_NONBLOCKING) {
+            spi->txrx_cb_func(spi->txrx_cb_arg, spi->buf_off);
+        }
+
+        return;
+    }
+
+    /* Transmit next chunk. */
+    rc = apollo2_spi_tx_next_chunk(spi);
+    assert(rc == 0);
+}
+
+static int
+apollo2_spi_txrx_begin(struct apollo2_spi *spi, uint8_t op,
+                       const void *tx_data, void *rx_data, int num_bytes)
+{
+    if (spi->op != APOLLO2_SPI_OP_NONE) {
+        return SYS_EBUSY;
+    }
+
+    if (num_bytes <= 0 || num_bytes > APOLLO2_SPI_MAX_TXR_SZ) {
+        return SYS_EINVAL;
+    }
+
+    spi->op = op;
+    spi->txbuf = tx_data;
+    spi->rxbuf = rx_data;
+    spi->buf_num_bytes = num_bytes;
+    spi->buf_off = 0;
+
+    apollo2_spi_tx_first_chunk(spi);
+    return 0;
+}
+
+static int
+apollo2_spi_txrx_blocking(struct apollo2_spi *spi,
+                          const void *tx_data, void *rx_data, int num_bytes)
+{
+    int rc;
+
+    rc = apollo2_spi_txrx_begin(spi, APOLLO2_SPI_OP_BLOCKING,
+                                tx_data, rx_data, num_bytes);
+    if (rc != 0) {
+        return rc;
+    }
+
+    apollo2_spi_block_until_idle(spi);
+
+    return 0;
+}
+
+/**
+ * Blocking call to send a value on the SPI. Returns the value received from
+ * the SPI slave.
+ *
+ * MASTER: Sends the value and returns the received value from the slave.
+ * SLAVE: Invalid API. Returns 0xFFFF
+ *
+ * @param spi_num   Spi interface to use
+ * @param val       Value to send
+ *
+ * @return uint16_t Value received on SPI interface from slave. Returns 0xFFFF
+ * if called when the SPI is configured to be a slave
+ */
+uint16_t
+hal_spi_tx_val(int spi_num, uint16_t val)
+{
+    struct apollo2_spi *spi;
+    uint8_t tx_data;
+    uint8_t rx_data;
+    int rc;
+
+    spi = apollo2_spi_resolve(spi_num);
+    if (spi == NULL) {
+        return 0xffff;
+    }
+
+    switch (spi->spi_type) {
+    case HAL_SPI_TYPE_MASTER:
+        tx_data = val;
+        rc = apollo2_spi_txrx_blocking(spi, &tx_data, &rx_data, 1);
+        if (rc == 0) {
+            return rx_data;
+        } else {
+            return 0xffff;
+        }
+
+    case HAL_SPI_TYPE_SLAVE:
+        return 0xffff;
+
+    default:
+        return 0xffff;
+    }
+}
+
+/**
+ * Sets the txrx callback (executed at interrupt context) when the
+ * buffer is transferred by the master or the slave using the non-blocking API.
+ * Cannot be called when the spi is enabled. This callback will also be called
+ * when chip select is de-asserted on the slave.
+ *
+ * NOTE: This callback is only used for the non-blocking interface and must
+ * be called prior to using the non-blocking API.
+ *
+ * @param spi_num   SPI interface on which to set callback
+ * @param txrx      Callback function
+ * @param arg       Argument to be passed to callback function
+ *
+ * @return int 0 on success, non-zero error code on failure.
+ */
+int
+hal_spi_set_txrx_cb(int spi_num, hal_spi_txrx_cb txrx_cb, void *arg)
+{
+    struct apollo2_spi *spi;
+
+    spi = apollo2_spi_resolve(spi_num);
+    if (spi == NULL) {
+        return SYS_EINVAL;
+    }
+
+    if (spi->enabled) {
+        return SYS_EBUSY;
+    }
+
+    spi->txrx_cb_func = txrx_cb;
+    spi->txrx_cb_arg = arg;
+
+    return 0;
+}
+
+/**
+ * Blocking interface to send a buffer and store the received values from the
+ * slave. The transmit and receive buffers are either arrays of 8-bit (uint8_t)
+ * values or 16-bit values depending on whether the spi is configured for 8 bit
+ * data or more than 8 bits per value. The 'cnt' parameter is the number of
+ * 8-bit or 16-bit values. Thus, if 'cnt' is 10, txbuf/rxbuf would point to an
+ * array of size 10 (in bytes) if the SPI is using 8-bit data; otherwise
+ * txbuf/rxbuf would point to an array of size 20 bytes (ten, uint16_t values).
+ *
+ * NOTE: these buffers are in the native endian-ness of the platform.
+ *
+ *     MASTER: master sends all the values in the buffer and stores the
+ *             stores the values in the receive buffer if rxbuf is not NULL.
+ *             The txbuf parameter cannot be NULL.
+ *     SLAVE: cannot be called for a slave; returns -1
+ *
+ * @param spi_num   SPI interface to use
+ * @param txbuf     Pointer to buffer where values to transmit are stored.
+ * @param rxbuf     Pointer to buffer to store values received from peer.
+ * @param cnt       Number of 8-bit or 16-bit values to be transferred.
+ *
+ * @return int 0 on success, non-zero error code on failure.
+ */
+int
+hal_spi_txrx(int spi_num, void *txbuf, void *rxbuf, int num_bytes)
+{
+    struct apollo2_spi *spi;
+    int rc;
+
+    spi = apollo2_spi_resolve(spi_num);
+    if (spi == NULL) {
+        return SYS_EINVAL;
+    }
+
+    rc = apollo2_spi_txrx_blocking(spi, txbuf, rxbuf, num_bytes);
+    return rc;
+}
+
+/**
+ * Non-blocking interface to send a buffer and store received values. Can be
+ * used for both master and slave SPI types. The user must configure the
+ * callback (using hal_spi_set_txrx_cb); the txrx callback is executed at
+ * interrupt context when the buffer is sent.
+ *
+ * The transmit and receive buffers are either arrays of 8-bit (uint8_t)
+ * values or 16-bit values depending on whether the spi is configured for 8 bit
+ * data or more than 8 bits per value. The 'cnt' parameter is the number of
+ * 8-bit or 16-bit values. Thus, if 'cnt' is 10, txbuf/rxbuf would point to an
+ * array of size 10 (in bytes) if the SPI is using 8-bit data; otherwise
+ * txbuf/rxbuf would point to an array of size 20 bytes (ten, uint16_t values).
+ *
+ * NOTE: these buffers are in the native endian-ness of the platform.
+ *
+ *     MASTER: master sends all the values in the buffer and stores the
+ *             stores the values in the receive buffer if rxbuf is not NULL.
+ *             The txbuf parameter cannot be NULL
+ *     SLAVE: Slave "preloads" the data to be sent to the master (values
+ *            stored in txbuf) and places received data from master in rxbuf
+ *            (if not NULL). The txrx callback occurs when len values are
+ *            transferred or master de-asserts chip select. If txbuf is NULL,
+ *            the slave transfers its default byte. Both rxbuf and txbuf cannot
+ *            be NULL.
+ *
+ * @param spi_num   SPI interface to use
+ * @param txbuf     Pointer to buffer where values to transmit are stored.
+ * @param rxbuf     Pointer to buffer to store values received from peer.
+ * @param num_bytes Number of 8-bit values to be transferred.
+ *
+ * @return int 0 on success, non-zero error code on failure.
+ */
+int
+hal_spi_txrx_noblock(int spi_num, void *txbuf, void *rxbuf, int num_bytes)
+{
+    struct apollo2_spi *spi;
+    int rc;
+
+    spi = apollo2_spi_resolve(spi_num);
+    if (spi == NULL) {
+        return SYS_EINVAL;
+    }
+
+    if (spi->txrx_cb_func == NULL) {
+        return SYS_ENOENT;
+    }
+
+    if (spi->op != APOLLO2_SPI_OP_NONE) {
+        return SYS_EBUSY;
+    }
+
+    switch (spi->spi_type) {
+    case HAL_SPI_TYPE_MASTER:
+        rc = apollo2_spi_txrx_begin(spi, APOLLO2_SPI_OP_NONBLOCKING,
+                                    txbuf, rxbuf, num_bytes);
+        return rc;
+
+    case HAL_SPI_TYPE_SLAVE:
+        spi->txbuf = txbuf;
+        spi->rxbuf = rxbuf;
+        spi->op = APOLLO2_SPI_OP_NONBLOCKING;
+        return 0;
+
+    default:
+        return SYS_EINVAL;
+    }
+}
+
+/**
+ * Sets the default value transferred by the slave. Not valid for master
+ *
+ * @param spi_num SPI interface to use
+ *
+ * @return int 0 on success, non-zero error code on failure.
+ */
+int
+hal_spi_slave_set_def_tx_val(int spi_num, uint16_t val)
+{
+    return SYS_ERANGE;
+}
+
+/**
+ * This aborts the current transfer but keeps the spi enabled.
+ *
+ * @param spi_num   SPI interface on which transfer should be aborted.
+ *
+ * @return int 0 on success, non-zero error code on failure.
+ *
+ * NOTE: does not return an error if no transfer was in progress.
+ */
+int
+hal_spi_abort(int spi_num)
+{
+    return SYS_ERANGE;
+}
+
+#endif /* SPI_ANY_ENABLED */
diff --git a/hw/mcu/ambiq/apollo2/src/hal_system.c b/hw/mcu/ambiq/apollo2/src/hal_system.c
new file mode 100644
index 000000000..b0b0fccf9
--- /dev/null
+++ b/hw/mcu/ambiq/apollo2/src/hal_system.c
@@ -0,0 +1,58 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <stdint.h>
+#include "mcu/cortex_m4.h"
+#include "hal/hal_system.h"
+#include "am_mcu_apollo.h"
+
+am_hal_mcuctrl_device_t adevinfo;
+
+void
+hal_system_init(void)
+{
+}
+
+void
+hal_system_reset(void)
+{
+    while (1) {
+        if (hal_debugger_connected()) {
+            /*
+             * If debugger is attached, breakpoint here.
+             */
+            asm("bkpt");
+        }
+        NVIC_SystemReset();
+    }
+}
+
+enum hal_reset_reason
+hal_reset_cause(void)
+{
+    enum hal_reset_reason reason = 0;
+    return (reason);
+}
+
+int
+hal_debugger_connected(void)
+{
+    /* XXX: Unimplemented. */
+    return 0;
+}
diff --git a/hw/mcu/ambiq/apollo2/src/hal_system_start.c b/hw/mcu/ambiq/apollo2/src/hal_system_start.c
new file mode 100644
index 000000000..0011289fa
--- /dev/null
+++ b/hw/mcu/ambiq/apollo2/src/hal_system_start.c
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <assert.h>
+#include <stddef.h>
+#include <inttypes.h>
+#include <mcu/cortex_m4.h>
+
+/**
+ * Boots the image described by the supplied image header.
+ *
+ * @param hdr                   The header for the image to boot.
+ */
+void
+hal_system_start(void *img_start)
+{
+    typedef void jump_fn(void);
+
+    uint32_t base0entry;
+    uint32_t jump_addr;
+    jump_fn *fn;
+
+    /* First word contains initial MSP value. */
+    __set_MSP(*(uint32_t *)img_start);
+
+    /* Second word contains address of entry point (Reset_Handler). */
+    base0entry = *(uint32_t *)(img_start + 4);
+    jump_addr = base0entry;
+    fn = (jump_fn *)jump_addr;
+
+    /* Jump to image. */
+    fn();
+}
diff --git a/hw/mcu/ambiq/apollo2/src/hal_uart.c b/hw/mcu/ambiq/apollo2/src/hal_uart.c
new file mode 100644
index 000000000..fe2384575
--- /dev/null
+++ b/hw/mcu/ambiq/apollo2/src/hal_uart.c
@@ -0,0 +1,532 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <assert.h>
+#include <inttypes.h>
+#include "mcu/hal_apollo2.h"
+#include "defs/error.h"
+#include "hal/hal_uart.h"
+#include "bsp/cmsis_nvic.h"
+#include "bsp/bsp.h"
+#include "os/os_trace_api.h"
+
+#include "am_mcu_apollo.h"
+
+/* Prevent CMSIS from breaking apollo2 macros. */
+#undef UART
+
+/* IRQ handler type */
+typedef void apollo2_uart_irqh_t(void);
+
+/*
+ * Only one UART on Ambiq Apollo 1
+ */
+struct apollo2_uart {
+    uint8_t u_open:1;
+    uint8_t u_rx_stall:1;
+    uint8_t u_tx_started:1;
+    uint8_t u_rx_buf;
+    uint8_t u_tx_buf[1];
+    hal_uart_rx_char u_rx_func;
+    hal_uart_tx_char u_tx_func;
+    hal_uart_tx_done u_tx_done;
+    void *u_func_arg;
+};
+static struct apollo2_uart uarts[UART_CNT];
+
+static inline void
+apollo2_uart_enable_tx_irq(void)
+{
+    AM_REGn(UART, 0, IER) |= (AM_REG_UART_IER_TXIM_M);
+}
+
+static inline void
+apollo2_uart_disable_tx_irq(void)
+{
+    AM_REGn(UART, 0, IER) &= ~(AM_REG_UART_IER_TXIM_M);
+}
+
+static inline void
+apollo2_uart_enable_rx_irq(void)
+{
+    AM_REGn(UART, 0, IER) |= (AM_REG_UART_IER_RTIM_M |
+            AM_REG_UART_IER_RXIM_M);
+}
+
+static inline void
+apollo2_uart_disable_rx_irq(void)
+{
+    AM_REGn(UART, 0, IER) &= ~(AM_REG_UART_IER_RTIM_M |
+            AM_REG_UART_IER_RXIM_M);
+}
+
+int
+hal_uart_init_cbs(int port, hal_uart_tx_char tx_func, hal_uart_tx_done tx_done,
+  hal_uart_rx_char rx_func, void *arg)
+{
+    struct apollo2_uart *u;
+
+    if (port >= UART_CNT) {
+        return -1;
+    }
+
+    u = &uarts[port];
+    if (u->u_open) {
+        return -1;
+    }
+
+    u->u_rx_func = rx_func;
+    u->u_tx_func = tx_func;
+    u->u_tx_done = tx_done;
+    u->u_func_arg = arg;
+
+    return 0;
+}
+
+void
+hal_uart_start_tx(int port)
+{
+    struct apollo2_uart *u;
+    os_sr_t sr;
+    int data;
+
+    if (port >= UART_CNT) {
+        return;
+    }
+
+    u = &uarts[port];
+    if (!u->u_open) {
+        return;
+    }
+
+    OS_ENTER_CRITICAL(sr);
+    if (u->u_tx_started == 0) {
+        while (1) {
+            if (AM_BFRn(UART, 0, FR, TXFF)) {
+                u->u_tx_started = 1;
+                apollo2_uart_enable_tx_irq();
+                break;
+            }
+
+            data = u->u_tx_func(u->u_func_arg);
+            if (data < 0) {
+                if (u->u_tx_done) {
+                    u->u_tx_done(u->u_func_arg);
+                }
+                break;
+            }
+
+            AM_REGn(UART, 0, DR) = data;
+        }
+    }
+    OS_EXIT_CRITICAL(sr);
+}
+
+void
+hal_uart_start_rx(int port)
+{
+    struct apollo2_uart *u;
+    os_sr_t sr;
+    int rc;
+
+    if (port >= UART_CNT) {
+        return;
+    }
+
+    u = &uarts[port];
+    if (!u->u_open) {
+        return;
+    }
+
+    if (u->u_rx_stall) {
+        OS_ENTER_CRITICAL(sr);
+        rc = u->u_rx_func(u->u_func_arg, u->u_rx_buf);
+        if (rc == 0) {
+            u->u_rx_stall = 0;
+            apollo2_uart_enable_rx_irq();
+        }
+
+        OS_EXIT_CRITICAL(sr);
+    }
+}
+
+void
+hal_uart_blocking_tx(int port, uint8_t data)
+{
+    struct apollo2_uart *u;
+
+    if (port >= UART_CNT) {
+        return;
+    }
+
+    u = &uarts[port];
+    if (!u->u_open) {
+        return;
+    }
+
+    while (AM_BFRn(UART, 0, FR, TXFF));
+    AM_REGn(UART, 0, DR) = data;
+}
+
+static void
+apollo2_uart_irqh_x(int num)
+{
+    struct apollo2_uart *u;
+    uint32_t status;
+    int data;
+    int rc;
+
+    os_trace_enter_isr();
+
+    u = &uarts[num];
+
+    status = AM_REGn(UART, 0, IES);
+    AM_REGn(UART, 0, IEC) &= ~status;
+
+    if (status & (AM_REG_UART_IES_TXRIS_M)) {
+        if (u->u_tx_started) {
+            while (1) {
+                if (AM_BFRn(UART, 0, FR, TXFF)) {
+                    break;
+                }
+
+                data = u->u_tx_func(u->u_func_arg);
+                if (data < 0) {
+                    if (u->u_tx_done) {
+                        u->u_tx_done(u->u_func_arg);
+                    }
+                    apollo2_uart_disable_tx_irq();
+                    u->u_tx_started = 0;
+                    break;
+                }
+
+                AM_REGn(UART, 0, DR) = data;
+            }
+        }
+    }
+
+    if (status & (AM_REG_UART_IES_RXRIS_M | AM_REG_UART_IES_RTRIS_M)) {
+        /* Service receive buffer */
+        while (!AM_BFRn(UART, 0, FR, RXFE)) {
+            u->u_rx_buf = AM_REGn(UART, 0, DR);
+            rc = u->u_rx_func(u->u_func_arg, u->u_rx_buf);
+            if (rc < 0) {
+                u->u_rx_stall = 1;
+                break;
+            }
+        }
+    }
+
+    os_trace_exit_isr();
+}
+
+#if MYNEWT_VAL(UART_0)
+static void apollo2_uart_irqh_0(void) { apollo2_uart_irqh_x(0); }
+#endif
+
+#if MYNEWT_VAL(UART_0)
+static void apollo2_uart_irqh_1(void) { apollo2_uart_irqh_x(1); }
+#endif
+
+static int
+apollo2_uart_irq_info(int port, int *out_irqn, apollo2_uart_irqh_t **out_irqh)
+{
+    apollo2_uart_irqh_t *irqh;
+    int irqn;
+
+    switch (port) {
+    case 0:
+        irqn = UART0_IRQn;
+        irqh = apollo2_uart_irqh_0;
+        break;
+
+    case 1:
+        irqn = UART1_IRQn;
+        irqh = apollo2_uart_irqh_1;
+        break;
+
+    default:
+        return -1;
+    }
+
+    if (out_irqn != NULL) {
+        *out_irqn = irqn;
+    }
+    if (out_irqh != NULL) {
+        *out_irqh = irqh;
+    }
+    return 0;
+}
+
+static void
+apollo2_uart_set_nvic(int port)
+{
+    apollo2_uart_irqh_t *irqh;
+    int irqn;
+    int rc;
+
+    rc = apollo2_uart_irq_info(port, &irqn, &irqh);
+    assert(rc == 0);
+
+    NVIC_SetVector(irqn, (uint32_t)irqh);
+}
+
+int
+hal_uart_init(int port, void *arg)
+{
+    struct apollo2_uart_cfg *cfg;
+    uint32_t pincfg;
+
+    cfg = arg;
+
+    if (port >= UART_CNT) {
+        return SYS_EINVAL;
+    }
+
+    switch (cfg->suc_pin_tx) {
+    case 1:
+        pincfg = AM_HAL_GPIO_FUNC(2);
+        break;
+
+    case 7:
+        pincfg = AM_HAL_GPIO_FUNC(5);
+        break;
+
+    case 16:
+        pincfg = AM_HAL_GPIO_FUNC(6);
+        break;
+
+    case 20:
+    case 30:
+        pincfg = AM_HAL_GPIO_FUNC(4);
+        break;
+
+    case 22:
+    case 39:
+        pincfg = AM_HAL_GPIO_FUNC(0);
+        break;
+
+    default:
+        return SYS_EINVAL;
+    }
+    am_hal_gpio_pin_config(cfg->suc_pin_tx, pincfg);
+
+    switch (cfg->suc_pin_rx) {
+    case 2:
+        pincfg = AM_HAL_GPIO_FUNC(2);
+        break;
+
+    case 11:
+    case 17:
+        pincfg = AM_HAL_GPIO_FUNC(6);
+        break;
+
+    case 21:
+    case 31:
+        pincfg = AM_HAL_GPIO_FUNC(4);
+        break;
+
+    case 23:
+    case 40:
+        pincfg = AM_HAL_GPIO_FUNC(0);
+        break;
+
+    default:
+        return SYS_EINVAL;
+    }
+    pincfg |= AM_HAL_PIN_DIR_INPUT;
+    am_hal_gpio_pin_config(cfg->suc_pin_rx, pincfg);
+
+    /* RTS pin is optional. */
+    if (cfg->suc_pin_rts != 0) {
+        switch (cfg->suc_pin_rts) {
+        case 3:
+            pincfg = AM_HAL_GPIO_FUNC(0);
+            break;
+
+        case 5:
+        case 37:
+            pincfg = AM_HAL_GPIO_FUNC(2);
+            break;
+
+        case 13:
+        case 35:
+            pincfg = AM_HAL_GPIO_FUNC(6);
+            break;
+
+        case 41:
+            pincfg = AM_HAL_GPIO_FUNC(7);
+            break;
+
+        default:
+            return SYS_EINVAL;
+        }
+        am_hal_gpio_pin_config(cfg->suc_pin_rts, pincfg);
+    }
+
+    /* CTS pin is optional. */
+    if (cfg->suc_pin_cts != 0) {
+        switch (cfg->suc_pin_cts) {
+        case 4:
+            pincfg = AM_HAL_GPIO_FUNC(0);
+            break;
+
+        case 6:
+        case 38:
+            pincfg = AM_HAL_GPIO_FUNC(2);
+            break;
+
+        case 12:
+        case 36:
+            pincfg = AM_HAL_GPIO_FUNC(6);
+            break;
+
+        case 29:
+            pincfg = AM_HAL_GPIO_FUNC(4);
+            break;
+
+        default:
+            return SYS_EINVAL;
+        }
+        pincfg |= AM_HAL_PIN_DIR_INPUT;
+        am_hal_gpio_pin_config(cfg->suc_pin_cts, pincfg);
+    }
+
+    apollo2_uart_set_nvic(port);
+    return 0;
+}
+
+int
+hal_uart_config(int port, int32_t baudrate, uint8_t databits, uint8_t stopbits,
+  enum hal_uart_parity parity, enum hal_uart_flow_ctl flow_ctl)
+{
+    struct apollo2_uart *u;
+    am_hal_uart_config_t uart_cfg;
+    int irqn;
+    int rc;
+
+    if (port >= UART_CNT) {
+        return -1;
+    }
+
+    u = &uarts[port];
+    if (u->u_open) {
+        return -1;
+    }
+
+    switch (databits) {
+    case 8:
+        uart_cfg.ui32DataBits = AM_HAL_UART_DATA_BITS_8;
+        break;
+    case 7:
+        uart_cfg.ui32DataBits = AM_HAL_UART_DATA_BITS_7;
+        break;
+    case 6:
+        uart_cfg.ui32DataBits = AM_HAL_UART_DATA_BITS_6;
+        break;
+    case 5:
+        uart_cfg.ui32DataBits = AM_HAL_UART_DATA_BITS_5;
+        break;
+    default:
+        return -1;
+    }
+
+    switch (stopbits) {
+    case 2:
+        uart_cfg.bTwoStopBits = true;
+        break;
+    case 1:
+    case 0:
+        uart_cfg.bTwoStopBits = false;
+        break;
+    default:
+        return -1;
+    }
+
+    rc = apollo2_uart_irq_info(port, &irqn, NULL);
+    if (rc != 0) {
+        return -1;
+    }
+
+    switch (parity) {
+    case HAL_UART_PARITY_NONE:
+        uart_cfg.ui32Parity = AM_HAL_UART_PARITY_NONE;
+        break;
+    case HAL_UART_PARITY_ODD:
+        uart_cfg.ui32Parity = AM_HAL_UART_PARITY_ODD;
+    case HAL_UART_PARITY_EVEN:
+        uart_cfg.ui32Parity = AM_HAL_UART_PARITY_EVEN;
+        break;
+    }
+
+    switch (flow_ctl) {
+    case HAL_UART_FLOW_CTL_NONE:
+        uart_cfg.ui32FlowCtrl = AM_HAL_UART_FLOW_CTRL_NONE;
+        break;
+    case HAL_UART_FLOW_CTL_RTS_CTS:
+        uart_cfg.ui32FlowCtrl = AM_HAL_UART_FLOW_CTRL_RTS_CTS;
+        break;
+    }
+
+    uart_cfg.ui32BaudRate = baudrate;
+
+    am_hal_uart_pwrctrl_enable(port);
+    am_hal_uart_clock_enable(port);
+
+    /* Disable the UART before configuring it */
+    am_hal_uart_disable(port);
+
+    am_hal_uart_config(port, &uart_cfg);
+
+    am_hal_uart_fifo_config(port,
+              AM_HAL_UART_TX_FIFO_1_2 | AM_HAL_UART_RX_FIFO_1_2);
+
+    NVIC_EnableIRQ(irqn);
+
+    am_hal_uart_enable(port);
+
+    apollo2_uart_enable_rx_irq();
+
+    u->u_rx_stall = 0;
+    u->u_tx_started = 0;
+    u->u_open = 1;
+
+    return 0;
+}
+
+int
+hal_uart_close(int port)
+{
+    struct apollo2_uart *u;
+
+    if (port >= UART_CNT) {
+        return -1;
+    }
+
+    u = &uarts[port];
+    if (!u->u_open) {
+        return -1;
+    }
+
+    u->u_open = 0;
+    am_hal_uart_disable(port);
+    am_hal_uart_clock_disable(port);
+    am_hal_uart_pwrctrl_disable(port);
+    return 0;
+}
diff --git a/hw/mcu/ambiq/apollo2/src/hal_watchdog.c b/hw/mcu/ambiq/apollo2/src/hal_watchdog.c
new file mode 100644
index 000000000..c4d57b333
--- /dev/null
+++ b/hw/mcu/ambiq/apollo2/src/hal_watchdog.c
@@ -0,0 +1,41 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "hal/hal_watchdog.h"
+
+#include <assert.h>
+
+int
+hal_watchdog_init(uint32_t expire_msecs)
+{
+    /* XXX: Unimplemented. */
+    return 0;
+}
+
+void
+hal_watchdog_enable(void)
+{
+    /* XXX: Unimplemented. */
+}
+
+void
+hal_watchdog_tickle(void)
+{
+    /* XXX: Unimplemented. */
+}
diff --git a/hw/mcu/ambiq/apollo2/syscfg.yml b/hw/mcu/ambiq/apollo2/syscfg.yml
new file mode 100644
index 000000000..b4662af02
--- /dev/null
+++ b/hw/mcu/ambiq/apollo2/syscfg.yml
@@ -0,0 +1,102 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# Package: hw/bsp/nrf52dk
+
+syscfg.defs:
+    MCU_FLASH_MIN_WRITE_SIZE:
+        description: >
+            Specifies the required alignment for internal flash writes.
+            Used internally by the newt tool.
+        value: 1
+
+    MCU_APOLLO2:
+        value: 1
+
+    SPI_0_MASTER:
+        description: 'SPI 0 master'
+        value:  0
+        restrictions:
+            - "!SPI_0_SLAVE"
+            - "!I2C_0"
+    SPI_0_SLAVE:
+        description: 'SPI 0 slave'
+        value:  0
+        restrictions:
+            - "!SPI_0_MASTER"
+            - "!I2C_0"
+    SPI_1_MASTER:
+        description: 'SPI 1 master'
+        value:  0
+        restrictions:
+            - "!SPI_1_SLAVE"
+            - "!I2C_1"
+    SPI_1_SLAVE:
+        description: 'SPI 1 slave'
+        value:  0
+        restrictions:
+            - "!SPI_1_MASTER"
+            - "!I2C_1"
+    SPI_2_MASTER:
+        description: 'SPI 2 master'
+        value:  0
+        restrictions:
+            - "!SPI_2_SLAVE"
+            - "!I2C_2"
+    SPI_2_SLAVE:
+        description: 'SPI 2 slave'
+        value:  0
+        restrictions:
+            - "!SPI_2_MASTER"
+            - "!I2C_2"
+    SPI_3_MASTER:
+        description: 'SPI 3 master'
+        value:  0
+        restrictions:
+            - "!SPI_3_SLAVE"
+            - "!I2C_3"
+    SPI_3_SLAVE:
+        description: 'SPI 3 slave'
+        value:  0
+        restrictions:
+            - "!SPI_3_MASTER"
+            - "!I2C_3"
+    SPI_4_MASTER:
+        description: 'SPI 4 master'
+        value:  0
+        restrictions:
+            - "!SPI_4_SLAVE"
+            - "!I2C_4"
+    SPI_4_SLAVE:
+        description: 'SPI 4 slave'
+        value:  0
+        restrictions:
+            - "!SPI_4_MASTER"
+            - "!I2C_4"
+    SPI_5_MASTER:
+        description: 'SPI 5 master'
+        value:  0
+        restrictions:
+            - "!SPI_5_SLAVE"
+            - "!I2C_5"
+    SPI_5_SLAVE:
+        description: 'SPI 5 slave'
+        value:  0
+        restrictions:
+            - "!SPI_5_MASTER"
+            - "!I2C_5"
diff --git a/hw/mcu/ambiq/pkg.yml b/hw/mcu/ambiq/pkg.yml
new file mode 100644
index 000000000..38ab9ffd9
--- /dev/null
+++ b/hw/mcu/ambiq/pkg.yml
@@ -0,0 +1,37 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+pkg.name: hw/mcu/ambiq
+pkg.description: MCU definitions for Ambiq Apollo chip
+pkg.author: "Apache Mynewt <de...@mynewt.incubator.apache.org>"
+pkg.homepage: "http://mynewt.apache.org/"
+pkg.keywords:
+    - ambiq
+    - apollo
+    - apollo2
+
+pkg.type: sdk
+
+pkg.src_dirs:
+    - "src/ext/AmbiqSuite/mcu/apollo2/"
+    - "src/ext/AmbiqSuite/utils/"
+
+pkg.deps: 
+    - hw/hal 
+    - hw/cmsis-core 
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/Makefile b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/Makefile
new file mode 100644
index 000000000..adc6122bc
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/Makefile
@@ -0,0 +1,55 @@
+#******************************************************************************
+#
+# Makefile - Rules for building the libraries, examples and docs.
+#
+# Copyright (c) 2017, Ambiq Micro
+# All rights reserved.
+# 
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# 
+# 1. Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# 
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 
+# 3. Neither the name of the copyright holder nor the names of its
+# contributors may be used to endorse or promote products derived from this
+# software without specific prior written permission.
+# 
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# 
+# This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+#
+#******************************************************************************
+
+SUBDIRS=${wildcard */}
+
+all:
+	@for i in ${SUBDIRS};                    \
+	 do                                      \
+	     if [ -f $${i}/Makefile ]; then      \
+	         $(MAKE) -C $${i} || exit $$?; fi;  \
+	 done
+
+clean:
+	@for i in ${SUBDIRS};                    \
+	 do                                      \
+	     if [ -f $${i}/Makefile ]; then      \
+	         $(MAKE) -C $${i} clean; fi;        \
+	 done
+
+
+	 
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/Makefile b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/Makefile
new file mode 100644
index 000000000..0843e50d4
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/Makefile
@@ -0,0 +1,54 @@
+#******************************************************************************
+#
+# Makefile - Rules for building the libraries, examples and docs.
+#
+# Copyright (c) 2017, Ambiq Micro
+# All rights reserved.
+# 
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# 
+# 1. Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# 
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 
+# 3. Neither the name of the copyright holder nor the names of its
+# contributors may be used to endorse or promote products derived from this
+# software without specific prior written permission.
+# 
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# 
+# This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+#
+#******************************************************************************
+
+SUBDIRS=${wildcard */}
+
+all:
+	@for i in ${SUBDIRS};                    \
+	 do                                      \
+	     if [ -f $${i}/Makefile ]; then      \
+	         $(MAKE) -C $${i} || exit $$?; fi;  \
+	 done
+
+clean:
+	@for i in ${SUBDIRS};                    \
+	 do                                      \
+	     if [ -f $${i}/Makefile ]; then      \
+	         $(MAKE) -C $${i} clean; fi;        \
+	 done
+
+
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/am_mcu_apollo.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/am_mcu_apollo.h
new file mode 100644
index 000000000..ed19370af
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/am_mcu_apollo.h
@@ -0,0 +1,127 @@
+//*****************************************************************************
+//
+//! @file am_mcu_apollo.h
+//!
+//! @brief Top Include for Apollo class devices.
+//!
+//! This file provides all the includes necessary for an apollo device.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_MCU_APOLLO_H
+#define AM_MCU_APOLLO_H
+
+//*****************************************************************************
+//
+// C99
+//
+//*****************************************************************************
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+#ifdef __IAR_SYSTEMS_ICC__
+#include "intrinsics.h"     // __CLZ() and other intrinsics
+#endif
+
+//*****************************************************************************
+//
+// Registers
+//
+//*****************************************************************************
+#include "regs/am_reg_base_addresses.h"
+
+#include "regs/am_reg_macros.h"
+
+#include "regs/am_reg_adc.h"
+#include "regs/am_reg_cachectrl.h"
+#include "regs/am_reg_clkgen.h"
+#include "regs/am_reg_ctimer.h"
+#include "regs/am_reg_gpio.h"
+#include "regs/am_reg_iomstr.h"
+#include "regs/am_reg_ioslave.h"
+#include "regs/am_reg_itm.h"
+#include "regs/am_reg_jedec.h"
+#include "regs/am_reg_mcuctrl.h"
+#include "regs/am_reg_nvic.h"
+#include "regs/am_reg_pdm.h"
+#include "regs/am_reg_pwrctrl.h"
+#include "regs/am_reg_rstgen.h"
+#include "regs/am_reg_rtc.h"
+#include "regs/am_reg_sysctrl.h"
+#include "regs/am_reg_systick.h"
+#include "regs/am_reg_tpiu.h"
+#include "regs/am_reg_uart.h"
+#include "regs/am_reg_vcomp.h"
+#include "regs/am_reg_wdt.h"
+
+//*****************************************************************************
+//
+// HAL
+//
+//*****************************************************************************
+#include "hal/am_hal_adc.h"
+#include "hal/am_hal_cachectrl.h"
+#include "hal/am_hal_clkgen.h"
+#include "hal/am_hal_ctimer.h"
+#include "hal/am_hal_debug.h"
+#include "hal/am_hal_flash.h"
+#include "hal/am_hal_global.h"
+#include "hal/am_hal_gpio.h"
+#include "hal/am_hal_i2c_bit_bang.h"
+#include "hal/am_hal_interrupt.h"
+#include "hal/am_hal_iom.h"
+#include "hal/am_hal_ios.h"
+#include "hal/am_hal_itm.h"
+#include "hal/am_hal_mcuctrl.h"
+#include "hal/am_hal_otp.h"
+#include "hal/am_hal_pdm.h"
+#include "hal/am_hal_pin.h"
+#include "hal/am_hal_pwrctrl.h"
+#include "hal/am_hal_queue.h"
+#include "hal/am_hal_reset.h"
+#include "hal/am_hal_rtc.h"
+#include "hal/am_hal_stimer.h"
+#include "hal/am_hal_sysctrl.h"
+#include "hal/am_hal_systick.h"
+#include "hal/am_hal_tpiu.h"
+#include "hal/am_hal_uart.h"
+#include "hal/am_hal_vcomp.h"
+#include "hal/am_hal_wdt.h"
+
+#endif // AM_MCU_APOLLO_H
+
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/Makefile b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/Makefile
new file mode 100644
index 000000000..230d1f544
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/Makefile
@@ -0,0 +1,53 @@
+#******************************************************************************
+#
+# Makefile - Rules for building the libraries, examples and docs.
+#
+# Copyright (c) 2017, Ambiq Micro
+# All rights reserved.
+# 
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# 
+# 1. Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# 
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 
+# 3. Neither the name of the copyright holder nor the names of its
+# contributors may be used to endorse or promote products derived from this
+# software without specific prior written permission.
+# 
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# 
+# This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+#
+#******************************************************************************
+
+SRCDIRS=src/ gdb_text_files/
+SUBDIRS=$(filter-out $(SRCDIRS),$(wildcard */))
+
+all:
+	@for i in ${SUBDIRS};                    \
+	 do                                      \
+	     if [ -f $${i}/Makefile ]; then      \
+	         $(MAKE) -C $${i} || exit $$?; fi;  \
+	 done
+clean:
+	@for i in ${SUBDIRS};                    \
+	 do                                      \
+	     if [ -f $${i}/Makefile ]; then      \
+	         $(MAKE) -C $${i} clean; fi;        \
+	 done
+
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_adc.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_adc.c
new file mode 100644
index 000000000..abf7d12f4
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_adc.c
@@ -0,0 +1,553 @@
+//*****************************************************************************
+//
+//! @file am_hal_adc.c
+//!
+//! @brief Functions for interfacing with the Analog to Digital Converter.
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup adc Analog-to-Digital Converter (ADC)
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#include "am_mcu_apollo.h"
+
+//*****************************************************************************
+//
+//! @brief Private SRAM view of temperature trims.
+//!
+//! This static SRAM union is private to the ADC HAL functions.
+//
+//*****************************************************************************
+static union
+{
+    //! These trim values are loaded as uint32_t values.
+    struct
+    {
+              //! Temperature of the package test head (in degrees Kelvin)
+              uint32_t ui32CalibrationTemperature;
+
+              //! Voltage corresponding to temperature measured on test head.
+              uint32_t ui32CalibrationVoltage;
+
+              //! ADC offset voltage measured on the package test head.
+              uint32_t ui32CalibrationOffset;
+
+              //! Flag if default (guess) or measured.
+              bool bMeasured;
+    } ui32;
+    //! These trim values are accessed as floats when used in temp calculations.
+    struct
+    {
+              //! Temperature of the package test head in degrees Kelvin
+              float    fCalibrationTemperature;
+
+              //! Voltage corresponding to temperature measured on test head.
+              float    fCalibrationVoltage;
+
+              //! ADC offset voltage measured on the package test head.
+              float    fCalibrationOffset;
+
+              //! Flag if default (guess) or measured.
+              float fMeasuredFlag;
+    } flt;
+} priv_temp_trims;
+
+//*****************************************************************************
+//
+//! @brief Configure the ADC.
+//!
+//! @param psConfig - pointer to the configuration structure for the ADC.
+//!
+//! This function may be used to perform the initial setup of the ADC based on
+//! setting found in a configuration structure.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_adc_config(am_hal_adc_config_t *psConfig)
+{
+    //
+    // Set general ADC configuration parameters.
+    //
+    AM_REG(ADC, CFG) = (psConfig->ui32Clock |
+                        psConfig->ui32TriggerConfig |
+                        psConfig->ui32Reference |
+                        psConfig->ui32ClockMode |
+                        psConfig->ui32PowerMode |
+                        psConfig->ui32Repeat |
+                        AM_REG_ADC_CFG_ADCEN(1));
+
+    //
+    // Grab the temperature trims.
+    //
+    priv_temp_trims.ui32.ui32CalibrationTemperature =
+                  am_hal_flash_load_ui32(AM_HAL_ADC_CALIB_TEMP_ADDR);
+    priv_temp_trims.ui32.ui32CalibrationVoltage     =
+                  am_hal_flash_load_ui32(AM_HAL_ADC_CALIB_AMBIENT_ADDR);
+    priv_temp_trims.ui32.ui32CalibrationOffset      =
+                  am_hal_flash_load_ui32(AM_HAL_ADC_CALIB_ADC_OFFSET_ADDR);
+
+    if ( (priv_temp_trims.ui32.ui32CalibrationTemperature == 0xffffffff)    ||
+         (priv_temp_trims.ui32.ui32CalibrationVoltage     == 0xffffffff)    ||
+         (priv_temp_trims.ui32.ui32CalibrationOffset      == 0xffffffff) )
+    {
+        //
+        // Since the device has not been calibrated on the tester, we'll load
+        // default calibration values.  These default values should result
+        // in worst-case temperature measurements of +-6 degress C.
+        //
+        priv_temp_trims.flt.fCalibrationOffset      = 299.5F;
+        priv_temp_trims.flt.fCalibrationTemperature = 1.02809F;
+        priv_temp_trims.flt.fCalibrationVoltage     = -0.004281F;
+        priv_temp_trims.ui32.bMeasured = false;
+    }
+    else
+    {
+        priv_temp_trims.ui32.bMeasured = true;
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Get the temperature trim parameters after configuring the ADC.
+//!
+//! @param pfTemp - pointer to a location to store the calibration temperature.
+//! @param pfVoltage - pointer to a location to store the calibration voltage.
+//! @param pfOffsetV - pointer to a location to store the calibration offset.
+//!
+//! This function may be used to access the actual temperature sensor trim
+//! values from the private structure.
+//!
+//! WARNING: only call this after the ADC has been configured with
+//!          am_hal_adc_config.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_adc_temp_trims_get(float * pfTemp, float * pfVoltage, float * pfOffsetV)
+{
+    //
+    // Return trim temperature as a float, if you can.
+    //
+    if ( pfTemp != NULL )
+    {
+        *pfTemp = priv_temp_trims.flt.fCalibrationTemperature;
+    }
+
+    //
+    // Return trim voltage as a float, if you can.
+    //
+    if ( pfVoltage != NULL )
+    {
+        *pfVoltage = priv_temp_trims.flt.fCalibrationVoltage;
+    }
+
+    //
+    // Return trim ADC offset voltage as a float, if you can.
+    //
+    if ( pfOffsetV != NULL )
+    {
+        *pfOffsetV = priv_temp_trims.flt.fCalibrationOffset;
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Set the ADC window parameters.
+//!
+//! @param ui32Upper - the upper limit for the ADC window.
+//! @param ui32Upper - the lower limit for the ADC window.
+//!
+//! This function may be used to change the ADC window parameters. Please note
+//! that the upper and lower limits are only 16-bits wide in the ADC hardware.
+//! This function will ignore the upper 16 bits of these arguments.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_adc_window_set(uint32_t ui32Upper, uint32_t ui32Lower)
+{
+    //
+    // Set the window limits for the ADC.
+    //
+     AM_BFW(ADC, WULIM, ULIM, ui32Upper);
+     AM_BFW(ADC, WLLIM, LLIM, ui32Lower);
+}
+
+//*****************************************************************************
+//
+//! @brief Configure a single ADC slot.
+//!
+//! @param ui32SlotNumber - the number of the ADC slot to be configured.
+//! @param ui32SlotConfig - contains slot-specific options.
+//!
+//! This function may be used to configure the settings for an individual ADC
+//! slot. The parameter \b ui32SlotConfig should be the logical 'OR' of a slot
+//! average macro, a slot hold-time macro, a slot channel macro, and
+//! optionally, the slot window enable macro.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_adc_slot_config(uint32_t ui32SlotNumber, uint32_t ui32SlotConfig)
+{
+    uint32_t ui32RegOffset;
+
+    //
+    // Make sure we're accessing a real slot.
+    //
+    am_hal_debug_assert_msg((ui32SlotNumber & 0xFFFFFFFF0) == 0,
+                            "Trying to configure an ADC slot that doesn't exist.");
+
+    //
+    // Locate the correct register for this ADC slot.
+    //
+    ui32RegOffset = (AM_REG_ADCn(0) + AM_REG_ADC_SL0CFG_O + (4 * ui32SlotNumber));
+
+    //
+    // Write the register with the caller's configuration value.
+    //
+    AM_REGVAL(ui32RegOffset) = ui32SlotConfig;
+}
+
+//*****************************************************************************
+//
+//! @brief Peek at the next fifo entry.
+//!
+//! This function reads the oldest value in the ADC sample fifo but doesn't
+//! actually advance the fifo to the next entry. This function is useful when
+//! you need information from the fifo but you don't want to also empty the
+//! fifo. This could be helpful if you want to check the FIFO depth without
+//! pulling any data out.
+//!
+//! The value returned by this function is the raw 32-bit value provided by the
+//! ADC hardware. In order to interpret this value, you will need to use one of
+//! the following macros.
+//!
+//! @return 32-bit FIFO entry.
+//!
+//
+//*****************************************************************************
+uint32_t
+am_hal_adc_fifo_peek(void)
+{
+    uint32_t ui32FIFOValue;
+
+    //
+    // Grab a value from the ADC FIFO.
+    //
+    ui32FIFOValue = AM_REG(ADC, FIFO);
+
+    //
+    // Return FIFO entry.
+    //
+    return ui32FIFOValue;
+}
+
+//*****************************************************************************
+//
+//! @brief
+//!
+//! This function reads the oldest value in the ADC fifo and then pops the
+//! fifo. Use this function when you actually want to pull data out of the
+//! fifo.
+//!
+//! @return 32-bit FIFO entry.
+//!
+//
+//*****************************************************************************
+uint32_t
+am_hal_adc_fifo_pop(void)
+{
+    uint32_t ui32FIFOValue;
+
+    //
+    // Grab a value from the ADC FIFO.
+    //
+    ui32FIFOValue = AM_REG(ADC, FIFO);
+
+    //
+    // Pop the FIFO.
+    //
+    AM_REG(ADC, FIFO) = 0;
+
+    //
+    // Return FIFO valid bits.
+    //
+    return ui32FIFOValue;
+}
+
+//*****************************************************************************
+//
+//! @brief Issue Software Trigger to the ADC.
+//!
+//! This function issues the software trigger to the ADC.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_adc_trigger(void)
+{
+    //
+    // Write to the Software trigger register in the ADC.
+    //
+    AM_REG(ADC, SWT) = 0x37;
+}
+
+//*****************************************************************************
+//
+//! @brief Enable the ADC.
+//!
+//! Use this function to enable the ADC.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_adc_enable(void)
+{
+    //
+    // Enable the ADC.
+    //
+    AM_BFW(ADC, CFG, ADCEN, 0x1);
+}
+
+//*****************************************************************************
+//
+//! @brief Disable the ADC.
+//!
+//! Use this function to disable the ADC.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_adc_disable(void)
+{
+    //
+    // Disable the ADC.
+    //
+    AM_BFW(ADC, CFG, ADCEN, 0x0);
+}
+
+//*****************************************************************************
+//
+//! @brief Enable selected ADC Interrupts.
+//!
+//! @param ui32Interrupt - Use the macro bit fields provided in am_hal_adc.h.
+//!
+//! Use this function to enable the ADC interrupts.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_adc_int_enable(uint32_t ui32Interrupt)
+{
+    //
+    // Enable the interrupts.
+    //
+    AM_REG(ADC, INTEN) |= ui32Interrupt;
+}
+
+//*****************************************************************************
+//
+//! @brief Return enabled ADC Interrupts.
+//!
+//! Use this function to get all enabled ADC interrupts.
+//!
+//! @return enabled ADC Interrupts.
+//
+//*****************************************************************************
+uint32_t
+am_hal_adc_int_enable_get(void)
+{
+    //
+    // Return enabled interrupts.
+    //
+    return AM_REG(ADC, INTEN);
+}
+
+//*****************************************************************************
+//
+//! @brief Disable selected ADC Interrupts.
+//!
+//! @param ui32Interrupt - Use the macro bit fields provided in am_hal_adc.h.
+//!
+//! Use this function to disable the ADC interrupts.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_adc_int_disable(uint32_t ui32Interrupt)
+{
+    //
+    // Disable the interrupts.
+    //
+    AM_REG(ADC, INTEN) &= ~ui32Interrupt;
+}
+
+//*****************************************************************************
+//
+//! @brief Clear selected ADC Interrupts.
+//!
+//! @param ui32Interrupt - Use the macro bit fields provided in am_hal_adc.h.
+//!
+//! Use this function to clear the ADC interrupts.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_adc_int_clear(uint32_t ui32Interrupt)
+{
+    //
+    // Clear the interrupts.
+    //
+    AM_REG(ADC, INTCLR) = ui32Interrupt;
+}
+
+//*****************************************************************************
+//
+//! @brief Set selected ADC Interrupts.
+//!
+//! @param ui32Interrupt - Use the macro bit fields provided in am_hal_adc.h.
+//!
+//! Use this function to set the ADC interrupts.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_adc_int_set(uint32_t ui32Interrupt)
+{
+    //
+    // Set the interrupts.
+    //
+    AM_REG(ADC, INTSET) = ui32Interrupt;
+}
+
+//*****************************************************************************
+//
+//! @brief Return either enabled or raw selected ADC interrupt status.
+//!
+//! @param bEnabledOnly - return the status of only the enabled interrupts.
+//!
+//! Use this function to get the ADC interrupt status.
+//!
+//! @return enabled or raw ADC interrupt status.
+//
+//*****************************************************************************
+uint32_t
+am_hal_adc_int_status_get(bool bEnabledOnly)
+{
+    //
+    // Return the status.
+    //
+    if (bEnabledOnly)
+    {
+        uint32_t u32RetVal = AM_REG(ADC, INTEN);
+        u32RetVal &= AM_REG(ADC, INTSTAT);
+        return u32RetVal;
+    }
+    else
+    {
+        return AM_REG(ADC, INTSTAT);
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Return temperature in degrees C of supplied voltage.
+//!
+//! @param fVoltage - return the temperature corresponding to this voltage.
+//!
+//! Use this function to convert volts from the temperature sensor into degrees
+//! C.  Caller converts ADC binary code to volts based on reference used.
+//! This routine looks up the trim parameters and returns corrected temperature.
+//!
+//! The computation is based on a line running through 0 degrees K.
+//! We find the slope from the trimmed temperature calibration point.
+//!
+//!
+//! @return the temperature in degrees C.
+//
+//*****************************************************************************
+float
+am_hal_adc_volts_to_celsius(float fVoltage)
+{
+    float fTemp;
+
+    //
+    // Get calibration temperature from trimmed values & convert to degrees K.
+    //
+    float fCalibration_temp = priv_temp_trims.flt.fCalibrationTemperature;
+
+    //
+    // Get remaining trimmed values.
+    //
+    float fCalibration_voltage = priv_temp_trims.flt.fCalibrationVoltage;
+    float fCalibration_offset  = priv_temp_trims.flt.fCalibrationOffset;
+
+    //
+    // Compute the temperature.
+    //
+    fTemp  = fCalibration_temp;
+    fTemp /= (fCalibration_voltage - fCalibration_offset);
+    fTemp *= (fVoltage - fCalibration_offset);
+
+    //
+    // Give it back to the caller in Celsius.
+    //
+    return fTemp - 273.15f;
+}
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_adc.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_adc.h
new file mode 100644
index 000000000..2cd0af8e8
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_adc.h
@@ -0,0 +1,338 @@
+//*****************************************************************************
+//
+//! @file am_hal_adc.h
+//!
+//! @brief Functions for interfacing with the Analog to Digital Converter
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup adc Analog-to-Digital Converter (ADC)
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_HAL_ADC_H
+#define AM_HAL_ADC_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+//*****************************************************************************
+//
+//! @name Clock Selection
+//! @brief These macros may be used to set the ADC module's clock source.
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_ADC_CLOCK_OFF                AM_REG_ADC_CFG_CLKSEL_OFF
+#define AM_HAL_ADC_CLOCK_HFRC               AM_REG_ADC_CFG_CLKSEL_HFRC
+#define AM_HAL_ADC_CLOCK_DIV2               AM_REG_ADC_CFG_CLKSEL_HFRC_DIV2
+//! @}
+
+//*****************************************************************************
+//
+//! @name Trigger Settings
+//! @brief ADC trigger setting macros.
+//!
+//! These macros alter the ADC's trigger source and trigger polarity. Note that
+//! the external trigger setting needs to be ORed with a POS or NEG option to
+//! define the desired trigger polarity.
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_ADC_TRIGGER_SOFT             AM_REG_ADC_CFG_TRIGSEL_SWT
+#define AM_HAL_ADC_TRIGGER_VCOMP            AM_REG_ADC_CFG_TRIGSEL_VCOMP
+#define AM_HAL_ADC_TRIGGER_EXT0             AM_REG_ADC_CFG_TRIGSEL_EXT0
+#define AM_HAL_ADC_TRIGGER_EXT1             AM_REG_ADC_CFG_TRIGSEL_EXT1
+#define AM_HAL_ADC_TRIGGER_EXT2             AM_REG_ADC_CFG_TRIGSEL_EXT2
+#define AM_HAL_ADC_TRIGGER_EXT3             AM_REG_ADC_CFG_TRIGSEL_EXT3
+#define AM_HAL_ADC_TRIGGER_FALL             AM_REG_ADC_CFG_TRIGPOL_FALLING_EDGE
+#define AM_HAL_ADC_TRIGGER_RISE             AM_REG_ADC_CFG_TRIGPOL_RISING_EDGE
+//! @}
+
+//*****************************************************************************
+//
+//! @name Reference Settings
+//! @brief ADC reference voltage setting macros.
+//!
+//! These macros control the ADC reference voltage source.
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_ADC_REF_EXT_2P0              AM_REG_ADC_CFG_REFSEL_EXT2P0
+#define AM_HAL_ADC_REF_EXT_1P5              AM_REG_ADC_CFG_REFSEL_EXT1P5
+#define AM_HAL_ADC_REF_INT_2P0              AM_REG_ADC_CFG_REFSEL_INT2P0
+#define AM_HAL_ADC_REF_INT_1P5              AM_REG_ADC_CFG_REFSEL_INT1P5
+//! @}
+
+//*****************************************************************************
+//
+//! @name Clock Mode
+//! @brief ADC clock mode settings
+//!
+//! These macros determine whether the ADC shuts down its clock between
+//! samples. Shutting down the clock will reduce power consumption, but
+//! increase latency. This setting is only valid for LPMODE 0. For other modes,
+//! it will be ignored.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_ADC_CK_LOW_POWER             AM_REG_ADC_CFG_CKMODE_LPCKMODE
+#define AM_HAL_ADC_CK_LOW_LATENCY           AM_REG_ADC_CFG_CKMODE_LLCKMODE
+//! @}
+
+//*****************************************************************************
+//
+//! @name Low Power Mode
+//! @brief ADC power conservation settings.
+//!
+//! These macros select the power state to enter between active scans. Each low
+//! power mode has its own set of timing constraints. Please see the datasheet
+//! for additional timing information on each power mode.
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_ADC_LPMODE_0                 AM_REG_ADC_CFG_LPMODE_MODE0
+#define AM_HAL_ADC_LPMODE_1                 AM_REG_ADC_CFG_LPMODE_MODE1
+//! @}
+
+//*****************************************************************************
+//
+//! @name Repeat Mode
+//! @brief Enable repeating scan mode.
+//!
+//! Use this macro to enable repeating scans using timer 3.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_ADC_REPEAT                   AM_REG_ADC_CFG_RPTEN(1)
+#define AM_HAL_ADC_NO_REPEAT                AM_REG_ADC_CFG_RPTEN(0)
+//! @}
+
+//*****************************************************************************
+//
+//! @name Slot configuration
+//! @brief Slot configuration macros
+//!
+//! These macros may be used to configure an individual ADC slot.
+//! @{
+//
+//*****************************************************************************
+
+// Set number of samples to average.
+#define AM_HAL_ADC_SLOT_AVG_1               AM_REG_ADC_SL0CFG_ADSEL0(0)
+#define AM_HAL_ADC_SLOT_AVG_2               AM_REG_ADC_SL0CFG_ADSEL0(1)
+#define AM_HAL_ADC_SLOT_AVG_4               AM_REG_ADC_SL0CFG_ADSEL0(2)
+#define AM_HAL_ADC_SLOT_AVG_8               AM_REG_ADC_SL0CFG_ADSEL0(3)
+#define AM_HAL_ADC_SLOT_AVG_16              AM_REG_ADC_SL0CFG_ADSEL0(4)
+#define AM_HAL_ADC_SLOT_AVG_32              AM_REG_ADC_SL0CFG_ADSEL0(5)
+#define AM_HAL_ADC_SLOT_AVG_64              AM_REG_ADC_SL0CFG_ADSEL0(6)
+#define AM_HAL_ADC_SLOT_AVG_128             AM_REG_ADC_SL0CFG_ADSEL0(7)
+
+// Set slot precision mode.
+#define AM_HAL_ADC_SLOT_14BIT               AM_REG_ADC_SL0CFG_PRMODE0_P14B
+#define AM_HAL_ADC_SLOT_12BIT               AM_REG_ADC_SL0CFG_PRMODE0_P14B
+#define AM_HAL_ADC_SLOT_10BIT               AM_REG_ADC_SL0CFG_PRMODE0_P14B
+#define AM_HAL_ADC_SLOT_8BIT                AM_REG_ADC_SL0CFG_PRMODE0_P14B
+
+// Select a channel by number.
+#define AM_HAL_ADC_SLOT_CHANNEL(n)          AM_REG_ADC_SL0CFG_CHSEL0(n)
+
+// Single-ended channels
+#define AM_HAL_ADC_SLOT_CHSEL_SE0           AM_REG_ADC_SL0CFG_CHSEL0_SE0
+#define AM_HAL_ADC_SLOT_CHSEL_SE1           AM_REG_ADC_SL0CFG_CHSEL0_SE1
+#define AM_HAL_ADC_SLOT_CHSEL_SE2           AM_REG_ADC_SL0CFG_CHSEL0_SE2
+#define AM_HAL_ADC_SLOT_CHSEL_SE3           AM_REG_ADC_SL0CFG_CHSEL0_SE3
+#define AM_HAL_ADC_SLOT_CHSEL_SE4           AM_REG_ADC_SL0CFG_CHSEL0_SE4
+#define AM_HAL_ADC_SLOT_CHSEL_SE5           AM_REG_ADC_SL0CFG_CHSEL0_SE5
+#define AM_HAL_ADC_SLOT_CHSEL_SE6           AM_REG_ADC_SL0CFG_CHSEL0_SE6
+#define AM_HAL_ADC_SLOT_CHSEL_SE7           AM_REG_ADC_SL0CFG_CHSEL0_SE7
+#define AM_HAL_ADC_SLOT_CHSEL_SE8           AM_REG_ADC_SL0CFG_CHSEL0_SE8
+#define AM_HAL_ADC_SLOT_CHSEL_SE9           AM_REG_ADC_SL0CFG_CHSEL0_SE9
+
+// Differential channels.
+#define AM_HAL_ADC_SLOT_CHSEL_DF0           AM_REG_ADC_SL0CFG_CHSEL0_DF0
+#define AM_HAL_ADC_SLOT_CHSEL_DF1           AM_REG_ADC_SL0CFG_CHSEL0_DF1
+
+// Miscellaneous other signals.
+#define AM_HAL_ADC_SLOT_CHSEL_TEMP          AM_REG_ADC_SL0CFG_CHSEL0_TEMP
+#define AM_HAL_ADC_SLOT_CHSEL_VSS           AM_REG_ADC_SL0CFG_CHSEL0_VSS
+#define AM_HAL_ADC_SLOT_CHSEL_VBATT         AM_REG_ADC_SL0CFG_CHSEL0_BATT
+
+// Window enable.
+#define AM_HAL_ADC_SLOT_WINDOW_EN           AM_REG_ADC_SL0CFG_WCEN0(1)
+
+// Enable the slot.
+#define AM_HAL_ADC_SLOT_ENABLE              AM_REG_ADC_SL0CFG_SLEN0(1)
+//! @}
+
+//*****************************************************************************
+//
+//! @name Interrupt Status Bits
+//! @brief Interrupt Status Bits for enable/disble use
+//!
+//! These macros may be used to enable an individual ADC interrupt cause.
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_ADC_INT_WCINC              AM_REG_ADC_INTEN_WCINC(1)
+#define AM_HAL_ADC_INT_WCEXC              AM_REG_ADC_INTEN_WCEXC(1)
+#define AM_HAL_ADC_INT_FIFOOVR2           AM_REG_ADC_INTEN_FIFOOVR2(1)
+#define AM_HAL_ADC_INT_FIFOOVR1           AM_REG_ADC_INTEN_FIFOOVR1(1)
+#define AM_HAL_ADC_INT_SCNCMP             AM_REG_ADC_INTEN_SCNCMP(1)
+#define AM_HAL_ADC_INT_CNVCMP             AM_REG_ADC_INTEN_CNVCMP(1)
+//! @}
+
+//*****************************************************************************
+//
+//! @name Temperature Trim Value Locations
+//! @brief Temperature calibration cofficients are stored in readable space.
+//!
+//! These macros are used to access the temperature trim values in readable
+//! space.
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_ADC_CALIB_AMBIENT_ADDR       (0x50023010)
+#define AM_HAL_ADC_CALIB_TEMP_ADDR          (0x50023014)
+#define AM_HAL_ADC_CALIB_ADC_OFFSET_ADDR    (0x50023018)
+//! @}
+
+//*****************************************************************************
+//
+//! @brief Configuration structure for the ADC.
+//
+//*****************************************************************************
+typedef struct
+{
+    //! Select the ADC Clock source using one of the clock source macros.
+    uint32_t ui32Clock;
+
+    //! Select the ADC trigger source using a trigger source macro.
+    uint32_t ui32TriggerConfig;
+
+    //! Use a macro to select the ADC reference voltage.
+    uint32_t ui32Reference;
+
+    //! Use a macro to decide whether to disable clocks between samples.
+    uint32_t ui32ClockMode;
+
+    //! Use a macro to select the ADC power mode.
+    uint32_t ui32PowerMode;
+
+    //! Select whether the ADC will re-trigger based on a signal from timer 3.
+    uint32_t ui32Repeat;
+}
+am_hal_adc_config_t;
+
+//*****************************************************************************
+//
+//! @brief ADC Fifo Read macros
+//!
+//! These are helper macros for interpreting FIFO data. Each ADC FIFO entry
+//! contains information about the slot number and the FIFO depth alongside the
+//! current sample. These macros perform the correct masking and shifting to
+//! read those values.
+//!
+//! The SAMPLE and FULL_SAMPLE options refer to the fractional part of averaged
+//! samples. If you are not using hardware averaging or don't need the
+//! fractional part of the ADC sample, you should just use
+//! AM_HAL_ADC_FIFO_SAMPLE.
+//!
+//! If you do need the fractional part, use AM_HAL_ADC_FIFO_FULL_SAMPLE. This
+//! macro will keep six bits of precision past the decimal point. Depending on
+//! the number of averaged samples, anywhere between 1 and 6 of these bits will
+//! be valid. Please consult the datasheet to find out how many bits of data
+//! are valid for your chosen averaging settings.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_ADC_FIFO_SAMPLE(value)                                         \
+    ((((value) & AM_REG_ADC_FIFO_DATA_M) >> AM_REG_ADC_FIFO_DATA_S) >> 6)
+
+#define AM_HAL_ADC_FIFO_FULL_SAMPLE(value)                                    \
+    (((value) & AM_REG_ADC_FIFO_DATA_M) >> AM_REG_ADC_FIFO_DATA_S )
+
+#define AM_HAL_ADC_FIFO_SLOT(value)                                           \
+    (((value) & AM_REG_ADC_FIFO_SLOTNUM_M) >> AM_REG_ADC_FIFO_SLOTNUM_S)
+
+#define AM_HAL_ADC_FIFO_COUNT(value)                                          \
+    (((value) & AM_REG_ADC_FIFO_COUNT_M) >> AM_REG_ADC_FIFO_COUNT_S)
+//! @}
+
+//*****************************************************************************
+//
+// External function definitions
+//
+//*****************************************************************************
+extern void am_hal_adc_config(am_hal_adc_config_t *psConfig);
+extern void am_hal_adc_window_set(uint32_t ui32Upper, uint32_t ui32Lower);
+extern void am_hal_adc_slot_config(uint32_t ui32SlotNumber,
+                                   uint32_t ui32SlotConfig);
+
+extern uint32_t am_hal_adc_fifo_peek(void);
+extern uint32_t am_hal_adc_fifo_pop(void);
+
+extern void am_hal_adc_trigger(void);
+extern void am_hal_adc_enable(void);
+extern void am_hal_adc_disable(void);
+extern void am_hal_adc_int_enable(uint32_t ui32Interrupt);
+extern uint32_t am_hal_adc_int_enable_get(void);
+extern void am_hal_adc_int_disable(uint32_t ui32Interrupt);
+extern void am_hal_adc_int_clear(uint32_t ui32Interrupt);
+extern void am_hal_adc_int_set(uint32_t ui32Interrupt);
+extern uint32_t am_hal_adc_int_status_get(bool bEnabledOnly);
+extern float am_hal_adc_volts_to_celsius(float fVoltage);
+extern void am_hal_adc_temp_trims_get(float * pfTemp, float * pfVoltage, float * pfOffsetV);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_HAL_ADC_H
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_cachectrl.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_cachectrl.c
new file mode 100644
index 000000000..86a985a7a
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_cachectrl.c
@@ -0,0 +1,576 @@
+//*****************************************************************************
+//
+//! @file am_hal_cachectrl.c
+//!
+//! @brief Functions for interfacing with the CACHE controller.
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup clkgen Clock Generator (CACHE)
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "am_mcu_apollo.h"
+
+//*****************************************************************************
+//
+// Default settings for the cache.
+//
+//*****************************************************************************
+const am_hal_cachectrl_config_t am_hal_cachectrl_defaults =
+{
+    .ui32EnableCache = 1,
+    .ui32LRU = 0,
+    .ui32EnableNCregions = 0,
+    .ui32Config = AM_HAL_CACHECTRL_CACHECFG_CONFIG_2WAY_512,
+    .ui32SerialCacheMode = 0,
+    .ui32FlashCachingEnables = 3,
+    .ui32EnableCacheClockGating = 1,
+    .ui32EnableLightSleep = 0,
+    .ui32Dly = 1,
+    .ui32SMDly = 1,
+    .ui32EnableDataClockGating = 1,
+    .ui32EnableCacheMonitoring = 0,
+};
+
+//*****************************************************************************
+//
+//! @brief Enable the cache using the supplied settings
+//!
+//! @param psConfig - pointer to a config structure containing cache settings.
+//!
+//! This function takes in a structure of cache settings, and uses them to
+//! enable the cache. This function will take care of the necessary register
+//! writes both in this module and in the power control module, so a separate
+//! powerctrl call is not necessary.
+//!
+//! For most applications, the default cache settings will be the most
+//! efficient choice. To use the default cache settings with this function, use
+//! the address of the global am_hal_cachectrl_defaults structure as the
+//! psConfig argument.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_cachectrl_enable(const am_hal_cachectrl_config_t *psConfig)
+{
+    uint32_t ui32ConfigValue;
+    uint32_t ui32Timeout;
+
+    //
+    // Pull the configuration data from the structure, and prepare to write the
+    // cache configuration register.
+    //
+    // NOTE: ICACHE and DCACHE settings were left out from this step. This is a
+    // workaround for a timing issue with early versions of Apollo2 that caused
+    // the cache to incorrectly mark itself valid during the startup sequence.
+    // The workaround calls for us to start the cache, manually invalidate it,
+    // and then enable ICACHE and DCACHE operation.
+    //
+    ui32ConfigValue = (AM_REG_CACHECTRL_CACHECFG_ENABLE( 1 )                                                |
+                       AM_REG_CACHECTRL_CACHECFG_LRU( psConfig->ui32LRU )                                   |
+                       AM_REG_CACHECTRL_CACHECFG_ENABLE_NC0( (psConfig->ui32EnableNCregions & 0x1) >> 0 )   |
+                       AM_REG_CACHECTRL_CACHECFG_ENABLE_NC1( (psConfig->ui32EnableNCregions & 0x2) >> 1 )   |
+                       psConfig->ui32Config                                                                 |
+                       AM_REG_CACHECTRL_CACHECFG_SERIAL(psConfig->ui32SerialCacheMode)                      |
+                       AM_REG_CACHECTRL_CACHECFG_CACHE_CLKGATE( psConfig->ui32EnableCacheClockGating )      |
+                       AM_REG_CACHECTRL_CACHECFG_CACHE_LS(psConfig->ui32EnableLightSleep )                  |
+                       AM_REG_CACHECTRL_CACHECFG_DLY( psConfig->ui32Dly )                                   |
+                       AM_REG_CACHECTRL_CACHECFG_SMDLY( psConfig->ui32SMDly )                               |
+                       AM_REG_CACHECTRL_CACHECFG_DATA_CLKGATE(psConfig->ui32EnableDataClockGating)          |
+                       AM_REG_CACHECTRL_CACHECFG_ENABLE_MONITOR(psConfig->ui32EnableCacheMonitoring) );
+
+    //
+    // Make sure the cache is enabled in the power control block.
+    //
+    am_hal_pwrctrl_memory_enable(AM_HAL_PWRCTRL_MEMEN_CACHE);
+
+    //
+    // Set the initial cache settings.
+    //
+    AM_REG(CACHECTRL, CACHECFG) = ui32ConfigValue;
+
+    //
+    // Wait for the cache ready signal.
+    //
+    for (ui32Timeout = 0; ui32Timeout < 50; ui32Timeout++)
+    {
+        if (AM_BFM(CACHECTRL, CACHECTRL, CACHE_READY))
+        {
+            break;
+        }
+    }
+
+    //
+    // Manually invalidate the cache (workaround for the issue described above.)
+    //
+    AM_BFW(CACHECTRL, CACHECTRL, INVALIDATE, 1);
+
+    //
+    // Wait for the cache ready signal again.
+    //
+    for (ui32Timeout = 0; ui32Timeout < 50; ui32Timeout++)
+    {
+        if (AM_BFM(CACHECTRL, CACHECTRL, CACHE_READY))
+        {
+            break;
+        }
+    }
+
+    //
+    // Now that the cache is running, and correctly marked invalid, we can OR in
+    // the ICACHE and DCACHE settings.
+    //
+    ui32ConfigValue |= (AM_REG_CACHECTRL_CACHECFG_ICACHE_ENABLE( (psConfig->ui32FlashCachingEnables & 0x1) >> 0 )   |
+                        AM_REG_CACHECTRL_CACHECFG_DCACHE_ENABLE( (psConfig->ui32FlashCachingEnables & 0x2) >> 1 ) );
+
+    //
+    // Write the final configuration settings to the CACHECTRL register.
+    //
+    AM_REG(CACHECTRL, CACHECFG) = ui32ConfigValue;
+}
+
+//*****************************************************************************
+//
+//! @brief Disable the cache.
+//!
+//! Call this function to completely shut down cache features.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_cachectrl_disable(void)
+{
+    uint32_t ui32CacheCfg;
+
+    //
+    // Save the cache settings.
+    //
+    ui32CacheCfg = AM_REG(CACHECTRL, CACHECFG);
+
+    //
+    // Remove the ICACHE and DCACHE settings.
+    //
+    ui32CacheCfg &= (AM_REG_CACHECTRL_CACHECFG_DCACHE_ENABLE(0) |
+                     AM_REG_CACHECTRL_CACHECFG_ICACHE_ENABLE(0));
+
+    //
+    // Write the resulting value back to the register.
+    //
+    AM_REG(CACHECTRL, CACHECFG) = ui32CacheCfg;
+
+    //
+    // Read the CACHECTRL register a few times
+    //
+    AM_REG(CACHECTRL, CACHECTRL);
+    AM_REG(CACHECTRL, CACHECTRL);
+    AM_REG(CACHECTRL, CACHECTRL);
+
+    //
+    // Disable the cache completely.
+    //
+    AM_BFW(CACHECTRL, CACHECFG, ENABLE, 0);
+
+    //
+    // Power the cache down in the powerctrl block.
+    //
+    am_hal_pwrctrl_memory_enable(AM_HAL_PWRCTRL_MEMEN_CACHE_DIS);
+}
+
+//*****************************************************************************
+//
+//! @brief Set a default cache configuration.
+//!
+//! This function is used to set a default cache configuration.
+//
+//*****************************************************************************
+void
+am_hal_cachectrl_config_default(void)
+{
+    //
+    // Set PWRCTRL
+    //
+    am_hal_pwrctrl_memory_enable(AM_HAL_PWRCTRL_MEMEN_CACHE);
+
+    //
+    // Write a default configuration to the CACHECFG register.
+    //
+    AM_REG(CACHECTRL, CACHECFG) =                                   \
+        AM_REG_CACHECTRL_CACHECFG_ENABLE( 1 )                   |   \
+        AM_REG_CACHECTRL_CACHECFG_LRU( 0 )                      |   \
+        AM_REG_CACHECTRL_CACHECFG_ENABLE_NC0( 0 )               |   \
+        AM_REG_CACHECTRL_CACHECFG_ENABLE_NC1( 0 )               |   \
+        AM_REG_CACHECTRL_CACHECFG_CONFIG_W2_128B_512E           |   \
+        AM_REG_CACHECTRL_CACHECFG_SERIAL( 0 )                   |   \
+        AM_REG_CACHECTRL_CACHECFG_ICACHE_ENABLE( 1 )            |   \
+        AM_REG_CACHECTRL_CACHECFG_DCACHE_ENABLE( 1 )            |   \
+        AM_REG_CACHECTRL_CACHECFG_CACHE_CLKGATE( 1 )            |   \
+        AM_REG_CACHECTRL_CACHECFG_CACHE_LS( 0 )                 |   \
+        AM_REG_CACHECTRL_CACHECFG_DLY( 1 )                      |   \
+        AM_REG_CACHECTRL_CACHECFG_SMDLY( 1 )                    |   \
+        AM_REG_CACHECTRL_CACHECFG_DATA_CLKGATE( 1 )             |   \
+        AM_REG_CACHECTRL_CACHECFG_ENABLE_MONITOR( 0 );
+
+    //
+    // Write a default configuration to the FLASHCFG register.
+    //
+    AM_REG(CACHECTRL, FLASHCFG) = AM_REG_CACHECTRL_FLASHCFG_RD_WAIT(1);
+
+    //
+    // Write a default configuration to the CACHECTRL register.
+    //
+    AM_REG(CACHECTRL, CACHECTRL) =                                  \
+        AM_REG_CACHECTRL_CACHECTRL_FLASH1_SLM_ENABLE(1)         |   \
+        AM_REG_CACHECTRL_CACHECTRL_FLASH1_SLM_DISABLE(0)        |   \
+        AM_REG_CACHECTRL_CACHECTRL_FLASH0_SLM_ENABLE(1)         |   \
+        AM_REG_CACHECTRL_CACHECTRL_FLASH0_SLM_DISABLE(0)        |   \
+        AM_REG_CACHECTRL_CACHECTRL_RESET_STAT(0)                |   \
+        AM_REG_CACHECTRL_CACHECTRL_INVALIDATE(0);
+
+    //
+    // Write a default configuration to the NCR0START and NCR0END registers.
+    //
+    AM_REG(CACHECTRL, NCR0START) =                          \
+        AM_REG_CACHECTRL_NCR0START_ADDR(0);
+    AM_REG(CACHECTRL, NCR0END) =                            \
+        AM_REG_CACHECTRL_NCR0END_ADDR(0);
+
+    //
+    // Write a default configuration to the NCR1START and NCR1END registers.
+    //
+    AM_REG(CACHECTRL, NCR1START) =                          \
+        AM_REG_CACHECTRL_NCR1START_ADDR(0);
+    AM_REG(CACHECTRL, NCR1END) =                            \
+        AM_REG_CACHECTRL_NCR1END_ADDR(0);
+
+    //
+    // Write a default configuration to the DMONn and IMONn registers.
+    //
+    AM_REG(CACHECTRL, DMON0) =                                      \
+        AM_REG_CACHECTRL_DMON0_DACCESS_COUNT(0);
+    AM_REG(CACHECTRL, DMON1)  =                                     \
+        AM_REG_CACHECTRL_DMON1_DLOOKUP_COUNT(0);
+    AM_REG(CACHECTRL, DMON2)  =                                     \
+        AM_REG_CACHECTRL_DMON2_DHIT_COUNT(0);
+    AM_REG(CACHECTRL, DMON3)  =                                     \
+        AM_REG_CACHECTRL_DMON3_DLINE_COUNT(0);
+    AM_REG(CACHECTRL, IMON0)  =                                     \
+        AM_REG_CACHECTRL_IMON0_IACCESS_COUNT(0);
+    AM_REG(CACHECTRL, IMON1)  =                                     \
+        AM_REG_CACHECTRL_IMON1_ILOOKUP_COUNT(0);
+    AM_REG(CACHECTRL, IMON2)  =                                     \
+        AM_REG_CACHECTRL_IMON2_IHIT_COUNT(0);
+    AM_REG(CACHECTRL, IMON3)  =                                     \
+        AM_REG_CACHECTRL_IMON3_ILINE_COUNT(0);
+}
+
+//*****************************************************************************
+//
+//! @brief Enable the flash cache controller via a configuration structure.
+//!
+//! @param psConfig - Pointer to a data structure containing all of the data
+//      necessary to configure the CACHECFG register.
+//!
+//! This function is used to configure all fields of the CACHECFG.
+//
+//*****************************************************************************
+void
+am_hal_cachectrl_config(am_hal_cachectrl_config_t *psConfig)
+{
+    uint32_t u32ConfigValue;
+
+    //
+    // Arrange all of the members of the data structure into a single u32 that
+    //  can be written to the register.
+    //
+    u32ConfigValue =
+        AM_REG_CACHECTRL_CACHECFG_ENABLE( psConfig->ui32EnableCache )       |
+        AM_REG_CACHECTRL_CACHECFG_LRU( psConfig->ui32LRU )                  |
+        AM_REG_CACHECTRL_CACHECFG_ENABLE_NC0(
+            (psConfig->ui32EnableNCregions & 0x1) >> 0 )                    |
+        AM_REG_CACHECTRL_CACHECFG_ENABLE_NC1(
+            (psConfig->ui32EnableNCregions & 0x2) >> 1 )                    |
+        psConfig->ui32Config                                                |
+        AM_REG_CACHECTRL_CACHECFG_SERIAL(psConfig->ui32SerialCacheMode)     |
+        AM_REG_CACHECTRL_CACHECFG_ICACHE_ENABLE(
+            (psConfig->ui32FlashCachingEnables & 0x1) >> 0 )                |
+        AM_REG_CACHECTRL_CACHECFG_DCACHE_ENABLE(
+            (psConfig->ui32FlashCachingEnables & 0x2) >> 1 )                |
+        AM_REG_CACHECTRL_CACHECFG_CACHE_CLKGATE(
+            psConfig->ui32EnableCacheClockGating )                          |
+        AM_REG_CACHECTRL_CACHECFG_CACHE_LS(
+            psConfig->ui32EnableLightSleep )                                |
+        AM_REG_CACHECTRL_CACHECFG_DLY( psConfig->ui32Dly )                  |
+        AM_REG_CACHECTRL_CACHECFG_SMDLY( psConfig->ui32SMDly )              |
+        AM_REG_CACHECTRL_CACHECFG_DATA_CLKGATE(
+            psConfig->ui32EnableDataClockGating )                           |
+        AM_REG_CACHECTRL_CACHECFG_ENABLE_MONITOR(
+            psConfig->ui32EnableCacheMonitoring );
+
+    //
+    // Write the configuration value to the CACHECFG register.
+    //
+    AM_REG(CACHECTRL, CACHECFG) = u32ConfigValue;
+}
+
+//*****************************************************************************
+//
+//! @brief Configure the various flash cache controller enables.
+//!
+//! @param u32EnableMask  - Mask of features to be enabled.
+//! @param u32DisableMask - Mask of features to be disabled.
+//!
+//! This function is used to enable or disable the various flash cache
+//! controller configuration enables which consist of the following:
+//!     AM_HAL_CACHECTRL_CACHECFG_ENABLE                Flash cache controller
+//!     AM_HAL_CACHECTRL_CACHECFG_LRU_ENABLE            LRU (disabled = LRR)
+//!     AM_HAL_CACHECTRL_CACHECFG_NC0_ENABLE            Non-cacheable region 0
+//!     AM_HAL_CACHECTRL_CACHECFG_NC1_ENABLE            Non-cacheable region 1
+//!     AM_HAL_CACHECTRL_CACHECFG_SERIAL_ENABLE         Serial cache mode
+//!     AM_HAL_CACHECTRL_CACHECFG_ICACHE_ENABLE         Instruction caching
+//!     AM_HAL_CACHECTRL_CACHECFG_DCACHE_ENABLE         Data caching.
+//!     AM_HAL_CACHECTRL_CACHECFG_CACHE_CLKGATE_ENABLE  Cache clock gating
+//!     AM_HAL_CACHECTRL_CACHECFG_LS_ENABLE             Light sleep cache RAMs
+//!     AM_HAL_CACHECTRL_CACHECFG_DATA_CLKGATE_ENABLE   Data clock gating
+//!     AM_HAL_CACHECTRL_CACHECFG_MONITOR_ENABLE        Cache Monitoring Stats
+//!
+//! Note that if both an enable and disable are provided in their respective
+//! masks, the enable will take precendence.
+//!
+//! @return The previous status of the flash cache controller enables.
+//
+//*****************************************************************************
+#define CACHECTRL_VALID_ENABLES                         (   \
+        AM_REG_CACHECTRL_CACHECFG_ENABLE_M              |   \
+        AM_REG_CACHECTRL_CACHECFG_LRU_M                 |   \
+        AM_REG_CACHECTRL_CACHECFG_ENABLE_NC0_M          |   \
+        AM_REG_CACHECTRL_CACHECFG_ENABLE_NC1_M          |   \
+        AM_REG_CACHECTRL_CACHECFG_SERIAL_M              |   \
+        AM_REG_CACHECTRL_CACHECFG_ICACHE_ENABLE_M       |   \
+        AM_REG_CACHECTRL_CACHECFG_DCACHE_ENABLE_M       |   \
+        AM_REG_CACHECTRL_CACHECFG_CACHE_CLKGATE_M       |   \
+        AM_REG_CACHECTRL_CACHECFG_CACHE_LS_M            |   \
+        AM_REG_CACHECTRL_CACHECFG_DATA_CLKGATE_M        |   \
+        AM_REG_CACHECTRL_CACHECFG_ENABLE_MONITOR_M )
+
+uint32_t
+am_hal_cachectrl_cache_enables(uint32_t u32EnableMask, uint32_t u32DisableMask)
+{
+    uint32_t ui32RetVal = AM_BFR(CACHECTRL, CACHECFG, ENABLE) &
+                          CACHECTRL_VALID_ENABLES;
+
+    //
+    // Make sure the enable masks include only valid bits.
+    //
+    u32EnableMask  &= CACHECTRL_VALID_ENABLES;
+    u32DisableMask &= CACHECTRL_VALID_ENABLES;
+
+    //
+    // First, do the disables.
+    //
+    AM_REG(CACHECTRL, CACHECFG) &= ~u32DisableMask;
+
+    //
+    // Now set the enables.
+    //
+    AM_REG(CACHECTRL, CACHECFG) |= u32EnableMask;
+
+    return ui32RetVal;
+}
+
+//*****************************************************************************
+//
+//! @brief Select the cache configuration type.
+//!
+//! This functions only sets the CACHECFG CONFIG field.
+//!
+//! @param ui32CacheConfig - The cache configuration value.
+//!
+//! This function can be used to select the type of cache.frequency of the main
+//! system clock.  The ui32CacheConfig parameter should be set to one of the
+//! following values:
+//!
+//!     AM_HAL_CACHECTRL_CACHECFG_CONFIG_DIRECT_256 : Direct mapped,
+//!         128-bit linesize, 256 entries (2 SRAMs active).
+//!     AM_HAL_CACHECTRL_CACHECFG_CONFIG_2WAY_256   : Two-way set associative,
+//!         128-bit linesize, 256 entries (4 SRAMs active).
+//!     AM_HAL_CACHECTRL_CACHECFG_CONFIG_2WAY_512   : Two-way set associative,
+//!         128-bit linesize, 512 entries (8 SRAMs active).
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_cachectrl_cache_config(uint32_t ui32CacheConfig)
+{
+    //
+    // Clear the bitfield
+    //
+    AM_REG(CACHECTRL, CACHECFG) &= ~AM_REG_CACHECTRL_CACHECFG_CONFIG_M;
+
+    //
+    // Write the new value to the bitfield.
+    //
+    AM_REG(CACHECTRL, CACHECFG) |= ui32CacheConfig &
+                                   AM_REG_CACHECTRL_CACHECFG_CONFIG_M;
+}
+
+//*****************************************************************************
+//
+//! @brief Invalidate the flash cache.
+//!
+//! This function is used to invalidate the flash cache.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_cachectrl_invalidate_flash_cache(void)
+{
+    //
+    // Write the bit to invalidate the flash cache.
+    // Note - this bit is not sticky, no need to write it back to 0.
+    //
+    AM_REG(CACHECTRL, CACHECTRL) |= AM_REG_CACHECTRL_CACHECTRL_INVALIDATE_GO;
+}
+
+//*****************************************************************************
+//
+//! @brief Reset cache statistics.
+//!
+//! This function is used to reset cache statistics.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_cachectrl_reset_statistics(void)
+{
+    //
+    // Write the bit to reset flash statistics.
+    // Note - this bit is not sticky, no need to write it back to 0.
+    //
+    AM_REG(CACHECTRL, CACHECTRL) |= AM_REG_CACHECTRL_CACHECTRL_RESET_STAT_CLEAR;
+}
+
+//*****************************************************************************
+//
+//! @brief Get flash cache sleep mode status.
+//!
+//! This function returns flash cache sleep mode statuses.
+//!
+//! @return
+//!     bit0 indicates that flash0 flash sleep mode is enabled.
+//!     bit1 indicates that flash1 flash sleep mode is enabled.
+//
+//*****************************************************************************
+uint32_t
+am_hal_cachectrl_sleep_mode_status(void)
+{
+    uint32_t ui32Status, ui32Ret;
+
+    //
+    // Get the current sleep mode status bits.
+    //
+    ui32Status = AM_REG(CACHECTRL, CACHECTRL);
+    ui32Ret = (ui32Status &                                                 \
+                AM_REG_CACHECTRL_CACHECTRL_FLASH0_SLM_STATUS_M) >>          \
+                (AM_REG_CACHECTRL_CACHECTRL_FLASH0_SLM_STATUS_S - 0);
+    ui32Ret |= (ui32Status &                                                \
+                AM_REG_CACHECTRL_CACHECTRL_FLASH1_SLM_STATUS_M) >>          \
+                (AM_REG_CACHECTRL_CACHECTRL_FLASH1_SLM_STATUS_S - 1);
+
+    return ui32Ret;
+}
+
+//*****************************************************************************
+//
+//! @brief Enable or disable flash cache sleep mode.
+//!
+//! This function enables or disables flash cache sleep mode.
+//! @param ui32EnableMask  - bit0 for flash0, bit1 for flash1.
+//! @param ui32DisableMask - bit0 for flash0, bit1 for flash1.
+//!
+//! Note that if both an enable and disable are provided in their respective
+//! masks, the enable will take precedence.
+//!
+//! @return Previous status.
+//!     bit0 indicates that flash0 flash sleep mode was previously enabled.
+//!     bit1 indicates that flash1 flash sleep mode was previously enabled.
+//
+//*****************************************************************************
+uint32_t
+am_hal_cachectrl_sleep_mode_enable(uint32_t ui32EnableMask,
+                                   uint32_t ui32DisableMask)
+{
+    uint32_t ui32Ret = am_hal_cachectrl_sleep_mode_status();
+
+    if ( ui32DisableMask & 0x1 )
+    {
+        AM_REG(CACHECTRL, CACHECTRL) |= AM_REG_CACHECTRL_CACHECTRL_FLASH0_SLM_DISABLE_M;
+    }
+
+    if ( ui32DisableMask & 0x2 )
+    {
+        AM_REG(CACHECTRL, CACHECTRL) |= AM_REG_CACHECTRL_CACHECTRL_FLASH1_SLM_DISABLE_M;
+    }
+
+    if ( ui32EnableMask & 0x1 )
+    {
+        AM_REG(CACHECTRL, CACHECTRL) |= AM_REG_CACHECTRL_CACHECTRL_FLASH0_SLM_ENABLE_M;
+    }
+
+    if ( ui32EnableMask & 0x2 )
+    {
+        AM_REG(CACHECTRL, CACHECTRL) |= AM_REG_CACHECTRL_CACHECTRL_FLASH1_SLM_ENABLE_M;
+    }
+
+    return ui32Ret;
+}
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_cachectrl.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_cachectrl.h
new file mode 100644
index 000000000..a349f9921
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_cachectrl.h
@@ -0,0 +1,210 @@
+//*****************************************************************************
+//
+//! @file am_hal_cachectrl.h
+//!
+//! @brief Functions for accessing and configuring the CACHE controller.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_HAL_CACHECTRL_H
+#define AM_HAL_CACHECTRL_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+//*****************************************************************************
+//
+// Cache configuration structure
+//
+//*****************************************************************************
+typedef struct
+{
+    //
+    //! Set to 1 to enable the cache.
+    //
+    uint8_t ui32EnableCache;
+
+    //
+    //! Set to 1 to enable the LRU cache replacement policy.
+    //! Set to 0 to enable the LRR (least recently used) replacement policy.
+    //! LEE minimizes writes to the TAG SRAM.
+    //
+    uint8_t ui32LRU;
+
+    //
+    //! Set to 3 to enable non-cachable region 1 and non-cachable region 0.
+    //! Set to 2 to enable non-cachable region 1.
+    //! Set to 1 to enable non-cachable region 0.
+    //! Set to 0 to make all regions cacheable.
+    //
+    uint8_t ui32EnableNCregions;
+
+    //
+    //! Set to:
+    //! AM_HAL_CACHECTRL_CACHECFG_CONFIG_DIRECT_256 for direct-mapped,
+    //!     128-bit linesize, 256 entries (2 SRAMs active)
+    //! AM_HAL_CACHECTRL_CACHECFG_CONFIG_2WAY_256 for two-way set associative,
+    //!     128-bit linesize, 256 entries (4 SRAMs active)
+    //! AM_HAL_CACHECTRL_CACHECFG_CONFIG_2WAY_512 for two-way set associative,
+    //!     128-bit linesize, 512 entries (8 SRAMs active)
+    //
+    uint8_t ui32Config;
+
+    //
+    //! Set to 1 to enable serial cache mode.
+    //
+    uint8_t ui32SerialCacheMode;
+
+    //
+    //! Set to 3 to enable flash data caching and flash instruction caching.
+    //! Set to 2 to enable flash data caching.
+    //! Set to 1 to enable flash instruction caching.
+    //! Set to 0 to disable flash data caching and flash instruction caching.
+    //
+    uint8_t ui32FlashCachingEnables;
+
+    //
+    //! Set to 1 to enable clock gating of cache RAMs.
+    //
+    uint8_t ui32EnableCacheClockGating;
+
+    //
+    //! Set to 1 to enable light sleep of cache RAMs.
+    //
+    uint8_t ui32EnableLightSleep;
+
+    //
+    //! Set Data RAM delay value (0x0 - 0xF).
+    //
+    uint8_t ui32Dly;
+
+    //
+    //! Set SM Data RAM delay value (0x0 - 0xF).
+    //
+    uint8_t ui32SMDly;
+
+    //
+    //! Set to 1 to enable clock gating of the entire data array.
+    //
+    uint8_t ui32EnableDataClockGating;
+
+    //
+    //! Set to 1 to enable cache monitor statistics.
+    //
+    uint8_t ui32EnableCacheMonitoring;
+}
+am_hal_cachectrl_config_t;
+
+extern const am_hal_cachectrl_config_t am_hal_cachectrl_defaults;
+
+//*****************************************************************************
+//
+//! @name Cache enables
+//! @brief Configuration selection for the various cache enables.
+//!
+//! These macros may be used in conjunction with the
+//!  am_hal_cachectrl_cache_enable() function to enable various cache features.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_CACHECTRL_CACHECFG_ENABLE                AM_REG_CACHECTRL_CACHECFG_ENABLE_M
+#define AM_HAL_CACHECTRL_CACHECFG_LRU_ENABLE            AM_REG_CACHECTRL_CACHECFG_LRU_M
+#define AM_HAL_CACHECTRL_CACHECFG_NC0_ENABLE            AM_REG_CACHECTRL_CACHECFG_ENABLE_NC0_M
+#define AM_HAL_CACHECTRL_CACHECFG_NC1_ENABLE            AM_REG_CACHECTRL_CACHECFG_ENABLE_NC1_M
+#define AM_HAL_CACHECTRL_CACHECFG_SERIAL_ENABLE         AM_REG_CACHECTRL_CACHECFG_SERIAL_M
+#define AM_HAL_CACHECTRL_CACHECFG_ICACHE_ENABLE         AM_REG_CACHECTRL_CACHECFG_ICACHE_ENABLE_M
+#define AM_HAL_CACHECTRL_CACHECFG_DCACHE_ENABLE         AM_REG_CACHECTRL_CACHECFG_DCACHE_ENABLE_M
+#define AM_HAL_CACHECTRL_CACHECFG_CACHE_CLKGATE_ENABLE  AM_REG_CACHECTRL_CACHECFG_CACHE_CLKGATE_M
+#define AM_HAL_CACHECTRL_CACHECFG_LS_ENABLE             AM_REG_CACHECTRL_CACHECFG_CACHE_LS_M
+#define AM_HAL_CACHECTRL_CACHECFG_DATA_CLKGATE_ENABLE   AM_REG_CACHECTRL_CACHECFG_DATA_CLKGATE_M
+#define AM_HAL_CACHECTRL_CACHECFG_MONITOR_ENABLE        AM_REG_CACHECTRL_CACHECFG_ENABLE_MONITOR_M
+//! @}
+
+//*****************************************************************************
+//
+//! @name Cache Config
+//! @brief Configuration selection for the cache.
+//!
+//! These macros may be used in conjunction with the
+//!  am_hal_cachectrl_cache_config() function to select the cache type.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_CACHECTRL_CACHECFG_CONFIG_DIRECT_256 AM_REG_CACHECTRL_CACHECFG_CONFIG_W1_128B_256E
+#define AM_HAL_CACHECTRL_CACHECFG_CONFIG_2WAY_256   AM_REG_CACHECTRL_CACHECFG_CONFIG_W2_128B_256E
+#define AM_HAL_CACHECTRL_CACHECFG_CONFIG_2WAY_512   AM_REG_CACHECTRL_CACHECFG_CONFIG_W2_128B_512E
+//! @}
+
+//*****************************************************************************
+//
+// Default cache settings
+//
+//*****************************************************************************
+#define AM_HAL_CACHECTRL_DEFAULTS                                             \
+    (AM_HAL_CACHECTRL_CACHECFG_ICACHE_ENABLE |                                \
+     AM_HAL_CACHECTRL_CACHECFG_DCACHE_ENABLE |                                \
+     AM_HAL_CACHECTRL_CACHECFG_CACHE_CLKGATE_ENABLE |                         \
+     AM_HAL_CACHECTRL_CACHECFG_DATA_CLKGATE_ENABLE |                          \
+     AM_HAL_CACHECTRL_CACHECFG_CONFIG_2WAY_512)
+
+//*****************************************************************************
+//
+// External function definitions
+//
+//*****************************************************************************
+extern void am_hal_cachectrl_enable(const am_hal_cachectrl_config_t *psConfig);
+extern void am_hal_cachectrl_disable(void);
+extern void am_hal_cachectrl_config_default(void);
+extern void am_hal_cachectrl_config(am_hal_cachectrl_config_t *psConfig);
+extern uint32_t am_hal_cachectrl_cache_enables(uint32_t u32EnableMask,
+                                               uint32_t u32DisableMask);
+extern void am_hal_cachectrl_cache_config(uint32_t ui32CacheConfig);
+extern void am_hal_cachectrl_invalidate_flash_cache(void);
+extern void am_hal_cachectrl_reset_statistics(void);
+extern uint32_t am_hal_cachectrl_sleep_mode_status(void);
+extern uint32_t am_hal_cachectrl_sleep_mode_enable(uint32_t ui32EnableMask,
+                                                   uint32_t ui32DisableMask);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_HAL_CACHECTRL_H
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_clkgen.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_clkgen.c
new file mode 100644
index 000000000..4dfa692ba
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_clkgen.c
@@ -0,0 +1,491 @@
+//*****************************************************************************
+//
+//! @file am_hal_clkgen.c
+//!
+//! @brief Functions for interfacing with the CLKGEN.
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup clkgen Clock Generator (CLKGEN)
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "am_mcu_apollo.h"
+
+//*****************************************************************************
+//
+// CLKGEN HFADJ register
+//
+//*****************************************************************************
+#define AM_REG_CLKGEN_HFADJ_HFXTADJ_DEFAULT         0x5B8
+
+//*****************************************************************************
+//
+//! @brief Select the clock divisor for the main system clock.
+//!
+//! @param ui32ClockSetting - The divisor value for the system clock.
+//!
+//! This function can be used to select the frequency of the main system clock.
+//! The \e ui32ClockSetting parameter should be set to one of the following
+//! values:
+//!
+//!     AM_HAL_CLKGEN_SYSCLK_MAX
+//!     AM_HAL_CLKGEN_SYSCLK_48MHZ
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_clkgen_sysclk_select(uint32_t ui32ClockSetting)
+{
+    am_hal_debug_assert_msg(ui32ClockSetting == AM_HAL_CLKGEN_SYSCLK_48MHZ,
+        "am_hal_clkgen_sysclk_select(): invalid clock setting.");
+
+    //
+    // Unlock the clock control register.
+    //
+    AM_REG(CLKGEN, CLKKEY) = AM_REG_CLKGEN_CLKKEY_KEYVAL;
+
+    //
+    // Set the HFRC divisor to the user-selected value.
+    //
+    AM_REG(CLKGEN, CCTRL) = ui32ClockSetting;
+
+    //
+    // Lock the clock configuration registers.
+    //
+    AM_REG(CLKGEN, CLKKEY) = 0;
+}
+
+//*****************************************************************************
+//
+//! @brief Get the current system clock frequency.
+//!
+//! This function can be used to determine the frequency of the main system
+//! clock. The return value is the system clock frequency measured in hertz.
+//!
+//! @return System clock frequency in Hz
+//
+//*****************************************************************************
+uint32_t
+am_hal_clkgen_sysclk_get(void)
+{
+    uint32_t ui32ClockSetting;
+
+    //
+    // Read the value of the clock divider.
+    //
+    ui32ClockSetting = AM_REG(CLKGEN, CCTRL) & AM_REG_CLKGEN_CCTRL_CORESEL_M;
+
+    switch ( ui32ClockSetting )
+    {
+        case AM_REG_CLKGEN_CCTRL_CORESEL_HFRC:
+            return 48000000;
+        case AM_REG_CLKGEN_CCTRL_CORESEL_HFRC_DIV2:
+            return 24000000;
+        default:
+            return 0xFFFFFFFF;
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Enable selected CLKGEN Interrupts.
+//!
+//! Use this function to enable the interrupts.
+//!
+//! @param ui32Interrupt - Use the macro bit fields provided in am_hal_clkgen.h
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_clkgen_int_enable(uint32_t ui32Interrupt)
+{
+    //
+    // Enable the interrupts.
+    //
+    AM_REG(CLKGEN, INTEN) |= ui32Interrupt;
+}
+
+//*****************************************************************************
+//
+//! @brief Return enabled CLKGEN Interrupts.
+//!
+//! Use this function to get all enabled CLKGEN interrupts.
+//!
+//! @return enabled CLKGEN interrupts.
+//
+//*****************************************************************************
+uint32_t
+am_hal_clkgen_int_enable_get(void)
+{
+    //
+    // Return the enabled interrupts.
+    //
+    return AM_REG(CLKGEN, INTEN);
+}
+
+//*****************************************************************************
+//
+//! @brief Disable selected CLKGEN Interrupts.
+//!
+//! Use this function to disable the CLKGEN interrupts.
+//!
+//! @param ui32Interrupt - Use the macro bit fields provided in am_hal_clkgen.h
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_clkgen_int_disable(uint32_t ui32Interrupt)
+{
+    //
+    // Disable the interrupts.
+    //
+    AM_REG(CLKGEN, INTEN) &= ~ui32Interrupt;
+}
+
+//*****************************************************************************
+//
+//! @brief Sets the interrupt status.
+//!
+//! @param ui32IntFlags interrupts to be enabled.
+//!
+//! This function sets the interrupts.
+//!
+//! Valid values for ui32IntFlags are:
+//!
+//!     AM_HAL_CLKGEN_INT_RTC_ALARM
+//!     AM_HAL_CLKGEN_INT_XT_FAIL
+//!     AM_HAL_CLKGEN_INT_AUTOCAL_COMPLETE
+//!     AM_HAL_CLKGEN_INT AUTOCAL_FAIL
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_clkgen_int_set(uint32_t ui32Interrupt)
+{
+    //
+    // Set the interrupt status.
+    //
+    AM_REG(CLKGEN, INTSET) = ui32Interrupt;
+}
+
+//*****************************************************************************
+//
+//! @brief Gets the interrupt configuration.
+//!
+//! @param bEnabledOnly - return the status of only the enabled interrupts.
+//!
+//! This function gets the currently configured interrupts.
+//!
+//! @return the configured interrupts.
+//!
+//! Possible values for the return are:
+//!
+//!     AM_HAL_CLKGEN_INT_RTC_ALARM
+//!     AM_HAL_CLKGEN_INT_XT_FAIL
+//!     AM_HAL_CLKGEN_INT_AUTOCAL_COMPLETE
+//!     AM_HAL_CLKGEN_INT AUTOCAL_FAIL
+//
+//*****************************************************************************
+uint32_t
+am_hal_clkgen_int_status_get(bool bEnabledOnly)
+{
+    //
+    // Return the status.
+    //
+    if ( bEnabledOnly )
+    {
+        uint32_t u32RetVal = AM_REG(CLKGEN, INTSTAT);
+        u32RetVal &= AM_REG(CLKGEN, INTEN);
+        return u32RetVal;
+    }
+    else
+    {
+        return AM_REG(CLKGEN, INTSTAT);
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Clears the interrupts.
+//!
+//! @param ui32IntFlags interrupts to be cleared.
+//!
+//! This function clears the interrupts.
+//!
+//! Valid values for ui32IntFlags are:
+//!
+//!     AM_HAL_CLKGEN_INT_RTC_ALARM
+//!     AM_HAL_CLKGEN_INT_XT_FAIL
+//!     AM_HAL_CLKGEN_INT_AUTOCAL_COMPLETE
+//!     AM_HAL_CLKGEN_INT AUTOCAL_FAIL
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_clkgen_int_clear(uint32_t ui32Interrupt)
+{
+    //
+    // Clear the interrupts.
+    //
+    AM_REG(CLKGEN, INTCLR) = ui32Interrupt;
+}
+
+//*****************************************************************************
+//
+//! @brief Starts the desired oscillator(s) (OSC).
+//!
+//! @param ui32OscFlags oscillator(s) to start.
+//!
+//! This function starts the desired oscillator(s) (OSC).
+//!
+//! Valid values for ui32OscFlags are:
+//!
+//!     AM_HAL_CLKGEN_OSC_LFRC
+//!     AM_HAL_CLKGEN_OSC_XT
+//!
+//! @return 0 None.
+//
+//*****************************************************************************
+void
+am_hal_clkgen_osc_start(uint32_t ui32OscFlags)
+{
+    //
+    // Start the oscillator(s).
+    //
+    AM_REG(CLKGEN, OCTRL) &= ~ui32OscFlags;
+}
+
+//*****************************************************************************
+//
+//! @brief Stops the desired oscillator(s) (OSC).
+//!
+//! @param ui32OscFlags oscillator(s) to stop.
+//!
+//! This function stops the desired oscillator(s) (OSC).
+//!
+//! Valid values for ui32OscFlags are:
+//!
+//!     AM_HAL_CLKGEN_OSC_LFRC
+//!     AM_HAL_CLKGEN_OSC_XT
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_clkgen_osc_stop(uint32_t ui32OscFlags)
+{
+    //
+    // Stop the oscillator(s).
+    //
+    AM_REG(CLKGEN, OCTRL) |= ui32OscFlags;
+}
+
+//*****************************************************************************
+//
+//! @brief Enables the clock out signal.
+//!
+//! @param ui32Signal desired location for the clock out signal.
+//!
+//! This function enables the clock out signal. See am_hal_clkgen.h for
+//! available signals.
+//!
+//! e.g. AM_HAL_CLKGEN_CLKOUT_CKSEL_HFRC
+//!      AM_HAL_CLKGEN_CLKOUT_CKSEL_HFRC_DIV4
+//!      AM_HAL_CLKGEN_CLKOUT_CKSEL_LFRC
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_clkgen_clkout_enable(uint32_t ui32Signal)
+{
+    //
+    // Enable the clock out on desired signal.
+    //
+    AM_REG(CLKGEN, CLKOUT) = AM_REG_CLKGEN_CLKOUT_CKEN_M | ui32Signal;
+}
+
+//*****************************************************************************
+//
+//! @brief Disables the clock out signal.
+//!
+//! This function disables the clock out signal.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_clkgen_clkout_disable(void)
+{
+    //
+    // Disable the clock out.
+    //
+    AM_REG(CLKGEN, CLKOUT) = 0;
+}
+
+//*****************************************************************************
+//
+//! @brief Enable UART system clock.
+//!
+//! This function enables or disables the UART system clock.
+//!
+//! @param ui32Module is 0 or 1 for Apollo2.
+//! @param ui32UartEn is one of the following.
+//!     AM_HAL_CLKGEN_UARTEN_DIS
+//!     AM_HAL_CLKGEN_UARTEN_EN
+//!     AM_HAL_CLKGEN_UARTEN_REDUCE_FREQ
+//!     AM_HAL_CLKGEN_UARTEN_EN_POWER_SAV
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_clkgen_uarten_set(uint32_t ui32Module, uint32_t ui32UartEn)
+{
+    uint32_t ui32Mask;
+
+    if ( (ui32Module >= AM_REG_UART_NUM_MODULES)        ||
+         (ui32UartEn > AM_HAL_CLKGEN_UARTEN_EN_POWER_SAV) )
+    {
+        return;
+    }
+
+    ui32UartEn <<= (ui32Module * AM_HAL_CLKGEN_UARTEN_UARTENn_S(ui32Module));
+    ui32Mask = ~(AM_HAL_CLKGEN_UARTEN_UARTENn_M(ui32Module));
+
+    //
+    // Begin critical section.
+    //
+    AM_CRITICAL_BEGIN_ASM
+
+    //
+    // Set the UART clock
+    //
+    AM_REG(CLKGEN, UARTEN) &= ui32Mask;
+    AM_REG(CLKGEN, UARTEN) |= ui32UartEn;
+
+    //
+    // Begin critical section.
+    //
+    AM_CRITICAL_END_ASM
+}
+
+//*****************************************************************************
+//
+//! @brief Enables HFRC auto-adjustment at the specified interval.
+//!
+//! @param ui32Warmup - How long to give the HFRC to stabilize during each
+//! calibration attempt.
+//! @param ui32Frequency - How often the auto-adjustment should happen.
+//!
+//! This function enables HFRC auto-adjustment from an external crystal
+//! oscillator even when the crystal is not normally being used.
+//!
+//! ui32Warmup should be one of the following values:
+//!
+//!     AM_REG_CLKGEN_HFADJ_HFWARMUP_1SEC
+//!     AM_REG_CLKGEN_HFADJ_HFWARMUP_2SEC
+//!
+//! ui32Frequency should be one of the following values:
+//!
+//!     AM_REG_CLKGEN_HFADJ_HFADJCK_4SEC
+//!     AM_REG_CLKGEN_HFADJ_HFADJCK_16SEC
+//!     AM_REG_CLKGEN_HFADJ_HFADJCK_32SEC
+//!     AM_REG_CLKGEN_HFADJ_HFADJCK_64SEC
+//!     AM_REG_CLKGEN_HFADJ_HFADJCK_128SEC
+//!     AM_REG_CLKGEN_HFADJ_HFADJCK_256SEC
+//!     AM_REG_CLKGEN_HFADJ_HFADJCK_512SEC
+//!     AM_REG_CLKGEN_HFADJ_HFADJCK_1024SEC
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_clkgen_hfrc_adjust_enable(uint32_t ui32Warmup, uint32_t ui32Frequency)
+{
+    //
+    // Set the HFRC Auto-adjust register for the user's chosen settings. Assume
+    // that the HFRC should be calibrated to 48 MHz and that the crystal is
+    // running at 32.768 kHz.
+    //
+    AM_REG(CLKGEN, HFADJ) =
+         AM_REG_CLKGEN_HFADJ_HFADJ_GAIN_Gain_of_1_in_2                      |
+         ui32Warmup                                                         |
+         AM_REG_CLKGEN_HFADJ_HFXTADJ(AM_REG_CLKGEN_HFADJ_HFXTADJ_DEFAULT)   |
+         ui32Frequency                                                      |
+         AM_REG_CLKGEN_HFADJ_HFADJEN_EN;
+}
+
+//*****************************************************************************
+//
+//! @brief Disables HFRC auto-adjustment.
+//!
+//! This function disables HFRC auto-adjustment.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_clkgen_hfrc_adjust_disable(void)
+{
+    //
+    // Disable the clock out.
+    //
+    AM_REG(CLKGEN, HFADJ) =
+        AM_REG_CLKGEN_HFADJ_HFADJ_GAIN_Gain_of_1_in_2                       |
+        AM_REG_CLKGEN_HFADJ_HFWARMUP_1SEC                                   |
+        AM_REG_CLKGEN_HFADJ_HFXTADJ(AM_REG_CLKGEN_HFADJ_HFXTADJ_DEFAULT)    |
+        AM_REG_CLKGEN_HFADJ_HFADJCK_4SEC                                    |
+        AM_REG_CLKGEN_HFADJ_HFADJEN_DIS;
+}
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_clkgen.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_clkgen.h
new file mode 100644
index 000000000..203a2bd1e
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_clkgen.h
@@ -0,0 +1,205 @@
+//*****************************************************************************
+//
+//! @file am_hal_clkgen.h
+//!
+//! @brief Functions for accessing and configuring the CLKGEN.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_HAL_CLKGEN_H
+#define AM_HAL_CLKGEN_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+//*****************************************************************************
+//
+//! @name System Clock max frequency
+//! @brief Defines the maximum clock frequency for this device.
+//!
+//! These macros provide a definition of the maximum clock frequency.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_CLKGEN_FREQ_MAX_HZ       48000000
+#define AM_HAL_CLKGEN_FREQ_MAX_MHZ      (AM_HAL_CLKGEN_FREQ_MAX_HZ / 1000000)
+//! @}
+
+//*****************************************************************************
+//
+//! @name System Clock Selection
+//! @brief Divisor selection for the main system clock.
+//!
+//! These macros may be used along with the am_hal_clkgen_sysctl_select()
+//! function to select the frequency of the main system clock.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_CLKGEN_SYSCLK_MAX        AM_REG_CLKGEN_CCTRL_CORESEL_HFRC
+#define AM_HAL_CLKGEN_SYSCLK_48MHZ      AM_REG_CLKGEN_CCTRL_CORESEL_HFRC
+//! @}
+
+//*****************************************************************************
+//
+//! @name Interrupt Status Bits
+//! @brief Interrupt Status Bits for enable/disble use
+//!
+//! These macros may be used to set and clear interrupt bits.
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_CLKGEN_INT_ALM           AM_REG_CLKGEN_INTEN_ALM_M
+#define AM_HAL_CLKGEN_INT_OF            AM_REG_CLKGEN_INTEN_OF_M
+#define AM_HAL_CLKGEN_INT_ACC           AM_REG_CLKGEN_INTEN_ACC_M
+#define AM_HAL_CLKGEN_INT_ACF           AM_REG_CLKGEN_INTEN_ACF_M
+//! @}
+
+//*****************************************************************************
+//
+//! @name OSC Start and Stop
+//! @brief OSC Start and Stop defines.
+//!
+//! OSC Start and Stop defines to be used with \e am_hal_clkgen_osc_x().
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_CLKGEN_OSC_LFRC          AM_REG_CLKGEN_OCTRL_STOPRC_M
+#define AM_HAL_CLKGEN_OSC_XT            AM_REG_CLKGEN_OCTRL_STOPXT_M
+//! @}
+
+//*****************************************************************************
+//
+// OSC Start, Stop, Select defines
+//
+//*****************************************************************************
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_LFRC         AM_REG_CLKGEN_CLKOUT_CKSEL_LFRC
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_XT_DIV2      AM_REG_CLKGEN_CLKOUT_CKSEL_XT_DIV2
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_XT_DIV4      AM_REG_CLKGEN_CLKOUT_CKSEL_XT_DIV4
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_XT_DIV8      AM_REG_CLKGEN_CLKOUT_CKSEL_XT_DIV8
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_XT_DIV16     AM_REG_CLKGEN_CLKOUT_CKSEL_XT_DIV16
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_XT_DIV32     AM_REG_CLKGEN_CLKOUT_CKSEL_XT_DIV32
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_RTC_100Hz    AM_REG_CLKGEN_CLKOUT_CKSEL_RTC_100Hz
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_XT_DIV2M     AM_REG_CLKGEN_CLKOUT_CKSEL_XT_DIV2M
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_XT           AM_REG_CLKGEN_CLKOUT_CKSEL_XT
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_CG_100Hz     AM_REG_CLKGEN_CLKOUT_CKSEL_CG_100Hz
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_HFRC         AM_REG_CLKGEN_CLKOUT_CKSEL_HFRC
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_HFRC_DIV4    AM_REG_CLKGEN_CLKOUT_CKSEL_HFRC_DIV4
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_HFRC_DIV8    AM_REG_CLKGEN_CLKOUT_CKSEL_HFRC_DIV8
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_HFRC_DIV32   AM_REG_CLKGEN_CLKOUT_CKSEL_HFRC_DIV32
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_HFRC_DIV64   AM_REG_CLKGEN_CLKOUT_CKSEL_HFRC_DIV64
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_HFRC_DIV128  AM_REG_CLKGEN_CLKOUT_CKSEL_HFRC_DIV128
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_HFRC_DIV256  AM_REG_CLKGEN_CLKOUT_CKSEL_HFRC_DIV256
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_CORE_CLK     AM_REG_CLKGEN_CLKOUT_CKSEL_CORE_CLK
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_FLASH_CLK    AM_REG_CLKGEN_CLKOUT_CKSEL_FLASH_CLK
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_LFRC_DIV2    AM_REG_CLKGEN_CLKOUT_CKSEL_LFRC_DIV2
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_LFRC_DIV32   AM_REG_CLKGEN_CLKOUT_CKSEL_LFRC_DIV32
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_LFRC_DIV512  AM_REG_CLKGEN_CLKOUT_CKSEL_LFRC_DIV512
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_LFRC_DIV32K  AM_REG_CLKGEN_CLKOUT_CKSEL_LFRC_DIV32K
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_XT_DIV256    AM_REG_CLKGEN_CLKOUT_CKSEL_XT_DIV256
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_XT_DIV8K     AM_REG_CLKGEN_CLKOUT_CKSEL_XT_DIV8K
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_XT_DIV64K    AM_REG_CLKGEN_CLKOUT_CKSEL_XT_DIV64K
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_ULFRC_DIV16  AM_REG_CLKGEN_CLKOUT_CKSEL_ULFRC_DIV16
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_ULFRC_DIV128 AM_REG_CLKGEN_CLKOUT_CKSEL_ULFRC_DIV128
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_ULFRC_1Hz    AM_REG_CLKGEN_CLKOUT_CKSEL_ULFRC_1Hz
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_ULFRC_DIV4K  AM_REG_CLKGEN_CLKOUT_CKSEL_ULFRC_DIV4K
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_ULFRC_DIV1M  AM_REG_CLKGEN_CLKOUT_CKSEL_ULFRC_DIV1M
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_HFRC_DIV64K  AM_REG_CLKGEN_CLKOUT_CKSEL_HFRC_DIV64K
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_HFRC_DIV16M  AM_REG_CLKGEN_CLKOUT_CKSEL_HFRC_DIV16M
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_LFRC_DIV2M   AM_REG_CLKGEN_CLKOUT_CKSEL_LFRC_DIV2M
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_HFRCNE       AM_REG_CLKGEN_CLKOUT_CKSEL_HFRCNE
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_HFRCNE_DIV8  AM_REG_CLKGEN_CLKOUT_CKSEL_HFRCNE_DIV8
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_CORE_CLKNE   AM_REG_CLKGEN_CLKOUT_CKSEL_CORE_CLKNE
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_XTNE         AM_REG_CLKGEN_CLKOUT_CKSEL_XTNE
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_XTNE_DIV16   AM_REG_CLKGEN_CLKOUT_CKSEL_XTNE_DIV16
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_LFRCNE_DIV32 AM_REG_CLKGEN_CLKOUT_CKSEL_LFRCNE_DIV32
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_FCLKNE       AM_REG_CLKGEN_CLKOUT_CKSEL_FCLKNE
+#define AM_HAL_CLKGEN_CLKOUT_CKSEL_LFRCNE       AM_REG_CLKGEN_CLKOUT_CKSEL_LFRCNE
+
+//*****************************************************************************
+//
+// UARTEN
+//
+//*****************************************************************************
+#define AM_HAL_CLKGEN_UARTEN_DIS          AM_REG_CLKGEN_UARTEN_UART0EN_DIS
+#define AM_HAL_CLKGEN_UARTEN_EN           AM_REG_CLKGEN_UARTEN_UART0EN_EN
+#define AM_HAL_CLKGEN_UARTEN_REDUCE_FREQ  AM_REG_CLKGEN_UARTEN_UART0EN_REDUCE_FREQ
+#define AM_HAL_CLKGEN_UARTEN_EN_POWER_SAV AM_REG_CLKGEN_UARTEN_UART0EN_EN_POWER_SAV
+
+#define AM_HAL_CLKGEN_UARTEN_UARTENn_S(module)                                  \
+        ((module) *                                                             \
+        (AM_REG_CLKGEN_UARTEN_UART1EN_S - AM_REG_CLKGEN_UARTEN_UART0EN_S))
+
+#define AM_HAL_CLKGEN_UARTEN_UARTENn_M(module)                                  \
+        (AM_REG_CLKGEN_UARTEN_UART0EN_M << AM_HAL_CLKGEN_UARTEN_UARTENn_S(module))
+
+//
+// UARTEN: entype is one of DIS, EN, REDUCE_FREQ, EN_POWER_SAV.
+//
+#define AM_HAL_CLKGEN_UARTEN_UARTENn(module, entype)                            \
+        (AM_REG_CLKGEN_UARTEN_UART0EN_##entype <<                               \
+         AM_HAL_CLKGEN_UARTEN_UARTENn_S(module))
+
+//*****************************************************************************
+//
+// External function definitions
+//
+//*****************************************************************************
+extern void am_hal_clkgen_sysclk_select(uint32_t ui32ClockSetting);
+extern uint32_t am_hal_clkgen_sysclk_get(void);
+extern void am_hal_clkgen_osc_start(uint32_t ui32OscFlags);
+extern void am_hal_clkgen_osc_stop(uint32_t ui32OscFlags);
+extern void am_hal_clkgen_clkout_enable(uint32_t ui32Signal);
+extern void am_hal_clkgen_clkout_disable(void);
+extern void am_hal_clkgen_uarten_set(uint32_t ui32Module, uint32_t ui32UartEn);
+extern void am_hal_clkgen_int_enable(uint32_t ui32Interrupt);
+extern uint32_t am_hal_clkgen_int_enable_get(void);
+extern void am_hal_clkgen_int_disable(uint32_t ui32Interrupt);
+extern void am_hal_clkgen_int_clear(uint32_t ui32Interrupt);
+extern void am_hal_clkgen_int_set(uint32_t ui32Interrupt);
+extern uint32_t am_hal_clkgen_int_status_get(bool bEnabledOnly);
+extern void am_hal_clkgen_hfrc_adjust_enable(uint32_t ui32Warmup, uint32_t ui32Frequency);
+extern void am_hal_clkgen_hfrc_adjust_disable(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_HAL_CLKGEN_H
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_ctimer.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_ctimer.c
new file mode 100644
index 000000000..c8c1dbb99
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_ctimer.c
@@ -0,0 +1,1655 @@
+//*****************************************************************************
+//
+//! @file am_hal_ctimer.c
+//!
+//! @brief Functions for interfacing with the Counter/Timer module.
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup ctimer Counter/Timer (CTIMER)
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "am_mcu_apollo.h"
+
+//*****************************************************************************
+//
+// Address space distance between timer configuration registers.
+//
+//*****************************************************************************
+#define MAX_CTIMERS         4
+#define TIMER_OFFSET        (AM_REG_CTIMER_TMR1_O - AM_REG_CTIMER_TMR0_O)
+#define CTIMER_CMPR_OFFSET  (AM_REG_CTIMER_CMPRB0_O - AM_REG_CTIMER_CMPRA0_O)
+
+//*****************************************************************************
+//
+// Adjacency check
+//
+// This is related to the timer read workaround. This macro checks to see if
+// the two supplied count values are within one "tick" of eachother. It should
+// still pass in the event of a timer rollover.
+//
+//*****************************************************************************
+#define adjacent(A, B)      (((A) == (B)) || (((A) + 1) == (B)) || ((B) == 0))
+
+//*****************************************************************************
+//
+// Array of function pointers for handling CTimer interrupts.
+//
+//*****************************************************************************
+am_hal_ctimer_handler_t am_hal_ctimer_ppfnHandlers[16];
+
+//*****************************************************************************
+//
+// Static function for reading the timer value.
+//
+//*****************************************************************************
+#if defined(__GNUC_STDC_INLINE__)
+__attribute__((naked))
+static
+void
+back2back_reads(uint32_t u32TimerAddr, uint32_t u32Data[])
+{
+    // u32TimerAddr = address of the timer to be read.
+    // u32Data[] is a pointer to a 3 word data array provided by the caller.
+    __asm
+    (
+        // Do 3 back-to-back reads of the register
+        "   push    {r4}\n"                     // Save r4
+        "   push    {r1}\n"                     // Save the data array ptr for later
+        "   mov     r2, r0\n"                   // Get Timer Addr
+        "   mrs     r4, PRIMASK\n"              // Save PRIMASK
+        "   cpsid   i\n"                        // __disable_irq()
+        "   nop\n"                              // Give the disable a cycle to take affect (but almost certainly not really needed)
+        "   ldr     r0, [r2, #0]\n"             // Get TMRn register value
+        "   ldr     r1, [r2, #0]\n"             // Get TMRn register value again
+        "   ldr     r3, [r2, #0]\n"             // Get TMRn register value for a third time
+        "   msr     PRIMASK, r4\n"              // Restore PRIMASK
+        "   pop     {r2}\n"                     // Get the array ptr
+        "   str     r0, [r2, #0]\n"             // Store register value to variable
+        "   str     r1, [r2, #4]\n"             // Store register value to variable
+        "   str     r3, [r2, #8]\n"             // Store register value to variable
+        "   pop     {r4}\n"                     // restore r4
+        "   bx      lr\n"
+    );
+}
+
+#elif defined(__ARMCC_VERSION)
+__asm static uint32_t
+back2back_reads( uint32_t u32TimerAddr, uint32_t u32Data[])
+{
+    push    {r4}                     // Save r4
+    push    {r1}                     // Save the data array ptr for later
+    mov     r2, r0                   // Get Timer Addr
+    mrs     r4, PRIMASK              // Save PRIMASK
+    cpsid   i                        // __disable_irq()
+    nop                              // Give the disable a cycle to take affect (but almost certainly not really needed)
+    ldr     r0, [r2, #0]             // Get TMRn register value
+    ldr     r1, [r2, #0]             // Get TMRn register value again
+    ldr     r3, [r2, #0]             // Get TMRn register value for a third time
+    msr     PRIMASK, r4              // Restore PRIMASK
+    pop     {r2}                     // Get the array ptr
+    str     r0, [r2, #0]             // Store register value to variable
+    str     r1, [r2, #4]             // Store register value to variable
+    str     r3, [r2, #8]             // Store register value to variable
+    pop     {r4}                     // Restore r4
+    bx      lr
+}
+
+#elif defined(__IAR_SYSTEMS_ICC__)
+#pragma diag_suppress = Pe940   // Suppress IAR compiler warning about missing
+                                // return statement on a non-void function
+__stackless static uint32_t
+back2back_reads( uint32_t u32TimerAddr, uint32_t u32Data[])
+{
+    __asm("    push    {r4}");          // Save r4
+    __asm("    push    {r1}");          // Save the data array ptr for later
+    __asm("    mov     r2, r0");        // Get Timer Addr
+    __asm("    mrs     r4, PRIMASK");   // Save PRIMASK"
+    __asm("    cpsid   i");             // __disable_irq()
+    __asm("    nop");                   // Give the disable a cycle to take affect (but almost certainly not really needed)
+    __asm("    ldr     r0, [r2, #0]");  // Get TMRn register value
+    __asm("    ldr     r1, [r2, #0]");  // Get TMRn register value again
+    __asm("    ldr     r3, [r2, #0]");  // Get TMRn register value for a third time
+    __asm("    msr     PRIMASK, r4");   // Restore PRIMASK
+    __asm("    pop     {r2}");          // Get the array ptr
+    __asm("    str     r0, [r2, #0]");  // Store register value to variable
+    __asm("    str     r1, [r2, #4]");  // Store register value to variable
+    __asm("    str     r3, [r2, #8]");  // Store register value to variable
+    __asm("    pop     {r4}");          // Restore r4
+    __asm("    bx      lr");
+}
+#pragma diag_default = Pe940    // Restore IAR compiler warning
+#endif
+
+//*****************************************************************************
+//
+// Forward Declaration.
+//
+//*****************************************************************************
+static bool am_hal_ctimers_use_hfrc(void);
+
+//*****************************************************************************
+//
+//! @brief Convenience function for responding to CTimer interrupts.
+//!
+//! @param ui32Status is the interrupt status as returned by
+//! am_hal_ctimer_int_status_get()
+//!
+//! This function may be called from am_ctimer_isr() to read the status of
+//! the CTimer interrupts, determine which source caused the most recent
+//! interrupt, and call an interrupt handler function to respond. The interrupt
+//! handler to be called must be first registered with the
+//! am_hal_ctimer_int_register() function.
+//!
+//! In the event that multiple sources are active, the corresponding
+//! interrupt handlers will be called in numerical order based on interrupt def.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ctimer_int_service(uint32_t ui32Status)
+{
+    uint32_t ui32Clz;
+
+    am_hal_ctimer_handler_t pfnHandler;
+
+    ui32Status &= 0xFFFF;
+
+    while ( ui32Status )
+    {
+        //
+        // Pick one of any remaining active interrupt bits
+        //
+#ifdef __IAR_SYSTEMS_ICC__
+        ui32Clz = __CLZ(ui32Status);
+#else
+        ui32Clz = __builtin_clz(ui32Status);
+#endif
+
+        //
+        // Turn off the bit we picked in the working copy
+        //
+        ui32Status &= ~(0x80000000 >> ui32Clz);
+
+        //
+        // Check the bit handler table to see if there is an interrupt handler
+        // registered for this particular bit.
+        //
+        pfnHandler = am_hal_ctimer_ppfnHandlers[31 - ui32Clz];
+        if ( pfnHandler )
+        {
+            //
+            // If we found an interrupt handler routine, call it now.
+            //
+            pfnHandler();
+        }
+    }
+
+}
+
+//*****************************************************************************
+//
+//! @brief Register an interrupt handler for CTimer.
+//!
+//! @param ui32Interrupt - interrupt number to assign this interrupt handler to.
+//! @param pfnHandler - Function to call when this interrupt is received.
+//!
+//! This function allows the caller to specify a function that should be called
+//! any time a Ctimer interrupt is received. Registering an
+//! interrupt handler using this function adds the function pointer to an array
+//! in SRAM. This interrupt handler will be called by am_hal_ctimer_int_service()
+//! whenever the ui32Status parameter indicates that the corresponding interrupt.
+//!
+//! To remove an interrupt handler that has already been registered, the
+//! pfnHandler parameter may be set to zero.
+//!
+//! @note This function will not have any effect unless the
+//! am_hal_ctimer_int_service() function is being used.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ctimer_int_register(uint32_t ui32Interrupt,
+                           am_hal_ctimer_handler_t pfnHandler)
+{
+    uint32_t intIdx = 0;
+    //
+    // Check to make sure the interrupt number is valid. (Debug builds only)
+    //
+    switch(ui32Interrupt)
+    {
+        case AM_REG_CTIMER_INTEN_CTMRA0C0INT_M:
+            intIdx = AM_REG_CTIMER_INTEN_CTMRA0C0INT_S;
+            break;
+
+        case AM_REG_CTIMER_INTEN_CTMRB0C0INT_M:
+            intIdx = AM_REG_CTIMER_INTEN_CTMRB0C0INT_S;
+            break;
+
+        case AM_REG_CTIMER_INTEN_CTMRA1C0INT_M:
+            intIdx = AM_REG_CTIMER_INTEN_CTMRA1C0INT_S;
+            break;
+
+        case AM_REG_CTIMER_INTEN_CTMRB1C0INT_M:
+            intIdx = AM_REG_CTIMER_INTEN_CTMRB1C0INT_S;
+            break;
+
+        case AM_REG_CTIMER_INTEN_CTMRA2C0INT_M:
+            intIdx = AM_REG_CTIMER_INTEN_CTMRA2C0INT_S;
+            break;
+
+        case AM_REG_CTIMER_INTEN_CTMRB2C0INT_M:
+            intIdx = AM_REG_CTIMER_INTEN_CTMRB2C0INT_S;
+            break;
+
+        case AM_REG_CTIMER_INTEN_CTMRA3C0INT_M:
+            intIdx = AM_REG_CTIMER_INTEN_CTMRA3C0INT_S;
+            break;
+
+        case AM_REG_CTIMER_INTEN_CTMRB3C0INT_M:
+            intIdx = AM_REG_CTIMER_INTEN_CTMRB3C0INT_S;
+            break;
+
+        case AM_REG_CTIMER_INTEN_CTMRA0C1INT_M:
+            intIdx = AM_REG_CTIMER_INTEN_CTMRA0C1INT_S;
+            break;
+
+        case AM_REG_CTIMER_INTEN_CTMRB0C1INT_M:
+            intIdx = AM_REG_CTIMER_INTEN_CTMRB0C1INT_S;
+            break;
+
+        case AM_REG_CTIMER_INTEN_CTMRA1C1INT_M:
+            intIdx = AM_REG_CTIMER_INTEN_CTMRA1C1INT_S;
+            break;
+
+        case AM_REG_CTIMER_INTEN_CTMRB1C1INT_M:
+            intIdx = AM_REG_CTIMER_INTEN_CTMRB1C1INT_S;
+            break;
+
+        case AM_REG_CTIMER_INTEN_CTMRA2C1INT_M:
+            intIdx = AM_REG_CTIMER_INTEN_CTMRA2C1INT_S;
+            break;
+
+        case AM_REG_CTIMER_INTEN_CTMRB2C1INT_M:
+            intIdx = AM_REG_CTIMER_INTEN_CTMRB2C1INT_S;
+            break;
+
+        case AM_REG_CTIMER_INTEN_CTMRA3C1INT_M:
+            intIdx = AM_REG_CTIMER_INTEN_CTMRA3C1INT_S;
+            break;
+
+        case AM_REG_CTIMER_INTEN_CTMRB3C1INT_M:
+            intIdx = AM_REG_CTIMER_INTEN_CTMRB3C1INT_S;
+            break;
+
+        default:
+            am_hal_debug_assert_msg(false, "CTimer interrupt number out of range.");
+    }
+    am_hal_ctimer_ppfnHandlers[intIdx] = pfnHandler;
+}
+
+//*****************************************************************************
+//
+//! @brief Set up the counter/timer.
+//!
+//! @param ui32TimerNumber is the number of the Timer that should be
+//! configured.
+//!
+//! @param psConfig is a pointer to a structure that holds important settings
+//! for the timer.
+//!
+//! This function should be used to perform the initial set-up of the
+//! counter-timer.
+//!
+//! @note This function will eventually be replaced by
+//! am_hal_ctimer_config_single(), which performs the same configuration
+//! without requiring a structure. Please use am_hal_ctimer_config_single() for
+//! new development.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ctimer_config(uint32_t ui32TimerNumber,
+                     am_hal_ctimer_config_t *psConfig)
+{
+    uint32_t *pui32ConfigReg;
+    uint32_t ui32ConfigVal;
+
+    //
+    // Start preparing the configuration word for this timer. The configuration
+    // values for Timer A and Timer B provided in the config structure should
+    // match the register definitions already, so we will mostly just need to
+    // OR them together.
+    //
+    ui32ConfigVal = ( (psConfig->ui32TimerAConfig)  |
+                      (psConfig->ui32TimerBConfig << 16) );
+
+    //
+    // OR in the Link bit if the timers need to be linked.
+    //
+    ui32ConfigVal |= psConfig->ui32Link ? AM_HAL_CTIMER_LINK : 0;
+
+    //
+    // Find the correct register to write.
+    //
+    pui32ConfigReg = (uint32_t *)(AM_REG_CTIMERn(0) + AM_REG_CTIMER_CTRL0_O +
+                                  (ui32TimerNumber * TIMER_OFFSET));
+
+    //
+    // Write our configuration value.
+    //
+    AM_REGVAL(pui32ConfigReg) = ui32ConfigVal;
+
+    //
+    // If all of the clock sources are not HRFC disable LDO when sleeping if timers are enabled.
+    //
+    if ( am_hal_ctimers_use_hfrc() )
+    {
+        AM_BFW(PWRCTRL, MISCOPT, DIS_LDOLPMODE_TIMERS, 0);
+    }
+    else
+    {
+        AM_BFW(PWRCTRL, MISCOPT, DIS_LDOLPMODE_TIMERS, 1);
+    }
+
+}
+
+//*****************************************************************************
+//
+//! @brief Set up the counter/timer.
+//!
+//! @param ui32TimerNumber is the number of the Timer that should be
+//! configured.
+//!
+//! @param ui32TimerSegment specifies which segment of the timer should be
+//! enabled.
+//!
+//! @param ui32Configval specifies the configuration options for the selected
+//! timer.
+//!
+//! This function should be used to perform the initial set-up of the
+//! counter-timer. It can be used to configure either a 16-bit timer (A or B) or a
+//! 32-bit timer using the BOTH option.
+//!
+//! Valid values for ui32TimerSegment are:
+//!
+//!     AM_HAL_CTIMER_TIMERA
+//!     AM_HAL_CTIMER_TIMERB
+//!     AM_HAL_CTIMER_BOTH
+//!
+//! The timer's clock source, mode, interrupt, and external pin behavior are
+//! all controlled through the \e ui32Configval parameter. The valid options
+//! for ui32ConfigVal include any ORed together combination of the following:
+//!
+//! Clock configuration macros:
+//!
+//!     AM_HAL_CTIMER_HFRC_24MHZ
+//!     AM_HAL_CTIMER_LFRC_512HZ
+//!     ... etc. (See am_hal_ctimer.h for the full set of options.)
+//!
+//! Mode selection macros:
+//!
+//!     AM_HAL_CTIMER_FN_ONCE
+//!     AM_HAL_CTIMER_FN_REPEAT
+//!     AM_HAL_CTIMER_FN_PWM_ONCE
+//!     AM_HAL_CTIMER_FN_PWM_REPEAT
+//!     AM_HAL_CTIMER_FN_CONTINUOUS
+//!
+//! Interrupt control:
+//!
+//!     AM_HAL_CTIMER_INT_ENABLE
+//!
+//! Pin control:
+//!
+//!     AM_HAL_CTIMER_PIN_ENABLE
+//!     AM_HAL_CTIMER_PIN_INVERT
+//!
+//! ADC trigger (Timer 3 only):
+//!
+//!     AM_HAL_CTIMER_ADC_TRIG
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ctimer_config_single(uint32_t ui32TimerNumber,
+                            uint32_t ui32TimerSegment,
+                            uint32_t ui32ConfigVal)
+{
+    volatile uint32_t *pui32ConfigReg;
+    uint32_t ui32WriteVal;
+
+    //
+    // Find the correct register to write based on the timer number.
+    //
+    pui32ConfigReg = (uint32_t *)(AM_REG_CTIMERn(0) + AM_REG_CTIMER_CTRL0_O +
+                                  (ui32TimerNumber * TIMER_OFFSET));
+
+    //
+    // Begin critical section while config registers are read and modified.
+    //
+    AM_CRITICAL_BEGIN_ASM
+
+    //
+    // Save the value that's already in the register.
+    //
+    ui32WriteVal = AM_REGVAL(pui32ConfigReg);
+
+    //
+    // If we're working with TIMERB, we need to shift our configuration value
+    // up by 16 bits.
+    //
+    if ( ui32TimerSegment == AM_HAL_CTIMER_TIMERB )
+    {
+        ui32ConfigVal = ((ui32ConfigVal & 0xFFFF) << 16);
+    }
+
+    //
+    // Replace part of the saved register value with the configuration value
+    // from the caller.
+    //
+    ui32WriteVal = (ui32WriteVal & ~(ui32TimerSegment)) | ui32ConfigVal;
+
+    //
+    // If we're configuring both timers, we need to set the "link" bit.
+    //
+    if ( ui32TimerSegment == AM_HAL_CTIMER_BOTH )
+    {
+        ui32WriteVal |= AM_HAL_CTIMER_LINK;
+    }
+
+    //
+    // Write our completed configuration value.
+    //
+    AM_REGVAL(pui32ConfigReg) = ui32WriteVal;
+
+    //
+    // Done with critical section.
+    //
+    AM_CRITICAL_END_ASM
+
+    //
+    // If all of the clock sources are not HRFC disable LDO when sleeping if timers are enabled.
+    //
+    if ( am_hal_ctimers_use_hfrc() )
+    {
+      AM_BFW(PWRCTRL, MISCOPT, DIS_LDOLPMODE_TIMERS, 0);
+    }
+    else
+    {
+      AM_BFW(PWRCTRL, MISCOPT, DIS_LDOLPMODE_TIMERS, 1);
+    }
+
+}
+
+//*****************************************************************************
+//
+//! @brief Check to see if any of the CTimers is using the HFRC
+//!
+//! This function should be used to check if the HFRC is being used in order
+//! to correctly establish power related settings.
+//!
+//! @return None.
+//
+//*****************************************************************************
+static bool
+am_hal_ctimers_use_hfrc(void)
+{
+    uint32_t *pui32ConfigReg;
+    uint32_t ui32TimerASrc;
+    uint32_t ui32TimerBSrc;
+    uint32_t ui32CtimerIndex;
+
+    //
+    // Check STimer to see if it is set to use HFRC
+    //
+    if ( (AM_BFR(CTIMER, STCFG, CLKSEL) == AM_REG_CTIMER_STCFG_CLKSEL_HFRC_DIV16)   ||
+         (AM_BFR(CTIMER, STCFG, CLKSEL) == AM_REG_CTIMER_STCFG_CLKSEL_HFRC_DIV256) )
+    {
+        return true;
+    }
+
+    //
+    //  Check all the CTimers to see if they use HFRC
+    //
+    for ( ui32CtimerIndex = 0; ui32CtimerIndex < MAX_CTIMERS; ui32CtimerIndex++ )
+    {
+        //
+        // Find the correct register to write.
+        //
+        pui32ConfigReg = (uint32_t *)(AM_REG_CTIMERn(0) + AM_REG_CTIMER_CTRL0_O +
+                                      (ui32CtimerIndex * TIMER_OFFSET));
+
+        //
+        // If clock source is not HRFC, we must disable LDO when sleeping.
+        // The value we are looking for is HFRC_DIV4 to HFRC_DIV4K.
+        // Get the clock sources and 0-base the extracted value.
+        //
+        ui32TimerASrc = AM_BFX(CTIMER, CTRL0, TMRA0CLK, *pui32ConfigReg) -
+                        AM_ENUMX(CTIMER, CTRL0, TMRA0CLK, HFRC_DIV4);
+        ui32TimerBSrc = AM_BFX(CTIMER, CTRL0, TMRB0CLK, *pui32ConfigReg) -
+                        AM_ENUMX(CTIMER, CTRL0, TMRB0CLK, HFRC_DIV4);
+
+        //
+        // If the source value is 0 to (HFRC_DIV4K - HFRC_DIV4), then it's HFRC.
+        //
+        if ( (ui32TimerASrc <= (AM_ENUMX(CTIMER, CTRL0, TMRA0CLK, HFRC_DIV4K) -
+                                AM_ENUMX(CTIMER, CTRL0, TMRA0CLK, HFRC_DIV4)))  ||
+             (ui32TimerBSrc <= (AM_ENUMX(CTIMER, CTRL0, TMRB0CLK, HFRC_DIV4K) -
+                                AM_ENUMX(CTIMER, CTRL0, TMRB0CLK, HFRC_DIV4))) )
+        {
+            return true;
+        }
+    }
+
+    return false;
+}
+
+//*****************************************************************************
+//
+//! @brief Start a timer
+//!
+//! @param ui32TimerNumber is the number of the timer to enable
+//!
+//! @param ui32TimerSegment specifies which segment of the timer should be
+//! enabled.  Valid values for ui32TimerSegment are:
+//!     AM_HAL_CTIMER_TIMERA
+//!     AM_HAL_CTIMER_TIMERB
+//!     AM_HAL_CTIMER_BOTH
+//!
+//! This function will enable a timer to begin incrementing. The \e
+//! ui32TimerNumber parameter selects the timer that should be enabled, for
+//! example, a 0 would target TIMER0. The \e ui32TimerSegment parameter allows
+//! the caller to individually select a segment within a timer to be enabled,
+//! such as TIMER0A, TIMER0B, or both.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ctimer_start(uint32_t ui32TimerNumber, uint32_t ui32TimerSegment)
+{
+    volatile uint32_t *pui32ConfigReg;
+    uint32_t ui32ConfigVal;
+
+    //
+    // Find the correct control register.
+    //
+    pui32ConfigReg = (uint32_t *)(AM_REG_CTIMERn(0) + AM_REG_CTIMER_CTRL0_O +
+                                  (ui32TimerNumber * TIMER_OFFSET));
+
+    //
+    // Begin critical section while config registers are read and modified.
+    //
+    AM_CRITICAL_BEGIN_ASM
+
+    //
+    // Read the current value.
+    //
+    ui32ConfigVal = *pui32ConfigReg;
+
+    //
+    // Clear out the "clear" bit.
+    //
+    ui32ConfigVal &= ~(ui32TimerSegment & (AM_REG_CTIMER_CTRL0_TMRA0CLR_M |
+                                           AM_REG_CTIMER_CTRL0_TMRB0CLR_M));
+
+    //
+    // Set the "enable bit"
+    //
+    ui32ConfigVal |= (ui32TimerSegment & (AM_REG_CTIMER_CTRL0_TMRA0EN_M |
+                                          AM_REG_CTIMER_CTRL0_TMRB0EN_M));
+
+    //
+    // Write the value back to the register.
+    //
+    AM_REGVAL(pui32ConfigReg) = ui32ConfigVal;
+
+    //
+    // Done with critical section.
+    //
+    AM_CRITICAL_END_ASM
+}
+
+//*****************************************************************************
+//
+//! @brief Stop a timer
+//!
+//! @param ui32TimerNumber is the number of the timer to disable.
+//!
+//! @param ui32TimerSegment specifies which segment of the timer should be
+//! disabled.
+//!
+//! This function will stop the selected timer from incrementing. The \e
+//! ui32TimerNumber parameter selects the timer that should be disabled, for
+//! example, a 0 would target TIMER0. The \e ui32TimerSegment parameter allows
+//! the caller to individually select a segment within a timer to be disabled,
+//! such as TIMER0A, TIMER0B, or both.
+//!
+//! This function will stop a counter/timer from counting, but does not return
+//! the count value to 'zero'. If you would like to reset the counter back to
+//! zero, try the am_hal_ctimer_clear() function instead.
+//!
+//! Valid values for ui32TimerSegment are:
+//!
+//!     AM_HAL_CTIMER_TIMERA
+//!     AM_HAL_CTIMER_TIMERB
+//!     AM_HAL_CTIMER_BOTH
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ctimer_stop(uint32_t ui32TimerNumber, uint32_t ui32TimerSegment)
+{
+    volatile uint32_t *pui32ConfigReg;
+
+    //
+    // Find the correct control register.
+    //
+    pui32ConfigReg = (uint32_t *)(AM_REG_CTIMERn(0) + AM_REG_CTIMER_CTRL0_O +
+                                  (ui32TimerNumber * TIMER_OFFSET));
+
+    //
+    // Begin critical section.
+    //
+    AM_CRITICAL_BEGIN_ASM
+
+    //
+    // Clear the "enable" bit
+    //
+    AM_REGVAL(pui32ConfigReg) &= ~(ui32TimerSegment &
+                                   (AM_REG_CTIMER_CTRL0_TMRA0EN_M |
+                                    AM_REG_CTIMER_CTRL0_TMRB0EN_M));
+
+    //
+    // Done with critical section.
+    //
+    AM_CRITICAL_END_ASM
+}
+
+//*****************************************************************************
+//
+//! @brief Stops a timer and resets its value back to zero.
+//!
+//! @param ui32TimerNumber is the number of the timer to clear.
+//!
+//! @param ui32TimerSegment specifies which segment of the timer should be
+//! cleared.
+//!
+//! This function will stop a free-running counter-timer, reset its value to
+//! zero, and leave the timer disabled. When you would like to restart the
+//! counter, you will need to call am_hal_ctimer_enable().
+//!
+//! The \e ui32TimerSegment parameter allows the caller to individually select
+//! a segment within, such as TIMER0A, TIMER0B, or both.
+//!
+//! Valid values for ui32TimerSegment are:
+//!
+//!     AM_HAL_CTIMER_TIMERA
+//!     AM_HAL_CTIMER_TIMERB
+//!     AM_HAL_CTIMER_BOTH
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ctimer_clear(uint32_t ui32TimerNumber, uint32_t ui32TimerSegment)
+{
+    volatile uint32_t *pui32ConfigReg;
+
+    //
+    // Find the correct control register.
+    //
+    pui32ConfigReg = (uint32_t *)(AM_REG_CTIMERn(0) + AM_REG_CTIMER_CTRL0_O +
+                                  (ui32TimerNumber * TIMER_OFFSET));
+
+    //
+    // Begin critical section.
+    //
+    AM_CRITICAL_BEGIN_ASM
+
+    //
+    // Set the "clear" bit
+    //
+    AM_REGVAL(pui32ConfigReg) |= (ui32TimerSegment &
+                                  (AM_REG_CTIMER_CTRL0_TMRA0CLR_M |
+                                   AM_REG_CTIMER_CTRL0_TMRB0CLR_M));
+
+    //
+    // Done with critical section.
+    //
+    AM_CRITICAL_END_ASM
+}
+
+//*****************************************************************************
+//
+//! @brief Returns the current free-running value of the selected timer.
+//!
+//! @param ui32TimerNumber is the number of the timer to read.
+//! @param ui32TimerSegment specifies which segment of the timer should be
+//! read.
+//!
+//! This function returns the current free-running value of the selected timer.
+//!
+//! @note When reading from a linked timer, be sure to use AM_HAL_CTIMER both
+//! for the segment argument.
+//!
+//! Valid values for ui32TimerSegment are:
+//!
+//!     AM_HAL_CTIMER_TIMERA
+//!     AM_HAL_CTIMER_TIMERB
+//!     AM_HAL_CTIMER_BOTH
+//!
+//! @return Current timer value.
+//
+//*****************************************************************************
+uint32_t
+am_hal_ctimer_read(uint32_t ui32TimerNumber, uint32_t ui32TimerSegment)
+{
+    volatile uint32_t ui32Value = 0;
+    uint32_t ui32Values[3] = {0};
+    uint32_t ui32TimerAddrTbl[4] =
+    {
+        REG_CTIMER_BASEADDR + AM_REG_CTIMER_TMR0_O,
+        REG_CTIMER_BASEADDR + AM_REG_CTIMER_TMR1_O,
+        REG_CTIMER_BASEADDR + AM_REG_CTIMER_TMR2_O,
+        REG_CTIMER_BASEADDR + AM_REG_CTIMER_TMR3_O
+    };
+
+    //
+    // Read the timer with back2back reads. This is a workaround for a clock
+    // domain synchronization issue. Some timer bits may be slow to increment,
+    // which means that the value in the timer register will sometimes be
+    // wrong.
+    //
+    // The architecture guarantees that:
+    //
+    // 1) If the timer is running at a speed close to the core frequency, the
+    // core and timer clock domains will be synchronized, and no "bad" reads
+    // will happen.
+    //
+    // 2) Bad reads will only happen if the core reads the timer register while
+    // the timer value is transitioning from one count to the next.
+    //
+    // 3) The timer will resolve to the correct value within one 24 MHz clock
+    // cycle.
+    //
+    // If we read the timer three times in a row with back-to-back load
+    // instructions, then we can guarantee that the timer will only have time
+    // to increment once, and that only one of the three reads can be wrong.
+    // This routine will perform the back-to-back reads and return all three
+    // values. The rest of this fuction determines which value we should
+    // actually use.
+    //
+    back2back_reads(ui32TimerAddrTbl[ui32TimerNumber], ui32Values);
+
+    //
+    // Shift or mask the values based on the given timer segment.
+    //
+    if ( ui32TimerSegment == AM_HAL_CTIMER_TIMERB )
+    {
+        ui32Values[0] >>= 16;
+        ui32Values[1] >>= 16;
+        ui32Values[2] >>= 16;
+    }
+    else if ( ui32TimerSegment == AM_HAL_CTIMER_TIMERA )
+    {
+        ui32Values[0] &= 0xFFFF;
+        ui32Values[1] &= 0xFFFF;
+        ui32Values[2] &= 0xFFFF;
+    }
+
+    //
+    // Now, we'll figure out which of the three values is the correct time.
+    //
+    if (ui32Values[0] == ui32Values[1])
+    {
+        //
+        // If the first two values match, then neither one was a bad read.
+        // We'll take this as the current time.
+        //
+        ui32Value = ui32Values[1];
+    }
+    else
+    {
+        //
+        // If the first two values didn't match, then one of them might be bad.
+        // If one of the first two values is bad, then the third one should
+        // always be correct. We'll take the third value as the correct time.
+        //
+        ui32Value = ui32Values[2];
+
+        //
+        // If all of the statements about the architecture are true, the third
+        // value should be correct, and it should always be within one count of
+        // either the first or the second value.
+        //
+        // Just in case, we'll check against the previous two values to make
+        // sure that our final answer was reasonable. If it isn't, we will
+        // flag it as a "bad read", and fail this assert statement.
+        //
+        // This shouldn't ever happen, and it hasn't ever happened in any of
+        // our tests so far.
+        //
+        am_hal_debug_assert_msg((adjacent(ui32Values[1], ui32Values[2]) ||
+                                 adjacent(ui32Values[0], ui32Values[2])),
+                                "Bad CTIMER read");
+    }
+
+    return ui32Value;
+}
+
+//*****************************************************************************
+//
+//! @brief Enable output to the timer pin
+//!
+//! @param ui32TimerNumber is the number of the timer to configure.
+//!
+//! @param ui32TimerSegment specifies which segment of the timer to use.
+//!
+//! This function will enable the output pin for the selected timer. The \e
+//! ui32TimerSegment parameter allows the caller to individually select a
+//! segment within, such as TIMER0A, TIMER0B, or both.
+//!
+//! Valid values for ui32TimerSegment are:
+//!
+//!     AM_HAL_CTIMER_TIMERA
+//!     AM_HAL_CTIMER_TIMERB
+//!     AM_HAL_CTIMER_BOTH
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ctimer_pin_enable(uint32_t ui32TimerNumber, uint32_t ui32TimerSegment)
+{
+    volatile uint32_t *pui32ConfigReg;
+
+    //
+    // Find the correct control register.
+    //
+    pui32ConfigReg = (uint32_t *)(AM_REG_CTIMERn(0) + AM_REG_CTIMER_CTRL0_O +
+                                  (ui32TimerNumber * TIMER_OFFSET));
+
+    //
+    // Begin critical section.
+    //
+    AM_CRITICAL_BEGIN_ASM
+
+    //
+    // Set the pin enable bit
+    //
+    AM_REGVAL(pui32ConfigReg) |= (ui32TimerSegment &
+                                  (AM_REG_CTIMER_CTRL0_TMRA0PE_M |
+                                   AM_REG_CTIMER_CTRL0_TMRB0PE_M));
+
+    //
+    // Done with critical section.
+    //
+    AM_CRITICAL_END_ASM
+}
+
+//*****************************************************************************
+//
+//! @brief Disable the output pin.
+//!
+//! @param ui32TimerNumber is the number of the timer to configure.
+//!
+//! @param ui32TimerSegment specifies which segment of the timer to use.
+//!
+//! This function will disable the output pin for the selected timer. The \e
+//! ui32TimerSegment parameter allows the caller to individually select a
+//! segment within, such as TIMER0A, TIMER0B, or both.
+//!
+//! Valid values for ui32TimerSegment are:
+//!
+//!     AM_HAL_CTIMER_TIMERA
+//!     AM_HAL_CTIMER_TIMERB
+//!     AM_HAL_CTIMER_BOTH
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ctimer_pin_disable(uint32_t ui32TimerNumber, uint32_t ui32TimerSegment)
+{
+    volatile uint32_t *pui32ConfigReg;
+
+    //
+    // Find the correct control register.
+    //
+    pui32ConfigReg = (uint32_t *)(AM_REG_CTIMERn(0) + AM_REG_CTIMER_CTRL0_O +
+                                  (ui32TimerNumber * TIMER_OFFSET));
+
+    //
+    // Begin critical section.
+    //
+    AM_CRITICAL_BEGIN_ASM
+
+    //
+    // Clear the pin enable bit
+    //
+    AM_REGVAL(pui32ConfigReg) &= ~(ui32TimerSegment &
+                                   (AM_REG_CTIMER_CTRL0_TMRA0PE_M |
+                                    AM_REG_CTIMER_CTRL0_TMRB0PE_M));
+
+    //
+    // Done with critical section.
+    //
+    AM_CRITICAL_END_ASM
+}
+
+//*****************************************************************************
+//
+//! @brief Set the polarity of the output pin.
+//!
+//! @param ui32TimerNumber is the number of the timer to configure.
+//!
+//! @param ui32TimerSegment specifies which segment of the timer to use.
+//!
+//! @param bInvertOutpt determines whether the output should be inverted. If
+//! true, the timer output pin for the selected timer segment will be
+//! inverted.
+//!
+//! This function will set the polarity of the the output pin for the selected
+//! timer. The \e ui32TimerSegment parameter allows the caller to individually
+//! select a segment within, such as TIMER0A, TIMER0B, or both.
+//!
+//! Valid values for ui32TimerSegment are:
+//!
+//!     AM_HAL_CTIMER_TIMERA
+//!     AM_HAL_CTIMER_TIMERB
+//!     AM_HAL_CTIMER_BOTH
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ctimer_pin_invert(uint32_t ui32TimerNumber, uint32_t ui32TimerSegment,
+                         bool bInvertOutput)
+{
+    volatile uint32_t *pui32ConfigReg;
+
+    //
+    // Find the correct control register.
+    //
+    pui32ConfigReg = (uint32_t *)(AM_REG_CTIMERn(0) + AM_REG_CTIMER_CTRL0_O +
+                                  (ui32TimerNumber * TIMER_OFFSET));
+
+    //
+    // Begin critical section.
+    //
+    AM_CRITICAL_BEGIN_ASM
+
+    //
+    // Figure out if we're supposed to be setting or clearing the polarity bit.
+    //
+    if ( bInvertOutput )
+    {
+        //
+        // Set the polarity bit to invert the output.
+        //
+        AM_REGVAL(pui32ConfigReg) |= (ui32TimerSegment &
+                                      (AM_REG_CTIMER_CTRL0_TMRA0POL_M |
+                                       AM_REG_CTIMER_CTRL0_TMRB0POL_M));
+    }
+    else
+    {
+        //
+        // Clear the polarity bit.
+        //
+        AM_REGVAL(pui32ConfigReg) &= ~(ui32TimerSegment &
+                                       (AM_REG_CTIMER_CTRL0_TMRA0POL_M |
+                                        AM_REG_CTIMER_CTRL0_TMRB0POL_M));
+    }
+
+    //
+    // Done with critical section.
+    //
+    AM_CRITICAL_END_ASM
+}
+
+//*****************************************************************************
+//
+//! @brief Set a compare register.
+//!
+//! @param ui32TimerNumber is the number of the timer to configure.
+//!
+//! @param ui32TimerSegment specifies which segment of the timer to use.
+//! Valid values for ui32TimerSegment are:
+//!
+//!     AM_HAL_CTIMER_TIMERA
+//!     AM_HAL_CTIMER_TIMERB
+//!     AM_HAL_CTIMER_BOTH
+//!
+//! @param ui32CompareReg specifies which compare register should be set
+//! (either 0 or 1)
+//!
+//! @param ui32Value is the value that should be written to the compare
+//! register.
+//!
+//! This function allows the caller to set the values in the compare registers
+//! for a timer. These registers control the period and duty cycle of the
+//! timers and their associated output pins. Please see the datasheet for
+//! further information on the operation of the compare registers. The \e
+//! ui32TimerSegment parameter allows the caller to individually select a
+//! segment within, such as TIMER0A, TIMER0B, or both.
+//!
+//! @note For simple manipulations of period or duty cycle for timers and PWMs,
+//! you may find it easier to use the am_hal_ctimer_period_set() function.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ctimer_compare_set(uint32_t ui32TimerNumber, uint32_t ui32TimerSegment,
+                          uint32_t ui32CompareReg, uint32_t ui32Value)
+{
+    volatile uint32_t *pui32CmprRegA, *pui32CmprRegB;
+    uint32_t ui32CmprRegA, ui32CmprRegB;
+
+    //
+    // Find the correct compare register to write.
+    // Assume A or BOTH.  We'll change later if B.
+    //
+    pui32CmprRegA = (uint32_t *)(AM_REG_CTIMERn(0) +
+                                 AM_REG_CTIMER_CMPRA0_O +
+                                 (ui32TimerNumber * TIMER_OFFSET));
+    pui32CmprRegB = pui32CmprRegA + CTIMER_CMPR_OFFSET;
+
+    //
+    // Write the compare register with the selected value.
+    // Begin critical section while CMPR registers are modified.
+    //
+    AM_CRITICAL_BEGIN_ASM
+
+    ui32CmprRegA = *pui32CmprRegA;
+    ui32CmprRegB = *pui32CmprRegB;
+
+    if ( ui32CompareReg == 1 )
+    {
+        //
+        // CMPR reg 1
+        // Get the lower 16b (but may not be used if TIMERB).
+        // Mask existing CMPR0 bits, add
+        //
+        ui32CmprRegA = ( (ui32CmprRegA & AM_REG_CTIMER_CMPRA0_CMPR0A0_M) |
+                          AM_REG_CTIMER_CMPRA0_CMPR1A0(ui32Value & 0xFFFF) );
+
+        //
+        // Get the upper 16b (but may not be used if TIMERA)
+        //
+        ui32CmprRegB = ( (ui32CmprRegB & AM_REG_CTIMER_CMPRA0_CMPR0A0_M) |
+                          AM_REG_CTIMER_CMPRA0_CMPR1A0(ui32Value >> 16) );
+    }
+    else
+    {
+        //
+        // CMPR reg 0
+        // Get the lower 16b (but may not be used if TIMERB)
+        //
+        ui32CmprRegA = ( (ui32CmprRegA & AM_REG_CTIMER_CMPRA0_CMPR1A0_M) |
+                         AM_REG_CTIMER_CMPRA0_CMPR0A0(ui32Value & 0xFFFF) );
+
+        //
+        // Set the upper 16b (but may not be used if TIMERA)
+        //
+        ui32CmprRegB = ( (ui32CmprRegB & AM_REG_CTIMER_CMPRA0_CMPR1A0_M) |
+                         AM_REG_CTIMER_CMPRA0_CMPR0A0(ui32Value >> 16) );
+    }
+
+    if ( ui32TimerSegment == AM_HAL_CTIMER_TIMERB )
+    {
+        *pui32CmprRegB = ui32CmprRegB;
+    }
+    else
+    {
+        //
+        // It's TIMERA or BOTH.
+        //
+        *pui32CmprRegA = ui32CmprRegA;
+
+        if ( ui32TimerSegment == AM_HAL_CTIMER_BOTH )
+        {
+            *pui32CmprRegB = ui32CmprRegB;
+        }
+    }
+
+    //
+    // Done with critical section.
+    //
+    AM_CRITICAL_END_ASM
+}
+
+//*****************************************************************************
+//
+//! @brief Set the period and duty cycle of a timer.
+//!
+//! @param ui32TimerNumber is the number of the timer to configure.
+//!
+//! @param ui32TimerSegment specifies which segment of the timer to use.
+//!
+//! @param ui32Period specifies the desired period.  This parameter effectively
+//! specifies the CTIMER CMPR field(s). The CMPR fields are handled in hardware
+//! as (n+1) values, therefore ui32Period is actually specified as 1 less than
+//! the desired period. Finally, as mentioned in the data sheet, the CMPR fields
+//! cannot be 0 (a value of 1), so neither can ui32Period be 0.
+//!
+//! @param ui32OnTime set the number of clocks where the output signal is high.
+//!
+//! This function should be used for simple manipulations of the period and
+//! duty cycle of a counter/timer. To set the period and/or duty cycle of a
+//! linked timer pair, use AM_HAL_CTIMER_BOTH as the timer segment argument. If
+//! you would like to set the period and/or duty cycle for both TIMERA and
+//! TIMERB you will need to call this function twice: once for TIMERA, and once
+//! for TIMERB.
+//!
+//! Valid values for ui32TimerSegment are:
+//!
+//!     AM_HAL_CTIMER_TIMERA
+//!     AM_HAL_CTIMER_TIMERB
+//!     AM_HAL_CTIMER_BOTH
+//!
+//! @note The ui32OnTime parameter will only work if the timer is currently
+//! operating in one of the PWM modes.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ctimer_period_set(uint32_t ui32TimerNumber, uint32_t ui32TimerSegment,
+                         uint32_t ui32Period, uint32_t ui32OnTime)
+{
+    volatile uint32_t *pui32ControlReg;
+    volatile uint32_t *pui32CompareRegA;
+    volatile uint32_t *pui32CompareRegB;
+    uint32_t ui32Mode, ui32Comp0, ui32Comp1;
+
+    //
+    // Find the correct control register to pull the function select field
+    // from.
+    //
+    pui32ControlReg = (uint32_t *)(AM_REG_CTIMERn(0) + AM_REG_CTIMER_CTRL0_O +
+                                   (ui32TimerNumber * TIMER_OFFSET));
+
+    //
+    // Find the correct compare registers to write.
+    //
+    pui32CompareRegA = (uint32_t *)(AM_REG_CTIMERn(0) +
+                                    AM_REG_CTIMER_CMPRA0_O +
+                                    (ui32TimerNumber * TIMER_OFFSET));
+
+    pui32CompareRegB = (uint32_t *)(AM_REG_CTIMERn(0) +
+                                    AM_REG_CTIMER_CMPRB0_O +
+                                    (ui32TimerNumber * TIMER_OFFSET));
+
+    //
+    // Begin critical section.
+    //
+    AM_CRITICAL_BEGIN_ASM
+
+    //
+    // Extract the timer mode from the register based on the ui32TimerSegment
+    // selected by the user.
+    //
+    ui32Mode = *pui32ControlReg;
+    if ( ui32TimerSegment == AM_HAL_CTIMER_TIMERB )
+    {
+        ui32Mode = ui32Mode >> 16;
+    }
+
+    //
+    // Mask to get to the bits we're interested in.
+    //
+    ui32Mode = ui32Mode & AM_REG_CTIMER_CTRL0_TMRA0FN_M;
+
+    //
+    // If the mode is a PWM mode, we'll need to calculate the correct CMPR0 and
+    // CMPR1 values here.
+    //
+    if (ui32Mode == AM_HAL_CTIMER_FN_PWM_ONCE   ||
+        ui32Mode == AM_HAL_CTIMER_FN_PWM_REPEAT)
+    {
+        ui32Comp0 = ui32Period - ui32OnTime;
+        ui32Comp1 = ui32Period;
+    }
+    else
+    {
+        ui32Comp0 = ui32Period;
+        ui32Comp1 = 0;
+    }
+
+    //
+    // Based on the timer segment argument, write the calculated Compare 0 and
+    // Compare 1 values to the correct halves of the correct registers.
+    //
+    if ( ui32TimerSegment == AM_HAL_CTIMER_TIMERA )
+    {
+        //
+        // For timer A, write the values to the TIMERA compare register.
+        //
+        *pui32CompareRegA = (AM_REG_CTIMER_CMPRA0_CMPR0A0(ui32Comp0) |
+                             AM_REG_CTIMER_CMPRA0_CMPR1A0(ui32Comp1));
+    }
+    else if ( ui32TimerSegment == AM_HAL_CTIMER_TIMERB )
+    {
+        //
+        // For timer B, write the values to the TIMERA compare register.
+        //
+        *pui32CompareRegB = (AM_REG_CTIMER_CMPRA0_CMPR0A0(ui32Comp0) |
+                             AM_REG_CTIMER_CMPRA0_CMPR1A0(ui32Comp1));
+    }
+    else
+    {
+        //
+        // For the linked case, write the lower halves of the values to the
+        // TIMERA compare register, and the upper halves to the TIMERB compare
+        // register.
+        //
+        *pui32CompareRegA = (AM_REG_CTIMER_CMPRA0_CMPR0A0(ui32Comp0) |
+                             AM_REG_CTIMER_CMPRA0_CMPR1A0(ui32Comp1));
+
+        *pui32CompareRegB = (AM_REG_CTIMER_CMPRA0_CMPR0A0(ui32Comp0 >> 16) |
+                             AM_REG_CTIMER_CMPRA0_CMPR1A0(ui32Comp1 >> 16));
+    }
+
+    //
+    // Done with critical section.
+    //
+    AM_CRITICAL_END_ASM
+}
+
+//*****************************************************************************
+//
+//! @brief Enable the TIMERA3 ADC trigger
+//!
+//! This function enables the ADC trigger within TIMERA3.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ctimer_adc_trigger_enable(void)
+{
+    //
+    // Begin critical section.
+    //
+    AM_CRITICAL_BEGIN_ASM
+
+    //
+    // Enable the ADC trigger.
+    //
+    AM_REGn(CTIMER, 0, CTRL3) |= AM_REG_CTIMER_CTRL3_ADCEN_M;
+
+    //
+    // Done with critical section.
+    //
+    AM_CRITICAL_END_ASM
+}
+
+//*****************************************************************************
+//
+//! @brief Disable the TIMERA3 ADC trigger
+//!
+//! This function disables the ADC trigger within TIMERA3.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ctimer_adc_trigger_disable(void)
+{
+    //
+    // Begin critical section.
+    //
+    AM_CRITICAL_BEGIN_ASM
+
+    //
+    // Disable the ADC trigger.
+    //
+    AM_REGn(CTIMER, 0, CTRL3) &= ~AM_REG_CTIMER_CTRL3_ADCEN_M;
+
+    //
+    // Done with critical section.
+    //
+    AM_CRITICAL_END_ASM
+}
+
+//*****************************************************************************
+//
+//! @brief Enables the selected timer interrupt.
+//!
+//! @param ui32Interrupt is the interrupt to be used.
+//!
+//! This function will enable the selected interrupts in the main CTIMER
+//! interrupt enable register. In order to receive an interrupt from a timer,
+//! you will need to enable the interrupt for that timer in this main register,
+//! as well as in the timer control register (accessible though
+//! am_hal_ctimer_config()), and in the NVIC.
+//!
+//! ui32Interrupt should be the logical OR of one or more of the following
+//! values:
+//!
+//!     AM_HAL_CTIMER_INT_TIMERA0C0
+//!     AM_HAL_CTIMER_INT_TIMERA0C1
+//!     AM_HAL_CTIMER_INT_TIMERB0C0
+//!     AM_HAL_CTIMER_INT_TIMERB0C1
+//!     AM_HAL_CTIMER_INT_TIMERA1C0
+//!     AM_HAL_CTIMER_INT_TIMERA1C1
+//!     AM_HAL_CTIMER_INT_TIMERB1C0
+//!     AM_HAL_CTIMER_INT_TIMERB1C1
+//!     AM_HAL_CTIMER_INT_TIMERA2C0
+//!     AM_HAL_CTIMER_INT_TIMERA2C1
+//!     AM_HAL_CTIMER_INT_TIMERB2C0
+//!     AM_HAL_CTIMER_INT_TIMERB2C1
+//!     AM_HAL_CTIMER_INT_TIMERA3C0
+//!     AM_HAL_CTIMER_INT_TIMERA3C1
+//!     AM_HAL_CTIMER_INT_TIMERB3C0
+//!     AM_HAL_CTIMER_INT_TIMERB3C1
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ctimer_int_enable(uint32_t ui32Interrupt)
+{
+    //
+    // Begin critical section.
+    //
+    AM_CRITICAL_BEGIN_ASM
+
+    //
+    // Enable the interrupt at the module level.
+    //
+    AM_REGn(CTIMER, 0, INTEN) |= ui32Interrupt;
+
+    //
+    // Done with critical section.
+    //
+    AM_CRITICAL_END_ASM
+}
+
+//*****************************************************************************
+//
+//! @brief Return the enabled timer interrupts.
+//!
+//! This function will return all enabled interrupts in the main CTIMER
+//! interrupt enable register.
+//!
+//! @return return enabled interrupts. This will be a logical or of:
+//!
+//!     AM_HAL_CTIMER_INT_TIMERA0C0
+//!     AM_HAL_CTIMER_INT_TIMERA0C1
+//!     AM_HAL_CTIMER_INT_TIMERB0C0
+//!     AM_HAL_CTIMER_INT_TIMERB0C1
+//!     AM_HAL_CTIMER_INT_TIMERA1C0
+//!     AM_HAL_CTIMER_INT_TIMERA1C1
+//!     AM_HAL_CTIMER_INT_TIMERB1C0
+//!     AM_HAL_CTIMER_INT_TIMERB1C1
+//!     AM_HAL_CTIMER_INT_TIMERA2C0
+//!     AM_HAL_CTIMER_INT_TIMERA2C1
+//!     AM_HAL_CTIMER_INT_TIMERB2C0
+//!     AM_HAL_CTIMER_INT_TIMERB2C1
+//!     AM_HAL_CTIMER_INT_TIMERA3C0
+//!     AM_HAL_CTIMER_INT_TIMERA3C1
+//!     AM_HAL_CTIMER_INT_TIMERB3C0
+//!     AM_HAL_CTIMER_INT_TIMERB3C1
+//!
+//! @return Return the enabled timer interrupts.
+//
+//*****************************************************************************
+uint32_t
+am_hal_ctimer_int_enable_get(void)
+{
+    //
+    // Return enabled interrupts.
+    //
+    return AM_REGn(CTIMER, 0, INTEN);
+}
+
+//*****************************************************************************
+//
+//! @brief Disables the selected timer interrupt.
+//!
+//! @param ui32Interrupt is the interrupt to be used.
+//!
+//! This function will disable the selected interrupts in the main CTIMER
+//! interrupt register.
+//!
+//! ui32Interrupt should be the logical OR of one or more of the following
+//! values:
+//!
+//!     AM_HAL_CTIMER_INT_TIMERA0C0
+//!     AM_HAL_CTIMER_INT_TIMERA0C1
+//!     AM_HAL_CTIMER_INT_TIMERB0C0
+//!     AM_HAL_CTIMER_INT_TIMERB0C1
+//!     AM_HAL_CTIMER_INT_TIMERA1C0
+//!     AM_HAL_CTIMER_INT_TIMERA1C1
+//!     AM_HAL_CTIMER_INT_TIMERB1C0
+//!     AM_HAL_CTIMER_INT_TIMERB1C1
+//!     AM_HAL_CTIMER_INT_TIMERA2C0
+//!     AM_HAL_CTIMER_INT_TIMERA2C1
+//!     AM_HAL_CTIMER_INT_TIMERB2C0
+//!     AM_HAL_CTIMER_INT_TIMERB2C1
+//!     AM_HAL_CTIMER_INT_TIMERA3C0
+//!     AM_HAL_CTIMER_INT_TIMERA3C1
+//!     AM_HAL_CTIMER_INT_TIMERB3C0
+//!     AM_HAL_CTIMER_INT_TIMERB3C1
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ctimer_int_disable(uint32_t ui32Interrupt)
+{
+    //
+    // Begin critical section.
+    //
+    AM_CRITICAL_BEGIN_ASM
+
+    //
+    // Disable the interrupt at the module level.
+    //
+    AM_REGn(CTIMER, 0, INTEN) &= ~ui32Interrupt;
+
+    //
+    // Done with critical section.
+    //
+    AM_CRITICAL_END_ASM
+}
+
+//*****************************************************************************
+//
+//! @brief Clears the selected timer interrupt.
+//!
+//! @param ui32Interrupt is the interrupt to be used.
+//!
+//! This function will clear the selected interrupts in the main CTIMER
+//! interrupt register.
+//!
+//! ui32Interrupt should be the logical OR of one or more of the following
+//! values:
+//!
+//!     AM_HAL_CTIMER_INT_TIMERA0C0
+//!     AM_HAL_CTIMER_INT_TIMERA0C1
+//!     AM_HAL_CTIMER_INT_TIMERB0C0
+//!     AM_HAL_CTIMER_INT_TIMERB0C1
+//!     AM_HAL_CTIMER_INT_TIMERA1C0
+//!     AM_HAL_CTIMER_INT_TIMERA1C1
+//!     AM_HAL_CTIMER_INT_TIMERB1C0
+//!     AM_HAL_CTIMER_INT_TIMERB1C1
+//!     AM_HAL_CTIMER_INT_TIMERA2C0
+//!     AM_HAL_CTIMER_INT_TIMERA2C1
+//!     AM_HAL_CTIMER_INT_TIMERB2C0
+//!     AM_HAL_CTIMER_INT_TIMERB2C1
+//!     AM_HAL_CTIMER_INT_TIMERA3C0
+//!     AM_HAL_CTIMER_INT_TIMERA3C1
+//!     AM_HAL_CTIMER_INT_TIMERB3C0
+//!     AM_HAL_CTIMER_INT_TIMERB3C1
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ctimer_int_clear(uint32_t ui32Interrupt)
+{
+    //
+    // Disable the interrupt at the module level.
+    //
+    AM_REGn(CTIMER, 0, INTCLR) = ui32Interrupt;
+}
+
+//*****************************************************************************
+//
+//! @brief Sets the selected timer interrupt.
+//!
+//! @param ui32Interrupt is the interrupt to be used.
+//!
+//! This function will set the selected interrupts in the main CTIMER
+//! interrupt register.
+//!
+//! ui32Interrupt should be the logical OR of one or more of the following
+//! values:
+//!
+//!     AM_HAL_CTIMER_INT_TIMERA0C0
+//!     AM_HAL_CTIMER_INT_TIMERA0C1
+//!     AM_HAL_CTIMER_INT_TIMERB0C0
+//!     AM_HAL_CTIMER_INT_TIMERB0C1
+//!     AM_HAL_CTIMER_INT_TIMERA1C0
+//!     AM_HAL_CTIMER_INT_TIMERA1C1
+//!     AM_HAL_CTIMER_INT_TIMERB1C0
+//!     AM_HAL_CTIMER_INT_TIMERB1C1
+//!     AM_HAL_CTIMER_INT_TIMERA2C0
+//!     AM_HAL_CTIMER_INT_TIMERA2C1
+//!     AM_HAL_CTIMER_INT_TIMERB2C0
+//!     AM_HAL_CTIMER_INT_TIMERB2C1
+//!     AM_HAL_CTIMER_INT_TIMERA3C0
+//!     AM_HAL_CTIMER_INT_TIMERA3C1
+//!     AM_HAL_CTIMER_INT_TIMERB3C0
+//!     AM_HAL_CTIMER_INT_TIMERB3C1
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ctimer_int_set(uint32_t ui32Interrupt)
+{
+    //
+    // Set the interrupts.
+    //
+    AM_REGn(CTIMER, 0, INTSET) = ui32Interrupt;
+}
+
+//*****************************************************************************
+//
+//! @brief Returns either the enabled or raw timer interrupt status.
+//!
+//! This function will return the timer interrupt status.
+//!
+//! @return bEnabledOnly if true returns the status of the enabled interrupts
+//! only.
+//!
+//! The return value will be the logical OR of one or more of the following
+//! values:
+//!
+//!     AM_HAL_CTIMER_INT_TIMERA0C0
+//!     AM_HAL_CTIMER_INT_TIMERA0C1
+//!     AM_HAL_CTIMER_INT_TIMERB0C0
+//!     AM_HAL_CTIMER_INT_TIMERB0C1
+//!     AM_HAL_CTIMER_INT_TIMERA1C0
+//!     AM_HAL_CTIMER_INT_TIMERA1C1
+//!     AM_HAL_CTIMER_INT_TIMERB1C0
+//!     AM_HAL_CTIMER_INT_TIMERB1C1
+//!     AM_HAL_CTIMER_INT_TIMERA2C0
+//!     AM_HAL_CTIMER_INT_TIMERA2C1
+//!     AM_HAL_CTIMER_INT_TIMERB2C0
+//!     AM_HAL_CTIMER_INT_TIMERB2C1
+//!     AM_HAL_CTIMER_INT_TIMERA3C0
+//!     AM_HAL_CTIMER_INT_TIMERA3C1
+//!     AM_HAL_CTIMER_INT_TIMERB3C0
+//!     AM_HAL_CTIMER_INT_TIMERB3C1
+//!
+//! @return Returns either the timer interrupt status.
+//
+//*****************************************************************************
+uint32_t
+am_hal_ctimer_int_status_get(bool bEnabledOnly)
+{
+    //
+    // Return the desired status.
+    //
+
+    if ( bEnabledOnly )
+    {
+        uint32_t u32RetVal;
+
+        //
+        // Begin critical section.
+        //
+        AM_CRITICAL_BEGIN_ASM
+
+        u32RetVal  = AM_REGn(CTIMER, 0, INTSTAT);
+        u32RetVal &= AM_REGn(CTIMER, 0, INTEN);
+
+        //
+        // Done with critical section.
+        //
+        AM_CRITICAL_END_ASM
+
+        return u32RetVal;
+    }
+    else
+    {
+        return AM_REGn(CTIMER, 0, INTSTAT);
+    }
+}
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_ctimer.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_ctimer.h
new file mode 100644
index 000000000..1d2ffc820
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_ctimer.h
@@ -0,0 +1,270 @@
+//*****************************************************************************
+//
+//! @file am_hal_ctimer.h
+//!
+//! @brief Functions for accessing and configuring the CTIMER.
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup ctimer Counter/Timer (CTIMER)
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_HAL_CTIMER_H
+#define AM_HAL_CTIMER_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+//*****************************************************************************
+//
+//! Timer offset value
+//
+//*****************************************************************************
+#define AM_HAL_CTIMER_TIMER_OFFSET  (AM_REG_CTIMER_TMR1_O - AM_REG_CTIMER_TMR0_O)
+
+//*****************************************************************************
+//
+//! @name Interrupt Status Bits
+//! @brief Interrupt Status Bits for enable/disble use
+//!
+//! These macros may be used to set and clear interrupt bits
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_CTIMER_INT_TIMERA0C0         AM_REG_CTIMER_INTEN_CTMRA0C0INT_M
+#define AM_HAL_CTIMER_INT_TIMERA0C1         AM_REG_CTIMER_INTEN_CTMRA0C1INT_M
+#define AM_HAL_CTIMER_INT_TIMERA1C0         AM_REG_CTIMER_INTEN_CTMRA1C0INT_M
+#define AM_HAL_CTIMER_INT_TIMERA1C1         AM_REG_CTIMER_INTEN_CTMRA1C1INT_M
+#define AM_HAL_CTIMER_INT_TIMERA2C0         AM_REG_CTIMER_INTEN_CTMRA2C0INT_M
+#define AM_HAL_CTIMER_INT_TIMERA2C1         AM_REG_CTIMER_INTEN_CTMRA2C1INT_M
+#define AM_HAL_CTIMER_INT_TIMERA3C0         AM_REG_CTIMER_INTEN_CTMRA3C0INT_M
+#define AM_HAL_CTIMER_INT_TIMERA3C1         AM_REG_CTIMER_INTEN_CTMRA3C1INT_M
+
+#define AM_HAL_CTIMER_INT_TIMERB0C0         AM_REG_CTIMER_INTEN_CTMRB0C0INT_M
+#define AM_HAL_CTIMER_INT_TIMERB0C1         AM_REG_CTIMER_INTEN_CTMRB0C1INT_M
+#define AM_HAL_CTIMER_INT_TIMERB1C0         AM_REG_CTIMER_INTEN_CTMRB1C0INT_M
+#define AM_HAL_CTIMER_INT_TIMERB1C1         AM_REG_CTIMER_INTEN_CTMRB1C1INT_M
+#define AM_HAL_CTIMER_INT_TIMERB2C0         AM_REG_CTIMER_INTEN_CTMRB2C0INT_M
+#define AM_HAL_CTIMER_INT_TIMERB2C1         AM_REG_CTIMER_INTEN_CTMRB2C1INT_M
+#define AM_HAL_CTIMER_INT_TIMERB3C0         AM_REG_CTIMER_INTEN_CTMRB3C0INT_M
+#define AM_HAL_CTIMER_INT_TIMERB3C1         AM_REG_CTIMER_INTEN_CTMRB3C1INT_M
+
+//
+// Deprecated, use the newer macros above.
+//
+#define AM_HAL_CTIMER_INT_TIMERA0           AM_HAL_CTIMER_INT_TIMERA0C0
+#define AM_HAL_CTIMER_INT_TIMERB0           AM_HAL_CTIMER_INT_TIMERB0C0
+#define AM_HAL_CTIMER_INT_TIMERA1           AM_HAL_CTIMER_INT_TIMERA1C0
+#define AM_HAL_CTIMER_INT_TIMERB1           AM_HAL_CTIMER_INT_TIMERB1C0
+#define AM_HAL_CTIMER_INT_TIMERA2           AM_HAL_CTIMER_INT_TIMERA2C0
+#define AM_HAL_CTIMER_INT_TIMERB2           AM_HAL_CTIMER_INT_TIMERB2C0
+#define AM_HAL_CTIMER_INT_TIMERA3           AM_HAL_CTIMER_INT_TIMERA3C0
+#define AM_HAL_CTIMER_INT_TIMERB3           AM_HAL_CTIMER_INT_TIMERB3C0
+//! @}
+
+//*****************************************************************************
+//
+//! @name Configuration options
+//! @brief Configuration options for \e am_hal_ctimer_config_t
+//!
+//! These options are to be used with the \e am_hal_ctimer_config_t structure
+//! used by \e am_hal_ctimer_config
+//!  @{
+//
+//*****************************************************************************
+#define AM_HAL_CTIMER_CLK_PIN               AM_REG_CTIMER_CTRL0_TMRA0CLK(0x0)
+#define AM_HAL_CTIMER_HFRC_12MHZ            AM_REG_CTIMER_CTRL0_TMRA0CLK(0x1)
+#define AM_HAL_CTIMER_HFRC_3MHZ             AM_REG_CTIMER_CTRL0_TMRA0CLK(0x2)
+#define AM_HAL_CTIMER_HFRC_187_5KHZ         AM_REG_CTIMER_CTRL0_TMRA0CLK(0x3)
+#define AM_HAL_CTIMER_HFRC_47KHZ            AM_REG_CTIMER_CTRL0_TMRA0CLK(0x4)
+#define AM_HAL_CTIMER_HFRC_12KHZ            AM_REG_CTIMER_CTRL0_TMRA0CLK(0x5)
+#define AM_HAL_CTIMER_XT_32_768KHZ          AM_REG_CTIMER_CTRL0_TMRA0CLK(0x6)
+#define AM_HAL_CTIMER_XT_16_384KHZ          AM_REG_CTIMER_CTRL0_TMRA0CLK(0x7)
+#define AM_HAL_CTIMER_XT_2_048KHZ           AM_REG_CTIMER_CTRL0_TMRA0CLK(0x8)
+#define AM_HAL_CTIMER_XT_256HZ              AM_REG_CTIMER_CTRL0_TMRA0CLK(0x9)
+#define AM_HAL_CTIMER_LFRC_512HZ            AM_REG_CTIMER_CTRL0_TMRA0CLK(0xA)
+#define AM_HAL_CTIMER_LFRC_32HZ             AM_REG_CTIMER_CTRL0_TMRA0CLK(0xB)
+#define AM_HAL_CTIMER_LFRC_1HZ              AM_REG_CTIMER_CTRL0_TMRA0CLK(0xC)
+#define AM_HAL_CTIMER_LFRC_1_16HZ           AM_REG_CTIMER_CTRL0_TMRA0CLK(0xD)
+#define AM_HAL_CTIMER_RTC_100HZ             AM_REG_CTIMER_CTRL0_TMRA0CLK(0xE)
+#define AM_HAL_CTIMER_HCLK                  AM_REG_CTIMER_CTRL0_TMRA0CLK(0xF)
+//! @}
+
+//*****************************************************************************
+//
+// Timer function macros.
+//
+//*****************************************************************************
+#define AM_HAL_CTIMER_FN_ONCE               AM_REG_CTIMER_CTRL0_TMRA0FN(0)
+#define AM_HAL_CTIMER_FN_REPEAT             AM_REG_CTIMER_CTRL0_TMRA0FN(1)
+#define AM_HAL_CTIMER_FN_PWM_ONCE           AM_REG_CTIMER_CTRL0_TMRA0FN(2)
+#define AM_HAL_CTIMER_FN_PWM_REPEAT         AM_REG_CTIMER_CTRL0_TMRA0FN(3)
+#define AM_HAL_CTIMER_FN_CONTINUOUS         AM_REG_CTIMER_CTRL0_TMRA0FN(4)
+
+//*****************************************************************************
+//
+// Half-timer options.
+//
+//*****************************************************************************
+#define AM_HAL_CTIMER_INT_ENABLE            AM_REG_CTIMER_CTRL0_TMRA0IE0_M
+#define AM_HAL_CTIMER_PIN_ENABLE            AM_REG_CTIMER_CTRL0_TMRA0PE_M
+#define AM_HAL_CTIMER_PIN_INVERT            AM_REG_CTIMER_CTRL0_TMRA0POL_M
+#define AM_HAL_CTIMER_CLEAR                 AM_REG_CTIMER_CTRL0_TMRA0CLR_M
+
+//*****************************************************************************
+//
+// Additional timer options.
+//
+//*****************************************************************************
+#define AM_HAL_CTIMER_LINK                  AM_REG_CTIMER_CTRL0_CTLINK0_M
+#define AM_HAL_CTIMER_ADC_TRIG              AM_REG_CTIMER_CTRL3_ADCEN_M
+
+//*****************************************************************************
+//
+// Timer selection macros.
+//
+//*****************************************************************************
+#define AM_HAL_CTIMER_TIMERA                0x0000FFFF
+#define AM_HAL_CTIMER_TIMERB                0xFFFF0000
+#define AM_HAL_CTIMER_BOTH                  0xFFFFFFFF
+//! @}
+
+//*****************************************************************************
+//
+// Timer configuration structure
+//
+//*****************************************************************************
+typedef struct
+{
+    //
+    //! Set to 1 to operate this timer as a 32-bit timer instead of two 16-bit
+    //! timers.
+    //
+    uint32_t ui32Link;
+
+    //
+    //! Configuration options for TIMERA
+    //
+    uint32_t ui32TimerAConfig;
+
+    //
+    //! Configuration options for TIMERB
+    //
+    uint32_t ui32TimerBConfig;
+
+}
+am_hal_ctimer_config_t;
+
+//*****************************************************************************
+//
+// Function pointer type for CTimer interrupt handlers.
+//
+//*****************************************************************************
+typedef void (*am_hal_ctimer_handler_t)(void);
+
+//*****************************************************************************
+//
+// External function definitions
+//
+//*****************************************************************************
+extern void am_hal_ctimer_config(uint32_t ui32TimerNumber,
+                                 am_hal_ctimer_config_t *psConfig);
+
+extern void am_hal_ctimer_config_single(uint32_t ui32TimerNumber,
+                                        uint32_t ui32TimerSegment,
+                                        uint32_t ui32ConfigVal);
+
+extern void am_hal_ctimer_start(uint32_t ui32TimerNumber,
+                                uint32_t ui32TimerSegment);
+
+extern void am_hal_ctimer_stop(uint32_t ui32TimerNumber,
+                               uint32_t ui32TimerSegment);
+
+extern void am_hal_ctimer_clear(uint32_t ui32TimerNumber,
+                                uint32_t ui32TimerSegment);
+
+extern uint32_t am_hal_ctimer_read(uint32_t ui32TimerNumber,
+                                   uint32_t ui32TimerSegment);
+
+extern void am_hal_ctimer_pin_enable(uint32_t ui32TimerNumber,
+                                     uint32_t ui32TimerSegment);
+
+extern void am_hal_ctimer_pin_disable(uint32_t ui32TimerNumber,
+                                      uint32_t ui32TimerSegment);
+
+extern void am_hal_ctimer_pin_invert(uint32_t ui32TimerNumber,
+                                     uint32_t ui32TimerSegment,
+                                     bool bInvertOutput);
+
+extern void am_hal_ctimer_compare_set(uint32_t ui32TimerNumber,
+                                      uint32_t ui32TimerSegment,
+                                      uint32_t ui32CompareReg,
+                                      uint32_t ui32Value);
+
+extern void am_hal_ctimer_period_set(uint32_t ui32TimerNumber,
+                                     uint32_t ui32TimerSegment,
+                                     uint32_t ui32Period,
+                                     uint32_t ui32OnTime);
+
+extern void am_hal_ctimer_adc_trigger_enable(void);
+extern void am_hal_ctimer_adc_trigger_disable(void);
+extern void am_hal_ctimer_int_enable(uint32_t ui32Interrupt);
+extern uint32_t am_hal_ctimer_int_enable_get(void);
+extern void am_hal_ctimer_int_disable(uint32_t ui32Interrupt);
+extern void am_hal_ctimer_int_set(uint32_t ui32Interrupt);
+extern void am_hal_ctimer_int_clear(uint32_t ui32Interrupt);
+extern uint32_t am_hal_ctimer_int_status_get(bool bEnabledOnly);
+extern void am_hal_ctimer_int_register(uint32_t ui32Interrupt,
+                         am_hal_ctimer_handler_t pfnHandler);
+extern void am_hal_ctimer_int_service(uint32_t ui32Status);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_HAL_CTIMER_H
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_debug.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_debug.c
new file mode 100644
index 000000000..9f87fd79f
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_debug.c
@@ -0,0 +1,80 @@
+//*****************************************************************************
+//
+//! @file am_hal_debug.c
+//!
+//! @brief Useful functions for debugging.
+//!
+//! These functions and macros were created to assist with debugging. They are
+//! intended to be as unintrusive as possible and designed to be removed from
+//! the compilation of a project when they are no longer needed.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "am_mcu_apollo.h"
+
+//*****************************************************************************
+//
+//! @brief Default implementation of a failed ASSERT statement.
+//!
+//! @param pcFile is the name of the source file where the error occurred.
+//! @param ui32Line is the line number where the error occurred.
+//! @param pcMessage is an optional message describing the failure.
+//!
+//! This function is called by am_hal_debug_assert() macro when the supplied
+//! condition is not true. The implementation here simply halts the application
+//! for further analysis. Individual applications may define their own
+//! implementations of am_hal_debug_error() to provide more detailed feedback
+//! about the failed am_hal_debug_assert() statement.
+//!
+//! @return
+//
+//*****************************************************************************
+#if defined (__IAR_SYSTEMS_ICC__)
+__weak void
+#else
+void __attribute__((weak))
+#endif
+am_hal_debug_error(const char *pcFile, uint32_t ui32Line, const char *pcMessage)
+{
+    //
+    // Halt for analysis.
+    //
+    while(1);
+}
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_debug.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_debug.h
new file mode 100644
index 000000000..da789ada0
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_debug.h
@@ -0,0 +1,88 @@
+//*****************************************************************************
+//
+//! @file am_hal_debug.h
+//!
+//! @brief Useful macros for debugging.
+//!
+//! These functions and macros were created to assist with debugging. They are
+//! intended to be as unintrusive as possible and designed to be removed from
+//! the compilation of a project when they are no longer needed.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_HAL_DEBUG_H
+#define AM_HAL_DEBUG_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+//*****************************************************************************
+//
+// Debug assert macros.
+//
+//*****************************************************************************
+#ifndef AM_HAL_DEBUG_NO_ASSERT
+
+#define am_hal_debug_assert_msg(bCondition, pcMessage)                        \
+    if ( !(bCondition))  am_hal_debug_error(__FILE__, __LINE__, pcMessage)
+
+#define am_hal_debug_assert(bCondition)                                       \
+    if ( !(bCondition))  am_hal_debug_error(__FILE__, __LINE__, 0)
+
+#else
+
+#define am_hal_debug_assert_msg(bCondition, pcMessage)
+#define am_hal_debug_assert(bCondition)
+
+#endif // AM_DEBUG_ASSERT
+
+//*****************************************************************************
+//
+// External function prototypes.
+//
+//*****************************************************************************
+extern void am_hal_debug_error(const char *pcFile, uint32_t ui32Line,
+                               const char *pcMessage);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_HAL_DEBUG_H
+
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_flash.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_flash.c
new file mode 100644
index 000000000..971606eb6
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_flash.c
@@ -0,0 +1,1444 @@
+//*****************************************************************************
+//
+//! @file am_hal_flash.c
+//!
+//! @brief Functions for performing Flash operations.
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup flash Flash
+//! @ingroup hal
+//!
+//! IMPORTANT: Interrupts are active during execution of all HAL flash
+//! functions. If an interrupt occurs during execution of a flash function
+//! that programs or erases flash or INFO space, errors will occur if the
+//! interrupt service routine (ISR) is located in on-chip flash.
+//! If interrupts are expected during execution of a flash function that
+//! programs or erases either flash or INFO space:
+//! - Interrupts must be disabled via a critical section handler prior to
+//!   calling the flash function.
+//! - Alternatively, applicable ISRs must be located in non-flash address space
+//!   (i.e. SRAM, off-chip ROM, etc.).
+//!
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "am_mcu_apollo.h"
+
+//
+// Look-up table
+//
+g_am_hal_flash_t g_am_hal_flash =
+{
+    //
+    // The basics.
+    //
+    // flash_mass_erase()
+    ((int  (*) (uint32_t, uint32_t)) 0x0800004d),
+    // flash_page_erase()
+    ((int  (*) (uint32_t, uint32_t, uint32_t))  0x08000051),
+    // flash_program_main()
+    ((int  (*) (uint32_t, uint32_t *, uint32_t *, uint32_t))  0x08000055),
+    // flash_program_info()
+    ((int  (*) (uint32_t, uint32_t, uint32_t *, uint32_t, uint32_t)) 0x08000059),
+
+    //
+    // Non-blocking variants, but be careful these are not interrupt safe so
+    // mask interrupts while these very long operations proceed.
+    //
+    // flash_mass_erase_nb()
+    ((int      (*)(uint32_t, uint32_t)) 0x0800006d),
+    // flash_page_erase_nb()
+    ((int      (*)(uint32_t, uint32_t, uint32_t)) 0x08000071),
+    // flash_nb_operation_complete()
+    ((bool     (*)(void)) 0x0800007d),
+
+    //
+    // Essentially these are recovery options.
+    //
+    // flash_erase_info()
+    ((int      (*)(uint32_t, uint32_t)) 0x08000081),
+    // flash_erase_main_plus_info()
+    ((int      (*)(uint32_t, uint32_t)) 0x08000089),
+    // flash_erase_main_plus_info_both_instances()
+    ((int      (*)(uint32_t)) 0x08000091),
+    // flash_recovery()
+    ((void     (*)(uint32_t)) 0x08000099),
+
+    //
+    // Useful utilities.
+    //
+    // flash_util_read_word()
+    ((uint32_t (*)(uint32_t*)) 0x08000075),
+    // flash_util_write_word()
+    ((void     (*)(uint32_t*, uint32_t)) 0x08000079),
+    // delay_cycles()
+    ((void     (*)(uint32_t)) 0x0800009d),
+
+    //
+    // The following functions pointers must never be called from user
+    // programs. They are here primarily to document these entry points
+    // which are usable from a debugger or debugger script.
+    //
+    // flash_program_main_sram()
+    ((void (*) (void))  0x0800005d),
+    // flash_program_info_sram()
+    ((void (*) (void))  0x08000061),
+    // flash_erase_main_pages_sram()
+    ((void (*) (void))  0x08000065),
+    // flash_mass_erase_sram()
+    ((void (*) (void))  0x08000069),
+    // flash_erase_info_sram()
+    ((void     (*)(void)) 0x08000085),
+    // flash_erase_main_plus_info_sram()
+    ((void     (*)(void)) 0x0800008d)
+};
+
+//*****************************************************************************
+//
+//! @brief This function performs a mass erase on a flash instance.
+//!
+//! @param ui32Value - The flash program key.
+//! @param ui32FlashInst - The flash instance to erase.
+//!
+//! This function will erase the desired instance of flash.
+//!
+//! @note For Apollo2, each flash instance contains a maximum of 512KB.
+//!
+//! @note Interrupts are active during execution of this function. Any interrupt
+//! taken could cause execution errors. Please see the IMPORTANT note under
+//! Detailed Description above for more details.
+//!
+//! @return 0 for success, non-zero for failure.
+//
+//*****************************************************************************
+int
+am_hal_flash_mass_erase(uint32_t ui32Value, uint32_t ui32FlashInst)
+{
+    return g_am_hal_flash.flash_mass_erase(ui32Value, ui32FlashInst);
+}
+
+//*****************************************************************************
+//
+//! @brief This function performs a page erase on a flash instance.
+//!
+//! @param ui32Value - The flash program key.
+//! @param ui32FlashInst - The flash instance to reference the page number with.
+//! @param ui32PageNum - The flash page relative to the specified instance.
+//!
+//! This function will erase the desired flash page in the desired instance of
+//! flash.
+//!
+//! @note For Apollo2, each flash page is 8KB (or AM_HAL_FLASH_PAGE_SIZE).
+//! Each flash instance contains a maximum of 64 pages (or
+//! AM_HAL_FLASH_INSTANCE_PAGES).
+//!
+//! @note When given an absolute flash address, a couple of helpful macros can
+//! be utilized when calling this function.
+//! For example:
+//!     am_hal_flash_page_erase(AM_HAL_FLASH_PROGRAM_KEY,
+//!                             AM_HAL_FLASH_ADDR2INST(ui32Addr),
+//!                             AM_HAL_FLASH_ADDR2PAGE(ui32Addr) );
+//!
+//! @note Interrupts are active during execution of this function. Any interrupt
+//! taken could cause execution errors. Please see the IMPORTANT note under
+//! Detailed Description above for more details.
+//!
+//! @return 0 for success, non-zero for failure.
+//
+//*****************************************************************************
+int
+am_hal_flash_page_erase(uint32_t ui32Value, uint32_t ui32FlashInst,
+                        uint32_t ui32PageNum)
+{
+    return g_am_hal_flash.flash_page_erase(ui32Value,
+                                           ui32FlashInst,
+                                           ui32PageNum);
+}
+
+//*****************************************************************************
+//
+//! @brief This programs up to N words of the Main array on one flash instance.
+//!
+//! @param ui32Value - The programming key, AM_HAL_FLASH_PROGRAM_KEY.
+//! @param pui32Src - Pointer to word aligned array of data to program into
+//! the flash instance.
+//! @param pui32Dst - Pointer to the word aligned flash location where
+//! programming of the flash instance is to begin.
+//! @param ui32NumWords - The number of words to be programmed.
+//!
+//! This function will program multiple words in main flash.
+//!
+//! @note Interrupts are active during execution of this function. Any interrupt
+//! taken could cause execution errors. Please see the IMPORTANT note under
+//! Detailed Description above for more details.
+//!
+//! @return 0 for success, non-zero for failure.
+//
+//*****************************************************************************
+int
+am_hal_flash_program_main(uint32_t ui32Value, uint32_t *pui32Src,
+                          uint32_t *pui32Dst, uint32_t ui32NumWords)
+{
+    return g_am_hal_flash.flash_program_main(ui32Value, pui32Src,
+                                             pui32Dst, ui32NumWords);
+}
+
+//*****************************************************************************
+//
+//! @brief This function programs multiple words in the customer INFO space.
+//!
+//! @param ui32Value - The customer INFO space key.
+//! @param ui32InfoInst - The INFO space instance, 0 or 1.
+//! @param *pui32Src - Pointer to word aligned array of data to program into
+//! the customer INFO space.
+//! @param ui32Offset - Word offset into customer INFO space (offset of 0 is
+//! the first word, 1 is second word, etc.).
+//! @param ui32NumWords - The number of words to be programmed, must not
+//! exceed AM_HAL_FLASH_INFO_SIZE/4.
+//!
+//! This function will program multiple words in the customer INFO space.
+//!
+//! @note Interrupts are active during execution of this function. Any interrupt
+//! taken could cause execution errors. Please see the IMPORTANT note under
+//! Detailed Description above for more details.
+//!
+//! @return 0 for success, non-zero for failure.
+//
+//*****************************************************************************
+int
+am_hal_flash_program_info(uint32_t ui32Value, uint32_t ui32InfoInst,
+                          uint32_t *pui32Src, uint32_t ui32Offset,
+                          uint32_t ui32NumWords)
+{
+    return g_am_hal_flash.flash_program_info(ui32Value, 0, pui32Src,
+                                             ui32Offset, ui32NumWords);
+}
+
+//*****************************************************************************
+//
+//! @brief This function erases an instance of the customer INFO space.
+//!
+//! @param ui32ProgramKey - The customer INFO space programming key
+//! (AM_HAL_FLASH_PROGRAM_KEY).
+//! @param ui32Inst - The flash instance, either 0 or 1.
+//!
+//! This function will erase the the customer INFO space of the specified
+//! instance.
+//!
+//! @note Interrupts are active during execution of this function. Any interrupt
+//! taken could cause execution errors. Please see the IMPORTANT note under
+//! Detailed Description above for more details.
+//!
+//! @return 0 for success, non-zero for failure.
+//
+//*****************************************************************************
+int
+am_hal_flash_erase_info(uint32_t ui32ProgramKey,
+                        uint32_t ui32Inst)
+{
+    return g_am_hal_flash.flash_erase_info(ui32ProgramKey, ui32Inst);
+}
+
+//*****************************************************************************
+//
+//! @brief This function erases the main instance + the customer INFO space.
+//!
+//! @param ui32ProgramKey - The customer INFO space key.
+//! @param ui32Inst      - The flash instance, either 0 or 1.
+//!
+//! This function will erase the main flash + the customer INFO space of the
+//! specified instance.
+//!
+//! @note Interrupts are active during execution of this function. Any interrupt
+//! taken could cause execution errors. Please see the IMPORTANT note under
+//! Detailed Description above for more details.
+//!
+//! @return 0 for success, non-zero for failure.
+//
+//*****************************************************************************
+int
+am_hal_flash_erase_main_plus_info(uint32_t ui32ProgramKey,
+                                  uint32_t ui32Inst)
+{
+    return g_am_hal_flash.flash_erase_main_plus_info(ui32ProgramKey,
+                                                     ui32Inst);
+}
+
+//*****************************************************************************
+//
+//! @brief This function erases the main flash + the customer INFO space.
+//!
+//! @param ui32ProgramKey - The customer INFO space key.
+//!
+//! This function will erase both instances the main flash + the
+//! customer INFO space.
+//!
+//! @note Interrupts are active during execution of this function. Any interrupt
+//! taken could cause execution errors. Please see the IMPORTANT note under
+//! Detailed Description above for more details.
+//!
+//! @return 0 for success, non-zero for failure.
+//
+//*****************************************************************************
+int
+am_hal_flash_erase_main_plus_info_both_instances(uint32_t ui32ProgramKey)
+{
+    return g_am_hal_flash.flash_erase_main_plus_info_both_instances(
+                                                               ui32ProgramKey);
+}
+
+//*****************************************************************************
+//
+//! @brief This function erases both main flash instances + both customer INFO
+//! space instances.
+//!
+//! @param ui32RecoveryKey - The recovery key.
+//!
+//! This function erases both main instances and both customer INFOinstances
+//! even if the customer INFO space is programmed to not be erasable. This
+//! function completely erases the flash main and info instances and wipes the
+//! SRAM. Upon completion of the erasure operations, it does a POI (power on
+//! initialization) reset.
+//!
+//! @note Interrupts are active during execution of this function. Any interrupt
+//! taken could cause execution errors. Please see the IMPORTANT note under
+//! Detailed Description above for more details.
+//!
+//! @return Never Returns!!!
+//
+//*****************************************************************************
+void
+am_hal_flash_recovery(uint32_t ui32RecoveryKey)
+{
+    g_am_hal_flash.flash_recovery(ui32RecoveryKey);
+}
+
+//*****************************************************************************
+//
+//! @brief Return ui32 value obtained from anywhere in D Code or System Bus
+//!
+//! @param ui32Address - return the value corresponding to this location.
+//!
+//! Use this function to read a value from various peripheral locations
+//! that must be read from code running external to flash.
+//!
+//! @return the value found
+//
+//*****************************************************************************
+uint32_t
+am_hal_flash_load_ui32(uint32_t ui32Address)
+{
+    return g_am_hal_flash.flash_util_read_word((uint32_t*)ui32Address);
+}
+
+//*****************************************************************************
+//
+//! @brief Use the bootrom to write to a location in SRAM or the system bus.
+//!
+//! @param ui32Address - Store the data value corresponding to this location.
+//! @param ui32Data    - 32-bit Data to be stored.
+//!
+//! Use this function to store a value to various peripheral or SRAM locations
+//! that can not be touched from code running in SRAM or FLASH.  There is no
+//! known need for this function in Apollo2 at this time.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_flash_store_ui32(uint32_t ui32Address, uint32_t ui32Data)
+{
+    g_am_hal_flash.flash_util_write_word((uint32_t*)ui32Address,
+                                                ui32Data);
+}
+
+//*****************************************************************************
+//
+//! @brief Use the bootrom to implement a spin loop.
+//!
+//! @param ui32Iterations - Number of iterations to delay.
+//!
+//! Use this function to implement a CPU busy waiting spin loop without cache
+//! or delay uncertainties.
+//!
+//! Note that the ROM-based function executes at 3 cycles per iteration plus
+//! the regular function call, entry, and exit overhead.
+//! The call and return overhead, including the call to this function, is
+//! somewhere in the neighborhood of 36 cycles.
+//!
+//! Example:
+//! - MCU operating at 48MHz -> 20.83 ns / cycle
+//! - Therefore each iteration (once inside the bootrom function) will consume
+//!   62.5ns.
+//! - The total overhead (assuming 36 cycles) is 750ns.
+//! - If ui32Iterations = 4: 0.750 + (0.0625 * 4) = 1us.
+//!
+//! @note Interrupts are active during execution of this function.  Therefore,
+//! any interrupt taken will affect the delay timing.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_flash_delay(uint32_t ui32Iterations)
+{
+    g_am_hal_flash.delay_cycles(ui32Iterations);
+}
+
+//*****************************************************************************
+//
+//! @brief Static Helper Function to check customer info valid bits erasure.
+//!
+//! Use this function to test the state of the 128 valid bits at the beginning
+//! of customer info space. If these are all erased then return true.
+//!
+//! @return true if the customer info bits are currently erased.
+//
+//*****************************************************************************
+static bool
+customer_info_signature_erased(void)
+{
+    uint32_t *pui32Signature = (uint32_t *) AM_HAL_FLASH_INFO_ADDR;
+
+    return ( (pui32Signature[3] == 0xFFFFFFFF)  &&
+             (pui32Signature[2] == 0xFFFFFFFF)  &&
+             (pui32Signature[1] == 0xFFFFFFFF)  &&
+             (pui32Signature[0] == 0xFFFFFFFF) ) ? true : false;
+}
+
+//*****************************************************************************
+//
+//! @brief Static Helper Function to set customer info valid bits
+//!
+//! Use this function to set the state of the 128 valid bits at the beginning
+//! of customer info space. If these bits are not set correctly then the
+//! customer protection bits in the INFO space will not be honored by the
+//! hardware.
+//!
+//! @return Zero for success. Non-Zero for errors.
+//
+//*****************************************************************************
+static int
+customer_info_signature_set(void)
+{
+    uint32_t ui32Valid[4];
+    int iRC;
+
+    //
+    // If they are already set then we are done.
+    //
+    if ( am_hal_flash_customer_info_signature_check() )
+    {
+        return 0;
+    }
+
+    //
+    // If they are not erased at this point we have an error.
+    //
+    if ( !customer_info_signature_erased() )
+    {
+        return (2 << 16);
+    }
+
+    //
+    // OK they need to be set so do it.
+    //
+    ui32Valid[3] = AM_HAL_FLASH_INFO_SIGNATURE3;
+    ui32Valid[2] = AM_HAL_FLASH_INFO_SIGNATURE2;
+    ui32Valid[1] = AM_HAL_FLASH_INFO_SIGNATURE1;
+    ui32Valid[0] = AM_HAL_FLASH_INFO_SIGNATURE0;
+
+    iRC = g_am_hal_flash.flash_program_info(AM_HAL_FLASH_PROGRAM_KEY,
+                                            0,         // instance
+                                            ui32Valid, // source data
+                                            0,         // offset
+                                            4);        // number of words
+    return iRC | ((iRC) ? (1 << 16) : 0);
+}
+
+//*****************************************************************************
+//
+//! @brief Check that the customer info bits are valid.
+//!
+//! Use this function to test the state of the 128 valid bits at the beginning
+//! of customer info space. If these are not set correctly then the customer
+//! protection bits in the INFO space will not be honored by the hardware.
+//!
+//! @return true if valid.
+//
+//*****************************************************************************
+bool
+am_hal_flash_customer_info_signature_check(void)
+{
+    uint32_t *pui32Signature = (uint32_t *)AM_HAL_FLASH_INFO_ADDR;
+
+    return ( (pui32Signature[3] == AM_HAL_FLASH_INFO_SIGNATURE3)    &&
+             (pui32Signature[2] == AM_HAL_FLASH_INFO_SIGNATURE2)    &&
+             (pui32Signature[1] == AM_HAL_FLASH_INFO_SIGNATURE1)    &&
+             (pui32Signature[0] == AM_HAL_FLASH_INFO_SIGNATURE0) );
+}
+
+//*****************************************************************************
+//
+//! @brief INFO signature set.
+//!
+//! Use this function to set the state of the 128 valid bits at the beginning
+//! of customer info space, if needed.
+//!
+//! @note Interrupts are active during execution of this function. Any interrupt
+//! taken could cause execution errors. Please see the IMPORTANT note under
+//! Detailed Description above for more details.
+//!
+//! @return Zero for success. Non-Zero for errors.
+//
+//*****************************************************************************
+bool
+am_hal_flash_info_signature_set(void)
+{
+    //
+    // Check and set signature.
+    //
+    return customer_info_signature_set() ? false : true;
+}
+
+//*****************************************************************************
+//
+//! @brief Disable FLASH INFO space.
+//!
+//! Use this function to set the state of the 128 valid bits at the beginning
+//! of customer info space, if needed. Then disable FLASH erasure.
+//!
+//! @note Interrupts are active during execution of this function. Any interrupt
+//! taken could cause execution errors. Please see the IMPORTANT note under
+//! Detailed Description above for more details.
+//!
+//! @return Zero for success. Non-Zero for errors.
+//
+//*****************************************************************************
+int32_t
+am_hal_flash_info_erase_disable(void)
+{
+    int iRC;
+    uint32_t ui32SecurityValue;
+
+    //
+    // Security protection only works if the signature data is correct.
+    //
+    iRC = customer_info_signature_set();
+    if ( iRC )
+    {
+        return iRC;
+    }
+
+    //
+    // Clear bit in INFO space to disable erasure.
+    //
+    ui32SecurityValue = AM_REGVAL(AM_HAL_FLASH_INFO_SECURITY_ADDR)  &
+                        ~AM_HAL_FLASH_INFO_SECURITY_ENINFOERASE_M;
+
+    //
+    // Now write the word to the flash INFO space.
+    //
+    return g_am_hal_flash.flash_program_info(
+            AM_HAL_FLASH_PROGRAM_KEY,
+            0,                                  // instance
+            &ui32SecurityValue,                 // source data
+            AM_HAL_FLASH_INFO_SECURITY_O / 4,   // word offset
+            1 );                                // number of words
+}
+
+//*****************************************************************************
+//
+//! @brief Check for Disabled FLASH INFO space.
+//!
+//! Use this function to determine whether FLASH INFO erasure is disabled.
+//!
+//! @return true if FLASH INFO erase is disabled, otherwise false.
+//
+//*****************************************************************************
+bool
+am_hal_flash_info_erase_disable_check(void)
+{
+    //
+    // If they are erased at this point then SRAM wipe can't be enabled.
+    //
+    if ( customer_info_signature_erased() )
+    {
+        return false;
+    }
+
+    //
+    // If they are not valid at this point then SRAM wipe can't be enabled.
+    //
+    if ( !am_hal_flash_customer_info_signature_check() )
+    {
+        return false;
+    }
+
+    //
+    // Looking good so far, now check the SRAM WIPE bit.
+    //
+    return AM_REGVAL(AM_HAL_FLASH_INFO_SECURITY_ADDR)   &
+                     AM_HAL_FLASH_INFO_SECURITY_ENINFOERASE_M  ? false : true;
+}
+
+//*****************************************************************************
+//
+//! @brief Mask off 1 to 4 quadrants of FLASH INFO space for programming.
+//!
+//! Use this function to set the state of the 128 valid bits at the beginning
+//! of customer info space, if needed. Then and the mask bits with the INFO
+//! space programming disable bits.
+//!
+//! @param ui32Mask - A mask of the 4 quadrants of info space where
+//!                   bit0 = First quadrant (first 2KB).
+//!                   bit1 = Second quadrant (second 2KB).
+//!                   bit2 = Third quadrant (third 2KB).
+//!                   bit3 = Fourth quadrant (fourth 2KB).
+//!
+//! @note This function disables only, any quadrant already disabled is not
+//! reenabled.  That is, any ui32Mask bits specified as 0 are essentially nops.
+//!
+//! @note Interrupts are active during execution of this function. Any interrupt
+//! taken could cause execution errors. Please see the IMPORTANT note under
+//! Detailed Description above for more details.
+//!
+//! @return Zero for success. Non-Zero for errors.
+//
+//*****************************************************************************
+int32_t
+am_hal_flash_info_program_disable(uint32_t ui32Mask)
+{
+    int iRC;
+    uint32_t ui32SecurityValue;
+
+    //
+    // Security protection only works if the signature data is correct.
+    //
+    iRC = customer_info_signature_set();
+    if ( iRC )
+    {
+        return iRC;
+    }
+
+    //
+    // Make sure we have a valid mask and get the mask into the correct position.
+    //
+    ui32Mask <<= AM_HAL_FLASH_INFO_SECURITY_ENINFOPRGM_S;
+    ui32Mask &= AM_HAL_FLASH_INFO_SECURITY_ENINFOPRGM_M;
+
+    //
+    // The security bit set to 1 enables programming, 0 disables programming.
+    //
+    ui32SecurityValue = AM_REGVAL(AM_HAL_FLASH_INFO_SECURITY_ADDR) & ~ui32Mask;
+
+    //
+    // Now write the word to the flash INFO space.
+    //
+    return g_am_hal_flash.flash_program_info(
+            AM_HAL_FLASH_PROGRAM_KEY,
+            0,                                  // instance
+            &ui32SecurityValue,                 // source data
+            AM_HAL_FLASH_INFO_SECURITY_O / 4,   // word offset
+            1 );                                // number of words
+}
+
+//*****************************************************************************
+//
+//! @brief Return a mask specifying which quadrants of customer INFO space have
+//! been disabled for programming.
+//!
+//! Use this function to determine whether programming of customer INFO space
+//! has been disabled.
+//!
+//! @return A 4-bit mask of the disabled quadrants.
+//! 0xFFFFFFFF indicates an error.
+//! 0x0  indicates all customer INFO space programming is enabled.
+//! 0xF  indicates all customer INFO space programming is disabled.
+//! bit0 indicates the first customer INFO space is disabled for programming.
+//! bit1 indicates the second customer INFO space is disabled for programming.
+//! bit2 indicates the third customer INFO space is disabled for programming.
+//! bit3 indicates the fourth customer INFO space is disabled for programming.
+//
+//*****************************************************************************
+uint32_t
+am_hal_flash_info_program_disable_get(void)
+{
+    //
+    // If they are erased at this point then SRAM wipe can't be enabled.
+    //
+    if ( customer_info_signature_erased() )
+    {
+        return 0xFFFFFFFF;
+    }
+
+    //
+    // If not valid at this point, then INFO programming can't be enabled.
+    //
+    if ( !am_hal_flash_customer_info_signature_check() )
+    {
+        return 0xFFFFFFFF;
+    }
+
+    //
+    // Looking good so far, now return a mask of the disabled bits.
+    //
+    return  ((AM_REGVAL(AM_HAL_FLASH_INFO_SECURITY_ADDR) &
+                AM_HAL_FLASH_INFO_SECURITY_ENINFOPRGM_M) ^
+                AM_HAL_FLASH_INFO_SECURITY_ENINFOPRGM_M) >>
+                AM_HAL_FLASH_INFO_SECURITY_ENINFOPRGM_S;
+}
+
+//*****************************************************************************
+//
+//! @brief Enable FLASH debugger protection (FLASH gets wiped if a debugger is
+//! connected).
+//!
+//! Use this function to set the state of the 128 valid bits at the beginning
+//! of customer info space, if needed. Then set the FLASH wipe bit to zero.
+//!
+//! @note Interrupts are active during execution of this function. Any interrupt
+//! taken could cause execution errors. Please see the IMPORTANT note under
+//! Detailed Description above for more details.
+//!
+//! @return Zero for success. Non-Zero for errors.
+//
+//*****************************************************************************
+int32_t
+am_hal_flash_wipe_flash_enable(void)
+{
+    int iRC;
+    uint32_t ui32SecurityValue;
+
+    //
+    // Security protection only works if the signature data is correct.
+    //
+    iRC = customer_info_signature_set();
+    if ( iRC )
+    {
+        return iRC;
+    }
+
+    //
+    // Clear the FLASH Wipe bit.
+    //
+    ui32SecurityValue = AM_REGVAL(AM_HAL_FLASH_INFO_SECURITY_ADDR) &
+                        ~AM_HAL_FLASH_INFO_SECURITY_FLASHWIPE_M;
+
+    //
+    // Now write the word to the flash INFO space.
+    //
+    return g_am_hal_flash.flash_program_info(
+            AM_HAL_FLASH_PROGRAM_KEY,
+            0,                                  // instance
+            &ui32SecurityValue,                 // source data
+            AM_HAL_FLASH_INFO_SECURITY_O / 4,   // word offset
+            1 );                                // number of words
+}
+
+//*****************************************************************************
+//
+//! @brief check for FLASH wipe protection enabled.
+//!
+//! Use this function to determine if FLASH wipe protection is enabled.
+//!
+//! @return true if FLASH wipe protection is enabled, otherwise false.
+//
+//*****************************************************************************
+bool
+am_hal_flash_wipe_flash_enable_check(void)
+{
+    //
+    // If they are erased at this point then flash wipe can't be enabled.
+    //
+    if ( customer_info_signature_erased() )
+    {
+        return false;
+    }
+
+    //
+    // If they are not valid at this point then flash wipe can't be enabled.
+    //
+    if ( !am_hal_flash_customer_info_signature_check() )
+    {
+        return false;
+    }
+
+    //
+    // Looking good so far, now check the Flash WIPE bit.
+    //
+    return AM_REGVAL(AM_HAL_FLASH_INFO_SECURITY_ADDR) &
+            AM_HAL_FLASH_INFO_SECURITY_FLASHWIPE_M ? false : true;
+}
+
+//*****************************************************************************
+//
+//! @brief Enable SRAM protection so SRAM gets wiped if a debgger is connected.
+//!
+//! Use this function to set the state of the 128 valid bits at the beginning
+//! of customer info space, if needed. Then set the SRAM wipe bit to zero.
+//!
+//! @note Interrupts are active during execution of this function. Any interrupt
+//! taken could cause execution errors. Please see the IMPORTANT note under
+//! Detailed Description above for more details.
+//!
+//! @return Zero for success. Non-Zero for errors.
+//
+//*****************************************************************************
+int32_t
+am_hal_flash_wipe_sram_enable(void)
+{
+    int iRC;
+    uint32_t ui32SecurityValue;
+
+    //
+    // Security protection only works if the signature data is correct.
+    //
+    iRC = customer_info_signature_set();
+    if ( iRC )
+    {
+        return iRC;
+    }
+
+    //
+    // Clear the SRAM Wipe bit.
+    //
+    ui32SecurityValue = AM_REGVAL(AM_HAL_FLASH_INFO_SECURITY_ADDR) &
+                        ~AM_HAL_FLASH_INFO_SECURITY_SRAMWIPE_M;
+
+    //
+    // Now write the word to the flash INFO space.
+    //
+    return g_am_hal_flash.flash_program_info(
+            AM_HAL_FLASH_PROGRAM_KEY,
+            0,                                  // instance
+            &ui32SecurityValue,                 // source data
+            AM_HAL_FLASH_INFO_SECURITY_O / 4,   // word offset
+            1 );                                // number of words
+}
+
+//*****************************************************************************
+//
+//! @brief check for SRAM protection enabled.
+//!
+//! Use this function to determine if SRAM protection is enabled.
+//!
+//! @return true if SRAM wipe protection is enabled, otherwise false.
+//
+//*****************************************************************************
+bool
+am_hal_flash_wipe_sram_enable_check(void)
+{
+    //
+    // If they are erased at this point then SRAM wipe can't be enabled.
+    //
+    if ( customer_info_signature_erased() )
+    {
+        return false;
+    }
+
+    //
+    // If they are not vale at this point then SRAM wipe can't be enabled.
+    //
+    if ( !am_hal_flash_customer_info_signature_check() )
+    {
+        return false;
+    }
+
+    //
+    // Looking good so far, now check the SRAM WIPE bit.
+    //
+    return AM_REGVAL(AM_HAL_FLASH_INFO_SECURITY_ADDR) &
+            AM_HAL_FLASH_INFO_SECURITY_SRAMWIPE_M ? false : true;
+}
+
+//*****************************************************************************
+//
+//! @brief Disable Output from ITM/SWO.
+//!
+//! Use this function to set the state of the 128 valid bits at the beginning
+//! of customer info space, if needed. Set the SWO disable bit to zero.
+//!
+//! @note Interrupts are active during execution of this function. Any interrupt
+//! taken could cause execution errors. Please see the IMPORTANT note under
+//! Detailed Description above for more details.
+//!
+//! @return Zero for success. Non-Zero for errors.
+//
+//*****************************************************************************
+int32_t
+am_hal_flash_swo_disable(void)
+{
+    int iRC;
+    uint32_t ui32SecurityValue;
+
+    //
+    // Security protection only works if the signature data is correct.
+    //
+    iRC = customer_info_signature_set();
+    if ( iRC )
+    {
+        return iRC;
+    }
+
+    //
+    // Clear the SWO bit.
+    //
+    ui32SecurityValue = AM_REGVAL(AM_HAL_FLASH_INFO_SECURITY_ADDR) &
+                        ~AM_HAL_FLASH_INFO_SECURITY_SWOCTRL_M;
+
+    //
+    // Now write the word to the flash INFO space.
+    //
+    return g_am_hal_flash.flash_program_info(
+            AM_HAL_FLASH_PROGRAM_KEY,
+            0,                                  // instance
+            &ui32SecurityValue,                 // source data
+            AM_HAL_FLASH_INFO_SECURITY_O / 4,   // word offset
+            1 );                                // number of words
+}
+
+//*****************************************************************************
+//
+//! @brief check for SWO disabled.
+//!
+//! Use this function to determine if the SWO is disabled.
+//!
+//! @return true if the ITM/SWO is disabled, otherwise false.
+//
+//*****************************************************************************
+bool
+am_hal_flash_swo_disable_check(void)
+{
+    //
+    // If they are erased at this point then SRAM wipe can't be enabled.
+    //
+    if ( customer_info_signature_erased() )
+    {
+        return false;
+    }
+
+    //
+    // If they are not vale at this point then SRAM wipe can't be enabled.
+    //
+    if ( !am_hal_flash_customer_info_signature_check() )
+    {
+        return false;
+    }
+
+    //
+    // Looking good so far, now check the SWO bit.
+    //
+    return AM_REGVAL(AM_HAL_FLASH_INFO_SECURITY_ADDR) &
+            AM_HAL_FLASH_INFO_SECURITY_SWOCTRL_M ? false : true;
+}
+
+//*****************************************************************************
+//
+//! @brief Disable Connections from a debugger on the SWD interface.
+//!
+//! Use this function to set the state of the 128 valid bits at the beginning
+//! of customer info space, if needed. Set the debugger disable bit to zero.
+//!
+//! @note Interrupts are active during execution of this function. Any interrupt
+//! taken could cause execution errors. Please see the IMPORTANT note under
+//! Detailed Description above for more details.
+//!
+//! @return Zero for success. Non-Zero for errors.
+//
+//*****************************************************************************
+int32_t
+am_hal_flash_debugger_disable(void)
+{
+    int iRC;
+    uint32_t ui32SecurityValue;
+
+    //
+    // Security protection only works if the signature data is correct.
+    //
+    iRC = customer_info_signature_set();
+    if ( iRC )
+    {
+        return iRC;
+    }
+
+    //
+    // Clear the DEBUGGER bit.
+    //
+    ui32SecurityValue = AM_REGVAL(AM_HAL_FLASH_INFO_SECURITY_ADDR) &
+                        ~AM_HAL_FLASH_INFO_SECURITY_DEBUGGERPROT_M;
+
+    //
+    // Now write the word to the flash INFO space.
+    //
+    return g_am_hal_flash.flash_program_info(
+            AM_HAL_FLASH_PROGRAM_KEY,
+            0,                                  // instance
+            &ui32SecurityValue,                 // source data
+            AM_HAL_FLASH_INFO_SECURITY_O / 4,   // word offset
+            1 );                                // number of words
+}
+
+//*****************************************************************************
+//
+//! @brief check for debugger disabled.
+//!
+//! Use this function to determine if the debugger is disabled.
+//!
+//! @return true if the debugger is disabled, otherwise false.
+//
+//*****************************************************************************
+bool
+am_hal_flash_debugger_disable_check(void)
+{
+    //
+    // If they are erased at this point then SRAM wipe can't be enabled.
+    //
+    if ( customer_info_signature_erased() )
+    {
+        return false;
+    }
+
+    //
+    // If they are not vale at this point then SRAM wipe can't be enabled.
+    //
+    if ( !am_hal_flash_customer_info_signature_check() )
+    {
+        return false;
+    }
+
+    //
+    // Looking good so far, now check the debugger disable bit.
+    //
+    return AM_REGVAL(AM_HAL_FLASH_INFO_SECURITY_ADDR) &
+            AM_HAL_FLASH_INFO_SECURITY_DEBUGGERPROT_M ? false : true;
+}
+
+//*****************************************************************************
+//
+//! @brief This static helper function generates a 64-bit protection mask.
+//!
+//! @param pui32StartAddress - Starting address in flash to begin protection.
+//! @param pui32StopAddress  - Ending address in flash to stop protection.
+//!
+//! This function computes a chunk map for the protection range.
+//!
+//! @return Inverse of the actual chunk mask.  That is, chunks to be protected
+//! are represented as 0 in the returned mask, while chunks to be left alone
+//! are represented as 1.  This value can therefore be directly ANDed with the
+//! existing bits in INFO space.
+//! Note that -1 is returned if input parameters are invalid - this return
+//! value would indicate that no chunks are to be protected.
+//!
+//
+//*****************************************************************************
+static uint64_t
+generate_chunk_mask(uint32_t *pui32StartAddress, uint32_t *pui32StopAddress)
+{
+    uint32_t ui32ChunkStart, ui32ChunkStop;
+    uint32_t ui32Width;
+    uint64_t ui64Mask;
+
+    //
+    // Validate the address input parameters
+    //
+    if ( (pui32StartAddress > pui32StopAddress)  ||
+         (pui32StopAddress > (uint32_t*)AM_HAL_FLASH_LARGEST_VALID_ADDR) )
+    {
+        //
+        // Argument error, return value to leave all chunks unprotected.
+        //
+        return 0xFFFFFFFFFFFFFFFF;
+    }
+
+    //
+    // Extract chunk related information
+    //
+    ui32ChunkStart = AM_HAL_FLASH_INFO_ADDR2CHUNK((uint32_t)pui32StartAddress);
+    ui32ChunkStop  = AM_HAL_FLASH_INFO_ADDR2CHUNK((uint32_t)pui32StopAddress);
+    ui32Width = ui32ChunkStop - ui32ChunkStart + 1;
+
+    if ( ui32Width == 64 )
+    {
+        ui64Mask = (uint64_t)0xFFFFFFFFFFFFFFFFLLU;
+    }
+    else
+    {
+        ui64Mask = ( ((uint64_t)0x0000000000000001) << ui32Width) - 1;
+        ui64Mask <<= ui32ChunkStart;
+    }
+
+    //
+    // OK now return the chunk mask (inverted).
+    //
+    return ~ui64Mask;
+}
+
+//*****************************************************************************
+//
+//! @brief This function sets copy protection for a range of flash chunks.
+//!
+//! @param pui32StartAddress - Starting address in flash to begin protection.
+//! @param pui32StopAddress - Ending address in flash to stop protection.
+//!
+//! This function will set copy protection bits for a range of flash chunks
+//!
+//! @note Each flash chunk contains 16KBytes and corresponds to one bit in
+//! the protection register. Set the bit to zero to enable protection.
+//!
+//! @note Interrupts are active during execution of this function. Any interrupt
+//! taken could cause execution errors. Please see the IMPORTANT note under
+//! Detailed Description above for more details.
+//!
+//! @return
+//!     0 for success.
+//!     0x400000 if the protection bits were already programmed (mask the return
+//!              value with 0x3FFFFF to ignore this case and treat as success).
+//!     Otherwise, non-zero for failure.
+//
+//*****************************************************************************
+int32_t
+am_hal_flash_copy_protect_set(uint32_t *pui32StartAddress,
+                              uint32_t *pui32StopAddress)
+{
+    int iRC;
+    bool bModified = false;
+    uint64_t ui64Mask;
+    uint32_t ui32Work;
+    uint32_t ui32Protection[2];
+    uint32_t *pui32Protection = (uint32_t *)AM_HAL_FLASH_INFO_COPYPROT_ADDR;
+
+    //
+    // Extract chunk mask from parameters.
+    // Also checks parameter validity (returns -1 if bad parameters).
+    //
+    ui64Mask = generate_chunk_mask(pui32StartAddress, pui32StopAddress);
+    if ( ~ui64Mask == 0x0 )
+    {
+        return 0x100000;
+    }
+
+    //
+    // Go get the current settings for copy protection.
+    //
+    ui32Protection[0] = pui32Protection[0];
+    ui32Protection[1] = pui32Protection[1];
+
+    //
+    // AND mask off the necessary protection bits in the lower word.
+    //
+    ui32Work = (uint32_t)ui64Mask;
+    if ( ( ~ui32Work )  &&  ( ui32Work != ui32Protection[0] ) )
+    {
+        bModified = true;
+        ui32Protection[0] &= ui32Work;
+        iRC = g_am_hal_flash.flash_program_info(
+                AM_HAL_FLASH_PROGRAM_KEY,
+                0,                                      // instance
+                &ui32Protection[0],                     // source data
+                (AM_HAL_FLASH_INFO_COPYPROT_O / 4) + 0, // word offset
+                1 );                                    // number of words
+
+        if ( iRC )
+        {
+            return iRC | 0x10000;
+        }
+    }
+
+    //
+    // AND mask off the necessary protection bits in the upper word.
+    //
+    ui32Work = (uint32_t)(ui64Mask >> 32);
+    if ( ( ~ui32Work )  &&  ( ui32Work != ui32Protection[1] ) )
+    {
+        bModified = true;
+        ui32Protection[1] &= ui32Work;
+        iRC = g_am_hal_flash.flash_program_info(
+                AM_HAL_FLASH_PROGRAM_KEY,
+                0,                                      // instance
+                &ui32Protection[1],                     // source data
+                (AM_HAL_FLASH_INFO_COPYPROT_O / 4) + 1, // word offset
+                1 );                                    // number of words
+
+        if ( iRC )
+        {
+            return iRC | 0x20000;
+        }
+    }
+
+    if ( bModified )
+    {
+        return 0;
+    }
+    else
+    {
+        return 0x400000;
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief This function checks copy protection for a range of flash chunks.
+//!
+//! @param pui32StartAddress - Starting address in flash.
+//! @param pui32StopAddress - Ending address in flash.
+//!
+//! This function will check copy protection bits for a range of flash chunks
+//! it expects all chunks in the range to be protected.
+//!
+//! @note Each flash chunk contains 16KBytes and corresponds to one bit in
+//! the protection register. Set the bit to zero to enable protection.
+//!
+//! @return false for at least one chunk in the covered range is not protected,
+//!         and true if all chunks in the covered range are protected.
+//!
+//
+//*****************************************************************************
+bool
+am_hal_flash_copy_protect_check(uint32_t *pui32StartAddress,
+                                uint32_t *pui32StopAddress)
+{
+    uint64_t ui64Mask;
+    uint32_t ui32Work;
+    uint32_t *pui32Protection = (uint32_t *)AM_HAL_FLASH_INFO_COPYPROT_ADDR;
+
+    //
+    // Extract chunk mask from parameters.
+    // Also checks parameter validity (returns -1 if bad parameters).
+    //
+    ui64Mask = generate_chunk_mask(pui32StartAddress, pui32StopAddress);
+    if ( ~ui64Mask == 0x0 )
+    {
+        return false;
+    }
+
+    //
+    // Now check the lower word of protection bits.
+    //
+    ui32Work = (uint32_t)ui64Mask;
+    if ( ~ui32Work  &  pui32Protection[0] )
+    {
+        return false;
+    }
+
+    //
+    // Now check the lower word of protection bits.
+    //
+    ui32Work = (uint32_t)(ui64Mask >> 32);
+    if ( ~ui32Work & pui32Protection[1] )
+    {
+        return false;
+    }
+
+    //
+    // If we get here, there are no unprotected chunks within specified range.
+    //
+    return true;
+}
+
+//*****************************************************************************
+//
+//! @brief This function sets write protection for a range of flash chunks.
+//!
+//! @param pui32StartAddress - Starting address in flash to begin protection.
+//! @param pui32StopAddress - Ending address in flash to stop protection.
+//!
+//! This function will set write protection bits for a range of flash chunks
+//!
+//! @note Each flash chunk contains 16KBytes and corresponds to one bit in
+//! the protection register. Set the bit to zero to enable protection.
+//!
+//! @note Interrupts are active during execution of this function. Any interrupt
+//! taken could cause execution errors. Please see the IMPORTANT note under
+//! Detailed Description above for more details.
+//!
+//! @return
+//!     0 for success.
+//!     0x400000 if the protection bits were already programmed (mask the return
+//!              value with 0x3FFFFF to ignore this case and treat as success).
+//!     Otherwise, non-zero for failure.
+//
+//*****************************************************************************
+int32_t
+am_hal_flash_write_protect_set(uint32_t *pui32StartAddress,
+                               uint32_t *pui32StopAddress)
+{
+    int iRC;
+    bool bModified = false;
+    uint64_t ui64Mask;
+    uint32_t ui32Work;
+    uint32_t ui32Protection[2];
+    uint32_t *pui32Protection = (uint32_t *)AM_HAL_FLASH_INFO_WRITPROT_ADDR;
+
+    //
+    // Extract chunk mask from parameters.
+    // Also checks parameter validity (returns -1 if bad parameters).
+    //
+    ui64Mask = generate_chunk_mask(pui32StartAddress, pui32StopAddress);
+    if ( ~ui64Mask == 0x0 )
+    {
+        return 0x100000;
+    }
+
+    //
+    // Go get the current settings for copy protection.
+    //
+    ui32Protection[0] = pui32Protection[0];
+    ui32Protection[1] = pui32Protection[1];
+
+    //
+    // AND mask off the necessary protection bits in the lower word.
+    //
+    ui32Work = (uint32_t)ui64Mask;
+    if ( ( ~ui32Work )  &&  ( ui32Work != ui32Protection[0] ) )
+    {
+        bModified = true;
+        ui32Protection[0] &= ui32Work;
+        iRC = g_am_hal_flash.flash_program_info(
+                AM_HAL_FLASH_PROGRAM_KEY,
+                0,                                      // instance
+                &ui32Protection[0],                     // source data
+                (AM_HAL_FLASH_INFO_WRITPROT_O / 4) + 0, // word offset
+                1 );                                    // number of words
+
+        if ( iRC )
+        {
+            return iRC | 0x10000;
+        }
+    }
+
+    //
+    // AND mask off the necessary protection bits in the upper word.
+    //
+    ui32Work = (uint32_t)(ui64Mask >> 32);
+    if ( ( ~ui32Work )  &&  ( ui32Work != ui32Protection[1] ) )
+    {
+        bModified = true;
+        ui32Protection[1] &= ui32Work;
+        iRC = g_am_hal_flash.flash_program_info(
+                AM_HAL_FLASH_PROGRAM_KEY,
+                0,                                      // instance
+                &ui32Protection[1],                     // source data
+                (AM_HAL_FLASH_INFO_WRITPROT_O / 4) + 1, // word offset
+                1 );                                    // number of words
+
+        if ( iRC )
+        {
+            return iRC | 0x20000;
+        }
+    }
+
+    if ( bModified )
+    {
+        return 0;
+    }
+    else
+    {
+        return 0x400000;
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief This function checks write protection for a range of flash chunks.
+//!
+//! @param pui32StartAddress - Starting address in flash.
+//! @param pui32StopAddress - Ending address in flash.
+//!
+//! This function will check write protection bits for a range of flash chunks
+//! it expects all chunks in the range to be protected.
+//!
+//! @note Each flash chunk contains 16KBytes and corresponds to one bit in
+//! the protection register. Set the bit to zero to enable protection.
+//!
+//! @return false for at least one chunk in the covered range is not protected,
+//!         and true if all chunks in the covered range are protected.
+//!
+//
+//*****************************************************************************
+bool
+am_hal_flash_write_protect_check(uint32_t *pui32StartAddress,
+                                 uint32_t *pui32StopAddress)
+{
+    uint64_t ui64Mask;
+    uint32_t ui32Work;
+    uint32_t *pui32Protection = (uint32_t *)AM_HAL_FLASH_INFO_WRITPROT_ADDR;
+
+    //
+    // Extract chunk mask from parameters.
+    // Also checks parameter validity (returns -1 if bad parameters).
+    //
+    ui64Mask = generate_chunk_mask(pui32StartAddress, pui32StopAddress);
+    if ( ~ui64Mask == 0x0 )
+    {
+        return false;
+    }
+
+    //
+    // Now check the lower word of protection bits.
+    //
+    ui32Work = (uint32_t)ui64Mask;
+    if ( ~ui32Work & pui32Protection[0] )
+    {
+        return false;
+    }
+
+    //
+    // Now check the lower word of protection bits.
+    //
+    ui32Work = (uint32_t)(ui64Mask >> 32);
+    if ( ~ui32Work & pui32Protection[1] )
+    {
+        return false;
+    }
+
+    //
+    // If we get here, there are no unprotected chunks within specified range.
+    //
+    return true;
+}
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_flash.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_flash.h
new file mode 100644
index 000000000..4a6a208f5
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_flash.h
@@ -0,0 +1,280 @@
+//*****************************************************************************
+//
+//! @file am_hal_flash.h
+//!
+//! @brief Functions for performing Flash operations.
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup flash Flash
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_HAL_FLASH_H
+#define AM_HAL_FLASH_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <stdint.h>
+#include <stdbool.h>
+
+//*****************************************************************************
+//
+// Flash Program keys.
+//
+//*****************************************************************************
+#define AM_HAL_FLASH_PROGRAM_KEY            0x12344321
+#define AM_HAL_FLASH_RECOVERY_KEY           0xA35C9B6D
+#define AM_HAL_FLASH_INFO_KEY               0x12344321
+#define AM_HAL_FLASH_OTP_KEY                (AM_HAL_FLASH_INFO_KEY)
+
+//*****************************************************************************
+//
+// Some helpful flash values and macros.
+//
+//*****************************************************************************
+#define AM_HAL_FLASH_ADDR                   0x00000000
+#define AM_HAL_FLASH_PAGE_SIZE              ( 8 * 1024 )
+#define AM_HAL_FLASH_INFO_SIZE              AM_HAL_FLASH_PAGE_SIZE
+#define AM_HAL_FLASH_INSTANCE_SIZE          ( 512 * 1024 )
+#define AM_HAL_FLASH_INSTANCE_PAGES         ( AM_HAL_FLASH_INSTANCE_SIZE / AM_HAL_FLASH_PAGE_SIZE )
+#define AM_HAL_FLASH_TOTAL_SIZE             ( AM_HAL_FLASH_INSTANCE_SIZE * 2 )
+#define AM_HAL_FLASH_LARGEST_VALID_ADDR     ( AM_HAL_FLASH_ADDR + AM_HAL_FLASH_TOTAL_SIZE - 1 )
+
+// Convert an absolute flash address to a instance
+#define AM_HAL_FLASH_ADDR2INST(addr)        ( ( addr >> 19 ) & 1 )
+// Convert an absolute flash address to a page number relative to the instance
+#define AM_HAL_FLASH_ADDR2PAGE(addr)        ( ( addr >> 13 ) & 0x3F )
+// Convert an absolute flash address to an absolute page number
+#define AM_HAL_FLASH_ADDR2ABSPAGE(addr)     ( addr >> 13 )
+
+//
+// Backward compatibility
+//
+#define am_hal_flash_program_otp        am_hal_flash_program_info
+#define am_hal_flash_program_otp_sram   am_hal_flash_program_info_sram
+
+//*****************************************************************************
+//
+// Structure of function pointers to helper functions for invoking various
+// flash operations. The functions we are pointing to here are in the Apollo 2
+// integrated BOOTROM.
+//
+//*****************************************************************************
+typedef struct am_hal_flash_helper_struct
+{
+    //
+    // The basics.
+    //
+    int      (*flash_mass_erase)(uint32_t, uint32_t);
+    int      (*flash_page_erase)(uint32_t, uint32_t, uint32_t);
+    int      (*flash_program_main)(uint32_t,  uint32_t *,
+                                          uint32_t*, uint32_t);
+    int      (*flash_program_info)(uint32_t,   uint32_t,
+                                         uint32_t*,  uint32_t, uint32_t);
+
+    //
+    // Non-blocking variants, but be careful these are not interrupt safe so
+    // mask interrupts while these very long operations proceed.
+    //
+    int      (*flash_mass_erase_nb)(uint32_t, uint32_t);
+    int      (*flash_page_erase_nb)(uint32_t, uint32_t, uint32_t);
+    bool     (*flash_nb_operation_complete)(void);
+
+    //
+    // Essentially these are recovery options.
+    //
+    int      (*flash_erase_info)(uint32_t, uint32_t);
+    int      (*flash_erase_main_plus_info)(uint32_t, uint32_t);
+    int      (*flash_erase_main_plus_info_both_instances)(uint32_t);
+    void     (*flash_recovery)(uint32_t);
+
+    //
+    // Useful utilities.
+    //
+    uint32_t (*flash_util_read_word)(uint32_t*);
+    void     (*flash_util_write_word)(uint32_t*, uint32_t);
+    void     (*delay_cycles)(uint32_t);
+
+    //
+    // The following functions pointers will generally never be called from
+    // user programs. They are here primarily to document these entry points
+    // which are usable from a debugger or debugger script.
+    //
+    void     (*flash_program_main_sram)(void);
+    void     (*flash_program_info_sram)(void);
+    void     (*flash_erase_main_pages_sram)(void);
+    void     (*flash_mass_erase_sram)(void);
+    void     (*flash_erase_info_sram)(void);
+    void     (*flash_erase_main_plus_info_sram)(void);
+} g_am_hal_flash_t;
+extern g_am_hal_flash_t g_am_hal_flash;
+
+
+//*****************************************************************************
+//
+// Define some FLASH INFO SPACE values and macros.
+//
+//*****************************************************************************
+#define AM_HAL_FLASH_INFO_ADDR              0x50020000
+#define AM_HAL_FLASH_INFO_SECURITY_O        0x10
+#define AM_HAL_FLASH_INFO_WRITPROT_O        0x20
+#define AM_HAL_FLASH_INFO_COPYPROT_O        0x30
+
+#define AM_HAL_FLASH_INFO_SECURITY_ADDR     (AM_HAL_FLASH_INFO_ADDR + AM_HAL_FLASH_INFO_SECURITY_O)
+#define AM_HAL_FLASH_INFO_WRITPROT_ADDR     (AM_HAL_FLASH_INFO_ADDR + AM_HAL_FLASH_INFO_WRITPROT_O)
+#define AM_HAL_FLASH_INFO_COPYPROT_ADDR     (AM_HAL_FLASH_INFO_ADDR + AM_HAL_FLASH_INFO_COPYPROT_O)
+
+//
+// Define the customer info signature data (at AM_HAL_FLASH_INFO_ADDR).
+// These bits must exist in the customer info space in order for many of the
+// security and protection functions to work.
+//
+#define AM_HAL_FLASH_INFO_SIGNATURE0        0x48EAAD88
+#define AM_HAL_FLASH_INFO_SIGNATURE1        0xC9705737
+#define AM_HAL_FLASH_INFO_SIGNATURE2        0x0A6B8458
+#define AM_HAL_FLASH_INFO_SIGNATURE3        0xE41A9D74
+
+//
+// Define the customer security bits (at AM_HAL_FLASH_INFO_SECURITY_ADDR)
+//
+#define AM_HAL_FLASH_INFO_SECURITY_DEBUGGERPROT_S       0
+#define AM_HAL_FLASH_INFO_SECURITY_SWOCTRL_S            1
+#define AM_HAL_FLASH_INFO_SECURITY_SRAMWIPE_S           2
+#define AM_HAL_FLASH_INFO_SECURITY_FLASHWIPE_S          3
+#define AM_HAL_FLASH_INFO_SECURITY_ENINFOPRGM_S         4
+#define AM_HAL_FLASH_INFO_SECURITY_ENINFOERASE_S        8
+#define AM_HAL_FLASH_INFO_SECURITY_BOOTLOADERSPIN_S     9
+
+#define AM_HAL_FLASH_INFO_SECURITY_DEBUGGERPROT_M       ((uint32_t)(0x1 << AM_HAL_FLASH_INFO_SECURITY_DEBUGGERPROT_S))
+#define AM_HAL_FLASH_INFO_SECURITY_SWOCTRL_M            ((uint32_t)(0x1 << AM_HAL_FLASH_INFO_SECURITY_SWOCTRL_S))
+#define AM_HAL_FLASH_INFO_SECURITY_SRAMWIPE_M           ((uint32_t)(0x1 << AM_HAL_FLASH_INFO_SECURITY_SRAMWIPE_S))
+#define AM_HAL_FLASH_INFO_SECURITY_FLASHWIPE_M          ((uint32_t)(0x1 << AM_HAL_FLASH_INFO_SECURITY_FLASHWIPE_S))
+#define AM_HAL_FLASH_INFO_SECURITY_ENINFOPRGM_M         ((uint32_t)(0xF << AM_HAL_FLASH_INFO_SECURITY_ENINFOPRGM_S))
+#define AM_HAL_FLASH_INFO_SECURITY_ENINFOERASE_M        ((uint32_t)(0x1 << AM_HAL_FLASH_INFO_SECURITY_ENINFOERASE_S))
+#define AM_HAL_FLASH_INFO_SECURITY_BOOTLOADERSPIN_M     ((uint32_t)(0x1 << AM_HAL_FLASH_INFO_SECURITY_BOOTLOADERSPIN_S))
+#define AM_HAL_FLASH_INFO_SECURITY_DEEPSLEEP_M          ((uint32_t)(0x1 << AM_HAL_FLASH_INFO_SECURITY_BOOTLOADERSPIN_S))
+#define AM_HAL_FLASH_INFO_SECURITY_DEEPSLEEP            ((uint32_t)(0x0 << AM_HAL_FLASH_INFO_SECURITY_BOOTLOADERSPIN_S))
+
+//
+// Protection chunk macros
+// AM_HAL_FLASH_INFO_CHUNK2ADDR: Convert a chunk number to an address
+// AM_HAL_FLASH_INFO_CHUNK2INST: Convert a chunk number to an instance number
+// AM_HAL_FLASH_INFO_ADDR2CHUNK: Convert an address to a chunk number
+//
+#define AM_HAL_FLASH_INFO_CHUNKSIZE         (16*1024)
+
+#define AM_HAL_FLASH_INFO_CHUNK2ADDR(n)     (AM_HAL_FLASH_ADDR + (n << 14))
+#define AM_HAL_FLASH_INFO_CHUNK2INST(n)     ((n >> 5) & 1
+#define AM_HAL_FLASH_INFO_ADDR2CHUNK(n)     ((n) >> 14)
+
+//*****************************************************************************
+//
+// Function prototypes for the helper functions
+//
+//*****************************************************************************
+extern int am_hal_flash_mass_erase(uint32_t ui32Value, uint32_t ui32FlashInst);
+extern int am_hal_flash_page_erase(uint32_t ui32Value, uint32_t ui32FlashInst,
+                                   uint32_t ui32PageNum);
+extern int am_hal_flash_program_main(uint32_t value, uint32_t *pSrc,
+                                     uint32_t *pDst, uint32_t  NumberOfWords);
+extern int am_hal_flash_program_info(uint32_t ui32Value, uint32_t ui32InfoInst,
+                                     uint32_t *pui32Src, uint32_t ui32Offset,
+                                     uint32_t ui32NumWords);
+
+//
+// Recovery type functions for Customer INFO space.
+//
+extern int      am_hal_flash_erase_info(uint32_t ui32ProgramKey,
+                                        uint32_t ui32Instance);
+extern int      am_hal_flash_erase_main_plus_info(uint32_t ui32ProgramKey,
+                                                  uint32_t ui32Instance);
+extern int      am_hal_flash_erase_main_plus_info_both_instances(
+                                                  uint32_t ui32ProgramKey);
+extern void     am_hal_flash_recovery(uint32_t ui32RecoveryKey);
+
+//
+// BOOTROM resident reader, writer and delay utility functions.
+//
+extern uint32_t am_hal_flash_load_ui32(uint32_t ui32Address);
+extern void     am_hal_flash_store_ui32(uint32_t ui32Address, uint32_t ui32Data);
+extern void     am_hal_flash_delay(uint32_t ui32Iterations);
+
+//
+// These functions update security/protection bits in the customer INFO blOCK.
+//
+extern bool     am_hal_flash_customer_info_signature_check(void);
+extern bool     am_hal_flash_info_signature_set(void);
+extern int32_t  am_hal_flash_info_erase_disable(void);
+extern bool     am_hal_flash_info_erase_disable_check(void);
+extern int32_t  am_hal_flash_info_program_disable(uint32_t ui32Mask);
+extern uint32_t am_hal_flash_info_program_disable_get(void);
+extern int32_t  am_hal_flash_wipe_flash_enable(void);
+extern bool     am_hal_flash_wipe_flash_enable_check(void);
+extern int32_t  am_hal_flash_wipe_sram_enable(void);
+extern bool     am_hal_flash_wipe_sram_enable_check(void);
+extern int32_t  am_hal_flash_swo_disable(void);
+extern bool     am_hal_flash_swo_disable_check(void);
+extern int32_t  am_hal_flash_debugger_disable(void);
+extern bool     am_hal_flash_debugger_disable_check(void);
+
+extern int32_t  am_hal_flash_copy_protect_set(uint32_t *pui32StartAddress,
+                                              uint32_t *pui32StopAddress);
+extern bool     am_hal_flash_copy_protect_check(uint32_t *pui32StartAddress,
+                                                uint32_t *pui32StopAddress);
+extern int32_t  am_hal_flash_write_protect_set(uint32_t *pui32StartAddress,
+                                               uint32_t *pui32StopAddress);
+extern bool     am_hal_flash_write_protect_check(uint32_t *pui32StartAddress,
+                                                 uint32_t *pui32StopAddress);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_HAL_FLASH_H
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_global.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_global.c
new file mode 100644
index 000000000..b1b3bd83b
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_global.c
@@ -0,0 +1,58 @@
+//*****************************************************************************
+//
+//! @file am_hal_global.c
+//!
+//! @brief Locate global variables here.
+//!
+//! This module contains global variables that are used throughout the HAL.
+//!
+//! One use in particular is that it uses a global HAL flags variable that
+//! contains flags used in various parts of the HAL.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "am_mcu_apollo.h"
+
+//*****************************************************************************
+//
+// Global Variables
+//
+//*****************************************************************************
+uint32_t volatile g_ui32HALflags = 0x00000000;
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_global.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_global.h
new file mode 100644
index 000000000..85d0df879
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_global.h
@@ -0,0 +1,113 @@
+//*****************************************************************************
+//
+//! @file am_hal_global.h
+//!
+//! @brief Locate all HAL global variables here.
+//!
+//! This module contains global variables that are used throughout the HAL,
+//! but not necessarily those designated as const (which typically end up in
+//! flash). Consolidating globals here will make it easier to manage them.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_HAL_GLOBAL_H
+#define AM_HAL_GLOBAL_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+//*****************************************************************************
+//
+// Macro definitions
+//
+//*****************************************************************************
+
+//******************************************************************************
+//
+// Macros used to access the bit fields in the flags variable.
+//
+//******************************************************************************
+#define AM_HAL_FLAGS_BFR(flagnm)                                            \
+    ((g_ui32HALflags & AM_HAL_FLAGS_##flagnm##_M) >> AM_HAL_FLAGS_##flagnm##_S)
+
+#define AM_HAL_FLAGS_BFW(flagnm, value)                                     \
+    g_ui32HALflags = ((g_ui32HALflags & (~(AM_HAL_FLAGS_##flagnm##_M)))  |    \
+     ((value << AM_HAL_FLAGS_##flagnm##_S) & (AM_HAL_FLAGS_##flagnm##_M)) )
+
+//******************************************************************************
+//
+// ITMSKIPENABLEDISABLE - Set when the ITM is not to be disabled.  This is
+//                        typically needed by Keil debug.ini.
+//
+//******************************************************************************
+#define AM_HAL_FLAGS_ITMSKIPENABLEDISABLE_S         0
+#define AM_HAL_FLAGS_ITMSKIPENABLEDISABLE_M         (1 << AM_HAL_FLAGS_ITMSKIPENABLEDISABLE_S)
+#define AM_HAL_FLAGS_ITMSKIPENABLEDISABLE(n)        (((n) << AM_HAL_FLAGS_ITMSKIPENABLEDISABLE_S) & AM_HAL_FLAGS_ITMSKIPENABLEDISABLE_M)
+
+//******************************************************************************
+//
+// ITMBKPT - Breakpoint at the end of itm_enable(), which is needed by
+//           Keil debug.ini.
+//
+//******************************************************************************
+#define AM_HAL_FLAGS_ITMBKPT_S                      1
+#define AM_HAL_FLAGS_ITMBKPT_M                      (1 << AM_HAL_FLAGS_ITMBKPT_S)
+#define AM_HAL_FLAGS_ITMBKPT(n)                     (((n) << AM_HAL_FLAGS_ITMBKPT_S) & AM_HAL_FLAGS_ITMBKPT_M)
+
+//******************************************************************************
+//
+// Next available flag or bit field.
+//
+//******************************************************************************
+#define AM_HAL_FLAGS_NEXTBITFIELD_S                 2
+#define AM_HAL_FLAGS_NEXTBITFIELD_M                 (1 << AM_HAL_FLAGS_NEXTBITFIELD_S)
+#define AM_HAL_FLAGS_NEXTBITFIELD(n)                (((n) << AM_HAL_FLAGS_NEXTBITFIELD_S) & AM_HAL_FLAGS_NEXTBITFIELD_M)
+
+//*****************************************************************************
+//
+// Global Variables extern declarations.
+//
+//*****************************************************************************
+extern volatile uint32_t g_ui32HALflags;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_HAL_GLOBAL_H
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_gpio.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_gpio.c
new file mode 100644
index 000000000..480ce99a3
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_gpio.c
@@ -0,0 +1,503 @@
+//*****************************************************************************
+//
+//! @file am_hal_gpio.c
+//!
+//! @brief Functions for interfacing with the GPIO module
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup gpio GPIO
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "am_mcu_apollo.h"
+
+//*****************************************************************************
+//
+// Array of function pointers for handling GPIO interrupts.
+//
+//*****************************************************************************
+am_hal_gpio_handler_t am_hal_gpio_ppfnHandlers[64];
+
+//*****************************************************************************
+//
+//! @brief Read the configuration information for the given pin..
+//!
+//! @param ui32GPIONum is the GPIO number whose configuration we want to read.
+//!
+//! This function reads the PADREG, GPIO CFG, and ALTPAD registers for the
+//! given GPIO and returns them in the following format:
+//!
+//! ( (ALTPAD << 16) | (CFG << 8) | PADREG)
+//!
+//! This is the same format used by the \e am_hal_gpio_pin_config()
+//! function-like macro.
+//!
+//! @return Pin configuration information.
+//
+//*****************************************************************************
+uint32_t
+am_hal_gpio_pin_config_read(uint32_t ui32PinNumber)
+{
+    uint32_t ui32CfgVal, ui32PadregVal, ui32AltPadVal;
+
+    am_hal_debug_assert_msg(ui32PinNumber <= 63, "Invalid GPIO number.");
+
+    ui32CfgVal    = AM_HAL_GPIO_CFG_R(ui32PinNumber);
+    ui32PadregVal = AM_HAL_GPIO_PADREG_R(ui32PinNumber);
+    ui32AltPadVal = AM_HAL_GPIO_ALTPADREG_R(ui32PinNumber);
+
+    return ( (ui32CfgVal    << CFGVAL_GPIOCFG_S)    |
+             (ui32PadregVal << CFGVAL_PADREG_S)     |
+             (ui32AltPadVal << CFGVAL_ALTPAD_S) );
+}
+
+//*****************************************************************************
+//
+//! @brief Get the state of ALL GPIOs from the INPUT READ REGISTER.
+//!
+//! This function retrieves the state of ALL GPIOs from the INPUT READ
+//! REGISTER.
+//!
+//! @return the state for the requested GPIO or -1 for error.
+//
+//*****************************************************************************
+uint64_t
+am_hal_gpio_input_read(void)
+{
+    //
+    // Combine upper or lower GPIO words into one 64 bit return value.
+    //
+    uint64_t ui64RetVal;
+
+    ui64RetVal  = ((uint64_t) AM_REGn(GPIO, 0, RDB)) << 32;
+    ui64RetVal |= ((uint64_t) AM_REGn(GPIO, 0, RDA)) << 0;
+
+    return ui64RetVal;
+}
+
+//*****************************************************************************
+//
+//! @brief Get the state of ALL GPIOs from the DATA OUTPUT REGISTER.
+//!
+//! This function retrieves the state of ALL GPIOs from the DATA OUTPUT
+//! REGISTER.
+//!
+//! @return the state for the requested GPIO or -1 for error.
+//
+//*****************************************************************************
+uint64_t
+am_hal_gpio_out_read(void)
+{
+    //
+    // Combine upper or lower GPIO words into one 64 bit return value.
+    //
+    uint64_t ui64RetVal;
+
+    ui64RetVal  = ((uint64_t) AM_REGn(GPIO, 0, WTB)) << 32;
+    ui64RetVal |= ((uint64_t) AM_REGn(GPIO, 0, WTA)) << 0;
+
+    return ui64RetVal;
+}
+
+//*****************************************************************************
+//
+//! @brief Gets the state of one GPIO from the DATA ENABLE REGISTER.
+//!
+//! @param ui32BitNum - GPIO number.
+//!
+//! This function gets the state of one GPIO from the DATA ENABLE REGISTER.
+//!
+//! @return the current state for the requested GPIO.
+//
+//*****************************************************************************
+uint32_t
+am_hal_gpio_out_enable_bit_get(uint32_t ui32BitNum)
+{
+    //
+    // Return 0 or 1.
+    //
+
+    return (AM_HAL_GPIO_EN(ui32BitNum) & AM_HAL_GPIO_EN_M(ui32BitNum)) ? 1 : 0;
+}
+
+//*****************************************************************************
+//
+//! @brief Gets the state of ALL GPIOs from the DATA ENABLE REGISTER.
+//!
+//! @param ui32BitNum - GPIO number.
+//!
+//! This function gets the state of all GPIOs from the DATA ENABLE REGISTER.
+//!
+//! @return the current state for the ALL GPIOs.
+//
+//*****************************************************************************
+uint64_t
+am_hal_gpio_out_enable_get(void)
+{
+    //
+    // Combine upper or lower GPIO words into one 64 bit return value.
+    //
+    uint64_t ui64RetVal;
+
+    ui64RetVal  = ((uint64_t) AM_REGn(GPIO, 0, ENB)) << 32;
+    ui64RetVal |= ((uint64_t) AM_REGn(GPIO, 0, ENA)) << 0;
+
+    return ui64RetVal;
+}
+
+//*****************************************************************************
+//
+//! @brief Enable selected GPIO Interrupts.
+//!
+//! @param ui64InterruptMask - GPIOs to enable interrupts on.
+//!
+//! Use this function to enable the GPIO interrupts.
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_gpio_int_enable(uint64_t ui64InterruptMask)
+{
+    //
+    // Enable the interrupts.
+    //
+    AM_REG(GPIO, INT1EN) |= (ui64InterruptMask >> 32);
+    AM_REG(GPIO, INT0EN) |= (ui64InterruptMask & 0xFFFFFFFF);
+}
+
+//*****************************************************************************
+//
+//! @brief Enable selected GPIO Interrupts.
+//!
+//! Use this function to enable the GPIO interrupts.
+//!
+//! @return logical or of all enabled interrupts. Use AM_HAL_GPIO_BITx to mask
+//! interrupts of interest.
+//
+//*****************************************************************************
+uint64_t
+am_hal_gpio_int_enable_get(void)
+{
+    //
+    // Return enabled interrupts.
+    //
+    uint64_t ui64RetVal;
+
+    ui64RetVal  = ((uint64_t) AM_REGn(GPIO, 0, INT1EN)) << 32;
+    ui64RetVal |= ((uint64_t) AM_REGn(GPIO, 0, INT0EN)) << 0;
+
+    return ui64RetVal;
+}
+
+//*****************************************************************************
+//
+//! @brief Disable selected GPIO Interrupts.
+//!
+//! @param ui64InterruptMask - GPIOs to disable interrupts on.
+//!
+//! Use this function to disable the GPIO interrupts.
+//!
+//! ui64InterruptMask should be a logical or of AM_HAL_GPIO_BITx defines.
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_gpio_int_disable(uint64_t ui64InterruptMask)
+{
+    //
+    // Disable the interrupts.
+    //
+    AM_CRITICAL_BEGIN_ASM
+    AM_REG(GPIO, INT1EN) &= ~(ui64InterruptMask >> 32);
+    AM_REG(GPIO, INT0EN) &= ~(ui64InterruptMask & 0xFFFFFFFF);
+    AM_CRITICAL_END_ASM
+}
+
+//*****************************************************************************
+//
+//! @brief Clear selected GPIO Interrupts.
+//!
+//! @param ui64InterruptMask - GPIOs to clear interrupts on.
+//!
+//! Use this function to clear the GPIO interrupts.
+//!
+//! ui64InterruptMask should be a logical or of AM_HAL_GPIO_BITx defines.
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_gpio_int_clear(uint64_t ui64InterruptMask)
+{
+    //
+    // Clear the interrupts.
+    //
+    AM_CRITICAL_BEGIN_ASM
+    AM_REG(GPIO, INT1CLR) = (ui64InterruptMask >> 32);
+    AM_REG(GPIO, INT0CLR) = (ui64InterruptMask & 0xFFFFFFFF);
+    AM_CRITICAL_END_ASM
+}
+
+//*****************************************************************************
+//
+//! @brief Set selected GPIO Interrupts.
+//!
+//! @param ui64InterruptMask - GPIOs to set interrupts on.
+//!
+//! Use this function to set the GPIO interrupts.
+//!
+//! ui64InterruptMask should be a logical or of AM_HAL_GPIO_BITx defines.
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_gpio_int_set(uint64_t ui64InterruptMask)
+{
+    //
+    // Set the interrupts.
+    //
+    AM_REG(GPIO, INT1SET) = (ui64InterruptMask >> 32);
+    AM_REG(GPIO, INT0SET) = (ui64InterruptMask & 0xFFFFFFFF);
+}
+
+//*****************************************************************************
+//
+//! @brief Set selected GPIO Interrupts.
+//!
+//! @param bEnabledOnly - return the status of only the enabled interrupts.
+//!
+//! Use this function to set the GPIO interrupts.
+//!
+//! @return None
+//
+//*****************************************************************************
+uint64_t
+am_hal_gpio_int_status_get(bool bEnabledOnly)
+{
+    uint64_t ui64RetVal, ui64Mask;
+
+    //
+    // Combine upper or lower GPIO words into one 64 bit return value.
+    //
+    ui64Mask   = 0xFFFFFFFFFFFFFFFF;
+
+    AM_CRITICAL_BEGIN_ASM
+    ui64RetVal  = ((uint64_t) AM_REGn(GPIO, 0, INT1STAT)) << 32;
+    ui64RetVal |= ((uint64_t) AM_REGn(GPIO, 0, INT0STAT)) << 0;
+
+    if ( bEnabledOnly )
+    {
+        ui64Mask    = ((uint64_t) AM_REGn(GPIO, 0, INT1EN)) << 32;
+        ui64Mask   |= ((uint64_t) AM_REGn(GPIO, 0, INT0EN)) << 0;
+    }
+
+    ui64RetVal &= ui64Mask;
+    AM_CRITICAL_END_ASM
+
+    return ui64RetVal;
+}
+
+//*****************************************************************************
+//
+//! @brief Convenience function for responding to pin interrupts.
+//!
+//! @param ui64Status is the interrupt status as returned by
+//! am_hal_gpio_int_status_get()
+//!
+//! This function may be called from am_hal_gpio_isr() to read the status of
+//! the GPIO interrupts, determine which pin(s) caused the most recent
+//! interrupt, and call an interrupt handler function to respond. The interrupt
+//! handler to be called must be first registered with the
+//! am_hal_gpio_int_register() function.
+//!
+//! In the event that multiple GPIO interrupts are active, the corresponding
+//! interrupt handlers will be called in numerical order by GPIO number
+//! starting with the lowest GPIO number.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_gpio_int_service(uint64_t ui64Status)
+{
+    uint32_t ui32Status;
+    uint32_t ui32Clz;
+
+    am_hal_gpio_handler_t pfnHandler;
+
+    //
+    // Handle any active interrupts in the lower 32 bits
+    //
+    ui32Status = (uint32_t) ui64Status;
+    while ( ui32Status )
+    {
+        //
+        // Pick one of any remaining active interrupt bits
+        //
+#ifdef __IAR_SYSTEMS_ICC__
+        ui32Clz = __CLZ(ui32Status);
+#else
+        ui32Clz = __builtin_clz(ui32Status);
+#endif
+
+        //
+        // Turn off the bit we picked in the working copy
+        //
+        ui32Status &= ~(0x80000000 >> ui32Clz);
+
+        //
+        // Check the bit handler table to see if there is an interrupt handler
+        // registered for this particular bit.
+        //
+        pfnHandler = am_hal_gpio_ppfnHandlers[31 - ui32Clz];
+        if ( pfnHandler )
+        {
+            //
+            // If we found an interrupt handler routine, call it now.
+            //
+            pfnHandler();
+        }
+    }
+
+    //
+    // Handle any active interrupts in the upper 32 bits
+    //
+    ui32Status = (uint32_t) (ui64Status >> 32);
+    while ( ui32Status )
+    {
+        //
+        // Pick one of any remaining active interrupt bits
+        //
+#ifdef __IAR_SYSTEMS_ICC__
+        ui32Clz = __CLZ(ui32Status);
+#else
+        ui32Clz = __builtin_clz(ui32Status);
+#endif
+
+        //
+        // Turn off the bit we picked in the working copy
+        //
+        ui32Status &= ~(0x80000000 >> ui32Clz);
+
+        //
+        // Check the bit handler table to see if there is an interrupt handler
+        // registered for this particular bit.
+        //
+        pfnHandler = am_hal_gpio_ppfnHandlers[63 - ui32Clz];
+        if ( pfnHandler )
+        {
+            //
+            // If we found an interrupt handler routine, call it now.
+            //
+            pfnHandler();
+        }
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Register an interrupt handler for an individual GPIO pin.
+//!
+//! @param ui32GPIONumber - GPIO number to assign this interrupt handler to.
+//! @param pfnHandler - Function to call when this GPIO interrupt is received.
+//!
+//! This function allows the caller to specify a function that should be called
+//! any time a GPIO interrupt is received on a particular pin. Registering an
+//! interrupt handler using this function adds the function pointer to an array
+//! in SRAM. This interrupt handler will be called by am_hal_gpio_int_service()
+//! whenever the ui64Status parameter indicates that the corresponding pin is
+//! asserting it's interrupt.
+//!
+//! To remove an interrupt handler that has already been registered, the
+//! pfnHandler parameter may be set to zero.
+//!
+//! @note This function will not have any effect unless the
+//! am_hal_gpio_int_service() function is being used.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_gpio_int_register(uint32_t ui32GPIONumber,
+                         am_hal_gpio_handler_t pfnHandler)
+{
+    //
+    // Check to make sure the GPIO number is valid. (Debug builds only)
+    //
+    am_hal_debug_assert_msg(ui32GPIONumber < 64, "GPIO number out of range.");
+
+    am_hal_gpio_ppfnHandlers[ui32GPIONumber] = pfnHandler;
+}
+
+//*****************************************************************************
+//
+//! @brief Get the state of one GPIO polarity bit.
+//!
+//! @param ui32BitNum - GPIO number.
+//!
+//! This function gets the state of one GPIO polarity bit.
+//!
+//! @note When the bit is a one the interrupt polarity is rising edge.
+//!
+//! @return the current polarity.
+//
+//*****************************************************************************
+bool
+am_hal_gpio_int_polarity_bit_get(uint32_t ui32BitNum)
+{
+    //
+    // Check the GPIO_CFGx register's interrupt polarity bit corresponding to
+    // this pin number.
+    //
+    return (AM_REGVAL(AM_HAL_GPIO_CFG(ui32BitNum)) &
+            AM_HAL_GPIO_POL_M(ui32BitNum));
+}
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_gpio.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_gpio.h
new file mode 100644
index 000000000..5f633cd9f
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_gpio.h
@@ -0,0 +1,684 @@
+//*****************************************************************************
+//
+//! @file am_hal_gpio.h
+//!
+//! @brief Functions for accessing and configuring the GPIO module.
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup gpio GPIO
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#ifndef AM_HAL_GPIO_H
+#define AM_HAL_GPIO_H
+
+// DEVICE ADDRESS IS 8-bits
+#define AM_HAL_GPIO_DEV_ADDR_8      (0)
+
+// DEVICE ADDRESS IS 16-bits
+#define AM_HAL_GPIO_DEV_ADDR_16     (1)
+
+// DEVICE OFFSET IS 8-bits
+#define AM_HAL_GPIO_DEV_OFFSET_8    (0x00000000)
+
+// DEVICE OFFSET IS 16-bits
+#define AM_HAL_GPIO_DEV_OFFSET_16   (0x00010000)
+
+// Maximum number of GPIOs on this device
+#define AM_HAL_GPIO_MAX_PADS        (50)
+
+//*****************************************************************************
+//
+//! @name GPIO Pin defines
+//! @brief GPIO Pin defines for use with interrupt functions
+//!
+//! These macros may be used to with \e am_hal_gpio_int_x().
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_GPIO_BIT(n)          (((uint64_t) 0x1) << n)
+//! @}
+
+//
+// Helper macros used for unraveling the GPIO configuration value (configval).
+//
+// Note that the configval, which is passed into functions such as
+//  am_hal_gpio_pin_config() as well as various helper macros, is a concatenated
+//  value that contains values used in multiple configuration registers.
+//
+// The GPIO configuration value fields are arranged as follows:
+// [ 7: 0] PADREG configuration.
+// [11: 8] GPIOCFG
+// [15:12] Unused.
+// [23:16] ALTPADREG configuration.
+//
+// Define macros describing these configval fields.
+//
+#define CFGVAL_PADREG_S             0
+#define CFGVAL_PADREG_M             (0xFF << CFGVAL_PADREG_S)
+#define CFGVAL_GPIOCFG_S            8
+#define CFGVAL_GPIOCFG_M            (0x0F << CFGVAL_GPIOCFG_S)
+#define CFGVAL_ALTPAD_S             16
+#define CFGVAL_ALTPAD_M             (0xFF << CFGVAL_ALTPAD_S)
+
+//
+// Extraction macros
+//
+#define CFGVAL_PADREG_X(x)          (((uint32_t)(x) & CFGVAL_PADREG_M)  >>  \
+                                     CFGVAL_PADREG_S)
+#define CFGVAL_GPIOCFG_X(x)         (((uint32_t)(x) & CFGVAL_GPIOCFG_M) >>  \
+                                     CFGVAL_GPIOCFG_S)
+#define CFGVAL_ALTPAD_X(x)          (((uint32_t)(x) & CFGVAL_ALTPAD_M)  >>  \
+                                     CFGVAL_ALTPAD_S)
+
+//*****************************************************************************
+//
+// Input options.
+//
+//*****************************************************************************
+#define AM_HAL_GPIO_INPEN           (0x02 << CFGVAL_PADREG_S)   // Enable input transistors.
+#define AM_HAL_GPIO_INCFG_RDZERO    (0x01 << CFGVAL_GPIOCFG_S)  // Disable input read registers.
+
+//*****************************************************************************
+//
+// Output options
+//
+//*****************************************************************************
+#define AM_HAL_GPIO_OUT_DISABLE     ((0x0 << 1) << CFGVAL_GPIOCFG_S)
+#define AM_HAL_GPIO_OUT_PUSHPULL    ((0x1 << 1) << CFGVAL_GPIOCFG_S)
+#define AM_HAL_GPIO_OUT_OPENDRAIN   ((0x2 << 1) << CFGVAL_GPIOCFG_S)
+#define AM_HAL_GPIO_OUT_3STATE      ((0x3 << 1) << CFGVAL_GPIOCFG_S)
+
+//*****************************************************************************
+//
+// Pad configuration options.
+// (Configuration value bits 7:0.)
+//
+//*****************************************************************************
+#define AM_HAL_GPIO_HIGH_DRIVE      (0x04 << CFGVAL_PADREG_S)
+#define AM_HAL_GPIO_LOW_DRIVE       (0x00 << CFGVAL_PADREG_S)
+#define AM_HAL_GPIO_PULLUP          (0x01 << CFGVAL_PADREG_S)
+#define AM_HAL_GPIO_PULL1_5K        ( (0x01 << CFGVAL_PADREG_S) |   \
+                                      AM_HAL_GPIO_PULLUP )
+#define AM_HAL_GPIO_PULL6K          ( (0x40 << CFGVAL_PADREG_S) |   \
+                                      AM_HAL_GPIO_PULLUP )
+#define AM_HAL_GPIO_PULL12K         ( (0x80 << CFGVAL_PADREG_S) |   \
+                                      AM_HAL_GPIO_PULLUP )
+#define AM_HAL_GPIO_PULL24K         ( (0xC0 << CFGVAL_PADREG_S) |   \
+                                      AM_HAL_GPIO_PULLUP )
+
+// POWER SWITCH is available on selected pins
+#define AM_HAL_GPIO_POWER           (0x80 << CFGVAL_PADREG_S)
+
+//*****************************************************************************
+//
+//! ALTPADREG configuration options.
+//! (Configuration value bits 23:16.)
+//!
+//! All Apollo2 GPIO pins can be configured for 2mA or 4mA.
+//!     AM_HAL_GPIO_DRIVE_2MA  =  2mA configuration.
+//!     AM_HAL_GPIO_DRIVE_4MA  =  4mA configuration.
+//!
+//! Certain Apollo2 GPIO pins can be configured to drive up to 12mA.
+//!     AM_HAL_GPIO_DRIVE_8MA  =  8mA configuration.
+//!     AM_HAL_GPIO_DRIVE_12MA = 12mA configuration.
+//!
+//! Notes:
+//! - Always consult the Apollo2 data sheet for the latest details.
+//! - The higher drive GPIOxx pads generally include:
+//!   0-2,5,7-8,10,12-13,22-23,26-29,38-39,42,44-48.
+//! - GPIOxx pads that do not support the higher drive:
+//!   3-4,6,9,11,14-21,24-25,30-37,40-41,43,49.
+//! - User is responsible for ensuring that the selected pin actually supports
+//!   the higher drive (8mA or 12mA) capabilities. See the Apollo2 data sheet.
+//! - Attempting to set the higher drive (8mA or 12mA) configuration on a
+//!   non-supporting pad will actually set the pad for 4mA drive strength,
+//!   regardless of the lower bit setting.
+//
+//*****************************************************************************
+#define AM_HAL_GPIO_DRIVE_2MA       ( 0 )
+#define AM_HAL_GPIO_DRIVE_4MA       AM_HAL_GPIO_HIGH_DRIVE
+#define AM_HAL_GPIO_DRIVE_8MA       ( 0x01 << CFGVAL_ALTPAD_S )
+#define AM_HAL_GPIO_DRIVE_12MA      ( (0x01 << CFGVAL_ALTPAD_S)  |  \
+                                      AM_HAL_GPIO_HIGH_DRIVE )
+
+#define AM_HAL_GPIO_SLEWRATE        ( 0x10 << CFGVAL_ALTPAD_S )
+
+//*****************************************************************************
+//
+// Interrupt polarity
+// These values can be used directly in the configval.
+//
+//*****************************************************************************
+#define AM_HAL_GPIOCFGVAL_FALLING   ((1 << 2) << CFGVAL_GPIOCFG_S)
+#define AM_HAL_GPIOCFGVAL_RISING    ((0 << 2) << CFGVAL_GPIOCFG_S)
+
+//*****************************************************************************
+//
+// Pad function select
+// This macro represents the 3 bit function select field in the PADREG byte.
+//
+//*****************************************************************************
+#define AM_HAL_GPIO_FUNC(x)         ((x & 0x7) << 3)
+
+//*****************************************************************************
+//
+//! Interrupt polarity
+//!
+//! Important:
+//!  These values are to be used with am_hal_gpio_int_polarity_bit_set().
+//   They are not intended to be used as part of the GPIO configval.
+//
+//*****************************************************************************
+#define AM_HAL_GPIO_FALLING         0x00000001
+#define AM_HAL_GPIO_RISING          0x00000000
+
+//*****************************************************************************
+//
+// A few common pin configurations.
+//
+//*****************************************************************************
+#define AM_HAL_GPIO_DISABLE                                                   \
+    (AM_HAL_GPIO_FUNC(3))
+
+#define AM_HAL_GPIO_INPUT                                                     \
+    (AM_HAL_GPIO_FUNC(3) | AM_HAL_GPIO_INPEN)
+
+#define AM_HAL_GPIO_OUTPUT                                                    \
+    (AM_HAL_GPIO_FUNC(3) | AM_HAL_GPIO_OUT_PUSHPULL)
+
+#define AM_HAL_GPIO_OPENDRAIN                                                 \
+    (AM_HAL_GPIO_FUNC(3) | AM_HAL_GPIO_OUT_OPENDRAIN | AM_HAL_GPIO_INPEN)
+
+#define AM_HAL_GPIO_3STATE                                                    \
+    (AM_HAL_GPIO_FUNC(3) | AM_HAL_GPIO_OUT_3STATE)
+
+//*****************************************************************************
+//
+// PADREG helper macros.
+//
+//*****************************************************************************
+#define AM_HAL_GPIO_PADREG(n)                                                 \
+    (AM_REG_GPIOn(0) + AM_REG_GPIO_PADREGA_O + (n & 0xFC))
+
+#define AM_HAL_GPIO_PADREG_S(n)                                               \
+    (((uint32_t)(n) % 4) << 3)
+
+#define AM_HAL_GPIO_PADREG_M(n)                                               \
+    ((uint32_t) 0xFF << AM_HAL_GPIO_PADREG_S(n))
+
+#define AM_HAL_GPIO_PADREG_FIELD(n, configval)                                \
+    (((uint32_t)(configval) & CFGVAL_PADREG_M) << AM_HAL_GPIO_PADREG_S(n))
+
+#define AM_HAL_GPIO_PADREG_W(n, configval)                                    \
+    AM_REGVAL(AM_HAL_GPIO_PADREG(n)) =                                        \
+        (AM_HAL_GPIO_PADREG_FIELD(n, configval) |                             \
+         (AM_REGVAL(AM_HAL_GPIO_PADREG(n)) & ~AM_HAL_GPIO_PADREG_M(n)))
+
+#define AM_HAL_GPIO_PADREG_R(n)                                               \
+    ((AM_REGVAL(AM_HAL_GPIO_PADREG(n)) & AM_HAL_GPIO_PADREG_M(n)) >>          \
+     AM_HAL_GPIO_PADREG_S(n))
+
+
+//*****************************************************************************
+//
+// ALTPADCFG helper macros.
+// The ALTPADCFG bits are located in [23:16] of the configval.
+//
+//*****************************************************************************
+#define AM_HAL_GPIO_ALTPADREG(n)                                              \
+    (AM_REG_GPIOn(0) + AM_REG_GPIO_ALTPADCFGA_O + (n & 0xFC))
+
+#define AM_HAL_GPIO_ALTPADREG_S(n)                                            \
+    (((uint32_t)(n) % 4) << 3)
+
+#define AM_HAL_GPIO_ALTPADREG_M(n)                                            \
+    ((uint32_t) 0xFF << AM_HAL_GPIO_ALTPADREG_S(n))
+
+#define AM_HAL_GPIO_ALTPADREG_FIELD(n, configval)                             \
+        (CFGVAL_ALTPAD_X(configval) << AM_HAL_GPIO_ALTPADREG_S(n))
+
+#define AM_HAL_GPIO_ALTPADREG_W(n, configval)                                 \
+    AM_REGVAL(AM_HAL_GPIO_ALTPADREG(n)) =                                     \
+        (AM_HAL_GPIO_ALTPADREG_FIELD(n, configval) |                          \
+         (AM_REGVAL(AM_HAL_GPIO_ALTPADREG(n)) & ~AM_HAL_GPIO_ALTPADREG_M(n)))
+
+#define AM_HAL_GPIO_ALTPADREG_R(n)                                            \
+    ((AM_REGVAL(AM_HAL_GPIO_ALTPADREG(n)) & AM_HAL_GPIO_ALTPADREG_M(n)) >>    \
+     AM_HAL_GPIO_ALTPADREG_S(n))
+
+//*****************************************************************************
+//
+// CFG helper macros.
+//
+//*****************************************************************************
+#define AM_HAL_GPIO_CFG(n)                                                    \
+    (AM_REG_GPIOn(0) + AM_REG_GPIO_CFGA_O + ((n & 0xF8) >> 1))
+
+#define AM_HAL_GPIO_CFG_S(n)                                                  \
+    (((uint32_t)(n) % 8) << 2)
+
+#define AM_HAL_GPIO_CFG_M(n)                                                  \
+    ((uint32_t) 0x7 << AM_HAL_GPIO_CFG_S(n))
+
+#define AM_HAL_GPIO_CFG_FIELD(n, configval)                                   \
+    ((((uint32_t)(configval) & 0x700) >> 8) << AM_HAL_GPIO_CFG_S(n))
+
+#define AM_HAL_GPIO_CFG_W(n, configval)                                       \
+    AM_REGVAL(AM_HAL_GPIO_CFG(n)) =                                           \
+        (AM_HAL_GPIO_CFG_FIELD(n, configval) |                                \
+         (AM_REGVAL(AM_HAL_GPIO_CFG(n)) & ~AM_HAL_GPIO_CFG_M(n)))
+
+#define AM_HAL_GPIO_CFG_R(n)                                                  \
+    ((AM_REGVAL(AM_HAL_GPIO_CFG(n)) & AM_HAL_GPIO_CFG_M(n)) >>                \
+     AM_HAL_GPIO_CFG_S(n))
+
+//*****************************************************************************
+//
+// Polarity helper macros.
+//
+//*****************************************************************************
+#define AM_HAL_GPIO_POL_S(n)                                                  \
+    ((((uint32_t)(n) % 8) << 2) + 3)
+
+#define AM_HAL_GPIO_POL_M(n)                                                  \
+    ((uint32_t) 0x1 << AM_HAL_GPIO_POL_S(n))
+
+#define AM_HAL_GPIO_POL_FIELD(n, polarity)                                    \
+    (((uint32_t)(polarity) & 0x1) << AM_HAL_GPIO_POL_S(n))
+
+#define AM_HAL_GPIO_POL_W(n, polarity)                                        \
+    AM_REGVAL(AM_HAL_GPIO_CFG(n)) =                                           \
+        (AM_HAL_GPIO_POL_FIELD(n, polarity) |                                 \
+         (AM_REGVAL(AM_HAL_GPIO_CFG(n)) & ~AM_HAL_GPIO_POL_M(n)))
+
+//*****************************************************************************
+//
+// RD helper macros.
+//
+//*****************************************************************************
+#define AM_HAL_GPIO_RD_REG(n)                                                 \
+    (AM_REG_GPIOn(0) + AM_REG_GPIO_RDA_O + (((uint32_t)(n) & 0x20) >> 3))
+
+#define AM_HAL_GPIO_RD_S(n)                                                   \
+    ((uint32_t)(n) % 32)
+
+#define AM_HAL_GPIO_RD_M(n)                                                   \
+    ((uint32_t) 0x1 << AM_HAL_GPIO_RD_S(n))
+
+#define AM_HAL_GPIO_RD(n)                                                     \
+    AM_REGVAL(AM_HAL_GPIO_RD_REG(n))
+
+//*****************************************************************************
+//
+// WT helper macros.
+//
+//*****************************************************************************
+#define AM_HAL_GPIO_WT_REG(n)                                                 \
+    (AM_REG_GPIOn(0) + AM_REG_GPIO_WTA_O + (((uint32_t)(n) & 0x20) >> 3))
+
+#define AM_HAL_GPIO_WT_S(n)                                                   \
+    ((uint32_t)(n) % 32)
+
+#define AM_HAL_GPIO_WT_M(n)                                                   \
+    ((uint32_t) 0x1 << AM_HAL_GPIO_WT_S(n))
+
+#define AM_HAL_GPIO_WT(n)                                                     \
+    AM_REGVAL(AM_HAL_GPIO_WT_REG(n))
+
+//*****************************************************************************
+//
+// WTS helper macros.
+//
+//*****************************************************************************
+#define AM_HAL_GPIO_WTS_REG(n)                                                \
+    (AM_REG_GPIOn(0) + AM_REG_GPIO_WTSA_O + (((uint32_t)(n) & 0x20) >> 3))
+
+#define AM_HAL_GPIO_WTS_S(n)                                                  \
+    ((uint32_t)(n) % 32)
+
+#define AM_HAL_GPIO_WTS_M(n)                                                  \
+    ((uint32_t) 0x1 << AM_HAL_GPIO_WTS_S(n))
+
+#define AM_HAL_GPIO_WTS(n)                                                    \
+    AM_REGVAL(AM_HAL_GPIO_WTS_REG(n))
+
+//*****************************************************************************
+//
+// WTC helper macros.
+//
+//*****************************************************************************
+#define AM_HAL_GPIO_WTC_REG(n)                                                \
+    (AM_REG_GPIOn(0) + AM_REG_GPIO_WTCA_O + (((uint32_t)(n) & 0x20) >> 3))
+
+#define AM_HAL_GPIO_WTC_S(n)                                                  \
+    ((uint32_t)(n) % 32)
+
+#define AM_HAL_GPIO_WTC_M(n)                                                  \
+    ((uint32_t) 0x1 << AM_HAL_GPIO_WTC_S(n))
+
+#define AM_HAL_GPIO_WTC(n)                                                    \
+    AM_REGVAL(AM_HAL_GPIO_WTC_REG(n))
+
+//*****************************************************************************
+//
+// EN helper macros.
+//
+//*****************************************************************************
+#define AM_HAL_GPIO_EN_REG(n)                                                 \
+    (AM_REG_GPIOn(0) + AM_REG_GPIO_ENA_O + (((uint32_t)(n) & 0x20) >> 3))
+
+#define AM_HAL_GPIO_EN_S(n)                                                   \
+    ((uint32_t)(n) % 32)
+
+#define AM_HAL_GPIO_EN_M(n)                                                   \
+    ((uint32_t) 0x1 << AM_HAL_GPIO_EN_S(n))
+
+#define AM_HAL_GPIO_EN(n)                                                     \
+    AM_REGVAL(AM_HAL_GPIO_EN_REG(n))
+
+//*****************************************************************************
+//
+// ENS helper macros.
+//
+//*****************************************************************************
+#define AM_HAL_GPIO_ENS_REG(n)                                                \
+    (AM_REG_GPIOn(0) + AM_REG_GPIO_ENSA_O + (((uint32_t)(n) & 0x20) >> 3))
+
+#define AM_HAL_GPIO_ENS_S(n)                                                  \
+    ((uint32_t)(n) % 32)
+
+#define AM_HAL_GPIO_ENS_M(n)                                                  \
+    ((uint32_t) 0x1 << AM_HAL_GPIO_ENS_S(n))
+
+#define AM_HAL_GPIO_ENS(n)                                                    \
+    AM_REGVAL(AM_HAL_GPIO_ENS_REG(n))
+
+//*****************************************************************************
+//
+// ENC helper macros.
+//
+//*****************************************************************************
+#define AM_HAL_GPIO_ENC_REG(n)                                                \
+    (AM_REG_GPIOn(0) + AM_REG_GPIO_ENCA_O + (((uint32_t)(n) & 0x20) >> 3))
+
+#define AM_HAL_GPIO_ENC_S(n)                                                  \
+    ((uint32_t)(n) % 32)
+
+#define AM_HAL_GPIO_ENC_M(n)                                                  \
+    ((uint32_t) 0x1 << AM_HAL_GPIO_ENC_S(n))
+
+#define AM_HAL_GPIO_ENC(n)                                                    \
+    AM_REGVAL(AM_HAL_GPIO_ENC_REG(n))
+
+//*****************************************************************************
+//
+//! @brief Configure the GPIO PAD MUX & GPIO PIN Configurations
+//!
+//! @param ui32PinNumber - GPIO pin number.
+//! @param ui32Config - Configuration options.
+//!
+//! This function applies the settings for a single GPIO. For a list of valid
+//! options please see the top of this file (am_hal_gpio.h) and am_hal_pin.h.
+//!
+//! Usage examples:
+//! am_hal_gpio_pin_config(11, AM_HAL_GPIO_INPUT);
+//! am_hal_gpio_pin_config(10, AM_HAL_GPIO_OUTPUT);
+//! am_hal_gpio_pin_config(14, AM_HAL_GPIO_OUTPUT | AM_HAL_GPIO_SLEWRATE);
+//! am_hal_gpio_pin_config(15, AM_HAL_GPIO_OUTPUT | AM_HAL_GPIO_HIGHDRIVESTR);
+//
+//*****************************************************************************
+#define am_hal_gpio_pin_config(ui32PinNumber, ui32Config)                     \
+    if ( (uint32_t)(ui32PinNumber) < AM_HAL_GPIO_MAX_PADS )                   \
+    {                                                                         \
+        AM_CRITICAL_BEGIN_ASM                                                 \
+                                                                              \
+        AM_REGn(GPIO, 0, PADKEY) = AM_REG_GPIO_PADKEY_KEYVAL;                 \
+                                                                              \
+        AM_HAL_GPIO_CFG_W(ui32PinNumber, ui32Config);                         \
+        AM_HAL_GPIO_PADREG_W(ui32PinNumber, ui32Config);                      \
+        AM_HAL_GPIO_ALTPADREG_W(ui32PinNumber, ui32Config);                   \
+                                                                              \
+        AM_REGn(GPIO, 0, PADKEY) = 0;                                         \
+                                                                              \
+        AM_CRITICAL_END_ASM                                                   \
+    }
+
+//*****************************************************************************
+//
+//! @brief Set the state of one GPIO polarity bit.
+//!
+//! @param ui32BitNum - GPIO number.
+//! @param ui32Polarity - Desired state.
+//!
+//! This function sets the state of one GPIO polarity bit to a supplied value.
+//! The ui32Polarity parameter should be one of the following values:
+//!
+//!     AM_HAL_GPIO_FALLING
+//!     AM_HAL_GPIO_RISING
+//!
+//! @return None.
+//
+//*****************************************************************************
+#define am_hal_gpio_int_polarity_bit_set(ui32PinNumber, ui32Polarity)         \
+    if ( (uint32_t)(ui32PinNumber) < AM_HAL_GPIO_MAX_PADS )                   \
+    {                                                                         \
+        AM_CRITICAL_BEGIN_ASM                                                 \
+                                                                              \
+        AM_REGn(GPIO, 0, PADKEY) = AM_REG_GPIO_PADKEY_KEYVAL;                 \
+        AM_HAL_GPIO_POL_W(ui32PinNumber, ui32Polarity);                       \
+        AM_REGn(GPIO, 0, PADKEY) = 0;                                         \
+                                                                              \
+        AM_CRITICAL_END_ASM                                                   \
+    }
+
+//*****************************************************************************
+//
+//! @brief Get the state of one GPIO from the INPUT READ REGISTER.
+//!
+//! @param ui32BitNum - GPIO number.
+//!
+//! This function retrieves the state of one GPIO from the INPUT READ
+//! REGISTER.
+//!
+//! @return the state for the requested GPIO.
+//
+//*****************************************************************************
+#define am_hal_gpio_input_bit_read(ui32BitNum)                                \
+    ((AM_HAL_GPIO_RD(ui32BitNum) & AM_HAL_GPIO_RD_M(ui32BitNum)) != 0)
+
+//*****************************************************************************
+//
+//! @brief Get the state of one GPIO in the DATA OUTPUT REGISTER
+//!
+//! @param ui32BitNum - GPIO number.
+//!
+//! This function retrieves the state of one GPIO in the DATA OUTPUT REGISTER.
+//!
+//! @return the state for the requested GPIO or -1 for error.
+//
+//*****************************************************************************
+#define am_hal_gpio_out_bit_read(ui32BitNum)                                  \
+    ((AM_HAL_GPIO_WT(ui32BitNum) & AM_HAL_GPIO_WT_M(ui32BitNum)) != 0)
+
+//*****************************************************************************
+//
+//! @brief Set the output state high for one GPIO.
+//!
+//! @param ui32BitNum - GPIO number.
+//!
+//! This function sets the output state to high for one GPIO.
+//!
+//! @return None.
+//
+//*****************************************************************************
+#define am_hal_gpio_out_bit_set(ui32BitNum)                                   \
+    AM_HAL_GPIO_WTS(ui32BitNum) = AM_HAL_GPIO_WTS_M(ui32BitNum)
+
+//*****************************************************************************
+//
+//! @brief Sets the output state to low for one GPIO.
+//!
+//! @param ui32BitNum - GPIO number.
+//!
+//! This function sets the output state to low for one GPIO.
+//!
+//! @return None.
+//
+//*****************************************************************************
+#define am_hal_gpio_out_bit_clear(ui32BitNum)                                 \
+    AM_HAL_GPIO_WTC(ui32BitNum) = AM_HAL_GPIO_WTC_M(ui32BitNum)
+
+//*****************************************************************************
+//
+//! @brief Sets the output state to ui32Value for one GPIO.
+//!
+//! @param ui32BitNum - GPIO number.
+//! @param ui32Value - Desired output state.
+//!
+//! This function sets the output state to ui32Value for one GPIO.
+//!
+//! @return None.
+//
+//*****************************************************************************
+#define am_hal_gpio_out_bit_replace(ui32BitNum, ui32Value)                    \
+    if ( ui32Value )                                                          \
+    {                                                                         \
+        AM_HAL_GPIO_WTS(ui32BitNum) = AM_HAL_GPIO_WTS_M(ui32BitNum);          \
+    }                                                                         \
+    else                                                                      \
+    {                                                                         \
+        AM_HAL_GPIO_WTC(ui32BitNum) = AM_HAL_GPIO_WTC_M(ui32BitNum);          \
+    }
+
+//*****************************************************************************
+//
+//! @brief Toggle the output state of one GPIO.
+//!
+//! @param ui32BitNum - GPIO number.
+//!
+//! This function toggles the output state of one GPIO.
+//!
+//! @return None.
+//
+//*****************************************************************************
+#define am_hal_gpio_out_bit_toggle(ui32BitNum)                                \
+    if ( 1 )                                                                  \
+    {                                                                         \
+        AM_CRITICAL_BEGIN_ASM                                                 \
+        AM_HAL_GPIO_WT(ui32BitNum) ^= AM_HAL_GPIO_WT_M(ui32BitNum);           \
+        AM_CRITICAL_END_ASM                                                   \
+    }
+
+//*****************************************************************************
+//
+//! @brief Sets the output enable for one GPIO.
+//!
+//! @param ui32BitNum - GPIO number.
+//!
+//! This function sets the output enable for one GPIO.
+//!
+//! @return None.
+//
+//*****************************************************************************
+#define am_hal_gpio_out_enable_bit_set(ui32BitNum)                            \
+    AM_HAL_GPIO_ENS(ui32BitNum) = AM_HAL_GPIO_ENS_M(ui32BitNum)
+
+//*****************************************************************************
+//
+//! @brief Clears the output enable for one GPIO.
+//!
+//! @param ui32BitNum - GPIO number.
+//!
+//! This function clears the output enable for one GPIO.
+//!
+//! @return None.
+//
+//*****************************************************************************
+#define am_hal_gpio_out_enable_bit_clear(ui32BitNum)                          \
+    AM_HAL_GPIO_ENC(ui32BitNum) = AM_HAL_GPIO_ENC_M(ui32BitNum)
+
+//*****************************************************************************
+//
+// Function pointer type for GPIO interrupt handlers.
+//
+//*****************************************************************************
+typedef void (*am_hal_gpio_handler_t)(void);
+
+//*****************************************************************************
+//
+// External function prototypes
+//
+//*****************************************************************************
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+extern uint32_t am_hal_gpio_pin_config_read(uint32_t ui32PinNumber);
+extern uint64_t am_hal_gpio_input_read(void);
+extern uint64_t am_hal_gpio_out_read(void);
+extern uint32_t am_hal_gpio_out_enable_bit_get(uint32_t ui32BitNum);
+extern uint64_t am_hal_gpio_out_enable_get(void);
+extern void am_hal_gpio_int_enable(uint64_t ui64InterruptMask);
+extern uint64_t am_hal_gpio_int_enable_get(void);
+extern void am_hal_gpio_int_disable(uint64_t ui64InterruptMask);
+extern void am_hal_gpio_int_clear(uint64_t ui64InterruptMask);
+extern void am_hal_gpio_int_set(uint64_t ui64InterruptMask);
+extern uint64_t am_hal_gpio_int_status_get(bool bEnabledOnly);
+extern void am_hal_gpio_int_service(uint64_t ui64Status);
+extern void am_hal_gpio_int_register(uint32_t ui32GPIONumber,
+                                     am_hal_gpio_handler_t pfnHandler);
+
+extern bool am_hal_gpio_int_polarity_bit_get(uint32_t ui32BitNum);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  // AM_HAL_GPIO_H
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_i2c_bit_bang.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_i2c_bit_bang.c
new file mode 100644
index 000000000..f34ac9238
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_i2c_bit_bang.c
@@ -0,0 +1,756 @@
+//*****************************************************************************
+//
+//! @file am_hal_i2c_bit_bang.c
+//!
+//! @brief I2C bit bang module.
+//!
+//! These functions implement the I2C bit bang utility
+//! It implements an I2C interface at close to 400 kHz
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "am_mcu_apollo.h"
+#include "am_util.h"
+#include "am_hal_i2c_bit_bang.h"
+
+// Max number of clock cycles to wait for clock stretch
+#define I2C_BB_MAX_CLOCK_STRETCH_WAIT               100
+
+#define I2C_BB_DESIRED_FREQ_HZ                      400000
+
+#define I2C_BB_CYCLES_PER_DELAY_COUNT               3
+#define I2C_BB_ONE_BIT_TIME_IN_CYCLES               (AM_HAL_CLKGEN_FREQ_MAX_HZ/I2C_BB_DESIRED_FREQ_HZ)
+#define I2C_BB_ONE_BIT_TIME_IN_DELAY_COUNT          (I2C_BB_ONE_BIT_TIME_IN_CYCLES/I2C_BB_CYCLES_PER_DELAY_COUNT)
+
+// Number of loops (each worth 3 cycles) needed to delay for defined time
+// This is imprecise, as there is a setup time as well which is not accounted
+// for
+// One Bit time = 120 Cycles (400 kHz @ 48 MHz)
+#define HALF_BIT_TIME    (I2C_BB_ONE_BIT_TIME_IN_DELAY_COUNT/2)
+#define QUARTER_BIT_TIME (I2C_BB_ONE_BIT_TIME_IN_DELAY_COUNT/4)
+#define ASM_DELAY        am_hal_flash_delay
+
+// Empirically determined adjustments to account for the fact that there is a
+// variable time spent in actual processing as well, and hence we need not delay
+// for the full time. This processing time is variable based on exact processing
+// needed at various times, and will also vary based on compiler type and
+// optimization levels
+#define I2C_BB_TIMER_ADJUST     6 // Can not be more than QUARTER_BIT_TIME - 1
+#define I2C_BB_TIMER_HI_ADJUST  15 // Can not be more than HALF_BIT_TIME - 1
+#define I2C_BB_TIMER_LO_ADJUST  13 // Can not be more than HALF_BIT_TIME - 1
+
+// Wait till it is time to end the SCL Hi Period
+#define WAIT_I2C_CLOCK_HI_PERIOD()     ASM_DELAY(HALF_BIT_TIME - I2C_BB_TIMER_HI_ADJUST)
+// Wait till it is time to end the SCL Lo Period
+#define WAIT_I2C_CLOCK_LOW_PERIOD()    ASM_DELAY(HALF_BIT_TIME - I2C_BB_TIMER_LO_ADJUST)
+// Delay for Quarter Clock
+#define WAIT_FOR_QUARTER_I2C_CLOCK()   ASM_DELAY(QUARTER_BIT_TIME - I2C_BB_TIMER_ADJUST)
+#define WRITE_SCL_LO()    \
+    do { \
+        AM_REGVAL(am_hal_i2c_bit_bang_priv.sck_reg_clr_addr) = (am_hal_i2c_bit_bang_priv.sck_reg_val); \
+    } while(0)
+
+#define PULL_SCL_HI()    \
+    do { \
+        AM_REGVAL(am_hal_i2c_bit_bang_priv.sck_reg_set_addr) = (am_hal_i2c_bit_bang_priv.sck_reg_val); \
+    } while(0)
+
+#define GET_SCL()   (AM_REGVAL(am_hal_i2c_bit_bang_priv.sck_reg_read_addr) & (am_hal_i2c_bit_bang_priv.sck_reg_val))
+#define GET_SDA()   (AM_REGVAL(am_hal_i2c_bit_bang_priv.sda_reg_read_addr) & (am_hal_i2c_bit_bang_priv.sda_reg_val))
+
+#define WRITE_SDA_LO()    \
+    do { \
+        AM_REGVAL(am_hal_i2c_bit_bang_priv.sda_reg_clr_addr) = (am_hal_i2c_bit_bang_priv.sda_reg_val); \
+    } while(0)
+
+#define PULL_SDA_HI()    \
+    do { \
+        AM_REGVAL(am_hal_i2c_bit_bang_priv.sda_reg_set_addr) = (am_hal_i2c_bit_bang_priv.sda_reg_val); \
+    } while(0)
+
+
+//*****************************************************************************
+//
+// I2C Bit Bang Private Data Structure
+//
+//*****************************************************************************
+typedef struct am_util_bit_bang_priv
+{
+    bool  start_flag;
+    uint32_t sck_gpio_number;
+    uint32_t sda_gpio_number;
+    uint32_t sck_reg_set_addr;
+    uint32_t sck_reg_clr_addr;
+    uint32_t sck_reg_read_addr;
+    uint32_t sck_reg_val;
+    uint32_t sda_reg_set_addr;
+    uint32_t sda_reg_clr_addr;
+    uint32_t sda_reg_read_addr;
+    uint32_t sda_reg_val;
+} am_hal_i2c_bit_bang_priv_t;
+static am_hal_i2c_bit_bang_priv_t am_hal_i2c_bit_bang_priv;
+
+//
+// Wait for any stretched clock to go high
+// If it times out - return failure
+//
+static inline bool
+i2c_pull_and_wait_scl_hi(void)
+{
+    // Maximum time to wait for clock stretching
+    uint32_t maxLoop = 4*I2C_BB_MAX_CLOCK_STRETCH_WAIT + 1;
+    // Pull SCL High
+    PULL_SCL_HI();
+    // Poll for SCL to check for clock stretching
+    while (!GET_SCL())
+    {
+        if (--maxLoop == 0)
+        {
+            // timeout!
+            return true;
+        }
+        WAIT_FOR_QUARTER_I2C_CLOCK();
+    }
+    return false;
+}
+
+//*****************************************************************************
+//
+//! @brief Initialize i2c bit bang private data structure
+//!
+//! @param sck_gpio_number is the GPIO # for the I2C SCK clock pin
+//! @param sda_gpio_number is the GPIO # for the I2C SDA data pin
+//!
+//! This function initializes the I2C bit bang utility's internal data struct.
+//!
+//! returns None.
+//
+//*****************************************************************************
+am_hal_i2c_bit_bang_enum_t
+am_hal_i2c_bit_bang_init(uint32_t sck_gpio_number,
+                         uint32_t sda_gpio_number)
+{
+    int i;
+    //
+    // remember GPIO pin assignments for I2C bus signals
+    //
+    am_hal_i2c_bit_bang_priv.sck_gpio_number = sck_gpio_number;
+    am_hal_i2c_bit_bang_priv.sda_gpio_number = sda_gpio_number;
+
+    am_hal_i2c_bit_bang_priv.sck_reg_set_addr = AM_HAL_GPIO_WTS_REG(sck_gpio_number);
+    am_hal_i2c_bit_bang_priv.sck_reg_clr_addr = AM_HAL_GPIO_WTC_REG(sck_gpio_number);
+    am_hal_i2c_bit_bang_priv.sck_reg_read_addr = AM_HAL_GPIO_RD_REG(sck_gpio_number);
+    am_hal_i2c_bit_bang_priv.sck_reg_val = AM_HAL_GPIO_WTC_M(sck_gpio_number);
+    am_hal_i2c_bit_bang_priv.sda_reg_set_addr = AM_HAL_GPIO_WTS_REG(sda_gpio_number);
+    am_hal_i2c_bit_bang_priv.sda_reg_clr_addr = AM_HAL_GPIO_WTC_REG(sda_gpio_number);
+    am_hal_i2c_bit_bang_priv.sda_reg_read_addr = AM_HAL_GPIO_RD_REG(sda_gpio_number);
+    am_hal_i2c_bit_bang_priv.sda_reg_val =  AM_HAL_GPIO_WTC_M(sda_gpio_number);
+
+    //
+    // Set SCK GPIO data bit high so we aren't pulling down the clock
+    //
+    am_hal_gpio_out_bit_set(sck_gpio_number);
+    //
+    // Set up SCK GPIO configuration bi-direction, input
+    //
+    am_hal_gpio_pin_config(sck_gpio_number, AM_HAL_PIN_OPENDRAIN);
+
+    //
+    // Set SDA GPIO data bit high so we aren't pulling down the data line
+    //
+    am_hal_gpio_out_bit_set(sda_gpio_number);
+    //
+    // Set up SDA GPIO configuration bi-direction, input
+    //
+    am_hal_gpio_pin_config(sda_gpio_number, AM_HAL_PIN_OPENDRAIN);
+
+    // Now make sure we have control of the clock line
+    //
+    // Wait for any stretched clock to go high. Return if still not high
+    //
+    if (i2c_pull_and_wait_scl_hi())
+    {
+        return AM_HAL_I2C_BIT_BANG_CLOCK_TIMEOUT;
+    }
+    if (!GET_SDA())
+    {
+        // If previous transaction did not finish - SDA may be pulled low for a Read.
+        // If so - need to flush out the data (max 8 bits) & NACK
+        for (i = 0; i < 9; i++)
+        {
+            //
+            // Pull down on clock line
+            //
+            WRITE_SCL_LO();
+            //
+            // Delay for 1/2 bit cell time to start the clock and let peer write on SDA
+            //
+            WAIT_I2C_CLOCK_LOW_PERIOD();
+            if (i2c_pull_and_wait_scl_hi())
+            {
+                return AM_HAL_I2C_BIT_BANG_CLOCK_TIMEOUT;
+            }
+            if (GET_SDA())
+            {
+                // Send START/STOP to clear the bus
+                //
+                // Delay for 1/4 bit cell time
+                //
+                WAIT_FOR_QUARTER_I2C_CLOCK();
+                WRITE_SDA_LO();
+                //
+                // Delay for 1/4 bit cell time
+                //
+                WAIT_FOR_QUARTER_I2C_CLOCK();
+                //
+                // Pull down on clock line
+                //
+                WRITE_SCL_LO();
+                //
+                // Delay for 1/2 bit cell time to start the clock and let peer write on SDA
+                //
+                WAIT_I2C_CLOCK_LOW_PERIOD();
+                //
+                // Release the clock line
+                //
+                PULL_SCL_HI();
+                //
+                // Delay for 1/4 bit cell time
+                //
+                WAIT_FOR_QUARTER_I2C_CLOCK();
+                PULL_SDA_HI();
+                //
+                // Delay for 1/4 bit cell time
+                //
+                WAIT_FOR_QUARTER_I2C_CLOCK();
+                break;
+            }
+        }
+        if (i == 9)
+        {
+            // It is it still stuck after 9 clocks - something is wrong. Need to bail out
+            return AM_HAL_I2C_BIT_BANG_DATA_TIMEOUT;
+        }
+    }
+    return AM_HAL_I2C_BIT_BANG_SUCCESS;
+}
+
+//*****************************************************************************
+//
+//! @brief Receive one data byte from an I2C device
+//!
+//! This function handles sending one byte to a slave device
+//! bNack defines if we should send an ACK or NACK
+//!
+//! returns the byte received
+//
+//*****************************************************************************
+static inline am_hal_i2c_bit_bang_enum_t
+i2c_receive_byte(uint8_t *pRxByte, bool bNack)
+{
+    int i;
+    uint8_t data_byte = 0;
+
+    //
+    // Loop through receiving 8 bits
+    //
+    for (i = 0; i < 8; i++)
+    {
+        //
+        // Pull down on clock line
+        //
+        WRITE_SCL_LO();
+
+        //
+        // release the data line from from the previous ACK
+        //
+        PULL_SDA_HI();
+
+        //
+        // Delay for 1/2 bit cell time to start the clock and let peer write on SDA
+        //
+        WAIT_I2C_CLOCK_LOW_PERIOD();
+
+        if (i2c_pull_and_wait_scl_hi())
+        {
+            return AM_HAL_I2C_BIT_BANG_CLOCK_TIMEOUT;
+        }
+        //
+        // grab the data bit here
+        //
+        if ( GET_SDA() )
+        {
+            //
+            // set the bit in the data byte to be returned
+            //
+            data_byte |=  (0x80 >> i);
+        }
+
+        //
+        // Delay for 1/2 bit cell time while clock is high
+        //
+        WAIT_I2C_CLOCK_HI_PERIOD();
+    }
+
+    *pRxByte = data_byte;
+    //
+    // Pull down on clock line
+    //
+    WRITE_SCL_LO();
+
+    //
+    // pull the data line down so we can ACK/NAK the byte we just received
+    //
+    if (bNack)
+    {
+        //
+        // Pull up on data line with clock low to indicate NAK
+        //
+        PULL_SDA_HI();
+    }
+    else
+    {
+        //
+        // Pull down on data line with clock low to indicate ACK
+        //
+        WRITE_SDA_LO();
+    }
+    //
+    // Delay for 1/2 bit cell time before sending ACK to device
+    //
+    WAIT_I2C_CLOCK_LOW_PERIOD();
+
+    if (i2c_pull_and_wait_scl_hi())
+    {
+        return AM_HAL_I2C_BIT_BANG_CLOCK_TIMEOUT;
+    }
+    //
+    // Delay for 1/2 bit cell time while clock is high to le peer sample the ACK/NAK
+    //
+    WAIT_I2C_CLOCK_HI_PERIOD();
+    //
+    // Give the received data byte back to them
+    //
+    return AM_HAL_I2C_BIT_BANG_SUCCESS;
+}
+
+//*****************************************************************************
+//
+//! @brief Send one data bytes to an I2C device
+//!
+//! @param one_byte the byte to send, could be address could be data
+//!
+//! This function handles sending one byte to a slave device
+//! Starts with 0 clock and runs till full cycle
+//!
+//! returns I2C BB ENUM
+//!     {
+//!     AM_HAL_I2C_BIT_BANG_SUCCESS,
+//!     AM_HAL_I2C_BIT_BANG_ADDRESS_NAKED
+//!     }
+//
+//*****************************************************************************
+static inline am_hal_i2c_bit_bang_enum_t
+i2c_send_byte(uint8_t one_byte)
+{
+    int i;
+    bool data_naked = false;
+
+    //
+    // Loop through sending 8 bits
+    //
+    for (i = 0; i < 8; i++)
+    {
+        //
+        // Pull down on clock line
+        //
+        WRITE_SCL_LO();
+
+        //
+        // output the next data bit
+        //
+        if ( one_byte & (0x80 >> i) )
+        {
+            PULL_SDA_HI();
+        }
+        else
+        {
+            WRITE_SDA_LO();
+        }
+
+        //
+        // Delay for 1/2 bit cell time to start the clock
+        //
+        WAIT_I2C_CLOCK_LOW_PERIOD();
+
+        if (i2c_pull_and_wait_scl_hi())
+        {
+            return AM_HAL_I2C_BIT_BANG_CLOCK_TIMEOUT;
+        }
+        //
+        // Delay for 1/2 bit cell time while clock is high
+        //
+        WAIT_I2C_CLOCK_HI_PERIOD();
+    }
+
+    //
+    // Pull down on clock line
+    //
+    WRITE_SCL_LO();
+
+    //
+    // Delay for 1/2 bit cell time to start the clock
+    //
+    WAIT_I2C_CLOCK_LOW_PERIOD();
+
+    if (i2c_pull_and_wait_scl_hi())
+    {
+        return AM_HAL_I2C_BIT_BANG_CLOCK_TIMEOUT;
+    }
+    //
+    // Grab the state of the ACK bit and return it
+    //
+    data_naked = GET_SDA();
+    //
+    // Delay for 1/2 bit cell time to complete the high period
+    //
+    WAIT_I2C_CLOCK_HI_PERIOD();
+    if ( data_naked )
+    {
+        return AM_HAL_I2C_BIT_BANG_DATA_NAKED;
+    }
+    else
+    {
+        return AM_HAL_I2C_BIT_BANG_SUCCESS;
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Receive a string of data bytes from an I2C device
+//!
+//! @param address (only 8 bit I2C addresses are supported)
+//!        LSB is I2C R/W
+//! @param number_of_bytes to transfer (# payload bytes)
+//! @param pData pointer to data buffer to receive payload
+//!
+//! This function handles receiving a payload from a slave device
+//!
+//! returns ENUM{AM_HAL_I2C_BIT_BANG_SUCCESS,AM_HAL_I2C_BIT_BANG_ADDRESS_NAKED}
+//
+//*****************************************************************************
+am_hal_i2c_bit_bang_enum_t
+am_hal_i2c_bit_bang_receive(uint8_t address, uint32_t number_of_bytes,
+                            uint8_t *pData, uint8_t ui8Offset,
+                            bool bUseOffset, bool bNoStop)
+{
+    uint32_t ui32I;
+    am_hal_i2c_bit_bang_enum_t status = AM_HAL_I2C_BIT_BANG_SUCCESS;
+
+
+    if (i2c_pull_and_wait_scl_hi())
+    {
+        return AM_HAL_I2C_BIT_BANG_CLOCK_TIMEOUT;
+    }
+    //
+    // Pull down on data line with clock high --> START CONDITION
+    //
+    WRITE_SDA_LO();
+
+    //
+    // Delay for 1/2 bit cell time to start the clock
+    //
+    WAIT_I2C_CLOCK_HI_PERIOD();
+
+    //
+    // send the address byte and wait for the ACK/NAK
+    //
+    status = i2c_send_byte(address);
+    if ( status != AM_HAL_I2C_BIT_BANG_SUCCESS )
+    {
+        if ( status == AM_HAL_I2C_BIT_BANG_DATA_NAKED)
+        {
+            return AM_HAL_I2C_BIT_BANG_ADDRESS_NAKED;
+        }
+        return status;
+    }
+
+    if ( bUseOffset )
+    {
+        status = i2c_send_byte(ui8Offset);
+        if ( status != AM_HAL_I2C_BIT_BANG_SUCCESS )
+        {
+            return status;
+        }
+    }
+
+    //
+    // receive the requested number of data bytes
+    //
+    for (ui32I = 0; ui32I < number_of_bytes - 1; ui32I++)
+    {
+        //
+        // receive the data bytes and send ACK for each one
+        //
+        status = i2c_receive_byte(pData, false);
+        if (status != AM_HAL_I2C_BIT_BANG_SUCCESS)
+        {
+            return status;
+        }
+        pData++;
+    }
+    // Send NAK for the last byte
+    status = i2c_receive_byte(pData, true);
+    if (status != AM_HAL_I2C_BIT_BANG_SUCCESS)
+    {
+        return status;
+    }
+
+    //********************
+    // Send stop condition
+    //********************
+    //
+    // Pull down on clock line
+    //
+    WRITE_SCL_LO();
+
+    //
+    // Delay for 1/4 bit cell time
+    //
+    WAIT_FOR_QUARTER_I2C_CLOCK();
+
+
+    if (!bNoStop)
+    {
+        //
+        // Pull down on data line with clock low
+        //
+        WRITE_SDA_LO();
+    }
+    else
+    {
+        //
+        // Release data line with clock low itself, as we are not sending STOP
+        //
+        PULL_SDA_HI();
+    }
+    //
+    //
+    // Delay for 1/4 bit cell time
+    //
+    WAIT_FOR_QUARTER_I2C_CLOCK();
+
+    if (i2c_pull_and_wait_scl_hi())
+    {
+        return AM_HAL_I2C_BIT_BANG_CLOCK_TIMEOUT;
+    }
+    //
+    // Delay for 1/2 bit cell time while clock is high
+    //
+    WAIT_I2C_CLOCK_HI_PERIOD();
+
+    if (!bNoStop)
+    {
+        //
+        // release data line with clock high --> STOP CONDITION
+        //
+        PULL_SDA_HI();
+    }
+
+    //
+    // message successfully received (how could we fail???)
+    //
+    return AM_HAL_I2C_BIT_BANG_SUCCESS;
+}
+
+//*****************************************************************************
+//
+//! @brief Send a string of data bytes to an I2C device
+//!
+//! @param address (only 8 bit I2C addresses are supported)
+//!        LSB is I2C R/W
+//! @param number_of_bytes to transfer (# payload bytes)
+//! @param pData pointer to data buffer containing payload
+//!
+//! This function handles sending a payload to a slave device
+//!
+//! returns ENUM {AM_HAL_I2C_BIT_BANG_SUCCESS, AM_HAL_I2C_BIT_BANG_DATA_NAKED,
+//!               AM_HAL_I2C_BIT_BANG_ADDRESS_NAKED}
+//
+//*****************************************************************************
+am_hal_i2c_bit_bang_enum_t
+am_hal_i2c_bit_bang_send(uint8_t address, uint32_t number_of_bytes,
+                         uint8_t *pData, uint8_t ui8Offset,
+                         bool bUseOffset, bool bNoStop)
+{
+    uint32_t ui32I;
+    am_hal_i2c_bit_bang_enum_t status;
+    bool data_naked = false;
+
+    if (i2c_pull_and_wait_scl_hi())
+    {
+        return AM_HAL_I2C_BIT_BANG_CLOCK_TIMEOUT;
+    }
+    //
+    // Pull down on data line with clock high --> START CONDITION
+    //
+    WRITE_SDA_LO();
+
+    //
+    // Delay for 1/2 bit cell time to start the clock
+    //
+    WAIT_I2C_CLOCK_HI_PERIOD();
+
+    //
+    // send the address byte and wait for the ACK/NAK
+    //
+    status = i2c_send_byte(address);
+    if ( status != AM_HAL_I2C_BIT_BANG_SUCCESS )
+    {
+        if ( status == AM_HAL_I2C_BIT_BANG_DATA_NAKED)
+        {
+            return AM_HAL_I2C_BIT_BANG_ADDRESS_NAKED;
+        }
+        return status;
+    }
+
+    if ( bUseOffset )
+    {
+        status = i2c_send_byte(ui8Offset);
+        if ( status != AM_HAL_I2C_BIT_BANG_SUCCESS )
+        {
+            return status;
+        }
+    }
+
+    //
+    // send the requested number of data bytes
+    //
+    for (ui32I = 0; ui32I < number_of_bytes; ui32I++)
+    {
+        //
+        // send out the data bytes while watching for premature NAK
+        //
+        status =  i2c_send_byte(*pData++);
+        if (status != AM_HAL_I2C_BIT_BANG_SUCCESS)
+        {
+            if (status == AM_HAL_I2C_BIT_BANG_DATA_NAKED)
+            {
+                if (ui32I != (number_of_bytes-1))
+                {
+                    data_naked = true;
+                    // TODO - should we be sending the STOP bit in this case regardless of bNoStop?
+                    break;
+                }
+                else
+                {
+                    status = AM_HAL_I2C_BIT_BANG_SUCCESS;
+                }
+            }
+            else
+            {
+                return status;
+            }
+        }
+    }
+
+    //********************
+    // Send stop condition
+    //********************
+
+    //
+    // Pull down on clock line
+    //
+    WRITE_SCL_LO();
+
+    //
+    // Delay for 1/4 bit cell time
+    //
+    WAIT_FOR_QUARTER_I2C_CLOCK();
+
+
+    if (!bNoStop)
+    {
+        //
+        // Pull down on data line with clock low
+        //
+        WRITE_SDA_LO();
+    }
+    else
+    {
+        //
+        // Release data line with clock low itself, as we are not sending STOP
+        //
+        PULL_SDA_HI();
+    }
+
+    //
+    // Delay for 1/4 bit cell time
+    //
+    WAIT_FOR_QUARTER_I2C_CLOCK();
+
+    if (i2c_pull_and_wait_scl_hi())
+    {
+        return AM_HAL_I2C_BIT_BANG_CLOCK_TIMEOUT;
+    }
+    if (!bNoStop)
+    {
+        //
+        // release data line with clock high --> STOP CONDITION
+        //
+        PULL_SDA_HI();
+    }
+
+    //
+    // Delay for 1/2 bit cell time while clock is high
+    //
+    WAIT_I2C_CLOCK_HI_PERIOD();
+
+    if ( data_naked )
+    {
+        return AM_HAL_I2C_BIT_BANG_DATA_NAKED;  // if it happens early
+    }
+
+    //
+    // message successfully sent
+    //
+    return AM_HAL_I2C_BIT_BANG_SUCCESS;
+}
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_i2c_bit_bang.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_i2c_bit_bang.h
new file mode 100644
index 000000000..16d5e6509
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_i2c_bit_bang.h
@@ -0,0 +1,99 @@
+//*****************************************************************************
+//
+//! @file am_hal_i2c_bit_bang.h
+//!
+//! @brief I2C bit bang module.
+//!
+//! These functions implement the I2C bit bang utility
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_HAL_I2C_BIT_BANG_H
+#define AM_HAL_I2C_BIT_BANG_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+//*****************************************************************************
+//
+// Enumerated return constants
+//
+//*****************************************************************************
+typedef enum
+{
+    AM_HAL_I2C_BIT_BANG_SUCCESS = 0,
+    AM_HAL_I2C_BIT_BANG_ADDRESS_NAKED,
+    AM_HAL_I2C_BIT_BANG_DATA_NAKED,
+    AM_HAL_I2C_BIT_BANG_CLOCK_TIMEOUT,
+    AM_HAL_I2C_BIT_BANG_DATA_TIMEOUT,
+}am_hal_i2c_bit_bang_enum_t;
+
+//*****************************************************************************
+//
+// External function definitions
+//
+//*****************************************************************************
+extern am_hal_i2c_bit_bang_enum_t am_hal_i2c_bit_bang_init(uint32_t sck_gpio_number,
+                                     uint32_t sda_gpio_number);
+
+extern am_hal_i2c_bit_bang_enum_t am_hal_i2c_bit_bang_send(uint8_t address,
+                                                    uint32_t number_of_bytes,
+                                                    uint8_t *pData,
+                                                    uint8_t ui8Offset,
+                                                    bool bUseOffset,
+                                                    bool bNoStop);
+
+extern am_hal_i2c_bit_bang_enum_t am_hal_i2c_bit_bang_receive(uint8_t address,
+                                                    uint32_t number_of_bytes,
+                                                    uint8_t *pData,
+                                                    uint8_t ui8Offset,
+                                                    bool bUseOffset,
+                                                    bool bNoStop);
+#ifdef __cplusplus
+}
+#endif
+
+#endif //AM_HAL_I2C_BIT_BANG_H
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_interrupt.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_interrupt.c
new file mode 100644
index 000000000..74ab58456
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_interrupt.c
@@ -0,0 +1,407 @@
+//*****************************************************************************
+//
+//! @file am_hal_interrupt.c
+//!
+//! @brief Helper functions supporting interrupts and NVIC operation.
+//!
+//! These functions may be used for NVIC-level interrupt configuration.
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup interrupt Interrupt (ARM NVIC support functions)
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "am_mcu_apollo.h"
+
+//*****************************************************************************
+//
+//! @brief Enable an interrupt.
+//!
+//! @param ui32Interrupt The ISR number of the interrupt to be enabled.
+//!
+//! This function enables an interrupt signal to the NVIC based on the provided
+//! ISR number.
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_interrupt_enable(uint32_t ui32Interrupt)
+{
+    //
+    // Check to see what type of interrupt this is.
+    //
+    if ( ui32Interrupt > 15 )
+    {
+        //
+        // If this ISR number corresponds to a "normal" peripheral interrupt,
+        // enable it using the NVIC register.
+        //
+        AM_REG(NVIC, ISER0) = 0x1 << ((ui32Interrupt - 16) & 0x1F);
+    }
+    else
+    {
+        //
+        // If this is an ARM internal interrupt number, route it to the
+        // appropriate enable register.
+        //
+        switch(ui32Interrupt)
+        {
+            case AM_HAL_INTERRUPT_BUSFAULT:
+                AM_BFW(SYSCTRL, SHCSR, BUSFAULTENA, 1);
+            break;
+
+            case AM_HAL_INTERRUPT_USAGEFAULT:
+                AM_BFW(SYSCTRL, SHCSR, USAGEFAULTENA, 1);
+            break;
+
+            case AM_HAL_INTERRUPT_MPUFAULT:
+                AM_BFW(SYSCTRL, SHCSR, MEMFAULTENA, 1);
+            break;
+        }
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Disable an interrupt.
+//!
+//! @param ui32Interrupt The ISR number of the interrupt to be disabled.
+//!
+//! This function disables an interrupt signal to the NVIC based on the
+//! provided ISR number.
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_interrupt_disable(uint32_t ui32Interrupt)
+{
+    //
+    // Check to see what type of interrupt this is.
+    //
+    if ( ui32Interrupt > 15 )
+    {
+        //
+        // If this ISR number corresponds to a "normal" peripheral interrupt,
+        // disable it using the NVIC register.
+        //
+        AM_REG(NVIC, ICER0) = 0x1 << ((ui32Interrupt - 16) & 0x1F);
+    }
+    else
+    {
+        //
+        // If this is an ARM internal interrupt number, route it to the
+        // appropriate enable register.
+        //
+        switch(ui32Interrupt)
+        {
+            case AM_HAL_INTERRUPT_BUSFAULT:
+                AM_BFW(SYSCTRL, SHCSR, BUSFAULTENA, 0);
+            break;
+
+            case AM_HAL_INTERRUPT_USAGEFAULT:
+                AM_BFW(SYSCTRL, SHCSR, USAGEFAULTENA, 0);
+            break;
+
+            case AM_HAL_INTERRUPT_MPUFAULT:
+                AM_BFW(SYSCTRL, SHCSR, MEMFAULTENA, 0);
+            break;
+        }
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Set the priority of an interrupt vector.
+//!
+//! @param ui32Interrupt is the ISR number of the interrupt to change.
+//! @param ui32Priority is the new ISR priority value.
+//!
+//! This function changes the priority value in the NVIC for the given
+//! interrupt vector number.
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_interrupt_priority_set(uint32_t ui32Interrupt, uint32_t ui32Priority)
+{
+    volatile uint32_t *pui32PriorityReg;
+    volatile uint32_t ui32OldPriority;
+    uint32_t ui32Shift;
+
+    //
+    // Find the correct priority register.
+    //
+    pui32PriorityReg = (volatile uint32_t *) AM_REG_NVIC_IPR0_O;
+    pui32PriorityReg += ((ui32Interrupt - 16) >> 2);
+
+    //
+    // Find the correct shift value.
+    //
+    ui32Shift = (((ui32Interrupt - 16) & 0x3) * 8);
+
+    //
+    // Mask out the old priority.
+    //
+    ui32OldPriority = *pui32PriorityReg;
+    ui32OldPriority &= ~(0xFF << ui32Shift);
+
+    //
+    // OR in the new priority.
+    //
+    *pui32PriorityReg |= (ui32Priority << ui32Shift);
+}
+
+//*****************************************************************************
+//
+//! @brief Set a pending interrupt bit in the NVIC (Software Interrupt)
+//!
+//! @param ui32Interrupt is the ISR number of the interrupt to change.
+//!
+//! This function sets the specified bit in the Interrupt Set Pending (ISPR0)
+//! register. For future MCUs there may be more than one ISPR.
+//!
+//! @return None
+//
+//*****************************************************************************
+void am_hal_interrupt_pend_set(uint32_t ui32Interrupt)
+{
+    //
+    // Check to see if the specified interrupt is valid for this MCU
+    //
+    if ( ui32Interrupt > 47 )
+    {
+        return;
+    }
+
+    //
+    // Check to see what type of interrupt this is.
+    //
+    if ( ui32Interrupt > 15 )
+    {
+        //
+        // If this ISR number corresponds to a "normal" peripheral interrupt,
+        // disable it using the NVIC register.
+        //
+        AM_REG(NVIC, ISPR0) = 0x1 << ((ui32Interrupt - 16) & 0x1F);
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Clear a pending interrupt bit in the NVIC without servicing it
+//!
+//! @param ui32Interrupt is the ISR number of the interrupt to change.
+//!
+//! This function clears the specified bit in the Interrupt Clear Pending
+//! (ICPR0) register. For future MCUs there may be more than one ICPR. This
+//! function is useful immediately following a WFI before interrupts are
+//! re-enabled.
+//!
+//! @return None
+//
+//*****************************************************************************
+void am_hal_interrupt_pend_clear(uint32_t ui32Interrupt)
+{
+    //
+    // Check to see if the specified interrupt is valid for this MCU
+    //
+    if ( ui32Interrupt > 47 )
+    {
+        return;
+    }
+
+    //
+    // Check to see what type of interrupt this is.
+    //
+    if ( ui32Interrupt > 15 )
+    {
+        //
+        // If this ISR number corresponds to a "normal" peripheral interrupt,
+        // disable it using the NVIC register.
+        //
+        AM_REG(NVIC, ICPR0) = 0x1 << ((ui32Interrupt - 16) & 0x1F);
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Globally enable interrupt service routines
+//!
+//! This function allows interrupt signals from the NVIC to trigger ISR entry
+//! in the CPU. This function must be called if interrupts are to be serviced
+//! in software.
+//!
+//! @return 1 if interrupts were previously disabled, 0 otherwise.
+//
+//*****************************************************************************
+#if defined(__GNUC_STDC_INLINE__)
+uint32_t __attribute__((naked))
+am_hal_interrupt_master_enable(void)
+{
+    __asm("    mrs     r0, PRIMASK");
+    __asm("    cpsie i");
+    __asm("    bx lr");
+}
+#elif defined(__ARMCC_VERSION)
+__asm uint32_t
+am_hal_interrupt_master_enable(void)
+{
+    mrs     r0, PRIMASK
+    cpsie   i
+    bx      lr
+}
+#elif defined(__IAR_SYSTEMS_ICC__)
+#pragma diag_suppress = Pe940   // Suppress IAR compiler warning about missing
+                                // return statement on a non-void function
+__stackless uint32_t
+am_hal_interrupt_master_enable(void)
+{
+    __asm("    mrs     r0, PRIMASK");
+    __asm("    cpsie i");
+    __asm("    bx lr");
+}
+#pragma diag_default = Pe940    // Restore IAR compiler warning
+#endif
+
+//*****************************************************************************
+//
+//! @brief Globally disable interrupt service routines
+//!
+//! This function prevents interrupt signals from the NVIC from triggering ISR
+//! entry in the CPU. This will effectively stop incoming interrupt sources
+//! from triggering their corresponding ISRs.
+//!
+//! @note Any external interrupt signal that occurs while the master interrupt
+//! disable is active will still reach the "pending" state in the NVIC, but it
+//! will not be allowed to reach the "active" state or trigger the
+//! corresponding ISR. Instead, these interrupts are essentially "queued" until
+//! the next time the master interrupt enable instruction is executed. At that
+//! time, the interrupt handlers will be executed in order of decreasing
+//! priority.
+//!
+//! @return 1 if interrupts were previously disabled, 0 otherwise.
+//
+//*****************************************************************************
+#if defined(__GNUC_STDC_INLINE__)
+uint32_t __attribute__((naked))
+am_hal_interrupt_master_disable(void)
+{
+    __asm("    mrs     r0, PRIMASK");
+    __asm("    cpsid i");
+    __asm("    bx lr");
+}
+#elif defined(__ARMCC_VERSION)
+__asm uint32_t
+am_hal_interrupt_master_disable(void)
+{
+    mrs     r0, PRIMASK
+    cpsid   i
+    bx      lr
+}
+#elif defined(__IAR_SYSTEMS_ICC__)
+#pragma diag_suppress = Pe940   // Suppress IAR compiler warning about missing
+                                // return statement on a non-void function
+__stackless uint32_t
+am_hal_interrupt_master_disable(void)
+{
+    __asm("    mrs     r0, PRIMASK");
+    __asm("    cpsid i");
+    __asm("    bx lr");
+}
+#pragma diag_default = Pe940    // Restore IAR compiler warning
+#endif
+
+//*****************************************************************************
+//
+//! @brief Sets the master interrupt state based on the input.
+//!
+//! @param ui32InterruptState - Desired PRIMASK value.
+//!
+//! This function directly writes the PRIMASK register in the ARM core. A value
+//! of 1 will disable interrupts, while a value of zero will enable them.
+//!
+//! This function may be used along with am_hal_interrupt_master_disable() to
+//! implement a nesting critical section. To do this, call
+//! am_hal_interrupt_master_disable() to start the critical section, and save
+//! its return value. To complete the critical section, call
+//! am_hal_interrupt_master_set() using the saved return value as \e
+//! ui32InterruptState. This will safely restore PRIMASK to the value it
+//! contained just before the start of the critical section.
+//!
+//! @return None.
+//
+//*****************************************************************************
+#if defined(__GNUC_STDC_INLINE__)
+void __attribute__((naked))
+am_hal_interrupt_master_set(uint32_t ui32InterruptState)
+{
+    __asm("    msr     PRIMASK, r0");
+    __asm("    bx lr");
+}
+#elif defined(__ARMCC_VERSION)
+__asm void
+am_hal_interrupt_master_set(uint32_t ui32InterruptState)
+{
+    msr     PRIMASK, r0
+    bx      lr
+}
+#elif defined(__IAR_SYSTEMS_ICC__)
+#pragma diag_suppress = Pe940   // Suppress IAR compiler warning about missing
+                                // return statement on a non-void function
+__stackless void
+am_hal_interrupt_master_set(uint32_t ui32InterruptState)
+{
+    __asm("    msr     PRIMASK, r0");
+    __asm("    bx lr");
+}
+#pragma diag_default = Pe940    // Restore IAR compiler warning
+#endif
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_interrupt.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_interrupt.h
new file mode 100644
index 000000000..b29e67bd1
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_interrupt.h
@@ -0,0 +1,159 @@
+//*****************************************************************************
+//
+//! @file am_hal_interrupt.h
+//!
+//! @brief Helper functions supporting interrupts and NVIC operation.
+//!
+//! These functions may be used for NVIC-level interrupt configuration.
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup interrupt Interrupt (ARM NVIC support functions)
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_HAL_INTERRUPT_H
+#define AM_HAL_INTERRUPT_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+//*****************************************************************************
+//
+//! @name ISR number macros.
+//! @brief ISR macros.
+//!
+//! These macros are used for all ui32Interrupt arguments in this module.
+//! @{
+//
+//*****************************************************************************
+//
+// Hardware interrupts
+//
+#define AM_HAL_INTERRUPT_RESET              1
+#define AM_HAL_INTERRUPT_NMI                2
+#define AM_HAL_INTERRUPT_HARDFAULT          3
+#define AM_HAL_INTERRUPT_MPUFAULT           4
+#define AM_HAL_INTERRUPT_BUSFAULT           5
+#define AM_HAL_INTERRUPT_USAGEFAULT         6
+
+#define AM_HAL_INTERRUPT_SVCALL             11
+#define AM_HAL_INTERRUPT_DEBUGMON           12
+#define AM_HAL_INTERRUPT_PENDSV             14
+#define AM_HAL_INTERRUPT_SYSTICK            15
+
+//
+// Begin IRQs
+//
+#define AM_HAL_INTERRUPT_BROWNOUT           16
+#define AM_HAL_INTERRUPT_WATCHDOG           17
+#define AM_HAL_INTERRUPT_CLKGEN             18
+#define AM_HAL_INTERRUPT_VCOMP              19
+#define AM_HAL_INTERRUPT_IOSLAVE            20
+#define AM_HAL_INTERRUPT_IOSACC             21
+#define AM_HAL_INTERRUPT_IOMASTER0          22
+#define AM_HAL_INTERRUPT_IOMASTER1          23
+#define AM_HAL_INTERRUPT_IOMASTER2          24
+#define AM_HAL_INTERRUPT_IOMASTER3          25
+#define AM_HAL_INTERRUPT_IOMASTER4          26
+#define AM_HAL_INTERRUPT_IOMASTER5          27
+#define AM_HAL_INTERRUPT_GPIO               28
+#define AM_HAL_INTERRUPT_CTIMER             29
+#define AM_HAL_INTERRUPT_UART0              30
+#define AM_HAL_INTERRUPT_UART1              31
+#define AM_HAL_INTERRUPT_UART               (AM_HAL_INTERRUPT_UART0)
+#define AM_HAL_INTERRUPT_ADC                32
+#define AM_HAL_INTERRUPT_PDM                33
+#define AM_HAL_INTERRUPT_STIMER             34
+#define AM_HAL_INTERRUPT_STIMER_CMPR0       35
+#define AM_HAL_INTERRUPT_STIMER_CMPR1       36
+#define AM_HAL_INTERRUPT_STIMER_CMPR2       37
+#define AM_HAL_INTERRUPT_STIMER_CMPR3       38
+#define AM_HAL_INTERRUPT_STIMER_CMPR4       39
+#define AM_HAL_INTERRUPT_STIMER_CMPR5       40
+#define AM_HAL_INTERRUPT_STIMER_CMPR6       41
+#define AM_HAL_INTERRUPT_STIMER_CMPR7       42
+#define AM_HAL_INTERRUPT_FLASH              43
+
+#define AM_HAL_INTERRUPT_SOFTWARE0          44
+#define AM_HAL_INTERRUPT_SOFTWARE1          45
+#define AM_HAL_INTERRUPT_SOFTWARE2          46
+#define AM_HAL_INTERRUPT_SOFTWARE3          47
+//! @}
+
+//*****************************************************************************
+//
+//! @brief Interrupt priority
+//!
+//! This macro is made to be used with the \e am_hal_interrupt_priority_set()
+//! function. It converts a priority number to the format used by the ARM
+//! standard priority register, where only the top 3 bits are used.
+//!
+//! For example, AM_HAL_INTERRUPT_PRIORITY(1) yields a value of 0x20.
+//
+//*****************************************************************************
+#define AM_HAL_INTERRUPT_PRIORITY(n)        (((uint32_t)(n) & 0x7) << 5)
+
+//*****************************************************************************
+//
+// External function definitions
+//
+//*****************************************************************************
+extern void am_hal_interrupt_enable(uint32_t ui32Interrupt);
+extern void am_hal_interrupt_disable(uint32_t ui32Interrupt);
+extern void am_hal_interrupt_pend_set(uint32_t ui32Interrupt);
+extern void am_hal_interrupt_pend_clear(uint32_t ui32Interrupt);
+extern void am_hal_interrupt_priority_set(uint32_t ui32Interrupt,
+                                          uint32_t ui32Priority);
+extern uint32_t am_hal_interrupt_master_disable(void);
+extern uint32_t am_hal_interrupt_master_enable(void);
+extern void am_hal_interrupt_master_set(uint32_t ui32InterruptState);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_HAL_INTERRUPT_H
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_iom.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_iom.c
new file mode 100644
index 000000000..39b43f3f0
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_iom.c
@@ -0,0 +1,4347 @@
+//*****************************************************************************
+//
+//! @file am_hal_iom.c
+//!
+//! @brief Functions for interfacing with the IO Master module
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup iom IO Master (SPI/I2C)
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "am_mcu_apollo.h"
+
+#ifdef __IAR_SYSTEMS_ICC__
+#define AM_INSTR_CLZ(n)                     __CLZ(n)
+#else
+#define AM_INSTR_CLZ(n)                     __builtin_clz(n)
+#endif
+
+//! ASSERT(1) or Correct(0) invalid IOM R/W Thresholds.
+#ifndef AM_ASSERT_INVALID_THRESHOLD
+#define AM_ASSERT_INVALID_THRESHOLD    (1)
+#endif
+
+//*****************************************************************************
+//
+// Forcing optimizations
+//
+// These pragmas must be enabled if we intend to use the IOM4 workaround with a
+// delay higher than 18-bits in the first word.
+//
+//*****************************************************************************
+//#ifdef __IAR_SYSTEMS_ICC__
+//#pragma optimize=3 s
+//#endif
+//
+//#ifdef __ARMCC_VERSION
+//#pragma O3
+//#endif
+//
+//#ifdef __GNUC__
+//#pragma GCC optimize ("O3")
+//#endif
+
+//*****************************************************************************
+//
+// Forward declarations.
+//
+//*****************************************************************************
+static void iom_workaround_loop(uint32_t ui32PadRegVal,
+                                volatile uint32_t *pui32PadReg,
+                                bool bRising);
+static uint32_t
+internal_am_hal_iom_spi_cmd_construct(uint32_t ui32Operation,
+                                      uint32_t ui32ChipSelect,
+                                      uint32_t ui32NumBytes,
+                                      uint32_t ui32Options);
+
+//*****************************************************************************
+//
+// IOM Buffer states.
+//
+//*****************************************************************************
+#define BUFFER_IDLE                         0x0
+#define BUFFER_SENDING                      0x1
+#define BUFFER_RECEIVING                    0x2
+
+//*****************************************************************************
+//
+// Global state variables
+//
+//*****************************************************************************
+//
+// Save error status from ISR, particularly for use in I2C queue mode.
+//
+uint32_t g_iom_error_status = 0;
+
+//
+// Define a structure to map CE for IOM4 only.
+//
+typedef struct
+{
+  uint8_t       channel;        // CE channel for SPI
+  uint8_t       pad;            // GPIO Pad
+  uint8_t       funcsel;        // FNCSEL value
+} IOMPad_t;
+
+// Define the mapping between SPI CEn, Pads, and FNCSEL values for all IOMs.
+const IOMPad_t g_IOMPads[] =
+{
+    {0, 29, 6}, {0, 34, 6}, {1, 18, 4}, {1, 37, 5}, {2, 41, 6},
+    {3, 17, 4}, {3, 45, 4}, {4, 10, 6}, {4, 46, 6}, {5,  9, 4},
+    {5, 47, 6}, {6, 35, 4}, {7, 38, 6}
+};
+
+#define WORKAROUND_IOM          4
+#define WORKAROUND_IOM_MOSI_PIN 44
+#define WORKAROUND_IOM_MOSI_CFG AM_HAL_PIN_44_M4MOSI
+
+//*****************************************************************************
+//
+// Non-blocking buffer and buffer-management variables.
+//
+//*****************************************************************************
+typedef struct
+{
+    uint32_t ui32State;
+    uint32_t *pui32Data;
+    uint32_t ui32BytesLeft;
+    uint32_t ui32Options;
+    void (*pfnCallback)(void);
+}
+am_hal_iom_nb_buffer;
+
+//
+// Global State to keep track if there is an ongoing transaction
+//
+volatile bool g_bIomBusy[AM_REG_IOMSTR_NUM_MODULES] = {0};
+
+am_hal_iom_nb_buffer g_psIOMBuffers[AM_REG_IOMSTR_NUM_MODULES];
+
+//*****************************************************************************
+//
+// Queue management variables.
+//
+//*****************************************************************************
+am_hal_queue_t g_psIOMQueue[AM_REG_IOMSTR_NUM_MODULES];
+
+//*****************************************************************************
+//
+// Default queue flush function
+//
+//*****************************************************************************
+am_hal_iom_queue_flush_t am_hal_iom_queue_flush = am_hal_iom_sleeping_queue_flush;
+
+//*****************************************************************************
+//
+// Power management structure.
+//
+//*****************************************************************************
+am_hal_iom_pwrsave_t am_hal_iom_pwrsave[AM_REG_IOMSTR_NUM_MODULES];
+
+
+//*****************************************************************************
+//
+// Static helper functions
+//
+//*****************************************************************************
+//
+// A power of 2?
+// Return true if ui32Value has exactly 1 bit set, otherwise false.
+//
+static bool onebit(uint32_t ui32Value)
+{
+    return ui32Value  &&  !(ui32Value & (ui32Value - 1));
+}
+
+//
+// Compute the interface frequency based on the given parameters
+//
+static uint32_t compute_freq(uint32_t ui32HFRCfreqHz,
+                             uint32_t ui32Fsel, uint32_t ui32Div3,
+                             uint32_t ui32DivEn, uint32_t ui32TotPer)
+{
+    uint32_t ui32Denomfinal, ui32ClkFreq;
+
+    ui32Denomfinal = ((1 << (ui32Fsel - 1)) * (1 + ui32Div3 * 2) * (1 + ui32DivEn * (ui32TotPer)));
+    ui32ClkFreq = (ui32HFRCfreqHz) / ui32Denomfinal;                           // Compute the set frequency value
+    ui32ClkFreq +=  (((ui32HFRCfreqHz) % ui32Denomfinal) > (ui32Denomfinal / 2)) ? 1 : 0;
+
+    return ui32ClkFreq;
+}
+
+//
+// Calculate the IOM4 GPIO to assert.
+//
+static uint32_t iom_calc_gpio(uint32_t ui32ChipSelect)
+{
+    uint32_t      index;
+    uint8_t       ui8PadRegVal, ui8FncSelVal;
+
+    //
+    // Figure out which GPIO we are using for the IOM
+    //
+    for ( index = 0; index < (sizeof(g_IOMPads) / sizeof(IOMPad_t)); index++ )
+    {
+        //
+        //  Is this one of the CEn that we are using?
+        //
+        if ( g_IOMPads[index].channel == ui32ChipSelect )
+        {
+            //
+            // Get the PAD register value
+            //
+            ui8PadRegVal = ((AM_REGVAL(AM_HAL_GPIO_PADREG(g_IOMPads[index].pad))) &
+                             AM_HAL_GPIO_PADREG_M(g_IOMPads[index].pad)) >>
+                             AM_HAL_GPIO_PADREG_S(g_IOMPads[index].pad);
+
+            //
+            // Get the FNCSEL field value
+            //
+            ui8FncSelVal = (ui8PadRegVal & 0x38) >> 3;
+
+            //
+            // Is the FNCSEL filed for this pad set to the expected value?
+            //
+            if ( ui8FncSelVal == g_IOMPads[index].funcsel )
+            {
+                // This is the GPIO we need to use.
+                return g_IOMPads[index].pad;
+            }
+        }
+    }
+    return 0xDEADBEEF;
+}
+
+//*****************************************************************************
+//
+// Checks to see if this processor is a Rev B0 device.
+//
+// This is needed for the B0 IOM workaround.
+//
+//*****************************************************************************
+bool
+isRevB0(void)
+{
+    //
+    // Check to make sure the major rev is B and the minor rev is zero.
+    //
+    if ( (AM_REG(MCUCTRL, CHIPREV) & 0xFF) == AM_REG_MCUCTRL_CHIPREV_REVMAJ_B )
+    {
+        return true;
+    }
+    else
+    {
+        return false;
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Returns the proper settings for the CLKCFG register.
+//!
+//! @param ui32FreqHz - The desired interface frequency in Hz.
+//!        ui32Phase  - SPI phase (0 or 1).  Can affect duty cycle.
+//!
+//! Given a desired serial interface clock frequency, this function computes
+//! the appropriate settings for the various fields in the CLKCFG register
+//! and returns the 32-bit value that should be written to that register.
+//! The actual interface frequency may be slightly lower than the specified
+//! frequency, but the actual frequency is also returned.
+//!
+//! @note A couple of criteria that this algorithm follow are:
+//!  1. For power savings, choose the highest FSEL possible.
+//!  2. For best duty cycle, use DIV3 when possible rather than DIVEN.
+//!
+//! An example of #1 is that both of the following CLKCFGs would result
+//! in a frequency of 428,571 Hz:  0x0E071400 and 0x1C0E1300.
+//! The former is chosen by the algorithm because it results in FSEL=4
+//! while the latter is FSEL=3.
+//!
+//! An example of #2 is that both of the following CLKCFGs would result
+//! in a frequency of 2,000,000 Hz:  0x02011400 and 0x00000C00.
+//! The latter is chosen by the algorithm because it results in use of DIV3
+//! rather than DIVEN.
+//!
+//! @return An unsigned 64-bit value.
+//! The lower 32-bits represent the value to use to set CLKCFG.
+//! The upper 32-bits represent the actual frequency (in Hz) that will result
+//! from setting CLKCFG with the lower 32-bits.
+//!
+//! 0 (64 bits) = error. Note that the caller must check the entire 64 bits.
+//! It is not an error if only the low 32-bits are 0 (this is a valid value).
+//! But the entire 64 bits returning 0 is an error.
+//!
+//*****************************************************************************
+
+static
+uint64_t iom_get_interface_clock_cfg(uint32_t ui32FreqHz, uint32_t ui32Phase )
+{
+    uint32_t ui32Fsel, ui32Div3, ui32DivEn, ui32TotPer, ui32LowPer;
+    uint32_t ui32Denom, ui32v1, ui32Denomfinal, ui32ClkFreq, ui32ClkCfg;
+    uint32_t ui32HFRCfreqHz;
+    int32_t i32Div, i32N;
+
+    if ( ui32FreqHz == 0 )
+    {
+        return 0;
+    }
+
+    //
+    // Set the HFRC clock frequency.
+    //
+    ui32HFRCfreqHz = AM_HAL_CLKGEN_FREQ_MAX_HZ;
+
+    //
+    // Compute various parameters used for computing the optimal CLKCFG setting.
+    //
+    i32Div = (ui32HFRCfreqHz / ui32FreqHz) + ((ui32HFRCfreqHz % ui32FreqHz) ? 1 : 0);    // Round up (ceiling)
+
+    //
+    // Compute N (count the number of LS zeros of Div) = ctz(Div) = log2(Div & (-Div))
+    //
+    i32N = 31 - AM_INSTR_CLZ((i32Div & (-i32Div)));
+
+    if ( i32N > 6 )
+    {
+        i32N = 6;
+    }
+
+    ui32Div3 = ( (ui32FreqHz < (ui32HFRCfreqHz / 16384))            ||
+                 ( ((ui32FreqHz >= (ui32HFRCfreqHz / 3))    &&
+                    (ui32FreqHz <= ((ui32HFRCfreqHz / 2) - 1)) ) ) ) ? 1 : 0;
+    ui32Denom = ( 1 << i32N ) * ( 1 + (ui32Div3 * 2) );
+    ui32TotPer = i32Div / ui32Denom;
+    ui32TotPer += (i32Div % ui32Denom) ? 1 : 0;
+    ui32v1 = 31 - AM_INSTR_CLZ(ui32TotPer);     // v1 = log2(TotPer)
+    ui32Fsel = (ui32v1 > 7) ? ui32v1 + i32N - 7 : i32N;
+    ui32Fsel++;
+
+    if ( ui32Fsel > 7 )
+    {
+        //
+        // This is an error, can't go that low.
+        //
+        return 0;
+    }
+
+    if ( ui32v1 > 7 )
+    {
+        ui32DivEn = ui32TotPer;     // Save TotPer for the round up calculation
+        ui32TotPer = ui32TotPer>>(ui32v1-7);
+        ui32TotPer += ((ui32DivEn) % (1 << (ui32v1 - 7))) ? 1 : 0;
+    }
+
+    ui32DivEn = ( (ui32FreqHz >= (ui32HFRCfreqHz / 4)) ||
+                  ((1 << (ui32Fsel - 1)) == i32Div) ) ? 0 : 1;
+
+    if (ui32Phase == 1)
+    {
+        ui32LowPer = (ui32TotPer - 2) / 2;          // Longer high phase
+    }
+    else
+    {
+        ui32LowPer = (ui32TotPer - 1) / 2;          // Longer low phase
+    }
+
+    ui32ClkCfg = AM_REG_IOMSTR_CLKCFG_FSEL(ui32Fsel)                |
+                 AM_REG_IOMSTR_CLKCFG_DIV3(ui32Div3)                |
+                 AM_REG_IOMSTR_CLKCFG_DIVEN(ui32DivEn)              |
+                 AM_REG_IOMSTR_CLKCFG_LOWPER(ui32LowPer)            |
+                 AM_REG_IOMSTR_CLKCFG_TOTPER(ui32TotPer - 1);
+
+
+    //
+    // Now, compute the actual frequency, which will be returned.
+    //
+    ui32ClkFreq = compute_freq(ui32HFRCfreqHz, ui32Fsel, ui32Div3, ui32DivEn, ui32TotPer - 1);
+
+    //
+    // Determine if the actual frequency is a power of 2 (MHz).
+    //
+    if ( (ui32ClkFreq % 250000) == 0 )
+    {
+        //
+        // If the actual clock frequency is a power of 2 ranging from 250KHz up,
+        // we can simplify the CLKCFG value using DIV3 (which also results in a
+        // better duty cycle).
+        //
+        ui32Denomfinal = ui32ClkFreq / (uint32_t)250000;
+
+        if ( onebit(ui32Denomfinal) )
+        {
+            //
+            // These configurations can be simplified by using DIV3.  Configs
+            // using DIV3 have a 50% duty cycle, while those from DIVEN will
+            // have a 66/33 duty cycle.
+            //
+            ui32TotPer = ui32LowPer = ui32DivEn = 0;
+            ui32Div3 = 1;
+
+            //
+            // Now, compute the return values.
+            //
+            ui32ClkFreq = compute_freq(ui32HFRCfreqHz, ui32Fsel, ui32Div3, ui32DivEn, ui32TotPer);
+
+            ui32ClkCfg = AM_REG_IOMSTR_CLKCFG_FSEL(ui32Fsel)    |
+                         AM_REG_IOMSTR_CLKCFG_DIV3(1)           |
+                         AM_REG_IOMSTR_CLKCFG_DIVEN(0)          |
+                         AM_REG_IOMSTR_CLKCFG_LOWPER(0)         |
+                         AM_REG_IOMSTR_CLKCFG_TOTPER(0);
+        }
+    }
+
+    return ( ((uint64_t)ui32ClkFreq) << 32) | (uint64_t)ui32ClkCfg;
+
+} //iom_get_interface_clock_cfg()
+
+
+//*****************************************************************************
+//
+//! @brief Enable the IOM in the power control block.
+//!
+//! This function enables the desigated IOM module in the power control block.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_iom_pwrctrl_enable(uint32_t ui32Module)
+{
+    am_hal_debug_assert_msg(ui32Module < AM_REG_IOMSTR_NUM_MODULES,
+                            "Trying to enable an IOM module that doesn't exist.");
+
+    am_hal_pwrctrl_periph_enable(AM_HAL_PWRCTRL_IOM0 << ui32Module);
+}
+
+//*****************************************************************************
+//
+//! @brief Disable the IOM in the power control block.
+//!
+//! This function disables the desigated IOM module in the power control block.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_iom_pwrctrl_disable(uint32_t ui32Module)
+{
+    am_hal_debug_assert_msg(ui32Module < AM_REG_IOMSTR_NUM_MODULES,
+                            "Trying to disable an IOM module that doesn't exist.");
+
+    am_hal_pwrctrl_periph_disable(AM_HAL_PWRCTRL_IOM0 << ui32Module);
+}
+
+//*****************************************************************************
+//
+//! @brief Enables the IOM module
+//!
+//! @param ui32Module - The number of the IOM module to be enabled.
+//!
+//! This function enables the IOM module using the IFCEN bitfield in the
+//! IOMSTR_CFG register.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_iom_enable(uint32_t ui32Module)
+{
+    if ( ui32Module < AM_REG_IOMSTR_NUM_MODULES )
+    {
+        AM_REGn(IOMSTR, ui32Module, CFG) |= AM_REG_IOMSTR_CFG_IFCEN(1);
+        g_bIomBusy[ui32Module] = false;
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Disables the IOM module.
+//!
+//! @param ui32Module - The number of the IOM module to be disabled.
+//!
+//! This function disables the IOM module using the IFCEN bitfield in the
+//! IOMSTR_CFG register.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_iom_disable(uint32_t ui32Module)
+{
+    if ( ui32Module < AM_REG_IOMSTR_NUM_MODULES )
+    {
+        //
+        // Wait until the bus is idle.
+        //
+        am_hal_iom_poll_complete(ui32Module);
+
+        //
+        // Disable the interface.
+        //
+        AM_REGn(IOMSTR, ui32Module, CFG) &= ~(AM_REG_IOMSTR_CFG_IFCEN(1));
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Enable power to the selected IOM module.
+//!
+//! @param ui32Module - Module number for the IOM to be turned on.
+//!
+//! This function enables the power gate to the selected IOM module. It is
+//! intended to be used along with am_hal_iom_power_off_save(). Used together,
+//! these functions allow the caller to power IOM modules off to save
+//! additional power without losing important configuration information.
+//!
+//! The am_hal_iom_power_off_save() function will save IOM configuration
+//! register information to SRAM before powering off the selected IOM module.
+//! This function will re-enable the IOM module, and restore those
+//! configuration settings from SRAM.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_iom_power_on_restore(uint32_t ui32Module)
+{
+    am_hal_debug_assert_msg(ui32Module < AM_REG_IOMSTR_NUM_MODULES,
+                            "Trying to enable an IOM module that doesn't exist.");
+
+    //
+    // Make sure this restore is a companion to a previous save call.
+    //
+    if ( am_hal_iom_pwrsave[ui32Module].bValid == 0 )
+    {
+        return;
+    }
+
+    //
+    // Enable power to the selected IOM.
+    //
+    am_hal_pwrctrl_periph_enable(AM_HAL_PWRCTRL_IOM0 << ui32Module);
+
+    //
+    // Restore the IOM configuration registers from the structure in SRAM.
+    //
+    AM_REGn(IOMSTR, ui32Module, FIFOTHR) = am_hal_iom_pwrsave[ui32Module].FIFOTHR;
+    AM_REGn(IOMSTR, ui32Module, CLKCFG) = am_hal_iom_pwrsave[ui32Module].CLKCFG;
+    AM_REGn(IOMSTR, ui32Module, CFG) = am_hal_iom_pwrsave[ui32Module].CFG;
+    AM_REGn(IOMSTR, ui32Module, INTEN) = am_hal_iom_pwrsave[ui32Module].INTEN;
+
+    //
+    // Indicates we have restored the configuration.
+    //
+    am_hal_iom_pwrsave[ui32Module].bValid = 0;
+}
+
+//*****************************************************************************
+//
+//! @brief Disable power to the selected IOM module.
+//!
+//! @param ui32Module - Module number for the IOM to be turned off.
+//!
+//! This function disables the power gate to the selected IOM module. It is
+//! intended to be used along with am_hal_iom_power_on_restore(). Used together,
+//! these functions allow the caller to power IOM modules off to save
+//! additional power without losing important configuration information.
+//!
+//! The am_hal_iom_power_off_save() function will save IOM configuration
+//! register information to SRAM before powering off the selected IOM module.
+//! The am_hal_iom_power_on_restore() function will re-enable the IOM module
+//! and restore those configuration settings from SRAM.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_iom_power_off_save(uint32_t ui32Module)
+{
+    am_hal_debug_assert_msg(ui32Module < AM_REG_IOMSTR_NUM_MODULES,
+                            "Trying to disable an IOM module that doesn't exist.");
+
+    //
+    // Save the IOM configuration registers to the structure in SRAM.
+    //
+    am_hal_iom_pwrsave[ui32Module].FIFOTHR = AM_REGn(IOMSTR, ui32Module, FIFOTHR);
+    am_hal_iom_pwrsave[ui32Module].CLKCFG = AM_REGn(IOMSTR, ui32Module, CLKCFG);
+    am_hal_iom_pwrsave[ui32Module].CFG = AM_REGn(IOMSTR, ui32Module, CFG);
+    am_hal_iom_pwrsave[ui32Module].INTEN = AM_REGn(IOMSTR, ui32Module, INTEN);
+
+    //
+    // Indicates we have a valid saved configuration.
+    //
+    am_hal_iom_pwrsave[ui32Module].bValid = 1;
+
+    //
+    // Disable power to the selected IOM.
+    //
+    am_hal_pwrctrl_periph_disable(AM_HAL_PWRCTRL_IOM0 << ui32Module);
+}
+
+//
+//! Check and correct the IOM FIFO threshold.
+//
+#define MAX_RW_THRESHOLD    (AM_HAL_IOM_MAX_FIFO_SIZE - 4)
+#define MIN_RW_THRESHOLD    (4)
+#if (AM_ASSERT_INVALID_THRESHOLD == 0)
+static uint8_t check_iom_threshold(const uint8_t iom_threshold)
+{
+    uint8_t corrected_threshold = iom_threshold;
+
+    if ( corrected_threshold < MIN_RW_THRESHOLD )
+    {
+        corrected_threshold = MIN_RW_THRESHOLD;
+    }
+
+    if ( corrected_threshold > MAX_RW_THRESHOLD )
+    {
+        corrected_threshold = MAX_RW_THRESHOLD;
+    }
+
+    return corrected_threshold;
+}
+#endif
+
+//*****************************************************************************
+//
+//! @brief Sets module-wide configuration options for the IOM module.
+//!
+//! @param ui32Module - The instance number for the module to be configured
+//! (zero or one)
+//!
+//! @param psConfig - Pointer to an IOM configuration structure.
+//!
+//! This function is used to set the interface mode (SPI or I2C), clock
+//! frequency, SPI format (when relevant), and FIFO read/write interrupt
+//! thresholds for the IO master. For more information on specific
+//! configuration options, please see the documentation for the configuration
+//! structure.
+//!
+//! @note The IOM module should be disabled before configuring or
+//! re-configuring. This function will not re-enable the module when it
+//! completes. Call the am_hal_iom_enable function when the module is
+//! configured and ready to use.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_iom_config(uint32_t ui32Module, const am_hal_iom_config_t *psConfig)
+{
+    uint32_t ui32Config, ui32ClkCfg;
+
+    //
+    // Start by checking the interface mode (I2C or SPI), and writing it to the
+    // configuration word.
+    //
+    ui32Config = psConfig->ui32InterfaceMode;
+
+    if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
+    {
+        return;
+    }
+
+    //
+    // Check the SPI format, and OR in the bits for SPHA (clock phase) and SPOL
+    // (polarity). These shouldn't have any effect in I2C mode, so it should be
+    // ok to write them without checking exactly which mode we're in.
+    //
+    if ( psConfig->bSPHA )
+    {
+        ui32Config |= AM_REG_IOMSTR_CFG_SPHA(1);
+    }
+
+    if ( psConfig->bSPOL )
+    {
+        ui32Config |= AM_REG_IOMSTR_CFG_SPOL(1);
+    }
+
+    // Set the STARTRD based on the interface speed
+    // For all I2C frequencies and SPI frequencies below 16 MHz, the STARTRD
+    // field should be set to 0 to minimize the potential of the IO transfer
+    // holding off a bus access to the FIFO. For SPI frequencies of 16 MHz
+    // or 24 MHz, the STARTRD field must be set to a value of 2 to insure
+    // enough time for the IO preread.
+    if ( psConfig->ui32ClockFrequency >= 16000000UL)
+    {
+        ui32Config |= AM_REG_IOMSTR_CFG_STARTRD(2);
+    }
+
+    //
+    // Write the resulting configuration word to the IO master CFG register for
+    // the module number we were provided.
+    //
+    AM_REGn(IOMSTR, ui32Module, CFG) = ui32Config;
+
+    //
+    // Write the FIFO write and read thresholds to the appropriate registers.
+    //
+#if     (AM_ASSERT_INVALID_THRESHOLD == 1)
+    am_hal_debug_assert_msg(
+        (psConfig->ui8WriteThreshold <= MAX_RW_THRESHOLD), "IOM write threshold too big.");
+    am_hal_debug_assert_msg(
+        (psConfig->ui8ReadThreshold <= MAX_RW_THRESHOLD), "IOM read threshold too big.");
+    am_hal_debug_assert_msg(
+        (psConfig->ui8WriteThreshold >= MIN_RW_THRESHOLD), "IOM write threshold too small.");
+    am_hal_debug_assert_msg(
+        (psConfig->ui8ReadThreshold >= MIN_RW_THRESHOLD), "IOM read threshold too small.");
+
+    AM_REGn(IOMSTR, ui32Module, FIFOTHR) =
+        (AM_REG_IOMSTR_FIFOTHR_FIFOWTHR(psConfig->ui8WriteThreshold) |
+         AM_REG_IOMSTR_FIFOTHR_FIFORTHR(psConfig->ui8ReadThreshold));
+#elif   (AM_ASSERT_INVALID_THRESHOLD == 0)
+    AM_REGn(IOMSTR, ui32Module, FIFOTHR) =
+        (AM_REG_IOMSTR_FIFOTHR_FIFOWTHR(check_iom_threshold(psConfig->ui8WriteThreshold)) |
+         AM_REG_IOMSTR_FIFOTHR_FIFORTHR(check_iom_threshold(psConfig->ui8ReadThreshold)));
+#else
+#error AM_ASSERT_INVALID_THRESHOLD must be 0 or 1.
+#endif
+
+    //
+    // An exception occurs in the LOWPER computation when setting an interface
+    //  frequency (such as a divide by 5 frequency) which results in a 60/40
+    //  duty cycle.  The 60% cycle must occur in the appropriate half-period,
+    //  as only one of the half-periods is active, depending on which phase
+    //  is being selected.
+    // If SPHA=0 the low period must be 60%. If SPHA=1 high period must be 60%.
+    // Note that the predetermined frequency parameters use the formula
+    //  lowper = (totper-1)/2, which results in a 60% low period.
+    //
+    ui32ClkCfg = iom_get_interface_clock_cfg(psConfig->ui32ClockFrequency,
+                                             psConfig->bSPHA );
+    if ( ui32ClkCfg )
+    {
+        AM_REGn(IOMSTR, ui32Module, CLKCFG) = (uint32_t)ui32ClkCfg;
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Returns the actual currently configured interface frequency in Hz.
+//
+//*****************************************************************************
+uint32_t
+am_hal_iom_frequency_get(uint32_t ui32ClkCfg)
+{
+    uint32_t ui32Freq;
+
+    ui32Freq = compute_freq(AM_HAL_CLKGEN_FREQ_MAX_HZ,
+    (ui32ClkCfg & AM_REG_IOMSTR_CLKCFG_FSEL_M)  >> AM_REG_IOMSTR_CLKCFG_FSEL_S,
+    (ui32ClkCfg & AM_REG_IOMSTR_CLKCFG_DIV3_M)  >> AM_REG_IOMSTR_CLKCFG_DIV3_S,
+    (ui32ClkCfg & AM_REG_IOMSTR_CLKCFG_DIVEN_M) >> AM_REG_IOMSTR_CLKCFG_DIVEN_S,
+    (ui32ClkCfg & AM_REG_IOMSTR_CLKCFG_TOTPER_M)>> AM_REG_IOMSTR_CLKCFG_TOTPER_S);
+
+    return ui32Freq;
+}
+
+//*****************************************************************************
+//
+// Helper function for the B0 workaround.
+//
+//*****************************************************************************
+static uint32_t
+iom_get_workaround_fsel(uint32_t maxFreq)
+{
+    uint32_t ui32Freq, ui32Fsel;
+    uint32_t ui32ClkCfg = AM_REGn(IOMSTR, 4, CLKCFG);
+
+    //
+    // Starting with the current clock configuration parameters, find a value
+    // of FSEL that will bring our total frequency down to or below maxFreq.
+    //
+    for ( ui32Fsel = 1; ui32Fsel < 8; ui32Fsel++ )
+    {
+        ui32Freq = compute_freq(AM_HAL_CLKGEN_FREQ_MAX_HZ, ui32Fsel,
+                                AM_BFX(IOMSTR, CLKCFG, DIV3, ui32ClkCfg),
+                                AM_BFX(IOMSTR, CLKCFG, DIVEN, ui32ClkCfg),
+                                AM_BFX(IOMSTR, CLKCFG, TOTPER, ui32ClkCfg));
+
+        if ( ui32Freq <= maxFreq && ui32Freq != 0 )
+        {
+            //
+            // Return the new FSEL
+            //
+            return ui32Fsel;
+        }
+    }
+
+    //
+    // Couldn't find an appropriate frequency. This should be impossible
+    // because there should always be a value of FSEL that brings the final IOM
+    // frequency below 500 KHz.
+    //
+    am_hal_debug_assert_msg(false, "Could find a valid frequency.  Should never get here.");
+    return maxFreq;
+}
+
+// Separating this piece of code in separate function to keep the impact of
+// rest of the code to mimimal because of stack usage
+static void
+internal_iom_workaround_critical(uint32_t ui32Command,
+                                 volatile uint32_t *pui32CSPadreg,
+                                 uint32_t ui32CSPadregVal,
+                                 uint32_t ui32DelayTime,
+                                 uint32_t ui32ClkCfg,
+                                 uint32_t ui32LowClkCfg,
+                                 bool bRising)
+{
+    uint32_t ui32Critical = 0;
+    //
+    // Start a critical section.
+    //
+    ui32Critical = am_hal_interrupt_master_disable();
+
+    //
+    // Start the write on the bus.
+    //
+    AM_REGn(IOMSTR, WORKAROUND_IOM, CMD) = ui32Command;
+
+    //
+    // Slow down the clock, and run the workaround loop. The workaround
+    // loop runs an edge-detector on MOSI, and triggers a falling edge on
+    // chip-enable on the first bit of our real data.
+    //
+    ((void (*)(uint32_t)) 0x0800009d)(ui32DelayTime);
+    // Switch to Low Freq
+    AM_REGn(IOMSTR, WORKAROUND_IOM, CLKCFG) = ui32LowClkCfg;
+    iom_workaround_loop(ui32CSPadregVal, pui32CSPadreg, bRising);
+    //
+    // Restore the clock frequency and the normal MOSI pin function.
+    //
+    AM_REGn(IOMSTR, WORKAROUND_IOM, CLKCFG) = ui32ClkCfg;
+    am_hal_gpio_pin_config(WORKAROUND_IOM_MOSI_PIN, WORKAROUND_IOM_MOSI_CFG);
+
+    //
+    // End the critical section.
+    //
+    am_hal_interrupt_master_set(ui32Critical);
+}
+
+
+//*****************************************************************************
+//
+//! @brief Workaround for an Apollo2 Rev B0 issue.
+//!
+//! @param ui32ChipSelect - Chip-select number for this transaction.
+//! @param pui32Data - Pointer to the bytes that will be sent.
+//! @param ui32NumBytes - Number of bytes to send.
+//! @param ui32Options - Additional SPI transfer options.
+//!
+//! Some Apollo2 Rev B0 devices have an issue where the first byte of a SPI
+//! write transaction can have some of its bits changed from ones to zeroes. In
+//! order to get around this issue, we artificially pad the SPI write data with
+//! additional bytes, and manually control the CS pin for the beginning of the
+//! SPI frame so that the receiving device will ignore the bytes of padding
+//! that we added.
+//!
+//! This function acts as a helper function to higher-level spi APIs. It
+//! performs the functions of am_hal_iom_fifo_write() and
+//! am_hal_iom_spi_cmd_run() to get a SPI write started on the bus, including
+//! all of the necessary workaround behavior.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_iom_workaround_word_write(uint32_t ui32ChipSelect,
+                                 uint32_t *pui32Data, uint32_t ui32NumBytes,
+                                 uint32_t ui32Options)
+{
+    uint32_t ui32TransferSize;
+    uint32_t ui32IOMGPIO = 0xDEADBEEF;
+    volatile uint32_t *pui32CSPadreg = 0;
+    uint32_t ui32CSPadregVal = 0;
+    uint32_t ui32ClkCfg = 0;
+    uint32_t ui32HiClkCfg, ui32LowClkCfg;
+    bool bRising = 0;
+    uint32_t ui32HiFreq = 0, ui32NormalFreq = 0;
+    uint32_t ui32DelayTime = 0;
+    uint32_t ui32LowFsel = 0;
+    uint32_t ui32HiFsel = 0;
+    uint32_t ui32FirstWord = 0;
+    uint32_t ui32MaxFifoSize = ((0 == AM_BFRn(IOMSTR, WORKAROUND_IOM, CFG, FULLDUP)) ?
+                               AM_HAL_IOM_MAX_FIFO_SIZE : AM_HAL_IOM_MAX_FIFO_SIZE / 2);
+    uint32_t ui32Command;
+    //
+    // Make sure the transfer isn't too long for the hardware to support.
+    //
+    // Note: This is a little shorter than usual, since the workaround
+    // consumes an extra byte at the beginning of the transfer.
+    //
+    am_hal_debug_assert_msg(ui32NumBytes <= 4091, "SPI transfer too big.");
+
+    //
+    // Create a "dummy" word to add on to the beginning of the transfer
+    // that will guarantee a transition between the first word and the
+    // second on the bus.
+    //
+    // For raw transactions, this is straightforward. For transactions
+    // preceded by an offset, we'll add the offset in to the "dummy" word
+    // to preserve data alignment later.
+    //
+    // The workaround uses a critical section for precision
+    // To minimize the time in critical section, we raise the SPI frequency
+    // to the max possible for the initial preamble to be clocked out
+    // then we switch to a 'reasonably' slow frequency to be able to reliably
+    // catch the rising or falling edge by polling. Then we switch back to
+    // configured frequency
+    //
+
+    // We want to slow down the clock to help us count edges more
+    // accurately. Save it first, then slow it down. Also, we will
+    // pre-calculate a delay for when we need to restore the SPI settings.
+    //
+    ui32ClkCfg = AM_REGn(IOMSTR, WORKAROUND_IOM, CLKCFG);
+    // Get the largest speed we can configure within our rated speed of 16MHz
+    ui32HiFsel = iom_get_workaround_fsel(16000000);
+    ui32HiClkCfg = ((ui32ClkCfg & (~AM_REG_IOMSTR_CLKCFG_FSEL_M)) |
+                     AM_BFV(IOMSTR, CLKCFG, FSEL, ui32HiFsel));
+    // Switch to Hi Freq
+    // Need to make sure we wait long enough for the hi clock to be effective
+    // Delay 2 cycles based on previous frequency
+    ui32NormalFreq = am_hal_iom_frequency_get(ui32ClkCfg);
+    AM_REGn(IOMSTR, WORKAROUND_IOM, CLKCFG) = ui32HiClkCfg;
+    ui32DelayTime = ((2 * AM_HAL_CLKGEN_FREQ_MAX_HZ) / (ui32NormalFreq * 3));
+    ((void (*)(uint32_t)) 0x0800009d)(ui32DelayTime);
+    //
+    // Remember what frequency we'll be running at.during Hi Phase
+    //
+    ui32HiFreq = am_hal_iom_frequency_get(ui32HiClkCfg);
+
+    //
+    // Validate return value to prevent DIVBY0 errors.
+    //
+    am_hal_debug_assert_msg(ui32HiFreq > 0, "Invalid Hi Frequency for IOM.");
+
+    // Get a reasonably slow speed (~1MHz) we can safely poll for the transition
+    ui32LowFsel = iom_get_workaround_fsel(1000000);
+    ui32LowClkCfg = ((ui32ClkCfg & (~AM_REG_IOMSTR_CLKCFG_FSEL_M)) |
+                     AM_BFV(IOMSTR, CLKCFG, FSEL, ui32LowFsel));
+
+    if ( ui32Options & AM_HAL_IOM_RAW )
+    {
+        //
+        // The transition we care for is on 33rd bit.
+        // Prepare to delay 27 bits past the start of the transaction
+        // before getting into polling - to leave some
+        // margin for compiler related variations
+        //
+        ui32DelayTime = ((27 * AM_HAL_CLKGEN_FREQ_MAX_HZ) / (ui32HiFreq * 3));
+
+        if ( pui32Data[0] & 0x80 )
+        {
+            ui32FirstWord = 0x00000000;
+            bRising = true;
+        }
+        else
+        {
+            ui32FirstWord = 0xFFFFFF00;
+            bRising = false;
+        }
+    }
+    else
+    {
+        //
+        // The transition we care for is on 25th bit.
+        // Prepare to delay 19 bits past the start of the transaction
+        // before getting into polling - to leave some
+        // margin for compiler related variations
+        //
+        ui32DelayTime = ((19 * AM_HAL_CLKGEN_FREQ_MAX_HZ) / (ui32HiFreq * 3));
+        ui32FirstWord = ((ui32Options & 0xFF00) << 16);
+        if ( ui32FirstWord & 0x80000000 )
+        {
+            bRising = true;
+        }
+        else
+        {
+            ui32FirstWord |= 0x00FFFF00;
+            bRising = false;
+        }
+    }
+
+    //
+    // Now that weve taken care of the offset byte, we can run the
+    // transaction in RAW mode.
+    //
+    ui32Options |= AM_HAL_IOM_RAW;
+
+    ui32NumBytes += 4;
+
+    //
+    // Figure out how many bytes we can write to the FIFO immediately.
+    //
+    ui32TransferSize = (ui32NumBytes <= ui32MaxFifoSize ? ui32NumBytes :
+                        ui32MaxFifoSize);
+
+    am_hal_iom_fifo_write(WORKAROUND_IOM, &ui32FirstWord, 4);
+
+    am_hal_iom_fifo_write(WORKAROUND_IOM, pui32Data, ui32TransferSize - 4);
+
+    //
+    // Calculate the GPIO to be controlled until the initial shift is
+    // complete. Make sure we get a valid value.
+    //
+    ui32IOMGPIO = iom_calc_gpio(ui32ChipSelect);
+    am_hal_debug_assert(0xDEADBEEF != ui32IOMGPIO);
+
+    //
+    // Save the locations and values of the CS pin configuration
+    // information.
+    //
+    pui32CSPadreg = (volatile uint32_t *)AM_HAL_GPIO_PADREG(ui32IOMGPIO);
+    ui32CSPadregVal = *pui32CSPadreg;
+
+    //
+    // Switch CS to a GPIO.
+    //
+    am_hal_gpio_out_bit_set(ui32IOMGPIO);
+    am_hal_gpio_pin_config(ui32IOMGPIO, AM_HAL_GPIO_OUTPUT);
+
+    //
+    // Enable the input buffer on MOSI.
+    //
+    am_hal_gpio_pin_config(WORKAROUND_IOM_MOSI_PIN, WORKAROUND_IOM_MOSI_CFG | AM_HAL_PIN_DIR_INPUT);
+
+    //
+    // Write the GPIO PADKEY register to allow the workaround loop to
+    // reconfigure chip enable.
+    //
+    AM_REGn(GPIO, 0, PADKEY) = AM_REG_GPIO_PADKEY_KEYVAL;
+    // Preconstruct the command - to save on calculations inside critical section
+    ui32Command = internal_am_hal_iom_spi_cmd_construct(AM_HAL_IOM_WRITE,
+                        ui32ChipSelect, ui32NumBytes, ui32Options);
+    internal_iom_workaround_critical(ui32Command,
+            pui32CSPadreg, ui32CSPadregVal,
+            ui32DelayTime, ui32ClkCfg,
+            ui32LowClkCfg, bRising);
+
+    //
+    // Update the pointer and data counter.
+    //
+    ui32NumBytes -= ui32TransferSize;
+    pui32Data += (ui32TransferSize - 4) >> 2;
+}
+
+//*****************************************************************************
+//
+//! @brief Implement an iterative spin loop.
+//!
+//! @param ui32Iterations - Number of iterations to delay.
+//!
+//! Use this function to implement a CPU busy waiting spin.  For Apollo, this
+//! delay can be used for timing purposes since for Apollo, each iteration will
+//! take 3 cycles.
+//!
+//! @return None.
+//
+//*****************************************************************************
+#if defined(__GNUC_STDC_INLINE__)
+static void __attribute__((naked))
+iom_workaround_loop(uint32_t ui32PadRegVal, volatile uint32_t *pui32PadReg,
+                    bool bRising)
+{
+    //
+    // Check to see if this is a "rising edge" or "falling edge" detector.
+    //
+    __asm("    cbz      r2, falling_edge");
+
+    //
+    // Read GPIO pin 44, and loop until it's HIGH.
+    //
+    __asm("rising_edge:");
+    __asm("    ldr      r2, =0x40010084");
+    __asm("rising_check_mosi:");
+    __asm("    ldr      r3, [r2]");
+    __asm("    ands     r3, r3, #0x1000");
+    __asm("    beq      rising_check_mosi");
+
+    //
+    // Write the PADREG Value to the PADREG register.
+    //
+    __asm("    str     r0, [r1]");
+    __asm("    bx      lr");
+
+    //
+    // Read GPIO pin 44, and loop until it's LOW.
+    //
+    __asm("falling_edge:");
+    __asm("    ldr      r2, =0x40010084");
+    __asm("falling_check_mosi:");
+    __asm("    ldr      r3, [r2]");
+    __asm("    ands     r3, r3, #0x1000");
+    __asm("    bne      falling_check_mosi");
+
+    //
+    // Write the PADREG Value to the PADREG register.
+    //
+    __asm("    str     r0, [r1]");
+    __asm("    bx      lr");
+}
+#endif
+#ifdef keil
+__asm static void
+iom_workaround_loop(uint32_t ui32PadRegVal, volatile uint32_t *pui32PadReg,
+                    bool bRising)
+{
+    //
+    // Check to see if this is a "rising edge" or "falling edge" detector.
+    //
+    cbz      r2, falling_edge
+
+    //
+    // Read GPIO pin 44, and loop until it's HIGH.
+    //
+rising_edge
+    ldr      r2, =0x40010084
+rising_check_mosi
+    ldr      r3, [r2]
+    ands     r3, r3, #0x1000
+    beq      rising_check_mosi
+
+    //
+    // Write the PADREG Value to the PADREG register.
+    //
+    str     r0, [r1]
+    bx      lr
+
+    //
+    // Read GPIO pin 44, and loop until it's LOW.
+    //
+falling_edge
+    ldr      r2, =0x40010084
+falling_check_mosi
+    ldr      r3, [r2]
+    ands     r3, r3, #0x1000
+    bne      falling_check_mosi
+
+    //
+    // Write the PADREG Value to the PADREG register.
+    //
+    str     r0, [r1]
+    bx      lr
+    nop
+}
+#endif
+#ifdef iar
+static void
+iom_workaround_loop(uint32_t ui32PadRegVal, volatile uint32_t *pui32PadReg,
+                    bool bRising)
+{
+    //
+    // Check to see if this is a "rising edge" or "falling edge" detector.
+    //
+    asm(
+    "    cbz      r2, falling_edge\n"
+
+    //
+    // Read GPIO pin 44, and loop until it's HIGH.
+    //
+    "rising_edge:\n"
+    "    mov32    r2, #0x40010084\n"
+    "rising_check_mosi:\n"
+    "    ldr      r3, [r2]\n"
+    "    ands     r3, r3, #0x1000\n"
+    "    beq      rising_check_mosi\n"
+
+    //
+    // Write the PADREG Value to the PADREG register.
+    //
+    "    str     r0, [r1]\n"
+    "    bx      lr\n"
+
+    //
+    // Read GPIO pin 44, and loop until it's LOW.
+    //
+    "falling_edge:\n"
+    "    mov32    r2, #0x40010084\n"
+    "falling_check_mosi:\n"
+    "    ldr      r3, [r2]\n"
+    "    ands     r3, r3, #0x1000\n"
+    "    bne      falling_check_mosi\n"
+
+    //
+    // Write the PADREG Value to the PADREG register.
+    //
+    "    str     r0, [r1]\n"
+    "    bx      lr"
+    );
+}
+#endif
+
+//*****************************************************************************
+//
+//! @brief Perform a simple write to the SPI interface.
+//!
+//! @param ui32Module - Module number for the IOM
+//! @param ui32ChipSelect - Chip-select number for this transaction.
+//! @param pui32Data - Pointer to the bytes that will be sent.
+//! @param ui32NumBytes - Number of bytes to send.
+//! @param ui32Options - Additional SPI transfer options.
+//!
+//! This function performs SPI writes to a selected SPI device.
+//!
+//! @note The actual SPI and I2C interfaces operate in BYTES, not 32-bit words.
+//! This means that you will need to byte-pack the \e pui32Data array with the
+//! data you intend to send over the interface. One easy way to do this is to
+//! declare the array as a 32-bit integer array, but use an 8-bit pointer to
+//! put your actual data into the array. If there are not enough bytes in your
+//! desired message to completely fill the last 32-bit word, you may pad that
+//! last word with bytes of any value. The IOM hardware will only read the
+//! first \e ui32NumBytes in the \e pui8Data array.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_iom_spi_write(uint32_t ui32Module, uint32_t ui32ChipSelect,
+                     uint32_t *pui32Data, uint32_t ui32NumBytes,
+                     uint32_t ui32Options)
+{
+    //
+    // Validate parameters
+    //
+    am_hal_debug_assert_msg(ui32Module < AM_REG_IOMSTR_NUM_MODULES,
+                            "Trying to use an IOM module that doesn't exist.");
+    am_hal_debug_assert_msg(ui32NumBytes > 0,
+                            "Trying to do a 0 byte transaction");
+
+    //
+    // Check to see if queues have been enabled. If they are, we'll actually
+    // switch to the queued interface.
+    //
+    if ( g_psIOMQueue[ui32Module].pui8Data != NULL )
+    {
+        //
+        // If the queue is on, go ahead and add this transaction to the queue.
+        //
+        am_hal_iom_queue_spi_write(ui32Module, ui32ChipSelect, pui32Data,
+                                   ui32NumBytes, ui32Options, 0);
+
+        //
+        // Wait until the transaction actually clears.
+        //
+        am_hal_iom_queue_flush(ui32Module);
+
+        //
+        // At this point, we've completed the transaction, and we can return.
+        //
+        return;
+    }
+    else
+    {
+        //
+        // Otherwise, we'll just do a polled transaction.
+        //
+        am_hal_iom_spi_write_nq(ui32Module, ui32ChipSelect, pui32Data,
+                                ui32NumBytes, ui32Options);
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Perform simple SPI read operations.
+//!
+//! @param ui32Module - Module number for the IOM
+//! @param ui32ChipSelect - Chip-select number for this transaction.
+//! @param pui32Data - Pointer to the array where received bytes should go.
+//! @param ui32NumBytes - Number of bytes to read.
+//! @param ui32Options - Additional SPI transfer options.
+//!
+//! This function performs simple SPI read operations. The caller is
+//! responsible for ensuring that the receive buffer is large enough to hold
+//! the requested amount of data.
+//!
+//! @note The actual SPI and I2C interfaces operate in BYTES, not 32-bit words.
+//! This function will pack the individual bytes from the physical interface
+//! into 32-bit words, which are then placed into the \e pui32Data array. Only
+//! the first \e ui32NumBytes bytes in this array will contain valid data.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_iom_spi_read(uint32_t ui32Module, uint32_t ui32ChipSelect,
+                    uint32_t *pui32Data, uint32_t ui32NumBytes,
+                    uint32_t ui32Options)
+{
+    //
+    // Validate parameters
+    //
+    am_hal_debug_assert_msg(ui32Module < AM_REG_IOMSTR_NUM_MODULES,
+                            "Trying to use an IOM module that doesn't exist.");
+    am_hal_debug_assert_msg(ui32NumBytes > 0,
+                            "Trying to do a 0 byte transaction");
+
+    //
+    // Make sure the transfer isn't too long for the hardware to support.
+    //
+    am_hal_debug_assert_msg(ui32NumBytes < 4096, "SPI transfer too big.");
+
+    //
+    // Check to see if queues have been enabled. If they are, we'll actually
+    // switch to the queued interface.
+    //
+    if ( g_psIOMQueue[ui32Module].pui8Data != NULL )
+    {
+        //
+        // If the queue is on, go ahead and add this transaction to the queue.
+        //
+        am_hal_iom_queue_spi_read(ui32Module, ui32ChipSelect, pui32Data,
+                                  ui32NumBytes, ui32Options, 0);
+
+        //
+        // Wait until the transaction actually clears.
+        //
+        am_hal_iom_queue_flush(ui32Module);
+
+        //
+        // At this point, we've completed the transaction, and we can return.
+        //
+        return;
+    }
+    else
+    {
+        //
+        // Otherwise, just perform a polled transaction.
+        //
+        am_hal_iom_spi_read_nq(ui32Module, ui32ChipSelect, pui32Data,
+                               ui32NumBytes, ui32Options);
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Perform a simple write to the SPI interface (without queuing)
+//!
+//! @param ui32Module - Module number for the IOM
+//! @param ui32ChipSelect - Chip-select number for this transaction.
+//! @param pui32Data - Pointer to the bytes that will be sent.
+//! @param ui32NumBytes - Number of bytes to send.
+//! @param ui32Options - Additional SPI transfer options.
+//!
+//! This function performs SPI writes to a selected SPI device.
+//!
+//! @note The actual SPI and I2C interfaces operate in BYTES, not 32-bit words.
+//! This means that you will need to byte-pack the \e pui32Data array with the
+//! data you intend to send over the interface. One easy way to do this is to
+//! declare the array as a 32-bit integer array, but use an 8-bit pointer to
+//! put your actual data into the array. If there are not enough bytes in your
+//! desired message to completely fill the last 32-bit word, you may pad that
+//! last word with bytes of any value. The IOM hardware will only read the
+//! first \e ui32NumBytes in the \e pui8Data array.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_iom_spi_write_nq(uint32_t ui32Module, uint32_t ui32ChipSelect,
+                        uint32_t *pui32Data, uint32_t ui32NumBytes,
+                        uint32_t ui32Options)
+{
+    uint32_t ui32TransferSize;
+    uint32_t ui32SpaceInFifo;
+    uint32_t ui32IntConfig;
+    uint32_t ui32MaxFifoSize;
+
+    //
+    // Validate parameters
+    //
+    am_hal_debug_assert_msg(ui32Module < AM_REG_IOMSTR_NUM_MODULES,
+                            "Trying to use an IOM module that doesn't exist.");
+    am_hal_debug_assert_msg(ui32NumBytes > 0,
+                            "Trying to do a 0 byte transaction");
+
+    //
+    // Make sure the transfer isn't too long for the hardware to support.
+    //
+    am_hal_debug_assert_msg(ui32NumBytes < 4096, "SPI transfer too big.");
+
+    ui32MaxFifoSize = ((0 == AM_BFRn(IOMSTR, ui32Module, CFG, FULLDUP)) ?
+                       AM_HAL_IOM_MAX_FIFO_SIZE : AM_HAL_IOM_MAX_FIFO_SIZE / 2);
+    //
+    // Wait until any earlier transactions have completed.
+    //
+    am_hal_iom_poll_complete(ui32Module);
+    //
+    // Disable interrupts so that we don't get any undesired interrupts.
+    //
+    ui32IntConfig = AM_REGn(IOMSTR, ui32Module, INTEN);
+    AM_REGn(IOMSTR, ui32Module, INTEN) = 0;
+    // Clear CMDCMP status
+    AM_BFWn(IOMSTR, ui32Module, INTCLR, CMDCMP, 1);
+
+    //
+    // If we're on a B0 part, and we're using IOM4, our first byte coule be
+    // corrupted, so we need to send a dummy word with chip-select held high to
+    // get that first byte out of the way.
+    //
+    // That operation is tricky and detailed, so we'll call a function to do it
+    // for us.
+    //
+    if ( WORKAROUND_IOM == ui32Module && isRevB0() )
+    {
+        am_hal_iom_workaround_word_write(ui32ChipSelect, pui32Data,
+                                         ui32NumBytes, ui32Options);
+        //
+        // The workaround function is going to a partial transfer for us, but
+        // we have to keep our own data-tracking variables updated. Here, we're
+        // subtracting 4 bytes from the effective transfer size to account for
+        // the 4 bytes of "dummy" word that we sent instead of the actual data.
+        //
+        ui32TransferSize = (ui32NumBytes <= (ui32MaxFifoSize - 4) ? ui32NumBytes :
+                            (ui32MaxFifoSize - 4));
+    }
+    else
+    {
+        //
+        // Figure out how many bytes we can write to the FIFO immediately.
+        //
+        ui32TransferSize = (ui32NumBytes <= ui32MaxFifoSize ? ui32NumBytes :
+                            ui32MaxFifoSize);
+        //
+        // write our first word to the fifo.
+        //
+
+        am_hal_iom_fifo_write(ui32Module, pui32Data, ui32TransferSize);
+
+        //
+        // Start the write on the bus.
+        //
+        am_hal_iom_spi_cmd_run(AM_HAL_IOM_WRITE, ui32Module, ui32ChipSelect,
+                               ui32NumBytes, ui32Options);
+    }
+
+    //
+    // Update the pointer and data counter.
+    //
+    ui32NumBytes -= ui32TransferSize;
+    pui32Data += ui32TransferSize >> 2;
+
+    //
+    // Keep looping until we're out of bytes to send or command complete (error).
+    //
+    while ( ui32NumBytes && !AM_BFRn(IOMSTR, ui32Module, INTSTAT, CMDCMP) )
+    {
+        //
+        // This will always return a multiple of four.
+        //
+        ui32SpaceInFifo =  am_hal_iom_fifo_empty_slots(ui32Module);
+
+        if ( ui32NumBytes <= ui32SpaceInFifo )
+        {
+            //
+            // If the entire message will fit in the fifo, prepare to copy
+            // everything.
+            //
+            ui32TransferSize = ui32NumBytes;
+        }
+        else
+        {
+            //
+            // If only a portion of the message will fit in the fifo, prepare
+            // to copy the largest number of 4-byte blocks possible.
+            //
+            ui32TransferSize = ui32SpaceInFifo & ~(0x3);
+        }
+
+        //
+        // Write this chunk to the fifo.
+        //
+        am_hal_iom_fifo_write(ui32Module, pui32Data, ui32TransferSize);
+
+        //
+        // Update the data pointer and bytes-left count.
+        //
+        ui32NumBytes -= ui32TransferSize;
+        pui32Data += ui32TransferSize >> 2;
+    }
+
+    //
+    // Make sure CMDCMP was raised,
+    //
+    while ( !AM_BFRn(IOMSTR, ui32Module, INTSTAT, CMDCMP) );
+
+    //
+    // Re-enable IOM interrupts. Make sure CMDCMP is cleared
+    //
+    AM_REGn(IOMSTR, ui32Module, INTCLR) = (ui32IntConfig | AM_REG_IOMSTR_INTSTAT_CMDCMP_M);
+    AM_REGn(IOMSTR, ui32Module, INTEN) = ui32IntConfig;
+
+}
+
+//*****************************************************************************
+//
+//! @brief Perform simple SPI read operations (without queuing).
+//!
+//! @param ui32Module - Module number for the IOM
+//! @param ui32ChipSelect - Chip-select number for this transaction.
+//! @param pui32Data - Pointer to the array where received bytes should go.
+//! @param ui32NumBytes - Number of bytes to read.
+//! @param ui32Options - Additional SPI transfer options.
+//!
+//! This function performs simple SPI read operations. The caller is
+//! responsible for ensuring that the receive buffer is large enough to hold
+//! the requested amount of data.
+//!
+//! @note The actual SPI and I2C interfaces operate in BYTES, not 32-bit words.
+//! This function will pack the individual bytes from the physical interface
+//! into 32-bit words, which are then placed into the \e pui32Data array. Only
+//! the first \e ui32NumBytes bytes in this array will contain valid data.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_iom_spi_read_nq(uint32_t ui32Module, uint32_t ui32ChipSelect,
+                       uint32_t *pui32Data, uint32_t ui32NumBytes,
+                       uint32_t ui32Options)
+{
+    uint32_t ui32BytesInFifo;
+    uint32_t ui32IntConfig;
+    uint32_t bCmdCmp = false;
+
+    //
+    // Validate parameters
+    //
+    am_hal_debug_assert_msg(ui32Module < AM_REG_IOMSTR_NUM_MODULES,
+                            "Trying to use an IOM module that doesn't exist.");
+    am_hal_debug_assert_msg(ui32NumBytes > 0,
+                            "Trying to do a 0 byte transaction");
+
+    //
+    // Make sure the transfer isn't too long for the hardware to support.
+    //
+    am_hal_debug_assert_msg(ui32NumBytes < 4096, "SPI transfer too big.");
+
+    //
+    // Wait until the bus is idle, then start the requested READ transfer on
+    // the physical interface.
+    //
+    am_hal_iom_poll_complete(ui32Module);
+
+    //
+    // Disable interrupts so that we don't get any undesired interrupts.
+    //
+    ui32IntConfig = AM_REGn(IOMSTR, ui32Module, INTEN);
+
+    //
+    // Disable IOM interrupts as we'll be polling
+    //
+    AM_REGn(IOMSTR, ui32Module, INTEN) = 0;
+
+    //
+    // Clear CMDCMP status
+    //
+    AM_BFWn(IOMSTR, ui32Module, INTCLR, CMDCMP, 1);
+
+    //
+    // If we're on a B0 part, and we're using IOM4, our first byte coule be
+    // corrupted, so we need to send a dummy word with chip-select held high to
+    // get that first byte out of the way. This is only true for spi reads with
+    // OFFSET values.
+    //
+    // That operation is tricky and detailed, so we'll call a function to do it
+    // for us.
+    //
+    if ( (WORKAROUND_IOM == ui32Module) && !(ui32Options & AM_HAL_IOM_RAW) &&
+        isRevB0() )
+    {
+        am_hal_iom_workaround_word_write(ui32ChipSelect, pui32Data, 0,
+                                         ui32Options | AM_HAL_IOM_CS_LOW);
+
+        //
+        // The workaround will send our offset for us, so we can run a RAW
+        // command after.
+        //
+        ui32Options |= AM_HAL_IOM_RAW;
+        //
+        // Wait for the dummy word to go out over the bus.
+        //
+        // Make sure the command complete has also been raised
+        while ( !AM_BFRn(IOMSTR, ui32Module, INTSTAT, CMDCMP) );
+        // Clear CMDCMP status
+        AM_BFWn(IOMSTR, ui32Module, INTCLR, CMDCMP, 1);
+    }
+
+    am_hal_iom_spi_cmd_run(AM_HAL_IOM_READ, ui32Module, ui32ChipSelect,
+                           ui32NumBytes, ui32Options);
+
+    //
+    // Start a loop to catch the Rx data.
+    //
+    while ( ui32NumBytes )
+    {
+        ui32BytesInFifo =  am_hal_iom_fifo_full_slots(ui32Module);
+
+        if ( ui32BytesInFifo >= ui32NumBytes )
+        {
+            //
+            // If the fifo contains our entire message, just copy the whole
+            // thing out.
+            //
+            am_hal_iom_fifo_read(ui32Module, pui32Data, ui32NumBytes);
+            ui32NumBytes = 0;
+        }
+        else if ( ui32BytesInFifo >= 4 )
+        {
+            //
+            // If the fifo has at least one 32-bit word in it, copy whole
+            // words out.
+            //
+            am_hal_iom_fifo_read(ui32Module, pui32Data, ui32BytesInFifo & ~0x3);
+            ui32NumBytes -= ui32BytesInFifo & ~0x3;
+            pui32Data += ui32BytesInFifo >> 2;
+        }
+        if ( bCmdCmp == true )
+        {
+            //
+            // No more data expected. Get out of the loop
+            //
+            break;
+        }
+
+        bCmdCmp = AM_BFRn(IOMSTR, ui32Module, INTSTAT, CMDCMP);
+    }
+
+    //
+    // Make sure CMDCMP was raised,
+    //
+    while ( !AM_BFRn(IOMSTR, ui32Module, INTSTAT, CMDCMP) );
+
+    //
+    // Re-enable IOM interrupts. Make sure CMDCMP is cleared
+    //
+    AM_REGn(IOMSTR, ui32Module, INTCLR) = (ui32IntConfig | AM_REG_IOMSTR_INTSTAT_CMDCMP_M);
+    AM_REGn(IOMSTR, ui32Module, INTEN) = ui32IntConfig;
+
+}
+
+//*****************************************************************************
+//
+//! @brief Perform a non-blocking write to the SPI interface.
+//!
+//! @param ui32Module - Module number for the IOM
+//! @param ui32ChipSelect - Chip-select number for this transaction.
+//! @param pui32Data - Pointer to the bytes that will be sent.
+//! @param ui32NumBytes - Number of bytes to send.
+//! @param ui32Options - Additional SPI transfer options.
+//! @param pfnCallback - Function to call when the transaction completes.
+//!
+//! This function performs SPI writes to the selected SPI device.
+//!
+//! This function call is a non-blocking implementation. It will write as much
+//! data to the FIFO as possible immediately, store a pointer to the remaining
+//! data, start the transfer on the bus, and then immediately return. The
+//! caller will need to make sure that \e am_hal_iom_int_service() is called
+//! for IOM FIFO interrupt events and "command complete" interrupt events. The
+//! \e am_hal_iom_int_service() function will refill the FIFO as necessary and
+//! call the \e pfnCallback function when the transaction is finished.
+//!
+//! @note The actual SPI and I2C interfaces operate in BYTES, not 32-bit words.
+//! This means that you will need to byte-pack the \e pui32Data array with the
+//! data you intend to send over the interface. One easy way to do this is to
+//! declare the array as a 32-bit integer array, but use an 8-bit pointer to
+//! put your actual data into the array. If there are not enough bytes in your
+//! desired message to completely fill the last 32-bit word, you may pad that
+//! last word with bytes of any value. The IOM hardware will only read the
+//! first \e ui32NumBytes in the \e pui8Data array.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_iom_spi_write_nb(uint32_t ui32Module, uint32_t ui32ChipSelect,
+                        uint32_t *pui32Data, uint32_t ui32NumBytes,
+                        uint32_t ui32Options,
+                        am_hal_iom_callback_t pfnCallback)
+{
+    uint32_t ui32TransferSize;
+    uint32_t ui32MaxFifoSize;
+
+    //
+    // Validate parameters
+    //
+    if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
+    {
+        return;
+    }
+
+    //
+    // Make sure the transfer isn't too long for the hardware to support.
+    //
+    am_hal_debug_assert_msg(ui32NumBytes < 4096, "SPI transfer too big.");
+    am_hal_debug_assert_msg(ui32NumBytes > 0,
+                            "Trying to do a 0 byte transaction");
+
+    ui32MaxFifoSize = ((0 == AM_BFRn(IOMSTR, ui32Module, CFG, FULLDUP)) ?
+                      AM_HAL_IOM_MAX_FIFO_SIZE : AM_HAL_IOM_MAX_FIFO_SIZE / 2);
+
+    //
+    // Wait until the bus is idle
+    //
+    am_hal_iom_poll_complete(ui32Module);
+
+    //
+    // Need to mark IOM busy to avoid another transaction to be scheduled.
+    // This is to take care of a race condition in Queue mode, where the IDLE
+    // set is not a guarantee that the CMDCMP has been received
+    //
+    g_bIomBusy[ui32Module] = true;
+
+    //
+    // Clear CMDCMP status
+    //
+    AM_BFWn(IOMSTR, ui32Module, INTCLR, CMDCMP, 1);
+
+    //
+    // Check to see if we need to do the workaround.
+    //
+    if ( WORKAROUND_IOM == ui32Module && isRevB0() )
+    {
+        //
+        // Figure out how many bytes we can write to the FIFO immediately,
+        // accounting for the extra word from the workaround.
+        //
+        ui32TransferSize = (ui32NumBytes <= (ui32MaxFifoSize - 4) ?  ui32NumBytes :
+                            (ui32MaxFifoSize - 4));
+
+        //
+        // Prepare the global IOM buffer structure.
+        //
+        g_psIOMBuffers[ui32Module].ui32State = BUFFER_SENDING;
+        g_psIOMBuffers[ui32Module].pui32Data = pui32Data + (ui32TransferSize / 4);
+        g_psIOMBuffers[ui32Module].ui32BytesLeft = ui32NumBytes - ui32TransferSize;
+        g_psIOMBuffers[ui32Module].pfnCallback = pfnCallback;
+        g_psIOMBuffers[ui32Module].ui32Options = ui32Options;
+
+        //
+        // Start the write on the bus using the workaround. This includes both
+        // the command write and the first fifo write, so we won't need to do
+        // either of those things manually.
+        //
+        am_hal_iom_workaround_word_write(ui32ChipSelect, pui32Data,
+                                         ui32NumBytes, ui32Options);
+    }
+    else
+    {
+        //
+        // Figure out how many bytes we can write to the FIFO immediately.
+        //
+        ui32TransferSize = (ui32NumBytes <= ui32MaxFifoSize ? ui32NumBytes :
+                            ui32MaxFifoSize);
+
+        if ( am_hal_iom_fifo_write(ui32Module, pui32Data, ui32TransferSize) > 0 )
+        {
+            //
+            // Prepare the global IOM buffer structure.
+            //
+            g_psIOMBuffers[ui32Module].ui32State = BUFFER_SENDING;
+            g_psIOMBuffers[ui32Module].pui32Data = pui32Data;
+            g_psIOMBuffers[ui32Module].ui32BytesLeft = ui32NumBytes;
+            g_psIOMBuffers[ui32Module].pfnCallback = pfnCallback;
+            g_psIOMBuffers[ui32Module].ui32Options = ui32Options;
+
+            //
+            // Update the pointer and the byte counter based on the portion of
+            // the transfer we just sent to the fifo.
+            //
+            g_psIOMBuffers[ui32Module].ui32BytesLeft -= ui32TransferSize;
+            g_psIOMBuffers[ui32Module].pui32Data += (ui32TransferSize / 4);
+
+            //
+            // Start the write on the bus.
+            //
+            am_hal_iom_spi_cmd_run(AM_HAL_IOM_WRITE, ui32Module, ui32ChipSelect,
+                                   ui32NumBytes, ui32Options);
+        }
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Perform a non-blocking SPI read.
+//!
+//! @param ui32Module - Module number for the IOM.
+//! @param ui32ChipSelect - Chip select number of the target device.
+//! @param pui32Data - Pointer to the array where received bytes should go.
+//! @param ui32NumBytes - Number of bytes to read.
+//! @param ui32Options - Additional SPI transfer options.
+//! @param pfnCallback - Function to call when the transaction completes.
+//!
+//! This function performs SPI reads to a selected SPI device.
+//!
+//! This function call is a non-blocking implementation. It will start the SPI
+//! transaction on the bus and store a pointer for the destination for the read
+//! data, but it will not wait for the SPI transaction to finish.  The caller
+//! will need to make sure that \e am_hal_iom_int_service() is called for IOM
+//! FIFO interrupt events and "command complete" interrupt events. The \e
+//! am_hal_iom_int_service() function will empty the FIFO as necessary,
+//! transfer the data to the \e pui32Data buffer, and call the \e pfnCallback
+//! function when the transaction is finished.
+//!
+//! @note The actual SPI and I2C interfaces operate in BYTES, not 32-bit words.
+//! This function will pack the individual bytes from the physical interface
+//! into 32-bit words, which are then placed into the \e pui32Data array. Only
+//! the first \e ui32NumBytes bytes in this array will contain valid data.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_iom_spi_read_nb(uint32_t ui32Module, uint32_t ui32ChipSelect,
+                       uint32_t *pui32Data, uint32_t ui32NumBytes,
+                       uint32_t ui32Options,
+                       am_hal_iom_callback_t pfnCallback)
+{
+    uint32_t ui32IntConfig;
+
+    //
+    // Validate parameters
+    //
+    am_hal_debug_assert_msg(ui32Module < AM_REG_IOMSTR_NUM_MODULES,
+                            "Trying to use an IOM module that doesn't exist.");
+    am_hal_debug_assert_msg(ui32NumBytes > 0,
+                            "Trying to do a 0 byte transaction");
+
+    //
+    // Make sure the transfer isn't too long for the hardware to support.
+    //
+    am_hal_debug_assert_msg(ui32NumBytes < 4096, "SPI transfer too big.");
+
+    //
+    // Wait until the bus is idle
+    //
+    am_hal_iom_poll_complete(ui32Module);
+
+    //
+    // Need to mark IOM busy to avoid another transaction to be scheduled.
+    // This is to take care of a race condition in Queue mode, where the IDLE
+    // set is not a guarantee that the CMDCMP has been received
+    //
+
+    g_bIomBusy[ui32Module] = true;
+
+    //
+    // Clear CMDCMP status
+    //
+    AM_BFWn(IOMSTR, ui32Module, INTCLR, CMDCMP, 1);
+
+    //
+    // If we're on a B0 part, and we're using IOM4, our first byte coule be
+    // corrupted, so we need to send a dummy word with chip-select held high to
+    // get that first byte out of the way. This is only true for spi reads with
+    // OFFSET values.
+    //
+    // That operation is tricky and detailed, so we'll call a function to do it
+    // for us.
+    //
+    if ( (WORKAROUND_IOM == ui32Module) && !(ui32Options & AM_HAL_IOM_RAW) &&
+        isRevB0() )
+    {
+        //
+        // We might mess up the interrupt handler behavior if we allow this
+        // polled transaction to complete with interrupts enabled. We'll
+        // briefly turn them off here.
+        //
+        ui32IntConfig = AM_REGn(IOMSTR, 4, INTEN);
+        AM_REGn(IOMSTR, 4, INTEN) = 0;
+
+        am_hal_iom_workaround_word_write(ui32ChipSelect, pui32Data,
+                                         0, ui32Options | AM_HAL_IOM_CS_LOW);
+
+        //
+        // The workaround will send our offset for us, so we can run a RAW
+        // command after.
+        //
+        ui32Options |= AM_HAL_IOM_RAW;
+
+        //
+        // Wait for the dummy word to go out over the bus.
+        //
+        // Make sure the command complete has also been raised
+        while ( !AM_BFRn(IOMSTR, ui32Module, INTSTAT, CMDCMP) );
+
+        //
+        // Re-mark IOM as busy
+        //
+
+        g_bIomBusy[ui32Module] = true;
+
+        //
+        // Re-enable IOM interrupts. Make sure CMDCMP is cleared
+        //
+        AM_REGn(IOMSTR, 4, INTCLR) = (ui32IntConfig | AM_REG_IOMSTR_INTSTAT_CMDCMP_M);
+        AM_REGn(IOMSTR, 4, INTEN) = ui32IntConfig;
+    }
+
+    //
+    // Prepare the global IOM buffer structure.
+    //
+    g_psIOMBuffers[ui32Module].ui32State = BUFFER_RECEIVING;
+    g_psIOMBuffers[ui32Module].pui32Data = pui32Data;
+    g_psIOMBuffers[ui32Module].ui32BytesLeft = ui32NumBytes;
+    g_psIOMBuffers[ui32Module].pfnCallback = pfnCallback;
+    g_psIOMBuffers[ui32Module].ui32Options = ui32Options;
+
+    //
+    // Start the read transaction on the bus.
+    //
+    am_hal_iom_spi_cmd_run(AM_HAL_IOM_READ, ui32Module, ui32ChipSelect,
+                           ui32NumBytes, ui32Options);
+}
+
+static uint32_t
+internal_am_hal_iom_spi_cmd_construct(uint32_t ui32Operation,
+                                      uint32_t ui32ChipSelect,
+                                      uint32_t ui32NumBytes,
+                                      uint32_t ui32Options)
+{
+    uint32_t ui32Command;
+    //
+    // Start building the command from the operation parameter.
+    //
+    ui32Command = ui32Operation;
+
+    //
+    // Set the transfer length (the length field is split, so this requires
+    // some swizzling).
+    //
+    ui32Command |= ((ui32NumBytes & 0xF00) << 15);
+    ui32Command |= (ui32NumBytes & 0xFF);
+
+    //
+    // Set the chip select number.
+    //
+    ui32Command |= ((ui32ChipSelect << 16) & 0x00070000);
+
+    //
+    // Finally, OR in the rest of the options. This mask should make sure that
+    // erroneous option values won't interfere with the other transfer
+    // parameters.
+    //
+    ui32Command |= ui32Options & 0x5C00FF00;
+    return ui32Command;
+}
+//*****************************************************************************
+//
+//! @brief Runs a SPI "command" through the IO master.
+//!
+//! @param ui32Operation - SPI action to be performed.
+//!
+//! @param psDevice - Structure containing information about the slave device.
+//!
+//! @param ui32NumBytes - Number of bytes to move (transmit or receive) with
+//! this command.
+//!
+//! @param ui32Options - Additional SPI options to apply to this command.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_iom_spi_cmd_run(uint32_t ui32Operation, uint32_t ui32Module,
+                       uint32_t ui32ChipSelect, uint32_t ui32NumBytes,
+                       uint32_t ui32Options)
+{
+    uint32_t ui32Command;
+
+    am_hal_debug_assert_msg(ui32NumBytes > 0,
+                            "Trying to do a 0 byte transaction");
+    ui32Command = internal_am_hal_iom_spi_cmd_construct(ui32Operation,
+                        ui32ChipSelect, ui32NumBytes, ui32Options);
+
+
+    //
+    // Write the complete command word to the IOM command register.
+    //
+    AM_REGn(IOMSTR, ui32Module, CMD) = ui32Command;
+}
+
+//*****************************************************************************
+//
+//! @brief Perform a simple write to the I2C interface (without queuing)
+//!
+//! @param ui32Module - Module number for the IOM.
+//! @param ui32BusAddress - I2C address of the target device.
+//! @param pui32Data - Pointer to the bytes that will be sent.
+//! @param ui32NumBytes - Number of bytes to send.
+//! @param ui32Options - Additional I2C transfer options.
+//!
+//! This function performs I2C writes to a selected I2C device.
+//!
+//! This function call is a blocking implementation. It will write as much
+//! data to the FIFO as possible immediately, and then refill the FIFO as data
+//! is transmiitted.
+//!
+//! @note The actual SPI and I2C interfaces operate in BYTES, not 32-bit words
+//! This means that you will need to byte-pack the \e pui32Data array with the
+//! data you intend to send over the interface. One easy way to do this is to
+//! declare the array as a 32-bit integer array, but use an 8-bit pointer to
+//! put your actual data into the array. If there are not enough bytes in your
+//! desired message to completely fill the last 32-bit word, you may pad that
+//! last word with bytes of any value. The IOM hardware will only read the
+//! first \e ui32NumBytes in the \e pui32Data array.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_iom_i2c_write_nq(uint32_t ui32Module, uint32_t ui32BusAddress,
+                        uint32_t *pui32Data, uint32_t ui32NumBytes,
+                        uint32_t ui32Options)
+{
+    uint32_t ui32TransferSize;
+    uint32_t ui32SpaceInFifo;
+    uint32_t ui32IntConfig;
+    uint32_t ui32MaxFifoSize;
+
+    //
+    // Validate parameters
+    //
+    if ( ui32Module > AM_REG_IOMSTR_NUM_MODULES )
+    {
+        return;
+    }
+    am_hal_debug_assert_msg(ui32NumBytes > 0,
+                            "Trying to do a 0 byte transaction");
+
+    //
+    // Redirect to the bit-bang interface if the module number matches the
+    // software I2C module.
+    //
+    if ( ui32Module == AM_HAL_IOM_I2CBB_MODULE )
+    {
+        if ( ui32Options & AM_HAL_IOM_RAW )
+        {
+            am_hal_i2c_bit_bang_send(ui32BusAddress << 1, ui32NumBytes,
+                                     (uint8_t *)pui32Data, 0, false,
+                                     (ui32Options & AM_HAL_IOM_NO_STOP));
+        }
+        else
+        {
+            am_hal_i2c_bit_bang_send(ui32BusAddress << 1, ui32NumBytes,
+                                     (uint8_t *)pui32Data,
+                                     ((ui32Options & 0xFF00) >> 8),
+                                     true,
+                                     (ui32Options & AM_HAL_IOM_NO_STOP));
+        }
+
+        //
+        // Return.
+        //
+        return;
+    }
+
+    //
+    // Make sure the transfer isn't too long for the hardware to support.
+    //
+    am_hal_debug_assert_msg(ui32NumBytes < 256, "I2C transfer too big.");
+
+    ui32MaxFifoSize = ((0 == AM_BFRn(IOMSTR, ui32Module, CFG, FULLDUP)) ?
+                      AM_HAL_IOM_MAX_FIFO_SIZE : AM_HAL_IOM_MAX_FIFO_SIZE / 2);
+
+    //
+    // Wait until any earlier transactions have completed.
+    //
+    am_hal_iom_poll_complete(ui32Module);
+
+    //
+    // Disable interrupts so that we don't get any undesired interrupts.
+    //
+    ui32IntConfig = AM_REGn(IOMSTR, ui32Module, INTEN);
+    AM_REGn(IOMSTR, ui32Module, INTEN) = 0;
+
+    //
+    // Clear CMDCMP status
+    //
+    AM_BFWn(IOMSTR, ui32Module, INTCLR, CMDCMP, 1);
+
+    //
+    // Figure out how many bytes we can write to the FIFO immediately.
+    //
+    ui32TransferSize = (ui32NumBytes <= ui32MaxFifoSize ? ui32NumBytes :
+                        ui32MaxFifoSize);
+
+    am_hal_iom_fifo_write(ui32Module, pui32Data, ui32TransferSize);
+
+    //
+    // Start the write on the bus.
+    //
+    am_hal_iom_i2c_cmd_run(AM_HAL_IOM_WRITE, ui32Module, ui32BusAddress,
+                           ui32NumBytes, ui32Options);
+
+    //
+    // Update the pointer and data counter.
+    //
+    ui32NumBytes -= ui32TransferSize;
+    pui32Data += ui32TransferSize >> 2;
+
+    //
+    // Keep looping until we're out of bytes to send or command complete (error).
+    //
+    while ( ui32NumBytes && !AM_BFRn(IOMSTR, ui32Module, INTSTAT, CMDCMP) )
+    {
+        //
+        // This will always return a multiple of four.
+        //
+        ui32SpaceInFifo =  am_hal_iom_fifo_empty_slots(ui32Module);
+
+        if ( ui32NumBytes <= ui32SpaceInFifo )
+        {
+            //
+            // If the entire message will fit in the fifo, prepare to copy
+            // everything.
+            //
+            ui32TransferSize = ui32NumBytes;
+        }
+        else
+        {
+            //
+            // If only a portion of the message will fit in the fifo, prepare
+            // to copy the largest number of 4-byte blocks possible.
+            //
+            ui32TransferSize = ui32SpaceInFifo;
+        }
+
+        //
+        // Write this chunk to the fifo.
+        //
+        am_hal_iom_fifo_write(ui32Module, pui32Data, ui32TransferSize);
+
+        //
+        // Update the data pointer and bytes-left count.
+        //
+        ui32NumBytes -= ui32TransferSize;
+        pui32Data += ui32TransferSize >> 2;
+    }
+
+    //
+    // Make sure CMDCMP was raised,
+    //
+    while ( !AM_BFRn(IOMSTR, ui32Module, INTSTAT, CMDCMP) );
+
+    //
+    // Re-enable IOM interrupts. Make sure CMDCMP is cleared
+    //
+    AM_REGn(IOMSTR, ui32Module, INTCLR) = (ui32IntConfig | AM_REG_IOMSTR_INTSTAT_CMDCMP_M);
+    AM_REGn(IOMSTR, ui32Module, INTEN) = ui32IntConfig;
+}
+
+//*****************************************************************************
+//
+//! @brief Perform simple I2C read operations (without queuing).
+//!
+//! @param ui32Module - Module number for the IOM.
+//! @param ui32BusAddress - I2C address of the target device.
+//! @param pui32Data - Pointer to the array where received bytes should go.
+//! @param ui32NumBytes - Number of bytes to read.
+//! @param ui32Options - Additional I2C transfer options.
+//!
+//! This function performs an I2C read to a selected I2C device.
+//!
+//! This function call is a blocking implementation. It will read as much
+//! data from the FIFO as possible immediately, and then re-read the FIFO as more
+//! data is available.
+//!
+//! @note The actual SPI and I2C interfaces operate in BYTES, not 32-bit words.
+//! This function will pack the individual bytes from the physical interface
+//! into 32-bit words, which are then placed into the \e pui32Data array. Only
+//! the first \e ui32NumBytes bytes in this array will contain valid data.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_iom_i2c_read_nq(uint32_t ui32Module, uint32_t ui32BusAddress,
+                       uint32_t *pui32Data, uint32_t ui32NumBytes,
+                       uint32_t ui32Options)
+{
+    uint32_t ui32BytesInFifo;
+    uint32_t ui32IntConfig;
+    uint32_t bCmdCmp = false;
+
+    //
+    // Validate parameters
+    //
+    if ( ui32Module > AM_REG_IOMSTR_NUM_MODULES )
+    {
+        return;
+    }
+    am_hal_debug_assert_msg(ui32NumBytes > 0,
+                            "Trying to do a 0 byte transaction");
+
+    //
+    // Redirect to the bit-bang interface if the module number matches the
+    // software I2C module.
+    //
+    if ( ui32Module == AM_HAL_IOM_I2CBB_MODULE )
+    {
+        if ( ui32Options & AM_HAL_IOM_RAW )
+        {
+            am_hal_i2c_bit_bang_receive((ui32BusAddress << 1) | 1, ui32NumBytes,
+                                        (uint8_t *)pui32Data, 0, false,
+                                        (ui32Options & AM_HAL_IOM_NO_STOP));
+        }
+        else
+        {
+            am_hal_i2c_bit_bang_receive((ui32BusAddress << 1) | 1, ui32NumBytes,
+                                        (uint8_t *)pui32Data,
+                                        ((ui32Options & 0xFF00) >> 8),
+                                        true,
+                                        (ui32Options & AM_HAL_IOM_NO_STOP));
+        }
+
+        //
+        // Return.
+        //
+        return;
+    }
+
+    //
+    // Make sure the transfer isn't too long for the hardware to support.
+    //
+    am_hal_debug_assert_msg(ui32NumBytes < 256, "I2C transfer too big.");
+
+    //
+    // Wait until the bus is idle
+    //
+    am_hal_iom_poll_complete(ui32Module);
+
+    //
+    // Disable interrupts so that we don't get any undesired interrupts.
+    //
+    ui32IntConfig = AM_REGn(IOMSTR, ui32Module, INTEN);
+    AM_REGn(IOMSTR, ui32Module, INTEN) = 0;
+
+    //
+    // Clear CMDCMP status
+    //
+    AM_BFWn(IOMSTR, ui32Module, INTCLR, CMDCMP, 1);
+
+    am_hal_iom_i2c_cmd_run(AM_HAL_IOM_READ, ui32Module, ui32BusAddress,
+                           ui32NumBytes, ui32Options);
+
+    //
+    // Start a loop to catch the Rx data.
+    //
+    while ( ui32NumBytes )
+    {
+        ui32BytesInFifo =  am_hal_iom_fifo_full_slots(ui32Module);
+
+        if ( ui32BytesInFifo >= ui32NumBytes )
+        {
+            //
+            // If the fifo contains our entire message, just copy the whole
+            // thing out.
+            //
+            am_hal_iom_fifo_read(ui32Module, pui32Data, ui32NumBytes);
+            ui32NumBytes = 0;
+        }
+        else if ( ui32BytesInFifo >= 4 )
+        {
+            //
+            // If the fifo has at least one 32-bit word in it, copy whole
+            // words out.
+            //
+            am_hal_iom_fifo_read(ui32Module, pui32Data, ui32BytesInFifo & ~0x3);
+
+            ui32NumBytes -= ui32BytesInFifo & ~0x3;
+            pui32Data += ui32BytesInFifo >> 2;
+        }
+
+        if ( bCmdCmp == true )
+        {
+            // No more data expected - exit out of loop
+            break;
+        }
+
+        bCmdCmp = AM_BFRn(IOMSTR, ui32Module, INTSTAT, CMDCMP);
+    }
+
+    //
+    // Make sure CMDCMP was raised,
+    //
+    while ( !AM_BFRn(IOMSTR, ui32Module, INTSTAT, CMDCMP) );
+
+    //
+    // Re-enable IOM interrupts. Make sure CMDCMP is cleared
+    //
+    AM_REGn(IOMSTR, ui32Module, INTCLR) = (ui32IntConfig | AM_REG_IOMSTR_INTSTAT_CMDCMP_M);
+    AM_REGn(IOMSTR, ui32Module, INTEN) = ui32IntConfig;
+}
+
+//*****************************************************************************
+//
+//! @brief Perform a simple write to the I2C interface.
+//!
+//! @param ui32Module - Module number for the IOM
+//! @param ui32BusAddress - I2C bus address for this transaction.
+//! @param pui32Data - Pointer to the bytes that will be sent.
+//! @param ui32NumBytes - Number of bytes to send.
+//! @param ui32Options - Additional options
+//!
+//! Performs a write to the I2C interface using the provided parameters.
+//!
+//! See the "Command Options" section for parameters that may be ORed together
+//! and used in the \b ui32Options parameter.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_iom_i2c_write(uint32_t ui32Module, uint32_t ui32BusAddress,
+                     uint32_t *pui32Data, uint32_t ui32NumBytes,
+                     uint32_t ui32Options)
+{
+    //
+    // Validate parameters
+    //
+    if ( ui32Module > AM_REG_IOMSTR_NUM_MODULES )
+    {
+        return;
+    }
+    am_hal_debug_assert_msg(ui32NumBytes > 0,
+                            "Trying to do a 0 byte transaction");
+
+    //
+    // Redirect to the bit-bang interface if the module number matches the
+    // software I2C module.
+    //
+    if ( ui32Module == AM_HAL_IOM_I2CBB_MODULE )
+    {
+        if ( ui32Options & AM_HAL_IOM_RAW )
+        {
+            am_hal_i2c_bit_bang_send(ui32BusAddress << 1, ui32NumBytes,
+                                     (uint8_t *)pui32Data, 0, false,
+                                     (ui32Options & AM_HAL_IOM_NO_STOP));
+        }
+        else
+        {
+            am_hal_i2c_bit_bang_send(ui32BusAddress << 1, ui32NumBytes,
+                                     (uint8_t *)pui32Data,
+                                     ((ui32Options & 0xFF00) >> 8),
+                                     true,
+                                     (ui32Options & AM_HAL_IOM_NO_STOP));
+        }
+
+        //
+        // Return.
+        //
+        return;
+    }
+
+    //
+    // Make sure the transfer isn't too long for the hardware to support.
+    //
+    am_hal_debug_assert_msg(ui32NumBytes < 256, "I2C transfer too big.");
+
+    //
+    // Check to see if queues have been enabled. If they are, we'll actually
+    // switch to the queued interface.
+    //
+    if ( g_psIOMQueue[ui32Module].pui8Data != NULL )
+    {
+        //
+        // If the queue is on, go ahead and add this transaction to the queue.
+        //
+        am_hal_iom_queue_i2c_write(ui32Module, ui32BusAddress, pui32Data,
+                                   ui32NumBytes, ui32Options, 0);
+
+        //
+        // Wait until the transaction actually clears.
+        //
+        am_hal_iom_queue_flush(ui32Module);
+
+        //
+        // At this point, we've completed the transaction, and we can return.
+        //
+        return;
+    }
+    else
+    {
+        //
+        // Otherwise, we'll just do a polled transaction.
+        //
+        am_hal_iom_i2c_write_nq(ui32Module, ui32BusAddress, pui32Data,
+                                ui32NumBytes, ui32Options);
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Perform simple I2C read operations.
+//!
+//! @param ui32Module - Module number for the IOM
+//! @param ui32BusAddress - I2C bus address for this transaction.
+//! @param pui32Data - Pointer to the array where received bytes should go.
+//! @param ui32NumBytes - Number of bytes to read.
+//! @param ui32Options - Additional I2C transfer options.
+//!
+//! This function performs simple I2C read operations. The caller is
+//! responsible for ensuring that the receive buffer is large enough to hold
+//! the requested amount of data. If \e bPolled is true, this function will
+//! block until all of the requested data has been received and placed in the
+//! user-supplied buffer. Otherwise, the function will execute the I2C read
+//! command and return immediately. The user-supplied buffer will be filled
+//! with the received I2C data as it comes in over the physical interface, and
+//! the "command complete" interrupt bit will become active once the entire
+//! message is available.
+//!
+//! See the "Command Options" section for parameters that may be ORed together
+//! and used in the \b ui32Options parameter.
+//!
+//! @note The actual SPI and I2C interfaces operate in BYTES, not 32-bit words.
+//! This function will pack the individual bytes from the physical interface
+//! into 32-bit words, which are then placed into the \e pui32Data array. Only
+//! the first \e ui32NumBytes bytes in this array will contain valid data.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_iom_i2c_read(uint32_t ui32Module, uint32_t ui32BusAddress,
+                    uint32_t *pui32Data, uint32_t ui32NumBytes,
+                    uint32_t ui32Options)
+{
+    //
+    // Validate parameters
+    //
+    if ( ui32Module > AM_REG_IOMSTR_NUM_MODULES )
+    {
+        return;
+    }
+    am_hal_debug_assert_msg(ui32NumBytes > 0,
+                            "Trying to do a 0 byte transaction");
+
+    //
+    // Redirect to the bit-bang interface if the module number matches the
+    // software I2C module.
+    //
+    if ( ui32Module == AM_HAL_IOM_I2CBB_MODULE )
+    {
+        if ( ui32Options & AM_HAL_IOM_RAW )
+        {
+            am_hal_i2c_bit_bang_receive((ui32BusAddress << 1) | 1, ui32NumBytes,
+                                        (uint8_t *)pui32Data, 0, false,
+                                        (ui32Options & AM_HAL_IOM_NO_STOP));
+        }
+        else
+        {
+            am_hal_i2c_bit_bang_receive((ui32BusAddress << 1) | 1, ui32NumBytes,
+                                        (uint8_t *)pui32Data,
+                                        ((ui32Options & 0xFF00) >> 8),
+                                        true,
+                                        (ui32Options & AM_HAL_IOM_NO_STOP));
+        }
+
+        //
+        // Return.
+        //
+        return;
+    }
+
+    //
+    // Make sure the transfer isn't too long for the hardware to support.
+    //
+    am_hal_debug_assert_msg(ui32NumBytes < 256, "I2C transfer too big.");
+
+    //
+    // Check to see if queues have been enabled. If they are, we'll actually
+    // switch to the queued interface.
+    //
+    if ( g_psIOMQueue[ui32Module].pui8Data != NULL )
+    {
+        //
+        // If the queue is on, go ahead and add this transaction to the queue.
+        //
+        am_hal_iom_queue_i2c_read(ui32Module, ui32BusAddress, pui32Data,
+                                  ui32NumBytes, ui32Options, 0);
+
+        //
+        // Wait until the transaction actually clears.
+        //
+        am_hal_iom_queue_flush(ui32Module);
+
+        //
+        // At this point, we've completed the transaction, and we can return.
+        //
+        return;
+    }
+    else
+    {
+        //
+        // Otherwise, just perform a polled transaction.
+        //
+        am_hal_iom_i2c_read_nq(ui32Module, ui32BusAddress, pui32Data,
+                               ui32NumBytes, ui32Options);
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Perform a non-blocking write to the I2C interface.
+//!
+//! @param ui32Module - Module number for the IOM.
+//! @param ui32BusAddress - I2C address of the target device.
+//! @param pui32Data - Pointer to the bytes that will be sent.
+//! @param ui32NumBytes - Number of bytes to send.
+//! @param ui32Options - Additional I2C transfer options.
+//! @param pfnCallback - Function to call when the transaction completes.
+//!
+//! This function performs I2C writes to a selected I2C device.
+//!
+//! This function call is a non-blocking implementation. It will write as much
+//! data to the FIFO as possible immediately, store a pointer to the remaining
+//! data, start the transfer on the bus, and then immediately return. The
+//! caller will need to make sure that \e am_hal_iom_int_service() is called
+//! for IOM FIFO interrupt events and "command complete" interrupt events. The
+//! \e am_hal_iom_int_service() function will refill the FIFO as necessary and
+//! call the \e pfnCallback function when the transaction is finished.
+//!
+//! @note The actual SPI and I2C interfaces operate in BYTES, not 32-bit words.
+//! This means that you will need to byte-pack the \e pui32Data array with the
+//! data you intend to send over the interface. One easy way to do this is to
+//! declare the array as a 32-bit integer array, but use an 8-bit pointer to
+//! put your actual data into the array. If there are not enough bytes in your
+//! desired message to completely fill the last 32-bit word, you may pad that
+//! last word with bytes of any value. The IOM hardware will only read the
+//! first \e ui32NumBytes in the \e pui32Data array.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_iom_i2c_write_nb(uint32_t ui32Module, uint32_t ui32BusAddress,
+                        uint32_t *pui32Data, uint32_t ui32NumBytes,
+                        uint32_t ui32Options,
+                        am_hal_iom_callback_t pfnCallback)
+{
+    uint32_t ui32TransferSize;
+    uint32_t ui32MaxFifoSize;
+
+    //
+    // Validate parameters
+    //
+    if ( ui32Module > AM_REG_IOMSTR_NUM_MODULES )
+    {
+        return;
+    }
+    am_hal_debug_assert_msg(ui32NumBytes > 0,
+                            "Trying to do a 0 byte transaction");
+
+    //
+    // Redirect to the bit-bang interface if the module number matches the
+    // software I2C module.
+    //
+    if ( ui32Module == AM_HAL_IOM_I2CBB_MODULE )
+    {
+        if ( ui32Options & AM_HAL_IOM_RAW )
+        {
+            am_hal_i2c_bit_bang_send(ui32BusAddress << 1, ui32NumBytes,
+                                     (uint8_t *)pui32Data, 0, false,
+                                     (ui32Options & AM_HAL_IOM_NO_STOP));
+        }
+        else
+        {
+            am_hal_i2c_bit_bang_send(ui32BusAddress << 1, ui32NumBytes,
+                                     (uint8_t *)pui32Data,
+                                     ((ui32Options & 0xFF00) >> 8),
+                                     true,
+                                     (ui32Options & AM_HAL_IOM_NO_STOP));
+        }
+
+        //
+        // The I2C bit-bang interface is actually a blocking transfer, and it
+        // doesn't trigger the interrupt handler, so we have to call the
+        // callback function manually.
+        //
+        if ( pfnCallback )
+        {
+            pfnCallback();
+        }
+        //
+        // Return.
+        //
+        return;
+    }
+
+    //
+    // Make sure the transfer isn't too long for the hardware to support.
+    //
+    am_hal_debug_assert_msg(ui32NumBytes < 256, "I2C transfer too big.");
+
+    ui32MaxFifoSize = ((0 == AM_BFRn(IOMSTR, ui32Module, CFG, FULLDUP)) ?
+                       AM_HAL_IOM_MAX_FIFO_SIZE : AM_HAL_IOM_MAX_FIFO_SIZE / 2);
+
+    //
+    // Figure out how many bytes we can write to the FIFO immediately.
+    //
+    ui32TransferSize = (ui32NumBytes <= ui32MaxFifoSize ? ui32NumBytes :
+                        ui32MaxFifoSize);
+
+    //
+    // Wait until any earlier transactions have completed, and then write our
+    // first word to the fifo.
+    //
+    am_hal_iom_poll_complete(ui32Module);
+
+    // Need to mark IOM busy to avoid another transaction to be scheduled.
+    // This is to take care of a race condition in Queue mode, where the IDLE
+    // set is not a guarantee that the CMDCMP has been received
+    g_bIomBusy[ui32Module] = true;
+
+    //
+    // Clear CMDCMP status
+    //
+    AM_BFWn(IOMSTR, ui32Module, INTCLR, CMDCMP, 1);
+
+    if ( am_hal_iom_fifo_write(ui32Module, pui32Data, ui32TransferSize) > 0 )
+    {
+        //
+        // Prepare the global IOM buffer structure.
+        //
+        g_psIOMBuffers[ui32Module].ui32State = BUFFER_SENDING;
+        g_psIOMBuffers[ui32Module].pui32Data = pui32Data;
+        g_psIOMBuffers[ui32Module].ui32BytesLeft = ui32NumBytes;
+        g_psIOMBuffers[ui32Module].pfnCallback = pfnCallback;
+
+        //
+        // Update the pointer and the byte counter based on the portion of the
+        // transfer we just sent to the fifo.
+        //
+        g_psIOMBuffers[ui32Module].ui32BytesLeft -= ui32TransferSize;
+        g_psIOMBuffers[ui32Module].pui32Data += (ui32TransferSize / 4);
+
+        //
+        // Start the write on the bus.
+        //
+        am_hal_iom_i2c_cmd_run(AM_HAL_IOM_WRITE, ui32Module, ui32BusAddress,
+                               ui32NumBytes, ui32Options);
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Perform a non-blocking I2C read.
+//!
+//! @param ui32Module - Module number for the IOM.
+//! @param ui32ChipSelect - I2C address of the target device.
+//! @param pui32Data - Pointer to the array where received bytes should go.
+//! @param ui32NumBytes - Number of bytes to read.
+//! @param ui32Options - Additional I2C transfer options.
+//! @param pfnCallback - Function to call when the transaction completes.
+//!
+//! This function performs an I2C read to a selected I2C device.
+//!
+//! This function call is a non-blocking implementation. It will start the I2C
+//! transaction on the bus and store a pointer for the destination for the read
+//! data, but it will not wait for the I2C transaction to finish.  The caller
+//! will need to make sure that \e am_hal_iom_int_service() is called for IOM
+//! FIFO interrupt events and "command complete" interrupt events. The \e
+//! am_hal_iom_int_service() function will empty the FIFO as necessary,
+//! transfer the data to the \e pui32Data buffer, and call the \e pfnCallback
+//! function when the transaction is finished.
+//!
+//! @note The actual SPI and I2C interfaces operate in BYTES, not 32-bit words.
+//! This function will pack the individual bytes from the physical interface
+//! into 32-bit words, which are then placed into the \e pui32Data array. Only
+//! the first \e ui32NumBytes bytes in this array will contain valid data.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_iom_i2c_read_nb(uint32_t ui32Module, uint32_t ui32BusAddress,
+                       uint32_t *pui32Data, uint32_t ui32NumBytes,
+                       uint32_t ui32Options,
+                       am_hal_iom_callback_t pfnCallback)
+{
+    //
+    // Validate parameters
+    //
+    if ( ui32Module > AM_REG_IOMSTR_NUM_MODULES )
+    {
+        return;
+    }
+    am_hal_debug_assert_msg(ui32NumBytes > 0,
+                            "Trying to do a 0 byte transaction");
+
+    //
+    // Redirect to the bit-bang interface if the module number matches the
+    // software I2C module.
+    //
+    if ( ui32Module == AM_HAL_IOM_I2CBB_MODULE )
+    {
+        if ( ui32Options & AM_HAL_IOM_RAW )
+        {
+            am_hal_i2c_bit_bang_receive((ui32BusAddress << 1) | 1, ui32NumBytes,
+                                        (uint8_t *)pui32Data, 0, false,
+                                        (ui32Options & AM_HAL_IOM_NO_STOP));
+        }
+        else
+        {
+            am_hal_i2c_bit_bang_receive((ui32BusAddress << 1) | 1, ui32NumBytes,
+                                        (uint8_t *)pui32Data,
+                                        ((ui32Options & 0xFF00) >> 8),
+                                        true,
+                                        (ui32Options & AM_HAL_IOM_NO_STOP));
+        }
+
+        //
+        // The I2C bit-bang interface is actually a blocking transfer, and it
+        // doesn't trigger the interrupt handler, so we have to call the
+        // callback function manually.
+        //
+        if ( pfnCallback )
+        {
+            pfnCallback();
+        }
+
+        //
+        // Return.
+        //
+        return;
+    }
+
+    //
+    // Make sure the transfer isn't too long for the hardware to support.
+    //
+    am_hal_debug_assert_msg(ui32NumBytes < 256, "I2C transfer too big.");
+
+    //
+    // Wait until the bus is idle
+    //
+    am_hal_iom_poll_complete(ui32Module);
+
+    //
+    // Need to mark IOM busy to avoid another transaction to be scheduled.
+    // This is to take care of a race condition in Queue mode, where the IDLE
+    // set is not a guarantee that the CMDCMP has been received
+    //
+    g_bIomBusy[ui32Module] = true;
+
+    //
+    // Clear CMDCMP status
+    //
+    AM_BFWn(IOMSTR, ui32Module, INTCLR, CMDCMP, 1);
+
+    //
+    // Prepare the global IOM buffer structure.
+    //
+    g_psIOMBuffers[ui32Module].ui32State = BUFFER_RECEIVING;
+    g_psIOMBuffers[ui32Module].pui32Data = pui32Data;
+    g_psIOMBuffers[ui32Module].ui32BytesLeft = ui32NumBytes;
+    g_psIOMBuffers[ui32Module].pfnCallback = pfnCallback;
+
+    //
+    // Start the read transaction on the bus.
+    //
+    am_hal_iom_i2c_cmd_run(AM_HAL_IOM_READ, ui32Module, ui32BusAddress,
+                           ui32NumBytes, ui32Options);
+}
+
+//*****************************************************************************
+//
+//! @brief Runs a I2C "command" through the IO master.
+//!
+//! @param ui32Operation - I2C action to be performed. This should either be
+//! AM_HAL_IOM_WRITE or AM_HAL_IOM_READ.
+//! @param psDevice - Structure containing information about the slave device.
+//! @param ui32NumBytes - Number of bytes to move (transmit or receive) with
+//! this command.
+//! @param ui32Options - Additional I2C options to apply to this command.
+//!
+//! This function may be used along with am_hal_iom_fifo_write and
+//! am_hal_iom_fifo_read to perform more complex I2C reads and writes. This
+//! function
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_iom_i2c_cmd_run(uint32_t ui32Operation, uint32_t ui32Module,
+                       uint32_t ui32BusAddress, uint32_t ui32NumBytes,
+                       uint32_t ui32Options)
+{
+    uint32_t ui32Command;
+
+    //
+    // Validate parameters
+    //
+    if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
+    {
+        return;
+    }
+    am_hal_debug_assert_msg(ui32NumBytes > 0,
+                            "Trying to do a 0 byte transaction");
+
+    //
+    // Start building the command from the operation parameter.
+    //
+    ui32Command = ui32Operation;
+
+    //
+    // Set the transfer length.
+    //
+    ui32Command |= (ui32NumBytes & 0xFF);
+
+    //
+    // Set the chip select number.
+    //
+    ui32Command |= ((ui32BusAddress << 16) & 0x03FF0000);
+
+    //
+    // Finally, OR in the rest of the options. This mask should make sure that
+    // erroneous option values won't interfere with the other transfer
+    // parameters.
+    //
+    ui32Command |= (ui32Options & 0x5C00FF00);
+
+    //
+    // Write the complete command word to the IOM command register.
+    //
+    AM_REGn(IOMSTR, ui32Module, CMD) = ui32Command;
+}
+
+//*****************************************************************************
+//
+//! @brief Sets the repeat count for the next IOM command.
+//!
+//! @param ui32Module is the IOM module number.
+//! @param ui32CmdCount is the number of times the next command should be
+//! executed.
+//!
+//! @note This function is not compatible with the am_hal_iom_spi_read/write()
+//! or am_hal_iom_i2c_read/write() functions. Instead, you will need to use the
+//! am_hal_iom_fifo_read/write() functions and the am_hal_iom_spi/i2c_cmd_run()
+//! functions.
+//!
+//! Example usage:
+//! @code
+//!
+//! //
+//! // Create a buffer and add 3 bytes of data to it.
+//! //
+//! am_hal_iom_buffer(3) psBuffer;
+//! psBuffer.bytes[0] = 's';
+//! psBuffer.bytes[1] = 'p';
+//! psBuffer.bytes[2] = 'i';
+//!
+//! //
+//! // Send three different bytes to the same SPI register on a remote device.
+//! //
+//! am_hal_iom_fifo_write(ui32Module, psBuffer.words, 3);
+//!
+//! am_hal_command_repeat_set(ui32Module, 3);
+//!
+//! am_hal_iom_spi_cmd_run(AM_HAL_IOM_WRITE, psDevice, 1,
+//!                        AM_HAL_IOM_OFFSET(0x5));
+//!
+//! //
+//! // The sequence "0x5, 's', 0x5, 'p', 0x5, 'i'" should be written to the SPI
+//! // bus.
+//! //
+//!
+//! @endcode
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_iom_command_repeat_set(uint32_t ui32Module, uint32_t ui32CmdCount)
+{
+    //
+    // Validate parameters
+    //
+    if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
+    {
+        return;
+    }
+
+    AM_REGn(IOMSTR, ui32Module, CMDRPT) = ui32CmdCount;
+}
+
+//*****************************************************************************
+//
+//! @brief Writes data to the IOM FIFO.
+//!
+//! @param ui32Module - Selects the IOM module to use (zero or one).
+//! @param pui32Data - Pointer to an array of the data to be written.
+//! @param ui32NumBytes - Number of BYTES to copy into the FIFO.
+//!
+//! This function copies data from the array \e pui32Data into the IOM FIFO.
+//! This prepares the data to eventually be sent as SPI or I2C data by an IOM
+//! "command".
+//!
+//! @note The actual SPI and I2C interfaces operate in BYTES, not 32-bit words.
+//! This means that you will need to byte-pack the \e pui32Data array with the
+//! data you intend to send over the interface. One easy way to do this is to
+//! declare the array as a 32-bit integer array, but use an 8-bit pointer to
+//! put your actual data into the array. If there are not enough bytes in your
+//! desired message to completely fill the last 32-bit word, you may pad that
+//! last word with bytes of any value. The IOM hardware will only read the
+//! first \e ui32NumBytes in the \e pui8Data array.
+//!
+//! @note This function may be used to write partial or complete SPI or I2C
+//! messages into the IOM FIFO. When writing partial messages to the FIFO, make
+//! sure that the number of bytes written is a multiple of four. Only the last
+//! 'part' of a message may consist of a number of bytes that is not a multiple
+//! of four. If this rule is not followed, the IOM will not be able to send
+//! these bytes correctly.
+//!
+//! @return Number of bytes actually written to the FIFO.
+//
+//*****************************************************************************
+uint32_t
+am_hal_iom_fifo_write(uint32_t ui32Module, uint32_t *pui32Data,
+                      uint32_t ui32NumBytes)
+{
+    uint32_t ui32Index;
+
+    //
+    // Validate parameters
+    //
+    if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
+    {
+        return 0;
+    }
+
+    //
+    // Make sure we check the number of bytes we're writing to the FIFO.
+    //
+    am_hal_debug_assert_msg((am_hal_iom_fifo_empty_slots(ui32Module) >= ui32NumBytes),
+                            "The fifo couldn't fit the requested number of bytes");
+
+    //
+    // Loop over the words in the array until we have the correct number of
+    // bytes.
+    //
+    for ( ui32Index = 0; (4 * ui32Index) < ui32NumBytes; ui32Index++ )
+    {
+        //
+        // Write the word to the FIFO.
+        //
+        AM_REGn(IOMSTR, ui32Module, FIFO) = pui32Data[ui32Index];
+    }
+
+    return ui32NumBytes;
+}
+
+//*****************************************************************************
+//
+//! @brief Reads data from the IOM FIFO.
+//!
+//! @param ui32Module - Selects the IOM module to use (zero or one).
+//! @param pui32Data - Pointer to an array where the FIFO data will be copied.
+//! @param ui32NumBytes - Number of bytes to copy into array.
+//!
+//! This function copies data from the IOM FIFO into the array \e pui32Data.
+//! This is how input data from SPI or I2C transactions may be retrieved.
+//!
+//! @note The actual SPI and I2C interfaces operate in BYTES, not 32-bit words.
+//! This function will pack the individual bytes from the physical interface
+//! into 32-bit words, which are then placed into the \e pui32Data array. Only
+//! the first \e ui32NumBytes bytes in this array will contain valid data.
+//!
+//! @return Number of bytes read from the fifo.
+//
+//*****************************************************************************
+uint32_t
+am_hal_iom_fifo_read(uint32_t ui32Module, uint32_t *pui32Data,
+                     uint32_t ui32NumBytes)
+{
+    am_hal_iom_buffer(4) sTempBuffer;
+    uint32_t i, j, ui32NumWords, ui32Leftovers;
+    uint8_t *pui8Data;
+
+    //
+    // Validate parameters
+    //
+    if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
+    {
+        return 0;
+    }
+
+    //
+    // Make sure we check the number of bytes we're reading from the FIFO.
+    //
+    am_hal_debug_assert_msg((am_hal_iom_fifo_full_slots(ui32Module) >= ui32NumBytes),
+                            "The fifo doesn't contain the requested number of bytes.");
+
+    //
+    // Figure out how many whole words we're reading from the fifo, and how
+    // many bytes will be left over when we're done.
+    //
+    ui32NumWords = ui32NumBytes / 4;
+    ui32Leftovers = ui32NumBytes - (ui32NumWords * 4);
+
+    //
+    // Copy out as many full words as we can.
+    //
+    for ( i = 0; i < ui32NumWords; i++ )
+    {
+        //
+        // Copy data out of the FIFO, one word at a time.
+        //
+        pui32Data[i] = AM_REGn(IOMSTR, ui32Module, FIFO);
+    }
+
+    //
+    // If there were leftovers, we'll copy them carefully. Pull the last word
+    // from the fifo (there should only be one) into a temporary buffer. Also,
+    // create an 8-bit pointer to help us copy the remaining bytes one at a
+    // time.
+    //
+    // Note: If the data buffer we were given was truly a word pointer like the
+    // definition requests, we wouldn't need to do this. It's possible to call
+    // this function with a re-cast or packed pointer instead though. If that
+    // happens, we want to be careful not to overwrite any data that might be
+    // sitting just past the end of the destination array.
+    //
+    if ( ui32Leftovers )
+    {
+        sTempBuffer.words[0] = AM_REGn(IOMSTR, ui32Module, FIFO);
+        pui8Data = (uint8_t *) (&pui32Data[i]);
+
+        //
+        // If we had leftover bytes, copy them out one byte at a time.
+        //
+        for ( j = 0; j < ui32Leftovers; j++ )
+        {
+            pui8Data[j] = sTempBuffer.bytes[j];
+        }
+    }
+
+    return ui32NumBytes;
+}
+
+//*****************************************************************************
+//
+//! @brief Check amount of empty space in the IOM fifo.
+//!
+//! @param ui32Module - Module number of the IOM whose fifo should be checked.
+//!
+//! Returns the number of bytes that could be written to the IOM fifo without
+//! causing an overflow.
+//!
+//! @return Amount of space available in the fifo (in bytes).
+//
+//*****************************************************************************
+uint8_t
+am_hal_iom_fifo_empty_slots(uint32_t ui32Module)
+{
+    uint32_t ui32MaxFifoSize;
+
+    //
+    // Validate parameters
+    //
+    if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
+    {
+        return 0;
+    }
+
+    ui32MaxFifoSize = ((0 == AM_BFRn(IOMSTR, ui32Module, CFG, FULLDUP)) ? AM_HAL_IOM_MAX_FIFO_SIZE : AM_HAL_IOM_MAX_FIFO_SIZE / 2);
+
+    //
+    // Calculate the FIFO Remaining from the FIFO size. This will be different
+    // depending on whether the IOM is configured for half-duplex or
+    // full-duplex.
+    //
+    return (ui32MaxFifoSize - AM_BFRn(IOMSTR, ui32Module, FIFOPTR, FIFOSIZ)) & (~0x3);
+}
+
+//*****************************************************************************
+//
+//! @brief Check to see how much data is in the IOM fifo.
+//!
+//! @param ui32Module - Module number of the IOM whose fifo should be checked.
+//!
+//! Returns the number of bytes of data that are currently in the IOM fifo.
+//!
+//! @return Number of bytes in the fifo.
+//
+//*****************************************************************************
+uint8_t
+am_hal_iom_fifo_full_slots(uint32_t ui32Module)
+{
+    //
+    // Validate parameters
+    //
+    if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
+    {
+        return 0;
+    }
+
+    return AM_BFRn(IOMSTR, ui32Module, FIFOPTR, FIFOSIZ);
+}
+
+//*****************************************************************************
+//
+//! @brief Wait for the current IOM command to complete.
+//!
+//! @param ui32Module - The module number of the IOM to use.
+//!
+//! This function polls until the IOM bus becomes idle.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_iom_poll_complete(uint32_t ui32Module)
+{
+    //
+    // Validate parameters
+    //
+    if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
+    {
+        return;
+    }
+
+    //
+    // Poll on the IDLE bit in the status register.
+    //
+    while ( g_bIomBusy[ui32Module] );
+}
+
+//*****************************************************************************
+//
+//! @brief Returns the contents of the IOM status register.
+//!
+//! @param ui32Module IOM instance to check the status of.
+//!
+//! This function is just a wrapper around the IOM status register.
+//!
+//! @return 32-bit contents of IOM status register.
+//
+//*****************************************************************************
+uint32_t
+am_hal_iom_status_get(uint32_t ui32Module)
+{
+    //
+    // Validate parameters
+    //
+    if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
+    {
+        return 0;
+    }
+
+    return AM_REGn(IOMSTR, ui32Module, STATUS);
+}
+
+//*****************************************************************************
+//
+//! @brief Returns current error state of the IOM.
+//!
+//! @param ui32Module IOM instance to check the status of.
+//!
+//! This function returns status indicating whether the IOM has incurred any
+//! errors or not.
+//!
+//! @return 0 if all is well.
+//!         Otherwise error status as a bitmask of:
+//!             AM_HAL_IOM_ERR_INVALID_MODULE
+//!             AM_HAL_IOM_INT_ARB      Another master initiated an operation
+//!                                     simultaenously and the IOM lost.  Or
+//!                                     the IOM started an operation but found
+//!                                     SDA already low.
+//!             AM_HAL_IOM_INT_START    A START from another master detected.
+//!                                     SW must wait for STOP before continuing.
+//!             AM_HAL_IOM_INT_ICMD     Attempt to issue a CMD while another
+//!                                     CMD was already in progress, or issue a
+//!                                     non-zero-len write CMD with empty FIFO.
+//!             AM_HAL_IOM_INT_IACC     Attempt to read the FIFO on a write. Or
+//!                                     an attempt to write the FIFO on a read.
+//!             AM_HAL_IOM_INT_NAK      Expected ACK from slave not received.
+//!             AM_HAL_IOM_INT_FOVFL    Attempt to write the FIFO while full
+//!                                     (FIFOSIZ > 124).
+//!             AM_HAL_IOM_INT_FUNDFL   Attempt to read FIFO when empty (that is
+//!                                     FIFOSIZ < 4).
+//!         Note - see the datasheet text for full explanations of the INT errs.
+//
+//*****************************************************************************
+uint32_t
+am_hal_iom_error_status_get(uint32_t ui32Module)
+{
+    uint32_t ui32intstat = 0;
+
+    //
+    // Validate parameters
+    //
+    if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
+    {
+        //
+        // AM_HAL_IOM_ERR_INVALID_MODULE is defined as an unused interrupt bit.
+        //
+        return AM_HAL_IOM_ERR_INVALID_MODULE;
+    }
+
+    if ( AM_REGn(IOMSTR, ui32Module, STATUS) & AM_REG_IOMSTR_STATUS_ERR_ERROR )
+    {
+        //
+        // The IOM is currently indicating an error condition.
+        // Let's figure out what is going on.
+        //
+        ui32intstat = AM_REGn(IOMSTR, ui32Module, INTSTAT);
+
+        //
+        // Filter out non-error bits.
+        //
+        ui32intstat &=  AM_REG_IOMSTR_INTSTAT_ARB_M     |
+                        AM_REG_IOMSTR_INTSTAT_START_M   |
+                        AM_REG_IOMSTR_INTSTAT_ICMD_M    |
+                        AM_REG_IOMSTR_INTSTAT_IACC_M    |
+                        AM_REG_IOMSTR_INTSTAT_NAK_M     |
+                        AM_REG_IOMSTR_INTSTAT_FOVFL_M   |
+                        AM_REG_IOMSTR_INTSTAT_FUNDFL_M;
+    }
+
+    return ui32intstat;
+}
+
+//*****************************************************************************
+//
+//! @brief Service interrupts from the IOM.
+//!
+//! @param ui32Status is the IOM interrupt status as returned from
+//! am_hal_iom_int_status_get()
+//!
+//! This function performs the necessary operations to facilitate non-blocking
+//! IOM writes and reads.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_iom_int_service(uint32_t ui32Module, uint32_t ui32Status)
+{
+    am_hal_iom_nb_buffer *psBuffer;
+    uint32_t ui32NumBytes;
+    uint32_t ui32SpaceInFifo;
+    uint32_t thresh;
+
+    //
+    // Validate parameters
+    //
+    if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
+    {
+        return;
+    }
+    //
+    // Find the buffer information for the chosen IOM module.
+    //
+    psBuffer = &g_psIOMBuffers[ui32Module];
+
+    //
+    // Figure out what type of interrupt this was.
+    //
+    if ( ui32Status & AM_HAL_IOM_INT_CMDCMP )
+    {
+        //
+        // Need to mark IOM Free
+        //
+        g_bIomBusy[ui32Module] = false;
+
+        //
+        // If we're not in the middle of a non-blocking call right now, there's
+        // nothing for this routine to do.
+        //
+        if ( psBuffer->ui32State == BUFFER_IDLE )
+        {
+            return;
+        }
+
+        //
+        // If a command just completed, we need to transfer all available data.
+        //
+        if ( psBuffer->ui32State == BUFFER_RECEIVING )
+        {
+            //
+            // If we were receiving, we need to copy any remaining data out of
+            // the IOM FIFO before calling the callback.
+            //
+            ui32NumBytes = am_hal_iom_fifo_full_slots(ui32Module);
+            am_hal_iom_fifo_read(ui32Module, psBuffer->pui32Data, ui32NumBytes);
+        }
+
+        //
+        // A command complete event also means that we've already transferred
+        // all of the data we need, so we can mark the data buffer as IDLE.
+        //
+        psBuffer->ui32State = BUFFER_IDLE;
+
+        //
+        // If we have a callback, call it now.
+        //
+        if ( psBuffer->pfnCallback )
+        {
+            psBuffer->pfnCallback();
+        }
+    }
+    else if ( ui32Status & AM_HAL_IOM_INT_THR )
+    {
+        //
+        // If we're not in the middle of a non-blocking call right now, there's
+        // nothing for this routine to do.
+        //
+        if ( psBuffer->ui32State == BUFFER_IDLE )
+        {
+            return;
+        }
+        //
+        // If we received a threshold event in the middle of a command, we need
+        // to transfer data.
+        //
+        if ( psBuffer->ui32State == BUFFER_SENDING )
+        {
+            thresh = AM_BFRn(IOMSTR, ui32Module, FIFOTHR, FIFOWTHR);
+            do
+            {
+                ui32SpaceInFifo = am_hal_iom_fifo_empty_slots(ui32Module);
+
+                //
+                // Figure out how much data we can send.
+                //
+                if ( psBuffer->ui32BytesLeft <= ui32SpaceInFifo )
+                {
+                    //
+                    // If the whole transfer will fit in the fifo, send it all.
+                    //
+                    ui32NumBytes = psBuffer->ui32BytesLeft;
+                }
+                else
+                {
+                    //
+                    // If the transfer won't fit in the fifo completely, send as
+                    // much as we can (rounded down to a multiple of four bytes).
+                    //
+                    ui32NumBytes = ui32SpaceInFifo;
+                }
+
+                //
+                // Perform the transfer.
+                //
+                am_hal_iom_fifo_write(ui32Module, psBuffer->pui32Data, ui32NumBytes);
+
+                // Clear any spurious THR interrupt that might have got raised
+                // while we were adding data to FIFO
+                AM_BFWn(IOMSTR, ui32Module, INTCLR, THR, 1);
+                //
+                // Update the pointer and the byte counter.
+                //
+                psBuffer->ui32BytesLeft -= ui32NumBytes;
+                psBuffer->pui32Data += (ui32NumBytes / 4);
+
+                if ( 0 == psBuffer->ui32BytesLeft )
+                {
+                    //
+                    // Done with this transaction
+                    //
+                    break;
+                }
+            } while ( am_hal_iom_fifo_full_slots(ui32Module) <= thresh );
+        }
+        else
+        {
+            thresh = AM_BFRn(IOMSTR, ui32Module, FIFOTHR, FIFORTHR);
+            while ( (ui32NumBytes = am_hal_iom_fifo_full_slots(ui32Module)) >= thresh )
+            {
+                //
+                // If we get here, we're in the middle of a read. Transfer as much
+                // data as possible out of the FIFO and into our buffer.
+                //
+                if ( ui32NumBytes == psBuffer->ui32BytesLeft )
+                {
+                    //
+                    // If the fifo contains our entire message, just copy the whole
+                    // thing out.
+                    //
+                    am_hal_iom_fifo_read(ui32Module, psBuffer->pui32Data,
+                                         psBuffer->ui32BytesLeft);
+
+                    break;
+                }
+                else if ( ui32NumBytes >= 4 )
+                {
+                    //
+                    // If the fifo has at least one 32-bit word in it, copy out the
+                    // biggest block we can.
+                    //
+                    ui32NumBytes = (ui32NumBytes & (~0x3));
+
+                    am_hal_iom_fifo_read(ui32Module, psBuffer->pui32Data, ui32NumBytes);
+
+                    //
+                    // Update the pointer and the byte counter.
+                    //
+                    psBuffer->ui32BytesLeft -= ui32NumBytes;
+                    psBuffer->pui32Data += (ui32NumBytes / 4);
+
+                    // Clear any spurious THR interrupt that might have got raised
+                    // while we were reading the data from FIFO
+                    AM_BFWn(IOMSTR, ui32Module, INTCLR, THR, 1);
+                }
+            }
+        }
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Initialize the IOM queue system.
+//!
+//! @param ui32Module - IOM module to be initialized for queue transfers.
+//! @param psQueueMemory - Memory to be used for queueing IOM transfers.
+//! @param ui32QueueMemSize - Size of the queue memory.
+//!
+//! This function prepares the selected IOM interface for use with the IOM
+//! queue system. The IOM queue system allows the caller to start multiple IOM
+//! transfers in a non-blocking way. In order to do this, the HAL requires some
+//! amount of memory dedicated to keeping track of IOM transactions before they
+//! can be sent to the hardware registers. This function tells the HAL what
+//! memory it should use for this purpose. For more information on the IOM
+//! queue interface, please see the documentation for
+//! am_hal_iom_queue_spi_write().
+//!
+//! @note This function only needs to be called once (per module), but it must
+//! be called before any other am_hal_iom_queue function.
+//!
+//! @note Each IOM module will need its own working space. If you intend to use
+//! the queueing mechanism with more than one IOM module, you will need to
+//! provide separate queue memory for each module.
+//!
+//! Example usage:
+//!
+//! @code
+//!
+//! //
+//! // Declare an array to be used for IOM queue transactions. This array will
+//! // be big enough to handle 32 IOM transactions.
+//! //
+//! am_hal_iom_queue_entry_t g_psQueueMemory[32];
+//!
+//! //
+//! // Attach the IOM0 queue system to the memory we just allocated.
+//! //
+//! am_hal_iom_queue_init(0, g_psQueueMemory, sizeof(g_psQueueMemory));
+//!
+//! @endcode
+//
+//*****************************************************************************
+void
+am_hal_iom_queue_init(uint32_t ui32Module, am_hal_iom_queue_entry_t *psQueueMemory,
+                      uint32_t ui32QueueMemSize)
+{
+    //
+    // Validate parameters
+    //
+    if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
+    {
+        return;
+    }
+
+    am_hal_queue_init(&g_psIOMQueue[ui32Module], psQueueMemory,
+                      sizeof(am_hal_iom_queue_entry_t), ui32QueueMemSize);
+}
+
+//*****************************************************************************
+//
+//! @brief Check to see how many transactions are in the queue.
+//!
+//! @param ui32Module Module number for the queue to check
+//!
+//! This function will check to see how many transactions are in the IOM queue
+//! for the selected IOM module.
+//!
+//! @return Number of transactions in the queue.
+//
+//*****************************************************************************
+uint32_t
+am_hal_iom_queue_length_get(uint32_t ui32Module)
+{
+    //
+    // Validate parameters
+    //
+    if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
+    {
+        return 0;
+    }
+
+    return am_hal_queue_data_left(&g_psIOMQueue[ui32Module]);
+}
+
+//*****************************************************************************
+//
+//! @brief Executes the next operation in the IOM queue.
+//!
+//! @param ui32ModuleNum - Module number for the IOM to use.
+//!
+//! This function checks the IOM queue to see if there are any remaining
+//! transactions. If so, it will start the next available transaction in a
+//! non-blocking way.
+//!
+//! @note This function is called automatically by am_hal_iom_queue_service().
+//! You should not call this function standalone in a normal application.
+//
+//*****************************************************************************
+void
+am_hal_iom_queue_start_next_msg(uint32_t ui32Module)
+{
+  am_hal_iom_queue_entry_t sIOMTransaction = {0};
+
+    uint32_t ui32ChipSelect;
+    uint32_t *pui32Data;
+    uint32_t ui32NumBytes;
+    uint32_t ui32Options;
+    am_hal_iom_callback_t pfnCallback;
+
+    uint32_t ui32Critical;
+
+    //
+    // Validate parameters
+    //
+    if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
+    {
+        return;
+    }
+
+    //
+    // Start a critical section.
+    //
+    ui32Critical = am_hal_interrupt_master_disable();
+
+    //
+    // Try to get the next IOM operation from the queue.
+    //
+    if ( am_hal_queue_item_get(&g_psIOMQueue[ui32Module], &sIOMTransaction, 1) )
+    {
+        //
+        // Read the operation parameters
+        //
+        ui32ChipSelect = sIOMTransaction.ui32ChipSelect;
+        pui32Data = sIOMTransaction.pui32Data;
+        ui32NumBytes = sIOMTransaction.ui32NumBytes;
+        ui32Options = sIOMTransaction.ui32Options;
+        pfnCallback = sIOMTransaction.pfnCallback;
+
+        //
+        // Figure out if this was a SPI or I2C write or read, and call the
+        // appropriate non-blocking function.
+        //
+        switch ( sIOMTransaction.ui32Operation )
+        {
+            case AM_HAL_IOM_QUEUE_SPI_WRITE:
+                am_hal_iom_spi_write_nb(ui32Module, ui32ChipSelect, pui32Data,
+                                        ui32NumBytes, ui32Options, pfnCallback);
+                break;
+
+            case AM_HAL_IOM_QUEUE_SPI_READ:
+                am_hal_iom_spi_read_nb(ui32Module, ui32ChipSelect, pui32Data,
+                                       ui32NumBytes, ui32Options, pfnCallback);
+                break;
+
+            case AM_HAL_IOM_QUEUE_I2C_WRITE:
+                am_hal_iom_i2c_write_nb(ui32Module, ui32ChipSelect, pui32Data,
+                                        ui32NumBytes, ui32Options, pfnCallback);
+                break;
+
+            case AM_HAL_IOM_QUEUE_I2C_READ:
+                am_hal_iom_i2c_read_nb(ui32Module, ui32ChipSelect, pui32Data,
+                                       ui32NumBytes, ui32Options, pfnCallback);
+                break;
+        }
+    }
+
+    //
+    // Exit the critical section.
+    //
+    am_hal_interrupt_master_set(ui32Critical);
+}
+
+//*****************************************************************************
+//
+//! @brief Send a SPI frame using the IOM queue.
+//!
+//! @param ui32Module - Module number for the IOM
+//! @param ui32ChipSelect - Chip-select number for this transaction.
+//! @param pui32Data - Pointer to the bytes that will be sent.
+//! @param ui32NumBytes - Number of bytes to send.
+//! @param ui32Options - Additional SPI transfer options.
+//!
+//! This function performs SPI writes to a selected SPI device.
+//!
+//! This function call is a queued implementation. It will write as much
+//! data to the FIFO as possible immediately, store a pointer to the remaining
+//! data, start the transfer on the bus, and then immediately return. If the
+//! FIFO is already in use, this function will save its arguments to the IOM
+//! queue and execute the transaction when the FIFO becomes available.
+//!
+//! The caller will need to make sure that \e am_hal_iom_queue_service() is
+//! called for IOM FIFO interrupt events and "command complete" interrupt
+//! events. The \e am_hal_iom_queue_service() function will refill the FIFO as
+//! necessary and call the \e pfnCallback function when the transaction is
+//! finished.
+//!
+//! @note The actual SPI and I2C interfaces operate in BYTES, not 32-bit words.
+//! This means that you will need to byte-pack the \e pui32Data array with the
+//! data you intend to send over the interface. One easy way to do this is to
+//! declare the array as a 32-bit integer array, but use an 8-bit pointer to
+//! put your actual data into the array. If there are not enough bytes in your
+//! desired message to completely fill the last 32-bit word, you may pad that
+//! last word with bytes of any value. The IOM hardware will only read the
+//! first \e ui32NumBytes in the \e pui8Data array.
+//
+//*****************************************************************************
+void
+am_hal_iom_queue_spi_write(uint32_t ui32Module, uint32_t ui32ChipSelect,
+                           uint32_t *pui32Data, uint32_t ui32NumBytes,
+                           uint32_t ui32Options, am_hal_iom_callback_t pfnCallback)
+{
+    uint32_t ui32Critical;
+
+    //
+    // Validate parameters
+    //
+    if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
+    {
+        return;
+    }
+    am_hal_debug_assert_msg(ui32NumBytes > 0,
+                            "Trying to do a 0 byte transaction");
+
+    //
+    // Start a critical section.
+    //
+    ui32Critical = am_hal_interrupt_master_disable();
+
+    //
+    // Check to see if we need to use the queue. If the IOM is idle, and
+    // there's nothing in the queue already, we can go ahead and start the
+    // transaction in the physical IOM. Need to check for the g_bIomBusy to
+    // avoid a race condition where IDLE is set - but the command complete
+    // for previous transaction has not been processed yet
+    //
+    if ( (g_bIomBusy[ui32Module] == false) &&
+        am_hal_queue_empty(&g_psIOMQueue[ui32Module]) )
+    {
+        //
+        // Send the packet.
+        //
+        am_hal_iom_spi_write_nb(ui32Module, ui32ChipSelect, pui32Data,
+                                ui32NumBytes, ui32Options, pfnCallback);
+    }
+    else
+    {
+        //
+        // Otherwise, we'll build a transaction structure and add it to the queue.
+        //
+        am_hal_iom_queue_entry_t sIOMTransaction;
+
+        sIOMTransaction.ui32Operation = AM_HAL_IOM_QUEUE_SPI_WRITE;
+        sIOMTransaction.ui32Module = ui32Module;
+        sIOMTransaction.ui32ChipSelect = ui32ChipSelect;
+        sIOMTransaction.pui32Data = pui32Data;
+        sIOMTransaction.ui32NumBytes = ui32NumBytes;
+        sIOMTransaction.ui32Options = ui32Options;
+        sIOMTransaction.pfnCallback = pfnCallback;
+
+        //
+        // Make sure the item actually makes it into the queue
+        //
+        if ( am_hal_queue_item_add(&g_psIOMQueue[ui32Module], &sIOMTransaction, 1) == false )
+        {
+            //
+            // Didn't have enough memory.
+            //
+            am_hal_debug_assert_msg(0,
+                                    "The IOM queue is full. Allocate more"
+                                    "memory to the IOM queue, or allow it more"
+                                    "time to empty between transactions.");
+        }
+    }
+
+    //
+    // Exit the critical section.
+    //
+    am_hal_interrupt_master_set(ui32Critical);
+}
+
+//*****************************************************************************
+//
+//! @brief Read a SPI frame using the IOM queue.
+//!
+//! @param ui32Module - Module number for the IOM
+//! @param ui32ChipSelect - Chip select number for this transaction.
+//! @param pui32Data - Pointer to the array where received bytes should go.
+//! @param ui32NumBytes - Number of bytes to read.
+//! @param ui32Options - Additional SPI transfer options.
+//!
+//! This function performs SPI reads to a selected SPI device.
+//!
+//! This function call is a queued implementation. It will write as much
+//! data to the FIFO as possible immediately, store a pointer to the remaining
+//! data, start the transfer on the bus, and then immediately return. If the
+//! FIFO is already in use, this function will save its arguments to the IOM
+//! queue and execute the transaction when the FIFO becomes available.
+//!
+//! The caller will need to make sure that \e am_hal_iom_queue_service() is
+//! called for IOM FIFO interrupt events and "command complete" interrupt
+//! events. The \e am_hal_iom_queue_service() function will empty the FIFO as
+//! necessary and call the \e pfnCallback function when the transaction is
+//! finished.
+//!
+//! @note The actual SPI and I2C interfaces operate in BYTES, not 32-bit words.
+//! This means that you will need to byte-pack the \e pui32Data array with the
+//! data you intend to send over the interface. One easy way to do this is to
+//! declare the array as a 32-bit integer array, but use an 8-bit pointer to
+//! put your actual data into the array. If there are not enough bytes in your
+//! desired message to completely fill the last 32-bit word, you may pad that
+//! last word with bytes of any value. The IOM hardware will only read the
+//! first \e ui32NumBytes in the \e pui8Data array.
+//
+//*****************************************************************************
+void
+am_hal_iom_queue_spi_read(uint32_t ui32Module, uint32_t ui32ChipSelect,
+                          uint32_t *pui32Data, uint32_t ui32NumBytes,
+                          uint32_t ui32Options, am_hal_iom_callback_t pfnCallback)
+{
+    uint32_t ui32Critical;
+
+    //
+    // Validate parameters
+    //
+    if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
+    {
+        return;
+    }
+    am_hal_debug_assert_msg(ui32NumBytes > 0,
+                            "Trying to do a 0 byte transaction");
+
+    // Start a critical section.
+    //
+    ui32Critical = am_hal_interrupt_master_disable();
+
+    //
+    // Check to see if we need to use the queue. If the IOM is idle, and
+    // there's nothing in the queue already, we can go ahead and start the
+    // transaction in the physical IOM. Need to check for the g_bIomBusy to
+    // avoid a race condition where IDLE is set - but the command complete
+    // for previous transaction has not been processed yet
+    //
+    if ( (g_bIomBusy[ui32Module] == false) &&
+        am_hal_queue_empty(&g_psIOMQueue[ui32Module]) )
+    {
+        //
+        // Send the packet.
+        //
+        am_hal_iom_spi_read_nb(ui32Module, ui32ChipSelect, pui32Data,
+                               ui32NumBytes, ui32Options, pfnCallback);
+    }
+    else
+    {
+        //
+        // Otherwise, we'll build a transaction structure and add it to the queue.
+        //
+        am_hal_iom_queue_entry_t sIOMTransaction;
+
+        sIOMTransaction.ui32Operation = AM_HAL_IOM_QUEUE_SPI_READ;
+        sIOMTransaction.ui32Module = ui32Module;
+        sIOMTransaction.ui32ChipSelect = ui32ChipSelect;
+        sIOMTransaction.pui32Data = pui32Data;
+        sIOMTransaction.ui32NumBytes = ui32NumBytes;
+        sIOMTransaction.ui32Options = ui32Options;
+        sIOMTransaction.pfnCallback = pfnCallback;
+
+        //
+        // Make sure the item actually makes it into the queue
+        //
+        if ( am_hal_queue_item_add(&g_psIOMQueue[ui32Module], &sIOMTransaction, 1) == false )
+        {
+            //
+            // Didn't have enough memory.
+            //
+            am_hal_debug_assert_msg(0,
+                                    "The IOM queue is full. Allocate more"
+                                    "memory to the IOM queue, or allow it more"
+                                    "time to empty between transactions.");
+        }
+    }
+
+    //
+    // Exit the critical section.
+    //
+    am_hal_interrupt_master_set(ui32Critical);
+}
+
+//*****************************************************************************
+//
+//! @brief Send an I2C frame using the IOM queue.
+//!
+//! @param ui32Module - Module number for the IOM
+//! @param ui32BusAddress - I2C address of the target device.
+//! @param pui32Data - Pointer to the bytes that will be sent.
+//! @param ui32NumBytes - Number of bytes to send.
+//! @param ui32Options - Additional I2C transfer options.
+//!
+//! This function performs I2C writes to a selected I2C device.
+//!
+//! This function call is a queued implementation. It will write as much
+//! data to the FIFO as possible immediately, store a pointer to the remaining
+//! data, start the transfer on the bus, and then immediately return. If the
+//! FIFO is already in use, this function will save its arguments to the IOM
+//! queue and execute the transaction when the FIFO becomes available.
+//!
+//! The caller will need to make sure that \e am_hal_iom_queue_service() is
+//! called for IOM FIFO interrupt events and "command complete" interrupt
+//! events. The \e am_hal_iom_queue_service() function will refill the FIFO as
+//! necessary and call the \e pfnCallback function when the transaction is
+//! finished.
+//!
+//! @note The actual SPI and I2C interfaces operate in BYTES, not 32-bit words.
+//! This means that you will need to byte-pack the \e pui32Data array with the
+//! data you intend to send over the interface. One easy way to do this is to
+//! declare the array as a 32-bit integer array, but use an 8-bit pointer to
+//! put your actual data into the array. If there are not enough bytes in your
+//! desired message to completely fill the last 32-bit word, you may pad that
+//! last word with bytes of any value. The IOM hardware will only read the
+//! first \e ui32NumBytes in the \e pui8Data array.
+//
+//*****************************************************************************
+void
+am_hal_iom_queue_i2c_write(uint32_t ui32Module, uint32_t ui32BusAddress,
+                           uint32_t *pui32Data, uint32_t ui32NumBytes,
+                           uint32_t ui32Options, am_hal_iom_callback_t pfnCallback)
+{
+    uint32_t ui32Critical;
+
+    //
+    // Validate parameters
+    //
+    if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
+    {
+        return;
+    }
+    am_hal_debug_assert_msg(ui32NumBytes > 0,
+                            "Trying to do a 0 byte transaction");
+
+    //
+    // Start a critical section.
+    //
+    ui32Critical = am_hal_interrupt_master_disable();
+
+    //
+    // Check to see if we need to use the queue. If the IOM is idle, and
+    // there's nothing in the queue already, we can go ahead and start the
+    // transaction in the physical IOM. Need to check for the g_bIomBusy to
+    // avoid a race condition where IDLE is set - but the command complete
+    // for previous transaction has not been processed yet
+    //
+    if ( (g_bIomBusy[ui32Module] == false) &&
+        am_hal_queue_empty(&g_psIOMQueue[ui32Module]) )
+    {
+        //
+        // Send the packet.
+        //
+        am_hal_iom_i2c_write_nb(ui32Module, ui32BusAddress, pui32Data,
+                                ui32NumBytes, ui32Options, pfnCallback);
+    }
+    else
+    {
+        //
+        // Otherwise, we'll build a transaction structure and add it to the queue.
+        //
+        am_hal_iom_queue_entry_t sIOMTransaction;
+
+        sIOMTransaction.ui32Operation = AM_HAL_IOM_QUEUE_I2C_WRITE;
+        sIOMTransaction.ui32Module = ui32Module;
+        sIOMTransaction.ui32ChipSelect = ui32BusAddress;
+        sIOMTransaction.pui32Data = pui32Data;
+        sIOMTransaction.ui32NumBytes = ui32NumBytes;
+        sIOMTransaction.ui32Options = ui32Options;
+        sIOMTransaction.pfnCallback = pfnCallback;
+
+        //
+        // Make sure the item actually makes it into the queue
+        //
+        if ( am_hal_queue_item_add(&g_psIOMQueue[ui32Module], &sIOMTransaction, 1) == false )
+        {
+            //
+            // Didn't have enough memory.
+            //
+            am_hal_debug_assert_msg(0,
+                                    "The IOM queue is full. Allocate more"
+                                    "memory to the IOM queue, or allow it more"
+                                    "time to empty between transactions.");
+        }
+    }
+
+    //
+    // Exit the critical section.
+    //
+    am_hal_interrupt_master_set(ui32Critical);
+}
+
+//*****************************************************************************
+//
+//! @brief Read a I2C frame using the IOM queue.
+//!
+//! @param ui32Module - Module number for the IOM
+//! @param ui32BusAddress - I2C address of the target device.
+//! @param pui32Data - Pointer to the array where received bytes should go.
+//! @param ui32NumBytes - Number of bytes to read.
+//! @param ui32Options - Additional I2C transfer options.
+//!
+//! This function performs I2C reads to a selected I2C device.
+//!
+//! This function call is a queued implementation. It will write as much
+//! data to the FIFO as possible immediately, store a pointer to the remaining
+//! data, start the transfer on the bus, and then immediately return. If the
+//! FIFO is already in use, this function will save its arguments to the IOM
+//! queue and execute the transaction when the FIFO becomes available.
+//!
+//! The caller will need to make sure that \e am_hal_iom_queue_service() is
+//! called for IOM FIFO interrupt events and "command complete" interrupt
+//! events. The \e am_hal_iom_queue_service() function will empty the FIFO as
+//! necessary and call the \e pfnCallback function when the transaction is
+//! finished.
+//!
+//! @note The actual SPI and I2C interfaces operate in BYTES, not 32-bit words.
+//! This means that you will need to byte-pack the \e pui32Data array with the
+//! data you intend to send over the interface. One easy way to do this is to
+//! declare the array as a 32-bit integer array, but use an 8-bit pointer to
+//! put your actual data into the array. If there are not enough bytes in your
+//! desired message to completely fill the last 32-bit word, you may pad that
+//! last word with bytes of any value. The IOM hardware will only read the
+//! first \e ui32NumBytes in the \e pui8Data array.
+//
+//*****************************************************************************
+void
+am_hal_iom_queue_i2c_read(uint32_t ui32Module, uint32_t ui32BusAddress,
+                          uint32_t *pui32Data, uint32_t ui32NumBytes,
+                          uint32_t ui32Options, am_hal_iom_callback_t pfnCallback)
+{
+    uint32_t ui32Critical;
+
+    //
+    // Validate parameters
+    //
+    if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
+    {
+        return;
+    }
+    am_hal_debug_assert_msg(ui32NumBytes > 0,
+                            "Trying to do a 0 byte transaction");
+
+    //
+    // Start a critical section.
+    //
+    ui32Critical = am_hal_interrupt_master_disable();
+
+    //
+    // Check to see if we need to use the queue. If the IOM is idle, and
+    // there's nothing in the queue already, we can go ahead and start the
+    // transaction in the physical IOM. Need to check for the g_bIomBusy to
+    // avoid a race condition where IDLE is set - but the command complete
+    // for previous transaction has not been processed yet
+    //
+    if ( (g_bIomBusy[ui32Module] == false) &&
+        am_hal_queue_empty(&g_psIOMQueue[ui32Module]) )
+    {
+        //
+        // Send the packet.
+        //
+        am_hal_iom_i2c_read_nb(ui32Module, ui32BusAddress, pui32Data,
+                               ui32NumBytes, ui32Options, pfnCallback);
+    }
+    else
+    {
+        //
+        // Otherwise, we'll build a transaction structure and add it to the queue.
+        //
+        am_hal_iom_queue_entry_t sIOMTransaction;
+
+        sIOMTransaction.ui32Operation = AM_HAL_IOM_QUEUE_I2C_READ;
+        sIOMTransaction.ui32Module = ui32Module;
+        sIOMTransaction.ui32ChipSelect = ui32BusAddress;
+        sIOMTransaction.pui32Data = pui32Data;
+        sIOMTransaction.ui32NumBytes = ui32NumBytes;
+        sIOMTransaction.ui32Options = ui32Options;
+        sIOMTransaction.pfnCallback = pfnCallback;
+
+        //
+        // Make sure the item actually makes it into the queue
+        //
+        if ( am_hal_queue_item_add(&g_psIOMQueue[ui32Module], &sIOMTransaction, 1) == false )
+        {
+            //
+            // Didn't have enough memory.
+            //
+            am_hal_debug_assert_msg(0, "The IOM queue is full. Allocate more"
+                                       "memory to the IOM queue, or allow it more"
+                                       "time to empty between transactions.");
+        }
+    }
+
+    //
+    // Exit the critical section.
+    //
+    am_hal_interrupt_master_set(ui32Critical);
+}
+
+//*****************************************************************************
+//
+//! @brief "Block" until the queue of IOM transactions is over.
+//!
+//! @param ui32Module - Module number for the IOM.
+//!
+//! This function will sleep the core block until the queue for the selected
+//! IOM is empty. This is mainly useful for non-RTOS applications where the
+//! caller needs to know that a certain IOM transaction is complete before
+//! continuing with the main program flow.
+//!
+//! @note This function will put the core to sleep while it waits for the
+//! queued IOM transactions to complete. This will save power, in most
+//! situations, but it may not be the best option in all cases. \e Do \e not
+//! call this function from interrupt context (the core may not wake up again).
+//! \e Be \e careful using this function from an RTOS task (many RTOS
+//! implementations use hardware interrupts to switch contexts, and most RTOS
+//! implementations expect to control sleep behavior).
+//
+//*****************************************************************************
+void
+am_hal_iom_sleeping_queue_flush(uint32_t ui32Module)
+{
+    bool bWaiting = true;
+    uint32_t ui32Critical;
+
+    //
+    // Validate parameters
+    //
+    if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
+    {
+        return;
+    }
+
+    //
+    // Loop forever waiting for the IOM to be idle and the queue to be empty.
+    //
+    while ( bWaiting )
+    {
+        //
+        // Start a critical section.
+        //
+        ui32Critical = am_hal_interrupt_master_disable();
+
+        //
+        // Check the queue and the IOM itself.
+        //
+        if ( (g_bIomBusy[ui32Module] == false) &&
+            am_hal_queue_empty(&g_psIOMQueue[ui32Module]) )
+        {
+            //
+            // If the queue is empty and the IOM is idle, we can go ahead and
+            // return.
+            //
+            bWaiting = false;
+        }
+        else
+        {
+            //
+            // Otherwise, we should sleep until the interface is actually free.
+            //
+            am_hal_sysctrl_sleep(AM_HAL_SYSCTRL_SLEEP_NORMAL);
+        }
+
+        //
+        // End the critical section.
+        //
+        am_hal_interrupt_master_set(ui32Critical);
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Service IOM transaction queue.
+//!
+//! @param ui32Module - Module number for the IOM to be used.
+//! @param ui32Status - Interrupt status bits for the IOM module being used.
+//!
+//! This function handles the operation of FIFOs and the IOM queue during
+//! queued IOM transactions. If you are using \e am_hal_iom_queue_spi_write()
+//! or similar functions, you will need to call this function in your interrupt
+//! handler.
+//!
+//! @note This interrupt service routine relies on the user to enable the IOM
+//! interrupts for FIFO threshold and CMD complete.
+//!
+//! Example:
+//!
+//! @code
+//! void
+//! am_iomaster0_isr(void)
+//! {
+//!     uint32_t ui32Status;
+//!
+//!     //
+//!     // Check to see which interrupt caused us to enter the ISR.
+//!     //
+//!     ui32Status = am_hal_iom_int_status(0, true);
+//!
+//!     //
+//!     // Fill or empty the FIFO, and either continue the current operation or
+//!     // start the next one in the queue. If there was a callback, it will be
+//!     // called here.
+//!     //
+//!     am_hal_iom_queue_service(0, ui32Status);
+//!
+//!     //
+//!     // Clear the interrupts before leaving the ISR.
+//!     //
+//!     am_hal_iom_int_clear(ui32Status);
+//! }
+//! @endcode
+//!
+//! @return
+//
+//*****************************************************************************
+void
+am_hal_iom_queue_service(uint32_t ui32Module, uint32_t ui32Status)
+{
+    //
+    // Validate parameters
+    //
+    if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
+    {
+        return;
+    }
+
+    //
+    // Service the FIFOs in case this was a threshold interrupt.
+    //
+    am_hal_iom_int_service(ui32Module, ui32Status);
+
+    //
+    // If the last interrupt was a "command complete", then the IOM should be
+    // idle already or very soon. Make absolutely sure that the IOM is not in
+    // use, and then start the next transaction in the queue.
+    //
+    if ( ui32Status & AM_HAL_IOM_INT_CMDCMP )
+    {
+        if ( g_psIOMQueue[ui32Module].pui8Data != NULL )
+        {
+            am_hal_iom_queue_start_next_msg(ui32Module);
+        }
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Enable selected IOM Interrupts.
+//!
+//! @param ui32Module - Module number.
+//! @param ui32Interrupt - Use the macro bit fields provided in am_hal_iom.h
+//!
+//! Use this function to enable the IOM interrupts.
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_iom_int_enable(uint32_t ui32Module, uint32_t ui32Interrupt)
+{
+    //
+    // Validate parameters
+    //
+    if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
+    {
+        return;
+    }
+
+    AM_REGn(IOMSTR, ui32Module, INTEN) |= ui32Interrupt;
+}
+
+//*****************************************************************************
+//
+//! @brief Return the enabled IOM Interrupts.
+//!
+//! @param ui32Module - Module number.
+//!
+//! Use this function to return all enabled IOM interrupts.
+//!
+//! @return all enabled IOM interrupts.
+//
+//*****************************************************************************
+uint32_t
+am_hal_iom_int_enable_get(uint32_t ui32Module)
+{
+    //
+    // Validate parameters
+    //
+    if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
+    {
+        return 0;
+    }
+
+    return AM_REGn(IOMSTR, ui32Module, INTEN);
+}
+
+//*****************************************************************************
+//
+//! @brief Disable selected IOM Interrupts.
+//!
+//! @param ui32Module - Module number.
+//! @param ui32Interrupt - Use the macro bit fields provided in am_hal_iom.h
+//!
+//! Use this function to disable the IOM interrupts.
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_iom_int_disable(uint32_t ui32Module, uint32_t ui32Interrupt)
+{
+    //
+    // Validate parameters
+    //
+    if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
+    {
+        return;
+    }
+
+    AM_REGn(IOMSTR, ui32Module, INTEN) &= ~ui32Interrupt;
+}
+
+//*****************************************************************************
+//
+//! @brief Clear selected IOM Interrupts.
+//!
+//! @param ui32Module - Module number.
+//! @param ui32Interrupt - Use the macro bit fields provided in am_hal_iom.h
+//!
+//! Use this function to clear the IOM interrupts.
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_iom_int_clear(uint32_t ui32Module, uint32_t ui32Interrupt)
+{
+    //
+    // Validate parameters
+    //
+    if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
+    {
+        return;
+    }
+
+    AM_REGn(IOMSTR, ui32Module, INTCLR) = ui32Interrupt;
+}
+
+//*****************************************************************************
+//
+//! @brief Set selected IOM Interrupts.
+//!
+//! @param ui32Module - Module number.
+//! @param ui32Interrupt - Use the macro bit fields provided in am_hal_iom.h
+//!
+//! Use this function to set the IOM interrupts.
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_iom_int_set(uint32_t ui32Module, uint32_t ui32Interrupt)
+{
+    //
+    // Validate parameters
+    //
+    if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
+    {
+        return;
+    }
+
+    AM_REGn(IOMSTR, ui32Module, INTSET) = ui32Interrupt;
+}
+
+//*****************************************************************************
+//
+//! @brief Return the IOM Interrupt status.
+//!
+//! @param ui32Module - Module number.
+//! @param bEnabledOnly - return only the enabled interrupts.
+//!
+//! Use this function to get the IOM interrupt status.
+//!
+//! @return interrupt status
+//
+//*****************************************************************************
+uint32_t
+am_hal_iom_int_status_get(uint32_t ui32Module, bool bEnabledOnly)
+{
+    //
+    // Validate parameters
+    //
+    if ( ui32Module >= AM_REG_IOMSTR_NUM_MODULES )
+    {
+        return 0;
+    }
+
+    if ( bEnabledOnly )
+    {
+        uint32_t u32RetVal = AM_REGn(IOMSTR, ui32Module, INTSTAT);
+        return u32RetVal & AM_REGn(IOMSTR, ui32Module, INTEN);
+    }
+    else
+    {
+        return AM_REGn(IOMSTR, ui32Module, INTSTAT);
+    }
+}
+
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_iom.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_iom.h
new file mode 100644
index 000000000..491054951
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_iom.h
@@ -0,0 +1,558 @@
+//*****************************************************************************
+//
+//! @file am_hal_iom.h
+//!
+//! @brief Functions for accessing and configuring the IO Master module
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup iom IO Master (SPI/I2C)
+//! @ingroup hal
+//! @{
+
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#ifndef AM_HAL_IOM_H
+#define AM_HAL_IOM_H
+
+//*****************************************************************************
+//
+// Macro definitions
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+//! @name IOM Clock Frequencies
+//! @brief Macro definitions for common SPI and I2C clock frequencies.
+//!
+//! These macros may be used with the ui32ClockFrequency member of the
+//! am_hal_iom_config_t structure to set the clock frequency of the serial
+//! interfaces.
+//!
+//! This list of frequencies is not exhaustive by any means. If your desired
+//! frequency is not in this list, simply set ui32ClockFrequency to the
+//! desired frequency (in Hz) when calling am_hal_iom_config().
+//
+//*****************************************************************************
+#define AM_HAL_IOM_24MHZ    24000000
+#define AM_HAL_IOM_16MHZ    16000000
+#define AM_HAL_IOM_12MHZ    12000000
+#define AM_HAL_IOM_8MHZ      8000000
+#define AM_HAL_IOM_6MHZ      6000000
+#define AM_HAL_IOM_4MHZ      4000000
+#define AM_HAL_IOM_3MHZ      3000000
+#define AM_HAL_IOM_2MHZ      2000000
+#define AM_HAL_IOM_1_5MHZ    1500000
+#define AM_HAL_IOM_1MHZ      1000000
+#define AM_HAL_IOM_750KHZ     750000
+#define AM_HAL_IOM_500KHZ     500000
+#define AM_HAL_IOM_400KHZ     400000
+#define AM_HAL_IOM_375KHZ     375000
+#define AM_HAL_IOM_250KHZ     250000
+#define AM_HAL_IOM_125KHZ     125000
+#define AM_HAL_IOM_100KHZ     100000
+#define AM_HAL_IOM_50KHZ       50000
+#define AM_HAL_IOM_10KHZ       10000
+
+// Hardware FIFO Size
+#define AM_HAL_IOM_MAX_FIFO_SIZE    128
+
+//*****************************************************************************
+//
+//! @name IOM Physical Protocols
+//! @brief Macro Definitions for general IOM configuration.
+//!
+//! These macros may be used with the am_hal_iom_config_t structure to set the
+//! operating parameters of each serial IO master module. Choose SPIMODE to
+//! select the SPI interface, or I2CMODE to select the I2C interface.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_IOM_SPIMODE                  AM_REG_IOMSTR_CFG_IFCSEL(1)
+#define AM_HAL_IOM_I2CMODE                  AM_REG_IOMSTR_CFG_IFCSEL(0)
+//! @}
+
+//*****************************************************************************
+//
+//! @name IOM Operations
+//! @brief Macro definitions used for ui32Operation parameters.
+//!
+//! These macros may be used to specify which action an IOM command will
+//! execute. The 'OFFSET' operations will cause the IOM hardware to transmit the
+//! provided 1-byte 'offset' before executing the rest of the command.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_IOM_WRITE                    0x00000000
+#define AM_HAL_IOM_READ                     0x80000000
+//! @}
+
+//*****************************************************************************
+//
+//! @name Command Options
+//! @brief Macro definitions used for ui32Options parameters.
+//!
+//! These macros are all related to SPI or I2C command words. They can be used
+//! to set specific options on a per-transaction basis.
+//!
+//! - CS_LOW - Do not raise the CS signal at the end of this SPI command.
+//! - NO_STOP - Do not release the I2C bus with a STOP bit after this command.
+//! - LSB_FIRST - Reverse the payload bits of this command.
+//! - 10BIT_ADDRESS - (I2C only) use a 10-bit I2C address protocol.
+//! - RAW - Don't use an offset byte.
+//! - OFFSET() - Send this 1-byte offset as the first byte of the transaction.
+//!   This can be used to access "registers" in external I2C devices, or add a
+//!   1-byte write to the beginning of a SPI write or read command. See
+//!   "normal mode" operation in the I2C/SPI Master section of the datasheet
+//!   for more information on this parameter.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_IOM_CS_LOW                   0x10000000
+#define AM_HAL_IOM_NO_STOP                  0x10000000
+#define AM_HAL_IOM_LSB_FIRST                0x08000000
+#define AM_HAL_IOM_10BIT_ADDRESS            0x04000000
+#define AM_HAL_IOM_RAW                      0x40000000
+#define AM_HAL_IOM_OFFSET(n)                (((n) << 8) & 0x0000FF00)
+//! @}
+
+//*****************************************************************************
+//
+//! @name IOM Interrupts
+//! @brief Macro definitions for IOM interrupt status bits.
+//!
+//! These macros correspond to the bits in the IOM interrupt status register.
+//! They may be used with any of the \e am_hal_iom_int_x() functions.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_IOM_INT_ARB                  AM_REG_IOMSTR_INTEN_ARB_M
+#define AM_HAL_IOM_INT_STOP                 AM_REG_IOMSTR_INTEN_STOP_M
+#define AM_HAL_IOM_INT_START                AM_REG_IOMSTR_INTEN_START_M
+#define AM_HAL_IOM_INT_ICMD                 AM_REG_IOMSTR_INTEN_ICMD_M
+#define AM_HAL_IOM_INT_IACC                 AM_REG_IOMSTR_INTEN_IACC_M
+#define AM_HAL_IOM_INT_WTLEN                AM_REG_IOMSTR_INTEN_WTLEN_M
+#define AM_HAL_IOM_INT_NAK                  AM_REG_IOMSTR_INTEN_NAK_M
+#define AM_HAL_IOM_INT_FOVFL                AM_REG_IOMSTR_INTEN_FOVFL_M
+#define AM_HAL_IOM_INT_FUNDFL               AM_REG_IOMSTR_INTEN_FUNDFL_M
+#define AM_HAL_IOM_INT_THR                  AM_REG_IOMSTR_INTEN_THR_M
+#define AM_HAL_IOM_INT_CMDCMP               AM_REG_IOMSTR_INTEN_CMDCMP_M
+//! @}
+
+//*****************************************************************************
+//
+//! @name IOM function errors
+//! @brief Return values for IOM HAL function errors, such as with the function
+//!        am_hal_iom_error_status_get().
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_IOM_ERR_INVALID_MODULE       (1 << 30)
+//! @}
+
+//*****************************************************************************
+//
+//! @name Software IOM modules
+//! @brief Macro definitions for using the software I2C interface.
+//!
+//! Use this macro as the module number for standard IOM functions to emulate
+//! them using the bit-banged i2c interface.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_IOM_I2CBB_MODULE             AM_REG_IOMSTR_NUM_MODULES
+//! @}
+
+//*****************************************************************************
+//
+//! @brief Union type for a word-aligned, byte-addressable array.
+//!
+//! This is a convenience macro that may be used to define byte-addressable
+//! arrays with 32-bit alignment. This allows the programmer to define SPI or
+//! I2C transactions as a series of 8-bit values, but also write them to the
+//! IOM FIFO efficiently as a series of 32-bit values.
+//!
+//! Example usage:
+//!
+//! @code
+//!     //
+//!     // Declare a buffer array with at least 3-bytes worth of space.
+//!     //
+//!     am_hal_iom_buffer(3) sBuffer;
+//!
+//!     //
+//!     // Populate the buffer with a 3-byte command.
+//!     //
+//!     sBuffer.bytes[0] = 's';
+//!     sBuffer.bytes[1] = 'p';
+//!     sBuffer.bytes[2] = 'i';
+//!
+//!     //
+//!     // Send the buffer over the spi interface.
+//!     //
+//!     am_hal_iom_spi_write(psDevice, sBuffer.words, 3, 0);
+//!
+//! @endcode
+//
+//*****************************************************************************
+#define am_hal_iom_buffer(A)                                                  \
+    union                                                                     \
+    {                                                                         \
+        uint32_t words[(A + 3) >> 2];                                         \
+        uint8_t bytes[A];                                                     \
+    }
+
+//*****************************************************************************
+//
+//! @brief Configuration structure for the IO master module.
+//
+//*****************************************************************************
+typedef struct
+{
+    //
+    //! @brief Selects the physical protocol for the IO master module. Choose
+    //! either AM_HAL_IOM_SPIMODE or AM_HAL_IOM_I2CMODE.
+    //
+    uint32_t ui32InterfaceMode;
+
+    //
+    //! @brief Selects the output clock frequency for SPI or I2C mode. Choose
+    //! one of the AM_HAL_IOM_nMHZ or AM_HAL_IOM_nKHZ macros.
+    //
+    uint32_t ui32ClockFrequency;
+
+    //
+    //! Select the SPI clock phase (unused in I2C mode).
+    //
+    bool bSPHA;
+
+    //
+    //! Select the SPI clock polarity (unused in I2C mode).
+    //
+    bool bSPOL;
+
+    //
+    //! @brief Select the FIFO write threshold.
+    //!
+    //! The IOM controller will generate a processor interrupt when the number
+    //! of entries in the FIFO goes *below* this number.
+    //
+    uint8_t ui8WriteThreshold;
+
+    //
+    //! @brief Select the FIFO read threshold.
+    //!
+    //! The IOM controller will generate a processor interrupt when the number
+    //! of entries in the FIFO grows *larger* than this number.
+    //
+    uint8_t ui8ReadThreshold;
+}
+am_hal_iom_config_t;
+
+//*****************************************************************************
+//
+//! Configuration structure for an individual SPI device.
+//
+//*****************************************************************************
+typedef struct
+{
+    //
+    //! IOM module to use for communicating with this device.
+    //
+    uint32_t ui32Module;
+
+    //
+    //! Chip select signal that should be used for this device.
+    //
+    uint32_t ui32ChipSelect;
+
+    //
+    //! Additional options that will ALWAYS be ORed into the command word.
+    //
+    uint32_t ui32Options;
+}
+am_hal_iom_spi_device_t;
+
+//*****************************************************************************
+//
+//! Configuration structure for an individual I2C device.
+//
+//*****************************************************************************
+typedef struct
+{
+    //
+    //! IOM module to use for communicating with this device.
+    //
+    uint32_t ui32Module;
+
+    //
+    //! I2C address associated with this device.
+    //
+    uint32_t ui32BusAddress;
+
+    //
+    //! Additional options that will ALWAYS be ORed into the command word.
+    //
+    uint32_t ui32Options;
+}
+am_hal_iom_i2c_device_t;
+
+//*****************************************************************************
+//
+// Typedef for non-blocking function callbacks.
+//
+//*****************************************************************************
+typedef void (*am_hal_iom_callback_t)(void);
+
+//*****************************************************************************
+//
+// Typedef for a function that waits until the IOM queue is empty.
+//
+//*****************************************************************************
+typedef void (*am_hal_iom_queue_flush_t)(uint32_t);
+
+extern am_hal_iom_queue_flush_t am_hal_iom_queue_flush;
+
+
+//*****************************************************************************
+//
+// Operations
+//
+//*****************************************************************************
+#define AM_HAL_IOM_QUEUE_SPI_WRITE                 0
+#define AM_HAL_IOM_QUEUE_SPI_READ                  1
+#define AM_HAL_IOM_QUEUE_I2C_WRITE                 2
+#define AM_HAL_IOM_QUEUE_I2C_READ                  3
+
+//*****************************************************************************
+//
+// Structure to hold IOM operations.
+//
+//*****************************************************************************
+typedef struct
+{
+    uint32_t ui32Operation;
+    uint32_t ui32Module;
+    uint32_t ui32ChipSelect;
+    uint32_t *pui32Data;
+    uint32_t ui32NumBytes;
+    uint32_t ui32Options;
+    am_hal_iom_callback_t pfnCallback;
+}
+am_hal_iom_queue_entry_t;
+
+//*****************************************************************************
+//
+// Structure to hold IOM configuration during module power-down.
+//
+//*****************************************************************************
+typedef struct
+{
+    uint32_t FIFOTHR;
+    uint32_t CLKCFG;
+    uint32_t CFG;
+    uint32_t INTEN;
+    uint32_t bValid;
+}
+am_hal_iom_pwrsave_t;
+
+//*****************************************************************************
+//
+// Global variables
+//
+//*****************************************************************************
+extern am_hal_iom_pwrsave_t am_hal_iom_pwrsave[AM_REG_IOMSTR_NUM_MODULES];
+extern uint32_t g_iom_error_status;
+
+//*****************************************************************************
+//
+// External function definitions
+//
+//*****************************************************************************
+extern void     am_hal_iom_pwrctrl_enable(uint32_t ui32Module);
+extern void     am_hal_iom_pwrctrl_disable(uint32_t ui32Module);
+extern void     am_hal_iom_power_on_restore(uint32_t ui32Module);
+extern void     am_hal_iom_power_off_save(uint32_t ui32Module);
+extern void     am_hal_iom_config(uint32_t ui32Module,
+                                  const am_hal_iom_config_t *psConfig);
+extern uint32_t am_hal_iom_frequency_get(uint32_t ui32Module);
+extern void     am_hal_iom_enable(uint32_t ui32Module);
+extern void     am_hal_iom_disable(uint32_t ui32Module);
+extern void     am_hal_iom_spi_write(uint32_t ui32Module, uint32_t ui32ChipSelect,
+                                     uint32_t *pui32Data, uint32_t ui32NumBytes,
+                                     uint32_t ui32Options);
+extern void     am_hal_iom_spi_read(uint32_t ui32Module, uint32_t ui32ChipSelect,
+                                    uint32_t *pui32Data, uint32_t ui32NumBytes,
+                                    uint32_t ui32Options);
+extern void     am_hal_iom_spi_write_nq(uint32_t ui32Module, uint32_t ui32ChipSelect,
+                                        uint32_t *pui32Data, uint32_t ui32NumBytes,
+                                        uint32_t ui32Options);
+extern void     am_hal_iom_spi_read_nq(uint32_t ui32Module, uint32_t ui32ChipSelect,
+                                       uint32_t *pui32Data, uint32_t ui32NumBytes,
+                                       uint32_t ui32Options);
+extern void     am_hal_iom_spi_write_nb(uint32_t ui32Module, uint32_t ui32ChipSelect,
+                                        uint32_t *pui32Data, uint32_t ui32NumBytes,
+                                        uint32_t ui32Options,
+                                        am_hal_iom_callback_t pfnCallback);
+extern void     am_hal_iom_spi_read_nb(uint32_t ui32Module, uint32_t ui32ChipSelect,
+                                       uint32_t *pui32Data, uint32_t ui32NumBytes,
+                                       uint32_t ui32Options,
+                                       am_hal_iom_callback_t pfnCallback);
+extern void     am_hal_iom_spi_cmd_run(uint32_t ui32Operation,
+                                       uint32_t ui32Module,
+                                       uint32_t ui32ChipSelect,
+                                       uint32_t ui32NumBytes,
+                                       uint32_t ui32Options);
+extern void     am_hal_iom_i2c_write(uint32_t ui32Module,
+                                     uint32_t ui32BusAddress,
+                                     uint32_t *pui32Data,
+                                     uint32_t ui32NumBytes,
+                                     uint32_t ui32Options);
+extern void     am_hal_iom_i2c_read(uint32_t ui32Module,
+                                    uint32_t ui32BusAddress,
+                                    uint32_t *pui32Data,
+                                    uint32_t ui32NumBytes,
+                                    uint32_t ui32Options);
+extern void     am_hal_iom_i2c_write_nq(uint32_t ui32Module,
+                                        uint32_t ui32BusAddress,
+                                        uint32_t *pui32Data,
+                                        uint32_t ui32NumBytes,
+                                        uint32_t ui32Options);
+extern void     am_hal_iom_i2c_read_nq(uint32_t ui32Module,
+                                       uint32_t ui32BusAddress,
+                                       uint32_t *pui32Data,
+                                       uint32_t ui32NumBytes,
+                                       uint32_t ui32Options);
+extern void     am_hal_iom_i2c_write_nb(uint32_t ui32Module,
+                                        uint32_t ui32BusAddress,
+                                        uint32_t *pui32Data,
+                                        uint32_t ui32NumBytes,
+                                        uint32_t ui32Options,
+                                        am_hal_iom_callback_t pfnCallback);
+extern void     am_hal_iom_i2c_read_nb(uint32_t ui32Module,
+                                       uint32_t ui32BusAddress,
+                                       uint32_t *pui32Data,
+                                       uint32_t ui32NumBytes,
+                                       uint32_t ui32Options,
+                                       am_hal_iom_callback_t pfnCallback);
+extern void     am_hal_iom_i2c_cmd_run(uint32_t ui32Operation,
+                                       uint32_t ui32Module,
+                                       uint32_t ui32BusAddress,
+                                       uint32_t ui32NumBytes,
+                                       uint32_t ui32Options);
+extern void     am_hal_iom_command_repeat_set(uint32_t ui32Module,
+                                              uint32_t ui32CmdCount);
+extern uint32_t am_hal_iom_status_get(uint32_t ui32Module);
+extern uint32_t am_hal_iom_error_status_get(uint32_t ui32Module);
+extern uint32_t am_hal_iom_fifo_write(uint32_t ui32Module, uint32_t *pui32Data,
+                                      uint32_t ui32NumBytes);
+extern uint32_t am_hal_iom_fifo_read(uint32_t ui32Module, uint32_t *pui32Data,
+                                     uint32_t ui32NumBytes);
+extern uint8_t  am_hal_iom_fifo_empty_slots(uint32_t ui32Module);
+extern uint8_t  am_hal_iom_fifo_full_slots(uint32_t ui32Module);
+extern void     am_hal_iom_poll_complete(uint32_t ui32Module);
+extern void     am_hal_iom_int_service(uint32_t ui32Module, uint32_t ui32Status);
+extern void     am_hal_iom_int_enable(uint32_t ui32Module, uint32_t ui32Interrupt);
+extern uint32_t am_hal_iom_int_enable_get(uint32_t ui32Module);
+extern void     am_hal_iom_int_disable(uint32_t ui32Module, uint32_t ui32Interrupt);
+extern void     am_hal_iom_int_clear(uint32_t ui32Module, uint32_t ui32Interrupt);
+extern void     am_hal_iom_int_set(uint32_t ui32Module, uint32_t ui32Interrupt);
+extern uint32_t am_hal_iom_int_status_get(uint32_t ui32Module, bool bEnabledOnly);
+extern void     am_hal_iom_queue_init(uint32_t ui32ModuleNum,
+                                      am_hal_iom_queue_entry_t *psQueueMemory,
+                                      uint32_t ui32QueueMemSize);
+extern uint32_t am_hal_iom_queue_length_get(uint32_t ui32Module);
+extern void     am_hal_iom_sleeping_queue_flush(uint32_t ui32Module);
+extern void     am_hal_iom_queue_spi_write(uint32_t ui32Module, uint32_t ui32ChipSelect,
+                                           uint32_t *pui32Data, uint32_t ui32NumBytes,
+                                           uint32_t ui32Options,
+                                           am_hal_iom_callback_t pfnCallback);
+extern void     am_hal_iom_queue_spi_read(uint32_t ui32Module, uint32_t ui32ChipSelect,
+                                          uint32_t *pui32Data, uint32_t ui32NumBytes,
+                                          uint32_t ui32Options,
+                                          am_hal_iom_callback_t pfnCallback);
+extern void     am_hal_iom_queue_i2c_write(uint32_t ui32Module, uint32_t ui32BusAddress,
+                                           uint32_t *pui32Data, uint32_t ui32NumBytes,
+                                           uint32_t ui32Options,
+                                           am_hal_iom_callback_t pfnCallback);
+extern void     am_hal_iom_queue_i2c_read(uint32_t ui32Module, uint32_t ui32BusAddress,
+                                          uint32_t *pui32Data, uint32_t ui32NumBytes,
+                                          uint32_t ui32Options,
+                                          am_hal_iom_callback_t pfnCallback);
+extern void     am_hal_iom_queue_start_next_msg(uint32_t ui32Module);
+extern void     am_hal_iom_queue_service(uint32_t ui32Module, uint32_t ui32Status);
+
+//*****************************************************************************
+//
+// Helper functions.
+//
+//*****************************************************************************
+#define AM_IOMASTER_ISR_QUEUE(x)                            \
+void am_iomaster##x##_isr(void)                             \
+{                                                           \
+    uint32_t ui32IntStatus;                                 \
+    g_iom_error_status = am_hal_iom_error_status_get(x);    \
+    ui32IntStatus = am_hal_iom_int_status_get(x, false);    \
+    am_hal_iom_int_clear(x, ui32IntStatus);                 \
+    am_hal_iom_queue_service(x, ui32IntStatus);             \
+}
+
+#define AM_IOMASTER_ISR_NB(x)                               \
+void am_iomaster##x##_isr(void)                             \
+{                                                           \
+    uint32_t ui32IntStatus;                                 \
+    g_iom_error_status = am_hal_iom_error_status_get(x);    \
+    ui32IntStatus = am_hal_iom_int_status_get(x, false);    \
+    am_hal_iom_int_clear(x, ui32IntStatus);                 \
+    am_hal_iom_int_service(x, ui32IntStatus);               \
+}
+
+#endif // AM_HAL_IOM_H
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_ios.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_ios.c
new file mode 100644
index 000000000..bff1ef9cd
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_ios.c
@@ -0,0 +1,1303 @@
+//*****************************************************************************
+//
+//! @file am_hal_ios.c
+//!
+//! @brief Functions for interfacing with the IO Slave module
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup ios IO Slave (SPI/I2C)
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "am_mcu_apollo.h"
+
+//*****************************************************************************
+//
+// SRAM Buffer structure
+//
+//*****************************************************************************
+typedef struct
+{
+    uint8_t           *pui8Data;
+    volatile uint32_t ui32WriteIndex;
+    volatile uint32_t ui32ReadIndex;
+    volatile uint32_t ui32Length;
+    uint32_t          ui32Capacity;
+}
+am_hal_ios_buffer_t;
+
+am_hal_ios_buffer_t g_sSRAMBuffer;
+
+//*****************************************************************************
+//
+// Forward declarations of static funcitons.
+//
+//*****************************************************************************
+static void am_hal_ios_buffer_init(am_hal_ios_buffer_t *psBuffer,
+                                   void *pvArray, uint32_t ui32Bytes);
+
+static void fifo_write(uint8_t *pui8Data, uint32_t ui32NumBytes);
+
+//*****************************************************************************
+//
+// Function-like macros.
+//
+//*****************************************************************************
+#define am_hal_ios_buffer_empty(psBuffer)                                   \
+    ((psBuffer)->ui32Length == 0)
+
+#define am_hal_ios_buffer_full(psBuffer)                                    \
+    ((psBuffer)->ui32Length == (psBuffer)->ui32Capacity)
+
+#define am_hal_ios_buffer_data_left(psBuffer)                               \
+    ((psBuffer)->ui32Length)
+
+//*****************************************************************************
+//
+// Global Variables
+//
+//*****************************************************************************
+volatile uint8_t * const am_hal_ios_pui8LRAM = (uint8_t *)REG_IOSLAVE_BASEADDR;
+uint8_t *g_pui8FIFOBase = (uint8_t *) REG_IOSLAVE_BASEADDR;
+uint8_t *g_pui8FIFOEnd = (uint8_t *) REG_IOSLAVE_BASEADDR;
+uint8_t *g_pui8FIFOPtr = (uint8_t *) REG_IOSLAVE_BASEADDR;
+uint8_t g_ui32HwFifoSize = 0;
+uint32_t g_ui32FifoBaseOffset = 0;
+
+//*****************************************************************************
+//
+//! @brief Enable the IOS in the power control block.
+//!
+//! This function enables the IOS module in the power control block.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ios_pwrctrl_enable(void)
+{
+    am_hal_pwrctrl_periph_enable(AM_HAL_PWRCTRL_IOS);
+}
+
+//*****************************************************************************
+//
+//! @brief Disable the IOS in the power control block.
+//!
+//! This function disables the IOS module in the power control block.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ios_pwrctrl_disable(void)
+{
+    am_hal_pwrctrl_periph_disable(AM_HAL_PWRCTRL_IOS);
+}
+
+//*****************************************************************************
+//
+//! @brief Enables the IOS module
+//!
+//! This function enables the IOSLAVE module using the IFCEN bitfield in the
+//! IOSLAVE_CFG register.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ios_enable(uint32_t ui32Module)
+{
+    AM_REGn(IOSLAVE, ui32Module, CFG) |= AM_REG_IOSLAVE_CFG_IFCEN(1);
+}
+
+//*****************************************************************************
+//
+//! @brief Disables the IOSLAVE module.
+//!
+//! This function disables the IOSLAVE module using the IFCEN bitfield in the
+//! IOSLAVE_CFG register.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ios_disable(uint32_t ui32Module)
+{
+    AM_REGn(IOSLAVE, ui32Module, CFG) &= ~(AM_REG_IOSLAVE_CFG_IFCEN(1));
+}
+
+//*****************************************************************************
+//
+//! @brief Configure the IOS module.
+//!
+//! This function reads the an \e am_hal_ios_config_t structure and uses it to
+//! set up the IO Slave module. Please see the information on the configuration
+//! structure for more information on the parameters that may be set by this
+//! function.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ios_config(am_hal_ios_config_t *psConfig)
+{
+    uint32_t ui32LRAMConfig;
+
+    am_hal_pwrctrl_periph_enable(AM_HAL_PWRCTRL_IOS);
+
+    //
+    // Record the FIFO parameters for later use.
+    //
+    g_pui8FIFOBase = (uint8_t *)(REG_IOSLAVE_BASEADDR + psConfig->ui32FIFOBase);
+    g_pui8FIFOEnd = (uint8_t *)(REG_IOSLAVE_BASEADDR + psConfig->ui32RAMBase);
+    g_ui32HwFifoSize = g_pui8FIFOEnd - g_pui8FIFOBase;
+    g_ui32FifoBaseOffset = psConfig->ui32FIFOBase;
+
+    //
+    // Caluclate the value for the IO Slave FIFO configuration register.
+    //
+    ui32LRAMConfig = AM_REG_IOSLAVE_FIFOCFG_ROBASE(psConfig->ui32ROBase >> 3);
+    ui32LRAMConfig |= AM_REG_IOSLAVE_FIFOCFG_FIFOBASE(psConfig->ui32FIFOBase >> 3);
+    ui32LRAMConfig |= AM_REG_IOSLAVE_FIFOCFG_FIFOMAX(psConfig->ui32RAMBase >> 3);
+
+    //
+    // Just in case, disable the IOS
+    //
+    am_hal_ios_disable(0);
+
+    //
+    // Write the configuration register with the user's selected interface
+    // characteristics.
+    //
+    AM_REG(IOSLAVE, CFG) = psConfig->ui32InterfaceSelect;
+
+    //
+    // Write the FIFO configuration register to set the memory map for the LRAM.
+    //
+    AM_REG(IOSLAVE, FIFOCFG) = ui32LRAMConfig;
+
+    //
+    // Enable the IOS. The following configuration options can't be set while
+    // the IOS is disabled.
+    //
+    am_hal_ios_enable(0);
+
+    //
+    // Initialize the FIFO pointer to the beginning of the FIFO section.
+    //
+    am_hal_ios_fifo_ptr_set(psConfig->ui32FIFOBase);
+
+    //
+    // Write the FIFO threshold register.
+    //
+    AM_REG(IOSLAVE, FIFOTHR) = psConfig->ui32FIFOThreshold;
+}
+
+//*****************************************************************************
+//
+//! @brief Set bits in the HOST side IOINTCTL register.
+//!
+//! This function may be used to set an interrupt bit to the host.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ios_host_int_set(uint32_t ui32Interrupt)
+{
+    //
+    // Set a bit that will cause an interrupt to the host.
+    //
+    AM_REG(IOSLAVE, IOINTCTL) = AM_REG_IOSLAVE_IOINTCTL_IOINTSET(ui32Interrupt);
+}
+
+//*****************************************************************************
+//
+//! @brief Clear bits in the HOST side IOINTCTL register.
+//!
+//! This function may be used to clear an interrupt bit to the host.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ios_host_int_clear(uint32_t ui32Interrupt)
+{
+    //
+    // Clear bits that will cause an interrupt to the host.
+    //
+    AM_REG(IOSLAVE, IOINTCTL) = AM_REG_IOSLAVE_IOINTCTL_IOINTCLR(ui32Interrupt);
+}
+
+//*****************************************************************************
+//
+//! @brief Get the bits in the HOST side IOINTCTL register.
+//!
+//! This function may be used to read the host side interrupt bits.
+//!
+//! @return None.
+//
+//*****************************************************************************
+uint32_t
+am_hal_ios_host_int_get(void)
+{
+    //
+    // return the value of the bits that will cause an interrupt to the host.
+    //
+    return AM_BFR(IOSLAVE, IOINTCTL, IOINT);
+}
+
+//*****************************************************************************
+//
+//! @brief Get the enable bits in the HOST side IOINTCTL register.
+//!
+//! This function may be used to read the host side interrupt bits.
+//!
+//! @return None.
+//
+//*****************************************************************************
+uint32_t
+am_hal_ios_host_int_enable_get(void)
+{
+    //
+    // return the value of the bits that will cause an interrupt to the host.
+    //
+    return AM_BFR(IOSLAVE, IOINTCTL, IOINTEN);
+}
+
+//*****************************************************************************
+//
+//! @brief Enable an IOS Access Interrupt.
+//!
+//! This function may be used to enable an interrupt to the NVIC.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ios_access_int_enable(uint32_t ui32Interrupt)
+{
+    //
+    // OR the desired interrupt into the enable register.
+    //
+    AM_REG(IOSLAVE, REGACCINTEN) |= ui32Interrupt;
+}
+
+//*****************************************************************************
+//
+//! @brief Return all enabled IOS Access Interrupts.
+//!
+//! This function may be used to return all enabled IOS Access interrupts.
+//!
+//! @return the enabled interrrupts.
+//
+//*****************************************************************************
+uint32_t
+am_hal_ios_access_int_enable_get(void)
+{
+    //
+    // Return the enabled interrupts.
+    //
+    return AM_REG(IOSLAVE, REGACCINTEN);
+}
+
+//*****************************************************************************
+//
+//! @brief Disable an IOS Access Interrupt.
+//!
+//! This function may be used to disable an interrupt to the NVIC.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ios_access_int_disable(uint32_t ui32Interrupt)
+{
+    //
+    // Clear the desired bit from the interrupt enable register.
+    //
+    AM_REG(IOSLAVE, REGACCINTEN) &= ~(ui32Interrupt);
+}
+
+//*****************************************************************************
+//
+//! @brief Clear an IOS Access Interrupt.
+//!
+//! This function may be used to clear an interrupt to the NVIC.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ios_access_int_clear(uint32_t ui32Interrupt)
+{
+    //
+    // Use the interrupt clear register to deactivate the chosen interrupt.
+    //
+    AM_REG(IOSLAVE, REGACCINTCLR) = ui32Interrupt;
+}
+
+//*****************************************************************************
+//
+//! @brief Set an IOS Access Interrupt.
+//!
+//! This function may be used to set an interrupt to the NVIC.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ios_access_int_set(uint32_t ui32Interrupt)
+{
+    //
+    // Use the interrupt set register to activate the chosen interrupt.
+    //
+    AM_REG(IOSLAVE, REGACCINTSET) = ui32Interrupt;
+}
+
+//*****************************************************************************
+//
+//! @brief Check the status of an IOS Access Interrupt.
+//!
+//! @param bEnabledOnly - return only the enabled interrupt status.
+//!
+//! This function may be used to return the enabled interrupt status.
+//!
+//! @return the enabled interrupt status.
+//
+//*****************************************************************************
+uint32_t
+am_hal_ios_access_int_status_get(bool bEnabledOnly)
+{
+    if ( bEnabledOnly )
+    {
+        uint32_t u32RetVal = AM_REG(IOSLAVE, REGACCINTSTAT);
+        return u32RetVal & AM_REG(IOSLAVE, REGACCINTEN);
+
+    }
+    else
+    {
+        return AM_REG(IOSLAVE, REGACCINTSTAT);
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Enable an IOS Interrupt.
+//!
+//! @param ui32Interrupt - desired interrupts.
+//!
+//! This function may be used to enable an interrupt to the NVIC.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ios_int_enable(uint32_t ui32Interrupt)
+{
+    //
+    // OR the desired interrupt into the enable register.
+    //
+    AM_REG(IOSLAVE, INTEN) |= ui32Interrupt;
+}
+
+//*****************************************************************************
+//
+//! @brief Return all enabled IOS Interrupts.
+//!
+//! This function may be used to return all enabled IOS interrupts.
+//!
+//! @return the enabled interrrupts.
+//
+//*****************************************************************************
+uint32_t
+am_hal_ios_int_enable_get(void)
+{
+    //
+    // Return the enabled interrupts.
+    //
+    return AM_REG(IOSLAVE, INTEN);
+}
+
+//*****************************************************************************
+//
+//! @brief Disable an IOS Interrupt.
+//!
+//! @param ui32Interrupt - desired interrupts.
+//!
+//! This function may be used to disable an interrupt to the NVIC.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ios_int_disable(uint32_t ui32Interrupt)
+{
+    //
+    // Clear the desired bit from the interrupt enable register.
+    //
+    AM_REG(IOSLAVE, INTEN) &= ~(ui32Interrupt);
+}
+
+//*****************************************************************************
+//
+//! @brief Clear an IOS Interrupt.
+//!
+//! @param ui32Interrupt - desired interrupts.
+//!
+//! This function may be used to clear an interrupt to the NVIC.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ios_int_clear(uint32_t ui32Interrupt)
+{
+    //
+    // Use the interrupt clear register to deactivate the chosen interrupt.
+    //
+    AM_REG(IOSLAVE, INTCLR) = ui32Interrupt;
+}
+
+//*****************************************************************************
+//
+//! @brief Set an IOS Interrupt.
+//!
+//! @param ui32Interrupt - desired interrupts.
+//!
+//! This function may be used to set an interrupt to the NVIC.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ios_int_set(uint32_t ui32Interrupt)
+{
+    //
+    // Use the interrupt clear register to deactivate the chosen interrupt.
+    //
+    AM_REG(IOSLAVE, INTSET) = ui32Interrupt;
+}
+
+//*****************************************************************************
+//
+//! @brief Write to the LRAM.
+//!
+//! @param ui32Offset - offset into the LRAM to write.
+//! @param ui8Value - value to be written.
+//!
+//! This function writes ui8Value to offset ui32Offset inside the LRAM.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ios_lram_write(uint32_t ui32Offset, uint8_t ui8Value)
+{
+    //
+    // Write the LRAM.
+    //
+    am_hal_ios_pui8LRAM[ui32Offset] = ui8Value;
+}
+
+//*****************************************************************************
+//
+//! @brief Read from the LRAM.
+//!
+//! @param ui32Offset - offset into the LRAM to read.
+//!
+//! This function read from offset ui32Offset inside the LRAM.
+//!
+//! @return the value at ui32Offset.
+//
+//*****************************************************************************
+uint8_t
+am_hal_ios_lram_read(uint32_t ui32Offset)
+{
+    //
+    // Read the LRAM.
+    //
+    return am_hal_ios_pui8LRAM[ui32Offset];
+}
+
+//*****************************************************************************
+//
+//! @brief Check the status of an IOS Interrupt.
+//!
+//! @param bEnabledOnly - return only the enabled interrupt status.
+//!
+//! This function may be used to return the enabled interrupt status.
+//!
+//! @return the enabled interrupt status.
+//
+//*****************************************************************************
+uint32_t
+am_hal_ios_int_status_get(bool bEnabledOnly)
+{
+    if ( bEnabledOnly )
+    {
+        uint32_t u32RetVal = AM_REG(IOSLAVE, INTSTAT);
+        return u32RetVal & AM_REG(IOSLAVE, INTEN);
+
+    }
+    else
+    {
+        return AM_REG(IOSLAVE, INTSTAT);
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Check the amount of space used in the FIFO
+//!
+//! This function returns the available data in the overall FIFO yet to be
+//! read by the host. This takes into account the SRAM buffer and hardware FIFO
+//!
+//! @return Bytes used in the Overall FIFO.
+//
+//*****************************************************************************
+uint32_t
+am_hal_ios_fifo_space_used(void)
+{
+    uint32_t ui32Val;
+    uint32_t ui32Primask;
+    //
+    // Start a critical section for thread safety.
+    //
+    ui32Primask = am_hal_interrupt_master_disable();
+    ui32Val = g_sSRAMBuffer.ui32Length;
+    ui32Val += AM_BFR(IOSLAVE, FIFOPTR, FIFOSIZ);
+    //
+    // End the critical section
+    //
+    am_hal_interrupt_master_set(ui32Primask);
+    return ui32Val;
+}
+
+
+
+//*****************************************************************************
+//
+//! @brief Check the amount of space left in the FIFO
+//!
+//! This function returns the available space in the overall FIFO to accept
+//! new data. This takes into account the SRAM buffer and hardware FIFO
+//!
+//! @return Bytes left in the Overall FIFO.
+//
+//*****************************************************************************
+uint32_t
+am_hal_ios_fifo_space_left(void)
+{
+    uint32_t ui32Val;
+    uint32_t ui32Primask;
+    //
+    // Start a critical section for thread safety.
+    //
+    ui32Primask = am_hal_interrupt_master_disable();
+    //
+    // We waste one byte in HW FIFO
+    //
+    ui32Val = g_sSRAMBuffer.ui32Capacity + g_ui32HwFifoSize - 1;
+    ui32Val -= g_sSRAMBuffer.ui32Length;
+    ui32Val -= AM_BFR(IOSLAVE, FIFOPTR, FIFOSIZ);
+    //
+    // End the critical section
+    //
+    am_hal_interrupt_master_set(ui32Primask);
+    return ui32Val;
+}
+
+//*****************************************************************************
+//
+//! @brief Check the amount of space left in the hardware FIFO
+//!
+//! This function reads the IOSLAVE FIFOPTR register and determines the amount
+//! of space left in the IOS LRAM FIFO.
+//!
+//! @return Bytes left in the IOS FIFO.
+//
+//*****************************************************************************
+static uint32_t
+fifo_space_left(void)
+{
+    //
+    // We waste one byte in HW FIFO
+    //
+    return ((uint32_t)g_ui32HwFifoSize- AM_BFR(IOSLAVE, FIFOPTR, FIFOSIZ) - 1);
+}
+
+//*****************************************************************************
+//
+// Helper function for managing IOS FIFO writes.
+//
+//*****************************************************************************
+static void
+fifo_write(uint8_t *pui8Data, uint32_t ui32NumBytes)
+{
+    uint8_t *pFifoPtr = g_pui8FIFOPtr;
+    uint8_t *pFifoBase = g_pui8FIFOBase;
+    uint8_t *pFifoEnd = g_pui8FIFOEnd;
+    while ( ui32NumBytes )
+    {
+        //
+        // Write the data to the FIFO
+        //
+        *pFifoPtr++ = *pui8Data++;
+        ui32NumBytes--;
+
+        //
+        // Make sure to wrap the FIFO pointer if necessary.
+        //
+        if ( pFifoPtr == pFifoEnd )
+        {
+            pFifoPtr = pFifoBase;
+        }
+    }
+    g_pui8FIFOPtr = pFifoPtr;
+}
+
+//
+// Assembly code below assumes 8bit FIFOSIZ field aligned at a byte boundary
+//
+#if (((AM_REG_IOSLAVE_FIFOPTR_FIFOSIZ_M >> AM_REG_IOSLAVE_FIFOPTR_FIFOSIZ_S) != 0xFF) \
+        || (AM_REG_IOSLAVE_FIFOPTR_FIFOSIZ_S & 0x3))
+#error "FIFOSIZ not 8bit value aligned at byte offset"
+#endif
+
+//
+// Byte offset of FIFOSIZ field in FIFOPTR register
+//
+#define BYTEOFFSET_FIFOSIZE             (AM_REG_IOSLAVE_FIFOPTR_FIFOSIZ_S >> 3)
+
+//*****************************************************************************
+//
+// Helper function in assembly for implementing the ReSync
+//
+//*****************************************************************************
+#if defined(__GNUC_STDC_INLINE__)
+#if (AM_REG_IOSLAVE_FIFOPTR_FIFOSIZ_S != 8)
+#error "AM_REG_IOSLAVE_FIFOPTR_FIFOSIZ_S not 8"
+#endif
+__attribute__((naked))
+static void
+internal_resync_fifoSize(uint32_t wrOffset, uint32_t maxFifoSize, uint32_t hwFifoPtrRegAddr)
+{
+    __asm
+    (
+        "   push    {r3,r4}\n\t"                  // Save r3, r4 - used by this function
+        "__internal_resync_fifoSize_loop:\n\t"
+        "   ldr     r4, [r2]\n\t"                 // Load FIFOPTR register in r4
+        "   ubfx    r3, r4, #8, #8\n\t"           // Extract hwFifoSize to r3
+        "   uxtb    r4, r4\n\t"                   // Extract rdOffset in r4
+        "   subs    r4, r0, r4\n\t"               // fifoSize in r4 = wrOffset - rdOffset
+        "   it      cc\n\t"                       // if (wrOffset < rdOffset)
+        "   addcc   r4, r4, r1\n\t"               //     fifoSize = maxFifoSize - (rdOffset - wrOffset)
+        "   cmp     r3, r4\n\t"                   // (hwFifoSize != fifoSize)
+        "   beq     __internal_resync_fifosize_done\n\t"
+        "   strb    r4, [r2, #1]\n\t"             // Overwrite FIFOSIZ value with fifoSize
+        "   b       __internal_resync_fifoSize_loop\n\t" // Repeat the check
+        "__internal_resync_fifosize_done:\n\t"
+        "   pop     {r3,r4}\n\t"                  // Restore registers
+        "   bx      lr\n\t"
+    );
+}
+
+#elif defined(__ARMCC_VERSION)
+__asm static void
+internal_resync_fifoSize(uint32_t wrOffset, uint32_t maxFifoSize, uint32_t hwFifoPtrRegAddr)
+{
+    push    {r3, r4}                 // Save r3, r4 - used by this function
+internal_resync_fifoSize_loop
+    ldr     r4, [r2]                 // Load FIFOPTR register in r4
+    ubfx    r3, r4, #AM_REG_IOSLAVE_FIFOPTR_FIFOSIZ_S, #8 // Extract hwFifoSize to r3
+    uxtb    r4, r4                   // Extract rdOffset in r4
+    subs    r4, r0, r4               // fifoSize in r4 = wrOffset - rdOffset
+    it      cc                       // if (wrOffset < rdOffset),
+    addcc   r4, r4, r1               //     fifoSize = maxFifoSize - (rdOffset - wrOffset)
+    cmp     r3, r4                   // (hwFifoSize != fifoSize)
+    beq     internal_resync_fifosize_done
+    strb    r4, [r2, #1]             // Overwrite FIFOSIZ value with fifoSize
+    b       internal_resync_fifoSize_loop // Repeat the check
+internal_resync_fifosize_done
+    pop     {r3, r4}                 // Restore registers
+    bx      lr
+}
+
+#elif defined(__IAR_SYSTEMS_ICC__)
+#if (AM_REG_IOSLAVE_FIFOPTR_FIFOSIZ_S != 8)
+#error "AM_REG_IOSLAVE_FIFOPTR_FIFOSIZ_S not 8"
+#endif
+__stackless static void
+internal_resync_fifoSize(uint32_t wrOffset, uint32_t maxFifoSize, uint32_t hwFifoPtrRegAddr)
+{
+    __asm volatile (
+          "    push    {r3,r4}\n"                  // Save r3, r4 - used by this function
+          "__internal_resync_fifoSize_loop:\n"
+          "    ldr     r4, [r2]\n"                 // Load FIFOPTR register in r4
+          "    ubfx    r3, r4, #8, #8\n"           // Extract hwFifoSize to r3
+          "    uxtb    r4, r4\n"                   // Extract rdOffset in r4
+          "    subs    r4, r0, r4\n"               // fifoSize in r4 = wrOffset - rdOffset
+          "    it      cc\n"
+          "    addcc   r4, r4, r1\n"               //     fifoSize = maxFifoSize - (rdOffset - wrOffset)
+          "    cmp     r3, r4\n"                   // (fifoSize != hwFifoSize)
+          "    beq     __internal_resync_fifosize_done\n"
+          "    strb    r4, [r2, #1]\n"             // Overwrite FIFOSIZ value with fifoSize
+          "    b       __internal_resync_fifoSize_loop\n" // Repeat the check
+          "__internal_resync_fifosize_done:\n"
+          "    pop     {r3,r4}\n"                  // Restore registers
+          "    bx      lr\n"
+          );
+}
+
+#else
+static void
+internal_resync_fifoSize(uint32_t wrOffset, uint32_t maxFifoSize, uint32_t hwFifoPtrRegAddr)
+{
+    uint32_t fifoSize;
+    uint32_t hwFifoPtrReg;
+    uint32_t rdOffset;
+    uint32_t hwFifoSize;
+
+    hwFifoPtrReg = AM_REGVAL(hwFifoPtrRegAddr);
+    rdOffset = ((hwFifoPtrReg & AM_REG_IOSLAVE_FIFOPTR_FIFOPTR_M) >> AM_REG_IOSLAVE_FIFOPTR_FIFOPTR_S);
+    hwFifoSize = (hwFifoPtrReg & AM_REG_IOSLAVE_FIFOPTR_FIFOSIZ_M) >> AM_REG_IOSLAVE_FIFOPTR_FIFOSIZ_S;
+    // By wasting one byte in hardware FIFO, we're guaranteed that fifoSize does not need special handling for FULL FIFO case
+    fifoSize = ((wrOffset >= rdOffset) ? (wrOffset - rdOffset) : (maxFifoSize - (rdOffset - wrOffset)));
+    while ( fifoSize != hwFifoSize )
+    {
+        // Overwite correct FIFOSIZ
+        // Need to do a Byte Write to make sure the FIFOPTR is not overwritten
+        *((uint8_t *)(hwFifoPtrRegAddr + BYTEOFFSET_FIFOSIZE)) = fifoSize;
+        // Read back the register and check for consistency
+        hwFifoPtrReg = AM_REGVAL(hwFifoPtrRegAddr);
+        rdOffset = ((hwFifoPtrReg & AM_REG_IOSLAVE_FIFOPTR_FIFOPTR_M) >> AM_REG_IOSLAVE_FIFOPTR_FIFOPTR_S);
+        hwFifoSize = (hwFifoPtrReg & AM_REG_IOSLAVE_FIFOPTR_FIFOSIZ_M) >> AM_REG_IOSLAVE_FIFOPTR_FIFOSIZ_S;
+        // By wasting one byte in hardware FIFO, we're guaranteed that fifoSize does not need special handling for FULL FIFO case
+        fifoSize = ((wrOffset >= rdOffset) ? (wrOffset - rdOffset) : (hwFifoSize - (rdOffset - wrOffset)));
+    }
+}
+#endif
+
+//
+// Address of the FIFOPTR register
+//
+#define AM_REG_IOS_FIFOPTR      (REG_IOSLAVE_BASEADDR + AM_REG_IOSLAVE_FIFOPTR_O)
+
+// When the FIFO is being replenished by the SW, at the same time as host is
+// reading from it, there is a possible race condition, where the hardware decrement
+// of FIFOSIZ as a result of read gets overwritten by hardware increment due to
+// write.
+// This function re-sync's the FIFOSIZ to ensure such errors do not accumulate
+void
+resync_fifoSize(void)
+{
+    uint32_t ui32Primask;
+    uint32_t wrOffset = (uint32_t)g_pui8FIFOPtr - (uint32_t)am_hal_ios_pui8LRAM;
+    //
+    // Start a critical section for thread safety.
+    //
+    ui32Primask = am_hal_interrupt_master_disable();
+    internal_resync_fifoSize(wrOffset, g_ui32HwFifoSize, AM_REG_IOS_FIFOPTR);
+    // Clear interrupts for IOS which could be spuriously triggered
+    AM_REG(IOSLAVE, REGACCINTCLR) = (AM_HAL_IOS_INT_FSIZE | AM_HAL_IOS_INT_FOVFL | AM_HAL_IOS_INT_FUNDFL);
+    //
+    // End the critical section
+    //
+    am_hal_interrupt_master_set(ui32Primask);
+    return;
+}
+
+//*****************************************************************************
+//
+//! @brief Transfer any available data from the IOS SRAM buffer to the FIFO.
+//!
+//! This function is meant to be called from an interrupt handler for the
+//! ioslave module. It checks the IOS FIFO interrupt status for a threshold
+//! event, and transfers data from an SRAM buffer into the IOS FIFO.
+//!
+//! @param ui32Status should be set to the ios interrupt status at the time of
+//! ISR entry.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ios_fifo_service(uint32_t ui32Status)
+{
+    uint32_t thresh;
+    uint32_t freeSpace, usedSpace, chunk1, chunk2, ui32WriteIndex;
+
+    //
+    // Check for FIFO size interrupts.
+    //
+    if ( ui32Status & AM_HAL_IOS_INT_FSIZE )
+    {
+        thresh = AM_BFR(IOSLAVE, FIFOTHR, FIFOTHR);
+
+        //
+        // While the FIFO is at or below threshold Add more data
+        // If Fifo level is above threshold, we're guaranteed an FSIZ interrupt
+        //
+        while ( g_sSRAMBuffer.ui32Length &&
+                ((usedSpace = AM_BFR(IOSLAVE, FIFOPTR, FIFOSIZ)) <= thresh) )
+        {
+            //
+            // So, we do have some data in SRAM which needs to be moved to FIFO.
+            // A chunk of data is a continguous set of bytes in SRAM that can be
+            //  written to FIFO. Determine the chunks of data from SRAM that can
+            //  be written. Up to two chunks possible
+            //
+            ui32WriteIndex = g_sSRAMBuffer.ui32WriteIndex;
+            chunk1 = ((ui32WriteIndex > (uint32_t)g_sSRAMBuffer.ui32ReadIndex) ?   \
+                        (ui32WriteIndex - (uint32_t)g_sSRAMBuffer.ui32ReadIndex) : \
+                        (g_sSRAMBuffer.ui32Capacity - (uint32_t)g_sSRAMBuffer.ui32ReadIndex));
+            chunk2 = g_sSRAMBuffer.ui32Length - chunk1;
+            // We waste one byte in HW FIFO
+            freeSpace = g_ui32HwFifoSize - usedSpace - 1;
+            // Write data in chunks
+            // Determine the chunks of data from SRAM that can be written
+            if ( chunk1 > freeSpace )
+            {
+                fifo_write((uint8_t *)(g_sSRAMBuffer.pui8Data + g_sSRAMBuffer.ui32ReadIndex), freeSpace);
+                //
+                // Advance the read index, wrapping if needed.
+                //
+                g_sSRAMBuffer.ui32ReadIndex += freeSpace;
+                // No need to check for wrap as we wrote less than chunk1
+                //
+                // Adjust the length value to reflect the change.
+                //
+                g_sSRAMBuffer.ui32Length -= freeSpace;
+            }
+            else
+            {
+                fifo_write((uint8_t *)(g_sSRAMBuffer.pui8Data + g_sSRAMBuffer.ui32ReadIndex), chunk1);
+
+                //
+                // Update the read index - wrapping as needed
+                //
+                g_sSRAMBuffer.ui32ReadIndex += chunk1;
+                g_sSRAMBuffer.ui32ReadIndex %= g_sSRAMBuffer.ui32Capacity;
+                //
+                // Adjust the length value to reflect the change.
+                //
+                g_sSRAMBuffer.ui32Length -= chunk1;
+                freeSpace -= chunk1;
+
+                if ( freeSpace && chunk2 )
+                {
+                    if ( chunk2 > freeSpace )
+                    {
+                        fifo_write((uint8_t *)(g_sSRAMBuffer.pui8Data + g_sSRAMBuffer.ui32ReadIndex), freeSpace);
+
+                        //
+                        // Advance the read index, wrapping if needed.
+                        //
+                        g_sSRAMBuffer.ui32ReadIndex += freeSpace;
+
+                        // No need to check for wrap in chunk2
+                        //
+                        // Adjust the length value to reflect the change.
+                        //
+                        g_sSRAMBuffer.ui32Length -= freeSpace;
+                    }
+                    else
+                    {
+                        fifo_write((uint8_t *)(g_sSRAMBuffer.pui8Data + g_sSRAMBuffer.ui32ReadIndex), chunk2);
+                        //
+                        // Advance the read index, wrapping if needed.
+                        //
+                        g_sSRAMBuffer.ui32ReadIndex += chunk2;
+
+                        // No need to check for wrap in chunk2
+                        //
+                        // Adjust the length value to reflect the change.
+                        //
+                        g_sSRAMBuffer.ui32Length -= chunk2;
+                    }
+                }
+            }
+            resync_fifoSize();
+
+            //
+            // Need to retake the FIFO space, after Threshold interrupt has been reenabled
+            // Clear any spurious FSIZE interrupt that might have got raised
+            //
+            AM_BFW(IOSLAVE, INTCLR, FSIZE, 1);
+        }
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Writes the specified number of bytes to the IOS fifo.
+//!
+//! @param pui8Data is a pointer to the data to be written to the fifo.
+//! @param ui32NumBytes is the number of bytes to send.
+//!
+//! This function will write data from the caller-provided array to the IOS
+//! LRAM FIFO. If there is no space in the LRAM FIFO, the data will be copied
+//! to a temporary SRAM buffer instead.
+//!
+//! The maximum message size for the IO Slave is 1023 bytes.
+//!
+//! @note In order for SRAM copy operations in the function to work correctly,
+//! the \e am_hal_ios_buffer_service() function must be called in the ISR for
+//! the ioslave module.
+//!
+//! @return Number of bytes written (could be less than ui32NumBytes, if not enough space)
+//
+//*****************************************************************************
+uint32_t
+am_hal_ios_fifo_write(uint8_t *pui8Data, uint32_t ui32NumBytes)
+{
+    uint32_t ui32FIFOSpace;
+    uint32_t ui32SRAMSpace;
+    uint32_t ui32SRAMLength;
+    uint32_t ui32Primask;
+    uint32_t totalBytes = ui32NumBytes;
+
+    //
+    // This operation will only work properly if an SRAM buffer has been
+    // allocated. Make sure that am_hal_ios_fifo_buffer_init() has been called,
+    // and the buffer pointer looks valid.
+    //
+    am_hal_debug_assert(g_sSRAMBuffer.pui8Data != 0);
+
+    if ( ui32NumBytes == 0 )
+    {
+        return 0;
+    }
+
+    //
+    // Start a critical section for thread safety.
+    //
+    ui32Primask = am_hal_interrupt_master_disable();
+
+    ui32SRAMLength = g_sSRAMBuffer.ui32Length;
+    //
+    // End the critical section
+    //
+    am_hal_interrupt_master_set(ui32Primask);
+
+    //
+    // If the SRAM buffer is empty, we should just write directly to the FIFO.
+    //
+    if ( ui32SRAMLength == 0 )
+    {
+        ui32FIFOSpace = fifo_space_left();
+
+        //
+        // If the whole message fits, send it now.
+        //
+        if ( ui32NumBytes <= ui32FIFOSpace )
+        {
+            fifo_write(pui8Data, ui32NumBytes);
+            ui32NumBytes = 0;
+        }
+        else
+        {
+            fifo_write(pui8Data, ui32FIFOSpace);
+            ui32NumBytes -= ui32FIFOSpace;
+            pui8Data += ui32FIFOSpace;
+        };
+        resync_fifoSize();
+    }
+
+    //
+    // If there's still data, write it to the SRAM buffer.
+    //
+    if ( ui32NumBytes )
+    {
+        uint32_t idx, writeIdx, capacity, fifoSize;
+        ui32SRAMSpace = g_sSRAMBuffer.ui32Capacity - ui32SRAMLength;
+
+        writeIdx = g_sSRAMBuffer.ui32WriteIndex;
+        capacity = g_sSRAMBuffer.ui32Capacity;
+        //
+        // Make sure that the data will fit inside the SRAM buffer.
+        //
+        if ( ui32SRAMSpace > ui32NumBytes )
+        {
+            ui32SRAMSpace = ui32NumBytes;
+        }
+
+        //
+        // If the data will fit, write it to the SRAM buffer.
+        //
+        for ( idx = 0; idx < ui32SRAMSpace; idx++ )
+        {
+            g_sSRAMBuffer.pui8Data[(idx + writeIdx) % capacity] = pui8Data[idx];
+        }
+
+        ui32NumBytes -= idx;
+        //
+        // Start a critical section for thread safety before updating length & wrIdx.
+        //
+        ui32Primask = am_hal_interrupt_master_disable();
+        //
+        // Advance the write index, making sure to wrap if necessary.
+        //
+        g_sSRAMBuffer.ui32WriteIndex = (idx + writeIdx) % capacity;
+
+        //
+        // Update the length value appropriately.
+        //
+        g_sSRAMBuffer.ui32Length += idx;
+        //
+        // End the critical section
+        //
+        am_hal_interrupt_master_set(ui32Primask);
+
+        // It is possible that there is a race condition that the FIFO level has
+        // gone below the threshold by the time we set the wrIdx above, and hence
+        // we may never get the threshold interrupt to serve the SRAM data we
+        // just wrote
+
+        // If that is the case, explicitly generate the FSIZE interrupt from here
+        fifoSize = AM_BFR(IOSLAVE, FIFOPTR, FIFOSIZ);
+        if ( fifoSize <= AM_BFR(IOSLAVE, FIFOTHR, FIFOTHR) )
+        {
+            AM_BFW(IOSLAVE, INTSET, FSIZE, 1);
+        }
+    }
+
+    return (totalBytes - ui32NumBytes);
+}
+
+//*****************************************************************************
+//
+//! @brief Writes the specified number of bytes to the IOS fifo simply.
+//!
+//! @param pui8Data is a pointer to the data to be written to the fifo.
+//! @param ui32NumBytes is the number of bytes to send.
+//!
+//! This function will write data from the caller-provided array to the IOS
+//! LRAM FIFO. This simple routine does not use SRAM buffering for large
+//! messages.
+//!
+//! The maximum message size for the IO Slave is 128 bytes.
+//!
+//! @note Do note call the \e am_hal_ios_buffer_service() function in the ISR for
+//! the ioslave module.
+//!
+//! @return
+//
+//*****************************************************************************
+void
+am_hal_ios_fifo_write_simple(uint8_t *pui8Data, uint32_t ui32NumBytes)
+{
+    uint32_t ui32FIFOSpace;
+
+    //
+    // Check the FIFO and the SRAM buffer to see where we have space.
+    //
+    ui32FIFOSpace = fifo_space_left();
+
+    //
+    // If the whole message fits, send it now.
+    //
+    if ( ui32NumBytes <= ui32FIFOSpace )
+    {
+        fifo_write(pui8Data, ui32NumBytes);
+    }
+    else
+    {
+        //
+        // The message didn't fit. Try using am_hal_ios_fifo_write() instead.
+        //
+        am_hal_debug_assert_msg(0, "The requested IOS transfer didn't fit in"
+                                   "the LRAM FIFO. Try using am_hal_ios_fifo_write().");
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Sets the IOS FIFO pointer to the specified LRAM offset.
+//!
+//! @param ui32Offset is LRAM offset to set the FIFO pointer to.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ios_fifo_ptr_set(uint32_t ui32Offset)
+{
+    uint32_t ui32Primask;
+
+    //
+    // Start a critical section for thread safety.
+    //
+    ui32Primask = am_hal_interrupt_master_disable();
+
+    //
+    // Set the FIFO Update bit.
+    //
+    AM_REG(IOSLAVE, FUPD) = 0x1;
+
+    //
+    // Change the FIFO offset.
+    //
+    AM_REG(IOSLAVE, FIFOPTR) = ui32Offset;
+
+    //
+    // Clear the FIFO update bit.
+    //
+    AM_REG(IOSLAVE, FUPD) = 0x0;
+
+    //
+    // Set the global FIFO-pointer tracking variable.
+    //
+    g_pui8FIFOPtr = (uint8_t *) (REG_IOSLAVE_BASEADDR + ui32Offset);
+
+    //
+    // End the critical section.
+    //
+    am_hal_interrupt_master_set(ui32Primask);
+}
+
+//*****************************************************************************
+//
+// Initialize an SRAM buffer for use with the IO Slave.
+//
+//*****************************************************************************
+static void
+am_hal_ios_buffer_init(am_hal_ios_buffer_t *psBuffer, void *pvArray,
+                       uint32_t ui32Bytes)
+{
+    psBuffer->ui32WriteIndex = 0;
+    psBuffer->ui32ReadIndex = 0;
+    psBuffer->ui32Length = 0;
+    psBuffer->ui32Capacity = ui32Bytes;
+    psBuffer->pui8Data = (uint8_t *)pvArray;
+}
+
+//*****************************************************************************
+//
+//! @brief Poll for all host side read activity to complete.
+//!
+//! Poll for all host side read activity to complete. Use this before
+//! calling am_hal_ios_fifo_write_simple().
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ios_read_poll_complete(void)
+{
+    while ( AM_REG(IOSLAVE, FUPD) & AM_REG_IOSLAVE_FUPD_IOREAD_M );
+}
+
+//*****************************************************************************
+//
+//! @brief Initializes an SRAM buffer for the IOS FIFO.
+//!
+//! @param pui8Buffer is the SRAM buffer that will be used for IOS fifo data.
+//! @param ui32BufferSize is the size of the SRAM buffer.
+//!
+//! This function provides the IOS HAL functions with working memory for
+//! managing outgoing IOS FIFO transactions. It needs to be called at least
+//! once before am_hal_ios_fifo_write() may be used.
+//!
+//! The recommended buffer size for the IOS FIFO is 1024 bytes.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ios_fifo_buffer_init(uint8_t *pui8Buffer, uint32_t ui32NumBytes)
+{
+    //
+    // Initialize the global SRAM buffer
+    // Total size, which is SRAM Buffer plus the hardware FIFO needs to be
+    // limited to 1023
+    //
+    if ( ui32NumBytes > (1023 - g_ui32HwFifoSize + 1) )
+    {
+        ui32NumBytes = (1023 - g_ui32HwFifoSize + 1);
+    }
+
+    am_hal_ios_buffer_init(&g_sSRAMBuffer, pui8Buffer, ui32NumBytes);
+
+    //
+    // Clear the FIFO State
+    //
+    AM_BFW(IOSLAVE, FIFOCTR, FIFOCTR, 0x0);
+    AM_BFW(IOSLAVE, FIFOPTR, FIFOSIZ, 0x0);
+
+    am_hal_ios_fifo_ptr_set(g_ui32FifoBaseOffset);
+}
+
+//*****************************************************************************
+//
+//! @brief Update the FIFOCTR to inform host of available data to read.
+//!
+//! This function allows the application to indicate to HAL when it is safe to
+//! update the FIFOCTR.
+//!
+//! Application needs to implement some sort of
+//! synchronization with the host to make sure host is not reading FIFOCTR while
+//! it is being updated by the MCU, since the FIFOCTR read over
+//! IO is not an atomic operation.
+//!
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_ios_update_fifoctr(void)
+{
+    uint32_t ui32Val;
+    // Determine the available data
+    ui32Val = am_hal_ios_fifo_space_used();
+    // Update FIFOCTR
+    AM_BFW(IOSLAVE, FIFOCTR, FIFOCTR, ui32Val);
+    return;
+}
+
+//*****************************************************************************
+//
+//  End the doxygen group
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_ios.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_ios.h
new file mode 100644
index 000000000..5419bb885
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_ios.h
@@ -0,0 +1,362 @@
+//*****************************************************************************
+//
+//! @file am_hal_ios.h
+//!
+//! @brief Functions for interfacing with the IO Slave module
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup ios IO Slave (SPI/I2C)
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_HAL_IOS_H
+#define AM_HAL_IOS_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+//*****************************************************************************
+//
+//! @name Interface Configuration
+//! @brief Macro definitions for configuring the physical interface of the IO
+//! Slave
+//!
+//! These macros may be used with the am_hal_ios_config_t structure to set the
+//! physical parameters of the SPI/I2C slave module.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_IOS_USE_SPI           AM_REG_IOSLAVE_CFG_IFCSEL_SPI
+#define AM_HAL_IOS_SPIMODE_0         AM_REG_IOSLAVE_CFG_SPOL_SPI_MODES_0_3
+#define AM_HAL_IOS_SPIMODE_1         AM_REG_IOSLAVE_CFG_SPOL_SPI_MODES_1_2
+#define AM_HAL_IOS_SPIMODE_2         AM_REG_IOSLAVE_CFG_SPOL_SPI_MODES_1_2
+#define AM_HAL_IOS_SPIMODE_3         AM_REG_IOSLAVE_CFG_SPOL_SPI_MODES_0_3
+
+#define AM_HAL_IOS_USE_I2C           AM_REG_IOSLAVE_CFG_IFCSEL_I2C
+#define AM_HAL_IOS_I2C_ADDRESS(n)    AM_REG_IOSLAVE_CFG_I2CADDR(n)
+
+#define AM_HAL_IOS_LSB_FIRST         AM_REG_IOSLAVE_CFG_LSB(1)
+//! @}
+
+//*****************************************************************************
+//
+//! @name Register Access Interrupts
+//! @brief Macro definitions for register access interrupts.
+//!
+//! These macros may be used with any of the
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_IOS_ACCESS_INT_00     AM_REG_IOSLAVE_REGACCINTEN_REGACC((uint32_t)1 << 31)
+#define AM_HAL_IOS_ACCESS_INT_01     AM_REG_IOSLAVE_REGACCINTEN_REGACC((uint32_t)1 << 30)
+#define AM_HAL_IOS_ACCESS_INT_02     AM_REG_IOSLAVE_REGACCINTEN_REGACC((uint32_t)1 << 29)
+#define AM_HAL_IOS_ACCESS_INT_03     AM_REG_IOSLAVE_REGACCINTEN_REGACC((uint32_t)1 << 28)
+#define AM_HAL_IOS_ACCESS_INT_04     AM_REG_IOSLAVE_REGACCINTEN_REGACC((uint32_t)1 << 27)
+#define AM_HAL_IOS_ACCESS_INT_05     AM_REG_IOSLAVE_REGACCINTEN_REGACC((uint32_t)1 << 26)
+#define AM_HAL_IOS_ACCESS_INT_06     AM_REG_IOSLAVE_REGACCINTEN_REGACC((uint32_t)1 << 25)
+#define AM_HAL_IOS_ACCESS_INT_07     AM_REG_IOSLAVE_REGACCINTEN_REGACC((uint32_t)1 << 24)
+#define AM_HAL_IOS_ACCESS_INT_08     AM_REG_IOSLAVE_REGACCINTEN_REGACC((uint32_t)1 << 23)
+#define AM_HAL_IOS_ACCESS_INT_09     AM_REG_IOSLAVE_REGACCINTEN_REGACC((uint32_t)1 << 22)
+#define AM_HAL_IOS_ACCESS_INT_0A     AM_REG_IOSLAVE_REGACCINTEN_REGACC((uint32_t)1 << 21)
+#define AM_HAL_IOS_ACCESS_INT_0B     AM_REG_IOSLAVE_REGACCINTEN_REGACC((uint32_t)1 << 20)
+#define AM_HAL_IOS_ACCESS_INT_0C     AM_REG_IOSLAVE_REGACCINTEN_REGACC((uint32_t)1 << 19)
+#define AM_HAL_IOS_ACCESS_INT_0D     AM_REG_IOSLAVE_REGACCINTEN_REGACC((uint32_t)1 << 18)
+#define AM_HAL_IOS_ACCESS_INT_0E     AM_REG_IOSLAVE_REGACCINTEN_REGACC((uint32_t)1 << 17)
+#define AM_HAL_IOS_ACCESS_INT_0F     AM_REG_IOSLAVE_REGACCINTEN_REGACC((uint32_t)1 << 16)
+#define AM_HAL_IOS_ACCESS_INT_13     AM_REG_IOSLAVE_REGACCINTEN_REGACC((uint32_t)1 << 15)
+#define AM_HAL_IOS_ACCESS_INT_17     AM_REG_IOSLAVE_REGACCINTEN_REGACC((uint32_t)1 << 14)
+#define AM_HAL_IOS_ACCESS_INT_1B     AM_REG_IOSLAVE_REGACCINTEN_REGACC((uint32_t)1 << 13)
+#define AM_HAL_IOS_ACCESS_INT_1F     AM_REG_IOSLAVE_REGACCINTEN_REGACC((uint32_t)1 << 12)
+#define AM_HAL_IOS_ACCESS_INT_23     AM_REG_IOSLAVE_REGACCINTEN_REGACC((uint32_t)1 << 11)
+#define AM_HAL_IOS_ACCESS_INT_27     AM_REG_IOSLAVE_REGACCINTEN_REGACC((uint32_t)1 << 10)
+#define AM_HAL_IOS_ACCESS_INT_2B     AM_REG_IOSLAVE_REGACCINTEN_REGACC((uint32_t)1 << 9)
+#define AM_HAL_IOS_ACCESS_INT_2F     AM_REG_IOSLAVE_REGACCINTEN_REGACC((uint32_t)1 << 8)
+#define AM_HAL_IOS_ACCESS_INT_33     AM_REG_IOSLAVE_REGACCINTEN_REGACC((uint32_t)1 << 7)
+#define AM_HAL_IOS_ACCESS_INT_37     AM_REG_IOSLAVE_REGACCINTEN_REGACC((uint32_t)1 << 6)
+#define AM_HAL_IOS_ACCESS_INT_3B     AM_REG_IOSLAVE_REGACCINTEN_REGACC((uint32_t)1 << 5)
+#define AM_HAL_IOS_ACCESS_INT_3F     AM_REG_IOSLAVE_REGACCINTEN_REGACC((uint32_t)1 << 4)
+#define AM_HAL_IOS_ACCESS_INT_43     AM_REG_IOSLAVE_REGACCINTEN_REGACC((uint32_t)1 << 3)
+#define AM_HAL_IOS_ACCESS_INT_47     AM_REG_IOSLAVE_REGACCINTEN_REGACC((uint32_t)1 << 2)
+#define AM_HAL_IOS_ACCESS_INT_4B     AM_REG_IOSLAVE_REGACCINTEN_REGACC((uint32_t)1 << 1)
+#define AM_HAL_IOS_ACCESS_INT_4F     AM_REG_IOSLAVE_REGACCINTEN_REGACC((uint32_t)1 << 0)
+#define AM_HAL_IOS_ACCESS_INT_ALL    0xFFFFFFFF
+//! @}
+
+//*****************************************************************************
+//
+//! @name I/O Slave Interrupts
+//! @brief Macro definitions for I/O slave (IOS) interrupts.
+//!
+//! These macros may be used with any of the
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_IOS_INT_FSIZE            AM_REG_IOSLAVE_INTEN_FSIZE_M
+#define AM_HAL_IOS_INT_FOVFL            AM_REG_IOSLAVE_INTEN_FOVFL_M
+#define AM_HAL_IOS_INT_FUNDFL           AM_REG_IOSLAVE_INTEN_FUNDFL_M
+#define AM_HAL_IOS_INT_FRDERR           AM_REG_IOSLAVE_INTEN_FRDERR_M
+#define AM_HAL_IOS_INT_GENAD            AM_REG_IOSLAVE_INTEN_GENAD_M
+#define AM_HAL_IOS_INT_IOINTW           AM_REG_IOSLAVE_INTEN_IOINTW_M
+#define AM_HAL_IOS_INT_XCMPWR           AM_REG_IOSLAVE_INTEN_XCMPWR_M
+#define AM_HAL_IOS_INT_XCMPWF           AM_REG_IOSLAVE_INTEN_XCMPWF_M
+#define AM_HAL_IOS_INT_XCMPRR           AM_REG_IOSLAVE_INTEN_XCMPRR_M
+#define AM_HAL_IOS_INT_XCMPRF           AM_REG_IOSLAVE_INTEN_XCMPRF_M
+#define AM_HAL_IOS_INT_ALL              0xFFFFFFFF
+//! @}
+
+//*****************************************************************************
+//
+//! @name I/O Slave Interrupts triggers
+//! @brief Macro definitions for I/O slave (IOS) interrupts.
+//!
+//! These macros may be used with am_hal_ios_int_set and am_hal_ios_int_clear
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_IOS_IOINTCTL_INT0    (0x01)
+#define AM_HAL_IOS_IOINTCTL_INT1    (0x02)
+#define AM_HAL_IOS_IOINTCTL_INT2    (0x04)
+#define AM_HAL_IOS_IOINTCTL_INT3    (0x08)
+#define AM_HAL_IOS_IOINTCTL_INT4    (0x10)
+#define AM_HAL_IOS_IOINTCTL_INT5    (0x20)
+//! @}
+
+//*****************************************************************************
+//
+// External variable definitions
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+//! @brief LRAM pointer
+//!
+//! Pointer to the base of the IO Slave LRAM.
+//
+//*****************************************************************************
+extern volatile uint8_t * const am_hal_ios_pui8LRAM;
+
+//*****************************************************************************
+//
+//! @brief Configuration structure for the IO slave module.
+//!
+//! This structure may be used along with the am_hal_ios_config() function to
+//! select key parameters of the IO Slave module. See the descriptions of each
+//! parameter within this structure for more information on what they control.
+//
+//*****************************************************************************
+typedef struct
+{
+    //
+    //! Interface Selection
+    //!
+    //! This word selects the physical behavior of the IO Slave port. For SPI
+    //! mode, this word should be the logical OR of one or more of the
+    //! following:
+    //!
+    //!     AM_HAL_IOS_USE_SPI
+    //!     AM_HAL_IOS_SPIMODE_0
+    //!     AM_HAL_IOS_SPIMODE_1
+    //!     AM_HAL_IOS_SPIMODE_2
+    //!     AM_HAL_IOS_SPIMODE_3
+    //!
+    //! For I2C mode, use the logical OR of one or more of these values instead
+    //! (where n is the 7 or 10-bit I2C address to use):
+    //!
+    //!     AM_HAL_IOS_USE_I2C
+    //!     AM_HAL_IOS_I2C_ADDRESS(n)
+    //!
+    //! Also, in any mode, you may OR in this value to reverse the order of
+    //! incoming data bits.
+    //!
+    //!     AM_HAL_IOS_LSB_FIRST
+    //
+    uint32_t ui32InterfaceSelect;
+
+    //
+    //! Read-Only section
+    //!
+    //! The IO Slave LRAM is split into three main sections. The first section
+    //! is a "Direct Write" section, which may be accessed for reads or write
+    //! either directly through the Apollo CPU, or over the SPI/I2C bus. The
+    //! "Direct Write" section always begins at LRAM offset 0x0. At the end of
+    //! the normal "Direct Write" space, there is a "Read Only" space, which is
+    //! read/write accessible to the Apollo CPU, but read-only over the I2C/SPI
+    //! Bus. This word selects the base address of this "Read Only" space.
+    //!
+    //! This value may be set to any multiple of 8 between 0x0 and 0x78,
+    //! inclusive. For the configuration to be valid, \e ui32ROBase must also
+    //! be less than or equal to \e ui32FIFOBase
+    //!
+    //! @note The address given here is in units of BYTES. Since the location
+    //! of the "Read Only" space may only be set in 8-byte increments, this
+    //! value must be a multiple of 8.
+    //!
+    //! For the avoidance of doubt this means 0x80 is 128 bytes. These functions
+    //! will shift right by 8 internally.
+    //
+    uint32_t ui32ROBase;
+
+    //
+    //! FIFO section
+    //!
+    //! After the "Direct Access" and "Read Only" sections is a section of LRAM
+    //! allocated to a FIFO. This section is accessible by the Apollo CPU
+    //! through the FIFO control registers, and accessible on the SPI/I2C bus
+    //! through the 0x7F address. This word selects the base address of the
+    //! FIFO space. The FIFO will extend from the address specified here to the
+    //! address specified in \e ui32RAMBase.
+    //!
+    //! This value may be set to any multiple of 8 between 0x0 and 0x78,
+    //! inclusive. For the configuration to be valid, \e ui32FIFOBase must also
+    //! be greater than or equal to \e ui32ROBase.
+    //!
+    //! @note The address given here is in units of BYTES. Since the location
+    //! of the "FIFO" space may only be set in 8-byte increments, this value
+    //! must be a multiple of 8.
+    //!
+    //! For the avoidance of doubt this means 0x80 is 128 bytes. These functions
+    //! will shift right by 8 internally.
+    //
+    uint32_t ui32FIFOBase;
+
+    //
+    //! RAM section
+    //!
+    //! At the end of the IOS LRAM, the user may allocate a "RAM" space that
+    //! can only be accessed by the Apollo CPU. This space will not interact
+    //! with the SPI/I2C bus at all, and may be used as general-purpose memory.
+    //! Unlike normal SRAM, this section of LRAM will retain its state through
+    //! Deep Sleep, so it may be used as a data retention space for
+    //! ultra-low-power applications.
+    //!
+    //! This value may be set to any multiple of 8 between 0x0 and 0x100,
+    //! inclusive. For the configuration to be valid, \e ui32RAMBase must also
+    //! be greater than or equal to \e ui32FIFOBase.
+    //!
+    //! @note The address given here is in units of BYTES. Since the location
+    //! of the "FIFO" space may only be set in 8-byte increments, this value
+    //! must be a multiple of 8.
+    //!
+    //! For the avoidance of doubt this means 0x80 is 128 bytes. These functions
+    //! will shift right by 8 internally.
+    //
+    uint32_t ui32RAMBase;
+
+    //
+    //! FIFO threshold
+    //!
+    //! The IO Slave module will trigger an interrupt when the number of
+    //! entries in the FIFO drops below this number of bytes.
+    //
+    uint32_t ui32FIFOThreshold;
+
+    //
+    // Pointer to an SRAM
+    //
+    uint8_t *pui8SRAMBuffer;
+}
+am_hal_ios_config_t;
+
+//*****************************************************************************
+//
+// External function definitions
+//
+//*****************************************************************************
+extern void am_hal_ios_enable(uint32_t ui32Module);
+extern void am_hal_ios_disable(uint32_t ui32Module);
+
+// these interrupts drive the HOST side IOS interrupt pins
+extern void am_hal_ios_host_int_set(uint32_t ui32Interrupt);
+extern void am_hal_ios_host_int_clear(uint32_t ui32Interrupt);
+extern uint32_t am_hal_ios_host_int_get(void);
+extern uint32_t am_hal_ios_host_int_enable_get(void);
+
+extern void am_hal_ios_lram_write(uint32_t ui32Offset, uint8_t ui8Value);
+extern uint8_t am_hal_ios_lram_read(uint32_t ui32Offset);
+
+// the following interrupts go back to the NVIC
+extern void am_hal_ios_config(am_hal_ios_config_t *psConfig);
+extern void am_hal_ios_access_int_enable(uint32_t ui32Interrupt);
+extern uint32_t am_hal_ios_access_int_enable_get(void);
+extern void am_hal_ios_access_int_disable(uint32_t ui32Interrupt);
+extern void am_hal_ios_access_int_clear(uint32_t ui32Interrupt);
+extern void am_hal_ios_access_int_set(uint32_t ui32Interrupt);
+extern uint32_t am_hal_ios_access_int_status_get(bool bEnabledOnly);
+extern void am_hal_ios_int_enable(uint32_t ui32Interrupt);
+extern uint32_t am_hal_ios_int_enable_get(void);
+extern void am_hal_ios_int_disable(uint32_t ui32Interrupt);
+extern void am_hal_ios_int_clear(uint32_t ui32Interrupt);
+extern void am_hal_ios_int_set(uint32_t ui32Interrupt);
+extern uint32_t am_hal_ios_int_status_get(bool bEnabledOnly);
+
+extern void am_hal_ios_fifo_buffer_init(uint8_t *pui8Buffer, uint32_t ui32NumBytes);
+extern uint32_t am_hal_ios_fifo_space_left(void);
+extern uint32_t am_hal_ios_fifo_space_used(void);
+extern void am_hal_ios_fifo_service(uint32_t ui32Status);
+// Returns the number of bytes actually written
+extern uint32_t am_hal_ios_fifo_write(uint8_t *pui8Data, uint32_t ui32NumBytes);
+extern void am_hal_ios_fifo_write_simple(uint8_t *pui8Data,
+                                         uint32_t ui32NumBytes);
+extern void am_hal_ios_fifo_ptr_set(uint32_t ui32Offset);
+extern void am_hal_ios_update_fifoctr(void);
+
+extern void am_hal_ios_read_poll_complete(void);
+extern void am_hal_ios_pwrctrl_enable(void);
+extern void am_hal_ios_pwrctrl_disable(void);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_HAL_IOS_H
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_itm.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_itm.c
new file mode 100644
index 000000000..fb3f25935
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_itm.c
@@ -0,0 +1,453 @@
+//*****************************************************************************
+//
+//! @file am_hal_itm.c
+//!
+//! @brief Functions for operating the instrumentation trace macrocell
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup itm Instrumentation Trace Macrocell (ITM)
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "am_mcu_apollo.h"
+
+//*****************************************************************************
+//
+// Global Variables
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+//! @brief Delays for a desired amount of microseconds.
+//!
+//! @note - This function is based on the similar function in am_util_delay.c,
+//! please see that module for implementation details. It was necessary to
+//! duplicate it here to avoid having to update every example to include the
+//! am_util_delay.c module in its build.
+//!
+//! @returns None
+//
+//*****************************************************************************
+void
+am_hal_itm_delay_us(uint32_t ui32MicroSeconds)
+{
+    uint32_t ui32Iterations = ui32MicroSeconds *
+                              (am_hal_clkgen_sysclk_get() / 3000000);
+
+    //
+    // Call the BOOTROM cycle delay function
+    //
+    am_hal_flash_delay(ui32Iterations);
+}
+
+//*****************************************************************************
+//
+//! @brief Enables the ITM
+//!
+//! This function enables the ARM ITM by setting the TRCENA bit in the DEMCR
+//! register.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_itm_enable(void)
+{
+    if (g_ui32HALflags & AM_HAL_FLAGS_ITMSKIPENABLEDISABLE_M)
+    {
+        return;
+    }
+
+    //
+    // To be able to access ITM registers, set the Trace Enable bit
+    // in the Debug Exception and Monitor Control Register (DEMCR).
+    //
+    AM_REG(SYSCTRL, DEMCR) |= AM_REG_SYSCTRL_DEMCR_TRCENA(1);
+    while ( !(AM_REG(SYSCTRL, DEMCR) & AM_REG_SYSCTRL_DEMCR_TRCENA(1)) );
+
+    //
+    // Write the key to the ITM Lock Access register to unlock the ITM_TCR.
+    //
+    AM_REGVAL(AM_REG_ITM_LOCKAREG_O) = AM_REG_ITM_LOCKAREG_KEYVAL;
+
+    //
+    // Set the enable bits in the ITM trace enable register, and the ITM
+    // control registers to enable trace data output.
+    //
+    AM_REGVAL(AM_REG_ITM_TPR_O) = 0x0000000f;
+    AM_REGVAL(AM_REG_ITM_TER_O) = 0xffffffff;
+
+    //
+    // Write to the ITM control and status register (don't enable yet).
+    //
+    AM_REGVAL(AM_REG_ITM_TCR_O) =
+        AM_WRITE_SM(AM_REG_ITM_TCR_ATB_ID, 0x15)      |
+        AM_WRITE_SM(AM_REG_ITM_TCR_TS_FREQ, 1)        |
+        AM_WRITE_SM(AM_REG_ITM_TCR_TS_PRESCALE, 1)    |
+        AM_WRITE_SM(AM_REG_ITM_TCR_SWV_ENABLE, 1)     |
+        AM_WRITE_SM(AM_REG_ITM_TCR_DWT_ENABLE, 0)     |
+        AM_WRITE_SM(AM_REG_ITM_TCR_SYNC_ENABLE, 0)    |
+        AM_WRITE_SM(AM_REG_ITM_TCR_TS_ENABLE, 0)      |
+        AM_WRITE_SM(AM_REG_ITM_TCR_ITM_ENABLE, 1);
+}
+
+//*****************************************************************************
+//
+//! @brief Disables the ITM
+//!
+//! This function completely disables the ARM ITM by resetting the TRCENA bit
+//! in the DEMCR register.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_itm_disable(void)
+{
+
+    if (g_ui32HALflags & AM_HAL_FLAGS_ITMSKIPENABLEDISABLE_M)
+    {
+        return;
+    }
+
+    //
+    // Make sure the ITM_TCR is unlocked.
+    //
+    AM_REGVAL(AM_REG_ITM_LOCKAREG_O) = AM_REG_ITM_LOCKAREG_KEYVAL;
+
+    //
+    // Make sure the ITM/TPIU is not busy.
+    //
+    while ( AM_REG(ITM, TCR) & AM_REG_ITM_TCR_BUSY(1) );
+
+    //
+    // Disable the ITM.
+    //
+    for (int ix = 0; ix < 100; ix++)
+    {
+        AM_REG(ITM, TCR) &= ~AM_REG_ITM_TCR_ITM_ENABLE(1);
+        while ( AM_REG(ITM, TCR) & (AM_REG_ITM_TCR_ITM_ENABLE(1) | AM_REG_ITM_TCR_BUSY(1)) );
+    }
+
+    //
+    // Reset the TRCENA bit in the DEMCR register, which should disable the ITM
+    // for operation.
+    //
+    AM_REG(SYSCTRL, DEMCR) &= ~AM_REG_SYSCTRL_DEMCR_TRCENA(1);
+
+    //
+    // Disable the TPIU clock source in MCU control.
+    //
+    AM_REG(MCUCTRL, TPIUCTRL) = AM_REG_MCUCTRL_TPIUCTRL_CLKSEL_0MHz |
+                                AM_REG_MCUCTRL_TPIUCTRL_ENABLE_DIS;
+}
+
+//*****************************************************************************
+//
+//! @brief Checks if itm is busy and provides a delay to flush the fifo
+//!
+//! This function disables the ARM ITM by resetting the TRCENA bit in the DEMCR
+//! register.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_itm_not_busy(void)
+{
+    //
+    // Make sure the ITM/TPIU is not busy.
+    //
+    while (AM_REG(ITM, TCR) & AM_REG_ITM_TCR_BUSY(1));
+
+    //
+    // wait for 50us for the data to flush out
+    //
+    am_hal_itm_delay_us(50);
+}
+
+//*****************************************************************************
+//
+//! @brief Enables tracing on a given set of ITM ports
+//!
+//! @param ui8portNum - Set ports to be enabled
+//!
+//! Enables tracing on the ports referred to by \e ui8portNum by writing the
+//! associated bit in the Trace Privilege Register in the ITM. The value for
+//! ui8portNum should be the logical OR one or more of the following values:
+//!
+//! \e ITM_PRIVMASK_0_7 - enable ports 0 through 7
+//! \e ITM_PRIVMASK_8_15 - enable ports 8 through 15
+//! \e ITM_PRIVMASK_16_23 - enable ports 16 through 23
+//! \e ITM_PRIVMASK_24_31 - enable ports 24 through 31
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_itm_trace_port_enable(uint8_t ui8portNum)
+{
+    AM_REGVAL(AM_REG_ITM_TPR_O) |= (0x00000001 << (ui8portNum>>3));
+}
+
+//*****************************************************************************
+//
+//! @brief Disable tracing on the given ITM stimulus port.
+//!
+//! @param ui8portNum
+//!
+//! Disables tracing on the ports referred to by \e ui8portNum by writing the
+//! associated bit in the Trace Privilege Register in the ITM. The value for
+//! ui8portNum should be the logical OR one or more of the following values:
+//!
+//! \e ITM_PRIVMASK_0_7 - disable ports 0 through 7
+//! \e ITM_PRIVMASK_8_15 - disable ports 8 through 15
+//! \e ITM_PRIVMASK_16_23 - disable ports 16 through 23
+//! \e ITM_PRIVMASK_24_31 - disable ports 24 through 31
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_itm_trace_port_disable(uint8_t ui8portNum)
+{
+    AM_REGVAL(AM_REG_ITM_TPR_O) &= ~(0x00000001 << (ui8portNum >> 3));
+}
+
+//*****************************************************************************
+//
+//! @brief Poll the given ITM stimulus register until not busy.
+//!
+//! @param ui32StimReg - stimulus register
+//!
+//! @return true if not busy, false if busy (timed out or other error).
+//
+//*****************************************************************************
+bool
+am_hal_itm_stimulus_not_busy(uint32_t ui32StimReg)
+{
+    uint32_t ui32StimAddr = (AM_REG_ITM_STIM0_O + (4 * ui32StimReg));
+
+    //
+    // Busy waiting until it is available, non-zero means ready.
+    //
+    while (!AM_REGVAL(ui32StimAddr));
+
+    return true;
+}
+
+//*****************************************************************************
+//
+//! @brief Writes a 32-bit value to the given ITM stimulus register.
+//!
+//! @param ui32StimReg - stimulus register
+//! @param ui32Value - value to be written.
+//!
+//! Write a word to the desired stimulus register.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_itm_stimulus_reg_word_write(uint32_t ui32StimReg, uint32_t ui32Value)
+{
+    uint32_t ui32StimAddr;
+
+    ui32StimAddr = (AM_REG_ITM_STIM0_O + (4 * ui32StimReg));
+
+    //
+    // Busy waiting until it is available, non-zero means ready
+    //
+    while (!AM_REGVAL(ui32StimAddr));
+
+    //
+    // Write the register.
+    //
+    AM_REGVAL(ui32StimAddr) = ui32Value;
+}
+
+//*****************************************************************************
+//
+//! @brief Writes a short to the given ITM stimulus register.
+//!
+//! @param ui32StimReg - stimulus register
+//! @param ui16Value - short to be written.
+//!
+//! Write a short to the desired stimulus register.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_itm_stimulus_reg_short_write(uint32_t ui32StimReg, uint16_t ui16Value)
+{
+    uint32_t ui32StimAddr;
+
+    ui32StimAddr = (AM_REG_ITM_STIM0_O + (4 * ui32StimReg));
+
+    //
+    // Busy waiting until it is available non-zero means ready
+    //
+    while (!AM_REGVAL(ui32StimAddr));
+
+    //
+    // Write the register.
+    //
+    *((volatile uint16_t *) ui32StimAddr) = ui16Value;
+}
+
+//*****************************************************************************
+//
+//! @brief Writes a byte to the given ITM stimulus register.
+//!
+//! @param ui32StimReg - stimulus register
+//! @param ui8Value - byte to be written.
+//!
+//! Write a byte to the desired stimulus register.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_itm_stimulus_reg_byte_write(uint32_t ui32StimReg, uint8_t ui8Value)
+{
+    uint32_t ui32StimAddr;
+
+    ui32StimAddr = (AM_REG_ITM_STIM0_O + (4 * ui32StimReg));
+
+    //
+    // Busy waiting until it is available (non-zero means ready)
+    //
+    while (!AM_REGVAL(ui32StimAddr));
+
+    //
+    // Write the register.
+    //
+    *((volatile uint8_t *) ui32StimAddr) = ui8Value;
+}
+
+//*****************************************************************************
+//
+//! @brief Sends a Sync Packet.
+//!
+//! Sends a sync packet. This can be useful for external software should it
+//! become out of sync with the ITM stream.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_itm_sync_send(void)
+{
+    //
+    // Write the register.
+    //
+    am_hal_itm_stimulus_reg_word_write(AM_HAL_ITM_SYNC_REG,
+                                       AM_HAL_ITM_SYNC_VAL);
+}
+
+//*****************************************************************************
+//
+//! @brief Poll the print stimulus registers until not busy.
+//!
+//! @return true if not busy, false if busy (timed out or other error).
+//
+//*****************************************************************************
+bool
+am_hal_itm_print_not_busy(void)
+{
+    //
+    // Poll stimulus register allocated for printing.
+    //
+    am_hal_itm_stimulus_not_busy(0);
+
+
+    return true;
+}
+
+//*****************************************************************************
+//
+//! @brief Prints a char string out of the ITM.
+//!
+//! @param pcString pointer to the character sting
+//!
+//! This function prints a sting out of the ITM.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_itm_print(char *pcString)
+{
+    uint32_t ui32Length = 0;
+
+    //
+    // Determine the length of the string.
+    //
+    while (*(pcString + ui32Length))
+    {
+        ui32Length++;
+    }
+
+    //
+    // If there is no longer a word left, empty out the remaining characters.
+    //
+    while (ui32Length)
+    {
+            //
+            // Print string out the ITM.
+            //
+            am_hal_itm_stimulus_reg_byte_write(0, (uint8_t)*pcString++);
+
+            //
+            // Subtract from length.
+            //
+            ui32Length--;
+    }
+}
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_itm.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_itm.h
new file mode 100644
index 000000000..7d09ae42a
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_itm.h
@@ -0,0 +1,107 @@
+//*****************************************************************************
+//
+//! @file am_hal_itm.h
+//!
+//! @brief Functions for accessing and configuring the ARM ITM.
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup itm Instrumentation Trace Macrocell (ITM)
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#ifndef AM_HAL_ITM_H
+#define AM_HAL_ITM_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+//*****************************************************************************
+//
+// Sync Packet Defines
+//
+//*****************************************************************************
+#define AM_HAL_ITM_SYNC_REG             23
+#define AM_HAL_ITM_SYNC_VAL             0xF8F8F8F8
+
+//*****************************************************************************
+//
+// PrintF Setup
+//
+//*****************************************************************************
+#define AM_HAL_ITM_PRINT_NUM_BYTES      1
+#define AM_HAL_ITM_PRINT_NUM_REGS       1
+extern uint32_t am_hal_itm_print_registers[AM_HAL_ITM_PRINT_NUM_REGS];
+
+//*****************************************************************************
+//
+// External function definitions
+//
+//*****************************************************************************
+extern void am_hal_itm_delay_us(uint32_t ui32MicroSeconds);
+extern void am_hal_itm_enable(void);
+extern void am_hal_itm_disable(void);
+extern void am_hal_itm_not_busy(void);
+extern void am_hal_itm_sync_send(void);
+extern void am_hal_itm_trace_port_enable(uint8_t ui8portNum);
+extern void am_hal_itm_trace_port_disable(uint8_t ui8portNum);
+extern bool am_hal_itm_stimulus_not_busy(uint32_t ui32StimReg);
+extern void am_hal_itm_stimulus_reg_word_write(uint32_t ui32StimReg,
+                                                uint32_t ui32Value);
+extern void am_hal_itm_stimulus_reg_short_write(uint32_t ui32StimReg,
+                                                uint16_t ui16Value);
+extern void am_hal_itm_stimulus_reg_byte_write(uint32_t ui32StimReg,
+                                                uint8_t ui8Value);
+extern bool am_hal_itm_print_not_busy(void);
+extern void am_hal_itm_print(char *pcString);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_HAL_ITM_H
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_mcuctrl.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_mcuctrl.c
new file mode 100644
index 000000000..3f74983dc
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_mcuctrl.c
@@ -0,0 +1,292 @@
+//*****************************************************************************
+//
+//! @file am_hal_mcuctrl.c
+//!
+//! @brief Functions for interfacing with the MCUCTRL.
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup mcuctrl MCU Control (MCUCTRL)
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "am_mcu_apollo.h"
+
+#define LDO_TRIM_REG_ADDR   (0x50023004)
+#define BUCK_TRIM_REG_ADDR  (0x50023000)
+
+//*****************************************************************************
+//
+// Global Variables.
+//
+//*****************************************************************************
+//
+// Define the flash sizes from CHIP_INFO.
+//
+const uint32_t g_am_hal_mcuctrl_flash_size[16] =
+{
+     16 * 1024,             /* 0x0 0x00004000   16 KB */
+     32 * 1024,             /* 0x1 0x00008000   32 KB */
+     64 * 1024,             /* 0x2 0x00010000   64 KB */
+    128 * 1024,             /* 0x3 0x00020000  128 KB */
+    256 * 1024,             /* 0x4 0x00040000  256 KB */
+    512 * 1024,             /* 0x5 0x00080000  512 KB */
+      1 * 1024 * 1024,      /* 0x6 0x00100000    1 MB */
+      2 * 1024 * 1024,      /* 0x7 0x00200000    2 MB */
+      4 * 1024 * 1024,      /* 0x8 0x00400000    4 MB */
+      8 * 1024 * 1024,      /* 0x9 0x00800000    8 MB */
+     16 * 1024 * 1024,      /* 0xA 0x01000000    16 MB */
+     32 * 1024 * 1024,      /* 0xB 0x02000000    32 MB */
+     64 * 1024 * 1024,      /* 0xC 0x04000000    64 MB */
+    128 * 1024 * 1024,      /* 0xD 0x08000000   128 MB */
+    256 * 1024 * 1024,      /* 0xE 0x10000000   256 MB */
+    512 * 1024 * 1024       /* 0xF 0x20000000   512 MB */
+};
+
+//
+// Define the SRAM sizes from CHIP_INFO.
+// For Apollo2, the SRAM sizes are defined exactly the same as the flash sizes.
+//
+#define g_am_hal_mcuctrl_sram_size  g_am_hal_mcuctrl_flash_size
+
+//*****************************************************************************
+//
+//! @brief Gets all relevant device information.
+//!
+//! @param psDevice is a pointer to a structure that will be used to store all
+//! device info.
+//!
+//! This function gets the device part number, chip IDs, and revision and
+//! stores them in the passed structure.
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_mcuctrl_device_info_get(am_hal_mcuctrl_device_t *psDevice)
+{
+    //
+    // Read the Part Number.
+    //
+    psDevice->ui32ChipPN = AM_REG(MCUCTRL, CHIP_INFO);
+
+    //
+    // Read the Chip ID0.
+    //
+    psDevice->ui32ChipID0 = AM_REG(MCUCTRL, CHIPID0);
+
+    //
+    // Read the Chip ID1.
+    //
+    psDevice->ui32ChipID1 = AM_REG(MCUCTRL, CHIPID1);
+
+    //
+    // Read the Chip Revision.
+    //
+    psDevice->ui32ChipRev = AM_REG(MCUCTRL, CHIPREV);
+
+    //
+    // Read the Part Number.
+    //
+    psDevice->ui32ChipPN = AM_REG(MCUCTRL, CHIP_INFO);
+
+    //
+    // Read the Chip ID0.
+    //
+    psDevice->ui32ChipID0 = AM_REG(MCUCTRL, CHIPID0);
+
+    //
+    // Read the Chip ID1.
+    //
+    psDevice->ui32ChipID1 = AM_REG(MCUCTRL, CHIPID1);
+
+    //
+    // Read the Chip Revision.
+    //
+    psDevice->ui32ChipRev = AM_REG(MCUCTRL, CHIPREV);
+
+    //
+    // Read the Chip VENDOR ID.
+    //
+    psDevice->ui32VendorID = AM_REG(MCUCTRL, VENDORID);
+
+    //
+    // Qualified from Part Number.
+    //
+    psDevice->ui32Qualified =
+            (psDevice->ui32ChipPN & AM_HAL_MCUCTRL_CHIP_INFO_QUAL_M) >>
+             AM_HAL_MCUCTRL_CHIP_INFO_QUAL_S;
+
+    //
+    // Flash size from Part Number.
+    //
+    psDevice->ui32FlashSize =
+        g_am_hal_mcuctrl_flash_size[
+            (psDevice->ui32ChipPN & AM_HAL_MCUCTRL_CHIP_INFO_FLASH_SIZE_M) >>
+            AM_HAL_MCUCTRL_CHIP_INFO_FLASH_SIZE_S];
+
+    //
+    // SRAM size from Part Number.
+    //
+    psDevice->ui32SRAMSize =
+        g_am_hal_mcuctrl_flash_size[
+            (psDevice->ui32ChipPN & AM_HAL_MCUCTRL_CHIP_INFO_SRAM_SIZE_M) >>
+            AM_HAL_MCUCTRL_CHIP_INFO_SRAM_SIZE_S];
+
+    //
+    // Now, let's look at the JEDEC info.
+    // The full partnumber is 12 bits total, but is scattered across 2 registers.
+    // Bits [11:8] are 0xE.
+    // Bits [7:4] are 0xE for Apollo, 0xD for Apollo2.
+    // Bits [3:0] are defined differently for Apollo and Apollo2.
+    //   For Apollo, the low nibble is 0x0.
+    //   For Apollo2, the low nibble indicates flash and SRAM size.
+    //
+    psDevice->ui32JedecPN  = (AM_BFR(JEDEC, PID0, PNL8) << 0);
+    psDevice->ui32JedecPN |= (AM_BFR(JEDEC, PID1, PNH4) << 8);
+
+    //
+    // JEPID is the JEP-106 Manufacturer ID Code, which is assigned to Ambiq as
+    //  0x1B, with parity bit is 0x9B.  It is 8 bits located across 2 registers.
+    //
+    psDevice->ui32JedecJEPID  = (AM_BFR(JEDEC, PID1, JEPIDL) << 0);
+    psDevice->ui32JedecJEPID |= (AM_BFR(JEDEC, PID2, JEPIDH) << 4);
+
+    //
+    // CHIPREV is 8 bits located across 2 registers.
+    //
+    psDevice->ui32JedecCHIPREV  = (AM_BFR(JEDEC, PID2, CHIPREVH4) << 4);
+    psDevice->ui32JedecCHIPREV |= (AM_BFR(JEDEC, PID3, CHIPREVL4) << 0);
+
+    //
+    // Let's get the Coresight ID (32-bits across 4 registers)
+    // For Apollo and Apollo2, it's expected to be 0xB105100D.
+    //
+    psDevice->ui32JedecCID  = (AM_BFR(JEDEC, CID3, CID) << 24);
+    psDevice->ui32JedecCID |= (AM_BFR(JEDEC, CID2, CID) << 16);
+    psDevice->ui32JedecCID |= (AM_BFR(JEDEC, CID1, CID) <<  8);
+    psDevice->ui32JedecCID |= (AM_BFR(JEDEC, CID0, CID) <<  0);
+}
+
+//*****************************************************************************
+//
+//! @brief Enables the fault capture registers.
+//!
+//! This function enables the DCODEFAULTADDR and ICODEFAULTADDR registers.
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_mcuctrl_fault_capture_enable(void)
+{
+    //
+    // Enable the Fault Capture registers.
+    //
+    AM_BFW(MCUCTRL, FAULTCAPTUREEN, ENABLE, 1);
+}
+
+//*****************************************************************************
+//
+//! @brief Disables the fault capture registers.
+//!
+//! This function disables the DCODEFAULTADDR and ICODEFAULTADDR registers.
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_mcuctrl_fault_capture_disable(void)
+{
+    //
+    // Disable the Fault Capture registers.
+    //
+    AM_BFW(MCUCTRL, FAULTCAPTUREEN, ENABLE, 0);
+}
+
+//*****************************************************************************
+//
+//! @brief Gets the fault status and capture registers.
+//!
+//! @param psFault is a pointer to a structure that will be used to store all
+//! fault info.
+//!
+//! This function gets the status of the ICODE, DCODE, and SYS bus faults and
+//! the addresses associated with the fault.
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_mcuctrl_fault_status(am_hal_mcuctrl_fault_t *psFault)
+{
+    uint32_t ui32FaultStat;
+
+    //
+    // Read the Fault Status Register.
+    //
+    ui32FaultStat = AM_REG(MCUCTRL, FAULTSTATUS);
+    psFault->bICODE = (ui32FaultStat & AM_REG_MCUCTRL_FAULTSTATUS_ICODE_M);
+    psFault->bDCODE = (ui32FaultStat & AM_REG_MCUCTRL_FAULTSTATUS_DCODE_M);
+    psFault->bSYS = (ui32FaultStat & AM_REG_MCUCTRL_FAULTSTATUS_SYS_M);
+
+    //
+    // Read the DCODE fault capture address register.
+    //
+    psFault->ui32DCODE = AM_REG(MCUCTRL, DCODEFAULTADDR);
+
+    //
+    // Read the ICODE fault capture address register.
+    //
+    psFault->ui32ICODE |= AM_REG(MCUCTRL, ICODEFAULTADDR);
+
+    //
+    // Read the ICODE fault capture address register.
+    //
+    psFault->ui32SYS |= AM_REG(MCUCTRL, SYSFAULTADDR);
+}
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_mcuctrl.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_mcuctrl.h
new file mode 100644
index 000000000..94b5957aa
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_mcuctrl.h
@@ -0,0 +1,212 @@
+//*****************************************************************************
+//
+//! @file am_hal_mcuctrl.h
+//!
+//! @brief Functions for accessing and configuring the MCUCTRL.
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup mcuctrl MCU Control (MCUCTRL)
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_HAL_MCUCTRL_H
+#define AM_HAL_MCUCTRL_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+//
+// Deprecate the am_hal_mcuctrl_bucks_enable() and disable() functions.
+// This functionality is now handled in pwrctrl.
+//
+#define am_hal_mcuctrl_bucks_enable     am_hal_pwrctrl_bucks_enable
+#define am_hal_mcuctrl_bucks_disable    am_hal_pwrctrl_bucks_disable
+
+
+//*****************************************************************************
+//
+// Define CHIP_INFO fields, which for Apollo2 are not defined in the register
+// definitions.
+//
+//*****************************************************************************
+#define AM_HAL_MCUCTRL_CHIP_INFO_CLASS_M        0xFF000000
+#define AM_HAL_MCUCTRL_CHIP_INFO_CLASS_S        24
+#define AM_HAL_MCUCTRL_CHIP_INFO_FLASH_SIZE_M   0x00F00000
+#define AM_HAL_MCUCTRL_CHIP_INFO_FLASH_SIZE_S   20
+#define AM_HAL_MCUCTRL_CHIP_INFO_SRAM_SIZE_M    0x000F0000
+#define AM_HAL_MCUCTRL_CHIP_INFO_SRAM_SIZE_S    16
+#define AM_HAL_MCUCTRL_CHIP_INFO_REV_M          0x0000FF00
+#define AM_HAL_MCUCTRL_CHIP_INFO_REV_S          8
+#define AM_HAL_MCUCTRL_CHIP_INFO_PKG_M          0x000000C0
+#define AM_HAL_MCUCTRL_CHIP_INFO_PKG_S          6
+#define AM_HAL_MCUCTRL_CHIP_INFO_PINS_M         0x00000038
+#define AM_HAL_MCUCTRL_CHIP_INFO_PINS_S         3
+#define AM_HAL_MCUCTRL_CHIP_INFO_TEMP_M         0x00000006
+#define AM_HAL_MCUCTRL_CHIP_INFO_TEMP_S         1
+#define AM_HAL_MCUCTRL_CHIP_INFO_QUAL_M         0x00000001
+#define AM_HAL_MCUCTRL_CHIP_INFO_QUAL_S         0
+
+//*****************************************************************************
+//
+// Apollo Number Decode.
+//
+//*****************************************************************************
+extern const uint32_t g_am_hal_mcuctrl_flash_size[];
+extern const uint32_t g_am_hal_mcuctrl_sram_size[];
+
+//*****************************************************************************
+//
+//! MCUCTRL device structure
+//
+//*****************************************************************************
+typedef struct
+{
+    //
+    //! Device part number. (BCD format)
+    //
+    uint32_t ui32ChipPN;
+
+    //
+    //! Unique Chip ID 0.
+    //
+    uint32_t ui32ChipID0;
+
+    //
+    //! Unique Chip ID 1.
+    //
+    uint32_t ui32ChipID1;
+
+    //
+    //! Chip Revision.
+    //
+    uint32_t ui32ChipRev;
+
+    //
+    //! Vendor ID.
+    //
+    uint32_t ui32VendorID;
+
+    //
+    //! Qualified chip.
+    //
+    uint32_t ui32Qualified;
+
+    //
+    //! Flash Size.
+    //
+    uint32_t ui32FlashSize;
+
+    //
+    //! SRAM Size.
+    //
+    uint32_t ui32SRAMSize;
+
+    //
+    // JEDEC chip info
+    //
+    uint32_t ui32JedecPN;
+    uint32_t ui32JedecJEPID;
+    uint32_t ui32JedecCHIPREV;
+    uint32_t ui32JedecCID;
+}
+am_hal_mcuctrl_device_t;
+
+//*****************************************************************************
+//
+//! MCUCTRL fault structure
+//
+//*****************************************************************************
+typedef struct
+{
+    //
+    //! ICODE bus fault occurred.
+    //
+    bool bICODE;
+
+    //
+    //! ICODE bus fault address.
+    //
+    uint32_t ui32ICODE;
+
+    //
+    //! DCODE bus fault occurred.
+    //
+    bool bDCODE;
+
+    //
+    //! DCODE bus fault address.
+    //
+    uint32_t ui32DCODE;
+
+    //
+    //! SYS bus fault occurred.
+    //
+    bool bSYS;
+
+    //
+    //! SYS bus fault address.
+    //
+    uint32_t ui32SYS;
+}
+am_hal_mcuctrl_fault_t;
+
+//*****************************************************************************
+//
+// External function definitions
+//
+//*****************************************************************************
+extern void am_hal_mcuctrl_device_info_get(am_hal_mcuctrl_device_t *psDevice);
+extern void am_hal_mcuctrl_fault_capture_enable(void);
+extern void am_hal_mcuctrl_fault_capture_disable(void);
+extern void am_hal_mcuctrl_fault_status(am_hal_mcuctrl_fault_t *psFault);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_HAL_MCUCTRL_H
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_otp.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_otp.c
new file mode 100644
index 000000000..935e7262e
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_otp.c
@@ -0,0 +1,172 @@
+//*****************************************************************************
+//
+//! @file am_hal_otp.c
+//!
+//! @brief Functions for handling the OTP interface.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#include "am_mcu_apollo.h"
+#include "am_hal_flash.h"
+
+//*****************************************************************************
+//
+//! THIS FUNCTION IS DEPRECATED!
+//! Use the respective HAL flash function instead.
+//!
+// @brief Check if debugger is currently locked out.
+//
+// @param None.
+//
+// Determine if the debugger is already locked out.
+//
+// @return non-zero if debugger is currently locked out.
+//     Specifically:
+//     0 = debugger is not locked out.
+//     1 = debugger is locked out.
+//
+//*****************************************************************************
+int
+am_hal_otp_is_debugger_lockedout(void)
+{
+    return am_hal_flash_debugger_disable_check();
+}
+
+//*****************************************************************************
+//
+//! THIS FUNCTION IS DEPRECATED!
+//! Use the respective HAL flash function instead.
+//!
+// @brief Lock out debugger access.
+//
+// @param None.
+//
+// This function locks out access by a debugger.
+//
+// @return 0 if lockout was successful or if lockout was already enabled.
+//
+//*****************************************************************************
+int
+am_hal_otp_debugger_lockout(void)
+{
+    return am_hal_flash_debugger_disable();
+}
+
+//*****************************************************************************
+//
+//! THIS FUNCTION IS DEPRECATED!
+//! Use the respective HAL flash function instead.
+//!
+// @brief Lock out SRAM access.
+//
+// @param None.
+//
+// This function locks out access by a debugger to SRAM.
+//
+// @return 0 if lockout was successful or if lockout was already enabled.
+//         Low byte=0xff, byte 1 contains current value of lockout.
+//         Else, return value from HAL programming function.
+//
+//*****************************************************************************
+int
+am_hal_otp_sram_lockout(void)
+{
+    return am_hal_flash_wipe_sram_enable();
+}
+
+//*****************************************************************************
+//
+//! THIS FUNCTION IS DEPRECATED!
+//! Use the respective HAL flash function instead.
+//!
+// @brief Set copy (read) protection.
+//
+// @param @u32BegAddr The beginning address to be copy protected.
+//        @u32EndAddr The ending address to be copy protected.
+//
+// @note For Apollo, the u32BegAddr parameter should be on a 16KB boundary, and
+//       the u32EndAddr parameter should be on a (16KB-1) boundary. Otherwise
+//       both parameters will be truncated/expanded to do so.
+//       For example, if u32BegAddr=0x1000 and u32EndAddr=0xC200, the actual
+//       range that protected is: 0x0 - 0xFFFF.
+//
+// This function enables copy protection on a given flash address range.
+//
+// @return 0 if copy protection was successfully enabled.
+//
+//*****************************************************************************
+int
+am_hal_otp_set_copy_protection(uint32_t u32BegAddr, uint32_t u32EndAddr)
+{
+    return am_hal_flash_copy_protect_set((uint32_t*)u32BegAddr,
+                                         (uint32_t*)u32EndAddr);
+}
+
+//*****************************************************************************
+//
+//! THIS FUNCTION IS DEPRECATED!
+//! Use the respective HAL flash function instead.
+//!
+// @brief Set write protection.
+//
+// @param @u32BegAddr The beginning address to be write protected.
+//        @u32EndAddr The ending address to be write protected.
+//
+// @note For Apollo, the u32BegAddr parameter should be on a 16KB boundary, and
+//       the u32EndAddr parameter should be on a (16KB-1) boundary. Otherwise
+//       both parameters will be truncated/expanded to do so.
+//       For example, if u32BegAddr=0x1000 and u32EndAddr=0xC200, the actual
+//       range that protected is: 0x0 - 0xFFFF.
+//
+// This function enables write protection on a given flash address range.
+//
+// @return 0 if write protection was successfully enabled.
+//
+//*****************************************************************************
+int
+am_hal_otp_set_write_protection(uint32_t u32BegAddr, uint32_t u32EndAddr)
+{
+    return am_hal_flash_write_protect_set((uint32_t*)u32BegAddr,
+                                          (uint32_t*)u32EndAddr);
+}
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_otp.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_otp.h
new file mode 100644
index 000000000..2ac6f4021
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_otp.h
@@ -0,0 +1,107 @@
+//*****************************************************************************
+//
+//! @file am_hal_otp.h
+//!
+//! @brief Functions for handling the OTP interface.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_HAL_OTP_H
+#define AM_HAL_OTP_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+//*****************************************************************************
+//
+// Define some OTP values and macros.
+//
+//*****************************************************************************
+#define AM_HAL_OTP_SIG0             0x00
+#define AM_HAL_OTP_SIG1             0x04
+#define AM_HAL_OTP_SIG2             0x08
+#define AM_HAL_OTP_SIG3             0x0C
+
+#define AM_HAL_OTP_DBGR_O           0x10
+#define AM_HAL_OTP_WRITPROT0_O      0x20
+#define AM_HAL_OTP_WRITPROT1_O      0x24
+#define AM_HAL_OTP_COPYPROT0_O      0x30
+#define AM_HAL_OTP_COPYPROT1_O      0x34
+
+#define AM_HAL_OTP_ADDR             0x50020000
+#define AM_HAL_OTP_DBGRPROT_ADDR    (AM_HAL_OTP_ADDR + AM_HAL_OTP_DBGR_O)
+#define AM_HAL_OTP_WRITPROT_ADDR    (AM_HAL_OTP_ADDR + AM_HAL_OTP_WRITPROT0_O)
+#define AM_HAL_OTP_COPYPROT_ADDR    (AM_HAL_OTP_ADDR + AM_HAL_OTP_COPYPROT0_O)
+
+#define AM_HAL_OTP_CHUNKSIZE        (16*1024)
+
+//
+// Debugger port lockout macros.
+//
+#define AM_OTP_DBGR_LOCKOUT_S       (0)
+#define AM_OTP_DBGR_LOCKOUT_M       (0x1 << AM_OTP_DBGR_LOCKOUT_S)
+#define AM_OTP_STRM_LOCKOUT_S       (1)
+#define AM_OTP_STRM_LOCKOUT_M       (0x1 << AM_OTP_STRM_LOCKOUT_S)
+#define AM_OTP_SRAM_LOCKOUT_S       (2)
+#define AM_OTP_SRAM_LOCKOUT_M       (0x1 << AM_OTP_SRAM_LOCKOUT_S)
+
+//*****************************************************************************
+//
+// Function prototypes
+//
+//*****************************************************************************
+extern int am_hal_otp_is_debugger_lockedout(void);
+extern int am_hal_otp_debugger_lockout(void);
+extern int am_hal_otp_sram_lockout(void);
+extern int am_hal_otp_set_copy_protection(uint32_t u32BegAddr, uint32_t u32EndAddr);
+extern int am_hal_otp_set_write_protection(uint32_t u32BegAddr, uint32_t u32EndAddr);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_HAL_OTP_H
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
+
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_pdm.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_pdm.c
new file mode 100644
index 000000000..41694e21e
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_pdm.c
@@ -0,0 +1,158 @@
+//*****************************************************************************
+//
+//! @file am_hal_pdm.c
+//!
+//! @brief Functions for interfacing with Pulse Density Modulation (PDM).
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup pdm DMEMS Microphon3 (PDM)
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "am_mcu_apollo.h"
+
+//*****************************************************************************
+//
+//! @brief Configure the PDM module.
+//!
+//! This function reads the an \e am_hal_pdm_config_t structure and uses it to
+//! set up the PDM module.
+//!
+//! Please see the information on the am_hal_pdm_config_t configuration
+//! structure, found in am_hal_pdm.h, for more information on the parameters
+//! that may be set by this function.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_pdm_config(am_hal_pdm_config_t *psConfig)
+{
+    //
+    // setup the PDM PCFG register
+    //
+    AM_REG(PDM, PCFG) = psConfig->ui32PDMConfigReg;
+
+    //
+    // setup the PDM VCFG register
+    //
+    AM_REG(PDM, VCFG) = psConfig->ui32VoiceConfigReg;
+
+    //
+    // setup the PDM FIFO Threshold register
+    //
+    AM_REG(PDM, FTHR) = psConfig->ui32FIFOThreshold;
+
+    //
+    // Flush the FIFO for good measure.
+    //
+    am_hal_pdm_fifo_flush();
+}
+
+//*****************************************************************************
+//
+//! @brief Enable the PDM module.
+//!
+//! This function enables the PDM module in the mode previously defined by
+//! am_hal_pdm_config().
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_pdm_enable(void)
+{
+    AM_REG(PDM, PCFG) |=  AM_REG_PDM_PCFG_PDMCORE_EN;
+    AM_REG(PDM, VCFG) |=  ( AM_REG_PDM_VCFG_IOCLKEN_EN      |
+                            AM_REG_PDM_VCFG_PDMCLK_EN       |
+                            AM_REG_PDM_VCFG_RSTB_NORM );
+}
+
+//*****************************************************************************
+//
+//! @brief Disable the PDM module.
+//!
+//! This function disables the PDM module.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_pdm_disable(void)
+{
+    AM_REG(PDM, PCFG) &= ~ AM_REG_PDM_PCFG_PDMCORE_EN;
+    AM_REG(PDM, VCFG) &= ~ (  AM_REG_PDM_VCFG_IOCLKEN_EN    |
+                              AM_REG_PDM_VCFG_PDMCLK_EN     |
+                              AM_REG_PDM_VCFG_RSTB_NORM );
+}
+
+//*****************************************************************************
+//
+//! @brief Return the PDM Interrupt status.
+//!
+//! @param bEnabledOnly - return only the enabled interrupts.
+//!
+//! Use this function to get the PDM interrupt status.
+//!
+//! @return intrrupt status
+//
+//*****************************************************************************
+uint32_t
+am_hal_pdm_int_status_get(bool bEnabledOnly)
+{
+    if ( bEnabledOnly )
+    {
+        uint32_t u32RetVal = AM_REG(PDM, INTSTAT);
+        return u32RetVal & AM_REG(PDM, INTEN);
+    }
+    else
+    {
+        return AM_REG(PDM, INTSTAT);
+    }
+}
+
+//*****************************************************************************
+//
+//  End the doxygen group
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_pdm.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_pdm.h
new file mode 100644
index 000000000..702c5436c
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_pdm.h
@@ -0,0 +1,665 @@
+//*****************************************************************************
+//
+//! @file am_hal_pdm.h
+//!
+//! @brief Functions for accessing and configuring the PDM module
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup pdm Pulse Density Modulation (PDM) Input Module.
+//! @ingroup hal
+//! @{
+
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#ifndef AM_HAL_PDM_H
+#define AM_HAL_PDM_H
+
+//*****************************************************************************
+//
+// Macro definitions
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+//! @name PDM Left Right Swap Control
+//! @brief Macro definitions for the PDM LRSWAP bit field
+//!
+//! These macros may be used with the am_hal_pdm_config_t structure to set the
+//! left right swap bit.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_PDM_PCFG_LRSWAP_ENABLE                                         \
+              AM_REG_PDM_PCFG_LRSWAP_EN
+#define AM_HAL_PDM_PCFG_LRSWAP_DISABLE                                        \
+              AM_REG_PDM_PCFG_LRSWAP_NOSWAP
+//! @}
+
+//*****************************************************************************
+//
+//! @name PDM Right Gain Setting
+//! @brief Macro definitions for the PDM Right Gain Setting.
+//!
+//! These macros may be used with the am_hal_pdm_config_t structure to set the
+//! right gain value.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_PDM_PCFG_RIGHT_PGA_M15DB   AM_REG_PDM_PCFG_PGARIGHT_M15DB
+#define AM_HAL_PDM_PCFG_RIGHT_PGA_M300DB  AM_REG_PDM_PCFG_PGARIGHT_M300DB
+#define AM_HAL_PDM_PCFG_RIGHT_PGA_M45DB   AM_REG_PDM_PCFG_PGARIGHT_M45DB
+#define AM_HAL_PDM_PCFG_RIGHT_PGA_M60DB   AM_REG_PDM_PCFG_PGARIGHT_M60DB
+#define AM_HAL_PDM_PCFG_RIGHT_PGA_M75DB   AM_REG_PDM_PCFG_PGARIGHT_M75DB
+#define AM_HAL_PDM_PCFG_RIGHT_PGA_M90DB   AM_REG_PDM_PCFG_PGARIGHT_M90DB
+#define AM_HAL_PDM_PCFG_RIGHT_PGA_M105DB  AM_REG_PDM_PCFG_PGARIGHT_M105DB
+#define AM_HAL_PDM_PCFG_RIGHT_PGA_M120DB  AM_REG_PDM_PCFG_PGARIGHT_M120DB
+#define AM_HAL_PDM_PCFG_RIGHT_PGA_P105DB  AM_REG_PDM_PCFG_PGARIGHT_P105DB
+#define AM_HAL_PDM_PCFG_RIGHT_PGA_P90DB   AM_REG_PDM_PCFG_PGARIGHT_P90DB
+#define AM_HAL_PDM_PCFG_RIGHT_PGA_P75DB   AM_REG_PDM_PCFG_PGARIGHT_P75DB
+#define AM_HAL_PDM_PCFG_RIGHT_PGA_P60DB   AM_REG_PDM_PCFG_PGARIGHT_P60DB
+#define AM_HAL_PDM_PCFG_RIGHT_PGA_P45DB   AM_REG_PDM_PCFG_PGARIGHT_P45DB
+#define AM_HAL_PDM_PCFG_RIGHT_PGA_P300DB  AM_REG_PDM_PCFG_PGARIGHT_P300DB
+#define AM_HAL_PDM_PCFG_RIGHT_PGA_P15DB   AM_REG_PDM_PCFG_PGARIGHT_P15DB
+#define AM_HAL_PDM_PCFG_RIGHT_PGA_0DB     AM_REG_PDM_PCFG_PGARIGHT_0DB
+//! @}
+
+//*****************************************************************************
+//
+//! @name PDM Left Gain Setting
+//! @brief Macro definitions for the PDM Left Gain Setting.
+//!
+//! These macros may be used with the am_hal_pdm_config_t structure to set the
+//! left gain value.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_PDM_PCFG_LEFT_PGA_M15DB   AM_REG_PDM_PCFG_PGALEFT_M15DB
+#define AM_HAL_PDM_PCFG_LEFT_PGA_M300DB  AM_REG_PDM_PCFG_PGALEFT_M300DB
+#define AM_HAL_PDM_PCFG_LEFT_PGA_M45DB   AM_REG_PDM_PCFG_PGALEFT_M45DB
+#define AM_HAL_PDM_PCFG_LEFT_PGA_M60DB   AM_REG_PDM_PCFG_PGALEFT_M60DB
+#define AM_HAL_PDM_PCFG_LEFT_PGA_M75DB   AM_REG_PDM_PCFG_PGALEFT_M75DB
+#define AM_HAL_PDM_PCFG_LEFT_PGA_M90DB   AM_REG_PDM_PCFG_PGALEFT_M90DB
+#define AM_HAL_PDM_PCFG_LEFT_PGA_M105DB  AM_REG_PDM_PCFG_PGALEFT_M105DB
+#define AM_HAL_PDM_PCFG_LEFT_PGA_M120DB  AM_REG_PDM_PCFG_PGALEFT_M120DB
+#define AM_HAL_PDM_PCFG_LEFT_PGA_P105DB  AM_REG_PDM_PCFG_PGALEFT_P105DB
+#define AM_HAL_PDM_PCFG_LEFT_PGA_P90DB   AM_REG_PDM_PCFG_PGALEFT_P90DB
+#define AM_HAL_PDM_PCFG_LEFT_PGA_P75DB   AM_REG_PDM_PCFG_PGALEFT_P75DB
+#define AM_HAL_PDM_PCFG_LEFT_PGA_P60DB   AM_REG_PDM_PCFG_PGALEFT_P60DB
+#define AM_HAL_PDM_PCFG_LEFT_PGA_P45DB   AM_REG_PDM_PCFG_PGALEFT_P45DB
+#define AM_HAL_PDM_PCFG_LEFT_PGA_P300DB  AM_REG_PDM_PCFG_PGALEFT_P300DB
+#define AM_HAL_PDM_PCFG_LEFT_PGA_P15DB   AM_REG_PDM_PCFG_PGALEFT_P15DB
+#define AM_HAL_PDM_PCFG_LEFT_PGA_0DB     AM_REG_PDM_PCFG_PGALEFT_0DB
+//! @}
+
+//*****************************************************************************
+//
+//! @name PDM Configuration MCLK Divider
+//! @brief Macro definitions for the PDM MCLK Divider
+//!
+//! These macros may be used with the am_hal_pdm_config_t structure to set the
+//! sinc decimation rate relative to the PDM sample clock (OSR).
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_PDM_PCFG_MCLKDIV_DIV1    AM_REG_PDM_PCFG_MCLKDIV_MCKDIV1
+#define AM_HAL_PDM_PCFG_MCLKDIV_DIV2    AM_REG_PDM_PCFG_MCLKDIV_MCKDIV2
+#define AM_HAL_PDM_PCFG_MCLKDIV_DIV3    AM_REG_PDM_PCFG_MCLKDIV_MCKDIV3
+#define AM_HAL_PDM_PCFG_MCLKDIV_DIV4    AM_REG_PDM_PCFG_MCLKDIV_MCKDIV4
+
+#define AM_HAL_PDM_PCFG_MCLKDIV(DIV)    AM_REG_PDM_PCFG_MCLKDIV(DIV)
+//! @}
+
+//*****************************************************************************
+//
+//! @name PDM Configuration SINC Decimation Rate
+//! @brief Macro definitions for the PDM SINC decimation rate
+//!
+//! These macros may be used with the am_hal_pdm_config_t structure to set the
+//! sinc decimation rate relative to the PDM sample clock (OSR).
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_PDM_PCFG_SINC_RATE(OSR)                                        \
+              AM_REG_PDM_PCFG_SINCRATE(OSR)
+//! @}
+
+//*****************************************************************************
+//
+//! @name PDM Configuration High Pass Filter Enable
+//! @brief Macro definitions for the PDM ADCHPD
+//!
+//! These macros may be used with the am_hal_pdm_config_t structure to enable
+//! the high pass filter.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_PDM_PCFG_ADCHPD_ENABLE  AM_REG_PDM_PCFG_ADCHPD_EN
+#define AM_HAL_PDM_PCFG_ADCHPD_DISABLE AM_REG_PDM_PCFG_ADCHPD_DIS
+//! @}
+
+//*****************************************************************************
+//
+//! @name PDM Configuration HPCUTOFF
+//! @brief Macro definitions for the PDM High Pass Filter Cutoff Selector.
+//!
+//! These macros may be used with the am_hal_pdm_config_t structure to set the
+//! high pass filter cutoff frequency. Valid range is 0 to 7.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_PDM_PCFG_HPCUTOFF(HPSEL)                                       \
+              AM_REG_PDM_PCFG_HPCUTOFF(HPSEL)
+//! @}
+
+//*****************************************************************************
+//
+//! @name PDM Configuration Gain Set Change Clock Delay
+//! @brief Macro definitions for the PDM clock delay for gain set changes.
+//!
+//! These macros may be used with the am_hal_pdm_config_t structure to set the
+//! number of clocks for spreading gain setting changes. Valid range is 0 to 7.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_PDM_PCFG_CYCLES(CLOCKS)                                        \
+              AM_REG_PDM_PCFG_CYCLES(CLOCKS)
+//! @}
+
+//*****************************************************************************
+//
+//! @name PDM Configuration SOFTMUTE enable/disable.
+//! @brief Macro definitions for the PDM PCFG register mute controls.
+//!
+//! These macros may be used with the am_hal_pdm_config_t structure to enable
+//! or disable the SOFTMUTE option.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_PDM_PCFG_SOFTMUTE_ENABLE  AM_REG_PDM_PCFG_SOFTMUTE_EN
+#define AM_HAL_PDM_PCFG_SOFTMUTE_DISABLE AM_REG_PDM_PCFG_SOFTMUTE_DIS
+//! @}
+
+//*****************************************************************************
+//
+//! @name PDM Configuration PDM Core enable/disable.
+//! @brief Macro definitions for the PDM PCFG register filter engine enable.
+//!
+//! These macros may be used with the am_hal_pdm_config_t structure to enable
+//! or disable the PDM filter engine core.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_PDM_PCFG_PDMCORE_ENABLE  AM_REG_PDM_PCFG_PDMCORE_EN
+#define AM_HAL_PDM_PCFG_PDMCORE_DISABLE AM_REG_PDM_PCFG_PDMCORE_DIS
+//! @}
+
+//*****************************************************************************
+//
+//! @name PDM Clock Frequencies
+//! @brief Macro definitions for the PDM clock (from clkgen) frequencies.
+//!
+//! These macros may be used with the am_hal_pdm_config_t structure to set the
+//! source clock frequency of the PDM interface.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_PDM_IOCLK_12MHZ                                              \
+        (AM_REG_PDM_VCFG_PDMCLKSEL_12MHz | AM_REG_PDM_VCFG_IOCLKEN_EN)
+#define AM_HAL_PDM_IOCLK_6MHZ                                               \
+        (AM_REG_PDM_VCFG_PDMCLKSEL_6MHz | AM_REG_PDM_VCFG_IOCLKEN_EN)
+#define AM_HAL_PDM_IOCLK_3MHZ                                               \
+        (AM_REG_PDM_VCFG_PDMCLKSEL_3MHz | AM_REG_PDM_VCFG_IOCLKEN_EN)
+#define AM_HAL_PDM_IOCLK_1_5MHZ                                             \
+        (AM_REG_PDM_VCFG_PDMCLKSEL_1_5MHz | AM_REG_PDM_VCFG_IOCLKEN_EN)
+#define AM_HAL_PDM_IOCLK_750KHZ                                             \
+        (AM_REG_PDM_VCFG_PDMCLKSEL_750KHz | AM_REG_PDM_VCFG_IOCLKEN_EN)
+#define AM_HAL_PDM_IOCLK_375KHZ                                             \
+        (AM_REG_PDM_VCFG_PDMCLKSEL_375KHz | AM_REG_PDM_VCFG_IOCLKEN_EN)
+#define AM_HAL_PDM_IOCLK_187KHZ                                             \
+        (AM_REG_PDM_VCFG_PDMCLKSEL_187KHz | AM_REG_PDM_VCFG_IOCLKEN_EN)
+//! @}
+
+//*****************************************************************************
+//
+//! @name PDM Voice Configuration RSTB
+//! @brief Reset the IP core.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_PDM_VCFG_RSTB_RESET      AM_REG_PDM_VCFG_RSTB_RESET
+#define AM_HAL_PDM_VCFG_RSTB_NORMAL     AM_REG_PDM_VCFG_RSTB_NORM
+//! @}
+
+//*****************************************************************************
+//
+//! @name PDM Voice Configuration PDM Clock Enable/Disable
+//! @brief Macro definitions for the PDM VCFG register PDMCLKEN.
+//!
+//! These macros may be used with the am_hal_pdm_config_t structure to enable
+//! or disable the PDM clock output to the pad mux and from there to the world.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_PDM_VCFG_PDMCLK_ENABLE  AM_REG_PDM_VCFG_PDMCLK_EN
+#define AM_HAL_PDM_VCFG_PDMCLK_DISABLE AM_REG_PDM_VCFG_PDMCLK_DIS
+//! @}
+
+//*****************************************************************************
+//
+//! @name PDM Voice Configuration I2S Mode Enable/Disable
+//! @brief Macro definitions for the PDM VCFG register I2SMODE.
+//!
+//! These macros may be used with the am_hal_pdm_config_t structure to enable
+//! or disable the PDM clock output to the pad mux and from there to the world.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_PDM_VCFG_I2SMODE_ENABLE  AM_REG_PDM_VCFG_I2SMODE_EN
+#define AM_HAL_PDM_VCFG_I2SMODE_DISABLE AM_REG_PDM_VCFG_I2SMODE_DIS
+//! @}
+
+//*****************************************************************************
+//
+//! @name PDM Voice Configuration BCLK Inversion Enable/Disable
+//! @brief Macro definitions for the PDM VCFG register BCLKINV.
+//!
+//! These macros may be used with the am_hal_pdm_config_t structure to enable
+//! or disable the PDM clock output to the pad mux and from there to the world.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_PDM_VCFG_BCLKINV_ENABLE  AM_REG_PDM_VCFG_BCLKINV_INV
+#define AM_HAL_PDM_VCFG_BCLKINV_DISABLE AM_REG_PDM_VCFG_BCLKINV_NORM
+//! @}
+
+//*****************************************************************************
+//
+//! @name PDM Voice Configuration DMICDEL Enable/Disable
+//! @brief Macro definitions for the PDM VCFG register Digital Mic Delay.
+//!
+//! These macros may be used with the am_hal_pdm_config_t structure to enable
+//! or disable the PDM digital microphone clock delay.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_PDM_VCFG_DMICDEL_1CYC    AM_REG_PDM_VCFG_DMICKDEL_1CYC
+#define AM_HAL_PDM_VCFG_DMICDEL_0CYC    AM_REG_PDM_VCFG_DMICKDEL_0CYC
+#define AM_HAL_PDM_VCFG_DMICDEL_ENABLE  AM_REG_PDM_VCFG_DMICKDEL_1CYC
+#define AM_HAL_PDM_VCFG_DMICDEL_DISABLE AM_REG_PDM_VCFG_DMICKDEL_0CYC
+//! @}
+
+//*****************************************************************************
+//
+//! @name PDM Voice Configuration Select Apps Processor (AP) versus Internal
+//! @brief Macro definitions for the PDM VCFG register Digital Mic Delay.
+//!
+//! These macros may be used with the am_hal_pdm_config_t structure to select
+//! the Application Processor (I2S slave) mode or the Internal FIFO interface
+//! to the Apollo Cortex M4.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_PDM_VCFG_SELAP_I2S       AM_REG_PDM_VCFG_SELAP_I2S
+#define AM_HAL_PDM_VCFG_SELAP_INTERNAL  AM_REG_PDM_VCFG_SELAP_INTERNAL
+#define AM_HAL_PDM_VCFG_SELAP_AP_I2S    AM_REG_PDM_VCFG_SELAP_I2S
+#define AM_HAL_PDM_VCFG_SELAP_CM4_FIFO  AM_REG_PDM_VCFG_SELAP_INTERNAL
+//! @}
+
+//*****************************************************************************
+//
+//! @name PDM Voice Configuration PACK Enable/Disable
+//! @brief Macro definitions for the PDM VCFG register sample packing mode.
+//!
+//! These macros may be used with the am_hal_pdm_config_t structure to enable
+//! or disable the PDM sample packing mode. This mode puts two 16-bit samples
+//! per 32-bit FIFO word. The following packed modes are available:
+//!
+//!   mono left:            LEFT_NEW, LEFT_OLD
+//!   mono right:           RIGHT_NEW,RIGHT_OLD
+//!   stereo right:         LEFT,     RIGHT
+//!   stereo right(LRSWAP): RIGHT,    LEFT
+//!
+//!
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_PDM_VCFG_PACK_ENABLE  AM_REG_PDM_VCFG_PCMPACK_EN
+#define AM_HAL_PDM_VCFG_PACK_DISABLE AM_REG_PDM_VCFG_PCMPACK_DIS
+//! @}
+
+//*****************************************************************************
+//
+//! @name PDM Channel Selects
+//! @brief Macro definitions for the PDM Channel Selection.
+//!
+//! These macros may be used with the am_hal_pdm_config_t structure to set the
+//! channel selection for the PDM interface.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_PDM_VCFG_CHANNEL_LEFT   AM_REG_PDM_VCFG_CHSET_LEFT
+#define AM_HAL_PDM_VCFG_CHANNEL_RIGHT  AM_REG_PDM_VCFG_CHSET_RIGHT
+#define AM_HAL_PDM_VCFG_CHANNEL_STEREO AM_REG_PDM_VCFG_CHSET_STEREO
+//! @}
+
+//*****************************************************************************
+//
+//! @name PDM Interrupts
+//! @brief Macro definitions for the PDM interrupt status bits.
+//!
+//! These macros correspond to the bits in the PDM interrupt status register.
+//! They may be used for any of the am_hal_pdm_int_x() functions.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_PDM_INT_UNDFL AM_REG_PDM_INTEN_UNDFL_M
+#define AM_HAL_PDM_INT_OVF   AM_REG_PDM_INTEN_OVF_M
+#define AM_HAL_PDM_INT_FIFO  AM_REG_PDM_INTEN_THR_M
+//! @}
+
+//*****************************************************************************
+//
+//! @brief Configuration structure for the PDM module.
+//
+//*****************************************************************************
+typedef struct
+{
+    //
+    //! @brief Set the PDM configuration reg with the values in this member.
+    //! Choose from AM_HAL_PDM_PCFG macros.
+    //!     AM_HAL_PDM_PCFG_LRSWAP_xxx
+    //!     AM_HAL_PDM_PCFG_RIGHT_PGA_xxx
+    //!     AM_HAL_PDM_PCFG_LEFT_PGA_xxx
+    //!     AM_HAL_PDM_PCFG_MCLKDIV_xxx
+    //!     AM_HAL_PDM_PCFG_SINC_RATE()
+    //!     AM_HAL_PDM_PCFG_ADCHPD_xxx
+    //!     AM_HAL_PDM_PCFG_HPCUTOFF()
+    //!     AM_HAL_PDM_PCFG_CYCLES()
+    //!     AM_HAL_PDM_PCFG_SOFTMUTE_xxx
+    //!   * AM_HAL_PDM_PCFG_PDMCORE_EN
+    //!     AM_HAL_PDM_PCFG_PDMCORE_DISABLE
+    //
+    uint32_t ui32PDMConfigReg;
+
+    //
+    //! @brief Set the Voice Configuration reg with the values in this member.
+    //! Choose from AM_HAL_PDM_VCFG macros.
+    //!     AM_HAL_PDM_IOCLK_xxx (also sets AM_REG_PDM_VCFG_IOCLKEN_EN)
+    //!   * AM_REG_PDM_VCFG_IOCLKEN_EN
+    //!   * AM_HAL_PDM_VCFG_RSTB_RESET
+    //!     AM_HAL_PDM_VCFG_RSTB_NORMAL
+    //!   * AM_HAL_PDM_VCFG_PDMCLK_EN
+    //!     AM_HAL_PDM_VCFG_PDMCLK_DIS
+    //!     AM_HAL_PDM_VCFG_I2SMODE_xxx
+    //!     AM_HAL_PDM_VCFG_BCLKINV_xxx
+    //!     AM_HAL_PDM_VCFG_DMICDEL_xxx
+    //!     AM_HAL_PDM_VCFG_SELAP_xxx
+    //!     AM_HAL_PDM_VCFG_PACK_xxx
+    //!     AM_HAL_PDM_VCFG_CHANNEL_xxx
+    //!
+    //! * = These bits are set or cleared by the HAL PDM functions
+    //!     am_hal_pdm_enable() or am_hal_pdm_disable().
+    //
+    uint32_t ui32VoiceConfigReg;
+
+    //
+    //! @brief Select the FIFO PCM sample threshold.
+    //!
+    //! The PDM controller will generate a processor interrupt when the number
+    //! of entries in the FIFO goes *above* this number.
+    //
+    uint32_t ui32FIFOThreshold;
+} am_hal_pdm_config_t;
+
+//*****************************************************************************
+//
+// Define function-like macros.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+//! @brief Read the FIFO depth information as an in-line macro
+//
+//*****************************************************************************
+#define am_hal_pdm_fifo_depth_read()    (AM_REG(PDM, FR))
+
+//*****************************************************************************
+//
+//! @brief Read the FIFO READ DATA as an in-line macro
+//
+//*****************************************************************************
+#define am_hal_pdm_fifo_data_read()     (AM_REG(PDM, FRD))
+
+//*****************************************************************************
+//
+//! @brief Flush the FIFO as an in-line macro
+//
+//*****************************************************************************
+#define am_hal_pdm_fifo_flush()         (AM_REG(PDM, FLUSH) = 0)
+
+//*****************************************************************************
+//
+//! @brief Set the PDM Configuration (PCFG) Register
+//!
+//! This function sets the PDM configuration register
+//
+//*****************************************************************************
+#define am_hal_pdm_pcfg_set(Value)      (AM_REG(PDM, PCFG) = Value)
+
+//*****************************************************************************
+//
+//! @brief Get the PCFG register value from PDM module.
+//
+//*****************************************************************************
+#define am_hal_pdm_pcfg_get()           (AM_REG(PDM, PCFG))
+
+//*****************************************************************************
+//
+//! @brief Set the Voice Configuration (VCFG) Register
+//
+//*****************************************************************************
+#define am_hal_pdm_vcfg_set(Value)      (AM_REG(PDM, VCFG) = Value)
+
+//*****************************************************************************
+//
+//! @brief Get the VCFG register value from PDM module.
+//
+//*****************************************************************************
+#define am_hal_pdm_vcfg_get()           (AM_REG(PDM, VCFG))
+
+//*****************************************************************************
+//
+//! @brief Set the FIFO Threshold
+//
+//*****************************************************************************
+#define am_hal_pdm_thresh_set(thresh)   (AM_REG(PDM, FTHR) = thresh)
+
+//*****************************************************************************
+//
+//! @brief Get the FIFO Threshold register value from PDM module.
+//
+//*****************************************************************************
+#define am_hal_pdm_thresh_get()         (AM_REG(PDM, FTHR))
+
+//*****************************************************************************
+//
+//! @brief Set the left microphone PGA gain.
+//!
+//*****************************************************************************
+#define am_hal_pdm_left_gain_set(gain)  (AM_BFW(PDM, PCFG, PGALEFT, gain))
+
+//*****************************************************************************
+//
+//! @brief Set the right microphone PGA gain.
+//
+//*****************************************************************************
+#define am_hal_pdm_right_gain_set(gain) (AM_BFW(PDM, PCFG, PGARIGHT, gain))
+
+//*****************************************************************************
+//
+//! @brief Get the left microphone PGA gain value.
+//
+//*****************************************************************************
+#define am_hal_pdm_left_gain_get()      (AM_BFR(PDM, PCFG, PGALEFT))
+
+//*****************************************************************************
+//
+//! @brief Get the right microphone PGA gain value.
+//
+//*****************************************************************************
+#define am_hal_pdm_right_gain_get()     (AM_BFR(PDM, PCFG, PGARIGHT))
+
+//*****************************************************************************
+//
+//! @brief Enable the Soft Mute functionality.
+//
+//*****************************************************************************
+#define am_hal_pdm_soft_mute_enable()   (AM_BFWe(PDM, PCFG, SOFTMUTE, EN))
+
+//*****************************************************************************
+//
+//! @brief Disable the Soft Mute functionality.
+//
+//*****************************************************************************
+#define am_hal_pdm_soft_mute_disable()  (AM_BFWe(PDM, PCFG, SOFTMUTE, DIS))
+
+//*****************************************************************************
+//
+//! @brief Enable selected PDM Interrupts.
+//!
+//! @param ui32Interrupt - Use the macro bit fields provided in am_hal_pdm.h\n
+//!     AM_HAL_PDM_INT_UNDFL\n
+//!     AM_HAL_PDM_INT_OVF\n
+//!     AM_HAL_PDM_INT_FIFO\n
+//
+//*****************************************************************************
+#define am_hal_pdm_int_enable(intrpt)   (AM_REG(PDM, INTEN) |= intrpt)
+
+//*****************************************************************************
+//
+//! @brief Return the enabled PDM Interrupts.
+//!
+//! Use this function to return all enabled PDM interrupts.
+//!
+//! @return all enabled PDM interrupts as a mask.\n
+//!     AM_HAL_PDM_INT_UNDFL\n
+//!     AM_HAL_PDM_INT_OVF\n
+//!     AM_HAL_PDM_INT_FIFO\n
+//
+//*****************************************************************************
+#define am_hal_pdm_int_enable_get()     (AM_REG(PDM, INTEN))
+
+//*****************************************************************************
+//
+//! @brief Disable selected PDM Interrupts.
+//!
+//! @param ui32Interrupt - Use the macro bit fields provided in am_hal_pdm.h\n
+//!     AM_HAL_PDM_INT_UNDFL\n
+//!     AM_HAL_PDM_INT_OVF\n
+//!     AM_HAL_PDM_INT_FIFO\n
+//
+//*****************************************************************************
+#define am_hal_pdm_int_disable(intrpt)  (AM_REG(PDM, INTEN) &= ~intrpt)
+
+//*****************************************************************************
+//
+//! @brief Clear selected PDM Interrupts.
+//!
+//! @param ui32Interrupt - Use the macro bit fields provided in am_hal_pdm.h\n
+//!     AM_HAL_PDM_INT_UNDFL\n
+//!     AM_HAL_PDM_INT_OVF\n
+//!     AM_HAL_PDM_INT_FIFO\n
+//
+//*****************************************************************************
+#define am_hal_pdm_int_clear(intrpt)    (AM_REG(PDM, INTCLR) = intrpt)
+
+//*****************************************************************************
+//
+//! @brief Set selected PDM Interrupts.
+//!
+//! Use this function to set the PDM interrupts.
+//!
+//! @param ui32Interrupt - Use the macro bit fields provided in am_hal_pdm.h\n
+//!     AM_HAL_PDM_INT_UNDFL\n
+//!     AM_HAL_PDM_INT_OVF\n
+//!     AM_HAL_PDM_INT_FIFO\n
+//
+//*****************************************************************************
+#define am_hal_pdm_int_set(intrpt)      (AM_REG(PDM, INTSET) = intrpt)
+
+//*****************************************************************************
+//
+// External function definitions
+//
+//*****************************************************************************
+extern void am_hal_pdm_config(am_hal_pdm_config_t * cfg);
+extern void am_hal_pdm_enable(void);
+extern void am_hal_pdm_disable(void);
+
+extern uint32_t am_hal_pdm_int_status_get(bool bEnabledOnly);
+
+#endif // AM_HAL_PDM_H
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_pin.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_pin.h
new file mode 100644
index 000000000..e80ec8f5a
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_pin.h
@@ -0,0 +1,558 @@
+//*****************************************************************************
+//
+//! @file am_hal_pin.h
+//!
+//! @brief Macros for configuring specific pins.
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup pin PIN
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#ifndef AM_HAL_PIN_H
+#define AM_HAL_PIN_H
+
+//*****************************************************************************
+//
+// Pin definition helper macros.
+//
+//*****************************************************************************
+#define AM_HAL_PIN_DIR_INPUT      (AM_HAL_GPIO_INPEN)
+#define AM_HAL_PIN_DIR_OUTPUT     (AM_HAL_GPIO_OUT_PUSHPULL)
+#define AM_HAL_PIN_DIR_OPENDRAIN  (AM_HAL_GPIO_OUT_OPENDRAIN | AM_HAL_GPIO_INPEN)
+#define AM_HAL_PIN_DIR_3STATE     (AM_HAL_GPIO_OUT_3STATE)
+
+//*****************************************************************************
+//
+// Pin definition helper macros.
+//
+//*****************************************************************************
+#define AM_HAL_PIN_DISABLE        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_INPUT          (AM_HAL_GPIO_FUNC(3) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_OUTPUT         (AM_HAL_GPIO_FUNC(3) | AM_HAL_PIN_DIR_OUTPUT)
+#define AM_HAL_PIN_OPENDRAIN      (AM_HAL_GPIO_FUNC(3) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_3STATE         (AM_HAL_GPIO_FUNC(3) | AM_HAL_PIN_DIR_3STATE)
+
+//*****************************************************************************
+//
+// Pin definition macros.
+//
+//*****************************************************************************
+#define AM_HAL_PIN_0_SLSCL        (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_0_SLSCK        (AM_HAL_GPIO_FUNC(1) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_0_CLKOUT       (AM_HAL_GPIO_FUNC(2))
+#define AM_HAL_PIN_0_GPIO         (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_0_MxSCKLB      (AM_HAL_GPIO_FUNC(4))
+#define AM_HAL_PIN_0_M2SCK        (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_0_MxSCLLB      (AM_HAL_GPIO_FUNC(6))
+#define AM_HAL_PIN_0_M2SCL        (AM_HAL_GPIO_FUNC(7) | AM_HAL_PIN_DIR_OPENDRAIN)
+
+#define AM_HAL_PIN_1_SLSDA        (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_1_SLMISO       (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_1_UART0TX      (AM_HAL_GPIO_FUNC(2))
+#define AM_HAL_PIN_1_GPIO         (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_1_MxMISOLB     (AM_HAL_GPIO_FUNC(4))
+#define AM_HAL_PIN_1_M2MISO       (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_1_MxSDALB      (AM_HAL_GPIO_FUNC(6))
+#define AM_HAL_PIN_1_M2SDA        (AM_HAL_GPIO_FUNC(7) | AM_HAL_PIN_DIR_OPENDRAIN)
+
+#define AM_HAL_PIN_2_SLWIR3       (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_3STATE)
+#define AM_HAL_PIN_2_SLMOSI       (AM_HAL_GPIO_FUNC(1) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_2_UART0RX      (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_2_GPIO         (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_2_MxMOSILB     (AM_HAL_GPIO_FUNC(4))
+#define AM_HAL_PIN_2_M2MOSI       (AM_HAL_GPIO_FUNC(5))
+#define AM_HAL_PIN_2_MxWIR3LB     (AM_HAL_GPIO_FUNC(6))
+#define AM_HAL_PIN_2_M2WIR3       (AM_HAL_GPIO_FUNC(7) | AM_HAL_PIN_DIR_3STATE)
+
+#define AM_HAL_PIN_3_UART0RTS     (AM_HAL_GPIO_FUNC(0))
+#define AM_HAL_PIN_3_SLnCE        (AM_HAL_GPIO_FUNC(1) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_3_M1nCE4       (AM_HAL_GPIO_FUNC(2))
+#define AM_HAL_PIN_3_GPIO         (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_3_MxnCELB      (AM_HAL_GPIO_FUNC(4))
+#define AM_HAL_PIN_3_M2nCE0       (AM_HAL_GPIO_FUNC(5))
+#define AM_HAL_PIN_3_TRIG1        (AM_HAL_GPIO_FUNC(6) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_3_I2S_WCLK     (AM_HAL_GPIO_FUNC(7))
+#define AM_HAL_PIN_3_PSOURCE      (AM_HAL_GPIO_FUNC(3) | AM_HAL_PIN_DIR_OUTPUT | AM_HAL_GPIO_POWER)
+
+#define AM_HAL_PIN_4_UART0CTS     (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_4_SLINT        (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_4_M0nCE5       (AM_HAL_GPIO_FUNC(2))
+#define AM_HAL_PIN_4_GPIO         (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_4_SLINTGP      (AM_HAL_GPIO_FUNC(4))
+#define AM_HAL_PIN_4_M2nCE5       (AM_HAL_GPIO_FUNC(5))
+#define AM_HAL_PIN_4_CLKOUT       (AM_HAL_GPIO_FUNC(6))
+#define AM_HAL_PIN_4_32KHZ_XT     (AM_HAL_GPIO_FUNC(7))
+
+#define AM_HAL_PIN_5_M0SCL        (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_5_M0SCK        (AM_HAL_GPIO_FUNC(1) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_5_UART0RTS     (AM_HAL_GPIO_FUNC(2))
+#define AM_HAL_PIN_5_GPIO         (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_5_M0SCKLB      (AM_HAL_GPIO_FUNC(4))
+#define AM_HAL_PIN_5_EXTHFA       (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_5_M0SCLLB      (AM_HAL_GPIO_FUNC(6))
+#define AM_HAL_PIN_5_M1nCE2       (AM_HAL_GPIO_FUNC(7))
+
+#define AM_HAL_PIN_6_M0SDA        (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_6_M0MISO       (AM_HAL_GPIO_FUNC(1) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_6_UART0CTS     (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_6_GPIO         (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_6_SLMISOLB     (AM_HAL_GPIO_FUNC(4))
+#define AM_HAL_PIN_6_M1nCE0       (AM_HAL_GPIO_FUNC(5))
+#define AM_HAL_PIN_6_SLSDALB      (AM_HAL_GPIO_FUNC(6))
+#define AM_HAL_PIN_6_I2S_DAT      (AM_HAL_GPIO_FUNC(7))
+
+#define AM_HAL_PIN_7_M0WIR3       (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_3STATE)
+#define AM_HAL_PIN_7_M0MOSI       (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_7_CLKOUT       (AM_HAL_GPIO_FUNC(2))
+#define AM_HAL_PIN_7_GPIO         (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_7_TRIG0        (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_7_UART0TX      (AM_HAL_GPIO_FUNC(5))
+#define AM_HAL_PIN_7_SLWIR3LB     (AM_HAL_GPIO_FUNC(6))
+#define AM_HAL_PIN_7_M1nCE1       (AM_HAL_GPIO_FUNC(7))
+
+#define AM_HAL_PIN_8_M1SCL        (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_8_M1SCK        (AM_HAL_GPIO_FUNC(1) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_8_M0nCE4       (AM_HAL_GPIO_FUNC(2))
+#define AM_HAL_PIN_8_GPIO         (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_8_M2nCE4       (AM_HAL_GPIO_FUNC(4))
+#define AM_HAL_PIN_8_M1SCKLB      (AM_HAL_GPIO_FUNC(5))
+#define AM_HAL_PIN_8_UART1TX      (AM_HAL_GPIO_FUNC(6))
+#define AM_HAL_PIN_8_M1SCLLB      (AM_HAL_GPIO_FUNC(7))
+
+#define AM_HAL_PIN_9_M1SDA        (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_9_M1MISO       (AM_HAL_GPIO_FUNC(1) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_9_M0nCE5       (AM_HAL_GPIO_FUNC(2))
+#define AM_HAL_PIN_9_GPIO         (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_9_M4nCE5       (AM_HAL_GPIO_FUNC(4))
+#define AM_HAL_PIN_9_SLMISOLB     (AM_HAL_GPIO_FUNC(5))
+#define AM_HAL_PIN_9_UART1RX      (AM_HAL_GPIO_FUNC(6) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_9_SLSDALB      (AM_HAL_GPIO_FUNC(7))
+
+#define AM_HAL_PIN_10_M1WIR3      (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_3STATE)
+#define AM_HAL_PIN_10_M1MOSI      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_10_M0nCE6      (AM_HAL_GPIO_FUNC(2))
+#define AM_HAL_PIN_10_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_10_M2nCE6      (AM_HAL_GPIO_FUNC(4))
+#define AM_HAL_PIN_10_UART1RTS    (AM_HAL_GPIO_FUNC(5))
+#define AM_HAL_PIN_10_M4nCE4      (AM_HAL_GPIO_FUNC(6))
+#define AM_HAL_PIN_10_SLWIR3LB    (AM_HAL_GPIO_FUNC(7))
+
+#define AM_HAL_PIN_11_ADCSE2      (AM_HAL_GPIO_FUNC(0))
+#define AM_HAL_PIN_11_M0nCE0      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_11_CLKOUT      (AM_HAL_GPIO_FUNC(2))
+#define AM_HAL_PIN_11_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_11_M2nCE7      (AM_HAL_GPIO_FUNC(4))
+#define AM_HAL_PIN_11_UART1CTS    (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_11_UART0RX     (AM_HAL_GPIO_FUNC(6) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_11_PDM_DATA    (AM_HAL_GPIO_FUNC(7) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_11_PSINK       (AM_HAL_GPIO_FUNC(3))
+
+#define AM_HAL_PIN_12_ADCD0NSE9   (AM_HAL_GPIO_FUNC(0))
+#define AM_HAL_PIN_12_M1nCE0      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_12_TCTA0       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_12_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_12_CLKOUT      (AM_HAL_GPIO_FUNC(4))
+#define AM_HAL_PIN_12_PDM_CLK     (AM_HAL_GPIO_FUNC(5))
+#define AM_HAL_PIN_12_UART0CTS    (AM_HAL_GPIO_FUNC(6) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_12_UART1TX     (AM_HAL_GPIO_FUNC(7))
+
+#define AM_HAL_PIN_13_ADCD0PSE8   (AM_HAL_GPIO_FUNC(0))
+#define AM_HAL_PIN_13_M1nCE1      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_13_TCTB0       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_13_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_13_M2nCE3      (AM_HAL_GPIO_FUNC(4))
+#define AM_HAL_PIN_13_EXTHFB      (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_13_UART0RTS    (AM_HAL_GPIO_FUNC(6))
+#define AM_HAL_PIN_13_UART1RX     (AM_HAL_GPIO_FUNC(7) | AM_HAL_PIN_DIR_INPUT)
+
+#define AM_HAL_PIN_14_ADCD1P      (AM_HAL_GPIO_FUNC(0))
+#define AM_HAL_PIN_14_M1nCE2      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_14_UART1TX     (AM_HAL_GPIO_FUNC(2))
+#define AM_HAL_PIN_14_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_14_M2nCE1      (AM_HAL_GPIO_FUNC(4))
+#define AM_HAL_PIN_14_EXTHFS      (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_14_SWDCK       (AM_HAL_GPIO_FUNC(6) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_14_32KHZ_XT    (AM_HAL_GPIO_FUNC(7))
+
+#define AM_HAL_PIN_15_ADCD1N      (AM_HAL_GPIO_FUNC(0))
+#define AM_HAL_PIN_15_M1nCE3      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_15_UART1RX     (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_15_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_15_M2nCE2      (AM_HAL_GPIO_FUNC(4))
+#define AM_HAL_PIN_15_EXTXT       (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_15_SWDIO       (AM_HAL_GPIO_FUNC(6) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_15_SWO         (AM_HAL_GPIO_FUNC(7))
+
+#define AM_HAL_PIN_16_ADCSE0      (AM_HAL_GPIO_FUNC(0))
+#define AM_HAL_PIN_16_M0nCE4      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_16_TRIG0       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_16_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_16_M2nCE3      (AM_HAL_GPIO_FUNC(4))
+#define AM_HAL_PIN_16_CMPIN0      (AM_HAL_GPIO_FUNC(5))
+#define AM_HAL_PIN_16_UART0TX     (AM_HAL_GPIO_FUNC(6))
+#define AM_HAL_PIN_16_UART1RTS    (AM_HAL_GPIO_FUNC(7))
+
+#define AM_HAL_PIN_17_CMPRF1      (AM_HAL_GPIO_FUNC(0))
+#define AM_HAL_PIN_17_M0nCE1      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_17_TRIG1       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_17_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_17_M4nCE3      (AM_HAL_GPIO_FUNC(4))
+#define AM_HAL_PIN_17_EXTLF       (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_17_UART0RX     (AM_HAL_GPIO_FUNC(6) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_17_UART1CTS    (AM_HAL_GPIO_FUNC(7) | AM_HAL_PIN_DIR_INPUT)
+
+#define AM_HAL_PIN_18_CMPIN1      (AM_HAL_GPIO_FUNC(0))
+#define AM_HAL_PIN_18_M0nCE2      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_18_TCTA1       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_18_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_18_M4nCE1      (AM_HAL_GPIO_FUNC(4))
+#define AM_HAL_PIN_18_ANATEST2    (AM_HAL_GPIO_FUNC(5))
+#define AM_HAL_PIN_18_UART1TX     (AM_HAL_GPIO_FUNC(6))
+#define AM_HAL_PIN_18_32KHZ_XT    (AM_HAL_GPIO_FUNC(7))
+
+#define AM_HAL_PIN_19_CMPRF0      (AM_HAL_GPIO_FUNC(0))
+#define AM_HAL_PIN_19_M0nCE3      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_19_TCTB1       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_19_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_19_TCTA1       (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_19_ANATEST1    (AM_HAL_GPIO_FUNC(5))
+#define AM_HAL_PIN_19_UART1RX     (AM_HAL_GPIO_FUNC(6) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_19_I2S_BCLK    (AM_HAL_GPIO_FUNC(7))
+
+#define AM_HAL_PIN_20_SWDCK       (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_20_M1nCE5      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_20_TCTA2       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_20_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_20_UART0TX     (AM_HAL_GPIO_FUNC(4))
+#define AM_HAL_PIN_20_UART1TX     (AM_HAL_GPIO_FUNC(5))
+
+#define AM_HAL_PIN_21_SWDIO       (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_21_M1nCE6      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_21_TCTB2       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_21_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_21_UART0RX     (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_21_UART1RX     (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
+
+#define AM_HAL_PIN_22_UART0TX     (AM_HAL_GPIO_FUNC(0))
+#define AM_HAL_PIN_22_M1nCE7      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_22_TCTA3       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_22_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_22_PDM_CLK     (AM_HAL_GPIO_FUNC(4))
+#define AM_HAL_PIN_22_TCTB1       (AM_HAL_GPIO_FUNC(6) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_22_SWO         (AM_HAL_GPIO_FUNC(7))
+#define AM_HAL_PIN_22_PSOURCE     (AM_HAL_GPIO_FUNC(3) | AM_HAL_PIN_DIR_OUTPUT | AM_HAL_GPIO_POWER)
+
+#define AM_HAL_PIN_23_UART0RX     (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_23_M0nCE0      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_23_TCTB3       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_23_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_23_PDM_DATA    (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_23_CMPOUT      (AM_HAL_GPIO_FUNC(5))
+#define AM_HAL_PIN_23_TCTB1       (AM_HAL_GPIO_FUNC(6) | AM_HAL_PIN_DIR_INPUT)
+
+#if defined (AM_PACKAGE_BGA)
+#define AM_HAL_PIN_24_M2nCE1      (AM_HAL_GPIO_FUNC(0))
+#define AM_HAL_PIN_24_M0nCE1      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_24_CLKOUT      (AM_HAL_GPIO_FUNC(2))
+#define AM_HAL_PIN_24_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_24_M5nCE0      (AM_HAL_GPIO_FUNC(4))
+#define AM_HAL_PIN_24_TCTA1       (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_24_I2S_BCLK    (AM_HAL_GPIO_FUNC(6))
+#define AM_HAL_PIN_24_SWO         (AM_HAL_GPIO_FUNC(7))
+#endif // defined (AM_PACKAGE_BGA)
+
+#if defined (AM_PACKAGE_BGA)
+#define AM_HAL_PIN_25_EXTXT       (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_25_M0nCE2      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_25_TCTA0       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_25_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_25_M2SDA       (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_25_M2MISO      (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_25_SLMISOLB    (AM_HAL_GPIO_FUNC(6))
+#define AM_HAL_PIN_25_SLSDALB     (AM_HAL_GPIO_FUNC(7))
+#endif // defined (AM_PACKAGE_BGA)
+
+#define AM_HAL_PIN_26_EXTLF       (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_26_M0nCE3      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_26_TCTB0       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_26_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_26_M2nCE0      (AM_HAL_GPIO_FUNC(4))
+#define AM_HAL_PIN_26_TCTA1       (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_26_M5nCE1      (AM_HAL_GPIO_FUNC(6))
+#define AM_HAL_PIN_26_M3nCE0      (AM_HAL_GPIO_FUNC(7))
+
+#if defined (AM_PACKAGE_BGA)
+#define AM_HAL_PIN_27_EXTHF       (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_27_M1nCE4      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_27_TCTA1       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_27_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_27_M2SCL       (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_27_M2SCK       (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_27_M2SCKLB     (AM_HAL_GPIO_FUNC(6))
+#define AM_HAL_PIN_27_M2SCLLB     (AM_HAL_GPIO_FUNC(7))
+#endif // defined (AM_PACKAGE_BGA)
+
+#define AM_HAL_PIN_28_I2S_WCLK    (AM_HAL_GPIO_FUNC(0))
+#define AM_HAL_PIN_28_M1nCE5      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_28_TCTB1       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_28_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_28_M2WIR3      (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_3STATE)
+#define AM_HAL_PIN_28_M2MOSI      (AM_HAL_GPIO_FUNC(5))
+#define AM_HAL_PIN_28_M5nCE3      (AM_HAL_GPIO_FUNC(6))
+#define AM_HAL_PIN_28_SLWIR3LB    (AM_HAL_GPIO_FUNC(7))
+
+#define AM_HAL_PIN_29_ADCSE1      (AM_HAL_GPIO_FUNC(0))
+#define AM_HAL_PIN_29_M1nCE6      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_29_TCTA2       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_29_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_29_UART0CTS    (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_29_UART1CTS    (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_29_M4nCE0      (AM_HAL_GPIO_FUNC(6))
+#define AM_HAL_PIN_29_PDM_DATA    (AM_HAL_GPIO_FUNC(7) | AM_HAL_PIN_DIR_INPUT)
+
+#if defined (AM_PACKAGE_BGA)
+#define AM_HAL_PIN_30_M1nCE7      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_30_TCTB2       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_30_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_30_UART0TX     (AM_HAL_GPIO_FUNC(4))
+#define AM_HAL_PIN_30_UART1RTS    (AM_HAL_GPIO_FUNC(5))
+#define AM_HAL_PIN_30_SWO         (AM_HAL_GPIO_FUNC(6))
+#define AM_HAL_PIN_30_I2S_DAT     (AM_HAL_GPIO_FUNC(7))
+#endif // defined (AM_PACKAGE_BGA)
+
+#if defined (AM_PACKAGE_BGA)
+#define AM_HAL_PIN_31_ADCSE3      (AM_HAL_GPIO_FUNC(0))
+#define AM_HAL_PIN_31_M0nCE4      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_31_TCTA3       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_31_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_31_UART0RX     (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_31_TCTB1       (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
+#endif // defined (AM_PACKAGE_BGA)
+
+#if defined (AM_PACKAGE_BGA)
+#define AM_HAL_PIN_32_ADCSE4      (AM_HAL_GPIO_FUNC(0))
+#define AM_HAL_PIN_32_M0nCE5      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_32_TCTB3       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_32_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_32_TCTB1       (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
+#endif // defined (AM_PACKAGE_BGA)
+
+#if defined (AM_PACKAGE_BGA)
+#define AM_HAL_PIN_33_ADCSE5      (AM_HAL_GPIO_FUNC(0))
+#define AM_HAL_PIN_33_M0nCE6      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_33_32KHZ_XT    (AM_HAL_GPIO_FUNC(2))
+#define AM_HAL_PIN_33_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_33_M3nCE7      (AM_HAL_GPIO_FUNC(5))
+#define AM_HAL_PIN_33_TCTB1       (AM_HAL_GPIO_FUNC(6) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_33_SWO         (AM_HAL_GPIO_FUNC(7))
+#endif // defined (AM_PACKAGE_BGA)
+
+#if defined (AM_PACKAGE_BGA)
+#define AM_HAL_PIN_34_ADCSE6      (AM_HAL_GPIO_FUNC(0))
+#define AM_HAL_PIN_34_M0nCE7      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_34_M2nCE3      (AM_HAL_GPIO_FUNC(2))
+#define AM_HAL_PIN_34_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_34_CMPRF2      (AM_HAL_GPIO_FUNC(4))
+#define AM_HAL_PIN_34_M3nCE1      (AM_HAL_GPIO_FUNC(5))
+#define AM_HAL_PIN_34_M4nCE0      (AM_HAL_GPIO_FUNC(6))
+#define AM_HAL_PIN_34_M5nCE2      (AM_HAL_GPIO_FUNC(7))
+#endif // defined (AM_PACKAGE_BGA)
+
+#if defined (AM_PACKAGE_BGA)
+#define AM_HAL_PIN_35_ADCSE7      (AM_HAL_GPIO_FUNC(0))
+#define AM_HAL_PIN_35_M1nCE0      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_35_UART1TX     (AM_HAL_GPIO_FUNC(2))
+#define AM_HAL_PIN_35_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_35_M4nCE6      (AM_HAL_GPIO_FUNC(4))
+#define AM_HAL_PIN_35_TCTA1       (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_35_UART0RTS    (AM_HAL_GPIO_FUNC(6))
+#define AM_HAL_PIN_35_M3nCE2      (AM_HAL_GPIO_FUNC(7))
+#endif // defined (AM_PACKAGE_BGA)
+
+#if defined (AM_PACKAGE_BGA)
+#define AM_HAL_PIN_36_TRIG1       (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_36_M1nCE1      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_36_UART1RX     (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_36_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_36_32KHZ_XT    (AM_HAL_GPIO_FUNC(4))
+#define AM_HAL_PIN_36_M2nCE0      (AM_HAL_GPIO_FUNC(5))
+#define AM_HAL_PIN_36_UART0CTS    (AM_HAL_GPIO_FUNC(6) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_36_M3nCE3      (AM_HAL_GPIO_FUNC(7))
+#endif // defined (AM_PACKAGE_BGA)
+
+#if defined (AM_PACKAGE_BGA)
+#define AM_HAL_PIN_37_TRIG2       (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_37_M1nCE2      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_37_UART0RTS    (AM_HAL_GPIO_FUNC(2))
+#define AM_HAL_PIN_37_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_37_M3nCE4      (AM_HAL_GPIO_FUNC(4))
+#define AM_HAL_PIN_37_M4nCE1      (AM_HAL_GPIO_FUNC(5))
+#define AM_HAL_PIN_37_PDM_CLK     (AM_HAL_GPIO_FUNC(6))
+#define AM_HAL_PIN_37_TCTA1       (AM_HAL_GPIO_FUNC(7) | AM_HAL_PIN_DIR_INPUT)
+#endif // defined (AM_PACKAGE_BGA)
+
+#if defined (AM_PACKAGE_BGA)
+#define AM_HAL_PIN_38_TRIG3       (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_38_M1nCE3      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_38_UART0CTS    (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_38_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_38_M3WIR3      (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_3STATE)
+#define AM_HAL_PIN_38_M3MOSI      (AM_HAL_GPIO_FUNC(5))
+#define AM_HAL_PIN_38_M4nCE7      (AM_HAL_GPIO_FUNC(6))
+#define AM_HAL_PIN_38_SLWIR3LB    (AM_HAL_GPIO_FUNC(7))
+#endif // defined (AM_PACKAGE_BGA)
+
+#define AM_HAL_PIN_39_UART0TX     (AM_HAL_GPIO_FUNC(0))
+#define AM_HAL_PIN_39_UART1TX     (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_39_CLKOUT      (AM_HAL_GPIO_FUNC(2))
+#define AM_HAL_PIN_39_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_39_M4SCL       (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_39_M4SCK       (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_39_M4SCKLB     (AM_HAL_GPIO_FUNC(6))
+#define AM_HAL_PIN_39_M4SCLLB     (AM_HAL_GPIO_FUNC(7))
+
+#define AM_HAL_PIN_40_UART0RX     (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_40_UART1RX     (AM_HAL_GPIO_FUNC(1) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_40_TRIG0       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_40_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_40_M4SDA       (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_40_M4MISO      (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_40_SLMISOLB    (AM_HAL_GPIO_FUNC(6))
+#define AM_HAL_PIN_40_SLSDALB     (AM_HAL_GPIO_FUNC(7))
+
+#define AM_HAL_PIN_41_M2nCE1      (AM_HAL_GPIO_FUNC(0))
+#define AM_HAL_PIN_41_CLKOUT      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_41_SWO         (AM_HAL_GPIO_FUNC(2))
+#define AM_HAL_PIN_41_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_41_M3nCE5      (AM_HAL_GPIO_FUNC(4))
+#define AM_HAL_PIN_41_M5nCE7      (AM_HAL_GPIO_FUNC(5))
+#define AM_HAL_PIN_41_M4nCE2      (AM_HAL_GPIO_FUNC(6))
+#define AM_HAL_PIN_41_UART0RTS    (AM_HAL_GPIO_FUNC(7))
+#define AM_HAL_PIN_41_PSOURCE     (AM_HAL_GPIO_FUNC(3) | AM_HAL_PIN_DIR_OUTPUT | AM_HAL_GPIO_POWER)
+
+#if defined (AM_PACKAGE_BGA)
+#define AM_HAL_PIN_42_M2nCE2      (AM_HAL_GPIO_FUNC(0))
+#define AM_HAL_PIN_42_M0nCE0      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_42_TCTA0       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_42_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_42_M3SCL       (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_42_M3SCK       (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_42_M3SCKLB     (AM_HAL_GPIO_FUNC(6))
+#define AM_HAL_PIN_42_M3SCLLB     (AM_HAL_GPIO_FUNC(7))
+#endif // defined (AM_PACKAGE_BGA)
+
+#if defined (AM_PACKAGE_BGA)
+#define AM_HAL_PIN_43_M2nCE4      (AM_HAL_GPIO_FUNC(0))
+#define AM_HAL_PIN_43_M0nCE1      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_43_TCTB0       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_43_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_43_M3SDA       (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_43_M3MISO      (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_43_SLMISOLB    (AM_HAL_GPIO_FUNC(6))
+#define AM_HAL_PIN_43_SLSDALB     (AM_HAL_GPIO_FUNC(7))
+#endif // defined (AM_PACKAGE_BGA)
+
+#define AM_HAL_PIN_44_UART1RTS    (AM_HAL_GPIO_FUNC(0))
+#define AM_HAL_PIN_44_M0nCE2      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_44_TCTA1       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_44_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_44_M4WIR3      (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_3STATE)
+#define AM_HAL_PIN_44_M4MOSI      (AM_HAL_GPIO_FUNC(5))
+#define AM_HAL_PIN_44_M5nCE6      (AM_HAL_GPIO_FUNC(6))
+#define AM_HAL_PIN_44_SLWIR3LB    (AM_HAL_GPIO_FUNC(7))
+
+#if defined (AM_PACKAGE_BGA)
+#define AM_HAL_PIN_45_UART1CTS    (AM_HAL_GPIO_FUNC(0) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_45_M0nCE3      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_45_TCTB1       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_45_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_45_M4nCE3      (AM_HAL_GPIO_FUNC(4))
+#define AM_HAL_PIN_45_M3nCE6      (AM_HAL_GPIO_FUNC(5))
+#define AM_HAL_PIN_45_M5nCE5      (AM_HAL_GPIO_FUNC(6))
+#define AM_HAL_PIN_45_TCTA1       (AM_HAL_GPIO_FUNC(7) | AM_HAL_PIN_DIR_INPUT)
+#endif // defined (AM_PACKAGE_BGA)
+
+#if defined (AM_PACKAGE_BGA)
+#define AM_HAL_PIN_46_32KHZ_XT    (AM_HAL_GPIO_FUNC(0))
+#define AM_HAL_PIN_46_M0nCE4      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_46_TCTA2       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_46_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_46_TCTA1       (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_46_M5nCE4      (AM_HAL_GPIO_FUNC(5))
+#define AM_HAL_PIN_46_M4nCE4      (AM_HAL_GPIO_FUNC(6))
+#define AM_HAL_PIN_46_SWO         (AM_HAL_GPIO_FUNC(7))
+#endif // defined (AM_PACKAGE_BGA)
+
+#define AM_HAL_PIN_47_M2nCE5      (AM_HAL_GPIO_FUNC(0))
+#define AM_HAL_PIN_47_M0nCE5      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_47_TCTB2       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_47_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_47_M5WIR3      (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_3STATE)
+#define AM_HAL_PIN_47_M5MOSI      (AM_HAL_GPIO_FUNC(5))
+#define AM_HAL_PIN_47_M4nCE5      (AM_HAL_GPIO_FUNC(6))
+#define AM_HAL_PIN_47_SLWIR3LB    (AM_HAL_GPIO_FUNC(7))
+
+#define AM_HAL_PIN_48_M2nCE6      (AM_HAL_GPIO_FUNC(0))
+#define AM_HAL_PIN_48_M0nCE6      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_48_TCTA3       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_48_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_48_M5SCL       (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_48_M5SCK       (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_48_M5SCKLB     (AM_HAL_GPIO_FUNC(6))
+#define AM_HAL_PIN_48_M5SCLLB     (AM_HAL_GPIO_FUNC(7))
+
+#define AM_HAL_PIN_49_M2nCE7      (AM_HAL_GPIO_FUNC(0))
+#define AM_HAL_PIN_49_M0nCE7      (AM_HAL_GPIO_FUNC(1))
+#define AM_HAL_PIN_49_TCTB3       (AM_HAL_GPIO_FUNC(2) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_49_GPIO        (AM_HAL_GPIO_FUNC(3))
+#define AM_HAL_PIN_49_M5SDA       (AM_HAL_GPIO_FUNC(4) | AM_HAL_PIN_DIR_OPENDRAIN)
+#define AM_HAL_PIN_49_M5MISO      (AM_HAL_GPIO_FUNC(5) | AM_HAL_PIN_DIR_INPUT)
+#define AM_HAL_PIN_49_SLMISOLB    (AM_HAL_GPIO_FUNC(6))
+#define AM_HAL_PIN_49_SLSDALB     (AM_HAL_GPIO_FUNC(7))
+
+#endif  // AM_HAL_PIN_H
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_pwrctrl.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_pwrctrl.c
new file mode 100644
index 000000000..1481f0ef7
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_pwrctrl.c
@@ -0,0 +1,655 @@
+//*****************************************************************************
+//
+//! @file am_hal_pwrctrl.c
+//!
+//! @brief Functions for enabling and disabling power domains.
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup pwrctrl Power Control
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "am_mcu_apollo.h"
+
+//*****************************************************************************
+//
+//  ONE_BIT - true iff value has exactly 1 bit set.
+//
+//*****************************************************************************
+#define ONE_BIT(ui32Value)   (ui32Value  &&  !(ui32Value & (ui32Value - 1)))
+
+//*****************************************************************************
+//
+//  Determine if Apollo2 A revision.
+//
+//  Note - this function is intended to be temporary until Apollo2 revA chips
+//  are no longer relevant.
+//
+//*****************************************************************************
+static bool
+isRevA(void)
+{
+    return AM_BFM(MCUCTRL, CHIPREV, REVMAJ) == AM_REG_MCUCTRL_CHIPREV_REVMAJ_A ?
+            true : false;
+}
+
+//*****************************************************************************
+//
+//  Determine if this is an Apollo2 revision that requires additional handling
+//  of the BUCK to LDO transition when only the ADC is in use and going to
+//  deepsleep.
+//
+//*****************************************************************************
+static bool
+isRev_ADC(void)
+{
+    return AM_BFM(MCUCTRL, CHIPREV, REVMAJ) == AM_REG_MCUCTRL_CHIPREV_REVMAJ_B ?
+            true : false;
+}
+
+//*****************************************************************************
+//
+//! @brief Enable power for a peripheral.
+//!
+//! @param ui32Peripheral - The peripheral to enable
+//!
+//! This function directly enables or disables power for the chosen peripheral.
+//!
+//! @note Unpowered peripherals may lose their configuration information. This
+//! function does not save or restore peripheral configuration registers.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_pwrctrl_periph_enable(uint32_t ui32Peripheral)
+{
+
+    am_hal_debug_assert_msg(ONE_BIT(ui32Peripheral),
+                        "Cannot enable more than one peripheral at a time.");
+
+    //
+    // Begin critical section.
+    //
+    AM_CRITICAL_BEGIN_ASM
+
+    //
+    // Enable power control for the given device.
+    //
+    AM_REG(PWRCTRL, DEVICEEN) |= ui32Peripheral;
+
+    //
+    // End Critical Section.
+    //
+    AM_CRITICAL_END_ASM
+
+    //
+    // Wait for the power to stablize.  Using a simple delay loop is more
+    // power efficient than a polling loop.
+    //
+    am_hal_flash_delay(AM_HAL_PWRCTRL_DEVICEEN_DELAYCYCLES / 3);
+
+    //
+    // Quick check to guarantee we're good (should never be more than 1 read).
+    //
+    POLL_PWRSTATUS(ui32Peripheral);
+}
+
+//*****************************************************************************
+//
+//! @brief Disable power for a peripheral.
+//!
+//! @param ui32Peripheral - The peripheral to disable
+//!
+//! This function directly disables or disables power for the chosen peripheral.
+//!
+//! @note Unpowered peripherals may lose their configuration information. This
+//! function does not save or restore peripheral configuration registers.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_pwrctrl_periph_disable(uint32_t ui32Peripheral)
+{
+
+    am_hal_debug_assert_msg(ONE_BIT(ui32Peripheral),
+                        "Cannot enable more than one peripheral at a time.");
+
+    //
+    // Begin critical section.
+    //
+    AM_CRITICAL_BEGIN_ASM
+
+    //
+    // Disable power control for the given device.
+    //
+    AM_REG(PWRCTRL, DEVICEEN) &= ~ui32Peripheral;
+
+    //
+    // End critical section.
+    //
+    AM_CRITICAL_END_ASM
+
+    //
+    // Wait for the power to stablize
+    //
+    am_hal_flash_delay(AM_HAL_PWRCTRL_DEVICEDIS_DELAYCYCLES / 3);
+}
+
+//*****************************************************************************
+//
+//! @brief Enable and disable power for memory devices (SRAM, flash, cache).
+//!
+//! @param ui32MemEn - The memory and amount to be enabled.
+//!         Must be one of the following:
+//!         AM_HAL_PWRCTRL_MEMEN_CACHE
+//!         AM_HAL_PWRCTRL_MEMEN_CACHE_DIS
+//!         AM_HAL_PWRCTRL_MEMEN_FLASH512K
+//!         AM_HAL_PWRCTRL_MEMEN_FLASH1M
+//!         AM_HAL_PWRCTRL_MEMEN_SRAM8K
+//!         AM_HAL_PWRCTRL_MEMEN_SRAM16K
+//!         AM_HAL_PWRCTRL_MEMEN_SRAM24K
+//!         AM_HAL_PWRCTRL_MEMEN_SRAM32K
+//!         AM_HAL_PWRCTRL_MEMEN_SRAM64K
+//!         AM_HAL_PWRCTRL_MEMEN_SRAM96K
+//!         AM_HAL_PWRCTRL_MEMEN_SRAM128K
+//!         AM_HAL_PWRCTRL_MEMEN_SRAM160K
+//!         AM_HAL_PWRCTRL_MEMEN_SRAM192K
+//!         AM_HAL_PWRCTRL_MEMEN_SRAM224K
+//!         AM_HAL_PWRCTRL_MEMEN_SRAM256K
+//!         AM_HAL_PWRCTRL_MEMEN_ALL (the default, power-up state)
+//!
+//! This function enables/disables power to provide only the given amount of
+//! the type of memory specified.
+//!
+//! Only the type of memory specified is affected. Therefore separate calls
+//! are required to affect power settings for FLASH, SRAM, or CACHE.
+//!
+//! Settings for zero SRAM or FLASH are not provided as device behavior under
+//! either of those conditions is undefined.
+//!
+//! @note Unpowered memory devices may lose their configuration information.
+//! This function does not save or restore peripheral configuration registers.
+//!
+//! @return None.
+//
+//*****************************************************************************
+bool
+am_hal_pwrctrl_memory_enable(uint32_t ui32MemEn)
+{
+    uint32_t ui32MemEnMask, ui32MemDisMask;
+    uint32_t ui32PwrStatEnMask, ui32PwrStatDisMask;
+    int32_t i32TOcnt;
+
+    if ( ui32MemEn == AM_HAL_PWRCTRL_MEMEN_FLASH512K )
+    {
+        ui32MemEnMask  = AM_REG_PWRCTRL_MEMEN_FLASH0_EN;
+        ui32MemDisMask = AM_REG_PWRCTRL_MEMEN_FLASH1_EN;
+        ui32PwrStatEnMask  = AM_REG_PWRCTRL_PWRONSTATUS_PD_FLAM0_M;
+        ui32PwrStatDisMask = AM_REG_PWRCTRL_PWRONSTATUS_PD_FLAM1_M;
+    }
+    else if ( ui32MemEn == AM_HAL_PWRCTRL_MEMEN_FLASH1M )
+    {
+        ui32MemEnMask  = AM_REG_PWRCTRL_MEMEN_FLASH0_EN |
+                         AM_REG_PWRCTRL_MEMEN_FLASH1_EN;
+        ui32MemDisMask = 0;
+        ui32PwrStatEnMask  = AM_REG_PWRCTRL_PWRONSTATUS_PD_FLAM0_M  |
+                             AM_REG_PWRCTRL_PWRONSTATUS_PD_FLAM1_M;
+        ui32PwrStatDisMask = 0;
+    }
+    else if ( ui32MemEn == AM_HAL_PWRCTRL_MEMEN_SRAM8K )
+    {
+        ui32MemEnMask  = AM_REG_PWRCTRL_MEMEN_SRAMEN_SRAM8K;
+        ui32MemDisMask = AM_REG_PWRCTRL_MEMEN_SRAMEN_ALL    &
+                         ~AM_REG_PWRCTRL_MEMEN_SRAMEN_SRAM8K;
+        ui32PwrStatEnMask  = AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_8K;
+        ui32PwrStatDisMask = AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_ALL    &
+                             ~AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_8K;
+    }
+    else if ( ui32MemEn == AM_HAL_PWRCTRL_MEMEN_SRAM16K )
+    {
+        ui32MemEnMask  = AM_REG_PWRCTRL_MEMEN_SRAMEN_SRAM16K;
+        ui32MemDisMask = AM_REG_PWRCTRL_MEMEN_SRAMEN_ALL    &
+                         ~AM_REG_PWRCTRL_MEMEN_SRAMEN_SRAM16K;
+        ui32PwrStatEnMask  = AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_16K;
+        ui32PwrStatDisMask = AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_ALL    &
+                             ~AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_16K;
+    }
+    else if ( ui32MemEn == AM_HAL_PWRCTRL_MEMEN_SRAM24K )
+    {
+        ui32MemEnMask  = AM_REG_PWRCTRL_MEMEN_SRAMEN_GROUP0_SRAM0       |
+                         AM_REG_PWRCTRL_MEMEN_SRAMEN_GROUP0_SRAM1       |
+                         AM_REG_PWRCTRL_MEMEN_SRAMEN_GROUP0_SRAM2;
+        ui32MemDisMask = AM_REG_PWRCTRL_MEMEN_SRAMEN_ALL    &
+                         ~(AM_REG_PWRCTRL_MEMEN_SRAMEN_GROUP0_SRAM0     |
+                           AM_REG_PWRCTRL_MEMEN_SRAMEN_GROUP0_SRAM1     |
+                           AM_REG_PWRCTRL_MEMEN_SRAMEN_GROUP0_SRAM2);
+        ui32PwrStatEnMask  = AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_24K;
+        ui32PwrStatDisMask = AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_ALL    &
+                             ~AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_24K;
+    }
+    else if ( ui32MemEn == AM_HAL_PWRCTRL_MEMEN_SRAM32K )
+    {
+        ui32MemEnMask  = AM_REG_PWRCTRL_MEMEN_SRAMEN_SRAM32K;
+        ui32MemDisMask = AM_REG_PWRCTRL_MEMEN_SRAMEN_ALL    &
+                         ~AM_REG_PWRCTRL_MEMEN_SRAMEN_SRAM32K;
+        ui32PwrStatEnMask  = AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_32K;
+        ui32PwrStatDisMask = AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_ALL    &
+                             ~AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_32K;
+    }
+    else if ( ui32MemEn == AM_HAL_PWRCTRL_MEMEN_SRAM64K )
+    {
+        ui32MemEnMask  = AM_REG_PWRCTRL_MEMEN_SRAMEN_SRAM64K;
+        ui32MemDisMask = AM_REG_PWRCTRL_MEMEN_SRAMEN_ALL    &
+                         ~AM_REG_PWRCTRL_MEMEN_SRAMEN_SRAM64K;
+        ui32PwrStatEnMask  = AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_64K;
+        ui32PwrStatDisMask = AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_ALL    &
+                             ~AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_64K;
+    }
+    else if ( ui32MemEn == AM_HAL_PWRCTRL_MEMEN_SRAM96K )
+    {
+        ui32MemEnMask  = AM_HAL_PWRCTRL_MEMEN_SRAM96K;
+        ui32MemDisMask = AM_REG_PWRCTRL_MEMEN_SRAMEN_ALL    &
+                         ~AM_HAL_PWRCTRL_MEMEN_SRAM96K;
+        ui32PwrStatEnMask  = AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_96K;
+        ui32PwrStatDisMask = AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_ALL    &
+                             ~AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_96K;
+    }
+    else if ( ui32MemEn == AM_HAL_PWRCTRL_MEMEN_SRAM128K )
+    {
+        ui32MemEnMask  = AM_REG_PWRCTRL_MEMEN_SRAMEN_SRAM128K;
+        ui32MemDisMask = AM_REG_PWRCTRL_MEMEN_SRAMEN_ALL    &
+                         ~AM_REG_PWRCTRL_MEMEN_SRAMEN_SRAM128K;
+        ui32PwrStatEnMask  = AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_128K;
+        ui32PwrStatDisMask = AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_ALL    &
+                             ~AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_128K;
+    }
+    else if ( ui32MemEn == AM_HAL_PWRCTRL_MEMEN_SRAM160K )
+    {
+        ui32MemEnMask  = AM_HAL_PWRCTRL_MEMEN_SRAM160K;
+        ui32MemDisMask = AM_REG_PWRCTRL_MEMEN_SRAMEN_ALL    &
+                         ~AM_HAL_PWRCTRL_MEMEN_SRAM160K;
+        ui32PwrStatEnMask  = AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_160K;
+        ui32PwrStatDisMask = AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_ALL    &
+                             ~AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_160K;
+    }
+    else if ( ui32MemEn == AM_HAL_PWRCTRL_MEMEN_SRAM192K )
+    {
+        ui32MemEnMask  = AM_HAL_PWRCTRL_MEMEN_SRAM192K;
+        ui32MemDisMask = AM_REG_PWRCTRL_MEMEN_SRAMEN_ALL    &
+                         ~AM_HAL_PWRCTRL_MEMEN_SRAM192K;
+        ui32PwrStatEnMask  = AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_192K;
+        ui32PwrStatDisMask = AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_ALL    &
+                             ~AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_192K;
+    }
+    else if ( ui32MemEn == AM_HAL_PWRCTRL_MEMEN_SRAM224K )
+    {
+        ui32MemEnMask  = AM_HAL_PWRCTRL_MEMEN_SRAM224K;
+        ui32MemDisMask = AM_REG_PWRCTRL_MEMEN_SRAMEN_ALL    &
+                         ~AM_HAL_PWRCTRL_MEMEN_SRAM224K;
+        ui32PwrStatEnMask  = AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_224K;
+        ui32PwrStatDisMask = AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_ALL    &
+                             ~AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_224K;
+    }
+    else if ( ui32MemEn == AM_HAL_PWRCTRL_MEMEN_SRAM256K )
+    {
+        ui32MemEnMask  = AM_REG_PWRCTRL_MEMEN_SRAMEN_SRAM256K;
+        ui32MemDisMask = AM_REG_PWRCTRL_MEMEN_SRAMEN_ALL    &
+                         ~AM_REG_PWRCTRL_MEMEN_SRAMEN_SRAM256K;
+        ui32PwrStatEnMask  = AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_256K;
+        ui32PwrStatDisMask = AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_ALL    &
+                             ~AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_256K;
+    }
+    else if ( ui32MemEn == AM_HAL_PWRCTRL_MEMEN_CACHE )
+    {
+        ui32MemEnMask  = AM_REG_PWRCTRL_MEMEN_CACHEB0_EN    |
+                         AM_REG_PWRCTRL_MEMEN_CACHEB2_EN;
+        ui32MemDisMask = 0;
+        ui32PwrStatEnMask  = AM_REG_PWRCTRL_PWRONSTATUS_PD_CACHEB2_M    |
+                             AM_REG_PWRCTRL_PWRONSTATUS_PD_CACHEB0_M;
+        ui32PwrStatDisMask = 0;
+    }
+    else if ( ui32MemEn == AM_HAL_PWRCTRL_MEMEN_CACHE_DIS )
+    {
+        ui32MemEnMask = 0;
+        ui32MemDisMask  = AM_REG_PWRCTRL_MEMEN_CACHEB0_EN   |
+                          AM_REG_PWRCTRL_MEMEN_CACHEB2_EN;
+        ui32PwrStatEnMask  = 0;
+        ui32PwrStatDisMask = AM_REG_PWRCTRL_PWRONSTATUS_PD_CACHEB2_M    |
+                             AM_REG_PWRCTRL_PWRONSTATUS_PD_CACHEB0_M;
+    }
+    else if ( ui32MemEn == AM_HAL_PWRCTRL_MEMEN_ALL )
+    {
+        ui32MemEnMask  = AM_HAL_PWRCTRL_MEMEN_ALL;
+        ui32MemDisMask = 0;
+        ui32PwrStatEnMask  = AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_ALL;
+        ui32PwrStatDisMask = 0;
+    }
+    else
+    {
+        return false;
+    }
+
+    //
+    // Disable unneeded memory. If nothing to be disabled, skip to save time.
+    //
+    // Note that a deliberate disable step using a disable mask is taken here
+    // for 2 reasons: 1) To only affect the specified type of memory, and 2)
+    // To avoid inadvertently disabling any memory currently being depended on.
+    //
+    if ( ui32MemDisMask != 0 )
+    {
+        AM_REG(PWRCTRL, MEMEN) &= ~ui32MemDisMask;
+    }
+
+    //
+    // Enable the required memory.
+    //
+    if ( ui32MemEnMask != 0 )
+    {
+        AM_REG(PWRCTRL, MEMEN) |= ui32MemEnMask;
+    }
+
+    //
+    // Wait for the power to be turned on.
+    // Apollo2 note - these loops typically end up taking 1 iteration.
+    //
+    i32TOcnt = 200;
+    if ( ui32PwrStatDisMask )
+    {
+        while ( --i32TOcnt              &&
+                ( AM_REG(PWRCTRL, PWRONSTATUS) & ui32PwrStatDisMask ) );
+    }
+
+    if ( i32TOcnt <= 0 )
+    {
+        return false;
+    }
+
+    i32TOcnt = 200;
+    if ( ui32PwrStatEnMask )
+    {
+        while ( --i32TOcnt              &&
+            (( AM_REG(PWRCTRL, PWRONSTATUS) & ui32PwrStatEnMask )
+                != ui32PwrStatEnMask) );
+    }
+    if ( i32TOcnt <= 0 )
+    {
+        return false;
+    }
+
+    return true;
+}
+
+//*****************************************************************************
+//
+//! @brief Intialize the core and memory buck converters.
+//!
+//! This function is intended to be used for first time core and memory buck
+//! converters initialization.
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_pwrctrl_bucks_init(void)
+{
+    am_hal_pwrctrl_bucks_enable();
+
+    while ( ( AM_REG(PWRCTRL, POWERSTATUS) &
+              ( AM_REG_PWRCTRL_POWERSTATUS_COREBUCKON_M |
+                AM_REG_PWRCTRL_POWERSTATUS_MEMBUCKON_M ) )  !=
+              ( AM_REG_PWRCTRL_POWERSTATUS_COREBUCKON_M |
+                AM_REG_PWRCTRL_POWERSTATUS_MEMBUCKON_M ) );
+
+    //
+    // Additional delay to make sure BUCKs are initialized.
+    //
+    am_hal_flash_delay(200 / 3);
+}
+
+//*****************************************************************************
+//
+//! @brief Enable the core and memory buck converters.
+//!
+//! This function enables the core and memory buck converters.
+//!
+//! @return None
+//
+//*****************************************************************************
+#define LDO_TRIM_REG_ADDR   (0x50023004)
+#define BUCK_TRIM_REG_ADDR  (0x50023000)
+
+void
+am_hal_pwrctrl_bucks_enable(void)
+{
+    uint32_t corebuck_trim, membuck_trim, mcuctrl_ldoreg1, mcuctrl_ldoreg3;
+
+    //
+    // Check to see if the bucks are already on. If so, we can just return.
+    //
+    if ( AM_BFR(PWRCTRL, POWERSTATUS, COREBUCKON)   &&
+         AM_BFR(PWRCTRL, POWERSTATUS, MEMBUCKON) )
+    {
+        return;
+    }
+
+    if ( isRevA() )
+    {
+        //
+        // 1) Override the buck pwd. This forces the buck to power up.
+        //
+        AM_REG(MCUCTRL, BUCK) = (AM_BFV(MCUCTRL, BUCK, MEMBUCKRST,  1) |
+                                 AM_BFV(MCUCTRL, BUCK, MEMBUCKPWD,  0) |
+                                 AM_BFV(MCUCTRL, BUCK, COREBUCKRST, 1) |
+                                 AM_BFV(MCUCTRL, BUCK, COREBUCKPWD, 0) |
+                                 AM_BFV(MCUCTRL, BUCK, BUCKSWE, 1));
+    }
+
+    //
+    // Enable BUCK power up
+    //
+    AM_BFW(PWRCTRL, SUPPLYSRC, COREBUCKEN, 1);
+    AM_BFW(PWRCTRL, SUPPLYSRC, MEMBUCKEN, 1);
+
+    //
+    // Wait until BUCKs are enabled.
+    //
+    while ( ( AM_REG(PWRCTRL, POWERSTATUS)                      &
+              ( AM_REG_PWRCTRL_POWERSTATUS_COREBUCKON_M |
+                AM_REG_PWRCTRL_POWERSTATUS_MEMBUCKON_M ) )  !=
+              ( AM_REG_PWRCTRL_POWERSTATUS_COREBUCKON_M |
+                AM_REG_PWRCTRL_POWERSTATUS_MEMBUCKON_M ) ) {};
+
+    if ( isRevA() )
+    {
+        //
+        // 4) Get the trims that need to be programmed for buck
+        //
+        corebuck_trim = AM_REGVAL(BUCK_TRIM_REG_ADDR) & 0x00003FF;
+        membuck_trim  = (AM_REGVAL(BUCK_TRIM_REG_ADDR) & 0x03FF0000) >> 16;
+
+        mcuctrl_ldoreg1 = (AM_REG(MCUCTRL, LDOREG1) & ~AM_REG_MCUCTRL_LDOREG1_TRIMCORELDOR1_M) | (corebuck_trim <<
+                                          AM_REG_MCUCTRL_LDOREG1_TRIMCORELDOR1_S);
+        mcuctrl_ldoreg3 = (AM_REG(MCUCTRL, LDOREG3) & ~AM_REG_MCUCTRL_LDOREG3_TRIMMEMLDOR1_M)  | (membuck_trim <<
+                                          AM_REG_MCUCTRL_LDOREG3_TRIMMEMLDOR1_S);
+
+        //
+        // 5) Remove the sw overrides
+        //
+        AM_BFW(MCUCTRL, BUCK, BUCKSWE, 0);
+
+        //
+        // 6) Program the trims
+        //
+        AM_REG(MCUCTRL, LDOREG1) = mcuctrl_ldoreg1;
+        AM_REG(MCUCTRL, LDOREG3) = mcuctrl_ldoreg3;
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Disable the core and memory buck converters.
+//!
+//! This function disables the core and memory buck converters.
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_pwrctrl_bucks_disable(void)
+{
+    //
+    // Check to see if the bucks are already off. If so, we can just return.
+    //
+    if ( AM_BFR(PWRCTRL, POWERSTATUS, COREBUCKON) == 0  &&
+         AM_BFR(PWRCTRL, POWERSTATUS, MEMBUCKON) == 0)
+    {
+        return;
+    }
+
+    if ( isRev_ADC()  &&
+         (AM_REG(PWRCTRL, DEVICEEN) == AM_REG_PWRCTRL_DEVICEEN_ADC_EN) )
+    {
+            //
+            // Set SUPPLYSRC to handle this case
+            //
+            AM_REG(PWRCTRL, SUPPLYSRC) &=
+                (AM_REG_PWRCTRL_SUPPLYSRC_SWITCH_LDO_IN_SLEEP_EN    |
+                 AM_REG_PWRCTRL_SUPPLYSRC_MEMBUCKEN_EN);
+    }
+    else if ( isRevA() )
+    {
+        uint32_t coreldo_trim, memldo_trim, mcuctrl_ldoreg1, mcuctrl_ldoreg3;
+
+        //
+        // Sequence for BUCK to LDO
+        // 1) get the trims needed for transition
+        //
+        coreldo_trim = AM_REGVAL(LDO_TRIM_REG_ADDR) & 0x000003FF;
+        memldo_trim  = (AM_REGVAL(LDO_TRIM_REG_ADDR) & 0x03FF0000) >> 16;
+
+        mcuctrl_ldoreg1 = (AM_REG(MCUCTRL, LDOREG1) & ~AM_REG_MCUCTRL_LDOREG1_TRIMCORELDOR1_M) | (coreldo_trim << AM_REG_MCUCTRL_LDOREG1_TRIMCORELDOR1_S);
+        mcuctrl_ldoreg3 = (AM_REG(MCUCTRL, LDOREG3) & ~AM_REG_MCUCTRL_LDOREG3_TRIMMEMLDOR1_M)  | (memldo_trim << AM_REG_MCUCTRL_LDOREG3_TRIMMEMLDOR1_S);
+
+        if ( AM_BFR(PWRCTRL, POWERSTATUS, COREBUCKON) )
+        {
+            //
+            // 2) Disable buck
+            //
+            AM_BFW(PWRCTRL, SUPPLYSRC, COREBUCKEN, 0);
+
+            //
+            // 3) Program the LDO trims
+            //
+            AM_REG(MCUCTRL, LDOREG1) = mcuctrl_ldoreg1;
+        }
+
+        if (AM_BFR(PWRCTRL, POWERSTATUS, MEMBUCKON))
+        {
+            //
+            // 4) Disable buck
+            //
+            AM_BFW(PWRCTRL, SUPPLYSRC, MEMBUCKEN, 0);
+
+            //
+            // 5) Program the LDO trims
+            //
+            AM_REG(MCUCTRL, LDOREG3) = mcuctrl_ldoreg3;
+        }
+
+        //
+        // Power them down
+        //
+        AM_BFW(PWRCTRL, SUPPLYSRC, COREBUCKEN, 0);
+        AM_BFW(PWRCTRL, SUPPLYSRC, MEMBUCKEN, 0);
+    }
+    else
+    {
+        //
+        // Power them down
+        //
+        AM_BFW(PWRCTRL, SUPPLYSRC, COREBUCKEN, 0);
+        AM_BFW(PWRCTRL, SUPPLYSRC, MEMBUCKEN, 0);
+    }
+
+    //
+    // Wait until BUCKs are disabled.
+    //
+    am_hal_flash_delay(AM_HAL_PWRCTRL_BUCKDIS_DELAYCYCLES / 3);
+}
+
+//*****************************************************************************
+//
+//! @brief Misc low power initializations.
+//!
+//! This function performs low power initializations that aren't specifically
+//! handled elsewhere.
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_pwrctrl_low_power_init(void)
+{
+    //
+    // For lowest power, we enable clock gating for all SRAM configuration.
+    //
+    AM_REG(PWRCTRL, SRAMCTRL) |=
+        AM_REG_PWRCTRL_SRAMCTRL_SRAM_MASTER_CLKGATE_EN  |
+        AM_REG_PWRCTRL_SRAMCTRL_SRAM_CLKGATE_EN         |
+        AM_REG_PWRCTRL_SRAMCTRL_SRAM_LIGHT_SLEEP_DIS;
+
+    //
+    // For lowest deep sleep power, make sure we stay in BUCK mode.
+    //
+    AM_REG(PWRCTRL, SUPPLYSRC) &=
+        ~AM_REG_PWRCTRL_SUPPLYSRC_SWITCH_LDO_IN_SLEEP_M;
+}
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_pwrctrl.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_pwrctrl.h
new file mode 100644
index 000000000..5cd50985b
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_pwrctrl.h
@@ -0,0 +1,342 @@
+//*****************************************************************************
+//
+//! @file am_hal_pwrctrl.h
+//!
+//! @brief Functions for enabling and disabling power domains.
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup pwrctrl Power Control
+//! @ingroup hal
+//! @{
+
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#ifndef AM_HAL_PWRCTRL_H
+#define AM_HAL_PWRCTRL_H
+
+//*****************************************************************************
+//
+// Peripheral enable bits for am_hal_pwrctrl_periph_enable/disable()
+//
+//*****************************************************************************
+#define AM_HAL_PWRCTRL_ADC      AM_REG_PWRCTRL_DEVICEEN_ADC_EN
+#define AM_HAL_PWRCTRL_IOM0     AM_REG_PWRCTRL_DEVICEEN_IO_MASTER0_EN
+#define AM_HAL_PWRCTRL_IOM1     AM_REG_PWRCTRL_DEVICEEN_IO_MASTER1_EN
+#define AM_HAL_PWRCTRL_IOM2     AM_REG_PWRCTRL_DEVICEEN_IO_MASTER2_EN
+#define AM_HAL_PWRCTRL_IOM3     AM_REG_PWRCTRL_DEVICEEN_IO_MASTER3_EN
+#define AM_HAL_PWRCTRL_IOM4     AM_REG_PWRCTRL_DEVICEEN_IO_MASTER4_EN
+#define AM_HAL_PWRCTRL_IOM5     AM_REG_PWRCTRL_DEVICEEN_IO_MASTER5_EN
+#define AM_HAL_PWRCTRL_IOS      AM_REG_PWRCTRL_DEVICEEN_IO_SLAVE_EN
+#define AM_HAL_PWRCTRL_PDM      AM_REG_PWRCTRL_DEVICEEN_PDM_EN
+#define AM_HAL_PWRCTRL_UART0    AM_REG_PWRCTRL_DEVICEEN_UART0_EN
+#define AM_HAL_PWRCTRL_UART1    AM_REG_PWRCTRL_DEVICEEN_UART1_EN
+
+//*****************************************************************************
+//
+// Macro to set the appropriate IOM peripheral when using
+//  am_hal_pwrctrl_periph_enable()/disable().
+// For Apollo2, the module argument must resolve to be a value from 0-5.
+//
+//*****************************************************************************
+#define AM_HAL_PWRCTRL_IOM(module)                      \
+    (AM_REG_PWRCTRL_DEVICEEN_IO_MASTER0_EN << module)
+
+//*****************************************************************************
+//
+// Macro to set the appropriate UART peripheral when using
+//  am_hal_pwrctrl_periph_enable()/disable().
+// For Apollo2, the module argument must resolve to be a value from 0-1.
+//
+//*****************************************************************************
+#define AM_HAL_PWRCTRL_UART(module)                     \
+    (AM_REG_PWRCTRL_DEVICEEN_UART0_EN << module)
+
+
+//*****************************************************************************
+//
+// Memory enable values for am_hal_pwrctrl_memory_enable()
+//
+//*****************************************************************************
+#define AM_HAL_PWRCTRL_MEMEN_SRAM8K     AM_REG_PWRCTRL_MEMEN_SRAMEN_SRAM8K
+#define AM_HAL_PWRCTRL_MEMEN_SRAM16K    AM_REG_PWRCTRL_MEMEN_SRAMEN_SRAM16K
+#define AM_HAL_PWRCTRL_MEMEN_SRAM24K   (AM_REG_PWRCTRL_MEMEN_SRAMEN_SRAM16K | \
+                                        AM_REG_PWRCTRL_MEMEN_SRAMEN_GROUP0_SRAM2)
+#define AM_HAL_PWRCTRL_MEMEN_SRAM32K    AM_REG_PWRCTRL_MEMEN_SRAMEN_SRAM32K
+#define AM_HAL_PWRCTRL_MEMEN_SRAM64K    AM_REG_PWRCTRL_MEMEN_SRAMEN_SRAM64K
+#define AM_HAL_PWRCTRL_MEMEN_SRAM96K                    \
+            (AM_REG_PWRCTRL_MEMEN_SRAMEN_SRAM64K    |   \
+             AM_REG_PWRCTRL_MEMEN_SRAMEN_GROUP2)
+#define AM_HAL_PWRCTRL_MEMEN_SRAM128K   AM_REG_PWRCTRL_MEMEN_SRAMEN_SRAM128K
+#define AM_HAL_PWRCTRL_MEMEN_SRAM160K                   \
+            (AM_REG_PWRCTRL_MEMEN_SRAMEN_SRAM128K   |   \
+             AM_REG_PWRCTRL_MEMEN_SRAMEN_GROUP4)
+#define AM_HAL_PWRCTRL_MEMEN_SRAM192K                   \
+            (AM_REG_PWRCTRL_MEMEN_SRAMEN_SRAM128K   |   \
+             AM_REG_PWRCTRL_MEMEN_SRAMEN_GROUP4     |   \
+             AM_REG_PWRCTRL_MEMEN_SRAMEN_GROUP5)
+#define AM_HAL_PWRCTRL_MEMEN_SRAM224K                   \
+            (AM_REG_PWRCTRL_MEMEN_SRAMEN_SRAM128K   |   \
+             AM_REG_PWRCTRL_MEMEN_SRAMEN_GROUP4     |   \
+             AM_REG_PWRCTRL_MEMEN_SRAMEN_GROUP5     |   \
+             AM_REG_PWRCTRL_MEMEN_SRAMEN_GROUP6)
+#define AM_HAL_PWRCTRL_MEMEN_SRAM256K   AM_REG_PWRCTRL_MEMEN_SRAMEN_SRAM256K
+
+#define AM_HAL_PWRCTRL_MEMEN_FLASH512K  AM_REG_PWRCTRL_MEMEN_FLASH0_EN
+#define AM_HAL_PWRCTRL_MEMEN_FLASH1M                \
+            (AM_REG_PWRCTRL_MEMEN_FLASH0_EN     |   \
+             AM_REG_PWRCTRL_MEMEN_FLASH1_EN)
+#define AM_HAL_PWRCTRL_MEMEN_CACHE                  \
+            (AM_REG_PWRCTRL_MEMEN_CACHEB0_EN    |   \
+             AM_REG_PWRCTRL_MEMEN_CACHEB2_EN)
+#define AM_HAL_PWRCTRL_MEMEN_CACHE_DIS              \
+            ~(AM_REG_PWRCTRL_MEMEN_CACHEB0_EN   |   \
+              AM_REG_PWRCTRL_MEMEN_CACHEB2_EN)
+
+//
+// Power up all available memory devices (this is the default power up state)
+//
+#define AM_HAL_PWRCTRL_MEMEN_ALL                    \
+            (AM_REG_PWRCTRL_MEMEN_SRAMEN_ALL    |   \
+             AM_REG_PWRCTRL_MEMEN_FLASH0_EN     |   \
+             AM_REG_PWRCTRL_MEMEN_FLASH1_EN     |   \
+             AM_REG_PWRCTRL_MEMEN_CACHEB0_EN    |   \
+             AM_REG_PWRCTRL_MEMEN_CACHEB2_EN)
+
+//*****************************************************************************
+//
+// Peripheral power enable and disable delays
+// The delay counts are based on an internal clock that runs at half of
+// HFRC. Therefore, we need to double the delay cycles.
+//
+//*****************************************************************************
+#define AM_HAL_PWRCTRL_DEVICEEN_DELAYCYCLES     (22 * 2)
+#define AM_HAL_PWRCTRL_DEVICEDIS_DELAYCYCLES    (22 * 2)
+
+//
+// Use the following only when enabling after sleep (not during initialization).
+//
+#define AM_HAL_PWRCTRL_BUCKEN_DELAYCYCLES       (0 * 2)
+#define AM_HAL_PWRCTRL_BUCKDIS_DELAYCYCLES      (15 * 2)
+
+//*****************************************************************************
+//
+// Peripheral PWRONSTATUS groupings.
+//
+//*****************************************************************************
+//
+// Group DEVICEEN bits (per PWRONSTATUS groupings).
+//
+#define AM_HAL_PWRCTRL_DEVICEEN_IOM_0_2                     \
+            (AM_REG_PWRCTRL_DEVICEEN_IO_MASTER0_EN      |   \
+             AM_REG_PWRCTRL_DEVICEEN_IO_MASTER1_EN      |   \
+             AM_REG_PWRCTRL_DEVICEEN_IO_MASTER2_EN )
+
+#define AM_HAL_PWRCTRL_DEVICEEN_IOM_3_5                     \
+            (AM_REG_PWRCTRL_DEVICEEN_IO_MASTER3_EN      |   \
+             AM_REG_PWRCTRL_DEVICEEN_IO_MASTER4_EN      |   \
+             AM_REG_PWRCTRL_DEVICEEN_IO_MASTER5_EN )
+
+#define AM_HAL_PWRCTRL_DEVICEEN_IOS_UARTS                   \
+            (AM_REG_PWRCTRL_DEVICEEN_UART0_EN           |   \
+             AM_REG_PWRCTRL_DEVICEEN_UART1_EN           |   \
+             AM_REG_PWRCTRL_DEVICEEN_IO_SLAVE_EN )
+
+#define AM_HAL_PWRCTRL_DEVICEEN_ADC             AM_REG_PWRCTRL_DEVICEEN_ADC_EN
+#define AM_HAL_PWRCTRL_DEVICEEN_PDM             AM_REG_PWRCTRL_DEVICEEN_PDM_EN
+
+//
+// Map PWRONSTATUS bits to peripheral groupings.
+//
+#define AM_HAL_PWRCTRL_PWRONSTATUS_IOS_UARTS    AM_REG_PWRCTRL_PWRONSTATUS_PDA_M
+#define AM_HAL_PWRCTRL_PWRONSTATUS_IOM_3_5      AM_REG_PWRCTRL_PWRONSTATUS_PDC_M
+#define AM_HAL_PWRCTRL_PWRONSTATUS_IOM_0_2      AM_REG_PWRCTRL_PWRONSTATUS_PDB_M
+#define AM_HAL_PWRCTRL_PWRONSTATUS_ADC          AM_REG_PWRCTRL_PWRONSTATUS_PDADC_M
+#define AM_HAL_PWRCTRL_PWRONSTATUS_PDM          AM_REG_PWRCTRL_PWRONSTATUS_PD_PDM_M
+
+#define POLL_PWRSTATUS(ui32Peripheral)                                  \
+    if ( 1 )                                                            \
+    {                                                                   \
+        uint32_t ui32PwrOnStat;                                         \
+        if ( ui32Peripheral & AM_HAL_PWRCTRL_DEVICEEN_IOM_0_2 )         \
+        {                                                               \
+            ui32PwrOnStat = AM_HAL_PWRCTRL_PWRONSTATUS_IOM_0_2;         \
+        }                                                               \
+        else if ( ui32Peripheral & AM_HAL_PWRCTRL_DEVICEEN_IOM_3_5 )    \
+        {                                                               \
+            ui32PwrOnStat = AM_HAL_PWRCTRL_PWRONSTATUS_IOM_3_5;         \
+        }                                                               \
+        else if ( ui32Peripheral & AM_HAL_PWRCTRL_DEVICEEN_IOS_UARTS )  \
+        {                                                               \
+            ui32PwrOnStat = AM_HAL_PWRCTRL_PWRONSTATUS_IOS_UARTS;       \
+        }                                                               \
+        else if ( ui32Peripheral & AM_HAL_PWRCTRL_DEVICEEN_ADC )        \
+        {                                                               \
+            ui32PwrOnStat = AM_HAL_PWRCTRL_PWRONSTATUS_ADC;             \
+        }                                                               \
+        else if ( ui32Peripheral & AM_HAL_PWRCTRL_DEVICEEN_PDM )        \
+        {                                                               \
+            ui32PwrOnStat = AM_HAL_PWRCTRL_PWRONSTATUS_PDM;             \
+        }                                                               \
+        else                                                            \
+        {                                                               \
+            ui32PwrOnStat = 0xFFFFFFFF;                                 \
+        }                                                               \
+                                                                        \
+        /* */                                                           \
+        /* Wait for the power control setting to take effect. */        \
+        /* */                                                           \
+        while ( !(AM_REG(PWRCTRL, PWRONSTATUS) & ui32PwrOnStat) );      \
+    }
+
+//*****************************************************************************
+//
+// Memory PWRONSTATUS enable values for am_hal_pwrctrl_memory_enable()
+//
+//*****************************************************************************
+#define AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_8K                  \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM0_M
+
+#define AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_16K                 \
+           (AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM1_M  |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM0_M)
+
+#define AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_24K                 \
+           (AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM2_M  |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM1_M  |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM0_M)
+
+#define AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_32K                 \
+           (AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM3_M  |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM2_M  |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM1_M  |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM0_M)
+
+#define AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_64K                 \
+           (AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP1_SRAM_M   |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM3_M  |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM2_M  |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM1_M  |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM0_M)
+
+#define AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_96K                 \
+           (AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP2_SRAM_M   |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP1_SRAM_M   |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM3_M  |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM2_M  |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM1_M  |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM0_M)
+
+#define AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_128K                \
+           (AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP3_SRAM_M   |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP2_SRAM_M   |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP1_SRAM_M   |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM3_M  |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM2_M  |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM1_M  |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM0_M)
+
+#define AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_160K                \
+           (AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP4_SRAM_M   |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP3_SRAM_M   |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP2_SRAM_M   |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP1_SRAM_M   |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM3_M  |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM2_M  |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM1_M  |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM0_M)
+
+#define AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_192K                \
+           (AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP5_SRAM_M   |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP4_SRAM_M   |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP3_SRAM_M   |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP2_SRAM_M   |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP1_SRAM_M   |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM3_M  |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM2_M  |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM1_M  |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM0_M)
+
+#define AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_224K                \
+           (AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP6_SRAM_M   |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP5_SRAM_M   |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP4_SRAM_M   |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP3_SRAM_M   |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP2_SRAM_M   |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP1_SRAM_M   |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM3_M  |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM2_M  |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM1_M  |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM0_M)
+
+#define AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_256K                \
+           (AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP7_SRAM_M   |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP6_SRAM_M   |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP5_SRAM_M   |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP4_SRAM_M   |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP3_SRAM_M   |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP2_SRAM_M   |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP1_SRAM_M   |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM3_M  |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM2_M  |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM1_M  |   \
+            AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM0_M)
+
+#define AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_ALL                 \
+        AM_HAL_PWRCTRL_PWRONSTATUS_SRAM_256K
+
+//*****************************************************************************
+//
+// Function prototypes
+//
+//*****************************************************************************
+extern void am_hal_pwrctrl_periph_enable(uint32_t ui32Peripheral);
+extern void am_hal_pwrctrl_periph_disable(uint32_t ui32Peripheral);
+extern bool am_hal_pwrctrl_memory_enable(uint32_t ui32MemEn);
+extern void am_hal_pwrctrl_bucks_init(void);
+extern void am_hal_pwrctrl_bucks_enable(void);
+extern void am_hal_pwrctrl_bucks_disable(void);
+extern void am_hal_pwrctrl_low_power_init(void);
+
+#endif // AM_HAL_PWRCTRL_H
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_queue.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_queue.c
new file mode 100644
index 000000000..d3acfea1e
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_queue.c
@@ -0,0 +1,286 @@
+//*****************************************************************************
+//
+//! @file am_hal_queue.c
+//!
+//! @brief Functions for implementing a queue system.
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup Miscellaneous Software Features (MISC)
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "am_mcu_apollo.h"
+
+//*****************************************************************************
+//
+//! @brief Initializes a queue.
+//!
+//! @param psQueue - Pointer to a queue structure.
+//! @param pvData - Pointer to a memory location to be used for data storage.
+//! @param ui32ItemSize - Number of bytes per item in the queue.
+//! @param ui32ArraySize - Number of bytes in the data array.
+//!
+//! This function initializes the members of a queue structure and attaches it
+//! to an array of memory that it can use for storage. This function should be
+//! called before the queue is used.
+//!
+//! In this example, we are creating a queue that can hold 1024 32-bit
+//! integers. The integers themselves will be stored in the array named
+//! pui32WorkingSpace, while information about the queue itself will be stored
+//! in sDataQueue.
+//!
+//! @note The caller should not modify any of the members of am_hal_queue_t
+//! structures. The queue API will handle these members in a thread-safe way.
+//!
+//! @note The queue will remember what size data is in it. Other queue API
+//! functions will perform transfers in units of "items" where one "item" is
+//! the number of bytes you specify in the \e ui32ItemSize argument upon
+//! initialization.
+//!
+//! Example usage:
+//!
+//! @code
+//!
+//! //
+//! // Declare a queue structure and an array of bytes we can use to store
+//! // data.
+//! //
+//! am_hal_queue_t sDataQueue;
+//! uint32_t pui32WorkingSpace[1024];
+//!
+//! //
+//! // Attach the queue structure to the working memory.
+//! //
+//! am_hal_queue_init(&sDataQueue, pui8WorkingSpace, sizeof(uint32_t)
+//!                   sizeof(pui32WorkingSpace));
+//!
+//! @endcode
+//!
+//! The am_hal_queue_from_array macro is a convenient shorthand for this
+//! operation. The code below does the same thing as the code above.
+//!
+//! @code
+//!
+//! //
+//! // Declare a queue structure and an array of bytes we can use to store
+//! // data.
+//! //
+//! am_hal_queue_t sDataQueue;
+//! uint32_t pui32WorkingSpace[1024];
+//!
+//! //
+//! // Attach the queue structure to the working memory.
+//! //
+//! am_hal_queue_from_array(&sDataQueue, pui8WorkingSpace);
+//!
+//! @endcode
+//
+//*****************************************************************************
+void
+am_hal_queue_init(am_hal_queue_t *psQueue, void *pvData, uint32_t ui32ItemSize,
+                  uint32_t ui32ArraySize)
+{
+    psQueue->ui32WriteIndex = 0;
+    psQueue->ui32ReadIndex = 0;
+    psQueue->ui32Length = 0;
+    psQueue->ui32Capacity = ui32ArraySize;
+    psQueue->ui32ItemSize = ui32ItemSize;
+    psQueue->pui8Data = (uint8_t *) pvData;
+}
+
+//*****************************************************************************
+//
+//! @brief Adds an item to the Queue
+//!
+//! @param psQueue - Pointer to a queue structure.
+//! @param pvSource - Pointer to the data to be added.
+//! @param ui32NumItems - Number of items to be added.
+//!
+//! This function will copy the data pointed to by pvSource into the queue. The
+//! \e ui32NumItems term specifies the number of items to be copied from \e
+//! pvSource. The size of an "item" depends on how the queue was initialized.
+//! Please see am_hal_queue_init() for more information on this.
+//!
+//! @return true if the add operation was successful, or false if the queue
+//! didn't have enough space.
+//
+//*****************************************************************************
+bool
+am_hal_queue_item_add(am_hal_queue_t *psQueue, const void *pvSource, uint32_t ui32NumItems)
+{
+    uint32_t i;
+    uint8_t *pui8Source;
+    uint32_t ui32Bytes = ui32NumItems * psQueue->ui32ItemSize;
+    bool bSuccess = false;
+    uint32_t ui32Primask;
+
+    pui8Source = (uint8_t *) pvSource;
+
+    ui32Primask = am_hal_interrupt_master_disable();
+
+    //
+    // Check to make sure that the buffer isn't already full
+    //
+    if ( am_hal_queue_space_left(psQueue) >= ui32Bytes )
+    {
+        //
+        // Loop over the bytes in the source array.
+        //
+        for ( i = 0; i < ui32Bytes; i++ )
+        {
+            //
+            // Write the value to the buffer.
+            //
+            psQueue->pui8Data[psQueue->ui32WriteIndex] = pui8Source[i];
+
+            //
+            // Advance the write index, making sure to wrap if necessary.
+            //
+            psQueue->ui32WriteIndex = ((psQueue->ui32WriteIndex + 1) %
+                                        psQueue->ui32Capacity);
+        }
+
+        //
+        // Update the length value appropriately.
+        //
+        psQueue->ui32Length += ui32Bytes;
+
+        //
+        // Report a success.
+        //
+        bSuccess = true;
+    }
+    else
+    {
+        //
+        // The buffer can't fit the amount of data requested. Return a
+        // failure.
+        //
+        bSuccess = false;
+    }
+
+    am_hal_interrupt_master_set(ui32Primask);
+
+    return bSuccess;
+}
+
+//*****************************************************************************
+//
+//! @brief Removes an item from the Queue
+//!
+//! @param psQueue - Pointer to a queue structure.
+//! @param pvDest - Pointer to the data to be added.
+//! @param ui32NumItems - Number of items to be added.
+//!
+//! This function will copy the data from the queue into the memory pointed to
+//! by pvDest. The \e ui32NumItems term specifies the number of items to be
+//! copied from the queue. The size of an "item" depends on how the queue was
+//! initialized.  Please see am_hal_queue_init() for more information on this.
+//!
+//! @return true if we were able to pull the requested number of items from the
+//! queue, or false if the queue didn't have that many items to pull.
+//
+//*****************************************************************************
+bool
+am_hal_queue_item_get(am_hal_queue_t *psQueue, void *pvDest, uint32_t ui32NumItems)
+{
+    uint32_t i;
+    uint8_t *pui8Dest;
+    uint32_t ui32Bytes = ui32NumItems * psQueue->ui32ItemSize;
+    bool bSuccess = false;
+    uint32_t ui32Primask;
+
+    pui8Dest = (uint8_t *) pvDest;
+
+    ui32Primask = am_hal_interrupt_master_disable();
+
+    //
+    // Check to make sure that the buffer isn't empty
+    //
+    if ( am_hal_queue_data_left(psQueue) >= ui32Bytes )
+    {
+        //
+        // Loop over the bytes in the destination array.
+        //
+        for ( i = 0; i < ui32Bytes; i++ )
+        {
+            //
+            // Grab the next value from the buffer.
+            //
+            pui8Dest[i] = psQueue->pui8Data[psQueue->ui32ReadIndex];
+
+            //
+            // Advance the read index, wrapping if needed.
+            //
+            psQueue->ui32ReadIndex = ((psQueue->ui32ReadIndex + 1) %
+                                       psQueue->ui32Capacity);
+        }
+
+        //
+        // Adjust the length value to reflect the change.
+        //
+        psQueue->ui32Length -= ui32Bytes;
+
+        //
+        // Report a success.
+        //
+        bSuccess = true;
+    }
+    else
+    {
+        //
+        // If the buffer didn't have enough data, just return false.
+        //
+        bSuccess = false;
+    }
+
+    am_hal_interrupt_master_set(ui32Primask);
+
+    return bSuccess;
+}
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_queue.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_queue.h
new file mode 100644
index 000000000..bf07131f0
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_queue.h
@@ -0,0 +1,123 @@
+//*****************************************************************************
+//
+//! @file am_hal_queue.h
+//!
+//! @brief Functions for implementing a queue system.
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup Miscellaneous Software Features (MISC)
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_HAL_QUEUE_H
+#define AM_HAL_QUEUE_H
+
+//*****************************************************************************
+//
+//! @brief A data structure that will operate as a queue.
+//!
+//! This data structure holds information necessary for operating a thread-safe
+//! queue. When declaring a structure of type am_hal_queue_t, you will also need
+//! to provide some working memory for the queue to use. For more information on
+//! setting up and using the am_hal_queue_t structure, please see the
+//! documentation for am_hal_queue_init().
+//
+//*****************************************************************************
+typedef struct
+{
+    uint32_t ui32WriteIndex;
+    uint32_t ui32ReadIndex;
+    uint32_t ui32Length;
+    uint32_t ui32Capacity;
+    uint32_t ui32ItemSize;
+    uint8_t *pui8Data;
+}
+am_hal_queue_t;
+
+//*****************************************************************************
+//
+// Function-like macros.
+//
+//*****************************************************************************
+#define am_hal_queue_empty(psQueue)                                           \
+    ((psQueue)->ui32Length == 0)
+
+#define am_hal_queue_full(psQueue)                                            \
+    ((psQueue)->ui32Length == (psQueue)->ui32Capacity)
+
+#define am_hal_queue_space_left(psQueue)                                      \
+    ((psQueue)->ui32Capacity - (psQueue)->ui32Length)
+
+#define am_hal_queue_data_left(psQueue)                                       \
+    ((psQueue)->ui32Length)
+
+//*****************************************************************************
+//
+// Use this to make sure you get the size parameters right.
+//
+//*****************************************************************************
+#define am_hal_queue_from_array(queue, array)                                 \
+    am_hal_queue_init((queue), (array), sizeof((array)[0]), sizeof(array))
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+//*****************************************************************************
+//
+// External function definitions.
+//
+//*****************************************************************************
+extern void am_hal_queue_init(am_hal_queue_t *psQueue, void *pvData, uint32_t ui32ItemSize, uint32_t ui32ArraySize);
+extern bool am_hal_queue_item_add(am_hal_queue_t *psQueue, const void *pvSource, uint32_t ui32NumItems);
+extern bool am_hal_queue_item_get(am_hal_queue_t *psQueue, void *pvDest, uint32_t ui32NumItems);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_HAL_QUEUE_H
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_reset.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_reset.c
new file mode 100644
index 000000000..8cf9fab6c
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_reset.c
@@ -0,0 +1,160 @@
+//*****************************************************************************
+//
+//! @file am_hal_reset.c
+//!
+//! @brief Hardware abstraction layer for the Reset Generator module.
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup rstgen Reset Generator (RSTGEN)
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#include "am_mcu_apollo.h"
+
+//*****************************************************************************
+//
+//! @brief Configure the Reset Generator.
+//!
+//! @param ui32Config - Or together the supplied macros to enable
+//! configurations to obtain the desired reset generator settings.
+//!
+//! This function will set the reset generator's configuration register based on
+//! the user's desired settings listed in the supplied arugment.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_reset_init(uint32_t ui32Config)
+{
+    //
+    // Write the configuration to the reset generator
+    //
+    AM_REG(RSTGEN, CFG) = ui32Config;
+}
+
+//*****************************************************************************
+//
+//! @brief Issue a POR (Apollo's last stage interrupt).
+//!
+//! This function will issue a POR reset.
+//! The Apollo chip has numerous stages of reset. POR is the last and is also
+//! the reset invoked by the chip's reset pin, the watchdog timer, the AIRCR
+//! reset, and the SWD debugger requested interrupt.
+//!
+//! The Debug Access Port in the M4 is not cleared by this reset.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void am_hal_reset_por(void)
+{
+    //
+    // Write the POR key to the software POR register.
+    //
+    AM_REG(RSTGEN, SWPOR) =
+           AM_REG_RSTGEN_SWPOR_SWPORKEY(AM_REG_RSTGEN_SWPOR_SWPORKEY_KEYVALUE);
+}
+
+//*****************************************************************************
+//
+//! @brief Issue a POI (Apollo's second stage interrupt).
+//!
+//! This function will issue a POI reset.
+//! The Apollo chip has numerous stages of reset. POI is the second stage.
+//! A few modules are reset by POI that are not reset by POR, notably POI
+//! causes the shadow registers to be reloaded from the OTP. A full power
+//! cycle or POI should be used after writing new flash, debug or SRAM
+//! protection bits into the OTP for these protections to take effect.
+//!
+//! The Debug Access Port in the M4 is not cleared by this reset.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void am_hal_reset_poi(void)
+{
+    //
+    // Write the POI key to the software POI register.
+    //
+    AM_REG(RSTGEN, SWPOI) =
+           AM_REG_RSTGEN_SWPOI_SWPOIKEY(AM_REG_RSTGEN_SWPOI_SWPOIKEY_KEYVALUE);
+}
+
+//*****************************************************************************
+//
+//! @brief Retrieve the status bits from the reset generator.
+//!
+//! This function will get the status bits from the reset generator.
+//! These bits are sticky and show the accumulation of reset types that the
+//! Apollo chip has experienced since power on. One should clear these out
+//! after reading them.
+//!
+//! @return None.
+//
+//*****************************************************************************
+uint32_t am_hal_reset_status_get(void)
+{
+    //
+    // Retrieve the reset generator status bits
+    //
+    return AM_REG(RSTGEN, STAT);
+}
+
+//*****************************************************************************
+//
+//! @brief Clear ALL of the status bits in the reset generator.
+//!
+//! This function will clear all status bits in the reset generator status.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void am_hal_reset_status_clear(void)
+{
+    AM_REG(RSTGEN, CLRSTAT) = AM_REG_RSTGEN_CLRSTAT_CLRSTAT(1);
+}
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_reset.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_reset.h
new file mode 100644
index 000000000..ba90df824
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_reset.h
@@ -0,0 +1,119 @@
+//*****************************************************************************
+//
+//! @file am_hal_reset.h
+//!
+//! @brief Hardware abstraction layer for the Reset Generator module.
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup wdt Watchdog Timer (RSTGEN)
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_HAL_RSTGEN_H
+#define AM_HAL_RSTGEN_H
+
+//*****************************************************************************
+//
+//! @name Reset Generator Configuration
+//! @brief These macros may be used to set the reset generator's configuration.
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_RESET_CFG_WDT_RESET_ENABLE       (AM_REG_RSTGEN_CFG_WDREN(1))
+// Brown out high (2.1v) reset enable.
+#define AM_HAL_RESET_CFG_BOD_HIGH_RESET_ENABLE  (AM_REG_RSTGEN_CFG_BODHREN(1))
+//! @}
+
+//*****************************************************************************
+//
+//! @name Reset Generator Status Bit Masks
+//! @brief These macros may be used to determine which type(s) of resets have
+//!        been seen.
+//! @{
+//
+//*****************************************************************************
+// Reset was initiated by a Watchdog Timer Reset.
+#define AM_HAL_RESET_STAT_WDT (AM_REG_RSTGEN_STAT_WDRSTAT_M)
+
+// Reset was a initiated by Debugger Reset.
+#define AM_HAL_RESET_STAT_DEBUG (AM_REG_RSTGEN_STAT_DBGRSTAT_M)
+
+// Reset was a initiated by Software POI Reset.
+#define AM_HAL_RESET_STAT_POI (AM_REG_RSTGEN_STAT_POIRSTAT_M)
+
+// Reset was a initiated by Software POR or AIRCR Reset.
+#define AM_HAL_RESET_STAT_SOFTWARE (AM_REG_RSTGEN_STAT_SWRSTAT_M)
+
+// Reset was initiated by a Brown-Out Reset.
+#define AM_HAL_RESET_STAT_BOD (AM_REG_RSTGEN_STAT_BORSTAT_M)
+
+// Reset was initiated by a Power Cycle
+#define AM_HAL_RESET_STAT_POWER_CYCLE (AM_REG_RSTGEN_STAT_PORSTAT_M)
+
+// Reset was initiated by an External Reset.
+#define AM_HAL_RESET_STAT_EXTERNAL (AM_REG_RSTGEN_STAT_EXRSTAT_M)
+//! @}
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+//*****************************************************************************
+//
+// External function definitions
+//
+//*****************************************************************************
+extern void am_hal_reset_init(uint32_t ui32Config);
+extern void am_hal_reset_por(void);
+extern void am_hal_reset_poi(void);
+extern uint32_t am_hal_reset_status_get(void);
+extern void am_hal_reset_status_clear(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_HAL_RSTGEN_H
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_rtc.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_rtc.c
new file mode 100644
index 000000000..08d4f30f5
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_rtc.c
@@ -0,0 +1,678 @@
+//*****************************************************************************
+//
+//! @file am_hal_rtc.c
+//!
+//! @brief Functions for interfacing with the Real-Time Clock (RTC).
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup rtc Real-Time Clock (RTC)
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "am_mcu_apollo.h"
+
+//*****************************************************************************
+//
+// Converts a Binary Coded Decimal (BCD) byte to its Decimal form.
+//
+//*****************************************************************************
+static uint8_t
+bcd_to_dec(uint8_t ui8BCDByte)
+{
+  return (((ui8BCDByte & 0xF0) >> 4) * 10) + (ui8BCDByte & 0x0F);
+}
+
+//*****************************************************************************
+//
+// Converts a Decimal byte to its Binary Coded Decimal (BCD) form.
+//
+//*****************************************************************************
+static uint8_t
+dec_to_bcd(uint8_t ui8DecimalByte)
+{
+  return (((ui8DecimalByte / 10) << 4) | (ui8DecimalByte % 10));
+}
+
+//*****************************************************************************
+//
+//! @brief Selects the clock source for the RTC.
+//!
+//! @param ui32OSC the clock source for the RTC.
+//!
+//! This function selects the clock source for the RTC.
+//!
+//! Valid values for ui32OSC are:
+//!
+//!     AM_HAL_RTC_OSC_LFRC
+//!     AM_HAL_RTC_OSC_XT
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_rtc_osc_select(uint32_t ui32OSC)
+{
+    //
+    // Set XT if flag is set.
+    // Otherwise configure for LFRC.
+    //
+    if (ui32OSC)
+    {
+        AM_REG(CLKGEN, OCTRL) |= AM_REG_CLKGEN_OCTRL_OSEL_M;
+    }
+    else
+    {
+        AM_REG(CLKGEN, OCTRL) &= ~AM_REG_CLKGEN_OCTRL_OSEL_M;
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Enable/Start the RTC oscillator.
+//!
+//! Starts the RTC oscillator.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_rtc_osc_enable(void)
+{
+    //
+    // Start the RTC Oscillator.
+    //
+    AM_REG(RTC, RTCCTL) &= ~AM_REG_RTC_RTCCTL_RSTOP(1);
+}
+
+//*****************************************************************************
+//
+//! @brief Disable/Stop the RTC oscillator.
+//!
+//! Stops the RTC oscillator.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_rtc_osc_disable(void)
+{
+    //
+    // Stop the RTC Oscillator.
+    //
+    AM_REG(RTC, RTCCTL) |= AM_REG_RTC_RTCCTL_RSTOP(1);
+}
+
+//*****************************************************************************
+//
+//! @brief Configures the RTC for 12 or 24 hour time keeping.
+//!
+//! @param b12Hour - A 'true' configures the RTC for 12 hour time keeping.
+//!
+//! Configures the RTC for 12 (true) or 24 (false) hour time keeping.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_rtc_time_12hour(bool b12Hour)
+{
+    //
+    // Set the 12/24 hour bit.
+    //
+    AM_REG(RTC, RTCCTL) |= AM_REG_RTC_RTCCTL_HR1224(b12Hour);
+}
+
+//*****************************************************************************
+//
+//! @brief Enable selected RTC interrupts.
+//!
+//! @param ui32Interrupt - desired interrupts
+//!
+//! Enables the RTC interrupts.
+//!
+//! ui32Interrupt should be an OR of the following:
+//!
+//!     AM_HAL_RTC_INT_ALM
+//!     AM_HAL_RTC_INT_OF
+//!     AM_HAL_RTC_INT_ACC
+//!     AM_HAL_RTC_INT_ACF
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_rtc_int_enable(uint32_t ui32Interrupt)
+{
+    //
+    // Enable the interrupts.
+    //
+    AM_REG(RTC, INTEN) |= ui32Interrupt;
+}
+
+//*****************************************************************************
+//
+//! @brief Return the enabled RTC interrupts.
+//!
+//! Returns the enabled RTC interrupts.
+//!
+//! @return enabled RTC interrupts. Return is a logical or of:
+//!
+//!     AM_HAL_RTC_INT_ALM
+//!     AM_HAL_RTC_INT_OF
+//!     AM_HAL_RTC_INT_ACC
+//!     AM_HAL_RTC_INT_ACF
+//
+//*****************************************************************************
+uint32_t
+am_hal_rtc_int_enable_get(void)
+{
+    //
+    // Read the RTC interrupt enable register, and return its contents.
+    //
+    return AM_REG(RTC, INTEN);
+}
+
+//*****************************************************************************
+//
+//! @brief Disable selected RTC interrupts.
+//!
+//! @param ui32Interrupt - desired interrupts
+//!
+//! Disables the RTC interrupts.
+//!
+//! ui32Interrupt should be an OR of the following:
+//!
+//!     AM_HAL_RTC_INT_ALM
+//!     AM_HAL_RTC_INT_OF
+//!     AM_HAL_RTC_INT_ACC
+//!     AM_HAL_RTC_INT_ACF
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_rtc_int_disable(uint32_t ui32Interrupt)
+{
+    //
+    // Disable the interrupts.
+    //
+    AM_REG(RTC, INTEN) &= ~ui32Interrupt;
+}
+
+//*****************************************************************************
+//
+//! @brief Sets the selected RTC interrupts.
+//!
+//! @param ui32Interrupt - desired interrupts
+//!
+//! Sets the RTC interrupts causing them to immediately trigger.
+//!
+//! ui32Interrupt should be an OR of the following:
+//!
+//!     AM_HAL_RTC_INT_ALM
+//!     AM_HAL_RTC_INT_OF
+//!     AM_HAL_RTC_INT_ACC
+//!     AM_HAL_RTC_INT_ACF
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_rtc_int_set(uint32_t ui32Interrupt)
+{
+    //
+    // Set the interrupts.
+    //
+    AM_REG(RTC, INTSET) = ui32Interrupt;
+}
+
+//*****************************************************************************
+//
+//! @brief Clear selected RTC interrupts.
+//!
+//! @param ui32Interrupt - desired interrupts
+//!
+//! Clears the RTC interrupts.
+//!
+//! ui32Interrupt should be an OR of the following:
+//!
+//!     AM_HAL_RTC_INT_ALM
+//!     AM_HAL_RTC_INT_OF
+//!     AM_HAL_RTC_INT_ACC
+//!     AM_HAL_RTC_INT_ACF
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_rtc_int_clear(uint32_t ui32Interrupt)
+{
+    //
+    // Clear the interrupts.
+    //
+    AM_REG(RTC, INTCLR) = ui32Interrupt;
+}
+
+//*****************************************************************************
+//
+//! @brief Returns the RTC interrupt status.
+//!
+//! @param bEnabledOnly - return the status of only the enabled interrupts.
+//!
+//! Returns the RTC interrupt status.
+//!
+//! @return Bitwise representation of the current interrupt status.
+//!
+//! The return value will be the logical OR of one or more of the following
+//! values:
+//!
+//!     AM_HAL_RTC_INT_ALM
+//!     AM_HAL_RTC_INT_OF
+//!     AM_HAL_RTC_INT_ACC
+//!     AM_HAL_RTC_INT_ACF
+//
+//*****************************************************************************
+uint32_t
+am_hal_rtc_int_status_get(bool bEnabledOnly)
+{
+    //
+    // Get the interrupt status.
+    //
+    if (bEnabledOnly)
+    {
+        uint32_t u32RetVal;
+        u32RetVal  = AM_REG(RTC, INTSTAT);
+        u32RetVal &= AM_REG(RTC, INTEN);
+        return u32RetVal &
+                (AM_HAL_RTC_INT_ALM | AM_HAL_RTC_INT_OF |
+                AM_HAL_RTC_INT_ACC | AM_HAL_RTC_INT_ACF);
+    }
+    else
+    {
+        return (AM_REG(RTC, INTSTAT) & (AM_HAL_RTC_INT_ALM |
+                                        AM_HAL_RTC_INT_OF |
+                                        AM_HAL_RTC_INT_ACC |
+                                        AM_HAL_RTC_INT_ACF));
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Set the Real Time Clock counter registers.
+//!
+//! @param *pTime - A pointer to the time structure.
+//!
+//! Sets the RTC counter registers to the supplied values.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_rtc_time_set(am_hal_rtc_time_t *pTime)
+{
+    //
+    // Enable writing to the counters.
+    //
+    AM_REG(RTC, RTCCTL) |= AM_REG_RTC_RTCCTL_WRTC(1);
+
+    //
+    // Write the RTCLOW register.
+    //
+    AM_REG(RTC, CTRLOW) =
+        AM_REG_RTC_CTRLOW_CTRHR(dec_to_bcd(pTime->ui32Hour))                |
+        AM_REG_RTC_CTRLOW_CTRMIN(dec_to_bcd(pTime->ui32Minute))             |
+        AM_REG_RTC_CTRLOW_CTRSEC(dec_to_bcd(pTime->ui32Second))             |
+        AM_REG_RTC_CTRLOW_CTR100(dec_to_bcd(pTime->ui32Hundredths));
+
+    //
+    // Write the RTCUP register.
+    //
+    AM_REG(RTC, CTRUP) =
+        AM_REG_RTC_CTRUP_CEB((pTime->ui32CenturyEnable))                   |
+        AM_REG_RTC_CTRUP_CB((pTime->ui32Century))                          |
+        AM_REG_RTC_CTRUP_CTRWKDY((pTime->ui32Weekday))                     |
+        AM_REG_RTC_CTRUP_CTRYR(dec_to_bcd((pTime->ui32Year)))              |
+        AM_REG_RTC_CTRUP_CTRMO(dec_to_bcd((pTime->ui32Month)))             |
+        AM_REG_RTC_CTRUP_CTRDATE(dec_to_bcd((pTime->ui32DayOfMonth)));
+
+    //
+    // Disable writing to the counters.
+    //
+    AM_REG(RTC, RTCCTL) |= AM_REG_RTC_RTCCTL_WRTC(0);
+}
+
+//*****************************************************************************
+//
+//! @brief Get the Real Time Clock current time.
+//!
+//! @param *pTime - A pointer to the time structure to store the current time.
+//!
+//! Gets the RTC's current time
+//!
+//! @return 0 for success and 1 for error.
+//
+//*****************************************************************************
+uint32_t
+am_hal_rtc_time_get(am_hal_rtc_time_t *pTime)
+{
+    uint32_t ui32RTCLow, ui32RTCUp, ui32Value;
+
+    //
+    // Read the upper and lower RTC registers.
+    //
+    ui32RTCLow = AM_REG(RTC, CTRLOW);
+    ui32RTCUp = AM_REG(RTC, CTRUP);
+
+    //
+    // Break out the lower word.
+    //
+    ui32Value =
+        ((ui32RTCLow & AM_REG_RTC_CTRLOW_CTRHR_M) >> AM_REG_RTC_CTRLOW_CTRHR_S);
+    pTime->ui32Hour = bcd_to_dec(ui32Value);
+
+    ui32Value =
+        ((ui32RTCLow & AM_REG_RTC_CTRLOW_CTRMIN_M) >> AM_REG_RTC_CTRLOW_CTRMIN_S);
+    pTime->ui32Minute = bcd_to_dec(ui32Value);
+
+    ui32Value =
+        ((ui32RTCLow & AM_REG_RTC_CTRLOW_CTRSEC_M) >> AM_REG_RTC_CTRLOW_CTRSEC_S);
+    pTime->ui32Second = bcd_to_dec(ui32Value);
+
+    ui32Value =
+        ((ui32RTCLow & AM_REG_RTC_CTRLOW_CTR100_M) >> AM_REG_RTC_CTRLOW_CTR100_S);
+    pTime->ui32Hundredths = bcd_to_dec(ui32Value);
+
+    //
+    // Break out the upper word.
+    //
+    pTime->ui32ReadError =
+        ((ui32RTCUp & AM_REG_RTC_CTRUP_CTERR_M) >> AM_REG_RTC_CTRUP_CTERR_S);
+
+    pTime->ui32CenturyEnable =
+        ((ui32RTCUp & AM_REG_RTC_CTRUP_CEB_M) >> AM_REG_RTC_CTRUP_CEB_S);
+
+    pTime->ui32Century =
+        ((ui32RTCUp & AM_REG_RTC_CTRUP_CB_M) >> AM_REG_RTC_CTRUP_CB_S);
+
+    ui32Value =
+        ((ui32RTCUp & AM_REG_RTC_CTRUP_CTRWKDY_M) >> AM_REG_RTC_CTRUP_CTRWKDY_S);
+    pTime->ui32Weekday = bcd_to_dec(ui32Value);
+
+    ui32Value =
+        ((ui32RTCUp & AM_REG_RTC_CTRUP_CTRYR_M) >> AM_REG_RTC_CTRUP_CTRYR_S);
+    pTime->ui32Year = bcd_to_dec(ui32Value);
+
+    ui32Value =
+        ((ui32RTCUp & AM_REG_RTC_CTRUP_CTRMO_M) >> AM_REG_RTC_CTRUP_CTRMO_S);
+    pTime->ui32Month = bcd_to_dec(ui32Value);
+
+    ui32Value =
+        ((ui32RTCUp & AM_REG_RTC_CTRUP_CTRDATE_M) >> AM_REG_RTC_CTRUP_CTRDATE_S);
+    pTime->ui32DayOfMonth = bcd_to_dec(ui32Value);
+
+    //
+    // Was there a read error?
+    //
+    if (pTime->ui32ReadError)
+    {
+        return 1;
+    }
+    else
+    {
+        return 0;
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Sets the alarm repeat interval.
+//!
+//! @param ui32RepeatInterval the desired repeat interval.
+//!
+//! Sets the alarm repeat interval.
+//!
+//! Valid values for ui32RepeatInterval:
+//!
+//!     AM_HAL_RTC_ALM_RPT_DIS
+//!     AM_HAL_RTC_ALM_RPT_YR
+//!     AM_HAL_RTC_ALM_RPT_MTH
+//!     AM_HAL_RTC_ALM_RPT_WK
+//!     AM_HAL_RTC_ALM_RPT_DAY
+//!     AM_HAL_RTC_ALM_RPT_HR
+//!     AM_HAL_RTC_ALM_RPT_MIN
+//!     AM_HAL_RTC_ALM_RPT_SEC
+//!     AM_HAL_RTC_ALM_RPT_10TH
+//!     AM_HAL_RTC_ALM_RPT_100TH
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_rtc_alarm_interval_set(uint32_t ui32RepeatInterval)
+{
+    uint32_t ui32RptInt, ui32Alm100, ui32Value;
+
+    switch(ui32RepeatInterval)
+    {
+        //
+        // If repeat every 10th set RPT and ALM100 field accordinly
+        //
+        case AM_HAL_RTC_ALM_RPT_10TH:
+            ui32RptInt = AM_HAL_RTC_ALM_RPT_SEC;
+            ui32Alm100 = AM_HAL_RTC_ALM100_10TH;
+            break;
+        //
+        // If repeat every 100th set RPT and ALM100 field accordinly
+        //
+        case AM_HAL_RTC_ALM_RPT_100TH:
+            ui32RptInt = AM_HAL_RTC_ALM_RPT_SEC;
+            ui32Alm100 = AM_HAL_RTC_ALM100_100TH;
+            break;
+        //
+        // Otherwise set RPT as value passed.  ALM100 values need to be 0xnn
+        // in this setting where n = 0-9.
+        //
+        default:
+            //
+            // Get the current value of the ALM100 field.
+            //
+            ui32Value = AM_BFR(RTC, ALMLOW, ALM100);
+
+            //
+            // If ALM100 was previous EVERY_10TH or EVERY_100TH reset to zero
+            // otherwise keep previous setting.
+            //
+            ui32Alm100 = ui32Value >= 0xF0 ? 0 : ui32Value;
+
+            //
+            // Set RPT value to value passed.
+            //
+            ui32RptInt = ui32RepeatInterval;
+            break;
+    }
+
+    //
+    // Write the interval to the register.
+    //
+    AM_BFW(RTC, RTCCTL, RPT, ui32RptInt);
+
+    //
+    // Write the Alarm 100 bits in the ALM100 register.
+    //
+    AM_BFW(RTC, ALMLOW, ALM100, ui32Alm100);
+}
+
+//*****************************************************************************
+//
+//! @brief Sets the RTC's Alarm.
+//!
+//! @param *pTime - A pointer to the time structure.
+//! @param ui32RepeatInterval - the desired alarm repeat interval.
+//!
+//! Set the Real Time Clock Alarm Parameters.
+//!
+//! Valid values for ui32RepeatInterval:
+//!
+//!     AM_HAL_RTC_ALM_RPT_DIS
+//!     AM_HAL_RTC_ALM_RPT_YR
+//!     AM_HAL_RTC_ALM_RPT_MTH
+//!     AM_HAL_RTC_ALM_RPT_WK
+//!     AM_HAL_RTC_ALM_RPT_DAY
+//!     AM_HAL_RTC_ALM_RPT_HR
+//!     AM_HAL_RTC_ALM_RPT_MIN
+//!     AM_HAL_RTC_ALM_RPT_SEC
+//!     AM_HAL_RTC_ALM_RPT_10TH
+//!     AM_HAL_RTC_ALM_RPT_EVERY_100TH
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_rtc_alarm_set(am_hal_rtc_time_t *pTime, uint32_t ui32RepeatInterval)
+{
+    uint8_t ui8Value = 0;
+
+    //
+    // Write the interval to the register.
+    //
+    AM_REG(RTC, RTCCTL) |=
+        AM_REG_RTC_RTCCTL_RPT(ui32RepeatInterval > 0x7 ? 0x7 : ui32RepeatInterval);
+
+    //
+    // Check if the interval is 10th or every 100th and track it in ui8Value.
+    //
+    if (ui32RepeatInterval == AM_HAL_RTC_ALM_RPT_10TH)
+    {
+        ui8Value = 0xF0;
+    }
+    else if (ui32RepeatInterval == AM_HAL_RTC_ALM_RPT_100TH)
+    {
+        ui8Value = 0xFF;
+    }
+
+    //
+    // Write the ALMUP register.
+    //
+    AM_REG(RTC, ALMUP) =
+        AM_REG_RTC_ALMUP_ALMWKDY((pTime->ui32Weekday))                     |
+        AM_REG_RTC_ALMUP_ALMMO(dec_to_bcd((pTime->ui32Month)))             |
+        AM_REG_RTC_ALMUP_ALMDATE(dec_to_bcd((pTime->ui32DayOfMonth)));
+
+    //
+    // Write the ALMLOW register.
+    //
+    AM_REG(RTC, ALMLOW) =
+        AM_REG_RTC_ALMLOW_ALMHR(dec_to_bcd(pTime->ui32Hour))                |
+        AM_REG_RTC_ALMLOW_ALMMIN(dec_to_bcd(pTime->ui32Minute))             |
+        AM_REG_RTC_ALMLOW_ALMSEC(dec_to_bcd(pTime->ui32Second))             |
+        AM_REG_RTC_ALMLOW_ALM100(dec_to_bcd(pTime->ui32Hundredths) | ui8Value);
+}
+
+//*****************************************************************************
+//
+//! @brief Get the Real Time Clock Alarm Parameters
+//!
+//! @param *pTime - A pointer to the time structure to store the current alarm.
+//!
+//! Gets the RTC's Alarm time
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_rtc_alarm_get(am_hal_rtc_time_t *pTime)
+{
+    uint32_t ui32ALMLow, ui32ALMUp, ui32Value;
+
+    //
+    // Read the upper and lower RTC registers.
+    //
+    ui32ALMLow = AM_REG(RTC, ALMLOW);
+    ui32ALMUp = AM_REG(RTC, ALMUP);
+
+    //
+    // Break out the lower word.
+    //
+    ui32Value =
+        ((ui32ALMLow & AM_REG_RTC_ALMLOW_ALMHR_M) >> AM_REG_RTC_ALMLOW_ALMHR_S);
+    pTime->ui32Hour = bcd_to_dec(ui32Value);
+
+    ui32Value =
+        ((ui32ALMLow & AM_REG_RTC_ALMLOW_ALMMIN_M) >> AM_REG_RTC_ALMLOW_ALMMIN_S);
+    pTime->ui32Minute = bcd_to_dec(ui32Value);
+
+    ui32Value =
+        ((ui32ALMLow & AM_REG_RTC_ALMLOW_ALMSEC_M) >> AM_REG_RTC_ALMLOW_ALMSEC_S);
+    pTime->ui32Second = bcd_to_dec(ui32Value);
+
+    ui32Value =
+        ((ui32ALMLow & AM_REG_RTC_ALMLOW_ALM100_M) >> AM_REG_RTC_ALMLOW_ALM100_S);
+    pTime->ui32Hundredths = bcd_to_dec(ui32Value);
+
+    //
+    // Break out the upper word.
+    //
+    pTime->ui32ReadError = 0;
+    pTime->ui32CenturyEnable = 0;
+    pTime->ui32Century = 0;
+
+    ui32Value =
+        ((ui32ALMUp & AM_REG_RTC_ALMUP_ALMWKDY_M) >> AM_REG_RTC_ALMUP_ALMWKDY_S);
+    pTime->ui32Weekday = bcd_to_dec(ui32Value);
+
+    pTime->ui32Year = 0;
+
+    ui32Value =
+        ((ui32ALMUp & AM_REG_RTC_ALMUP_ALMMO_M) >> AM_REG_RTC_ALMUP_ALMMO_S);
+    pTime->ui32Month = bcd_to_dec(ui32Value);
+
+    ui32Value =
+        ((ui32ALMUp & AM_REG_RTC_ALMUP_ALMDATE_M) >> AM_REG_RTC_ALMUP_ALMDATE_S);
+    pTime->ui32DayOfMonth = bcd_to_dec(ui32Value);
+}
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_rtc.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_rtc.h
new file mode 100644
index 000000000..bf505b3af
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_rtc.h
@@ -0,0 +1,185 @@
+//*****************************************************************************
+//
+//! @file am_hal_rtc.h
+//!
+//! @brief Functions for interfacing and accessing the Real-Time Clock (RTC).
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup rtc Real-Time Clock (RTC)
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_HAL_RTC_H
+#define AM_HAL_RTC_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+//*****************************************************************************
+//
+//! @name OSC Start and Stop
+//! @brief OSC Start and Stop defines.
+//!
+//! OSC Start and Stop defines to be used with \e am_hal_clkgen_osc_x().
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_RTC_OSC_LFRC          0x1
+#define AM_HAL_RTC_OSC_XT            0x0
+//! @}
+
+//*****************************************************************************
+//
+//! @name RTC Interrupts
+//! @brief Macro definitions for RTC interrupt status bits.
+//!
+//! These macros correspond to the bits in the RTC interrupt status register.
+//! They may be used with any of the \e am_hal_rtc_int_x() functions.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_RTC_INT_ALM                  AM_REG_RTC_INTEN_ALM_M
+#define AM_HAL_RTC_INT_OF                   AM_REG_RTC_INTEN_OF_M
+#define AM_HAL_RTC_INT_ACC                  AM_REG_RTC_INTEN_ACC_M
+#define AM_HAL_RTC_INT_ACF                  AM_REG_RTC_INTEN_ACF_M
+//! @}
+
+//*****************************************************************************
+//
+//! @name RTC Alarm Repeat Interval.
+//! @brief Macro definitions for the RTC alarm repeat interval.
+//!
+//! These macros correspond to the RPT bits in the RTCCTL register.
+//! They may be used with the \e am_hal_rtc_alarm_interval_set() function.
+//!
+//! Note: AM_HAL_RTC_ALM_RPT_10TH and AM_HAL_RTC_ALM_RPT_100TH do not
+//! correspond to the RPT bits but are used in conjunction with setting the
+//! ALM100 bits in the ALMLOW register.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_RTC_ALM_RPT_DIS              0x0
+#define AM_HAL_RTC_ALM_RPT_YR               0x1
+#define AM_HAL_RTC_ALM_RPT_MTH              0x2
+#define AM_HAL_RTC_ALM_RPT_WK               0x3
+#define AM_HAL_RTC_ALM_RPT_DAY              0x4
+#define AM_HAL_RTC_ALM_RPT_HR               0x5
+#define AM_HAL_RTC_ALM_RPT_MIN              0x6
+#define AM_HAL_RTC_ALM_RPT_SEC              0x7
+#define AM_HAL_RTC_ALM_RPT_10TH             0x8
+#define AM_HAL_RTC_ALM_RPT_100TH            0x9
+//! @}
+
+//*****************************************************************************
+//
+//! @name RTC Alarm 100 Interval.
+//! @brief Macro definitions for the RTC alarm ms intervals.
+//!
+//! These macros are used inside the #am_hal_rtc_alarm_interval_set function
+//! when 10ms and 100ms repeated alarm intervals are desired.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_RTC_ALM100_DEFAULT           0x00
+#define AM_HAL_RTC_ALM100_10TH              0xF0
+#define AM_HAL_RTC_ALM100_100TH             0xFF
+//! @}
+
+//*****************************************************************************
+//
+//! @brief The basic time structure used by the HAL for RTC interaction.
+//!
+//! All values are positive whole numbers. The HAL routines convert back and
+//! forth to BCD.
+//
+//*****************************************************************************
+typedef struct am_hal_rtc_time_struct
+{
+    uint32_t ui32ReadError;
+    uint32_t ui32CenturyEnable;
+    uint32_t ui32Weekday;
+    uint32_t ui32Century;
+    uint32_t ui32Year;
+    uint32_t ui32Month;
+    uint32_t ui32DayOfMonth;
+    uint32_t ui32Hour;
+    uint32_t ui32Minute;
+    uint32_t ui32Second;
+    uint32_t ui32Hundredths;
+}am_hal_rtc_time_t;
+
+//*****************************************************************************
+//
+// External function definitions
+//
+//*****************************************************************************
+extern void am_hal_rtc_osc_select(uint32_t ui32OSC);
+extern void am_hal_rtc_osc_enable(void);
+extern void am_hal_rtc_osc_disable(void);
+extern void am_hal_rtc_time_12hour(bool b12Hour);
+extern void am_hal_rtc_time_set(am_hal_rtc_time_t *pTime);
+extern uint32_t am_hal_rtc_time_get(am_hal_rtc_time_t *pTime);
+extern void am_hal_rtc_alarm_interval_set(uint32_t ui32RepeatInterval);
+extern void am_hal_rtc_alarm_set(am_hal_rtc_time_t *pTime,
+                                 uint32_t ui32RepeatInterval);
+extern void am_hal_rtc_alarm_get(am_hal_rtc_time_t *pTime);
+extern void am_hal_rtc_int_enable(uint32_t ui32Interrupt);
+extern uint32_t am_hal_rtc_int_enable_get(void);
+extern void am_hal_rtc_int_disable(uint32_t ui32Interrupt);
+extern void am_hal_rtc_int_clear(uint32_t ui32Interrupt);
+extern void am_hal_rtc_int_set(uint32_t ui32Interrupt);
+extern uint32_t am_hal_rtc_int_status_get(bool bEnabledOnly);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_HAL_RTC_H
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_stimer.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_stimer.c
new file mode 100644
index 000000000..14311ed61
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_stimer.c
@@ -0,0 +1,525 @@
+//*****************************************************************************
+//
+//! @file am_hal_stimer.c
+//!
+//! @brief Functions for interfacing with the system timer (STIMER).
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup stimer System Timer (STIMER)
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "am_mcu_apollo.h"
+
+//*****************************************************************************
+//
+//! @brief Set up the stimer.
+//!
+//! @param ui32STimerConfig is the value to load into the configuration reg.
+//!
+//! This function should be used to perform the initial set-up of the
+//! stimer.
+//!
+//! @return The 32-bit current config of the STimer Config register
+//
+//*****************************************************************************
+uint32_t
+am_hal_stimer_config(uint32_t ui32STimerConfig)
+{
+    uint32_t ui32CurrVal;
+
+    //
+    // Read the current config
+    //
+    ui32CurrVal = AM_REG(CTIMER, STCFG);
+
+    //
+    // Write our configuration value.
+    //
+    AM_REG(CTIMER, STCFG) = ui32STimerConfig;
+
+    //
+    // If all of the clock sources are not HFRC, disable LDO when sleeping if timers are enabled.
+    //
+    if ( (AM_BFR(CTIMER, STCFG, CLKSEL) == AM_REG_CTIMER_STCFG_CLKSEL_HFRC_DIV16)   ||
+         (AM_BFR(CTIMER, STCFG, CLKSEL) == AM_REG_CTIMER_STCFG_CLKSEL_HFRC_DIV256) )
+    {
+        AM_BFW(PWRCTRL, MISCOPT, DIS_LDOLPMODE_TIMERS, 0);
+    }
+    else
+    {
+        AM_BFW(PWRCTRL, MISCOPT, DIS_LDOLPMODE_TIMERS, 1);
+    }
+    return ui32CurrVal;
+}
+
+//*****************************************************************************
+//
+//! @brief Get the current stimer value.
+//!
+//! This function can be used to read, uninvasively, the value in the stimer.
+//!
+//! @return The 32-bit value from the STimer counter register.
+//
+//*****************************************************************************
+uint32_t
+am_hal_stimer_counter_get(void)
+{
+    return AM_REG(CTIMER, STTMR);
+}
+
+//*****************************************************************************
+//
+//! @brief Clear the stimer counter.
+//!
+//! This function clears the STimer Counter and leaves the stimer running.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_stimer_counter_clear(void)
+{
+    //
+    // Set the clear bit
+    //
+    AM_REG(CTIMER, STCFG) |= AM_REG_CTIMER_STCFG_CLEAR_M;
+
+    //
+    // Reset the clear bit
+    //
+    AM_REG(CTIMER, STCFG) &= ~AM_REG_CTIMER_STCFG_CLEAR_M;
+}
+
+//*****************************************************************************
+//
+//! @brief Set the compare value.
+//!
+//! @param ui32CmprInstance is the compare register instance number (0-7).
+//! @param ui32Delta is the value to add to the STimer counter and load into
+//!        the comparator register.
+//!
+//! NOTE: There is no way to set an absolute value into a comparator register.
+//!       Only deltas added to the STimer counter can be written to the compare
+//!       registers.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_stimer_compare_delta_set(uint32_t ui32CmprInstance, uint32_t ui32Delta)
+{
+    if ( ui32CmprInstance > 7 )
+    {
+        return;
+    }
+
+    AM_REGVAL(AM_REG_STIMER_COMPARE(0, ui32CmprInstance)) = ui32Delta;
+}
+
+//*****************************************************************************
+//
+//! @brief Get the current stimer compare register value.
+//!
+//! @param ui32CmprInstance is the compare register instance number (0-7).
+//!
+//! This function can be used to read the value in an stimer compare register.
+//!
+//!
+//! @return None.
+//
+//*****************************************************************************
+uint32_t
+am_hal_stimer_compare_get(uint32_t ui32CmprInstance)
+{
+    if ( ui32CmprInstance > 7 )
+    {
+        return 0;
+    }
+
+    return AM_REGVAL(AM_REG_STIMER_COMPARE(0, ui32CmprInstance));
+}
+
+//*****************************************************************************
+//
+//! @brief Start capturing data with the specified capture register.
+//!
+//! @param ui32CaptureNum is the Capture Register Number to read (0-3).
+//!        ui32GPIONumber is the pin number.
+//!        bPolarity: false (0) = Capture on low to high transition.
+//!                   true  (1) = Capture on high to low transition.
+//!
+//! Use this function to start capturing.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_stimer_capture_start(uint32_t ui32CaptureNum,
+                            uint32_t ui32GPIONumber,
+                            bool bPolarity)
+{
+    uint32_t ui32CapCtrl;
+
+    if ( ui32GPIONumber > (AM_HAL_GPIO_MAX_PADS-1) )
+    {
+        return;
+    }
+
+    //
+    // Set the polarity and pin selection in the GPIO block.
+    //
+    switch (ui32CaptureNum)
+    {
+         case 0:
+            AM_BFW(GPIO, STMRCAP, STPOL0, bPolarity);
+            AM_BFW(GPIO, STMRCAP, STSEL0, ui32GPIONumber);
+            ui32CapCtrl = AM_REG_CTIMER_CAPTURE_CONTROL_CAPTURE_A_M;
+            break;
+         case 1:
+            AM_BFW(GPIO, STMRCAP, STPOL1, bPolarity);
+            AM_BFW(GPIO, STMRCAP, STSEL1, ui32GPIONumber);
+            ui32CapCtrl = AM_REG_CTIMER_CAPTURE_CONTROL_CAPTURE_B_M;
+            break;
+         case 2:
+            AM_BFW(GPIO, STMRCAP, STPOL2, bPolarity);
+            AM_BFW(GPIO, STMRCAP, STSEL2, ui32GPIONumber);
+            ui32CapCtrl = AM_REG_CTIMER_CAPTURE_CONTROL_CAPTURE_C_M;
+            break;
+         case 3:
+            AM_BFW(GPIO, STMRCAP, STPOL3, bPolarity);
+            AM_BFW(GPIO, STMRCAP, STSEL3, ui32GPIONumber);
+            ui32CapCtrl = AM_REG_CTIMER_CAPTURE_CONTROL_CAPTURE_D_M;
+            break;
+         default:
+            return;     // error concealment.
+    }
+
+    //
+    // Enable it in the CTIMER Block
+    //
+    AM_REG(CTIMER, CAPTURE_CONTROL) |= ui32CapCtrl;
+}
+
+//*****************************************************************************
+//
+//! @brief Start capturing data with the specified capture register.
+//!
+//! @param ui32CaptureNum is the Capture Register Number to read.
+//!
+//! Use this function to start capturing.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void am_hal_stimer_capture_stop(uint32_t ui32CaptureNum)
+{
+    //
+    // Disable it in the CTIMER block.
+    //
+    AM_REG(CTIMER, CAPTURE_CONTROL) &=
+        ~(AM_REG_CTIMER_CAPTURE_CONTROL_CAPTURE_A_M <<
+            ((AM_REG_CTIMER_CAPTURE_CONTROL_CAPTURE_B_S -
+              AM_REG_CTIMER_CAPTURE_CONTROL_CAPTURE_A_S) * ui32CaptureNum));
+}
+
+//*****************************************************************************
+//
+//! @brief Get the current stimer capture register value.
+//!
+//! @param ui32CaptureNum is the Capture Register Number to read.
+//!
+//! This function can be used to read the value in an stimer capture register.
+//!
+//!
+//! @return None.
+//
+//*****************************************************************************
+uint32_t am_hal_stimer_capture_get(uint32_t ui32CaptureNum)
+{
+    if ( ui32CaptureNum > 7 )
+    {
+        return 0;
+    }
+
+    return AM_REGVAL(AM_REG_STIMER_CAPTURE(0, ui32CaptureNum));
+}
+
+//*****************************************************************************
+//
+//! @brief Enables the selected system timer interrupt.
+//!
+//! @param ui32Interrupt is the interrupt to be used.
+//!
+//! This function will enable the selected interrupts in the STIMER interrupt
+//! enable register. In order to receive an interrupt from an stimer component,
+//! you will need to enable the interrupt for that component in this main
+//! register, as well as in the stimer configuration register (accessible though
+//! am_hal_stimer_config()), and in the NVIC.
+//!
+//! ui32Interrupt should be the logical OR of one or more of the following
+//! values:
+//!
+//!     AM_HAL_STIMER_INT_COMPAREA
+//!     AM_HAL_STIMER_INT_COMPAREB
+//!     AM_HAL_STIMER_INT_COMPAREC
+//!     AM_HAL_STIMER_INT_COMPARED
+//!     AM_HAL_STIMER_INT_COMPAREE
+//!     AM_HAL_STIMER_INT_COMPAREF
+//!     AM_HAL_STIMER_INT_COMPAREG
+//!     AM_HAL_STIMER_INT_COMPAREH
+//!
+//!     AM_HAL_STIMER_INT_OVERFLOW
+//!
+//!     AM_HAL_STIMER_INT_CAPTUREA
+//!     AM_HAL_STIMER_INT_CAPTUREB
+//!     AM_HAL_STIMER_INT_CAPTUREC
+//!     AM_HAL_STIMER_INT_CAPTURED
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_stimer_int_enable(uint32_t ui32Interrupt)
+{
+    //
+    // Enable the interrupt at the module level.
+    //
+    AM_REGn(CTIMER, 0, STMINTEN) |= ui32Interrupt;
+}
+
+//*****************************************************************************
+//
+//! @brief Return the enabled stimer interrupts.
+//!
+//! This function will return all enabled interrupts in the STIMER
+//! interrupt enable register.
+//!
+//! @return return enabled interrupts. This will be a logical or of:
+//!
+//!     AM_HAL_STIMER_INT_COMPAREA
+//!     AM_HAL_STIMER_INT_COMPAREB
+//!     AM_HAL_STIMER_INT_COMPAREC
+//!     AM_HAL_STIMER_INT_COMPARED
+//!     AM_HAL_STIMER_INT_COMPAREE
+//!     AM_HAL_STIMER_INT_COMPAREF
+//!     AM_HAL_STIMER_INT_COMPAREG
+//!     AM_HAL_STIMER_INT_COMPAREH
+//!
+//!     AM_HAL_STIMER_INT_OVERFLOW
+//!
+//!     AM_HAL_STIMER_INT_CAPTUREA
+//!     AM_HAL_STIMER_INT_CAPTUREB
+//!     AM_HAL_STIMER_INT_CAPTUREC
+//!     AM_HAL_STIMER_INT_CAPTURED
+//!
+//! @return Return the enabled timer interrupts.
+//
+//*****************************************************************************
+uint32_t
+am_hal_stimer_int_enable_get(void)
+{
+    //
+    // Return enabled interrupts.
+    //
+    return AM_REGn(CTIMER, 0, STMINTEN);
+}
+
+//*****************************************************************************
+//
+//! @brief Disables the selected stimer interrupt.
+//!
+//! @param ui32Interrupt is the interrupt to be used.
+//!
+//! This function will disable the selected interrupts in the STIMER
+//! interrupt register.
+//!
+//! ui32Interrupt should be the logical OR of one or more of the following
+//! values:
+//!
+//!     AM_HAL_STIMER_INT_COMPAREA
+//!     AM_HAL_STIMER_INT_COMPAREB
+//!     AM_HAL_STIMER_INT_COMPAREC
+//!     AM_HAL_STIMER_INT_COMPARED
+//!     AM_HAL_STIMER_INT_COMPAREE
+//!     AM_HAL_STIMER_INT_COMPAREF
+//!     AM_HAL_STIMER_INT_COMPAREG
+//!     AM_HAL_STIMER_INT_COMPAREH
+//!
+//!     AM_HAL_STIMER_INT_OVERFLOW
+//!
+//!     AM_HAL_STIMER_INT_CAPTUREA
+//!     AM_HAL_STIMER_INT_CAPTUREB
+//!     AM_HAL_STIMER_INT_CAPTUREC
+//!     AM_HAL_STIMER_INT_CAPTURED
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_stimer_int_disable(uint32_t ui32Interrupt)
+{
+    //
+    // Disable the interrupt at the module level.
+    //
+    AM_REGn(CTIMER, 0, STMINTEN) &= ~ui32Interrupt;
+}
+
+//*****************************************************************************
+//
+//! @brief Sets the selected stimer interrupt.
+//!
+//! @param ui32Interrupt is the interrupt to be used.
+//!
+//! This function will set the selected interrupts in the STIMER
+//! interrupt register.
+//!
+//! ui32Interrupt should be the logical OR of one or more of the following
+//! values:
+//!
+//!     AM_HAL_STIMER_INT_COMPAREA
+//!     AM_HAL_STIMER_INT_COMPAREB
+//!     AM_HAL_STIMER_INT_COMPAREC
+//!     AM_HAL_STIMER_INT_COMPARED
+//!     AM_HAL_STIMER_INT_COMPAREE
+//!     AM_HAL_STIMER_INT_COMPAREF
+//!     AM_HAL_STIMER_INT_COMPAREG
+//!     AM_HAL_STIMER_INT_COMPAREH
+//!
+//!     AM_HAL_STIMER_INT_OVERFLOW
+//!
+//!     AM_HAL_STIMER_INT_CAPTUREA
+//!     AM_HAL_STIMER_INT_CAPTUREB
+//!     AM_HAL_STIMER_INT_CAPTUREC
+//!     AM_HAL_STIMER_INT_CAPTURED
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_stimer_int_set(uint32_t ui32Interrupt)
+{
+    //
+    // Set the interrupts.
+    //
+    AM_REGn(CTIMER, 0, STMINTSET) = ui32Interrupt;
+}
+
+//*****************************************************************************
+//
+//! @brief Clears the selected stimer interrupt.
+//!
+//! @param ui32Interrupt is the interrupt to be used.
+//!
+//! This function will clear the selected interrupts in the STIMER
+//! interrupt register.
+//!
+//! ui32Interrupt should be the logical OR of one or more of the following
+//! values:
+//!
+//!     AM_HAL_STIMER_INT_COMPAREA
+//!     AM_HAL_STIMER_INT_COMPAREB
+//!     AM_HAL_STIMER_INT_COMPAREC
+//!     AM_HAL_STIMER_INT_COMPARED
+//!     AM_HAL_STIMER_INT_COMPAREE
+//!     AM_HAL_STIMER_INT_COMPAREF
+//!     AM_HAL_STIMER_INT_COMPAREG
+//!     AM_HAL_STIMER_INT_COMPAREH
+//!
+//!     AM_HAL_STIMER_INT_OVERFLOW
+//!
+//!     AM_HAL_STIMER_INT_CAPTUREA
+//!     AM_HAL_STIMER_INT_CAPTUREB
+//!     AM_HAL_STIMER_INT_CAPTUREC
+//!     AM_HAL_STIMER_INT_CAPTURED
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_stimer_int_clear(uint32_t ui32Interrupt)
+{
+    //
+    // Disable the interrupt at the module level.
+    //
+    AM_REGn(CTIMER, 0, STMINTCLR) = ui32Interrupt;
+}
+
+
+//*****************************************************************************
+//
+//! @brief Returns either the enabled or raw stimer interrupt status.
+//!
+//! This function will return the stimer interrupt status.
+//!
+//! @bEnabledOnly if true returns the status of the enabled interrupts
+//! only.
+//!
+//! The return value will be the logical OR of one or more of the following
+//! values:
+//!
+//!
+//! @return Returns the stimer interrupt status.
+//
+//*****************************************************************************
+uint32_t
+am_hal_stimer_int_status_get(bool bEnabledOnly)
+{
+    //
+    // Return the desired status.
+    //
+    uint32_t ui32RetVal = AM_REGn(CTIMER, 0, STMINTSTAT);
+
+    if ( bEnabledOnly )
+    {
+        ui32RetVal &= AM_REGn(CTIMER, 0, STMINTEN);
+    }
+
+    return ui32RetVal;
+}
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_stimer.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_stimer.h
new file mode 100644
index 000000000..45ad54a8a
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_stimer.h
@@ -0,0 +1,242 @@
+//*****************************************************************************
+//
+//! @file am_hal_stimer.h
+//!
+//! @brief Functions for accessing and configuring the STIMER.
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup stimer Counter/Timer (STIMER)
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_HAL_STIMER_H
+#define AM_HAL_STIMER_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+//
+// Compute address of a given COMPARE or CAPTURE register.
+// Note - For Apollo2, the parameter n should be 0 (as only 1 stimer module
+//        exists) and the parameter r should be 0-7 (compare) or 0-3 (capture).
+//
+#define AM_REG_STIMER_COMPARE(n, r) (AM_REG_CTIMERn(n) +                \
+                                     AM_REG_CTIMER_SCMPR0_O + (r * 4))
+
+#define AM_REG_STIMER_CAPTURE(n, r) (AM_REG_CTIMERn(n) +                \
+                                     AM_REG_CTIMER_SCAPT0_O + (r * 4))
+
+//*****************************************************************************
+//
+//! @name Interrupt Status Bits
+//! @brief Interrupt Status Bits for enable/disble use
+//!
+//! These macros may be used to set and clear interrupt bits
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_STIMER_INT_COMPAREA         AM_REG_CTIMER_STMINTSTAT_COMPAREA_M
+#define AM_HAL_STIMER_INT_COMPAREB         AM_REG_CTIMER_STMINTSTAT_COMPAREB_M
+#define AM_HAL_STIMER_INT_COMPAREC         AM_REG_CTIMER_STMINTSTAT_COMPAREC_M
+#define AM_HAL_STIMER_INT_COMPARED         AM_REG_CTIMER_STMINTSTAT_COMPARED_M
+#define AM_HAL_STIMER_INT_COMPAREE         AM_REG_CTIMER_STMINTSTAT_COMPAREE_M
+#define AM_HAL_STIMER_INT_COMPAREF         AM_REG_CTIMER_STMINTSTAT_COMPAREF_M
+#define AM_HAL_STIMER_INT_COMPAREG         AM_REG_CTIMER_STMINTSTAT_COMPAREG_M
+#define AM_HAL_STIMER_INT_COMPAREH         AM_REG_CTIMER_STMINTSTAT_COMPAREH_M
+
+#define AM_HAL_STIMER_INT_OVERFLOW         AM_REG_CTIMER_STMINTSTAT_OVERFLOW_M
+
+#define AM_HAL_STIMER_INT_CAPTUREA         AM_REG_CTIMER_STMINTSTAT_CAPTUREA_M
+#define AM_HAL_STIMER_INT_CAPTUREB         AM_REG_CTIMER_STMINTSTAT_CAPTUREB_M
+#define AM_HAL_STIMER_INT_CAPTUREC         AM_REG_CTIMER_STMINTSTAT_CAPTUREC_M
+#define AM_HAL_STIMER_INT_CAPTURED         AM_REG_CTIMER_STMINTSTAT_CAPTURED_M
+
+//! @}
+
+
+
+//*****************************************************************************
+//
+//! @name STimer Configuration Bits
+//! @brief Interrupt Status Bits for enable/disble use
+//!
+//! These macros may be used to set and clear interrupt bits
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_STIMER_CFG_THAW                                                \
+                                                AM_REG_CTIMER_STCFG_FREEZE_THAW
+#define AM_HAL_STIMER_CFG_FREEZE                                              \
+                                              AM_REG_CTIMER_STCFG_FREEZE_FREEZE
+#define AM_HAL_STIMER_CFG_RUN                                                 \
+                                                  AM_REG_CTIMER_STCFG_CLEAR_RUN
+#define AM_HAL_STIMER_CFG_CLEAR                                               \
+                                                AM_REG_CTIMER_STCFG_CLEAR_CLEAR
+#define AM_HAL_STIMER_CFG_COMPARE_A_ENABLE                                    \
+                                        AM_REG_CTIMER_STCFG_COMPARE_A_EN_ENABLE
+#define AM_HAL_STIMER_CFG_COMPARE_B_ENABLE                                    \
+                                        AM_REG_CTIMER_STCFG_COMPARE_B_EN_ENABLE
+#define AM_HAL_STIMER_CFG_COMPARE_C_ENABLE                                    \
+                                        AM_REG_CTIMER_STCFG_COMPARE_C_EN_ENABLE
+#define AM_HAL_STIMER_CFG_COMPARE_D_ENABLE                                    \
+                                        AM_REG_CTIMER_STCFG_COMPARE_D_EN_ENABLE
+#define AM_HAL_STIMER_CFG_COMPARE_E_ENABLE                                    \
+                                        AM_REG_CTIMER_STCFG_COMPARE_E_EN_ENABLE
+#define AM_HAL_STIMER_CFG_COMPARE_F_ENABLE                                    \
+                                        AM_REG_CTIMER_STCFG_COMPARE_F_EN_ENABLE
+#define AM_HAL_STIMER_CFG_COMPARE_G_ENABLE                                    \
+                                        AM_REG_CTIMER_STCFG_COMPARE_G_EN_ENABLE
+#define AM_HAL_STIMER_CFG_COMPARE_H_ENABLE                                    \
+                                        AM_REG_CTIMER_STCFG_COMPARE_H_EN_ENABLE
+
+//! @}
+
+//*****************************************************************************
+//
+//! @name Clock Configuration options
+//! @brief STimer Configuration register options.
+//!
+//! These options are to be used with the am_hal_stimer_config() function.
+//!  @{
+//
+//*****************************************************************************
+#define AM_HAL_STIMER_NO_CLK                                                  \
+              AM_REG_CTIMER_STCFG_CLKSEL(AM_REG_CTIMER_STCFG_CLKSEL_NOCLK)
+#define AM_HAL_STIMER_HFRC_3MHZ                                               \
+              AM_REG_CTIMER_STCFG_CLKSEL(AM_REG_CTIMER_STCFG_CLKSEL_HFRC_DIV16)
+#define AM_HAL_STIMER_HFRC_187_5KHZ                                           \
+              AM_REG_CTIMER_STCFG_CLKSEL(AM_REG_CTIMER_STCFG_CLKSEL_HFRC_DIV256)
+#define AM_HAL_STIMER_XTAL_32KHZ                                              \
+              AM_REG_CTIMER_STCFG_CLKSEL(AM_REG_CTIMER_STCFG_CLKSEL_XTAL_DIV1)
+#define AM_HAL_STIMER_XTAL_16KHZ                                              \
+              AM_REG_CTIMER_STCFG_CLKSEL(AM_REG_CTIMER_STCFG_CLKSEL_XTAL_DIV2)
+#define AM_HAL_STIMER_XTAL_1KHZ                                               \
+              AM_REG_CTIMER_STCFG_CLKSEL(AM_REG_CTIMER_STCFG_CLKSEL_XTAL_DIV32)
+#define AM_HAL_STIMER_LFRC_1KHZ                                               \
+              AM_REG_CTIMER_STCFG_CLKSEL(AM_REG_CTIMER_STCFG_CLKSEL_LFRC_DIV1)
+#define AM_HAL_STIMER_HFRC_CTIMER0A                                           \
+              AM_REG_CTIMER_STCFG_CLKSEL(AM_REG_CTIMER_STCFG_CLKSEL_CTIMER0A)
+#define AM_HAL_STIMER_HFRC_CTIMER0B                                           \
+              AM_REG_CTIMER_STCFG_CLKSEL(AM_REG_CTIMER_STCFG_CLKSEL_CTIMER0B)
+//! @}
+
+
+
+//*****************************************************************************
+//
+//! @name Capture Control Register options.
+//! @brief Configuration options for capture control register.
+//!
+//! These options are to be used with the am_hal_stimer_capture_control_set
+//! function.
+//!  @{
+//
+//*****************************************************************************
+#define AM_HAL_STIMER_CAPTURE_A_ENABLE                                        \
+                                 AM_REG_CTIMER_CAPTURE_CONTROL_CAPTURE_A_ENABLE
+#define AM_HAL_STIMER_CAPTURE_B_ENABLE                                        \
+                                 AM_REG_CTIMER_CAPTURE_CONTROL_CAPTURE_B_ENABLE
+#define AM_HAL_STIMER_CAPTURE_C_ENABLE                                        \
+                                 AM_REG_CTIMER_CAPTURE_CONTROL_CAPTURE_C_ENABLE
+#define AM_HAL_STIMER_CAPTURE_D_ENABLE                                        \
+                                 AM_REG_CTIMER_CAPTURE_CONTROL_CAPTURE_D_ENABLE
+
+//! @}
+
+
+//*****************************************************************************
+//
+//
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Stimer configuration structure
+//
+//*****************************************************************************
+typedef struct
+{
+    //
+    //! Configuration options for the STIMER
+    //
+    uint32_t ui32STimerConfig;
+}
+am_hal_stimer_config_t;
+
+
+
+//*****************************************************************************
+//
+// External function definitions
+//
+//*****************************************************************************
+extern uint32_t am_hal_stimer_config(uint32_t ui32STimerConfig);
+extern uint32_t am_hal_stimer_counter_get(void);
+extern void     am_hal_stimer_counter_clear(void);
+extern void     am_hal_stimer_compare_delta_set(uint32_t ui32CmprInstance,
+                                                uint32_t ui32Delta);
+extern uint32_t am_hal_stimer_compare_get(uint32_t ui32CmprInstance);
+extern void     am_hal_stimer_capture_start(uint32_t ui32CaptureNum,
+                                            uint32_t ui32GPIONumber,
+                                            bool bPolarity);
+extern void     am_hal_stimer_capture_stop(uint32_t ui32CaptureNum);
+extern uint32_t am_hal_stimer_capture_get(uint32_t ui32CaptureNum);
+extern void     am_hal_stimer_int_enable(uint32_t ui32Interrupt);
+extern uint32_t am_hal_stimer_int_enable_get(void);
+extern void     am_hal_stimer_int_disable(uint32_t ui32Interrupt);
+extern void     am_hal_stimer_int_set(uint32_t ui32Interrupt);
+extern void     am_hal_stimer_int_clear(uint32_t ui32Interrupt);
+extern uint32_t am_hal_stimer_int_status_get(bool bEnabledOnly);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_HAL_STIMER_H
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_sysctrl.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_sysctrl.c
new file mode 100644
index 000000000..ed16e8d03
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_sysctrl.c
@@ -0,0 +1,291 @@
+//*****************************************************************************
+//
+//! @file am_hal_sysctrl.c
+//!
+//! @brief Functions for interfacing with the M4F system control registers
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup sysctrl System Control (SYSCTRL)
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "am_mcu_apollo.h"
+
+//*****************************************************************************
+//
+//  Determine if Apollo2 A revision.
+//
+//  Note - this function is intended to be temporary until Apollo2 revA chips
+//  are no longer relevant.
+//
+//*****************************************************************************
+static bool
+isRevA(void)
+{
+    return AM_BFM(MCUCTRL, CHIPREV, REVMAJ) == AM_REG_MCUCTRL_CHIPREV_REVMAJ_A ?
+            true : false;
+}
+
+//*****************************************************************************
+//
+//! @brief Place the core into sleep or deepsleep.
+//!
+//! @param bSleepDeep - False for Normal or True Deep sleep.
+//!
+//! This function puts the MCU to sleep or deepsleep depending on bSleepDeep.
+//!
+//! Valid values for bSleepDeep are:
+//!
+//!     AM_HAL_SYSCTRL_SLEEP_NORMAL
+//!     AM_HAL_SYSCTRL_SLEEP_DEEP
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_sysctrl_sleep(bool bSleepDeep)
+{
+    uint32_t ui32Critical;
+    uint32_t ui32CoreBuckEn, ui32MemBuckEn;
+
+    //
+    // Disable interrupts and save the previous interrupt state.
+    //
+    ui32Critical = am_hal_interrupt_master_disable();
+
+    //
+    // If the user selected DEEPSLEEP and the TPIU is off, attempt to enter
+    // DEEP SLEEP.
+    //
+    if ((bSleepDeep == AM_HAL_SYSCTRL_SLEEP_DEEP) &&
+        (AM_BFM(MCUCTRL, TPIUCTRL, ENABLE) == AM_REG_MCUCTRL_TPIUCTRL_ENABLE_DIS))
+    {
+        //
+        // Prepare the core for deepsleep (write 1 to the DEEPSLEEP bit).
+        //
+        AM_BFW(SYSCTRL, SCR, SLEEPDEEP, 1);
+
+        if (isRevA())
+        {
+            //
+            // Workaround for an issue with RevA buck-converter sleep behavior.
+            // Save the buck enable registers, and then turn them off.
+            //
+            ui32CoreBuckEn = AM_BFR(PWRCTRL, SUPPLYSRC, COREBUCKEN);
+            ui32MemBuckEn = AM_BFR(PWRCTRL, SUPPLYSRC, MEMBUCKEN);
+            am_hal_mcuctrl_bucks_disable();
+        }
+        else
+        {
+            ui32CoreBuckEn = ui32MemBuckEn = 0;
+        }
+
+        //
+        // Execute the sleep instruction.
+        //
+        AM_ASM_WFI;
+
+        //
+        // Return from sleep
+        //
+        if (isRevA())
+        {
+            //
+            // Workaround for an issue with RevA buck-converter sleep behavior.
+            // If the bucks were on when this function was called, turn them
+            // back on now.
+            //
+            if (ui32CoreBuckEn || ui32MemBuckEn)
+            {
+                am_hal_mcuctrl_bucks_enable();
+            }
+        }
+    }
+    else
+    {
+        //
+        // Prepare the core for normal sleep (write 0 to the DEEPSLEEP bit).
+        //
+        AM_BFW(SYSCTRL, SCR, SLEEPDEEP, 0);
+
+        //
+        // Go to sleep.
+        //
+        AM_ASM_WFI;
+    }
+
+    //
+    // Restore the interrupt state.
+    //
+    am_hal_interrupt_master_set(ui32Critical);
+}
+
+//*****************************************************************************
+//
+//! @brief Enable the floating point module.
+//!
+//! Call this function to enable the ARM hardware floating point module.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_sysctrl_fpu_enable(void)
+{
+    //
+    // Enable access to the FPU in both privileged and user modes.
+    // NOTE: Write 0s to all reserved fields in this register.
+    //
+    AM_REG(SYSCTRL, CPACR) = (AM_REG_SYSCTRL_CPACR_CP11(0x3) |
+                             AM_REG_SYSCTRL_CPACR_CP10(0x3));
+}
+
+//*****************************************************************************
+//
+//! @brief Disable the floating point module.
+//!
+//! Call this function to disable the ARM hardware floating point module.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_sysctrl_fpu_disable(void)
+{
+    //
+    // Disable access to the FPU in both privileged and user modes.
+    // NOTE: Write 0s to all reserved fields in this register.
+    //
+    AM_REG(SYSCTRL, CPACR) = 0x00000000                     &
+                          ~(AM_REG_SYSCTRL_CPACR_CP11(0x3) |
+                            AM_REG_SYSCTRL_CPACR_CP10(0x3));
+}
+
+//*****************************************************************************
+//
+//! @brief Enable stacking of FPU registers on exception entry.
+//!
+//! @param bLazy - Set to "true" to enable "lazy stacking".
+//!
+//! This function allows the core to save floating-point information to the
+//! stack on exception entry. Setting the bLazy option enables "lazy stacking"
+//! for interrupt handlers.  Normally, mixing floating-point code and interrupt
+//! driven routines causes increased interrupt latency, because the core must
+//! save extra information to the stack upon exception entry. With the lazy
+//! stacking option enabled, the core will skip the saving of floating-point
+//! registers when possible, reducing average interrupt latency.
+//!
+//! @note This function should be called before the floating-point module is
+//! used in interrupt-driven code. If it is not called, the core will not have
+//! any way to save context information for floating-point variables on
+//! exception entry.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_sysctrl_fpu_stacking_enable(bool bLazy)
+{
+    if ( bLazy )
+    {
+        //
+        // Enable automatic saving of FPU registers on exception entry, using lazy
+        // context saving.
+        //
+        AM_REG(SYSCTRL, FPCCR) |= (AM_REG_SYSCTRL_FPCCR_ASPEN(0x1) |
+                                   AM_REG_SYSCTRL_FPCCR_LSPEN(0x1));
+    }
+    else
+    {
+        //
+        // Enable automatic saving of FPU registers on exception entry.
+        //
+        AM_REG(SYSCTRL, FPCCR) |= AM_REG_SYSCTRL_FPCCR_ASPEN(0x1);
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Disable FPU register stacking on exception entry.
+//!
+//! This function disables all stacking of floating point registers for
+//! interrupt handlers.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_sysctrl_fpu_stacking_disable(void)
+{
+    //
+    // Enable automatic saving of FPU registers on exception entry, using lazy
+    // context saving.
+    //
+    AM_REG(SYSCTRL, FPCCR) &= ~(AM_REG_SYSCTRL_FPCCR_ASPEN(0x1) |
+                                AM_REG_SYSCTRL_FPCCR_LSPEN(0x1));
+}
+
+//*****************************************************************************
+//
+//! @brief Issue a system wide reset using the AIRCR bit in the M4 system ctrl.
+//!
+//! This function issues a system wide reset (Apollo POR level reset).
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_sysctrl_aircr_reset(void)
+{
+    //
+    // Set the system reset bit in the AIRCR register
+    //
+    AM_REG(SYSCTRL, AIRCR) = AM_REG_SYSCTRL_AIRCR_VECTKEY(0x5FA) |
+                             AM_REG_SYSCTRL_AIRCR_SYSRESETREQ(1);
+}
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_sysctrl.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_sysctrl.h
new file mode 100644
index 000000000..078432f44
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_sysctrl.h
@@ -0,0 +1,87 @@
+//*****************************************************************************
+//
+//! @file am_hal_sysctrl.h
+//!
+//! @brief Functions for interfacing with the M4F system control registers
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup sysctrl System Control (SYSCTRL)
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_HAL_SYSCTRL_H
+#define AM_HAL_SYSCTRL_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+//*****************************************************************************
+//
+// Definitions for sleep mode parameter
+//
+//*****************************************************************************
+#define AM_HAL_SYSCTRL_SLEEP_DEEP       true
+#define AM_HAL_SYSCTRL_SLEEP_NORMAL     false
+
+//*****************************************************************************
+//
+// External function definitions
+//
+//*****************************************************************************
+extern void am_hal_sysctrl_sleep(bool bSleepDeep);
+extern void am_hal_sysctrl_fpu_enable(void);
+extern void am_hal_sysctrl_fpu_disable(void);
+extern void am_hal_sysctrl_fpu_stacking_enable(bool bLazy);
+extern void am_hal_sysctrl_fpu_stacking_disable(void);
+extern void am_hal_sysctrl_aircr_reset(void);
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_HAL_SYSCTRL_H
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
+
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_systick.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_systick.c
new file mode 100644
index 000000000..b56703255
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_systick.c
@@ -0,0 +1,453 @@
+//*****************************************************************************
+//
+//! @file am_hal_systick.c
+//!
+//! @brief Functions for interfacing with the SYSTICK
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup systick System Timer (SYSTICK)
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "am_mcu_apollo.h"
+
+
+//*****************************************************************************
+//
+// Macro definitions
+//
+//*****************************************************************************
+#define SYSTICK_MAX_TICKS   ((1 << 24)-1)
+#define MAX_U32             (0xffffffff)
+
+//*****************************************************************************
+//
+//! @brief Start the SYSTICK.
+//!
+//! This function starts the systick timer.
+//!
+//! @note This timer does not run in deep-sleep mode as it runs from the core
+//! clock, which is gated in deep-sleep. If a timer is needed in deep-sleep use
+//! one of the ctimers instead. Also to note is this timer will consume higher
+//! power than the ctimers.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_systick_start(void)
+{
+    //
+    // Start the systick timer.
+    //
+    AM_REG(SYSTICK, SYSTCSR) |= AM_REG_SYSTICK_SYSTCSR_ENABLE_M;
+}
+
+//*****************************************************************************
+//
+//! @brief Stop the SYSTICK.
+//!
+//! This function stops the systick timer.
+//!
+//! @note This timer does not run in deep-sleep mode as it runs from the core
+//! clock, which is gated in deep-sleep. If a timer is needed in deep-sleep use
+//! one of the ctimers instead. Also to note is this timer will consume higher
+//! power than the ctimers.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_systick_stop(void)
+{
+    //
+    // Stop the systick timer.
+    //
+    AM_REG(SYSTICK, SYSTCSR) &= ~AM_REG_SYSTICK_SYSTCSR_ENABLE_M;
+}
+
+//*****************************************************************************
+//
+//! @brief Enable the interrupt in the SYSTICK.
+//!
+//! This function enables the interupt in the systick timer.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_systick_int_enable(void)
+{
+    //
+    // Enable the systick timer interrupt.
+    //
+    AM_REG(SYSTICK, SYSTCSR) |= AM_REG_SYSTICK_SYSTCSR_TICKINT_M;
+}
+
+//*****************************************************************************
+//
+//! @brief Disable the interrupt in the SYSTICK.
+//!
+//! This function disables the interupt in the systick timer.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_systick_int_disable(void)
+{
+    //
+    // Disable the systick timer interrupt.
+    //
+    AM_REG(SYSTICK, SYSTCSR) &= ~AM_REG_SYSTICK_SYSTCSR_TICKINT_M;
+}
+
+//*****************************************************************************
+//
+//! @brief Reads the interrupt status.
+//!
+//! This function reads the interrupt status in the systick timer.
+//!
+//! @return the interrupt status.
+//
+//*****************************************************************************
+uint32_t
+am_hal_systick_int_status_get(void)
+{
+    //
+    // Return the systick timer interrupt status.
+    //
+    return AM_REG(SYSTICK, SYSTCSR) & AM_REG_SYSTICK_SYSTCSR_COUNTFLAG_M;
+}
+
+//*****************************************************************************
+//
+//! @brief Reset the interrupt in the SYSTICK.
+//!
+//! This function resets the systick timer by clearing out the configuration
+//! register.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_systick_reset(void)
+{
+    //
+    // Reset the systick timer interrupt.
+    //
+    AM_REG(SYSTICK, SYSTCSR) = 0x0;
+}
+
+//*****************************************************************************
+//
+//! @brief Load the value into the SYSTICK.
+//!
+//! @param ui32LoadVal the desired load value for the systick. Maximum value is
+//! 0x00FF.FFFF.
+//!
+//! This function loads the desired value into the systick timer.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_systick_load(uint32_t ui32LoadVal)
+{
+    //
+    // Write the reload register.
+    //
+    AM_REG(SYSTICK, SYSTRVR) = ui32LoadVal;
+}
+
+//*****************************************************************************
+//
+//! @brief Get the current count value in the SYSTICK.
+//!
+//! This function gets the current count value in the systick timer.
+//!
+//! @return Current count value.
+//
+//*****************************************************************************
+uint32_t
+am_hal_systick_count(void)
+{
+    //
+    // Return the current systick timer count value.
+    //
+    return AM_REG(SYSTICK, SYSTCVR);
+}
+
+//*****************************************************************************
+//
+//! @brief Wait the specified number of ticks.
+//!
+//! This function delays for the given number of SysTick ticks.
+//!
+//! @note If the SysTick timer is being used elsewhere, it will be corrupted
+//! by calling this function.
+//!
+//! @return 0 if successful.
+//
+//*****************************************************************************
+uint32_t
+am_hal_systick_wait_ticks(uint32_t u32Ticks)
+{
+
+    if ( u32Ticks == 0 )
+    {
+        u32Ticks++;                 // Make sure we get the COUNTFLAG
+    }
+
+    //
+    //  The proper SysTick initialization sequence is: (p 4-36 of the M4 UG).
+    //      1. Program reload value
+    //      2. Clear current value
+    //      3. Program CSR
+    //
+    // Set the reload value to the required number of ticks.
+    //
+    AM_REG(SYSTICK, SYSTRVR) = u32Ticks;
+
+    //
+    // Clear the current count.
+    //
+    AM_REG(SYSTICK, SYSTCVR) = 0x0;
+
+    //
+    // Set to use the processor clock, but don't cause an exception (we'll poll).
+    //
+    AM_REG(SYSTICK, SYSTCSR) = AM_REG_SYSTICK_SYSTCSR_ENABLE_M;
+
+    //
+    // Poll till done
+    //
+    while ( !(AM_REG(SYSTICK, SYSTCSR) & AM_REG_SYSTICK_SYSTCSR_COUNTFLAG_M) );
+
+    //
+    // And disable systick before exiting.
+    //
+    AM_REG(SYSTICK, SYSTCSR) = 0;
+
+    return 0;
+}
+
+//*****************************************************************************
+//
+//! @brief Delay the specified number of microseconds.
+//!
+//! This function will use the SysTick timer to delay until the specified
+//!  number of microseconds have elapsed.  It uses the processor clocks and
+//!  takes into account the current CORESEL setting.
+//!
+//! @note If the SysTick timer is being used elsewhere, it will be corrupted
+//! by calling this function.
+//!
+//! @return Total number of SysTick ticks delayed.
+//
+//*****************************************************************************
+uint32_t
+am_hal_systick_delay_us(uint32_t u32NumUs)
+{
+    uint32_t u32ClkFreq, u32nLoops, u32Ticks, uRet;
+    uint32_t u32CoreSel = AM_BFR(CLKGEN, CCTRL, CORESEL);
+
+    u32nLoops = 1;
+    switch (u32CoreSel)
+    {
+        //
+        // We need to compute the required number of ticks.  To do so and to
+        //   minimize divide operations, we'll use the following equation:
+        // u32Ticks = (u32NumUs * HFCR_EXACT)/1000000
+        //          = (u32NumUs * (HFCR_EXACT * 1024)/1000000) / 1024
+        // The values for the variable u32ClkFreq are computed as follows:
+        //  u32ClkFreq = (24390200 * 1024) / ((clksel+1)*1000000);
+        //  (and we'll do the remaining divide by 1024, using a shift, later).
+        //
+        case 0:
+            u32ClkFreq = 24975;
+            if ( u32NumUs > ((SYSTICK_MAX_TICKS / 24975)*1024) )
+            {
+                u32nLoops = (u32NumUs / ((SYSTICK_MAX_TICKS / 24975)*1024)) + 1;
+                u32NumUs /= u32nLoops;
+            }
+            if ( u32NumUs > (MAX_U32 / 24975) )
+            {
+                u32Ticks = (u32NumUs >> 10) * u32ClkFreq;
+            }
+            else
+            {
+                u32Ticks = (u32NumUs * u32ClkFreq) >> 10;
+            }
+            break;
+        case 1:
+            u32ClkFreq = 12487;
+            if ( u32NumUs > ((SYSTICK_MAX_TICKS / 12487)*1024) )
+            {
+                u32nLoops = (u32NumUs / ((SYSTICK_MAX_TICKS / 12487)*1024)) + 1;
+                u32NumUs /= u32nLoops;
+            }
+            if ( u32NumUs > (MAX_U32 / 12487) )
+            {
+                u32Ticks = (u32NumUs >> 10) * u32ClkFreq;
+            }
+            else
+            {
+                u32Ticks = (u32NumUs * u32ClkFreq) >> 10;
+            }
+            break;
+        case 2:
+            u32ClkFreq = 8325;
+            if ( u32NumUs > ((SYSTICK_MAX_TICKS / 8325)*1024) )
+            {
+                u32nLoops = (u32NumUs / ((SYSTICK_MAX_TICKS / 8325)*1024)) + 1;
+                u32NumUs /= u32nLoops;
+            }
+            if ( u32NumUs > (MAX_U32 / 8325) )
+            {
+                u32Ticks = (u32NumUs >> 10) * u32ClkFreq;
+            }
+            else
+            {
+                u32Ticks = (u32NumUs * u32ClkFreq) >> 10;
+            }
+            break;
+        case 3:
+            u32ClkFreq = 6243;
+            if ( u32NumUs > ((SYSTICK_MAX_TICKS / 6243)*1024) )
+            {
+                u32nLoops = (u32NumUs / ((SYSTICK_MAX_TICKS / 6243)*1024)) + 1;
+                u32NumUs /= u32nLoops;
+            }
+            if ( u32NumUs > (MAX_U32 / 6243) )
+            {
+                u32Ticks = (u32NumUs >> 10) * u32ClkFreq;
+            }
+            else
+            {
+                u32Ticks = (u32NumUs * u32ClkFreq) >> 10;
+            }
+            break;
+        case 4:
+            u32ClkFreq = 4995;
+            if ( u32NumUs > ((SYSTICK_MAX_TICKS / 4995)*1024) )
+            {
+                u32nLoops = (u32NumUs / ((SYSTICK_MAX_TICKS / 4995)*1024)) + 1;
+                u32NumUs /= u32nLoops;
+            }
+            if ( u32NumUs > (MAX_U32 / 4995) )
+            {
+                u32Ticks = (u32NumUs >> 10) * u32ClkFreq;
+            }
+            else
+            {
+                u32Ticks = (u32NumUs * u32ClkFreq) >> 10;
+            }
+            break;
+        case 5:
+            u32ClkFreq = 4162;
+            if ( u32NumUs > ((SYSTICK_MAX_TICKS / 4162)*1024) )
+            {
+                u32nLoops = (u32NumUs / ((SYSTICK_MAX_TICKS / 4162)*1024)) + 1;
+                u32NumUs /= u32nLoops;
+            }
+            if ( u32NumUs > (MAX_U32 / 4162) )
+            {
+                u32Ticks = (u32NumUs >> 10) * u32ClkFreq;
+            }
+            else
+            {
+                u32Ticks = (u32NumUs * u32ClkFreq) >> 10;
+            }
+            break;
+        case 6:
+            u32ClkFreq = 3567;
+            if ( u32NumUs > ((SYSTICK_MAX_TICKS / 3567)*1024) )
+            {
+                u32nLoops = (u32NumUs / ((SYSTICK_MAX_TICKS / 3567)*1024)) + 1;
+                u32NumUs /= u32nLoops;
+            }
+            if ( u32NumUs > (MAX_U32 / 3567) )
+            {
+                u32Ticks = (u32NumUs >> 10) * u32ClkFreq;
+            }
+            else
+            {
+                u32Ticks = (u32NumUs * u32ClkFreq) >> 10;
+            }
+            break;
+        case 7:
+            u32ClkFreq = 3121;
+            if ( u32NumUs > ((SYSTICK_MAX_TICKS / 3121)*1024) )
+            {
+                u32nLoops = (u32NumUs / ((SYSTICK_MAX_TICKS / 3121)*1024)) + 1;
+                u32NumUs /= u32nLoops;
+            }
+            if ( u32NumUs > (MAX_U32 / 3121) )
+            {
+                u32Ticks = (u32NumUs >> 10) * u32ClkFreq;
+            }
+            else
+            {
+                u32Ticks = (u32NumUs * u32ClkFreq) >> 10;
+            }
+            break;
+        default:
+            u32Ticks = 1;
+            break;
+    } // switch()
+
+    uRet = u32Ticks * u32nLoops;
+    while ( u32nLoops-- )
+    {
+        am_hal_systick_wait_ticks(u32Ticks);
+    }
+
+    return uRet;
+}
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_systick.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_systick.h
new file mode 100644
index 000000000..668f54b11
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_systick.h
@@ -0,0 +1,83 @@
+//*****************************************************************************
+//
+//! @file am_hal_systick.h
+//!
+//! @brief Functions for accessing and configuring the SYSTICK.
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup systick System Timer (SYSTICK)
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_HAL_SYSTICK_H
+#define AM_HAL_SYSTICK_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+//*****************************************************************************
+//
+// External function definitions
+//
+//*****************************************************************************
+extern void am_hal_systick_start(void);
+extern void am_hal_systick_stop(void);
+extern void am_hal_systick_int_enable(void);
+extern void am_hal_systick_int_disable(void);
+extern uint32_t am_hal_systick_int_status_get(void);
+extern void am_hal_systick_reset(void);
+extern void am_hal_systick_load(uint32_t ui32LoadVal);
+extern uint32_t am_hal_systick_count(void);
+extern uint32_t am_hal_systick_wait_ticks(uint32_t u32Ticks);
+extern uint32_t am_hal_systick_delay_us(uint32_t u32NumUs);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_HAL_SYSTICK_H
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_tpiu.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_tpiu.c
new file mode 100644
index 000000000..8f6a00505
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_tpiu.c
@@ -0,0 +1,381 @@
+//*****************************************************************************
+//
+//! @file am_hal_tpiu.c
+//!
+//! @brief Support functions for the ARM TPIU module
+//!
+//! Provides support functions for configuring the ARM TPIU module
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup tpiu Trace Port Interface Unit (TPIU)
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "am_mcu_apollo.h"
+
+//*****************************************************************************
+//
+//! @brief Enable the clock to the TPIU module.
+//!
+//! This function enables the clock to the TPIU module.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_tpiu_clock_enable(void)
+{
+    //
+    // Enable the TPIU clock
+    //
+    AM_REG(MCUCTRL, TPIUCTRL) |= AM_REG_MCUCTRL_TPIUCTRL_ENABLE_M;
+}
+
+//*****************************************************************************
+//
+//! @brief Disable the clock to the TPIU module.
+//!
+//! This function disables the clock to the TPIU module.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_tpiu_clock_disable(void)
+{
+    //
+    // Disable the TPIU clock
+    //
+    AM_REG(MCUCTRL, TPIUCTRL) &= ~AM_REG_MCUCTRL_TPIUCTRL_ENABLE_M;
+}
+
+//*****************************************************************************
+//
+//! @brief Set the output port width of the TPIU
+//!
+//! @param ui32PortWidth - The desired port width (in bits)
+//!
+//! This function uses the TPIU_CSPSR register to set the desired output port
+//! width of the TPIU.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_tpiu_port_width_set(uint32_t ui32PortWidth)
+{
+   AM_REG(TPIU, CSPSR) = 1 << (ui32PortWidth - 1);
+}
+
+//*****************************************************************************
+//
+//! @brief Read the supported_output port width of the TPIU
+//!
+//! This function uses the \e TPIU_SSPSR register to set the supported output
+//! port widths of the TPIU.
+//!
+//! @return Current width of the TPIU output port
+//
+//*****************************************************************************
+uint32_t
+am_hal_tpiu_supported_port_width_get(void)
+{
+    uint32_t i, ui32WidthValue;
+
+    //
+    // Read the supported width register.
+    //
+    ui32WidthValue = AM_REG(TPIU, SSPSR);
+
+    //
+    // The register value is encoded in a one-hot format, so the position of
+    // the single set bit determines the actual width of the port.
+    //
+    for (i = 1; i < 32; i++)
+    {
+        //
+        // Check each bit for a '1'. When we find it, our current loop index
+        // will be equal to the port width.
+        //
+        if (ui32WidthValue == (0x1 << (i - 1)))
+        {
+            return i;
+        }
+    }
+
+    //
+    // We should never get here, but if we do, just return the smallest
+    // possible value for a supported trace port width.
+    //
+    return 1;
+}
+
+//*****************************************************************************
+//
+//! @brief Read the output port width of the TPIU
+//!
+//! This function uses the \e TPIU_CSPSR register to set the desired output
+//! port width of the TPIU.
+//!
+//! @return Current width of the TPIU output port
+//
+//*****************************************************************************
+uint32_t
+am_hal_tpiu_port_width_get(void)
+{
+    uint32_t ui32Temp;
+    uint32_t ui32Width;
+
+    ui32Width = 1;
+    ui32Temp = AM_REG(TPIU, CSPSR);
+
+    while ( !(ui32Temp & 1) )
+    {
+        ui32Temp = ui32Temp >> 1;
+        ui32Width++;
+
+        if (ui32Width > 32)
+        {
+            ui32Width = 0;
+            break;
+        }
+    }
+
+    //
+    // Current width of the TPIU output port.
+    //
+    return ui32Width;
+}
+
+//*****************************************************************************
+//
+//! @brief Configure the TPIU based on the values in the configuration struct.
+//!
+//! @param psConfig - pointer to an am_hal_tpiu_config_t structure containing
+//! the desired configuration information.
+//!
+//! This function reads the provided configuration structure, and sets the
+//! relevant TPIU registers to achieve the desired configuration.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_tpiu_configure(am_hal_tpiu_config_t *psConfig)
+{
+    //
+    // Set the clock freq in the MCUCTRL register.
+    //
+    AM_REG(MCUCTRL, TPIUCTRL) |= psConfig->ui32TraceClkIn;
+
+    //
+    // Set the desired protocol.
+    //
+    AM_REG(TPIU, SPPR) = psConfig->ui32PinProtocol;
+
+    //
+    // Set the parallel port width. This may be redundant if the user has
+    // selected a serial protocol, but we'll set it anyway.
+    //
+    AM_REG(TPIU, CSPSR) = (1 << (psConfig->ui32ParallelPortSize - 1));
+
+    //
+    // Set the clock prescaler.
+    //
+    AM_REG(TPIU, ACPR) = psConfig->ui32ClockPrescaler;
+}
+
+//*****************************************************************************
+//
+//! @brief Enables the TPIU
+//!
+//! This function enables the ARM TPIU by setting the TPIU registers and then
+//! enabling the TPIU clock source in MCU control register.
+//!
+//! @param psConfig - structure for configuration.
+//!     If ui32SetItmBaud, the other structure members are used to set the
+//!      TPIU configuration.
+//!     But for simplicity, ui32SetItmBaud can be set to one of the
+//!      following, in which case all other structure members are ignored.
+//!      In this case, the given BAUD rate is based on a div-by-8 HFRC clock.
+//!         AM_HAL_TPIU_BAUD_57600
+//!         AM_HAL_TPIU_BAUD_115200
+//!         AM_HAL_TPIU_BAUD_230400
+//!         AM_HAL_TPIU_BAUD_460800
+//!         AM_HAL_TPIU_BAUD_500000
+//!         AM_HAL_TPIU_BAUD_1M
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_tpiu_enable(am_hal_tpiu_config_t *psConfig)
+{
+    uint32_t ui32HFRC, ui32SWOscaler, ui32ITMbitrate;
+
+    ui32ITMbitrate = psConfig->ui32SetItmBaud;
+
+    //
+    // TPIU formatter & flush control register.
+    //
+    AM_REG(TPIU, FFCR) = 0;
+
+    if ( ui32ITMbitrate )
+    {
+        //
+        // Set the Current Parallel Port Size (note - only 1 bit can be set).
+        //
+        AM_REG(TPIU, CSPSR) = AM_REG_TPIU_CSPSR_CWIDTH_1BIT;
+
+        //
+        // Use some default assumptions to set the ITM frequency.
+        //
+        if ( (ui32ITMbitrate < AM_HAL_TPIU_BAUD_57600 )  ||
+             (ui32ITMbitrate > AM_HAL_TPIU_BAUD_2M ) )
+        {
+            ui32ITMbitrate = AM_HAL_TPIU_BAUD_DEFAULT;
+        }
+
+        //
+        // Get the current HFRC frequency.
+        //
+        ui32HFRC = am_hal_clkgen_sysclk_get();
+
+        //
+        // Compute the SWO scaler value.
+        //
+        if ( ui32HFRC != 0xFFFFFFFF )
+        {
+            ui32SWOscaler = ((ui32HFRC / 8) / ui32ITMbitrate) - 1;
+        }
+        else
+        {
+            ui32SWOscaler = ( (AM_HAL_CLKGEN_FREQ_MAX_HZ / 8) /
+                              AM_HAL_TPIU_BAUD_DEFAULT ) - 1;
+        }
+
+        //
+        // Set the scaler value.
+        //
+        AM_REG(TPIU, ACPR) = AM_REG_TPIU_ACPR_SWOSCALER(ui32SWOscaler);
+
+        //
+        // Set for UART mode
+        //
+        AM_REG(TPIU, SPPR) = AM_REG_TPIU_SPPR_TXMODE_UART;
+
+        //
+        // Make sure we are not in test mode (important for proper deep sleep
+        // operation).
+        //
+        AM_REG(TPIU, ITCTRL) = AM_REG_TPIU_ITCTRL_MODE_NORMAL;
+
+        //
+        // Enable the TPIU clock source in MCU control.
+        // Set TPIU clock for HFRC/8 (6 or 3 MHz) operation.
+        //
+        AM_REGn(MCUCTRL, 0, TPIUCTRL) =
+                AM_REG_MCUCTRL_TPIUCTRL_CLKSEL_HFRC_DIV_8 |
+                AM_REG_MCUCTRL_TPIUCTRL_ENABLE_EN;
+    }
+    else
+    {
+        //
+        // Set the configuration according to the structure values.
+        //
+
+        //
+        // Set the Asynchronous Clock Prescaler Register.
+        //
+        AM_REG(TPIU, ACPR) = psConfig->ui32ClockPrescaler;
+
+        //
+        // Set the Selected Pin Protocol Register.
+        //  e.g. AM_REG_TPIU_SPPR_TXMODE_UART
+        //
+        AM_REG(TPIU, SPPR) = psConfig->ui32PinProtocol;
+
+        //
+        // Set the Current Parallel Port Size (note - only 1 bit can be set).
+        // This may be redundant if the user has selected a serial protocol,
+        // but we'll set it anyway.
+        //
+        AM_REG(TPIU, CSPSR) = (1 << (psConfig->ui32ParallelPortSize - 1));
+
+        //
+        // Set the clock freq in the MCUCTRL register.
+        //
+        AM_REG(MCUCTRL, TPIUCTRL) |= psConfig->ui32TraceClkIn;
+    }
+
+    //
+    // Wait for 50us for the data to flush out.
+    //
+    am_hal_itm_delay_us(50);
+}
+
+//*****************************************************************************
+//
+//! @brief Disables the TPIU
+//!
+//! This function disables the ARM TPIU by disabling the TPIU clock source
+//! in MCU control register.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_tpiu_disable(void)
+{
+    //
+    // Disable the TPIU clock source in MCU control.
+    //
+    AM_REG(MCUCTRL, TPIUCTRL) = AM_REG_MCUCTRL_TPIUCTRL_CLKSEL_0MHz |
+                                AM_REG_MCUCTRL_TPIUCTRL_ENABLE_DIS;
+}
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_tpiu.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_tpiu.h
new file mode 100644
index 000000000..c72db0bb4
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_tpiu.h
@@ -0,0 +1,193 @@
+//*****************************************************************************
+//
+//! @file am_hal_tpiu.h
+//!
+//! @brief Definitions and structures for working with the TPIU.
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup tpiu Trace Port Interface Unit (TPIU)
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_HAL_TPIU_H
+#define AM_HAL_TPIU_H
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+//*****************************************************************************
+//
+// TPIU bit rate defines.
+//
+//*****************************************************************************
+#define AM_HAL_TPIU_BAUD_57600      (115200 / 2)
+#define AM_HAL_TPIU_BAUD_115200     (115200 * 1)
+#define AM_HAL_TPIU_BAUD_230400     (115200 * 2)
+#define AM_HAL_TPIU_BAUD_460800     (115200 * 4)
+#define AM_HAL_TPIU_BAUD_500000     (1000000 / 2)
+#define AM_HAL_TPIU_BAUD_1M         (1000000 * 1)
+#define AM_HAL_TPIU_BAUD_2M         (1000000 * 2)
+#define AM_HAL_TPIU_BAUD_DEFAULT    (AM_HAL_TPIU_BAUD_1M)
+
+//*****************************************************************************
+//
+// TPIU register defines.
+//
+//*****************************************************************************
+#define AM_HAL_TPIU_SSPSR       0xE0040000  //! Supported Parallel Port Sizes
+#define AM_HAL_TPIU_CSPSR       0xE0040004  //! Current Parallel Port Size
+#define AM_HAL_TPIU_ACPR        0xE0040010  //! Asynchronous Clock Prescaler
+#define AM_HAL_TPIU_SPPR        0xE00400F0  //! Selected Pin Protocol
+#define AM_HAL_TPIU_TYPE        0xE0040FC8  //! TPIU Type
+
+//*****************************************************************************
+//
+// TPIU ACPR defines.
+//
+//*****************************************************************************
+#define AM_HAL_TPIU_ACPR_SWOSCALER_M    0x0000FFFF  //! SWO baud rate prescalar
+
+//*****************************************************************************
+//
+// TPIU_SPPR TXMODE defines.
+//
+//*****************************************************************************
+#define AM_HAL_TPIU_SPPR_PARALLEL       0x00000000
+#define AM_HAL_TPIU_SPPR_MANCHESTER     0x00000001
+#define AM_HAL_TPIU_SPPR_NRZ            0x00000002
+
+//*****************************************************************************
+//
+// TPIU Type defines
+//
+//*****************************************************************************
+#define AM_HAL_TPIU_TYPE_NRZVALID       0x00000800
+#define AM_HAL_TPIU_TYPE_MANCVALID      0x00000400
+#define AM_HAL_TPIU_TYPE_PTINVALID      0x00000200
+#define AM_HAL_TPIU_TYPE_FIFOSZ_M       0x000001C0
+
+//*****************************************************************************
+//
+// TPIU Clock defines
+//
+//*****************************************************************************
+#define AM_HAL_TPIU_TRACECLKIN_6MHZ     AM_REG_MCUCTRL_TPIUCTRL_TPIUCLKSEL(0)
+#define AM_HAL_TPIU_TRACECLKIN_3MHZ     AM_REG_MCUCTRL_TPIUCTRL_TPIUCLKSEL(1)
+#define AM_HAL_TPIU_TRACECLKIN_1_5MHZ   AM_REG_MCUCTRL_TPIUCTRL_TPIUCLKSEL(2)
+#define AM_HAL_TPIU_TRACECLKIN_750KHZ   AM_REG_MCUCTRL_TPIUCTRL_TPIUCLKSEL(3)
+
+//*****************************************************************************
+//
+//! @brief Structure used for configuring the TPIU
+//
+//*****************************************************************************
+typedef struct
+{
+    //
+    // If ui32SetItmBaud is non-zero, the ITM frequency is set to the given
+    //  frequency, and is based on a divide-by-8 HFRC TPIU clock.
+    // If zero, other structure members are used to set the TPIU configuration.
+    //
+    uint32_t ui32SetItmBaud;
+
+    //
+    //! MCU Control TRACECLKIN clock freq.
+    //!
+    //! Valid values for ui32TraceClkIn are:
+    //!
+    //!     AM_HAL_TPIU_TRACECLKIN_6MHZ
+    //!     AM_HAL_TPIU_TRACECLKIN_3MHZ
+    //!     AM_HAL_TPIU_TRACECLKIN_1_5MHZ
+    //!     AM_HAL_TPIU_TRACECLKIN_750KHZ
+    //
+    uint32_t ui32TraceClkIn;
+
+    //
+    //! Protocol to use for the TPIU
+    //!
+    //! Valid values for ui32PinProtocol are:
+    //!
+    //!     AM_HAL_TPIU_SPPR_PARALLEL
+    //!     AM_HAL_TPIU_SPPR_MANCHESTER
+    //!     AM_HAL_TPIU_SPPR_NRZ
+    //
+    uint32_t ui32PinProtocol;
+
+    //
+    //! Desired width of the TPIU parallel port
+    //
+    uint32_t ui32ParallelPortSize;
+
+    //
+    //! Desired Clock prescaler value
+    //
+    uint32_t ui32ClockPrescaler;
+}
+am_hal_tpiu_config_t;
+
+//*****************************************************************************
+//
+// External function definitions
+//
+//*****************************************************************************
+extern void am_hal_tpiu_clock_enable(void);
+extern void am_hal_tpiu_clock_disable(void);
+extern void am_hal_tpiu_port_width_set(uint32_t ui32PortWidth);
+extern uint32_t am_hal_tpiu_supported_port_width_get(void);
+extern uint32_t am_hal_tpiu_port_width_get(void);
+extern void am_hal_tpiu_configure(am_hal_tpiu_config_t *psConfig);
+extern void am_hal_tpiu_enable(am_hal_tpiu_config_t *psConfig);
+extern void am_hal_tpiu_disable(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_HAL_TPIU_H
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_ttp.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_ttp.c
new file mode 100644
index 000000000..542a9ab10
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_ttp.c
@@ -0,0 +1,204 @@
+//*****************************************************************************
+//
+//! @file am_hal_ttp.c
+//!
+//! @brief Functions for handling the "two time program" interface.
+//!
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#include "am_mcu_apollo.h"
+#include "am_hal_ttp.h"
+
+//*****************************************************************************
+//
+// Local constants
+//
+//*****************************************************************************
+#define TTP_ADDR                0x50020000
+
+//*****************************************************************************
+//
+// Local prototypes
+//
+//*****************************************************************************
+#if !defined(__GNUC__)
+void __breakpoint(int val);
+#endif
+
+//*****************************************************************************
+//
+// A function to verify that the TTP was saved and/or restored properly.
+//
+//*****************************************************************************
+int
+verifyTTPSaved(uint32_t *pSaveArray, int iNumWords)
+{
+    int ix, iErrCnt = 0;
+    uint32_t *pDataSpace = (uint32_t*)TTP_ADDR;
+
+    for (ix = 0; ix<iNumWords; ix++)
+    {
+        if ( *pSaveArray != am_hal_flash_load_ui32((uint32_t)pDataSpace) )
+        {
+            iErrCnt++;
+        }
+        pSaveArray++;
+        pDataSpace++;
+    }
+
+    //
+    // Hopefully returning 0.
+    //
+    return iErrCnt;
+}
+
+//*****************************************************************************
+//
+//! @brief TTP unlock.
+//!
+//! @param ui32Keyval - The key value to unlock the interface.
+//! @param pui8_1024Bytes - A pointer to a 1024 bytes array, used for
+//!                         temporary data storage.
+//!                         WARNING This area must be 32-bit aligned and at
+//!                         least 1024 bytes long.
+//!
+//! This function is used to unlock the TTP ability.
+//!
+//! @return None.
+//
+//*****************************************************************************
+int
+am_hal_ttp_unlock(uint32_t ui32Keyval, uint8_t *pui8_1024Bytes)
+{
+    int iErrCnt = 0;
+    int ix, iRet;
+    int iNumWords = 1024 / 4;
+    uint32_t *pSaveArray, *pDataSpace;
+    int (*pTTPClear)(uint32_t, uint32_t) = (int (*)(uint32_t, uint32_t))0x080002EF;
+    int (*pTTPSet)(uint32_t, uint32_t, uint32_t*, uint32_t, uint32_t) =
+        (int (*)(uint32_t, uint32_t, uint32_t*, uint32_t, uint32_t))0x080006FF;
+
+    //
+    // Save off the data.
+    //
+    pSaveArray = (uint32_t*)pui8_1024Bytes;
+    pDataSpace = (uint32_t*)TTP_ADDR;
+    for (ix = 0; ix < iNumWords; ix++)
+    {
+        *pSaveArray = am_hal_flash_load_ui32((uint32_t)pDataSpace);
+        pSaveArray++;
+        pDataSpace++;
+    }
+
+    //
+    // Before proceeding, make sure that we captured the data correctly.
+    //
+    iErrCnt += verifyTTPSaved((uint32_t*)pui8_1024Bytes, iNumWords);
+    if ( iErrCnt )
+    {
+        return 0x10000001;
+    }
+
+    //
+    // Erase the TTP area.
+    //
+    iRet = (*pTTPClear)(0, ui32Keyval);
+    if ( iRet != 0 )
+    {
+        iErrCnt++;
+        return 0x10000002;
+    }
+
+    //
+    // The point of no return!  The TTP space is successfully erased.
+    // Let's make sure.
+    //
+    pDataSpace = (uint32_t*)TTP_ADDR;
+    for (ix = 0; ix < iNumWords; ix++)
+    {
+        if ( am_hal_flash_load_ui32((uint32_t)pDataSpace) != 0xffffffff )
+        {
+            iErrCnt++;
+        }
+        pDataSpace++;
+    }
+
+    if ( iErrCnt )
+    {
+        return 0x10000003;
+    }
+
+    //
+    // Restore the TTP block from the saved data.
+    //
+    iRet = (*pTTPSet)(ui32Keyval, 0, (uint32_t*)pui8_1024Bytes, 0, iNumWords);
+    if ( iRet != 0 )
+    {
+        iErrCnt++;
+        return 0x10000004;
+    }
+
+    //
+    // Now, check the restored INFO data.
+    //
+    iRet = verifyTTPSaved((uint32_t*)pui8_1024Bytes, iNumWords);
+    if ( iRet )
+    {
+        iErrCnt++;
+        return 0x10000005;
+    }
+    else
+    {
+        //
+        // All good.  The device was successfully recovered.
+        //
+    }
+
+
+    //
+    // Return with error count (hopefully 0).
+    //
+    return iErrCnt;
+}
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_ttp.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_ttp.h
new file mode 100644
index 000000000..1d6924d0c
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_ttp.h
@@ -0,0 +1,71 @@
+//*****************************************************************************
+//
+//! @file am_hal_ttp.h
+//!
+//! @brief Functions for handling the "two time program" interface.
+//!
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_HAL_TTP_H
+#define AM_HAL_TTP_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+//*****************************************************************************
+//
+// Function prototypes
+//
+//*****************************************************************************
+extern int am_hal_ttp_unlock(uint32_t ui32Keyval, uint8_t *pui8_1024Bytes);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_HAL_TTP_H
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
+
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_uart.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_uart.c
new file mode 100644
index 000000000..684fd2a3a
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_uart.c
@@ -0,0 +1,1160 @@
+//*****************************************************************************
+//
+//! @file am_hal_uart.c
+//!
+//! @brief Functions for interfacing with the UART.
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup uart UART
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "am_mcu_apollo.h"
+
+//*****************************************************************************
+//
+// Transmit and receive queue pointers for each UART module.
+//
+//*****************************************************************************
+am_hal_queue_t g_psTxQueue[AM_REG_UART_NUM_MODULES];
+am_hal_queue_t g_psRxQueue[AM_REG_UART_NUM_MODULES];
+
+//*****************************************************************************
+//
+// Power tracking structure
+//
+//*****************************************************************************
+am_hal_uart_pwrsave_t am_hal_uart_pwrsave[AM_REG_UART_NUM_MODULES];
+
+//*****************************************************************************
+//
+// Set Baud Rate based on the UART clock frequency.
+//
+//*****************************************************************************
+
+#define BAUDCLK     (32)
+
+static void
+config_baudrate(uint32_t ui32Module, uint32_t ui32Baudrate, uint32_t ui32UartClkFreq)
+{
+    uint64_t ui64FractionDivisorLong;
+    uint64_t ui64IntermediateLong;
+    uint32_t ui32IntegerDivisor;
+    uint32_t ui32FractionDivisor;
+    uint32_t ui32BaudClk;
+
+    //
+    // Calculate register values.
+    //
+    ui32BaudClk = BAUDCLK * ui32Baudrate;
+    ui32IntegerDivisor = (uint32_t)(ui32UartClkFreq / ui32BaudClk);
+    ui64IntermediateLong = (ui32UartClkFreq * 64) / ui32BaudClk;
+    ui64FractionDivisorLong = ui64IntermediateLong - (ui32IntegerDivisor * 64);
+    ui32FractionDivisor = (uint32_t)ui64FractionDivisorLong;
+
+    //
+    // Check the result.
+    //
+    am_hal_debug_assert_msg(ui32IntegerDivisor > 0, "Integer divisor MUST be greater than or equal to 1.");
+
+    //
+    // Write the UART regs.
+    //
+    AM_REGn(UART, ui32Module, IBRD) = ui32IntegerDivisor;
+    AM_REGn(UART, ui32Module, IBRD) = ui32IntegerDivisor;
+    AM_REGn(UART, ui32Module, FBRD) = ui32FractionDivisor;
+}
+
+//*****************************************************************************
+//
+//! @brief Set up the UART.
+//!
+//! @param psConfig pointer to a structure that holds the settings for the UART.
+//! @param ui32UartclkFreq is clock frequency that the UART is running at.
+//!
+//! This function should be used to perform the initial set-up of the UART.
+//!
+//! @return none.
+//
+//*****************************************************************************
+void
+am_hal_uart_config(uint32_t ui32Module, am_hal_uart_config_t *psConfig)
+
+{
+    uint32_t ui32ConfigVal = 0;
+
+    //
+    // Configure the Baudrate.
+    //
+    config_baudrate(ui32Module, psConfig->ui32BaudRate, am_hal_clkgen_sysclk_get());
+
+    //
+    // OR in the Data bits.
+    //
+    ui32ConfigVal |= psConfig->ui32DataBits;
+
+    //
+    // OR in the Two Stop bit if used.
+    //
+    ui32ConfigVal |= psConfig->bTwoStopBits ? AM_REG_UART_LCRH_STP2_M : 0;
+
+    //
+    // OR in the Parity.
+    //
+    ui32ConfigVal |= psConfig->ui32Parity;
+
+    //
+    // Write config to Line control register.
+    //
+    AM_REGn(UART, ui32Module, LCRH) |= ui32ConfigVal;
+
+    //
+    // Write the flow control settings to the control register.
+    //
+    AM_REGn(UART, ui32Module, CR) |= psConfig->ui32FlowCtrl;
+
+    //
+    // Set the clock select field for 24MHz from the HFRC
+    //
+    AM_REGn(UART, ui32Module, CR) |= AM_REG_UART_CR_CLKSEL_24MHZ;
+}
+
+//*****************************************************************************
+//
+//! @brief Gets the status.
+//!
+//! This function returns the current status.
+//!
+//! @return current status.
+//
+//*****************************************************************************
+uint32_t
+am_hal_uart_status_get(uint32_t ui32Module)
+{
+    //
+    // Read and return the Status.
+    //
+    return AM_REGn(UART, ui32Module, RSR);
+}
+
+//*****************************************************************************
+//
+//! @brief Gets the interrupt status.
+//!
+//! @param bEnabledOnly - If true returns the enabled interrupt status.
+//!
+//! This function returns the masked or raw interrupt status.
+//!
+//! @return Bitwise representation of the current interrupt status.
+//!
+//! The return value will be the logical OR of one or more of the following
+//! values:
+//!
+//!     AM_HAL_UART_INT_OVER_RUN
+//!     AM_HAL_UART_INT_BREAK_ERR
+//!     AM_HAL_UART_INT_PARITY_ERR
+//!     AM_HAL_UART_INT_FRAME_ERR
+//!     AM_HAL_UART_INT_RX_TMOUT
+//!     AM_HAL_UART_INT_TX
+//!     AM_REG_UART_IER_TXIM_M
+//!     AM_HAL_UART_INT_RX
+//!     AM_HAL_UART_INT_DSRM
+//!     AM_HAL_UART_INT_DCDM
+//!     AM_HAL_UART_INT_CTSM
+//!     AM_HAL_UART_INT_RIM
+//
+//*****************************************************************************
+uint32_t
+am_hal_uart_int_status_get(uint32_t ui32Module, bool bEnabledOnly)
+{
+    if (bEnabledOnly)
+    {
+        //
+        // Read and return the Masked Interrupt Status.
+        //
+        return AM_REGn(UART, ui32Module, MIS);
+    }
+    else
+    {
+        //
+        // Read and return the Raw Interrupt Status.
+        //
+        return AM_REGn(UART, ui32Module, IES);
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Clears the desired interrupts.
+//!
+//! @param ui32Interrupt - Interrupt bits to clear.
+//!
+//! This function clears the desired interrupts.
+//!
+//! ui32Interrupt should be a logical or of the following:
+//!
+//!     AM_HAL_UART_INT_OVER_RUN
+//!     AM_HAL_UART_INT_BREAK_ERR
+//!     AM_HAL_UART_INT_PARITY_ERR
+//!     AM_HAL_UART_INT_FRAME_ERR
+//!     AM_HAL_UART_INT_RX_TMOUT
+//!     AM_HAL_UART_INT_TX
+//!     AM_REG_UART_IER_TXIM_M
+//!     AM_HAL_UART_INT_RX
+//!     AM_HAL_UART_INT_DSRM
+//!     AM_HAL_UART_INT_DCDM
+//!     AM_HAL_UART_INT_CTSM
+//!     AM_HAL_UART_INT_RIM
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_uart_int_clear(uint32_t ui32Module, uint32_t ui32Interrupt)
+{
+    //
+    // Clear the bits.
+    //
+    AM_REGn(UART, ui32Module, IEC) = ui32Interrupt;
+}
+
+//*****************************************************************************
+//
+//! @brief Disables the desired interrupts.
+//!
+//! @param ui32Interrupt - Interrupt bits to disable.
+//!
+//! This function disables the desired interrupts.
+//!
+//! ui32Interrupt should be a logical or of the following:
+//!
+//!     AM_HAL_UART_INT_OVER_RUN
+//!     AM_HAL_UART_INT_BREAK_ERR
+//!     AM_HAL_UART_INT_PARITY_ERR
+//!     AM_HAL_UART_INT_FRAME_ERR
+//!     AM_HAL_UART_INT_RX_TMOUT
+//!     AM_HAL_UART_INT_TX
+//!     AM_REG_UART_IER_TXIM_M
+//!     AM_HAL_UART_INT_RX
+//!     AM_HAL_UART_INT_DSRM
+//!     AM_HAL_UART_INT_DCDM
+//!     AM_HAL_UART_INT_CTSM
+//!     AM_HAL_UART_INT_RIM
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_uart_int_disable(uint32_t ui32Module, uint32_t ui32Interrupt)
+{
+    //
+    // Disable the bits.
+    //
+    AM_REGn(UART, ui32Module, IER) &= ~ui32Interrupt;
+}
+
+//*****************************************************************************
+//
+//! @brief Enables the desired interrupts.
+//!
+//! @param ui32Interrupt - Interrupt bits to enable.
+//!
+//! This function enables the desired interrupts.
+//!
+//! ui32Interrupt should be a logical or of the following:
+//!
+//!     AM_HAL_UART_INT_OVER_RUN
+//!     AM_HAL_UART_INT_BREAK_ERR
+//!     AM_HAL_UART_INT_PARITY_ERR
+//!     AM_HAL_UART_INT_FRAME_ERR
+//!     AM_HAL_UART_INT_RX_TMOUT
+//!     AM_HAL_UART_INT_TX
+//!     AM_REG_UART_IER_TXIM_M
+//!     AM_HAL_UART_INT_RX
+//!     AM_HAL_UART_INT_DSRM
+//!     AM_HAL_UART_INT_DCDM
+//!     AM_HAL_UART_INT_CTSM
+//!     AM_HAL_UART_INT_RIM
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_uart_int_enable(uint32_t ui32Module, uint32_t ui32Interrupt)
+{
+    //
+    // Enable the interrupts.
+    //
+    AM_REGn(UART, ui32Module, IER) |= ui32Interrupt;
+}
+
+//*****************************************************************************
+//
+//! @brief Returns the enabled interrupts.
+//!
+//! This function return the enabled interrupts.
+//!
+//! @return the enabled interrupts. This will be a logical or of the following:
+//!
+//!     AM_HAL_UART_INT_OVER_RUN
+//!     AM_HAL_UART_INT_BREAK_ERR
+//!     AM_HAL_UART_INT_PARITY_ERR
+//!     AM_HAL_UART_INT_FRAME_ERR
+//!     AM_HAL_UART_INT_RX_TMOUT
+//!     AM_HAL_UART_INT_TX
+//!     AM_REG_UART_IER_TXIM_M
+//!     AM_HAL_UART_INT_RX
+//!     AM_HAL_UART_INT_DSRM
+//!     AM_HAL_UART_INT_DCDM
+//!     AM_HAL_UART_INT_CTSM
+//!     AM_HAL_UART_INT_RIM
+//!
+//! @return Returns the enabled interrupts.
+//
+//*****************************************************************************
+uint32_t
+am_hal_uart_int_enable_get(uint32_t ui32Module)
+{
+    //
+    // Return the enabled interrupts.
+    //
+    return AM_REGn(UART, ui32Module, IER);
+}
+
+//*****************************************************************************
+//
+//! @brief Enable the UART, RX, and TX.
+//!
+//! This function enables the UART, RX, and TX.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_uart_enable(uint32_t ui32Module)
+{
+    //
+    // Enable the UART, RX, and TX.
+    //
+    AM_REGan_SET(UART, ui32Module, CR, (AM_REG_UART_CR_UARTEN_M   |
+                                        AM_REG_UART_CR_RXE_M      |
+                                        AM_REG_UART_CR_TXE_M) );
+}
+
+//*****************************************************************************
+//
+//! @brief Disable the UART, RX, and TX.
+//!
+//! This function disables the UART, RX, and TX.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_uart_disable(uint32_t ui32Module)
+{
+    //
+    // Disable the UART.
+    //
+    AM_REGan_CLR(UART, ui32Module, CR, (AM_REG_UART_CR_UARTEN_M   |
+                                        AM_REG_UART_CR_RXE_M      |
+                                        AM_REG_UART_CR_TXE_M) );
+}
+
+//*****************************************************************************
+//
+//! @brief Enable the UART in the power control block.
+//!
+//! This function enables the UART device in the power control block.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_uart_pwrctrl_enable(uint32_t ui32Module)
+{
+    //
+    // Check to make sure we're acting on a real UART module.
+    //
+    am_hal_debug_assert_msg(ui32Module < AM_REG_UART_NUM_MODULES,
+                            "Trying to disable a UART module that doesn't exist");
+
+    am_hal_pwrctrl_periph_enable(AM_HAL_PWRCTRL_UART0 << ui32Module);
+}
+
+//*****************************************************************************
+//
+//! @brief Disable the UART in the power control block.
+//!
+//! This function disables the UART device in the power control block.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_uart_pwrctrl_disable(uint32_t ui32Module)
+{
+    //
+    // Check to make sure we're acting on a real UART module.
+    //
+    am_hal_debug_assert_msg(ui32Module < AM_REG_UART_NUM_MODULES,
+                            "Trying to disable a UART module that doesn't exist");
+
+    am_hal_pwrctrl_periph_disable(AM_HAL_PWRCTRL_UART0 << ui32Module);
+}
+
+//*****************************************************************************
+//
+//! @brief Enable the UART in the power control block.
+//!
+//! This function enables the UART device in the power control block.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_uart_power_on_restore(uint32_t ui32Module)
+{
+    //
+    // Check to make sure we're acting on a real UART module.
+    //
+    am_hal_debug_assert_msg(ui32Module < AM_REG_UART_NUM_MODULES,
+                            "Trying to enable a UART module that doesn't exist");
+
+    //
+    // Make sure this restore is a companion to a previous save call.
+    //
+    if ( am_hal_uart_pwrsave[ui32Module].bValid == 0 )
+    {
+        return;
+    }
+
+    //
+    // Enable power to the selected UART
+    //
+    am_hal_pwrctrl_periph_enable(AM_HAL_PWRCTRL_UART0 << ui32Module);
+
+    //
+    // Restore the clock settings
+    //
+    am_hal_clkgen_uarten_set(ui32Module, am_hal_uart_pwrsave[ui32Module].UARTEN);
+
+    //
+    // Restore the configuration registers from the global variable in SRAM.
+    //
+    AM_REGn(UART, ui32Module, ILPR) = am_hal_uart_pwrsave[ui32Module].ILPR;
+    AM_REGn(UART, ui32Module, IBRD) = am_hal_uart_pwrsave[ui32Module].IBRD;
+    AM_REGn(UART, ui32Module, FBRD) = am_hal_uart_pwrsave[ui32Module].FBRD;
+    AM_REGn(UART, ui32Module, LCRH) = am_hal_uart_pwrsave[ui32Module].LCRH;
+    AM_REGn(UART, ui32Module, CR)   = am_hal_uart_pwrsave[ui32Module].CR;
+    AM_REGn(UART, ui32Module, IFLS) = am_hal_uart_pwrsave[ui32Module].IFLS;
+    AM_REGn(UART, ui32Module, IER)  = am_hal_uart_pwrsave[ui32Module].IER;
+
+    //
+    // Indicates we have restored the configuration.
+    //
+    am_hal_uart_pwrsave[ui32Module].bValid = 0;
+
+    return;
+}
+
+//*****************************************************************************
+//
+//! @brief Disable the UART in the power control block.
+//!
+//! This function disables the UART device in the power control block.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_uart_power_off_save(uint32_t ui32Module)
+{
+    //
+    // Check to make sure we're acting on a real UART module.
+    //
+    am_hal_debug_assert_msg(ui32Module < AM_REG_UART_NUM_MODULES,
+                            "Trying to disable a UART module that doesn't exist");
+
+    //
+    // Save all of the configuration register information for the selected
+    // UART.
+    //
+    am_hal_uart_pwrsave[ui32Module].ILPR = AM_REGn(UART, ui32Module, ILPR);
+    am_hal_uart_pwrsave[ui32Module].IBRD = AM_REGn(UART, ui32Module, IBRD);
+    am_hal_uart_pwrsave[ui32Module].FBRD = AM_REGn(UART, ui32Module, FBRD);
+    am_hal_uart_pwrsave[ui32Module].LCRH = AM_REGn(UART, ui32Module, LCRH);
+    am_hal_uart_pwrsave[ui32Module].CR = AM_REGn(UART, ui32Module, CR);
+    am_hal_uart_pwrsave[ui32Module].IFLS = AM_REGn(UART, ui32Module, IFLS);
+    am_hal_uart_pwrsave[ui32Module].IER = AM_REGn(UART, ui32Module, IER);
+
+    //
+    // Save the clock setting and disable power to the selected UART.
+    // Save the current enable value.
+    //
+    am_hal_uart_pwrsave[ui32Module].UARTEN =
+        (AM_REG(CLKGEN, UARTEN) & AM_HAL_CLKGEN_UARTEN_UARTENn_M(ui32Module)) >>
+         AM_HAL_CLKGEN_UARTEN_UARTENn_S(ui32Module);
+
+    //
+    // Disable the UART.
+    //
+    am_hal_clkgen_uarten_set(ui32Module, AM_HAL_CLKGEN_UARTEN_DIS);
+
+    //
+    // Indicates we have a valid saved configuration.
+    //
+    am_hal_uart_pwrsave[ui32Module].bValid = 1;
+
+    //
+    // Disable power to the selected UART.
+    //
+    am_hal_pwrctrl_periph_disable(AM_HAL_PWRCTRL_UART0 << ui32Module);
+
+    return;
+}
+
+//*****************************************************************************
+//
+//! @brief Enable the UART clock.
+//!
+//! This function enables the clock to the UART.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_uart_clock_enable(uint32_t ui32Module)
+{
+    //
+    // Set CLKGEN.UARTEN, clear the field then write the desired enable value
+    // Valid enable values are DIS, EN, REDUCE_FREQ, EN_POWER_SAV.
+    //
+    am_hal_clkgen_uarten_set(ui32Module, AM_HAL_CLKGEN_UARTEN_EN);
+
+    //
+    // Enable the UART clock.
+    //
+    AM_REGn(UART, ui32Module, CR) |= AM_REG_UART_CR_CLKEN_M;
+
+    //
+    // Select default UART clock source
+    //
+    AM_REGn(UART, ui32Module, CR) |= AM_REG_UART_CR_CLKSEL_24MHZ;
+}
+
+//*****************************************************************************
+//
+//! @brief Disable the UART clock.
+//!
+//! This function disables the clock to the UART.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_uart_clock_disable(uint32_t ui32Module)
+{
+    //
+    // Disable the UART clock.
+    //
+    AM_REGn(UART, ui32Module, CR) &= ~AM_REG_UART_CR_CLKEN_M;
+
+    //
+    // Disable the UART clock in the CLKGEN module.
+    //
+    am_hal_clkgen_uarten_set(ui32Module, AM_HAL_CLKGEN_UARTEN_DIS);
+}
+
+//*****************************************************************************
+//
+//! @brief Set and enable the desired interrupt levels for the RX/TX fifo.
+//!
+//! @param ui32LvlCfg - Desired FIFO RX/TX levels.
+//!
+//! This function sets the desired interrupt levels for the RX/TX fifo and
+//! enables the use of transmit and receive FIFO buffers.
+//!
+//! Valid values for ui32LvlCfg are:
+//!
+//!     AM_HAL_UART_TX_FIFO_1_8
+//!     AM_HAL_UART_TX_FIFO_1_4
+//!     AM_HAL_UART_TX_FIFO_1_2
+//!     AM_HAL_UART_TX_FIFO_3_4
+//!     AM_HAL_UART_TX_FIFO_7_8
+//!
+//!     AM_HAL_UART_RX_FIFO_1_8
+//!     AM_HAL_UART_RX_FIFO_1_4
+//!     AM_HAL_UART_RX_FIFO_1_2
+//!     AM_HAL_UART_RX_FIFO_3_4
+//!     AM_HAL_UART_RX_FIFO_7_8
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_uart_fifo_config(uint32_t ui32Module, uint32_t ui32LvlCfg)
+{
+    //
+    // Enable the use of FIFOs.
+    //
+    AM_REGn(UART, ui32Module, LCRH) |= AM_REG_UART_LCRH_FEN_M;
+
+    //
+    // Write the FIFO level register.
+    //
+    AM_REGn(UART, ui32Module, IFLS) = ui32LvlCfg;
+}
+
+//*****************************************************************************
+//
+//! @brief Return the UART Flags.
+//!
+//! This function reads and returns the UART flags.
+//!
+//! @return Returns the Flags.
+//
+//*****************************************************************************
+uint32_t
+am_hal_uart_flags_get(uint32_t ui32Module)
+{
+    //
+    // Read and return the Flags.
+    //
+    return AM_REGn(UART, ui32Module, FR);
+}
+
+//*****************************************************************************
+//
+//! @brief Outputs a single character using polling.
+//!
+//! @param cChar - Character to send.
+//!
+//! This function outputs a single character using polling.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_uart_char_transmit_polled(uint32_t ui32Module, char cChar)
+{
+    //
+    // Wait for space, i.e.  TX FIFO EMPTY
+    //
+    while (AM_BFRn(UART, ui32Module, FR, TXFF));
+
+    //
+    // Write the char.
+    //
+    AM_REGn(UART, ui32Module, DR) = cChar;
+}
+
+//*****************************************************************************
+//
+//! @brief Outputs a zero terminated string using polling.
+//!
+//! @param pcString - Pointer to character string to send.
+//!
+//! This function outputs a zero terminated string using polling.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_uart_string_transmit_polled(uint32_t ui32Module, char *pcString)
+{
+    while (*pcString)
+    {
+        //
+        // Wait for space, i.e.  TX FIFO EMPTY.
+        //
+        while (AM_BFRn(UART, ui32Module, FR, TXFF));
+
+        //
+        // Write the char.
+        //
+        AM_REGn(UART, ui32Module, DR) = *pcString++;
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Receives a character using polling.
+//!
+//! @param pcChar - Pointer to character to store received char.
+//!
+//! This function receives a character using polling.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_uart_char_receive_polled(uint32_t ui32Module, char *pcChar)
+{
+    //
+    // Wait for data, i.e. RX FIFO NOT EMPTY.
+    //
+    while (AM_BFRn(UART, ui32Module, FR, RXFE));
+
+    //
+    // Save the char.
+    //
+    *pcChar = AM_REGn(UART, ui32Module, DR);
+}
+
+//*****************************************************************************
+//
+//! @brief Receives one line using polling.
+//!
+//! @param ui32MaxChars - Maximum number of characters to receive.
+//! @param pcChar - Pointer to character string to store received line.
+//!
+//! This function receives a line (delimited by '/n' or '/r') using polling.
+//! Line buffer is 0 (NULL) terminated.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_uart_line_receive_polled(uint32_t ui32Module,
+                                uint32_t ui32MaxChars,
+                                char *pcChar)
+{
+    char cRecChar;
+    uint32_t i;
+
+    //
+    // Loop until we receive ui32MaxChars or receive a line ending.
+    //
+    for (i = 0; i < (ui32MaxChars - 1); i++)
+    {
+        //
+        // Get char.
+        //
+        am_hal_uart_char_receive_polled(ui32Module, &cRecChar);
+
+        if ((cRecChar == '\n') || (cRecChar == '\r'))
+        {
+            //
+            // Zero terminate the buffer.
+            //
+            *pcChar = 0;
+
+            return;
+        }
+
+        *pcChar++ = cRecChar;
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Initialize the buffered UART.
+//!
+//! @param pui8RxArray - Pointer to the RX buffer to fill.
+//! @param ui32RxSize - size of RX buffer.
+//! @param pui8TxArray - Pointer to the TX buffer to fill.
+//! @param ui32TxSize - size of TX buffer.
+//!
+//! This function initializes the buffered UART.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_uart_init_buffered(uint32_t ui32Module,
+                          uint8_t *pui8RxArray, uint32_t ui32RxSize,
+                          uint8_t *pui8TxArray, uint32_t ui32TxSize)
+{
+    //
+    // Enable the UART RX timeout interrupt.
+    //
+    AM_REGn(UART, ui32Module, IER) |= (AM_REG_UART_IES_RTRIS_M |
+                                       AM_REG_UART_IES_TXRIS_M);
+
+    //
+    // Initialize the ring buffers.
+    //
+    am_hal_queue_init(&g_psTxQueue[ui32Module], pui8TxArray, 1, ui32TxSize);
+    am_hal_queue_init(&g_psRxQueue[ui32Module], pui8RxArray, 1, ui32RxSize);
+}
+
+//*****************************************************************************
+//
+//! @brief Get the status of the buffered UART.
+//!
+//! @param pui32RxSize - Pointer to variable to return the Rx ring data size.
+//! @param pui32TxSize - Pointer to variable to return the Tx ring data size.
+//!
+//! This function gets the status of the buffered UART.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_uart_get_status_buffered(uint32_t ui32Module,
+                                uint32_t *pui32RxSize,
+                                uint32_t *pui32TxSize)
+{
+    //
+    // Return the current size of ring buffers.
+    //
+    if ( pui32RxSize )
+    {
+        *pui32RxSize = am_hal_queue_data_left(&g_psRxQueue[ui32Module]);
+    }
+
+    if ( pui32TxSize )
+    {
+        *pui32TxSize = am_hal_queue_data_left(&g_psTxQueue[ui32Module]);
+    }
+}
+
+
+//*****************************************************************************
+//
+//! @brief Services the buffered UART.
+//!
+//! @param ui32Status is the contents of the UART interrupt status register.
+//!
+//! This function is responsible for servicing the buffered UART. Designed to
+//! be called from the UART interrupt handler.
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_uart_service_buffered(uint32_t ui32Module, uint32_t ui32Status)
+{
+    uint8_t ui8Character = '\x00';
+    uint32_t ui32FifoEntry = 0;
+
+    //
+    // Check to see if we have filled the Rx FIFO past the configured limit, or
+    // if we have an 'old' character or two sitting in the FIFO.
+    //
+    if (ui32Status & (AM_REG_UART_IES_RXRIS_M | AM_REG_UART_IES_RTRIS_M))
+    {
+        //
+        // While there's stuff in the RX fifo....
+        //
+        while (!AM_BFRn(UART, ui32Module, FR, RXFE))
+        {
+            //
+            // Read each character out one by one, and add it to the ring
+            // buffer. This will start losing bytes if the fifo ever overflows.
+            //
+            ui32FifoEntry = AM_REGn(UART, ui32Module , DR);
+
+            //
+            // As long as no error bits were set, we should push this byte to
+            // the FIFO.
+            //
+            if ( (ui32FifoEntry & 0xF00) == 0 )
+            {
+                ui8Character = ui32FifoEntry & 0xFF;
+                am_hal_queue_item_add(&g_psRxQueue[ui32Module], &ui8Character, 1);
+            }
+        }
+    }
+
+    //
+    // Check to see if our TX buffer has been recently emptied. If so, we
+    // should refill it from the TX ring buffer.
+    //
+    if (ui32Status & AM_REG_UART_IES_TXRIS_M)
+    {
+        //
+        // Keep refilling until the fifo is full, or the ring buffer is empty,
+        // whichever happens first.
+        //
+        while (am_hal_queue_data_left(&g_psTxQueue[ui32Module]) &&
+               !AM_BFRn(UART, ui32Module, FR, TXFF))
+        {
+            am_hal_queue_item_get(&g_psTxQueue[ui32Module], &ui8Character, 1);
+            AM_REGn(UART, ui32Module , DR) = ui8Character;
+        }
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Services the buffered UART.
+//!
+//! @param ui32Status is the contents of the UART interrupt status register.
+//!
+//! This function is responsible for servicing the buffered UART. Designed to
+//! be called from the UART interrupt handler.
+//!
+//! This function behaves exactly like am_hal_uart_service_buffered() \e except
+//! it does not completely empty the RX FIFO on every interrupt event. Instead,
+//! it will leave at least one byte behind until it receives a UART RX TIMEOUT
+//! interrupt. If you use this service routine, you can treat the RX TIMEOUT
+//! interrupt as a UART IDLE interrupt. Every time the UART RX line goes IDLE
+//! for 32 consecutive bit-times you WILL receive a UART RX TIMEOUT interrupt.
+//! This behavior is not guaranteed for am_hal_uart_service_buffered().
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_uart_service_buffered_timeout_save(uint32_t ui32Module, uint32_t ui32Status)
+{
+    uint8_t ui8Character = '\x00';
+    uint32_t ui32Count = 0;
+    uint32_t ui32FifoEntry = 0;
+
+    //
+    // Check to see if we have filled the Rx FIFO past the configured limit, or
+    // if we have an 'old' character or two sitting in the FIFO.
+    //
+    if (ui32Status & (AM_REG_UART_IES_RXRIS_M | AM_REG_UART_IES_RTRIS_M))
+    {
+        //
+        // Check to see what our FIFO configuration setting is.
+        //
+        uint32_t ui32FifoThreshold;
+        uint32_t ui32FifoCfg = AM_BFMn(UART, ui32Module, IFLS, RXIFLSEL);
+
+        //
+        // Compute the number of bytes for receive interrupt from the FIFO level
+        // register.
+        //
+        switch(ui32FifoCfg)
+        {
+            case AM_HAL_UART_RX_FIFO_1_8: ui32FifoThreshold = 4; break;
+            case AM_HAL_UART_RX_FIFO_1_4: ui32FifoThreshold = 8; break;
+            case AM_HAL_UART_RX_FIFO_1_2: ui32FifoThreshold = 16; break;
+            case AM_HAL_UART_RX_FIFO_3_4: ui32FifoThreshold = 24; break;
+            case AM_HAL_UART_RX_FIFO_7_8: ui32FifoThreshold = 28; break;
+            default:
+                ui32FifoThreshold = 32;
+        }
+
+        //
+        // While there's stuff in the RX fifo....
+        //
+        while (!AM_BFRn(UART, ui32Module, FR, RXFE))
+        {
+            //
+            // Read each character out one by one, and add it to the ring
+            // buffer. This will start losing bytes if the fifo ever overflows.
+            //
+            ui32FifoEntry = AM_REGn(UART, ui32Module, DR);
+
+            //
+            // As long as no error bits were set, we should push this byte to
+            // the FIFO.
+            //
+            if ( (ui32FifoEntry & 0xF00) == 0)
+            {
+                ui8Character = ui32FifoEntry & 0xFF;
+                am_hal_queue_item_add(&g_psRxQueue[ui32Module], &ui8Character, 1);
+            }
+
+            //
+            // Leave one byte to trigger the RX timeout interrupt.
+            //
+            if ( ++ui32Count >= (ui32FifoThreshold - 1) )
+            {
+                break;
+            }
+        }
+    }
+
+    //
+    // Check to see if our TX buffer has been recently emptied. If so, we
+    // should refill it from the TX ring buffer.
+    //
+    if (ui32Status & AM_REG_UART_IES_TXRIS_M)
+    {
+        //
+        // Keep refilling until the fifo is full, or the ring buffer is empty,
+        // whichever happens first.
+        //
+        while (am_hal_queue_data_left(&g_psTxQueue[ui32Module]) &&
+               !AM_BFRn(UART, ui32Module, FR, TXFF))
+        {
+            am_hal_queue_item_get(&g_psTxQueue[ui32Module], &ui8Character, 1);
+            AM_REGn(UART, ui32Module , DR) = ui8Character;
+        }
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Puts a char in the buffer or directly to the fifo if available.
+//!
+//! @param cChar - Character to send.
+//!
+//! This function puts a character in the buffer or directly to the fifo.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_uart_char_transmit_buffered(uint32_t ui32Module, char cChar)
+{
+    //
+    // Check the status of the Tx fifo and the Tx ring buffer.
+    //
+    if (am_hal_queue_empty(&g_psTxQueue[ui32Module]) &&
+        !AM_BFRn(UART, ui32Module, FR, TXFF))
+    {
+        //
+        // If the fifo isn't full yet, and the ring buffer isn't being used,
+        // just write the new character directly to the fifo.
+        //
+        AM_REGn(UART, ui32Module, DR) = cChar;
+    }
+    else
+    {
+        //
+        // If we get here, either the fifo is full, or the ring buffer is
+        // already in use. In either case, we need to use the ring buffer
+        // to make sure that the transmitted data gets sent in the right
+        // order. If the buffer is already full, we will simply lose this
+        // byte.
+        //
+        am_hal_queue_item_add(&g_psTxQueue[ui32Module], &cChar, 1);
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Puts a null terminaled string in the buffer or directly to the fifo.
+//!
+//! @param pcString - Pointer to buffer used for sending.
+//!
+//! This function puts a string in the buffer or directly to the fifo if there
+//! is space available.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_uart_string_transmit_buffered(uint32_t ui32Module, char *pcString)
+{
+    //
+    // Check the status of the Tx fifo and the Tx ring buffer.
+    //
+    while (*pcString)
+    {
+        if (am_hal_queue_empty(&g_psTxQueue[ui32Module]) &&
+            !AM_BFRn(UART, ui32Module, FR, TXFF))
+        {
+            //
+            // If the fifo isn't full yet, and the ring buffer isn't being used,
+            // just write the new character directly to the fifo.
+            //
+            AM_REGn(UART, ui32Module, DR) = *pcString;
+        }
+        else
+        {
+            //
+            // If we get here, either the fifo is full, or the ring buffer is
+            // already in use. In either case, we need to use the ring buffer
+            // to make sure that the transmitted data gets sent in the right
+            // order. If the buffer is already full, we will simply lose this
+            // byte.
+            //
+            am_hal_queue_item_add(&g_psTxQueue[ui32Module], pcString, 1);
+        }
+
+        //
+        // Move the pointer to the next character.
+        //
+        pcString++;
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Returns n number of characters from the ring buffer or until empty.
+//!
+//! @param pcString - Pointer to buffer for putting received characters.
+//! @param ui32MaxChars - Maximum number of characters to receive.
+//!
+//! This function puts a char string in the buffer.
+//!
+//! @return Returns the number of chars received.
+//
+//*****************************************************************************
+uint32_t
+am_hal_uart_char_receive_buffered(uint32_t ui32Module,
+                                  char *pcString,
+                                  uint32_t ui32MaxChars)
+{
+    uint32_t ui32NumChars = 0;
+
+    //
+    // Loop until ui32MaxChars or until empty.
+    //
+    while (am_hal_queue_data_left(&g_psRxQueue[ui32Module]) && ui32MaxChars)
+    {
+        //
+        // Pull a char out of the ring buffer.
+        //
+        am_hal_queue_item_get(&g_psRxQueue[ui32Module], pcString, 1);
+
+        //
+        // Subtract from ui32MaxChars.
+        // Add to ui32NumChars.
+        // Move pointer in buffer.
+        //
+        ui32MaxChars--;
+        ui32NumChars++;
+        pcString++;
+    }
+
+    //
+    // return the number of chars received.
+    //
+    return ui32NumChars;
+}
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_uart.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_uart.h
new file mode 100644
index 000000000..23f6d99f5
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_uart.h
@@ -0,0 +1,345 @@
+//*****************************************************************************
+//
+//! @file am_hal_uart.h
+//!
+//! @brief Functions for accessing and configuring the UART.
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup uart UART
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_HAL_UART_H
+#define AM_HAL_UART_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+//*****************************************************************************
+//
+//! @name UART Interrupts
+//! @brief Macro definitions for UART FIFO levels.
+//!
+//! They may be used with the \e am_hal_uart_fifo_config() function.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_UART_INT_OVER_RUN            AM_REG_UART_IER_OEIM_M
+#define AM_HAL_UART_INT_BREAK_ERR           AM_REG_UART_IER_BEIM_M
+#define AM_HAL_UART_INT_PARITY_ERR          AM_REG_UART_IER_PEIM_M
+#define AM_HAL_UART_INT_FRAME_ERR           AM_REG_UART_IER_FEIM_M
+#define AM_HAL_UART_INT_RX_TMOUT            AM_REG_UART_IER_RTIM_M
+#define AM_HAL_UART_INT_TX                  AM_REG_UART_IER_TXIM_M
+#define AM_HAL_UART_INT_RX                  AM_REG_UART_IER_RXIM_M
+#define AM_HAL_UART_INT_DSRM                AM_REG_UART_IER_DSRMIM_M
+#define AM_HAL_UART_INT_DCDM                AM_REG_UART_IER_DCDMIM_M
+#define AM_HAL_UART_INT_CTSM                AM_REG_UART_IER_CTSMIM_M
+#define AM_HAL_UART_INT_TXCMP               AM_REG_UART_IER_TXCMPMIM_M
+//! @}
+
+//*****************************************************************************
+//
+//! @name UART FIFO Levels
+//! @brief Macro definitions for RTV interrupt status bits.
+//!
+//! These macros correspond to the bits in the UART interrupt status register.
+//! They may be used with any of the \e am_hal_uart_int_x() functions.
+//!
+//! @{
+//
+//*****************************************************************************
+//TX
+#define AM_HAL_UART_TX_FIFO_1_8             AM_REG_UART_IFLS_TXIFLSEL(0)
+#define AM_HAL_UART_TX_FIFO_1_4             AM_REG_UART_IFLS_TXIFLSEL(1)
+#define AM_HAL_UART_TX_FIFO_1_2             AM_REG_UART_IFLS_TXIFLSEL(2)
+#define AM_HAL_UART_TX_FIFO_3_4             AM_REG_UART_IFLS_TXIFLSEL(3)
+#define AM_HAL_UART_TX_FIFO_7_8             AM_REG_UART_IFLS_TXIFLSEL(4)
+// RX
+#define AM_HAL_UART_RX_FIFO_1_8             AM_REG_UART_IFLS_RXIFLSEL(0)
+#define AM_HAL_UART_RX_FIFO_1_4             AM_REG_UART_IFLS_RXIFLSEL(1)
+#define AM_HAL_UART_RX_FIFO_1_2             AM_REG_UART_IFLS_RXIFLSEL(2)
+#define AM_HAL_UART_RX_FIFO_3_4             AM_REG_UART_IFLS_RXIFLSEL(3)
+#define AM_HAL_UART_RX_FIFO_7_8             AM_REG_UART_IFLS_RXIFLSEL(4)
+//! @}
+
+//*****************************************************************************
+//
+//! @name UART Status Register
+//! @brief Macro definitions for UART Status Register Bits.
+//!
+//! They may be used with the \e am_hal_uart_status_get() function.
+//!
+//! @{
+//
+//*****************************************************************************
+// This is the overrun error indicator.
+#define AM_HAL_UART_RSR_OVERRUN_NOERR       AM_REG_UART_RSR_OESTAT_NOERR
+#define AM_HAL_UART_RSR_OVERRUN_ERROR       AM_REG_UART_RSR_OESTAT_ERR
+
+// This is the break error indicator.
+#define AM_HAL_UART_RSR_BREAK_NOERR         AM_REG_UART_RSR_BESTAT_NOERR
+#define AM_HAL_UART_RSR_BREAK_ERROR         AM_REG_UART_RSR_BESTAT_ERR
+
+// This is the parity error indicator.
+#define AM_HAL_UART_RSR_PARITY_NOERR        AM_REG_UART_RSR_PESTAT_NOERR
+#define AM_HAL_UART_RSR_PARITY_ERROR        AM_REG_UART_RSR_PESTAT_ERR
+
+// This is the framing error indicator.
+#define AM_HAL_UART_RSR_FRAME_ERROR_NOERR   AM_REG_UART_RSR_FESTAT_NOERR
+#define AM_HAL_UART_RSR_FRAME_ERROR_ERROR   AM_REG_UART_RSR_FESTAT_ERR
+//! @}
+
+//*****************************************************************************
+//
+//! @name UART Flag Register
+//! @brief Macro definitions for UART Flag Register Bits.
+//!
+//! They may be used with the \e am_hal_uart_flags_get() function.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_UART_FR_RING                 AM_REG_UART_FR_RI_M
+#define AM_HAL_UART_FR_TX_EMPTY             AM_REG_UART_FR_TXFE_XMTFIFO_EMPTY
+#define AM_HAL_UART_FR_RX_FULL              AM_REG_UART_FR_RXFF_RCVFIFO_FULL
+#define AM_HAL_UART_FR_TX_FULL              AM_REG_UART_FR_TXFF_XMTFIFO_FULL
+#define AM_HAL_UART_FR_RX_EMPTY             AM_REG_UART_FR_RXFE_RCVFIFO_EMPTY
+#define AM_HAL_UART_FR_BUSY                 AM_REG_UART_FR_BUSY_BUSY
+#define AM_HAL_UART_FR_DCD_DETECTED         AM_REG_UART_FR_DCD_DETECTED
+#define AM_HAL_UART_FR_DSR_READY            AM_REG_UART_FR_DSR_READY
+#define AM_HAL_UART_FR_CTS                  AM_REG_UART_FR_CTS_M
+//! @}
+
+
+//*****************************************************************************
+//
+//! @name UART Config Macros
+//! @brief Macro definitions for available Data bits.
+//!
+//! They may be used with the \e am_hal_uart_config_t structure used by \e
+//! am_hal_uart_config().
+//!
+//! @{
+//
+//*****************************************************************************
+//*****************************************************************************
+//
+// Data bits defines.
+//
+//*****************************************************************************
+#define AM_HAL_UART_DATA_BITS_8             AM_REG_UART_LCRH_WLEN(3)
+#define AM_HAL_UART_DATA_BITS_7             AM_REG_UART_LCRH_WLEN(2)
+#define AM_HAL_UART_DATA_BITS_6             AM_REG_UART_LCRH_WLEN(1)
+#define AM_HAL_UART_DATA_BITS_5             0
+
+//*****************************************************************************
+//
+// Parity defines.
+//
+//*****************************************************************************
+#define AM_HAL_UART_PARITY_NONE             0
+#define AM_HAL_UART_PARITY_ODD              AM_REG_UART_LCRH_PEN_M
+#define AM_HAL_UART_PARITY_EVEN             AM_REG_UART_LCRH_PEN_M |       \
+                                            AM_REG_UART_LCRH_EPS_M
+
+//*****************************************************************************
+//
+// Flow control defines.
+//
+//*****************************************************************************
+#define AM_HAL_UART_FLOW_CTRL_NONE          0
+#define AM_HAL_UART_FLOW_CTRL_RTS_CTS       AM_REG_UART_CR_CTSEN_M |       \
+                                            AM_REG_UART_CR_RTSEN_M
+//! @}
+
+//*****************************************************************************
+//
+//! UART configuration structure
+//
+//*****************************************************************************
+typedef struct
+{
+    //
+    //! Desired Baudrate for the UART.
+    //
+    uint32_t ui32BaudRate;
+
+    //
+    //! Number of data bits.
+    //!
+    //! Valid values for ui32DataBits are:
+    //!
+    //!     AM_HAL_UART_DATA_BITS_8
+    //!     AM_HAL_UART_DATA_BITS_7
+    //!     AM_HAL_UART_DATA_BITS_6
+    //!     AM_HAL_UART_DATA_BITS_5
+    //
+    uint32_t ui32DataBits;
+
+    //
+    //! Use two stop bits.
+    //
+    bool bTwoStopBits;
+
+    //
+    //! Parity.
+    //!
+    //! Valid values for ui32Parity are:
+    //!
+    //!     AM_HAL_UART_PARITY_NONE
+    //!     AM_HAL_UART_PARITY_ODD
+    //!     AM_HAL_UART_PARITY_EVEN
+    //
+    uint32_t ui32Parity;
+
+    //
+    //! Flow control.
+    //!
+    //! Valid values for ui32FlowCtrl are:
+    //!
+    //!     AM_HAL_UART_FLOW_CTRL_NONE
+    //!     AM_HAL_UART_FLOW_CTRL_RTS_CTS
+    //
+    uint32_t ui32FlowCtrl;
+}
+am_hal_uart_config_t;
+
+//*****************************************************************************
+//
+// Structure for containing information about the UART's configuration while
+// it is powered down.
+//
+//*****************************************************************************
+typedef struct
+{
+    uint32_t ILPR;
+    uint32_t IBRD;
+    uint32_t FBRD;
+    uint32_t LCRH;
+    uint32_t CR;
+    uint32_t IFLS;
+    uint32_t IER;
+    uint32_t UARTEN;
+    uint32_t bValid;
+}
+am_hal_uart_pwrsave_t;
+
+//*****************************************************************************
+//
+// Global Variables
+//
+//*****************************************************************************
+extern am_hal_uart_pwrsave_t am_hal_uart_pwrsave[AM_REG_UART_NUM_MODULES];
+
+//*****************************************************************************
+//
+// External function definitions
+//
+//*****************************************************************************
+extern void am_hal_uart_pwrctrl_enable(uint32_t ui32Module);
+extern void am_hal_uart_pwrctrl_disable(uint32_t ui32Module);
+extern void am_hal_uart_power_on_restore(uint32_t ui32Module);
+extern void am_hal_uart_power_off_save(uint32_t ui32Module);
+extern void am_hal_uart_config(uint32_t ui32Module,
+                               am_hal_uart_config_t *psConfig);
+extern uint32_t am_hal_uart_status_get(uint32_t ui32Module);
+extern uint32_t am_hal_uart_int_status_get(uint32_t ui32Module,
+                                           bool bEnabledOnly);
+extern void am_hal_uart_int_clear(uint32_t ui32Module,
+                                  uint32_t ui32Interrupt);
+extern void am_hal_uart_int_disable(uint32_t ui32Module,
+                                    uint32_t ui32Interrupt);
+extern void am_hal_uart_int_enable(uint32_t ui32Module,
+                                   uint32_t ui32Interrupt);
+extern uint32_t am_hal_uart_int_enable_get(uint32_t ui32Module);
+extern void am_hal_uart_enable(uint32_t ui32Module);
+extern void am_hal_uart_disable(uint32_t ui32Module);
+extern void am_hal_uart_clock_enable(uint32_t ui32Module);
+extern void am_hal_uart_clock_disable(uint32_t ui32Module);
+extern void am_hal_uart_fifo_config(uint32_t ui32Module, uint32_t ui32LvlCfg);
+extern uint32_t am_hal_uart_flags_get(uint32_t ui32Module);
+
+// rx/tx polled
+extern void am_hal_uart_char_transmit_polled(uint32_t ui32Module,
+                                             char cChar);
+extern void am_hal_uart_string_transmit_polled(uint32_t ui32Module,
+                                               char *pcString);
+extern void am_hal_uart_char_receive_polled(uint32_t ui32Module,
+                                            char *pcChar);
+extern void am_hal_uart_line_receive_polled(uint32_t ui32Module,
+                                            uint32_t ui32MaxChars,
+                                            char *pcChar);
+
+// rx/tx buffered
+extern void am_hal_uart_init_buffered(uint32_t ui32Module,
+                                      uint8_t *pui8RxArray,
+                                      uint32_t ui32RxSize,
+                                      uint8_t *pui8TxArray,
+                                      uint32_t ui32TxSize);
+extern void am_hal_uart_get_status_buffered(uint32_t ui32Module,
+                          uint32_t *pui32RxSize,
+                          uint32_t *pui32TxSize);
+extern void am_hal_uart_service_buffered(uint32_t ui32Module,
+                                         uint32_t ui32Status);
+
+extern void am_hal_uart_service_buffered_timeout_save(uint32_t ui32Module,
+                                                      uint32_t ui32Status);
+extern void am_hal_uart_char_transmit_buffered(uint32_t ui32Module,
+                                               char cChar);
+extern void am_hal_uart_string_transmit_buffered(uint32_t ui32Module,
+                                                 char *pcString);
+extern uint32_t am_hal_uart_char_receive_buffered(uint32_t ui32Module,
+                                                  char *pcString,
+                                                  uint32_t ui32MaxChars);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_HAL_UART_H
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_vcomp.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_vcomp.c
new file mode 100644
index 000000000..5f5906c86
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_vcomp.c
@@ -0,0 +1,287 @@
+//*****************************************************************************
+//
+//! @file am_hal_vcomp.c
+//!
+//! @brief Functions for operating the on-chip Voltage Comparator
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup vcomp Voltage Comparator (VCOMP)
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "am_mcu_apollo.h"
+
+//*****************************************************************************
+//
+//! @brief Configure the Voltage Comparator module.
+//!
+//! @param psConfig is a structure containing configuration information for the
+//! voltage comparator.
+//!
+//! This function configures the positive and negative input signals for the
+//! voltage comparator.
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_vcomp_config(const am_hal_vcomp_config_t *psConfig)
+{
+    //
+    // The configuration word should be a simple OR of the components of the
+    // configuration structure.
+    //
+    AM_REG(VCOMP, CFG) = (psConfig->ui32LevelSelect |
+                          psConfig->ui32PosInput |
+                          psConfig->ui32NegInput);
+}
+
+//*****************************************************************************
+//
+//! @brief Set the Voltage Comparator DAC Level Select in Configuration Reg.
+//!
+//! @param ui32Level - DAC voltage selector (use macros enumerations)
+//!
+//! This function sets the DAC level select in the configuration register.
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_vcomp_dac_level_set(uint32_t ui32Level)
+{
+    //
+    // Insert the supplied level into the vcomp configuration register
+    //
+    AM_BFW(VCOMP, CFG, LVLSEL, ui32Level >> AM_REG_VCOMP_CFG_LVLSEL_S);
+}
+
+//*****************************************************************************
+//
+//! @brief Read the state of the voltage comparator.
+//!
+//! This function extracts the comparator state from the status register.
+//!
+//! @return the voltage comparator state
+//
+//*****************************************************************************
+bool
+am_hal_vcomp_read(void)
+{
+    return (AM_BFR(VCOMP,  STAT, CMPOUT) == 1);
+}
+
+//*****************************************************************************
+//
+//! @brief Enable the voltage comparator.
+//!
+//! This function powers up the voltage comparator.
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_vcomp_enable(void)
+{
+    AM_REG(VCOMP, PWDKEY) = 0;
+}
+
+//*****************************************************************************
+//
+//! @brief Disable the voltage comparator.
+//!
+//! This function powers down the voltage comparator.
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_vcomp_disable(void)
+{
+    AM_REG(VCOMP, PWDKEY) = AM_REG_VCOMP_PWDKEY_KEYVAL;
+}
+
+//*****************************************************************************
+//
+//! @brief Read the state of the voltage comparator interrupt status bits.
+//!
+//! @param bEnabledOnly - return the status of only the enabled interrupts.
+//!
+//! This function extracts the interrupt status bits and returns the raw or
+//! only the enabled based on bEnabledOnly.
+//!
+//! @return Bitwise representation of the current interrupt status.
+//!
+//! The return value will be the logical OR of one or more of the following
+//! values:
+//!
+//! AM_HAL_VCOMP_INT_OUTHI
+//! AM_HAL_VCOMP_INT_OUTLO
+//
+//*****************************************************************************
+uint32_t
+am_hal_vcomp_int_status_get(bool bEnabledOnly)
+{
+    if (bEnabledOnly)
+    {
+        uint32_t u32RetVal = AM_REG(VCOMP, INTSTAT);
+        return u32RetVal & AM_REG(VCOMP, INTEN);
+    }
+    else
+    {
+        return AM_REG(VCOMP, INTSTAT);
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Set the state of the voltage comparator interrupt status bits.
+//!
+//! @param ui32Interrupt - interrupts to be set.
+//!
+//! This function sets the specified interrupt status bits.
+//!
+//! ui32Interrupt should be a logical or of:
+//!
+//! AM_HAL_VCOMP_INT_OUTHI
+//! AM_HAL_VCOMP_INT_OUTLO
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_vcomp_int_set(uint32_t ui32Interrupt)
+{
+    AM_REG(VCOMP, INTSET) = ui32Interrupt;
+}
+
+//*****************************************************************************
+//
+//! @brief Clear the state of the voltage comparator interrupt status bits.
+//!
+//! @param ui32Interrupt - interrupts to be cleared.
+//!
+//! This function clears the specified interrupt status bits.
+//!
+//! ui32Interrupt should be a logical or of:
+//!
+//! AM_HAL_VCOMP_INT_OUTHI
+//! AM_HAL_VCOMP_INT_OUTLO
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_vcomp_int_clear(uint32_t ui32Interrupt)
+{
+    AM_REG(VCOMP, INTCLR) = ui32Interrupt;
+}
+
+//*****************************************************************************
+//
+//! @brief Enable the voltage comparator interrupt status bits.
+//!
+//! @param ui32Interrupt - interrupts to be enabled.
+//!
+//! This function enables desired interrupt status bits.
+//!
+//! ui32Interrupt should be a logical or of:
+//!
+//! AM_HAL_VCOMP_INT_OUTHI
+//! AM_HAL_VCOMP_INT_OUTLO
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_vcomp_int_enable(uint32_t ui32Interrupt)
+{
+    AM_REG(VCOMP, INTEN) |= ui32Interrupt;
+}
+
+//*****************************************************************************
+//
+//! @brief Return the enabled, voltage comparator interrupt status bits.
+//!
+//! This function returns the enabled interrupt status bits
+//!
+//! @return returns the enabled interrupt status bits. The return is a logical
+//! or of:
+//!
+//! AM_HAL_VCOMP_INT_OUTHI
+//! AM_HAL_VCOMP_INT_OUTLO
+//
+//*****************************************************************************
+uint32_t
+am_hal_vcomp_int_enable_get(void)
+{
+    return AM_REG(VCOMP, INTEN);
+}
+
+//*****************************************************************************
+//
+//! @brief Disable the voltage comparator interrupt status bits.
+//!
+//! @param ui32Interrupt - interrupts to be disabled.
+//!
+//! This function disables desired interrupt status bits.
+//!
+//! ui32Interrupt should be a logical or of:
+//!
+//! AM_HAL_VCOMP_INT_OUTHI
+//! AM_HAL_VCOMP_INT_OUTLO
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_vcomp_int_disable(uint32_t ui32Interrupt)
+{
+    AM_REG(VCOMP, INTEN) &= ~ui32Interrupt;
+}
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_vcomp.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_vcomp.h
new file mode 100644
index 000000000..ca3d2cb35
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_vcomp.h
@@ -0,0 +1,176 @@
+//*****************************************************************************
+//
+//! @file am_hal_vcomp.h
+//!
+//! @brief Functions for operating the on-chip Voltage Comparator
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup vcomp Voltage Comparator (VCOMP)
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_HAL_VCOMP_H
+#define AM_HAL_VCOMP_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+//*****************************************************************************
+//
+//! @name Positive Input Selection
+//! @brief Use these macros to determine the positive input to the comparator.
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_VCOMP_PSEL_VDDADJ            AM_REG_VCOMP_CFG_PSEL_VDDADJ
+#define AM_HAL_VCOMP_PSEL_VTEMP             AM_REG_VCOMP_CFG_PSEL_VTEMP
+#define AM_HAL_VCOMP_PSEL_VEXT1             AM_REG_VCOMP_CFG_PSEL_VEXT1
+#define AM_HAL_VCOMP_PSEL_VEXT2             AM_REG_VCOMP_CFG_PSEL_VEXT2
+//! @}
+
+//*****************************************************************************
+//
+//! @name Negative Input Selection
+//! @brief Use these macros to determine the negative input to the comparator.
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_VCOMP_NSEL_VREFEXT1          AM_REG_VCOMP_CFG_NSEL_VREFEXT1
+#define AM_HAL_VCOMP_NSEL_VREFEXT2          AM_REG_VCOMP_CFG_NSEL_VREFEXT2
+#define AM_HAL_VCOMP_NSEL_VREFEXT3          AM_REG_VCOMP_CFG_NSEL_VREFEXT3
+#define AM_HAL_VCOMP_NSEL_DAC_LEVEL         AM_REG_VCOMP_CFG_NSEL_DAC
+//! @}
+
+//*****************************************************************************
+//
+//! @name Negative Input DAC Selectioin
+//! @brief Use these macros to determine the NSEL DAC voltage setting
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_VCOMP_DAC_LVLSEL_0_58V        AM_REG_VCOMP_CFG_LVLSEL_0P58V
+#define AM_HAL_VCOMP_DAC_LVLSEL_0_77V        AM_REG_VCOMP_CFG_LVLSEL_0P77V
+#define AM_HAL_VCOMP_DAC_LVLSEL_0_97V        AM_REG_VCOMP_CFG_LVLSEL_0P97V
+#define AM_HAL_VCOMP_DAC_LVLSEL_1_16V        AM_REG_VCOMP_CFG_LVLSEL_1P16V
+#define AM_HAL_VCOMP_DAC_LVLSEL_1_35V        AM_REG_VCOMP_CFG_LVLSEL_1P35V
+#define AM_HAL_VCOMP_DAC_LVLSEL_1_55V        AM_REG_VCOMP_CFG_LVLSEL_1P55V
+#define AM_HAL_VCOMP_DAC_LVLSEL_1_74V        AM_REG_VCOMP_CFG_LVLSEL_1P74V
+#define AM_HAL_VCOMP_DAC_LVLSEL_1_93V        AM_REG_VCOMP_CFG_LVLSEL_1P93V
+#define AM_HAL_VCOMP_DAC_LVLSEL_2_13V        AM_REG_VCOMP_CFG_LVLSEL_2P13V
+#define AM_HAL_VCOMP_DAC_LVLSEL_2_32V        AM_REG_VCOMP_CFG_LVLSEL_2P32V
+#define AM_HAL_VCOMP_DAC_LVLSEL_2_51V        AM_REG_VCOMP_CFG_LVLSEL_2P51V
+#define AM_HAL_VCOMP_DAC_LVLSEL_2_71V        AM_REG_VCOMP_CFG_LVLSEL_2P71V
+#define AM_HAL_VCOMP_DAC_LVLSEL_2_90V        AM_REG_VCOMP_CFG_LVLSEL_2P90V
+#define AM_HAL_VCOMP_DAC_LVLSEL_3_09V        AM_REG_VCOMP_CFG_LVLSEL_3P09V
+#define AM_HAL_VCOMP_DAC_LVLSEL_3_29V        AM_REG_VCOMP_CFG_LVLSEL_3P29V
+#define AM_HAL_VCOMP_DAC_LVLSEL_3_48V        AM_REG_VCOMP_CFG_LVLSEL_3P48V
+//! @}
+
+//*****************************************************************************
+//
+//! @name Interrupt Status Bits
+//! @brief Interrupt Status Bits for enable/disble use
+//!
+//! These macros may be used to set and clear interrupt bits
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_VCOMP_INT_OUTHI            AM_REG_VCOMP_INTEN_OUTHI_M
+#define AM_HAL_VCOMP_INT_OUTLO            AM_REG_VCOMP_INTEN_OUTLOW_M
+//! @}
+
+//*****************************************************************************
+//
+//! @brief Configuration struct
+//
+//*****************************************************************************
+typedef struct
+{
+    //
+    //! The DAC level setting
+    //
+    uint32_t ui32LevelSelect;
+
+    //
+    //! The "positive" comparator input channel
+    //!
+    //! This channel is usually used as the signal to be monitored.
+    //
+    uint32_t ui32PosInput;
+
+    //
+    //! The "negative" comparator input channel
+    //!
+    //! This channel is usually used as the reference signal.
+    //
+    uint32_t ui32NegInput;
+}
+am_hal_vcomp_config_t;
+
+//*****************************************************************************
+//
+// External function definitions
+//
+//*****************************************************************************
+extern void am_hal_vcomp_config(const am_hal_vcomp_config_t *psConfig);
+extern void am_hal_vcomp_dac_level_set(uint32_t ui3Level);
+extern bool am_hal_vcomp_read(void);
+extern void am_hal_vcomp_enable(void);
+extern void am_hal_vcomp_disable(void);
+extern void am_hal_vcomp_int_enable(uint32_t ui32Interrupt);
+extern uint32_t am_hal_vcomp_int_enable_get(void);
+extern void am_hal_vcomp_int_disable(uint32_t ui32Interrupt);
+extern void am_hal_vcomp_int_clear(uint32_t ui32Interrupt);
+extern void am_hal_vcomp_int_set(uint32_t ui32Interrupt);
+extern uint32_t am_hal_vcomp_int_status_get(bool bEnabledOnly);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_HAL_VCOMP_H
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_wdt.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_wdt.c
new file mode 100644
index 000000000..2937dc89f
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_wdt.c
@@ -0,0 +1,454 @@
+//*****************************************************************************
+//
+//! @file am_hal_wdt.c
+//!
+//! @brief Hardware abstraction layer for the Watchdog Timer module.
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup wdt Watchdog Timer (WDT)
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "am_mcu_apollo.h"
+
+//*****************************************************************************
+//
+// Adjacency check
+//
+// This is related to the timer read workaround. This macro checks to see if
+// the two supplied count values are within one "tick" of eachother. It should
+// still pass in the event of a timer rollover. The "B" read is assumed to
+// follow the "A" read.  The macro returns "TRUE" when the adjacent timer reads
+// can be used.
+//
+//*****************************************************************************
+#define adjacent(A, B)      (((A) == (B)) || (((A) + 1) == (B)) || ((B) == 0))
+
+//*****************************************************************************
+//
+//! @brief Configure the watchdog timer.
+//!
+//! @param psConfig - pointer to a configuration structure containing the
+//! desired watchdog settings.
+//!
+//! This function will set the watchdog configuration register based on the
+//! user's desired settings listed in the structure referenced by psConfig. If
+//! the structure indicates that watchdog interrupts are desired, this function
+//! will also set the interrupt enable bit in the configuration register.
+//!
+//! @note In order to actually receive watchdog interrupt and/or watchdog reset
+//! events, the caller will also need to make sure that the watchdog interrupt
+//! vector is enabled in the ARM NVIC, and that watchdog resets are enabled in
+//! the reset generator module. Otherwise, the watchdog-generated interrupt and
+//! reset events will have no effect.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_wdt_init(const am_hal_wdt_config_t *psConfig)
+{
+    uint32_t ui32ConfigVal;
+    uint16_t ui16IntCount, ui16ResetCount;
+    bool bResetEnabled = psConfig->ui32Config & AM_HAL_WDT_ENABLE_RESET;
+    bool bInterruptEnabled = psConfig->ui32Config & AM_HAL_WDT_ENABLE_INTERRUPT;
+
+    //
+    // Read the desired settings from the psConfig structure.
+    //
+    ui16IntCount = psConfig->ui16InterruptCount;
+    ui16ResetCount = psConfig->ui16ResetCount;
+
+    //
+    // Write the interrupt and reset count values to a temporary variable.
+    //
+    // Accept the passed Config value, but clear the Counts that we are about to set.
+    ui32ConfigVal = psConfig->ui32Config & ~(AM_REG_WDT_CFG_INTVAL_M | AM_REG_WDT_CFG_RESVAL_M);
+    ui32ConfigVal |= AM_WRITE_SM(AM_REG_WDT_CFG_INTVAL, ui16IntCount);
+    ui32ConfigVal |= AM_WRITE_SM(AM_REG_WDT_CFG_RESVAL, ui16ResetCount);
+
+    //
+    // If interrupts should be enabled, set the appropriate bit in the
+    // temporary variable. Also, enable the interrupt in INTEN register in the
+    // watchdog module.
+    //
+    if ( bInterruptEnabled )
+    {
+        //
+        // Enable the watchdog interrupt if the configuration calls for them.
+        //
+        AM_REGn(WDT, 0, INTEN) |= AM_REG_WDT_INTEN_WDT_M;
+    }
+    else
+    {
+        //
+        // Disable the watchdog interrupt if the configuration doesn't call for
+        // watchdog interrupts.
+        //
+        AM_REGn(WDT, 0, INTEN) &= ~AM_REG_WDT_INTEN_WDT_M;
+    }
+
+    //
+    // If resets should be enabled, set the appropriate bit in the temporary
+    // variable.
+    //
+    if ( bResetEnabled )
+    {
+        //
+        // Also enable watchdog resets in the reset module.
+        //
+        AM_REG(RSTGEN, CFG) |= AM_REG_RSTGEN_CFG_WDREN_M;
+    }
+    else
+    {
+        //
+        // Disable watchdog resets in the reset module.
+        //
+        AM_REG(RSTGEN, CFG) &= ~AM_REG_RSTGEN_CFG_WDREN_M;
+    }
+
+    //
+    // Check for a user specified clock select. If none specified then
+    // set 128Hz.
+    //
+    if ( !(psConfig->ui32Config & AM_REG_WDT_CFG_CLKSEL_M) )
+    {
+        ui32ConfigVal |= AM_REG_WDT_CFG_CLKSEL_128HZ;
+    }
+
+    //
+    // Write the saved value to the watchdog configuration register.
+    //
+    AM_REGn(WDT, 0, CFG) = ui32ConfigVal;
+}
+
+//*****************************************************************************
+//
+//! @brief Starts the watchdog timer.
+//!
+//! Enables the watchdog timer tick using the 'enable' bit in the watchdog
+//! configuration register.  This function does not perform any locking of the
+//! watchdog timer, so it can be disabled or reconfigured later.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_wdt_start(void)
+{
+    //
+    // Make sure the watchdog timer is in the "reset" state, and then set the
+    // enable bit to start counting.
+    //
+    AM_REGn(WDT, 0, CFG) |= AM_REG_WDT_CFG_WDTEN_M;
+    AM_REGn(WDT, 0, RSTRT) |= AM_REG_WDT_RSTRT_RSTRT_KEYVALUE;
+
+}
+
+//*****************************************************************************
+//
+//! @brief Stops the watchdog timer.
+//!
+//! Disables the watchdog timer tick by clearing the 'enable' bit in the
+//! watchdog configuration register.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_wdt_halt(void)
+{
+
+    //
+    // Clear the watchdog enable bit.
+    //
+    AM_REGn(WDT, 0, CFG) &= ~AM_REG_WDT_CFG_WDTEN_M;
+}
+
+//*****************************************************************************
+//
+//! @brief Locks the watchdog configuration and starts the watchdog timer.
+//!
+//! This function sets the watchdog "lock" register, which prevents software
+//! from re-configuring the watchdog. This action will also set the enable bit
+//! for the watchdog timer, so it will start counting immediately.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_hal_wdt_lock_and_start(void)
+{
+    //
+    // Write the 'key' value to the watchdog lock register.
+    //
+    AM_REGn(WDT, 0, LOCK) = AM_REG_WDT_LOCK_LOCK_KEYVALUE;
+}
+
+//*****************************************************************************
+//
+//! @brief Read the state of the wdt interrupt status.
+//!
+//! @param bEnabledOnly - return the status of only the enabled interrupts.
+//!
+//! This function extracts the interrupt status bits and returns the enabled or
+//! raw based on bEnabledOnly.
+//!
+//! @return WDT interrupt status.
+//
+//*****************************************************************************
+uint32_t
+am_hal_wdt_int_status_get(bool bEnabledOnly)
+{
+    if (bEnabledOnly)
+    {
+        uint32_t u32RetVal = AM_REG(WDT, INTSTAT);
+        return u32RetVal & AM_REG(WDT, INTEN);
+    }
+    else
+    {
+        return AM_REG(WDT, INTSTAT);
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Set the state of the wdt interrupt status bit.
+//!
+//! This function sets the interrupt bit.
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_wdt_int_set(void)
+{
+    AM_REG(WDT, INTSET) = AM_REG_WDT_INTSET_WDT_M;
+}
+
+//*****************************************************************************
+//
+//! @brief Clear the state of the wdt interrupt status bit.
+//!
+//! This function clear the interrupt bit.
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_wdt_int_clear(void)
+{
+    AM_REGn(WDT, 0, INTCLR) = AM_REG_WDT_INTCLR_WDT_M;
+}
+
+//*****************************************************************************
+//
+//! @brief Enable the wdt interrupt.
+//!
+//! This function enable the interrupt.
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_wdt_int_enable(void)
+{
+    AM_REG(WDT, INTEN) |= AM_REG_WDT_INTSET_WDT_M;
+}
+
+//*****************************************************************************
+//
+//! @brief Return the enabled WDT interrupts.
+//!
+//! This function returns the enabled WDT interrupts.
+//!
+//! @return enabled WDT interrupts.
+//
+//*****************************************************************************
+uint32_t
+am_hal_wdt_int_enable_get(void)
+{
+    return AM_REG(WDT, INTEN);
+}
+
+//*****************************************************************************
+//
+//! @brief Disable the wdt interrupt.
+//!
+//! This function disablee the interrupt.
+//!
+//! @return None
+//
+//*****************************************************************************
+void
+am_hal_wdt_int_disable(void)
+{
+    AM_REG(WDT, INTEN) &= ~AM_REG_WDT_INTSET_WDT_M;
+}
+
+//*****************************************************************************
+//
+// Static function for reading the WDT counter value.
+//
+//*****************************************************************************
+#if defined(__GNUC_STDC_INLINE__)
+__attribute__((naked))
+static
+void
+back2back_read_asm(uint32_t *pui32Array, uint32_t *pui32Register)
+{
+    // pui32Array[] is a pointer to a 3 word data array provided by the caller.
+    // pui32Register = address of the timer to be read.
+    __asm
+    (
+        // Do 3 back-to-back reads of the register
+        "   ldr     r2, [r1, #0]\n"             // Get counter register value
+        "   ldr     r3, [r1, #0]\n"             // Get counter register value again
+        "   ldr     r1, [r1, #0]\n"             // Get counter register value for a third time
+        "   str     r2, [r0, #0]\n"             // Store register value to variable
+        "   str     r3, [r0, #4]\n"             // Store register value to variable
+        "   str     r1, [r0, #8]\n"             // Store register value to variable
+        "   bx      lr\n"
+    );
+}
+
+#elif defined(__ARMCC_VERSION)
+__asm static uint32_t
+back2back_read_asm(uint32_t *pui32Array, uint32_t *pui32Register)
+{
+    ldr     r2, [r1, #0]             // Get TMRn register value
+    ldr     r3, [r1, #0]             // Get TMRn register value again
+    ldr     r1, [r1, #0]             // Get TMRn register value for a third time
+    str     r2, [r0, #0]             // Store register value to variable
+    str     r3, [r0, #4]             // Store register value to variable
+    str     r1, [r0, #8]             // Store register value to variable
+    bx      lr
+}
+
+#elif defined(__IAR_SYSTEMS_ICC__)
+#pragma diag_suppress = Pe940   // Suppress IAR compiler warning about missing
+                                // return statement on a non-void function
+__stackless static uint32_t
+back2back_read_asm(uint32_t *pui32Array, uint32_t *pui32Register)
+{
+    __asm("    ldr     r2, [r1, #0]");  // Get TMRn register value
+    __asm("    ldr     r3, [r1, #0]");  // Get TMRn register value again
+    __asm("    ldr     r1, [r1, #0]");  // Get TMRn register value for a third time
+    __asm("    str     r2, [r0, #0]");  // Store register value to variable
+    __asm("    str     r3, [r0, #4]");  // Store register value to variable
+    __asm("    str     r1, [r0, #8]");  // Store register value to variable
+    __asm("    bx      lr");
+}
+#pragma diag_default = Pe940    // Restore IAR compiler warning
+#endif
+
+
+//*****************************************************************************
+//
+//! @brief Get the wdt counter value.
+//!
+//! This function reads the current value of watch dog timer counter register.
+//!
+//! WARNING caller is responsible for masking interrutps before calling this
+//! function.
+//!
+//! @return None
+//
+//*****************************************************************************
+uint32_t
+am_hal_wdt_counter_get(void)
+{
+  uint32_t ui32Values[3] = {0};
+    uint32_t ui32Value;
+
+    //
+    // First, go read the value from the counter register 3 times
+    // back to back in assembly language.
+    //
+    back2back_read_asm(ui32Values, (uint32_t *)AM_REG_WDTn(0));
+
+    //
+    // Now, we'll figure out which of the three values is the correct time.
+    //
+    if (ui32Values[0] == ui32Values[1])
+    {
+        //
+        // If the first two values match, then neither one was a bad read.
+        // We'll take this as the current time.
+        //
+        ui32Value = ui32Values[1];
+    }
+    else
+    {
+        //
+        // If the first two values didn't match, then one of them might be bad.
+        // If one of the first two values is bad, then the third one should
+        // always be correct. We'll take the third value as the correct count.
+        //
+        ui32Value = ui32Values[2];
+
+        //
+        // If all of the statements about the architecture are true, the third
+        // value should be correct, and it should always be within one count of
+        // either the first or the second value.
+        //
+        // Just in case, we'll check against the previous two values to make
+        // sure that our final answer was reasonable. If it isn't, we will
+        // flag it as a "bad read", and fail this assert statement.
+        //
+        // This shouldn't ever happen, and it hasn't ever happened in any of
+        // our tests so far.
+        //
+        am_hal_debug_assert_msg((adjacent(ui32Values[1], ui32Values[2]) ||
+                                 adjacent(ui32Values[0], ui32Values[2])),
+                                "Bad CDT read");
+    }
+
+    return ui32Value;
+}
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_wdt.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_wdt.h
new file mode 100644
index 000000000..6e6d26467
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/am_hal_wdt.h
@@ -0,0 +1,184 @@
+//*****************************************************************************
+//
+//! @file am_hal_wdt.h
+//!
+//! @brief Hardware abstraction layer for the Watchdog Timer module.
+//!
+//! @addtogroup hal Hardware Abstraction Layer (HAL)
+//! @addtogroup wdt Watchdog Timer (WDT)
+//! @ingroup hal
+//! @{
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_HAL_WDT_H
+#define AM_HAL_WDT_H
+
+#include <stdint.h>
+#include <stdbool.h>
+
+//*****************************************************************************
+//
+// Macro definitions
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+//! @name WDT Clock Divider Selections.
+//! @brief Macro definitions for WDT clock frequencies.
+//!
+//! These macros may be used with the am_hal_wdt_config_t structure to set the
+//! clock frequency of the watch dog timer.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_WDT_LFRC_CLK_DEFAULT AM_REG_WDT_CFG_CLKSEL_128HZ
+#define AM_HAL_WDT_LFRC_CLK_128HZ   AM_REG_WDT_CFG_CLKSEL_128HZ
+#define AM_HAL_WDT_LFRC_CLK_16HZ    AM_REG_WDT_CFG_CLKSEL_16HZ
+#define AM_HAL_WDT_LFRC_CLK_1HZ     AM_REG_WDT_CFG_CLKSEL_1HZ
+#define AM_HAL_WDT_LFRC_CLK_1_16HZ  AM_REG_WDT_CFG_CLKSEL_1_16HZ
+#define AM_HAL_WDT_LFRC_CLK_OFF     AM_REG_WDT_CFG_CLKSEL_OFF
+//! @}
+
+//*****************************************************************************
+//
+//! @name WDT Enable Reset in the WDT Configuration.
+//! @brief Macro definitions for WDT Reset Enable.
+//!
+//! These macros may be used with the am_hal_wdt_config_t structure to enable
+//! the watch dog timer to generate resets to the chip.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_WDT_ENABLE_RESET      AM_REG_WDT_CFG_RESEN(1)
+#define AM_HAL_WDT_DISABLE_RESET     AM_REG_WDT_CFG_RESEN(0)
+//! @}
+
+//*****************************************************************************
+//
+//! @name WDT Enable Interrupt Generation from the WDT Configuration.
+//! @brief Macro definitions for WDT Interrupt Enable.
+//!
+//! These macros may be used with the am_hal_wdt_config_t structure to enable
+//! the watch dog timer to generate generate WDT interrupts.
+//!
+//! @{
+//
+//*****************************************************************************
+#define AM_HAL_WDT_ENABLE_INTERRUPT      AM_REG_WDT_CFG_INTEN(1)
+#define AM_HAL_WDT_DISABLE_INTERRUPT     AM_REG_WDT_CFG_INTEN(0)
+//! @}
+
+//*****************************************************************************
+//
+//! @brief Watchdog timer configuration structure.
+//!
+//! This structure is made to be used with the am_hal_wdt_init() function. It
+//! describes the configuration of the watchdog timer.
+//
+//*****************************************************************************
+typedef struct
+{
+    //! Configuration Values for watchdog timer
+    //! event is generated.
+    uint32_t ui32Config;
+
+    //! Number of watchdog timer ticks allowed before a watchdog interrupt
+    //! event is generated.
+    uint16_t ui16InterruptCount;
+
+    //! Number of watchdog timer ticks allowed before the watchdog will issue a
+    //! system reset.
+    uint16_t ui16ResetCount;
+
+}
+am_hal_wdt_config_t;
+
+
+//*****************************************************************************
+//
+//! @brief Restarts the watchdog timer ("Pets" the dog)
+//!
+//! This function restarts the watchdog timer from the beginning, preventing
+//! any interrupt or reset even from occuring until the next time the watchdog
+//! timer expires.
+//!
+//! @return None.
+//
+//*****************************************************************************
+#define am_hal_wdt_restart()                                                  \
+    do                                                                        \
+    {                                                                         \
+        AM_REGn(WDT, 0, RSTRT) = AM_REG_WDT_RSTRT_RSTRT_KEYVALUE;             \
+        (void)AM_REGn(WDT, 0, RSTRT);                                         \
+    }                                                                         \
+    while(0)
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+//*****************************************************************************
+//
+// External function definitions
+//
+//*****************************************************************************
+extern void am_hal_wdt_init(const am_hal_wdt_config_t *psConfig);
+extern void am_hal_wdt_start(void);
+extern void am_hal_wdt_halt(void);
+extern void am_hal_wdt_lock_and_start(void);
+extern void am_hal_wdt_int_enable(void);
+extern uint32_t am_hal_wdt_int_enable_get(void);
+extern void am_hal_wdt_int_disable(void);
+extern void am_hal_wdt_int_clear(void);
+extern void am_hal_wdt_int_set(void);
+extern uint32_t am_hal_wdt_int_status_get(bool bEnabledOnly);
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_HAL_WDT_H
+
+//*****************************************************************************
+//
+// End Doxygen group.
+//! @}
+//
+//*****************************************************************************
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/atollic_gcc/.cproject b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/atollic_gcc/.cproject
new file mode 100644
index 000000000..6686302c1
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/atollic_gcc/.cproject
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+	<storageModule moduleId="org.eclipse.cdt.core.settings">
+		<cconfiguration id="com.atollic.truestudio.lib.debug.7796040824.4860393155">
+			<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.atollic.truestudio.lib.debug.7796040824.4860393155" moduleId="org.eclipse.cdt.core.settings" name="bin">
+				<macros>
+					<stringMacro name="AMBIQ_ROOT" type="VALUE_TEXT" value="${ProjDirPath}/../../../.."/>
+					<stringMacro name="AM_CFLAGS" type="VALUE_TEXT" value="-mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -ffunction-sections -fdata-sections -MMD -MP -O3 -funroll-loops "/>
+				</macros>
+				<externalSettings>
+					<externalSetting>
+						<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/am_hal_gcc"/>
+						<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/am_hal_gcc/bin"/>
+						<entry flags="RESOLVED" kind="libraryFile" name="am_hal_gcc" srcPrefixMapping="" srcRootPath=""/>
+					</externalSetting>
+				</externalSettings>
+				<extensions>
+					<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+					<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+					<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+				</extensions>
+			</storageModule>
+			<storageModule moduleId="cdtBuildSystem" version="4.0.0">
+				<configuration artifactExtension="a" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib" cleanCommand="rm -f" description="AmbiqSuite bin directory for objects, libs, and executables." id="com.atollic.truestudio.lib.debug.7796040824.4860393155" name="bin" parent="com.atollic.truestudio.lib.debug">
+					<folderInfo id="com.atollic.truestudio.lib.debug.7796040824.4860393155." name="/" resourcePath="">
+						<toolChain id="com.atollic.truestudio.lib.debug.toolchain.394601402" name="Atollic ARM Tools" superClass="com.atollic.truestudio.lib.debug.toolchain">
+							<option id="com.atollic.truestudio.toolchain_options.mcu.1354743296" name="Microcontroller" superClass="com.atollic.truestudio.toolchain_options.mcu" useByScannerDiscovery="false" value="Cortex-M4" valueType="string"/>
+							<option id="com.atollic.truestudio.toolchain_options.vendor.2144693964" name="Vendor name" superClass="com.atollic.truestudio.toolchain_options.vendor" useByScannerDiscovery="false" value="ARM" valueType="string"/>
+							<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="com.atollic.truestudio.lib.debug.toolchain.platform.533176131" isAbstract="false" name="Debug platform" superClass="com.atollic.truestudio.lib.debug.toolchain.platform"/>
+							<builder buildPath="${workspace_loc:/am_hal}/Debug" customBuilderProperties="toolChainpathString=/opt/Atollic_TrueSTUDIO_for_ARM_7.1.2/ARMTools/bin|toolChainpathType=1|com.atollic.truestudio.common_options.target.vendor=ARM|com.atollic.truestudio.common_options.target.mcu=Cortex-M4|" id="com.atollic.truestudio.mbs.builder1.842338050" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.atollic.truestudio.mbs.builder1"/>
+							<tool commandLinePattern="${COMMAND} ${FLAGS} ${AM_CFLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="com.atollic.truestudio.lib.debug.toolchain.as.1948149624" name="Assembler" superClass="com.atollic.truestudio.lib.debug.toolchain.as">
+								<option id="com.atollic.truestudio.common_options.target.mcpu.593896695" name="Microcontroller" superClass="com.atollic.truestudio.common_options.target.mcpu" useByScannerDiscovery="false" value="Cortex-M4" valueType="enumerated"/>
+								<option id="com.atollic.truestudio.common_options.target.endianess.1066485747" name="Endianess" superClass="com.atollic.truestudio.common_options.target.endianess" useByScannerDiscovery="false"/>
+								<option id="com.atollic.truestudio.common_options.target.instr_set.345702985" name="Instruction set" superClass="com.atollic.truestudio.common_options.target.instr_set" useByScannerDiscovery="false" value="com.atollic.truestudio.common_options.target.instr_set.thumb2" valueType="enumerated"/>
+								<option id="com.atollic.truestudio.common_options.target.fpu.2000439272" name="Floating point" superClass="com.atollic.truestudio.common_options.target.fpu" useByScannerDiscovery="false"/>
+								<option id="com.atollic.truestudio.common_options.target.fpucore.1646013442" name="FPU" superClass="com.atollic.truestudio.common_options.target.fpucore" useByScannerDiscovery="false" value="com.atollic.truestudio.common_options.target.fpucore.fpv4-sp-d16" valueType="enumerated"/>
+								<option id="com.atollic.truestudio.common_options.target.interwork.497377956" name="Mix ARM/Thumb" superClass="com.atollic.truestudio.common_options.target.interwork" useByScannerDiscovery="false"/>
+								<inputType id="com.atollic.truestudio.as.input.867900926" name="Input" superClass="com.atollic.truestudio.as.input"/>
+							</tool>
+							<tool commandLinePattern="${COMMAND} ${INPUTS} ${FLAGS} ${AM_CFLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT}" id="com.atollic.truestudio.lib.debug.toolchain.gcc.334071979" name="C Compiler" superClass="com.atollic.truestudio.lib.debug.toolchain.gcc">
+								<option id="com.atollic.truestudio.common_options.target.mcpu.838046259" name="Microcontroller" superClass="com.atollic.truestudio.common_options.target.mcpu" useByScannerDiscovery="false" value="Cortex-M4" valueType="enumerated"/>
+								<option id="com.atollic.truestudio.common_options.target.endianess.1818215375" name="Endianess" superClass="com.atollic.truestudio.common_options.target.endianess" useByScannerDiscovery="false"/>
+								<option id="com.atollic.truestudio.common_options.target.instr_set.1777197316" name="Instruction set" superClass="com.atollic.truestudio.common_options.target.instr_set" useByScannerDiscovery="false" value="com.atollic.truestudio.common_options.target.instr_set.thumb2" valueType="enumerated"/>
+								<option id="com.atollic.truestudio.common_options.target.fpu.170192335" name="Floating point" superClass="com.atollic.truestudio.common_options.target.fpu" useByScannerDiscovery="false"/>
+								<option id="com.atollic.truestudio.common_options.target.fpucore.1457365135" name="FPU" superClass="com.atollic.truestudio.common_options.target.fpucore" useByScannerDiscovery="false" value="com.atollic.truestudio.common_options.target.fpucore.fpv4-sp-d16" valueType="enumerated"/>
+								<option id="com.atollic.truestudio.gcc.optimization.prep_garbage.1688320403" name="Prepare dead code removal " superClass="com.atollic.truestudio.gcc.optimization.prep_garbage" useByScannerDiscovery="false" value="true" valueType="boolean"/>
+								<option id="com.atollic.truestudio.gcc.optimization.prep_data.622389316" name="Prepare dead data removal" superClass="com.atollic.truestudio.gcc.optimization.prep_data" useByScannerDiscovery="false" value="true" valueType="boolean"/>
+								<option id="com.atollic.truestudio.common_options.target.interwork.1678943818" name="Mix ARM/Thumb" superClass="com.atollic.truestudio.common_options.target.interwork" useByScannerDiscovery="false"/>
+								<option id="com.atollic.truestudio.gcc.cstandard.827476387" name="C standard" superClass="com.atollic.truestudio.gcc.cstandard" useByScannerDiscovery="false" value="com.atollic.truestudio.gcc.cstandard.c99" valueType="enumerated"/>
+								<option id="com.atollic.truestudio.gcc.misc.stackusage.4203574732" name="Generate per function stack usage information" superClass="com.atollic.truestudio.gcc.misc.stackusage" useByScannerDiscovery="false" value="false" valueType="boolean"/>
+								<option id="com.atollic.truestudio.gcc.symbols.defined.288842290" name="Defined symbols" superClass="com.atollic.truestudio.gcc.symbols.defined" useByScannerDiscovery="false" valueType="definedSymbols">
+									<listOptionValue builtIn="false" value="AM_DEBUG_ASSERT"/>
+									<listOptionValue builtIn="false" value="AM_ASSERT_INVALID_THRESHOLD=0"/>
+									<listOptionValue builtIn="false" value="AM_PART_APOLLO2"/>
+								</option>
+								<option id="com.atollic.truestudio.gcc.directories.select.2143287876" name="Include path" superClass="com.atollic.truestudio.gcc.directories.select" useByScannerDiscovery="false" valueType="includePath">
+									<listOptionValue builtIn="false" value="&quot;${AMBIQ_ROOT}/mcu/apollo2&quot;"/>
+									<listOptionValue builtIn="false" value="&quot;${AMBIQ_ROOT}/utils&quot;"/>
+								</option>
+								<option id="com.atollic.truestudio.lib.debug.toolchain.gcc.optimization.level.835363915" name="Optimization Level" superClass="com.atollic.truestudio.lib.debug.toolchain.gcc.optimization.level" useByScannerDiscovery="false" value="com.atollic.truestudio.gcc.optimization.level.03" valueType="enumerated"/>
+								<inputType id="com.atollic.truestudio.gcc.input.1533629434" superClass="com.atollic.truestudio.gcc.input"/>
+							</tool>
+							<tool id="com.atollic.truestudio.ld.base.2090792853" name="C Linker" superClass="com.atollic.truestudio.ld.base">
+								<option id="com.atollic.truestudio.common_options.target.mcpu.534981459" name="Microcontroller" superClass="com.atollic.truestudio.common_options.target.mcpu" value="Cortex-M4" valueType="enumerated"/>
+								<option id="com.atollic.truestudio.common_options.target.endianess.530803548" name="Endianess" superClass="com.atollic.truestudio.common_options.target.endianess"/>
+								<option id="com.atollic.truestudio.common_options.target.instr_set.50355545" name="Instruction set" superClass="com.atollic.truestudio.common_options.target.instr_set" value="com.atollic.truestudio.common_options.target.instr_set.thumb2" valueType="enumerated"/>
+								<option id="com.atollic.truestudio.common_options.target.fpucore.346486819" name="FPU" superClass="com.atollic.truestudio.common_options.target.fpucore" value="com.atollic.truestudio.common_options.target.fpucore.fpv4-sp-d16" valueType="enumerated"/>
+								<option id="com.atollic.truestudio.common_options.target.fpu.761861802" name="Floating point" superClass="com.atollic.truestudio.common_options.target.fpu"/>
+								<option id="com.atollic.truestudio.common_options.target.interwork.1876189673" name="Mix ARM/Thumb" superClass="com.atollic.truestudio.common_options.target.interwork"/>
+							</tool>
+							<tool id="com.atollic.truestudio.lib.debug.toolchain.gpp.1655758199" name="C++ Compiler" superClass="com.atollic.truestudio.lib.debug.toolchain.gpp">
+								<option id="com.atollic.truestudio.common_options.target.mcpu.124401054" name="Microcontroller" superClass="com.atollic.truestudio.common_options.target.mcpu" value="Cortex-M4" valueType="enumerated"/>
+								<option id="com.atollic.truestudio.common_options.target.endianess.518599455" name="Endianess" superClass="com.atollic.truestudio.common_options.target.endianess"/>
+								<option id="com.atollic.truestudio.common_options.target.instr_set.737193089" name="Instruction set" superClass="com.atollic.truestudio.common_options.target.instr_set" value="com.atollic.truestudio.common_options.target.instr_set.thumb2" valueType="enumerated"/>
+								<option id="com.atollic.truestudio.common_options.target.fpu.1192067870" name="Floating point" superClass="com.atollic.truestudio.common_options.target.fpu"/>
+								<option id="com.atollic.truestudio.common_options.target.fpucore.1036264945" name="FPU" superClass="com.atollic.truestudio.common_options.target.fpucore" value="com.atollic.truestudio.common_options.target.fpucore.fpv4-sp-d16" valueType="enumerated"/>
+								<option id="com.atollic.truestudio.gpp.optimization.prep_garbage.2250624" name="Prepare dead code removal" superClass="com.atollic.truestudio.gpp.optimization.prep_garbage" value="true" valueType="boolean"/>
+								<option id="com.atollic.truestudio.gpp.optimization.prep_data.2146225781" name="Prepare dead data removal" superClass="com.atollic.truestudio.gpp.optimization.prep_data" value="true" valueType="boolean"/>
+								<option id="com.atollic.truestudio.gpp.optimization.fno_rtti.2025223247" name="Disable RTTI" superClass="com.atollic.truestudio.gpp.optimization.fno_rtti"/>
+								<option id="com.atollic.truestudio.gpp.optimization.fno_exceptions.2060169458" name="Disable exception handling" superClass="com.atollic.truestudio.gpp.optimization.fno_exceptions"/>
+								<option id="com.atollic.truestudio.common_options.target.interwork.1742976288" name="Mix ARM/Thumb" superClass="com.atollic.truestudio.common_options.target.interwork"/>
+							</tool>
+							<tool id="com.atollic.truestudio.ldcc.base.1595434793" name="C++ Linker" superClass="com.atollic.truestudio.ldcc.base">
+								<option id="com.atollic.truestudio.common_options.target.mcpu.1773797967" name="Microcontroller" superClass="com.atollic.truestudio.common_options.target.mcpu" value="Cortex-M4" valueType="enumerated"/>
+								<option id="com.atollic.truestudio.common_options.target.endianess.2110981505" name="Endianess" superClass="com.atollic.truestudio.common_options.target.endianess"/>
+								<option id="com.atollic.truestudio.common_options.target.instr_set.1652491256" name="Instruction set" superClass="com.atollic.truestudio.common_options.target.instr_set" value="com.atollic.truestudio.common_options.target.instr_set.thumb2" valueType="enumerated"/>
+								<option id="com.atollic.truestudio.common_options.target.fpucore.661745976" name="FPU" superClass="com.atollic.truestudio.common_options.target.fpucore" value="com.atollic.truestudio.common_options.target.fpucore.fpv4-sp-d16" valueType="enumerated"/>
+								<option id="com.atollic.truestudio.common_options.target.fpu.854349055" name="Floating point" superClass="com.atollic.truestudio.common_options.target.fpu"/>
+								<option id="com.atollic.truestudio.common_options.target.interwork.945089238" name="Mix ARM/Thumb" superClass="com.atollic.truestudio.common_options.target.interwork"/>
+							</tool>
+							<tool id="com.atollic.truestudio.lib.debug.toolchain.ar.947682620" name="Archiver" superClass="com.atollic.truestudio.lib.debug.toolchain.ar">
+								<option id="com.atollic.truestudio.ar.general.flags.538181425" name="Archiver flags" superClass="com.atollic.truestudio.ar.general.flags" useByScannerDiscovery="false" value="-rsvc" valueType="string"/>
+							</tool>
+							<tool id="com.atollic.truestudio.secoutput.base.853996171" name="Other" superClass="com.atollic.truestudio.secoutput.base"/>
+						</toolChain>
+					</folderInfo>
+					<sourceEntries>
+						<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
+					</sourceEntries>
+				</configuration>
+			</storageModule>
+			<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+		</cconfiguration>
+	</storageModule>
+	<storageModule moduleId="cdtBuildSystem" version="4.0.0">
+		<project id="am_hal.com.atollic.truestudio.lib.1804033404" name="Static Library" projectType="com.atollic.truestudio.lib"/>
+	</storageModule>
+	<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+	<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
+	<storageModule moduleId="scannerConfiguration">
+		<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+		<scannerConfigBuildInfo instanceId="com.atollic.truestudio.lib.debug.7796040824.4860393155;com.atollic.truestudio.lib.debug.7796040824.4860393155.;com.atollic.truestudio.lib.debug.toolchain.gcc.334071979;com.atollic.truestudio.gcc.input.1533629434">
+			<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="com.atollic.truestudio.mbs.ARMToolsPerProjectProfileC"/>
+		</scannerConfigBuildInfo>
+	</storageModule>
+	<storageModule moduleId="refreshScope" versionNumber="2">
+		<configuration configurationName="bin">
+			<resource resourceType="PROJECT" workspacePath="/am_hal_gcc"/>
+		</configuration>
+	</storageModule>
+</cproject>
+
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/atollic_gcc/.project b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/atollic_gcc/.project
new file mode 100644
index 000000000..74dd90211
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/atollic_gcc/.project
@@ -0,0 +1,184 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>am_hal_gcc</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+			<triggers>clean,full,incremental,</triggers>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+			<triggers>full,incremental,</triggers>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.cdt.core.cnature</nature>
+		<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+		<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+	</natures>
+	<linkedResources>
+		<link>
+			<name>source_files</name>
+			<type>2</type>
+			<locationURI>virtual:/virtual</locationURI>
+		</link>
+		<link>
+			<name>source_files/am_hal_adc.c</name>
+			<type>1</type>
+			<locationURI>EXAMPLE_LOC/am_hal_adc.c</locationURI>
+		</link>
+		<link>
+			<name>source_files/am_hal_cachectrl.c</name>
+			<type>1</type>
+			<locationURI>EXAMPLE_LOC/am_hal_cachectrl.c</locationURI>
+		</link>
+		<link>
+			<name>source_files/am_hal_clkgen.c</name>
+			<type>1</type>
+			<locationURI>EXAMPLE_LOC/am_hal_clkgen.c</locationURI>
+		</link>
+		<link>
+			<name>source_files/am_hal_ctimer.c</name>
+			<type>1</type>
+			<locationURI>EXAMPLE_LOC/am_hal_ctimer.c</locationURI>
+		</link>
+		<link>
+			<name>source_files/am_hal_debug.c</name>
+			<type>1</type>
+			<locationURI>EXAMPLE_LOC/am_hal_debug.c</locationURI>
+		</link>
+		<link>
+			<name>source_files/am_hal_flash.c</name>
+			<type>1</type>
+			<locationURI>EXAMPLE_LOC/am_hal_flash.c</locationURI>
+		</link>
+		<link>
+			<name>source_files/am_hal_global.c</name>
+			<type>1</type>
+			<locationURI>EXAMPLE_LOC/am_hal_global.c</locationURI>
+		</link>
+		<link>
+			<name>source_files/am_hal_gpio.c</name>
+			<type>1</type>
+			<locationURI>EXAMPLE_LOC/am_hal_gpio.c</locationURI>
+		</link>
+		<link>
+			<name>source_files/am_hal_i2c_bit_bang.c</name>
+			<type>1</type>
+			<locationURI>EXAMPLE_LOC/am_hal_i2c_bit_bang.c</locationURI>
+		</link>
+		<link>
+			<name>source_files/am_hal_interrupt.c</name>
+			<type>1</type>
+			<locationURI>EXAMPLE_LOC/am_hal_interrupt.c</locationURI>
+		</link>
+		<link>
+			<name>source_files/am_hal_iom.c</name>
+			<type>1</type>
+			<locationURI>EXAMPLE_LOC/am_hal_iom.c</locationURI>
+		</link>
+		<link>
+			<name>source_files/am_hal_ios.c</name>
+			<type>1</type>
+			<locationURI>EXAMPLE_LOC/am_hal_ios.c</locationURI>
+		</link>
+		<link>
+			<name>source_files/am_hal_itm.c</name>
+			<type>1</type>
+			<locationURI>EXAMPLE_LOC/am_hal_itm.c</locationURI>
+		</link>
+		<link>
+			<name>source_files/am_hal_mcuctrl.c</name>
+			<type>1</type>
+			<locationURI>EXAMPLE_LOC/am_hal_mcuctrl.c</locationURI>
+		</link>
+		<link>
+			<name>source_files/am_hal_otp.c</name>
+			<type>1</type>
+			<locationURI>EXAMPLE_LOC/am_hal_otp.c</locationURI>
+		</link>
+		<link>
+			<name>source_files/am_hal_pdm.c</name>
+			<type>1</type>
+			<locationURI>EXAMPLE_LOC/am_hal_pdm.c</locationURI>
+		</link>
+		<link>
+			<name>source_files/am_hal_pwrctrl.c</name>
+			<type>1</type>
+			<locationURI>EXAMPLE_LOC/am_hal_pwrctrl.c</locationURI>
+		</link>
+		<link>
+			<name>source_files/am_hal_queue.c</name>
+			<type>1</type>
+			<locationURI>EXAMPLE_LOC/am_hal_queue.c</locationURI>
+		</link>
+		<link>
+			<name>source_files/am_hal_reset.c</name>
+			<type>1</type>
+			<locationURI>EXAMPLE_LOC/am_hal_reset.c</locationURI>
+		</link>
+		<link>
+			<name>source_files/am_hal_rtc.c</name>
+			<type>1</type>
+			<locationURI>EXAMPLE_LOC/am_hal_rtc.c</locationURI>
+		</link>
+		<link>
+			<name>source_files/am_hal_stimer.c</name>
+			<type>1</type>
+			<locationURI>EXAMPLE_LOC/am_hal_stimer.c</locationURI>
+		</link>
+		<link>
+			<name>source_files/am_hal_sysctrl.c</name>
+			<type>1</type>
+			<locationURI>EXAMPLE_LOC/am_hal_sysctrl.c</locationURI>
+		</link>
+		<link>
+			<name>source_files/am_hal_systick.c</name>
+			<type>1</type>
+			<locationURI>EXAMPLE_LOC/am_hal_systick.c</locationURI>
+		</link>
+		<link>
+			<name>source_files/am_hal_tpiu.c</name>
+			<type>1</type>
+			<locationURI>EXAMPLE_LOC/am_hal_tpiu.c</locationURI>
+		</link>
+		<link>
+			<name>source_files/am_hal_ttp.c</name>
+			<type>1</type>
+			<locationURI>EXAMPLE_LOC/am_hal_ttp.c</locationURI>
+		</link>
+		<link>
+			<name>source_files/am_hal_uart.c</name>
+			<type>1</type>
+			<locationURI>EXAMPLE_LOC/am_hal_uart.c</locationURI>
+		</link>
+		<link>
+			<name>source_files/am_hal_vcomp.c</name>
+			<type>1</type>
+			<locationURI>EXAMPLE_LOC/am_hal_vcomp.c</locationURI>
+		</link>
+		<link>
+			<name>source_files/am_hal_wdt.c</name>
+			<type>1</type>
+			<locationURI>EXAMPLE_LOC/am_hal_wdt.c</locationURI>
+		</link>
+	</linkedResources>
+	<variableList>
+		<variable>
+			<name>AMBIQ_ROOT</name>
+			<value>$%7BPARENT-4-PROJECT_LOC%7D</value>
+		</variable>
+		<variable>
+			<name>EXAMPLE_LOC</name>
+			<value>$%7BPARENT-1-PROJECT_LOC%7D</value>
+		</variable>
+	</variableList>
+</projectDescription>
+
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/atollic_gcc/.settings/com.atollic.truestudio.debug.hardware_device.prefs b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/atollic_gcc/.settings/com.atollic.truestudio.debug.hardware_device.prefs
new file mode 100644
index 000000000..8db2d4e99
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/atollic_gcc/.settings/com.atollic.truestudio.debug.hardware_device.prefs
@@ -0,0 +1,11 @@
+BOARD=None
+CODE_LOCATION=FLASH
+ENDIAN=Little-endian
+MCU=Cortex-M4
+MCU_VENDOR=ARM
+MODEL=Lite
+PROJECT_FORMAT_VERSION=2
+TARGET=ARM\u00AE
+VERSION=7.1.0
+eclipse.preferences.version=1
+
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/atollic_gcc/.settings/com.atollic.truestudio.tsp.prefs b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/atollic_gcc/.settings/com.atollic.truestudio.tsp.prefs
new file mode 100644
index 000000000..4106cb164
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/atollic_gcc/.settings/com.atollic.truestudio.tsp.prefs
@@ -0,0 +1,4 @@
+eclipse.preferences.version=1
+svd_custom_file_path=
+svd_file_path=${AMBIQ_ROOT}/pack/SVD/apollo2.svd
+
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/atollic_gcc/.settings/language.settings.xml b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/atollic_gcc/.settings/language.settings.xml
new file mode 100644
index 000000000..a3a5b0224
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/atollic_gcc/.settings/language.settings.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<project>
+	<configuration id="com.atollic.truestudio.lib.debug.7796040824.4860393155" name="bin">
+		<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
+			<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
+			<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
+			<provider class="com.atollic.truestudio.mbs.GCCSpecsDetectorAtollicArm" console="false" env-hash="1292331279938990028" id="com.atollic.truestudio.mbs.provider" keep-relative-paths="false" name="Atollic ARM Tools Language Settings" parameter="${COMMAND} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
+				<language-scope id="org.eclipse.cdt.core.gcc"/>
+				<language-scope id="org.eclipse.cdt.core.g++"/>
+			</provider>
+		</extension>
+	</configuration>
+</project>
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/atollic_gcc/.settings/org.eclipse.cdt.managedbuilder.core.prefs b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/atollic_gcc/.settings/org.eclipse.cdt.managedbuilder.core.prefs
new file mode 100644
index 000000000..11e734387
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/atollic_gcc/.settings/org.eclipse.cdt.managedbuilder.core.prefs
@@ -0,0 +1,37 @@
+eclipse.preferences.version=1
+environment/buildEnvironmentInclude/com.atollic.truestudio.exe.debug.392750561.493989912/CPATH/delimiter=;
+environment/buildEnvironmentInclude/com.atollic.truestudio.exe.debug.392750561.493989912/CPATH/operation=remove
+environment/buildEnvironmentInclude/com.atollic.truestudio.exe.debug.392750561.493989912/C_INCLUDE_PATH/delimiter=;
+environment/buildEnvironmentInclude/com.atollic.truestudio.exe.debug.392750561.493989912/C_INCLUDE_PATH/operation=remove
+environment/buildEnvironmentInclude/com.atollic.truestudio.exe.debug.392750561.493989912/append=true
+environment/buildEnvironmentInclude/com.atollic.truestudio.exe.debug.392750561.493989912/appendContributed=true
+environment/buildEnvironmentInclude/com.atollic.truestudio.exe.debug.392750561/CPATH/delimiter=;
+environment/buildEnvironmentInclude/com.atollic.truestudio.exe.debug.392750561/CPATH/operation=remove
+environment/buildEnvironmentInclude/com.atollic.truestudio.exe.debug.392750561/C_INCLUDE_PATH/delimiter=;
+environment/buildEnvironmentInclude/com.atollic.truestudio.exe.debug.392750561/C_INCLUDE_PATH/operation=remove
+environment/buildEnvironmentInclude/com.atollic.truestudio.exe.debug.392750561/append=true
+environment/buildEnvironmentInclude/com.atollic.truestudio.exe.debug.392750561/appendContributed=true
+environment/buildEnvironmentInclude/com.atollic.truestudio.exe.debug.4949424832/CPATH/delimiter=\:
+environment/buildEnvironmentInclude/com.atollic.truestudio.exe.debug.4949424832/CPATH/operation=remove
+environment/buildEnvironmentInclude/com.atollic.truestudio.exe.debug.4949424832/C_INCLUDE_PATH/delimiter=\:
+environment/buildEnvironmentInclude/com.atollic.truestudio.exe.debug.4949424832/C_INCLUDE_PATH/operation=remove
+environment/buildEnvironmentInclude/com.atollic.truestudio.exe.debug.4949424832/append=true
+environment/buildEnvironmentInclude/com.atollic.truestudio.exe.debug.4949424832/appendContributed=true
+environment/buildEnvironmentInclude/com.atollic.truestudio.lib.debug.7796040824.4860393155/CPATH/delimiter=;
+environment/buildEnvironmentInclude/com.atollic.truestudio.lib.debug.7796040824.4860393155/CPATH/operation=remove
+environment/buildEnvironmentInclude/com.atollic.truestudio.lib.debug.7796040824.4860393155/C_INCLUDE_PATH/delimiter=;
+environment/buildEnvironmentInclude/com.atollic.truestudio.lib.debug.7796040824.4860393155/C_INCLUDE_PATH/operation=remove
+environment/buildEnvironmentInclude/com.atollic.truestudio.lib.debug.7796040824.4860393155/append=true
+environment/buildEnvironmentInclude/com.atollic.truestudio.lib.debug.7796040824.4860393155/appendContributed=true
+environment/buildEnvironmentLibrary/com.atollic.truestudio.exe.debug.392750561.493989912/LIBRARY_PATH/delimiter=;
+environment/buildEnvironmentLibrary/com.atollic.truestudio.exe.debug.392750561.493989912/LIBRARY_PATH/operation=remove
+environment/buildEnvironmentLibrary/com.atollic.truestudio.exe.debug.392750561.493989912/append=true
+environment/buildEnvironmentLibrary/com.atollic.truestudio.exe.debug.392750561.493989912/appendContributed=true
+environment/buildEnvironmentLibrary/com.atollic.truestudio.exe.debug.392750561/LIBRARY_PATH/delimiter=;
+environment/buildEnvironmentLibrary/com.atollic.truestudio.exe.debug.392750561/LIBRARY_PATH/operation=remove
+environment/buildEnvironmentLibrary/com.atollic.truestudio.exe.debug.392750561/append=true
+environment/buildEnvironmentLibrary/com.atollic.truestudio.exe.debug.392750561/appendContributed=true
+environment/buildEnvironmentLibrary/com.atollic.truestudio.exe.debug.4949424832/LIBRARY_PATH/delimiter=\:
+environment/buildEnvironmentLibrary/com.atollic.truestudio.exe.debug.4949424832/LIBRARY_PATH/operation=remove
+environment/buildEnvironmentLibrary/com.atollic.truestudio.exe.debug.4949424832/append=true
+environment/buildEnvironmentLibrary/com.atollic.truestudio.exe.debug.4949424832/appendContributed=true
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/atollic_gcc/Makefile b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/atollic_gcc/Makefile
new file mode 100644
index 000000000..73ffd93da
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/atollic_gcc/Makefile
@@ -0,0 +1,85 @@
+#******************************************************************************
+#
+# Makefile - Rules for building the libraries, examples and docs.
+#
+# Copyright (c) 2017, Ambiq Micro
+# All rights reserved.
+# 
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# 
+# 1. Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# 
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 
+# 3. Neither the name of the copyright holder nor the names of its
+# contributors may be used to endorse or promote products derived from this
+# software without specific prior written permission.
+# 
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+#
+#******************************************************************************
+TARGET = libam_hal
+COMPILERNAME = gcc
+PROJECT = libam_hal_gcc
+CONFIG = bin
+
+#### Setup ####
+WITHCC=w/$(COMPILERNAME)
+
+.PHONY: all clean
+
+#### Required Executables ####
+ECLIPSE = '$(shell which TrueSTUDIO 2>/dev/null)'
+RM = $(shell which rm 2>/dev/null)
+
+EXECUTABLES = ECLIPSE RM
+K := $(foreach exec,$(EXECUTABLES),\
+        $(if $(shell which $($(exec)) 2>/dev/null),,\
+        $(info $(exec) not found on PATH ($($(exec))).)$(exec)))
+$(if $(strip $(value K)),$(info Required Program(s) $(strip $(value K)) not found))
+
+ifneq ($(strip $(value K)),)
+all clean:
+	$(info Tools $(WITHCC) not installed.)
+else
+
+#### Rules ####
+all: $(CONFIG)/$(PROJECT).a
+
+$(CONFIG):
+	@+mkdir -p $@
+
+# BIN target requires post build step: objcopy elf to bin.
+$(CONFIG)/$(PROJECT).a: $(CONFIG)
+	@+echo " Building $(WITHCC) $@..." ;\
+	WKSP=$$(mktemp -d) ;\
+	$(ECLIPSE) --launcher.suppressErrors -nosplash -data "$$WKSP" \
+	    -application org.eclipse.cdt.managedbuilder.core.headlessbuild \
+	    -import ./  -E cross_rm=$(RM) -cleanBuild .*/.*$(CONFIG).* \
+	     1> '$(PROJECT).log' 2> '$(PROJECT).errlog' ;\
+	$(RM) -rf $$WKSP
+
+OBJS =  $(CONFIG)/**/*
+
+clean:
+	@+echo Cleaning... ;\
+	rm -rf bin
+
+endif
+
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/atollic_gcc/libam_hal_gcc.errlog b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/atollic_gcc/libam_hal_gcc.errlog
new file mode 100644
index 000000000..e69de29bb
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/atollic_gcc/libam_hal_gcc.log b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/atollic_gcc/libam_hal_gcc.log
new file mode 100644
index 000000000..6d270cb6f
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/atollic_gcc/libam_hal_gcc.log
@@ -0,0 +1,71 @@
+Create.
+Opening 'am_hal_gcc'.
+Refreshing '/am_hal_gcc'.
+21:23:30 **** Clean-only build of configuration bin for project am_hal_gcc ****
+rm -f source_files/am_hal_global.o libam_hal_gcc.a source_files/am_hal_pdm.o source_files/am_hal_tpiu.d source_files/am_hal_sysctrl.o source_files/am_hal_debug.o source_files/am_hal_adc.d source_files/am_hal_stimer.d source_files/am_hal_tpiu.o source_files/am_hal_uart.o source_files/am_hal_reset.o source_files/am_hal_pdm.d source_files/am_hal_ttp.o source_files/am_hal_uart.d source_files/am_hal_sysctrl.d source_files/am_hal_debug.d source_files/am_hal_reset.d source_files/am_hal_clkgen.d source_files/am_hal_stimer.o source_files/am_hal_ctimer.o source_files/am_hal_queue.d source_files/am_hal_clkgen.o source_files/am_hal_queue.o source_files/am_hal_ttp.d source_files/am_hal_global.d source_files/am_hal_i2c_bit_bang.d source_files/am_hal_flash.d source_files/am_hal_ctimer.d source_files/am_hal_i2c_bit_bang.o source_files/am_hal_systick.o source_files/am_hal_pwrctrl.d source_files/am_hal_interrupt.d source_files/am_hal_systick.d source_files/am_hal_adc.o source_files/am_hal_gpio.o source_files/am_hal_rtc.d source_files/am_hal_flash.o source_files/am_hal_itm.d source_files/am_hal_itm.o source_files/am_hal_interrupt.o source_files/am_hal_gpio.d source_files/am_hal_rtc.o source_files/am_hal_otp.d source_files/am_hal_ios.o source_files/am_hal_iom.o source_files/am_hal_pwrctrl.o source_files/am_hal_wdt.o source_files/am_hal_mcuctrl.o source_files/am_hal_cachectrl.o source_files/am_hal_iom.d source_files/am_hal_wdt.d source_files/am_hal_vcomp.d source_files/am_hal_cachectrl.d source_files/am_hal_ios.d source_files/am_hal_vcomp.o source_files/am_hal_mcuctrl.d source_files/am_hal_otp.o 
+
+21:23:31 Build Finished (took 277ms)
+
+21:23:31 **** Rebuild of configuration bin for project am_hal_gcc ****
+Info: Internal Builder is used for build
+arm-atollic-eabi-gcc -c ..\..\am_hal_reset.c -mthumb -mcpu=cortex-m4 -std=c99 -DAM_DEBUG_ASSERT -DAM_ASSERT_INVALID_THRESHOLD=0 -DAM_PART_APOLLO2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../mcu/apollo2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../utils -O3 -ffunction-sections -fdata-sections -g -Wall -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -ffunction-sections -fdata-sections -MMD -MP -O3 -funroll-loops -o source_files\am_hal_reset.o 
+arm-atollic-eabi-gcc -c ..\..\am_hal_mcuctrl.c -mthumb -mcpu=cortex-m4 -std=c99 -DAM_DEBUG_ASSERT -DAM_ASSERT_INVALID_THRESHOLD=0 -DAM_PART_APOLLO2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../mcu/apollo2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../utils -O3 -ffunction-sections -fdata-sections -g -Wall -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -ffunction-sections -fdata-sections -MMD -MP -O3 -funroll-loops -o source_files\am_hal_mcuctrl.o 
+arm-atollic-eabi-gcc -c ..\..\am_hal_otp.c -mthumb -mcpu=cortex-m4 -std=c99 -DAM_DEBUG_ASSERT -DAM_ASSERT_INVALID_THRESHOLD=0 -DAM_PART_APOLLO2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../mcu/apollo2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../utils -O3 -ffunction-sections -fdata-sections -g -Wall -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -ffunction-sections -fdata-sections -MMD -MP -O3 -funroll-loops -o source_files\am_hal_otp.o 
+arm-atollic-eabi-gcc -c ..\..\am_hal_ttp.c -mthumb -mcpu=cortex-m4 -std=c99 -DAM_DEBUG_ASSERT -DAM_ASSERT_INVALID_THRESHOLD=0 -DAM_PART_APOLLO2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../mcu/apollo2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../utils -O3 -ffunction-sections -fdata-sections -g -Wall -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -ffunction-sections -fdata-sections -MMD -MP -O3 -funroll-loops -o source_files\am_hal_ttp.o 
+arm-atollic-eabi-gcc -c ..\..\am_hal_debug.c -mthumb -mcpu=cortex-m4 -std=c99 -DAM_DEBUG_ASSERT -DAM_ASSERT_INVALID_THRESHOLD=0 -DAM_PART_APOLLO2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../mcu/apollo2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../utils -O3 -ffunction-sections -fdata-sections -g -Wall -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -ffunction-sections -fdata-sections -MMD -MP -O3 -funroll-loops -o source_files\am_hal_debug.o 
+arm-atollic-eabi-gcc -c ..\..\am_hal_flash.c -mthumb -mcpu=cortex-m4 -std=c99 -DAM_DEBUG_ASSERT -DAM_ASSERT_INVALID_THRESHOLD=0 -DAM_PART_APOLLO2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../mcu/apollo2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../utils -O3 -ffunction-sections -fdata-sections -g -Wall -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -ffunction-sections -fdata-sections -MMD -MP -O3 -funroll-loops -o source_files\am_hal_flash.o 
+arm-atollic-eabi-gcc -c ..\..\am_hal_ios.c -mthumb -mcpu=cortex-m4 -std=c99 -DAM_DEBUG_ASSERT -DAM_ASSERT_INVALID_THRESHOLD=0 -DAM_PART_APOLLO2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../mcu/apollo2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../utils -O3 -ffunction-sections -fdata-sections -g -Wall -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -ffunction-sections -fdata-sections -MMD -MP -O3 -funroll-loops -o source_files\am_hal_ios.o 
+arm-atollic-eabi-gcc -c ..\..\am_hal_pwrctrl.c -mthumb -mcpu=cortex-m4 -std=c99 -DAM_DEBUG_ASSERT -DAM_ASSERT_INVALID_THRESHOLD=0 -DAM_PART_APOLLO2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../mcu/apollo2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../utils -O3 -ffunction-sections -fdata-sections -g -Wall -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -ffunction-sections -fdata-sections -MMD -MP -O3 -funroll-loops -o source_files\am_hal_pwrctrl.o 
+arm-atollic-eabi-gcc -c ..\..\am_hal_clkgen.c -mthumb -mcpu=cortex-m4 -std=c99 -DAM_DEBUG_ASSERT -DAM_ASSERT_INVALID_THRESHOLD=0 -DAM_PART_APOLLO2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../mcu/apollo2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../utils -O3 -ffunction-sections -fdata-sections -g -Wall -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -ffunction-sections -fdata-sections -MMD -MP -O3 -funroll-loops -o source_files\am_hal_clkgen.o 
+arm-atollic-eabi-gcc -c ..\..\am_hal_itm.c -mthumb -mcpu=cortex-m4 -std=c99 -DAM_DEBUG_ASSERT -DAM_ASSERT_INVALID_THRESHOLD=0 -DAM_PART_APOLLO2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../mcu/apollo2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../utils -O3 -ffunction-sections -fdata-sections -g -Wall -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -ffunction-sections -fdata-sections -MMD -MP -O3 -funroll-loops -o source_files\am_hal_itm.o 
+arm-atollic-eabi-gcc -c ..\..\am_hal_tpiu.c -mthumb -mcpu=cortex-m4 -std=c99 -DAM_DEBUG_ASSERT -DAM_ASSERT_INVALID_THRESHOLD=0 -DAM_PART_APOLLO2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../mcu/apollo2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../utils -O3 -ffunction-sections -fdata-sections -g -Wall -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -ffunction-sections -fdata-sections -MMD -MP -O3 -funroll-loops -o source_files\am_hal_tpiu.o 
+arm-atollic-eabi-gcc -c ..\..\am_hal_vcomp.c -mthumb -mcpu=cortex-m4 -std=c99 -DAM_DEBUG_ASSERT -DAM_ASSERT_INVALID_THRESHOLD=0 -DAM_PART_APOLLO2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../mcu/apollo2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../utils -O3 -ffunction-sections -fdata-sections -g -Wall -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -ffunction-sections -fdata-sections -MMD -MP -O3 -funroll-loops -o source_files\am_hal_vcomp.o 
+arm-atollic-eabi-gcc -c ..\..\am_hal_global.c -mthumb -mcpu=cortex-m4 -std=c99 -DAM_DEBUG_ASSERT -DAM_ASSERT_INVALID_THRESHOLD=0 -DAM_PART_APOLLO2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../mcu/apollo2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../utils -O3 -ffunction-sections -fdata-sections -g -Wall -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -ffunction-sections -fdata-sections -MMD -MP -O3 -funroll-loops -o source_files\am_hal_global.o 
+arm-atollic-eabi-gcc -c ..\..\am_hal_queue.c -mthumb -mcpu=cortex-m4 -std=c99 -DAM_DEBUG_ASSERT -DAM_ASSERT_INVALID_THRESHOLD=0 -DAM_PART_APOLLO2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../mcu/apollo2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../utils -O3 -ffunction-sections -fdata-sections -g -Wall -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -ffunction-sections -fdata-sections -MMD -MP -O3 -funroll-loops -o source_files\am_hal_queue.o 
+arm-atollic-eabi-gcc -c ..\..\am_hal_adc.c -mthumb -mcpu=cortex-m4 -std=c99 -DAM_DEBUG_ASSERT -DAM_ASSERT_INVALID_THRESHOLD=0 -DAM_PART_APOLLO2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../mcu/apollo2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../utils -O3 -ffunction-sections -fdata-sections -g -Wall -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -ffunction-sections -fdata-sections -MMD -MP -O3 -funroll-loops -o source_files\am_hal_adc.o 
+arm-atollic-eabi-gcc -c ..\..\am_hal_wdt.c -mthumb -mcpu=cortex-m4 -std=c99 -DAM_DEBUG_ASSERT -DAM_ASSERT_INVALID_THRESHOLD=0 -DAM_PART_APOLLO2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../mcu/apollo2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../utils -O3 -ffunction-sections -fdata-sections -g -Wall -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -ffunction-sections -fdata-sections -MMD -MP -O3 -funroll-loops -o source_files\am_hal_wdt.o 
+arm-atollic-eabi-gcc -c ..\..\am_hal_ctimer.c -mthumb -mcpu=cortex-m4 -std=c99 -DAM_DEBUG_ASSERT -DAM_ASSERT_INVALID_THRESHOLD=0 -DAM_PART_APOLLO2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../mcu/apollo2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../utils -O3 -ffunction-sections -fdata-sections -g -Wall -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -ffunction-sections -fdata-sections -MMD -MP -O3 -funroll-loops -o source_files\am_hal_ctimer.o 
+arm-atollic-eabi-gcc -c ..\..\am_hal_cachectrl.c -mthumb -mcpu=cortex-m4 -std=c99 -DAM_DEBUG_ASSERT -DAM_ASSERT_INVALID_THRESHOLD=0 -DAM_PART_APOLLO2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../mcu/apollo2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../utils -O3 -ffunction-sections -fdata-sections -g -Wall -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -ffunction-sections -fdata-sections -MMD -MP -O3 -funroll-loops -o source_files\am_hal_cachectrl.o 
+arm-atollic-eabi-gcc -c ..\..\am_hal_sysctrl.c -mthumb -mcpu=cortex-m4 -std=c99 -DAM_DEBUG_ASSERT -DAM_ASSERT_INVALID_THRESHOLD=0 -DAM_PART_APOLLO2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../mcu/apollo2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../utils -O3 -ffunction-sections -fdata-sections -g -Wall -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -ffunction-sections -fdata-sections -MMD -MP -O3 -funroll-loops -o source_files\am_hal_sysctrl.o 
+arm-atollic-eabi-gcc -c ..\..\am_hal_gpio.c -mthumb -mcpu=cortex-m4 -std=c99 -DAM_DEBUG_ASSERT -DAM_ASSERT_INVALID_THRESHOLD=0 -DAM_PART_APOLLO2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../mcu/apollo2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../utils -O3 -ffunction-sections -fdata-sections -g -Wall -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -ffunction-sections -fdata-sections -MMD -MP -O3 -funroll-loops -o source_files\am_hal_gpio.o 
+arm-atollic-eabi-gcc -c ..\..\am_hal_pdm.c -mthumb -mcpu=cortex-m4 -std=c99 -DAM_DEBUG_ASSERT -DAM_ASSERT_INVALID_THRESHOLD=0 -DAM_PART_APOLLO2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../mcu/apollo2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../utils -O3 -ffunction-sections -fdata-sections -g -Wall -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -ffunction-sections -fdata-sections -MMD -MP -O3 -funroll-loops -o source_files\am_hal_pdm.o 
+arm-atollic-eabi-gcc -c ..\..\am_hal_uart.c -mthumb -mcpu=cortex-m4 -std=c99 -DAM_DEBUG_ASSERT -DAM_ASSERT_INVALID_THRESHOLD=0 -DAM_PART_APOLLO2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../mcu/apollo2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../utils -O3 -ffunction-sections -fdata-sections -g -Wall -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -ffunction-sections -fdata-sections -MMD -MP -O3 -funroll-loops -o source_files\am_hal_uart.o 
+arm-atollic-eabi-gcc -c ..\..\am_hal_i2c_bit_bang.c -mthumb -mcpu=cortex-m4 -std=c99 -DAM_DEBUG_ASSERT -DAM_ASSERT_INVALID_THRESHOLD=0 -DAM_PART_APOLLO2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../mcu/apollo2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../utils -O3 -ffunction-sections -fdata-sections -g -Wall -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -ffunction-sections -fdata-sections -MMD -MP -O3 -funroll-loops -o source_files\am_hal_i2c_bit_bang.o 
+arm-atollic-eabi-gcc -c ..\..\am_hal_systick.c -mthumb -mcpu=cortex-m4 -std=c99 -DAM_DEBUG_ASSERT -DAM_ASSERT_INVALID_THRESHOLD=0 -DAM_PART_APOLLO2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../mcu/apollo2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../utils -O3 -ffunction-sections -fdata-sections -g -Wall -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -ffunction-sections -fdata-sections -MMD -MP -O3 -funroll-loops -o source_files\am_hal_systick.o 
+arm-atollic-eabi-gcc -c ..\..\am_hal_stimer.c -mthumb -mcpu=cortex-m4 -std=c99 -DAM_DEBUG_ASSERT -DAM_ASSERT_INVALID_THRESHOLD=0 -DAM_PART_APOLLO2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../mcu/apollo2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../utils -O3 -ffunction-sections -fdata-sections -g -Wall -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -ffunction-sections -fdata-sections -MMD -MP -O3 -funroll-loops -o source_files\am_hal_stimer.o 
+arm-atollic-eabi-gcc -c ..\..\am_hal_rtc.c -mthumb -mcpu=cortex-m4 -std=c99 -DAM_DEBUG_ASSERT -DAM_ASSERT_INVALID_THRESHOLD=0 -DAM_PART_APOLLO2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../mcu/apollo2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../utils -O3 -ffunction-sections -fdata-sections -g -Wall -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -ffunction-sections -fdata-sections -MMD -MP -O3 -funroll-loops -o source_files\am_hal_rtc.o 
+arm-atollic-eabi-gcc -c ..\..\am_hal_interrupt.c -mthumb -mcpu=cortex-m4 -std=c99 -DAM_DEBUG_ASSERT -DAM_ASSERT_INVALID_THRESHOLD=0 -DAM_PART_APOLLO2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../mcu/apollo2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../utils -O3 -ffunction-sections -fdata-sections -g -Wall -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -ffunction-sections -fdata-sections -MMD -MP -O3 -funroll-loops -o source_files\am_hal_interrupt.o 
+arm-atollic-eabi-gcc -c ..\..\am_hal_iom.c -mthumb -mcpu=cortex-m4 -std=c99 -DAM_DEBUG_ASSERT -DAM_ASSERT_INVALID_THRESHOLD=0 -DAM_PART_APOLLO2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../mcu/apollo2 -IC:/jenkins/jobs/ambiqsuite-checkout/workspace/mcu/apollo2/hal/atollic_gcc/../../../../utils -O3 -ffunction-sections -fdata-sections -g -Wall -mthumb -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -ffunction-sections -fdata-sections -MMD -MP -O3 -funroll-loops -o source_files\am_hal_iom.o 
+arm-atollic-eabi-ar -rsvc libam_hal_gcc.a source_files\am_hal_adc.o source_files\am_hal_cachectrl.o source_files\am_hal_clkgen.o source_files\am_hal_ctimer.o source_files\am_hal_debug.o source_files\am_hal_flash.o source_files\am_hal_global.o source_files\am_hal_gpio.o source_files\am_hal_i2c_bit_bang.o source_files\am_hal_interrupt.o source_files\am_hal_iom.o source_files\am_hal_ios.o source_files\am_hal_itm.o source_files\am_hal_mcuctrl.o source_files\am_hal_otp.o source_files\am_hal_pdm.o source_files\am_hal_pwrctrl.o source_files\am_hal_queue.o source_files\am_hal_reset.o source_files\am_hal_rtc.o source_files\am_hal_stimer.o source_files\am_hal_sysctrl.o source_files\am_hal_systick.o source_files\am_hal_tpiu.o source_files\am_hal_ttp.o source_files\am_hal_uart.o source_files\am_hal_vcomp.o source_files\am_hal_wdt.o 
+a - source_files\am_hal_adc.o
+a - source_files\am_hal_cachectrl.o
+a - source_files\am_hal_clkgen.o
+a - source_files\am_hal_ctimer.o
+a - source_files\am_hal_debug.o
+a - source_files\am_hal_flash.o
+a - source_files\am_hal_global.o
+a - source_files\am_hal_gpio.o
+a - source_files\am_hal_i2c_bit_bang.o
+a - source_files\am_hal_interrupt.o
+a - source_files\am_hal_iom.o
+a - source_files\am_hal_ios.o
+a - source_files\am_hal_itm.o
+a - source_files\am_hal_mcuctrl.o
+a - source_files\am_hal_otp.o
+a - source_files\am_hal_pdm.o
+a - source_files\am_hal_pwrctrl.o
+a - source_files\am_hal_queue.o
+a - source_files\am_hal_reset.o
+a - source_files\am_hal_rtc.o
+a - source_files\am_hal_stimer.o
+a - source_files\am_hal_sysctrl.o
+a - source_files\am_hal_systick.o
+a - source_files\am_hal_tpiu.o
+a - source_files\am_hal_ttp.o
+a - source_files\am_hal_uart.o
+a - source_files\am_hal_vcomp.o
+a - source_files\am_hal_wdt.o
+Info: Parallel threads used: 4
+
+21:23:36 Build Finished (took 5s.570ms)
+
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/gcc/Makefile b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/gcc/Makefile
new file mode 100644
index 000000000..dd4fc63bb
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/gcc/Makefile
@@ -0,0 +1,158 @@
+#******************************************************************************
+#
+# Makefile - Rules for building the libraries, examples and docs.
+#
+# Copyright (c) 2017, Ambiq Micro
+# All rights reserved.
+# 
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# 
+# 1. Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# 
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 
+# 3. Neither the name of the copyright holder nor the names of its
+# contributors may be used to endorse or promote products derived from this
+# software without specific prior written permission.
+# 
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+#
+#******************************************************************************
+TARGET = libam_hal
+
+#### Setup ####
+TOOLCHAIN = arm-atollic-eabi
+PART = apollo2
+CPU = cortex-m4
+FPU = fpv4-sp-d16
+FABI = softfp
+WITHCC=w/GCC
+
+#### Required Executables ####
+CC = $(TOOLCHAIN)-gcc
+GCC = $(TOOLCHAIN)-gcc
+CPP = $(TOOLCHAIN)-cpp
+LD = $(TOOLCHAIN)-ld
+CP = $(TOOLCHAIN)-objcopy
+OD = $(TOOLCHAIN)-objdump
+RD = $(TOOLCHAIN)-readelf
+AR = $(TOOLCHAIN)-ar
+SIZE = $(TOOLCHAIN)-size
+
+EXECUTABLES = CC LD CP OD AR RD SIZE GCC
+K := $(foreach exec,$(EXECUTABLES),\
+        $(if $(shell which $($(exec)) 2>/dev/null),,\
+        $(info $(exec) not found on PATH ($($(exec))).)$(exec)))
+$(if $(strip $(value K)),$(info Required Program(s) $(strip $(value K)) not found))
+
+ifneq ($(strip $(value K)),)
+all clean:
+	$(info Tools $(WITHCC) not installed.)
+else
+DEFINES = -DPART_$(PART)
+DEFINES+= -Dgcc
+DEFINES+= -DAM_DEBUG_ASSERT
+DEFINES += -DAM_ASSERT_INVALID_THRESHOLD=0
+DEFINES += -DAM_PART_APOLLO2
+
+INCLUDES = -I../../../../mcu/apollo2
+INCLUDES += -I../../../../utils
+
+VPATH = ../.
+
+SRC = am_hal_adc.c
+SRC += am_hal_cachectrl.c
+SRC += am_hal_clkgen.c
+SRC += am_hal_ctimer.c
+SRC += am_hal_debug.c
+SRC += am_hal_flash.c
+SRC += am_hal_global.c
+SRC += am_hal_gpio.c
+SRC += am_hal_i2c_bit_bang.c
+SRC += am_hal_interrupt.c
+SRC += am_hal_iom.c
+SRC += am_hal_ios.c
+SRC += am_hal_itm.c
+SRC += am_hal_mcuctrl.c
+SRC += am_hal_otp.c
+SRC += am_hal_pdm.c
+SRC += am_hal_pwrctrl.c
+SRC += am_hal_queue.c
+SRC += am_hal_reset.c
+SRC += am_hal_rtc.c
+SRC += am_hal_stimer.c
+SRC += am_hal_sysctrl.c
+SRC += am_hal_systick.c
+SRC += am_hal_tpiu.c
+SRC += am_hal_ttp.c
+SRC += am_hal_uart.c
+SRC += am_hal_vcomp.c
+SRC += am_hal_wdt.c
+
+CSRC = $(filter %.c,$(SRC))
+ASRC = $(filter %.s,$(SRC))
+
+OBJS = $(CSRC:%.c=bin/%.o)
+OBJS+= $(ASRC:%.s=bin/%.o)
+
+DEPS = $(CSRC:%.c=bin/%.d)
+DEPS+= $(ASRC:%.s=bin/%.d)
+
+LIBS = 
+
+CFLAGS = -mthumb -mcpu=$(CPU) -mfpu=$(FPU) -mfloat-abi=$(FABI)
+CFLAGS+= -ffunction-sections -fdata-sections
+CFLAGS+= -MMD -MP -std=c99 -Wall
+# Libraries O3 for production, examples O0 for debug.
+CFLAGS+= -O3 -funroll-loops
+CFLAGS+= $(DEFINES)
+CFLAGS+= $(INCLUDES)
+CFLAGS+= 
+
+ODFLAGS = -S
+
+#### Rules ####
+.PHONY: all clean
+all: bin bin/$(TARGET).a
+
+bin:
+	mkdir -p $@
+
+bin/%.o: %.c bin/%.d
+	@+echo " Compiling $(WITHCC) $<" ;\
+	$(CC) -c $(CFLAGS) $< -o $@
+
+bin/%.o: %.s bin/%.d
+	@+echo " Assembling $(WITHCC) $<" ;\
+	$(CC) -c $(CFLAGS) $< -o $@
+
+bin/$(TARGET).a: $(OBJS)
+	@+echo " Library $(WITHCC) $@" ;\
+	$(AR) rsvc $@ $(OBJS)
+
+clean:
+	@+echo "Cleaning..." ;\
+	rm -f $(OBJS) $(DEPS) bin/$(TARGET).a
+
+bin/%.d: ;
+
+# Automatically include any generated dependencies
+-include $(DEPS)
+endif
+
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/iar/Makefile b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/iar/Makefile
new file mode 100644
index 000000000..a8ce287e3
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/iar/Makefile
@@ -0,0 +1,51 @@
+#******************************************************************************
+#
+# Makefile - Rules for building the libraries, examples and docs.
+#
+# Copyright (c) 2017, Ambiq Micro
+# All rights reserved.
+# 
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# 
+# 1. Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# 
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 
+# 3. Neither the name of the copyright holder nor the names of its
+# contributors may be used to endorse or promote products derived from this
+# software without specific prior written permission.
+# 
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# 
+# This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+#
+#******************************************************************************
+
+SHELL=/bin/bash
+K := $(shell type -p IarBuild.exe)
+
+ifeq ($(K),)
+all clean:
+	$(info IAR tools not found, skipping...)
+else
+all:
+	IarBuild.exe libam_hal.ewp -make Debug -log info
+
+clean:
+	@+echo Cleaning... ;\
+	IarBuild.exe libam_hal.ewp -clean Debug -log all
+endif
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/iar/libam_hal.ewd b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/iar/libam_hal.ewd
new file mode 100644
index 000000000..bf9a40ccc
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/iar/libam_hal.ewd
@@ -0,0 +1,2810 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+    <fileVersion>3</fileVersion>
+    <configuration>
+        <name>Debug</name>
+        <toolchain>
+            <name>ARM</name>
+        </toolchain>
+        <debug>1</debug>
+        <settings>
+            <name>C-SPY</name>
+            <archiveVersion>2</archiveVersion>
+            <data>
+                <version>28</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>1</debug>
+                <option>
+                    <name>CInput</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CEndian</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CProcessor</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OCVariant</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>MacOverride</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>MacFile</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>MemOverride</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>MemFile</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>RunToEnable</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>RunToName</name>
+                    <state>main</state>
+                </option>
+                <option>
+                    <name>CExtraOptionsCheck</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CExtraOptions</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CFpuProcessor</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OCDDFArgumentProducer</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>OCDownloadSuppressDownload</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCDownloadVerifyAll</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCProductVersion</name>
+                    <state>8.11.1.13270</state>
+                </option>
+                <option>
+                    <name>OCDynDriverList</name>
+                    <state>ARMSIM_ID</state>
+                </option>
+                <option>
+                    <name>OCLastSavedByProductVersion</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>UseFlashLoader</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CLowLevel</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OCBE8Slave</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>MacFile2</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CDevice</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>FlashLoadersV3</name>
+                    <state>$TOOLKIT_DIR$\config\flashloader\</state>
+                </option>
+                <option>
+                    <name>OCImagesSuppressCheck1</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCImagesPath1</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>OCImagesSuppressCheck2</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCImagesPath2</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>OCImagesSuppressCheck3</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCImagesPath3</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>OverrideDefFlashBoard</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCImagesOffset1</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>OCImagesOffset2</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>OCImagesOffset3</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>OCImagesUse1</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCImagesUse2</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCImagesUse3</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCDeviceConfigMacroFile</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OCDebuggerExtraOption</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OCAllMTBOptions</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OCMulticoreNrOfCores</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OCMulticoreMaster</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCMulticorePort</name>
+                    <state>53461</state>
+                </option>
+                <option>
+                    <name>OCMulticoreWorkspace</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>OCMulticoreSlaveProject</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>OCMulticoreSlaveConfiguration</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>OCDownloadExtraImage</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OCAttachSlave</name>
+                    <state>0</state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>ARMSIM_ID</name>
+            <archiveVersion>2</archiveVersion>
+            <data>
+                <version>1</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>1</debug>
+                <option>
+                    <name>OCSimDriverInfo</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OCSimEnablePSP</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCSimPspOverrideConfig</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCSimPspConfigFile</name>
+                    <state></state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>CADI_ID</name>
+            <archiveVersion>2</archiveVersion>
+            <data>
+                <version>0</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>1</debug>
+                <option>
+                    <name>CCadiMemory</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>Fast Model</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CCADILogFileCheck</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCADILogFileEditB</name>
+                    <state>$PROJ_DIR$\cspycomm.log</state>
+                </option>
+                <option>
+                    <name>OCDriverInfo</name>
+                    <state>1</state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>CMSISDAP_ID</name>
+            <archiveVersion>2</archiveVersion>
+            <data>
+                <version>4</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>1</debug>
+                <option>
+                    <name>CatchSFERR</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OCDriverInfo</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OCIarProbeScriptFile</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CMSISDAPResetList</name>
+                    <version>1</version>
+                    <state>10</state>
+                </option>
+                <option>
+                    <name>CMSISDAPHWResetDuration</name>
+                    <state>300</state>
+                </option>
+                <option>
+                    <name>CMSISDAPHWResetDelay</name>
+                    <state>200</state>
+                </option>
+                <option>
+                    <name>CMSISDAPDoLogfile</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CMSISDAPLogFile</name>
+                    <state>$PROJ_DIR$\cspycomm.log</state>
+                </option>
+                <option>
+                    <name>CMSISDAPInterfaceRadio</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CMSISDAPInterfaceCmdLine</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CMSISDAPMultiTargetEnable</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CMSISDAPMultiTarget</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CMSISDAPJtagSpeedList</name>
+                    <version>0</version>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CMSISDAPBreakpointRadio</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CMSISDAPRestoreBreakpointsCheck</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CMSISDAPUpdateBreakpointsEdit</name>
+                    <state>_call_main</state>
+                </option>
+                <option>
+                    <name>RDICatchReset</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>RDICatchUndef</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>RDICatchSWI</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>RDICatchData</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>RDICatchPrefetch</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>RDICatchIRQ</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>RDICatchFIQ</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CatchCORERESET</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CatchMMERR</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CatchNOCPERR</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CatchCHKERR</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CatchSTATERR</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CatchBUSERR</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CatchINTERR</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CatchHARDERR</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CatchDummy</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CMSISDAPMultiCPUEnable</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CMSISDAPMultiCPUNumber</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCProbeCfgOverride</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCProbeConfig</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CMSISDAPProbeConfigRadio</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CMSISDAPSelectedCPUBehaviour</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>ICpuName</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>OCJetEmuParams</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CCCMSISDAPUsbSerialNo</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CCCMSISDAPUsbSerialNoSelect</name>
+                    <state>0</state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>GDBSERVER_ID</name>
+            <archiveVersion>2</archiveVersion>
+            <data>
+                <version>0</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>1</debug>
+                <option>
+                    <name>OCDriverInfo</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>TCPIP</name>
+                    <state>localhost,3333</state>
+                </option>
+                <option>
+                    <name>DoLogfile</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>LogFile</name>
+                    <state>$PROJ_DIR$\cspycomm.log</state>
+                </option>
+                <option>
+                    <name>CCJTagBreakpointRadio</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCJTagDoUpdateBreakpoints</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCJTagUpdateBreakpoints</name>
+                    <state>_call_main</state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>IJET_ID</name>
+            <archiveVersion>2</archiveVersion>
+            <data>
+                <version>8</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>1</debug>
+                <option>
+                    <name>OCDriverInfo</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OCIarProbeScriptFile</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IjetResetList</name>
+                    <version>1</version>
+                    <state>10</state>
+                </option>
+                <option>
+                    <name>IjetHWResetDuration</name>
+                    <state>300</state>
+                </option>
+                <option>
+                    <name>IjetHWResetDelay</name>
+                    <state>200</state>
+                </option>
+                <option>
+                    <name>IjetPowerFromProbe</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IjetPowerRadio</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetDoLogfile</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetLogFile</name>
+                    <state>$PROJ_DIR$\cspycomm.log</state>
+                </option>
+                <option>
+                    <name>IjetInterfaceRadio</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetInterfaceCmdLine</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetMultiTargetEnable</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetMultiTarget</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetScanChainNonARMDevices</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetIRLength</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetJtagSpeedList</name>
+                    <version>0</version>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetProtocolRadio</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetSwoPin</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetCpuClockEdit</name>
+                    <state>6.0</state>
+                </option>
+                <option>
+                    <name>IjetSwoPrescalerList</name>
+                    <version>1</version>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetBreakpointRadio</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetRestoreBreakpointsCheck</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetUpdateBreakpointsEdit</name>
+                    <state>_call_main</state>
+                </option>
+                <option>
+                    <name>RDICatchReset</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>RDICatchUndef</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>RDICatchSWI</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>RDICatchData</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>RDICatchPrefetch</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>RDICatchIRQ</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>RDICatchFIQ</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CatchCORERESET</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CatchMMERR</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CatchNOCPERR</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CatchCHKERR</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CatchSTATERR</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CatchBUSERR</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CatchINTERR</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CatchSFERR</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CatchHARDERR</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CatchDummy</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCProbeCfgOverride</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCProbeConfig</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>IjetProbeConfigRadio</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetMultiCPUEnable</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetMultiCPUNumber</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetSelectedCPUBehaviour</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>ICpuName</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>OCJetEmuParams</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IjetPreferETB</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IjetTraceSettingsList</name>
+                    <version>0</version>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetTraceSizeList</name>
+                    <version>0</version>
+                    <state>4</state>
+                </option>
+                <option>
+                    <name>FlashBoardPathSlave</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCIjetUsbSerialNo</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CCIjetUsbSerialNoSelect</name>
+                    <state>0</state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>JLINK_ID</name>
+            <archiveVersion>2</archiveVersion>
+            <data>
+                <version>16</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>1</debug>
+                <option>
+                    <name>JLinkSpeed</name>
+                    <state>1000</state>
+                </option>
+                <option>
+                    <name>CCJLinkDoLogfile</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCJLinkLogFile</name>
+                    <state>$PROJ_DIR$\cspycomm.log</state>
+                </option>
+                <option>
+                    <name>CCJLinkHWResetDelay</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCDriverInfo</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>JLinkInitialSpeed</name>
+                    <state>1000</state>
+                </option>
+                <option>
+                    <name>CCDoJlinkMultiTarget</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCScanChainNonARMDevices</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCJLinkMultiTarget</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCJLinkIRLength</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCJLinkCommRadio</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCJLinkTCPIP</name>
+                    <state>aaa.bbb.ccc.ddd</state>
+                </option>
+                <option>
+                    <name>CCJLinkSpeedRadioV2</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCUSBDevice</name>
+                    <version>1</version>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CCRDICatchReset</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCRDICatchUndef</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCRDICatchSWI</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCRDICatchData</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCRDICatchPrefetch</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCRDICatchIRQ</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCRDICatchFIQ</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCJLinkBreakpointRadio</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCJLinkDoUpdateBreakpoints</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCJLinkUpdateBreakpoints</name>
+                    <state>_call_main</state>
+                </option>
+                <option>
+                    <name>CCJLinkInterfaceRadio</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCJLinkResetList</name>
+                    <version>6</version>
+                    <state>5</state>
+                </option>
+                <option>
+                    <name>CCJLinkInterfaceCmdLine</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCCatchCORERESET</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCCatchMMERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCCatchNOCPERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCCatchCHRERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCCatchSTATERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCCatchBUSERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCCatchINTERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCCatchSFERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCCatchHARDERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCCatchDummy</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCJLinkScriptFile</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CCJLinkUsbSerialNo</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CCTcpIpAlt</name>
+                    <version>0</version>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCJLinkTcpIpSerialNo</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CCCpuClockEdit</name>
+                    <state>6.0</state>
+                </option>
+                <option>
+                    <name>CCSwoClockAuto</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSwoClockEdit</name>
+                    <state>2000</state>
+                </option>
+                <option>
+                    <name>OCJLinkTraceSource</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCJLinkTraceSourceDummy</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCJLinkDeviceName</name>
+                    <state>1</state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>LMIFTDI_ID</name>
+            <archiveVersion>2</archiveVersion>
+            <data>
+                <version>2</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>1</debug>
+                <option>
+                    <name>OCDriverInfo</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>LmiftdiSpeed</name>
+                    <state>500</state>
+                </option>
+                <option>
+                    <name>CCLmiftdiDoLogfile</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCLmiftdiLogFile</name>
+                    <state>$PROJ_DIR$\cspycomm.log</state>
+                </option>
+                <option>
+                    <name>CCLmiFtdiInterfaceRadio</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCLmiFtdiInterfaceCmdLine</name>
+                    <state>0</state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>PEMICRO_ID</name>
+            <archiveVersion>2</archiveVersion>
+            <data>
+                <version>3</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>1</debug>
+                <option>
+                    <name>OCDriverInfo</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CCJPEMicroShowSettings</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>DoLogfile</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>LogFile</name>
+                    <state>$PROJ_DIR$\cspycomm.log</state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>STLINK_ID</name>
+            <archiveVersion>2</archiveVersion>
+            <data>
+                <version>4</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>1</debug>
+                <option>
+                    <name>OCDriverInfo</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CCSTLinkInterfaceRadio</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSTLinkInterfaceCmdLine</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSTLinkResetList</name>
+                    <version>3</version>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCCpuClockEdit</name>
+                    <state>72.0</state>
+                </option>
+                <option>
+                    <name>CCSwoClockAuto</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSwoClockEdit</name>
+                    <state>2000</state>
+                </option>
+                <option>
+                    <name>DoLogfile</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>LogFile</name>
+                    <state>$PROJ_DIR$\cspycomm.log</state>
+                </option>
+                <option>
+                    <name>CCSTLinkDoUpdateBreakpoints</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSTLinkUpdateBreakpoints</name>
+                    <state>_call_main</state>
+                </option>
+                <option>
+                    <name>CCSTLinkCatchCORERESET</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSTLinkCatchMMERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSTLinkCatchNOCPERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSTLinkCatchCHRERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSTLinkCatchSTATERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSTLinkCatchBUSERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSTLinkCatchINTERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSTLinkCatchSFERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSTLinkCatchHARDERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSTLinkCatchDummy</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSTLinkUsbSerialNo</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CCSTLinkUsbSerialNoSelect</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSTLinkJtagSpeedList</name>
+                    <version>0</version>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSTLinkDAPNumber</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CCSTLinkDebugAccessPortRadio</name>
+                    <state>0</state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>THIRDPARTY_ID</name>
+            <archiveVersion>2</archiveVersion>
+            <data>
+                <version>0</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>1</debug>
+                <option>
+                    <name>CThirdPartyDriverDll</name>
+                    <state>###Uninitialized###</state>
+                </option>
+                <option>
+                    <name>CThirdPartyLogFileCheck</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CThirdPartyLogFileEditB</name>
+                    <state>$PROJ_DIR$\cspycomm.log</state>
+                </option>
+                <option>
+                    <name>OCDriverInfo</name>
+                    <state>1</state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>TIFET_ID</name>
+            <archiveVersion>2</archiveVersion>
+            <data>
+                <version>1</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>1</debug>
+                <option>
+                    <name>OCDriverInfo</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CCMSPFetResetList</name>
+                    <version>0</version>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCMSPFetInterfaceRadio</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCMSPFetInterfaceCmdLine</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCMSPFetTargetVccTypeDefault</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCMSPFetTargetVoltage</name>
+                    <state>###Uninitialized###</state>
+                </option>
+                <option>
+                    <name>CCMSPFetVCCDefault</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CCMSPFetTargetSettlingtime</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCMSPFetRadioJtagSpeedType</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CCMSPFetConnection</name>
+                    <version>0</version>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCMSPFetUsbComPort</name>
+                    <state>Automatic</state>
+                </option>
+                <option>
+                    <name>CCMSPFetAllowAccessToBSL</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCMSPFetDoLogfile</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCMSPFetLogFile</name>
+                    <state>$PROJ_DIR$\cspycomm.log</state>
+                </option>
+                <option>
+                    <name>CCMSPFetRadioEraseFlash</name>
+                    <state>1</state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>XDS100_ID</name>
+            <archiveVersion>2</archiveVersion>
+            <data>
+                <version>6</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>1</debug>
+                <option>
+                    <name>CCXds100CatchSFERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCDriverInfo</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>TIPackageOverride</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>TIPackage</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>BoardFile</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>DoLogfile</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>LogFile</name>
+                    <state>$PROJ_DIR$\cspycomm.log</state>
+                </option>
+                <option>
+                    <name>CCXds100BreakpointRadio</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100DoUpdateBreakpoints</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100UpdateBreakpoints</name>
+                    <state>_call_main</state>
+                </option>
+                <option>
+                    <name>CCXds100CatchReset</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100CatchUndef</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100CatchSWI</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100CatchData</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100CatchPrefetch</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100CatchIRQ</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100CatchFIQ</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100CatchCORERESET</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100CatchMMERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100CatchNOCPERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100CatchCHRERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100CatchSTATERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100CatchBUSERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100CatchINTERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100CatchHARDERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100CatchDummy</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100CpuClockEdit</name>
+                    <state>72.0</state>
+                </option>
+                <option>
+                    <name>CCXds100SwoClockAuto</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100SwoClockEdit</name>
+                    <state>1000</state>
+                </option>
+                <option>
+                    <name>CCXds100HWResetDelay</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100ResetList</name>
+                    <version>0</version>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100UsbSerialNo</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CCXds100UsbSerialNoSelect</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100JtagSpeedList</name>
+                    <version>0</version>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100InterfaceRadio</name>
+                    <state>2</state>
+                </option>
+                <option>
+                    <name>CCXds100InterfaceCmdLine</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100ProbeList</name>
+                    <version>0</version>
+                    <state>2</state>
+                </option>
+                <option>
+                    <name>CCXds100SWOPortRadio</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100SWOPort</name>
+                    <state>1</state>
+                </option>
+            </data>
+        </settings>
+        <debuggerPlugins>
+            <plugin>
+                <file>$TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin</file>
+                <loadFlag>0</loadFlag>
+            </plugin>
+            <plugin>
+                <file>$TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin</file>
+                <loadFlag>0</loadFlag>
+            </plugin>
+            <plugin>
+                <file>$TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin</file>
+                <loadFlag>0</loadFlag>
+            </plugin>
+            <plugin>
+                <file>$TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin</file>
+                <loadFlag>0</loadFlag>
+            </plugin>
+            <plugin>
+                <file>$TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin</file>
+                <loadFlag>0</loadFlag>
+            </plugin>
+            <plugin>
+                <file>$TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin</file>
+                <loadFlag>0</loadFlag>
+            </plugin>
+            <plugin>
+                <file>$TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin</file>
+                <loadFlag>0</loadFlag>
+            </plugin>
+            <plugin>
+                <file>$TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin</file>
+                <loadFlag>0</loadFlag>
+            </plugin>
+            <plugin>
+                <file>$TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin</file>
+                <loadFlag>0</loadFlag>
+            </plugin>
+            <plugin>
+                <file>$TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin</file>
+                <loadFlag>0</loadFlag>
+            </plugin>
+            <plugin>
+                <file>$EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin</file>
+                <loadFlag>1</loadFlag>
+            </plugin>
+            <plugin>
+                <file>$EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin</file>
+                <loadFlag>0</loadFlag>
+            </plugin>
+            <plugin>
+                <file>$EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin</file>
+                <loadFlag>0</loadFlag>
+            </plugin>
+        </debuggerPlugins>
+    </configuration>
+    <configuration>
+        <name>Release</name>
+        <toolchain>
+            <name>ARM</name>
+        </toolchain>
+        <debug>0</debug>
+        <settings>
+            <name>C-SPY</name>
+            <archiveVersion>2</archiveVersion>
+            <data>
+                <version>28</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>0</debug>
+                <option>
+                    <name>CInput</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CEndian</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CProcessor</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OCVariant</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>MacOverride</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>MacFile</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>MemOverride</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>MemFile</name>
+                    <state>$TOOLKIT_DIR$\CONFIG\debugger\AmbiqMicro\AMAPH1KK-KBR.ddf</state>
+                </option>
+                <option>
+                    <name>RunToEnable</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>RunToName</name>
+                    <state>main</state>
+                </option>
+                <option>
+                    <name>CExtraOptionsCheck</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CExtraOptions</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CFpuProcessor</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OCDDFArgumentProducer</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>OCDownloadSuppressDownload</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCDownloadVerifyAll</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCProductVersion</name>
+                    <state>7.40.2.8567</state>
+                </option>
+                <option>
+                    <name>OCDynDriverList</name>
+                    <state>ARMSIM_ID</state>
+                </option>
+                <option>
+                    <name>OCLastSavedByProductVersion</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>UseFlashLoader</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CLowLevel</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OCBE8Slave</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>MacFile2</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CDevice</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>FlashLoadersV3</name>
+                    <state>$TOOLKIT_DIR$\config\flashloader\AmbiqMicro\FlashApollo2_1024.board</state>
+                </option>
+                <option>
+                    <name>OCImagesSuppressCheck1</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCImagesPath1</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>OCImagesSuppressCheck2</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCImagesPath2</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>OCImagesSuppressCheck3</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCImagesPath3</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>OverrideDefFlashBoard</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCImagesOffset1</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>OCImagesOffset2</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>OCImagesOffset3</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>OCImagesUse1</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCImagesUse2</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCImagesUse3</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCDeviceConfigMacroFile</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OCDebuggerExtraOption</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OCAllMTBOptions</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OCMulticoreNrOfCores</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OCMulticoreMaster</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCMulticorePort</name>
+                    <state>53461</state>
+                </option>
+                <option>
+                    <name>OCMulticoreWorkspace</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>OCMulticoreSlaveProject</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>OCMulticoreSlaveConfiguration</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>OCDownloadExtraImage</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OCAttachSlave</name>
+                    <state>0</state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>ARMSIM_ID</name>
+            <archiveVersion>2</archiveVersion>
+            <data>
+                <version>1</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>0</debug>
+                <option>
+                    <name>OCSimDriverInfo</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OCSimEnablePSP</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCSimPspOverrideConfig</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCSimPspConfigFile</name>
+                    <state></state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>CADI_ID</name>
+            <archiveVersion>2</archiveVersion>
+            <data>
+                <version>0</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>0</debug>
+                <option>
+                    <name>CCadiMemory</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>Fast Model</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CCADILogFileCheck</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCADILogFileEditB</name>
+                    <state>$PROJ_DIR$\cspycomm.log</state>
+                </option>
+                <option>
+                    <name>OCDriverInfo</name>
+                    <state>1</state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>CMSISDAP_ID</name>
+            <archiveVersion>2</archiveVersion>
+            <data>
+                <version>4</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>0</debug>
+                <option>
+                    <name>CatchSFERR</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OCDriverInfo</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OCIarProbeScriptFile</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CMSISDAPResetList</name>
+                    <version>1</version>
+                    <state>10</state>
+                </option>
+                <option>
+                    <name>CMSISDAPHWResetDuration</name>
+                    <state>300</state>
+                </option>
+                <option>
+                    <name>CMSISDAPHWResetDelay</name>
+                    <state>200</state>
+                </option>
+                <option>
+                    <name>CMSISDAPDoLogfile</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CMSISDAPLogFile</name>
+                    <state>$PROJ_DIR$\cspycomm.log</state>
+                </option>
+                <option>
+                    <name>CMSISDAPInterfaceRadio</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CMSISDAPInterfaceCmdLine</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CMSISDAPMultiTargetEnable</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CMSISDAPMultiTarget</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CMSISDAPJtagSpeedList</name>
+                    <version>0</version>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CMSISDAPBreakpointRadio</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CMSISDAPRestoreBreakpointsCheck</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CMSISDAPUpdateBreakpointsEdit</name>
+                    <state>_call_main</state>
+                </option>
+                <option>
+                    <name>RDICatchReset</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>RDICatchUndef</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>RDICatchSWI</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>RDICatchData</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>RDICatchPrefetch</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>RDICatchIRQ</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>RDICatchFIQ</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CatchCORERESET</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CatchMMERR</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CatchNOCPERR</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CatchCHKERR</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CatchSTATERR</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CatchBUSERR</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CatchINTERR</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CatchHARDERR</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CatchDummy</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CMSISDAPMultiCPUEnable</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CMSISDAPMultiCPUNumber</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCProbeCfgOverride</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCProbeConfig</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CMSISDAPProbeConfigRadio</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CMSISDAPSelectedCPUBehaviour</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>ICpuName</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>OCJetEmuParams</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CCCMSISDAPUsbSerialNo</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CCCMSISDAPUsbSerialNoSelect</name>
+                    <state>0</state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>GDBSERVER_ID</name>
+            <archiveVersion>2</archiveVersion>
+            <data>
+                <version>0</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>0</debug>
+                <option>
+                    <name>OCDriverInfo</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>TCPIP</name>
+                    <state>aaa.bbb.ccc.ddd</state>
+                </option>
+                <option>
+                    <name>DoLogfile</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>LogFile</name>
+                    <state>$PROJ_DIR$\cspycomm.log</state>
+                </option>
+                <option>
+                    <name>CCJTagBreakpointRadio</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCJTagDoUpdateBreakpoints</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCJTagUpdateBreakpoints</name>
+                    <state>_call_main</state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>IJET_ID</name>
+            <archiveVersion>2</archiveVersion>
+            <data>
+                <version>8</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>0</debug>
+                <option>
+                    <name>CatchSFERR</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OCDriverInfo</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OCIarProbeScriptFile</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IjetResetList</name>
+                    <version>1</version>
+                    <state>10</state>
+                </option>
+                <option>
+                    <name>IjetHWResetDuration</name>
+                    <state>300</state>
+                </option>
+                <option>
+                    <name>IjetHWResetDelay</name>
+                    <state>200</state>
+                </option>
+                <option>
+                    <name>IjetPowerFromProbe</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IjetPowerRadio</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetDoLogfile</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetLogFile</name>
+                    <state>$PROJ_DIR$\cspycomm.log</state>
+                </option>
+                <option>
+                    <name>IjetInterfaceRadio</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetInterfaceCmdLine</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetMultiTargetEnable</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetMultiTarget</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetScanChainNonARMDevices</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetIRLength</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetJtagSpeedList</name>
+                    <version>0</version>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetProtocolRadio</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetSwoPin</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetCpuClockEdit</name>
+                    <state>72.0</state>
+                </option>
+                <option>
+                    <name>IjetSwoPrescalerList</name>
+                    <version>1</version>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetBreakpointRadio</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetRestoreBreakpointsCheck</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetUpdateBreakpointsEdit</name>
+                    <state>_call_main</state>
+                </option>
+                <option>
+                    <name>RDICatchReset</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>RDICatchUndef</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>RDICatchSWI</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>RDICatchData</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>RDICatchPrefetch</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>RDICatchIRQ</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>RDICatchFIQ</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CatchCORERESET</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CatchMMERR</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CatchNOCPERR</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CatchCHKERR</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CatchSTATERR</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CatchBUSERR</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CatchINTERR</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CatchHARDERR</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CatchDummy</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCProbeCfgOverride</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCProbeConfig</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>IjetProbeConfigRadio</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetMultiCPUEnable</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetMultiCPUNumber</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetSelectedCPUBehaviour</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>ICpuName</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>OCJetEmuParams</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IjetPreferETB</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IjetTraceSettingsList</name>
+                    <version>0</version>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IjetTraceSizeList</name>
+                    <version>0</version>
+                    <state>4</state>
+                </option>
+                <option>
+                    <name>FlashBoardPathSlave</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCIjetUsbSerialNo</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CCIjetUsbSerialNoSelect</name>
+                    <state>0</state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>JLINK_ID</name>
+            <archiveVersion>2</archiveVersion>
+            <data>
+                <version>16</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>0</debug>
+                <option>
+                    <name>CCCatchSFERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>JLinkSpeed</name>
+                    <state>1000</state>
+                </option>
+                <option>
+                    <name>CCJLinkDoLogfile</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCJLinkLogFile</name>
+                    <state>$PROJ_DIR$\cspycomm.log</state>
+                </option>
+                <option>
+                    <name>CCJLinkHWResetDelay</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCDriverInfo</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>JLinkInitialSpeed</name>
+                    <state>1000</state>
+                </option>
+                <option>
+                    <name>CCDoJlinkMultiTarget</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCScanChainNonARMDevices</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCJLinkMultiTarget</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCJLinkIRLength</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCJLinkCommRadio</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCJLinkTCPIP</name>
+                    <state>aaa.bbb.ccc.ddd</state>
+                </option>
+                <option>
+                    <name>CCJLinkSpeedRadioV2</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCUSBDevice</name>
+                    <version>1</version>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CCRDICatchReset</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCRDICatchUndef</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCRDICatchSWI</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCRDICatchData</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCRDICatchPrefetch</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCRDICatchIRQ</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCRDICatchFIQ</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCJLinkBreakpointRadio</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCJLinkDoUpdateBreakpoints</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCJLinkUpdateBreakpoints</name>
+                    <state>_call_main</state>
+                </option>
+                <option>
+                    <name>CCJLinkInterfaceRadio</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CCJLinkResetList</name>
+                    <version>6</version>
+                    <state>7</state>
+                </option>
+                <option>
+                    <name>CCJLinkInterfaceCmdLine</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCCatchCORERESET</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCCatchMMERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCCatchNOCPERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCCatchCHRERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCCatchSTATERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCCatchBUSERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCCatchINTERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCCatchHARDERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCCatchDummy</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCJLinkScriptFile</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CCJLinkUsbSerialNo</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CCTcpIpAlt</name>
+                    <version>0</version>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCJLinkTcpIpSerialNo</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CCCpuClockEdit</name>
+                    <state>6.0</state>
+                </option>
+                <option>
+                    <name>CCSwoClockAuto</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSwoClockEdit</name>
+                    <state>2000</state>
+                </option>
+                <option>
+                    <name>OCJLinkTraceSource</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCJLinkTraceSourceDummy</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCJLinkDeviceName</name>
+                    <state>1</state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>LMIFTDI_ID</name>
+            <archiveVersion>2</archiveVersion>
+            <data>
+                <version>2</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>0</debug>
+                <option>
+                    <name>OCDriverInfo</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>LmiftdiSpeed</name>
+                    <state>500</state>
+                </option>
+                <option>
+                    <name>CCLmiftdiDoLogfile</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCLmiftdiLogFile</name>
+                    <state>$PROJ_DIR$\cspycomm.log</state>
+                </option>
+                <option>
+                    <name>CCLmiFtdiInterfaceRadio</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCLmiFtdiInterfaceCmdLine</name>
+                    <state>0</state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>PEMICRO_ID</name>
+            <archiveVersion>2</archiveVersion>
+            <data>
+                <version>3</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>0</debug>
+                <option>
+                    <name>OCDriverInfo</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CCJPEMicroShowSettings</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>DoLogfile</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>LogFile</name>
+                    <state>$PROJ_DIR$\cspycomm.log</state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>STLINK_ID</name>
+            <archiveVersion>2</archiveVersion>
+            <data>
+                <version>4</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>0</debug>
+                <option>
+                    <name>OCDriverInfo</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CCSTLinkInterfaceRadio</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSTLinkInterfaceCmdLine</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSTLinkResetList</name>
+                    <version>3</version>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCCpuClockEdit</name>
+                    <state>72.0</state>
+                </option>
+                <option>
+                    <name>CCSwoClockAuto</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSwoClockEdit</name>
+                    <state>2000</state>
+                </option>
+                <option>
+                    <name>DoLogfile</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>LogFile</name>
+                    <state>$PROJ_DIR$\cspycomm.log</state>
+                </option>
+                <option>
+                    <name>CCSTLinkDoUpdateBreakpoints</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSTLinkUpdateBreakpoints</name>
+                    <state>_call_main</state>
+                </option>
+                <option>
+                    <name>CCSTLinkCatchCORERESET</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSTLinkCatchMMERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSTLinkCatchNOCPERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSTLinkCatchCHRERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSTLinkCatchSTATERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSTLinkCatchBUSERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSTLinkCatchINTERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSTLinkCatchSFERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSTLinkCatchHARDERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSTLinkCatchDummy</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSTLinkUsbSerialNo</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CCSTLinkUsbSerialNoSelect</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSTLinkJtagSpeedList</name>
+                    <version>0</version>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSTLinkDAPNumber</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CCSTLinkDebugAccessPortRadio</name>
+                    <state>0</state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>THIRDPARTY_ID</name>
+            <archiveVersion>2</archiveVersion>
+            <data>
+                <version>0</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>0</debug>
+                <option>
+                    <name>CThirdPartyDriverDll</name>
+                    <state>###Uninitialized###</state>
+                </option>
+                <option>
+                    <name>CThirdPartyLogFileCheck</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CThirdPartyLogFileEditB</name>
+                    <state>$PROJ_DIR$\cspycomm.log</state>
+                </option>
+                <option>
+                    <name>OCDriverInfo</name>
+                    <state>1</state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>TIFET_ID</name>
+            <archiveVersion>2</archiveVersion>
+            <data>
+                <version>1</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>0</debug>
+                <option>
+                    <name>OCDriverInfo</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CCMSPFetResetList</name>
+                    <version>0</version>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCMSPFetInterfaceRadio</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCMSPFetInterfaceCmdLine</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCMSPFetTargetVccTypeDefault</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCMSPFetTargetVoltage</name>
+                    <state>###Uninitialized###</state>
+                </option>
+                <option>
+                    <name>CCMSPFetVCCDefault</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CCMSPFetTargetSettlingtime</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCMSPFetRadioJtagSpeedType</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CCMSPFetConnection</name>
+                    <version>0</version>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCMSPFetUsbComPort</name>
+                    <state>Automatic</state>
+                </option>
+                <option>
+                    <name>CCMSPFetAllowAccessToBSL</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCMSPFetDoLogfile</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCMSPFetLogFile</name>
+                    <state>$PROJ_DIR$\cspycomm.log</state>
+                </option>
+                <option>
+                    <name>CCMSPFetRadioEraseFlash</name>
+                    <state>1</state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>XDS100_ID</name>
+            <archiveVersion>2</archiveVersion>
+            <data>
+                <version>6</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>0</debug>
+                <option>
+                    <name>CCXds100CatchSFERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCDriverInfo</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>TIPackageOverride</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>TIPackage</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>BoardFile</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>DoLogfile</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>LogFile</name>
+                    <state>$PROJ_DIR$\cspycomm.log</state>
+                </option>
+                <option>
+                    <name>CCXds100BreakpointRadio</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100DoUpdateBreakpoints</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100UpdateBreakpoints</name>
+                    <state>_call_main</state>
+                </option>
+                <option>
+                    <name>CCXds100CatchReset</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100CatchUndef</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100CatchSWI</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100CatchData</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100CatchPrefetch</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100CatchIRQ</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100CatchFIQ</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100CatchCORERESET</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100CatchMMERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100CatchNOCPERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100CatchCHRERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100CatchSTATERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100CatchBUSERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100CatchINTERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100CatchHARDERR</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100CatchDummy</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100CpuClockEdit</name>
+                    <state>72.0</state>
+                </option>
+                <option>
+                    <name>CCXds100SwoClockAuto</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100SwoClockEdit</name>
+                    <state>1000</state>
+                </option>
+                <option>
+                    <name>CCXds100HWResetDelay</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100ResetList</name>
+                    <version>0</version>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100UsbSerialNo</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CCXds100UsbSerialNoSelect</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100JtagSpeedList</name>
+                    <version>0</version>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100InterfaceRadio</name>
+                    <state>2</state>
+                </option>
+                <option>
+                    <name>CCXds100InterfaceCmdLine</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100ProbeList</name>
+                    <version>0</version>
+                    <state>2</state>
+                </option>
+                <option>
+                    <name>CCXds100SWOPortRadio</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCXds100SWOPort</name>
+                    <state>1</state>
+                </option>
+            </data>
+        </settings>
+        <debuggerPlugins>
+            <plugin>
+                <file>$TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin</file>
+                <loadFlag>0</loadFlag>
+            </plugin>
+            <plugin>
+                <file>$TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin</file>
+                <loadFlag>0</loadFlag>
+            </plugin>
+            <plugin>
+                <file>$TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin</file>
+                <loadFlag>0</loadFlag>
+            </plugin>
+            <plugin>
+                <file>$TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin</file>
+                <loadFlag>0</loadFlag>
+            </plugin>
+            <plugin>
+                <file>$TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin</file>
+                <loadFlag>0</loadFlag>
+            </plugin>
+            <plugin>
+                <file>$TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin</file>
+                <loadFlag>0</loadFlag>
+            </plugin>
+            <plugin>
+                <file>$TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin</file>
+                <loadFlag>0</loadFlag>
+            </plugin>
+            <plugin>
+                <file>$TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin</file>
+                <loadFlag>0</loadFlag>
+            </plugin>
+            <plugin>
+                <file>$TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin</file>
+                <loadFlag>0</loadFlag>
+            </plugin>
+            <plugin>
+                <file>$TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin</file>
+                <loadFlag>0</loadFlag>
+            </plugin>
+            <plugin>
+                <file>$EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin</file>
+                <loadFlag>1</loadFlag>
+            </plugin>
+            <plugin>
+                <file>$EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin</file>
+                <loadFlag>0</loadFlag>
+            </plugin>
+            <plugin>
+                <file>$EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin</file>
+                <loadFlag>0</loadFlag>
+            </plugin>
+        </debuggerPlugins>
+    </configuration>
+</project>
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/iar/libam_hal.ewp b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/iar/libam_hal.ewp
new file mode 100644
index 000000000..85b56d6ac
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/iar/libam_hal.ewp
@@ -0,0 +1,2117 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+    <fileVersion>3</fileVersion>
+    <configuration>
+        <name>Debug</name>
+        <toolchain>
+            <name>ARM</name>
+        </toolchain>
+        <debug>1</debug>
+        <settings>
+            <name>General</name>
+            <archiveVersion>3</archiveVersion>
+            <data>
+                <version>28</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>1</debug>
+                <option>
+                    <name>ExePath</name>
+                    <state>bin</state>
+                </option>
+                <option>
+                    <name>ObjPath</name>
+                    <state>bin</state>
+                </option>
+                <option>
+                    <name>ListPath</name>
+                    <state>bin</state>
+                </option>
+                <option>
+                    <name>GEndianMode</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>Input description</name>
+                    <state>Full formatting, without multibyte support.</state>
+                </option>
+                <option>
+                    <name>Output description</name>
+                    <state>Full formatting, without multibyte support.</state>
+                </option>
+                <option>
+                    <name>GOutputBinary</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OGCoreOrChip</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>GRuntimeLibSelect</name>
+                    <version>0</version>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>GRuntimeLibSelectSlave</name>
+                    <version>0</version>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>RTDescription</name>
+                    <state>Do not link with a runtime library.</state>
+                </option>
+                <option>
+                    <name>OGProductVersion</name>
+                    <state>7.40.2.8567</state>
+                </option>
+                <option>
+                    <name>OGLastSavedByProductVersion</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>GeneralEnableMisra</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>GeneralMisraVerbose</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OGChipSelectEditMenu</name>
+                    <state>AMAPH1KK-KBR	AmbiqMicro AMAPH1KK-KBR</state>
+                </option>
+                <option>
+                    <name>GenLowLevelInterface</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>GEndianModeBE</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OGBufferedTerminalOutput</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>GenStdoutInterface</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>GeneralMisraRules98</name>
+                    <version>0</version>
+                    <state>1000111110110101101110011100111111101110011011000101110111101101100111111111111100110011111001110111001111111111111111111111111</state>
+                </option>
+                <option>
+                    <name>GeneralMisraVer</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>GeneralMisraRules04</name>
+                    <version>0</version>
+                    <state>111101110010111111111000110111111111111111111111111110010111101111010101111111111111111111111111101111111011111001111011111011111111111111111</state>
+                </option>
+                <option>
+                    <name>RTConfigPath2</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>GBECoreSlave</name>
+                    <version>25</version>
+                    <state>39</state>
+                </option>
+                <option>
+                    <name>OGUseCmsis</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OGUseCmsisDspLib</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>GRuntimeLibThreads</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CoreVariant</name>
+                    <version>25</version>
+                    <state>39</state>
+                </option>
+                <option>
+                    <name>GFPUDeviceSlave</name>
+                    <state>AMAPH1KK-KBR	AmbiqMicro AMAPH1KK-KBR</state>
+                </option>
+                <option>
+                    <name>FPU2</name>
+                    <version>0</version>
+                    <state>4</state>
+                </option>
+                <option>
+                    <name>NrRegs</name>
+                    <version>0</version>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>NEON</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>GFPUCoreSlave2</name>
+                    <version>25</version>
+                    <state>39</state>
+                </option>
+                <option>
+                    <name>OGCMSISPackSelectDevice</name>
+                </option>
+                <option>
+                    <name>OgLibHeap</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OGLibAdditionalLocale</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OGPrintfVariant</name>
+                    <version>0</version>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OGPrintfMultibyteSupport</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OGScanfVariant</name>
+                    <version>0</version>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OGScanfMultibyteSupport</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>GenLocaleTags</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>GenLocaleDisplayOnly</name>
+                    <state></state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>ICCARM</name>
+            <archiveVersion>2</archiveVersion>
+            <data>
+                <version>34</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>1</debug>
+                <option>
+                    <name>CCDefines</name>
+                    <state>iar</state>
+          <state>AM_DEBUG_ASSERT</state>
+          <state>AM_ASSERT_INVALID_THRESHOLD=0</state>
+          <state>AM_PART_APOLLO2</state>
+                </option>
+                <option>
+                    <name>CCPreprocFile</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCPreprocComments</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCPreprocLine</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCListCFile</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCListCMnemonics</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCListCMessages</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCListAssFile</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCListAssSource</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCEnableRemarks</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCDiagSuppress</name>
+                    <state>Pa050</state>
+                </option>
+                <option>
+                    <name>CCDiagRemark</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CCDiagWarning</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CCDiagError</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CCObjPrefix</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CCAllowList</name>
+                    <version>1</version>
+                    <state>11111110</state>
+                </option>
+                <option>
+                    <name>CCDebugInfo</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IEndianMode</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IProcessor</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IExtraOptionsCheck</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IExtraOptions</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CCLangConformance</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSignedPlainChar</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CCRequirePrototypes</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCDiagWarnAreErr</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCCompilerRuntimeInfo</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IFpuProcessor</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OutputFile</name>
+                    <state>$FILE_BNAME$.o</state>
+                </option>
+                <option>
+                    <name>CCLibConfigHeader</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>PreInclude</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CompilerMisraOverride</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCIncludePath2</name>
+          <state>$PROJ_DIR$\..\..\..\..\mcu\apollo2</state>
+          <state>$PROJ_DIR$\..\..\..\..\utils</state>
+                </option>
+                <option>
+                    <name>CCStdIncCheck</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCCodeSection</name>
+                    <state>.text</state>
+                </option>
+                <option>
+                    <name>IProcessorMode2</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CCOptLevel</name>
+                    <state>3</state>
+                </option>
+                <option>
+                    <name>CCOptStrategy</name>
+                    <version>0</version>
+                    <state>2</state>
+                </option>
+                <option>
+                    <name>CCOptLevelSlave</name>
+                    <state>3</state>
+                </option>
+                <option>
+                    <name>CompilerMisraRules98</name>
+                    <version>0</version>
+                    <state>1000111110110101101110011100111111101110011011000101110111101101100111111111111100110011111001110111001111111111111111111111111</state>
+                </option>
+                <option>
+                    <name>CompilerMisraRules04</name>
+                    <version>0</version>
+                    <state>111101110010111111111000110111111111111111111111111110010111101111010101111111111111111111111111101111111011111001111011111011111111111111111</state>
+                </option>
+                <option>
+                    <name>CCPosIndRopi</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCPosIndRwpi</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCPosIndNoDynInit</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IccLang</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IccCDialect</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IccAllowVLA</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IccStaticDestr</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IccCppInlineSemantics</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IccCmsis</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IccFloatSemantics</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCOptimizationNoSizeConstraints</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CCNoLiteralPool</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCOptStrategySlave</name>
+                    <version>0</version>
+                    <state>2</state>
+                </option>
+                <option>
+                    <name>CCGuardCalls</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CCEncSource</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCEncOutput</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCEncOutputBom</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CCEncInput</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IccExceptions2</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IccRTTI2</name>
+                    <state>0</state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>AARM</name>
+            <archiveVersion>2</archiveVersion>
+            <data>
+                <version>10</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>1</debug>
+                <option>
+                    <name>AObjPrefix</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>AEndian</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>ACaseSensitivity</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>MacroChars</name>
+                    <version>0</version>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>AWarnEnable</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>AWarnWhat</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>AWarnOne</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>AWarnRange1</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>AWarnRange2</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>ADebug</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>AltRegisterNames</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>ADefines</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>AList</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>AListHeader</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>AListing</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>Includes</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>MacDefs</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>MacExps</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>MacExec</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OnlyAssed</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>MultiLine</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>PageLengthCheck</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>PageLength</name>
+                    <state>80</state>
+                </option>
+                <option>
+                    <name>TabSpacing</name>
+                    <state>8</state>
+                </option>
+                <option>
+                    <name>AXRef</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>AXRefDefines</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>AXRefInternal</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>AXRefDual</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>AProcessor</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>AFpuProcessor</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>AOutputFile</name>
+                    <state>$FILE_BNAME$.o</state>
+                </option>
+                <option>
+                    <name>ALimitErrorsCheck</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>ALimitErrorsEdit</name>
+                    <state>100</state>
+                </option>
+                <option>
+                    <name>AIgnoreStdInclude</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>AUserIncludes</name>
+          <state>$PROJ_DIR$\..\..\..\..\mcu\apollo2</state>
+          <state>$PROJ_DIR$\..\..\..\..\utils</state>
+                </option>
+                <option>
+                    <name>AExtraOptionsCheckV2</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>AExtraOptionsV2</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>AsmNoLiteralPool</name>
+                    <state>0</state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>OBJCOPY</name>
+            <archiveVersion>0</archiveVersion>
+            <data>
+                <version>1</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>1</debug>
+                <option>
+                    <name>OOCOutputFormat</name>
+                    <version>3</version>
+                    <state>3</state>
+                </option>
+                <option>
+                    <name>OCOutputOverride</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OOCOutputFile</name>
+                    <state>libam_hal.bin</state>
+                </option>
+                <option>
+                    <name>OOCCommandLineProducer</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OOCObjCopyEnable</name>
+                    <state>1</state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>CUSTOM</name>
+            <archiveVersion>3</archiveVersion>
+            <data>
+                <extensions></extensions>
+                <cmdline></cmdline>
+                <hasPrio>0</hasPrio>
+            </data>
+        </settings>
+        <settings>
+            <name>BICOMP</name>
+            <archiveVersion>0</archiveVersion>
+            <data />
+        </settings>
+        <settings>
+            <name>BUILDACTION</name>
+            <archiveVersion>1</archiveVersion>
+            <data>
+                <prebuild></prebuild>
+                <postbuild></postbuild>
+            </data>
+        </settings>
+        <settings>
+            <name>ILINK</name>
+            <archiveVersion>0</archiveVersion>
+            <data>
+                <version>20</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>1</debug>
+                <option>
+                    <name>IlinkLibIOConfig</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>XLinkMisraHandler</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkInputFileSlave</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkOutputFile</name>
+                    <state>libam_hal.out</state>
+                </option>
+                <option>
+                    <name>IlinkDebugInfoEnable</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IlinkKeepSymbols</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>IlinkRawBinaryFile</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>IlinkRawBinarySymbol</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>IlinkRawBinarySegment</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>IlinkRawBinaryAlign</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>IlinkDefines</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>IlinkConfigDefines</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>IlinkMapFile</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkLogFile</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkLogInitialization</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkLogModule</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkLogSection</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkLogVeneer</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkIcfOverride</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkIcfFile</name>
+                    <state>$PROJ_DIR$\libam_hal.icf</state>
+                </option>
+                <option>
+                    <name>IlinkIcfFileSlave</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>IlinkEnableRemarks</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkSuppressDiags</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>IlinkTreatAsRem</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>IlinkTreatAsWarn</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>IlinkTreatAsErr</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>IlinkWarningsAreErrors</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkUseExtraOptions</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkExtraOptions</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>IlinkLowLevelInterfaceSlave</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IlinkAutoLibEnable</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IlinkAdditionalLibs</name>
+
+                </option>
+                <option>
+                    <name>IlinkOverrideProgramEntryLabel</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkProgramEntryLabelSelect</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkProgramEntryLabel</name>
+                    <state>__iar_program_start</state>
+                </option>
+                <option>
+                    <name>DoFill</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>FillerByte</name>
+                    <state>0xFF</state>
+                </option>
+                <option>
+                    <name>FillerStart</name>
+                    <state>0x0</state>
+                </option>
+                <option>
+                    <name>FillerEnd</name>
+                    <state>0x0</state>
+                </option>
+                <option>
+                    <name>CrcSize</name>
+                    <version>0</version>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CrcAlign</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CrcPoly</name>
+                    <state>0x11021</state>
+                </option>
+                <option>
+                    <name>CrcCompl</name>
+                    <version>0</version>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CrcBitOrder</name>
+                    <version>0</version>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CrcInitialValue</name>
+                    <state>0x0</state>
+                </option>
+                <option>
+                    <name>DoCrc</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkBE8Slave</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IlinkBufferedTerminalOutput</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IlinkStdoutInterfaceSlave</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CrcFullSize</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkIElfToolPostProcess</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkLogAutoLibSelect</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkLogRedirSymbols</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkLogUnusedFragments</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkCrcReverseByteOrder</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkCrcUseAsInput</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IlinkOptInline</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkOptExceptionsAllow</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IlinkOptExceptionsForce</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkCmsis</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IlinkOptMergeDuplSections</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkOptUseVfe</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IlinkOptForceVfe</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkStackAnalysisEnable</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkStackControlFile</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>IlinkStackCallGraphFile</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CrcAlgorithm</name>
+                    <version>1</version>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CrcUnitSize</name>
+                    <version>0</version>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkThreadsSlave</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IlinkLogCallGraph</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkIcfFile_AltDefault</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>IlinkEncInput</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkEncOutput</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkEncOutputBom</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IlinkHeapSelect</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IlinkLocaleSelect</name>
+                    <state>1</state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>IARCHIVE</name>
+            <archiveVersion>0</archiveVersion>
+            <data>
+                <version>0</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>1</debug>
+                <option>
+                    <name>IarchiveInputs</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>IarchiveOverride</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IarchiveOutput</name>
+                    <state>libam_hal.a</state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>BILINK</name>
+            <archiveVersion>0</archiveVersion>
+            <data />
+        </settings>
+    </configuration>
+    <configuration>
+        <name>Release</name>
+        <toolchain>
+            <name>ARM</name>
+        </toolchain>
+        <debug>0</debug>
+        <settings>
+            <name>General</name>
+            <archiveVersion>3</archiveVersion>
+            <data>
+                <version>28</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>0</debug>
+                <option>
+                    <name>ExePath</name>
+                    <state>bin</state>
+                </option>
+                <option>
+                    <name>ObjPath</name>
+                    <state>bin</state>
+                </option>
+                <option>
+                    <name>ListPath</name>
+                    <state>bin</state>
+                </option>
+                <option>
+                    <name>GEndianMode</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>Input description</name>
+                    <state>Automatic choice of formatter.</state>
+                </option>
+                <option>
+                    <name>Output description</name>
+                    <state>Automatic choice of formatter.</state>
+                </option>
+                <option>
+                    <name>GOutputBinary</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OGCoreOrChip</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>GRuntimeLibSelect</name>
+                    <version>0</version>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>GRuntimeLibSelectSlave</name>
+                    <version>0</version>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>RTDescription</name>
+                    <state>Use the normal configuration of the C/C++ runtime library. No locale interface, C locale, no file descriptor support, no multibytes in printf and scanf, and no hex floats in strtod.</state>
+                </option>
+                <option>
+                    <name>OGProductVersion</name>
+                    <state>7.40.2.8567</state>
+                </option>
+                <option>
+                    <name>OGLastSavedByProductVersion</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>GeneralEnableMisra</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>GeneralMisraVerbose</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OGChipSelectEditMenu</name>
+                    <state>AMAPH1KK-KBR	AmbiqMicro AMAPH1KK-KBR</state>
+                </option>
+                <option>
+                    <name>GenLowLevelInterface</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>GEndianModeBE</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OGBufferedTerminalOutput</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>GenStdoutInterface</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>GeneralMisraRules98</name>
+                    <version>0</version>
+                    <state>1000111110110101101110011100111111101110011011000101110111101101100111111111111100110011111001110111001111111111111111111111111</state>
+                </option>
+                <option>
+                    <name>GeneralMisraVer</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>GeneralMisraRules04</name>
+                    <version>0</version>
+                    <state>111101110010111111111000110111111111111111111111111110010111101111010101111111111111111111111111101111111011111001111011111011111111111111111</state>
+                </option>
+                <option>
+                    <name>RTConfigPath2</name>
+                    <state>$TOOLKIT_DIR$\INC\c\DLib_Config_Normal.h</state>
+                </option>
+                <option>
+                    <name>GBECoreSlave</name>
+                    <version>25</version>
+                    <state>39</state>
+                </option>
+                <option>
+                    <name>OGUseCmsis</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OGUseCmsisDspLib</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>GRuntimeLibThreads</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CoreVariant</name>
+                    <version>25</version>
+                    <state>39</state>
+                </option>
+                <option>
+                    <name>GFPUDeviceSlave</name>
+                    <state>AMAPH1KK-KBR	AmbiqMicro AMAPH1KK-KBR</state>
+                </option>
+                <option>
+                    <name>FPU2</name>
+                    <version>0</version>
+                    <state>4</state>
+                </option>
+                <option>
+                    <name>NrRegs</name>
+                    <version>0</version>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>NEON</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>GFPUCoreSlave2</name>
+                    <version>25</version>
+                    <state>39</state>
+                </option>
+                <option>
+                    <name>OGCMSISPackSelectDevice</name>
+                </option>
+                <option>
+                    <name>OgLibHeap</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OGLibAdditionalLocale</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OGPrintfVariant</name>
+                    <version>0</version>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OGPrintfMultibyteSupport</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OGScanfVariant</name>
+                    <version>0</version>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OGScanfMultibyteSupport</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>GenLocaleTags</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>GenLocaleDisplayOnly</name>
+                    <state></state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>ICCARM</name>
+            <archiveVersion>2</archiveVersion>
+            <data>
+                <version>34</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>0</debug>
+                <option>
+                    <name>CCDefines</name>
+                    <state>iar</state>
+          <state>AM_DEBUG_ASSERT</state>
+          <state>AM_ASSERT_INVALID_THRESHOLD=0</state>
+          <state>AM_PART_APOLLO2</state>
+                </option>
+                <option>
+                    <name>CCPreprocFile</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCPreprocComments</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCPreprocLine</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCListCFile</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCListCMnemonics</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCListCMessages</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCListAssFile</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCListAssSource</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCEnableRemarks</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCDiagSuppress</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CCDiagRemark</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CCDiagWarning</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CCDiagError</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CCObjPrefix</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CCAllowList</name>
+                    <version>1</version>
+                    <state>11111110</state>
+                </option>
+                <option>
+                    <name>CCDebugInfo</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IEndianMode</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IProcessor</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IExtraOptionsCheck</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IExtraOptions</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CCLangConformance</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCSignedPlainChar</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CCRequirePrototypes</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCDiagWarnAreErr</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCCompilerRuntimeInfo</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IFpuProcessor</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OutputFile</name>
+                    <state>$FILE_BNAME$.o</state>
+                </option>
+                <option>
+                    <name>CCLibConfigHeader</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>PreInclude</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CompilerMisraOverride</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCIncludePath2</name>
+          <state>$PROJ_DIR$\..\..\..\..\mcu\apollo2</state>
+          <state>$PROJ_DIR$\..\..\..\..\utils</state>
+                </option>
+                <option>
+                    <name>CCStdIncCheck</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCCodeSection</name>
+                    <state>.text</state>
+                </option>
+                <option>
+                    <name>IProcessorMode2</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CCOptLevel</name>
+                    <state>3</state>
+                </option>
+                <option>
+                    <name>CCOptStrategy</name>
+                    <version>0</version>
+                    <state>2</state>
+                </option>
+                <option>
+                    <name>CCOptLevelSlave</name>
+                    <state>3</state>
+                </option>
+                <option>
+                    <name>CompilerMisraRules98</name>
+                    <version>0</version>
+                    <state>1000111110110101101110011100111111101110011011000101110111101101100111111111111100110011111001110111001111111111111111111111111</state>
+                </option>
+                <option>
+                    <name>CompilerMisraRules04</name>
+                    <version>0</version>
+                    <state>111101110010111111111000110111111111111111111111111110010111101111010101111111111111111111111111101111111011111001111011111011111111111111111</state>
+                </option>
+                <option>
+                    <name>CCPosIndRopi</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCPosIndRwpi</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCPosIndNoDynInit</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IccLang</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IccCDialect</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IccAllowVLA</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IccStaticDestr</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IccCppInlineSemantics</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IccCmsis</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IccFloatSemantics</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCOptimizationNoSizeConstraints</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CCNoLiteralPool</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCOptStrategySlave</name>
+                    <version>0</version>
+                    <state>2</state>
+                </option>
+                <option>
+                    <name>CCGuardCalls</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CCEncSource</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCEncOutput</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CCEncOutputBom</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CCEncInput</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IccExceptions2</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IccRTTI2</name>
+                    <state>0</state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>AARM</name>
+            <archiveVersion>2</archiveVersion>
+            <data>
+                <version>10</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>0</debug>
+                <option>
+                    <name>AObjPrefix</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>AEndian</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>ACaseSensitivity</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>MacroChars</name>
+                    <version>0</version>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>AWarnEnable</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>AWarnWhat</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>AWarnOne</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>AWarnRange1</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>AWarnRange2</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>ADebug</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>AltRegisterNames</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>ADefines</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>AList</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>AListHeader</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>AListing</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>Includes</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>MacDefs</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>MacExps</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>MacExec</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OnlyAssed</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>MultiLine</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>PageLengthCheck</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>PageLength</name>
+                    <state>80</state>
+                </option>
+                <option>
+                    <name>TabSpacing</name>
+                    <state>8</state>
+                </option>
+                <option>
+                    <name>AXRef</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>AXRefDefines</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>AXRefInternal</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>AXRefDual</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>AProcessor</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>AFpuProcessor</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>AOutputFile</name>
+                    <state>$FILE_BNAME$.o</state>
+                </option>
+                <option>
+                    <name>ALimitErrorsCheck</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>ALimitErrorsEdit</name>
+                    <state>100</state>
+                </option>
+                <option>
+                    <name>AIgnoreStdInclude</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>AUserIncludes</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>AExtraOptionsCheckV2</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>AExtraOptionsV2</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>AsmNoLiteralPool</name>
+                    <state>0</state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>OBJCOPY</name>
+            <archiveVersion>0</archiveVersion>
+            <data>
+                <version>1</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>0</debug>
+                <option>
+                    <name>OOCOutputFormat</name>
+                    <version>3</version>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OCOutputOverride</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>OOCOutputFile</name>
+                    <state>libam_hal.bin</state>
+                </option>
+                <option>
+                    <name>OOCCommandLineProducer</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>OOCObjCopyEnable</name>
+                    <state>0</state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>CUSTOM</name>
+            <archiveVersion>3</archiveVersion>
+            <data>
+                <extensions></extensions>
+                <cmdline></cmdline>
+                <hasPrio>0</hasPrio>
+            </data>
+        </settings>
+        <settings>
+            <name>BICOMP</name>
+            <archiveVersion>0</archiveVersion>
+            <data />
+        </settings>
+        <settings>
+            <name>BUILDACTION</name>
+            <archiveVersion>1</archiveVersion>
+            <data>
+                <prebuild></prebuild>
+                <postbuild></postbuild>
+            </data>
+        </settings>
+        <settings>
+            <name>ILINK</name>
+            <archiveVersion>0</archiveVersion>
+            <data>
+                <version>20</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>0</debug>
+                <option>
+                    <name>IlinkLibIOConfig</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>XLinkMisraHandler</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkInputFileSlave</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkOutputFile</name>
+                    <state>libam_hal.out</state>
+                </option>
+                <option>
+                    <name>IlinkDebugInfoEnable</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IlinkKeepSymbols</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>IlinkRawBinaryFile</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>IlinkRawBinarySymbol</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>IlinkRawBinarySegment</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>IlinkRawBinaryAlign</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>IlinkDefines</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>IlinkConfigDefines</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>IlinkMapFile</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkLogFile</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkLogInitialization</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkLogModule</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkLogSection</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkLogVeneer</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkIcfOverride</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkIcfFile</name>
+                    <state>$TOOLKIT_DIR$\config\linker\AmbiqMicro\apollo2_1024.icf</state>
+                </option>
+                <option>
+                    <name>IlinkIcfFileSlave</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>IlinkEnableRemarks</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkSuppressDiags</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>IlinkTreatAsRem</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>IlinkTreatAsWarn</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>IlinkTreatAsErr</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>IlinkWarningsAreErrors</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkUseExtraOptions</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkExtraOptions</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>IlinkLowLevelInterfaceSlave</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IlinkAutoLibEnable</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IlinkAdditionalLibs</name>
+
+                </option>
+                <option>
+                    <name>IlinkOverrideProgramEntryLabel</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkProgramEntryLabelSelect</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkProgramEntryLabel</name>
+                    <state>__iar_program_start</state>
+                </option>
+                <option>
+                    <name>DoFill</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>FillerByte</name>
+                    <state>0xFF</state>
+                </option>
+                <option>
+                    <name>FillerStart</name>
+                    <state>0x0</state>
+                </option>
+                <option>
+                    <name>FillerEnd</name>
+                    <state>0x0</state>
+                </option>
+                <option>
+                    <name>CrcSize</name>
+                    <version>0</version>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CrcAlign</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CrcPoly</name>
+                    <state>0x11021</state>
+                </option>
+                <option>
+                    <name>CrcCompl</name>
+                    <version>0</version>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CrcBitOrder</name>
+                    <version>0</version>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>CrcInitialValue</name>
+                    <state>0x0</state>
+                </option>
+                <option>
+                    <name>DoCrc</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkBE8Slave</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IlinkBufferedTerminalOutput</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IlinkStdoutInterfaceSlave</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CrcFullSize</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkIElfToolPostProcess</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkLogAutoLibSelect</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkLogRedirSymbols</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkLogUnusedFragments</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkCrcReverseByteOrder</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkCrcUseAsInput</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IlinkOptInline</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IlinkOptExceptionsAllow</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IlinkOptExceptionsForce</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkCmsis</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IlinkOptMergeDuplSections</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkOptUseVfe</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IlinkOptForceVfe</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkStackAnalysisEnable</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkStackControlFile</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>IlinkStackCallGraphFile</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>CrcAlgorithm</name>
+                    <version>1</version>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>CrcUnitSize</name>
+                    <version>0</version>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkThreadsSlave</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IlinkLogCallGraph</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkIcfFile_AltDefault</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>IlinkEncInput</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkEncOutput</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IlinkEncOutputBom</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IlinkHeapSelect</name>
+                    <state>1</state>
+                </option>
+                <option>
+                    <name>IlinkLocaleSelect</name>
+                    <state>1</state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>IARCHIVE</name>
+            <archiveVersion>0</archiveVersion>
+            <data>
+                <version>0</version>
+                <wantNonLocal>1</wantNonLocal>
+                <debug>0</debug>
+                <option>
+                    <name>IarchiveInputs</name>
+                    <state></state>
+                </option>
+                <option>
+                    <name>IarchiveOverride</name>
+                    <state>0</state>
+                </option>
+                <option>
+                    <name>IarchiveOutput</name>
+                    <state>###Unitialized###</state>
+                </option>
+            </data>
+        </settings>
+        <settings>
+            <name>BILINK</name>
+            <archiveVersion>0</archiveVersion>
+            <data />
+        </settings>
+    </configuration>
+  <file>
+    <name>$PROJ_DIR$\..\am_hal_adc.c</name>
+  </file>
+  <file>
+    <name>$PROJ_DIR$\..\am_hal_cachectrl.c</name>
+  </file>
+  <file>
+    <name>$PROJ_DIR$\..\am_hal_clkgen.c</name>
+  </file>
+  <file>
+    <name>$PROJ_DIR$\..\am_hal_ctimer.c</name>
+  </file>
+  <file>
+    <name>$PROJ_DIR$\..\am_hal_debug.c</name>
+  </file>
+  <file>
+    <name>$PROJ_DIR$\..\am_hal_flash.c</name>
+  </file>
+  <file>
+    <name>$PROJ_DIR$\..\am_hal_global.c</name>
+  </file>
+  <file>
+    <name>$PROJ_DIR$\..\am_hal_gpio.c</name>
+  </file>
+  <file>
+    <name>$PROJ_DIR$\..\am_hal_i2c_bit_bang.c</name>
+  </file>
+  <file>
+    <name>$PROJ_DIR$\..\am_hal_interrupt.c</name>
+  </file>
+  <file>
+    <name>$PROJ_DIR$\..\am_hal_iom.c</name>
+  </file>
+  <file>
+    <name>$PROJ_DIR$\..\am_hal_ios.c</name>
+  </file>
+  <file>
+    <name>$PROJ_DIR$\..\am_hal_itm.c</name>
+  </file>
+  <file>
+    <name>$PROJ_DIR$\..\am_hal_mcuctrl.c</name>
+  </file>
+  <file>
+    <name>$PROJ_DIR$\..\am_hal_otp.c</name>
+  </file>
+  <file>
+    <name>$PROJ_DIR$\..\am_hal_pdm.c</name>
+  </file>
+  <file>
+    <name>$PROJ_DIR$\..\am_hal_pwrctrl.c</name>
+  </file>
+  <file>
+    <name>$PROJ_DIR$\..\am_hal_queue.c</name>
+  </file>
+  <file>
+    <name>$PROJ_DIR$\..\am_hal_reset.c</name>
+  </file>
+  <file>
+    <name>$PROJ_DIR$\..\am_hal_rtc.c</name>
+  </file>
+  <file>
+    <name>$PROJ_DIR$\..\am_hal_stimer.c</name>
+  </file>
+  <file>
+    <name>$PROJ_DIR$\..\am_hal_sysctrl.c</name>
+  </file>
+  <file>
+    <name>$PROJ_DIR$\..\am_hal_systick.c</name>
+  </file>
+  <file>
+    <name>$PROJ_DIR$\..\am_hal_tpiu.c</name>
+  </file>
+  <file>
+    <name>$PROJ_DIR$\..\am_hal_ttp.c</name>
+  </file>
+  <file>
+    <name>$PROJ_DIR$\..\am_hal_uart.c</name>
+  </file>
+  <file>
+    <name>$PROJ_DIR$\..\am_hal_vcomp.c</name>
+  </file>
+  <file>
+    <name>$PROJ_DIR$\..\am_hal_wdt.c</name>
+  </file>
+</project>
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/iar/libam_hal.eww b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/iar/libam_hal.eww
new file mode 100644
index 000000000..a37bed5d2
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/iar/libam_hal.eww
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<workspace>
+  <project>
+      <path>$WS_DIR$\libam_hal.ewp</path>
+  </project>
+  <batchBuild/>
+</workspace>
+
+
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/keil/Makefile b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/keil/Makefile
new file mode 100644
index 000000000..6f6ae0a88
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/keil/Makefile
@@ -0,0 +1,53 @@
+#******************************************************************************
+#
+# Makefile - Rules for building the libraries, examples and docs.
+#
+# Copyright (c) 2017, Ambiq Micro
+# All rights reserved.
+# 
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# 
+# 1. Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# 
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 
+# 3. Neither the name of the copyright holder nor the names of its
+# contributors may be used to endorse or promote products derived from this
+# software without specific prior written permission.
+# 
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+# 
+# This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+#
+#******************************************************************************
+
+SHELL=/bin/bash
+K := $(shell type -p uv4)
+
+ifeq ($(K),)
+all clean:
+	$(info Keil tools not found, skipping...)
+else
+all:
+	+mkdir -p bin ;\
+	(uv4 -b -t "libam_hal" libam_hal.uvprojx -j0) || \
+	    ( RC=$$?;[ $$RC -eq 1 ] || exit $$RC )
+clean:
+	@+echo Cleaning... ;\
+	rm -rf bin
+endif
+
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/keil/libam_hal.uvoptx b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/keil/libam_hal.uvoptx
new file mode 100644
index 000000000..bfd558e89
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/keil/libam_hal.uvoptx
@@ -0,0 +1,632 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
+<ProjectOpt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_optx.xsd">
+
+  <SchemaVersion>1.0</SchemaVersion>
+
+  <Header>### uVision Project, (C) Keil Software</Header>
+
+  <Extensions>
+    <cExt>*.c</cExt>
+    <aExt>*.s*; *.src; *.a*</aExt>
+    <oExt>*.obj</oExt>
+    <lExt>*.lib</lExt>
+    <tExt>*.txt; *.h; *.inc</tExt>
+    <pExt>*.plm</pExt>
+    <CppX>*.cpp</CppX>
+    <nMigrate>0</nMigrate>
+  </Extensions>
+
+  <DaveTm>
+    <dwLowDateTime>0</dwLowDateTime>
+    <dwHighDateTime>0</dwHighDateTime>
+  </DaveTm>
+
+  <Target>
+    <TargetName>libam_hal</TargetName>
+    <ToolsetNumber>0x4</ToolsetNumber>
+    <ToolsetName>ARM-ADS</ToolsetName>
+    <TargetOption>
+      <CLKADS>48000000</CLKADS>
+      <OPTTT>
+        <gFlags>1</gFlags>
+        <BeepAtEnd>1</BeepAtEnd>
+        <RunSim>0</RunSim>
+        <RunTarget>1</RunTarget>
+        <RunAbUc>0</RunAbUc>
+      </OPTTT>
+      <OPTHX>
+        <HexSelection>1</HexSelection>
+        <FlashByte>65535</FlashByte>
+        <HexRangeLowAddress>0</HexRangeLowAddress>
+        <HexRangeHighAddress>0</HexRangeHighAddress>
+        <HexOffset>0</HexOffset>
+      </OPTHX>
+      <OPTLEX>
+        <PageWidth>79</PageWidth>
+        <PageLength>66</PageLength>
+        <TabStop>8</TabStop>
+        <ListingPath>.\Listings\</ListingPath>
+      </OPTLEX>
+      <ListingPage>
+        <CreateCListing>1</CreateCListing>
+        <CreateAListing>1</CreateAListing>
+        <CreateLListing>1</CreateLListing>
+        <CreateIListing>0</CreateIListing>
+        <AsmCond>1</AsmCond>
+        <AsmSymb>1</AsmSymb>
+        <AsmXref>0</AsmXref>
+        <CCond>1</CCond>
+        <CCode>0</CCode>
+        <CListInc>0</CListInc>
+        <CSymb>0</CSymb>
+        <LinkerCodeListing>0</LinkerCodeListing>
+      </ListingPage>
+      <OPTXL>
+        <LMap>1</LMap>
+        <LComments>1</LComments>
+        <LGenerateSymbols>1</LGenerateSymbols>
+        <LLibSym>1</LLibSym>
+        <LLines>1</LLines>
+        <LLocSym>1</LLocSym>
+        <LPubSym>1</LPubSym>
+        <LXref>0</LXref>
+        <LExpSel>0</LExpSel>
+      </OPTXL>
+      <OPTFL>
+        <tvExp>1</tvExp>
+        <tvExpOptDlg>0</tvExpOptDlg>
+        <IsCurrentTarget>1</IsCurrentTarget>
+      </OPTFL>
+      <CpuCode>255</CpuCode>
+      <DebugOpt>
+        <uSim>0</uSim>
+        <uTrg>1</uTrg>
+        <sLdApp>1</sLdApp>
+        <sGomain>1</sGomain>
+        <sRbreak>1</sRbreak>
+        <sRwatch>1</sRwatch>
+        <sRmem>1</sRmem>
+        <sRfunc>1</sRfunc>
+        <sRbox>1</sRbox>
+        <tLdApp>0</tLdApp>
+        <tGomain>0</tGomain>
+        <tRbreak>1</tRbreak>
+        <tRwatch>1</tRwatch>
+        <tRmem>1</tRmem>
+        <tRfunc>0</tRfunc>
+        <tRbox>1</tRbox>
+        <tRtrace>1</tRtrace>
+        <sRSysVw>1</sRSysVw>
+        <tRSysVw>1</tRSysVw>
+        <sRunDeb>0</sRunDeb>
+        <sLrtime>0</sLrtime>
+        <bEvRecOn>1</bEvRecOn>
+        <nTsel>3</nTsel>
+        <sDll></sDll>
+        <sDllPa></sDllPa>
+        <sDlgDll></sDlgDll>
+        <sDlgPa></sDlgPa>
+        <sIfile></sIfile>
+        <tDll></tDll>
+        <tDllPa></tDllPa>
+        <tDlgDll></tDlgDll>
+        <tDlgPa></tDlgPa>
+        <tIfile>.\Dbg_RAM.ini</tIfile>
+        <pMon>Segger\JL2CM3.dll</pMon>
+      </DebugOpt>
+      <TargetDriverDllRegistry>
+        <SetRegEntry>
+          <Number>0</Number>
+          <Key>JL2CM3</Key>
+          <Name>-U483027775 -O2510 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO1 -TC3000000 -TP21 -TDS2 -TDT0 -TDC1F -TIE1 -TIP0 -TB1 -TFE0 -FO7 -FD10000000 -FC4000 -FN1 -FF0Apollo2.FLM -FS00 -FL0100000 -FP0($$Device:AMAPH1KK-KBR$Flash\Apollo2.FLM)</Name>
+        </SetRegEntry>
+        <SetRegEntry>
+          <Number>0</Number>
+          <Key>DbgCM</Key>
+          <Name>-U-O206 -O206 -S2 -C0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO1 -TC3000000 -TP21 -TDS2 -TDT0 -TDC1F -TIE1 -TIP8 -FO7 -FD10000000 -FC4000 -FN1 -FF0Apollo -FS00 -FL080000</Name>
+        </SetRegEntry>
+        <SetRegEntry>
+          <Number>0</Number>
+          <Key>UL2CM3</Key>
+          <Name>-UV0264NGE -O2510 -S0 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO1 -TC3000000 -TP21 -TDS8002 -TDT0 -TDC1F -TIE1 -TIP8 -FO7 -FD10000000 -FC4000 -FN1 -FF0Apollo2.FLM -FS00 -FL0100000 -FP0($$Device:AMAPH1KK-KBR$Flash\Apollo2.FLM)</Name>
+        </SetRegEntry>
+      </TargetDriverDllRegistry>
+      <Breakpoint/>
+      <Tracepoint>
+        <THDelay>0</THDelay>
+      </Tracepoint>
+      <DebugFlag>
+        <trace>0</trace>
+        <periodic>1</periodic>
+        <aLwin>1</aLwin>
+        <aCover>0</aCover>
+        <aSer1>0</aSer1>
+        <aSer2>0</aSer2>
+        <aPa>0</aPa>
+        <viewmode>1</viewmode>
+        <vrSel>0</vrSel>
+        <aSym>0</aSym>
+        <aTbox>0</aTbox>
+        <AscS1>0</AscS1>
+        <AscS2>0</AscS2>
+        <AscS3>0</AscS3>
+        <aSer3>0</aSer3>
+        <eProf>0</eProf>
+        <aLa>0</aLa>
+        <aPa1>0</aPa1>
+        <AscS4>0</AscS4>
+        <aSer4>1</aSer4>
+        <StkLoc>0</StkLoc>
+        <TrcWin>0</TrcWin>
+        <newCpu>0</newCpu>
+        <uProt>0</uProt>
+      </DebugFlag>
+      <LintExecutable></LintExecutable>
+      <LintConfigFile></LintConfigFile>
+      <bLintAuto>0</bLintAuto>
+      <Lin2Executable></Lin2Executable>
+      <Lin2ConfigFile></Lin2ConfigFile>
+      <bLin2Auto>0</bLin2Auto>
+      <bAutoGenD>0</bAutoGenD>
+      <bAuto2GenD>0</bAuto2GenD>
+    </TargetOption>
+  </Target>
+
+  <Group>
+    <GroupName>source_files</GroupName>
+    <tvExp>1</tvExp>
+    <tvExpOptDlg>0</tvExpOptDlg>
+    <cbSel>0</cbSel>
+    <RteFlg>0</RteFlg>
+    <File>
+      <GroupNumber>1</GroupNumber>
+      <FileNumber>1</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <Focus>0</Focus>
+      <ColumnNumber>0</ColumnNumber>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <TopLine>0</TopLine>
+      <CurrentLine>0</CurrentLine>
+      <bDave2>0</bDave2>
+      <PathWithFileName>.././am_hal_adc.c</PathWithFileName>
+      <FilenameWithoutPath>am_hal_adc.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>1</GroupNumber>
+      <FileNumber>2</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <Focus>0</Focus>
+      <ColumnNumber>0</ColumnNumber>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <TopLine>0</TopLine>
+      <CurrentLine>0</CurrentLine>
+      <bDave2>0</bDave2>
+      <PathWithFileName>.././am_hal_cachectrl.c</PathWithFileName>
+      <FilenameWithoutPath>am_hal_cachectrl.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>1</GroupNumber>
+      <FileNumber>3</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <Focus>0</Focus>
+      <ColumnNumber>0</ColumnNumber>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <TopLine>0</TopLine>
+      <CurrentLine>0</CurrentLine>
+      <bDave2>0</bDave2>
+      <PathWithFileName>.././am_hal_clkgen.c</PathWithFileName>
+      <FilenameWithoutPath>am_hal_clkgen.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>1</GroupNumber>
+      <FileNumber>4</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <Focus>0</Focus>
+      <ColumnNumber>0</ColumnNumber>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <TopLine>0</TopLine>
+      <CurrentLine>0</CurrentLine>
+      <bDave2>0</bDave2>
+      <PathWithFileName>.././am_hal_ctimer.c</PathWithFileName>
+      <FilenameWithoutPath>am_hal_ctimer.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>1</GroupNumber>
+      <FileNumber>5</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <Focus>0</Focus>
+      <ColumnNumber>0</ColumnNumber>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <TopLine>0</TopLine>
+      <CurrentLine>0</CurrentLine>
+      <bDave2>0</bDave2>
+      <PathWithFileName>.././am_hal_debug.c</PathWithFileName>
+      <FilenameWithoutPath>am_hal_debug.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>1</GroupNumber>
+      <FileNumber>6</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <Focus>0</Focus>
+      <ColumnNumber>0</ColumnNumber>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <TopLine>0</TopLine>
+      <CurrentLine>0</CurrentLine>
+      <bDave2>0</bDave2>
+      <PathWithFileName>.././am_hal_flash.c</PathWithFileName>
+      <FilenameWithoutPath>am_hal_flash.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>1</GroupNumber>
+      <FileNumber>7</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <Focus>0</Focus>
+      <ColumnNumber>0</ColumnNumber>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <TopLine>0</TopLine>
+      <CurrentLine>0</CurrentLine>
+      <bDave2>0</bDave2>
+      <PathWithFileName>.././am_hal_global.c</PathWithFileName>
+      <FilenameWithoutPath>am_hal_global.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>1</GroupNumber>
+      <FileNumber>8</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <Focus>0</Focus>
+      <ColumnNumber>0</ColumnNumber>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <TopLine>0</TopLine>
+      <CurrentLine>0</CurrentLine>
+      <bDave2>0</bDave2>
+      <PathWithFileName>.././am_hal_gpio.c</PathWithFileName>
+      <FilenameWithoutPath>am_hal_gpio.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>1</GroupNumber>
+      <FileNumber>9</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <Focus>0</Focus>
+      <ColumnNumber>0</ColumnNumber>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <TopLine>0</TopLine>
+      <CurrentLine>0</CurrentLine>
+      <bDave2>0</bDave2>
+      <PathWithFileName>.././am_hal_i2c_bit_bang.c</PathWithFileName>
+      <FilenameWithoutPath>am_hal_i2c_bit_bang.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>1</GroupNumber>
+      <FileNumber>10</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <Focus>0</Focus>
+      <ColumnNumber>0</ColumnNumber>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <TopLine>0</TopLine>
+      <CurrentLine>0</CurrentLine>
+      <bDave2>0</bDave2>
+      <PathWithFileName>.././am_hal_interrupt.c</PathWithFileName>
+      <FilenameWithoutPath>am_hal_interrupt.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>1</GroupNumber>
+      <FileNumber>11</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <Focus>0</Focus>
+      <ColumnNumber>0</ColumnNumber>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <TopLine>0</TopLine>
+      <CurrentLine>0</CurrentLine>
+      <bDave2>0</bDave2>
+      <PathWithFileName>.././am_hal_iom.c</PathWithFileName>
+      <FilenameWithoutPath>am_hal_iom.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>1</GroupNumber>
+      <FileNumber>12</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <Focus>0</Focus>
+      <ColumnNumber>0</ColumnNumber>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <TopLine>0</TopLine>
+      <CurrentLine>0</CurrentLine>
+      <bDave2>0</bDave2>
+      <PathWithFileName>.././am_hal_ios.c</PathWithFileName>
+      <FilenameWithoutPath>am_hal_ios.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>1</GroupNumber>
+      <FileNumber>13</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <Focus>0</Focus>
+      <ColumnNumber>0</ColumnNumber>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <TopLine>0</TopLine>
+      <CurrentLine>0</CurrentLine>
+      <bDave2>0</bDave2>
+      <PathWithFileName>.././am_hal_itm.c</PathWithFileName>
+      <FilenameWithoutPath>am_hal_itm.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>1</GroupNumber>
+      <FileNumber>14</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <Focus>0</Focus>
+      <ColumnNumber>0</ColumnNumber>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <TopLine>0</TopLine>
+      <CurrentLine>0</CurrentLine>
+      <bDave2>0</bDave2>
+      <PathWithFileName>.././am_hal_mcuctrl.c</PathWithFileName>
+      <FilenameWithoutPath>am_hal_mcuctrl.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>1</GroupNumber>
+      <FileNumber>15</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <Focus>0</Focus>
+      <ColumnNumber>0</ColumnNumber>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <TopLine>0</TopLine>
+      <CurrentLine>0</CurrentLine>
+      <bDave2>0</bDave2>
+      <PathWithFileName>.././am_hal_otp.c</PathWithFileName>
+      <FilenameWithoutPath>am_hal_otp.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>1</GroupNumber>
+      <FileNumber>16</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <Focus>0</Focus>
+      <ColumnNumber>0</ColumnNumber>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <TopLine>0</TopLine>
+      <CurrentLine>0</CurrentLine>
+      <bDave2>0</bDave2>
+      <PathWithFileName>.././am_hal_pdm.c</PathWithFileName>
+      <FilenameWithoutPath>am_hal_pdm.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>1</GroupNumber>
+      <FileNumber>17</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <Focus>0</Focus>
+      <ColumnNumber>0</ColumnNumber>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <TopLine>0</TopLine>
+      <CurrentLine>0</CurrentLine>
+      <bDave2>0</bDave2>
+      <PathWithFileName>.././am_hal_pwrctrl.c</PathWithFileName>
+      <FilenameWithoutPath>am_hal_pwrctrl.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>1</GroupNumber>
+      <FileNumber>18</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <Focus>0</Focus>
+      <ColumnNumber>0</ColumnNumber>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <TopLine>0</TopLine>
+      <CurrentLine>0</CurrentLine>
+      <bDave2>0</bDave2>
+      <PathWithFileName>.././am_hal_queue.c</PathWithFileName>
+      <FilenameWithoutPath>am_hal_queue.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>1</GroupNumber>
+      <FileNumber>19</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <Focus>0</Focus>
+      <ColumnNumber>0</ColumnNumber>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <TopLine>0</TopLine>
+      <CurrentLine>0</CurrentLine>
+      <bDave2>0</bDave2>
+      <PathWithFileName>.././am_hal_reset.c</PathWithFileName>
+      <FilenameWithoutPath>am_hal_reset.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>1</GroupNumber>
+      <FileNumber>20</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <Focus>0</Focus>
+      <ColumnNumber>0</ColumnNumber>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <TopLine>0</TopLine>
+      <CurrentLine>0</CurrentLine>
+      <bDave2>0</bDave2>
+      <PathWithFileName>.././am_hal_rtc.c</PathWithFileName>
+      <FilenameWithoutPath>am_hal_rtc.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>1</GroupNumber>
+      <FileNumber>21</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <Focus>0</Focus>
+      <ColumnNumber>0</ColumnNumber>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <TopLine>0</TopLine>
+      <CurrentLine>0</CurrentLine>
+      <bDave2>0</bDave2>
+      <PathWithFileName>.././am_hal_stimer.c</PathWithFileName>
+      <FilenameWithoutPath>am_hal_stimer.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>1</GroupNumber>
+      <FileNumber>22</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <Focus>0</Focus>
+      <ColumnNumber>0</ColumnNumber>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <TopLine>0</TopLine>
+      <CurrentLine>0</CurrentLine>
+      <bDave2>0</bDave2>
+      <PathWithFileName>.././am_hal_sysctrl.c</PathWithFileName>
+      <FilenameWithoutPath>am_hal_sysctrl.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>1</GroupNumber>
+      <FileNumber>23</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <Focus>0</Focus>
+      <ColumnNumber>0</ColumnNumber>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <TopLine>0</TopLine>
+      <CurrentLine>0</CurrentLine>
+      <bDave2>0</bDave2>
+      <PathWithFileName>.././am_hal_systick.c</PathWithFileName>
+      <FilenameWithoutPath>am_hal_systick.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>1</GroupNumber>
+      <FileNumber>24</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <Focus>0</Focus>
+      <ColumnNumber>0</ColumnNumber>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <TopLine>0</TopLine>
+      <CurrentLine>0</CurrentLine>
+      <bDave2>0</bDave2>
+      <PathWithFileName>.././am_hal_tpiu.c</PathWithFileName>
+      <FilenameWithoutPath>am_hal_tpiu.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>1</GroupNumber>
+      <FileNumber>25</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <Focus>0</Focus>
+      <ColumnNumber>0</ColumnNumber>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <TopLine>0</TopLine>
+      <CurrentLine>0</CurrentLine>
+      <bDave2>0</bDave2>
+      <PathWithFileName>.././am_hal_ttp.c</PathWithFileName>
+      <FilenameWithoutPath>am_hal_ttp.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>1</GroupNumber>
+      <FileNumber>26</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <Focus>0</Focus>
+      <ColumnNumber>0</ColumnNumber>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <TopLine>0</TopLine>
+      <CurrentLine>0</CurrentLine>
+      <bDave2>0</bDave2>
+      <PathWithFileName>.././am_hal_uart.c</PathWithFileName>
+      <FilenameWithoutPath>am_hal_uart.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>1</GroupNumber>
+      <FileNumber>27</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <Focus>0</Focus>
+      <ColumnNumber>0</ColumnNumber>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <TopLine>0</TopLine>
+      <CurrentLine>0</CurrentLine>
+      <bDave2>0</bDave2>
+      <PathWithFileName>.././am_hal_vcomp.c</PathWithFileName>
+      <FilenameWithoutPath>am_hal_vcomp.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>1</GroupNumber>
+      <FileNumber>28</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <Focus>0</Focus>
+      <ColumnNumber>0</ColumnNumber>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <TopLine>0</TopLine>
+      <CurrentLine>0</CurrentLine>
+      <bDave2>0</bDave2>
+      <PathWithFileName>.././am_hal_wdt.c</PathWithFileName>
+      <FilenameWithoutPath>am_hal_wdt.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+  </Group>
+
+</ProjectOpt>
+
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/keil/libam_hal.uvprojx b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/keil/libam_hal.uvprojx
new file mode 100644
index 000000000..e53f6caed
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/hal/keil/libam_hal.uvprojx
@@ -0,0 +1,529 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
+<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_projx.xsd">
+
+  <SchemaVersion>2.1</SchemaVersion>
+
+  <Header>### uVision Project, (C) Keil Software</Header>
+
+  <Targets>
+    <Target>
+      <TargetName>libam_hal</TargetName>
+      <ToolsetNumber>0x4</ToolsetNumber>
+      <ToolsetName>ARM-ADS</ToolsetName>
+      <pCCUsed>5060422::V5.06 update 4 (build 422)::ARMCC</pCCUsed>
+      <TargetOption>
+        <TargetCommonOption>
+          <Device>AMAPH1KK-KBR</Device>
+          <Vendor>Ambiq Micro</Vendor>
+          <PackID>AmbiqMicro.Apollo_DFP.1.0.0</PackID>
+          <PackURL>http://s3.asia.ambiqmicro.com/pack/</PackURL>
+          <Cpu>IROM(0x00000000,0x100000) IRAM(0x10000000,0x40000) CPUTYPE("Cortex-M4") FPU2 CLOCK(24000000) ELITTLE</Cpu>
+          <FlashUtilSpec></FlashUtilSpec>
+          <StartupFile></StartupFile>
+          <FlashDriverDll>UL2CM3(-S0 -C0 -P0 -FD10000000 -FC4000 -FN1 -FF0Apollo -FS00 -FL010000 -FP0($$Device:AMAPH1KK-KBR$Flash\Apollo2.FLM))</FlashDriverDll>
+          <DeviceId>0</DeviceId>
+          <RegisterFile></RegisterFile>
+          <MemoryEnv></MemoryEnv>
+          <Cmp></Cmp>
+          <Asm></Asm>
+          <Linker></Linker>
+          <OHString></OHString>
+          <InfinionOptionDll></InfinionOptionDll>
+          <SLE66CMisc></SLE66CMisc>
+          <SLE66AMisc></SLE66AMisc>
+          <SLE66LinkerMisc></SLE66LinkerMisc>
+          <SFDFile>$$Device:AMAPH1KK-KBR$SVD\Apollo2.svd</SFDFile>
+          <bCustSvd>0</bCustSvd>
+          <UseEnv>0</UseEnv>
+          <BinPath></BinPath>
+          <IncludePath></IncludePath>
+          <LibPath></LibPath>
+          <RegisterFilePath>1024 BGA$Device\Include\Apollo2.h\</RegisterFilePath>
+          <DBRegisterFilePath>1024 BGA$Device\Include\Apollo2.h\</DBRegisterFilePath>
+          <TargetStatus>
+            <Error>0</Error>
+            <ExitCodeStop>0</ExitCodeStop>
+            <ButtonStop>0</ButtonStop>
+            <NotGenerated>0</NotGenerated>
+            <InvalidFlash>1</InvalidFlash>
+          </TargetStatus>
+          <OutputDirectory>.\bin\</OutputDirectory>
+          <OutputName>libam_hal</OutputName>
+          <CreateExecutable>0</CreateExecutable>
+          <CreateLib>1</CreateLib>
+          <CreateHexFile>0</CreateHexFile>
+          <DebugInformation>0</DebugInformation>
+          <BrowseInformation>1</BrowseInformation>
+          <ListingPath>.\Listings\</ListingPath>
+          <HexFormatSelection>1</HexFormatSelection>
+          <Merge32K>0</Merge32K>
+          <CreateBatchFile>0</CreateBatchFile>
+          <BeforeCompile>
+            <RunUserProg1>0</RunUserProg1>
+            <RunUserProg2>0</RunUserProg2>
+            <UserProg1Name></UserProg1Name>
+            <UserProg2Name></UserProg2Name>
+            <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
+            <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
+            <nStopU1X>0</nStopU1X>
+            <nStopU2X>0</nStopU2X>
+          </BeforeCompile>
+          <BeforeMake>
+            <RunUserProg1>0</RunUserProg1>
+            <RunUserProg2>0</RunUserProg2>
+            <UserProg1Name></UserProg1Name>
+            <UserProg2Name></UserProg2Name>
+            <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
+            <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
+            <nStopB1X>0</nStopB1X>
+            <nStopB2X>0</nStopB2X>
+          </BeforeMake>
+          <AfterMake>
+            <RunUserProg1>1</RunUserProg1>
+            <RunUserProg2>1</RunUserProg2>
+            <UserProg1Name>fromelf --bin --output bin\libam_hal.bin bin\libam_hal.axf</UserProg1Name>
+            <UserProg2Name>fromelf -cedrst --output bin\libam_hal.txt bin\libam_hal.axf</UserProg2Name>
+            <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
+            <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
+            <nStopA1X>0</nStopA1X>
+            <nStopA2X>0</nStopA2X>
+          </AfterMake>
+          <SelectedForBatchBuild>0</SelectedForBatchBuild>
+          <SVCSIdString></SVCSIdString>
+        </TargetCommonOption>
+        <CommonProperty>
+          <UseCPPCompiler>0</UseCPPCompiler>
+          <RVCTCodeConst>0</RVCTCodeConst>
+          <RVCTZI>0</RVCTZI>
+          <RVCTOtherData>0</RVCTOtherData>
+          <ModuleSelection>0</ModuleSelection>
+          <IncludeInBuild>1</IncludeInBuild>
+          <AlwaysBuild>0</AlwaysBuild>
+          <GenerateAssemblyFile>0</GenerateAssemblyFile>
+          <AssembleAssemblyFile>0</AssembleAssemblyFile>
+          <PublicsOnly>0</PublicsOnly>
+          <StopOnExitCode>3</StopOnExitCode>
+          <CustomArgument></CustomArgument>
+          <IncludeLibraryModules></IncludeLibraryModules>
+          <ComprImg>1</ComprImg>
+        </CommonProperty>
+        <DllOption>
+          <SimDllName>SARMCM3.DLL</SimDllName>
+          <SimDllArguments>  -MPU</SimDllArguments>
+          <SimDlgDll>DCM.DLL</SimDlgDll>
+          <SimDlgDllArguments>-pCM4</SimDlgDllArguments>
+          <TargetDllName>SARMCM3.DLL</TargetDllName>
+          <TargetDllArguments> -MPU</TargetDllArguments>
+          <TargetDlgDll>TCM.DLL</TargetDlgDll>
+          <TargetDlgDllArguments>-pCM4</TargetDlgDllArguments>
+        </DllOption>
+        <DebugOption>
+          <OPTHX>
+            <HexSelection>1</HexSelection>
+            <HexRangeLowAddress>0</HexRangeLowAddress>
+            <HexRangeHighAddress>0</HexRangeHighAddress>
+            <HexOffset>0</HexOffset>
+            <Oh166RecLen>16</Oh166RecLen>
+          </OPTHX>
+        </DebugOption>
+        <Utilities>
+          <Flash1>
+            <UseTargetDll>1</UseTargetDll>
+            <UseExternalTool>0</UseExternalTool>
+            <RunIndependent>0</RunIndependent>
+            <UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
+            <Capability>1</Capability>
+            <DriverSelection>4096</DriverSelection>
+          </Flash1>
+          <bUseTDR>1</bUseTDR>
+          <Flash2>BIN\UL2CM3.DLL</Flash2>
+          <Flash3></Flash3>
+          <Flash4></Flash4>
+          <pFcarmOut></pFcarmOut>
+          <pFcarmGrp></pFcarmGrp>
+          <pFcArmRoot></pFcArmRoot>
+          <FcArmLst>0</FcArmLst>
+        </Utilities>
+        <TargetArmAds>
+          <ArmAdsMisc>
+            <GenerateListings>0</GenerateListings>
+            <asHll>1</asHll>
+            <asAsm>1</asAsm>
+            <asMacX>1</asMacX>
+            <asSyms>1</asSyms>
+            <asFals>1</asFals>
+            <asDbgD>1</asDbgD>
+            <asForm>1</asForm>
+            <ldLst>0</ldLst>
+            <ldmm>1</ldmm>
+            <ldXref>1</ldXref>
+            <BigEnd>0</BigEnd>
+            <AdsALst>1</AdsALst>
+            <AdsACrf>1</AdsACrf>
+            <AdsANop>0</AdsANop>
+            <AdsANot>0</AdsANot>
+            <AdsLLst>1</AdsLLst>
+            <AdsLmap>1</AdsLmap>
+            <AdsLcgr>1</AdsLcgr>
+            <AdsLsym>1</AdsLsym>
+            <AdsLszi>1</AdsLszi>
+            <AdsLtoi>1</AdsLtoi>
+            <AdsLsun>1</AdsLsun>
+            <AdsLven>1</AdsLven>
+            <AdsLsxf>1</AdsLsxf>
+            <RvctClst>0</RvctClst>
+            <GenPPlst>0</GenPPlst>
+            <AdsCpuType>"Cortex-M4"</AdsCpuType>
+            <RvctDeviceName></RvctDeviceName>
+            <mOS>0</mOS>
+            <uocRom>0</uocRom>
+            <uocRam>0</uocRam>
+            <hadIROM>1</hadIROM>
+            <hadIRAM>1</hadIRAM>
+            <hadXRAM>0</hadXRAM>
+            <uocXRam>0</uocXRam>
+            <RvdsVP>2</RvdsVP>
+            <hadIRAM2>0</hadIRAM2>
+            <hadIROM2>0</hadIROM2>
+            <StupSel>8</StupSel>
+            <useUlib>0</useUlib>
+            <EndSel>0</EndSel>
+            <uLtcg>0</uLtcg>
+            <nSecure>0</nSecure>
+            <RoSelD>3</RoSelD>
+            <RwSelD>3</RwSelD>
+            <CodeSel>0</CodeSel>
+            <OptFeed>0</OptFeed>
+            <NoZi1>0</NoZi1>
+            <NoZi2>0</NoZi2>
+            <NoZi3>0</NoZi3>
+            <NoZi4>0</NoZi4>
+            <NoZi5>0</NoZi5>
+            <Ro1Chk>0</Ro1Chk>
+            <Ro2Chk>0</Ro2Chk>
+            <Ro3Chk>0</Ro3Chk>
+            <Ir1Chk>1</Ir1Chk>
+            <Ir2Chk>0</Ir2Chk>
+            <Ra1Chk>0</Ra1Chk>
+            <Ra2Chk>0</Ra2Chk>
+            <Ra3Chk>0</Ra3Chk>
+            <Im1Chk>1</Im1Chk>
+            <Im2Chk>0</Im2Chk>
+            <OnChipMemories>
+              <Ocm1>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </Ocm1>
+              <Ocm2>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </Ocm2>
+              <Ocm3>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </Ocm3>
+              <Ocm4>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </Ocm4>
+              <Ocm5>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </Ocm5>
+              <Ocm6>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </Ocm6>
+              <IRAM>
+                <Type>0</Type>
+                <StartAddress>0x10000000</StartAddress>
+                <Size>0x40000</Size>
+              </IRAM>
+              <IROM>
+                <Type>1</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x100000</Size>
+              </IROM>
+              <XRAM>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </XRAM>
+              <OCR_RVCT1>
+                <Type>1</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT1>
+              <OCR_RVCT2>
+                <Type>1</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT2>
+              <OCR_RVCT3>
+                <Type>1</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT3>
+              <OCR_RVCT4>
+                <Type>1</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x80000</Size>
+              </OCR_RVCT4>
+              <OCR_RVCT5>
+                <Type>1</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT5>
+              <OCR_RVCT6>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT6>
+              <OCR_RVCT7>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT7>
+              <OCR_RVCT8>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT8>
+              <OCR_RVCT9>
+                <Type>0</Type>
+                <StartAddress>0x10000000</StartAddress>
+                <Size>0x40000</Size>
+              </OCR_RVCT9>
+              <OCR_RVCT10>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT10>
+            </OnChipMemories>
+            <RvctStartVector></RvctStartVector>
+          </ArmAdsMisc>
+          <Cads>
+            <interw>1</interw>
+            <Optim>4</Optim>
+            <oTime>1</oTime>
+            <SplitLS>0</SplitLS>
+            <OneElfS>1</OneElfS>
+            <Strict>0</Strict>
+            <EnumInt>0</EnumInt>
+            <PlainCh>0</PlainCh>
+            <Ropi>0</Ropi>
+            <Rwpi>0</Rwpi>
+            <wLevel>2</wLevel>
+            <uThumb>0</uThumb>
+            <uSurpInc>0</uSurpInc>
+            <uC99>1</uC99>
+            <useXO>0</useXO>
+            <v6Lang>1</v6Lang>
+            <v6LangP>1</v6LangP>
+            <vShortEn>1</vShortEn>
+            <vShortWch>1</vShortWch>
+            <v6Lto>0</v6Lto>
+            <v6WtE>0</v6WtE>
+            <v6Rtti>0</v6Rtti>
+            <VariousControls>
+              <MiscControls></MiscControls>
+              <Define>AM_DEBUG_ASSERT AM_ASSERT_INVALID_THRESHOLD=0 AM_PART_APOLLO2 keil</Define>
+              <Undefine></Undefine>
+              <IncludePath>../../../../mcu/apollo2;../../../../utils</IncludePath>
+            </VariousControls>
+          </Cads>
+          <Aads>
+            <interw>1</interw>
+            <Ropi>0</Ropi>
+            <Rwpi>0</Rwpi>
+            <thumb>0</thumb>
+            <SplitLS>0</SplitLS>
+            <SwStkChk>0</SwStkChk>
+            <NoWarn>0</NoWarn>
+            <uSurpInc>0</uSurpInc>
+            <useXO>0</useXO>
+            <uClangAs>0</uClangAs>
+            <VariousControls>
+              <MiscControls></MiscControls>
+              <Define></Define>
+              <Undefine></Undefine>
+              <IncludePath></IncludePath>
+            </VariousControls>
+          </Aads>
+          <LDads>
+            <umfTarg>0</umfTarg>
+            <Ropi>0</Ropi>
+            <Rwpi>0</Rwpi>
+            <noStLib>0</noStLib>
+            <RepFail>1</RepFail>
+            <useFile>0</useFile>
+            <TextAddressRange>0x0</TextAddressRange>
+            <DataAddressRange>0x10000000</DataAddressRange>
+            <pXoBase></pXoBase>
+            <ScatterFile></ScatterFile>
+            <IncludeLibs></IncludeLibs>
+            <IncludeLibsPath></IncludeLibsPath>
+            <Misc>../../../../mcu/apollo2/hal/keil/bin/libam_hal.lib(am_hal_global.o) --keep=am_hal_global.o(.data)</Misc>
+            <LinkerInputFile></LinkerInputFile>
+            <DisabledWarnings></DisabledWarnings>
+          </LDads>
+        </TargetArmAds>
+      </TargetOption>
+      <Groups>
+        <Group>
+          <GroupName>source_files</GroupName>
+          <Files>
+            <File>
+              <FileName>am_hal_adc.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>../am_hal_adc.c</FilePath>
+            </File>
+            <File>
+              <FileName>am_hal_cachectrl.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>../am_hal_cachectrl.c</FilePath>
+            </File>
+            <File>
+              <FileName>am_hal_clkgen.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>../am_hal_clkgen.c</FilePath>
+            </File>
+            <File>
+              <FileName>am_hal_ctimer.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>../am_hal_ctimer.c</FilePath>
+            </File>
+            <File>
+              <FileName>am_hal_debug.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>../am_hal_debug.c</FilePath>
+            </File>
+            <File>
+              <FileName>am_hal_flash.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>../am_hal_flash.c</FilePath>
+            </File>
+            <File>
+              <FileName>am_hal_global.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>../am_hal_global.c</FilePath>
+            </File>
+            <File>
+              <FileName>am_hal_gpio.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>../am_hal_gpio.c</FilePath>
+            </File>
+            <File>
+              <FileName>am_hal_i2c_bit_bang.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>../am_hal_i2c_bit_bang.c</FilePath>
+            </File>
+            <File>
+              <FileName>am_hal_interrupt.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>../am_hal_interrupt.c</FilePath>
+            </File>
+            <File>
+              <FileName>am_hal_iom.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>../am_hal_iom.c</FilePath>
+            </File>
+            <File>
+              <FileName>am_hal_ios.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>../am_hal_ios.c</FilePath>
+            </File>
+            <File>
+              <FileName>am_hal_itm.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>../am_hal_itm.c</FilePath>
+            </File>
+            <File>
+              <FileName>am_hal_mcuctrl.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>../am_hal_mcuctrl.c</FilePath>
+            </File>
+            <File>
+              <FileName>am_hal_otp.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>../am_hal_otp.c</FilePath>
+            </File>
+            <File>
+              <FileName>am_hal_pdm.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>../am_hal_pdm.c</FilePath>
+            </File>
+            <File>
+              <FileName>am_hal_pwrctrl.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>../am_hal_pwrctrl.c</FilePath>
+            </File>
+            <File>
+              <FileName>am_hal_queue.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>../am_hal_queue.c</FilePath>
+            </File>
+            <File>
+              <FileName>am_hal_reset.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>../am_hal_reset.c</FilePath>
+            </File>
+            <File>
+              <FileName>am_hal_rtc.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>../am_hal_rtc.c</FilePath>
+            </File>
+            <File>
+              <FileName>am_hal_stimer.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>../am_hal_stimer.c</FilePath>
+            </File>
+            <File>
+              <FileName>am_hal_sysctrl.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>../am_hal_sysctrl.c</FilePath>
+            </File>
+            <File>
+              <FileName>am_hal_systick.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>../am_hal_systick.c</FilePath>
+            </File>
+            <File>
+              <FileName>am_hal_tpiu.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>../am_hal_tpiu.c</FilePath>
+            </File>
+            <File>
+              <FileName>am_hal_ttp.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>../am_hal_ttp.c</FilePath>
+            </File>
+            <File>
+              <FileName>am_hal_uart.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>../am_hal_uart.c</FilePath>
+            </File>
+            <File>
+              <FileName>am_hal_vcomp.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>../am_hal_vcomp.c</FilePath>
+            </File>
+            <File>
+              <FileName>am_hal_wdt.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>../am_hal_wdt.c</FilePath>
+            </File>
+          </Files>
+        </Group>
+      </Groups>
+    </Target>
+  </Targets>
+
+</Project>
+
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_adc.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_adc.h
new file mode 100644
index 000000000..9241f8cb0
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_adc.h
@@ -0,0 +1,863 @@
+//*****************************************************************************
+//
+//! @file am_reg_adc.h
+//!
+//! @brief Register macros for the ADC module
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_REG_ADC_H
+#define AM_REG_ADC_H
+
+//*****************************************************************************
+//
+// Instance finder. (1 instance(s) available)
+//
+//*****************************************************************************
+#define AM_REG_ADC_NUM_MODULES                       1
+#define AM_REG_ADCn(n) \
+    (REG_ADC_BASEADDR + 0x00000000 * n)
+
+//*****************************************************************************
+//
+// Register offsets.
+//
+//*****************************************************************************
+#define AM_REG_ADC_CFG_O                             0x00000000
+#define AM_REG_ADC_STAT_O                            0x00000004
+#define AM_REG_ADC_SWT_O                             0x00000008
+#define AM_REG_ADC_SL0CFG_O                          0x0000000C
+#define AM_REG_ADC_SL1CFG_O                          0x00000010
+#define AM_REG_ADC_SL2CFG_O                          0x00000014
+#define AM_REG_ADC_SL3CFG_O                          0x00000018
+#define AM_REG_ADC_SL4CFG_O                          0x0000001C
+#define AM_REG_ADC_SL5CFG_O                          0x00000020
+#define AM_REG_ADC_SL6CFG_O                          0x00000024
+#define AM_REG_ADC_SL7CFG_O                          0x00000028
+#define AM_REG_ADC_WULIM_O                           0x0000002C
+#define AM_REG_ADC_WLLIM_O                           0x00000030
+#define AM_REG_ADC_FIFO_O                            0x00000038
+#define AM_REG_ADC_INTEN_O                           0x00000200
+#define AM_REG_ADC_INTSTAT_O                         0x00000204
+#define AM_REG_ADC_INTCLR_O                          0x00000208
+#define AM_REG_ADC_INTSET_O                          0x0000020C
+
+//*****************************************************************************
+//
+// ADC_INTEN - ADC Interrupt registers: Enable
+//
+//*****************************************************************************
+// Window comparator voltage incursion interrupt.
+#define AM_REG_ADC_INTEN_WCINC_S                     5
+#define AM_REG_ADC_INTEN_WCINC_M                     0x00000020
+#define AM_REG_ADC_INTEN_WCINC(n)                    (((uint32_t)(n) << 5) & 0x00000020)
+#define AM_REG_ADC_INTEN_WCINC_WCINCINT              0x00000020
+
+// Window comparator voltage excursion interrupt.
+#define AM_REG_ADC_INTEN_WCEXC_S                     4
+#define AM_REG_ADC_INTEN_WCEXC_M                     0x00000010
+#define AM_REG_ADC_INTEN_WCEXC(n)                    (((uint32_t)(n) << 4) & 0x00000010)
+#define AM_REG_ADC_INTEN_WCEXC_WCEXCINT              0x00000010
+
+// FIFO 100 percent full interrupt.
+#define AM_REG_ADC_INTEN_FIFOOVR2_S                  3
+#define AM_REG_ADC_INTEN_FIFOOVR2_M                  0x00000008
+#define AM_REG_ADC_INTEN_FIFOOVR2(n)                 (((uint32_t)(n) << 3) & 0x00000008)
+#define AM_REG_ADC_INTEN_FIFOOVR2_FIFOFULLINT        0x00000008
+
+// FIFO 75 percent full interrupt.
+#define AM_REG_ADC_INTEN_FIFOOVR1_S                  2
+#define AM_REG_ADC_INTEN_FIFOOVR1_M                  0x00000004
+#define AM_REG_ADC_INTEN_FIFOOVR1(n)                 (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_ADC_INTEN_FIFOOVR1_FIFO75INT          0x00000004
+
+// ADC scan complete interrupt.
+#define AM_REG_ADC_INTEN_SCNCMP_S                    1
+#define AM_REG_ADC_INTEN_SCNCMP_M                    0x00000002
+#define AM_REG_ADC_INTEN_SCNCMP(n)                   (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_ADC_INTEN_SCNCMP_SCNCMPINT            0x00000002
+
+// ADC conversion complete interrupt.
+#define AM_REG_ADC_INTEN_CNVCMP_S                    0
+#define AM_REG_ADC_INTEN_CNVCMP_M                    0x00000001
+#define AM_REG_ADC_INTEN_CNVCMP(n)                   (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_ADC_INTEN_CNVCMP_CNVCMPINT            0x00000001
+
+//*****************************************************************************
+//
+// ADC_INTSTAT - ADC Interrupt registers: Status
+//
+//*****************************************************************************
+// Window comparator voltage incursion interrupt.
+#define AM_REG_ADC_INTSTAT_WCINC_S                   5
+#define AM_REG_ADC_INTSTAT_WCINC_M                   0x00000020
+#define AM_REG_ADC_INTSTAT_WCINC(n)                  (((uint32_t)(n) << 5) & 0x00000020)
+#define AM_REG_ADC_INTSTAT_WCINC_WCINCINT            0x00000020
+
+// Window comparator voltage excursion interrupt.
+#define AM_REG_ADC_INTSTAT_WCEXC_S                   4
+#define AM_REG_ADC_INTSTAT_WCEXC_M                   0x00000010
+#define AM_REG_ADC_INTSTAT_WCEXC(n)                  (((uint32_t)(n) << 4) & 0x00000010)
+#define AM_REG_ADC_INTSTAT_WCEXC_WCEXCINT            0x00000010
+
+// FIFO 100 percent full interrupt.
+#define AM_REG_ADC_INTSTAT_FIFOOVR2_S                3
+#define AM_REG_ADC_INTSTAT_FIFOOVR2_M                0x00000008
+#define AM_REG_ADC_INTSTAT_FIFOOVR2(n)               (((uint32_t)(n) << 3) & 0x00000008)
+#define AM_REG_ADC_INTSTAT_FIFOOVR2_FIFOFULLINT      0x00000008
+
+// FIFO 75 percent full interrupt.
+#define AM_REG_ADC_INTSTAT_FIFOOVR1_S                2
+#define AM_REG_ADC_INTSTAT_FIFOOVR1_M                0x00000004
+#define AM_REG_ADC_INTSTAT_FIFOOVR1(n)               (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_ADC_INTSTAT_FIFOOVR1_FIFO75INT        0x00000004
+
+// ADC scan complete interrupt.
+#define AM_REG_ADC_INTSTAT_SCNCMP_S                  1
+#define AM_REG_ADC_INTSTAT_SCNCMP_M                  0x00000002
+#define AM_REG_ADC_INTSTAT_SCNCMP(n)                 (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_ADC_INTSTAT_SCNCMP_SCNCMPINT          0x00000002
+
+// ADC conversion complete interrupt.
+#define AM_REG_ADC_INTSTAT_CNVCMP_S                  0
+#define AM_REG_ADC_INTSTAT_CNVCMP_M                  0x00000001
+#define AM_REG_ADC_INTSTAT_CNVCMP(n)                 (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_ADC_INTSTAT_CNVCMP_CNVCMPINT          0x00000001
+
+//*****************************************************************************
+//
+// ADC_INTCLR - ADC Interrupt registers: Clear
+//
+//*****************************************************************************
+// Window comparator voltage incursion interrupt.
+#define AM_REG_ADC_INTCLR_WCINC_S                    5
+#define AM_REG_ADC_INTCLR_WCINC_M                    0x00000020
+#define AM_REG_ADC_INTCLR_WCINC(n)                   (((uint32_t)(n) << 5) & 0x00000020)
+#define AM_REG_ADC_INTCLR_WCINC_WCINCINT             0x00000020
+
+// Window comparator voltage excursion interrupt.
+#define AM_REG_ADC_INTCLR_WCEXC_S                    4
+#define AM_REG_ADC_INTCLR_WCEXC_M                    0x00000010
+#define AM_REG_ADC_INTCLR_WCEXC(n)                   (((uint32_t)(n) << 4) & 0x00000010)
+#define AM_REG_ADC_INTCLR_WCEXC_WCEXCINT             0x00000010
+
+// FIFO 100 percent full interrupt.
+#define AM_REG_ADC_INTCLR_FIFOOVR2_S                 3
+#define AM_REG_ADC_INTCLR_FIFOOVR2_M                 0x00000008
+#define AM_REG_ADC_INTCLR_FIFOOVR2(n)                (((uint32_t)(n) << 3) & 0x00000008)
+#define AM_REG_ADC_INTCLR_FIFOOVR2_FIFOFULLINT       0x00000008
+
+// FIFO 75 percent full interrupt.
+#define AM_REG_ADC_INTCLR_FIFOOVR1_S                 2
+#define AM_REG_ADC_INTCLR_FIFOOVR1_M                 0x00000004
+#define AM_REG_ADC_INTCLR_FIFOOVR1(n)                (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_ADC_INTCLR_FIFOOVR1_FIFO75INT         0x00000004
+
+// ADC scan complete interrupt.
+#define AM_REG_ADC_INTCLR_SCNCMP_S                   1
+#define AM_REG_ADC_INTCLR_SCNCMP_M                   0x00000002
+#define AM_REG_ADC_INTCLR_SCNCMP(n)                  (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_ADC_INTCLR_SCNCMP_SCNCMPINT           0x00000002
+
+// ADC conversion complete interrupt.
+#define AM_REG_ADC_INTCLR_CNVCMP_S                   0
+#define AM_REG_ADC_INTCLR_CNVCMP_M                   0x00000001
+#define AM_REG_ADC_INTCLR_CNVCMP(n)                  (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_ADC_INTCLR_CNVCMP_CNVCMPINT           0x00000001
+
+//*****************************************************************************
+//
+// ADC_INTSET - ADC Interrupt registers: Set
+//
+//*****************************************************************************
+// Window comparator voltage incursion interrupt.
+#define AM_REG_ADC_INTSET_WCINC_S                    5
+#define AM_REG_ADC_INTSET_WCINC_M                    0x00000020
+#define AM_REG_ADC_INTSET_WCINC(n)                   (((uint32_t)(n) << 5) & 0x00000020)
+#define AM_REG_ADC_INTSET_WCINC_WCINCINT             0x00000020
+
+// Window comparator voltage excursion interrupt.
+#define AM_REG_ADC_INTSET_WCEXC_S                    4
+#define AM_REG_ADC_INTSET_WCEXC_M                    0x00000010
+#define AM_REG_ADC_INTSET_WCEXC(n)                   (((uint32_t)(n) << 4) & 0x00000010)
+#define AM_REG_ADC_INTSET_WCEXC_WCEXCINT             0x00000010
+
+// FIFO 100 percent full interrupt.
+#define AM_REG_ADC_INTSET_FIFOOVR2_S                 3
+#define AM_REG_ADC_INTSET_FIFOOVR2_M                 0x00000008
+#define AM_REG_ADC_INTSET_FIFOOVR2(n)                (((uint32_t)(n) << 3) & 0x00000008)
+#define AM_REG_ADC_INTSET_FIFOOVR2_FIFOFULLINT       0x00000008
+
+// FIFO 75 percent full interrupt.
+#define AM_REG_ADC_INTSET_FIFOOVR1_S                 2
+#define AM_REG_ADC_INTSET_FIFOOVR1_M                 0x00000004
+#define AM_REG_ADC_INTSET_FIFOOVR1(n)                (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_ADC_INTSET_FIFOOVR1_FIFO75INT         0x00000004
+
+// ADC scan complete interrupt.
+#define AM_REG_ADC_INTSET_SCNCMP_S                   1
+#define AM_REG_ADC_INTSET_SCNCMP_M                   0x00000002
+#define AM_REG_ADC_INTSET_SCNCMP(n)                  (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_ADC_INTSET_SCNCMP_SCNCMPINT           0x00000002
+
+// ADC conversion complete interrupt.
+#define AM_REG_ADC_INTSET_CNVCMP_S                   0
+#define AM_REG_ADC_INTSET_CNVCMP_M                   0x00000001
+#define AM_REG_ADC_INTSET_CNVCMP(n)                  (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_ADC_INTSET_CNVCMP_CNVCMPINT           0x00000001
+
+//*****************************************************************************
+//
+// ADC_CFG - Configuration Register
+//
+//*****************************************************************************
+// Select the source and frequency for the ADC clock.  All values not enumerated
+// below are undefined.
+#define AM_REG_ADC_CFG_CLKSEL_S                      24
+#define AM_REG_ADC_CFG_CLKSEL_M                      0x03000000
+#define AM_REG_ADC_CFG_CLKSEL(n)                     (((uint32_t)(n) << 24) & 0x03000000)
+#define AM_REG_ADC_CFG_CLKSEL_OFF                    0x00000000
+#define AM_REG_ADC_CFG_CLKSEL_HFRC                   0x01000000
+#define AM_REG_ADC_CFG_CLKSEL_HFRC_DIV2              0x02000000
+
+// This bit selects the ADC trigger polarity for external off chip triggers.
+#define AM_REG_ADC_CFG_TRIGPOL_S                     19
+#define AM_REG_ADC_CFG_TRIGPOL_M                     0x00080000
+#define AM_REG_ADC_CFG_TRIGPOL(n)                    (((uint32_t)(n) << 19) & 0x00080000)
+#define AM_REG_ADC_CFG_TRIGPOL_RISING_EDGE           0x00000000
+#define AM_REG_ADC_CFG_TRIGPOL_FALLING_EDGE          0x00080000
+
+// Select the ADC trigger source.
+#define AM_REG_ADC_CFG_TRIGSEL_S                     16
+#define AM_REG_ADC_CFG_TRIGSEL_M                     0x00070000
+#define AM_REG_ADC_CFG_TRIGSEL(n)                    (((uint32_t)(n) << 16) & 0x00070000)
+#define AM_REG_ADC_CFG_TRIGSEL_EXT0                  0x00000000
+#define AM_REG_ADC_CFG_TRIGSEL_EXT1                  0x00010000
+#define AM_REG_ADC_CFG_TRIGSEL_EXT2                  0x00020000
+#define AM_REG_ADC_CFG_TRIGSEL_EXT3                  0x00030000
+#define AM_REG_ADC_CFG_TRIGSEL_VCOMP                 0x00040000
+#define AM_REG_ADC_CFG_TRIGSEL_SWT                   0x00070000
+
+// Select the ADC reference voltage.
+#define AM_REG_ADC_CFG_REFSEL_S                      8
+#define AM_REG_ADC_CFG_REFSEL_M                      0x00000300
+#define AM_REG_ADC_CFG_REFSEL(n)                     (((uint32_t)(n) << 8) & 0x00000300)
+#define AM_REG_ADC_CFG_REFSEL_INT2P0                 0x00000000
+#define AM_REG_ADC_CFG_REFSEL_INT1P5                 0x00000100
+#define AM_REG_ADC_CFG_REFSEL_EXT2P0                 0x00000200
+#define AM_REG_ADC_CFG_REFSEL_EXT1P5                 0x00000300
+
+// Clock mode register
+#define AM_REG_ADC_CFG_CKMODE_S                      4
+#define AM_REG_ADC_CFG_CKMODE_M                      0x00000010
+#define AM_REG_ADC_CFG_CKMODE(n)                     (((uint32_t)(n) << 4) & 0x00000010)
+#define AM_REG_ADC_CFG_CKMODE_LPCKMODE               0x00000000
+#define AM_REG_ADC_CFG_CKMODE_LLCKMODE               0x00000010
+
+// Select power mode to enter between active scans.
+#define AM_REG_ADC_CFG_LPMODE_S                      3
+#define AM_REG_ADC_CFG_LPMODE_M                      0x00000008
+#define AM_REG_ADC_CFG_LPMODE(n)                     (((uint32_t)(n) << 3) & 0x00000008)
+#define AM_REG_ADC_CFG_LPMODE_MODE0                  0x00000000
+#define AM_REG_ADC_CFG_LPMODE_MODE1                  0x00000008
+
+// This bit enables Repeating Scan Mode.
+#define AM_REG_ADC_CFG_RPTEN_S                       2
+#define AM_REG_ADC_CFG_RPTEN_M                       0x00000004
+#define AM_REG_ADC_CFG_RPTEN(n)                      (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_ADC_CFG_RPTEN_SINGLE_SCAN             0x00000000
+#define AM_REG_ADC_CFG_RPTEN_REPEATING_SCAN          0x00000004
+
+// This bit enables the ADC module. While the ADC is enabled, the ADCCFG and
+// SLOT Configuration regsiter settings must remain stable and unchanged. All
+// configuration register settings, slot configuration settings and window
+// comparison settings should be written prior to setting the ADCEN bit to '1'.
+#define AM_REG_ADC_CFG_ADCEN_S                       0
+#define AM_REG_ADC_CFG_ADCEN_M                       0x00000001
+#define AM_REG_ADC_CFG_ADCEN(n)                      (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_ADC_CFG_ADCEN_DIS                     0x00000000
+#define AM_REG_ADC_CFG_ADCEN_EN                      0x00000001
+
+//*****************************************************************************
+//
+// ADC_STAT - ADC Power Status
+//
+//*****************************************************************************
+// Indicates the power-status of the ADC.
+#define AM_REG_ADC_STAT_PWDSTAT_S                    0
+#define AM_REG_ADC_STAT_PWDSTAT_M                    0x00000001
+#define AM_REG_ADC_STAT_PWDSTAT(n)                   (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_ADC_STAT_PWDSTAT_ON                   0x00000000
+#define AM_REG_ADC_STAT_PWDSTAT_POWERED_DOWN         0x00000001
+
+//*****************************************************************************
+//
+// ADC_SWT - Software trigger
+//
+//*****************************************************************************
+// Writing 0x37 to this register generates a software trigger.
+#define AM_REG_ADC_SWT_SWT_S                         0
+#define AM_REG_ADC_SWT_SWT_M                         0x000000FF
+#define AM_REG_ADC_SWT_SWT(n)                        (((uint32_t)(n) << 0) & 0x000000FF)
+#define AM_REG_ADC_SWT_SWT_GEN_SW_TRIGGER            0x00000037
+
+//*****************************************************************************
+//
+// ADC_SL0CFG - Slot 0 Configuration Register
+//
+//*****************************************************************************
+// Select the number of measurements to average in the accumulate divide module
+// for this slot.
+#define AM_REG_ADC_SL0CFG_ADSEL0_S                   24
+#define AM_REG_ADC_SL0CFG_ADSEL0_M                   0x07000000
+#define AM_REG_ADC_SL0CFG_ADSEL0(n)                  (((uint32_t)(n) << 24) & 0x07000000)
+#define AM_REG_ADC_SL0CFG_ADSEL0_AVG_1_MSRMT         0x00000000
+#define AM_REG_ADC_SL0CFG_ADSEL0_AVG_2_MSRMTS        0x01000000
+#define AM_REG_ADC_SL0CFG_ADSEL0_AVG_4_MSRMTS        0x02000000
+#define AM_REG_ADC_SL0CFG_ADSEL0_AVG_8_MSRMT         0x03000000
+#define AM_REG_ADC_SL0CFG_ADSEL0_AVG_16_MSRMTS       0x04000000
+#define AM_REG_ADC_SL0CFG_ADSEL0_AVG_32_MSRMTS       0x05000000
+#define AM_REG_ADC_SL0CFG_ADSEL0_AVG_64_MSRMTS       0x06000000
+#define AM_REG_ADC_SL0CFG_ADSEL0_AVG_128_MSRMTS      0x07000000
+
+// Set the Precision Mode For Slot.
+#define AM_REG_ADC_SL0CFG_PRMODE0_S                  16
+#define AM_REG_ADC_SL0CFG_PRMODE0_M                  0x00030000
+#define AM_REG_ADC_SL0CFG_PRMODE0(n)                 (((uint32_t)(n) << 16) & 0x00030000)
+#define AM_REG_ADC_SL0CFG_PRMODE0_P14B               0x00000000
+#define AM_REG_ADC_SL0CFG_PRMODE0_P12B               0x00010000
+#define AM_REG_ADC_SL0CFG_PRMODE0_P10B               0x00020000
+#define AM_REG_ADC_SL0CFG_PRMODE0_P8B                0x00030000
+
+// Select one of the 14 channel inputs for this slot.
+#define AM_REG_ADC_SL0CFG_CHSEL0_S                   8
+#define AM_REG_ADC_SL0CFG_CHSEL0_M                   0x00000F00
+#define AM_REG_ADC_SL0CFG_CHSEL0(n)                  (((uint32_t)(n) << 8) & 0x00000F00)
+#define AM_REG_ADC_SL0CFG_CHSEL0_SE0                 0x00000000
+#define AM_REG_ADC_SL0CFG_CHSEL0_SE1                 0x00000100
+#define AM_REG_ADC_SL0CFG_CHSEL0_SE2                 0x00000200
+#define AM_REG_ADC_SL0CFG_CHSEL0_SE3                 0x00000300
+#define AM_REG_ADC_SL0CFG_CHSEL0_SE4                 0x00000400
+#define AM_REG_ADC_SL0CFG_CHSEL0_SE5                 0x00000500
+#define AM_REG_ADC_SL0CFG_CHSEL0_SE6                 0x00000600
+#define AM_REG_ADC_SL0CFG_CHSEL0_SE7                 0x00000700
+#define AM_REG_ADC_SL0CFG_CHSEL0_SE8                 0x00000800
+#define AM_REG_ADC_SL0CFG_CHSEL0_SE9                 0x00000900
+#define AM_REG_ADC_SL0CFG_CHSEL0_DF0                 0x00000A00
+#define AM_REG_ADC_SL0CFG_CHSEL0_DF1                 0x00000B00
+#define AM_REG_ADC_SL0CFG_CHSEL0_TEMP                0x00000C00
+#define AM_REG_ADC_SL0CFG_CHSEL0_BATT                0x00000D00
+#define AM_REG_ADC_SL0CFG_CHSEL0_VSS                 0x00000E00
+
+// This bit enables the window compare function for slot 0.
+#define AM_REG_ADC_SL0CFG_WCEN0_S                    1
+#define AM_REG_ADC_SL0CFG_WCEN0_M                    0x00000002
+#define AM_REG_ADC_SL0CFG_WCEN0(n)                   (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_ADC_SL0CFG_WCEN0_WCEN                 0x00000002
+
+// This bit enables slot 0 for ADC conversions.
+#define AM_REG_ADC_SL0CFG_SLEN0_S                    0
+#define AM_REG_ADC_SL0CFG_SLEN0_M                    0x00000001
+#define AM_REG_ADC_SL0CFG_SLEN0(n)                   (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_ADC_SL0CFG_SLEN0_SLEN                 0x00000001
+
+//*****************************************************************************
+//
+// ADC_SL1CFG - Slot 1 Configuration Register
+//
+//*****************************************************************************
+// Select the number of measurements to average in the accumulate divide module
+// for this slot.
+#define AM_REG_ADC_SL1CFG_ADSEL1_S                   24
+#define AM_REG_ADC_SL1CFG_ADSEL1_M                   0x07000000
+#define AM_REG_ADC_SL1CFG_ADSEL1(n)                  (((uint32_t)(n) << 24) & 0x07000000)
+#define AM_REG_ADC_SL1CFG_ADSEL1_AVG_1_MSRMT         0x00000000
+#define AM_REG_ADC_SL1CFG_ADSEL1_AVG_2_MSRMTS        0x01000000
+#define AM_REG_ADC_SL1CFG_ADSEL1_AVG_4_MSRMTS        0x02000000
+#define AM_REG_ADC_SL1CFG_ADSEL1_AVG_8_MSRMT         0x03000000
+#define AM_REG_ADC_SL1CFG_ADSEL1_AVG_16_MSRMTS       0x04000000
+#define AM_REG_ADC_SL1CFG_ADSEL1_AVG_32_MSRMTS       0x05000000
+#define AM_REG_ADC_SL1CFG_ADSEL1_AVG_64_MSRMTS       0x06000000
+#define AM_REG_ADC_SL1CFG_ADSEL1_AVG_128_MSRMTS      0x07000000
+
+// Set the Precision Mode For Slot.
+#define AM_REG_ADC_SL1CFG_PRMODE1_S                  16
+#define AM_REG_ADC_SL1CFG_PRMODE1_M                  0x00030000
+#define AM_REG_ADC_SL1CFG_PRMODE1(n)                 (((uint32_t)(n) << 16) & 0x00030000)
+#define AM_REG_ADC_SL1CFG_PRMODE1_P14B               0x00000000
+#define AM_REG_ADC_SL1CFG_PRMODE1_P12B               0x00010000
+#define AM_REG_ADC_SL1CFG_PRMODE1_P10B               0x00020000
+#define AM_REG_ADC_SL1CFG_PRMODE1_P8B                0x00030000
+
+// Select one of the 14 channel inputs for this slot.
+#define AM_REG_ADC_SL1CFG_CHSEL1_S                   8
+#define AM_REG_ADC_SL1CFG_CHSEL1_M                   0x00000F00
+#define AM_REG_ADC_SL1CFG_CHSEL1(n)                  (((uint32_t)(n) << 8) & 0x00000F00)
+#define AM_REG_ADC_SL1CFG_CHSEL1_SE0                 0x00000000
+#define AM_REG_ADC_SL1CFG_CHSEL1_SE1                 0x00000100
+#define AM_REG_ADC_SL1CFG_CHSEL1_SE2                 0x00000200
+#define AM_REG_ADC_SL1CFG_CHSEL1_SE3                 0x00000300
+#define AM_REG_ADC_SL1CFG_CHSEL1_SE4                 0x00000400
+#define AM_REG_ADC_SL1CFG_CHSEL1_SE5                 0x00000500
+#define AM_REG_ADC_SL1CFG_CHSEL1_SE6                 0x00000600
+#define AM_REG_ADC_SL1CFG_CHSEL1_SE7                 0x00000700
+#define AM_REG_ADC_SL1CFG_CHSEL1_SE8                 0x00000800
+#define AM_REG_ADC_SL1CFG_CHSEL1_SE9                 0x00000900
+#define AM_REG_ADC_SL1CFG_CHSEL1_DF0                 0x00000A00
+#define AM_REG_ADC_SL1CFG_CHSEL1_DF1                 0x00000B00
+#define AM_REG_ADC_SL1CFG_CHSEL1_TEMP                0x00000C00
+#define AM_REG_ADC_SL1CFG_CHSEL1_BATT                0x00000D00
+#define AM_REG_ADC_SL1CFG_CHSEL1_VSS                 0x00000E00
+
+// This bit enables the window compare function for slot 1.
+#define AM_REG_ADC_SL1CFG_WCEN1_S                    1
+#define AM_REG_ADC_SL1CFG_WCEN1_M                    0x00000002
+#define AM_REG_ADC_SL1CFG_WCEN1(n)                   (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_ADC_SL1CFG_WCEN1_WCEN                 0x00000002
+
+// This bit enables slot 1 for ADC conversions.
+#define AM_REG_ADC_SL1CFG_SLEN1_S                    0
+#define AM_REG_ADC_SL1CFG_SLEN1_M                    0x00000001
+#define AM_REG_ADC_SL1CFG_SLEN1(n)                   (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_ADC_SL1CFG_SLEN1_SLEN                 0x00000001
+
+//*****************************************************************************
+//
+// ADC_SL2CFG - Slot 2 Configuration Register
+//
+//*****************************************************************************
+// Select the number of measurements to average in the accumulate divide module
+// for this slot.
+#define AM_REG_ADC_SL2CFG_ADSEL2_S                   24
+#define AM_REG_ADC_SL2CFG_ADSEL2_M                   0x07000000
+#define AM_REG_ADC_SL2CFG_ADSEL2(n)                  (((uint32_t)(n) << 24) & 0x07000000)
+#define AM_REG_ADC_SL2CFG_ADSEL2_AVG_1_MSRMT         0x00000000
+#define AM_REG_ADC_SL2CFG_ADSEL2_AVG_2_MSRMTS        0x01000000
+#define AM_REG_ADC_SL2CFG_ADSEL2_AVG_4_MSRMTS        0x02000000
+#define AM_REG_ADC_SL2CFG_ADSEL2_AVG_8_MSRMT         0x03000000
+#define AM_REG_ADC_SL2CFG_ADSEL2_AVG_16_MSRMTS       0x04000000
+#define AM_REG_ADC_SL2CFG_ADSEL2_AVG_32_MSRMTS       0x05000000
+#define AM_REG_ADC_SL2CFG_ADSEL2_AVG_64_MSRMTS       0x06000000
+#define AM_REG_ADC_SL2CFG_ADSEL2_AVG_128_MSRMTS      0x07000000
+
+// Set the Precision Mode For Slot.
+#define AM_REG_ADC_SL2CFG_PRMODE2_S                  16
+#define AM_REG_ADC_SL2CFG_PRMODE2_M                  0x00030000
+#define AM_REG_ADC_SL2CFG_PRMODE2(n)                 (((uint32_t)(n) << 16) & 0x00030000)
+#define AM_REG_ADC_SL2CFG_PRMODE2_P14B               0x00000000
+#define AM_REG_ADC_SL2CFG_PRMODE2_P12B               0x00010000
+#define AM_REG_ADC_SL2CFG_PRMODE2_P10B               0x00020000
+#define AM_REG_ADC_SL2CFG_PRMODE2_P8B                0x00030000
+
+// Select one of the 14 channel inputs for this slot.
+#define AM_REG_ADC_SL2CFG_CHSEL2_S                   8
+#define AM_REG_ADC_SL2CFG_CHSEL2_M                   0x00000F00
+#define AM_REG_ADC_SL2CFG_CHSEL2(n)                  (((uint32_t)(n) << 8) & 0x00000F00)
+#define AM_REG_ADC_SL2CFG_CHSEL2_SE0                 0x00000000
+#define AM_REG_ADC_SL2CFG_CHSEL2_SE1                 0x00000100
+#define AM_REG_ADC_SL2CFG_CHSEL2_SE2                 0x00000200
+#define AM_REG_ADC_SL2CFG_CHSEL2_SE3                 0x00000300
+#define AM_REG_ADC_SL2CFG_CHSEL2_SE4                 0x00000400
+#define AM_REG_ADC_SL2CFG_CHSEL2_SE5                 0x00000500
+#define AM_REG_ADC_SL2CFG_CHSEL2_SE6                 0x00000600
+#define AM_REG_ADC_SL2CFG_CHSEL2_SE7                 0x00000700
+#define AM_REG_ADC_SL2CFG_CHSEL2_SE8                 0x00000800
+#define AM_REG_ADC_SL2CFG_CHSEL2_SE9                 0x00000900
+#define AM_REG_ADC_SL2CFG_CHSEL2_DF0                 0x00000A00
+#define AM_REG_ADC_SL2CFG_CHSEL2_DF1                 0x00000B00
+#define AM_REG_ADC_SL2CFG_CHSEL2_TEMP                0x00000C00
+#define AM_REG_ADC_SL2CFG_CHSEL2_BATT                0x00000D00
+#define AM_REG_ADC_SL2CFG_CHSEL2_VSS                 0x00000E00
+
+// This bit enables the window compare function for slot 2.
+#define AM_REG_ADC_SL2CFG_WCEN2_S                    1
+#define AM_REG_ADC_SL2CFG_WCEN2_M                    0x00000002
+#define AM_REG_ADC_SL2CFG_WCEN2(n)                   (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_ADC_SL2CFG_WCEN2_WCEN                 0x00000002
+
+// This bit enables slot 2 for ADC conversions.
+#define AM_REG_ADC_SL2CFG_SLEN2_S                    0
+#define AM_REG_ADC_SL2CFG_SLEN2_M                    0x00000001
+#define AM_REG_ADC_SL2CFG_SLEN2(n)                   (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_ADC_SL2CFG_SLEN2_SLEN                 0x00000001
+
+//*****************************************************************************
+//
+// ADC_SL3CFG - Slot 3 Configuration Register
+//
+//*****************************************************************************
+// Select the number of measurements to average in the accumulate divide module
+// for this slot.
+#define AM_REG_ADC_SL3CFG_ADSEL3_S                   24
+#define AM_REG_ADC_SL3CFG_ADSEL3_M                   0x07000000
+#define AM_REG_ADC_SL3CFG_ADSEL3(n)                  (((uint32_t)(n) << 24) & 0x07000000)
+#define AM_REG_ADC_SL3CFG_ADSEL3_AVG_1_MSRMT         0x00000000
+#define AM_REG_ADC_SL3CFG_ADSEL3_AVG_2_MSRMTS        0x01000000
+#define AM_REG_ADC_SL3CFG_ADSEL3_AVG_4_MSRMTS        0x02000000
+#define AM_REG_ADC_SL3CFG_ADSEL3_AVG_8_MSRMT         0x03000000
+#define AM_REG_ADC_SL3CFG_ADSEL3_AVG_16_MSRMTS       0x04000000
+#define AM_REG_ADC_SL3CFG_ADSEL3_AVG_32_MSRMTS       0x05000000
+#define AM_REG_ADC_SL3CFG_ADSEL3_AVG_64_MSRMTS       0x06000000
+#define AM_REG_ADC_SL3CFG_ADSEL3_AVG_128_MSRMTS      0x07000000
+
+// Set the Precision Mode For Slot.
+#define AM_REG_ADC_SL3CFG_PRMODE3_S                  16
+#define AM_REG_ADC_SL3CFG_PRMODE3_M                  0x00030000
+#define AM_REG_ADC_SL3CFG_PRMODE3(n)                 (((uint32_t)(n) << 16) & 0x00030000)
+#define AM_REG_ADC_SL3CFG_PRMODE3_P14B               0x00000000
+#define AM_REG_ADC_SL3CFG_PRMODE3_P12B               0x00010000
+#define AM_REG_ADC_SL3CFG_PRMODE3_P10B               0x00020000
+#define AM_REG_ADC_SL3CFG_PRMODE3_P8B                0x00030000
+
+// Select one of the 14 channel inputs for this slot.
+#define AM_REG_ADC_SL3CFG_CHSEL3_S                   8
+#define AM_REG_ADC_SL3CFG_CHSEL3_M                   0x00000F00
+#define AM_REG_ADC_SL3CFG_CHSEL3(n)                  (((uint32_t)(n) << 8) & 0x00000F00)
+#define AM_REG_ADC_SL3CFG_CHSEL3_SE0                 0x00000000
+#define AM_REG_ADC_SL3CFG_CHSEL3_SE1                 0x00000100
+#define AM_REG_ADC_SL3CFG_CHSEL3_SE2                 0x00000200
+#define AM_REG_ADC_SL3CFG_CHSEL3_SE3                 0x00000300
+#define AM_REG_ADC_SL3CFG_CHSEL3_SE4                 0x00000400
+#define AM_REG_ADC_SL3CFG_CHSEL3_SE5                 0x00000500
+#define AM_REG_ADC_SL3CFG_CHSEL3_SE6                 0x00000600
+#define AM_REG_ADC_SL3CFG_CHSEL3_SE7                 0x00000700
+#define AM_REG_ADC_SL3CFG_CHSEL3_SE8                 0x00000800
+#define AM_REG_ADC_SL3CFG_CHSEL3_SE9                 0x00000900
+#define AM_REG_ADC_SL3CFG_CHSEL3_DF0                 0x00000A00
+#define AM_REG_ADC_SL3CFG_CHSEL3_DF1                 0x00000B00
+#define AM_REG_ADC_SL3CFG_CHSEL3_TEMP                0x00000C00
+#define AM_REG_ADC_SL3CFG_CHSEL3_BATT                0x00000D00
+#define AM_REG_ADC_SL3CFG_CHSEL3_VSS                 0x00000E00
+
+// This bit enables the window compare function for slot 3.
+#define AM_REG_ADC_SL3CFG_WCEN3_S                    1
+#define AM_REG_ADC_SL3CFG_WCEN3_M                    0x00000002
+#define AM_REG_ADC_SL3CFG_WCEN3(n)                   (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_ADC_SL3CFG_WCEN3_WCEN                 0x00000002
+
+// This bit enables slot 3 for ADC conversions.
+#define AM_REG_ADC_SL3CFG_SLEN3_S                    0
+#define AM_REG_ADC_SL3CFG_SLEN3_M                    0x00000001
+#define AM_REG_ADC_SL3CFG_SLEN3(n)                   (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_ADC_SL3CFG_SLEN3_SLEN                 0x00000001
+
+//*****************************************************************************
+//
+// ADC_SL4CFG - Slot 4 Configuration Register
+//
+//*****************************************************************************
+// Select the number of measurements to average in the accumulate divide module
+// for this slot.
+#define AM_REG_ADC_SL4CFG_ADSEL4_S                   24
+#define AM_REG_ADC_SL4CFG_ADSEL4_M                   0x07000000
+#define AM_REG_ADC_SL4CFG_ADSEL4(n)                  (((uint32_t)(n) << 24) & 0x07000000)
+#define AM_REG_ADC_SL4CFG_ADSEL4_AVG_1_MSRMT         0x00000000
+#define AM_REG_ADC_SL4CFG_ADSEL4_AVG_2_MSRMTS        0x01000000
+#define AM_REG_ADC_SL4CFG_ADSEL4_AVG_4_MSRMTS        0x02000000
+#define AM_REG_ADC_SL4CFG_ADSEL4_AVG_8_MSRMT         0x03000000
+#define AM_REG_ADC_SL4CFG_ADSEL4_AVG_16_MSRMTS       0x04000000
+#define AM_REG_ADC_SL4CFG_ADSEL4_AVG_32_MSRMTS       0x05000000
+#define AM_REG_ADC_SL4CFG_ADSEL4_AVG_64_MSRMTS       0x06000000
+#define AM_REG_ADC_SL4CFG_ADSEL4_AVG_128_MSRMTS      0x07000000
+
+// Set the Precision Mode For Slot.
+#define AM_REG_ADC_SL4CFG_PRMODE4_S                  16
+#define AM_REG_ADC_SL4CFG_PRMODE4_M                  0x00030000
+#define AM_REG_ADC_SL4CFG_PRMODE4(n)                 (((uint32_t)(n) << 16) & 0x00030000)
+#define AM_REG_ADC_SL4CFG_PRMODE4_P14B               0x00000000
+#define AM_REG_ADC_SL4CFG_PRMODE4_P12B               0x00010000
+#define AM_REG_ADC_SL4CFG_PRMODE4_P10B               0x00020000
+#define AM_REG_ADC_SL4CFG_PRMODE4_P8B                0x00030000
+
+// Select one of the 14 channel inputs for this slot.
+#define AM_REG_ADC_SL4CFG_CHSEL4_S                   8
+#define AM_REG_ADC_SL4CFG_CHSEL4_M                   0x00000F00
+#define AM_REG_ADC_SL4CFG_CHSEL4(n)                  (((uint32_t)(n) << 8) & 0x00000F00)
+#define AM_REG_ADC_SL4CFG_CHSEL4_SE0                 0x00000000
+#define AM_REG_ADC_SL4CFG_CHSEL4_SE1                 0x00000100
+#define AM_REG_ADC_SL4CFG_CHSEL4_SE2                 0x00000200
+#define AM_REG_ADC_SL4CFG_CHSEL4_SE3                 0x00000300
+#define AM_REG_ADC_SL4CFG_CHSEL4_SE4                 0x00000400
+#define AM_REG_ADC_SL4CFG_CHSEL4_SE5                 0x00000500
+#define AM_REG_ADC_SL4CFG_CHSEL4_SE6                 0x00000600
+#define AM_REG_ADC_SL4CFG_CHSEL4_SE7                 0x00000700
+#define AM_REG_ADC_SL4CFG_CHSEL4_SE8                 0x00000800
+#define AM_REG_ADC_SL4CFG_CHSEL4_SE9                 0x00000900
+#define AM_REG_ADC_SL4CFG_CHSEL4_DF0                 0x00000A00
+#define AM_REG_ADC_SL4CFG_CHSEL4_DF1                 0x00000B00
+#define AM_REG_ADC_SL4CFG_CHSEL4_TEMP                0x00000C00
+#define AM_REG_ADC_SL4CFG_CHSEL4_BATT                0x00000D00
+#define AM_REG_ADC_SL4CFG_CHSEL4_VSS                 0x00000E00
+
+// This bit enables the window compare function for slot 4.
+#define AM_REG_ADC_SL4CFG_WCEN4_S                    1
+#define AM_REG_ADC_SL4CFG_WCEN4_M                    0x00000002
+#define AM_REG_ADC_SL4CFG_WCEN4(n)                   (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_ADC_SL4CFG_WCEN4_WCEN                 0x00000002
+
+// This bit enables slot 4 for ADC conversions.
+#define AM_REG_ADC_SL4CFG_SLEN4_S                    0
+#define AM_REG_ADC_SL4CFG_SLEN4_M                    0x00000001
+#define AM_REG_ADC_SL4CFG_SLEN4(n)                   (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_ADC_SL4CFG_SLEN4_SLEN                 0x00000001
+
+//*****************************************************************************
+//
+// ADC_SL5CFG - Slot 5 Configuration Register
+//
+//*****************************************************************************
+// Select number of measurements to average in the accumulate divide module for
+// this slot.
+#define AM_REG_ADC_SL5CFG_ADSEL5_S                   24
+#define AM_REG_ADC_SL5CFG_ADSEL5_M                   0x07000000
+#define AM_REG_ADC_SL5CFG_ADSEL5(n)                  (((uint32_t)(n) << 24) & 0x07000000)
+#define AM_REG_ADC_SL5CFG_ADSEL5_AVG_1_MSRMT         0x00000000
+#define AM_REG_ADC_SL5CFG_ADSEL5_AVG_2_MSRMTS        0x01000000
+#define AM_REG_ADC_SL5CFG_ADSEL5_AVG_4_MSRMTS        0x02000000
+#define AM_REG_ADC_SL5CFG_ADSEL5_AVG_8_MSRMT         0x03000000
+#define AM_REG_ADC_SL5CFG_ADSEL5_AVG_16_MSRMTS       0x04000000
+#define AM_REG_ADC_SL5CFG_ADSEL5_AVG_32_MSRMTS       0x05000000
+#define AM_REG_ADC_SL5CFG_ADSEL5_AVG_64_MSRMTS       0x06000000
+#define AM_REG_ADC_SL5CFG_ADSEL5_AVG_128_MSRMTS      0x07000000
+
+// Set the Precision Mode For Slot.
+#define AM_REG_ADC_SL5CFG_PRMODE5_S                  16
+#define AM_REG_ADC_SL5CFG_PRMODE5_M                  0x00030000
+#define AM_REG_ADC_SL5CFG_PRMODE5(n)                 (((uint32_t)(n) << 16) & 0x00030000)
+#define AM_REG_ADC_SL5CFG_PRMODE5_P14B               0x00000000
+#define AM_REG_ADC_SL5CFG_PRMODE5_P12B               0x00010000
+#define AM_REG_ADC_SL5CFG_PRMODE5_P10B               0x00020000
+#define AM_REG_ADC_SL5CFG_PRMODE5_P8B                0x00030000
+
+// Select one of the 14 channel inputs for this slot.
+#define AM_REG_ADC_SL5CFG_CHSEL5_S                   8
+#define AM_REG_ADC_SL5CFG_CHSEL5_M                   0x00000F00
+#define AM_REG_ADC_SL5CFG_CHSEL5(n)                  (((uint32_t)(n) << 8) & 0x00000F00)
+#define AM_REG_ADC_SL5CFG_CHSEL5_SE0                 0x00000000
+#define AM_REG_ADC_SL5CFG_CHSEL5_SE1                 0x00000100
+#define AM_REG_ADC_SL5CFG_CHSEL5_SE2                 0x00000200
+#define AM_REG_ADC_SL5CFG_CHSEL5_SE3                 0x00000300
+#define AM_REG_ADC_SL5CFG_CHSEL5_SE4                 0x00000400
+#define AM_REG_ADC_SL5CFG_CHSEL5_SE5                 0x00000500
+#define AM_REG_ADC_SL5CFG_CHSEL5_SE6                 0x00000600
+#define AM_REG_ADC_SL5CFG_CHSEL5_SE7                 0x00000700
+#define AM_REG_ADC_SL5CFG_CHSEL5_SE8                 0x00000800
+#define AM_REG_ADC_SL5CFG_CHSEL5_SE9                 0x00000900
+#define AM_REG_ADC_SL5CFG_CHSEL5_DF0                 0x00000A00
+#define AM_REG_ADC_SL5CFG_CHSEL5_DF1                 0x00000B00
+#define AM_REG_ADC_SL5CFG_CHSEL5_TEMP                0x00000C00
+#define AM_REG_ADC_SL5CFG_CHSEL5_BATT                0x00000D00
+#define AM_REG_ADC_SL5CFG_CHSEL5_VSS                 0x00000E00
+
+// This bit enables the window compare function for slot 5.
+#define AM_REG_ADC_SL5CFG_WCEN5_S                    1
+#define AM_REG_ADC_SL5CFG_WCEN5_M                    0x00000002
+#define AM_REG_ADC_SL5CFG_WCEN5(n)                   (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_ADC_SL5CFG_WCEN5_WCEN                 0x00000002
+
+// This bit enables slot 5 for ADC conversions.
+#define AM_REG_ADC_SL5CFG_SLEN5_S                    0
+#define AM_REG_ADC_SL5CFG_SLEN5_M                    0x00000001
+#define AM_REG_ADC_SL5CFG_SLEN5(n)                   (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_ADC_SL5CFG_SLEN5_SLEN                 0x00000001
+
+//*****************************************************************************
+//
+// ADC_SL6CFG - Slot 6 Configuration Register
+//
+//*****************************************************************************
+// Select the number of measurements to average in the accumulate divide module
+// for this slot.
+#define AM_REG_ADC_SL6CFG_ADSEL6_S                   24
+#define AM_REG_ADC_SL6CFG_ADSEL6_M                   0x07000000
+#define AM_REG_ADC_SL6CFG_ADSEL6(n)                  (((uint32_t)(n) << 24) & 0x07000000)
+#define AM_REG_ADC_SL6CFG_ADSEL6_AVG_1_MSRMT         0x00000000
+#define AM_REG_ADC_SL6CFG_ADSEL6_AVG_2_MSRMTS        0x01000000
+#define AM_REG_ADC_SL6CFG_ADSEL6_AVG_4_MSRMTS        0x02000000
+#define AM_REG_ADC_SL6CFG_ADSEL6_AVG_8_MSRMT         0x03000000
+#define AM_REG_ADC_SL6CFG_ADSEL6_AVG_16_MSRMTS       0x04000000
+#define AM_REG_ADC_SL6CFG_ADSEL6_AVG_32_MSRMTS       0x05000000
+#define AM_REG_ADC_SL6CFG_ADSEL6_AVG_64_MSRMTS       0x06000000
+#define AM_REG_ADC_SL6CFG_ADSEL6_AVG_128_MSRMTS      0x07000000
+
+// Set the Precision Mode For Slot.
+#define AM_REG_ADC_SL6CFG_PRMODE6_S                  16
+#define AM_REG_ADC_SL6CFG_PRMODE6_M                  0x00030000
+#define AM_REG_ADC_SL6CFG_PRMODE6(n)                 (((uint32_t)(n) << 16) & 0x00030000)
+#define AM_REG_ADC_SL6CFG_PRMODE6_P14B               0x00000000
+#define AM_REG_ADC_SL6CFG_PRMODE6_P12B               0x00010000
+#define AM_REG_ADC_SL6CFG_PRMODE6_P10B               0x00020000
+#define AM_REG_ADC_SL6CFG_PRMODE6_P8B                0x00030000
+
+// Select one of the 14 channel inputs for this slot.
+#define AM_REG_ADC_SL6CFG_CHSEL6_S                   8
+#define AM_REG_ADC_SL6CFG_CHSEL6_M                   0x00000F00
+#define AM_REG_ADC_SL6CFG_CHSEL6(n)                  (((uint32_t)(n) << 8) & 0x00000F00)
+#define AM_REG_ADC_SL6CFG_CHSEL6_SE0                 0x00000000
+#define AM_REG_ADC_SL6CFG_CHSEL6_SE1                 0x00000100
+#define AM_REG_ADC_SL6CFG_CHSEL6_SE2                 0x00000200
+#define AM_REG_ADC_SL6CFG_CHSEL6_SE3                 0x00000300
+#define AM_REG_ADC_SL6CFG_CHSEL6_SE4                 0x00000400
+#define AM_REG_ADC_SL6CFG_CHSEL6_SE5                 0x00000500
+#define AM_REG_ADC_SL6CFG_CHSEL6_SE6                 0x00000600
+#define AM_REG_ADC_SL6CFG_CHSEL6_SE7                 0x00000700
+#define AM_REG_ADC_SL6CFG_CHSEL6_SE8                 0x00000800
+#define AM_REG_ADC_SL6CFG_CHSEL6_SE9                 0x00000900
+#define AM_REG_ADC_SL6CFG_CHSEL6_DF0                 0x00000A00
+#define AM_REG_ADC_SL6CFG_CHSEL6_DF1                 0x00000B00
+#define AM_REG_ADC_SL6CFG_CHSEL6_TEMP                0x00000C00
+#define AM_REG_ADC_SL6CFG_CHSEL6_BATT                0x00000D00
+#define AM_REG_ADC_SL6CFG_CHSEL6_VSS                 0x00000E00
+
+// This bit enables the window compare function for slot 6.
+#define AM_REG_ADC_SL6CFG_WCEN6_S                    1
+#define AM_REG_ADC_SL6CFG_WCEN6_M                    0x00000002
+#define AM_REG_ADC_SL6CFG_WCEN6(n)                   (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_ADC_SL6CFG_WCEN6_WCEN                 0x00000002
+
+// This bit enables slot 6 for ADC conversions.
+#define AM_REG_ADC_SL6CFG_SLEN6_S                    0
+#define AM_REG_ADC_SL6CFG_SLEN6_M                    0x00000001
+#define AM_REG_ADC_SL6CFG_SLEN6(n)                   (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_ADC_SL6CFG_SLEN6_SLEN                 0x00000001
+
+//*****************************************************************************
+//
+// ADC_SL7CFG - Slot 7 Configuration Register
+//
+//*****************************************************************************
+// Select the number of measurements to average in the accumulate divide module
+// for this slot.
+#define AM_REG_ADC_SL7CFG_ADSEL7_S                   24
+#define AM_REG_ADC_SL7CFG_ADSEL7_M                   0x07000000
+#define AM_REG_ADC_SL7CFG_ADSEL7(n)                  (((uint32_t)(n) << 24) & 0x07000000)
+#define AM_REG_ADC_SL7CFG_ADSEL7_AVG_1_MSRMT         0x00000000
+#define AM_REG_ADC_SL7CFG_ADSEL7_AVG_2_MSRMTS        0x01000000
+#define AM_REG_ADC_SL7CFG_ADSEL7_AVG_4_MSRMTS        0x02000000
+#define AM_REG_ADC_SL7CFG_ADSEL7_AVG_8_MSRMT         0x03000000
+#define AM_REG_ADC_SL7CFG_ADSEL7_AVG_16_MSRMTS       0x04000000
+#define AM_REG_ADC_SL7CFG_ADSEL7_AVG_32_MSRMTS       0x05000000
+#define AM_REG_ADC_SL7CFG_ADSEL7_AVG_64_MSRMTS       0x06000000
+#define AM_REG_ADC_SL7CFG_ADSEL7_AVG_128_MSRMTS      0x07000000
+
+// Set the Precision Mode For Slot.
+#define AM_REG_ADC_SL7CFG_PRMODE7_S                  16
+#define AM_REG_ADC_SL7CFG_PRMODE7_M                  0x00030000
+#define AM_REG_ADC_SL7CFG_PRMODE7(n)                 (((uint32_t)(n) << 16) & 0x00030000)
+#define AM_REG_ADC_SL7CFG_PRMODE7_P14B               0x00000000
+#define AM_REG_ADC_SL7CFG_PRMODE7_P12B               0x00010000
+#define AM_REG_ADC_SL7CFG_PRMODE7_P10B               0x00020000
+#define AM_REG_ADC_SL7CFG_PRMODE7_P8B                0x00030000
+
+// Select one of the 14 channel inputs for this slot.
+#define AM_REG_ADC_SL7CFG_CHSEL7_S                   8
+#define AM_REG_ADC_SL7CFG_CHSEL7_M                   0x00000F00
+#define AM_REG_ADC_SL7CFG_CHSEL7(n)                  (((uint32_t)(n) << 8) & 0x00000F00)
+#define AM_REG_ADC_SL7CFG_CHSEL7_SE0                 0x00000000
+#define AM_REG_ADC_SL7CFG_CHSEL7_SE1                 0x00000100
+#define AM_REG_ADC_SL7CFG_CHSEL7_SE2                 0x00000200
+#define AM_REG_ADC_SL7CFG_CHSEL7_SE3                 0x00000300
+#define AM_REG_ADC_SL7CFG_CHSEL7_SE4                 0x00000400
+#define AM_REG_ADC_SL7CFG_CHSEL7_SE5                 0x00000500
+#define AM_REG_ADC_SL7CFG_CHSEL7_SE6                 0x00000600
+#define AM_REG_ADC_SL7CFG_CHSEL7_SE7                 0x00000700
+#define AM_REG_ADC_SL7CFG_CHSEL7_SE8                 0x00000800
+#define AM_REG_ADC_SL7CFG_CHSEL7_SE9                 0x00000900
+#define AM_REG_ADC_SL7CFG_CHSEL7_DF0                 0x00000A00
+#define AM_REG_ADC_SL7CFG_CHSEL7_DF1                 0x00000B00
+#define AM_REG_ADC_SL7CFG_CHSEL7_TEMP                0x00000C00
+#define AM_REG_ADC_SL7CFG_CHSEL7_BATT                0x00000D00
+#define AM_REG_ADC_SL7CFG_CHSEL7_VSS                 0x00000E00
+
+// This bit enables the window compare function for slot 7.
+#define AM_REG_ADC_SL7CFG_WCEN7_S                    1
+#define AM_REG_ADC_SL7CFG_WCEN7_M                    0x00000002
+#define AM_REG_ADC_SL7CFG_WCEN7(n)                   (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_ADC_SL7CFG_WCEN7_WCEN                 0x00000002
+
+// This bit enables slot 7 for ADC conversions.
+#define AM_REG_ADC_SL7CFG_SLEN7_S                    0
+#define AM_REG_ADC_SL7CFG_SLEN7_M                    0x00000001
+#define AM_REG_ADC_SL7CFG_SLEN7(n)                   (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_ADC_SL7CFG_SLEN7_SLEN                 0x00000001
+
+//*****************************************************************************
+//
+// ADC_WULIM - Window Comparator Upper Limits Register
+//
+//*****************************************************************************
+// Sets the upper limit for the wondow comparator.
+#define AM_REG_ADC_WULIM_ULIM_S                      0
+#define AM_REG_ADC_WULIM_ULIM_M                      0x000FFFFF
+#define AM_REG_ADC_WULIM_ULIM(n)                     (((uint32_t)(n) << 0) & 0x000FFFFF)
+
+//*****************************************************************************
+//
+// ADC_WLLIM - Window Comparator Lower Limits Register
+//
+//*****************************************************************************
+// Sets the lower limit for the wondow comparator.
+#define AM_REG_ADC_WLLIM_LLIM_S                      0
+#define AM_REG_ADC_WLLIM_LLIM_M                      0x000FFFFF
+#define AM_REG_ADC_WLLIM_LLIM(n)                     (((uint32_t)(n) << 0) & 0x000FFFFF)
+
+//*****************************************************************************
+//
+// ADC_FIFO - FIFO Data and Valid Count Register
+//
+//*****************************************************************************
+// RESERVED.
+#define AM_REG_ADC_FIFO_RSVD_S                       31
+#define AM_REG_ADC_FIFO_RSVD_M                       0x80000000
+#define AM_REG_ADC_FIFO_RSVD(n)                      (((uint32_t)(n) << 31) & 0x80000000)
+
+// Slot number associated with this FIFO data.
+#define AM_REG_ADC_FIFO_SLOTNUM_S                    28
+#define AM_REG_ADC_FIFO_SLOTNUM_M                    0x70000000
+#define AM_REG_ADC_FIFO_SLOTNUM(n)                   (((uint32_t)(n) << 28) & 0x70000000)
+
+// Number of valid entries in the ADC FIFO.
+#define AM_REG_ADC_FIFO_COUNT_S                      20
+#define AM_REG_ADC_FIFO_COUNT_M                      0x0FF00000
+#define AM_REG_ADC_FIFO_COUNT(n)                     (((uint32_t)(n) << 20) & 0x0FF00000)
+
+// Oldest data in the FIFO.
+#define AM_REG_ADC_FIFO_DATA_S                       0
+#define AM_REG_ADC_FIFO_DATA_M                       0x000FFFFF
+#define AM_REG_ADC_FIFO_DATA(n)                      (((uint32_t)(n) << 0) & 0x000FFFFF)
+
+#endif // AM_REG_ADC_H
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_base_addresses.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_base_addresses.h
new file mode 100644
index 000000000..c4d12a873
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_base_addresses.h
@@ -0,0 +1,77 @@
+//*****************************************************************************
+//
+//! @file am_reg_base_addresses.h
+//!
+//! @brief Register defines for all module base addresses
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_REG_BASE_ADDRESSES_H
+#define AM_REG_BASE_ADDRESSES_H
+
+#include "stdint.h"
+
+// ARM standard register space (needed for macros)
+#define REG_ITM_BASEADDR                         (0x00000000UL)
+#define REG_JEDEC_BASEADDR                       (0x00000000UL)
+#define REG_NVIC_BASEADDR                        (0x00000000UL)
+#define REG_SYSCTRL_BASEADDR                     (0x00000000UL)
+#define REG_SYSTICK_BASEADDR                     (0x00000000UL)
+#define REG_TPIU_BASEADDR                        (0x00000000UL)
+
+// Peripheral register space
+#define REG_ADC_BASEADDR                         (0x50010000UL)
+#define REG_CACHECTRL_BASEADDR                   (0x40018000UL)
+#define REG_CLKGEN_BASEADDR                      (0x40004000UL)
+#define REG_CTIMER_BASEADDR                      (0x40008000UL)
+#define REG_GPIO_BASEADDR                        (0x40010000UL)
+#define REG_IOMSTR_BASEADDR                      (0x50004000UL)
+#define REG_IOSLAVE_BASEADDR                     (0x50000000UL)
+#define REG_MCUCTRL_BASEADDR                     (0x40020000UL)
+#define REG_PDM_BASEADDR                         (0x50011000UL)
+#define REG_PWRCTRL_BASEADDR                     (0x40021000UL)
+#define REG_RSTGEN_BASEADDR                      (0x40000000UL)
+#define REG_RTC_BASEADDR                         (0x40004000UL)
+#define REG_UART_BASEADDR                        (0x4001C000UL)
+#define REG_VCOMP_BASEADDR                       (0x4000C000UL)
+#define REG_WDT_BASEADDR                         (0x40024000UL)
+
+// SRAM address space
+#define SRAM_BASEADDR                            (0x10000000UL)
+
+#endif // AM_REG_BASE_ADDRESSES_H
+
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_cachectrl.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_cachectrl.h
new file mode 100644
index 000000000..514be243c
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_cachectrl.h
@@ -0,0 +1,414 @@
+//*****************************************************************************
+//
+//! @file am_reg_cachectrl.h
+//!
+//! @brief Register macros for the CACHECTRL module
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_REG_CACHECTRL_H
+#define AM_REG_CACHECTRL_H
+
+//*****************************************************************************
+//
+// Instance finder. (1 instance(s) available)
+//
+//*****************************************************************************
+#define AM_REG_CACHECTRL_NUM_MODULES                 1
+#define AM_REG_CACHECTRLn(n) \
+    (REG_CACHECTRL_BASEADDR + 0x00001000 * n)
+
+//*****************************************************************************
+//
+// Register offsets.
+//
+//*****************************************************************************
+#define AM_REG_CACHECTRL_CACHECFG_O                  0x00000000
+#define AM_REG_CACHECTRL_FLASHCFG_O                  0x00000004
+#define AM_REG_CACHECTRL_CACHECTRL_O                 0x00000008
+#define AM_REG_CACHECTRL_NCR0START_O                 0x00000010
+#define AM_REG_CACHECTRL_NCR0END_O                   0x00000014
+#define AM_REG_CACHECTRL_NCR1START_O                 0x00000018
+#define AM_REG_CACHECTRL_NCR1END_O                   0x0000001C
+#define AM_REG_CACHECTRL_CACHEMODE_O                 0x00000030
+#define AM_REG_CACHECTRL_DMON0_O                     0x00000040
+#define AM_REG_CACHECTRL_DMON1_O                     0x00000044
+#define AM_REG_CACHECTRL_DMON2_O                     0x00000048
+#define AM_REG_CACHECTRL_DMON3_O                     0x0000004C
+#define AM_REG_CACHECTRL_IMON0_O                     0x00000050
+#define AM_REG_CACHECTRL_IMON1_O                     0x00000054
+#define AM_REG_CACHECTRL_IMON2_O                     0x00000058
+#define AM_REG_CACHECTRL_IMON3_O                     0x0000005C
+
+//*****************************************************************************
+//
+// CACHECTRL_CACHECFG - Flash Cache Control Register
+//
+//*****************************************************************************
+// Enable Cache Monitoring Stats.  Only enable this for debug/performance
+// analysis since it will consume additional power.  See IMON/DMON registers for
+// data.
+#define AM_REG_CACHECTRL_CACHECFG_ENABLE_MONITOR_S   24
+#define AM_REG_CACHECTRL_CACHECFG_ENABLE_MONITOR_M   0x01000000
+#define AM_REG_CACHECTRL_CACHECFG_ENABLE_MONITOR(n)  (((uint32_t)(n) << 24) & 0x01000000)
+
+// Enable clock gating of entire cache data array subsystem.  This should be
+// enabled for normal operation.
+#define AM_REG_CACHECTRL_CACHECFG_DATA_CLKGATE_S     20
+#define AM_REG_CACHECTRL_CACHECFG_DATA_CLKGATE_M     0x00100000
+#define AM_REG_CACHECTRL_CACHECFG_DATA_CLKGATE(n)    (((uint32_t)(n) << 20) & 0x00100000)
+
+// Unused.  Should be left at default value.
+#define AM_REG_CACHECTRL_CACHECFG_SMDLY_S            16
+#define AM_REG_CACHECTRL_CACHECFG_SMDLY_M            0x000F0000
+#define AM_REG_CACHECTRL_CACHECFG_SMDLY(n)           (((uint32_t)(n) << 16) & 0x000F0000)
+
+// Unused.  Should be left at default value.
+#define AM_REG_CACHECTRL_CACHECFG_DLY_S              12
+#define AM_REG_CACHECTRL_CACHECFG_DLY_M              0x0000F000
+#define AM_REG_CACHECTRL_CACHECFG_DLY(n)             (((uint32_t)(n) << 12) & 0x0000F000)
+
+// Enable LS (light sleep) of cache RAMs.  This should not be enabled for normal
+// operation.  When this bit is set, the cache's RAMS will be put into light
+// sleep mode while inactive.  NOTE:  if the cache is actively used, this may
+// have an adverse affect on power since entering/exiting LS mode may consume
+// more power than would be saved.
+#define AM_REG_CACHECTRL_CACHECFG_CACHE_LS_S         11
+#define AM_REG_CACHECTRL_CACHECFG_CACHE_LS_M         0x00000800
+#define AM_REG_CACHECTRL_CACHECFG_CACHE_LS(n)        (((uint32_t)(n) << 11) & 0x00000800)
+
+// Enable clock gating of individual cache RAMs.  This bit should be enabled for
+// normal operation for lowest power consumption.
+#define AM_REG_CACHECTRL_CACHECFG_CACHE_CLKGATE_S    10
+#define AM_REG_CACHECTRL_CACHECFG_CACHE_CLKGATE_M    0x00000400
+#define AM_REG_CACHECTRL_CACHECFG_CACHE_CLKGATE(n)   (((uint32_t)(n) << 10) & 0x00000400)
+
+// Enable Flash Data Caching.  When set to 1, all instruction accesses to flash
+// will be cached.
+#define AM_REG_CACHECTRL_CACHECFG_DCACHE_ENABLE_S    9
+#define AM_REG_CACHECTRL_CACHECFG_DCACHE_ENABLE_M    0x00000200
+#define AM_REG_CACHECTRL_CACHECFG_DCACHE_ENABLE(n)   (((uint32_t)(n) << 9) & 0x00000200)
+
+// Enable Flash Instruction Caching.  When set to 1, all instruction accesses to
+// flash will be cached.
+#define AM_REG_CACHECTRL_CACHECFG_ICACHE_ENABLE_S    8
+#define AM_REG_CACHECTRL_CACHECFG_ICACHE_ENABLE_M    0x00000100
+#define AM_REG_CACHECTRL_CACHECFG_ICACHE_ENABLE(n)   (((uint32_t)(n) << 8) & 0x00000100)
+
+// Bitfield should always be programmed to 0.
+#define AM_REG_CACHECTRL_CACHECFG_SERIAL_S           7
+#define AM_REG_CACHECTRL_CACHECFG_SERIAL_M           0x00000080
+#define AM_REG_CACHECTRL_CACHECFG_SERIAL(n)          (((uint32_t)(n) << 7) & 0x00000080)
+
+// Sets the cache configuration.  Only a single configuration of 0x5 is valid.
+#define AM_REG_CACHECTRL_CACHECFG_CONFIG_S           4
+#define AM_REG_CACHECTRL_CACHECFG_CONFIG_M           0x00000070
+#define AM_REG_CACHECTRL_CACHECFG_CONFIG(n)          (((uint32_t)(n) << 4) & 0x00000070)
+#define AM_REG_CACHECTRL_CACHECFG_CONFIG_W2_128B_512E 0x00000050
+
+// Enable Non-cacheable region 1.  See the NCR1 registers to set the region
+// boundaries and size.
+#define AM_REG_CACHECTRL_CACHECFG_ENABLE_NC1_S       3
+#define AM_REG_CACHECTRL_CACHECFG_ENABLE_NC1_M       0x00000008
+#define AM_REG_CACHECTRL_CACHECFG_ENABLE_NC1(n)      (((uint32_t)(n) << 3) & 0x00000008)
+
+// Enable Non-cacheable region 0.  See the NCR0 registers to set the region
+// boundaries and size.
+#define AM_REG_CACHECTRL_CACHECFG_ENABLE_NC0_S       2
+#define AM_REG_CACHECTRL_CACHECFG_ENABLE_NC0_M       0x00000004
+#define AM_REG_CACHECTRL_CACHECFG_ENABLE_NC0(n)      (((uint32_t)(n) << 2) & 0x00000004)
+
+// Sets the cache replacement policy.  0=LRR (least recently replaced), 1=LRU
+// (least recently used).  LRR minimizes writes to the TAG SRAM and is
+// recommended.
+#define AM_REG_CACHECTRL_CACHECFG_LRU_S              1
+#define AM_REG_CACHECTRL_CACHECFG_LRU_M              0x00000002
+#define AM_REG_CACHECTRL_CACHECFG_LRU(n)             (((uint32_t)(n) << 1) & 0x00000002)
+
+// Enables the main flash cache controller logic and enables power to the cache
+// RAMs.  Instruction and Data caching need to be enabled independently using
+// the ICACHE_ENABLE and DCACHE_ENABLE bits.
+#define AM_REG_CACHECTRL_CACHECFG_ENABLE_S           0
+#define AM_REG_CACHECTRL_CACHECFG_ENABLE_M           0x00000001
+#define AM_REG_CACHECTRL_CACHECFG_ENABLE(n)          (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// CACHECTRL_FLASHCFG - Flash Control Register
+//
+//*****************************************************************************
+// Sets read waitstates for flash accesses (in clock cycles).  This should be
+// left at the default value for normal flash operation.
+#define AM_REG_CACHECTRL_FLASHCFG_RD_WAIT_S          0
+#define AM_REG_CACHECTRL_FLASHCFG_RD_WAIT_M          0x00000007
+#define AM_REG_CACHECTRL_FLASHCFG_RD_WAIT(n)         (((uint32_t)(n) << 0) & 0x00000007)
+
+//*****************************************************************************
+//
+// CACHECTRL_CACHECTRL - Cache Control
+//
+//*****************************************************************************
+// Enable Flash Sleep Mode.  After writing this bit, the flash instance 1 will
+// enter a low-power mode until the CPU writes the SLM_DISABLE bit or a flash
+// access occurs.  Wake from SLM requires ~5us, so this should only be set if
+// the flash will not be accessed for reasonably long time.
+#define AM_REG_CACHECTRL_CACHECTRL_FLASH1_SLM_ENABLE_S 10
+#define AM_REG_CACHECTRL_CACHECTRL_FLASH1_SLM_ENABLE_M 0x00000400
+#define AM_REG_CACHECTRL_CACHECTRL_FLASH1_SLM_ENABLE(n) (((uint32_t)(n) << 10) & 0x00000400)
+
+// Disable Flash Sleep Mode.  Allows CPU to manually disable SLM mode.
+// Performing a flash read will also wake the array.
+#define AM_REG_CACHECTRL_CACHECTRL_FLASH1_SLM_DISABLE_S 9
+#define AM_REG_CACHECTRL_CACHECTRL_FLASH1_SLM_DISABLE_M 0x00000200
+#define AM_REG_CACHECTRL_CACHECTRL_FLASH1_SLM_DISABLE(n) (((uint32_t)(n) << 9) & 0x00000200)
+
+// Flash Sleep Mode Status.  When 1, flash instance 1 is asleep.
+#define AM_REG_CACHECTRL_CACHECTRL_FLASH1_SLM_STATUS_S 8
+#define AM_REG_CACHECTRL_CACHECTRL_FLASH1_SLM_STATUS_M 0x00000100
+#define AM_REG_CACHECTRL_CACHECTRL_FLASH1_SLM_STATUS(n) (((uint32_t)(n) << 8) & 0x00000100)
+
+// Enable Flash Sleep Mode.  After writing this bit, the flash instance 0 will
+// enter a low-power mode until the CPU writes the SLM_DISABLE bit or a flash
+// access occurs.  Wake from SLM requires ~5us, so this should only be set if
+// the flash will not be accessed for reasonably long time.
+#define AM_REG_CACHECTRL_CACHECTRL_FLASH0_SLM_ENABLE_S 6
+#define AM_REG_CACHECTRL_CACHECTRL_FLASH0_SLM_ENABLE_M 0x00000040
+#define AM_REG_CACHECTRL_CACHECTRL_FLASH0_SLM_ENABLE(n) (((uint32_t)(n) << 6) & 0x00000040)
+
+// Disable Flash Sleep Mode.  Allows CPU to manually disable SLM mode.
+// Performing a flash read will also wake the array.
+#define AM_REG_CACHECTRL_CACHECTRL_FLASH0_SLM_DISABLE_S 5
+#define AM_REG_CACHECTRL_CACHECTRL_FLASH0_SLM_DISABLE_M 0x00000020
+#define AM_REG_CACHECTRL_CACHECTRL_FLASH0_SLM_DISABLE(n) (((uint32_t)(n) << 5) & 0x00000020)
+
+// Flash Sleep Mode Status.  When 1, flash instance 0 is asleep.
+#define AM_REG_CACHECTRL_CACHECTRL_FLASH0_SLM_STATUS_S 4
+#define AM_REG_CACHECTRL_CACHECTRL_FLASH0_SLM_STATUS_M 0x00000010
+#define AM_REG_CACHECTRL_CACHECTRL_FLASH0_SLM_STATUS(n) (((uint32_t)(n) << 4) & 0x00000010)
+
+// Cache Ready Status.  A value of 1 indicates the cache is enabled and not
+// processing an invalidate operation.
+#define AM_REG_CACHECTRL_CACHECTRL_CACHE_READY_S     2
+#define AM_REG_CACHECTRL_CACHECTRL_CACHE_READY_M     0x00000004
+#define AM_REG_CACHECTRL_CACHECTRL_CACHE_READY(n)    (((uint32_t)(n) << 2) & 0x00000004)
+
+// Writing a 1 to this bitfield will reset the cache monitor statistics
+// (DMON0-3, IMON0-3).  Statistic gathering can be paused/stopped by disabling
+// the MONITOR_ENABLE bit in CACHECFG, which will maintain the count values
+// until the stats are reset by writing this bitfield.
+#define AM_REG_CACHECTRL_CACHECTRL_RESET_STAT_S      1
+#define AM_REG_CACHECTRL_CACHECTRL_RESET_STAT_M      0x00000002
+#define AM_REG_CACHECTRL_CACHECTRL_RESET_STAT(n)     (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_CACHECTRL_CACHECTRL_RESET_STAT_CLEAR  0x00000002
+
+// Writing a 1 to this bitfield invalidates the flash cache contents.
+#define AM_REG_CACHECTRL_CACHECTRL_INVALIDATE_S      0
+#define AM_REG_CACHECTRL_CACHECTRL_INVALIDATE_M      0x00000001
+#define AM_REG_CACHECTRL_CACHECTRL_INVALIDATE(n)     (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_CACHECTRL_CACHECTRL_INVALIDATE_GO     0x00000001
+
+//*****************************************************************************
+//
+// CACHECTRL_NCR0START - Flash Cache Noncachable Region 0 Start Address.
+//
+//*****************************************************************************
+// Start address for non-cacheable region 0.  The physical address of the start
+// of this region should be programmed to this register and must be aligned to a
+// 16-byte boundary (thus the lower 4 address bits are unused).
+#define AM_REG_CACHECTRL_NCR0START_ADDR_S            4
+#define AM_REG_CACHECTRL_NCR0START_ADDR_M            0x000FFFF0
+#define AM_REG_CACHECTRL_NCR0START_ADDR(n)           (((uint32_t)(n) << 4) & 0x000FFFF0)
+
+//*****************************************************************************
+//
+// CACHECTRL_NCR0END - Flash Cache Noncachable Region 0 End
+//
+//*****************************************************************************
+// End address for non-cacheable region 0.  The physical address of the end of
+// this region should be programmed to this register and must be aligned to a
+// 16-byte boundary (thus the lower 4 address bits are unused).
+#define AM_REG_CACHECTRL_NCR0END_ADDR_S              4
+#define AM_REG_CACHECTRL_NCR0END_ADDR_M              0x000FFFF0
+#define AM_REG_CACHECTRL_NCR0END_ADDR(n)             (((uint32_t)(n) << 4) & 0x000FFFF0)
+
+//*****************************************************************************
+//
+// CACHECTRL_NCR1START - Flash Cache Noncachable Region 1 Start
+//
+//*****************************************************************************
+// Start address for non-cacheable region 1.  The physical address of the start
+// of this region should be programmed to this register and must be aligned to a
+// 16-byte boundary (thus the lower 4 address bits are unused).
+#define AM_REG_CACHECTRL_NCR1START_ADDR_S            4
+#define AM_REG_CACHECTRL_NCR1START_ADDR_M            0x000FFFF0
+#define AM_REG_CACHECTRL_NCR1START_ADDR(n)           (((uint32_t)(n) << 4) & 0x000FFFF0)
+
+//*****************************************************************************
+//
+// CACHECTRL_NCR1END - Flash Cache Noncachable Region 1 End
+//
+//*****************************************************************************
+// End address for non-cacheable region 1.  The physical address of the end of
+// this region should be programmed to this register and must be aligned to a
+// 16-byte boundary (thus the lower 4 address bits are unused).
+#define AM_REG_CACHECTRL_NCR1END_ADDR_S              4
+#define AM_REG_CACHECTRL_NCR1END_ADDR_M              0x000FFFF0
+#define AM_REG_CACHECTRL_NCR1END_ADDR(n)             (((uint32_t)(n) << 4) & 0x000FFFF0)
+
+//*****************************************************************************
+//
+// CACHECTRL_CACHEMODE - Flash Cache Mode Register.  Used to trim
+// performance/power.
+//
+//*****************************************************************************
+// Disallow Simultaneous Data RAM reads (from 2 line hits on each bus).  Value
+// should be left at zero for optimal performance.
+#define AM_REG_CACHECTRL_CACHEMODE_THROTTLE6_S       5
+#define AM_REG_CACHECTRL_CACHEMODE_THROTTLE6_M       0x00000020
+#define AM_REG_CACHECTRL_CACHEMODE_THROTTLE6(n)      (((uint32_t)(n) << 5) & 0x00000020)
+
+// Disallow Data RAM reads (from line hits) during lookup read ops.  Value
+// should be left at zero for optimal performance.
+#define AM_REG_CACHECTRL_CACHEMODE_THROTTLE5_S       4
+#define AM_REG_CACHECTRL_CACHEMODE_THROTTLE5_M       0x00000010
+#define AM_REG_CACHECTRL_CACHEMODE_THROTTLE5(n)      (((uint32_t)(n) << 4) & 0x00000010)
+
+// Disallow Data RAM reads (from line hits) on tag RAM fill cycles. Value should
+// be left at zero for optimal performance.
+#define AM_REG_CACHECTRL_CACHEMODE_THROTTLE4_S       3
+#define AM_REG_CACHECTRL_CACHEMODE_THROTTLE4_M       0x00000008
+#define AM_REG_CACHECTRL_CACHEMODE_THROTTLE4(n)      (((uint32_t)(n) << 3) & 0x00000008)
+
+// Disallow cache data RAM writes on data RAM read cycles. Value should be left
+// at zero for optimal performance.
+#define AM_REG_CACHECTRL_CACHEMODE_THROTTLE3_S       2
+#define AM_REG_CACHECTRL_CACHEMODE_THROTTLE3_M       0x00000004
+#define AM_REG_CACHECTRL_CACHEMODE_THROTTLE3(n)      (((uint32_t)(n) << 2) & 0x00000004)
+
+// Disallow cache data RAM writes on tag RAM read cycles. Value should be left
+// at zero for optimal performance.
+#define AM_REG_CACHECTRL_CACHEMODE_THROTTLE2_S       1
+#define AM_REG_CACHECTRL_CACHEMODE_THROTTLE2_M       0x00000002
+#define AM_REG_CACHECTRL_CACHEMODE_THROTTLE2(n)      (((uint32_t)(n) << 1) & 0x00000002)
+
+// Disallow cache data RAM writes on tag RAM fill cycles. Value should be left
+// at zero for optimal performance.
+#define AM_REG_CACHECTRL_CACHEMODE_THROTTLE1_S       0
+#define AM_REG_CACHECTRL_CACHEMODE_THROTTLE1_M       0x00000001
+#define AM_REG_CACHECTRL_CACHEMODE_THROTTLE1(n)      (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// CACHECTRL_DMON0 - Data Cache Total Accesses
+//
+//*****************************************************************************
+// Total accesses to data cache
+#define AM_REG_CACHECTRL_DMON0_DACCESS_COUNT_S       0
+#define AM_REG_CACHECTRL_DMON0_DACCESS_COUNT_M       0xFFFFFFFF
+#define AM_REG_CACHECTRL_DMON0_DACCESS_COUNT(n)      (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// CACHECTRL_DMON1 - Data Cache Tag Lookups
+//
+//*****************************************************************************
+// Total tag lookups from data cache
+#define AM_REG_CACHECTRL_DMON1_DLOOKUP_COUNT_S       0
+#define AM_REG_CACHECTRL_DMON1_DLOOKUP_COUNT_M       0xFFFFFFFF
+#define AM_REG_CACHECTRL_DMON1_DLOOKUP_COUNT(n)      (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// CACHECTRL_DMON2 - Data Cache Hits
+//
+//*****************************************************************************
+// Cache hits from lookup operations
+#define AM_REG_CACHECTRL_DMON2_DHIT_COUNT_S          0
+#define AM_REG_CACHECTRL_DMON2_DHIT_COUNT_M          0xFFFFFFFF
+#define AM_REG_CACHECTRL_DMON2_DHIT_COUNT(n)         (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// CACHECTRL_DMON3 - Data Cache Line Hits
+//
+//*****************************************************************************
+// Cache hits from line cache
+#define AM_REG_CACHECTRL_DMON3_DLINE_COUNT_S         0
+#define AM_REG_CACHECTRL_DMON3_DLINE_COUNT_M         0xFFFFFFFF
+#define AM_REG_CACHECTRL_DMON3_DLINE_COUNT(n)        (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// CACHECTRL_IMON0 - Instruction Cache Total Accesses
+//
+//*****************************************************************************
+// Total accesses to Instruction cache
+#define AM_REG_CACHECTRL_IMON0_IACCESS_COUNT_S       0
+#define AM_REG_CACHECTRL_IMON0_IACCESS_COUNT_M       0xFFFFFFFF
+#define AM_REG_CACHECTRL_IMON0_IACCESS_COUNT(n)      (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// CACHECTRL_IMON1 - Instruction Cache Tag Lookups
+//
+//*****************************************************************************
+// Total tag lookups from Instruction cache
+#define AM_REG_CACHECTRL_IMON1_ILOOKUP_COUNT_S       0
+#define AM_REG_CACHECTRL_IMON1_ILOOKUP_COUNT_M       0xFFFFFFFF
+#define AM_REG_CACHECTRL_IMON1_ILOOKUP_COUNT(n)      (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// CACHECTRL_IMON2 - Instruction Cache Hits
+//
+//*****************************************************************************
+// Cache hits from lookup operations
+#define AM_REG_CACHECTRL_IMON2_IHIT_COUNT_S          0
+#define AM_REG_CACHECTRL_IMON2_IHIT_COUNT_M          0xFFFFFFFF
+#define AM_REG_CACHECTRL_IMON2_IHIT_COUNT(n)         (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// CACHECTRL_IMON3 - Instruction Cache Line Hits
+//
+//*****************************************************************************
+// Cache hits from line cache
+#define AM_REG_CACHECTRL_IMON3_ILINE_COUNT_S         0
+#define AM_REG_CACHECTRL_IMON3_ILINE_COUNT_M         0xFFFFFFFF
+#define AM_REG_CACHECTRL_IMON3_ILINE_COUNT(n)        (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+#endif // AM_REG_CACHECTRL_H
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_clkgen.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_clkgen.h
new file mode 100644
index 000000000..6335ba486
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_clkgen.h
@@ -0,0 +1,499 @@
+//*****************************************************************************
+//
+//! @file am_reg_clkgen.h
+//!
+//! @brief Register macros for the CLKGEN module
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_REG_CLKGEN_H
+#define AM_REG_CLKGEN_H
+
+//*****************************************************************************
+//
+// Instance finder. (1 instance(s) available)
+//
+//*****************************************************************************
+#define AM_REG_CLKGEN_NUM_MODULES                    1
+#define AM_REG_CLKGENn(n) \
+    (REG_CLKGEN_BASEADDR + 0x00000000 * n)
+
+//*****************************************************************************
+//
+// Register offsets.
+//
+//*****************************************************************************
+#define AM_REG_CLKGEN_CALXT_O                        0x00000000
+#define AM_REG_CLKGEN_CALRC_O                        0x00000004
+#define AM_REG_CLKGEN_ACALCTR_O                      0x00000008
+#define AM_REG_CLKGEN_OCTRL_O                        0x0000000C
+#define AM_REG_CLKGEN_CLKOUT_O                       0x00000010
+#define AM_REG_CLKGEN_CCTRL_O                        0x00000018
+#define AM_REG_CLKGEN_STATUS_O                       0x0000001C
+#define AM_REG_CLKGEN_HFADJ_O                        0x00000020
+#define AM_REG_CLKGEN_HFVAL_O                        0x00000024
+#define AM_REG_CLKGEN_CLOCKEN_O                      0x00000028
+#define AM_REG_CLKGEN_CLOCKEN2_O                     0x0000002C
+#define AM_REG_CLKGEN_CLOCKEN3_O                     0x00000030
+#define AM_REG_CLKGEN_UARTEN_O                       0x00000034
+#define AM_REG_CLKGEN_CLKKEY_O                       0x00000014
+#define AM_REG_CLKGEN_INTEN_O                        0x00000100
+#define AM_REG_CLKGEN_INTSTAT_O                      0x00000104
+#define AM_REG_CLKGEN_INTCLR_O                       0x00000108
+#define AM_REG_CLKGEN_INTSET_O                       0x0000010C
+
+//*****************************************************************************
+//
+// Key values.
+//
+//*****************************************************************************
+#define AM_REG_CLKGEN_CLKKEY_KEYVAL                  0x00000047
+
+//*****************************************************************************
+//
+// CLKGEN_INTEN - CLKGEN Interrupt Register: Enable
+//
+//*****************************************************************************
+// RTC Alarm interrupt
+#define AM_REG_CLKGEN_INTEN_ALM_S                    3
+#define AM_REG_CLKGEN_INTEN_ALM_M                    0x00000008
+#define AM_REG_CLKGEN_INTEN_ALM(n)                   (((uint32_t)(n) << 3) & 0x00000008)
+
+// XT Oscillator Fail interrupt
+#define AM_REG_CLKGEN_INTEN_OF_S                     2
+#define AM_REG_CLKGEN_INTEN_OF_M                     0x00000004
+#define AM_REG_CLKGEN_INTEN_OF(n)                    (((uint32_t)(n) << 2) & 0x00000004)
+
+// Autocalibration Complete interrupt
+#define AM_REG_CLKGEN_INTEN_ACC_S                    1
+#define AM_REG_CLKGEN_INTEN_ACC_M                    0x00000002
+#define AM_REG_CLKGEN_INTEN_ACC(n)                   (((uint32_t)(n) << 1) & 0x00000002)
+
+// Autocalibration Fail interrupt
+#define AM_REG_CLKGEN_INTEN_ACF_S                    0
+#define AM_REG_CLKGEN_INTEN_ACF_M                    0x00000001
+#define AM_REG_CLKGEN_INTEN_ACF(n)                   (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// CLKGEN_INTSTAT - CLKGEN Interrupt Register: Status
+//
+//*****************************************************************************
+// RTC Alarm interrupt
+#define AM_REG_CLKGEN_INTSTAT_ALM_S                  3
+#define AM_REG_CLKGEN_INTSTAT_ALM_M                  0x00000008
+#define AM_REG_CLKGEN_INTSTAT_ALM(n)                 (((uint32_t)(n) << 3) & 0x00000008)
+
+// XT Oscillator Fail interrupt
+#define AM_REG_CLKGEN_INTSTAT_OF_S                   2
+#define AM_REG_CLKGEN_INTSTAT_OF_M                   0x00000004
+#define AM_REG_CLKGEN_INTSTAT_OF(n)                  (((uint32_t)(n) << 2) & 0x00000004)
+
+// Autocalibration Complete interrupt
+#define AM_REG_CLKGEN_INTSTAT_ACC_S                  1
+#define AM_REG_CLKGEN_INTSTAT_ACC_M                  0x00000002
+#define AM_REG_CLKGEN_INTSTAT_ACC(n)                 (((uint32_t)(n) << 1) & 0x00000002)
+
+// Autocalibration Fail interrupt
+#define AM_REG_CLKGEN_INTSTAT_ACF_S                  0
+#define AM_REG_CLKGEN_INTSTAT_ACF_M                  0x00000001
+#define AM_REG_CLKGEN_INTSTAT_ACF(n)                 (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// CLKGEN_INTCLR - CLKGEN Interrupt Register: Clear
+//
+//*****************************************************************************
+// RTC Alarm interrupt
+#define AM_REG_CLKGEN_INTCLR_ALM_S                   3
+#define AM_REG_CLKGEN_INTCLR_ALM_M                   0x00000008
+#define AM_REG_CLKGEN_INTCLR_ALM(n)                  (((uint32_t)(n) << 3) & 0x00000008)
+
+// XT Oscillator Fail interrupt
+#define AM_REG_CLKGEN_INTCLR_OF_S                    2
+#define AM_REG_CLKGEN_INTCLR_OF_M                    0x00000004
+#define AM_REG_CLKGEN_INTCLR_OF(n)                   (((uint32_t)(n) << 2) & 0x00000004)
+
+// Autocalibration Complete interrupt
+#define AM_REG_CLKGEN_INTCLR_ACC_S                   1
+#define AM_REG_CLKGEN_INTCLR_ACC_M                   0x00000002
+#define AM_REG_CLKGEN_INTCLR_ACC(n)                  (((uint32_t)(n) << 1) & 0x00000002)
+
+// Autocalibration Fail interrupt
+#define AM_REG_CLKGEN_INTCLR_ACF_S                   0
+#define AM_REG_CLKGEN_INTCLR_ACF_M                   0x00000001
+#define AM_REG_CLKGEN_INTCLR_ACF(n)                  (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// CLKGEN_INTSET - CLKGEN Interrupt Register: Set
+//
+//*****************************************************************************
+// RTC Alarm interrupt
+#define AM_REG_CLKGEN_INTSET_ALM_S                   3
+#define AM_REG_CLKGEN_INTSET_ALM_M                   0x00000008
+#define AM_REG_CLKGEN_INTSET_ALM(n)                  (((uint32_t)(n) << 3) & 0x00000008)
+
+// XT Oscillator Fail interrupt
+#define AM_REG_CLKGEN_INTSET_OF_S                    2
+#define AM_REG_CLKGEN_INTSET_OF_M                    0x00000004
+#define AM_REG_CLKGEN_INTSET_OF(n)                   (((uint32_t)(n) << 2) & 0x00000004)
+
+// Autocalibration Complete interrupt
+#define AM_REG_CLKGEN_INTSET_ACC_S                   1
+#define AM_REG_CLKGEN_INTSET_ACC_M                   0x00000002
+#define AM_REG_CLKGEN_INTSET_ACC(n)                  (((uint32_t)(n) << 1) & 0x00000002)
+
+// Autocalibration Fail interrupt
+#define AM_REG_CLKGEN_INTSET_ACF_S                   0
+#define AM_REG_CLKGEN_INTSET_ACF_M                   0x00000001
+#define AM_REG_CLKGEN_INTSET_ACF(n)                  (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// CLKGEN_CALXT - XT Oscillator Control
+//
+//*****************************************************************************
+// XT Oscillator calibration value
+#define AM_REG_CLKGEN_CALXT_CALXT_S                  0
+#define AM_REG_CLKGEN_CALXT_CALXT_M                  0x000007FF
+#define AM_REG_CLKGEN_CALXT_CALXT(n)                 (((uint32_t)(n) << 0) & 0x000007FF)
+
+//*****************************************************************************
+//
+// CLKGEN_CALRC - RC Oscillator Control
+//
+//*****************************************************************************
+// LFRC Oscillator calibration value
+#define AM_REG_CLKGEN_CALRC_CALRC_S                  0
+#define AM_REG_CLKGEN_CALRC_CALRC_M                  0x0003FFFF
+#define AM_REG_CLKGEN_CALRC_CALRC(n)                 (((uint32_t)(n) << 0) & 0x0003FFFF)
+
+//*****************************************************************************
+//
+// CLKGEN_ACALCTR - Autocalibration Counter
+//
+//*****************************************************************************
+// Autocalibration Counter result.
+#define AM_REG_CLKGEN_ACALCTR_ACALCTR_S              0
+#define AM_REG_CLKGEN_ACALCTR_ACALCTR_M              0x00FFFFFF
+#define AM_REG_CLKGEN_ACALCTR_ACALCTR(n)             (((uint32_t)(n) << 0) & 0x00FFFFFF)
+
+//*****************************************************************************
+//
+// CLKGEN_OCTRL - Oscillator Control
+//
+//*****************************************************************************
+// Autocalibration control
+#define AM_REG_CLKGEN_OCTRL_ACAL_S                   8
+#define AM_REG_CLKGEN_OCTRL_ACAL_M                   0x00000700
+#define AM_REG_CLKGEN_OCTRL_ACAL(n)                  (((uint32_t)(n) << 8) & 0x00000700)
+#define AM_REG_CLKGEN_OCTRL_ACAL_DIS                 0x00000000
+#define AM_REG_CLKGEN_OCTRL_ACAL_1024SEC             0x00000200
+#define AM_REG_CLKGEN_OCTRL_ACAL_512SEC              0x00000300
+#define AM_REG_CLKGEN_OCTRL_ACAL_XTFREQ              0x00000600
+#define AM_REG_CLKGEN_OCTRL_ACAL_EXTFREQ             0x00000700
+
+// Selects the RTC oscillator (1 => LFRC, 0 => XT)
+#define AM_REG_CLKGEN_OCTRL_OSEL_S                   7
+#define AM_REG_CLKGEN_OCTRL_OSEL_M                   0x00000080
+#define AM_REG_CLKGEN_OCTRL_OSEL(n)                  (((uint32_t)(n) << 7) & 0x00000080)
+#define AM_REG_CLKGEN_OCTRL_OSEL_RTC_XT              0x00000000
+#define AM_REG_CLKGEN_OCTRL_OSEL_RTC_LFRC            0x00000080
+
+// Oscillator switch on failure function
+#define AM_REG_CLKGEN_OCTRL_FOS_S                    6
+#define AM_REG_CLKGEN_OCTRL_FOS_M                    0x00000040
+#define AM_REG_CLKGEN_OCTRL_FOS(n)                   (((uint32_t)(n) << 6) & 0x00000040)
+#define AM_REG_CLKGEN_OCTRL_FOS_DIS                  0x00000000
+#define AM_REG_CLKGEN_OCTRL_FOS_EN                   0x00000040
+
+// Stop the LFRC Oscillator to the RTC
+#define AM_REG_CLKGEN_OCTRL_STOPRC_S                 1
+#define AM_REG_CLKGEN_OCTRL_STOPRC_M                 0x00000002
+#define AM_REG_CLKGEN_OCTRL_STOPRC(n)                (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_CLKGEN_OCTRL_STOPRC_EN                0x00000000
+#define AM_REG_CLKGEN_OCTRL_STOPRC_STOP              0x00000002
+
+// Stop the XT Oscillator to the RTC
+#define AM_REG_CLKGEN_OCTRL_STOPXT_S                 0
+#define AM_REG_CLKGEN_OCTRL_STOPXT_M                 0x00000001
+#define AM_REG_CLKGEN_OCTRL_STOPXT(n)                (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_CLKGEN_OCTRL_STOPXT_EN                0x00000000
+#define AM_REG_CLKGEN_OCTRL_STOPXT_STOP              0x00000001
+
+//*****************************************************************************
+//
+// CLKGEN_CLKOUT - CLKOUT Frequency Select
+//
+//*****************************************************************************
+// Enable the CLKOUT signal
+#define AM_REG_CLKGEN_CLKOUT_CKEN_S                  7
+#define AM_REG_CLKGEN_CLKOUT_CKEN_M                  0x00000080
+#define AM_REG_CLKGEN_CLKOUT_CKEN(n)                 (((uint32_t)(n) << 7) & 0x00000080)
+#define AM_REG_CLKGEN_CLKOUT_CKEN_DIS                0x00000000
+#define AM_REG_CLKGEN_CLKOUT_CKEN_EN                 0x00000080
+
+// CLKOUT signal select
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_S                 0
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_M                 0x0000003F
+#define AM_REG_CLKGEN_CLKOUT_CKSEL(n)                (((uint32_t)(n) << 0) & 0x0000003F)
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_LFRC              0x00000000
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_XT_DIV2           0x00000001
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_XT_DIV4           0x00000002
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_XT_DIV8           0x00000003
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_XT_DIV16          0x00000004
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_XT_DIV32          0x00000005
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_RTC_1Hz           0x00000010
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_XT_DIV2M          0x00000016
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_XT                0x00000017
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_CG_100Hz          0x00000018
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_HFRC              0x00000019
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_HFRC_DIV4         0x0000001A
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_HFRC_DIV8         0x0000001B
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_HFRC_DIV16        0x0000001C
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_HFRC_DIV64        0x0000001D
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_HFRC_DIV128       0x0000001E
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_HFRC_DIV256       0x0000001F
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_HFRC_DIV512       0x00000020
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_FLASH_CLK         0x00000022
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_LFRC_DIV2         0x00000023
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_LFRC_DIV32        0x00000024
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_LFRC_DIV512       0x00000025
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_LFRC_DIV32K       0x00000026
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_XT_DIV256         0x00000027
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_XT_DIV8K          0x00000028
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_XT_DIV64K         0x00000029
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_ULFRC_DIV16       0x0000002A
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_ULFRC_DIV128      0x0000002B
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_ULFRC_1Hz         0x0000002C
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_ULFRC_DIV4K       0x0000002D
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_ULFRC_DIV1M       0x0000002E
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_HFRC_DIV64K       0x0000002F
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_HFRC_DIV16M       0x00000030
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_LFRC_DIV2M        0x00000031
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_HFRCNE            0x00000032
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_HFRCNE_DIV8       0x00000033
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_XTNE              0x00000035
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_XTNE_DIV16        0x00000036
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_LFRCNE_DIV32      0x00000037
+#define AM_REG_CLKGEN_CLKOUT_CKSEL_LFRCNE            0x00000039
+
+//*****************************************************************************
+//
+// CLKGEN_CCTRL - HFRC Clock Control
+//
+//*****************************************************************************
+// Core Clock divisor
+#define AM_REG_CLKGEN_CCTRL_CORESEL_S                0
+#define AM_REG_CLKGEN_CCTRL_CORESEL_M                0x00000001
+#define AM_REG_CLKGEN_CCTRL_CORESEL(n)               (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_CLKGEN_CCTRL_CORESEL_HFRC             0x00000000
+#define AM_REG_CLKGEN_CCTRL_CORESEL_HFRC_DIV2        0x00000001
+
+//*****************************************************************************
+//
+// CLKGEN_STATUS - Clock Generator Status
+//
+//*****************************************************************************
+// XT Oscillator is enabled but not oscillating
+#define AM_REG_CLKGEN_STATUS_OSCF_S                  1
+#define AM_REG_CLKGEN_STATUS_OSCF_M                  0x00000002
+#define AM_REG_CLKGEN_STATUS_OSCF(n)                 (((uint32_t)(n) << 1) & 0x00000002)
+
+// Current RTC oscillator (1 => LFRC, 0 => XT)
+#define AM_REG_CLKGEN_STATUS_OMODE_S                 0
+#define AM_REG_CLKGEN_STATUS_OMODE_M                 0x00000001
+#define AM_REG_CLKGEN_STATUS_OMODE(n)                (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// CLKGEN_HFADJ - HFRC Adjustment
+//
+//*****************************************************************************
+// Gain control for HFRC adjustment
+#define AM_REG_CLKGEN_HFADJ_HFADJ_GAIN_S             21
+#define AM_REG_CLKGEN_HFADJ_HFADJ_GAIN_M             0x00E00000
+#define AM_REG_CLKGEN_HFADJ_HFADJ_GAIN(n)            (((uint32_t)(n) << 21) & 0x00E00000)
+#define AM_REG_CLKGEN_HFADJ_HFADJ_GAIN_Gain_of_1     0x00000000
+#define AM_REG_CLKGEN_HFADJ_HFADJ_GAIN_Gain_of_1_in_2 0x00200000
+#define AM_REG_CLKGEN_HFADJ_HFADJ_GAIN_Gain_of_1_in_4 0x00400000
+#define AM_REG_CLKGEN_HFADJ_HFADJ_GAIN_Gain_of_1_in_8 0x00600000
+#define AM_REG_CLKGEN_HFADJ_HFADJ_GAIN_Gain_of_1_in_16 0x00800000
+#define AM_REG_CLKGEN_HFADJ_HFADJ_GAIN_Gain_of_1_in_32 0x00A00000
+
+// XT warmup period for HFRC adjustment
+#define AM_REG_CLKGEN_HFADJ_HFWARMUP_S               20
+#define AM_REG_CLKGEN_HFADJ_HFWARMUP_M               0x00100000
+#define AM_REG_CLKGEN_HFADJ_HFWARMUP(n)              (((uint32_t)(n) << 20) & 0x00100000)
+#define AM_REG_CLKGEN_HFADJ_HFWARMUP_1SEC            0x00000000
+#define AM_REG_CLKGEN_HFADJ_HFWARMUP_2SEC            0x00100000
+
+// Target HFRC adjustment value.
+#define AM_REG_CLKGEN_HFADJ_HFXTADJ_S                8
+#define AM_REG_CLKGEN_HFADJ_HFXTADJ_M                0x000FFF00
+#define AM_REG_CLKGEN_HFADJ_HFXTADJ(n)               (((uint32_t)(n) << 8) & 0x000FFF00)
+
+// Repeat period for HFRC adjustment
+#define AM_REG_CLKGEN_HFADJ_HFADJCK_S                1
+#define AM_REG_CLKGEN_HFADJ_HFADJCK_M                0x0000000E
+#define AM_REG_CLKGEN_HFADJ_HFADJCK(n)               (((uint32_t)(n) << 1) & 0x0000000E)
+#define AM_REG_CLKGEN_HFADJ_HFADJCK_4SEC             0x00000000
+#define AM_REG_CLKGEN_HFADJ_HFADJCK_16SEC            0x00000002
+#define AM_REG_CLKGEN_HFADJ_HFADJCK_32SEC            0x00000004
+#define AM_REG_CLKGEN_HFADJ_HFADJCK_64SEC            0x00000006
+#define AM_REG_CLKGEN_HFADJ_HFADJCK_128SEC           0x00000008
+#define AM_REG_CLKGEN_HFADJ_HFADJCK_256SEC           0x0000000A
+#define AM_REG_CLKGEN_HFADJ_HFADJCK_512SEC           0x0000000C
+#define AM_REG_CLKGEN_HFADJ_HFADJCK_1024SEC          0x0000000E
+
+// HFRC adjustment control
+#define AM_REG_CLKGEN_HFADJ_HFADJEN_S                0
+#define AM_REG_CLKGEN_HFADJ_HFADJEN_M                0x00000001
+#define AM_REG_CLKGEN_HFADJ_HFADJEN(n)               (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_CLKGEN_HFADJ_HFADJEN_DIS              0x00000000
+#define AM_REG_CLKGEN_HFADJ_HFADJEN_EN               0x00000001
+
+//*****************************************************************************
+//
+// CLKGEN_HFVAL - HFADJ readback
+//
+//*****************************************************************************
+// Current HFTUNE value
+#define AM_REG_CLKGEN_HFVAL_HFTUNERB_S               0
+#define AM_REG_CLKGEN_HFVAL_HFTUNERB_M               0x000007FF
+#define AM_REG_CLKGEN_HFVAL_HFTUNERB(n)              (((uint32_t)(n) << 0) & 0x000007FF)
+
+//*****************************************************************************
+//
+// CLKGEN_CLOCKEN - Clock Enable Status
+//
+//*****************************************************************************
+// Clock enable status
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN_S              0
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN_M              0xFFFFFFFF
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN(n)             (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN_ADC_CLKEN      0x00000001
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN_CTIMER_CLKEN   0x00000002
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN_CTIMER0A_CLKEN 0x00000004
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN_CTIMER0B_CLKEN 0x00000008
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN_CTIMER1A_CLKEN 0x00000010
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN_CTIMER1B_CLKEN 0x00000020
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN_CTIMER2A_CLKEN 0x00000040
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN_CTIMER2B_CLKEN 0x00000080
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN_CTIMER3A_CLKEN 0x00000100
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN_CTIMER3B_CLKEN 0x00000200
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN_IOMSTR0_CLKEN  0x00000400
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN_IOMSTR1_CLKEN  0x00000800
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN_IOMSTR2_CLKEN  0x00001000
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN_IOMSTR3_CLKEN  0x00002000
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN_IOMSTR4_CLKEN  0x00004000
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN_IOMSTR5_CLKEN  0x00008000
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN_IOMSTRIFC0_CLKEN 0x00010000
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN_IOMSTRIFC1_CLKEN 0x00020000
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN_IOMSTRIFC2_CLKEN 0x00040000
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN_IOMSTRIFC3_CLKEN 0x00080000
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN_IOMSTRIFC4_CLKEN 0x00100000
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN_IOMSTRIFC5_CLKEN 0x00200000
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN_IOSLAVE_CLKEN  0x00400000
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN_PDM_CLKEN      0x00800000
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN_PDMIFC_CLKEN   0x01000000
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN_RSTGEN_CLKEN   0x02000000
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN_SRAM_WIPE_CLKEN 0x04000000
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN_STIMER_CLKEN   0x08000000
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN_STIMER_CNT_CLKEN 0x10000000
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN_TPIU_CLKEN     0x20000000
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN_UART0_HCLK_CLKEN 0x40000000
+#define AM_REG_CLKGEN_CLOCKEN_CLOCKEN_UART0HF_CLKEN  0x80000000
+
+//*****************************************************************************
+//
+// CLKGEN_CLOCKEN2 - Clock Enable Status
+//
+//*****************************************************************************
+// Clock enable status 2
+#define AM_REG_CLKGEN_CLOCKEN2_CLOCKEN2_S            0
+#define AM_REG_CLKGEN_CLOCKEN2_CLOCKEN2_M            0xFFFFFFFF
+#define AM_REG_CLKGEN_CLOCKEN2_CLOCKEN2(n)           (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+#define AM_REG_CLKGEN_CLOCKEN2_CLOCKEN2_UART1_HCLK_CLKEN 0x00000001
+#define AM_REG_CLKGEN_CLOCKEN2_CLOCKEN2_UART1HF_CLKEN 0x00000002
+#define AM_REG_CLKGEN_CLOCKEN2_CLOCKEN2_WDT_CLKEN    0x00000004
+#define AM_REG_CLKGEN_CLOCKEN2_CLOCKEN2_XT_32KHz_EN  0x40000000
+#define AM_REG_CLKGEN_CLOCKEN2_CLOCKEN2_FRCHFRC      0x80000000
+
+//*****************************************************************************
+//
+// CLKGEN_CLOCKEN3 - Clock Enable Status
+//
+//*****************************************************************************
+// Clock enable status 3
+#define AM_REG_CLKGEN_CLOCKEN3_CLOCKEN3_S            0
+#define AM_REG_CLKGEN_CLOCKEN3_CLOCKEN3_M            0xFFFFFFFF
+#define AM_REG_CLKGEN_CLOCKEN3_CLOCKEN3(n)           (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+#define AM_REG_CLKGEN_CLOCKEN3_CLOCKEN3_periph_all_xtal_en 0x01000000
+#define AM_REG_CLKGEN_CLOCKEN3_CLOCKEN3_periph_all_hfrc_en 0x02000000
+#define AM_REG_CLKGEN_CLOCKEN3_CLOCKEN3_HFADJEN      0x04000000
+#define AM_REG_CLKGEN_CLOCKEN3_CLOCKEN3_HFRC_en_out  0x08000000
+#define AM_REG_CLKGEN_CLOCKEN3_CLOCKEN3_RTC_SOURCE   0x10000000
+#define AM_REG_CLKGEN_CLOCKEN3_CLOCKEN3_XTAL_EN      0x20000000
+#define AM_REG_CLKGEN_CLOCKEN3_CLOCKEN3_HFRC_EN      0x40000000
+#define AM_REG_CLKGEN_CLOCKEN3_CLOCKEN3_FLASHCLK_EN  0x80000000
+
+//*****************************************************************************
+//
+// CLKGEN_UARTEN - UART Enable
+//
+//*****************************************************************************
+// UART1 system clock control
+#define AM_REG_CLKGEN_UARTEN_UART1EN_S               8
+#define AM_REG_CLKGEN_UARTEN_UART1EN_M               0x00000300
+#define AM_REG_CLKGEN_UARTEN_UART1EN(n)              (((uint32_t)(n) << 8) & 0x00000300)
+#define AM_REG_CLKGEN_UARTEN_UART1EN_DIS             0x00000000
+#define AM_REG_CLKGEN_UARTEN_UART1EN_EN              0x00000100
+#define AM_REG_CLKGEN_UARTEN_UART1EN_REDUCE_FREQ     0x00000200
+#define AM_REG_CLKGEN_UARTEN_UART1EN_EN_POWER_SAV    0x00000300
+
+// UART0 system clock control
+#define AM_REG_CLKGEN_UARTEN_UART0EN_S               0
+#define AM_REG_CLKGEN_UARTEN_UART0EN_M               0x00000003
+#define AM_REG_CLKGEN_UARTEN_UART0EN(n)              (((uint32_t)(n) << 0) & 0x00000003)
+#define AM_REG_CLKGEN_UARTEN_UART0EN_DIS             0x00000000
+#define AM_REG_CLKGEN_UARTEN_UART0EN_EN              0x00000001
+#define AM_REG_CLKGEN_UARTEN_UART0EN_REDUCE_FREQ     0x00000002
+#define AM_REG_CLKGEN_UARTEN_UART0EN_EN_POWER_SAV    0x00000003
+
+#endif // AM_REG_CLKGEN_H
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_ctimer.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_ctimer.h
new file mode 100644
index 000000000..bc465cab3
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_ctimer.h
@@ -0,0 +1,1914 @@
+//*****************************************************************************
+//
+//! @file am_reg_ctimer.h
+//!
+//! @brief Register macros for the CTIMER module
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_REG_CTIMER_H
+#define AM_REG_CTIMER_H
+
+//*****************************************************************************
+//
+// Instance finder. (1 instance(s) available)
+//
+//*****************************************************************************
+#define AM_REG_CTIMER_NUM_MODULES                    1
+#define AM_REG_CTIMERn(n) \
+    (REG_CTIMER_BASEADDR + 0x00000000 * n)
+
+//*****************************************************************************
+//
+// Register offsets.
+//
+//*****************************************************************************
+#define AM_REG_CTIMER_TMR0_O                         0x00000000
+#define AM_REG_CTIMER_CMPRA0_O                       0x00000004
+#define AM_REG_CTIMER_CMPRB0_O                       0x00000008
+#define AM_REG_CTIMER_CTRL0_O                        0x0000000C
+#define AM_REG_CTIMER_TMR1_O                         0x00000010
+#define AM_REG_CTIMER_CMPRA1_O                       0x00000014
+#define AM_REG_CTIMER_CMPRB1_O                       0x00000018
+#define AM_REG_CTIMER_CTRL1_O                        0x0000001C
+#define AM_REG_CTIMER_TMR2_O                         0x00000020
+#define AM_REG_CTIMER_CMPRA2_O                       0x00000024
+#define AM_REG_CTIMER_CMPRB2_O                       0x00000028
+#define AM_REG_CTIMER_CTRL2_O                        0x0000002C
+#define AM_REG_CTIMER_TMR3_O                         0x00000030
+#define AM_REG_CTIMER_CMPRA3_O                       0x00000034
+#define AM_REG_CTIMER_CMPRB3_O                       0x00000038
+#define AM_REG_CTIMER_CTRL3_O                        0x0000003C
+#define AM_REG_CTIMER_STCFG_O                        0x00000100
+#define AM_REG_CTIMER_STTMR_O                        0x00000104
+#define AM_REG_CTIMER_CAPTURE_CONTROL_O              0x00000108
+#define AM_REG_CTIMER_SCMPR0_O                       0x00000110
+#define AM_REG_CTIMER_SCMPR1_O                       0x00000114
+#define AM_REG_CTIMER_SCMPR2_O                       0x00000118
+#define AM_REG_CTIMER_SCMPR3_O                       0x0000011C
+#define AM_REG_CTIMER_SCMPR4_O                       0x00000120
+#define AM_REG_CTIMER_SCMPR5_O                       0x00000124
+#define AM_REG_CTIMER_SCMPR6_O                       0x00000128
+#define AM_REG_CTIMER_SCMPR7_O                       0x0000012C
+#define AM_REG_CTIMER_SCAPT0_O                       0x000001E0
+#define AM_REG_CTIMER_SCAPT1_O                       0x000001E4
+#define AM_REG_CTIMER_SCAPT2_O                       0x000001E8
+#define AM_REG_CTIMER_SCAPT3_O                       0x000001EC
+#define AM_REG_CTIMER_SNVR0_O                        0x000001F0
+#define AM_REG_CTIMER_SNVR1_O                        0x000001F4
+#define AM_REG_CTIMER_SNVR2_O                        0x000001F8
+#define AM_REG_CTIMER_INTEN_O                        0x00000200
+#define AM_REG_CTIMER_INTSTAT_O                      0x00000204
+#define AM_REG_CTIMER_INTCLR_O                       0x00000208
+#define AM_REG_CTIMER_INTSET_O                       0x0000020C
+#define AM_REG_CTIMER_STMINTEN_O                     0x00000300
+#define AM_REG_CTIMER_STMINTSTAT_O                   0x00000304
+#define AM_REG_CTIMER_STMINTCLR_O                    0x00000308
+#define AM_REG_CTIMER_STMINTSET_O                    0x0000030C
+
+//*****************************************************************************
+//
+// CTIMER_INTEN - Counter/Timer Interrupts: Enable
+//
+//*****************************************************************************
+// Counter/Timer B3 interrupt based on COMPR1.
+#define AM_REG_CTIMER_INTEN_CTMRB3C1INT_S            15
+#define AM_REG_CTIMER_INTEN_CTMRB3C1INT_M            0x00008000
+#define AM_REG_CTIMER_INTEN_CTMRB3C1INT(n)           (((uint32_t)(n) << 15) & 0x00008000)
+
+// Counter/Timer A3 interrupt based on COMPR1.
+#define AM_REG_CTIMER_INTEN_CTMRA3C1INT_S            14
+#define AM_REG_CTIMER_INTEN_CTMRA3C1INT_M            0x00004000
+#define AM_REG_CTIMER_INTEN_CTMRA3C1INT(n)           (((uint32_t)(n) << 14) & 0x00004000)
+
+// Counter/Timer B2 interrupt based on COMPR1.
+#define AM_REG_CTIMER_INTEN_CTMRB2C1INT_S            13
+#define AM_REG_CTIMER_INTEN_CTMRB2C1INT_M            0x00002000
+#define AM_REG_CTIMER_INTEN_CTMRB2C1INT(n)           (((uint32_t)(n) << 13) & 0x00002000)
+
+// Counter/Timer A2 interrupt based on COMPR1.
+#define AM_REG_CTIMER_INTEN_CTMRA2C1INT_S            12
+#define AM_REG_CTIMER_INTEN_CTMRA2C1INT_M            0x00001000
+#define AM_REG_CTIMER_INTEN_CTMRA2C1INT(n)           (((uint32_t)(n) << 12) & 0x00001000)
+
+// Counter/Timer B1 interrupt based on COMPR1.
+#define AM_REG_CTIMER_INTEN_CTMRB1C1INT_S            11
+#define AM_REG_CTIMER_INTEN_CTMRB1C1INT_M            0x00000800
+#define AM_REG_CTIMER_INTEN_CTMRB1C1INT(n)           (((uint32_t)(n) << 11) & 0x00000800)
+
+// Counter/Timer A1 interrupt based on COMPR1.
+#define AM_REG_CTIMER_INTEN_CTMRA1C1INT_S            10
+#define AM_REG_CTIMER_INTEN_CTMRA1C1INT_M            0x00000400
+#define AM_REG_CTIMER_INTEN_CTMRA1C1INT(n)           (((uint32_t)(n) << 10) & 0x00000400)
+
+// Counter/Timer B0 interrupt based on COMPR1.
+#define AM_REG_CTIMER_INTEN_CTMRB0C1INT_S            9
+#define AM_REG_CTIMER_INTEN_CTMRB0C1INT_M            0x00000200
+#define AM_REG_CTIMER_INTEN_CTMRB0C1INT(n)           (((uint32_t)(n) << 9) & 0x00000200)
+
+// Counter/Timer A0 interrupt based on COMPR1.
+#define AM_REG_CTIMER_INTEN_CTMRA0C1INT_S            8
+#define AM_REG_CTIMER_INTEN_CTMRA0C1INT_M            0x00000100
+#define AM_REG_CTIMER_INTEN_CTMRA0C1INT(n)           (((uint32_t)(n) << 8) & 0x00000100)
+
+// Counter/Timer B3 interrupt based on COMPR0.
+#define AM_REG_CTIMER_INTEN_CTMRB3C0INT_S            7
+#define AM_REG_CTIMER_INTEN_CTMRB3C0INT_M            0x00000080
+#define AM_REG_CTIMER_INTEN_CTMRB3C0INT(n)           (((uint32_t)(n) << 7) & 0x00000080)
+
+// Counter/Timer A3 interrupt based on COMPR0.
+#define AM_REG_CTIMER_INTEN_CTMRA3C0INT_S            6
+#define AM_REG_CTIMER_INTEN_CTMRA3C0INT_M            0x00000040
+#define AM_REG_CTIMER_INTEN_CTMRA3C0INT(n)           (((uint32_t)(n) << 6) & 0x00000040)
+
+// Counter/Timer B2 interrupt based on COMPR0.
+#define AM_REG_CTIMER_INTEN_CTMRB2C0INT_S            5
+#define AM_REG_CTIMER_INTEN_CTMRB2C0INT_M            0x00000020
+#define AM_REG_CTIMER_INTEN_CTMRB2C0INT(n)           (((uint32_t)(n) << 5) & 0x00000020)
+
+// Counter/Timer A2 interrupt based on COMPR0.
+#define AM_REG_CTIMER_INTEN_CTMRA2C0INT_S            4
+#define AM_REG_CTIMER_INTEN_CTMRA2C0INT_M            0x00000010
+#define AM_REG_CTIMER_INTEN_CTMRA2C0INT(n)           (((uint32_t)(n) << 4) & 0x00000010)
+
+// Counter/Timer B1 interrupt based on COMPR0.
+#define AM_REG_CTIMER_INTEN_CTMRB1C0INT_S            3
+#define AM_REG_CTIMER_INTEN_CTMRB1C0INT_M            0x00000008
+#define AM_REG_CTIMER_INTEN_CTMRB1C0INT(n)           (((uint32_t)(n) << 3) & 0x00000008)
+
+// Counter/Timer A1 interrupt based on COMPR0.
+#define AM_REG_CTIMER_INTEN_CTMRA1C0INT_S            2
+#define AM_REG_CTIMER_INTEN_CTMRA1C0INT_M            0x00000004
+#define AM_REG_CTIMER_INTEN_CTMRA1C0INT(n)           (((uint32_t)(n) << 2) & 0x00000004)
+
+// Counter/Timer B0 interrupt based on COMPR0.
+#define AM_REG_CTIMER_INTEN_CTMRB0C0INT_S            1
+#define AM_REG_CTIMER_INTEN_CTMRB0C0INT_M            0x00000002
+#define AM_REG_CTIMER_INTEN_CTMRB0C0INT(n)           (((uint32_t)(n) << 1) & 0x00000002)
+
+// Counter/Timer A0 interrupt based on COMPR0.
+#define AM_REG_CTIMER_INTEN_CTMRA0C0INT_S            0
+#define AM_REG_CTIMER_INTEN_CTMRA0C0INT_M            0x00000001
+#define AM_REG_CTIMER_INTEN_CTMRA0C0INT(n)           (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// CTIMER_INTSTAT - Counter/Timer Interrupts: Status
+//
+//*****************************************************************************
+// Counter/Timer B3 interrupt based on COMPR1.
+#define AM_REG_CTIMER_INTSTAT_CTMRB3C1INT_S          15
+#define AM_REG_CTIMER_INTSTAT_CTMRB3C1INT_M          0x00008000
+#define AM_REG_CTIMER_INTSTAT_CTMRB3C1INT(n)         (((uint32_t)(n) << 15) & 0x00008000)
+
+// Counter/Timer A3 interrupt based on COMPR1.
+#define AM_REG_CTIMER_INTSTAT_CTMRA3C1INT_S          14
+#define AM_REG_CTIMER_INTSTAT_CTMRA3C1INT_M          0x00004000
+#define AM_REG_CTIMER_INTSTAT_CTMRA3C1INT(n)         (((uint32_t)(n) << 14) & 0x00004000)
+
+// Counter/Timer B2 interrupt based on COMPR1.
+#define AM_REG_CTIMER_INTSTAT_CTMRB2C1INT_S          13
+#define AM_REG_CTIMER_INTSTAT_CTMRB2C1INT_M          0x00002000
+#define AM_REG_CTIMER_INTSTAT_CTMRB2C1INT(n)         (((uint32_t)(n) << 13) & 0x00002000)
+
+// Counter/Timer A2 interrupt based on COMPR1.
+#define AM_REG_CTIMER_INTSTAT_CTMRA2C1INT_S          12
+#define AM_REG_CTIMER_INTSTAT_CTMRA2C1INT_M          0x00001000
+#define AM_REG_CTIMER_INTSTAT_CTMRA2C1INT(n)         (((uint32_t)(n) << 12) & 0x00001000)
+
+// Counter/Timer B1 interrupt based on COMPR1.
+#define AM_REG_CTIMER_INTSTAT_CTMRB1C1INT_S          11
+#define AM_REG_CTIMER_INTSTAT_CTMRB1C1INT_M          0x00000800
+#define AM_REG_CTIMER_INTSTAT_CTMRB1C1INT(n)         (((uint32_t)(n) << 11) & 0x00000800)
+
+// Counter/Timer A1 interrupt based on COMPR1.
+#define AM_REG_CTIMER_INTSTAT_CTMRA1C1INT_S          10
+#define AM_REG_CTIMER_INTSTAT_CTMRA1C1INT_M          0x00000400
+#define AM_REG_CTIMER_INTSTAT_CTMRA1C1INT(n)         (((uint32_t)(n) << 10) & 0x00000400)
+
+// Counter/Timer B0 interrupt based on COMPR1.
+#define AM_REG_CTIMER_INTSTAT_CTMRB0C1INT_S          9
+#define AM_REG_CTIMER_INTSTAT_CTMRB0C1INT_M          0x00000200
+#define AM_REG_CTIMER_INTSTAT_CTMRB0C1INT(n)         (((uint32_t)(n) << 9) & 0x00000200)
+
+// Counter/Timer A0 interrupt based on COMPR1.
+#define AM_REG_CTIMER_INTSTAT_CTMRA0C1INT_S          8
+#define AM_REG_CTIMER_INTSTAT_CTMRA0C1INT_M          0x00000100
+#define AM_REG_CTIMER_INTSTAT_CTMRA0C1INT(n)         (((uint32_t)(n) << 8) & 0x00000100)
+
+// Counter/Timer B3 interrupt based on COMPR0.
+#define AM_REG_CTIMER_INTSTAT_CTMRB3C0INT_S          7
+#define AM_REG_CTIMER_INTSTAT_CTMRB3C0INT_M          0x00000080
+#define AM_REG_CTIMER_INTSTAT_CTMRB3C0INT(n)         (((uint32_t)(n) << 7) & 0x00000080)
+
+// Counter/Timer A3 interrupt based on COMPR0.
+#define AM_REG_CTIMER_INTSTAT_CTMRA3C0INT_S          6
+#define AM_REG_CTIMER_INTSTAT_CTMRA3C0INT_M          0x00000040
+#define AM_REG_CTIMER_INTSTAT_CTMRA3C0INT(n)         (((uint32_t)(n) << 6) & 0x00000040)
+
+// Counter/Timer B2 interrupt based on COMPR0.
+#define AM_REG_CTIMER_INTSTAT_CTMRB2C0INT_S          5
+#define AM_REG_CTIMER_INTSTAT_CTMRB2C0INT_M          0x00000020
+#define AM_REG_CTIMER_INTSTAT_CTMRB2C0INT(n)         (((uint32_t)(n) << 5) & 0x00000020)
+
+// Counter/Timer A2 interrupt based on COMPR0.
+#define AM_REG_CTIMER_INTSTAT_CTMRA2C0INT_S          4
+#define AM_REG_CTIMER_INTSTAT_CTMRA2C0INT_M          0x00000010
+#define AM_REG_CTIMER_INTSTAT_CTMRA2C0INT(n)         (((uint32_t)(n) << 4) & 0x00000010)
+
+// Counter/Timer B1 interrupt based on COMPR0.
+#define AM_REG_CTIMER_INTSTAT_CTMRB1C0INT_S          3
+#define AM_REG_CTIMER_INTSTAT_CTMRB1C0INT_M          0x00000008
+#define AM_REG_CTIMER_INTSTAT_CTMRB1C0INT(n)         (((uint32_t)(n) << 3) & 0x00000008)
+
+// Counter/Timer A1 interrupt based on COMPR0.
+#define AM_REG_CTIMER_INTSTAT_CTMRA1C0INT_S          2
+#define AM_REG_CTIMER_INTSTAT_CTMRA1C0INT_M          0x00000004
+#define AM_REG_CTIMER_INTSTAT_CTMRA1C0INT(n)         (((uint32_t)(n) << 2) & 0x00000004)
+
+// Counter/Timer B0 interrupt based on COMPR0.
+#define AM_REG_CTIMER_INTSTAT_CTMRB0C0INT_S          1
+#define AM_REG_CTIMER_INTSTAT_CTMRB0C0INT_M          0x00000002
+#define AM_REG_CTIMER_INTSTAT_CTMRB0C0INT(n)         (((uint32_t)(n) << 1) & 0x00000002)
+
+// Counter/Timer A0 interrupt based on COMPR0.
+#define AM_REG_CTIMER_INTSTAT_CTMRA0C0INT_S          0
+#define AM_REG_CTIMER_INTSTAT_CTMRA0C0INT_M          0x00000001
+#define AM_REG_CTIMER_INTSTAT_CTMRA0C0INT(n)         (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// CTIMER_INTCLR - Counter/Timer Interrupts: Clear
+//
+//*****************************************************************************
+// Counter/Timer B3 interrupt based on COMPR1.
+#define AM_REG_CTIMER_INTCLR_CTMRB3C1INT_S           15
+#define AM_REG_CTIMER_INTCLR_CTMRB3C1INT_M           0x00008000
+#define AM_REG_CTIMER_INTCLR_CTMRB3C1INT(n)          (((uint32_t)(n) << 15) & 0x00008000)
+
+// Counter/Timer A3 interrupt based on COMPR1.
+#define AM_REG_CTIMER_INTCLR_CTMRA3C1INT_S           14
+#define AM_REG_CTIMER_INTCLR_CTMRA3C1INT_M           0x00004000
+#define AM_REG_CTIMER_INTCLR_CTMRA3C1INT(n)          (((uint32_t)(n) << 14) & 0x00004000)
+
+// Counter/Timer B2 interrupt based on COMPR1.
+#define AM_REG_CTIMER_INTCLR_CTMRB2C1INT_S           13
+#define AM_REG_CTIMER_INTCLR_CTMRB2C1INT_M           0x00002000
+#define AM_REG_CTIMER_INTCLR_CTMRB2C1INT(n)          (((uint32_t)(n) << 13) & 0x00002000)
+
+// Counter/Timer A2 interrupt based on COMPR1.
+#define AM_REG_CTIMER_INTCLR_CTMRA2C1INT_S           12
+#define AM_REG_CTIMER_INTCLR_CTMRA2C1INT_M           0x00001000
+#define AM_REG_CTIMER_INTCLR_CTMRA2C1INT(n)          (((uint32_t)(n) << 12) & 0x00001000)
+
+// Counter/Timer B1 interrupt based on COMPR1.
+#define AM_REG_CTIMER_INTCLR_CTMRB1C1INT_S           11
+#define AM_REG_CTIMER_INTCLR_CTMRB1C1INT_M           0x00000800
+#define AM_REG_CTIMER_INTCLR_CTMRB1C1INT(n)          (((uint32_t)(n) << 11) & 0x00000800)
+
+// Counter/Timer A1 interrupt based on COMPR1.
+#define AM_REG_CTIMER_INTCLR_CTMRA1C1INT_S           10
+#define AM_REG_CTIMER_INTCLR_CTMRA1C1INT_M           0x00000400
+#define AM_REG_CTIMER_INTCLR_CTMRA1C1INT(n)          (((uint32_t)(n) << 10) & 0x00000400)
+
+// Counter/Timer B0 interrupt based on COMPR1.
+#define AM_REG_CTIMER_INTCLR_CTMRB0C1INT_S           9
+#define AM_REG_CTIMER_INTCLR_CTMRB0C1INT_M           0x00000200
+#define AM_REG_CTIMER_INTCLR_CTMRB0C1INT(n)          (((uint32_t)(n) << 9) & 0x00000200)
+
+// Counter/Timer A0 interrupt based on COMPR1.
+#define AM_REG_CTIMER_INTCLR_CTMRA0C1INT_S           8
+#define AM_REG_CTIMER_INTCLR_CTMRA0C1INT_M           0x00000100
+#define AM_REG_CTIMER_INTCLR_CTMRA0C1INT(n)          (((uint32_t)(n) << 8) & 0x00000100)
+
+// Counter/Timer B3 interrupt based on COMPR0.
+#define AM_REG_CTIMER_INTCLR_CTMRB3C0INT_S           7
+#define AM_REG_CTIMER_INTCLR_CTMRB3C0INT_M           0x00000080
+#define AM_REG_CTIMER_INTCLR_CTMRB3C0INT(n)          (((uint32_t)(n) << 7) & 0x00000080)
+
+// Counter/Timer A3 interrupt based on COMPR0.
+#define AM_REG_CTIMER_INTCLR_CTMRA3C0INT_S           6
+#define AM_REG_CTIMER_INTCLR_CTMRA3C0INT_M           0x00000040
+#define AM_REG_CTIMER_INTCLR_CTMRA3C0INT(n)          (((uint32_t)(n) << 6) & 0x00000040)
+
+// Counter/Timer B2 interrupt based on COMPR0.
+#define AM_REG_CTIMER_INTCLR_CTMRB2C0INT_S           5
+#define AM_REG_CTIMER_INTCLR_CTMRB2C0INT_M           0x00000020
+#define AM_REG_CTIMER_INTCLR_CTMRB2C0INT(n)          (((uint32_t)(n) << 5) & 0x00000020)
+
+// Counter/Timer A2 interrupt based on COMPR0.
+#define AM_REG_CTIMER_INTCLR_CTMRA2C0INT_S           4
+#define AM_REG_CTIMER_INTCLR_CTMRA2C0INT_M           0x00000010
+#define AM_REG_CTIMER_INTCLR_CTMRA2C0INT(n)          (((uint32_t)(n) << 4) & 0x00000010)
+
+// Counter/Timer B1 interrupt based on COMPR0.
+#define AM_REG_CTIMER_INTCLR_CTMRB1C0INT_S           3
+#define AM_REG_CTIMER_INTCLR_CTMRB1C0INT_M           0x00000008
+#define AM_REG_CTIMER_INTCLR_CTMRB1C0INT(n)          (((uint32_t)(n) << 3) & 0x00000008)
+
+// Counter/Timer A1 interrupt based on COMPR0.
+#define AM_REG_CTIMER_INTCLR_CTMRA1C0INT_S           2
+#define AM_REG_CTIMER_INTCLR_CTMRA1C0INT_M           0x00000004
+#define AM_REG_CTIMER_INTCLR_CTMRA1C0INT(n)          (((uint32_t)(n) << 2) & 0x00000004)
+
+// Counter/Timer B0 interrupt based on COMPR0.
+#define AM_REG_CTIMER_INTCLR_CTMRB0C0INT_S           1
+#define AM_REG_CTIMER_INTCLR_CTMRB0C0INT_M           0x00000002
+#define AM_REG_CTIMER_INTCLR_CTMRB0C0INT(n)          (((uint32_t)(n) << 1) & 0x00000002)
+
+// Counter/Timer A0 interrupt based on COMPR0.
+#define AM_REG_CTIMER_INTCLR_CTMRA0C0INT_S           0
+#define AM_REG_CTIMER_INTCLR_CTMRA0C0INT_M           0x00000001
+#define AM_REG_CTIMER_INTCLR_CTMRA0C0INT(n)          (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// CTIMER_INTSET - Counter/Timer Interrupts: Set
+//
+//*****************************************************************************
+// Counter/Timer B3 interrupt based on COMPR1.
+#define AM_REG_CTIMER_INTSET_CTMRB3C1INT_S           15
+#define AM_REG_CTIMER_INTSET_CTMRB3C1INT_M           0x00008000
+#define AM_REG_CTIMER_INTSET_CTMRB3C1INT(n)          (((uint32_t)(n) << 15) & 0x00008000)
+
+// Counter/Timer A3 interrupt based on COMPR1.
+#define AM_REG_CTIMER_INTSET_CTMRA3C1INT_S           14
+#define AM_REG_CTIMER_INTSET_CTMRA3C1INT_M           0x00004000
+#define AM_REG_CTIMER_INTSET_CTMRA3C1INT(n)          (((uint32_t)(n) << 14) & 0x00004000)
+
+// Counter/Timer B2 interrupt based on COMPR1.
+#define AM_REG_CTIMER_INTSET_CTMRB2C1INT_S           13
+#define AM_REG_CTIMER_INTSET_CTMRB2C1INT_M           0x00002000
+#define AM_REG_CTIMER_INTSET_CTMRB2C1INT(n)          (((uint32_t)(n) << 13) & 0x00002000)
+
+// Counter/Timer A2 interrupt based on COMPR1.
+#define AM_REG_CTIMER_INTSET_CTMRA2C1INT_S           12
+#define AM_REG_CTIMER_INTSET_CTMRA2C1INT_M           0x00001000
+#define AM_REG_CTIMER_INTSET_CTMRA2C1INT(n)          (((uint32_t)(n) << 12) & 0x00001000)
+
+// Counter/Timer B1 interrupt based on COMPR1.
+#define AM_REG_CTIMER_INTSET_CTMRB1C1INT_S           11
+#define AM_REG_CTIMER_INTSET_CTMRB1C1INT_M           0x00000800
+#define AM_REG_CTIMER_INTSET_CTMRB1C1INT(n)          (((uint32_t)(n) << 11) & 0x00000800)
+
+// Counter/Timer A1 interrupt based on COMPR1.
+#define AM_REG_CTIMER_INTSET_CTMRA1C1INT_S           10
+#define AM_REG_CTIMER_INTSET_CTMRA1C1INT_M           0x00000400
+#define AM_REG_CTIMER_INTSET_CTMRA1C1INT(n)          (((uint32_t)(n) << 10) & 0x00000400)
+
+// Counter/Timer B0 interrupt based on COMPR1.
+#define AM_REG_CTIMER_INTSET_CTMRB0C1INT_S           9
+#define AM_REG_CTIMER_INTSET_CTMRB0C1INT_M           0x00000200
+#define AM_REG_CTIMER_INTSET_CTMRB0C1INT(n)          (((uint32_t)(n) << 9) & 0x00000200)
+
+// Counter/Timer A0 interrupt based on COMPR1.
+#define AM_REG_CTIMER_INTSET_CTMRA0C1INT_S           8
+#define AM_REG_CTIMER_INTSET_CTMRA0C1INT_M           0x00000100
+#define AM_REG_CTIMER_INTSET_CTMRA0C1INT(n)          (((uint32_t)(n) << 8) & 0x00000100)
+
+// Counter/Timer B3 interrupt based on COMPR0.
+#define AM_REG_CTIMER_INTSET_CTMRB3C0INT_S           7
+#define AM_REG_CTIMER_INTSET_CTMRB3C0INT_M           0x00000080
+#define AM_REG_CTIMER_INTSET_CTMRB3C0INT(n)          (((uint32_t)(n) << 7) & 0x00000080)
+
+// Counter/Timer A3 interrupt based on COMPR0.
+#define AM_REG_CTIMER_INTSET_CTMRA3C0INT_S           6
+#define AM_REG_CTIMER_INTSET_CTMRA3C0INT_M           0x00000040
+#define AM_REG_CTIMER_INTSET_CTMRA3C0INT(n)          (((uint32_t)(n) << 6) & 0x00000040)
+
+// Counter/Timer B2 interrupt based on COMPR0.
+#define AM_REG_CTIMER_INTSET_CTMRB2C0INT_S           5
+#define AM_REG_CTIMER_INTSET_CTMRB2C0INT_M           0x00000020
+#define AM_REG_CTIMER_INTSET_CTMRB2C0INT(n)          (((uint32_t)(n) << 5) & 0x00000020)
+
+// Counter/Timer A2 interrupt based on COMPR0.
+#define AM_REG_CTIMER_INTSET_CTMRA2C0INT_S           4
+#define AM_REG_CTIMER_INTSET_CTMRA2C0INT_M           0x00000010
+#define AM_REG_CTIMER_INTSET_CTMRA2C0INT(n)          (((uint32_t)(n) << 4) & 0x00000010)
+
+// Counter/Timer B1 interrupt based on COMPR0.
+#define AM_REG_CTIMER_INTSET_CTMRB1C0INT_S           3
+#define AM_REG_CTIMER_INTSET_CTMRB1C0INT_M           0x00000008
+#define AM_REG_CTIMER_INTSET_CTMRB1C0INT(n)          (((uint32_t)(n) << 3) & 0x00000008)
+
+// Counter/Timer A1 interrupt based on COMPR0.
+#define AM_REG_CTIMER_INTSET_CTMRA1C0INT_S           2
+#define AM_REG_CTIMER_INTSET_CTMRA1C0INT_M           0x00000004
+#define AM_REG_CTIMER_INTSET_CTMRA1C0INT(n)          (((uint32_t)(n) << 2) & 0x00000004)
+
+// Counter/Timer B0 interrupt based on COMPR0.
+#define AM_REG_CTIMER_INTSET_CTMRB0C0INT_S           1
+#define AM_REG_CTIMER_INTSET_CTMRB0C0INT_M           0x00000002
+#define AM_REG_CTIMER_INTSET_CTMRB0C0INT(n)          (((uint32_t)(n) << 1) & 0x00000002)
+
+// Counter/Timer A0 interrupt based on COMPR0.
+#define AM_REG_CTIMER_INTSET_CTMRA0C0INT_S           0
+#define AM_REG_CTIMER_INTSET_CTMRA0C0INT_M           0x00000001
+#define AM_REG_CTIMER_INTSET_CTMRA0C0INT(n)          (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// CTIMER_STMINTEN - STIMER Interrupt registers: Enable
+//
+//*****************************************************************************
+// CAPTURE register D has grabbed the value in the counter
+#define AM_REG_CTIMER_STMINTEN_CAPTURED_S            12
+#define AM_REG_CTIMER_STMINTEN_CAPTURED_M            0x00001000
+#define AM_REG_CTIMER_STMINTEN_CAPTURED(n)           (((uint32_t)(n) << 12) & 0x00001000)
+#define AM_REG_CTIMER_STMINTEN_CAPTURED_CAPD_INT     0x00001000
+
+// CAPTURE register C has grabbed the value in the counter
+#define AM_REG_CTIMER_STMINTEN_CAPTUREC_S            11
+#define AM_REG_CTIMER_STMINTEN_CAPTUREC_M            0x00000800
+#define AM_REG_CTIMER_STMINTEN_CAPTUREC(n)           (((uint32_t)(n) << 11) & 0x00000800)
+#define AM_REG_CTIMER_STMINTEN_CAPTUREC_CAPC_INT     0x00000800
+
+// CAPTURE register B has grabbed the value in the counter
+#define AM_REG_CTIMER_STMINTEN_CAPTUREB_S            10
+#define AM_REG_CTIMER_STMINTEN_CAPTUREB_M            0x00000400
+#define AM_REG_CTIMER_STMINTEN_CAPTUREB(n)           (((uint32_t)(n) << 10) & 0x00000400)
+#define AM_REG_CTIMER_STMINTEN_CAPTUREB_CAPB_INT     0x00000400
+
+// CAPTURE register A has grabbed the value in the counter
+#define AM_REG_CTIMER_STMINTEN_CAPTUREA_S            9
+#define AM_REG_CTIMER_STMINTEN_CAPTUREA_M            0x00000200
+#define AM_REG_CTIMER_STMINTEN_CAPTUREA(n)           (((uint32_t)(n) << 9) & 0x00000200)
+#define AM_REG_CTIMER_STMINTEN_CAPTUREA_CAPA_INT     0x00000200
+
+// COUNTER over flowed from 0xFFFFFFFF back to 0x00000000.
+#define AM_REG_CTIMER_STMINTEN_OVERFLOW_S            8
+#define AM_REG_CTIMER_STMINTEN_OVERFLOW_M            0x00000100
+#define AM_REG_CTIMER_STMINTEN_OVERFLOW(n)           (((uint32_t)(n) << 8) & 0x00000100)
+#define AM_REG_CTIMER_STMINTEN_OVERFLOW_OFLOW_INT    0x00000100
+
+// COUNTER is greater than or equal to COMPARE register H.
+#define AM_REG_CTIMER_STMINTEN_COMPAREH_S            7
+#define AM_REG_CTIMER_STMINTEN_COMPAREH_M            0x00000080
+#define AM_REG_CTIMER_STMINTEN_COMPAREH(n)           (((uint32_t)(n) << 7) & 0x00000080)
+#define AM_REG_CTIMER_STMINTEN_COMPAREH_COMPARED     0x00000080
+
+// COUNTER is greater than or equal to COMPARE register G.
+#define AM_REG_CTIMER_STMINTEN_COMPAREG_S            6
+#define AM_REG_CTIMER_STMINTEN_COMPAREG_M            0x00000040
+#define AM_REG_CTIMER_STMINTEN_COMPAREG(n)           (((uint32_t)(n) << 6) & 0x00000040)
+#define AM_REG_CTIMER_STMINTEN_COMPAREG_COMPARED     0x00000040
+
+// COUNTER is greater than or equal to COMPARE register F.
+#define AM_REG_CTIMER_STMINTEN_COMPAREF_S            5
+#define AM_REG_CTIMER_STMINTEN_COMPAREF_M            0x00000020
+#define AM_REG_CTIMER_STMINTEN_COMPAREF(n)           (((uint32_t)(n) << 5) & 0x00000020)
+#define AM_REG_CTIMER_STMINTEN_COMPAREF_COMPARED     0x00000020
+
+// COUNTER is greater than or equal to COMPARE register E.
+#define AM_REG_CTIMER_STMINTEN_COMPAREE_S            4
+#define AM_REG_CTIMER_STMINTEN_COMPAREE_M            0x00000010
+#define AM_REG_CTIMER_STMINTEN_COMPAREE(n)           (((uint32_t)(n) << 4) & 0x00000010)
+#define AM_REG_CTIMER_STMINTEN_COMPAREE_COMPARED     0x00000010
+
+// COUNTER is greater than or equal to COMPARE register D.
+#define AM_REG_CTIMER_STMINTEN_COMPARED_S            3
+#define AM_REG_CTIMER_STMINTEN_COMPARED_M            0x00000008
+#define AM_REG_CTIMER_STMINTEN_COMPARED(n)           (((uint32_t)(n) << 3) & 0x00000008)
+#define AM_REG_CTIMER_STMINTEN_COMPARED_COMPARED     0x00000008
+
+// COUNTER is greater than or equal to COMPARE register C.
+#define AM_REG_CTIMER_STMINTEN_COMPAREC_S            2
+#define AM_REG_CTIMER_STMINTEN_COMPAREC_M            0x00000004
+#define AM_REG_CTIMER_STMINTEN_COMPAREC(n)           (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_CTIMER_STMINTEN_COMPAREC_COMPARED     0x00000004
+
+// COUNTER is greater than or equal to COMPARE register B.
+#define AM_REG_CTIMER_STMINTEN_COMPAREB_S            1
+#define AM_REG_CTIMER_STMINTEN_COMPAREB_M            0x00000002
+#define AM_REG_CTIMER_STMINTEN_COMPAREB(n)           (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_CTIMER_STMINTEN_COMPAREB_COMPARED     0x00000002
+
+// COUNTER is greater than or equal to COMPARE register A.
+#define AM_REG_CTIMER_STMINTEN_COMPAREA_S            0
+#define AM_REG_CTIMER_STMINTEN_COMPAREA_M            0x00000001
+#define AM_REG_CTIMER_STMINTEN_COMPAREA(n)           (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_CTIMER_STMINTEN_COMPAREA_COMPARED     0x00000001
+
+//*****************************************************************************
+//
+// CTIMER_STMINTSTAT - STIMER Interrupt registers: Status
+//
+//*****************************************************************************
+// CAPTURE register D has grabbed the value in the counter
+#define AM_REG_CTIMER_STMINTSTAT_CAPTURED_S          12
+#define AM_REG_CTIMER_STMINTSTAT_CAPTURED_M          0x00001000
+#define AM_REG_CTIMER_STMINTSTAT_CAPTURED(n)         (((uint32_t)(n) << 12) & 0x00001000)
+#define AM_REG_CTIMER_STMINTSTAT_CAPTURED_CAPD_INT   0x00001000
+
+// CAPTURE register C has grabbed the value in the counter
+#define AM_REG_CTIMER_STMINTSTAT_CAPTUREC_S          11
+#define AM_REG_CTIMER_STMINTSTAT_CAPTUREC_M          0x00000800
+#define AM_REG_CTIMER_STMINTSTAT_CAPTUREC(n)         (((uint32_t)(n) << 11) & 0x00000800)
+#define AM_REG_CTIMER_STMINTSTAT_CAPTUREC_CAPC_INT   0x00000800
+
+// CAPTURE register B has grabbed the value in the counter
+#define AM_REG_CTIMER_STMINTSTAT_CAPTUREB_S          10
+#define AM_REG_CTIMER_STMINTSTAT_CAPTUREB_M          0x00000400
+#define AM_REG_CTIMER_STMINTSTAT_CAPTUREB(n)         (((uint32_t)(n) << 10) & 0x00000400)
+#define AM_REG_CTIMER_STMINTSTAT_CAPTUREB_CAPB_INT   0x00000400
+
+// CAPTURE register A has grabbed the value in the counter
+#define AM_REG_CTIMER_STMINTSTAT_CAPTUREA_S          9
+#define AM_REG_CTIMER_STMINTSTAT_CAPTUREA_M          0x00000200
+#define AM_REG_CTIMER_STMINTSTAT_CAPTUREA(n)         (((uint32_t)(n) << 9) & 0x00000200)
+#define AM_REG_CTIMER_STMINTSTAT_CAPTUREA_CAPA_INT   0x00000200
+
+// COUNTER over flowed from 0xFFFFFFFF back to 0x00000000.
+#define AM_REG_CTIMER_STMINTSTAT_OVERFLOW_S          8
+#define AM_REG_CTIMER_STMINTSTAT_OVERFLOW_M          0x00000100
+#define AM_REG_CTIMER_STMINTSTAT_OVERFLOW(n)         (((uint32_t)(n) << 8) & 0x00000100)
+#define AM_REG_CTIMER_STMINTSTAT_OVERFLOW_OFLOW_INT  0x00000100
+
+// COUNTER is greater than or equal to COMPARE register H.
+#define AM_REG_CTIMER_STMINTSTAT_COMPAREH_S          7
+#define AM_REG_CTIMER_STMINTSTAT_COMPAREH_M          0x00000080
+#define AM_REG_CTIMER_STMINTSTAT_COMPAREH(n)         (((uint32_t)(n) << 7) & 0x00000080)
+#define AM_REG_CTIMER_STMINTSTAT_COMPAREH_COMPARED   0x00000080
+
+// COUNTER is greater than or equal to COMPARE register G.
+#define AM_REG_CTIMER_STMINTSTAT_COMPAREG_S          6
+#define AM_REG_CTIMER_STMINTSTAT_COMPAREG_M          0x00000040
+#define AM_REG_CTIMER_STMINTSTAT_COMPAREG(n)         (((uint32_t)(n) << 6) & 0x00000040)
+#define AM_REG_CTIMER_STMINTSTAT_COMPAREG_COMPARED   0x00000040
+
+// COUNTER is greater than or equal to COMPARE register F.
+#define AM_REG_CTIMER_STMINTSTAT_COMPAREF_S          5
+#define AM_REG_CTIMER_STMINTSTAT_COMPAREF_M          0x00000020
+#define AM_REG_CTIMER_STMINTSTAT_COMPAREF(n)         (((uint32_t)(n) << 5) & 0x00000020)
+#define AM_REG_CTIMER_STMINTSTAT_COMPAREF_COMPARED   0x00000020
+
+// COUNTER is greater than or equal to COMPARE register E.
+#define AM_REG_CTIMER_STMINTSTAT_COMPAREE_S          4
+#define AM_REG_CTIMER_STMINTSTAT_COMPAREE_M          0x00000010
+#define AM_REG_CTIMER_STMINTSTAT_COMPAREE(n)         (((uint32_t)(n) << 4) & 0x00000010)
+#define AM_REG_CTIMER_STMINTSTAT_COMPAREE_COMPARED   0x00000010
+
+// COUNTER is greater than or equal to COMPARE register D.
+#define AM_REG_CTIMER_STMINTSTAT_COMPARED_S          3
+#define AM_REG_CTIMER_STMINTSTAT_COMPARED_M          0x00000008
+#define AM_REG_CTIMER_STMINTSTAT_COMPARED(n)         (((uint32_t)(n) << 3) & 0x00000008)
+#define AM_REG_CTIMER_STMINTSTAT_COMPARED_COMPARED   0x00000008
+
+// COUNTER is greater than or equal to COMPARE register C.
+#define AM_REG_CTIMER_STMINTSTAT_COMPAREC_S          2
+#define AM_REG_CTIMER_STMINTSTAT_COMPAREC_M          0x00000004
+#define AM_REG_CTIMER_STMINTSTAT_COMPAREC(n)         (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_CTIMER_STMINTSTAT_COMPAREC_COMPARED   0x00000004
+
+// COUNTER is greater than or equal to COMPARE register B.
+#define AM_REG_CTIMER_STMINTSTAT_COMPAREB_S          1
+#define AM_REG_CTIMER_STMINTSTAT_COMPAREB_M          0x00000002
+#define AM_REG_CTIMER_STMINTSTAT_COMPAREB(n)         (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_CTIMER_STMINTSTAT_COMPAREB_COMPARED   0x00000002
+
+// COUNTER is greater than or equal to COMPARE register A.
+#define AM_REG_CTIMER_STMINTSTAT_COMPAREA_S          0
+#define AM_REG_CTIMER_STMINTSTAT_COMPAREA_M          0x00000001
+#define AM_REG_CTIMER_STMINTSTAT_COMPAREA(n)         (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_CTIMER_STMINTSTAT_COMPAREA_COMPARED   0x00000001
+
+//*****************************************************************************
+//
+// CTIMER_STMINTCLR - STIMER Interrupt registers: Clear
+//
+//*****************************************************************************
+// CAPTURE register D has grabbed the value in the counter
+#define AM_REG_CTIMER_STMINTCLR_CAPTURED_S           12
+#define AM_REG_CTIMER_STMINTCLR_CAPTURED_M           0x00001000
+#define AM_REG_CTIMER_STMINTCLR_CAPTURED(n)          (((uint32_t)(n) << 12) & 0x00001000)
+#define AM_REG_CTIMER_STMINTCLR_CAPTURED_CAPD_INT    0x00001000
+
+// CAPTURE register C has grabbed the value in the counter
+#define AM_REG_CTIMER_STMINTCLR_CAPTUREC_S           11
+#define AM_REG_CTIMER_STMINTCLR_CAPTUREC_M           0x00000800
+#define AM_REG_CTIMER_STMINTCLR_CAPTUREC(n)          (((uint32_t)(n) << 11) & 0x00000800)
+#define AM_REG_CTIMER_STMINTCLR_CAPTUREC_CAPC_INT    0x00000800
+
+// CAPTURE register B has grabbed the value in the counter
+#define AM_REG_CTIMER_STMINTCLR_CAPTUREB_S           10
+#define AM_REG_CTIMER_STMINTCLR_CAPTUREB_M           0x00000400
+#define AM_REG_CTIMER_STMINTCLR_CAPTUREB(n)          (((uint32_t)(n) << 10) & 0x00000400)
+#define AM_REG_CTIMER_STMINTCLR_CAPTUREB_CAPB_INT    0x00000400
+
+// CAPTURE register A has grabbed the value in the counter
+#define AM_REG_CTIMER_STMINTCLR_CAPTUREA_S           9
+#define AM_REG_CTIMER_STMINTCLR_CAPTUREA_M           0x00000200
+#define AM_REG_CTIMER_STMINTCLR_CAPTUREA(n)          (((uint32_t)(n) << 9) & 0x00000200)
+#define AM_REG_CTIMER_STMINTCLR_CAPTUREA_CAPA_INT    0x00000200
+
+// COUNTER over flowed from 0xFFFFFFFF back to 0x00000000.
+#define AM_REG_CTIMER_STMINTCLR_OVERFLOW_S           8
+#define AM_REG_CTIMER_STMINTCLR_OVERFLOW_M           0x00000100
+#define AM_REG_CTIMER_STMINTCLR_OVERFLOW(n)          (((uint32_t)(n) << 8) & 0x00000100)
+#define AM_REG_CTIMER_STMINTCLR_OVERFLOW_OFLOW_INT   0x00000100
+
+// COUNTER is greater than or equal to COMPARE register H.
+#define AM_REG_CTIMER_STMINTCLR_COMPAREH_S           7
+#define AM_REG_CTIMER_STMINTCLR_COMPAREH_M           0x00000080
+#define AM_REG_CTIMER_STMINTCLR_COMPAREH(n)          (((uint32_t)(n) << 7) & 0x00000080)
+#define AM_REG_CTIMER_STMINTCLR_COMPAREH_COMPARED    0x00000080
+
+// COUNTER is greater than or equal to COMPARE register G.
+#define AM_REG_CTIMER_STMINTCLR_COMPAREG_S           6
+#define AM_REG_CTIMER_STMINTCLR_COMPAREG_M           0x00000040
+#define AM_REG_CTIMER_STMINTCLR_COMPAREG(n)          (((uint32_t)(n) << 6) & 0x00000040)
+#define AM_REG_CTIMER_STMINTCLR_COMPAREG_COMPARED    0x00000040
+
+// COUNTER is greater than or equal to COMPARE register F.
+#define AM_REG_CTIMER_STMINTCLR_COMPAREF_S           5
+#define AM_REG_CTIMER_STMINTCLR_COMPAREF_M           0x00000020
+#define AM_REG_CTIMER_STMINTCLR_COMPAREF(n)          (((uint32_t)(n) << 5) & 0x00000020)
+#define AM_REG_CTIMER_STMINTCLR_COMPAREF_COMPARED    0x00000020
+
+// COUNTER is greater than or equal to COMPARE register E.
+#define AM_REG_CTIMER_STMINTCLR_COMPAREE_S           4
+#define AM_REG_CTIMER_STMINTCLR_COMPAREE_M           0x00000010
+#define AM_REG_CTIMER_STMINTCLR_COMPAREE(n)          (((uint32_t)(n) << 4) & 0x00000010)
+#define AM_REG_CTIMER_STMINTCLR_COMPAREE_COMPARED    0x00000010
+
+// COUNTER is greater than or equal to COMPARE register D.
+#define AM_REG_CTIMER_STMINTCLR_COMPARED_S           3
+#define AM_REG_CTIMER_STMINTCLR_COMPARED_M           0x00000008
+#define AM_REG_CTIMER_STMINTCLR_COMPARED(n)          (((uint32_t)(n) << 3) & 0x00000008)
+#define AM_REG_CTIMER_STMINTCLR_COMPARED_COMPARED    0x00000008
+
+// COUNTER is greater than or equal to COMPARE register C.
+#define AM_REG_CTIMER_STMINTCLR_COMPAREC_S           2
+#define AM_REG_CTIMER_STMINTCLR_COMPAREC_M           0x00000004
+#define AM_REG_CTIMER_STMINTCLR_COMPAREC(n)          (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_CTIMER_STMINTCLR_COMPAREC_COMPARED    0x00000004
+
+// COUNTER is greater than or equal to COMPARE register B.
+#define AM_REG_CTIMER_STMINTCLR_COMPAREB_S           1
+#define AM_REG_CTIMER_STMINTCLR_COMPAREB_M           0x00000002
+#define AM_REG_CTIMER_STMINTCLR_COMPAREB(n)          (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_CTIMER_STMINTCLR_COMPAREB_COMPARED    0x00000002
+
+// COUNTER is greater than or equal to COMPARE register A.
+#define AM_REG_CTIMER_STMINTCLR_COMPAREA_S           0
+#define AM_REG_CTIMER_STMINTCLR_COMPAREA_M           0x00000001
+#define AM_REG_CTIMER_STMINTCLR_COMPAREA(n)          (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_CTIMER_STMINTCLR_COMPAREA_COMPARED    0x00000001
+
+//*****************************************************************************
+//
+// CTIMER_STMINTSET - STIMER Interrupt registers: Set
+//
+//*****************************************************************************
+// CAPTURE register D has grabbed the value in the counter
+#define AM_REG_CTIMER_STMINTSET_CAPTURED_S           12
+#define AM_REG_CTIMER_STMINTSET_CAPTURED_M           0x00001000
+#define AM_REG_CTIMER_STMINTSET_CAPTURED(n)          (((uint32_t)(n) << 12) & 0x00001000)
+#define AM_REG_CTIMER_STMINTSET_CAPTURED_CAPD_INT    0x00001000
+
+// CAPTURE register C has grabbed the value in the counter
+#define AM_REG_CTIMER_STMINTSET_CAPTUREC_S           11
+#define AM_REG_CTIMER_STMINTSET_CAPTUREC_M           0x00000800
+#define AM_REG_CTIMER_STMINTSET_CAPTUREC(n)          (((uint32_t)(n) << 11) & 0x00000800)
+#define AM_REG_CTIMER_STMINTSET_CAPTUREC_CAPC_INT    0x00000800
+
+// CAPTURE register B has grabbed the value in the counter
+#define AM_REG_CTIMER_STMINTSET_CAPTUREB_S           10
+#define AM_REG_CTIMER_STMINTSET_CAPTUREB_M           0x00000400
+#define AM_REG_CTIMER_STMINTSET_CAPTUREB(n)          (((uint32_t)(n) << 10) & 0x00000400)
+#define AM_REG_CTIMER_STMINTSET_CAPTUREB_CAPB_INT    0x00000400
+
+// CAPTURE register A has grabbed the value in the counter
+#define AM_REG_CTIMER_STMINTSET_CAPTUREA_S           9
+#define AM_REG_CTIMER_STMINTSET_CAPTUREA_M           0x00000200
+#define AM_REG_CTIMER_STMINTSET_CAPTUREA(n)          (((uint32_t)(n) << 9) & 0x00000200)
+#define AM_REG_CTIMER_STMINTSET_CAPTUREA_CAPA_INT    0x00000200
+
+// COUNTER over flowed from 0xFFFFFFFF back to 0x00000000.
+#define AM_REG_CTIMER_STMINTSET_OVERFLOW_S           8
+#define AM_REG_CTIMER_STMINTSET_OVERFLOW_M           0x00000100
+#define AM_REG_CTIMER_STMINTSET_OVERFLOW(n)          (((uint32_t)(n) << 8) & 0x00000100)
+#define AM_REG_CTIMER_STMINTSET_OVERFLOW_OFLOW_INT   0x00000100
+
+// COUNTER is greater than or equal to COMPARE register H.
+#define AM_REG_CTIMER_STMINTSET_COMPAREH_S           7
+#define AM_REG_CTIMER_STMINTSET_COMPAREH_M           0x00000080
+#define AM_REG_CTIMER_STMINTSET_COMPAREH(n)          (((uint32_t)(n) << 7) & 0x00000080)
+#define AM_REG_CTIMER_STMINTSET_COMPAREH_COMPARED    0x00000080
+
+// COUNTER is greater than or equal to COMPARE register G.
+#define AM_REG_CTIMER_STMINTSET_COMPAREG_S           6
+#define AM_REG_CTIMER_STMINTSET_COMPAREG_M           0x00000040
+#define AM_REG_CTIMER_STMINTSET_COMPAREG(n)          (((uint32_t)(n) << 6) & 0x00000040)
+#define AM_REG_CTIMER_STMINTSET_COMPAREG_COMPARED    0x00000040
+
+// COUNTER is greater than or equal to COMPARE register F.
+#define AM_REG_CTIMER_STMINTSET_COMPAREF_S           5
+#define AM_REG_CTIMER_STMINTSET_COMPAREF_M           0x00000020
+#define AM_REG_CTIMER_STMINTSET_COMPAREF(n)          (((uint32_t)(n) << 5) & 0x00000020)
+#define AM_REG_CTIMER_STMINTSET_COMPAREF_COMPARED    0x00000020
+
+// COUNTER is greater than or equal to COMPARE register E.
+#define AM_REG_CTIMER_STMINTSET_COMPAREE_S           4
+#define AM_REG_CTIMER_STMINTSET_COMPAREE_M           0x00000010
+#define AM_REG_CTIMER_STMINTSET_COMPAREE(n)          (((uint32_t)(n) << 4) & 0x00000010)
+#define AM_REG_CTIMER_STMINTSET_COMPAREE_COMPARED    0x00000010
+
+// COUNTER is greater than or equal to COMPARE register D.
+#define AM_REG_CTIMER_STMINTSET_COMPARED_S           3
+#define AM_REG_CTIMER_STMINTSET_COMPARED_M           0x00000008
+#define AM_REG_CTIMER_STMINTSET_COMPARED(n)          (((uint32_t)(n) << 3) & 0x00000008)
+#define AM_REG_CTIMER_STMINTSET_COMPARED_COMPARED    0x00000008
+
+// COUNTER is greater than or equal to COMPARE register C.
+#define AM_REG_CTIMER_STMINTSET_COMPAREC_S           2
+#define AM_REG_CTIMER_STMINTSET_COMPAREC_M           0x00000004
+#define AM_REG_CTIMER_STMINTSET_COMPAREC(n)          (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_CTIMER_STMINTSET_COMPAREC_COMPARED    0x00000004
+
+// COUNTER is greater than or equal to COMPARE register B.
+#define AM_REG_CTIMER_STMINTSET_COMPAREB_S           1
+#define AM_REG_CTIMER_STMINTSET_COMPAREB_M           0x00000002
+#define AM_REG_CTIMER_STMINTSET_COMPAREB(n)          (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_CTIMER_STMINTSET_COMPAREB_COMPARED    0x00000002
+
+// COUNTER is greater than or equal to COMPARE register A.
+#define AM_REG_CTIMER_STMINTSET_COMPAREA_S           0
+#define AM_REG_CTIMER_STMINTSET_COMPAREA_M           0x00000001
+#define AM_REG_CTIMER_STMINTSET_COMPAREA(n)          (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_CTIMER_STMINTSET_COMPAREA_COMPARED    0x00000001
+
+//*****************************************************************************
+//
+// CTIMER_TMR0 - Counter/Timer Register
+//
+//*****************************************************************************
+// Counter/Timer B0.
+#define AM_REG_CTIMER_TMR0_CTTMRB0_S                 16
+#define AM_REG_CTIMER_TMR0_CTTMRB0_M                 0xFFFF0000
+#define AM_REG_CTIMER_TMR0_CTTMRB0(n)                (((uint32_t)(n) << 16) & 0xFFFF0000)
+
+// Counter/Timer A0.
+#define AM_REG_CTIMER_TMR0_CTTMRA0_S                 0
+#define AM_REG_CTIMER_TMR0_CTTMRA0_M                 0x0000FFFF
+#define AM_REG_CTIMER_TMR0_CTTMRA0(n)                (((uint32_t)(n) << 0) & 0x0000FFFF)
+
+//*****************************************************************************
+//
+// CTIMER_CMPRA0 - Counter/Timer A0 Compare Registers
+//
+//*****************************************************************************
+// Counter/Timer A0 Compare Register 1. Holds the upper limit for timer half A.
+#define AM_REG_CTIMER_CMPRA0_CMPR1A0_S               16
+#define AM_REG_CTIMER_CMPRA0_CMPR1A0_M               0xFFFF0000
+#define AM_REG_CTIMER_CMPRA0_CMPR1A0(n)              (((uint32_t)(n) << 16) & 0xFFFF0000)
+
+// Counter/Timer A0 Compare Register 0. Holds the lower limit for timer half A.
+#define AM_REG_CTIMER_CMPRA0_CMPR0A0_S               0
+#define AM_REG_CTIMER_CMPRA0_CMPR0A0_M               0x0000FFFF
+#define AM_REG_CTIMER_CMPRA0_CMPR0A0(n)              (((uint32_t)(n) << 0) & 0x0000FFFF)
+
+//*****************************************************************************
+//
+// CTIMER_CMPRB0 - Counter/Timer B0 Compare Registers
+//
+//*****************************************************************************
+// Counter/Timer B0 Compare Register 1. Holds the upper limit for timer half B.
+#define AM_REG_CTIMER_CMPRB0_CMPR1B0_S               16
+#define AM_REG_CTIMER_CMPRB0_CMPR1B0_M               0xFFFF0000
+#define AM_REG_CTIMER_CMPRB0_CMPR1B0(n)              (((uint32_t)(n) << 16) & 0xFFFF0000)
+
+// Counter/Timer B0 Compare Register 0. Holds the lower limit for timer half B.
+#define AM_REG_CTIMER_CMPRB0_CMPR0B0_S               0
+#define AM_REG_CTIMER_CMPRB0_CMPR0B0_M               0x0000FFFF
+#define AM_REG_CTIMER_CMPRB0_CMPR0B0(n)              (((uint32_t)(n) << 0) & 0x0000FFFF)
+
+//*****************************************************************************
+//
+// CTIMER_CTRL0 - Counter/Timer Control
+//
+//*****************************************************************************
+// Counter/Timer A0/B0 Link bit.
+#define AM_REG_CTIMER_CTRL0_CTLINK0_S                31
+#define AM_REG_CTIMER_CTRL0_CTLINK0_M                0x80000000
+#define AM_REG_CTIMER_CTRL0_CTLINK0(n)               (((uint32_t)(n) << 31) & 0x80000000)
+#define AM_REG_CTIMER_CTRL0_CTLINK0_TWO_16BIT_TIMERS 0x00000000
+#define AM_REG_CTIMER_CTRL0_CTLINK0_32BIT_TIMER      0x80000000
+
+// Counter/Timer B0 Output Enable bit.
+#define AM_REG_CTIMER_CTRL0_TMRB0PE_S                29
+#define AM_REG_CTIMER_CTRL0_TMRB0PE_M                0x20000000
+#define AM_REG_CTIMER_CTRL0_TMRB0PE(n)               (((uint32_t)(n) << 29) & 0x20000000)
+#define AM_REG_CTIMER_CTRL0_TMRB0PE_DIS              0x00000000
+#define AM_REG_CTIMER_CTRL0_TMRB0PE_EN               0x20000000
+
+// Counter/Timer B0 output polarity.
+#define AM_REG_CTIMER_CTRL0_TMRB0POL_S               28
+#define AM_REG_CTIMER_CTRL0_TMRB0POL_M               0x10000000
+#define AM_REG_CTIMER_CTRL0_TMRB0POL(n)              (((uint32_t)(n) << 28) & 0x10000000)
+#define AM_REG_CTIMER_CTRL0_TMRB0POL_NORMAL          0x00000000
+#define AM_REG_CTIMER_CTRL0_TMRB0POL_INVERTED        0x10000000
+
+// Counter/Timer B0 Clear bit.
+#define AM_REG_CTIMER_CTRL0_TMRB0CLR_S               27
+#define AM_REG_CTIMER_CTRL0_TMRB0CLR_M               0x08000000
+#define AM_REG_CTIMER_CTRL0_TMRB0CLR(n)              (((uint32_t)(n) << 27) & 0x08000000)
+#define AM_REG_CTIMER_CTRL0_TMRB0CLR_RUN             0x00000000
+#define AM_REG_CTIMER_CTRL0_TMRB0CLR_CLEAR           0x08000000
+
+// Counter/Timer B0 Interrupt Enable bit for COMPR1.
+#define AM_REG_CTIMER_CTRL0_TMRB0IE1_S               26
+#define AM_REG_CTIMER_CTRL0_TMRB0IE1_M               0x04000000
+#define AM_REG_CTIMER_CTRL0_TMRB0IE1(n)              (((uint32_t)(n) << 26) & 0x04000000)
+#define AM_REG_CTIMER_CTRL0_TMRB0IE1_DIS             0x00000000
+#define AM_REG_CTIMER_CTRL0_TMRB0IE1_EN              0x04000000
+
+// Counter/Timer B0 Interrupt Enable bit for COMPR0.
+#define AM_REG_CTIMER_CTRL0_TMRB0IE0_S               25
+#define AM_REG_CTIMER_CTRL0_TMRB0IE0_M               0x02000000
+#define AM_REG_CTIMER_CTRL0_TMRB0IE0(n)              (((uint32_t)(n) << 25) & 0x02000000)
+#define AM_REG_CTIMER_CTRL0_TMRB0IE0_DIS             0x00000000
+#define AM_REG_CTIMER_CTRL0_TMRB0IE0_EN              0x02000000
+
+// Counter/Timer B0 Function Select.
+#define AM_REG_CTIMER_CTRL0_TMRB0FN_S                22
+#define AM_REG_CTIMER_CTRL0_TMRB0FN_M                0x01C00000
+#define AM_REG_CTIMER_CTRL0_TMRB0FN(n)               (((uint32_t)(n) << 22) & 0x01C00000)
+#define AM_REG_CTIMER_CTRL0_TMRB0FN_SINGLECOUNT      0x00000000
+#define AM_REG_CTIMER_CTRL0_TMRB0FN_REPEATEDCOUNT    0x00400000
+#define AM_REG_CTIMER_CTRL0_TMRB0FN_PULSE_ONCE       0x00800000
+#define AM_REG_CTIMER_CTRL0_TMRB0FN_PULSE_CONT       0x00C00000
+#define AM_REG_CTIMER_CTRL0_TMRB0FN_CONTINUOUS       0x01000000
+
+// Counter/Timer B0 Clock Select.
+#define AM_REG_CTIMER_CTRL0_TMRB0CLK_S               17
+#define AM_REG_CTIMER_CTRL0_TMRB0CLK_M               0x003E0000
+#define AM_REG_CTIMER_CTRL0_TMRB0CLK(n)              (((uint32_t)(n) << 17) & 0x003E0000)
+#define AM_REG_CTIMER_CTRL0_TMRB0CLK_TMRPIN          0x00000000
+#define AM_REG_CTIMER_CTRL0_TMRB0CLK_HFRC_DIV4       0x00020000
+#define AM_REG_CTIMER_CTRL0_TMRB0CLK_HFRC_DIV16      0x00040000
+#define AM_REG_CTIMER_CTRL0_TMRB0CLK_HFRC_DIV256     0x00060000
+#define AM_REG_CTIMER_CTRL0_TMRB0CLK_HFRC_DIV1024    0x00080000
+#define AM_REG_CTIMER_CTRL0_TMRB0CLK_HFRC_DIV4K      0x000A0000
+#define AM_REG_CTIMER_CTRL0_TMRB0CLK_XT              0x000C0000
+#define AM_REG_CTIMER_CTRL0_TMRB0CLK_XT_DIV2         0x000E0000
+#define AM_REG_CTIMER_CTRL0_TMRB0CLK_XT_DIV16        0x00100000
+#define AM_REG_CTIMER_CTRL0_TMRB0CLK_XT_DIV256       0x00120000
+#define AM_REG_CTIMER_CTRL0_TMRB0CLK_LFRC_DIV2       0x00140000
+#define AM_REG_CTIMER_CTRL0_TMRB0CLK_LFRC_DIV32      0x00160000
+#define AM_REG_CTIMER_CTRL0_TMRB0CLK_LFRC_DIV1K      0x00180000
+#define AM_REG_CTIMER_CTRL0_TMRB0CLK_LFRC            0x001A0000
+#define AM_REG_CTIMER_CTRL0_TMRB0CLK_RTC_100HZ       0x001C0000
+#define AM_REG_CTIMER_CTRL0_TMRB0CLK_HCLK            0x001E0000
+#define AM_REG_CTIMER_CTRL0_TMRB0CLK_BUCKB           0x00200000
+
+// Counter/Timer B0 Enable bit.
+#define AM_REG_CTIMER_CTRL0_TMRB0EN_S                16
+#define AM_REG_CTIMER_CTRL0_TMRB0EN_M                0x00010000
+#define AM_REG_CTIMER_CTRL0_TMRB0EN(n)               (((uint32_t)(n) << 16) & 0x00010000)
+#define AM_REG_CTIMER_CTRL0_TMRB0EN_DIS              0x00000000
+#define AM_REG_CTIMER_CTRL0_TMRB0EN_EN               0x00010000
+
+// Counter/Timer A0 Output Enable bit.
+#define AM_REG_CTIMER_CTRL0_TMRA0PE_S                13
+#define AM_REG_CTIMER_CTRL0_TMRA0PE_M                0x00002000
+#define AM_REG_CTIMER_CTRL0_TMRA0PE(n)               (((uint32_t)(n) << 13) & 0x00002000)
+#define AM_REG_CTIMER_CTRL0_TMRA0PE_DIS              0x00000000
+#define AM_REG_CTIMER_CTRL0_TMRA0PE_EN               0x00002000
+
+// Counter/Timer A0 output polarity.
+#define AM_REG_CTIMER_CTRL0_TMRA0POL_S               12
+#define AM_REG_CTIMER_CTRL0_TMRA0POL_M               0x00001000
+#define AM_REG_CTIMER_CTRL0_TMRA0POL(n)              (((uint32_t)(n) << 12) & 0x00001000)
+#define AM_REG_CTIMER_CTRL0_TMRA0POL_NORMAL          0x00000000
+#define AM_REG_CTIMER_CTRL0_TMRA0POL_INVERTED        0x00001000
+
+// Counter/Timer A0 Clear bit.
+#define AM_REG_CTIMER_CTRL0_TMRA0CLR_S               11
+#define AM_REG_CTIMER_CTRL0_TMRA0CLR_M               0x00000800
+#define AM_REG_CTIMER_CTRL0_TMRA0CLR(n)              (((uint32_t)(n) << 11) & 0x00000800)
+#define AM_REG_CTIMER_CTRL0_TMRA0CLR_RUN             0x00000000
+#define AM_REG_CTIMER_CTRL0_TMRA0CLR_CLEAR           0x00000800
+
+// Counter/Timer A0 Interrupt Enable bit based on COMPR1.
+#define AM_REG_CTIMER_CTRL0_TMRA0IE1_S               10
+#define AM_REG_CTIMER_CTRL0_TMRA0IE1_M               0x00000400
+#define AM_REG_CTIMER_CTRL0_TMRA0IE1(n)              (((uint32_t)(n) << 10) & 0x00000400)
+#define AM_REG_CTIMER_CTRL0_TMRA0IE1_DIS             0x00000000
+#define AM_REG_CTIMER_CTRL0_TMRA0IE1_EN              0x00000400
+
+// Counter/Timer A0 Interrupt Enable bit based on COMPR0.
+#define AM_REG_CTIMER_CTRL0_TMRA0IE0_S               9
+#define AM_REG_CTIMER_CTRL0_TMRA0IE0_M               0x00000200
+#define AM_REG_CTIMER_CTRL0_TMRA0IE0(n)              (((uint32_t)(n) << 9) & 0x00000200)
+#define AM_REG_CTIMER_CTRL0_TMRA0IE0_DIS             0x00000000
+#define AM_REG_CTIMER_CTRL0_TMRA0IE0_EN              0x00000200
+
+// Counter/Timer A0 Function Select.
+#define AM_REG_CTIMER_CTRL0_TMRA0FN_S                6
+#define AM_REG_CTIMER_CTRL0_TMRA0FN_M                0x000001C0
+#define AM_REG_CTIMER_CTRL0_TMRA0FN(n)               (((uint32_t)(n) << 6) & 0x000001C0)
+#define AM_REG_CTIMER_CTRL0_TMRA0FN_SINGLECOUNT      0x00000000
+#define AM_REG_CTIMER_CTRL0_TMRA0FN_REPEATEDCOUNT    0x00000040
+#define AM_REG_CTIMER_CTRL0_TMRA0FN_PULSE_ONCE       0x00000080
+#define AM_REG_CTIMER_CTRL0_TMRA0FN_PULSE_CONT       0x000000C0
+#define AM_REG_CTIMER_CTRL0_TMRA0FN_CONTINUOUS       0x00000100
+
+// Counter/Timer A0 Clock Select.
+#define AM_REG_CTIMER_CTRL0_TMRA0CLK_S               1
+#define AM_REG_CTIMER_CTRL0_TMRA0CLK_M               0x0000003E
+#define AM_REG_CTIMER_CTRL0_TMRA0CLK(n)              (((uint32_t)(n) << 1) & 0x0000003E)
+#define AM_REG_CTIMER_CTRL0_TMRA0CLK_TMRPIN          0x00000000
+#define AM_REG_CTIMER_CTRL0_TMRA0CLK_HFRC_DIV4       0x00000002
+#define AM_REG_CTIMER_CTRL0_TMRA0CLK_HFRC_DIV16      0x00000004
+#define AM_REG_CTIMER_CTRL0_TMRA0CLK_HFRC_DIV256     0x00000006
+#define AM_REG_CTIMER_CTRL0_TMRA0CLK_HFRC_DIV1024    0x00000008
+#define AM_REG_CTIMER_CTRL0_TMRA0CLK_HFRC_DIV4K      0x0000000A
+#define AM_REG_CTIMER_CTRL0_TMRA0CLK_XT              0x0000000C
+#define AM_REG_CTIMER_CTRL0_TMRA0CLK_XT_DIV2         0x0000000E
+#define AM_REG_CTIMER_CTRL0_TMRA0CLK_XT_DIV16        0x00000010
+#define AM_REG_CTIMER_CTRL0_TMRA0CLK_XT_DIV256       0x00000012
+#define AM_REG_CTIMER_CTRL0_TMRA0CLK_LFRC_DIV2       0x00000014
+#define AM_REG_CTIMER_CTRL0_TMRA0CLK_LFRC_DIV32      0x00000016
+#define AM_REG_CTIMER_CTRL0_TMRA0CLK_LFRC_DIV1K      0x00000018
+#define AM_REG_CTIMER_CTRL0_TMRA0CLK_LFRC            0x0000001A
+#define AM_REG_CTIMER_CTRL0_TMRA0CLK_RTC_100HZ       0x0000001C
+#define AM_REG_CTIMER_CTRL0_TMRA0CLK_HCLK_DIV4       0x0000001E
+#define AM_REG_CTIMER_CTRL0_TMRA0CLK_BUCKA           0x00000020
+
+// Counter/Timer A0 Enable bit.
+#define AM_REG_CTIMER_CTRL0_TMRA0EN_S                0
+#define AM_REG_CTIMER_CTRL0_TMRA0EN_M                0x00000001
+#define AM_REG_CTIMER_CTRL0_TMRA0EN(n)               (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_CTIMER_CTRL0_TMRA0EN_DIS              0x00000000
+#define AM_REG_CTIMER_CTRL0_TMRA0EN_EN               0x00000001
+
+//*****************************************************************************
+//
+// CTIMER_TMR1 - Counter/Timer Register
+//
+//*****************************************************************************
+// Counter/Timer B1.
+#define AM_REG_CTIMER_TMR1_CTTMRB1_S                 16
+#define AM_REG_CTIMER_TMR1_CTTMRB1_M                 0xFFFF0000
+#define AM_REG_CTIMER_TMR1_CTTMRB1(n)                (((uint32_t)(n) << 16) & 0xFFFF0000)
+
+// Counter/Timer A1.
+#define AM_REG_CTIMER_TMR1_CTTMRA1_S                 0
+#define AM_REG_CTIMER_TMR1_CTTMRA1_M                 0x0000FFFF
+#define AM_REG_CTIMER_TMR1_CTTMRA1(n)                (((uint32_t)(n) << 0) & 0x0000FFFF)
+
+//*****************************************************************************
+//
+// CTIMER_CMPRA1 - Counter/Timer A1 Compare Registers
+//
+//*****************************************************************************
+// Counter/Timer A1 Compare Register 1.
+#define AM_REG_CTIMER_CMPRA1_CMPR1A1_S               16
+#define AM_REG_CTIMER_CMPRA1_CMPR1A1_M               0xFFFF0000
+#define AM_REG_CTIMER_CMPRA1_CMPR1A1(n)              (((uint32_t)(n) << 16) & 0xFFFF0000)
+
+// Counter/Timer A1 Compare Register 0.
+#define AM_REG_CTIMER_CMPRA1_CMPR0A1_S               0
+#define AM_REG_CTIMER_CMPRA1_CMPR0A1_M               0x0000FFFF
+#define AM_REG_CTIMER_CMPRA1_CMPR0A1(n)              (((uint32_t)(n) << 0) & 0x0000FFFF)
+
+//*****************************************************************************
+//
+// CTIMER_CMPRB1 - Counter/Timer B1 Compare Registers
+//
+//*****************************************************************************
+// Counter/Timer B1 Compare Register 1.
+#define AM_REG_CTIMER_CMPRB1_CMPR1B1_S               16
+#define AM_REG_CTIMER_CMPRB1_CMPR1B1_M               0xFFFF0000
+#define AM_REG_CTIMER_CMPRB1_CMPR1B1(n)              (((uint32_t)(n) << 16) & 0xFFFF0000)
+
+// Counter/Timer B1 Compare Register 0.
+#define AM_REG_CTIMER_CMPRB1_CMPR0B1_S               0
+#define AM_REG_CTIMER_CMPRB1_CMPR0B1_M               0x0000FFFF
+#define AM_REG_CTIMER_CMPRB1_CMPR0B1(n)              (((uint32_t)(n) << 0) & 0x0000FFFF)
+
+//*****************************************************************************
+//
+// CTIMER_CTRL1 - Counter/Timer Control
+//
+//*****************************************************************************
+// Counter/Timer A1/B1 Link bit.
+#define AM_REG_CTIMER_CTRL1_CTLINK1_S                31
+#define AM_REG_CTIMER_CTRL1_CTLINK1_M                0x80000000
+#define AM_REG_CTIMER_CTRL1_CTLINK1(n)               (((uint32_t)(n) << 31) & 0x80000000)
+#define AM_REG_CTIMER_CTRL1_CTLINK1_TWO_16BIT_TIMERS 0x00000000
+#define AM_REG_CTIMER_CTRL1_CTLINK1_32BIT_TIMER      0x80000000
+
+// Counter/Timer B1 Output Enable bit.
+#define AM_REG_CTIMER_CTRL1_TMRB1PE_S                29
+#define AM_REG_CTIMER_CTRL1_TMRB1PE_M                0x20000000
+#define AM_REG_CTIMER_CTRL1_TMRB1PE(n)               (((uint32_t)(n) << 29) & 0x20000000)
+#define AM_REG_CTIMER_CTRL1_TMRB1PE_DIS              0x00000000
+#define AM_REG_CTIMER_CTRL1_TMRB1PE_EN               0x20000000
+
+// Counter/Timer B1 output polarity.
+#define AM_REG_CTIMER_CTRL1_TMRB1POL_S               28
+#define AM_REG_CTIMER_CTRL1_TMRB1POL_M               0x10000000
+#define AM_REG_CTIMER_CTRL1_TMRB1POL(n)              (((uint32_t)(n) << 28) & 0x10000000)
+#define AM_REG_CTIMER_CTRL1_TMRB1POL_NORMAL          0x00000000
+#define AM_REG_CTIMER_CTRL1_TMRB1POL_INVERTED        0x10000000
+
+// Counter/Timer B1 Clear bit.
+#define AM_REG_CTIMER_CTRL1_TMRB1CLR_S               27
+#define AM_REG_CTIMER_CTRL1_TMRB1CLR_M               0x08000000
+#define AM_REG_CTIMER_CTRL1_TMRB1CLR(n)              (((uint32_t)(n) << 27) & 0x08000000)
+#define AM_REG_CTIMER_CTRL1_TMRB1CLR_RUN             0x00000000
+#define AM_REG_CTIMER_CTRL1_TMRB1CLR_CLEAR           0x08000000
+
+// Counter/Timer B1 Interrupt Enable bit for COMPR1.
+#define AM_REG_CTIMER_CTRL1_TMRB1IE1_S               26
+#define AM_REG_CTIMER_CTRL1_TMRB1IE1_M               0x04000000
+#define AM_REG_CTIMER_CTRL1_TMRB1IE1(n)              (((uint32_t)(n) << 26) & 0x04000000)
+#define AM_REG_CTIMER_CTRL1_TMRB1IE1_DIS             0x00000000
+#define AM_REG_CTIMER_CTRL1_TMRB1IE1_EN              0x04000000
+
+// Counter/Timer B1 Interrupt Enable bit for COMPR0.
+#define AM_REG_CTIMER_CTRL1_TMRB1IE0_S               25
+#define AM_REG_CTIMER_CTRL1_TMRB1IE0_M               0x02000000
+#define AM_REG_CTIMER_CTRL1_TMRB1IE0(n)              (((uint32_t)(n) << 25) & 0x02000000)
+#define AM_REG_CTIMER_CTRL1_TMRB1IE0_DIS             0x00000000
+#define AM_REG_CTIMER_CTRL1_TMRB1IE0_EN              0x02000000
+
+// Counter/Timer B1 Function Select.
+#define AM_REG_CTIMER_CTRL1_TMRB1FN_S                22
+#define AM_REG_CTIMER_CTRL1_TMRB1FN_M                0x01C00000
+#define AM_REG_CTIMER_CTRL1_TMRB1FN(n)               (((uint32_t)(n) << 22) & 0x01C00000)
+#define AM_REG_CTIMER_CTRL1_TMRB1FN_SINGLECOUNT      0x00000000
+#define AM_REG_CTIMER_CTRL1_TMRB1FN_REPEATEDCOUNT    0x00400000
+#define AM_REG_CTIMER_CTRL1_TMRB1FN_PULSE_ONCE       0x00800000
+#define AM_REG_CTIMER_CTRL1_TMRB1FN_PULSE_CONT       0x00C00000
+#define AM_REG_CTIMER_CTRL1_TMRB1FN_CONTINUOUS       0x01000000
+
+// Counter/Timer B1 Clock Select.
+#define AM_REG_CTIMER_CTRL1_TMRB1CLK_S               17
+#define AM_REG_CTIMER_CTRL1_TMRB1CLK_M               0x003E0000
+#define AM_REG_CTIMER_CTRL1_TMRB1CLK(n)              (((uint32_t)(n) << 17) & 0x003E0000)
+#define AM_REG_CTIMER_CTRL1_TMRB1CLK_TMRPIN          0x00000000
+#define AM_REG_CTIMER_CTRL1_TMRB1CLK_HFRC_DIV4       0x00020000
+#define AM_REG_CTIMER_CTRL1_TMRB1CLK_HFRC_DIV16      0x00040000
+#define AM_REG_CTIMER_CTRL1_TMRB1CLK_HFRC_DIV256     0x00060000
+#define AM_REG_CTIMER_CTRL1_TMRB1CLK_HFRC_DIV1024    0x00080000
+#define AM_REG_CTIMER_CTRL1_TMRB1CLK_HFRC_DIV4K      0x000A0000
+#define AM_REG_CTIMER_CTRL1_TMRB1CLK_XT              0x000C0000
+#define AM_REG_CTIMER_CTRL1_TMRB1CLK_XT_DIV2         0x000E0000
+#define AM_REG_CTIMER_CTRL1_TMRB1CLK_XT_DIV16        0x00100000
+#define AM_REG_CTIMER_CTRL1_TMRB1CLK_XT_DIV256       0x00120000
+#define AM_REG_CTIMER_CTRL1_TMRB1CLK_LFRC_DIV2       0x00140000
+#define AM_REG_CTIMER_CTRL1_TMRB1CLK_LFRC_DIV32      0x00160000
+#define AM_REG_CTIMER_CTRL1_TMRB1CLK_LFRC_DIV1K      0x00180000
+#define AM_REG_CTIMER_CTRL1_TMRB1CLK_LFRC            0x001A0000
+#define AM_REG_CTIMER_CTRL1_TMRB1CLK_RTC_100HZ       0x001C0000
+#define AM_REG_CTIMER_CTRL1_TMRB1CLK_HCLK            0x001E0000
+#define AM_REG_CTIMER_CTRL1_TMRB1CLK_BUCKB           0x00200000
+
+// Counter/Timer B1 Enable bit.
+#define AM_REG_CTIMER_CTRL1_TMRB1EN_S                16
+#define AM_REG_CTIMER_CTRL1_TMRB1EN_M                0x00010000
+#define AM_REG_CTIMER_CTRL1_TMRB1EN(n)               (((uint32_t)(n) << 16) & 0x00010000)
+#define AM_REG_CTIMER_CTRL1_TMRB1EN_DIS              0x00000000
+#define AM_REG_CTIMER_CTRL1_TMRB1EN_EN               0x00010000
+
+// Counter/Timer A1 Output Enable bit.
+#define AM_REG_CTIMER_CTRL1_TMRA1PE_S                13
+#define AM_REG_CTIMER_CTRL1_TMRA1PE_M                0x00002000
+#define AM_REG_CTIMER_CTRL1_TMRA1PE(n)               (((uint32_t)(n) << 13) & 0x00002000)
+#define AM_REG_CTIMER_CTRL1_TMRA1PE_DIS              0x00000000
+#define AM_REG_CTIMER_CTRL1_TMRA1PE_EN               0x00002000
+
+// Counter/Timer A1 output polarity.
+#define AM_REG_CTIMER_CTRL1_TMRA1POL_S               12
+#define AM_REG_CTIMER_CTRL1_TMRA1POL_M               0x00001000
+#define AM_REG_CTIMER_CTRL1_TMRA1POL(n)              (((uint32_t)(n) << 12) & 0x00001000)
+#define AM_REG_CTIMER_CTRL1_TMRA1POL_NORMAL          0x00000000
+#define AM_REG_CTIMER_CTRL1_TMRA1POL_INVERTED        0x00001000
+
+// Counter/Timer A1 Clear bit.
+#define AM_REG_CTIMER_CTRL1_TMRA1CLR_S               11
+#define AM_REG_CTIMER_CTRL1_TMRA1CLR_M               0x00000800
+#define AM_REG_CTIMER_CTRL1_TMRA1CLR(n)              (((uint32_t)(n) << 11) & 0x00000800)
+#define AM_REG_CTIMER_CTRL1_TMRA1CLR_RUN             0x00000000
+#define AM_REG_CTIMER_CTRL1_TMRA1CLR_CLEAR           0x00000800
+
+// Counter/Timer A1 Interrupt Enable bit based on COMPR1.
+#define AM_REG_CTIMER_CTRL1_TMRA1IE1_S               10
+#define AM_REG_CTIMER_CTRL1_TMRA1IE1_M               0x00000400
+#define AM_REG_CTIMER_CTRL1_TMRA1IE1(n)              (((uint32_t)(n) << 10) & 0x00000400)
+#define AM_REG_CTIMER_CTRL1_TMRA1IE1_DIS             0x00000000
+#define AM_REG_CTIMER_CTRL1_TMRA1IE1_EN              0x00000400
+
+// Counter/Timer A1 Interrupt Enable bit based on COMPR0.
+#define AM_REG_CTIMER_CTRL1_TMRA1IE0_S               9
+#define AM_REG_CTIMER_CTRL1_TMRA1IE0_M               0x00000200
+#define AM_REG_CTIMER_CTRL1_TMRA1IE0(n)              (((uint32_t)(n) << 9) & 0x00000200)
+#define AM_REG_CTIMER_CTRL1_TMRA1IE0_DIS             0x00000000
+#define AM_REG_CTIMER_CTRL1_TMRA1IE0_EN              0x00000200
+
+// Counter/Timer A1 Function Select.
+#define AM_REG_CTIMER_CTRL1_TMRA1FN_S                6
+#define AM_REG_CTIMER_CTRL1_TMRA1FN_M                0x000001C0
+#define AM_REG_CTIMER_CTRL1_TMRA1FN(n)               (((uint32_t)(n) << 6) & 0x000001C0)
+#define AM_REG_CTIMER_CTRL1_TMRA1FN_SINGLECOUNT      0x00000000
+#define AM_REG_CTIMER_CTRL1_TMRA1FN_REPEATEDCOUNT    0x00000040
+#define AM_REG_CTIMER_CTRL1_TMRA1FN_PULSE_ONCE       0x00000080
+#define AM_REG_CTIMER_CTRL1_TMRA1FN_PULSE_CONT       0x000000C0
+#define AM_REG_CTIMER_CTRL1_TMRA1FN_CONTINUOUS       0x00000100
+
+// Counter/Timer A1 Clock Select.
+#define AM_REG_CTIMER_CTRL1_TMRA1CLK_S               1
+#define AM_REG_CTIMER_CTRL1_TMRA1CLK_M               0x0000003E
+#define AM_REG_CTIMER_CTRL1_TMRA1CLK(n)              (((uint32_t)(n) << 1) & 0x0000003E)
+#define AM_REG_CTIMER_CTRL1_TMRA1CLK_TMRPIN          0x00000000
+#define AM_REG_CTIMER_CTRL1_TMRA1CLK_HFRC_DIV4       0x00000002
+#define AM_REG_CTIMER_CTRL1_TMRA1CLK_HFRC_DIV16      0x00000004
+#define AM_REG_CTIMER_CTRL1_TMRA1CLK_HFRC_DIV256     0x00000006
+#define AM_REG_CTIMER_CTRL1_TMRA1CLK_HFRC_DIV1024    0x00000008
+#define AM_REG_CTIMER_CTRL1_TMRA1CLK_HFRC_DIV4K      0x0000000A
+#define AM_REG_CTIMER_CTRL1_TMRA1CLK_XT              0x0000000C
+#define AM_REG_CTIMER_CTRL1_TMRA1CLK_XT_DIV2         0x0000000E
+#define AM_REG_CTIMER_CTRL1_TMRA1CLK_XT_DIV16        0x00000010
+#define AM_REG_CTIMER_CTRL1_TMRA1CLK_XT_DIV256       0x00000012
+#define AM_REG_CTIMER_CTRL1_TMRA1CLK_LFRC_DIV2       0x00000014
+#define AM_REG_CTIMER_CTRL1_TMRA1CLK_LFRC_DIV32      0x00000016
+#define AM_REG_CTIMER_CTRL1_TMRA1CLK_LFRC_DIV1K      0x00000018
+#define AM_REG_CTIMER_CTRL1_TMRA1CLK_LFRC            0x0000001A
+#define AM_REG_CTIMER_CTRL1_TMRA1CLK_RTC_100HZ       0x0000001C
+#define AM_REG_CTIMER_CTRL1_TMRA1CLK_HCLK            0x0000001E
+#define AM_REG_CTIMER_CTRL1_TMRA1CLK_BUCKA           0x00000020
+
+// Counter/Timer A1 Enable bit.
+#define AM_REG_CTIMER_CTRL1_TMRA1EN_S                0
+#define AM_REG_CTIMER_CTRL1_TMRA1EN_M                0x00000001
+#define AM_REG_CTIMER_CTRL1_TMRA1EN(n)               (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_CTIMER_CTRL1_TMRA1EN_DIS              0x00000000
+#define AM_REG_CTIMER_CTRL1_TMRA1EN_EN               0x00000001
+
+//*****************************************************************************
+//
+// CTIMER_TMR2 - Counter/Timer Register
+//
+//*****************************************************************************
+// Counter/Timer B2.
+#define AM_REG_CTIMER_TMR2_CTTMRB2_S                 16
+#define AM_REG_CTIMER_TMR2_CTTMRB2_M                 0xFFFF0000
+#define AM_REG_CTIMER_TMR2_CTTMRB2(n)                (((uint32_t)(n) << 16) & 0xFFFF0000)
+
+// Counter/Timer A2.
+#define AM_REG_CTIMER_TMR2_CTTMRA2_S                 0
+#define AM_REG_CTIMER_TMR2_CTTMRA2_M                 0x0000FFFF
+#define AM_REG_CTIMER_TMR2_CTTMRA2(n)                (((uint32_t)(n) << 0) & 0x0000FFFF)
+
+//*****************************************************************************
+//
+// CTIMER_CMPRA2 - Counter/Timer A2 Compare Registers
+//
+//*****************************************************************************
+// Counter/Timer A2 Compare Register 1.
+#define AM_REG_CTIMER_CMPRA2_CMPR1A2_S               16
+#define AM_REG_CTIMER_CMPRA2_CMPR1A2_M               0xFFFF0000
+#define AM_REG_CTIMER_CMPRA2_CMPR1A2(n)              (((uint32_t)(n) << 16) & 0xFFFF0000)
+
+// Counter/Timer A2 Compare Register 0.
+#define AM_REG_CTIMER_CMPRA2_CMPR0A2_S               0
+#define AM_REG_CTIMER_CMPRA2_CMPR0A2_M               0x0000FFFF
+#define AM_REG_CTIMER_CMPRA2_CMPR0A2(n)              (((uint32_t)(n) << 0) & 0x0000FFFF)
+
+//*****************************************************************************
+//
+// CTIMER_CMPRB2 - Counter/Timer B2 Compare Registers
+//
+//*****************************************************************************
+// Counter/Timer B2 Compare Register 1.
+#define AM_REG_CTIMER_CMPRB2_CMPR1B2_S               16
+#define AM_REG_CTIMER_CMPRB2_CMPR1B2_M               0xFFFF0000
+#define AM_REG_CTIMER_CMPRB2_CMPR1B2(n)              (((uint32_t)(n) << 16) & 0xFFFF0000)
+
+// Counter/Timer B2 Compare Register 0.
+#define AM_REG_CTIMER_CMPRB2_CMPR0B2_S               0
+#define AM_REG_CTIMER_CMPRB2_CMPR0B2_M               0x0000FFFF
+#define AM_REG_CTIMER_CMPRB2_CMPR0B2(n)              (((uint32_t)(n) << 0) & 0x0000FFFF)
+
+//*****************************************************************************
+//
+// CTIMER_CTRL2 - Counter/Timer Control
+//
+//*****************************************************************************
+// Counter/Timer A2/B2 Link bit.
+#define AM_REG_CTIMER_CTRL2_CTLINK2_S                31
+#define AM_REG_CTIMER_CTRL2_CTLINK2_M                0x80000000
+#define AM_REG_CTIMER_CTRL2_CTLINK2(n)               (((uint32_t)(n) << 31) & 0x80000000)
+#define AM_REG_CTIMER_CTRL2_CTLINK2_TWO_16BIT_TIMERS 0x00000000
+#define AM_REG_CTIMER_CTRL2_CTLINK2_32BIT_TIMER      0x80000000
+
+// Counter/Timer B2 Output Enable bit.
+#define AM_REG_CTIMER_CTRL2_TMRB2PE_S                29
+#define AM_REG_CTIMER_CTRL2_TMRB2PE_M                0x20000000
+#define AM_REG_CTIMER_CTRL2_TMRB2PE(n)               (((uint32_t)(n) << 29) & 0x20000000)
+#define AM_REG_CTIMER_CTRL2_TMRB2PE_DIS              0x00000000
+#define AM_REG_CTIMER_CTRL2_TMRB2PE_EN               0x20000000
+
+// Counter/Timer B2 output polarity.
+#define AM_REG_CTIMER_CTRL2_TMRB2POL_S               28
+#define AM_REG_CTIMER_CTRL2_TMRB2POL_M               0x10000000
+#define AM_REG_CTIMER_CTRL2_TMRB2POL(n)              (((uint32_t)(n) << 28) & 0x10000000)
+#define AM_REG_CTIMER_CTRL2_TMRB2POL_NORMAL          0x00000000
+#define AM_REG_CTIMER_CTRL2_TMRB2POL_INVERTED        0x10000000
+
+// Counter/Timer B2 Clear bit.
+#define AM_REG_CTIMER_CTRL2_TMRB2CLR_S               27
+#define AM_REG_CTIMER_CTRL2_TMRB2CLR_M               0x08000000
+#define AM_REG_CTIMER_CTRL2_TMRB2CLR(n)              (((uint32_t)(n) << 27) & 0x08000000)
+#define AM_REG_CTIMER_CTRL2_TMRB2CLR_RUN             0x00000000
+#define AM_REG_CTIMER_CTRL2_TMRB2CLR_CLEAR           0x08000000
+
+// Counter/Timer B2 Interrupt Enable bit for COMPR1.
+#define AM_REG_CTIMER_CTRL2_TMRB2IE1_S               26
+#define AM_REG_CTIMER_CTRL2_TMRB2IE1_M               0x04000000
+#define AM_REG_CTIMER_CTRL2_TMRB2IE1(n)              (((uint32_t)(n) << 26) & 0x04000000)
+#define AM_REG_CTIMER_CTRL2_TMRB2IE1_DIS             0x00000000
+#define AM_REG_CTIMER_CTRL2_TMRB2IE1_EN              0x04000000
+
+// Counter/Timer B2 Interrupt Enable bit for COMPR0.
+#define AM_REG_CTIMER_CTRL2_TMRB2IE0_S               25
+#define AM_REG_CTIMER_CTRL2_TMRB2IE0_M               0x02000000
+#define AM_REG_CTIMER_CTRL2_TMRB2IE0(n)              (((uint32_t)(n) << 25) & 0x02000000)
+#define AM_REG_CTIMER_CTRL2_TMRB2IE0_DIS             0x00000000
+#define AM_REG_CTIMER_CTRL2_TMRB2IE0_EN              0x02000000
+
+// Counter/Timer B2 Function Select.
+#define AM_REG_CTIMER_CTRL2_TMRB2FN_S                22
+#define AM_REG_CTIMER_CTRL2_TMRB2FN_M                0x01C00000
+#define AM_REG_CTIMER_CTRL2_TMRB2FN(n)               (((uint32_t)(n) << 22) & 0x01C00000)
+#define AM_REG_CTIMER_CTRL2_TMRB2FN_SINGLECOUNT      0x00000000
+#define AM_REG_CTIMER_CTRL2_TMRB2FN_REPEATEDCOUNT    0x00400000
+#define AM_REG_CTIMER_CTRL2_TMRB2FN_PULSE_ONCE       0x00800000
+#define AM_REG_CTIMER_CTRL2_TMRB2FN_PULSE_CONT       0x00C00000
+#define AM_REG_CTIMER_CTRL2_TMRB2FN_CONTINUOUS       0x01000000
+
+// Counter/Timer B2 Clock Select.
+#define AM_REG_CTIMER_CTRL2_TMRB2CLK_S               17
+#define AM_REG_CTIMER_CTRL2_TMRB2CLK_M               0x003E0000
+#define AM_REG_CTIMER_CTRL2_TMRB2CLK(n)              (((uint32_t)(n) << 17) & 0x003E0000)
+#define AM_REG_CTIMER_CTRL2_TMRB2CLK_TMRPIN          0x00000000
+#define AM_REG_CTIMER_CTRL2_TMRB2CLK_HFRC_DIV4       0x00020000
+#define AM_REG_CTIMER_CTRL2_TMRB2CLK_HFRC_DIV16      0x00040000
+#define AM_REG_CTIMER_CTRL2_TMRB2CLK_HFRC_DIV256     0x00060000
+#define AM_REG_CTIMER_CTRL2_TMRB2CLK_HFRC_DIV1024    0x00080000
+#define AM_REG_CTIMER_CTRL2_TMRB2CLK_HFRC_DIV4K      0x000A0000
+#define AM_REG_CTIMER_CTRL2_TMRB2CLK_XT              0x000C0000
+#define AM_REG_CTIMER_CTRL2_TMRB2CLK_XT_DIV2         0x000E0000
+#define AM_REG_CTIMER_CTRL2_TMRB2CLK_XT_DIV16        0x00100000
+#define AM_REG_CTIMER_CTRL2_TMRB2CLK_XT_DIV256       0x00120000
+#define AM_REG_CTIMER_CTRL2_TMRB2CLK_LFRC_DIV2       0x00140000
+#define AM_REG_CTIMER_CTRL2_TMRB2CLK_LFRC_DIV32      0x00160000
+#define AM_REG_CTIMER_CTRL2_TMRB2CLK_LFRC_DIV1K      0x00180000
+#define AM_REG_CTIMER_CTRL2_TMRB2CLK_LFRC            0x001A0000
+#define AM_REG_CTIMER_CTRL2_TMRB2CLK_RTC_100HZ       0x001C0000
+#define AM_REG_CTIMER_CTRL2_TMRB2CLK_HCLK            0x001E0000
+#define AM_REG_CTIMER_CTRL2_TMRB2CLK_BUCKA           0x00200000
+
+// Counter/Timer B2 Enable bit.
+#define AM_REG_CTIMER_CTRL2_TMRB2EN_S                16
+#define AM_REG_CTIMER_CTRL2_TMRB2EN_M                0x00010000
+#define AM_REG_CTIMER_CTRL2_TMRB2EN(n)               (((uint32_t)(n) << 16) & 0x00010000)
+#define AM_REG_CTIMER_CTRL2_TMRB2EN_DIS              0x00000000
+#define AM_REG_CTIMER_CTRL2_TMRB2EN_EN               0x00010000
+
+// Counter/Timer A2 Output Enable bit.
+#define AM_REG_CTIMER_CTRL2_TMRA2PE_S                13
+#define AM_REG_CTIMER_CTRL2_TMRA2PE_M                0x00002000
+#define AM_REG_CTIMER_CTRL2_TMRA2PE(n)               (((uint32_t)(n) << 13) & 0x00002000)
+#define AM_REG_CTIMER_CTRL2_TMRA2PE_DIS              0x00000000
+#define AM_REG_CTIMER_CTRL2_TMRA2PE_EN               0x00002000
+
+// Counter/Timer A2 output polarity.
+#define AM_REG_CTIMER_CTRL2_TMRA2POL_S               12
+#define AM_REG_CTIMER_CTRL2_TMRA2POL_M               0x00001000
+#define AM_REG_CTIMER_CTRL2_TMRA2POL(n)              (((uint32_t)(n) << 12) & 0x00001000)
+#define AM_REG_CTIMER_CTRL2_TMRA2POL_NORMAL          0x00000000
+#define AM_REG_CTIMER_CTRL2_TMRA2POL_INVERTED        0x00001000
+
+// Counter/Timer A2 Clear bit.
+#define AM_REG_CTIMER_CTRL2_TMRA2CLR_S               11
+#define AM_REG_CTIMER_CTRL2_TMRA2CLR_M               0x00000800
+#define AM_REG_CTIMER_CTRL2_TMRA2CLR(n)              (((uint32_t)(n) << 11) & 0x00000800)
+#define AM_REG_CTIMER_CTRL2_TMRA2CLR_RUN             0x00000000
+#define AM_REG_CTIMER_CTRL2_TMRA2CLR_CLEAR           0x00000800
+
+// Counter/Timer A2 Interrupt Enable bit based on COMPR1.
+#define AM_REG_CTIMER_CTRL2_TMRA2IE1_S               10
+#define AM_REG_CTIMER_CTRL2_TMRA2IE1_M               0x00000400
+#define AM_REG_CTIMER_CTRL2_TMRA2IE1(n)              (((uint32_t)(n) << 10) & 0x00000400)
+#define AM_REG_CTIMER_CTRL2_TMRA2IE1_DIS             0x00000000
+#define AM_REG_CTIMER_CTRL2_TMRA2IE1_EN              0x00000400
+
+// Counter/Timer A2 Interrupt Enable bit based on COMPR0.
+#define AM_REG_CTIMER_CTRL2_TMRA2IE0_S               9
+#define AM_REG_CTIMER_CTRL2_TMRA2IE0_M               0x00000200
+#define AM_REG_CTIMER_CTRL2_TMRA2IE0(n)              (((uint32_t)(n) << 9) & 0x00000200)
+#define AM_REG_CTIMER_CTRL2_TMRA2IE0_DIS             0x00000000
+#define AM_REG_CTIMER_CTRL2_TMRA2IE0_EN              0x00000200
+
+// Counter/Timer A2 Function Select.
+#define AM_REG_CTIMER_CTRL2_TMRA2FN_S                6
+#define AM_REG_CTIMER_CTRL2_TMRA2FN_M                0x000001C0
+#define AM_REG_CTIMER_CTRL2_TMRA2FN(n)               (((uint32_t)(n) << 6) & 0x000001C0)
+#define AM_REG_CTIMER_CTRL2_TMRA2FN_SINGLECOUNT      0x00000000
+#define AM_REG_CTIMER_CTRL2_TMRA2FN_REPEATEDCOUNT    0x00000040
+#define AM_REG_CTIMER_CTRL2_TMRA2FN_PULSE_ONCE       0x00000080
+#define AM_REG_CTIMER_CTRL2_TMRA2FN_PULSE_CONT       0x000000C0
+#define AM_REG_CTIMER_CTRL2_TMRA2FN_CONTINUOUS       0x00000100
+
+// Counter/Timer A2 Clock Select.
+#define AM_REG_CTIMER_CTRL2_TMRA2CLK_S               1
+#define AM_REG_CTIMER_CTRL2_TMRA2CLK_M               0x0000003E
+#define AM_REG_CTIMER_CTRL2_TMRA2CLK(n)              (((uint32_t)(n) << 1) & 0x0000003E)
+#define AM_REG_CTIMER_CTRL2_TMRA2CLK_TMRPIN          0x00000000
+#define AM_REG_CTIMER_CTRL2_TMRA2CLK_HFRC_DIV4       0x00000002
+#define AM_REG_CTIMER_CTRL2_TMRA2CLK_HFRC_DIV16      0x00000004
+#define AM_REG_CTIMER_CTRL2_TMRA2CLK_HFRC_DIV256     0x00000006
+#define AM_REG_CTIMER_CTRL2_TMRA2CLK_HFRC_DIV1024    0x00000008
+#define AM_REG_CTIMER_CTRL2_TMRA2CLK_HFRC_DIV4K      0x0000000A
+#define AM_REG_CTIMER_CTRL2_TMRA2CLK_XT              0x0000000C
+#define AM_REG_CTIMER_CTRL2_TMRA2CLK_XT_DIV2         0x0000000E
+#define AM_REG_CTIMER_CTRL2_TMRA2CLK_XT_DIV16        0x00000010
+#define AM_REG_CTIMER_CTRL2_TMRA2CLK_XT_DIV256       0x00000012
+#define AM_REG_CTIMER_CTRL2_TMRA2CLK_LFRC_DIV2       0x00000014
+#define AM_REG_CTIMER_CTRL2_TMRA2CLK_LFRC_DIV32      0x00000016
+#define AM_REG_CTIMER_CTRL2_TMRA2CLK_LFRC_DIV1K      0x00000018
+#define AM_REG_CTIMER_CTRL2_TMRA2CLK_LFRC            0x0000001A
+#define AM_REG_CTIMER_CTRL2_TMRA2CLK_RTC_100HZ       0x0000001C
+#define AM_REG_CTIMER_CTRL2_TMRA2CLK_HCLK            0x0000001E
+#define AM_REG_CTIMER_CTRL2_TMRA2CLK_BUCKB           0x00000020
+
+// Counter/Timer A2 Enable bit.
+#define AM_REG_CTIMER_CTRL2_TMRA2EN_S                0
+#define AM_REG_CTIMER_CTRL2_TMRA2EN_M                0x00000001
+#define AM_REG_CTIMER_CTRL2_TMRA2EN(n)               (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_CTIMER_CTRL2_TMRA2EN_DIS              0x00000000
+#define AM_REG_CTIMER_CTRL2_TMRA2EN_EN               0x00000001
+
+//*****************************************************************************
+//
+// CTIMER_TMR3 - Counter/Timer Register
+//
+//*****************************************************************************
+// Counter/Timer B3.
+#define AM_REG_CTIMER_TMR3_CTTMRB3_S                 16
+#define AM_REG_CTIMER_TMR3_CTTMRB3_M                 0xFFFF0000
+#define AM_REG_CTIMER_TMR3_CTTMRB3(n)                (((uint32_t)(n) << 16) & 0xFFFF0000)
+
+// Counter/Timer A3.
+#define AM_REG_CTIMER_TMR3_CTTMRA3_S                 0
+#define AM_REG_CTIMER_TMR3_CTTMRA3_M                 0x0000FFFF
+#define AM_REG_CTIMER_TMR3_CTTMRA3(n)                (((uint32_t)(n) << 0) & 0x0000FFFF)
+
+//*****************************************************************************
+//
+// CTIMER_CMPRA3 - Counter/Timer A3 Compare Registers
+//
+//*****************************************************************************
+// Counter/Timer A3 Compare Register 1.
+#define AM_REG_CTIMER_CMPRA3_CMPR1A3_S               16
+#define AM_REG_CTIMER_CMPRA3_CMPR1A3_M               0xFFFF0000
+#define AM_REG_CTIMER_CMPRA3_CMPR1A3(n)              (((uint32_t)(n) << 16) & 0xFFFF0000)
+
+// Counter/Timer A3 Compare Register 0.
+#define AM_REG_CTIMER_CMPRA3_CMPR0A3_S               0
+#define AM_REG_CTIMER_CMPRA3_CMPR0A3_M               0x0000FFFF
+#define AM_REG_CTIMER_CMPRA3_CMPR0A3(n)              (((uint32_t)(n) << 0) & 0x0000FFFF)
+
+//*****************************************************************************
+//
+// CTIMER_CMPRB3 - Counter/Timer B3 Compare Registers
+//
+//*****************************************************************************
+// Counter/Timer B3 Compare Register 1.
+#define AM_REG_CTIMER_CMPRB3_CMPR1B3_S               16
+#define AM_REG_CTIMER_CMPRB3_CMPR1B3_M               0xFFFF0000
+#define AM_REG_CTIMER_CMPRB3_CMPR1B3(n)              (((uint32_t)(n) << 16) & 0xFFFF0000)
+
+// Counter/Timer B3 Compare Register 0.
+#define AM_REG_CTIMER_CMPRB3_CMPR0B3_S               0
+#define AM_REG_CTIMER_CMPRB3_CMPR0B3_M               0x0000FFFF
+#define AM_REG_CTIMER_CMPRB3_CMPR0B3(n)              (((uint32_t)(n) << 0) & 0x0000FFFF)
+
+//*****************************************************************************
+//
+// CTIMER_CTRL3 - Counter/Timer Control
+//
+//*****************************************************************************
+// Counter/Timer A3/B3 Link bit.
+#define AM_REG_CTIMER_CTRL3_CTLINK3_S                31
+#define AM_REG_CTIMER_CTRL3_CTLINK3_M                0x80000000
+#define AM_REG_CTIMER_CTRL3_CTLINK3(n)               (((uint32_t)(n) << 31) & 0x80000000)
+#define AM_REG_CTIMER_CTRL3_CTLINK3_TWO_16BIT_TIMERS 0x00000000
+#define AM_REG_CTIMER_CTRL3_CTLINK3_32BIT_TIMER      0x80000000
+
+// Counter/Timer B3 Output Enable bit.
+#define AM_REG_CTIMER_CTRL3_TMRB3PE_S                29
+#define AM_REG_CTIMER_CTRL3_TMRB3PE_M                0x20000000
+#define AM_REG_CTIMER_CTRL3_TMRB3PE(n)               (((uint32_t)(n) << 29) & 0x20000000)
+#define AM_REG_CTIMER_CTRL3_TMRB3PE_DIS              0x00000000
+#define AM_REG_CTIMER_CTRL3_TMRB3PE_EN               0x20000000
+
+// Counter/Timer B3 output polarity.
+#define AM_REG_CTIMER_CTRL3_TMRB3POL_S               28
+#define AM_REG_CTIMER_CTRL3_TMRB3POL_M               0x10000000
+#define AM_REG_CTIMER_CTRL3_TMRB3POL(n)              (((uint32_t)(n) << 28) & 0x10000000)
+#define AM_REG_CTIMER_CTRL3_TMRB3POL_NORMAL          0x00000000
+#define AM_REG_CTIMER_CTRL3_TMRB3POL_INVERTED        0x10000000
+
+// Counter/Timer B3 Clear bit.
+#define AM_REG_CTIMER_CTRL3_TMRB3CLR_S               27
+#define AM_REG_CTIMER_CTRL3_TMRB3CLR_M               0x08000000
+#define AM_REG_CTIMER_CTRL3_TMRB3CLR(n)              (((uint32_t)(n) << 27) & 0x08000000)
+#define AM_REG_CTIMER_CTRL3_TMRB3CLR_RUN             0x00000000
+#define AM_REG_CTIMER_CTRL3_TMRB3CLR_CLEAR           0x08000000
+
+// Counter/Timer B3 Interrupt Enable bit for COMPR1.
+#define AM_REG_CTIMER_CTRL3_TMRB3IE1_S               26
+#define AM_REG_CTIMER_CTRL3_TMRB3IE1_M               0x04000000
+#define AM_REG_CTIMER_CTRL3_TMRB3IE1(n)              (((uint32_t)(n) << 26) & 0x04000000)
+#define AM_REG_CTIMER_CTRL3_TMRB3IE1_DIS             0x00000000
+#define AM_REG_CTIMER_CTRL3_TMRB3IE1_EN              0x04000000
+
+// Counter/Timer B3 Interrupt Enable bit for COMPR0.
+#define AM_REG_CTIMER_CTRL3_TMRB3IE0_S               25
+#define AM_REG_CTIMER_CTRL3_TMRB3IE0_M               0x02000000
+#define AM_REG_CTIMER_CTRL3_TMRB3IE0(n)              (((uint32_t)(n) << 25) & 0x02000000)
+#define AM_REG_CTIMER_CTRL3_TMRB3IE0_DIS             0x00000000
+#define AM_REG_CTIMER_CTRL3_TMRB3IE0_EN              0x02000000
+
+// Counter/Timer B3 Function Select.
+#define AM_REG_CTIMER_CTRL3_TMRB3FN_S                22
+#define AM_REG_CTIMER_CTRL3_TMRB3FN_M                0x01C00000
+#define AM_REG_CTIMER_CTRL3_TMRB3FN(n)               (((uint32_t)(n) << 22) & 0x01C00000)
+#define AM_REG_CTIMER_CTRL3_TMRB3FN_SINGLECOUNT      0x00000000
+#define AM_REG_CTIMER_CTRL3_TMRB3FN_REPEATEDCOUNT    0x00400000
+#define AM_REG_CTIMER_CTRL3_TMRB3FN_PULSE_ONCE       0x00800000
+#define AM_REG_CTIMER_CTRL3_TMRB3FN_PULSE_CONT       0x00C00000
+#define AM_REG_CTIMER_CTRL3_TMRB3FN_CONTINUOUS       0x01000000
+
+// Counter/Timer B3 Clock Select.
+#define AM_REG_CTIMER_CTRL3_TMRB3CLK_S               17
+#define AM_REG_CTIMER_CTRL3_TMRB3CLK_M               0x003E0000
+#define AM_REG_CTIMER_CTRL3_TMRB3CLK(n)              (((uint32_t)(n) << 17) & 0x003E0000)
+#define AM_REG_CTIMER_CTRL3_TMRB3CLK_TMRPIN          0x00000000
+#define AM_REG_CTIMER_CTRL3_TMRB3CLK_HFRC_DIV4       0x00020000
+#define AM_REG_CTIMER_CTRL3_TMRB3CLK_HFRC_DIV16      0x00040000
+#define AM_REG_CTIMER_CTRL3_TMRB3CLK_HFRC_DIV256     0x00060000
+#define AM_REG_CTIMER_CTRL3_TMRB3CLK_HFRC_DIV1024    0x00080000
+#define AM_REG_CTIMER_CTRL3_TMRB3CLK_HFRC_DIV4K      0x000A0000
+#define AM_REG_CTIMER_CTRL3_TMRB3CLK_XT              0x000C0000
+#define AM_REG_CTIMER_CTRL3_TMRB3CLK_XT_DIV2         0x000E0000
+#define AM_REG_CTIMER_CTRL3_TMRB3CLK_XT_DIV16        0x00100000
+#define AM_REG_CTIMER_CTRL3_TMRB3CLK_XT_DIV256       0x00120000
+#define AM_REG_CTIMER_CTRL3_TMRB3CLK_LFRC_DIV2       0x00140000
+#define AM_REG_CTIMER_CTRL3_TMRB3CLK_LFRC_DIV32      0x00160000
+#define AM_REG_CTIMER_CTRL3_TMRB3CLK_LFRC_DIV1K      0x00180000
+#define AM_REG_CTIMER_CTRL3_TMRB3CLK_LFRC            0x001A0000
+#define AM_REG_CTIMER_CTRL3_TMRB3CLK_RTC_100HZ       0x001C0000
+#define AM_REG_CTIMER_CTRL3_TMRB3CLK_HCLK            0x001E0000
+#define AM_REG_CTIMER_CTRL3_TMRB3CLK_BUCKA           0x00200000
+
+// Counter/Timer B3 Enable bit.
+#define AM_REG_CTIMER_CTRL3_TMRB3EN_S                16
+#define AM_REG_CTIMER_CTRL3_TMRB3EN_M                0x00010000
+#define AM_REG_CTIMER_CTRL3_TMRB3EN(n)               (((uint32_t)(n) << 16) & 0x00010000)
+#define AM_REG_CTIMER_CTRL3_TMRB3EN_DIS              0x00000000
+#define AM_REG_CTIMER_CTRL3_TMRB3EN_EN               0x00010000
+
+// Special Timer A3 enable for ADC function.
+#define AM_REG_CTIMER_CTRL3_ADCEN_S                  15
+#define AM_REG_CTIMER_CTRL3_ADCEN_M                  0x00008000
+#define AM_REG_CTIMER_CTRL3_ADCEN(n)                 (((uint32_t)(n) << 15) & 0x00008000)
+
+// Counter/Timer A3 Output Enable bit.
+#define AM_REG_CTIMER_CTRL3_TMRA3PE_S                13
+#define AM_REG_CTIMER_CTRL3_TMRA3PE_M                0x00002000
+#define AM_REG_CTIMER_CTRL3_TMRA3PE(n)               (((uint32_t)(n) << 13) & 0x00002000)
+#define AM_REG_CTIMER_CTRL3_TMRA3PE_DIS              0x00000000
+#define AM_REG_CTIMER_CTRL3_TMRA3PE_EN               0x00002000
+
+// Counter/Timer A3 output polarity.
+#define AM_REG_CTIMER_CTRL3_TMRA3POL_S               12
+#define AM_REG_CTIMER_CTRL3_TMRA3POL_M               0x00001000
+#define AM_REG_CTIMER_CTRL3_TMRA3POL(n)              (((uint32_t)(n) << 12) & 0x00001000)
+#define AM_REG_CTIMER_CTRL3_TMRA3POL_NORMAL          0x00000000
+#define AM_REG_CTIMER_CTRL3_TMRA3POL_INVERTED        0x00001000
+
+// Counter/Timer A3 Clear bit.
+#define AM_REG_CTIMER_CTRL3_TMRA3CLR_S               11
+#define AM_REG_CTIMER_CTRL3_TMRA3CLR_M               0x00000800
+#define AM_REG_CTIMER_CTRL3_TMRA3CLR(n)              (((uint32_t)(n) << 11) & 0x00000800)
+#define AM_REG_CTIMER_CTRL3_TMRA3CLR_RUN             0x00000000
+#define AM_REG_CTIMER_CTRL3_TMRA3CLR_CLEAR           0x00000800
+
+// Counter/Timer A3 Interrupt Enable bit based on COMPR1.
+#define AM_REG_CTIMER_CTRL3_TMRA3IE1_S               10
+#define AM_REG_CTIMER_CTRL3_TMRA3IE1_M               0x00000400
+#define AM_REG_CTIMER_CTRL3_TMRA3IE1(n)              (((uint32_t)(n) << 10) & 0x00000400)
+#define AM_REG_CTIMER_CTRL3_TMRA3IE1_DIS             0x00000000
+#define AM_REG_CTIMER_CTRL3_TMRA3IE1_EN              0x00000400
+
+// Counter/Timer A3 Interrupt Enable bit based on COMPR0.
+#define AM_REG_CTIMER_CTRL3_TMRA3IE0_S               9
+#define AM_REG_CTIMER_CTRL3_TMRA3IE0_M               0x00000200
+#define AM_REG_CTIMER_CTRL3_TMRA3IE0(n)              (((uint32_t)(n) << 9) & 0x00000200)
+#define AM_REG_CTIMER_CTRL3_TMRA3IE0_DIS             0x00000000
+#define AM_REG_CTIMER_CTRL3_TMRA3IE0_EN              0x00000200
+
+// Counter/Timer A3 Function Select.
+#define AM_REG_CTIMER_CTRL3_TMRA3FN_S                6
+#define AM_REG_CTIMER_CTRL3_TMRA3FN_M                0x000001C0
+#define AM_REG_CTIMER_CTRL3_TMRA3FN(n)               (((uint32_t)(n) << 6) & 0x000001C0)
+#define AM_REG_CTIMER_CTRL3_TMRA3FN_SINGLECOUNT      0x00000000
+#define AM_REG_CTIMER_CTRL3_TMRA3FN_REPEATEDCOUNT    0x00000040
+#define AM_REG_CTIMER_CTRL3_TMRA3FN_PULSE_ONCE       0x00000080
+#define AM_REG_CTIMER_CTRL3_TMRA3FN_PULSE_CONT       0x000000C0
+#define AM_REG_CTIMER_CTRL3_TMRA3FN_CONTINUOUS       0x00000100
+
+// Counter/Timer A3 Clock Select.
+#define AM_REG_CTIMER_CTRL3_TMRA3CLK_S               1
+#define AM_REG_CTIMER_CTRL3_TMRA3CLK_M               0x0000003E
+#define AM_REG_CTIMER_CTRL3_TMRA3CLK(n)              (((uint32_t)(n) << 1) & 0x0000003E)
+#define AM_REG_CTIMER_CTRL3_TMRA3CLK_TMRPIN          0x00000000
+#define AM_REG_CTIMER_CTRL3_TMRA3CLK_HFRC_DIV4       0x00000002
+#define AM_REG_CTIMER_CTRL3_TMRA3CLK_HFRC_DIV16      0x00000004
+#define AM_REG_CTIMER_CTRL3_TMRA3CLK_HFRC_DIV256     0x00000006
+#define AM_REG_CTIMER_CTRL3_TMRA3CLK_HFRC_DIV1024    0x00000008
+#define AM_REG_CTIMER_CTRL3_TMRA3CLK_HFRC_DIV4K      0x0000000A
+#define AM_REG_CTIMER_CTRL3_TMRA3CLK_XT              0x0000000C
+#define AM_REG_CTIMER_CTRL3_TMRA3CLK_XT_DIV2         0x0000000E
+#define AM_REG_CTIMER_CTRL3_TMRA3CLK_XT_DIV16        0x00000010
+#define AM_REG_CTIMER_CTRL3_TMRA3CLK_XT_DIV256       0x00000012
+#define AM_REG_CTIMER_CTRL3_TMRA3CLK_LFRC_DIV2       0x00000014
+#define AM_REG_CTIMER_CTRL3_TMRA3CLK_LFRC_DIV32      0x00000016
+#define AM_REG_CTIMER_CTRL3_TMRA3CLK_LFRC_DIV1K      0x00000018
+#define AM_REG_CTIMER_CTRL3_TMRA3CLK_LFRC            0x0000001A
+#define AM_REG_CTIMER_CTRL3_TMRA3CLK_RTC_100HZ       0x0000001C
+#define AM_REG_CTIMER_CTRL3_TMRA3CLK_HCLK            0x0000001E
+#define AM_REG_CTIMER_CTRL3_TMRA3CLK_BUCKB           0x00000020
+
+// Counter/Timer A3 Enable bit.
+#define AM_REG_CTIMER_CTRL3_TMRA3EN_S                0
+#define AM_REG_CTIMER_CTRL3_TMRA3EN_M                0x00000001
+#define AM_REG_CTIMER_CTRL3_TMRA3EN(n)               (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_CTIMER_CTRL3_TMRA3EN_DIS              0x00000000
+#define AM_REG_CTIMER_CTRL3_TMRA3EN_EN               0x00000001
+
+//*****************************************************************************
+//
+// CTIMER_STCFG - Configuration Register
+//
+//*****************************************************************************
+// Set this bit to one to freeze the clock input to the COUNTER register. Once
+// frozen, the value can be safely written from the MCU.  Unfreeze to resume.
+#define AM_REG_CTIMER_STCFG_FREEZE_S                 31
+#define AM_REG_CTIMER_STCFG_FREEZE_M                 0x80000000
+#define AM_REG_CTIMER_STCFG_FREEZE(n)                (((uint32_t)(n) << 31) & 0x80000000)
+#define AM_REG_CTIMER_STCFG_FREEZE_THAW              0x00000000
+#define AM_REG_CTIMER_STCFG_FREEZE_FREEZE            0x80000000
+
+// Set this bit to one to clear the System Timer register.  If this bit is set
+// to '1', the system timer register will stay cleared.  It needs to be set to
+// '0' for the system timer to start running.
+#define AM_REG_CTIMER_STCFG_CLEAR_S                  30
+#define AM_REG_CTIMER_STCFG_CLEAR_M                  0x40000000
+#define AM_REG_CTIMER_STCFG_CLEAR(n)                 (((uint32_t)(n) << 30) & 0x40000000)
+#define AM_REG_CTIMER_STCFG_CLEAR_RUN                0x00000000
+#define AM_REG_CTIMER_STCFG_CLEAR_CLEAR              0x40000000
+
+// Selects whether compare is enabled for the corresponding SCMPR register. If
+// compare is enabled, the interrupt status is set once the comparision is met.
+#define AM_REG_CTIMER_STCFG_COMPARE_H_EN_S           15
+#define AM_REG_CTIMER_STCFG_COMPARE_H_EN_M           0x00008000
+#define AM_REG_CTIMER_STCFG_COMPARE_H_EN(n)          (((uint32_t)(n) << 15) & 0x00008000)
+#define AM_REG_CTIMER_STCFG_COMPARE_H_EN_DISABLE     0x00000000
+#define AM_REG_CTIMER_STCFG_COMPARE_H_EN_ENABLE      0x00008000
+
+// Selects whether compare is enabled for the corresponding SCMPR register. If
+// compare is enabled, the interrupt status is set once the comparision is met.
+#define AM_REG_CTIMER_STCFG_COMPARE_G_EN_S           14
+#define AM_REG_CTIMER_STCFG_COMPARE_G_EN_M           0x00004000
+#define AM_REG_CTIMER_STCFG_COMPARE_G_EN(n)          (((uint32_t)(n) << 14) & 0x00004000)
+#define AM_REG_CTIMER_STCFG_COMPARE_G_EN_DISABLE     0x00000000
+#define AM_REG_CTIMER_STCFG_COMPARE_G_EN_ENABLE      0x00004000
+
+// Selects whether compare is enabled for the corresponding SCMPR register. If
+// compare is enabled, the interrupt status is set once the comparision is met.
+#define AM_REG_CTIMER_STCFG_COMPARE_F_EN_S           13
+#define AM_REG_CTIMER_STCFG_COMPARE_F_EN_M           0x00002000
+#define AM_REG_CTIMER_STCFG_COMPARE_F_EN(n)          (((uint32_t)(n) << 13) & 0x00002000)
+#define AM_REG_CTIMER_STCFG_COMPARE_F_EN_DISABLE     0x00000000
+#define AM_REG_CTIMER_STCFG_COMPARE_F_EN_ENABLE      0x00002000
+
+// Selects whether compare is enabled for the corresponding SCMPR register. If
+// compare is enabled, the interrupt status is set once the comparision is met.
+#define AM_REG_CTIMER_STCFG_COMPARE_E_EN_S           12
+#define AM_REG_CTIMER_STCFG_COMPARE_E_EN_M           0x00001000
+#define AM_REG_CTIMER_STCFG_COMPARE_E_EN(n)          (((uint32_t)(n) << 12) & 0x00001000)
+#define AM_REG_CTIMER_STCFG_COMPARE_E_EN_DISABLE     0x00000000
+#define AM_REG_CTIMER_STCFG_COMPARE_E_EN_ENABLE      0x00001000
+
+// Selects whether compare is enabled for the corresponding SCMPR register. If
+// compare is enabled, the interrupt status is set once the comparision is met.
+#define AM_REG_CTIMER_STCFG_COMPARE_D_EN_S           11
+#define AM_REG_CTIMER_STCFG_COMPARE_D_EN_M           0x00000800
+#define AM_REG_CTIMER_STCFG_COMPARE_D_EN(n)          (((uint32_t)(n) << 11) & 0x00000800)
+#define AM_REG_CTIMER_STCFG_COMPARE_D_EN_DISABLE     0x00000000
+#define AM_REG_CTIMER_STCFG_COMPARE_D_EN_ENABLE      0x00000800
+
+// Selects whether compare is enabled for the corresponding SCMPR register. If
+// compare is enabled, the interrupt status is set once the comparision is met.
+#define AM_REG_CTIMER_STCFG_COMPARE_C_EN_S           10
+#define AM_REG_CTIMER_STCFG_COMPARE_C_EN_M           0x00000400
+#define AM_REG_CTIMER_STCFG_COMPARE_C_EN(n)          (((uint32_t)(n) << 10) & 0x00000400)
+#define AM_REG_CTIMER_STCFG_COMPARE_C_EN_DISABLE     0x00000000
+#define AM_REG_CTIMER_STCFG_COMPARE_C_EN_ENABLE      0x00000400
+
+// Selects whether compare is enabled for the corresponding SCMPR register. If
+// compare is enabled, the interrupt status is set once the comparision is met.
+#define AM_REG_CTIMER_STCFG_COMPARE_B_EN_S           9
+#define AM_REG_CTIMER_STCFG_COMPARE_B_EN_M           0x00000200
+#define AM_REG_CTIMER_STCFG_COMPARE_B_EN(n)          (((uint32_t)(n) << 9) & 0x00000200)
+#define AM_REG_CTIMER_STCFG_COMPARE_B_EN_DISABLE     0x00000000
+#define AM_REG_CTIMER_STCFG_COMPARE_B_EN_ENABLE      0x00000200
+
+// Selects whether compare is enabled for the corresponding SCMPR register. If
+// compare is enabled, the interrupt status is set once the comparision is met.
+#define AM_REG_CTIMER_STCFG_COMPARE_A_EN_S           8
+#define AM_REG_CTIMER_STCFG_COMPARE_A_EN_M           0x00000100
+#define AM_REG_CTIMER_STCFG_COMPARE_A_EN(n)          (((uint32_t)(n) << 8) & 0x00000100)
+#define AM_REG_CTIMER_STCFG_COMPARE_A_EN_DISABLE     0x00000000
+#define AM_REG_CTIMER_STCFG_COMPARE_A_EN_ENABLE      0x00000100
+
+// Selects an appropriate clock source and divider to use for the System Timer
+// clock.
+#define AM_REG_CTIMER_STCFG_CLKSEL_S                 0
+#define AM_REG_CTIMER_STCFG_CLKSEL_M                 0x0000000F
+#define AM_REG_CTIMER_STCFG_CLKSEL(n)                (((uint32_t)(n) << 0) & 0x0000000F)
+#define AM_REG_CTIMER_STCFG_CLKSEL_NOCLK             0x00000000
+#define AM_REG_CTIMER_STCFG_CLKSEL_HFRC_DIV16        0x00000001
+#define AM_REG_CTIMER_STCFG_CLKSEL_HFRC_DIV256       0x00000002
+#define AM_REG_CTIMER_STCFG_CLKSEL_XTAL_DIV1         0x00000003
+#define AM_REG_CTIMER_STCFG_CLKSEL_XTAL_DIV2         0x00000004
+#define AM_REG_CTIMER_STCFG_CLKSEL_XTAL_DIV32        0x00000005
+#define AM_REG_CTIMER_STCFG_CLKSEL_LFRC_DIV1         0x00000006
+#define AM_REG_CTIMER_STCFG_CLKSEL_CTIMER0A          0x00000007
+#define AM_REG_CTIMER_STCFG_CLKSEL_CTIMER0B          0x00000008
+
+//*****************************************************************************
+//
+// CTIMER_STTMR - System Timer Count Register (Real Time Counter)
+//
+//*****************************************************************************
+// Value of the 32-bit counter as it ticks over.
+#define AM_REG_CTIMER_STTMR_VALUE_S                  0
+#define AM_REG_CTIMER_STTMR_VALUE_M                  0xFFFFFFFF
+#define AM_REG_CTIMER_STTMR_VALUE(n)                 (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// CTIMER_CAPTURE_CONTROL - Capture Control Register
+//
+//*****************************************************************************
+// Selects whether capture is enabled for the specified capture register.
+#define AM_REG_CTIMER_CAPTURE_CONTROL_CAPTURE_D_S    3
+#define AM_REG_CTIMER_CAPTURE_CONTROL_CAPTURE_D_M    0x00000008
+#define AM_REG_CTIMER_CAPTURE_CONTROL_CAPTURE_D(n)   (((uint32_t)(n) << 3) & 0x00000008)
+#define AM_REG_CTIMER_CAPTURE_CONTROL_CAPTURE_D_DISABLE 0x00000000
+#define AM_REG_CTIMER_CAPTURE_CONTROL_CAPTURE_D_ENABLE 0x00000008
+
+// Selects whether capture is enabled for the specified capture register.
+#define AM_REG_CTIMER_CAPTURE_CONTROL_CAPTURE_C_S    2
+#define AM_REG_CTIMER_CAPTURE_CONTROL_CAPTURE_C_M    0x00000004
+#define AM_REG_CTIMER_CAPTURE_CONTROL_CAPTURE_C(n)   (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_CTIMER_CAPTURE_CONTROL_CAPTURE_C_DISABLE 0x00000000
+#define AM_REG_CTIMER_CAPTURE_CONTROL_CAPTURE_C_ENABLE 0x00000004
+
+// Selects whether capture is enabled for the specified capture register.
+#define AM_REG_CTIMER_CAPTURE_CONTROL_CAPTURE_B_S    1
+#define AM_REG_CTIMER_CAPTURE_CONTROL_CAPTURE_B_M    0x00000002
+#define AM_REG_CTIMER_CAPTURE_CONTROL_CAPTURE_B(n)   (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_CTIMER_CAPTURE_CONTROL_CAPTURE_B_DISABLE 0x00000000
+#define AM_REG_CTIMER_CAPTURE_CONTROL_CAPTURE_B_ENABLE 0x00000002
+
+// Selects whether capture is enabled for the specified capture register.
+#define AM_REG_CTIMER_CAPTURE_CONTROL_CAPTURE_A_S    0
+#define AM_REG_CTIMER_CAPTURE_CONTROL_CAPTURE_A_M    0x00000001
+#define AM_REG_CTIMER_CAPTURE_CONTROL_CAPTURE_A(n)   (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_CTIMER_CAPTURE_CONTROL_CAPTURE_A_DISABLE 0x00000000
+#define AM_REG_CTIMER_CAPTURE_CONTROL_CAPTURE_A_ENABLE 0x00000001
+
+//*****************************************************************************
+//
+// CTIMER_SCMPR0 - Compare Register A
+//
+//*****************************************************************************
+// Compare this value to the value in the COUNTER register according to the
+// match criterion, as selected in the COMPARE_A_EN bit in the REG_CTIMER_STCGF
+// register.
+#define AM_REG_CTIMER_SCMPR0_VALUE_S                 0
+#define AM_REG_CTIMER_SCMPR0_VALUE_M                 0xFFFFFFFF
+#define AM_REG_CTIMER_SCMPR0_VALUE(n)                (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// CTIMER_SCMPR1 - Compare Register B
+//
+//*****************************************************************************
+// Compare this value to the value in the COUNTER register according to the
+// match criterion, as selected in the COMPARE_B_EN bit in the REG_CTIMER_STCGF
+// register.
+#define AM_REG_CTIMER_SCMPR1_VALUE_S                 0
+#define AM_REG_CTIMER_SCMPR1_VALUE_M                 0xFFFFFFFF
+#define AM_REG_CTIMER_SCMPR1_VALUE(n)                (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// CTIMER_SCMPR2 - Compare Register C
+//
+//*****************************************************************************
+// Compare this value to the value in the COUNTER register according to the
+// match criterion, as selected in the COMPARE_C_EN bit in the REG_CTIMER_STCGF
+// register.
+#define AM_REG_CTIMER_SCMPR2_VALUE_S                 0
+#define AM_REG_CTIMER_SCMPR2_VALUE_M                 0xFFFFFFFF
+#define AM_REG_CTIMER_SCMPR2_VALUE(n)                (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// CTIMER_SCMPR3 - Compare Register D
+//
+//*****************************************************************************
+// Compare this value to the value in the COUNTER register according to the
+// match criterion, as selected in the COMPARE_D_EN bit in the REG_CTIMER_STCGF
+// register.
+#define AM_REG_CTIMER_SCMPR3_VALUE_S                 0
+#define AM_REG_CTIMER_SCMPR3_VALUE_M                 0xFFFFFFFF
+#define AM_REG_CTIMER_SCMPR3_VALUE(n)                (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// CTIMER_SCMPR4 - Compare Register E
+//
+//*****************************************************************************
+// Compare this value to the value in the COUNTER register according to the
+// match criterion, as selected in the COMPARE_E_EN bit in the REG_CTIMER_STCGF
+// register.
+#define AM_REG_CTIMER_SCMPR4_VALUE_S                 0
+#define AM_REG_CTIMER_SCMPR4_VALUE_M                 0xFFFFFFFF
+#define AM_REG_CTIMER_SCMPR4_VALUE(n)                (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// CTIMER_SCMPR5 - Compare Register F
+//
+//*****************************************************************************
+// Compare this value to the value in the COUNTER register according to the
+// match criterion, as selected in the COMPARE_F_EN bit in the REG_CTIMER_STCGF
+// register.
+#define AM_REG_CTIMER_SCMPR5_VALUE_S                 0
+#define AM_REG_CTIMER_SCMPR5_VALUE_M                 0xFFFFFFFF
+#define AM_REG_CTIMER_SCMPR5_VALUE(n)                (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// CTIMER_SCMPR6 - Compare Register G
+//
+//*****************************************************************************
+// Compare this value to the value in the COUNTER register according to the
+// match criterion, as selected in the COMPARE_G_EN bit in the REG_CTIMER_STCGF
+// register.
+#define AM_REG_CTIMER_SCMPR6_VALUE_S                 0
+#define AM_REG_CTIMER_SCMPR6_VALUE_M                 0xFFFFFFFF
+#define AM_REG_CTIMER_SCMPR6_VALUE(n)                (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// CTIMER_SCMPR7 - Compare Register H
+//
+//*****************************************************************************
+// Compare this value to the value in the COUNTER register according to the
+// match criterion, as selected in the COMPARE_H_EN bit in the REG_CTIMER_STCGF
+// register.
+#define AM_REG_CTIMER_SCMPR7_VALUE_S                 0
+#define AM_REG_CTIMER_SCMPR7_VALUE_M                 0xFFFFFFFF
+#define AM_REG_CTIMER_SCMPR7_VALUE(n)                (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// CTIMER_SCAPT0 - Capture Register A
+//
+//*****************************************************************************
+// Whenever the event is detected, the value in the COUNTER is copied into this
+// register and the corresponding interrupt status bit is set.
+#define AM_REG_CTIMER_SCAPT0_VALUE_S                 0
+#define AM_REG_CTIMER_SCAPT0_VALUE_M                 0xFFFFFFFF
+#define AM_REG_CTIMER_SCAPT0_VALUE(n)                (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// CTIMER_SCAPT1 - Capture Register B
+//
+//*****************************************************************************
+// Whenever the event is detected, the value in the COUNTER is copied into this
+// register and the corresponding interrupt status bit is set.
+#define AM_REG_CTIMER_SCAPT1_VALUE_S                 0
+#define AM_REG_CTIMER_SCAPT1_VALUE_M                 0xFFFFFFFF
+#define AM_REG_CTIMER_SCAPT1_VALUE(n)                (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// CTIMER_SCAPT2 - Capture Register C
+//
+//*****************************************************************************
+// Whenever the event is detected, the value in the COUNTER is copied into this
+// register and the corresponding interrupt status bit is set.
+#define AM_REG_CTIMER_SCAPT2_VALUE_S                 0
+#define AM_REG_CTIMER_SCAPT2_VALUE_M                 0xFFFFFFFF
+#define AM_REG_CTIMER_SCAPT2_VALUE(n)                (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// CTIMER_SCAPT3 - Capture Register D
+//
+//*****************************************************************************
+// Whenever the event is detected, the value in the COUNTER is copied into this
+// register and the corresponding interrupt status bit is set.
+#define AM_REG_CTIMER_SCAPT3_VALUE_S                 0
+#define AM_REG_CTIMER_SCAPT3_VALUE_M                 0xFFFFFFFF
+#define AM_REG_CTIMER_SCAPT3_VALUE(n)                (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// CTIMER_SNVR0 - System Timer NVRAM_A Register
+//
+//*****************************************************************************
+// Value of the 32-bit counter as it ticks over.
+#define AM_REG_CTIMER_SNVR0_VALUE_S                  0
+#define AM_REG_CTIMER_SNVR0_VALUE_M                  0xFFFFFFFF
+#define AM_REG_CTIMER_SNVR0_VALUE(n)                 (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// CTIMER_SNVR1 - System Timer NVRAM_B Register
+//
+//*****************************************************************************
+// Value of the 32-bit counter as it ticks over.
+#define AM_REG_CTIMER_SNVR1_VALUE_S                  0
+#define AM_REG_CTIMER_SNVR1_VALUE_M                  0xFFFFFFFF
+#define AM_REG_CTIMER_SNVR1_VALUE(n)                 (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// CTIMER_SNVR2 - System Timer NVRAM_C Register
+//
+//*****************************************************************************
+// Value of the 32-bit counter as it ticks over.
+#define AM_REG_CTIMER_SNVR2_VALUE_S                  0
+#define AM_REG_CTIMER_SNVR2_VALUE_M                  0xFFFFFFFF
+#define AM_REG_CTIMER_SNVR2_VALUE(n)                 (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+#endif // AM_REG_CTIMER_H
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_flashctrl.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_flashctrl.h
new file mode 100644
index 000000000..ecf20fd9b
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_flashctrl.h
@@ -0,0 +1,67 @@
+//*****************************************************************************
+//
+//! @file am_reg_flashctrl.h
+//!
+//! @brief Register macros for the FLASHCTRL module
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_REG_FLASHCTRL_H
+#define AM_REG_FLASHCTRL_H
+
+//*****************************************************************************
+//
+// Instance finder. (1 instance(s) available)
+//
+//*****************************************************************************
+#define AM_REG_FLASHCTRL_NUM_MODULES                 1
+#define AM_REG_FLASHCTRLn(n) \
+    (REG_FLASHCTRL_BASEADDR + 0x00001000 * n)
+
+//*****************************************************************************
+//
+// Register offsets.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Key values.
+//
+//*****************************************************************************
+
+#endif // AM_REG_FLASHCTRL_H
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_gpio.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_gpio.h
new file mode 100644
index 000000000..1d6813e0b
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_gpio.h
@@ -0,0 +1,5217 @@
+//*****************************************************************************
+//
+//! @file am_reg_gpio.h
+//!
+//! @brief Register macros for the GPIO module
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_REG_GPIO_H
+#define AM_REG_GPIO_H
+
+//*****************************************************************************
+//
+// Instance finder. (1 instance(s) available)
+//
+//*****************************************************************************
+#define AM_REG_GPIO_NUM_MODULES                      1
+#define AM_REG_GPIOn(n) \
+    (REG_GPIO_BASEADDR + 0x00000000 * n)
+
+//*****************************************************************************
+//
+// Register offsets.
+//
+//*****************************************************************************
+#define AM_REG_GPIO_PADREGA_O                        0x00000000
+#define AM_REG_GPIO_PADREGB_O                        0x00000004
+#define AM_REG_GPIO_PADREGC_O                        0x00000008
+#define AM_REG_GPIO_PADREGD_O                        0x0000000C
+#define AM_REG_GPIO_PADREGE_O                        0x00000010
+#define AM_REG_GPIO_PADREGF_O                        0x00000014
+#define AM_REG_GPIO_PADREGG_O                        0x00000018
+#define AM_REG_GPIO_PADREGH_O                        0x0000001C
+#define AM_REG_GPIO_PADREGI_O                        0x00000020
+#define AM_REG_GPIO_PADREGJ_O                        0x00000024
+#define AM_REG_GPIO_PADREGK_O                        0x00000028
+#define AM_REG_GPIO_PADREGL_O                        0x0000002C
+#define AM_REG_GPIO_PADREGM_O                        0x00000030
+#define AM_REG_GPIO_CFGA_O                           0x00000040
+#define AM_REG_GPIO_CFGB_O                           0x00000044
+#define AM_REG_GPIO_CFGC_O                           0x00000048
+#define AM_REG_GPIO_CFGD_O                           0x0000004C
+#define AM_REG_GPIO_CFGE_O                           0x00000050
+#define AM_REG_GPIO_CFGF_O                           0x00000054
+#define AM_REG_GPIO_CFGG_O                           0x00000058
+#define AM_REG_GPIO_RDA_O                            0x00000080
+#define AM_REG_GPIO_RDB_O                            0x00000084
+#define AM_REG_GPIO_WTA_O                            0x00000088
+#define AM_REG_GPIO_WTB_O                            0x0000008C
+#define AM_REG_GPIO_WTSA_O                           0x00000090
+#define AM_REG_GPIO_WTSB_O                           0x00000094
+#define AM_REG_GPIO_WTCA_O                           0x00000098
+#define AM_REG_GPIO_WTCB_O                           0x0000009C
+#define AM_REG_GPIO_ENA_O                            0x000000A0
+#define AM_REG_GPIO_ENB_O                            0x000000A4
+#define AM_REG_GPIO_ENSA_O                           0x000000A8
+#define AM_REG_GPIO_ENSB_O                           0x000000AC
+#define AM_REG_GPIO_ENCA_O                           0x000000B4
+#define AM_REG_GPIO_ENCB_O                           0x000000B8
+#define AM_REG_GPIO_STMRCAP_O                        0x000000BC
+#define AM_REG_GPIO_IOM0IRQ_O                        0x000000C0
+#define AM_REG_GPIO_IOM1IRQ_O                        0x000000C4
+#define AM_REG_GPIO_IOM2IRQ_O                        0x000000C8
+#define AM_REG_GPIO_IOM3IRQ_O                        0x000000CC
+#define AM_REG_GPIO_IOM4IRQ_O                        0x000000D0
+#define AM_REG_GPIO_IOM5IRQ_O                        0x000000D4
+#define AM_REG_GPIO_LOOPBACK_O                       0x000000D8
+#define AM_REG_GPIO_GPIOOBS_O                        0x000000DC
+#define AM_REG_GPIO_ALTPADCFGA_O                     0x000000E0
+#define AM_REG_GPIO_ALTPADCFGB_O                     0x000000E4
+#define AM_REG_GPIO_ALTPADCFGC_O                     0x000000E8
+#define AM_REG_GPIO_ALTPADCFGD_O                     0x000000EC
+#define AM_REG_GPIO_ALTPADCFGE_O                     0x000000F0
+#define AM_REG_GPIO_ALTPADCFGF_O                     0x000000F4
+#define AM_REG_GPIO_ALTPADCFGG_O                     0x000000F8
+#define AM_REG_GPIO_ALTPADCFGH_O                     0x000000FC
+#define AM_REG_GPIO_ALTPADCFGI_O                     0x00000100
+#define AM_REG_GPIO_ALTPADCFGJ_O                     0x00000104
+#define AM_REG_GPIO_ALTPADCFGK_O                     0x00000108
+#define AM_REG_GPIO_ALTPADCFGL_O                     0x0000010C
+#define AM_REG_GPIO_ALTPADCFGM_O                     0x00000110
+#define AM_REG_GPIO_PADKEY_O                         0x00000060
+#define AM_REG_GPIO_INT0EN_O                         0x00000200
+#define AM_REG_GPIO_INT0STAT_O                       0x00000204
+#define AM_REG_GPIO_INT0CLR_O                        0x00000208
+#define AM_REG_GPIO_INT0SET_O                        0x0000020C
+#define AM_REG_GPIO_INT1EN_O                         0x00000210
+#define AM_REG_GPIO_INT1STAT_O                       0x00000214
+#define AM_REG_GPIO_INT1CLR_O                        0x00000218
+#define AM_REG_GPIO_INT1SET_O                        0x0000021C
+
+//*****************************************************************************
+//
+// Key values.
+//
+//*****************************************************************************
+#define AM_REG_GPIO_PADKEY_KEYVAL                    0x00000073
+
+//*****************************************************************************
+//
+// GPIO_INT0EN - GPIO Interrupt Registers 31-0: Enable
+//
+//*****************************************************************************
+// GPIO31 interrupt.
+#define AM_REG_GPIO_INT0EN_GPIO31_S                  31
+#define AM_REG_GPIO_INT0EN_GPIO31_M                  0x80000000
+#define AM_REG_GPIO_INT0EN_GPIO31(n)                 (((uint32_t)(n) << 31) & 0x80000000)
+
+// GPIO30 interrupt.
+#define AM_REG_GPIO_INT0EN_GPIO30_S                  30
+#define AM_REG_GPIO_INT0EN_GPIO30_M                  0x40000000
+#define AM_REG_GPIO_INT0EN_GPIO30(n)                 (((uint32_t)(n) << 30) & 0x40000000)
+
+// GPIO29 interrupt.
+#define AM_REG_GPIO_INT0EN_GPIO29_S                  29
+#define AM_REG_GPIO_INT0EN_GPIO29_M                  0x20000000
+#define AM_REG_GPIO_INT0EN_GPIO29(n)                 (((uint32_t)(n) << 29) & 0x20000000)
+
+// GPIO28 interrupt.
+#define AM_REG_GPIO_INT0EN_GPIO28_S                  28
+#define AM_REG_GPIO_INT0EN_GPIO28_M                  0x10000000
+#define AM_REG_GPIO_INT0EN_GPIO28(n)                 (((uint32_t)(n) << 28) & 0x10000000)
+
+// GPIO27 interrupt.
+#define AM_REG_GPIO_INT0EN_GPIO27_S                  27
+#define AM_REG_GPIO_INT0EN_GPIO27_M                  0x08000000
+#define AM_REG_GPIO_INT0EN_GPIO27(n)                 (((uint32_t)(n) << 27) & 0x08000000)
+
+// GPIO26 interrupt.
+#define AM_REG_GPIO_INT0EN_GPIO26_S                  26
+#define AM_REG_GPIO_INT0EN_GPIO26_M                  0x04000000
+#define AM_REG_GPIO_INT0EN_GPIO26(n)                 (((uint32_t)(n) << 26) & 0x04000000)
+
+// GPIO25 interrupt.
+#define AM_REG_GPIO_INT0EN_GPIO25_S                  25
+#define AM_REG_GPIO_INT0EN_GPIO25_M                  0x02000000
+#define AM_REG_GPIO_INT0EN_GPIO25(n)                 (((uint32_t)(n) << 25) & 0x02000000)
+
+// GPIO24 interrupt.
+#define AM_REG_GPIO_INT0EN_GPIO24_S                  24
+#define AM_REG_GPIO_INT0EN_GPIO24_M                  0x01000000
+#define AM_REG_GPIO_INT0EN_GPIO24(n)                 (((uint32_t)(n) << 24) & 0x01000000)
+
+// GPIO23 interrupt.
+#define AM_REG_GPIO_INT0EN_GPIO23_S                  23
+#define AM_REG_GPIO_INT0EN_GPIO23_M                  0x00800000
+#define AM_REG_GPIO_INT0EN_GPIO23(n)                 (((uint32_t)(n) << 23) & 0x00800000)
+
+// GPIO22 interrupt.
+#define AM_REG_GPIO_INT0EN_GPIO22_S                  22
+#define AM_REG_GPIO_INT0EN_GPIO22_M                  0x00400000
+#define AM_REG_GPIO_INT0EN_GPIO22(n)                 (((uint32_t)(n) << 22) & 0x00400000)
+
+// GPIO21 interrupt.
+#define AM_REG_GPIO_INT0EN_GPIO21_S                  21
+#define AM_REG_GPIO_INT0EN_GPIO21_M                  0x00200000
+#define AM_REG_GPIO_INT0EN_GPIO21(n)                 (((uint32_t)(n) << 21) & 0x00200000)
+
+// GPIO20 interrupt.
+#define AM_REG_GPIO_INT0EN_GPIO20_S                  20
+#define AM_REG_GPIO_INT0EN_GPIO20_M                  0x00100000
+#define AM_REG_GPIO_INT0EN_GPIO20(n)                 (((uint32_t)(n) << 20) & 0x00100000)
+
+// GPIO19 interrupt.
+#define AM_REG_GPIO_INT0EN_GPIO19_S                  19
+#define AM_REG_GPIO_INT0EN_GPIO19_M                  0x00080000
+#define AM_REG_GPIO_INT0EN_GPIO19(n)                 (((uint32_t)(n) << 19) & 0x00080000)
+
+// GPIO18interrupt.
+#define AM_REG_GPIO_INT0EN_GPIO18_S                  18
+#define AM_REG_GPIO_INT0EN_GPIO18_M                  0x00040000
+#define AM_REG_GPIO_INT0EN_GPIO18(n)                 (((uint32_t)(n) << 18) & 0x00040000)
+
+// GPIO17 interrupt.
+#define AM_REG_GPIO_INT0EN_GPIO17_S                  17
+#define AM_REG_GPIO_INT0EN_GPIO17_M                  0x00020000
+#define AM_REG_GPIO_INT0EN_GPIO17(n)                 (((uint32_t)(n) << 17) & 0x00020000)
+
+// GPIO16 interrupt.
+#define AM_REG_GPIO_INT0EN_GPIO16_S                  16
+#define AM_REG_GPIO_INT0EN_GPIO16_M                  0x00010000
+#define AM_REG_GPIO_INT0EN_GPIO16(n)                 (((uint32_t)(n) << 16) & 0x00010000)
+
+// GPIO15 interrupt.
+#define AM_REG_GPIO_INT0EN_GPIO15_S                  15
+#define AM_REG_GPIO_INT0EN_GPIO15_M                  0x00008000
+#define AM_REG_GPIO_INT0EN_GPIO15(n)                 (((uint32_t)(n) << 15) & 0x00008000)
+
+// GPIO14 interrupt.
+#define AM_REG_GPIO_INT0EN_GPIO14_S                  14
+#define AM_REG_GPIO_INT0EN_GPIO14_M                  0x00004000
+#define AM_REG_GPIO_INT0EN_GPIO14(n)                 (((uint32_t)(n) << 14) & 0x00004000)
+
+// GPIO13 interrupt.
+#define AM_REG_GPIO_INT0EN_GPIO13_S                  13
+#define AM_REG_GPIO_INT0EN_GPIO13_M                  0x00002000
+#define AM_REG_GPIO_INT0EN_GPIO13(n)                 (((uint32_t)(n) << 13) & 0x00002000)
+
+// GPIO12 interrupt.
+#define AM_REG_GPIO_INT0EN_GPIO12_S                  12
+#define AM_REG_GPIO_INT0EN_GPIO12_M                  0x00001000
+#define AM_REG_GPIO_INT0EN_GPIO12(n)                 (((uint32_t)(n) << 12) & 0x00001000)
+
+// GPIO11 interrupt.
+#define AM_REG_GPIO_INT0EN_GPIO11_S                  11
+#define AM_REG_GPIO_INT0EN_GPIO11_M                  0x00000800
+#define AM_REG_GPIO_INT0EN_GPIO11(n)                 (((uint32_t)(n) << 11) & 0x00000800)
+
+// GPIO10 interrupt.
+#define AM_REG_GPIO_INT0EN_GPIO10_S                  10
+#define AM_REG_GPIO_INT0EN_GPIO10_M                  0x00000400
+#define AM_REG_GPIO_INT0EN_GPIO10(n)                 (((uint32_t)(n) << 10) & 0x00000400)
+
+// GPIO9 interrupt.
+#define AM_REG_GPIO_INT0EN_GPIO9_S                   9
+#define AM_REG_GPIO_INT0EN_GPIO9_M                   0x00000200
+#define AM_REG_GPIO_INT0EN_GPIO9(n)                  (((uint32_t)(n) << 9) & 0x00000200)
+
+// GPIO8 interrupt.
+#define AM_REG_GPIO_INT0EN_GPIO8_S                   8
+#define AM_REG_GPIO_INT0EN_GPIO8_M                   0x00000100
+#define AM_REG_GPIO_INT0EN_GPIO8(n)                  (((uint32_t)(n) << 8) & 0x00000100)
+
+// GPIO7 interrupt.
+#define AM_REG_GPIO_INT0EN_GPIO7_S                   7
+#define AM_REG_GPIO_INT0EN_GPIO7_M                   0x00000080
+#define AM_REG_GPIO_INT0EN_GPIO7(n)                  (((uint32_t)(n) << 7) & 0x00000080)
+
+// GPIO6 interrupt.
+#define AM_REG_GPIO_INT0EN_GPIO6_S                   6
+#define AM_REG_GPIO_INT0EN_GPIO6_M                   0x00000040
+#define AM_REG_GPIO_INT0EN_GPIO6(n)                  (((uint32_t)(n) << 6) & 0x00000040)
+
+// GPIO5 interrupt.
+#define AM_REG_GPIO_INT0EN_GPIO5_S                   5
+#define AM_REG_GPIO_INT0EN_GPIO5_M                   0x00000020
+#define AM_REG_GPIO_INT0EN_GPIO5(n)                  (((uint32_t)(n) << 5) & 0x00000020)
+
+// GPIO4 interrupt.
+#define AM_REG_GPIO_INT0EN_GPIO4_S                   4
+#define AM_REG_GPIO_INT0EN_GPIO4_M                   0x00000010
+#define AM_REG_GPIO_INT0EN_GPIO4(n)                  (((uint32_t)(n) << 4) & 0x00000010)
+
+// GPIO3 interrupt.
+#define AM_REG_GPIO_INT0EN_GPIO3_S                   3
+#define AM_REG_GPIO_INT0EN_GPIO3_M                   0x00000008
+#define AM_REG_GPIO_INT0EN_GPIO3(n)                  (((uint32_t)(n) << 3) & 0x00000008)
+
+// GPIO2 interrupt.
+#define AM_REG_GPIO_INT0EN_GPIO2_S                   2
+#define AM_REG_GPIO_INT0EN_GPIO2_M                   0x00000004
+#define AM_REG_GPIO_INT0EN_GPIO2(n)                  (((uint32_t)(n) << 2) & 0x00000004)
+
+// GPIO1 interrupt.
+#define AM_REG_GPIO_INT0EN_GPIO1_S                   1
+#define AM_REG_GPIO_INT0EN_GPIO1_M                   0x00000002
+#define AM_REG_GPIO_INT0EN_GPIO1(n)                  (((uint32_t)(n) << 1) & 0x00000002)
+
+// GPIO0 interrupt.
+#define AM_REG_GPIO_INT0EN_GPIO0_S                   0
+#define AM_REG_GPIO_INT0EN_GPIO0_M                   0x00000001
+#define AM_REG_GPIO_INT0EN_GPIO0(n)                  (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// GPIO_INT0STAT - GPIO Interrupt Registers 31-0: Status
+//
+//*****************************************************************************
+// GPIO31 interrupt.
+#define AM_REG_GPIO_INT0STAT_GPIO31_S                31
+#define AM_REG_GPIO_INT0STAT_GPIO31_M                0x80000000
+#define AM_REG_GPIO_INT0STAT_GPIO31(n)               (((uint32_t)(n) << 31) & 0x80000000)
+
+// GPIO30 interrupt.
+#define AM_REG_GPIO_INT0STAT_GPIO30_S                30
+#define AM_REG_GPIO_INT0STAT_GPIO30_M                0x40000000
+#define AM_REG_GPIO_INT0STAT_GPIO30(n)               (((uint32_t)(n) << 30) & 0x40000000)
+
+// GPIO29 interrupt.
+#define AM_REG_GPIO_INT0STAT_GPIO29_S                29
+#define AM_REG_GPIO_INT0STAT_GPIO29_M                0x20000000
+#define AM_REG_GPIO_INT0STAT_GPIO29(n)               (((uint32_t)(n) << 29) & 0x20000000)
+
+// GPIO28 interrupt.
+#define AM_REG_GPIO_INT0STAT_GPIO28_S                28
+#define AM_REG_GPIO_INT0STAT_GPIO28_M                0x10000000
+#define AM_REG_GPIO_INT0STAT_GPIO28(n)               (((uint32_t)(n) << 28) & 0x10000000)
+
+// GPIO27 interrupt.
+#define AM_REG_GPIO_INT0STAT_GPIO27_S                27
+#define AM_REG_GPIO_INT0STAT_GPIO27_M                0x08000000
+#define AM_REG_GPIO_INT0STAT_GPIO27(n)               (((uint32_t)(n) << 27) & 0x08000000)
+
+// GPIO26 interrupt.
+#define AM_REG_GPIO_INT0STAT_GPIO26_S                26
+#define AM_REG_GPIO_INT0STAT_GPIO26_M                0x04000000
+#define AM_REG_GPIO_INT0STAT_GPIO26(n)               (((uint32_t)(n) << 26) & 0x04000000)
+
+// GPIO25 interrupt.
+#define AM_REG_GPIO_INT0STAT_GPIO25_S                25
+#define AM_REG_GPIO_INT0STAT_GPIO25_M                0x02000000
+#define AM_REG_GPIO_INT0STAT_GPIO25(n)               (((uint32_t)(n) << 25) & 0x02000000)
+
+// GPIO24 interrupt.
+#define AM_REG_GPIO_INT0STAT_GPIO24_S                24
+#define AM_REG_GPIO_INT0STAT_GPIO24_M                0x01000000
+#define AM_REG_GPIO_INT0STAT_GPIO24(n)               (((uint32_t)(n) << 24) & 0x01000000)
+
+// GPIO23 interrupt.
+#define AM_REG_GPIO_INT0STAT_GPIO23_S                23
+#define AM_REG_GPIO_INT0STAT_GPIO23_M                0x00800000
+#define AM_REG_GPIO_INT0STAT_GPIO23(n)               (((uint32_t)(n) << 23) & 0x00800000)
+
+// GPIO22 interrupt.
+#define AM_REG_GPIO_INT0STAT_GPIO22_S                22
+#define AM_REG_GPIO_INT0STAT_GPIO22_M                0x00400000
+#define AM_REG_GPIO_INT0STAT_GPIO22(n)               (((uint32_t)(n) << 22) & 0x00400000)
+
+// GPIO21 interrupt.
+#define AM_REG_GPIO_INT0STAT_GPIO21_S                21
+#define AM_REG_GPIO_INT0STAT_GPIO21_M                0x00200000
+#define AM_REG_GPIO_INT0STAT_GPIO21(n)               (((uint32_t)(n) << 21) & 0x00200000)
+
+// GPIO20 interrupt.
+#define AM_REG_GPIO_INT0STAT_GPIO20_S                20
+#define AM_REG_GPIO_INT0STAT_GPIO20_M                0x00100000
+#define AM_REG_GPIO_INT0STAT_GPIO20(n)               (((uint32_t)(n) << 20) & 0x00100000)
+
+// GPIO19 interrupt.
+#define AM_REG_GPIO_INT0STAT_GPIO19_S                19
+#define AM_REG_GPIO_INT0STAT_GPIO19_M                0x00080000
+#define AM_REG_GPIO_INT0STAT_GPIO19(n)               (((uint32_t)(n) << 19) & 0x00080000)
+
+// GPIO18interrupt.
+#define AM_REG_GPIO_INT0STAT_GPIO18_S                18
+#define AM_REG_GPIO_INT0STAT_GPIO18_M                0x00040000
+#define AM_REG_GPIO_INT0STAT_GPIO18(n)               (((uint32_t)(n) << 18) & 0x00040000)
+
+// GPIO17 interrupt.
+#define AM_REG_GPIO_INT0STAT_GPIO17_S                17
+#define AM_REG_GPIO_INT0STAT_GPIO17_M                0x00020000
+#define AM_REG_GPIO_INT0STAT_GPIO17(n)               (((uint32_t)(n) << 17) & 0x00020000)
+
+// GPIO16 interrupt.
+#define AM_REG_GPIO_INT0STAT_GPIO16_S                16
+#define AM_REG_GPIO_INT0STAT_GPIO16_M                0x00010000
+#define AM_REG_GPIO_INT0STAT_GPIO16(n)               (((uint32_t)(n) << 16) & 0x00010000)
+
+// GPIO15 interrupt.
+#define AM_REG_GPIO_INT0STAT_GPIO15_S                15
+#define AM_REG_GPIO_INT0STAT_GPIO15_M                0x00008000
+#define AM_REG_GPIO_INT0STAT_GPIO15(n)               (((uint32_t)(n) << 15) & 0x00008000)
+
+// GPIO14 interrupt.
+#define AM_REG_GPIO_INT0STAT_GPIO14_S                14
+#define AM_REG_GPIO_INT0STAT_GPIO14_M                0x00004000
+#define AM_REG_GPIO_INT0STAT_GPIO14(n)               (((uint32_t)(n) << 14) & 0x00004000)
+
+// GPIO13 interrupt.
+#define AM_REG_GPIO_INT0STAT_GPIO13_S                13
+#define AM_REG_GPIO_INT0STAT_GPIO13_M                0x00002000
+#define AM_REG_GPIO_INT0STAT_GPIO13(n)               (((uint32_t)(n) << 13) & 0x00002000)
+
+// GPIO12 interrupt.
+#define AM_REG_GPIO_INT0STAT_GPIO12_S                12
+#define AM_REG_GPIO_INT0STAT_GPIO12_M                0x00001000
+#define AM_REG_GPIO_INT0STAT_GPIO12(n)               (((uint32_t)(n) << 12) & 0x00001000)
+
+// GPIO11 interrupt.
+#define AM_REG_GPIO_INT0STAT_GPIO11_S                11
+#define AM_REG_GPIO_INT0STAT_GPIO11_M                0x00000800
+#define AM_REG_GPIO_INT0STAT_GPIO11(n)               (((uint32_t)(n) << 11) & 0x00000800)
+
+// GPIO10 interrupt.
+#define AM_REG_GPIO_INT0STAT_GPIO10_S                10
+#define AM_REG_GPIO_INT0STAT_GPIO10_M                0x00000400
+#define AM_REG_GPIO_INT0STAT_GPIO10(n)               (((uint32_t)(n) << 10) & 0x00000400)
+
+// GPIO9 interrupt.
+#define AM_REG_GPIO_INT0STAT_GPIO9_S                 9
+#define AM_REG_GPIO_INT0STAT_GPIO9_M                 0x00000200
+#define AM_REG_GPIO_INT0STAT_GPIO9(n)                (((uint32_t)(n) << 9) & 0x00000200)
+
+// GPIO8 interrupt.
+#define AM_REG_GPIO_INT0STAT_GPIO8_S                 8
+#define AM_REG_GPIO_INT0STAT_GPIO8_M                 0x00000100
+#define AM_REG_GPIO_INT0STAT_GPIO8(n)                (((uint32_t)(n) << 8) & 0x00000100)
+
+// GPIO7 interrupt.
+#define AM_REG_GPIO_INT0STAT_GPIO7_S                 7
+#define AM_REG_GPIO_INT0STAT_GPIO7_M                 0x00000080
+#define AM_REG_GPIO_INT0STAT_GPIO7(n)                (((uint32_t)(n) << 7) & 0x00000080)
+
+// GPIO6 interrupt.
+#define AM_REG_GPIO_INT0STAT_GPIO6_S                 6
+#define AM_REG_GPIO_INT0STAT_GPIO6_M                 0x00000040
+#define AM_REG_GPIO_INT0STAT_GPIO6(n)                (((uint32_t)(n) << 6) & 0x00000040)
+
+// GPIO5 interrupt.
+#define AM_REG_GPIO_INT0STAT_GPIO5_S                 5
+#define AM_REG_GPIO_INT0STAT_GPIO5_M                 0x00000020
+#define AM_REG_GPIO_INT0STAT_GPIO5(n)                (((uint32_t)(n) << 5) & 0x00000020)
+
+// GPIO4 interrupt.
+#define AM_REG_GPIO_INT0STAT_GPIO4_S                 4
+#define AM_REG_GPIO_INT0STAT_GPIO4_M                 0x00000010
+#define AM_REG_GPIO_INT0STAT_GPIO4(n)                (((uint32_t)(n) << 4) & 0x00000010)
+
+// GPIO3 interrupt.
+#define AM_REG_GPIO_INT0STAT_GPIO3_S                 3
+#define AM_REG_GPIO_INT0STAT_GPIO3_M                 0x00000008
+#define AM_REG_GPIO_INT0STAT_GPIO3(n)                (((uint32_t)(n) << 3) & 0x00000008)
+
+// GPIO2 interrupt.
+#define AM_REG_GPIO_INT0STAT_GPIO2_S                 2
+#define AM_REG_GPIO_INT0STAT_GPIO2_M                 0x00000004
+#define AM_REG_GPIO_INT0STAT_GPIO2(n)                (((uint32_t)(n) << 2) & 0x00000004)
+
+// GPIO1 interrupt.
+#define AM_REG_GPIO_INT0STAT_GPIO1_S                 1
+#define AM_REG_GPIO_INT0STAT_GPIO1_M                 0x00000002
+#define AM_REG_GPIO_INT0STAT_GPIO1(n)                (((uint32_t)(n) << 1) & 0x00000002)
+
+// GPIO0 interrupt.
+#define AM_REG_GPIO_INT0STAT_GPIO0_S                 0
+#define AM_REG_GPIO_INT0STAT_GPIO0_M                 0x00000001
+#define AM_REG_GPIO_INT0STAT_GPIO0(n)                (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// GPIO_INT0CLR - GPIO Interrupt Registers 31-0: Clear
+//
+//*****************************************************************************
+// GPIO31 interrupt.
+#define AM_REG_GPIO_INT0CLR_GPIO31_S                 31
+#define AM_REG_GPIO_INT0CLR_GPIO31_M                 0x80000000
+#define AM_REG_GPIO_INT0CLR_GPIO31(n)                (((uint32_t)(n) << 31) & 0x80000000)
+
+// GPIO30 interrupt.
+#define AM_REG_GPIO_INT0CLR_GPIO30_S                 30
+#define AM_REG_GPIO_INT0CLR_GPIO30_M                 0x40000000
+#define AM_REG_GPIO_INT0CLR_GPIO30(n)                (((uint32_t)(n) << 30) & 0x40000000)
+
+// GPIO29 interrupt.
+#define AM_REG_GPIO_INT0CLR_GPIO29_S                 29
+#define AM_REG_GPIO_INT0CLR_GPIO29_M                 0x20000000
+#define AM_REG_GPIO_INT0CLR_GPIO29(n)                (((uint32_t)(n) << 29) & 0x20000000)
+
+// GPIO28 interrupt.
+#define AM_REG_GPIO_INT0CLR_GPIO28_S                 28
+#define AM_REG_GPIO_INT0CLR_GPIO28_M                 0x10000000
+#define AM_REG_GPIO_INT0CLR_GPIO28(n)                (((uint32_t)(n) << 28) & 0x10000000)
+
+// GPIO27 interrupt.
+#define AM_REG_GPIO_INT0CLR_GPIO27_S                 27
+#define AM_REG_GPIO_INT0CLR_GPIO27_M                 0x08000000
+#define AM_REG_GPIO_INT0CLR_GPIO27(n)                (((uint32_t)(n) << 27) & 0x08000000)
+
+// GPIO26 interrupt.
+#define AM_REG_GPIO_INT0CLR_GPIO26_S                 26
+#define AM_REG_GPIO_INT0CLR_GPIO26_M                 0x04000000
+#define AM_REG_GPIO_INT0CLR_GPIO26(n)                (((uint32_t)(n) << 26) & 0x04000000)
+
+// GPIO25 interrupt.
+#define AM_REG_GPIO_INT0CLR_GPIO25_S                 25
+#define AM_REG_GPIO_INT0CLR_GPIO25_M                 0x02000000
+#define AM_REG_GPIO_INT0CLR_GPIO25(n)                (((uint32_t)(n) << 25) & 0x02000000)
+
+// GPIO24 interrupt.
+#define AM_REG_GPIO_INT0CLR_GPIO24_S                 24
+#define AM_REG_GPIO_INT0CLR_GPIO24_M                 0x01000000
+#define AM_REG_GPIO_INT0CLR_GPIO24(n)                (((uint32_t)(n) << 24) & 0x01000000)
+
+// GPIO23 interrupt.
+#define AM_REG_GPIO_INT0CLR_GPIO23_S                 23
+#define AM_REG_GPIO_INT0CLR_GPIO23_M                 0x00800000
+#define AM_REG_GPIO_INT0CLR_GPIO23(n)                (((uint32_t)(n) << 23) & 0x00800000)
+
+// GPIO22 interrupt.
+#define AM_REG_GPIO_INT0CLR_GPIO22_S                 22
+#define AM_REG_GPIO_INT0CLR_GPIO22_M                 0x00400000
+#define AM_REG_GPIO_INT0CLR_GPIO22(n)                (((uint32_t)(n) << 22) & 0x00400000)
+
+// GPIO21 interrupt.
+#define AM_REG_GPIO_INT0CLR_GPIO21_S                 21
+#define AM_REG_GPIO_INT0CLR_GPIO21_M                 0x00200000
+#define AM_REG_GPIO_INT0CLR_GPIO21(n)                (((uint32_t)(n) << 21) & 0x00200000)
+
+// GPIO20 interrupt.
+#define AM_REG_GPIO_INT0CLR_GPIO20_S                 20
+#define AM_REG_GPIO_INT0CLR_GPIO20_M                 0x00100000
+#define AM_REG_GPIO_INT0CLR_GPIO20(n)                (((uint32_t)(n) << 20) & 0x00100000)
+
+// GPIO19 interrupt.
+#define AM_REG_GPIO_INT0CLR_GPIO19_S                 19
+#define AM_REG_GPIO_INT0CLR_GPIO19_M                 0x00080000
+#define AM_REG_GPIO_INT0CLR_GPIO19(n)                (((uint32_t)(n) << 19) & 0x00080000)
+
+// GPIO18interrupt.
+#define AM_REG_GPIO_INT0CLR_GPIO18_S                 18
+#define AM_REG_GPIO_INT0CLR_GPIO18_M                 0x00040000
+#define AM_REG_GPIO_INT0CLR_GPIO18(n)                (((uint32_t)(n) << 18) & 0x00040000)
+
+// GPIO17 interrupt.
+#define AM_REG_GPIO_INT0CLR_GPIO17_S                 17
+#define AM_REG_GPIO_INT0CLR_GPIO17_M                 0x00020000
+#define AM_REG_GPIO_INT0CLR_GPIO17(n)                (((uint32_t)(n) << 17) & 0x00020000)
+
+// GPIO16 interrupt.
+#define AM_REG_GPIO_INT0CLR_GPIO16_S                 16
+#define AM_REG_GPIO_INT0CLR_GPIO16_M                 0x00010000
+#define AM_REG_GPIO_INT0CLR_GPIO16(n)                (((uint32_t)(n) << 16) & 0x00010000)
+
+// GPIO15 interrupt.
+#define AM_REG_GPIO_INT0CLR_GPIO15_S                 15
+#define AM_REG_GPIO_INT0CLR_GPIO15_M                 0x00008000
+#define AM_REG_GPIO_INT0CLR_GPIO15(n)                (((uint32_t)(n) << 15) & 0x00008000)
+
+// GPIO14 interrupt.
+#define AM_REG_GPIO_INT0CLR_GPIO14_S                 14
+#define AM_REG_GPIO_INT0CLR_GPIO14_M                 0x00004000
+#define AM_REG_GPIO_INT0CLR_GPIO14(n)                (((uint32_t)(n) << 14) & 0x00004000)
+
+// GPIO13 interrupt.
+#define AM_REG_GPIO_INT0CLR_GPIO13_S                 13
+#define AM_REG_GPIO_INT0CLR_GPIO13_M                 0x00002000
+#define AM_REG_GPIO_INT0CLR_GPIO13(n)                (((uint32_t)(n) << 13) & 0x00002000)
+
+// GPIO12 interrupt.
+#define AM_REG_GPIO_INT0CLR_GPIO12_S                 12
+#define AM_REG_GPIO_INT0CLR_GPIO12_M                 0x00001000
+#define AM_REG_GPIO_INT0CLR_GPIO12(n)                (((uint32_t)(n) << 12) & 0x00001000)
+
+// GPIO11 interrupt.
+#define AM_REG_GPIO_INT0CLR_GPIO11_S                 11
+#define AM_REG_GPIO_INT0CLR_GPIO11_M                 0x00000800
+#define AM_REG_GPIO_INT0CLR_GPIO11(n)                (((uint32_t)(n) << 11) & 0x00000800)
+
+// GPIO10 interrupt.
+#define AM_REG_GPIO_INT0CLR_GPIO10_S                 10
+#define AM_REG_GPIO_INT0CLR_GPIO10_M                 0x00000400
+#define AM_REG_GPIO_INT0CLR_GPIO10(n)                (((uint32_t)(n) << 10) & 0x00000400)
+
+// GPIO9 interrupt.
+#define AM_REG_GPIO_INT0CLR_GPIO9_S                  9
+#define AM_REG_GPIO_INT0CLR_GPIO9_M                  0x00000200
+#define AM_REG_GPIO_INT0CLR_GPIO9(n)                 (((uint32_t)(n) << 9) & 0x00000200)
+
+// GPIO8 interrupt.
+#define AM_REG_GPIO_INT0CLR_GPIO8_S                  8
+#define AM_REG_GPIO_INT0CLR_GPIO8_M                  0x00000100
+#define AM_REG_GPIO_INT0CLR_GPIO8(n)                 (((uint32_t)(n) << 8) & 0x00000100)
+
+// GPIO7 interrupt.
+#define AM_REG_GPIO_INT0CLR_GPIO7_S                  7
+#define AM_REG_GPIO_INT0CLR_GPIO7_M                  0x00000080
+#define AM_REG_GPIO_INT0CLR_GPIO7(n)                 (((uint32_t)(n) << 7) & 0x00000080)
+
+// GPIO6 interrupt.
+#define AM_REG_GPIO_INT0CLR_GPIO6_S                  6
+#define AM_REG_GPIO_INT0CLR_GPIO6_M                  0x00000040
+#define AM_REG_GPIO_INT0CLR_GPIO6(n)                 (((uint32_t)(n) << 6) & 0x00000040)
+
+// GPIO5 interrupt.
+#define AM_REG_GPIO_INT0CLR_GPIO5_S                  5
+#define AM_REG_GPIO_INT0CLR_GPIO5_M                  0x00000020
+#define AM_REG_GPIO_INT0CLR_GPIO5(n)                 (((uint32_t)(n) << 5) & 0x00000020)
+
+// GPIO4 interrupt.
+#define AM_REG_GPIO_INT0CLR_GPIO4_S                  4
+#define AM_REG_GPIO_INT0CLR_GPIO4_M                  0x00000010
+#define AM_REG_GPIO_INT0CLR_GPIO4(n)                 (((uint32_t)(n) << 4) & 0x00000010)
+
+// GPIO3 interrupt.
+#define AM_REG_GPIO_INT0CLR_GPIO3_S                  3
+#define AM_REG_GPIO_INT0CLR_GPIO3_M                  0x00000008
+#define AM_REG_GPIO_INT0CLR_GPIO3(n)                 (((uint32_t)(n) << 3) & 0x00000008)
+
+// GPIO2 interrupt.
+#define AM_REG_GPIO_INT0CLR_GPIO2_S                  2
+#define AM_REG_GPIO_INT0CLR_GPIO2_M                  0x00000004
+#define AM_REG_GPIO_INT0CLR_GPIO2(n)                 (((uint32_t)(n) << 2) & 0x00000004)
+
+// GPIO1 interrupt.
+#define AM_REG_GPIO_INT0CLR_GPIO1_S                  1
+#define AM_REG_GPIO_INT0CLR_GPIO1_M                  0x00000002
+#define AM_REG_GPIO_INT0CLR_GPIO1(n)                 (((uint32_t)(n) << 1) & 0x00000002)
+
+// GPIO0 interrupt.
+#define AM_REG_GPIO_INT0CLR_GPIO0_S                  0
+#define AM_REG_GPIO_INT0CLR_GPIO0_M                  0x00000001
+#define AM_REG_GPIO_INT0CLR_GPIO0(n)                 (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// GPIO_INT0SET - GPIO Interrupt Registers 31-0: Set
+//
+//*****************************************************************************
+// GPIO31 interrupt.
+#define AM_REG_GPIO_INT0SET_GPIO31_S                 31
+#define AM_REG_GPIO_INT0SET_GPIO31_M                 0x80000000
+#define AM_REG_GPIO_INT0SET_GPIO31(n)                (((uint32_t)(n) << 31) & 0x80000000)
+
+// GPIO30 interrupt.
+#define AM_REG_GPIO_INT0SET_GPIO30_S                 30
+#define AM_REG_GPIO_INT0SET_GPIO30_M                 0x40000000
+#define AM_REG_GPIO_INT0SET_GPIO30(n)                (((uint32_t)(n) << 30) & 0x40000000)
+
+// GPIO29 interrupt.
+#define AM_REG_GPIO_INT0SET_GPIO29_S                 29
+#define AM_REG_GPIO_INT0SET_GPIO29_M                 0x20000000
+#define AM_REG_GPIO_INT0SET_GPIO29(n)                (((uint32_t)(n) << 29) & 0x20000000)
+
+// GPIO28 interrupt.
+#define AM_REG_GPIO_INT0SET_GPIO28_S                 28
+#define AM_REG_GPIO_INT0SET_GPIO28_M                 0x10000000
+#define AM_REG_GPIO_INT0SET_GPIO28(n)                (((uint32_t)(n) << 28) & 0x10000000)
+
+// GPIO27 interrupt.
+#define AM_REG_GPIO_INT0SET_GPIO27_S                 27
+#define AM_REG_GPIO_INT0SET_GPIO27_M                 0x08000000
+#define AM_REG_GPIO_INT0SET_GPIO27(n)                (((uint32_t)(n) << 27) & 0x08000000)
+
+// GPIO26 interrupt.
+#define AM_REG_GPIO_INT0SET_GPIO26_S                 26
+#define AM_REG_GPIO_INT0SET_GPIO26_M                 0x04000000
+#define AM_REG_GPIO_INT0SET_GPIO26(n)                (((uint32_t)(n) << 26) & 0x04000000)
+
+// GPIO25 interrupt.
+#define AM_REG_GPIO_INT0SET_GPIO25_S                 25
+#define AM_REG_GPIO_INT0SET_GPIO25_M                 0x02000000
+#define AM_REG_GPIO_INT0SET_GPIO25(n)                (((uint32_t)(n) << 25) & 0x02000000)
+
+// GPIO24 interrupt.
+#define AM_REG_GPIO_INT0SET_GPIO24_S                 24
+#define AM_REG_GPIO_INT0SET_GPIO24_M                 0x01000000
+#define AM_REG_GPIO_INT0SET_GPIO24(n)                (((uint32_t)(n) << 24) & 0x01000000)
+
+// GPIO23 interrupt.
+#define AM_REG_GPIO_INT0SET_GPIO23_S                 23
+#define AM_REG_GPIO_INT0SET_GPIO23_M                 0x00800000
+#define AM_REG_GPIO_INT0SET_GPIO23(n)                (((uint32_t)(n) << 23) & 0x00800000)
+
+// GPIO22 interrupt.
+#define AM_REG_GPIO_INT0SET_GPIO22_S                 22
+#define AM_REG_GPIO_INT0SET_GPIO22_M                 0x00400000
+#define AM_REG_GPIO_INT0SET_GPIO22(n)                (((uint32_t)(n) << 22) & 0x00400000)
+
+// GPIO21 interrupt.
+#define AM_REG_GPIO_INT0SET_GPIO21_S                 21
+#define AM_REG_GPIO_INT0SET_GPIO21_M                 0x00200000
+#define AM_REG_GPIO_INT0SET_GPIO21(n)                (((uint32_t)(n) << 21) & 0x00200000)
+
+// GPIO20 interrupt.
+#define AM_REG_GPIO_INT0SET_GPIO20_S                 20
+#define AM_REG_GPIO_INT0SET_GPIO20_M                 0x00100000
+#define AM_REG_GPIO_INT0SET_GPIO20(n)                (((uint32_t)(n) << 20) & 0x00100000)
+
+// GPIO19 interrupt.
+#define AM_REG_GPIO_INT0SET_GPIO19_S                 19
+#define AM_REG_GPIO_INT0SET_GPIO19_M                 0x00080000
+#define AM_REG_GPIO_INT0SET_GPIO19(n)                (((uint32_t)(n) << 19) & 0x00080000)
+
+// GPIO18interrupt.
+#define AM_REG_GPIO_INT0SET_GPIO18_S                 18
+#define AM_REG_GPIO_INT0SET_GPIO18_M                 0x00040000
+#define AM_REG_GPIO_INT0SET_GPIO18(n)                (((uint32_t)(n) << 18) & 0x00040000)
+
+// GPIO17 interrupt.
+#define AM_REG_GPIO_INT0SET_GPIO17_S                 17
+#define AM_REG_GPIO_INT0SET_GPIO17_M                 0x00020000
+#define AM_REG_GPIO_INT0SET_GPIO17(n)                (((uint32_t)(n) << 17) & 0x00020000)
+
+// GPIO16 interrupt.
+#define AM_REG_GPIO_INT0SET_GPIO16_S                 16
+#define AM_REG_GPIO_INT0SET_GPIO16_M                 0x00010000
+#define AM_REG_GPIO_INT0SET_GPIO16(n)                (((uint32_t)(n) << 16) & 0x00010000)
+
+// GPIO15 interrupt.
+#define AM_REG_GPIO_INT0SET_GPIO15_S                 15
+#define AM_REG_GPIO_INT0SET_GPIO15_M                 0x00008000
+#define AM_REG_GPIO_INT0SET_GPIO15(n)                (((uint32_t)(n) << 15) & 0x00008000)
+
+// GPIO14 interrupt.
+#define AM_REG_GPIO_INT0SET_GPIO14_S                 14
+#define AM_REG_GPIO_INT0SET_GPIO14_M                 0x00004000
+#define AM_REG_GPIO_INT0SET_GPIO14(n)                (((uint32_t)(n) << 14) & 0x00004000)
+
+// GPIO13 interrupt.
+#define AM_REG_GPIO_INT0SET_GPIO13_S                 13
+#define AM_REG_GPIO_INT0SET_GPIO13_M                 0x00002000
+#define AM_REG_GPIO_INT0SET_GPIO13(n)                (((uint32_t)(n) << 13) & 0x00002000)
+
+// GPIO12 interrupt.
+#define AM_REG_GPIO_INT0SET_GPIO12_S                 12
+#define AM_REG_GPIO_INT0SET_GPIO12_M                 0x00001000
+#define AM_REG_GPIO_INT0SET_GPIO12(n)                (((uint32_t)(n) << 12) & 0x00001000)
+
+// GPIO11 interrupt.
+#define AM_REG_GPIO_INT0SET_GPIO11_S                 11
+#define AM_REG_GPIO_INT0SET_GPIO11_M                 0x00000800
+#define AM_REG_GPIO_INT0SET_GPIO11(n)                (((uint32_t)(n) << 11) & 0x00000800)
+
+// GPIO10 interrupt.
+#define AM_REG_GPIO_INT0SET_GPIO10_S                 10
+#define AM_REG_GPIO_INT0SET_GPIO10_M                 0x00000400
+#define AM_REG_GPIO_INT0SET_GPIO10(n)                (((uint32_t)(n) << 10) & 0x00000400)
+
+// GPIO9 interrupt.
+#define AM_REG_GPIO_INT0SET_GPIO9_S                  9
+#define AM_REG_GPIO_INT0SET_GPIO9_M                  0x00000200
+#define AM_REG_GPIO_INT0SET_GPIO9(n)                 (((uint32_t)(n) << 9) & 0x00000200)
+
+// GPIO8 interrupt.
+#define AM_REG_GPIO_INT0SET_GPIO8_S                  8
+#define AM_REG_GPIO_INT0SET_GPIO8_M                  0x00000100
+#define AM_REG_GPIO_INT0SET_GPIO8(n)                 (((uint32_t)(n) << 8) & 0x00000100)
+
+// GPIO7 interrupt.
+#define AM_REG_GPIO_INT0SET_GPIO7_S                  7
+#define AM_REG_GPIO_INT0SET_GPIO7_M                  0x00000080
+#define AM_REG_GPIO_INT0SET_GPIO7(n)                 (((uint32_t)(n) << 7) & 0x00000080)
+
+// GPIO6 interrupt.
+#define AM_REG_GPIO_INT0SET_GPIO6_S                  6
+#define AM_REG_GPIO_INT0SET_GPIO6_M                  0x00000040
+#define AM_REG_GPIO_INT0SET_GPIO6(n)                 (((uint32_t)(n) << 6) & 0x00000040)
+
+// GPIO5 interrupt.
+#define AM_REG_GPIO_INT0SET_GPIO5_S                  5
+#define AM_REG_GPIO_INT0SET_GPIO5_M                  0x00000020
+#define AM_REG_GPIO_INT0SET_GPIO5(n)                 (((uint32_t)(n) << 5) & 0x00000020)
+
+// GPIO4 interrupt.
+#define AM_REG_GPIO_INT0SET_GPIO4_S                  4
+#define AM_REG_GPIO_INT0SET_GPIO4_M                  0x00000010
+#define AM_REG_GPIO_INT0SET_GPIO4(n)                 (((uint32_t)(n) << 4) & 0x00000010)
+
+// GPIO3 interrupt.
+#define AM_REG_GPIO_INT0SET_GPIO3_S                  3
+#define AM_REG_GPIO_INT0SET_GPIO3_M                  0x00000008
+#define AM_REG_GPIO_INT0SET_GPIO3(n)                 (((uint32_t)(n) << 3) & 0x00000008)
+
+// GPIO2 interrupt.
+#define AM_REG_GPIO_INT0SET_GPIO2_S                  2
+#define AM_REG_GPIO_INT0SET_GPIO2_M                  0x00000004
+#define AM_REG_GPIO_INT0SET_GPIO2(n)                 (((uint32_t)(n) << 2) & 0x00000004)
+
+// GPIO1 interrupt.
+#define AM_REG_GPIO_INT0SET_GPIO1_S                  1
+#define AM_REG_GPIO_INT0SET_GPIO1_M                  0x00000002
+#define AM_REG_GPIO_INT0SET_GPIO1(n)                 (((uint32_t)(n) << 1) & 0x00000002)
+
+// GPIO0 interrupt.
+#define AM_REG_GPIO_INT0SET_GPIO0_S                  0
+#define AM_REG_GPIO_INT0SET_GPIO0_M                  0x00000001
+#define AM_REG_GPIO_INT0SET_GPIO0(n)                 (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// GPIO_INT1EN - GPIO Interrupt Registers 49-32: Enable
+//
+//*****************************************************************************
+// GPIO49 interrupt.
+#define AM_REG_GPIO_INT1EN_GPIO49_S                  17
+#define AM_REG_GPIO_INT1EN_GPIO49_M                  0x00020000
+#define AM_REG_GPIO_INT1EN_GPIO49(n)                 (((uint32_t)(n) << 17) & 0x00020000)
+
+// GPIO48 interrupt.
+#define AM_REG_GPIO_INT1EN_GPIO48_S                  16
+#define AM_REG_GPIO_INT1EN_GPIO48_M                  0x00010000
+#define AM_REG_GPIO_INT1EN_GPIO48(n)                 (((uint32_t)(n) << 16) & 0x00010000)
+
+// GPIO47 interrupt.
+#define AM_REG_GPIO_INT1EN_GPIO47_S                  15
+#define AM_REG_GPIO_INT1EN_GPIO47_M                  0x00008000
+#define AM_REG_GPIO_INT1EN_GPIO47(n)                 (((uint32_t)(n) << 15) & 0x00008000)
+
+// GPIO46 interrupt.
+#define AM_REG_GPIO_INT1EN_GPIO46_S                  14
+#define AM_REG_GPIO_INT1EN_GPIO46_M                  0x00004000
+#define AM_REG_GPIO_INT1EN_GPIO46(n)                 (((uint32_t)(n) << 14) & 0x00004000)
+
+// GPIO45 interrupt.
+#define AM_REG_GPIO_INT1EN_GPIO45_S                  13
+#define AM_REG_GPIO_INT1EN_GPIO45_M                  0x00002000
+#define AM_REG_GPIO_INT1EN_GPIO45(n)                 (((uint32_t)(n) << 13) & 0x00002000)
+
+// GPIO44 interrupt.
+#define AM_REG_GPIO_INT1EN_GPIO44_S                  12
+#define AM_REG_GPIO_INT1EN_GPIO44_M                  0x00001000
+#define AM_REG_GPIO_INT1EN_GPIO44(n)                 (((uint32_t)(n) << 12) & 0x00001000)
+
+// GPIO43 interrupt.
+#define AM_REG_GPIO_INT1EN_GPIO43_S                  11
+#define AM_REG_GPIO_INT1EN_GPIO43_M                  0x00000800
+#define AM_REG_GPIO_INT1EN_GPIO43(n)                 (((uint32_t)(n) << 11) & 0x00000800)
+
+// GPIO42 interrupt.
+#define AM_REG_GPIO_INT1EN_GPIO42_S                  10
+#define AM_REG_GPIO_INT1EN_GPIO42_M                  0x00000400
+#define AM_REG_GPIO_INT1EN_GPIO42(n)                 (((uint32_t)(n) << 10) & 0x00000400)
+
+// GPIO41 interrupt.
+#define AM_REG_GPIO_INT1EN_GPIO41_S                  9
+#define AM_REG_GPIO_INT1EN_GPIO41_M                  0x00000200
+#define AM_REG_GPIO_INT1EN_GPIO41(n)                 (((uint32_t)(n) << 9) & 0x00000200)
+
+// GPIO40 interrupt.
+#define AM_REG_GPIO_INT1EN_GPIO40_S                  8
+#define AM_REG_GPIO_INT1EN_GPIO40_M                  0x00000100
+#define AM_REG_GPIO_INT1EN_GPIO40(n)                 (((uint32_t)(n) << 8) & 0x00000100)
+
+// GPIO39 interrupt.
+#define AM_REG_GPIO_INT1EN_GPIO39_S                  7
+#define AM_REG_GPIO_INT1EN_GPIO39_M                  0x00000080
+#define AM_REG_GPIO_INT1EN_GPIO39(n)                 (((uint32_t)(n) << 7) & 0x00000080)
+
+// GPIO38 interrupt.
+#define AM_REG_GPIO_INT1EN_GPIO38_S                  6
+#define AM_REG_GPIO_INT1EN_GPIO38_M                  0x00000040
+#define AM_REG_GPIO_INT1EN_GPIO38(n)                 (((uint32_t)(n) << 6) & 0x00000040)
+
+// GPIO37 interrupt.
+#define AM_REG_GPIO_INT1EN_GPIO37_S                  5
+#define AM_REG_GPIO_INT1EN_GPIO37_M                  0x00000020
+#define AM_REG_GPIO_INT1EN_GPIO37(n)                 (((uint32_t)(n) << 5) & 0x00000020)
+
+// GPIO36 interrupt.
+#define AM_REG_GPIO_INT1EN_GPIO36_S                  4
+#define AM_REG_GPIO_INT1EN_GPIO36_M                  0x00000010
+#define AM_REG_GPIO_INT1EN_GPIO36(n)                 (((uint32_t)(n) << 4) & 0x00000010)
+
+// GPIO35 interrupt.
+#define AM_REG_GPIO_INT1EN_GPIO35_S                  3
+#define AM_REG_GPIO_INT1EN_GPIO35_M                  0x00000008
+#define AM_REG_GPIO_INT1EN_GPIO35(n)                 (((uint32_t)(n) << 3) & 0x00000008)
+
+// GPIO34 interrupt.
+#define AM_REG_GPIO_INT1EN_GPIO34_S                  2
+#define AM_REG_GPIO_INT1EN_GPIO34_M                  0x00000004
+#define AM_REG_GPIO_INT1EN_GPIO34(n)                 (((uint32_t)(n) << 2) & 0x00000004)
+
+// GPIO33 interrupt.
+#define AM_REG_GPIO_INT1EN_GPIO33_S                  1
+#define AM_REG_GPIO_INT1EN_GPIO33_M                  0x00000002
+#define AM_REG_GPIO_INT1EN_GPIO33(n)                 (((uint32_t)(n) << 1) & 0x00000002)
+
+// GPIO32 interrupt.
+#define AM_REG_GPIO_INT1EN_GPIO32_S                  0
+#define AM_REG_GPIO_INT1EN_GPIO32_M                  0x00000001
+#define AM_REG_GPIO_INT1EN_GPIO32(n)                 (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// GPIO_INT1STAT - GPIO Interrupt Registers 49-32: Status
+//
+//*****************************************************************************
+// GPIO49 interrupt.
+#define AM_REG_GPIO_INT1STAT_GPIO49_S                17
+#define AM_REG_GPIO_INT1STAT_GPIO49_M                0x00020000
+#define AM_REG_GPIO_INT1STAT_GPIO49(n)               (((uint32_t)(n) << 17) & 0x00020000)
+
+// GPIO48 interrupt.
+#define AM_REG_GPIO_INT1STAT_GPIO48_S                16
+#define AM_REG_GPIO_INT1STAT_GPIO48_M                0x00010000
+#define AM_REG_GPIO_INT1STAT_GPIO48(n)               (((uint32_t)(n) << 16) & 0x00010000)
+
+// GPIO47 interrupt.
+#define AM_REG_GPIO_INT1STAT_GPIO47_S                15
+#define AM_REG_GPIO_INT1STAT_GPIO47_M                0x00008000
+#define AM_REG_GPIO_INT1STAT_GPIO47(n)               (((uint32_t)(n) << 15) & 0x00008000)
+
+// GPIO46 interrupt.
+#define AM_REG_GPIO_INT1STAT_GPIO46_S                14
+#define AM_REG_GPIO_INT1STAT_GPIO46_M                0x00004000
+#define AM_REG_GPIO_INT1STAT_GPIO46(n)               (((uint32_t)(n) << 14) & 0x00004000)
+
+// GPIO45 interrupt.
+#define AM_REG_GPIO_INT1STAT_GPIO45_S                13
+#define AM_REG_GPIO_INT1STAT_GPIO45_M                0x00002000
+#define AM_REG_GPIO_INT1STAT_GPIO45(n)               (((uint32_t)(n) << 13) & 0x00002000)
+
+// GPIO44 interrupt.
+#define AM_REG_GPIO_INT1STAT_GPIO44_S                12
+#define AM_REG_GPIO_INT1STAT_GPIO44_M                0x00001000
+#define AM_REG_GPIO_INT1STAT_GPIO44(n)               (((uint32_t)(n) << 12) & 0x00001000)
+
+// GPIO43 interrupt.
+#define AM_REG_GPIO_INT1STAT_GPIO43_S                11
+#define AM_REG_GPIO_INT1STAT_GPIO43_M                0x00000800
+#define AM_REG_GPIO_INT1STAT_GPIO43(n)               (((uint32_t)(n) << 11) & 0x00000800)
+
+// GPIO42 interrupt.
+#define AM_REG_GPIO_INT1STAT_GPIO42_S                10
+#define AM_REG_GPIO_INT1STAT_GPIO42_M                0x00000400
+#define AM_REG_GPIO_INT1STAT_GPIO42(n)               (((uint32_t)(n) << 10) & 0x00000400)
+
+// GPIO41 interrupt.
+#define AM_REG_GPIO_INT1STAT_GPIO41_S                9
+#define AM_REG_GPIO_INT1STAT_GPIO41_M                0x00000200
+#define AM_REG_GPIO_INT1STAT_GPIO41(n)               (((uint32_t)(n) << 9) & 0x00000200)
+
+// GPIO40 interrupt.
+#define AM_REG_GPIO_INT1STAT_GPIO40_S                8
+#define AM_REG_GPIO_INT1STAT_GPIO40_M                0x00000100
+#define AM_REG_GPIO_INT1STAT_GPIO40(n)               (((uint32_t)(n) << 8) & 0x00000100)
+
+// GPIO39 interrupt.
+#define AM_REG_GPIO_INT1STAT_GPIO39_S                7
+#define AM_REG_GPIO_INT1STAT_GPIO39_M                0x00000080
+#define AM_REG_GPIO_INT1STAT_GPIO39(n)               (((uint32_t)(n) << 7) & 0x00000080)
+
+// GPIO38 interrupt.
+#define AM_REG_GPIO_INT1STAT_GPIO38_S                6
+#define AM_REG_GPIO_INT1STAT_GPIO38_M                0x00000040
+#define AM_REG_GPIO_INT1STAT_GPIO38(n)               (((uint32_t)(n) << 6) & 0x00000040)
+
+// GPIO37 interrupt.
+#define AM_REG_GPIO_INT1STAT_GPIO37_S                5
+#define AM_REG_GPIO_INT1STAT_GPIO37_M                0x00000020
+#define AM_REG_GPIO_INT1STAT_GPIO37(n)               (((uint32_t)(n) << 5) & 0x00000020)
+
+// GPIO36 interrupt.
+#define AM_REG_GPIO_INT1STAT_GPIO36_S                4
+#define AM_REG_GPIO_INT1STAT_GPIO36_M                0x00000010
+#define AM_REG_GPIO_INT1STAT_GPIO36(n)               (((uint32_t)(n) << 4) & 0x00000010)
+
+// GPIO35 interrupt.
+#define AM_REG_GPIO_INT1STAT_GPIO35_S                3
+#define AM_REG_GPIO_INT1STAT_GPIO35_M                0x00000008
+#define AM_REG_GPIO_INT1STAT_GPIO35(n)               (((uint32_t)(n) << 3) & 0x00000008)
+
+// GPIO34 interrupt.
+#define AM_REG_GPIO_INT1STAT_GPIO34_S                2
+#define AM_REG_GPIO_INT1STAT_GPIO34_M                0x00000004
+#define AM_REG_GPIO_INT1STAT_GPIO34(n)               (((uint32_t)(n) << 2) & 0x00000004)
+
+// GPIO33 interrupt.
+#define AM_REG_GPIO_INT1STAT_GPIO33_S                1
+#define AM_REG_GPIO_INT1STAT_GPIO33_M                0x00000002
+#define AM_REG_GPIO_INT1STAT_GPIO33(n)               (((uint32_t)(n) << 1) & 0x00000002)
+
+// GPIO32 interrupt.
+#define AM_REG_GPIO_INT1STAT_GPIO32_S                0
+#define AM_REG_GPIO_INT1STAT_GPIO32_M                0x00000001
+#define AM_REG_GPIO_INT1STAT_GPIO32(n)               (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// GPIO_INT1CLR - GPIO Interrupt Registers 49-32: Clear
+//
+//*****************************************************************************
+// GPIO49 interrupt.
+#define AM_REG_GPIO_INT1CLR_GPIO49_S                 17
+#define AM_REG_GPIO_INT1CLR_GPIO49_M                 0x00020000
+#define AM_REG_GPIO_INT1CLR_GPIO49(n)                (((uint32_t)(n) << 17) & 0x00020000)
+
+// GPIO48 interrupt.
+#define AM_REG_GPIO_INT1CLR_GPIO48_S                 16
+#define AM_REG_GPIO_INT1CLR_GPIO48_M                 0x00010000
+#define AM_REG_GPIO_INT1CLR_GPIO48(n)                (((uint32_t)(n) << 16) & 0x00010000)
+
+// GPIO47 interrupt.
+#define AM_REG_GPIO_INT1CLR_GPIO47_S                 15
+#define AM_REG_GPIO_INT1CLR_GPIO47_M                 0x00008000
+#define AM_REG_GPIO_INT1CLR_GPIO47(n)                (((uint32_t)(n) << 15) & 0x00008000)
+
+// GPIO46 interrupt.
+#define AM_REG_GPIO_INT1CLR_GPIO46_S                 14
+#define AM_REG_GPIO_INT1CLR_GPIO46_M                 0x00004000
+#define AM_REG_GPIO_INT1CLR_GPIO46(n)                (((uint32_t)(n) << 14) & 0x00004000)
+
+// GPIO45 interrupt.
+#define AM_REG_GPIO_INT1CLR_GPIO45_S                 13
+#define AM_REG_GPIO_INT1CLR_GPIO45_M                 0x00002000
+#define AM_REG_GPIO_INT1CLR_GPIO45(n)                (((uint32_t)(n) << 13) & 0x00002000)
+
+// GPIO44 interrupt.
+#define AM_REG_GPIO_INT1CLR_GPIO44_S                 12
+#define AM_REG_GPIO_INT1CLR_GPIO44_M                 0x00001000
+#define AM_REG_GPIO_INT1CLR_GPIO44(n)                (((uint32_t)(n) << 12) & 0x00001000)
+
+// GPIO43 interrupt.
+#define AM_REG_GPIO_INT1CLR_GPIO43_S                 11
+#define AM_REG_GPIO_INT1CLR_GPIO43_M                 0x00000800
+#define AM_REG_GPIO_INT1CLR_GPIO43(n)                (((uint32_t)(n) << 11) & 0x00000800)
+
+// GPIO42 interrupt.
+#define AM_REG_GPIO_INT1CLR_GPIO42_S                 10
+#define AM_REG_GPIO_INT1CLR_GPIO42_M                 0x00000400
+#define AM_REG_GPIO_INT1CLR_GPIO42(n)                (((uint32_t)(n) << 10) & 0x00000400)
+
+// GPIO41 interrupt.
+#define AM_REG_GPIO_INT1CLR_GPIO41_S                 9
+#define AM_REG_GPIO_INT1CLR_GPIO41_M                 0x00000200
+#define AM_REG_GPIO_INT1CLR_GPIO41(n)                (((uint32_t)(n) << 9) & 0x00000200)
+
+// GPIO40 interrupt.
+#define AM_REG_GPIO_INT1CLR_GPIO40_S                 8
+#define AM_REG_GPIO_INT1CLR_GPIO40_M                 0x00000100
+#define AM_REG_GPIO_INT1CLR_GPIO40(n)                (((uint32_t)(n) << 8) & 0x00000100)
+
+// GPIO39 interrupt.
+#define AM_REG_GPIO_INT1CLR_GPIO39_S                 7
+#define AM_REG_GPIO_INT1CLR_GPIO39_M                 0x00000080
+#define AM_REG_GPIO_INT1CLR_GPIO39(n)                (((uint32_t)(n) << 7) & 0x00000080)
+
+// GPIO38 interrupt.
+#define AM_REG_GPIO_INT1CLR_GPIO38_S                 6
+#define AM_REG_GPIO_INT1CLR_GPIO38_M                 0x00000040
+#define AM_REG_GPIO_INT1CLR_GPIO38(n)                (((uint32_t)(n) << 6) & 0x00000040)
+
+// GPIO37 interrupt.
+#define AM_REG_GPIO_INT1CLR_GPIO37_S                 5
+#define AM_REG_GPIO_INT1CLR_GPIO37_M                 0x00000020
+#define AM_REG_GPIO_INT1CLR_GPIO37(n)                (((uint32_t)(n) << 5) & 0x00000020)
+
+// GPIO36 interrupt.
+#define AM_REG_GPIO_INT1CLR_GPIO36_S                 4
+#define AM_REG_GPIO_INT1CLR_GPIO36_M                 0x00000010
+#define AM_REG_GPIO_INT1CLR_GPIO36(n)                (((uint32_t)(n) << 4) & 0x00000010)
+
+// GPIO35 interrupt.
+#define AM_REG_GPIO_INT1CLR_GPIO35_S                 3
+#define AM_REG_GPIO_INT1CLR_GPIO35_M                 0x00000008
+#define AM_REG_GPIO_INT1CLR_GPIO35(n)                (((uint32_t)(n) << 3) & 0x00000008)
+
+// GPIO34 interrupt.
+#define AM_REG_GPIO_INT1CLR_GPIO34_S                 2
+#define AM_REG_GPIO_INT1CLR_GPIO34_M                 0x00000004
+#define AM_REG_GPIO_INT1CLR_GPIO34(n)                (((uint32_t)(n) << 2) & 0x00000004)
+
+// GPIO33 interrupt.
+#define AM_REG_GPIO_INT1CLR_GPIO33_S                 1
+#define AM_REG_GPIO_INT1CLR_GPIO33_M                 0x00000002
+#define AM_REG_GPIO_INT1CLR_GPIO33(n)                (((uint32_t)(n) << 1) & 0x00000002)
+
+// GPIO32 interrupt.
+#define AM_REG_GPIO_INT1CLR_GPIO32_S                 0
+#define AM_REG_GPIO_INT1CLR_GPIO32_M                 0x00000001
+#define AM_REG_GPIO_INT1CLR_GPIO32(n)                (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// GPIO_INT1SET - GPIO Interrupt Registers 49-32: Set
+//
+//*****************************************************************************
+// GPIO49 interrupt.
+#define AM_REG_GPIO_INT1SET_GPIO49_S                 17
+#define AM_REG_GPIO_INT1SET_GPIO49_M                 0x00020000
+#define AM_REG_GPIO_INT1SET_GPIO49(n)                (((uint32_t)(n) << 17) & 0x00020000)
+
+// GPIO48 interrupt.
+#define AM_REG_GPIO_INT1SET_GPIO48_S                 16
+#define AM_REG_GPIO_INT1SET_GPIO48_M                 0x00010000
+#define AM_REG_GPIO_INT1SET_GPIO48(n)                (((uint32_t)(n) << 16) & 0x00010000)
+
+// GPIO47 interrupt.
+#define AM_REG_GPIO_INT1SET_GPIO47_S                 15
+#define AM_REG_GPIO_INT1SET_GPIO47_M                 0x00008000
+#define AM_REG_GPIO_INT1SET_GPIO47(n)                (((uint32_t)(n) << 15) & 0x00008000)
+
+// GPIO46 interrupt.
+#define AM_REG_GPIO_INT1SET_GPIO46_S                 14
+#define AM_REG_GPIO_INT1SET_GPIO46_M                 0x00004000
+#define AM_REG_GPIO_INT1SET_GPIO46(n)                (((uint32_t)(n) << 14) & 0x00004000)
+
+// GPIO45 interrupt.
+#define AM_REG_GPIO_INT1SET_GPIO45_S                 13
+#define AM_REG_GPIO_INT1SET_GPIO45_M                 0x00002000
+#define AM_REG_GPIO_INT1SET_GPIO45(n)                (((uint32_t)(n) << 13) & 0x00002000)
+
+// GPIO44 interrupt.
+#define AM_REG_GPIO_INT1SET_GPIO44_S                 12
+#define AM_REG_GPIO_INT1SET_GPIO44_M                 0x00001000
+#define AM_REG_GPIO_INT1SET_GPIO44(n)                (((uint32_t)(n) << 12) & 0x00001000)
+
+// GPIO43 interrupt.
+#define AM_REG_GPIO_INT1SET_GPIO43_S                 11
+#define AM_REG_GPIO_INT1SET_GPIO43_M                 0x00000800
+#define AM_REG_GPIO_INT1SET_GPIO43(n)                (((uint32_t)(n) << 11) & 0x00000800)
+
+// GPIO42 interrupt.
+#define AM_REG_GPIO_INT1SET_GPIO42_S                 10
+#define AM_REG_GPIO_INT1SET_GPIO42_M                 0x00000400
+#define AM_REG_GPIO_INT1SET_GPIO42(n)                (((uint32_t)(n) << 10) & 0x00000400)
+
+// GPIO41 interrupt.
+#define AM_REG_GPIO_INT1SET_GPIO41_S                 9
+#define AM_REG_GPIO_INT1SET_GPIO41_M                 0x00000200
+#define AM_REG_GPIO_INT1SET_GPIO41(n)                (((uint32_t)(n) << 9) & 0x00000200)
+
+// GPIO40 interrupt.
+#define AM_REG_GPIO_INT1SET_GPIO40_S                 8
+#define AM_REG_GPIO_INT1SET_GPIO40_M                 0x00000100
+#define AM_REG_GPIO_INT1SET_GPIO40(n)                (((uint32_t)(n) << 8) & 0x00000100)
+
+// GPIO39 interrupt.
+#define AM_REG_GPIO_INT1SET_GPIO39_S                 7
+#define AM_REG_GPIO_INT1SET_GPIO39_M                 0x00000080
+#define AM_REG_GPIO_INT1SET_GPIO39(n)                (((uint32_t)(n) << 7) & 0x00000080)
+
+// GPIO38 interrupt.
+#define AM_REG_GPIO_INT1SET_GPIO38_S                 6
+#define AM_REG_GPIO_INT1SET_GPIO38_M                 0x00000040
+#define AM_REG_GPIO_INT1SET_GPIO38(n)                (((uint32_t)(n) << 6) & 0x00000040)
+
+// GPIO37 interrupt.
+#define AM_REG_GPIO_INT1SET_GPIO37_S                 5
+#define AM_REG_GPIO_INT1SET_GPIO37_M                 0x00000020
+#define AM_REG_GPIO_INT1SET_GPIO37(n)                (((uint32_t)(n) << 5) & 0x00000020)
+
+// GPIO36 interrupt.
+#define AM_REG_GPIO_INT1SET_GPIO36_S                 4
+#define AM_REG_GPIO_INT1SET_GPIO36_M                 0x00000010
+#define AM_REG_GPIO_INT1SET_GPIO36(n)                (((uint32_t)(n) << 4) & 0x00000010)
+
+// GPIO35 interrupt.
+#define AM_REG_GPIO_INT1SET_GPIO35_S                 3
+#define AM_REG_GPIO_INT1SET_GPIO35_M                 0x00000008
+#define AM_REG_GPIO_INT1SET_GPIO35(n)                (((uint32_t)(n) << 3) & 0x00000008)
+
+// GPIO34 interrupt.
+#define AM_REG_GPIO_INT1SET_GPIO34_S                 2
+#define AM_REG_GPIO_INT1SET_GPIO34_M                 0x00000004
+#define AM_REG_GPIO_INT1SET_GPIO34(n)                (((uint32_t)(n) << 2) & 0x00000004)
+
+// GPIO33 interrupt.
+#define AM_REG_GPIO_INT1SET_GPIO33_S                 1
+#define AM_REG_GPIO_INT1SET_GPIO33_M                 0x00000002
+#define AM_REG_GPIO_INT1SET_GPIO33(n)                (((uint32_t)(n) << 1) & 0x00000002)
+
+// GPIO32 interrupt.
+#define AM_REG_GPIO_INT1SET_GPIO32_S                 0
+#define AM_REG_GPIO_INT1SET_GPIO32_M                 0x00000001
+#define AM_REG_GPIO_INT1SET_GPIO32(n)                (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// GPIO_PADREGA - Pad Configuration Register A
+//
+//*****************************************************************************
+// Pad 3 function select
+#define AM_REG_GPIO_PADREGA_PAD3FNCSEL_S             27
+#define AM_REG_GPIO_PADREGA_PAD3FNCSEL_M             0x38000000
+#define AM_REG_GPIO_PADREGA_PAD3FNCSEL(n)            (((uint32_t)(n) << 27) & 0x38000000)
+#define AM_REG_GPIO_PADREGA_PAD3FNCSEL_UA0RTS        0x00000000
+#define AM_REG_GPIO_PADREGA_PAD3FNCSEL_SLnCE         0x08000000
+#define AM_REG_GPIO_PADREGA_PAD3FNCSEL_M1nCE4        0x10000000
+#define AM_REG_GPIO_PADREGA_PAD3FNCSEL_GPIO3         0x18000000
+#define AM_REG_GPIO_PADREGA_PAD3FNCSEL_MxnCELB       0x20000000
+#define AM_REG_GPIO_PADREGA_PAD3FNCSEL_M2nCE0        0x28000000
+#define AM_REG_GPIO_PADREGA_PAD3FNCSEL_TRIG1         0x30000000
+#define AM_REG_GPIO_PADREGA_PAD3FNCSEL_I2S_WCLK      0x38000000
+
+// Pad 3 drive strength.
+#define AM_REG_GPIO_PADREGA_PAD3STRNG_S              26
+#define AM_REG_GPIO_PADREGA_PAD3STRNG_M              0x04000000
+#define AM_REG_GPIO_PADREGA_PAD3STRNG(n)             (((uint32_t)(n) << 26) & 0x04000000)
+#define AM_REG_GPIO_PADREGA_PAD3STRNG_LOW            0x00000000
+#define AM_REG_GPIO_PADREGA_PAD3STRNG_HIGH           0x04000000
+
+// Pad 3 input enable.
+#define AM_REG_GPIO_PADREGA_PAD3INPEN_S              25
+#define AM_REG_GPIO_PADREGA_PAD3INPEN_M              0x02000000
+#define AM_REG_GPIO_PADREGA_PAD3INPEN(n)             (((uint32_t)(n) << 25) & 0x02000000)
+#define AM_REG_GPIO_PADREGA_PAD3INPEN_DIS            0x00000000
+#define AM_REG_GPIO_PADREGA_PAD3INPEN_EN             0x02000000
+
+// Pad 3 pullup enable
+#define AM_REG_GPIO_PADREGA_PAD3PULL_S               24
+#define AM_REG_GPIO_PADREGA_PAD3PULL_M               0x01000000
+#define AM_REG_GPIO_PADREGA_PAD3PULL(n)              (((uint32_t)(n) << 24) & 0x01000000)
+#define AM_REG_GPIO_PADREGA_PAD3PULL_DIS             0x00000000
+#define AM_REG_GPIO_PADREGA_PAD3PULL_EN              0x01000000
+
+// Pad 2 function select
+#define AM_REG_GPIO_PADREGA_PAD2FNCSEL_S             19
+#define AM_REG_GPIO_PADREGA_PAD2FNCSEL_M             0x00380000
+#define AM_REG_GPIO_PADREGA_PAD2FNCSEL(n)            (((uint32_t)(n) << 19) & 0x00380000)
+#define AM_REG_GPIO_PADREGA_PAD2FNCSEL_SLWIR3        0x00000000
+#define AM_REG_GPIO_PADREGA_PAD2FNCSEL_SLMOSI        0x00080000
+#define AM_REG_GPIO_PADREGA_PAD2FNCSEL_UART0RX       0x00100000
+#define AM_REG_GPIO_PADREGA_PAD2FNCSEL_GPIO2         0x00180000
+#define AM_REG_GPIO_PADREGA_PAD2FNCSEL_MxMOSILB      0x00200000
+#define AM_REG_GPIO_PADREGA_PAD2FNCSEL_M2MOSI        0x00280000
+#define AM_REG_GPIO_PADREGA_PAD2FNCSEL_MxWIR3LB      0x00300000
+#define AM_REG_GPIO_PADREGA_PAD2FNCSEL_M2WIR3        0x00380000
+
+// Pad 2 drive strength
+#define AM_REG_GPIO_PADREGA_PAD2STRNG_S              18
+#define AM_REG_GPIO_PADREGA_PAD2STRNG_M              0x00040000
+#define AM_REG_GPIO_PADREGA_PAD2STRNG(n)             (((uint32_t)(n) << 18) & 0x00040000)
+#define AM_REG_GPIO_PADREGA_PAD2STRNG_LOW            0x00000000
+#define AM_REG_GPIO_PADREGA_PAD2STRNG_HIGH           0x00040000
+
+// Pad 2 input enable
+#define AM_REG_GPIO_PADREGA_PAD2INPEN_S              17
+#define AM_REG_GPIO_PADREGA_PAD2INPEN_M              0x00020000
+#define AM_REG_GPIO_PADREGA_PAD2INPEN(n)             (((uint32_t)(n) << 17) & 0x00020000)
+#define AM_REG_GPIO_PADREGA_PAD2INPEN_DIS            0x00000000
+#define AM_REG_GPIO_PADREGA_PAD2INPEN_EN             0x00020000
+
+// Pad 2 pullup enable
+#define AM_REG_GPIO_PADREGA_PAD2PULL_S               16
+#define AM_REG_GPIO_PADREGA_PAD2PULL_M               0x00010000
+#define AM_REG_GPIO_PADREGA_PAD2PULL(n)              (((uint32_t)(n) << 16) & 0x00010000)
+#define AM_REG_GPIO_PADREGA_PAD2PULL_DIS             0x00000000
+#define AM_REG_GPIO_PADREGA_PAD2PULL_EN              0x00010000
+
+// Pad 1 pullup resistor selection.
+#define AM_REG_GPIO_PADREGA_PAD1RSEL_S               14
+#define AM_REG_GPIO_PADREGA_PAD1RSEL_M               0x0000C000
+#define AM_REG_GPIO_PADREGA_PAD1RSEL(n)              (((uint32_t)(n) << 14) & 0x0000C000)
+#define AM_REG_GPIO_PADREGA_PAD1RSEL_PULL1_5K        0x00000000
+#define AM_REG_GPIO_PADREGA_PAD1RSEL_PULL6K          0x00004000
+#define AM_REG_GPIO_PADREGA_PAD1RSEL_PULL12K         0x00008000
+#define AM_REG_GPIO_PADREGA_PAD1RSEL_PULL24K         0x0000C000
+
+// Pad 1 function select
+#define AM_REG_GPIO_PADREGA_PAD1FNCSEL_S             11
+#define AM_REG_GPIO_PADREGA_PAD1FNCSEL_M             0x00003800
+#define AM_REG_GPIO_PADREGA_PAD1FNCSEL(n)            (((uint32_t)(n) << 11) & 0x00003800)
+#define AM_REG_GPIO_PADREGA_PAD1FNCSEL_SLSDA         0x00000000
+#define AM_REG_GPIO_PADREGA_PAD1FNCSEL_SLMISO        0x00000800
+#define AM_REG_GPIO_PADREGA_PAD1FNCSEL_UART0TX       0x00001000
+#define AM_REG_GPIO_PADREGA_PAD1FNCSEL_GPIO1         0x00001800
+#define AM_REG_GPIO_PADREGA_PAD1FNCSEL_MxMISOLB      0x00002000
+#define AM_REG_GPIO_PADREGA_PAD1FNCSEL_M2MISO        0x00002800
+#define AM_REG_GPIO_PADREGA_PAD1FNCSEL_MxSDALB       0x00003000
+#define AM_REG_GPIO_PADREGA_PAD1FNCSEL_M2SDA         0x00003800
+
+// Pad 1 drive strength
+#define AM_REG_GPIO_PADREGA_PAD1STRNG_S              10
+#define AM_REG_GPIO_PADREGA_PAD1STRNG_M              0x00000400
+#define AM_REG_GPIO_PADREGA_PAD1STRNG(n)             (((uint32_t)(n) << 10) & 0x00000400)
+#define AM_REG_GPIO_PADREGA_PAD1STRNG_LOW            0x00000000
+#define AM_REG_GPIO_PADREGA_PAD1STRNG_HIGH           0x00000400
+
+// Pad 1 input enable
+#define AM_REG_GPIO_PADREGA_PAD1INPEN_S              9
+#define AM_REG_GPIO_PADREGA_PAD1INPEN_M              0x00000200
+#define AM_REG_GPIO_PADREGA_PAD1INPEN(n)             (((uint32_t)(n) << 9) & 0x00000200)
+#define AM_REG_GPIO_PADREGA_PAD1INPEN_DIS            0x00000000
+#define AM_REG_GPIO_PADREGA_PAD1INPEN_EN             0x00000200
+
+// Pad 1 pullup enable
+#define AM_REG_GPIO_PADREGA_PAD1PULL_S               8
+#define AM_REG_GPIO_PADREGA_PAD1PULL_M               0x00000100
+#define AM_REG_GPIO_PADREGA_PAD1PULL(n)              (((uint32_t)(n) << 8) & 0x00000100)
+#define AM_REG_GPIO_PADREGA_PAD1PULL_DIS             0x00000000
+#define AM_REG_GPIO_PADREGA_PAD1PULL_EN              0x00000100
+
+// Pad 0 pullup resistor selection.
+#define AM_REG_GPIO_PADREGA_PAD0RSEL_S               6
+#define AM_REG_GPIO_PADREGA_PAD0RSEL_M               0x000000C0
+#define AM_REG_GPIO_PADREGA_PAD0RSEL(n)              (((uint32_t)(n) << 6) & 0x000000C0)
+#define AM_REG_GPIO_PADREGA_PAD0RSEL_PULL1_5K        0x00000000
+#define AM_REG_GPIO_PADREGA_PAD0RSEL_PULL6K          0x00000040
+#define AM_REG_GPIO_PADREGA_PAD0RSEL_PULL12K         0x00000080
+#define AM_REG_GPIO_PADREGA_PAD0RSEL_PULL24K         0x000000C0
+
+// Pad 0 function select
+#define AM_REG_GPIO_PADREGA_PAD0FNCSEL_S             3
+#define AM_REG_GPIO_PADREGA_PAD0FNCSEL_M             0x00000038
+#define AM_REG_GPIO_PADREGA_PAD0FNCSEL(n)            (((uint32_t)(n) << 3) & 0x00000038)
+#define AM_REG_GPIO_PADREGA_PAD0FNCSEL_SLSCL         0x00000000
+#define AM_REG_GPIO_PADREGA_PAD0FNCSEL_SLSCK         0x00000008
+#define AM_REG_GPIO_PADREGA_PAD0FNCSEL_CLKOUT        0x00000010
+#define AM_REG_GPIO_PADREGA_PAD0FNCSEL_GPIO0         0x00000018
+#define AM_REG_GPIO_PADREGA_PAD0FNCSEL_MxSCKLB       0x00000020
+#define AM_REG_GPIO_PADREGA_PAD0FNCSEL_M2SCK         0x00000028
+#define AM_REG_GPIO_PADREGA_PAD0FNCSEL_MxSCLLB       0x00000030
+#define AM_REG_GPIO_PADREGA_PAD0FNCSEL_M2SCL         0x00000038
+
+// Pad 0 drive strength
+#define AM_REG_GPIO_PADREGA_PAD0STRNG_S              2
+#define AM_REG_GPIO_PADREGA_PAD0STRNG_M              0x00000004
+#define AM_REG_GPIO_PADREGA_PAD0STRNG(n)             (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_GPIO_PADREGA_PAD0STRNG_LOW            0x00000000
+#define AM_REG_GPIO_PADREGA_PAD0STRNG_HIGH           0x00000004
+
+// Pad 0 input enable
+#define AM_REG_GPIO_PADREGA_PAD0INPEN_S              1
+#define AM_REG_GPIO_PADREGA_PAD0INPEN_M              0x00000002
+#define AM_REG_GPIO_PADREGA_PAD0INPEN(n)             (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_GPIO_PADREGA_PAD0INPEN_DIS            0x00000000
+#define AM_REG_GPIO_PADREGA_PAD0INPEN_EN             0x00000002
+
+// Pad 0 pullup enable
+#define AM_REG_GPIO_PADREGA_PAD0PULL_S               0
+#define AM_REG_GPIO_PADREGA_PAD0PULL_M               0x00000001
+#define AM_REG_GPIO_PADREGA_PAD0PULL(n)              (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_GPIO_PADREGA_PAD0PULL_DIS             0x00000000
+#define AM_REG_GPIO_PADREGA_PAD0PULL_EN              0x00000001
+
+//*****************************************************************************
+//
+// GPIO_PADREGB - Pad Configuration Register B
+//
+//*****************************************************************************
+// Pad 7 function select
+#define AM_REG_GPIO_PADREGB_PAD7FNCSEL_S             27
+#define AM_REG_GPIO_PADREGB_PAD7FNCSEL_M             0x38000000
+#define AM_REG_GPIO_PADREGB_PAD7FNCSEL(n)            (((uint32_t)(n) << 27) & 0x38000000)
+#define AM_REG_GPIO_PADREGB_PAD7FNCSEL_M0WIR3        0x00000000
+#define AM_REG_GPIO_PADREGB_PAD7FNCSEL_M0MOSI        0x08000000
+#define AM_REG_GPIO_PADREGB_PAD7FNCSEL_CLKOUT        0x10000000
+#define AM_REG_GPIO_PADREGB_PAD7FNCSEL_GPIO7         0x18000000
+#define AM_REG_GPIO_PADREGB_PAD7FNCSEL_TRIG0         0x20000000
+#define AM_REG_GPIO_PADREGB_PAD7FNCSEL_UART0TX       0x28000000
+#define AM_REG_GPIO_PADREGB_PAD7FNCSEL_SLWIR3LB      0x30000000
+#define AM_REG_GPIO_PADREGB_PAD7FNCSEL_M1nCE1        0x38000000
+
+// Pad 7 drive strentgh
+#define AM_REG_GPIO_PADREGB_PAD7STRNG_S              26
+#define AM_REG_GPIO_PADREGB_PAD7STRNG_M              0x04000000
+#define AM_REG_GPIO_PADREGB_PAD7STRNG(n)             (((uint32_t)(n) << 26) & 0x04000000)
+#define AM_REG_GPIO_PADREGB_PAD7STRNG_LOW            0x00000000
+#define AM_REG_GPIO_PADREGB_PAD7STRNG_HIGH           0x04000000
+
+// Pad 7 input enable
+#define AM_REG_GPIO_PADREGB_PAD7INPEN_S              25
+#define AM_REG_GPIO_PADREGB_PAD7INPEN_M              0x02000000
+#define AM_REG_GPIO_PADREGB_PAD7INPEN(n)             (((uint32_t)(n) << 25) & 0x02000000)
+#define AM_REG_GPIO_PADREGB_PAD7INPEN_DIS            0x00000000
+#define AM_REG_GPIO_PADREGB_PAD7INPEN_EN             0x02000000
+
+// Pad 7 pullup enable
+#define AM_REG_GPIO_PADREGB_PAD7PULL_S               24
+#define AM_REG_GPIO_PADREGB_PAD7PULL_M               0x01000000
+#define AM_REG_GPIO_PADREGB_PAD7PULL(n)              (((uint32_t)(n) << 24) & 0x01000000)
+#define AM_REG_GPIO_PADREGB_PAD7PULL_DIS             0x00000000
+#define AM_REG_GPIO_PADREGB_PAD7PULL_EN              0x01000000
+
+// Pad 6 pullup resistor selection.
+#define AM_REG_GPIO_PADREGB_PAD6RSEL_S               22
+#define AM_REG_GPIO_PADREGB_PAD6RSEL_M               0x00C00000
+#define AM_REG_GPIO_PADREGB_PAD6RSEL(n)              (((uint32_t)(n) << 22) & 0x00C00000)
+#define AM_REG_GPIO_PADREGB_PAD6RSEL_PULL1_5K        0x00000000
+#define AM_REG_GPIO_PADREGB_PAD6RSEL_PULL6K          0x00400000
+#define AM_REG_GPIO_PADREGB_PAD6RSEL_PULL12K         0x00800000
+#define AM_REG_GPIO_PADREGB_PAD6RSEL_PULL24K         0x00C00000
+
+// Pad 6 function select
+#define AM_REG_GPIO_PADREGB_PAD6FNCSEL_S             19
+#define AM_REG_GPIO_PADREGB_PAD6FNCSEL_M             0x00380000
+#define AM_REG_GPIO_PADREGB_PAD6FNCSEL(n)            (((uint32_t)(n) << 19) & 0x00380000)
+#define AM_REG_GPIO_PADREGB_PAD6FNCSEL_M0SDA         0x00000000
+#define AM_REG_GPIO_PADREGB_PAD6FNCSEL_M0MISO        0x00080000
+#define AM_REG_GPIO_PADREGB_PAD6FNCSEL_UA0CTS        0x00100000
+#define AM_REG_GPIO_PADREGB_PAD6FNCSEL_GPIO6         0x00180000
+#define AM_REG_GPIO_PADREGB_PAD6FNCSEL_SLMISOLB      0x00200000
+#define AM_REG_GPIO_PADREGB_PAD6FNCSEL_M1nCE0        0x00280000
+#define AM_REG_GPIO_PADREGB_PAD6FNCSEL_SLSDALB       0x00300000
+#define AM_REG_GPIO_PADREGB_PAD6FNCSEL_I2S_DAT       0x00380000
+
+// Pad 6 drive strength
+#define AM_REG_GPIO_PADREGB_PAD6STRNG_S              18
+#define AM_REG_GPIO_PADREGB_PAD6STRNG_M              0x00040000
+#define AM_REG_GPIO_PADREGB_PAD6STRNG(n)             (((uint32_t)(n) << 18) & 0x00040000)
+#define AM_REG_GPIO_PADREGB_PAD6STRNG_LOW            0x00000000
+#define AM_REG_GPIO_PADREGB_PAD6STRNG_HIGH           0x00040000
+
+// Pad 6 input enable
+#define AM_REG_GPIO_PADREGB_PAD6INPEN_S              17
+#define AM_REG_GPIO_PADREGB_PAD6INPEN_M              0x00020000
+#define AM_REG_GPIO_PADREGB_PAD6INPEN(n)             (((uint32_t)(n) << 17) & 0x00020000)
+#define AM_REG_GPIO_PADREGB_PAD6INPEN_DIS            0x00000000
+#define AM_REG_GPIO_PADREGB_PAD6INPEN_EN             0x00020000
+
+// Pad 6 pullup enable
+#define AM_REG_GPIO_PADREGB_PAD6PULL_S               16
+#define AM_REG_GPIO_PADREGB_PAD6PULL_M               0x00010000
+#define AM_REG_GPIO_PADREGB_PAD6PULL(n)              (((uint32_t)(n) << 16) & 0x00010000)
+#define AM_REG_GPIO_PADREGB_PAD6PULL_DIS             0x00000000
+#define AM_REG_GPIO_PADREGB_PAD6PULL_EN              0x00010000
+
+// Pad 5 pullup resistor selection.
+#define AM_REG_GPIO_PADREGB_PAD5RSEL_S               14
+#define AM_REG_GPIO_PADREGB_PAD5RSEL_M               0x0000C000
+#define AM_REG_GPIO_PADREGB_PAD5RSEL(n)              (((uint32_t)(n) << 14) & 0x0000C000)
+#define AM_REG_GPIO_PADREGB_PAD5RSEL_PULL1_5K        0x00000000
+#define AM_REG_GPIO_PADREGB_PAD5RSEL_PULL6K          0x00004000
+#define AM_REG_GPIO_PADREGB_PAD5RSEL_PULL12K         0x00008000
+#define AM_REG_GPIO_PADREGB_PAD5RSEL_PULL24K         0x0000C000
+
+// Pad 5 function select
+#define AM_REG_GPIO_PADREGB_PAD5FNCSEL_S             11
+#define AM_REG_GPIO_PADREGB_PAD5FNCSEL_M             0x00003800
+#define AM_REG_GPIO_PADREGB_PAD5FNCSEL(n)            (((uint32_t)(n) << 11) & 0x00003800)
+#define AM_REG_GPIO_PADREGB_PAD5FNCSEL_M0SCL         0x00000000
+#define AM_REG_GPIO_PADREGB_PAD5FNCSEL_M0SCK         0x00000800
+#define AM_REG_GPIO_PADREGB_PAD5FNCSEL_UA0RTS        0x00001000
+#define AM_REG_GPIO_PADREGB_PAD5FNCSEL_GPIO5         0x00001800
+#define AM_REG_GPIO_PADREGB_PAD5FNCSEL_M0SCKLB       0x00002000
+#define AM_REG_GPIO_PADREGB_PAD5FNCSEL_EXTHFA        0x00002800
+#define AM_REG_GPIO_PADREGB_PAD5FNCSEL_M0SCLLB       0x00003000
+#define AM_REG_GPIO_PADREGB_PAD5FNCSEL_M1nCE2        0x00003800
+
+// Pad 5 drive strength
+#define AM_REG_GPIO_PADREGB_PAD5STRNG_S              10
+#define AM_REG_GPIO_PADREGB_PAD5STRNG_M              0x00000400
+#define AM_REG_GPIO_PADREGB_PAD5STRNG(n)             (((uint32_t)(n) << 10) & 0x00000400)
+#define AM_REG_GPIO_PADREGB_PAD5STRNG_LOW            0x00000000
+#define AM_REG_GPIO_PADREGB_PAD5STRNG_HIGH           0x00000400
+
+// Pad 5 input enable
+#define AM_REG_GPIO_PADREGB_PAD5INPEN_S              9
+#define AM_REG_GPIO_PADREGB_PAD5INPEN_M              0x00000200
+#define AM_REG_GPIO_PADREGB_PAD5INPEN(n)             (((uint32_t)(n) << 9) & 0x00000200)
+#define AM_REG_GPIO_PADREGB_PAD5INPEN_DIS            0x00000000
+#define AM_REG_GPIO_PADREGB_PAD5INPEN_EN             0x00000200
+
+// Pad 5 pullup enable
+#define AM_REG_GPIO_PADREGB_PAD5PULL_S               8
+#define AM_REG_GPIO_PADREGB_PAD5PULL_M               0x00000100
+#define AM_REG_GPIO_PADREGB_PAD5PULL(n)              (((uint32_t)(n) << 8) & 0x00000100)
+#define AM_REG_GPIO_PADREGB_PAD5PULL_DIS             0x00000000
+#define AM_REG_GPIO_PADREGB_PAD5PULL_EN              0x00000100
+
+// Pad 4 VSS power switch enable
+#define AM_REG_GPIO_PADREGB_PAD4PWRDN_S              7
+#define AM_REG_GPIO_PADREGB_PAD4PWRDN_M              0x00000080
+#define AM_REG_GPIO_PADREGB_PAD4PWRDN(n)             (((uint32_t)(n) << 7) & 0x00000080)
+#define AM_REG_GPIO_PADREGB_PAD4PWRDN_DIS            0x00000000
+#define AM_REG_GPIO_PADREGB_PAD4PWRDN_EN             0x00000080
+
+// Pad 4 function select
+#define AM_REG_GPIO_PADREGB_PAD4FNCSEL_S             3
+#define AM_REG_GPIO_PADREGB_PAD4FNCSEL_M             0x00000038
+#define AM_REG_GPIO_PADREGB_PAD4FNCSEL(n)            (((uint32_t)(n) << 3) & 0x00000038)
+#define AM_REG_GPIO_PADREGB_PAD4FNCSEL_UA0CTS        0x00000000
+#define AM_REG_GPIO_PADREGB_PAD4FNCSEL_SLINT         0x00000008
+#define AM_REG_GPIO_PADREGB_PAD4FNCSEL_M0nCE5        0x00000010
+#define AM_REG_GPIO_PADREGB_PAD4FNCSEL_GPIO4         0x00000018
+#define AM_REG_GPIO_PADREGB_PAD4FNCSEL_SLINTGP       0x00000020
+#define AM_REG_GPIO_PADREGB_PAD4FNCSEL_M2nCE5        0x00000028
+#define AM_REG_GPIO_PADREGB_PAD4FNCSEL_CLKOUT        0x00000030
+#define AM_REG_GPIO_PADREGB_PAD4FNCSEL_32khz_XT      0x00000038
+
+// Pad 4 drive strength
+#define AM_REG_GPIO_PADREGB_PAD4STRNG_S              2
+#define AM_REG_GPIO_PADREGB_PAD4STRNG_M              0x00000004
+#define AM_REG_GPIO_PADREGB_PAD4STRNG(n)             (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_GPIO_PADREGB_PAD4STRNG_LOW            0x00000000
+#define AM_REG_GPIO_PADREGB_PAD4STRNG_HIGH           0x00000004
+
+// Pad 4 input enable
+#define AM_REG_GPIO_PADREGB_PAD4INPEN_S              1
+#define AM_REG_GPIO_PADREGB_PAD4INPEN_M              0x00000002
+#define AM_REG_GPIO_PADREGB_PAD4INPEN(n)             (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_GPIO_PADREGB_PAD4INPEN_DIS            0x00000000
+#define AM_REG_GPIO_PADREGB_PAD4INPEN_EN             0x00000002
+
+// Pad 4 pullup enable
+#define AM_REG_GPIO_PADREGB_PAD4PULL_S               0
+#define AM_REG_GPIO_PADREGB_PAD4PULL_M               0x00000001
+#define AM_REG_GPIO_PADREGB_PAD4PULL(n)              (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_GPIO_PADREGB_PAD4PULL_DIS             0x00000000
+#define AM_REG_GPIO_PADREGB_PAD4PULL_EN              0x00000001
+
+//*****************************************************************************
+//
+// GPIO_PADREGC - Pad Configuration Register C
+//
+//*****************************************************************************
+// Pad 11 function select
+#define AM_REG_GPIO_PADREGC_PAD11FNCSEL_S            27
+#define AM_REG_GPIO_PADREGC_PAD11FNCSEL_M            0x38000000
+#define AM_REG_GPIO_PADREGC_PAD11FNCSEL(n)           (((uint32_t)(n) << 27) & 0x38000000)
+#define AM_REG_GPIO_PADREGC_PAD11FNCSEL_ADCSE2       0x00000000
+#define AM_REG_GPIO_PADREGC_PAD11FNCSEL_M0nCE0       0x08000000
+#define AM_REG_GPIO_PADREGC_PAD11FNCSEL_CLKOUT       0x10000000
+#define AM_REG_GPIO_PADREGC_PAD11FNCSEL_GPIO11       0x18000000
+#define AM_REG_GPIO_PADREGC_PAD11FNCSEL_M2nCE7       0x20000000
+#define AM_REG_GPIO_PADREGC_PAD11FNCSEL_UA1CTS       0x28000000
+#define AM_REG_GPIO_PADREGC_PAD11FNCSEL_UART0RX      0x30000000
+#define AM_REG_GPIO_PADREGC_PAD11FNCSEL_PDM_DATA     0x38000000
+
+// Pad 11 drive strentgh
+#define AM_REG_GPIO_PADREGC_PAD11STRNG_S             26
+#define AM_REG_GPIO_PADREGC_PAD11STRNG_M             0x04000000
+#define AM_REG_GPIO_PADREGC_PAD11STRNG(n)            (((uint32_t)(n) << 26) & 0x04000000)
+#define AM_REG_GPIO_PADREGC_PAD11STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGC_PAD11STRNG_HIGH          0x04000000
+
+// Pad 11 input enable
+#define AM_REG_GPIO_PADREGC_PAD11INPEN_S             25
+#define AM_REG_GPIO_PADREGC_PAD11INPEN_M             0x02000000
+#define AM_REG_GPIO_PADREGC_PAD11INPEN(n)            (((uint32_t)(n) << 25) & 0x02000000)
+#define AM_REG_GPIO_PADREGC_PAD11INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGC_PAD11INPEN_EN            0x02000000
+
+// Pad 11 pullup enable
+#define AM_REG_GPIO_PADREGC_PAD11PULL_S              24
+#define AM_REG_GPIO_PADREGC_PAD11PULL_M              0x01000000
+#define AM_REG_GPIO_PADREGC_PAD11PULL(n)             (((uint32_t)(n) << 24) & 0x01000000)
+#define AM_REG_GPIO_PADREGC_PAD11PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGC_PAD11PULL_EN             0x01000000
+
+// Pad 10 function select
+#define AM_REG_GPIO_PADREGC_PAD10FNCSEL_S            19
+#define AM_REG_GPIO_PADREGC_PAD10FNCSEL_M            0x00380000
+#define AM_REG_GPIO_PADREGC_PAD10FNCSEL(n)           (((uint32_t)(n) << 19) & 0x00380000)
+#define AM_REG_GPIO_PADREGC_PAD10FNCSEL_M1WIR3       0x00000000
+#define AM_REG_GPIO_PADREGC_PAD10FNCSEL_M1MOSI       0x00080000
+#define AM_REG_GPIO_PADREGC_PAD10FNCSEL_M0nCE6       0x00100000
+#define AM_REG_GPIO_PADREGC_PAD10FNCSEL_GPIO10       0x00180000
+#define AM_REG_GPIO_PADREGC_PAD10FNCSEL_M2nCE6       0x00200000
+#define AM_REG_GPIO_PADREGC_PAD10FNCSEL_UA1RTS       0x00280000
+#define AM_REG_GPIO_PADREGC_PAD10FNCSEL_M4nCE4       0x00300000
+#define AM_REG_GPIO_PADREGC_PAD10FNCSEL_SLWIR3LB     0x00380000
+
+// Pad 10 drive strength
+#define AM_REG_GPIO_PADREGC_PAD10STRNG_S             18
+#define AM_REG_GPIO_PADREGC_PAD10STRNG_M             0x00040000
+#define AM_REG_GPIO_PADREGC_PAD10STRNG(n)            (((uint32_t)(n) << 18) & 0x00040000)
+#define AM_REG_GPIO_PADREGC_PAD10STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGC_PAD10STRNG_HIGH          0x00040000
+
+// Pad 10 input enable
+#define AM_REG_GPIO_PADREGC_PAD10INPEN_S             17
+#define AM_REG_GPIO_PADREGC_PAD10INPEN_M             0x00020000
+#define AM_REG_GPIO_PADREGC_PAD10INPEN(n)            (((uint32_t)(n) << 17) & 0x00020000)
+#define AM_REG_GPIO_PADREGC_PAD10INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGC_PAD10INPEN_EN            0x00020000
+
+// Pad 10 pullup enable
+#define AM_REG_GPIO_PADREGC_PAD10PULL_S              16
+#define AM_REG_GPIO_PADREGC_PAD10PULL_M              0x00010000
+#define AM_REG_GPIO_PADREGC_PAD10PULL(n)             (((uint32_t)(n) << 16) & 0x00010000)
+#define AM_REG_GPIO_PADREGC_PAD10PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGC_PAD10PULL_EN             0x00010000
+
+// Pad 9 pullup resistor selection
+#define AM_REG_GPIO_PADREGC_PAD9RSEL_S               14
+#define AM_REG_GPIO_PADREGC_PAD9RSEL_M               0x0000C000
+#define AM_REG_GPIO_PADREGC_PAD9RSEL(n)              (((uint32_t)(n) << 14) & 0x0000C000)
+#define AM_REG_GPIO_PADREGC_PAD9RSEL_PULL1_5K        0x00000000
+#define AM_REG_GPIO_PADREGC_PAD9RSEL_PULL6K          0x00004000
+#define AM_REG_GPIO_PADREGC_PAD9RSEL_PULL12K         0x00008000
+#define AM_REG_GPIO_PADREGC_PAD9RSEL_PULL24K         0x0000C000
+
+// Pad 9 function select
+#define AM_REG_GPIO_PADREGC_PAD9FNCSEL_S             11
+#define AM_REG_GPIO_PADREGC_PAD9FNCSEL_M             0x00003800
+#define AM_REG_GPIO_PADREGC_PAD9FNCSEL(n)            (((uint32_t)(n) << 11) & 0x00003800)
+#define AM_REG_GPIO_PADREGC_PAD9FNCSEL_M1SDA         0x00000000
+#define AM_REG_GPIO_PADREGC_PAD9FNCSEL_M1MISO        0x00000800
+#define AM_REG_GPIO_PADREGC_PAD9FNCSEL_M0nCE5        0x00001000
+#define AM_REG_GPIO_PADREGC_PAD9FNCSEL_GPIO9         0x00001800
+#define AM_REG_GPIO_PADREGC_PAD9FNCSEL_M4nCE5        0x00002000
+#define AM_REG_GPIO_PADREGC_PAD9FNCSEL_SLMISOLB      0x00002800
+#define AM_REG_GPIO_PADREGC_PAD9FNCSEL_UART1RX       0x00003000
+#define AM_REG_GPIO_PADREGC_PAD9FNCSEL_SLSDALB       0x00003800
+
+// Pad 9 drive strength
+#define AM_REG_GPIO_PADREGC_PAD9STRNG_S              10
+#define AM_REG_GPIO_PADREGC_PAD9STRNG_M              0x00000400
+#define AM_REG_GPIO_PADREGC_PAD9STRNG(n)             (((uint32_t)(n) << 10) & 0x00000400)
+#define AM_REG_GPIO_PADREGC_PAD9STRNG_LOW            0x00000000
+#define AM_REG_GPIO_PADREGC_PAD9STRNG_HIGH           0x00000400
+
+// Pad 9 input enable
+#define AM_REG_GPIO_PADREGC_PAD9INPEN_S              9
+#define AM_REG_GPIO_PADREGC_PAD9INPEN_M              0x00000200
+#define AM_REG_GPIO_PADREGC_PAD9INPEN(n)             (((uint32_t)(n) << 9) & 0x00000200)
+#define AM_REG_GPIO_PADREGC_PAD9INPEN_DIS            0x00000000
+#define AM_REG_GPIO_PADREGC_PAD9INPEN_EN             0x00000200
+
+// Pad 9 pullup enable
+#define AM_REG_GPIO_PADREGC_PAD9PULL_S               8
+#define AM_REG_GPIO_PADREGC_PAD9PULL_M               0x00000100
+#define AM_REG_GPIO_PADREGC_PAD9PULL(n)              (((uint32_t)(n) << 8) & 0x00000100)
+#define AM_REG_GPIO_PADREGC_PAD9PULL_DIS             0x00000000
+#define AM_REG_GPIO_PADREGC_PAD9PULL_EN              0x00000100
+
+// Pad 8 pullup resistor selection.
+#define AM_REG_GPIO_PADREGC_PAD8RSEL_S               6
+#define AM_REG_GPIO_PADREGC_PAD8RSEL_M               0x000000C0
+#define AM_REG_GPIO_PADREGC_PAD8RSEL(n)              (((uint32_t)(n) << 6) & 0x000000C0)
+#define AM_REG_GPIO_PADREGC_PAD8RSEL_PULL1_5K        0x00000000
+#define AM_REG_GPIO_PADREGC_PAD8RSEL_PULL6K          0x00000040
+#define AM_REG_GPIO_PADREGC_PAD8RSEL_PULL12K         0x00000080
+#define AM_REG_GPIO_PADREGC_PAD8RSEL_PULL24K         0x000000C0
+
+// Pad 8 function select
+#define AM_REG_GPIO_PADREGC_PAD8FNCSEL_S             3
+#define AM_REG_GPIO_PADREGC_PAD8FNCSEL_M             0x00000038
+#define AM_REG_GPIO_PADREGC_PAD8FNCSEL(n)            (((uint32_t)(n) << 3) & 0x00000038)
+#define AM_REG_GPIO_PADREGC_PAD8FNCSEL_M1SCL         0x00000000
+#define AM_REG_GPIO_PADREGC_PAD8FNCSEL_M1SCK         0x00000008
+#define AM_REG_GPIO_PADREGC_PAD8FNCSEL_M0nCE4        0x00000010
+#define AM_REG_GPIO_PADREGC_PAD8FNCSEL_GPIO8         0x00000018
+#define AM_REG_GPIO_PADREGC_PAD8FNCSEL_M2nCE4        0x00000020
+#define AM_REG_GPIO_PADREGC_PAD8FNCSEL_M1SCKLB       0x00000028
+#define AM_REG_GPIO_PADREGC_PAD8FNCSEL_UART1TX       0x00000030
+#define AM_REG_GPIO_PADREGC_PAD8FNCSEL_M1SCLLB       0x00000038
+
+// Pad 8 drive strength
+#define AM_REG_GPIO_PADREGC_PAD8STRNG_S              2
+#define AM_REG_GPIO_PADREGC_PAD8STRNG_M              0x00000004
+#define AM_REG_GPIO_PADREGC_PAD8STRNG(n)             (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_GPIO_PADREGC_PAD8STRNG_LOW            0x00000000
+#define AM_REG_GPIO_PADREGC_PAD8STRNG_HIGH           0x00000004
+
+// Pad 8 input enable
+#define AM_REG_GPIO_PADREGC_PAD8INPEN_S              1
+#define AM_REG_GPIO_PADREGC_PAD8INPEN_M              0x00000002
+#define AM_REG_GPIO_PADREGC_PAD8INPEN(n)             (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_GPIO_PADREGC_PAD8INPEN_DIS            0x00000000
+#define AM_REG_GPIO_PADREGC_PAD8INPEN_EN             0x00000002
+
+// Pad 8 pullup enable
+#define AM_REG_GPIO_PADREGC_PAD8PULL_S               0
+#define AM_REG_GPIO_PADREGC_PAD8PULL_M               0x00000001
+#define AM_REG_GPIO_PADREGC_PAD8PULL(n)              (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_GPIO_PADREGC_PAD8PULL_DIS             0x00000000
+#define AM_REG_GPIO_PADREGC_PAD8PULL_EN              0x00000001
+
+//*****************************************************************************
+//
+// GPIO_PADREGD - Pad Configuration Register D
+//
+//*****************************************************************************
+// Pad 15 function select
+#define AM_REG_GPIO_PADREGD_PAD15FNCSEL_S            27
+#define AM_REG_GPIO_PADREGD_PAD15FNCSEL_M            0x38000000
+#define AM_REG_GPIO_PADREGD_PAD15FNCSEL(n)           (((uint32_t)(n) << 27) & 0x38000000)
+#define AM_REG_GPIO_PADREGD_PAD15FNCSEL_ADCD1N       0x00000000
+#define AM_REG_GPIO_PADREGD_PAD15FNCSEL_M1nCE3       0x08000000
+#define AM_REG_GPIO_PADREGD_PAD15FNCSEL_UART1RX      0x10000000
+#define AM_REG_GPIO_PADREGD_PAD15FNCSEL_GPIO15       0x18000000
+#define AM_REG_GPIO_PADREGD_PAD15FNCSEL_M2nCE2       0x20000000
+#define AM_REG_GPIO_PADREGD_PAD15FNCSEL_EXTXT        0x28000000
+#define AM_REG_GPIO_PADREGD_PAD15FNCSEL_SWDIO        0x30000000
+#define AM_REG_GPIO_PADREGD_PAD15FNCSEL_SWO          0x38000000
+
+// Pad 15 drive strentgh
+#define AM_REG_GPIO_PADREGD_PAD15STRNG_S             26
+#define AM_REG_GPIO_PADREGD_PAD15STRNG_M             0x04000000
+#define AM_REG_GPIO_PADREGD_PAD15STRNG(n)            (((uint32_t)(n) << 26) & 0x04000000)
+#define AM_REG_GPIO_PADREGD_PAD15STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGD_PAD15STRNG_HIGH          0x04000000
+
+// Pad 15 input enable
+#define AM_REG_GPIO_PADREGD_PAD15INPEN_S             25
+#define AM_REG_GPIO_PADREGD_PAD15INPEN_M             0x02000000
+#define AM_REG_GPIO_PADREGD_PAD15INPEN(n)            (((uint32_t)(n) << 25) & 0x02000000)
+#define AM_REG_GPIO_PADREGD_PAD15INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGD_PAD15INPEN_EN            0x02000000
+
+// Pad 15 pullup enable
+#define AM_REG_GPIO_PADREGD_PAD15PULL_S              24
+#define AM_REG_GPIO_PADREGD_PAD15PULL_M              0x01000000
+#define AM_REG_GPIO_PADREGD_PAD15PULL(n)             (((uint32_t)(n) << 24) & 0x01000000)
+#define AM_REG_GPIO_PADREGD_PAD15PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGD_PAD15PULL_EN             0x01000000
+
+// Pad 14 function select
+#define AM_REG_GPIO_PADREGD_PAD14FNCSEL_S            19
+#define AM_REG_GPIO_PADREGD_PAD14FNCSEL_M            0x00380000
+#define AM_REG_GPIO_PADREGD_PAD14FNCSEL(n)           (((uint32_t)(n) << 19) & 0x00380000)
+#define AM_REG_GPIO_PADREGD_PAD14FNCSEL_ADCD1P       0x00000000
+#define AM_REG_GPIO_PADREGD_PAD14FNCSEL_M1nCE2       0x00080000
+#define AM_REG_GPIO_PADREGD_PAD14FNCSEL_UART1TX      0x00100000
+#define AM_REG_GPIO_PADREGD_PAD14FNCSEL_GPIO14       0x00180000
+#define AM_REG_GPIO_PADREGD_PAD14FNCSEL_M2nCE1       0x00200000
+#define AM_REG_GPIO_PADREGD_PAD14FNCSEL_EXTHFS       0x00280000
+#define AM_REG_GPIO_PADREGD_PAD14FNCSEL_SWDCK        0x00300000
+#define AM_REG_GPIO_PADREGD_PAD14FNCSEL_32khz_XT     0x00380000
+
+// Pad 14 drive strength
+#define AM_REG_GPIO_PADREGD_PAD14STRNG_S             18
+#define AM_REG_GPIO_PADREGD_PAD14STRNG_M             0x00040000
+#define AM_REG_GPIO_PADREGD_PAD14STRNG(n)            (((uint32_t)(n) << 18) & 0x00040000)
+#define AM_REG_GPIO_PADREGD_PAD14STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGD_PAD14STRNG_HIGH          0x00040000
+
+// Pad 14 input enable
+#define AM_REG_GPIO_PADREGD_PAD14INPEN_S             17
+#define AM_REG_GPIO_PADREGD_PAD14INPEN_M             0x00020000
+#define AM_REG_GPIO_PADREGD_PAD14INPEN(n)            (((uint32_t)(n) << 17) & 0x00020000)
+#define AM_REG_GPIO_PADREGD_PAD14INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGD_PAD14INPEN_EN            0x00020000
+
+// Pad 14 pullup enable
+#define AM_REG_GPIO_PADREGD_PAD14PULL_S              16
+#define AM_REG_GPIO_PADREGD_PAD14PULL_M              0x00010000
+#define AM_REG_GPIO_PADREGD_PAD14PULL(n)             (((uint32_t)(n) << 16) & 0x00010000)
+#define AM_REG_GPIO_PADREGD_PAD14PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGD_PAD14PULL_EN             0x00010000
+
+// Pad 13 function select
+#define AM_REG_GPIO_PADREGD_PAD13FNCSEL_S            11
+#define AM_REG_GPIO_PADREGD_PAD13FNCSEL_M            0x00003800
+#define AM_REG_GPIO_PADREGD_PAD13FNCSEL(n)           (((uint32_t)(n) << 11) & 0x00003800)
+#define AM_REG_GPIO_PADREGD_PAD13FNCSEL_ADCD0PSE8    0x00000000
+#define AM_REG_GPIO_PADREGD_PAD13FNCSEL_M1nCE1       0x00000800
+#define AM_REG_GPIO_PADREGD_PAD13FNCSEL_TCTB0        0x00001000
+#define AM_REG_GPIO_PADREGD_PAD13FNCSEL_GPIO13       0x00001800
+#define AM_REG_GPIO_PADREGD_PAD13FNCSEL_M2nCE3       0x00002000
+#define AM_REG_GPIO_PADREGD_PAD13FNCSEL_EXTHFB       0x00002800
+#define AM_REG_GPIO_PADREGD_PAD13FNCSEL_UA0RTS       0x00003000
+#define AM_REG_GPIO_PADREGD_PAD13FNCSEL_UART1RX      0x00003800
+
+// Pad 13 drive strength
+#define AM_REG_GPIO_PADREGD_PAD13STRNG_S             10
+#define AM_REG_GPIO_PADREGD_PAD13STRNG_M             0x00000400
+#define AM_REG_GPIO_PADREGD_PAD13STRNG(n)            (((uint32_t)(n) << 10) & 0x00000400)
+#define AM_REG_GPIO_PADREGD_PAD13STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGD_PAD13STRNG_HIGH          0x00000400
+
+// Pad 13 input enable
+#define AM_REG_GPIO_PADREGD_PAD13INPEN_S             9
+#define AM_REG_GPIO_PADREGD_PAD13INPEN_M             0x00000200
+#define AM_REG_GPIO_PADREGD_PAD13INPEN(n)            (((uint32_t)(n) << 9) & 0x00000200)
+#define AM_REG_GPIO_PADREGD_PAD13INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGD_PAD13INPEN_EN            0x00000200
+
+// Pad 13 pullup enable
+#define AM_REG_GPIO_PADREGD_PAD13PULL_S              8
+#define AM_REG_GPIO_PADREGD_PAD13PULL_M              0x00000100
+#define AM_REG_GPIO_PADREGD_PAD13PULL(n)             (((uint32_t)(n) << 8) & 0x00000100)
+#define AM_REG_GPIO_PADREGD_PAD13PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGD_PAD13PULL_EN             0x00000100
+
+// Pad 12 function select
+#define AM_REG_GPIO_PADREGD_PAD12FNCSEL_S            3
+#define AM_REG_GPIO_PADREGD_PAD12FNCSEL_M            0x00000038
+#define AM_REG_GPIO_PADREGD_PAD12FNCSEL(n)           (((uint32_t)(n) << 3) & 0x00000038)
+#define AM_REG_GPIO_PADREGD_PAD12FNCSEL_ADCD0NSE9    0x00000000
+#define AM_REG_GPIO_PADREGD_PAD12FNCSEL_M1nCE0       0x00000008
+#define AM_REG_GPIO_PADREGD_PAD12FNCSEL_TCTA0        0x00000010
+#define AM_REG_GPIO_PADREGD_PAD12FNCSEL_GPIO12       0x00000018
+#define AM_REG_GPIO_PADREGD_PAD12FNCSEL_CLKOUT       0x00000020
+#define AM_REG_GPIO_PADREGD_PAD12FNCSEL_PDM_CLK      0x00000028
+#define AM_REG_GPIO_PADREGD_PAD12FNCSEL_UA0CTS       0x00000030
+#define AM_REG_GPIO_PADREGD_PAD12FNCSEL_UART1TX      0x00000038
+
+// Pad 12 drive strength
+#define AM_REG_GPIO_PADREGD_PAD12STRNG_S             2
+#define AM_REG_GPIO_PADREGD_PAD12STRNG_M             0x00000004
+#define AM_REG_GPIO_PADREGD_PAD12STRNG(n)            (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_GPIO_PADREGD_PAD12STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGD_PAD12STRNG_HIGH          0x00000004
+
+// Pad 12 input enable
+#define AM_REG_GPIO_PADREGD_PAD12INPEN_S             1
+#define AM_REG_GPIO_PADREGD_PAD12INPEN_M             0x00000002
+#define AM_REG_GPIO_PADREGD_PAD12INPEN(n)            (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_GPIO_PADREGD_PAD12INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGD_PAD12INPEN_EN            0x00000002
+
+// Pad 12 pullup enable
+#define AM_REG_GPIO_PADREGD_PAD12PULL_S              0
+#define AM_REG_GPIO_PADREGD_PAD12PULL_M              0x00000001
+#define AM_REG_GPIO_PADREGD_PAD12PULL(n)             (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_GPIO_PADREGD_PAD12PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGD_PAD12PULL_EN             0x00000001
+
+//*****************************************************************************
+//
+// GPIO_PADREGE - Pad Configuration Register E
+//
+//*****************************************************************************
+// Pad 19 function select
+#define AM_REG_GPIO_PADREGE_PAD19FNCSEL_S            27
+#define AM_REG_GPIO_PADREGE_PAD19FNCSEL_M            0x38000000
+#define AM_REG_GPIO_PADREGE_PAD19FNCSEL(n)           (((uint32_t)(n) << 27) & 0x38000000)
+#define AM_REG_GPIO_PADREGE_PAD19FNCSEL_CMPRF0       0x00000000
+#define AM_REG_GPIO_PADREGE_PAD19FNCSEL_M0nCE3       0x08000000
+#define AM_REG_GPIO_PADREGE_PAD19FNCSEL_TCTB1        0x10000000
+#define AM_REG_GPIO_PADREGE_PAD19FNCSEL_GPIO19       0x18000000
+#define AM_REG_GPIO_PADREGE_PAD19FNCSEL_TCTA1        0x20000000
+#define AM_REG_GPIO_PADREGE_PAD19FNCSEL_ANATEST1     0x28000000
+#define AM_REG_GPIO_PADREGE_PAD19FNCSEL_UART1RX      0x30000000
+#define AM_REG_GPIO_PADREGE_PAD19FNCSEL_I2S_BCLK     0x38000000
+
+// Pad 19 drive strentgh
+#define AM_REG_GPIO_PADREGE_PAD19STRNG_S             26
+#define AM_REG_GPIO_PADREGE_PAD19STRNG_M             0x04000000
+#define AM_REG_GPIO_PADREGE_PAD19STRNG(n)            (((uint32_t)(n) << 26) & 0x04000000)
+#define AM_REG_GPIO_PADREGE_PAD19STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGE_PAD19STRNG_HIGH          0x04000000
+
+// Pad 19 input enable
+#define AM_REG_GPIO_PADREGE_PAD19INPEN_S             25
+#define AM_REG_GPIO_PADREGE_PAD19INPEN_M             0x02000000
+#define AM_REG_GPIO_PADREGE_PAD19INPEN(n)            (((uint32_t)(n) << 25) & 0x02000000)
+#define AM_REG_GPIO_PADREGE_PAD19INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGE_PAD19INPEN_EN            0x02000000
+
+// Pad 19 pullup enable
+#define AM_REG_GPIO_PADREGE_PAD19PULL_S              24
+#define AM_REG_GPIO_PADREGE_PAD19PULL_M              0x01000000
+#define AM_REG_GPIO_PADREGE_PAD19PULL(n)             (((uint32_t)(n) << 24) & 0x01000000)
+#define AM_REG_GPIO_PADREGE_PAD19PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGE_PAD19PULL_EN             0x01000000
+
+// Pad 18 function select
+#define AM_REG_GPIO_PADREGE_PAD18FNCSEL_S            19
+#define AM_REG_GPIO_PADREGE_PAD18FNCSEL_M            0x00380000
+#define AM_REG_GPIO_PADREGE_PAD18FNCSEL(n)           (((uint32_t)(n) << 19) & 0x00380000)
+#define AM_REG_GPIO_PADREGE_PAD18FNCSEL_CMPIN1       0x00000000
+#define AM_REG_GPIO_PADREGE_PAD18FNCSEL_M0nCE2       0x00080000
+#define AM_REG_GPIO_PADREGE_PAD18FNCSEL_TCTA1        0x00100000
+#define AM_REG_GPIO_PADREGE_PAD18FNCSEL_GPIO18       0x00180000
+#define AM_REG_GPIO_PADREGE_PAD18FNCSEL_M4nCE1       0x00200000
+#define AM_REG_GPIO_PADREGE_PAD18FNCSEL_ANATEST2     0x00280000
+#define AM_REG_GPIO_PADREGE_PAD18FNCSEL_UART1TX      0x00300000
+#define AM_REG_GPIO_PADREGE_PAD18FNCSEL_32khz_XT     0x00380000
+
+// Pad 18 drive strength
+#define AM_REG_GPIO_PADREGE_PAD18STRNG_S             18
+#define AM_REG_GPIO_PADREGE_PAD18STRNG_M             0x00040000
+#define AM_REG_GPIO_PADREGE_PAD18STRNG(n)            (((uint32_t)(n) << 18) & 0x00040000)
+#define AM_REG_GPIO_PADREGE_PAD18STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGE_PAD18STRNG_HIGH          0x00040000
+
+// Pad 18 input enable
+#define AM_REG_GPIO_PADREGE_PAD18INPEN_S             17
+#define AM_REG_GPIO_PADREGE_PAD18INPEN_M             0x00020000
+#define AM_REG_GPIO_PADREGE_PAD18INPEN(n)            (((uint32_t)(n) << 17) & 0x00020000)
+#define AM_REG_GPIO_PADREGE_PAD18INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGE_PAD18INPEN_EN            0x00020000
+
+// Pad 18 pullup enable
+#define AM_REG_GPIO_PADREGE_PAD18PULL_S              16
+#define AM_REG_GPIO_PADREGE_PAD18PULL_M              0x00010000
+#define AM_REG_GPIO_PADREGE_PAD18PULL(n)             (((uint32_t)(n) << 16) & 0x00010000)
+#define AM_REG_GPIO_PADREGE_PAD18PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGE_PAD18PULL_EN             0x00010000
+
+// Pad 17 function select
+#define AM_REG_GPIO_PADREGE_PAD17FNCSEL_S            11
+#define AM_REG_GPIO_PADREGE_PAD17FNCSEL_M            0x00003800
+#define AM_REG_GPIO_PADREGE_PAD17FNCSEL(n)           (((uint32_t)(n) << 11) & 0x00003800)
+#define AM_REG_GPIO_PADREGE_PAD17FNCSEL_CMPRF1       0x00000000
+#define AM_REG_GPIO_PADREGE_PAD17FNCSEL_M0nCE1       0x00000800
+#define AM_REG_GPIO_PADREGE_PAD17FNCSEL_TRIG1        0x00001000
+#define AM_REG_GPIO_PADREGE_PAD17FNCSEL_GPIO17       0x00001800
+#define AM_REG_GPIO_PADREGE_PAD17FNCSEL_M4nCE3       0x00002000
+#define AM_REG_GPIO_PADREGE_PAD17FNCSEL_EXTLF        0x00002800
+#define AM_REG_GPIO_PADREGE_PAD17FNCSEL_UART0RX      0x00003000
+#define AM_REG_GPIO_PADREGE_PAD17FNCSEL_UA1CTS       0x00003800
+
+// Pad 17 drive strength
+#define AM_REG_GPIO_PADREGE_PAD17STRNG_S             10
+#define AM_REG_GPIO_PADREGE_PAD17STRNG_M             0x00000400
+#define AM_REG_GPIO_PADREGE_PAD17STRNG(n)            (((uint32_t)(n) << 10) & 0x00000400)
+#define AM_REG_GPIO_PADREGE_PAD17STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGE_PAD17STRNG_HIGH          0x00000400
+
+// Pad 17 input enable
+#define AM_REG_GPIO_PADREGE_PAD17INPEN_S             9
+#define AM_REG_GPIO_PADREGE_PAD17INPEN_M             0x00000200
+#define AM_REG_GPIO_PADREGE_PAD17INPEN(n)            (((uint32_t)(n) << 9) & 0x00000200)
+#define AM_REG_GPIO_PADREGE_PAD17INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGE_PAD17INPEN_EN            0x00000200
+
+// Pad 17 pullup enable
+#define AM_REG_GPIO_PADREGE_PAD17PULL_S              8
+#define AM_REG_GPIO_PADREGE_PAD17PULL_M              0x00000100
+#define AM_REG_GPIO_PADREGE_PAD17PULL(n)             (((uint32_t)(n) << 8) & 0x00000100)
+#define AM_REG_GPIO_PADREGE_PAD17PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGE_PAD17PULL_EN             0x00000100
+
+// Pad 16 function select
+#define AM_REG_GPIO_PADREGE_PAD16FNCSEL_S            3
+#define AM_REG_GPIO_PADREGE_PAD16FNCSEL_M            0x00000038
+#define AM_REG_GPIO_PADREGE_PAD16FNCSEL(n)           (((uint32_t)(n) << 3) & 0x00000038)
+#define AM_REG_GPIO_PADREGE_PAD16FNCSEL_ADCSE0       0x00000000
+#define AM_REG_GPIO_PADREGE_PAD16FNCSEL_M0nCE4       0x00000008
+#define AM_REG_GPIO_PADREGE_PAD16FNCSEL_TRIG0        0x00000010
+#define AM_REG_GPIO_PADREGE_PAD16FNCSEL_GPIO16       0x00000018
+#define AM_REG_GPIO_PADREGE_PAD16FNCSEL_M2nCE3       0x00000020
+#define AM_REG_GPIO_PADREGE_PAD16FNCSEL_CMPIN0       0x00000028
+#define AM_REG_GPIO_PADREGE_PAD16FNCSEL_UART0TX      0x00000030
+#define AM_REG_GPIO_PADREGE_PAD16FNCSEL_UA1RTS       0x00000038
+
+// Pad 16 drive strength
+#define AM_REG_GPIO_PADREGE_PAD16STRNG_S             2
+#define AM_REG_GPIO_PADREGE_PAD16STRNG_M             0x00000004
+#define AM_REG_GPIO_PADREGE_PAD16STRNG(n)            (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_GPIO_PADREGE_PAD16STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGE_PAD16STRNG_HIGH          0x00000004
+
+// Pad 16 input enable
+#define AM_REG_GPIO_PADREGE_PAD16INPEN_S             1
+#define AM_REG_GPIO_PADREGE_PAD16INPEN_M             0x00000002
+#define AM_REG_GPIO_PADREGE_PAD16INPEN(n)            (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_GPIO_PADREGE_PAD16INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGE_PAD16INPEN_EN            0x00000002
+
+// Pad 16 pullup enable
+#define AM_REG_GPIO_PADREGE_PAD16PULL_S              0
+#define AM_REG_GPIO_PADREGE_PAD16PULL_M              0x00000001
+#define AM_REG_GPIO_PADREGE_PAD16PULL(n)             (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_GPIO_PADREGE_PAD16PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGE_PAD16PULL_EN             0x00000001
+
+//*****************************************************************************
+//
+// GPIO_PADREGF - Pad Configuration Register F
+//
+//*****************************************************************************
+// Pad 23 function select
+#define AM_REG_GPIO_PADREGF_PAD23FNCSEL_S            27
+#define AM_REG_GPIO_PADREGF_PAD23FNCSEL_M            0x38000000
+#define AM_REG_GPIO_PADREGF_PAD23FNCSEL(n)           (((uint32_t)(n) << 27) & 0x38000000)
+#define AM_REG_GPIO_PADREGF_PAD23FNCSEL_UART0RX      0x00000000
+#define AM_REG_GPIO_PADREGF_PAD23FNCSEL_M0nCE0       0x08000000
+#define AM_REG_GPIO_PADREGF_PAD23FNCSEL_TCTB3        0x10000000
+#define AM_REG_GPIO_PADREGF_PAD23FNCSEL_GPIO23       0x18000000
+#define AM_REG_GPIO_PADREGF_PAD23FNCSEL_PDM_DATA     0x20000000
+#define AM_REG_GPIO_PADREGF_PAD23FNCSEL_CMPOUT       0x28000000
+#define AM_REG_GPIO_PADREGF_PAD23FNCSEL_TCTB1        0x30000000
+#define AM_REG_GPIO_PADREGF_PAD23FNCSEL_UNDEF7       0x38000000
+
+// Pad 23 drive strentgh
+#define AM_REG_GPIO_PADREGF_PAD23STRNG_S             26
+#define AM_REG_GPIO_PADREGF_PAD23STRNG_M             0x04000000
+#define AM_REG_GPIO_PADREGF_PAD23STRNG(n)            (((uint32_t)(n) << 26) & 0x04000000)
+#define AM_REG_GPIO_PADREGF_PAD23STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGF_PAD23STRNG_HIGH          0x04000000
+
+// Pad 23 input enable
+#define AM_REG_GPIO_PADREGF_PAD23INPEN_S             25
+#define AM_REG_GPIO_PADREGF_PAD23INPEN_M             0x02000000
+#define AM_REG_GPIO_PADREGF_PAD23INPEN(n)            (((uint32_t)(n) << 25) & 0x02000000)
+#define AM_REG_GPIO_PADREGF_PAD23INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGF_PAD23INPEN_EN            0x02000000
+
+// Pad 23 pullup enable
+#define AM_REG_GPIO_PADREGF_PAD23PULL_S              24
+#define AM_REG_GPIO_PADREGF_PAD23PULL_M              0x01000000
+#define AM_REG_GPIO_PADREGF_PAD23PULL(n)             (((uint32_t)(n) << 24) & 0x01000000)
+#define AM_REG_GPIO_PADREGF_PAD23PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGF_PAD23PULL_EN             0x01000000
+
+// Pad 22  upper power switch enable
+#define AM_REG_GPIO_PADREGF_PAD22PWRUP_S             23
+#define AM_REG_GPIO_PADREGF_PAD22PWRUP_M             0x00800000
+#define AM_REG_GPIO_PADREGF_PAD22PWRUP(n)            (((uint32_t)(n) << 23) & 0x00800000)
+#define AM_REG_GPIO_PADREGF_PAD22PWRUP_DIS           0x00000000
+#define AM_REG_GPIO_PADREGF_PAD22PWRUP_EN            0x00800000
+
+// Pad 22 function select
+#define AM_REG_GPIO_PADREGF_PAD22FNCSEL_S            19
+#define AM_REG_GPIO_PADREGF_PAD22FNCSEL_M            0x00380000
+#define AM_REG_GPIO_PADREGF_PAD22FNCSEL(n)           (((uint32_t)(n) << 19) & 0x00380000)
+#define AM_REG_GPIO_PADREGF_PAD22FNCSEL_UART0TX      0x00000000
+#define AM_REG_GPIO_PADREGF_PAD22FNCSEL_M1nCE7       0x00080000
+#define AM_REG_GPIO_PADREGF_PAD22FNCSEL_TCTA3        0x00100000
+#define AM_REG_GPIO_PADREGF_PAD22FNCSEL_GPIO22       0x00180000
+#define AM_REG_GPIO_PADREGF_PAD22FNCSEL_PDM_CLK      0x00200000
+#define AM_REG_GPIO_PADREGF_PAD22FNCSEL_UNDEF5       0x00280000
+#define AM_REG_GPIO_PADREGF_PAD22FNCSEL_TCTB1        0x00300000
+#define AM_REG_GPIO_PADREGF_PAD22FNCSEL_SWO          0x00380000
+
+// Pad 22 drive strength
+#define AM_REG_GPIO_PADREGF_PAD22STRNG_S             18
+#define AM_REG_GPIO_PADREGF_PAD22STRNG_M             0x00040000
+#define AM_REG_GPIO_PADREGF_PAD22STRNG(n)            (((uint32_t)(n) << 18) & 0x00040000)
+#define AM_REG_GPIO_PADREGF_PAD22STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGF_PAD22STRNG_HIGH          0x00040000
+
+// Pad 22 input enable
+#define AM_REG_GPIO_PADREGF_PAD22INPEN_S             17
+#define AM_REG_GPIO_PADREGF_PAD22INPEN_M             0x00020000
+#define AM_REG_GPIO_PADREGF_PAD22INPEN(n)            (((uint32_t)(n) << 17) & 0x00020000)
+#define AM_REG_GPIO_PADREGF_PAD22INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGF_PAD22INPEN_EN            0x00020000
+
+// Pad 22 pullup enable
+#define AM_REG_GPIO_PADREGF_PAD22PULL_S              16
+#define AM_REG_GPIO_PADREGF_PAD22PULL_M              0x00010000
+#define AM_REG_GPIO_PADREGF_PAD22PULL(n)             (((uint32_t)(n) << 16) & 0x00010000)
+#define AM_REG_GPIO_PADREGF_PAD22PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGF_PAD22PULL_EN             0x00010000
+
+// Pad 21 function select
+#define AM_REG_GPIO_PADREGF_PAD21FNCSEL_S            11
+#define AM_REG_GPIO_PADREGF_PAD21FNCSEL_M            0x00003800
+#define AM_REG_GPIO_PADREGF_PAD21FNCSEL(n)           (((uint32_t)(n) << 11) & 0x00003800)
+#define AM_REG_GPIO_PADREGF_PAD21FNCSEL_SWDIO        0x00000000
+#define AM_REG_GPIO_PADREGF_PAD21FNCSEL_M1nCE6       0x00000800
+#define AM_REG_GPIO_PADREGF_PAD21FNCSEL_TCTB2        0x00001000
+#define AM_REG_GPIO_PADREGF_PAD21FNCSEL_GPIO21       0x00001800
+#define AM_REG_GPIO_PADREGF_PAD21FNCSEL_UART0RX      0x00002000
+#define AM_REG_GPIO_PADREGF_PAD21FNCSEL_UART1RX      0x00002800
+#define AM_REG_GPIO_PADREGF_PAD21FNCSEL_UNDEF6       0x00003000
+#define AM_REG_GPIO_PADREGF_PAD21FNCSEL_UNDEF7       0x00003800
+
+// Pad 21 drive strength
+#define AM_REG_GPIO_PADREGF_PAD21STRNG_S             10
+#define AM_REG_GPIO_PADREGF_PAD21STRNG_M             0x00000400
+#define AM_REG_GPIO_PADREGF_PAD21STRNG(n)            (((uint32_t)(n) << 10) & 0x00000400)
+#define AM_REG_GPIO_PADREGF_PAD21STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGF_PAD21STRNG_HIGH          0x00000400
+
+// Pad 21 input enable
+#define AM_REG_GPIO_PADREGF_PAD21INPEN_S             9
+#define AM_REG_GPIO_PADREGF_PAD21INPEN_M             0x00000200
+#define AM_REG_GPIO_PADREGF_PAD21INPEN(n)            (((uint32_t)(n) << 9) & 0x00000200)
+#define AM_REG_GPIO_PADREGF_PAD21INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGF_PAD21INPEN_EN            0x00000200
+
+// Pad 21 pullup enable
+#define AM_REG_GPIO_PADREGF_PAD21PULL_S              8
+#define AM_REG_GPIO_PADREGF_PAD21PULL_M              0x00000100
+#define AM_REG_GPIO_PADREGF_PAD21PULL(n)             (((uint32_t)(n) << 8) & 0x00000100)
+#define AM_REG_GPIO_PADREGF_PAD21PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGF_PAD21PULL_EN             0x00000100
+
+// Pad 20 function select
+#define AM_REG_GPIO_PADREGF_PAD20FNCSEL_S            3
+#define AM_REG_GPIO_PADREGF_PAD20FNCSEL_M            0x00000038
+#define AM_REG_GPIO_PADREGF_PAD20FNCSEL(n)           (((uint32_t)(n) << 3) & 0x00000038)
+#define AM_REG_GPIO_PADREGF_PAD20FNCSEL_SWDCK        0x00000000
+#define AM_REG_GPIO_PADREGF_PAD20FNCSEL_M1nCE5       0x00000008
+#define AM_REG_GPIO_PADREGF_PAD20FNCSEL_TCTA2        0x00000010
+#define AM_REG_GPIO_PADREGF_PAD20FNCSEL_GPIO20       0x00000018
+#define AM_REG_GPIO_PADREGF_PAD20FNCSEL_UART0TX      0x00000020
+#define AM_REG_GPIO_PADREGF_PAD20FNCSEL_UART1TX      0x00000028
+#define AM_REG_GPIO_PADREGF_PAD20FNCSEL_UNDEF6       0x00000030
+#define AM_REG_GPIO_PADREGF_PAD20FNCSEL_UNDEF7       0x00000038
+
+// Pad 20 drive strength
+#define AM_REG_GPIO_PADREGF_PAD20STRNG_S             2
+#define AM_REG_GPIO_PADREGF_PAD20STRNG_M             0x00000004
+#define AM_REG_GPIO_PADREGF_PAD20STRNG(n)            (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_GPIO_PADREGF_PAD20STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGF_PAD20STRNG_HIGH          0x00000004
+
+// Pad 20 input enable
+#define AM_REG_GPIO_PADREGF_PAD20INPEN_S             1
+#define AM_REG_GPIO_PADREGF_PAD20INPEN_M             0x00000002
+#define AM_REG_GPIO_PADREGF_PAD20INPEN(n)            (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_GPIO_PADREGF_PAD20INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGF_PAD20INPEN_EN            0x00000002
+
+// Pad 20 pulldown enable
+#define AM_REG_GPIO_PADREGF_PAD20PULL_S              0
+#define AM_REG_GPIO_PADREGF_PAD20PULL_M              0x00000001
+#define AM_REG_GPIO_PADREGF_PAD20PULL(n)             (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_GPIO_PADREGF_PAD20PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGF_PAD20PULL_EN             0x00000001
+
+//*****************************************************************************
+//
+// GPIO_PADREGG - Pad Configuration Register G
+//
+//*****************************************************************************
+// Pad 27 pullup resistor selection.
+#define AM_REG_GPIO_PADREGG_PAD27RSEL_S              30
+#define AM_REG_GPIO_PADREGG_PAD27RSEL_M              0xC0000000
+#define AM_REG_GPIO_PADREGG_PAD27RSEL(n)             (((uint32_t)(n) << 30) & 0xC0000000)
+#define AM_REG_GPIO_PADREGG_PAD27RSEL_PULL1_5K       0x00000000
+#define AM_REG_GPIO_PADREGG_PAD27RSEL_PULL6K         0x40000000
+#define AM_REG_GPIO_PADREGG_PAD27RSEL_PULL12K        0x80000000
+#define AM_REG_GPIO_PADREGG_PAD27RSEL_PULL24K        0xC0000000
+
+// Pad 27 function select
+#define AM_REG_GPIO_PADREGG_PAD27FNCSEL_S            27
+#define AM_REG_GPIO_PADREGG_PAD27FNCSEL_M            0x38000000
+#define AM_REG_GPIO_PADREGG_PAD27FNCSEL(n)           (((uint32_t)(n) << 27) & 0x38000000)
+#define AM_REG_GPIO_PADREGG_PAD27FNCSEL_EXTHF        0x00000000
+#define AM_REG_GPIO_PADREGG_PAD27FNCSEL_M1nCE4       0x08000000
+#define AM_REG_GPIO_PADREGG_PAD27FNCSEL_TCTA1        0x10000000
+#define AM_REG_GPIO_PADREGG_PAD27FNCSEL_GPIO27       0x18000000
+#define AM_REG_GPIO_PADREGG_PAD27FNCSEL_M2SCL        0x20000000
+#define AM_REG_GPIO_PADREGG_PAD27FNCSEL_M2SCK        0x28000000
+#define AM_REG_GPIO_PADREGG_PAD27FNCSEL_M2SCKLB      0x30000000
+#define AM_REG_GPIO_PADREGG_PAD27FNCSEL_M2SCLLB      0x38000000
+
+// Pad 27 drive strentgh
+#define AM_REG_GPIO_PADREGG_PAD27STRNG_S             26
+#define AM_REG_GPIO_PADREGG_PAD27STRNG_M             0x04000000
+#define AM_REG_GPIO_PADREGG_PAD27STRNG(n)            (((uint32_t)(n) << 26) & 0x04000000)
+#define AM_REG_GPIO_PADREGG_PAD27STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGG_PAD27STRNG_HIGH          0x04000000
+
+// Pad 27 input enable
+#define AM_REG_GPIO_PADREGG_PAD27INPEN_S             25
+#define AM_REG_GPIO_PADREGG_PAD27INPEN_M             0x02000000
+#define AM_REG_GPIO_PADREGG_PAD27INPEN(n)            (((uint32_t)(n) << 25) & 0x02000000)
+#define AM_REG_GPIO_PADREGG_PAD27INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGG_PAD27INPEN_EN            0x02000000
+
+// Pad 27 pullup enable
+#define AM_REG_GPIO_PADREGG_PAD27PULL_S              24
+#define AM_REG_GPIO_PADREGG_PAD27PULL_M              0x01000000
+#define AM_REG_GPIO_PADREGG_PAD27PULL(n)             (((uint32_t)(n) << 24) & 0x01000000)
+#define AM_REG_GPIO_PADREGG_PAD27PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGG_PAD27PULL_EN             0x01000000
+
+// Pad 26 function select
+#define AM_REG_GPIO_PADREGG_PAD26FNCSEL_S            19
+#define AM_REG_GPIO_PADREGG_PAD26FNCSEL_M            0x00380000
+#define AM_REG_GPIO_PADREGG_PAD26FNCSEL(n)           (((uint32_t)(n) << 19) & 0x00380000)
+#define AM_REG_GPIO_PADREGG_PAD26FNCSEL_EXTLF        0x00000000
+#define AM_REG_GPIO_PADREGG_PAD26FNCSEL_M0nCE3       0x00080000
+#define AM_REG_GPIO_PADREGG_PAD26FNCSEL_TCTB0        0x00100000
+#define AM_REG_GPIO_PADREGG_PAD26FNCSEL_GPIO26       0x00180000
+#define AM_REG_GPIO_PADREGG_PAD26FNCSEL_M2nCE0       0x00200000
+#define AM_REG_GPIO_PADREGG_PAD26FNCSEL_TCTA1        0x00280000
+#define AM_REG_GPIO_PADREGG_PAD26FNCSEL_M5nCE1       0x00300000
+#define AM_REG_GPIO_PADREGG_PAD26FNCSEL_M3nCE0       0x00380000
+
+// Pad 26 drive strength
+#define AM_REG_GPIO_PADREGG_PAD26STRNG_S             18
+#define AM_REG_GPIO_PADREGG_PAD26STRNG_M             0x00040000
+#define AM_REG_GPIO_PADREGG_PAD26STRNG(n)            (((uint32_t)(n) << 18) & 0x00040000)
+#define AM_REG_GPIO_PADREGG_PAD26STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGG_PAD26STRNG_HIGH          0x00040000
+
+// Pad 26 input enable
+#define AM_REG_GPIO_PADREGG_PAD26INPEN_S             17
+#define AM_REG_GPIO_PADREGG_PAD26INPEN_M             0x00020000
+#define AM_REG_GPIO_PADREGG_PAD26INPEN(n)            (((uint32_t)(n) << 17) & 0x00020000)
+#define AM_REG_GPIO_PADREGG_PAD26INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGG_PAD26INPEN_EN            0x00020000
+
+// Pad 26 pullup enable
+#define AM_REG_GPIO_PADREGG_PAD26PULL_S              16
+#define AM_REG_GPIO_PADREGG_PAD26PULL_M              0x00010000
+#define AM_REG_GPIO_PADREGG_PAD26PULL(n)             (((uint32_t)(n) << 16) & 0x00010000)
+#define AM_REG_GPIO_PADREGG_PAD26PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGG_PAD26PULL_EN             0x00010000
+
+// Pad 25 pullup resistor selection.
+#define AM_REG_GPIO_PADREGG_PAD25RSEL_S              14
+#define AM_REG_GPIO_PADREGG_PAD25RSEL_M              0x0000C000
+#define AM_REG_GPIO_PADREGG_PAD25RSEL(n)             (((uint32_t)(n) << 14) & 0x0000C000)
+#define AM_REG_GPIO_PADREGG_PAD25RSEL_PULL1_5K       0x00000000
+#define AM_REG_GPIO_PADREGG_PAD25RSEL_PULL6K         0x00004000
+#define AM_REG_GPIO_PADREGG_PAD25RSEL_PULL12K        0x00008000
+#define AM_REG_GPIO_PADREGG_PAD25RSEL_PULL24K        0x0000C000
+
+// Pad 25 function select
+#define AM_REG_GPIO_PADREGG_PAD25FNCSEL_S            11
+#define AM_REG_GPIO_PADREGG_PAD25FNCSEL_M            0x00003800
+#define AM_REG_GPIO_PADREGG_PAD25FNCSEL(n)           (((uint32_t)(n) << 11) & 0x00003800)
+#define AM_REG_GPIO_PADREGG_PAD25FNCSEL_EXTXT        0x00000000
+#define AM_REG_GPIO_PADREGG_PAD25FNCSEL_M0nCE2       0x00000800
+#define AM_REG_GPIO_PADREGG_PAD25FNCSEL_TCTA0        0x00001000
+#define AM_REG_GPIO_PADREGG_PAD25FNCSEL_GPIO25       0x00001800
+#define AM_REG_GPIO_PADREGG_PAD25FNCSEL_M2SDA        0x00002000
+#define AM_REG_GPIO_PADREGG_PAD25FNCSEL_M2MISO       0x00002800
+#define AM_REG_GPIO_PADREGG_PAD25FNCSEL_SLMISOLB     0x00003000
+#define AM_REG_GPIO_PADREGG_PAD25FNCSEL_SLSDALB      0x00003800
+
+// Pad 25 drive strength
+#define AM_REG_GPIO_PADREGG_PAD25STRNG_S             10
+#define AM_REG_GPIO_PADREGG_PAD25STRNG_M             0x00000400
+#define AM_REG_GPIO_PADREGG_PAD25STRNG(n)            (((uint32_t)(n) << 10) & 0x00000400)
+#define AM_REG_GPIO_PADREGG_PAD25STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGG_PAD25STRNG_HIGH          0x00000400
+
+// Pad 25 input enable
+#define AM_REG_GPIO_PADREGG_PAD25INPEN_S             9
+#define AM_REG_GPIO_PADREGG_PAD25INPEN_M             0x00000200
+#define AM_REG_GPIO_PADREGG_PAD25INPEN(n)            (((uint32_t)(n) << 9) & 0x00000200)
+#define AM_REG_GPIO_PADREGG_PAD25INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGG_PAD25INPEN_EN            0x00000200
+
+// Pad 25 pullup enable
+#define AM_REG_GPIO_PADREGG_PAD25PULL_S              8
+#define AM_REG_GPIO_PADREGG_PAD25PULL_M              0x00000100
+#define AM_REG_GPIO_PADREGG_PAD25PULL(n)             (((uint32_t)(n) << 8) & 0x00000100)
+#define AM_REG_GPIO_PADREGG_PAD25PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGG_PAD25PULL_EN             0x00000100
+
+// Pad 24 function select
+#define AM_REG_GPIO_PADREGG_PAD24FNCSEL_S            3
+#define AM_REG_GPIO_PADREGG_PAD24FNCSEL_M            0x00000038
+#define AM_REG_GPIO_PADREGG_PAD24FNCSEL(n)           (((uint32_t)(n) << 3) & 0x00000038)
+#define AM_REG_GPIO_PADREGG_PAD24FNCSEL_M2nCE1       0x00000000
+#define AM_REG_GPIO_PADREGG_PAD24FNCSEL_M0nCE1       0x00000008
+#define AM_REG_GPIO_PADREGG_PAD24FNCSEL_CLKOUT       0x00000010
+#define AM_REG_GPIO_PADREGG_PAD24FNCSEL_GPIO24       0x00000018
+#define AM_REG_GPIO_PADREGG_PAD24FNCSEL_M5nCE0       0x00000020
+#define AM_REG_GPIO_PADREGG_PAD24FNCSEL_TCTA1        0x00000028
+#define AM_REG_GPIO_PADREGG_PAD24FNCSEL_I2S_BCLK     0x00000030
+#define AM_REG_GPIO_PADREGG_PAD24FNCSEL_SWO          0x00000038
+
+// Pad 24 drive strength
+#define AM_REG_GPIO_PADREGG_PAD24STRNG_S             2
+#define AM_REG_GPIO_PADREGG_PAD24STRNG_M             0x00000004
+#define AM_REG_GPIO_PADREGG_PAD24STRNG(n)            (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_GPIO_PADREGG_PAD24STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGG_PAD24STRNG_HIGH          0x00000004
+
+// Pad 24 input enable
+#define AM_REG_GPIO_PADREGG_PAD24INPEN_S             1
+#define AM_REG_GPIO_PADREGG_PAD24INPEN_M             0x00000002
+#define AM_REG_GPIO_PADREGG_PAD24INPEN(n)            (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_GPIO_PADREGG_PAD24INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGG_PAD24INPEN_EN            0x00000002
+
+// Pad 24 pullup enable
+#define AM_REG_GPIO_PADREGG_PAD24PULL_S              0
+#define AM_REG_GPIO_PADREGG_PAD24PULL_M              0x00000001
+#define AM_REG_GPIO_PADREGG_PAD24PULL(n)             (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_GPIO_PADREGG_PAD24PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGG_PAD24PULL_EN             0x00000001
+
+//*****************************************************************************
+//
+// GPIO_PADREGH - Pad Configuration Register H
+//
+//*****************************************************************************
+// Pad 31 function select
+#define AM_REG_GPIO_PADREGH_PAD31FNCSEL_S            27
+#define AM_REG_GPIO_PADREGH_PAD31FNCSEL_M            0x38000000
+#define AM_REG_GPIO_PADREGH_PAD31FNCSEL(n)           (((uint32_t)(n) << 27) & 0x38000000)
+#define AM_REG_GPIO_PADREGH_PAD31FNCSEL_ADCSE3       0x00000000
+#define AM_REG_GPIO_PADREGH_PAD31FNCSEL_M0nCE4       0x08000000
+#define AM_REG_GPIO_PADREGH_PAD31FNCSEL_TCTA3        0x10000000
+#define AM_REG_GPIO_PADREGH_PAD31FNCSEL_GPIO31       0x18000000
+#define AM_REG_GPIO_PADREGH_PAD31FNCSEL_UART0RX      0x20000000
+#define AM_REG_GPIO_PADREGH_PAD31FNCSEL_TCTB1        0x28000000
+#define AM_REG_GPIO_PADREGH_PAD31FNCSEL_UNDEF6       0x30000000
+#define AM_REG_GPIO_PADREGH_PAD31FNCSEL_UNDEF7       0x38000000
+
+// Pad 31 drive strentgh
+#define AM_REG_GPIO_PADREGH_PAD31STRNG_S             26
+#define AM_REG_GPIO_PADREGH_PAD31STRNG_M             0x04000000
+#define AM_REG_GPIO_PADREGH_PAD31STRNG(n)            (((uint32_t)(n) << 26) & 0x04000000)
+#define AM_REG_GPIO_PADREGH_PAD31STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGH_PAD31STRNG_HIGH          0x04000000
+
+// Pad 31 input enable
+#define AM_REG_GPIO_PADREGH_PAD31INPEN_S             25
+#define AM_REG_GPIO_PADREGH_PAD31INPEN_M             0x02000000
+#define AM_REG_GPIO_PADREGH_PAD31INPEN(n)            (((uint32_t)(n) << 25) & 0x02000000)
+#define AM_REG_GPIO_PADREGH_PAD31INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGH_PAD31INPEN_EN            0x02000000
+
+// Pad 31 pullup enable
+#define AM_REG_GPIO_PADREGH_PAD31PULL_S              24
+#define AM_REG_GPIO_PADREGH_PAD31PULL_M              0x01000000
+#define AM_REG_GPIO_PADREGH_PAD31PULL(n)             (((uint32_t)(n) << 24) & 0x01000000)
+#define AM_REG_GPIO_PADREGH_PAD31PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGH_PAD31PULL_EN             0x01000000
+
+// Pad 30 function select
+#define AM_REG_GPIO_PADREGH_PAD30FNCSEL_S            19
+#define AM_REG_GPIO_PADREGH_PAD30FNCSEL_M            0x00380000
+#define AM_REG_GPIO_PADREGH_PAD30FNCSEL(n)           (((uint32_t)(n) << 19) & 0x00380000)
+#define AM_REG_GPIO_PADREGH_PAD30FNCSEL_UNDEF0       0x00000000
+#define AM_REG_GPIO_PADREGH_PAD30FNCSEL_M1nCE7       0x00080000
+#define AM_REG_GPIO_PADREGH_PAD30FNCSEL_TCTB2        0x00100000
+#define AM_REG_GPIO_PADREGH_PAD30FNCSEL_GPIO30       0x00180000
+#define AM_REG_GPIO_PADREGH_PAD30FNCSEL_UART0TX      0x00200000
+#define AM_REG_GPIO_PADREGH_PAD30FNCSEL_UA1RTS       0x00280000
+#define AM_REG_GPIO_PADREGH_PAD30FNCSEL_UNDEF6       0x00300000
+#define AM_REG_GPIO_PADREGH_PAD30FNCSEL_I2S_DAT      0x00380000
+
+// Pad 30 drive strength
+#define AM_REG_GPIO_PADREGH_PAD30STRNG_S             18
+#define AM_REG_GPIO_PADREGH_PAD30STRNG_M             0x00040000
+#define AM_REG_GPIO_PADREGH_PAD30STRNG(n)            (((uint32_t)(n) << 18) & 0x00040000)
+#define AM_REG_GPIO_PADREGH_PAD30STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGH_PAD30STRNG_HIGH          0x00040000
+
+// Pad 30 input enable
+#define AM_REG_GPIO_PADREGH_PAD30INPEN_S             17
+#define AM_REG_GPIO_PADREGH_PAD30INPEN_M             0x00020000
+#define AM_REG_GPIO_PADREGH_PAD30INPEN(n)            (((uint32_t)(n) << 17) & 0x00020000)
+#define AM_REG_GPIO_PADREGH_PAD30INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGH_PAD30INPEN_EN            0x00020000
+
+// Pad 30 pullup enable
+#define AM_REG_GPIO_PADREGH_PAD30PULL_S              16
+#define AM_REG_GPIO_PADREGH_PAD30PULL_M              0x00010000
+#define AM_REG_GPIO_PADREGH_PAD30PULL(n)             (((uint32_t)(n) << 16) & 0x00010000)
+#define AM_REG_GPIO_PADREGH_PAD30PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGH_PAD30PULL_EN             0x00010000
+
+// Pad 29 function select
+#define AM_REG_GPIO_PADREGH_PAD29FNCSEL_S            11
+#define AM_REG_GPIO_PADREGH_PAD29FNCSEL_M            0x00003800
+#define AM_REG_GPIO_PADREGH_PAD29FNCSEL(n)           (((uint32_t)(n) << 11) & 0x00003800)
+#define AM_REG_GPIO_PADREGH_PAD29FNCSEL_ADCSE1       0x00000000
+#define AM_REG_GPIO_PADREGH_PAD29FNCSEL_M1nCE6       0x00000800
+#define AM_REG_GPIO_PADREGH_PAD29FNCSEL_TCTA2        0x00001000
+#define AM_REG_GPIO_PADREGH_PAD29FNCSEL_GPIO29       0x00001800
+#define AM_REG_GPIO_PADREGH_PAD29FNCSEL_UA0CTS       0x00002000
+#define AM_REG_GPIO_PADREGH_PAD29FNCSEL_UA1CTS       0x00002800
+#define AM_REG_GPIO_PADREGH_PAD29FNCSEL_M4nCE0       0x00003000
+#define AM_REG_GPIO_PADREGH_PAD29FNCSEL_PDM_DATA     0x00003800
+
+// Pad 29 drive strength
+#define AM_REG_GPIO_PADREGH_PAD29STRNG_S             10
+#define AM_REG_GPIO_PADREGH_PAD29STRNG_M             0x00000400
+#define AM_REG_GPIO_PADREGH_PAD29STRNG(n)            (((uint32_t)(n) << 10) & 0x00000400)
+#define AM_REG_GPIO_PADREGH_PAD29STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGH_PAD29STRNG_HIGH          0x00000400
+
+// Pad 29 input enable
+#define AM_REG_GPIO_PADREGH_PAD29INPEN_S             9
+#define AM_REG_GPIO_PADREGH_PAD29INPEN_M             0x00000200
+#define AM_REG_GPIO_PADREGH_PAD29INPEN(n)            (((uint32_t)(n) << 9) & 0x00000200)
+#define AM_REG_GPIO_PADREGH_PAD29INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGH_PAD29INPEN_EN            0x00000200
+
+// Pad 29 pullup enable
+#define AM_REG_GPIO_PADREGH_PAD29PULL_S              8
+#define AM_REG_GPIO_PADREGH_PAD29PULL_M              0x00000100
+#define AM_REG_GPIO_PADREGH_PAD29PULL(n)             (((uint32_t)(n) << 8) & 0x00000100)
+#define AM_REG_GPIO_PADREGH_PAD29PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGH_PAD29PULL_EN             0x00000100
+
+// Pad 28 function select
+#define AM_REG_GPIO_PADREGH_PAD28FNCSEL_S            3
+#define AM_REG_GPIO_PADREGH_PAD28FNCSEL_M            0x00000038
+#define AM_REG_GPIO_PADREGH_PAD28FNCSEL(n)           (((uint32_t)(n) << 3) & 0x00000038)
+#define AM_REG_GPIO_PADREGH_PAD28FNCSEL_I2S_WCLK     0x00000000
+#define AM_REG_GPIO_PADREGH_PAD28FNCSEL_M1nCE5       0x00000008
+#define AM_REG_GPIO_PADREGH_PAD28FNCSEL_TCTB1        0x00000010
+#define AM_REG_GPIO_PADREGH_PAD28FNCSEL_GPIO28       0x00000018
+#define AM_REG_GPIO_PADREGH_PAD28FNCSEL_M2WIR3       0x00000020
+#define AM_REG_GPIO_PADREGH_PAD28FNCSEL_M2MOSI       0x00000028
+#define AM_REG_GPIO_PADREGH_PAD28FNCSEL_M5nCE3       0x00000030
+#define AM_REG_GPIO_PADREGH_PAD28FNCSEL_SLWIR3LB     0x00000038
+
+// Pad 28 drive strength
+#define AM_REG_GPIO_PADREGH_PAD28STRNG_S             2
+#define AM_REG_GPIO_PADREGH_PAD28STRNG_M             0x00000004
+#define AM_REG_GPIO_PADREGH_PAD28STRNG(n)            (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_GPIO_PADREGH_PAD28STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGH_PAD28STRNG_HIGH          0x00000004
+
+// Pad 28 input enable
+#define AM_REG_GPIO_PADREGH_PAD28INPEN_S             1
+#define AM_REG_GPIO_PADREGH_PAD28INPEN_M             0x00000002
+#define AM_REG_GPIO_PADREGH_PAD28INPEN(n)            (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_GPIO_PADREGH_PAD28INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGH_PAD28INPEN_EN            0x00000002
+
+// Pad 28 pullup enable
+#define AM_REG_GPIO_PADREGH_PAD28PULL_S              0
+#define AM_REG_GPIO_PADREGH_PAD28PULL_M              0x00000001
+#define AM_REG_GPIO_PADREGH_PAD28PULL(n)             (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_GPIO_PADREGH_PAD28PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGH_PAD28PULL_EN             0x00000001
+
+//*****************************************************************************
+//
+// GPIO_PADREGI - Pad Configuration Register I
+//
+//*****************************************************************************
+// Pad 35 function select
+#define AM_REG_GPIO_PADREGI_PAD35FNCSEL_S            27
+#define AM_REG_GPIO_PADREGI_PAD35FNCSEL_M            0x38000000
+#define AM_REG_GPIO_PADREGI_PAD35FNCSEL(n)           (((uint32_t)(n) << 27) & 0x38000000)
+#define AM_REG_GPIO_PADREGI_PAD35FNCSEL_ADCSE7       0x00000000
+#define AM_REG_GPIO_PADREGI_PAD35FNCSEL_M1nCE0       0x08000000
+#define AM_REG_GPIO_PADREGI_PAD35FNCSEL_UART1TX      0x10000000
+#define AM_REG_GPIO_PADREGI_PAD35FNCSEL_GPIO35       0x18000000
+#define AM_REG_GPIO_PADREGI_PAD35FNCSEL_M4nCE6       0x20000000
+#define AM_REG_GPIO_PADREGI_PAD35FNCSEL_TCTA1        0x28000000
+#define AM_REG_GPIO_PADREGI_PAD35FNCSEL_UA0RTS       0x30000000
+#define AM_REG_GPIO_PADREGI_PAD35FNCSEL_M3nCE2       0x38000000
+
+// Pad 35 drive strentgh
+#define AM_REG_GPIO_PADREGI_PAD35STRNG_S             26
+#define AM_REG_GPIO_PADREGI_PAD35STRNG_M             0x04000000
+#define AM_REG_GPIO_PADREGI_PAD35STRNG(n)            (((uint32_t)(n) << 26) & 0x04000000)
+#define AM_REG_GPIO_PADREGI_PAD35STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGI_PAD35STRNG_HIGH          0x04000000
+
+// Pad 35 input enable
+#define AM_REG_GPIO_PADREGI_PAD35INPEN_S             25
+#define AM_REG_GPIO_PADREGI_PAD35INPEN_M             0x02000000
+#define AM_REG_GPIO_PADREGI_PAD35INPEN(n)            (((uint32_t)(n) << 25) & 0x02000000)
+#define AM_REG_GPIO_PADREGI_PAD35INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGI_PAD35INPEN_EN            0x02000000
+
+// Pad 35 pullup enable
+#define AM_REG_GPIO_PADREGI_PAD35PULL_S              24
+#define AM_REG_GPIO_PADREGI_PAD35PULL_M              0x01000000
+#define AM_REG_GPIO_PADREGI_PAD35PULL(n)             (((uint32_t)(n) << 24) & 0x01000000)
+#define AM_REG_GPIO_PADREGI_PAD35PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGI_PAD35PULL_EN             0x01000000
+
+// Pad 34 function select
+#define AM_REG_GPIO_PADREGI_PAD34FNCSEL_S            19
+#define AM_REG_GPIO_PADREGI_PAD34FNCSEL_M            0x00380000
+#define AM_REG_GPIO_PADREGI_PAD34FNCSEL(n)           (((uint32_t)(n) << 19) & 0x00380000)
+#define AM_REG_GPIO_PADREGI_PAD34FNCSEL_ADCSE6       0x00000000
+#define AM_REG_GPIO_PADREGI_PAD34FNCSEL_M0nCE7       0x00080000
+#define AM_REG_GPIO_PADREGI_PAD34FNCSEL_M2nCE3       0x00100000
+#define AM_REG_GPIO_PADREGI_PAD34FNCSEL_GPIO34       0x00180000
+#define AM_REG_GPIO_PADREGI_PAD34FNCSEL_CMPRF2       0x00200000
+#define AM_REG_GPIO_PADREGI_PAD34FNCSEL_M3nCE1       0x00280000
+#define AM_REG_GPIO_PADREGI_PAD34FNCSEL_M4nCE0       0x00300000
+#define AM_REG_GPIO_PADREGI_PAD34FNCSEL_M5nCE2       0x00380000
+
+// Pad 34 drive strength
+#define AM_REG_GPIO_PADREGI_PAD34STRNG_S             18
+#define AM_REG_GPIO_PADREGI_PAD34STRNG_M             0x00040000
+#define AM_REG_GPIO_PADREGI_PAD34STRNG(n)            (((uint32_t)(n) << 18) & 0x00040000)
+#define AM_REG_GPIO_PADREGI_PAD34STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGI_PAD34STRNG_HIGH          0x00040000
+
+// Pad 34 input enable
+#define AM_REG_GPIO_PADREGI_PAD34INPEN_S             17
+#define AM_REG_GPIO_PADREGI_PAD34INPEN_M             0x00020000
+#define AM_REG_GPIO_PADREGI_PAD34INPEN(n)            (((uint32_t)(n) << 17) & 0x00020000)
+#define AM_REG_GPIO_PADREGI_PAD34INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGI_PAD34INPEN_EN            0x00020000
+
+// Pad 34 pullup enable
+#define AM_REG_GPIO_PADREGI_PAD34PULL_S              16
+#define AM_REG_GPIO_PADREGI_PAD34PULL_M              0x00010000
+#define AM_REG_GPIO_PADREGI_PAD34PULL(n)             (((uint32_t)(n) << 16) & 0x00010000)
+#define AM_REG_GPIO_PADREGI_PAD34PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGI_PAD34PULL_EN             0x00010000
+
+// Pad 33 function select
+#define AM_REG_GPIO_PADREGI_PAD33FNCSEL_S            11
+#define AM_REG_GPIO_PADREGI_PAD33FNCSEL_M            0x00003800
+#define AM_REG_GPIO_PADREGI_PAD33FNCSEL(n)           (((uint32_t)(n) << 11) & 0x00003800)
+#define AM_REG_GPIO_PADREGI_PAD33FNCSEL_ADCSE5       0x00000000
+#define AM_REG_GPIO_PADREGI_PAD33FNCSEL_M0nCE6       0x00000800
+#define AM_REG_GPIO_PADREGI_PAD33FNCSEL_32khz_XT     0x00001000
+#define AM_REG_GPIO_PADREGI_PAD33FNCSEL_GPIO33       0x00001800
+#define AM_REG_GPIO_PADREGI_PAD33FNCSEL_UNDEF4       0x00002000
+#define AM_REG_GPIO_PADREGI_PAD33FNCSEL_M3nCE7       0x00002800
+#define AM_REG_GPIO_PADREGI_PAD33FNCSEL_TCTB1        0x00003000
+#define AM_REG_GPIO_PADREGI_PAD33FNCSEL_SWO          0x00003800
+
+// Pad 33 drive strength
+#define AM_REG_GPIO_PADREGI_PAD33STRNG_S             10
+#define AM_REG_GPIO_PADREGI_PAD33STRNG_M             0x00000400
+#define AM_REG_GPIO_PADREGI_PAD33STRNG(n)            (((uint32_t)(n) << 10) & 0x00000400)
+#define AM_REG_GPIO_PADREGI_PAD33STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGI_PAD33STRNG_HIGH          0x00000400
+
+// Pad 33 input enable
+#define AM_REG_GPIO_PADREGI_PAD33INPEN_S             9
+#define AM_REG_GPIO_PADREGI_PAD33INPEN_M             0x00000200
+#define AM_REG_GPIO_PADREGI_PAD33INPEN(n)            (((uint32_t)(n) << 9) & 0x00000200)
+#define AM_REG_GPIO_PADREGI_PAD33INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGI_PAD33INPEN_EN            0x00000200
+
+// Pad 33 pullup enable
+#define AM_REG_GPIO_PADREGI_PAD33PULL_S              8
+#define AM_REG_GPIO_PADREGI_PAD33PULL_M              0x00000100
+#define AM_REG_GPIO_PADREGI_PAD33PULL(n)             (((uint32_t)(n) << 8) & 0x00000100)
+#define AM_REG_GPIO_PADREGI_PAD33PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGI_PAD33PULL_EN             0x00000100
+
+// Pad 32 function select
+#define AM_REG_GPIO_PADREGI_PAD32FNCSEL_S            3
+#define AM_REG_GPIO_PADREGI_PAD32FNCSEL_M            0x00000038
+#define AM_REG_GPIO_PADREGI_PAD32FNCSEL(n)           (((uint32_t)(n) << 3) & 0x00000038)
+#define AM_REG_GPIO_PADREGI_PAD32FNCSEL_ADCSE4       0x00000000
+#define AM_REG_GPIO_PADREGI_PAD32FNCSEL_M0nCE5       0x00000008
+#define AM_REG_GPIO_PADREGI_PAD32FNCSEL_TCTB3        0x00000010
+#define AM_REG_GPIO_PADREGI_PAD32FNCSEL_GPIO32       0x00000018
+#define AM_REG_GPIO_PADREGI_PAD32FNCSEL_UNDEF4       0x00000020
+#define AM_REG_GPIO_PADREGI_PAD32FNCSEL_TCTB1        0x00000028
+#define AM_REG_GPIO_PADREGI_PAD32FNCSEL_UNDEF6       0x00000030
+#define AM_REG_GPIO_PADREGI_PAD32FNCSEL_UNDEF7       0x00000038
+
+// Pad 32 drive strength
+#define AM_REG_GPIO_PADREGI_PAD32STRNG_S             2
+#define AM_REG_GPIO_PADREGI_PAD32STRNG_M             0x00000004
+#define AM_REG_GPIO_PADREGI_PAD32STRNG(n)            (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_GPIO_PADREGI_PAD32STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGI_PAD32STRNG_HIGH          0x00000004
+
+// Pad 32 input enable
+#define AM_REG_GPIO_PADREGI_PAD32INPEN_S             1
+#define AM_REG_GPIO_PADREGI_PAD32INPEN_M             0x00000002
+#define AM_REG_GPIO_PADREGI_PAD32INPEN(n)            (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_GPIO_PADREGI_PAD32INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGI_PAD32INPEN_EN            0x00000002
+
+// Pad 32 pullup enable
+#define AM_REG_GPIO_PADREGI_PAD32PULL_S              0
+#define AM_REG_GPIO_PADREGI_PAD32PULL_M              0x00000001
+#define AM_REG_GPIO_PADREGI_PAD32PULL(n)             (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_GPIO_PADREGI_PAD32PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGI_PAD32PULL_EN             0x00000001
+
+//*****************************************************************************
+//
+// GPIO_PADREGJ - Pad Configuration Register J
+//
+//*****************************************************************************
+// Pad 39 pullup resistor selection.
+#define AM_REG_GPIO_PADREGJ_PAD39RSEL_S              30
+#define AM_REG_GPIO_PADREGJ_PAD39RSEL_M              0xC0000000
+#define AM_REG_GPIO_PADREGJ_PAD39RSEL(n)             (((uint32_t)(n) << 30) & 0xC0000000)
+#define AM_REG_GPIO_PADREGJ_PAD39RSEL_PULL1_5K       0x00000000
+#define AM_REG_GPIO_PADREGJ_PAD39RSEL_PULL6K         0x40000000
+#define AM_REG_GPIO_PADREGJ_PAD39RSEL_PULL12K        0x80000000
+#define AM_REG_GPIO_PADREGJ_PAD39RSEL_PULL24K        0xC0000000
+
+// Pad 39 function select
+#define AM_REG_GPIO_PADREGJ_PAD39FNCSEL_S            27
+#define AM_REG_GPIO_PADREGJ_PAD39FNCSEL_M            0x38000000
+#define AM_REG_GPIO_PADREGJ_PAD39FNCSEL(n)           (((uint32_t)(n) << 27) & 0x38000000)
+#define AM_REG_GPIO_PADREGJ_PAD39FNCSEL_UART0TX      0x00000000
+#define AM_REG_GPIO_PADREGJ_PAD39FNCSEL_UART1TX      0x08000000
+#define AM_REG_GPIO_PADREGJ_PAD39FNCSEL_CLKOUT       0x10000000
+#define AM_REG_GPIO_PADREGJ_PAD39FNCSEL_GPIO39       0x18000000
+#define AM_REG_GPIO_PADREGJ_PAD39FNCSEL_M4SCL        0x20000000
+#define AM_REG_GPIO_PADREGJ_PAD39FNCSEL_M4SCK        0x28000000
+#define AM_REG_GPIO_PADREGJ_PAD39FNCSEL_M4SCKLB      0x30000000
+#define AM_REG_GPIO_PADREGJ_PAD39FNCSEL_M4SCLLB      0x38000000
+
+// Pad 39 drive strentgh
+#define AM_REG_GPIO_PADREGJ_PAD39STRNG_S             26
+#define AM_REG_GPIO_PADREGJ_PAD39STRNG_M             0x04000000
+#define AM_REG_GPIO_PADREGJ_PAD39STRNG(n)            (((uint32_t)(n) << 26) & 0x04000000)
+#define AM_REG_GPIO_PADREGJ_PAD39STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGJ_PAD39STRNG_HIGH          0x04000000
+
+// Pad 39 input enable
+#define AM_REG_GPIO_PADREGJ_PAD39INPEN_S             25
+#define AM_REG_GPIO_PADREGJ_PAD39INPEN_M             0x02000000
+#define AM_REG_GPIO_PADREGJ_PAD39INPEN(n)            (((uint32_t)(n) << 25) & 0x02000000)
+#define AM_REG_GPIO_PADREGJ_PAD39INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGJ_PAD39INPEN_EN            0x02000000
+
+// Pad 39 pullup enable
+#define AM_REG_GPIO_PADREGJ_PAD39PULL_S              24
+#define AM_REG_GPIO_PADREGJ_PAD39PULL_M              0x01000000
+#define AM_REG_GPIO_PADREGJ_PAD39PULL(n)             (((uint32_t)(n) << 24) & 0x01000000)
+#define AM_REG_GPIO_PADREGJ_PAD39PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGJ_PAD39PULL_EN             0x01000000
+
+// Pad 38 function select
+#define AM_REG_GPIO_PADREGJ_PAD38FNCSEL_S            19
+#define AM_REG_GPIO_PADREGJ_PAD38FNCSEL_M            0x00380000
+#define AM_REG_GPIO_PADREGJ_PAD38FNCSEL(n)           (((uint32_t)(n) << 19) & 0x00380000)
+#define AM_REG_GPIO_PADREGJ_PAD38FNCSEL_TRIG3        0x00000000
+#define AM_REG_GPIO_PADREGJ_PAD38FNCSEL_M1nCE3       0x00080000
+#define AM_REG_GPIO_PADREGJ_PAD38FNCSEL_UA0CTS       0x00100000
+#define AM_REG_GPIO_PADREGJ_PAD38FNCSEL_GPIO38       0x00180000
+#define AM_REG_GPIO_PADREGJ_PAD38FNCSEL_M3WIR3       0x00200000
+#define AM_REG_GPIO_PADREGJ_PAD38FNCSEL_M3MOSI       0x00280000
+#define AM_REG_GPIO_PADREGJ_PAD38FNCSEL_M4nCE7       0x00300000
+#define AM_REG_GPIO_PADREGJ_PAD38FNCSEL_SLWIR3LB     0x00380000
+
+// Pad 38 drive strength
+#define AM_REG_GPIO_PADREGJ_PAD38STRNG_S             18
+#define AM_REG_GPIO_PADREGJ_PAD38STRNG_M             0x00040000
+#define AM_REG_GPIO_PADREGJ_PAD38STRNG(n)            (((uint32_t)(n) << 18) & 0x00040000)
+#define AM_REG_GPIO_PADREGJ_PAD38STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGJ_PAD38STRNG_HIGH          0x00040000
+
+// Pad 38 input enable
+#define AM_REG_GPIO_PADREGJ_PAD38INPEN_S             17
+#define AM_REG_GPIO_PADREGJ_PAD38INPEN_M             0x00020000
+#define AM_REG_GPIO_PADREGJ_PAD38INPEN(n)            (((uint32_t)(n) << 17) & 0x00020000)
+#define AM_REG_GPIO_PADREGJ_PAD38INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGJ_PAD38INPEN_EN            0x00020000
+
+// Pad 38 pullup enable
+#define AM_REG_GPIO_PADREGJ_PAD38PULL_S              16
+#define AM_REG_GPIO_PADREGJ_PAD38PULL_M              0x00010000
+#define AM_REG_GPIO_PADREGJ_PAD38PULL(n)             (((uint32_t)(n) << 16) & 0x00010000)
+#define AM_REG_GPIO_PADREGJ_PAD38PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGJ_PAD38PULL_EN             0x00010000
+
+// Pad 37 function select
+#define AM_REG_GPIO_PADREGJ_PAD37FNCSEL_S            11
+#define AM_REG_GPIO_PADREGJ_PAD37FNCSEL_M            0x00003800
+#define AM_REG_GPIO_PADREGJ_PAD37FNCSEL(n)           (((uint32_t)(n) << 11) & 0x00003800)
+#define AM_REG_GPIO_PADREGJ_PAD37FNCSEL_TRIG2        0x00000000
+#define AM_REG_GPIO_PADREGJ_PAD37FNCSEL_M1nCE2       0x00000800
+#define AM_REG_GPIO_PADREGJ_PAD37FNCSEL_UA0RTS       0x00001000
+#define AM_REG_GPIO_PADREGJ_PAD37FNCSEL_GPIO37       0x00001800
+#define AM_REG_GPIO_PADREGJ_PAD37FNCSEL_M3nCE4       0x00002000
+#define AM_REG_GPIO_PADREGJ_PAD37FNCSEL_M4nCE1       0x00002800
+#define AM_REG_GPIO_PADREGJ_PAD37FNCSEL_PDM_CLK      0x00003000
+#define AM_REG_GPIO_PADREGJ_PAD37FNCSEL_TCTA1        0x00003800
+
+// Pad 37 drive strength
+#define AM_REG_GPIO_PADREGJ_PAD37STRNG_S             10
+#define AM_REG_GPIO_PADREGJ_PAD37STRNG_M             0x00000400
+#define AM_REG_GPIO_PADREGJ_PAD37STRNG(n)            (((uint32_t)(n) << 10) & 0x00000400)
+#define AM_REG_GPIO_PADREGJ_PAD37STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGJ_PAD37STRNG_HIGH          0x00000400
+
+// Pad 37 input enable
+#define AM_REG_GPIO_PADREGJ_PAD37INPEN_S             9
+#define AM_REG_GPIO_PADREGJ_PAD37INPEN_M             0x00000200
+#define AM_REG_GPIO_PADREGJ_PAD37INPEN(n)            (((uint32_t)(n) << 9) & 0x00000200)
+#define AM_REG_GPIO_PADREGJ_PAD37INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGJ_PAD37INPEN_EN            0x00000200
+
+// Pad 37 pullup enable
+#define AM_REG_GPIO_PADREGJ_PAD37PULL_S              8
+#define AM_REG_GPIO_PADREGJ_PAD37PULL_M              0x00000100
+#define AM_REG_GPIO_PADREGJ_PAD37PULL(n)             (((uint32_t)(n) << 8) & 0x00000100)
+#define AM_REG_GPIO_PADREGJ_PAD37PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGJ_PAD37PULL_EN             0x00000100
+
+// Pad 36 function select
+#define AM_REG_GPIO_PADREGJ_PAD36FNCSEL_S            3
+#define AM_REG_GPIO_PADREGJ_PAD36FNCSEL_M            0x00000038
+#define AM_REG_GPIO_PADREGJ_PAD36FNCSEL(n)           (((uint32_t)(n) << 3) & 0x00000038)
+#define AM_REG_GPIO_PADREGJ_PAD36FNCSEL_TRIG1        0x00000000
+#define AM_REG_GPIO_PADREGJ_PAD36FNCSEL_M1nCE1       0x00000008
+#define AM_REG_GPIO_PADREGJ_PAD36FNCSEL_UART1RX      0x00000010
+#define AM_REG_GPIO_PADREGJ_PAD36FNCSEL_GPIO36       0x00000018
+#define AM_REG_GPIO_PADREGJ_PAD36FNCSEL_32khz_XT     0x00000020
+#define AM_REG_GPIO_PADREGJ_PAD36FNCSEL_M2nCE0       0x00000028
+#define AM_REG_GPIO_PADREGJ_PAD36FNCSEL_UA0CTS       0x00000030
+#define AM_REG_GPIO_PADREGJ_PAD36FNCSEL_M3nCE3       0x00000038
+
+// Pad 36 drive strength
+#define AM_REG_GPIO_PADREGJ_PAD36STRNG_S             2
+#define AM_REG_GPIO_PADREGJ_PAD36STRNG_M             0x00000004
+#define AM_REG_GPIO_PADREGJ_PAD36STRNG(n)            (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_GPIO_PADREGJ_PAD36STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGJ_PAD36STRNG_HIGH          0x00000004
+
+// Pad 36 input enable
+#define AM_REG_GPIO_PADREGJ_PAD36INPEN_S             1
+#define AM_REG_GPIO_PADREGJ_PAD36INPEN_M             0x00000002
+#define AM_REG_GPIO_PADREGJ_PAD36INPEN(n)            (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_GPIO_PADREGJ_PAD36INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGJ_PAD36INPEN_EN            0x00000002
+
+// Pad 36 pullup enable
+#define AM_REG_GPIO_PADREGJ_PAD36PULL_S              0
+#define AM_REG_GPIO_PADREGJ_PAD36PULL_M              0x00000001
+#define AM_REG_GPIO_PADREGJ_PAD36PULL(n)             (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_GPIO_PADREGJ_PAD36PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGJ_PAD36PULL_EN             0x00000001
+
+//*****************************************************************************
+//
+// GPIO_PADREGK - Pad Configuration Register K
+//
+//*****************************************************************************
+// Pad 43 pullup resistor selection.
+#define AM_REG_GPIO_PADREGK_PAD43RSEL_S              30
+#define AM_REG_GPIO_PADREGK_PAD43RSEL_M              0xC0000000
+#define AM_REG_GPIO_PADREGK_PAD43RSEL(n)             (((uint32_t)(n) << 30) & 0xC0000000)
+#define AM_REG_GPIO_PADREGK_PAD43RSEL_PULL1_5K       0x00000000
+#define AM_REG_GPIO_PADREGK_PAD43RSEL_PULL6K         0x40000000
+#define AM_REG_GPIO_PADREGK_PAD43RSEL_PULL12K        0x80000000
+#define AM_REG_GPIO_PADREGK_PAD43RSEL_PULL24K        0xC0000000
+
+// Pad 43 function select
+#define AM_REG_GPIO_PADREGK_PAD43FNCSEL_S            27
+#define AM_REG_GPIO_PADREGK_PAD43FNCSEL_M            0x38000000
+#define AM_REG_GPIO_PADREGK_PAD43FNCSEL(n)           (((uint32_t)(n) << 27) & 0x38000000)
+#define AM_REG_GPIO_PADREGK_PAD43FNCSEL_M2nCE4       0x00000000
+#define AM_REG_GPIO_PADREGK_PAD43FNCSEL_M0nCE1       0x08000000
+#define AM_REG_GPIO_PADREGK_PAD43FNCSEL_TCTB0        0x10000000
+#define AM_REG_GPIO_PADREGK_PAD43FNCSEL_GPIO43       0x18000000
+#define AM_REG_GPIO_PADREGK_PAD43FNCSEL_M3SDA        0x20000000
+#define AM_REG_GPIO_PADREGK_PAD43FNCSEL_M3MISO       0x28000000
+#define AM_REG_GPIO_PADREGK_PAD43FNCSEL_SLMISOLB     0x30000000
+#define AM_REG_GPIO_PADREGK_PAD43FNCSEL_SLSDALB      0x38000000
+
+// Pad 43 drive strentgh
+#define AM_REG_GPIO_PADREGK_PAD43STRNG_S             26
+#define AM_REG_GPIO_PADREGK_PAD43STRNG_M             0x04000000
+#define AM_REG_GPIO_PADREGK_PAD43STRNG(n)            (((uint32_t)(n) << 26) & 0x04000000)
+#define AM_REG_GPIO_PADREGK_PAD43STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGK_PAD43STRNG_HIGH          0x04000000
+
+// Pad 43 input enable
+#define AM_REG_GPIO_PADREGK_PAD43INPEN_S             25
+#define AM_REG_GPIO_PADREGK_PAD43INPEN_M             0x02000000
+#define AM_REG_GPIO_PADREGK_PAD43INPEN(n)            (((uint32_t)(n) << 25) & 0x02000000)
+#define AM_REG_GPIO_PADREGK_PAD43INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGK_PAD43INPEN_EN            0x02000000
+
+// Pad 43 pullup enable
+#define AM_REG_GPIO_PADREGK_PAD43PULL_S              24
+#define AM_REG_GPIO_PADREGK_PAD43PULL_M              0x01000000
+#define AM_REG_GPIO_PADREGK_PAD43PULL(n)             (((uint32_t)(n) << 24) & 0x01000000)
+#define AM_REG_GPIO_PADREGK_PAD43PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGK_PAD43PULL_EN             0x01000000
+
+// Pad 42 pullup resistor selection.
+#define AM_REG_GPIO_PADREGK_PAD42RSEL_S              22
+#define AM_REG_GPIO_PADREGK_PAD42RSEL_M              0x00C00000
+#define AM_REG_GPIO_PADREGK_PAD42RSEL(n)             (((uint32_t)(n) << 22) & 0x00C00000)
+#define AM_REG_GPIO_PADREGK_PAD42RSEL_PULL1_5K       0x00000000
+#define AM_REG_GPIO_PADREGK_PAD42RSEL_PULL6K         0x00400000
+#define AM_REG_GPIO_PADREGK_PAD42RSEL_PULL12K        0x00800000
+#define AM_REG_GPIO_PADREGK_PAD42RSEL_PULL24K        0x00C00000
+
+// Pad 42 function select
+#define AM_REG_GPIO_PADREGK_PAD42FNCSEL_S            19
+#define AM_REG_GPIO_PADREGK_PAD42FNCSEL_M            0x00380000
+#define AM_REG_GPIO_PADREGK_PAD42FNCSEL(n)           (((uint32_t)(n) << 19) & 0x00380000)
+#define AM_REG_GPIO_PADREGK_PAD42FNCSEL_M2nCE2       0x00000000
+#define AM_REG_GPIO_PADREGK_PAD42FNCSEL_M0nCE0       0x00080000
+#define AM_REG_GPIO_PADREGK_PAD42FNCSEL_TCTA0        0x00100000
+#define AM_REG_GPIO_PADREGK_PAD42FNCSEL_GPIO42       0x00180000
+#define AM_REG_GPIO_PADREGK_PAD42FNCSEL_M3SCL        0x00200000
+#define AM_REG_GPIO_PADREGK_PAD42FNCSEL_M3SCK        0x00280000
+#define AM_REG_GPIO_PADREGK_PAD42FNCSEL_M3SCKLB      0x00300000
+#define AM_REG_GPIO_PADREGK_PAD42FNCSEL_M3SCLLB      0x00380000
+
+// Pad 42 drive strength
+#define AM_REG_GPIO_PADREGK_PAD42STRNG_S             18
+#define AM_REG_GPIO_PADREGK_PAD42STRNG_M             0x00040000
+#define AM_REG_GPIO_PADREGK_PAD42STRNG(n)            (((uint32_t)(n) << 18) & 0x00040000)
+#define AM_REG_GPIO_PADREGK_PAD42STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGK_PAD42STRNG_HIGH          0x00040000
+
+// Pad 42 input enable
+#define AM_REG_GPIO_PADREGK_PAD42INPEN_S             17
+#define AM_REG_GPIO_PADREGK_PAD42INPEN_M             0x00020000
+#define AM_REG_GPIO_PADREGK_PAD42INPEN(n)            (((uint32_t)(n) << 17) & 0x00020000)
+#define AM_REG_GPIO_PADREGK_PAD42INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGK_PAD42INPEN_EN            0x00020000
+
+// Pad 42 pullup enable
+#define AM_REG_GPIO_PADREGK_PAD42PULL_S              16
+#define AM_REG_GPIO_PADREGK_PAD42PULL_M              0x00010000
+#define AM_REG_GPIO_PADREGK_PAD42PULL(n)             (((uint32_t)(n) << 16) & 0x00010000)
+#define AM_REG_GPIO_PADREGK_PAD42PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGK_PAD42PULL_EN             0x00010000
+
+// Pad 41 upper power switch enable
+#define AM_REG_GPIO_PADREGK_PAD41PWRUP_S             15
+#define AM_REG_GPIO_PADREGK_PAD41PWRUP_M             0x00008000
+#define AM_REG_GPIO_PADREGK_PAD41PWRUP(n)            (((uint32_t)(n) << 15) & 0x00008000)
+#define AM_REG_GPIO_PADREGK_PAD41PWRUP_DIS           0x00000000
+#define AM_REG_GPIO_PADREGK_PAD41PWRUP_EN            0x00008000
+
+// Pad 41 function select
+#define AM_REG_GPIO_PADREGK_PAD41FNCSEL_S            11
+#define AM_REG_GPIO_PADREGK_PAD41FNCSEL_M            0x00003800
+#define AM_REG_GPIO_PADREGK_PAD41FNCSEL(n)           (((uint32_t)(n) << 11) & 0x00003800)
+#define AM_REG_GPIO_PADREGK_PAD41FNCSEL_M2nCE1       0x00000000
+#define AM_REG_GPIO_PADREGK_PAD41FNCSEL_CLKOUT       0x00000800
+#define AM_REG_GPIO_PADREGK_PAD41FNCSEL_SWO          0x00001000
+#define AM_REG_GPIO_PADREGK_PAD41FNCSEL_GPIO41       0x00001800
+#define AM_REG_GPIO_PADREGK_PAD41FNCSEL_M3nCE5       0x00002000
+#define AM_REG_GPIO_PADREGK_PAD41FNCSEL_M5nCE7       0x00002800
+#define AM_REG_GPIO_PADREGK_PAD41FNCSEL_M4nCE2       0x00003000
+#define AM_REG_GPIO_PADREGK_PAD41FNCSEL_UA0RTS       0x00003800
+
+// Pad 41 drive strength
+#define AM_REG_GPIO_PADREGK_PAD41STRNG_S             10
+#define AM_REG_GPIO_PADREGK_PAD41STRNG_M             0x00000400
+#define AM_REG_GPIO_PADREGK_PAD41STRNG(n)            (((uint32_t)(n) << 10) & 0x00000400)
+#define AM_REG_GPIO_PADREGK_PAD41STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGK_PAD41STRNG_HIGH          0x00000400
+
+// Pad 41 input enable
+#define AM_REG_GPIO_PADREGK_PAD41INPEN_S             9
+#define AM_REG_GPIO_PADREGK_PAD41INPEN_M             0x00000200
+#define AM_REG_GPIO_PADREGK_PAD41INPEN(n)            (((uint32_t)(n) << 9) & 0x00000200)
+#define AM_REG_GPIO_PADREGK_PAD41INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGK_PAD41INPEN_EN            0x00000200
+
+// Pad 41 pullup enable
+#define AM_REG_GPIO_PADREGK_PAD41PULL_S              8
+#define AM_REG_GPIO_PADREGK_PAD41PULL_M              0x00000100
+#define AM_REG_GPIO_PADREGK_PAD41PULL(n)             (((uint32_t)(n) << 8) & 0x00000100)
+#define AM_REG_GPIO_PADREGK_PAD41PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGK_PAD41PULL_EN             0x00000100
+
+// Pad 40 pullup resistor selection.
+#define AM_REG_GPIO_PADREGK_PAD40RSEL_S              6
+#define AM_REG_GPIO_PADREGK_PAD40RSEL_M              0x000000C0
+#define AM_REG_GPIO_PADREGK_PAD40RSEL(n)             (((uint32_t)(n) << 6) & 0x000000C0)
+#define AM_REG_GPIO_PADREGK_PAD40RSEL_PULL1_5K       0x00000000
+#define AM_REG_GPIO_PADREGK_PAD40RSEL_PULL6K         0x00000040
+#define AM_REG_GPIO_PADREGK_PAD40RSEL_PULL12K        0x00000080
+#define AM_REG_GPIO_PADREGK_PAD40RSEL_PULL24K        0x000000C0
+
+// Pad 40 function select
+#define AM_REG_GPIO_PADREGK_PAD40FNCSEL_S            3
+#define AM_REG_GPIO_PADREGK_PAD40FNCSEL_M            0x00000038
+#define AM_REG_GPIO_PADREGK_PAD40FNCSEL(n)           (((uint32_t)(n) << 3) & 0x00000038)
+#define AM_REG_GPIO_PADREGK_PAD40FNCSEL_UART0RX      0x00000000
+#define AM_REG_GPIO_PADREGK_PAD40FNCSEL_UART1RX      0x00000008
+#define AM_REG_GPIO_PADREGK_PAD40FNCSEL_TRIG0        0x00000010
+#define AM_REG_GPIO_PADREGK_PAD40FNCSEL_GPIO40       0x00000018
+#define AM_REG_GPIO_PADREGK_PAD40FNCSEL_M4SDA        0x00000020
+#define AM_REG_GPIO_PADREGK_PAD40FNCSEL_M4MISO       0x00000028
+#define AM_REG_GPIO_PADREGK_PAD40FNCSEL_SLMISOLB     0x00000030
+#define AM_REG_GPIO_PADREGK_PAD40FNCSEL_SLSDALB      0x00000038
+
+// Pad 40 drive strength
+#define AM_REG_GPIO_PADREGK_PAD40STRNG_S             2
+#define AM_REG_GPIO_PADREGK_PAD40STRNG_M             0x00000004
+#define AM_REG_GPIO_PADREGK_PAD40STRNG(n)            (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_GPIO_PADREGK_PAD40STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGK_PAD40STRNG_HIGH          0x00000004
+
+// Pad 40 input enable
+#define AM_REG_GPIO_PADREGK_PAD40INPEN_S             1
+#define AM_REG_GPIO_PADREGK_PAD40INPEN_M             0x00000002
+#define AM_REG_GPIO_PADREGK_PAD40INPEN(n)            (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_GPIO_PADREGK_PAD40INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGK_PAD40INPEN_EN            0x00000002
+
+// Pad 40 pullup enable
+#define AM_REG_GPIO_PADREGK_PAD40PULL_S              0
+#define AM_REG_GPIO_PADREGK_PAD40PULL_M              0x00000001
+#define AM_REG_GPIO_PADREGK_PAD40PULL(n)             (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_GPIO_PADREGK_PAD40PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGK_PAD40PULL_EN             0x00000001
+
+//*****************************************************************************
+//
+// GPIO_PADREGL - Pad Configuration Register L
+//
+//*****************************************************************************
+// Pad 47 function select
+#define AM_REG_GPIO_PADREGL_PAD47FNCSEL_S            27
+#define AM_REG_GPIO_PADREGL_PAD47FNCSEL_M            0x38000000
+#define AM_REG_GPIO_PADREGL_PAD47FNCSEL(n)           (((uint32_t)(n) << 27) & 0x38000000)
+#define AM_REG_GPIO_PADREGL_PAD47FNCSEL_M2nCE5       0x00000000
+#define AM_REG_GPIO_PADREGL_PAD47FNCSEL_M0nCE5       0x08000000
+#define AM_REG_GPIO_PADREGL_PAD47FNCSEL_TCTB2        0x10000000
+#define AM_REG_GPIO_PADREGL_PAD47FNCSEL_GPIO47       0x18000000
+#define AM_REG_GPIO_PADREGL_PAD47FNCSEL_M5WIR3       0x20000000
+#define AM_REG_GPIO_PADREGL_PAD47FNCSEL_M5MOSI       0x28000000
+#define AM_REG_GPIO_PADREGL_PAD47FNCSEL_M4nCE5       0x30000000
+#define AM_REG_GPIO_PADREGL_PAD47FNCSEL_SLWIR3LB     0x38000000
+
+// Pad 47 drive strentgh
+#define AM_REG_GPIO_PADREGL_PAD47STRNG_S             26
+#define AM_REG_GPIO_PADREGL_PAD47STRNG_M             0x04000000
+#define AM_REG_GPIO_PADREGL_PAD47STRNG(n)            (((uint32_t)(n) << 26) & 0x04000000)
+#define AM_REG_GPIO_PADREGL_PAD47STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGL_PAD47STRNG_HIGH          0x04000000
+
+// Pad 47 input enable
+#define AM_REG_GPIO_PADREGL_PAD47INPEN_S             25
+#define AM_REG_GPIO_PADREGL_PAD47INPEN_M             0x02000000
+#define AM_REG_GPIO_PADREGL_PAD47INPEN(n)            (((uint32_t)(n) << 25) & 0x02000000)
+#define AM_REG_GPIO_PADREGL_PAD47INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGL_PAD47INPEN_EN            0x02000000
+
+// Pad 47 pullup enable
+#define AM_REG_GPIO_PADREGL_PAD47PULL_S              24
+#define AM_REG_GPIO_PADREGL_PAD47PULL_M              0x01000000
+#define AM_REG_GPIO_PADREGL_PAD47PULL(n)             (((uint32_t)(n) << 24) & 0x01000000)
+#define AM_REG_GPIO_PADREGL_PAD47PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGL_PAD47PULL_EN             0x01000000
+
+// Pad 46 function select
+#define AM_REG_GPIO_PADREGL_PAD46FNCSEL_S            19
+#define AM_REG_GPIO_PADREGL_PAD46FNCSEL_M            0x00380000
+#define AM_REG_GPIO_PADREGL_PAD46FNCSEL(n)           (((uint32_t)(n) << 19) & 0x00380000)
+#define AM_REG_GPIO_PADREGL_PAD46FNCSEL_32khz_XT     0x00000000
+#define AM_REG_GPIO_PADREGL_PAD46FNCSEL_M0nCE4       0x00080000
+#define AM_REG_GPIO_PADREGL_PAD46FNCSEL_TCTA2        0x00100000
+#define AM_REG_GPIO_PADREGL_PAD46FNCSEL_GPIO46       0x00180000
+#define AM_REG_GPIO_PADREGL_PAD46FNCSEL_TCTA1        0x00200000
+#define AM_REG_GPIO_PADREGL_PAD46FNCSEL_M5nCE4       0x00280000
+#define AM_REG_GPIO_PADREGL_PAD46FNCSEL_M4nCE4       0x00300000
+#define AM_REG_GPIO_PADREGL_PAD46FNCSEL_SWO          0x00380000
+
+// Pad 46 drive strength
+#define AM_REG_GPIO_PADREGL_PAD46STRNG_S             18
+#define AM_REG_GPIO_PADREGL_PAD46STRNG_M             0x00040000
+#define AM_REG_GPIO_PADREGL_PAD46STRNG(n)            (((uint32_t)(n) << 18) & 0x00040000)
+#define AM_REG_GPIO_PADREGL_PAD46STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGL_PAD46STRNG_HIGH          0x00040000
+
+// Pad 46 input enable
+#define AM_REG_GPIO_PADREGL_PAD46INPEN_S             17
+#define AM_REG_GPIO_PADREGL_PAD46INPEN_M             0x00020000
+#define AM_REG_GPIO_PADREGL_PAD46INPEN(n)            (((uint32_t)(n) << 17) & 0x00020000)
+#define AM_REG_GPIO_PADREGL_PAD46INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGL_PAD46INPEN_EN            0x00020000
+
+// Pad 46 pullup enable
+#define AM_REG_GPIO_PADREGL_PAD46PULL_S              16
+#define AM_REG_GPIO_PADREGL_PAD46PULL_M              0x00010000
+#define AM_REG_GPIO_PADREGL_PAD46PULL(n)             (((uint32_t)(n) << 16) & 0x00010000)
+#define AM_REG_GPIO_PADREGL_PAD46PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGL_PAD46PULL_EN             0x00010000
+
+// Pad 45 function select
+#define AM_REG_GPIO_PADREGL_PAD45FNCSEL_S            11
+#define AM_REG_GPIO_PADREGL_PAD45FNCSEL_M            0x00003800
+#define AM_REG_GPIO_PADREGL_PAD45FNCSEL(n)           (((uint32_t)(n) << 11) & 0x00003800)
+#define AM_REG_GPIO_PADREGL_PAD45FNCSEL_UA1CTS       0x00000000
+#define AM_REG_GPIO_PADREGL_PAD45FNCSEL_M0nCE3       0x00000800
+#define AM_REG_GPIO_PADREGL_PAD45FNCSEL_TCTB1        0x00001000
+#define AM_REG_GPIO_PADREGL_PAD45FNCSEL_GPIO45       0x00001800
+#define AM_REG_GPIO_PADREGL_PAD45FNCSEL_M4nCE3       0x00002000
+#define AM_REG_GPIO_PADREGL_PAD45FNCSEL_M3nCE6       0x00002800
+#define AM_REG_GPIO_PADREGL_PAD45FNCSEL_M5nCE5       0x00003000
+#define AM_REG_GPIO_PADREGL_PAD45FNCSEL_TCTA1        0x00003800
+
+// Pad 45 drive strength
+#define AM_REG_GPIO_PADREGL_PAD45STRNG_S             10
+#define AM_REG_GPIO_PADREGL_PAD45STRNG_M             0x00000400
+#define AM_REG_GPIO_PADREGL_PAD45STRNG(n)            (((uint32_t)(n) << 10) & 0x00000400)
+#define AM_REG_GPIO_PADREGL_PAD45STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGL_PAD45STRNG_HIGH          0x00000400
+
+// Pad 45 input enable
+#define AM_REG_GPIO_PADREGL_PAD45INPEN_S             9
+#define AM_REG_GPIO_PADREGL_PAD45INPEN_M             0x00000200
+#define AM_REG_GPIO_PADREGL_PAD45INPEN(n)            (((uint32_t)(n) << 9) & 0x00000200)
+#define AM_REG_GPIO_PADREGL_PAD45INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGL_PAD45INPEN_EN            0x00000200
+
+// Pad 45 pullup enable
+#define AM_REG_GPIO_PADREGL_PAD45PULL_S              8
+#define AM_REG_GPIO_PADREGL_PAD45PULL_M              0x00000100
+#define AM_REG_GPIO_PADREGL_PAD45PULL(n)             (((uint32_t)(n) << 8) & 0x00000100)
+#define AM_REG_GPIO_PADREGL_PAD45PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGL_PAD45PULL_EN             0x00000100
+
+// Pad 44 function select
+#define AM_REG_GPIO_PADREGL_PAD44FNCSEL_S            3
+#define AM_REG_GPIO_PADREGL_PAD44FNCSEL_M            0x00000038
+#define AM_REG_GPIO_PADREGL_PAD44FNCSEL(n)           (((uint32_t)(n) << 3) & 0x00000038)
+#define AM_REG_GPIO_PADREGL_PAD44FNCSEL_UA1RTS       0x00000000
+#define AM_REG_GPIO_PADREGL_PAD44FNCSEL_M0nCE2       0x00000008
+#define AM_REG_GPIO_PADREGL_PAD44FNCSEL_TCTA1        0x00000010
+#define AM_REG_GPIO_PADREGL_PAD44FNCSEL_GPIO44       0x00000018
+#define AM_REG_GPIO_PADREGL_PAD44FNCSEL_M4WIR3       0x00000020
+#define AM_REG_GPIO_PADREGL_PAD44FNCSEL_M4MOSI       0x00000028
+#define AM_REG_GPIO_PADREGL_PAD44FNCSEL_M5nCE6       0x00000030
+#define AM_REG_GPIO_PADREGL_PAD44FNCSEL_SLWIR3LB     0x00000038
+
+// Pad 44 drive strength
+#define AM_REG_GPIO_PADREGL_PAD44STRNG_S             2
+#define AM_REG_GPIO_PADREGL_PAD44STRNG_M             0x00000004
+#define AM_REG_GPIO_PADREGL_PAD44STRNG(n)            (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_GPIO_PADREGL_PAD44STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGL_PAD44STRNG_HIGH          0x00000004
+
+// Pad 44 input enable
+#define AM_REG_GPIO_PADREGL_PAD44INPEN_S             1
+#define AM_REG_GPIO_PADREGL_PAD44INPEN_M             0x00000002
+#define AM_REG_GPIO_PADREGL_PAD44INPEN(n)            (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_GPIO_PADREGL_PAD44INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGL_PAD44INPEN_EN            0x00000002
+
+// Pad 44 pullup enable
+#define AM_REG_GPIO_PADREGL_PAD44PULL_S              0
+#define AM_REG_GPIO_PADREGL_PAD44PULL_M              0x00000001
+#define AM_REG_GPIO_PADREGL_PAD44PULL(n)             (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_GPIO_PADREGL_PAD44PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGL_PAD44PULL_EN             0x00000001
+
+//*****************************************************************************
+//
+// GPIO_PADREGM - Pad Configuration Register M
+//
+//*****************************************************************************
+// Pad 49 pullup resistor selection.
+#define AM_REG_GPIO_PADREGM_PAD49RSEL_S              14
+#define AM_REG_GPIO_PADREGM_PAD49RSEL_M              0x0000C000
+#define AM_REG_GPIO_PADREGM_PAD49RSEL(n)             (((uint32_t)(n) << 14) & 0x0000C000)
+#define AM_REG_GPIO_PADREGM_PAD49RSEL_PULL1_5K       0x00000000
+#define AM_REG_GPIO_PADREGM_PAD49RSEL_PULL6K         0x00004000
+#define AM_REG_GPIO_PADREGM_PAD49RSEL_PULL12K        0x00008000
+#define AM_REG_GPIO_PADREGM_PAD49RSEL_PULL24K        0x0000C000
+
+// Pad 49 function select
+#define AM_REG_GPIO_PADREGM_PAD49FNCSEL_S            11
+#define AM_REG_GPIO_PADREGM_PAD49FNCSEL_M            0x00003800
+#define AM_REG_GPIO_PADREGM_PAD49FNCSEL(n)           (((uint32_t)(n) << 11) & 0x00003800)
+#define AM_REG_GPIO_PADREGM_PAD49FNCSEL_M2nCE7       0x00000000
+#define AM_REG_GPIO_PADREGM_PAD49FNCSEL_M0nCE7       0x00000800
+#define AM_REG_GPIO_PADREGM_PAD49FNCSEL_TCTB3        0x00001000
+#define AM_REG_GPIO_PADREGM_PAD49FNCSEL_GPIO49       0x00001800
+#define AM_REG_GPIO_PADREGM_PAD49FNCSEL_M5SDA        0x00002000
+#define AM_REG_GPIO_PADREGM_PAD49FNCSEL_M5MISO       0x00002800
+#define AM_REG_GPIO_PADREGM_PAD49FNCSEL_SLMISOLB     0x00003000
+#define AM_REG_GPIO_PADREGM_PAD49FNCSEL_SLSDALB      0x00003800
+
+// Pad 49 drive strength
+#define AM_REG_GPIO_PADREGM_PAD49STRNG_S             10
+#define AM_REG_GPIO_PADREGM_PAD49STRNG_M             0x00000400
+#define AM_REG_GPIO_PADREGM_PAD49STRNG(n)            (((uint32_t)(n) << 10) & 0x00000400)
+#define AM_REG_GPIO_PADREGM_PAD49STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGM_PAD49STRNG_HIGH          0x00000400
+
+// Pad 49 input enable
+#define AM_REG_GPIO_PADREGM_PAD49INPEN_S             9
+#define AM_REG_GPIO_PADREGM_PAD49INPEN_M             0x00000200
+#define AM_REG_GPIO_PADREGM_PAD49INPEN(n)            (((uint32_t)(n) << 9) & 0x00000200)
+#define AM_REG_GPIO_PADREGM_PAD49INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGM_PAD49INPEN_EN            0x00000200
+
+// Pad 49 pullup enable
+#define AM_REG_GPIO_PADREGM_PAD49PULL_S              8
+#define AM_REG_GPIO_PADREGM_PAD49PULL_M              0x00000100
+#define AM_REG_GPIO_PADREGM_PAD49PULL(n)             (((uint32_t)(n) << 8) & 0x00000100)
+#define AM_REG_GPIO_PADREGM_PAD49PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGM_PAD49PULL_EN             0x00000100
+
+// Pad 48 pullup resistor selection.
+#define AM_REG_GPIO_PADREGM_PAD48RSEL_S              6
+#define AM_REG_GPIO_PADREGM_PAD48RSEL_M              0x000000C0
+#define AM_REG_GPIO_PADREGM_PAD48RSEL(n)             (((uint32_t)(n) << 6) & 0x000000C0)
+#define AM_REG_GPIO_PADREGM_PAD48RSEL_PULL1_5K       0x00000000
+#define AM_REG_GPIO_PADREGM_PAD48RSEL_PULL6K         0x00000040
+#define AM_REG_GPIO_PADREGM_PAD48RSEL_PULL12K        0x00000080
+#define AM_REG_GPIO_PADREGM_PAD48RSEL_PULL24K        0x000000C0
+
+// Pad 48 function select
+#define AM_REG_GPIO_PADREGM_PAD48FNCSEL_S            3
+#define AM_REG_GPIO_PADREGM_PAD48FNCSEL_M            0x00000038
+#define AM_REG_GPIO_PADREGM_PAD48FNCSEL(n)           (((uint32_t)(n) << 3) & 0x00000038)
+#define AM_REG_GPIO_PADREGM_PAD48FNCSEL_M2nCE6       0x00000000
+#define AM_REG_GPIO_PADREGM_PAD48FNCSEL_M0nCE6       0x00000008
+#define AM_REG_GPIO_PADREGM_PAD48FNCSEL_TCTA3        0x00000010
+#define AM_REG_GPIO_PADREGM_PAD48FNCSEL_GPIO48       0x00000018
+#define AM_REG_GPIO_PADREGM_PAD48FNCSEL_M5SCL        0x00000020
+#define AM_REG_GPIO_PADREGM_PAD48FNCSEL_M5SCK        0x00000028
+#define AM_REG_GPIO_PADREGM_PAD48FNCSEL_M5SCKLB      0x00000030
+#define AM_REG_GPIO_PADREGM_PAD48FNCSEL_M5SCLLB      0x00000038
+
+// Pad 48 drive strength
+#define AM_REG_GPIO_PADREGM_PAD48STRNG_S             2
+#define AM_REG_GPIO_PADREGM_PAD48STRNG_M             0x00000004
+#define AM_REG_GPIO_PADREGM_PAD48STRNG(n)            (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_GPIO_PADREGM_PAD48STRNG_LOW           0x00000000
+#define AM_REG_GPIO_PADREGM_PAD48STRNG_HIGH          0x00000004
+
+// Pad 48 input enable
+#define AM_REG_GPIO_PADREGM_PAD48INPEN_S             1
+#define AM_REG_GPIO_PADREGM_PAD48INPEN_M             0x00000002
+#define AM_REG_GPIO_PADREGM_PAD48INPEN(n)            (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_GPIO_PADREGM_PAD48INPEN_DIS           0x00000000
+#define AM_REG_GPIO_PADREGM_PAD48INPEN_EN            0x00000002
+
+// Pad 48 pullup enable
+#define AM_REG_GPIO_PADREGM_PAD48PULL_S              0
+#define AM_REG_GPIO_PADREGM_PAD48PULL_M              0x00000001
+#define AM_REG_GPIO_PADREGM_PAD48PULL(n)             (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_GPIO_PADREGM_PAD48PULL_DIS            0x00000000
+#define AM_REG_GPIO_PADREGM_PAD48PULL_EN             0x00000001
+
+//*****************************************************************************
+//
+// GPIO_CFGA - GPIO Configuration Register A
+//
+//*****************************************************************************
+// GPIO7 interrupt direction.
+#define AM_REG_GPIO_CFGA_GPIO7INTD_S                 31
+#define AM_REG_GPIO_CFGA_GPIO7INTD_M                 0x80000000
+#define AM_REG_GPIO_CFGA_GPIO7INTD(n)                (((uint32_t)(n) << 31) & 0x80000000)
+#define AM_REG_GPIO_CFGA_GPIO7INTD_INTLH             0x00000000
+#define AM_REG_GPIO_CFGA_GPIO7INTD_INTHL             0x80000000
+
+// GPIO7 output configuration.
+#define AM_REG_GPIO_CFGA_GPIO7OUTCFG_S               29
+#define AM_REG_GPIO_CFGA_GPIO7OUTCFG_M               0x60000000
+#define AM_REG_GPIO_CFGA_GPIO7OUTCFG(n)              (((uint32_t)(n) << 29) & 0x60000000)
+#define AM_REG_GPIO_CFGA_GPIO7OUTCFG_DIS             0x00000000
+#define AM_REG_GPIO_CFGA_GPIO7OUTCFG_PUSHPULL        0x20000000
+#define AM_REG_GPIO_CFGA_GPIO7OUTCFG_OD              0x40000000
+#define AM_REG_GPIO_CFGA_GPIO7OUTCFG_TS              0x60000000
+
+// GPIO7 input enable.
+#define AM_REG_GPIO_CFGA_GPIO7INCFG_S                28
+#define AM_REG_GPIO_CFGA_GPIO7INCFG_M                0x10000000
+#define AM_REG_GPIO_CFGA_GPIO7INCFG(n)               (((uint32_t)(n) << 28) & 0x10000000)
+#define AM_REG_GPIO_CFGA_GPIO7INCFG_READ             0x00000000
+#define AM_REG_GPIO_CFGA_GPIO7INCFG_RDZERO           0x10000000
+
+// GPIO6 interrupt direction.
+#define AM_REG_GPIO_CFGA_GPIO6INTD_S                 27
+#define AM_REG_GPIO_CFGA_GPIO6INTD_M                 0x08000000
+#define AM_REG_GPIO_CFGA_GPIO6INTD(n)                (((uint32_t)(n) << 27) & 0x08000000)
+#define AM_REG_GPIO_CFGA_GPIO6INTD_INTLH             0x00000000
+#define AM_REG_GPIO_CFGA_GPIO6INTD_INTHL             0x08000000
+
+// GPIO6 output configuration.
+#define AM_REG_GPIO_CFGA_GPIO6OUTCFG_S               25
+#define AM_REG_GPIO_CFGA_GPIO6OUTCFG_M               0x06000000
+#define AM_REG_GPIO_CFGA_GPIO6OUTCFG(n)              (((uint32_t)(n) << 25) & 0x06000000)
+#define AM_REG_GPIO_CFGA_GPIO6OUTCFG_DIS             0x00000000
+#define AM_REG_GPIO_CFGA_GPIO6OUTCFG_PUSHPULL        0x02000000
+#define AM_REG_GPIO_CFGA_GPIO6OUTCFG_OD              0x04000000
+#define AM_REG_GPIO_CFGA_GPIO6OUTCFG_TS              0x06000000
+
+// GPIO6 input enable.
+#define AM_REG_GPIO_CFGA_GPIO6INCFG_S                24
+#define AM_REG_GPIO_CFGA_GPIO6INCFG_M                0x01000000
+#define AM_REG_GPIO_CFGA_GPIO6INCFG(n)               (((uint32_t)(n) << 24) & 0x01000000)
+#define AM_REG_GPIO_CFGA_GPIO6INCFG_READ             0x00000000
+#define AM_REG_GPIO_CFGA_GPIO6INCFG_RDZERO           0x01000000
+
+// GPIO5 interrupt direction.
+#define AM_REG_GPIO_CFGA_GPIO5INTD_S                 23
+#define AM_REG_GPIO_CFGA_GPIO5INTD_M                 0x00800000
+#define AM_REG_GPIO_CFGA_GPIO5INTD(n)                (((uint32_t)(n) << 23) & 0x00800000)
+#define AM_REG_GPIO_CFGA_GPIO5INTD_INTLH             0x00000000
+#define AM_REG_GPIO_CFGA_GPIO5INTD_INTHL             0x00800000
+
+// GPIO5 output configuration.
+#define AM_REG_GPIO_CFGA_GPIO5OUTCFG_S               21
+#define AM_REG_GPIO_CFGA_GPIO5OUTCFG_M               0x00600000
+#define AM_REG_GPIO_CFGA_GPIO5OUTCFG(n)              (((uint32_t)(n) << 21) & 0x00600000)
+#define AM_REG_GPIO_CFGA_GPIO5OUTCFG_DIS             0x00000000
+#define AM_REG_GPIO_CFGA_GPIO5OUTCFG_PUSHPULL        0x00200000
+#define AM_REG_GPIO_CFGA_GPIO5OUTCFG_OD              0x00400000
+#define AM_REG_GPIO_CFGA_GPIO5OUTCFG_TS              0x00600000
+
+// GPIO5 input enable.
+#define AM_REG_GPIO_CFGA_GPIO5INCFG_S                20
+#define AM_REG_GPIO_CFGA_GPIO5INCFG_M                0x00100000
+#define AM_REG_GPIO_CFGA_GPIO5INCFG(n)               (((uint32_t)(n) << 20) & 0x00100000)
+#define AM_REG_GPIO_CFGA_GPIO5INCFG_READ             0x00000000
+#define AM_REG_GPIO_CFGA_GPIO5INCFG_RDZERO           0x00100000
+
+// GPIO4 interrupt direction.
+#define AM_REG_GPIO_CFGA_GPIO4INTD_S                 19
+#define AM_REG_GPIO_CFGA_GPIO4INTD_M                 0x00080000
+#define AM_REG_GPIO_CFGA_GPIO4INTD(n)                (((uint32_t)(n) << 19) & 0x00080000)
+#define AM_REG_GPIO_CFGA_GPIO4INTD_INTLH             0x00000000
+#define AM_REG_GPIO_CFGA_GPIO4INTD_INTHL             0x00080000
+
+// GPIO4 output configuration.
+#define AM_REG_GPIO_CFGA_GPIO4OUTCFG_S               17
+#define AM_REG_GPIO_CFGA_GPIO4OUTCFG_M               0x00060000
+#define AM_REG_GPIO_CFGA_GPIO4OUTCFG(n)              (((uint32_t)(n) << 17) & 0x00060000)
+#define AM_REG_GPIO_CFGA_GPIO4OUTCFG_DIS             0x00000000
+#define AM_REG_GPIO_CFGA_GPIO4OUTCFG_PUSHPULL        0x00020000
+#define AM_REG_GPIO_CFGA_GPIO4OUTCFG_OD              0x00040000
+#define AM_REG_GPIO_CFGA_GPIO4OUTCFG_TS              0x00060000
+
+// GPIO4 input enable.
+#define AM_REG_GPIO_CFGA_GPIO4INCFG_S                16
+#define AM_REG_GPIO_CFGA_GPIO4INCFG_M                0x00010000
+#define AM_REG_GPIO_CFGA_GPIO4INCFG(n)               (((uint32_t)(n) << 16) & 0x00010000)
+#define AM_REG_GPIO_CFGA_GPIO4INCFG_READ             0x00000000
+#define AM_REG_GPIO_CFGA_GPIO4INCFG_RDZERO           0x00010000
+
+// GPIO3 interrupt direction.
+#define AM_REG_GPIO_CFGA_GPIO3INTD_S                 15
+#define AM_REG_GPIO_CFGA_GPIO3INTD_M                 0x00008000
+#define AM_REG_GPIO_CFGA_GPIO3INTD(n)                (((uint32_t)(n) << 15) & 0x00008000)
+#define AM_REG_GPIO_CFGA_GPIO3INTD_INTLH             0x00000000
+#define AM_REG_GPIO_CFGA_GPIO3INTD_INTHL             0x00008000
+
+// GPIO3 output configuration.
+#define AM_REG_GPIO_CFGA_GPIO3OUTCFG_S               13
+#define AM_REG_GPIO_CFGA_GPIO3OUTCFG_M               0x00006000
+#define AM_REG_GPIO_CFGA_GPIO3OUTCFG(n)              (((uint32_t)(n) << 13) & 0x00006000)
+#define AM_REG_GPIO_CFGA_GPIO3OUTCFG_DIS             0x00000000
+#define AM_REG_GPIO_CFGA_GPIO3OUTCFG_PUSHPULL        0x00002000
+#define AM_REG_GPIO_CFGA_GPIO3OUTCFG_OD              0x00004000
+#define AM_REG_GPIO_CFGA_GPIO3OUTCFG_TS              0x00006000
+
+// GPIO3 input enable.
+#define AM_REG_GPIO_CFGA_GPIO3INCFG_S                12
+#define AM_REG_GPIO_CFGA_GPIO3INCFG_M                0x00001000
+#define AM_REG_GPIO_CFGA_GPIO3INCFG(n)               (((uint32_t)(n) << 12) & 0x00001000)
+#define AM_REG_GPIO_CFGA_GPIO3INCFG_READ             0x00000000
+#define AM_REG_GPIO_CFGA_GPIO3INCFG_RDZERO           0x00001000
+
+// GPIO2 interrupt direction.
+#define AM_REG_GPIO_CFGA_GPIO2INTD_S                 11
+#define AM_REG_GPIO_CFGA_GPIO2INTD_M                 0x00000800
+#define AM_REG_GPIO_CFGA_GPIO2INTD(n)                (((uint32_t)(n) << 11) & 0x00000800)
+#define AM_REG_GPIO_CFGA_GPIO2INTD_INTLH             0x00000000
+#define AM_REG_GPIO_CFGA_GPIO2INTD_INTHL             0x00000800
+
+// GPIO2 output configuration.
+#define AM_REG_GPIO_CFGA_GPIO2OUTCFG_S               9
+#define AM_REG_GPIO_CFGA_GPIO2OUTCFG_M               0x00000600
+#define AM_REG_GPIO_CFGA_GPIO2OUTCFG(n)              (((uint32_t)(n) << 9) & 0x00000600)
+#define AM_REG_GPIO_CFGA_GPIO2OUTCFG_DIS             0x00000000
+#define AM_REG_GPIO_CFGA_GPIO2OUTCFG_PUSHPULL        0x00000200
+#define AM_REG_GPIO_CFGA_GPIO2OUTCFG_OD              0x00000400
+#define AM_REG_GPIO_CFGA_GPIO2OUTCFG_TS              0x00000600
+
+// GPIO2 input enable.
+#define AM_REG_GPIO_CFGA_GPIO2INCFG_S                8
+#define AM_REG_GPIO_CFGA_GPIO2INCFG_M                0x00000100
+#define AM_REG_GPIO_CFGA_GPIO2INCFG(n)               (((uint32_t)(n) << 8) & 0x00000100)
+#define AM_REG_GPIO_CFGA_GPIO2INCFG_READ             0x00000000
+#define AM_REG_GPIO_CFGA_GPIO2INCFG_RDZERO           0x00000100
+
+// GPIO1 interrupt direction.
+#define AM_REG_GPIO_CFGA_GPIO1INTD_S                 7
+#define AM_REG_GPIO_CFGA_GPIO1INTD_M                 0x00000080
+#define AM_REG_GPIO_CFGA_GPIO1INTD(n)                (((uint32_t)(n) << 7) & 0x00000080)
+#define AM_REG_GPIO_CFGA_GPIO1INTD_INTLH             0x00000000
+#define AM_REG_GPIO_CFGA_GPIO1INTD_INTHL             0x00000080
+
+// GPIO1 output configuration.
+#define AM_REG_GPIO_CFGA_GPIO1OUTCFG_S               5
+#define AM_REG_GPIO_CFGA_GPIO1OUTCFG_M               0x00000060
+#define AM_REG_GPIO_CFGA_GPIO1OUTCFG(n)              (((uint32_t)(n) << 5) & 0x00000060)
+#define AM_REG_GPIO_CFGA_GPIO1OUTCFG_DIS             0x00000000
+#define AM_REG_GPIO_CFGA_GPIO1OUTCFG_PUSHPULL        0x00000020
+#define AM_REG_GPIO_CFGA_GPIO1OUTCFG_OD              0x00000040
+#define AM_REG_GPIO_CFGA_GPIO1OUTCFG_TS              0x00000060
+
+// GPIO1 input enable.
+#define AM_REG_GPIO_CFGA_GPIO1INCFG_S                4
+#define AM_REG_GPIO_CFGA_GPIO1INCFG_M                0x00000010
+#define AM_REG_GPIO_CFGA_GPIO1INCFG(n)               (((uint32_t)(n) << 4) & 0x00000010)
+#define AM_REG_GPIO_CFGA_GPIO1INCFG_READ             0x00000000
+#define AM_REG_GPIO_CFGA_GPIO1INCFG_RDZERO           0x00000010
+
+// GPIO0 interrupt direction.
+#define AM_REG_GPIO_CFGA_GPIO0INTD_S                 3
+#define AM_REG_GPIO_CFGA_GPIO0INTD_M                 0x00000008
+#define AM_REG_GPIO_CFGA_GPIO0INTD(n)                (((uint32_t)(n) << 3) & 0x00000008)
+#define AM_REG_GPIO_CFGA_GPIO0INTD_INTLH             0x00000000
+#define AM_REG_GPIO_CFGA_GPIO0INTD_INTHL             0x00000008
+
+// GPIO0 output configuration.
+#define AM_REG_GPIO_CFGA_GPIO0OUTCFG_S               1
+#define AM_REG_GPIO_CFGA_GPIO0OUTCFG_M               0x00000006
+#define AM_REG_GPIO_CFGA_GPIO0OUTCFG(n)              (((uint32_t)(n) << 1) & 0x00000006)
+#define AM_REG_GPIO_CFGA_GPIO0OUTCFG_DIS             0x00000000
+#define AM_REG_GPIO_CFGA_GPIO0OUTCFG_PUSHPULL        0x00000002
+#define AM_REG_GPIO_CFGA_GPIO0OUTCFG_OD              0x00000004
+#define AM_REG_GPIO_CFGA_GPIO0OUTCFG_TS              0x00000006
+
+// GPIO0 input enable.
+#define AM_REG_GPIO_CFGA_GPIO0INCFG_S                0
+#define AM_REG_GPIO_CFGA_GPIO0INCFG_M                0x00000001
+#define AM_REG_GPIO_CFGA_GPIO0INCFG(n)               (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_GPIO_CFGA_GPIO0INCFG_READ             0x00000000
+#define AM_REG_GPIO_CFGA_GPIO0INCFG_RDZERO           0x00000001
+
+//*****************************************************************************
+//
+// GPIO_CFGB - GPIO Configuration Register B
+//
+//*****************************************************************************
+// GPIO15 interrupt direction.
+#define AM_REG_GPIO_CFGB_GPIO15INTD_S                31
+#define AM_REG_GPIO_CFGB_GPIO15INTD_M                0x80000000
+#define AM_REG_GPIO_CFGB_GPIO15INTD(n)               (((uint32_t)(n) << 31) & 0x80000000)
+#define AM_REG_GPIO_CFGB_GPIO15INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGB_GPIO15INTD_INTHL            0x80000000
+
+// GPIO15 output configuration.
+#define AM_REG_GPIO_CFGB_GPIO15OUTCFG_S              29
+#define AM_REG_GPIO_CFGB_GPIO15OUTCFG_M              0x60000000
+#define AM_REG_GPIO_CFGB_GPIO15OUTCFG(n)             (((uint32_t)(n) << 29) & 0x60000000)
+#define AM_REG_GPIO_CFGB_GPIO15OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGB_GPIO15OUTCFG_PUSHPULL       0x20000000
+#define AM_REG_GPIO_CFGB_GPIO15OUTCFG_OD             0x40000000
+#define AM_REG_GPIO_CFGB_GPIO15OUTCFG_TS             0x60000000
+
+// GPIO15 input enable.
+#define AM_REG_GPIO_CFGB_GPIO15INCFG_S               28
+#define AM_REG_GPIO_CFGB_GPIO15INCFG_M               0x10000000
+#define AM_REG_GPIO_CFGB_GPIO15INCFG(n)              (((uint32_t)(n) << 28) & 0x10000000)
+#define AM_REG_GPIO_CFGB_GPIO15INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGB_GPIO15INCFG_RDZERO          0x10000000
+
+// GPIO14 interrupt direction.
+#define AM_REG_GPIO_CFGB_GPIO14INTD_S                27
+#define AM_REG_GPIO_CFGB_GPIO14INTD_M                0x08000000
+#define AM_REG_GPIO_CFGB_GPIO14INTD(n)               (((uint32_t)(n) << 27) & 0x08000000)
+#define AM_REG_GPIO_CFGB_GPIO14INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGB_GPIO14INTD_INTHL            0x08000000
+
+// GPIO14 output configuration.
+#define AM_REG_GPIO_CFGB_GPIO14OUTCFG_S              25
+#define AM_REG_GPIO_CFGB_GPIO14OUTCFG_M              0x06000000
+#define AM_REG_GPIO_CFGB_GPIO14OUTCFG(n)             (((uint32_t)(n) << 25) & 0x06000000)
+#define AM_REG_GPIO_CFGB_GPIO14OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGB_GPIO14OUTCFG_PUSHPULL       0x02000000
+#define AM_REG_GPIO_CFGB_GPIO14OUTCFG_OD             0x04000000
+#define AM_REG_GPIO_CFGB_GPIO14OUTCFG_TS             0x06000000
+
+// GPIO14 input enable.
+#define AM_REG_GPIO_CFGB_GPIO14INCFG_S               24
+#define AM_REG_GPIO_CFGB_GPIO14INCFG_M               0x01000000
+#define AM_REG_GPIO_CFGB_GPIO14INCFG(n)              (((uint32_t)(n) << 24) & 0x01000000)
+#define AM_REG_GPIO_CFGB_GPIO14INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGB_GPIO14INCFG_RDZERO          0x01000000
+
+// GPIO13 interrupt direction.
+#define AM_REG_GPIO_CFGB_GPIO13INTD_S                23
+#define AM_REG_GPIO_CFGB_GPIO13INTD_M                0x00800000
+#define AM_REG_GPIO_CFGB_GPIO13INTD(n)               (((uint32_t)(n) << 23) & 0x00800000)
+#define AM_REG_GPIO_CFGB_GPIO13INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGB_GPIO13INTD_INTHL            0x00800000
+
+// GPIO13 output configuration.
+#define AM_REG_GPIO_CFGB_GPIO13OUTCFG_S              21
+#define AM_REG_GPIO_CFGB_GPIO13OUTCFG_M              0x00600000
+#define AM_REG_GPIO_CFGB_GPIO13OUTCFG(n)             (((uint32_t)(n) << 21) & 0x00600000)
+#define AM_REG_GPIO_CFGB_GPIO13OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGB_GPIO13OUTCFG_PUSHPULL       0x00200000
+#define AM_REG_GPIO_CFGB_GPIO13OUTCFG_OD             0x00400000
+#define AM_REG_GPIO_CFGB_GPIO13OUTCFG_TS             0x00600000
+
+// GPIO13 input enable.
+#define AM_REG_GPIO_CFGB_GPIO13INCFG_S               20
+#define AM_REG_GPIO_CFGB_GPIO13INCFG_M               0x00100000
+#define AM_REG_GPIO_CFGB_GPIO13INCFG(n)              (((uint32_t)(n) << 20) & 0x00100000)
+#define AM_REG_GPIO_CFGB_GPIO13INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGB_GPIO13INCFG_RDZERO          0x00100000
+
+// GPIO12 interrupt direction.
+#define AM_REG_GPIO_CFGB_GPIO12INTD_S                19
+#define AM_REG_GPIO_CFGB_GPIO12INTD_M                0x00080000
+#define AM_REG_GPIO_CFGB_GPIO12INTD(n)               (((uint32_t)(n) << 19) & 0x00080000)
+#define AM_REG_GPIO_CFGB_GPIO12INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGB_GPIO12INTD_INTHL            0x00080000
+
+// GPIO12 output configuration.
+#define AM_REG_GPIO_CFGB_GPIO12OUTCFG_S              17
+#define AM_REG_GPIO_CFGB_GPIO12OUTCFG_M              0x00060000
+#define AM_REG_GPIO_CFGB_GPIO12OUTCFG(n)             (((uint32_t)(n) << 17) & 0x00060000)
+#define AM_REG_GPIO_CFGB_GPIO12OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGB_GPIO12OUTCFG_PUSHPULL       0x00020000
+#define AM_REG_GPIO_CFGB_GPIO12OUTCFG_OD             0x00040000
+#define AM_REG_GPIO_CFGB_GPIO12OUTCFG_TS             0x00060000
+
+// GPIO12 input enable.
+#define AM_REG_GPIO_CFGB_GPIO12INCFG_S               16
+#define AM_REG_GPIO_CFGB_GPIO12INCFG_M               0x00010000
+#define AM_REG_GPIO_CFGB_GPIO12INCFG(n)              (((uint32_t)(n) << 16) & 0x00010000)
+#define AM_REG_GPIO_CFGB_GPIO12INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGB_GPIO12INCFG_RDZERO          0x00010000
+
+// GPIO11 interrupt direction.
+#define AM_REG_GPIO_CFGB_GPIO11INTD_S                15
+#define AM_REG_GPIO_CFGB_GPIO11INTD_M                0x00008000
+#define AM_REG_GPIO_CFGB_GPIO11INTD(n)               (((uint32_t)(n) << 15) & 0x00008000)
+#define AM_REG_GPIO_CFGB_GPIO11INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGB_GPIO11INTD_INTHL            0x00008000
+
+// GPIO11 output configuration.
+#define AM_REG_GPIO_CFGB_GPIO11OUTCFG_S              13
+#define AM_REG_GPIO_CFGB_GPIO11OUTCFG_M              0x00006000
+#define AM_REG_GPIO_CFGB_GPIO11OUTCFG(n)             (((uint32_t)(n) << 13) & 0x00006000)
+#define AM_REG_GPIO_CFGB_GPIO11OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGB_GPIO11OUTCFG_PUSHPULL       0x00002000
+#define AM_REG_GPIO_CFGB_GPIO11OUTCFG_OD             0x00004000
+#define AM_REG_GPIO_CFGB_GPIO11OUTCFG_TS             0x00006000
+
+// GPIO11 input enable.
+#define AM_REG_GPIO_CFGB_GPIO11INCFG_S               12
+#define AM_REG_GPIO_CFGB_GPIO11INCFG_M               0x00001000
+#define AM_REG_GPIO_CFGB_GPIO11INCFG(n)              (((uint32_t)(n) << 12) & 0x00001000)
+#define AM_REG_GPIO_CFGB_GPIO11INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGB_GPIO11INCFG_RDZERO          0x00001000
+
+// GPIO10 interrupt direction.
+#define AM_REG_GPIO_CFGB_GPIO10INTD_S                11
+#define AM_REG_GPIO_CFGB_GPIO10INTD_M                0x00000800
+#define AM_REG_GPIO_CFGB_GPIO10INTD(n)               (((uint32_t)(n) << 11) & 0x00000800)
+#define AM_REG_GPIO_CFGB_GPIO10INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGB_GPIO10INTD_INTHL            0x00000800
+
+// GPIO10 output configuration.
+#define AM_REG_GPIO_CFGB_GPIO10OUTCFG_S              9
+#define AM_REG_GPIO_CFGB_GPIO10OUTCFG_M              0x00000600
+#define AM_REG_GPIO_CFGB_GPIO10OUTCFG(n)             (((uint32_t)(n) << 9) & 0x00000600)
+#define AM_REG_GPIO_CFGB_GPIO10OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGB_GPIO10OUTCFG_PUSHPULL       0x00000200
+#define AM_REG_GPIO_CFGB_GPIO10OUTCFG_OD             0x00000400
+#define AM_REG_GPIO_CFGB_GPIO10OUTCFG_TS             0x00000600
+
+// GPIO10 input enable.
+#define AM_REG_GPIO_CFGB_GPIO10INCFG_S               8
+#define AM_REG_GPIO_CFGB_GPIO10INCFG_M               0x00000100
+#define AM_REG_GPIO_CFGB_GPIO10INCFG(n)              (((uint32_t)(n) << 8) & 0x00000100)
+#define AM_REG_GPIO_CFGB_GPIO10INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGB_GPIO10INCFG_RDZERO          0x00000100
+
+// GPIO9 interrupt direction.
+#define AM_REG_GPIO_CFGB_GPIO9INTD_S                 7
+#define AM_REG_GPIO_CFGB_GPIO9INTD_M                 0x00000080
+#define AM_REG_GPIO_CFGB_GPIO9INTD(n)                (((uint32_t)(n) << 7) & 0x00000080)
+#define AM_REG_GPIO_CFGB_GPIO9INTD_INTLH             0x00000000
+#define AM_REG_GPIO_CFGB_GPIO9INTD_INTHL             0x00000080
+
+// GPIO9 output configuration.
+#define AM_REG_GPIO_CFGB_GPIO9OUTCFG_S               5
+#define AM_REG_GPIO_CFGB_GPIO9OUTCFG_M               0x00000060
+#define AM_REG_GPIO_CFGB_GPIO9OUTCFG(n)              (((uint32_t)(n) << 5) & 0x00000060)
+#define AM_REG_GPIO_CFGB_GPIO9OUTCFG_DIS             0x00000000
+#define AM_REG_GPIO_CFGB_GPIO9OUTCFG_PUSHPULL        0x00000020
+#define AM_REG_GPIO_CFGB_GPIO9OUTCFG_OD              0x00000040
+#define AM_REG_GPIO_CFGB_GPIO9OUTCFG_TS              0x00000060
+
+// GPIO9 input enable.
+#define AM_REG_GPIO_CFGB_GPIO9INCFG_S                4
+#define AM_REG_GPIO_CFGB_GPIO9INCFG_M                0x00000010
+#define AM_REG_GPIO_CFGB_GPIO9INCFG(n)               (((uint32_t)(n) << 4) & 0x00000010)
+#define AM_REG_GPIO_CFGB_GPIO9INCFG_READ             0x00000000
+#define AM_REG_GPIO_CFGB_GPIO9INCFG_RDZERO           0x00000010
+
+// GPIO8 interrupt direction.
+#define AM_REG_GPIO_CFGB_GPIO8INTD_S                 3
+#define AM_REG_GPIO_CFGB_GPIO8INTD_M                 0x00000008
+#define AM_REG_GPIO_CFGB_GPIO8INTD(n)                (((uint32_t)(n) << 3) & 0x00000008)
+#define AM_REG_GPIO_CFGB_GPIO8INTD_INTLH             0x00000000
+#define AM_REG_GPIO_CFGB_GPIO8INTD_INTHL             0x00000008
+
+// GPIO8 output configuration.
+#define AM_REG_GPIO_CFGB_GPIO8OUTCFG_S               1
+#define AM_REG_GPIO_CFGB_GPIO8OUTCFG_M               0x00000006
+#define AM_REG_GPIO_CFGB_GPIO8OUTCFG(n)              (((uint32_t)(n) << 1) & 0x00000006)
+#define AM_REG_GPIO_CFGB_GPIO8OUTCFG_DIS             0x00000000
+#define AM_REG_GPIO_CFGB_GPIO8OUTCFG_PUSHPULL        0x00000002
+#define AM_REG_GPIO_CFGB_GPIO8OUTCFG_OD              0x00000004
+#define AM_REG_GPIO_CFGB_GPIO8OUTCFG_TS              0x00000006
+
+// GPIO8 input enable.
+#define AM_REG_GPIO_CFGB_GPIO8INCFG_S                0
+#define AM_REG_GPIO_CFGB_GPIO8INCFG_M                0x00000001
+#define AM_REG_GPIO_CFGB_GPIO8INCFG(n)               (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_GPIO_CFGB_GPIO8INCFG_READ             0x00000000
+#define AM_REG_GPIO_CFGB_GPIO8INCFG_RDZERO           0x00000001
+
+//*****************************************************************************
+//
+// GPIO_CFGC - GPIO Configuration Register C
+//
+//*****************************************************************************
+// GPIO23 interrupt direction.
+#define AM_REG_GPIO_CFGC_GPIO23INTD_S                31
+#define AM_REG_GPIO_CFGC_GPIO23INTD_M                0x80000000
+#define AM_REG_GPIO_CFGC_GPIO23INTD(n)               (((uint32_t)(n) << 31) & 0x80000000)
+#define AM_REG_GPIO_CFGC_GPIO23INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGC_GPIO23INTD_INTHL            0x80000000
+
+// GPIO23 output configuration.
+#define AM_REG_GPIO_CFGC_GPIO23OUTCFG_S              29
+#define AM_REG_GPIO_CFGC_GPIO23OUTCFG_M              0x60000000
+#define AM_REG_GPIO_CFGC_GPIO23OUTCFG(n)             (((uint32_t)(n) << 29) & 0x60000000)
+#define AM_REG_GPIO_CFGC_GPIO23OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGC_GPIO23OUTCFG_PUSHPULL       0x20000000
+#define AM_REG_GPIO_CFGC_GPIO23OUTCFG_OD             0x40000000
+#define AM_REG_GPIO_CFGC_GPIO23OUTCFG_TS             0x60000000
+
+// GPIO23 input enable.
+#define AM_REG_GPIO_CFGC_GPIO23INCFG_S               28
+#define AM_REG_GPIO_CFGC_GPIO23INCFG_M               0x10000000
+#define AM_REG_GPIO_CFGC_GPIO23INCFG(n)              (((uint32_t)(n) << 28) & 0x10000000)
+#define AM_REG_GPIO_CFGC_GPIO23INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGC_GPIO23INCFG_RDZERO          0x10000000
+
+// GPIO22 interrupt direction.
+#define AM_REG_GPIO_CFGC_GPIO22INTD_S                27
+#define AM_REG_GPIO_CFGC_GPIO22INTD_M                0x08000000
+#define AM_REG_GPIO_CFGC_GPIO22INTD(n)               (((uint32_t)(n) << 27) & 0x08000000)
+#define AM_REG_GPIO_CFGC_GPIO22INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGC_GPIO22INTD_INTHL            0x08000000
+
+// GPIO22 output configuration.
+#define AM_REG_GPIO_CFGC_GPIO22OUTCFG_S              25
+#define AM_REG_GPIO_CFGC_GPIO22OUTCFG_M              0x06000000
+#define AM_REG_GPIO_CFGC_GPIO22OUTCFG(n)             (((uint32_t)(n) << 25) & 0x06000000)
+#define AM_REG_GPIO_CFGC_GPIO22OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGC_GPIO22OUTCFG_PUSHPULL       0x02000000
+#define AM_REG_GPIO_CFGC_GPIO22OUTCFG_OD             0x04000000
+#define AM_REG_GPIO_CFGC_GPIO22OUTCFG_TS             0x06000000
+
+// GPIO22 input enable.
+#define AM_REG_GPIO_CFGC_GPIO22INCFG_S               24
+#define AM_REG_GPIO_CFGC_GPIO22INCFG_M               0x01000000
+#define AM_REG_GPIO_CFGC_GPIO22INCFG(n)              (((uint32_t)(n) << 24) & 0x01000000)
+#define AM_REG_GPIO_CFGC_GPIO22INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGC_GPIO22INCFG_RDZERO          0x01000000
+
+// GPIO21 interrupt direction.
+#define AM_REG_GPIO_CFGC_GPIO21INTD_S                23
+#define AM_REG_GPIO_CFGC_GPIO21INTD_M                0x00800000
+#define AM_REG_GPIO_CFGC_GPIO21INTD(n)               (((uint32_t)(n) << 23) & 0x00800000)
+#define AM_REG_GPIO_CFGC_GPIO21INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGC_GPIO21INTD_INTHL            0x00800000
+
+// GPIO21 output configuration.
+#define AM_REG_GPIO_CFGC_GPIO21OUTCFG_S              21
+#define AM_REG_GPIO_CFGC_GPIO21OUTCFG_M              0x00600000
+#define AM_REG_GPIO_CFGC_GPIO21OUTCFG(n)             (((uint32_t)(n) << 21) & 0x00600000)
+#define AM_REG_GPIO_CFGC_GPIO21OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGC_GPIO21OUTCFG_PUSHPULL       0x00200000
+#define AM_REG_GPIO_CFGC_GPIO21OUTCFG_OD             0x00400000
+#define AM_REG_GPIO_CFGC_GPIO21OUTCFG_TS             0x00600000
+
+// GPIO21 input enable.
+#define AM_REG_GPIO_CFGC_GPIO21INCFG_S               20
+#define AM_REG_GPIO_CFGC_GPIO21INCFG_M               0x00100000
+#define AM_REG_GPIO_CFGC_GPIO21INCFG(n)              (((uint32_t)(n) << 20) & 0x00100000)
+#define AM_REG_GPIO_CFGC_GPIO21INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGC_GPIO21INCFG_RDZERO          0x00100000
+
+// GPIO20 interrupt direction.
+#define AM_REG_GPIO_CFGC_GPIO20INTD_S                19
+#define AM_REG_GPIO_CFGC_GPIO20INTD_M                0x00080000
+#define AM_REG_GPIO_CFGC_GPIO20INTD(n)               (((uint32_t)(n) << 19) & 0x00080000)
+#define AM_REG_GPIO_CFGC_GPIO20INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGC_GPIO20INTD_INTHL            0x00080000
+
+// GPIO20 output configuration.
+#define AM_REG_GPIO_CFGC_GPIO20OUTCFG_S              17
+#define AM_REG_GPIO_CFGC_GPIO20OUTCFG_M              0x00060000
+#define AM_REG_GPIO_CFGC_GPIO20OUTCFG(n)             (((uint32_t)(n) << 17) & 0x00060000)
+#define AM_REG_GPIO_CFGC_GPIO20OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGC_GPIO20OUTCFG_PUSHPULL       0x00020000
+#define AM_REG_GPIO_CFGC_GPIO20OUTCFG_OD             0x00040000
+#define AM_REG_GPIO_CFGC_GPIO20OUTCFG_TS             0x00060000
+
+// GPIO20 input enable.
+#define AM_REG_GPIO_CFGC_GPIO20INCFG_S               16
+#define AM_REG_GPIO_CFGC_GPIO20INCFG_M               0x00010000
+#define AM_REG_GPIO_CFGC_GPIO20INCFG(n)              (((uint32_t)(n) << 16) & 0x00010000)
+#define AM_REG_GPIO_CFGC_GPIO20INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGC_GPIO20INCFG_RDZERO          0x00010000
+
+// GPIO19 interrupt direction.
+#define AM_REG_GPIO_CFGC_GPIO19INTD_S                15
+#define AM_REG_GPIO_CFGC_GPIO19INTD_M                0x00008000
+#define AM_REG_GPIO_CFGC_GPIO19INTD(n)               (((uint32_t)(n) << 15) & 0x00008000)
+#define AM_REG_GPIO_CFGC_GPIO19INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGC_GPIO19INTD_INTHL            0x00008000
+
+// GPIO19 output configuration.
+#define AM_REG_GPIO_CFGC_GPIO19OUTCFG_S              13
+#define AM_REG_GPIO_CFGC_GPIO19OUTCFG_M              0x00006000
+#define AM_REG_GPIO_CFGC_GPIO19OUTCFG(n)             (((uint32_t)(n) << 13) & 0x00006000)
+#define AM_REG_GPIO_CFGC_GPIO19OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGC_GPIO19OUTCFG_PUSHPULL       0x00002000
+#define AM_REG_GPIO_CFGC_GPIO19OUTCFG_OD             0x00004000
+#define AM_REG_GPIO_CFGC_GPIO19OUTCFG_TS             0x00006000
+
+// GPIO19 input enable.
+#define AM_REG_GPIO_CFGC_GPIO19INCFG_S               12
+#define AM_REG_GPIO_CFGC_GPIO19INCFG_M               0x00001000
+#define AM_REG_GPIO_CFGC_GPIO19INCFG(n)              (((uint32_t)(n) << 12) & 0x00001000)
+#define AM_REG_GPIO_CFGC_GPIO19INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGC_GPIO19INCFG_RDZERO          0x00001000
+
+// GPIO18 interrupt direction.
+#define AM_REG_GPIO_CFGC_GPIO18INTD_S                11
+#define AM_REG_GPIO_CFGC_GPIO18INTD_M                0x00000800
+#define AM_REG_GPIO_CFGC_GPIO18INTD(n)               (((uint32_t)(n) << 11) & 0x00000800)
+#define AM_REG_GPIO_CFGC_GPIO18INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGC_GPIO18INTD_INTHL            0x00000800
+
+// GPIO18 output configuration.
+#define AM_REG_GPIO_CFGC_GPIO18OUTCFG_S              9
+#define AM_REG_GPIO_CFGC_GPIO18OUTCFG_M              0x00000600
+#define AM_REG_GPIO_CFGC_GPIO18OUTCFG(n)             (((uint32_t)(n) << 9) & 0x00000600)
+#define AM_REG_GPIO_CFGC_GPIO18OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGC_GPIO18OUTCFG_PUSHPULL       0x00000200
+#define AM_REG_GPIO_CFGC_GPIO18OUTCFG_OD             0x00000400
+#define AM_REG_GPIO_CFGC_GPIO18OUTCFG_TS             0x00000600
+
+// GPIO18 input enable.
+#define AM_REG_GPIO_CFGC_GPIO18INCFG_S               8
+#define AM_REG_GPIO_CFGC_GPIO18INCFG_M               0x00000100
+#define AM_REG_GPIO_CFGC_GPIO18INCFG(n)              (((uint32_t)(n) << 8) & 0x00000100)
+#define AM_REG_GPIO_CFGC_GPIO18INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGC_GPIO18INCFG_RDZERO          0x00000100
+
+// GPIO17 interrupt direction.
+#define AM_REG_GPIO_CFGC_GPIO17INTD_S                7
+#define AM_REG_GPIO_CFGC_GPIO17INTD_M                0x00000080
+#define AM_REG_GPIO_CFGC_GPIO17INTD(n)               (((uint32_t)(n) << 7) & 0x00000080)
+#define AM_REG_GPIO_CFGC_GPIO17INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGC_GPIO17INTD_INTHL            0x00000080
+
+// GPIO17 output configuration.
+#define AM_REG_GPIO_CFGC_GPIO17OUTCFG_S              5
+#define AM_REG_GPIO_CFGC_GPIO17OUTCFG_M              0x00000060
+#define AM_REG_GPIO_CFGC_GPIO17OUTCFG(n)             (((uint32_t)(n) << 5) & 0x00000060)
+#define AM_REG_GPIO_CFGC_GPIO17OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGC_GPIO17OUTCFG_PUSHPULL       0x00000020
+#define AM_REG_GPIO_CFGC_GPIO17OUTCFG_OD             0x00000040
+#define AM_REG_GPIO_CFGC_GPIO17OUTCFG_TS             0x00000060
+
+// GPIO17 input enable.
+#define AM_REG_GPIO_CFGC_GPIO17INCFG_S               4
+#define AM_REG_GPIO_CFGC_GPIO17INCFG_M               0x00000010
+#define AM_REG_GPIO_CFGC_GPIO17INCFG(n)              (((uint32_t)(n) << 4) & 0x00000010)
+#define AM_REG_GPIO_CFGC_GPIO17INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGC_GPIO17INCFG_RDZERO          0x00000010
+
+// GPIO16 interrupt direction.
+#define AM_REG_GPIO_CFGC_GPIO16INTD_S                3
+#define AM_REG_GPIO_CFGC_GPIO16INTD_M                0x00000008
+#define AM_REG_GPIO_CFGC_GPIO16INTD(n)               (((uint32_t)(n) << 3) & 0x00000008)
+#define AM_REG_GPIO_CFGC_GPIO16INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGC_GPIO16INTD_INTHL            0x00000008
+
+// GPIO16 output configuration.
+#define AM_REG_GPIO_CFGC_GPIO16OUTCFG_S              1
+#define AM_REG_GPIO_CFGC_GPIO16OUTCFG_M              0x00000006
+#define AM_REG_GPIO_CFGC_GPIO16OUTCFG(n)             (((uint32_t)(n) << 1) & 0x00000006)
+#define AM_REG_GPIO_CFGC_GPIO16OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGC_GPIO16OUTCFG_PUSHPULL       0x00000002
+#define AM_REG_GPIO_CFGC_GPIO16OUTCFG_OD             0x00000004
+#define AM_REG_GPIO_CFGC_GPIO16OUTCFG_TS             0x00000006
+
+// GPIO16 input enable.
+#define AM_REG_GPIO_CFGC_GPIO16INCFG_S               0
+#define AM_REG_GPIO_CFGC_GPIO16INCFG_M               0x00000001
+#define AM_REG_GPIO_CFGC_GPIO16INCFG(n)              (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_GPIO_CFGC_GPIO16INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGC_GPIO16INCFG_RDZERO          0x00000001
+
+//*****************************************************************************
+//
+// GPIO_CFGD - GPIO Configuration Register D
+//
+//*****************************************************************************
+// GPIO31 interrupt direction.
+#define AM_REG_GPIO_CFGD_GPIO31INTD_S                31
+#define AM_REG_GPIO_CFGD_GPIO31INTD_M                0x80000000
+#define AM_REG_GPIO_CFGD_GPIO31INTD(n)               (((uint32_t)(n) << 31) & 0x80000000)
+#define AM_REG_GPIO_CFGD_GPIO31INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGD_GPIO31INTD_INTHL            0x80000000
+
+// GPIO31 output configuration.
+#define AM_REG_GPIO_CFGD_GPIO31OUTCFG_S              29
+#define AM_REG_GPIO_CFGD_GPIO31OUTCFG_M              0x60000000
+#define AM_REG_GPIO_CFGD_GPIO31OUTCFG(n)             (((uint32_t)(n) << 29) & 0x60000000)
+#define AM_REG_GPIO_CFGD_GPIO31OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGD_GPIO31OUTCFG_PUSHPULL       0x20000000
+#define AM_REG_GPIO_CFGD_GPIO31OUTCFG_OD             0x40000000
+#define AM_REG_GPIO_CFGD_GPIO31OUTCFG_TS             0x60000000
+
+// GPIO31 input enable.
+#define AM_REG_GPIO_CFGD_GPIO31INCFG_S               28
+#define AM_REG_GPIO_CFGD_GPIO31INCFG_M               0x10000000
+#define AM_REG_GPIO_CFGD_GPIO31INCFG(n)              (((uint32_t)(n) << 28) & 0x10000000)
+#define AM_REG_GPIO_CFGD_GPIO31INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGD_GPIO31INCFG_RDZERO          0x10000000
+
+// GPIO30 interrupt direction.
+#define AM_REG_GPIO_CFGD_GPIO30INTD_S                27
+#define AM_REG_GPIO_CFGD_GPIO30INTD_M                0x08000000
+#define AM_REG_GPIO_CFGD_GPIO30INTD(n)               (((uint32_t)(n) << 27) & 0x08000000)
+#define AM_REG_GPIO_CFGD_GPIO30INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGD_GPIO30INTD_INTHL            0x08000000
+
+// GPIO30 output configuration.
+#define AM_REG_GPIO_CFGD_GPIO30OUTCFG_S              25
+#define AM_REG_GPIO_CFGD_GPIO30OUTCFG_M              0x06000000
+#define AM_REG_GPIO_CFGD_GPIO30OUTCFG(n)             (((uint32_t)(n) << 25) & 0x06000000)
+#define AM_REG_GPIO_CFGD_GPIO30OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGD_GPIO30OUTCFG_PUSHPULL       0x02000000
+#define AM_REG_GPIO_CFGD_GPIO30OUTCFG_OD             0x04000000
+#define AM_REG_GPIO_CFGD_GPIO30OUTCFG_TS             0x06000000
+
+// GPIO30 input enable.
+#define AM_REG_GPIO_CFGD_GPIO30INCFG_S               24
+#define AM_REG_GPIO_CFGD_GPIO30INCFG_M               0x01000000
+#define AM_REG_GPIO_CFGD_GPIO30INCFG(n)              (((uint32_t)(n) << 24) & 0x01000000)
+#define AM_REG_GPIO_CFGD_GPIO30INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGD_GPIO30INCFG_RDZERO          0x01000000
+
+// GPIO29 interrupt direction.
+#define AM_REG_GPIO_CFGD_GPIO29INTD_S                23
+#define AM_REG_GPIO_CFGD_GPIO29INTD_M                0x00800000
+#define AM_REG_GPIO_CFGD_GPIO29INTD(n)               (((uint32_t)(n) << 23) & 0x00800000)
+#define AM_REG_GPIO_CFGD_GPIO29INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGD_GPIO29INTD_INTHL            0x00800000
+
+// GPIO29 output configuration.
+#define AM_REG_GPIO_CFGD_GPIO29OUTCFG_S              21
+#define AM_REG_GPIO_CFGD_GPIO29OUTCFG_M              0x00600000
+#define AM_REG_GPIO_CFGD_GPIO29OUTCFG(n)             (((uint32_t)(n) << 21) & 0x00600000)
+#define AM_REG_GPIO_CFGD_GPIO29OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGD_GPIO29OUTCFG_PUSHPULL       0x00200000
+#define AM_REG_GPIO_CFGD_GPIO29OUTCFG_OD             0x00400000
+#define AM_REG_GPIO_CFGD_GPIO29OUTCFG_TS             0x00600000
+
+// GPIO29 input enable.
+#define AM_REG_GPIO_CFGD_GPIO29INCFG_S               20
+#define AM_REG_GPIO_CFGD_GPIO29INCFG_M               0x00100000
+#define AM_REG_GPIO_CFGD_GPIO29INCFG(n)              (((uint32_t)(n) << 20) & 0x00100000)
+#define AM_REG_GPIO_CFGD_GPIO29INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGD_GPIO29INCFG_RDZERO          0x00100000
+
+// GPIO28 interrupt direction.
+#define AM_REG_GPIO_CFGD_GPIO28INTD_S                19
+#define AM_REG_GPIO_CFGD_GPIO28INTD_M                0x00080000
+#define AM_REG_GPIO_CFGD_GPIO28INTD(n)               (((uint32_t)(n) << 19) & 0x00080000)
+#define AM_REG_GPIO_CFGD_GPIO28INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGD_GPIO28INTD_INTHL            0x00080000
+
+// GPIO28 output configuration.
+#define AM_REG_GPIO_CFGD_GPIO28OUTCFG_S              17
+#define AM_REG_GPIO_CFGD_GPIO28OUTCFG_M              0x00060000
+#define AM_REG_GPIO_CFGD_GPIO28OUTCFG(n)             (((uint32_t)(n) << 17) & 0x00060000)
+#define AM_REG_GPIO_CFGD_GPIO28OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGD_GPIO28OUTCFG_PUSHPULL       0x00020000
+#define AM_REG_GPIO_CFGD_GPIO28OUTCFG_OD             0x00040000
+#define AM_REG_GPIO_CFGD_GPIO28OUTCFG_TS             0x00060000
+
+// GPIO28 input enable.
+#define AM_REG_GPIO_CFGD_GPIO28INCFG_S               16
+#define AM_REG_GPIO_CFGD_GPIO28INCFG_M               0x00010000
+#define AM_REG_GPIO_CFGD_GPIO28INCFG(n)              (((uint32_t)(n) << 16) & 0x00010000)
+#define AM_REG_GPIO_CFGD_GPIO28INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGD_GPIO28INCFG_RDZERO          0x00010000
+
+// GPIO27 interrupt direction.
+#define AM_REG_GPIO_CFGD_GPIO27INTD_S                15
+#define AM_REG_GPIO_CFGD_GPIO27INTD_M                0x00008000
+#define AM_REG_GPIO_CFGD_GPIO27INTD(n)               (((uint32_t)(n) << 15) & 0x00008000)
+#define AM_REG_GPIO_CFGD_GPIO27INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGD_GPIO27INTD_INTHL            0x00008000
+
+// GPIO27 output configuration.
+#define AM_REG_GPIO_CFGD_GPIO27OUTCFG_S              13
+#define AM_REG_GPIO_CFGD_GPIO27OUTCFG_M              0x00006000
+#define AM_REG_GPIO_CFGD_GPIO27OUTCFG(n)             (((uint32_t)(n) << 13) & 0x00006000)
+#define AM_REG_GPIO_CFGD_GPIO27OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGD_GPIO27OUTCFG_PUSHPULL       0x00002000
+#define AM_REG_GPIO_CFGD_GPIO27OUTCFG_OD             0x00004000
+#define AM_REG_GPIO_CFGD_GPIO27OUTCFG_TS             0x00006000
+
+// GPIO27 input enable.
+#define AM_REG_GPIO_CFGD_GPIO27INCFG_S               12
+#define AM_REG_GPIO_CFGD_GPIO27INCFG_M               0x00001000
+#define AM_REG_GPIO_CFGD_GPIO27INCFG(n)              (((uint32_t)(n) << 12) & 0x00001000)
+#define AM_REG_GPIO_CFGD_GPIO27INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGD_GPIO27INCFG_RDZERO          0x00001000
+
+// GPIO26 interrupt direction.
+#define AM_REG_GPIO_CFGD_GPIO26INTD_S                11
+#define AM_REG_GPIO_CFGD_GPIO26INTD_M                0x00000800
+#define AM_REG_GPIO_CFGD_GPIO26INTD(n)               (((uint32_t)(n) << 11) & 0x00000800)
+#define AM_REG_GPIO_CFGD_GPIO26INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGD_GPIO26INTD_INTHL            0x00000800
+
+// GPIO26 output configuration.
+#define AM_REG_GPIO_CFGD_GPIO26OUTCFG_S              9
+#define AM_REG_GPIO_CFGD_GPIO26OUTCFG_M              0x00000600
+#define AM_REG_GPIO_CFGD_GPIO26OUTCFG(n)             (((uint32_t)(n) << 9) & 0x00000600)
+#define AM_REG_GPIO_CFGD_GPIO26OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGD_GPIO26OUTCFG_PUSHPULL       0x00000200
+#define AM_REG_GPIO_CFGD_GPIO26OUTCFG_OD             0x00000400
+#define AM_REG_GPIO_CFGD_GPIO26OUTCFG_TS             0x00000600
+
+// GPIO26 input enable.
+#define AM_REG_GPIO_CFGD_GPIO26INCFG_S               8
+#define AM_REG_GPIO_CFGD_GPIO26INCFG_M               0x00000100
+#define AM_REG_GPIO_CFGD_GPIO26INCFG(n)              (((uint32_t)(n) << 8) & 0x00000100)
+#define AM_REG_GPIO_CFGD_GPIO26INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGD_GPIO26INCFG_RDZERO          0x00000100
+
+// GPIO25 interrupt direction.
+#define AM_REG_GPIO_CFGD_GPIO25INTD_S                7
+#define AM_REG_GPIO_CFGD_GPIO25INTD_M                0x00000080
+#define AM_REG_GPIO_CFGD_GPIO25INTD(n)               (((uint32_t)(n) << 7) & 0x00000080)
+#define AM_REG_GPIO_CFGD_GPIO25INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGD_GPIO25INTD_INTHL            0x00000080
+
+// GPIO25 output configuration.
+#define AM_REG_GPIO_CFGD_GPIO25OUTCFG_S              5
+#define AM_REG_GPIO_CFGD_GPIO25OUTCFG_M              0x00000060
+#define AM_REG_GPIO_CFGD_GPIO25OUTCFG(n)             (((uint32_t)(n) << 5) & 0x00000060)
+#define AM_REG_GPIO_CFGD_GPIO25OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGD_GPIO25OUTCFG_PUSHPULL       0x00000020
+#define AM_REG_GPIO_CFGD_GPIO25OUTCFG_OD             0x00000040
+#define AM_REG_GPIO_CFGD_GPIO25OUTCFG_TS             0x00000060
+
+// GPIO25 input enable.
+#define AM_REG_GPIO_CFGD_GPIO25INCFG_S               4
+#define AM_REG_GPIO_CFGD_GPIO25INCFG_M               0x00000010
+#define AM_REG_GPIO_CFGD_GPIO25INCFG(n)              (((uint32_t)(n) << 4) & 0x00000010)
+#define AM_REG_GPIO_CFGD_GPIO25INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGD_GPIO25INCFG_RDZERO          0x00000010
+
+// GPIO24 interrupt direction.
+#define AM_REG_GPIO_CFGD_GPIO24INTD_S                3
+#define AM_REG_GPIO_CFGD_GPIO24INTD_M                0x00000008
+#define AM_REG_GPIO_CFGD_GPIO24INTD(n)               (((uint32_t)(n) << 3) & 0x00000008)
+#define AM_REG_GPIO_CFGD_GPIO24INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGD_GPIO24INTD_INTHL            0x00000008
+
+// GPIO24 output configuration.
+#define AM_REG_GPIO_CFGD_GPIO24OUTCFG_S              1
+#define AM_REG_GPIO_CFGD_GPIO24OUTCFG_M              0x00000006
+#define AM_REG_GPIO_CFGD_GPIO24OUTCFG(n)             (((uint32_t)(n) << 1) & 0x00000006)
+#define AM_REG_GPIO_CFGD_GPIO24OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGD_GPIO24OUTCFG_PUSHPULL       0x00000002
+#define AM_REG_GPIO_CFGD_GPIO24OUTCFG_OD             0x00000004
+#define AM_REG_GPIO_CFGD_GPIO24OUTCFG_TS             0x00000006
+
+// GPIO24 input enable.
+#define AM_REG_GPIO_CFGD_GPIO24INCFG_S               0
+#define AM_REG_GPIO_CFGD_GPIO24INCFG_M               0x00000001
+#define AM_REG_GPIO_CFGD_GPIO24INCFG(n)              (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_GPIO_CFGD_GPIO24INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGD_GPIO24INCFG_RDZERO          0x00000001
+
+//*****************************************************************************
+//
+// GPIO_CFGE - GPIO Configuration Register E
+//
+//*****************************************************************************
+// GPIO39 interrupt direction.
+#define AM_REG_GPIO_CFGE_GPIO39INTD_S                31
+#define AM_REG_GPIO_CFGE_GPIO39INTD_M                0x80000000
+#define AM_REG_GPIO_CFGE_GPIO39INTD(n)               (((uint32_t)(n) << 31) & 0x80000000)
+#define AM_REG_GPIO_CFGE_GPIO39INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGE_GPIO39INTD_INTHL            0x80000000
+
+// GPIO39 output configuration.
+#define AM_REG_GPIO_CFGE_GPIO39OUTCFG_S              29
+#define AM_REG_GPIO_CFGE_GPIO39OUTCFG_M              0x60000000
+#define AM_REG_GPIO_CFGE_GPIO39OUTCFG(n)             (((uint32_t)(n) << 29) & 0x60000000)
+#define AM_REG_GPIO_CFGE_GPIO39OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGE_GPIO39OUTCFG_PUSHPULL       0x20000000
+#define AM_REG_GPIO_CFGE_GPIO39OUTCFG_OD             0x40000000
+#define AM_REG_GPIO_CFGE_GPIO39OUTCFG_TS             0x60000000
+
+// GPIO39 input enable.
+#define AM_REG_GPIO_CFGE_GPIO39INCFG_S               28
+#define AM_REG_GPIO_CFGE_GPIO39INCFG_M               0x10000000
+#define AM_REG_GPIO_CFGE_GPIO39INCFG(n)              (((uint32_t)(n) << 28) & 0x10000000)
+#define AM_REG_GPIO_CFGE_GPIO39INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGE_GPIO39INCFG_RDZERO          0x10000000
+
+// GPIO38 interrupt direction.
+#define AM_REG_GPIO_CFGE_GPIO38INTD_S                27
+#define AM_REG_GPIO_CFGE_GPIO38INTD_M                0x08000000
+#define AM_REG_GPIO_CFGE_GPIO38INTD(n)               (((uint32_t)(n) << 27) & 0x08000000)
+#define AM_REG_GPIO_CFGE_GPIO38INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGE_GPIO38INTD_INTHL            0x08000000
+
+// GPIO38 output configuration.
+#define AM_REG_GPIO_CFGE_GPIO38OUTCFG_S              25
+#define AM_REG_GPIO_CFGE_GPIO38OUTCFG_M              0x06000000
+#define AM_REG_GPIO_CFGE_GPIO38OUTCFG(n)             (((uint32_t)(n) << 25) & 0x06000000)
+#define AM_REG_GPIO_CFGE_GPIO38OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGE_GPIO38OUTCFG_PUSHPULL       0x02000000
+#define AM_REG_GPIO_CFGE_GPIO38OUTCFG_OD             0x04000000
+#define AM_REG_GPIO_CFGE_GPIO38OUTCFG_TS             0x06000000
+
+// GPIO38 input enable.
+#define AM_REG_GPIO_CFGE_GPIO38INCFG_S               24
+#define AM_REG_GPIO_CFGE_GPIO38INCFG_M               0x01000000
+#define AM_REG_GPIO_CFGE_GPIO38INCFG(n)              (((uint32_t)(n) << 24) & 0x01000000)
+#define AM_REG_GPIO_CFGE_GPIO38INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGE_GPIO38INCFG_RDZERO          0x01000000
+
+// GPIO37 interrupt direction.
+#define AM_REG_GPIO_CFGE_GPIO37INTD_S                23
+#define AM_REG_GPIO_CFGE_GPIO37INTD_M                0x00800000
+#define AM_REG_GPIO_CFGE_GPIO37INTD(n)               (((uint32_t)(n) << 23) & 0x00800000)
+#define AM_REG_GPIO_CFGE_GPIO37INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGE_GPIO37INTD_INTHL            0x00800000
+
+// GPIO37 output configuration.
+#define AM_REG_GPIO_CFGE_GPIO37OUTCFG_S              21
+#define AM_REG_GPIO_CFGE_GPIO37OUTCFG_M              0x00600000
+#define AM_REG_GPIO_CFGE_GPIO37OUTCFG(n)             (((uint32_t)(n) << 21) & 0x00600000)
+#define AM_REG_GPIO_CFGE_GPIO37OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGE_GPIO37OUTCFG_PUSHPULL       0x00200000
+#define AM_REG_GPIO_CFGE_GPIO37OUTCFG_OD             0x00400000
+#define AM_REG_GPIO_CFGE_GPIO37OUTCFG_TS             0x00600000
+
+// GPIO37 input enable.
+#define AM_REG_GPIO_CFGE_GPIO37INCFG_S               20
+#define AM_REG_GPIO_CFGE_GPIO37INCFG_M               0x00100000
+#define AM_REG_GPIO_CFGE_GPIO37INCFG(n)              (((uint32_t)(n) << 20) & 0x00100000)
+#define AM_REG_GPIO_CFGE_GPIO37INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGE_GPIO37INCFG_RDZERO          0x00100000
+
+// GPIO36 interrupt direction.
+#define AM_REG_GPIO_CFGE_GPIO36INTD_S                19
+#define AM_REG_GPIO_CFGE_GPIO36INTD_M                0x00080000
+#define AM_REG_GPIO_CFGE_GPIO36INTD(n)               (((uint32_t)(n) << 19) & 0x00080000)
+#define AM_REG_GPIO_CFGE_GPIO36INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGE_GPIO36INTD_INTHL            0x00080000
+
+// GPIO36 output configuration.
+#define AM_REG_GPIO_CFGE_GPIO36OUTCFG_S              17
+#define AM_REG_GPIO_CFGE_GPIO36OUTCFG_M              0x00060000
+#define AM_REG_GPIO_CFGE_GPIO36OUTCFG(n)             (((uint32_t)(n) << 17) & 0x00060000)
+#define AM_REG_GPIO_CFGE_GPIO36OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGE_GPIO36OUTCFG_PUSHPULL       0x00020000
+#define AM_REG_GPIO_CFGE_GPIO36OUTCFG_OD             0x00040000
+#define AM_REG_GPIO_CFGE_GPIO36OUTCFG_TS             0x00060000
+
+// GPIO36 input enable.
+#define AM_REG_GPIO_CFGE_GPIO36INCFG_S               16
+#define AM_REG_GPIO_CFGE_GPIO36INCFG_M               0x00010000
+#define AM_REG_GPIO_CFGE_GPIO36INCFG(n)              (((uint32_t)(n) << 16) & 0x00010000)
+#define AM_REG_GPIO_CFGE_GPIO36INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGE_GPIO36INCFG_RDZERO          0x00010000
+
+// GPIO35 interrupt direction.
+#define AM_REG_GPIO_CFGE_GPIO35INTD_S                15
+#define AM_REG_GPIO_CFGE_GPIO35INTD_M                0x00008000
+#define AM_REG_GPIO_CFGE_GPIO35INTD(n)               (((uint32_t)(n) << 15) & 0x00008000)
+#define AM_REG_GPIO_CFGE_GPIO35INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGE_GPIO35INTD_INTHL            0x00008000
+
+// GPIO35 output configuration.
+#define AM_REG_GPIO_CFGE_GPIO35OUTCFG_S              13
+#define AM_REG_GPIO_CFGE_GPIO35OUTCFG_M              0x00006000
+#define AM_REG_GPIO_CFGE_GPIO35OUTCFG(n)             (((uint32_t)(n) << 13) & 0x00006000)
+#define AM_REG_GPIO_CFGE_GPIO35OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGE_GPIO35OUTCFG_PUSHPULL       0x00002000
+#define AM_REG_GPIO_CFGE_GPIO35OUTCFG_OD             0x00004000
+#define AM_REG_GPIO_CFGE_GPIO35OUTCFG_TS             0x00006000
+
+// GPIO35 input enable.
+#define AM_REG_GPIO_CFGE_GPIO35INCFG_S               12
+#define AM_REG_GPIO_CFGE_GPIO35INCFG_M               0x00001000
+#define AM_REG_GPIO_CFGE_GPIO35INCFG(n)              (((uint32_t)(n) << 12) & 0x00001000)
+#define AM_REG_GPIO_CFGE_GPIO35INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGE_GPIO35INCFG_RDZERO          0x00001000
+
+// GPIO34 interrupt direction.
+#define AM_REG_GPIO_CFGE_GPIO34INTD_S                11
+#define AM_REG_GPIO_CFGE_GPIO34INTD_M                0x00000800
+#define AM_REG_GPIO_CFGE_GPIO34INTD(n)               (((uint32_t)(n) << 11) & 0x00000800)
+#define AM_REG_GPIO_CFGE_GPIO34INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGE_GPIO34INTD_INTHL            0x00000800
+
+// GPIO34 output configuration.
+#define AM_REG_GPIO_CFGE_GPIO34OUTCFG_S              9
+#define AM_REG_GPIO_CFGE_GPIO34OUTCFG_M              0x00000600
+#define AM_REG_GPIO_CFGE_GPIO34OUTCFG(n)             (((uint32_t)(n) << 9) & 0x00000600)
+#define AM_REG_GPIO_CFGE_GPIO34OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGE_GPIO34OUTCFG_PUSHPULL       0x00000200
+#define AM_REG_GPIO_CFGE_GPIO34OUTCFG_OD             0x00000400
+#define AM_REG_GPIO_CFGE_GPIO34OUTCFG_TS             0x00000600
+
+// GPIO34 input enable.
+#define AM_REG_GPIO_CFGE_GPIO34INCFG_S               8
+#define AM_REG_GPIO_CFGE_GPIO34INCFG_M               0x00000100
+#define AM_REG_GPIO_CFGE_GPIO34INCFG(n)              (((uint32_t)(n) << 8) & 0x00000100)
+#define AM_REG_GPIO_CFGE_GPIO34INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGE_GPIO34INCFG_RDZERO          0x00000100
+
+// GPIO33 interrupt direction.
+#define AM_REG_GPIO_CFGE_GPIO33INTD_S                7
+#define AM_REG_GPIO_CFGE_GPIO33INTD_M                0x00000080
+#define AM_REG_GPIO_CFGE_GPIO33INTD(n)               (((uint32_t)(n) << 7) & 0x00000080)
+#define AM_REG_GPIO_CFGE_GPIO33INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGE_GPIO33INTD_INTHL            0x00000080
+
+// GPIO33 output configuration.
+#define AM_REG_GPIO_CFGE_GPIO33OUTCFG_S              5
+#define AM_REG_GPIO_CFGE_GPIO33OUTCFG_M              0x00000060
+#define AM_REG_GPIO_CFGE_GPIO33OUTCFG(n)             (((uint32_t)(n) << 5) & 0x00000060)
+#define AM_REG_GPIO_CFGE_GPIO33OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGE_GPIO33OUTCFG_PUSHPULL       0x00000020
+#define AM_REG_GPIO_CFGE_GPIO33OUTCFG_OD             0x00000040
+#define AM_REG_GPIO_CFGE_GPIO33OUTCFG_TS             0x00000060
+
+// GPIO33 input enable.
+#define AM_REG_GPIO_CFGE_GPIO33INCFG_S               4
+#define AM_REG_GPIO_CFGE_GPIO33INCFG_M               0x00000010
+#define AM_REG_GPIO_CFGE_GPIO33INCFG(n)              (((uint32_t)(n) << 4) & 0x00000010)
+#define AM_REG_GPIO_CFGE_GPIO33INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGE_GPIO33INCFG_RDZERO          0x00000010
+
+// GPIO32 interrupt direction.
+#define AM_REG_GPIO_CFGE_GPIO32INTD_S                3
+#define AM_REG_GPIO_CFGE_GPIO32INTD_M                0x00000008
+#define AM_REG_GPIO_CFGE_GPIO32INTD(n)               (((uint32_t)(n) << 3) & 0x00000008)
+#define AM_REG_GPIO_CFGE_GPIO32INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGE_GPIO32INTD_INTHL            0x00000008
+
+// GPIO32 output configuration.
+#define AM_REG_GPIO_CFGE_GPIO32OUTCFG_S              1
+#define AM_REG_GPIO_CFGE_GPIO32OUTCFG_M              0x00000006
+#define AM_REG_GPIO_CFGE_GPIO32OUTCFG(n)             (((uint32_t)(n) << 1) & 0x00000006)
+#define AM_REG_GPIO_CFGE_GPIO32OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGE_GPIO32OUTCFG_PUSHPULL       0x00000002
+#define AM_REG_GPIO_CFGE_GPIO32OUTCFG_OD             0x00000004
+#define AM_REG_GPIO_CFGE_GPIO32OUTCFG_TS             0x00000006
+
+// GPIO32 input enable.
+#define AM_REG_GPIO_CFGE_GPIO32INCFG_S               0
+#define AM_REG_GPIO_CFGE_GPIO32INCFG_M               0x00000001
+#define AM_REG_GPIO_CFGE_GPIO32INCFG(n)              (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_GPIO_CFGE_GPIO32INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGE_GPIO32INCFG_RDZERO          0x00000001
+
+//*****************************************************************************
+//
+// GPIO_CFGF - GPIO Configuration Register F
+//
+//*****************************************************************************
+// GPIO47 interrupt direction.
+#define AM_REG_GPIO_CFGF_GPIO47INTD_S                31
+#define AM_REG_GPIO_CFGF_GPIO47INTD_M                0x80000000
+#define AM_REG_GPIO_CFGF_GPIO47INTD(n)               (((uint32_t)(n) << 31) & 0x80000000)
+#define AM_REG_GPIO_CFGF_GPIO47INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGF_GPIO47INTD_INTHL            0x80000000
+
+// GPIO47 output configuration.
+#define AM_REG_GPIO_CFGF_GPIO47OUTCFG_S              29
+#define AM_REG_GPIO_CFGF_GPIO47OUTCFG_M              0x60000000
+#define AM_REG_GPIO_CFGF_GPIO47OUTCFG(n)             (((uint32_t)(n) << 29) & 0x60000000)
+#define AM_REG_GPIO_CFGF_GPIO47OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGF_GPIO47OUTCFG_PUSHPULL       0x20000000
+#define AM_REG_GPIO_CFGF_GPIO47OUTCFG_OD             0x40000000
+#define AM_REG_GPIO_CFGF_GPIO47OUTCFG_TS             0x60000000
+
+// GPIO47 input enable.
+#define AM_REG_GPIO_CFGF_GPIO47INCFG_S               28
+#define AM_REG_GPIO_CFGF_GPIO47INCFG_M               0x10000000
+#define AM_REG_GPIO_CFGF_GPIO47INCFG(n)              (((uint32_t)(n) << 28) & 0x10000000)
+#define AM_REG_GPIO_CFGF_GPIO47INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGF_GPIO47INCFG_RDZERO          0x10000000
+
+// GPIO46 interrupt direction.
+#define AM_REG_GPIO_CFGF_GPIO46INTD_S                27
+#define AM_REG_GPIO_CFGF_GPIO46INTD_M                0x08000000
+#define AM_REG_GPIO_CFGF_GPIO46INTD(n)               (((uint32_t)(n) << 27) & 0x08000000)
+#define AM_REG_GPIO_CFGF_GPIO46INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGF_GPIO46INTD_INTHL            0x08000000
+
+// GPIO46 output configuration.
+#define AM_REG_GPIO_CFGF_GPIO46OUTCFG_S              25
+#define AM_REG_GPIO_CFGF_GPIO46OUTCFG_M              0x06000000
+#define AM_REG_GPIO_CFGF_GPIO46OUTCFG(n)             (((uint32_t)(n) << 25) & 0x06000000)
+#define AM_REG_GPIO_CFGF_GPIO46OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGF_GPIO46OUTCFG_PUSHPULL       0x02000000
+#define AM_REG_GPIO_CFGF_GPIO46OUTCFG_OD             0x04000000
+#define AM_REG_GPIO_CFGF_GPIO46OUTCFG_TS             0x06000000
+
+// GPIO46 input enable.
+#define AM_REG_GPIO_CFGF_GPIO46INCFG_S               24
+#define AM_REG_GPIO_CFGF_GPIO46INCFG_M               0x01000000
+#define AM_REG_GPIO_CFGF_GPIO46INCFG(n)              (((uint32_t)(n) << 24) & 0x01000000)
+#define AM_REG_GPIO_CFGF_GPIO46INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGF_GPIO46INCFG_RDZERO          0x01000000
+
+// GPIO45 interrupt direction.
+#define AM_REG_GPIO_CFGF_GPIO45INTD_S                23
+#define AM_REG_GPIO_CFGF_GPIO45INTD_M                0x00800000
+#define AM_REG_GPIO_CFGF_GPIO45INTD(n)               (((uint32_t)(n) << 23) & 0x00800000)
+#define AM_REG_GPIO_CFGF_GPIO45INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGF_GPIO45INTD_INTHL            0x00800000
+
+// GPIO45 output configuration.
+#define AM_REG_GPIO_CFGF_GPIO45OUTCFG_S              21
+#define AM_REG_GPIO_CFGF_GPIO45OUTCFG_M              0x00600000
+#define AM_REG_GPIO_CFGF_GPIO45OUTCFG(n)             (((uint32_t)(n) << 21) & 0x00600000)
+#define AM_REG_GPIO_CFGF_GPIO45OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGF_GPIO45OUTCFG_PUSHPULL       0x00200000
+#define AM_REG_GPIO_CFGF_GPIO45OUTCFG_OD             0x00400000
+#define AM_REG_GPIO_CFGF_GPIO45OUTCFG_TS             0x00600000
+
+// GPIO45 input enable.
+#define AM_REG_GPIO_CFGF_GPIO45INCFG_S               20
+#define AM_REG_GPIO_CFGF_GPIO45INCFG_M               0x00100000
+#define AM_REG_GPIO_CFGF_GPIO45INCFG(n)              (((uint32_t)(n) << 20) & 0x00100000)
+#define AM_REG_GPIO_CFGF_GPIO45INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGF_GPIO45INCFG_RDZERO          0x00100000
+
+// GPIO44 interrupt direction.
+#define AM_REG_GPIO_CFGF_GPIO44INTD_S                19
+#define AM_REG_GPIO_CFGF_GPIO44INTD_M                0x00080000
+#define AM_REG_GPIO_CFGF_GPIO44INTD(n)               (((uint32_t)(n) << 19) & 0x00080000)
+#define AM_REG_GPIO_CFGF_GPIO44INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGF_GPIO44INTD_INTHL            0x00080000
+
+// GPIO44 output configuration.
+#define AM_REG_GPIO_CFGF_GPIO44OUTCFG_S              17
+#define AM_REG_GPIO_CFGF_GPIO44OUTCFG_M              0x00060000
+#define AM_REG_GPIO_CFGF_GPIO44OUTCFG(n)             (((uint32_t)(n) << 17) & 0x00060000)
+#define AM_REG_GPIO_CFGF_GPIO44OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGF_GPIO44OUTCFG_PUSHPULL       0x00020000
+#define AM_REG_GPIO_CFGF_GPIO44OUTCFG_OD             0x00040000
+#define AM_REG_GPIO_CFGF_GPIO44OUTCFG_TS             0x00060000
+
+// GPIO44 input enable.
+#define AM_REG_GPIO_CFGF_GPIO44INCFG_S               16
+#define AM_REG_GPIO_CFGF_GPIO44INCFG_M               0x00010000
+#define AM_REG_GPIO_CFGF_GPIO44INCFG(n)              (((uint32_t)(n) << 16) & 0x00010000)
+#define AM_REG_GPIO_CFGF_GPIO44INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGF_GPIO44INCFG_RDZERO          0x00010000
+
+// GPIO43 interrupt direction.
+#define AM_REG_GPIO_CFGF_GPIO43INTD_S                15
+#define AM_REG_GPIO_CFGF_GPIO43INTD_M                0x00008000
+#define AM_REG_GPIO_CFGF_GPIO43INTD(n)               (((uint32_t)(n) << 15) & 0x00008000)
+#define AM_REG_GPIO_CFGF_GPIO43INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGF_GPIO43INTD_INTHL            0x00008000
+
+// GPIO43 output configuration.
+#define AM_REG_GPIO_CFGF_GPIO43OUTCFG_S              13
+#define AM_REG_GPIO_CFGF_GPIO43OUTCFG_M              0x00006000
+#define AM_REG_GPIO_CFGF_GPIO43OUTCFG(n)             (((uint32_t)(n) << 13) & 0x00006000)
+#define AM_REG_GPIO_CFGF_GPIO43OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGF_GPIO43OUTCFG_PUSHPULL       0x00002000
+#define AM_REG_GPIO_CFGF_GPIO43OUTCFG_OD             0x00004000
+#define AM_REG_GPIO_CFGF_GPIO43OUTCFG_TS             0x00006000
+
+// GPIO43 input enable.
+#define AM_REG_GPIO_CFGF_GPIO43INCFG_S               12
+#define AM_REG_GPIO_CFGF_GPIO43INCFG_M               0x00001000
+#define AM_REG_GPIO_CFGF_GPIO43INCFG(n)              (((uint32_t)(n) << 12) & 0x00001000)
+#define AM_REG_GPIO_CFGF_GPIO43INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGF_GPIO43INCFG_RDZERO          0x00001000
+
+// GPIO42 interrupt direction.
+#define AM_REG_GPIO_CFGF_GPIO42INTD_S                11
+#define AM_REG_GPIO_CFGF_GPIO42INTD_M                0x00000800
+#define AM_REG_GPIO_CFGF_GPIO42INTD(n)               (((uint32_t)(n) << 11) & 0x00000800)
+#define AM_REG_GPIO_CFGF_GPIO42INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGF_GPIO42INTD_INTHL            0x00000800
+
+// GPIO42 output configuration.
+#define AM_REG_GPIO_CFGF_GPIO42OUTCFG_S              9
+#define AM_REG_GPIO_CFGF_GPIO42OUTCFG_M              0x00000600
+#define AM_REG_GPIO_CFGF_GPIO42OUTCFG(n)             (((uint32_t)(n) << 9) & 0x00000600)
+#define AM_REG_GPIO_CFGF_GPIO42OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGF_GPIO42OUTCFG_PUSHPULL       0x00000200
+#define AM_REG_GPIO_CFGF_GPIO42OUTCFG_OD             0x00000400
+#define AM_REG_GPIO_CFGF_GPIO42OUTCFG_TS             0x00000600
+
+// GPIO42 input enable.
+#define AM_REG_GPIO_CFGF_GPIO42INCFG_S               8
+#define AM_REG_GPIO_CFGF_GPIO42INCFG_M               0x00000100
+#define AM_REG_GPIO_CFGF_GPIO42INCFG(n)              (((uint32_t)(n) << 8) & 0x00000100)
+#define AM_REG_GPIO_CFGF_GPIO42INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGF_GPIO42INCFG_RDZERO          0x00000100
+
+// GPIO41 interrupt direction.
+#define AM_REG_GPIO_CFGF_GPIO41INTD_S                7
+#define AM_REG_GPIO_CFGF_GPIO41INTD_M                0x00000080
+#define AM_REG_GPIO_CFGF_GPIO41INTD(n)               (((uint32_t)(n) << 7) & 0x00000080)
+#define AM_REG_GPIO_CFGF_GPIO41INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGF_GPIO41INTD_INTHL            0x00000080
+
+// GPIO41 output configuration.
+#define AM_REG_GPIO_CFGF_GPIO41OUTCFG_S              5
+#define AM_REG_GPIO_CFGF_GPIO41OUTCFG_M              0x00000060
+#define AM_REG_GPIO_CFGF_GPIO41OUTCFG(n)             (((uint32_t)(n) << 5) & 0x00000060)
+#define AM_REG_GPIO_CFGF_GPIO41OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGF_GPIO41OUTCFG_PUSHPULL       0x00000020
+#define AM_REG_GPIO_CFGF_GPIO41OUTCFG_OD             0x00000040
+#define AM_REG_GPIO_CFGF_GPIO41OUTCFG_TS             0x00000060
+
+// GPIO41 input enable.
+#define AM_REG_GPIO_CFGF_GPIO41INCFG_S               4
+#define AM_REG_GPIO_CFGF_GPIO41INCFG_M               0x00000010
+#define AM_REG_GPIO_CFGF_GPIO41INCFG(n)              (((uint32_t)(n) << 4) & 0x00000010)
+#define AM_REG_GPIO_CFGF_GPIO41INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGF_GPIO41INCFG_RDZERO          0x00000010
+
+// GPIO40 interrupt direction.
+#define AM_REG_GPIO_CFGF_GPIO40INTD_S                3
+#define AM_REG_GPIO_CFGF_GPIO40INTD_M                0x00000008
+#define AM_REG_GPIO_CFGF_GPIO40INTD(n)               (((uint32_t)(n) << 3) & 0x00000008)
+#define AM_REG_GPIO_CFGF_GPIO40INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGF_GPIO40INTD_INTHL            0x00000008
+
+// GPIO40 output configuration.
+#define AM_REG_GPIO_CFGF_GPIO40OUTCFG_S              1
+#define AM_REG_GPIO_CFGF_GPIO40OUTCFG_M              0x00000006
+#define AM_REG_GPIO_CFGF_GPIO40OUTCFG(n)             (((uint32_t)(n) << 1) & 0x00000006)
+#define AM_REG_GPIO_CFGF_GPIO40OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGF_GPIO40OUTCFG_PUSHPULL       0x00000002
+#define AM_REG_GPIO_CFGF_GPIO40OUTCFG_OD             0x00000004
+#define AM_REG_GPIO_CFGF_GPIO40OUTCFG_TS             0x00000006
+
+// GPIO40 input enable.
+#define AM_REG_GPIO_CFGF_GPIO40INCFG_S               0
+#define AM_REG_GPIO_CFGF_GPIO40INCFG_M               0x00000001
+#define AM_REG_GPIO_CFGF_GPIO40INCFG(n)              (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_GPIO_CFGF_GPIO40INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGF_GPIO40INCFG_RDZERO          0x00000001
+
+//*****************************************************************************
+//
+// GPIO_CFGG - GPIO Configuration Register G
+//
+//*****************************************************************************
+// GPIO49 interrupt direction.
+#define AM_REG_GPIO_CFGG_GPIO49INTD_S                7
+#define AM_REG_GPIO_CFGG_GPIO49INTD_M                0x00000080
+#define AM_REG_GPIO_CFGG_GPIO49INTD(n)               (((uint32_t)(n) << 7) & 0x00000080)
+#define AM_REG_GPIO_CFGG_GPIO49INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGG_GPIO49INTD_INTHL            0x00000080
+
+// GPIO49 output configuration.
+#define AM_REG_GPIO_CFGG_GPIO49OUTCFG_S              5
+#define AM_REG_GPIO_CFGG_GPIO49OUTCFG_M              0x00000060
+#define AM_REG_GPIO_CFGG_GPIO49OUTCFG(n)             (((uint32_t)(n) << 5) & 0x00000060)
+#define AM_REG_GPIO_CFGG_GPIO49OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGG_GPIO49OUTCFG_PUSHPULL       0x00000020
+#define AM_REG_GPIO_CFGG_GPIO49OUTCFG_OD             0x00000040
+#define AM_REG_GPIO_CFGG_GPIO49OUTCFG_TS             0x00000060
+
+// GPIO49 input enable.
+#define AM_REG_GPIO_CFGG_GPIO49INCFG_S               4
+#define AM_REG_GPIO_CFGG_GPIO49INCFG_M               0x00000010
+#define AM_REG_GPIO_CFGG_GPIO49INCFG(n)              (((uint32_t)(n) << 4) & 0x00000010)
+#define AM_REG_GPIO_CFGG_GPIO49INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGG_GPIO49INCFG_RDZERO          0x00000010
+
+// GPIO48 interrupt direction.
+#define AM_REG_GPIO_CFGG_GPIO48INTD_S                3
+#define AM_REG_GPIO_CFGG_GPIO48INTD_M                0x00000008
+#define AM_REG_GPIO_CFGG_GPIO48INTD(n)               (((uint32_t)(n) << 3) & 0x00000008)
+#define AM_REG_GPIO_CFGG_GPIO48INTD_INTLH            0x00000000
+#define AM_REG_GPIO_CFGG_GPIO48INTD_INTHL            0x00000008
+
+// GPIO48 output configuration.
+#define AM_REG_GPIO_CFGG_GPIO48OUTCFG_S              1
+#define AM_REG_GPIO_CFGG_GPIO48OUTCFG_M              0x00000006
+#define AM_REG_GPIO_CFGG_GPIO48OUTCFG(n)             (((uint32_t)(n) << 1) & 0x00000006)
+#define AM_REG_GPIO_CFGG_GPIO48OUTCFG_DIS            0x00000000
+#define AM_REG_GPIO_CFGG_GPIO48OUTCFG_PUSHPULL       0x00000002
+#define AM_REG_GPIO_CFGG_GPIO48OUTCFG_OD             0x00000004
+#define AM_REG_GPIO_CFGG_GPIO48OUTCFG_TS             0x00000006
+
+// GPIO48 input enable.
+#define AM_REG_GPIO_CFGG_GPIO48INCFG_S               0
+#define AM_REG_GPIO_CFGG_GPIO48INCFG_M               0x00000001
+#define AM_REG_GPIO_CFGG_GPIO48INCFG(n)              (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_GPIO_CFGG_GPIO48INCFG_READ            0x00000000
+#define AM_REG_GPIO_CFGG_GPIO48INCFG_RDZERO          0x00000001
+
+//*****************************************************************************
+//
+// GPIO_RDA - GPIO Input Register A
+//
+//*****************************************************************************
+// GPIO31-0 read data.
+#define AM_REG_GPIO_RDA_RDA_S                        0
+#define AM_REG_GPIO_RDA_RDA_M                        0xFFFFFFFF
+#define AM_REG_GPIO_RDA_RDA(n)                       (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// GPIO_RDB - GPIO Input Register B
+//
+//*****************************************************************************
+// GPIO49-32 read data.
+#define AM_REG_GPIO_RDB_RDB_S                        0
+#define AM_REG_GPIO_RDB_RDB_M                        0x0003FFFF
+#define AM_REG_GPIO_RDB_RDB(n)                       (((uint32_t)(n) << 0) & 0x0003FFFF)
+
+//*****************************************************************************
+//
+// GPIO_WTA - GPIO Output Register A
+//
+//*****************************************************************************
+// GPIO31-0 write data.
+#define AM_REG_GPIO_WTA_WTA_S                        0
+#define AM_REG_GPIO_WTA_WTA_M                        0xFFFFFFFF
+#define AM_REG_GPIO_WTA_WTA(n)                       (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// GPIO_WTB - GPIO Output Register B
+//
+//*****************************************************************************
+// GPIO49-32 write data.
+#define AM_REG_GPIO_WTB_WTB_S                        0
+#define AM_REG_GPIO_WTB_WTB_M                        0x0003FFFF
+#define AM_REG_GPIO_WTB_WTB(n)                       (((uint32_t)(n) << 0) & 0x0003FFFF)
+
+//*****************************************************************************
+//
+// GPIO_WTSA - GPIO Output Register A Set
+//
+//*****************************************************************************
+// Set the GPIO31-0 write data.
+#define AM_REG_GPIO_WTSA_WTSA_S                      0
+#define AM_REG_GPIO_WTSA_WTSA_M                      0xFFFFFFFF
+#define AM_REG_GPIO_WTSA_WTSA(n)                     (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// GPIO_WTSB - GPIO Output Register B Set
+//
+//*****************************************************************************
+// Set the GPIO49-32 write data.
+#define AM_REG_GPIO_WTSB_WTSB_S                      0
+#define AM_REG_GPIO_WTSB_WTSB_M                      0x0003FFFF
+#define AM_REG_GPIO_WTSB_WTSB(n)                     (((uint32_t)(n) << 0) & 0x0003FFFF)
+
+//*****************************************************************************
+//
+// GPIO_WTCA - GPIO Output Register A Clear
+//
+//*****************************************************************************
+// Clear the GPIO31-0 write data.
+#define AM_REG_GPIO_WTCA_WTCA_S                      0
+#define AM_REG_GPIO_WTCA_WTCA_M                      0xFFFFFFFF
+#define AM_REG_GPIO_WTCA_WTCA(n)                     (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// GPIO_WTCB - GPIO Output Register B Clear
+//
+//*****************************************************************************
+// Clear the GPIO49-32 write data.
+#define AM_REG_GPIO_WTCB_WTCB_S                      0
+#define AM_REG_GPIO_WTCB_WTCB_M                      0x0003FFFF
+#define AM_REG_GPIO_WTCB_WTCB(n)                     (((uint32_t)(n) << 0) & 0x0003FFFF)
+
+//*****************************************************************************
+//
+// GPIO_ENA - GPIO Enable Register A
+//
+//*****************************************************************************
+// GPIO31-0 output enables
+#define AM_REG_GPIO_ENA_ENA_S                        0
+#define AM_REG_GPIO_ENA_ENA_M                        0xFFFFFFFF
+#define AM_REG_GPIO_ENA_ENA(n)                       (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// GPIO_ENB - GPIO Enable Register B
+//
+//*****************************************************************************
+// GPIO49-32 output enables
+#define AM_REG_GPIO_ENB_ENB_S                        0
+#define AM_REG_GPIO_ENB_ENB_M                        0x0003FFFF
+#define AM_REG_GPIO_ENB_ENB(n)                       (((uint32_t)(n) << 0) & 0x0003FFFF)
+
+//*****************************************************************************
+//
+// GPIO_ENSA - GPIO Enable Register A Set
+//
+//*****************************************************************************
+// Set the GPIO31-0 output enables
+#define AM_REG_GPIO_ENSA_ENSA_S                      0
+#define AM_REG_GPIO_ENSA_ENSA_M                      0xFFFFFFFF
+#define AM_REG_GPIO_ENSA_ENSA(n)                     (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// GPIO_ENSB - GPIO Enable Register B Set
+//
+//*****************************************************************************
+// Set the GPIO49-32 output enables
+#define AM_REG_GPIO_ENSB_ENSB_S                      0
+#define AM_REG_GPIO_ENSB_ENSB_M                      0x0003FFFF
+#define AM_REG_GPIO_ENSB_ENSB(n)                     (((uint32_t)(n) << 0) & 0x0003FFFF)
+
+//*****************************************************************************
+//
+// GPIO_ENCA - GPIO Enable Register A Clear
+//
+//*****************************************************************************
+// Clear the GPIO31-0 output enables
+#define AM_REG_GPIO_ENCA_ENCA_S                      0
+#define AM_REG_GPIO_ENCA_ENCA_M                      0xFFFFFFFF
+#define AM_REG_GPIO_ENCA_ENCA(n)                     (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// GPIO_ENCB - GPIO Enable Register B Clear
+//
+//*****************************************************************************
+// Clear the GPIO49-32 output enables
+#define AM_REG_GPIO_ENCB_ENCB_S                      0
+#define AM_REG_GPIO_ENCB_ENCB_M                      0x0003FFFF
+#define AM_REG_GPIO_ENCB_ENCB(n)                     (((uint32_t)(n) << 0) & 0x0003FFFF)
+
+//*****************************************************************************
+//
+// GPIO_STMRCAP - STIMER Capture Control
+//
+//*****************************************************************************
+// STIMER Capture 3 Polarity.
+#define AM_REG_GPIO_STMRCAP_STPOL3_S                 30
+#define AM_REG_GPIO_STMRCAP_STPOL3_M                 0x40000000
+#define AM_REG_GPIO_STMRCAP_STPOL3(n)                (((uint32_t)(n) << 30) & 0x40000000)
+#define AM_REG_GPIO_STMRCAP_STPOL3_CAPLH             0x00000000
+#define AM_REG_GPIO_STMRCAP_STPOL3_CAPHL             0x40000000
+
+// STIMER Capture 3 Select.
+#define AM_REG_GPIO_STMRCAP_STSEL3_S                 24
+#define AM_REG_GPIO_STMRCAP_STSEL3_M                 0x3F000000
+#define AM_REG_GPIO_STMRCAP_STSEL3(n)                (((uint32_t)(n) << 24) & 0x3F000000)
+
+// STIMER Capture 2 Polarity.
+#define AM_REG_GPIO_STMRCAP_STPOL2_S                 22
+#define AM_REG_GPIO_STMRCAP_STPOL2_M                 0x00400000
+#define AM_REG_GPIO_STMRCAP_STPOL2(n)                (((uint32_t)(n) << 22) & 0x00400000)
+#define AM_REG_GPIO_STMRCAP_STPOL2_CAPLH             0x00000000
+#define AM_REG_GPIO_STMRCAP_STPOL2_CAPHL             0x00400000
+
+// STIMER Capture 2 Select.
+#define AM_REG_GPIO_STMRCAP_STSEL2_S                 16
+#define AM_REG_GPIO_STMRCAP_STSEL2_M                 0x003F0000
+#define AM_REG_GPIO_STMRCAP_STSEL2(n)                (((uint32_t)(n) << 16) & 0x003F0000)
+
+// STIMER Capture 1 Polarity.
+#define AM_REG_GPIO_STMRCAP_STPOL1_S                 14
+#define AM_REG_GPIO_STMRCAP_STPOL1_M                 0x00004000
+#define AM_REG_GPIO_STMRCAP_STPOL1(n)                (((uint32_t)(n) << 14) & 0x00004000)
+#define AM_REG_GPIO_STMRCAP_STPOL1_CAPLH             0x00000000
+#define AM_REG_GPIO_STMRCAP_STPOL1_CAPHL             0x00004000
+
+// STIMER Capture 1 Select.
+#define AM_REG_GPIO_STMRCAP_STSEL1_S                 8
+#define AM_REG_GPIO_STMRCAP_STSEL1_M                 0x00003F00
+#define AM_REG_GPIO_STMRCAP_STSEL1(n)                (((uint32_t)(n) << 8) & 0x00003F00)
+
+// STIMER Capture 0 Polarity.
+#define AM_REG_GPIO_STMRCAP_STPOL0_S                 6
+#define AM_REG_GPIO_STMRCAP_STPOL0_M                 0x00000040
+#define AM_REG_GPIO_STMRCAP_STPOL0(n)                (((uint32_t)(n) << 6) & 0x00000040)
+#define AM_REG_GPIO_STMRCAP_STPOL0_CAPLH             0x00000000
+#define AM_REG_GPIO_STMRCAP_STPOL0_CAPHL             0x00000040
+
+// STIMER Capture 0 Select.
+#define AM_REG_GPIO_STMRCAP_STSEL0_S                 0
+#define AM_REG_GPIO_STMRCAP_STSEL0_M                 0x0000003F
+#define AM_REG_GPIO_STMRCAP_STSEL0(n)                (((uint32_t)(n) << 0) & 0x0000003F)
+
+//*****************************************************************************
+//
+// GPIO_IOM0IRQ - IOM0 Flow Control IRQ Select
+//
+//*****************************************************************************
+// IOMSTR0 IRQ pad select.
+#define AM_REG_GPIO_IOM0IRQ_IOM0IRQ_S                0
+#define AM_REG_GPIO_IOM0IRQ_IOM0IRQ_M                0x0000003F
+#define AM_REG_GPIO_IOM0IRQ_IOM0IRQ(n)               (((uint32_t)(n) << 0) & 0x0000003F)
+
+//*****************************************************************************
+//
+// GPIO_IOM1IRQ - IOM1 Flow Control IRQ Select
+//
+//*****************************************************************************
+// IOMSTR1 IRQ pad select.
+#define AM_REG_GPIO_IOM1IRQ_IOM1IRQ_S                0
+#define AM_REG_GPIO_IOM1IRQ_IOM1IRQ_M                0x0000003F
+#define AM_REG_GPIO_IOM1IRQ_IOM1IRQ(n)               (((uint32_t)(n) << 0) & 0x0000003F)
+
+//*****************************************************************************
+//
+// GPIO_IOM2IRQ - IOM2 Flow Control IRQ Select
+//
+//*****************************************************************************
+// IOMSTR2 IRQ pad select.
+#define AM_REG_GPIO_IOM2IRQ_IOM2IRQ_S                0
+#define AM_REG_GPIO_IOM2IRQ_IOM2IRQ_M                0x0000003F
+#define AM_REG_GPIO_IOM2IRQ_IOM2IRQ(n)               (((uint32_t)(n) << 0) & 0x0000003F)
+
+//*****************************************************************************
+//
+// GPIO_IOM3IRQ - IOM3 Flow Control IRQ Select
+//
+//*****************************************************************************
+// IOMSTR3 IRQ pad select.
+#define AM_REG_GPIO_IOM3IRQ_IOM3IRQ_S                0
+#define AM_REG_GPIO_IOM3IRQ_IOM3IRQ_M                0x0000003F
+#define AM_REG_GPIO_IOM3IRQ_IOM3IRQ(n)               (((uint32_t)(n) << 0) & 0x0000003F)
+
+//*****************************************************************************
+//
+// GPIO_IOM4IRQ - IOM4 Flow Control IRQ Select
+//
+//*****************************************************************************
+// IOMSTR4 IRQ pad select.
+#define AM_REG_GPIO_IOM4IRQ_IOM4IRQ_S                0
+#define AM_REG_GPIO_IOM4IRQ_IOM4IRQ_M                0x0000003F
+#define AM_REG_GPIO_IOM4IRQ_IOM4IRQ(n)               (((uint32_t)(n) << 0) & 0x0000003F)
+
+//*****************************************************************************
+//
+// GPIO_IOM5IRQ - IOM5 Flow Control IRQ Select
+//
+//*****************************************************************************
+// IOMSTR5 IRQ pad select.
+#define AM_REG_GPIO_IOM5IRQ_IOM5IRQ_S                0
+#define AM_REG_GPIO_IOM5IRQ_IOM5IRQ_M                0x0000003F
+#define AM_REG_GPIO_IOM5IRQ_IOM5IRQ(n)               (((uint32_t)(n) << 0) & 0x0000003F)
+
+//*****************************************************************************
+//
+// GPIO_LOOPBACK - IOM to IOS Loopback Control
+//
+//*****************************************************************************
+// IOM to IOS loopback control.
+#define AM_REG_GPIO_LOOPBACK_LOOPBACK_S              0
+#define AM_REG_GPIO_LOOPBACK_LOOPBACK_M              0x00000007
+#define AM_REG_GPIO_LOOPBACK_LOOPBACK(n)             (((uint32_t)(n) << 0) & 0x00000007)
+#define AM_REG_GPIO_LOOPBACK_LOOPBACK_LOOP0          0x00000000
+#define AM_REG_GPIO_LOOPBACK_LOOPBACK_LOOP1          0x00000001
+#define AM_REG_GPIO_LOOPBACK_LOOPBACK_LOOP2          0x00000002
+#define AM_REG_GPIO_LOOPBACK_LOOPBACK_LOOP3          0x00000003
+#define AM_REG_GPIO_LOOPBACK_LOOPBACK_LOOP4          0x00000004
+#define AM_REG_GPIO_LOOPBACK_LOOPBACK_LOOP5          0x00000005
+#define AM_REG_GPIO_LOOPBACK_LOOPBACK_LOOPNONE       0x00000006
+
+//*****************************************************************************
+//
+// GPIO_GPIOOBS - GPIO Observation Mode Sample register
+//
+//*****************************************************************************
+// Sample of the data output on the GPIO observation port.  May have async
+// sampling issues, as the data is not synronized to the read operation.
+// Intended for debug purposes only
+#define AM_REG_GPIO_GPIOOBS_OBS_DATA_S               0
+#define AM_REG_GPIO_GPIOOBS_OBS_DATA_M               0x0000FFFF
+#define AM_REG_GPIO_GPIOOBS_OBS_DATA(n)              (((uint32_t)(n) << 0) & 0x0000FFFF)
+
+//*****************************************************************************
+//
+// GPIO_ALTPADCFGA - Alternate Pad Configuration reg0 (Pads 3,2,1,0)
+//
+//*****************************************************************************
+// Pad 3 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGA_PAD3_SR_S             28
+#define AM_REG_GPIO_ALTPADCFGA_PAD3_SR_M             0x10000000
+#define AM_REG_GPIO_ALTPADCFGA_PAD3_SR(n)            (((uint32_t)(n) << 28) & 0x10000000)
+#define AM_REG_GPIO_ALTPADCFGA_PAD3_SR_SR_EN         0x10000000
+
+// Pad 3 high order drive strength selection.  Used in conjunction with
+// PAD3STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGA_PAD3_DS1_S            24
+#define AM_REG_GPIO_ALTPADCFGA_PAD3_DS1_M            0x01000000
+#define AM_REG_GPIO_ALTPADCFGA_PAD3_DS1(n)           (((uint32_t)(n) << 24) & 0x01000000)
+
+// Pad 2 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGA_PAD2_SR_S             20
+#define AM_REG_GPIO_ALTPADCFGA_PAD2_SR_M             0x00100000
+#define AM_REG_GPIO_ALTPADCFGA_PAD2_SR(n)            (((uint32_t)(n) << 20) & 0x00100000)
+#define AM_REG_GPIO_ALTPADCFGA_PAD2_SR_SR_EN         0x00100000
+
+// Pad 2 high order drive strength selection.  Used in conjunction with
+// PAD2STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGA_PAD2_DS1_S            16
+#define AM_REG_GPIO_ALTPADCFGA_PAD2_DS1_M            0x00010000
+#define AM_REG_GPIO_ALTPADCFGA_PAD2_DS1(n)           (((uint32_t)(n) << 16) & 0x00010000)
+
+// Pad 1 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGA_PAD1_SR_S             12
+#define AM_REG_GPIO_ALTPADCFGA_PAD1_SR_M             0x00001000
+#define AM_REG_GPIO_ALTPADCFGA_PAD1_SR(n)            (((uint32_t)(n) << 12) & 0x00001000)
+#define AM_REG_GPIO_ALTPADCFGA_PAD1_SR_SR_EN         0x00001000
+
+// Pad 1 high order drive strength selection.  Used in conjunction with
+// PAD1STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGA_PAD1_DS1_S            8
+#define AM_REG_GPIO_ALTPADCFGA_PAD1_DS1_M            0x00000100
+#define AM_REG_GPIO_ALTPADCFGA_PAD1_DS1(n)           (((uint32_t)(n) << 8) & 0x00000100)
+
+// Pad 0 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGA_PAD0_SR_S             4
+#define AM_REG_GPIO_ALTPADCFGA_PAD0_SR_M             0x00000010
+#define AM_REG_GPIO_ALTPADCFGA_PAD0_SR(n)            (((uint32_t)(n) << 4) & 0x00000010)
+#define AM_REG_GPIO_ALTPADCFGA_PAD0_SR_SR_EN         0x00000010
+
+// Pad 0 high order drive strength selection.  Used in conjunction with
+// PAD0STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGA_PAD0_DS1_S            0
+#define AM_REG_GPIO_ALTPADCFGA_PAD0_DS1_M            0x00000001
+#define AM_REG_GPIO_ALTPADCFGA_PAD0_DS1(n)           (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// GPIO_ALTPADCFGB - Alternate Pad Configuration reg1 (Pads 7,6,5,4)
+//
+//*****************************************************************************
+// Pad 7 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGB_PAD7_SR_S             28
+#define AM_REG_GPIO_ALTPADCFGB_PAD7_SR_M             0x10000000
+#define AM_REG_GPIO_ALTPADCFGB_PAD7_SR(n)            (((uint32_t)(n) << 28) & 0x10000000)
+#define AM_REG_GPIO_ALTPADCFGB_PAD7_SR_SR_EN         0x10000000
+
+// Pad 7 high order drive strength selection.  Used in conjunction with
+// PAD7STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGB_PAD7_DS1_S            24
+#define AM_REG_GPIO_ALTPADCFGB_PAD7_DS1_M            0x01000000
+#define AM_REG_GPIO_ALTPADCFGB_PAD7_DS1(n)           (((uint32_t)(n) << 24) & 0x01000000)
+
+// Pad 6 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGB_PAD6_SR_S             20
+#define AM_REG_GPIO_ALTPADCFGB_PAD6_SR_M             0x00100000
+#define AM_REG_GPIO_ALTPADCFGB_PAD6_SR(n)            (((uint32_t)(n) << 20) & 0x00100000)
+#define AM_REG_GPIO_ALTPADCFGB_PAD6_SR_SR_EN         0x00100000
+
+// Pad 6 high order drive strength selection.  Used in conjunction with
+// PAD6STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGB_PAD6_DS1_S            16
+#define AM_REG_GPIO_ALTPADCFGB_PAD6_DS1_M            0x00010000
+#define AM_REG_GPIO_ALTPADCFGB_PAD6_DS1(n)           (((uint32_t)(n) << 16) & 0x00010000)
+
+// Pad 5 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGB_PAD5_SR_S             12
+#define AM_REG_GPIO_ALTPADCFGB_PAD5_SR_M             0x00001000
+#define AM_REG_GPIO_ALTPADCFGB_PAD5_SR(n)            (((uint32_t)(n) << 12) & 0x00001000)
+#define AM_REG_GPIO_ALTPADCFGB_PAD5_SR_SR_EN         0x00001000
+
+// Pad 5 high order drive strength selection.  Used in conjunction with
+// PAD5STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGB_PAD5_DS1_S            8
+#define AM_REG_GPIO_ALTPADCFGB_PAD5_DS1_M            0x00000100
+#define AM_REG_GPIO_ALTPADCFGB_PAD5_DS1(n)           (((uint32_t)(n) << 8) & 0x00000100)
+
+// Pad 4 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGB_PAD4_SR_S             4
+#define AM_REG_GPIO_ALTPADCFGB_PAD4_SR_M             0x00000010
+#define AM_REG_GPIO_ALTPADCFGB_PAD4_SR(n)            (((uint32_t)(n) << 4) & 0x00000010)
+#define AM_REG_GPIO_ALTPADCFGB_PAD4_SR_SR_EN         0x00000010
+
+// Pad 4 high order drive strength selection.  Used in conjunction with
+// PAD4STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGB_PAD4_DS1_S            0
+#define AM_REG_GPIO_ALTPADCFGB_PAD4_DS1_M            0x00000001
+#define AM_REG_GPIO_ALTPADCFGB_PAD4_DS1(n)           (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// GPIO_ALTPADCFGC - Alternate Pad Configuration reg2 (Pads 11,10,9,8)
+//
+//*****************************************************************************
+// Pad 11 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGC_PAD11_SR_S            28
+#define AM_REG_GPIO_ALTPADCFGC_PAD11_SR_M            0x10000000
+#define AM_REG_GPIO_ALTPADCFGC_PAD11_SR(n)           (((uint32_t)(n) << 28) & 0x10000000)
+#define AM_REG_GPIO_ALTPADCFGC_PAD11_SR_SR_EN        0x10000000
+
+// Pad 11 high order drive strength selection.  Used in conjunction with
+// PAD11STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGC_PAD11_DS1_S           24
+#define AM_REG_GPIO_ALTPADCFGC_PAD11_DS1_M           0x01000000
+#define AM_REG_GPIO_ALTPADCFGC_PAD11_DS1(n)          (((uint32_t)(n) << 24) & 0x01000000)
+
+// Pad 10 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGC_PAD10_SR_S            20
+#define AM_REG_GPIO_ALTPADCFGC_PAD10_SR_M            0x00100000
+#define AM_REG_GPIO_ALTPADCFGC_PAD10_SR(n)           (((uint32_t)(n) << 20) & 0x00100000)
+#define AM_REG_GPIO_ALTPADCFGC_PAD10_SR_SR_EN        0x00100000
+
+// Pad 10 high order drive strength selection.  Used in conjunction with
+// PAD10STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGC_PAD10_DS1_S           16
+#define AM_REG_GPIO_ALTPADCFGC_PAD10_DS1_M           0x00010000
+#define AM_REG_GPIO_ALTPADCFGC_PAD10_DS1(n)          (((uint32_t)(n) << 16) & 0x00010000)
+
+// Pad 9 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGC_PAD9_SR_S             12
+#define AM_REG_GPIO_ALTPADCFGC_PAD9_SR_M             0x00001000
+#define AM_REG_GPIO_ALTPADCFGC_PAD9_SR(n)            (((uint32_t)(n) << 12) & 0x00001000)
+#define AM_REG_GPIO_ALTPADCFGC_PAD9_SR_SR_EN         0x00001000
+
+// Pad 9 high order drive strength selection.  Used in conjunction with
+// PAD9STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGC_PAD9_DS1_S            8
+#define AM_REG_GPIO_ALTPADCFGC_PAD9_DS1_M            0x00000100
+#define AM_REG_GPIO_ALTPADCFGC_PAD9_DS1(n)           (((uint32_t)(n) << 8) & 0x00000100)
+
+// Pad 8 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGC_PAD8_SR_S             4
+#define AM_REG_GPIO_ALTPADCFGC_PAD8_SR_M             0x00000010
+#define AM_REG_GPIO_ALTPADCFGC_PAD8_SR(n)            (((uint32_t)(n) << 4) & 0x00000010)
+#define AM_REG_GPIO_ALTPADCFGC_PAD8_SR_SR_EN         0x00000010
+
+// Pad 8 high order drive strength selection.  Used in conjunction with
+// PAD8STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGC_PAD8_DS1_S            0
+#define AM_REG_GPIO_ALTPADCFGC_PAD8_DS1_M            0x00000001
+#define AM_REG_GPIO_ALTPADCFGC_PAD8_DS1(n)           (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// GPIO_ALTPADCFGD - Alternate Pad Configuration reg3 (Pads 15,14,13,12)
+//
+//*****************************************************************************
+// Pad 15 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGD_PAD15_SR_S            28
+#define AM_REG_GPIO_ALTPADCFGD_PAD15_SR_M            0x10000000
+#define AM_REG_GPIO_ALTPADCFGD_PAD15_SR(n)           (((uint32_t)(n) << 28) & 0x10000000)
+#define AM_REG_GPIO_ALTPADCFGD_PAD15_SR_SR_EN        0x10000000
+
+// Pad 15 high order drive strength selection.  Used in conjunction with
+// PAD15STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGD_PAD15_DS1_S           24
+#define AM_REG_GPIO_ALTPADCFGD_PAD15_DS1_M           0x01000000
+#define AM_REG_GPIO_ALTPADCFGD_PAD15_DS1(n)          (((uint32_t)(n) << 24) & 0x01000000)
+
+// Pad 14 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGD_PAD14_SR_S            20
+#define AM_REG_GPIO_ALTPADCFGD_PAD14_SR_M            0x00100000
+#define AM_REG_GPIO_ALTPADCFGD_PAD14_SR(n)           (((uint32_t)(n) << 20) & 0x00100000)
+#define AM_REG_GPIO_ALTPADCFGD_PAD14_SR_SR_EN        0x00100000
+
+// Pad 14 high order drive strength selection.  Used in conjunction with
+// PAD14STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGD_PAD14_DS1_S           16
+#define AM_REG_GPIO_ALTPADCFGD_PAD14_DS1_M           0x00010000
+#define AM_REG_GPIO_ALTPADCFGD_PAD14_DS1(n)          (((uint32_t)(n) << 16) & 0x00010000)
+
+// Pad 13 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGD_PAD13_SR_S            12
+#define AM_REG_GPIO_ALTPADCFGD_PAD13_SR_M            0x00001000
+#define AM_REG_GPIO_ALTPADCFGD_PAD13_SR(n)           (((uint32_t)(n) << 12) & 0x00001000)
+#define AM_REG_GPIO_ALTPADCFGD_PAD13_SR_SR_EN        0x00001000
+
+// Pad 13 high order drive strength selection.  Used in conjunction with
+// PAD13STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGD_PAD13_DS1_S           8
+#define AM_REG_GPIO_ALTPADCFGD_PAD13_DS1_M           0x00000100
+#define AM_REG_GPIO_ALTPADCFGD_PAD13_DS1(n)          (((uint32_t)(n) << 8) & 0x00000100)
+
+// Pad 12 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGD_PAD12_SR_S            4
+#define AM_REG_GPIO_ALTPADCFGD_PAD12_SR_M            0x00000010
+#define AM_REG_GPIO_ALTPADCFGD_PAD12_SR(n)           (((uint32_t)(n) << 4) & 0x00000010)
+#define AM_REG_GPIO_ALTPADCFGD_PAD12_SR_SR_EN        0x00000010
+
+// Pad 12 high order drive strength selection.  Used in conjunction with
+// PAD12STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGD_PAD12_DS1_S           0
+#define AM_REG_GPIO_ALTPADCFGD_PAD12_DS1_M           0x00000001
+#define AM_REG_GPIO_ALTPADCFGD_PAD12_DS1(n)          (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// GPIO_ALTPADCFGE - Alternate Pad Configuration reg4 (Pads 19,18,17,16)
+//
+//*****************************************************************************
+// Pad 19 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGE_PAD19_SR_S            28
+#define AM_REG_GPIO_ALTPADCFGE_PAD19_SR_M            0x10000000
+#define AM_REG_GPIO_ALTPADCFGE_PAD19_SR(n)           (((uint32_t)(n) << 28) & 0x10000000)
+#define AM_REG_GPIO_ALTPADCFGE_PAD19_SR_SR_EN        0x10000000
+
+// Pad 19 high order drive strength selection.  Used in conjunction with
+// PAD19STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGE_PAD19_DS1_S           24
+#define AM_REG_GPIO_ALTPADCFGE_PAD19_DS1_M           0x01000000
+#define AM_REG_GPIO_ALTPADCFGE_PAD19_DS1(n)          (((uint32_t)(n) << 24) & 0x01000000)
+
+// Pad 18 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGE_PAD18_SR_S            20
+#define AM_REG_GPIO_ALTPADCFGE_PAD18_SR_M            0x00100000
+#define AM_REG_GPIO_ALTPADCFGE_PAD18_SR(n)           (((uint32_t)(n) << 20) & 0x00100000)
+#define AM_REG_GPIO_ALTPADCFGE_PAD18_SR_SR_EN        0x00100000
+
+// Pad 18 high order drive strength selection.  Used in conjunction with
+// PAD18STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGE_PAD18_DS1_S           16
+#define AM_REG_GPIO_ALTPADCFGE_PAD18_DS1_M           0x00010000
+#define AM_REG_GPIO_ALTPADCFGE_PAD18_DS1(n)          (((uint32_t)(n) << 16) & 0x00010000)
+
+// Pad 17 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGE_PAD17_SR_S            12
+#define AM_REG_GPIO_ALTPADCFGE_PAD17_SR_M            0x00001000
+#define AM_REG_GPIO_ALTPADCFGE_PAD17_SR(n)           (((uint32_t)(n) << 12) & 0x00001000)
+#define AM_REG_GPIO_ALTPADCFGE_PAD17_SR_SR_EN        0x00001000
+
+// Pad 17 high order drive strength selection.  Used in conjunction with
+// PAD17STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGE_PAD17_DS1_S           8
+#define AM_REG_GPIO_ALTPADCFGE_PAD17_DS1_M           0x00000100
+#define AM_REG_GPIO_ALTPADCFGE_PAD17_DS1(n)          (((uint32_t)(n) << 8) & 0x00000100)
+
+// Pad 16 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGE_PAD16_SR_S            4
+#define AM_REG_GPIO_ALTPADCFGE_PAD16_SR_M            0x00000010
+#define AM_REG_GPIO_ALTPADCFGE_PAD16_SR(n)           (((uint32_t)(n) << 4) & 0x00000010)
+#define AM_REG_GPIO_ALTPADCFGE_PAD16_SR_SR_EN        0x00000010
+
+// Pad 16 high order drive strength selection.  Used in conjunction with
+// PAD16STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGE_PAD16_DS1_S           0
+#define AM_REG_GPIO_ALTPADCFGE_PAD16_DS1_M           0x00000001
+#define AM_REG_GPIO_ALTPADCFGE_PAD16_DS1(n)          (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// GPIO_ALTPADCFGF - Alternate Pad Configuration reg5 (Pads 23,22,21,20)
+//
+//*****************************************************************************
+// Pad 23 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGF_PAD23_SR_S            28
+#define AM_REG_GPIO_ALTPADCFGF_PAD23_SR_M            0x10000000
+#define AM_REG_GPIO_ALTPADCFGF_PAD23_SR(n)           (((uint32_t)(n) << 28) & 0x10000000)
+#define AM_REG_GPIO_ALTPADCFGF_PAD23_SR_SR_EN        0x10000000
+
+// Pad 23 high order drive strength selection.  Used in conjunction with
+// PAD23STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGF_PAD23_DS1_S           24
+#define AM_REG_GPIO_ALTPADCFGF_PAD23_DS1_M           0x01000000
+#define AM_REG_GPIO_ALTPADCFGF_PAD23_DS1(n)          (((uint32_t)(n) << 24) & 0x01000000)
+
+// Pad 22 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGF_PAD22_SR_S            20
+#define AM_REG_GPIO_ALTPADCFGF_PAD22_SR_M            0x00100000
+#define AM_REG_GPIO_ALTPADCFGF_PAD22_SR(n)           (((uint32_t)(n) << 20) & 0x00100000)
+#define AM_REG_GPIO_ALTPADCFGF_PAD22_SR_SR_EN        0x00100000
+
+// Pad 22 high order drive strength selection.  Used in conjunction with
+// PAD22STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGF_PAD22_DS1_S           16
+#define AM_REG_GPIO_ALTPADCFGF_PAD22_DS1_M           0x00010000
+#define AM_REG_GPIO_ALTPADCFGF_PAD22_DS1(n)          (((uint32_t)(n) << 16) & 0x00010000)
+
+// Pad 21 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGF_PAD21_SR_S            12
+#define AM_REG_GPIO_ALTPADCFGF_PAD21_SR_M            0x00001000
+#define AM_REG_GPIO_ALTPADCFGF_PAD21_SR(n)           (((uint32_t)(n) << 12) & 0x00001000)
+#define AM_REG_GPIO_ALTPADCFGF_PAD21_SR_SR_EN        0x00001000
+
+// Pad 21 high order drive strength selection.  Used in conjunction with
+// PAD21STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGF_PAD21_DS1_S           8
+#define AM_REG_GPIO_ALTPADCFGF_PAD21_DS1_M           0x00000100
+#define AM_REG_GPIO_ALTPADCFGF_PAD21_DS1(n)          (((uint32_t)(n) << 8) & 0x00000100)
+
+// Pad 20 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGF_PAD20_SR_S            4
+#define AM_REG_GPIO_ALTPADCFGF_PAD20_SR_M            0x00000010
+#define AM_REG_GPIO_ALTPADCFGF_PAD20_SR(n)           (((uint32_t)(n) << 4) & 0x00000010)
+#define AM_REG_GPIO_ALTPADCFGF_PAD20_SR_SR_EN        0x00000010
+
+// Pad 20 high order drive strength selection.  Used in conjunction with
+// PAD20STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGF_PAD20_DS1_S           0
+#define AM_REG_GPIO_ALTPADCFGF_PAD20_DS1_M           0x00000001
+#define AM_REG_GPIO_ALTPADCFGF_PAD20_DS1(n)          (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// GPIO_ALTPADCFGG - Alternate Pad Configuration reg6 (Pads 27,26,25,24)
+//
+//*****************************************************************************
+// Pad 27 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGG_PAD27_SR_S            28
+#define AM_REG_GPIO_ALTPADCFGG_PAD27_SR_M            0x10000000
+#define AM_REG_GPIO_ALTPADCFGG_PAD27_SR(n)           (((uint32_t)(n) << 28) & 0x10000000)
+#define AM_REG_GPIO_ALTPADCFGG_PAD27_SR_SR_EN        0x10000000
+
+// Pad 27 high order drive strength selection.  Used in conjunction with
+// PAD27STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGG_PAD27_DS1_S           24
+#define AM_REG_GPIO_ALTPADCFGG_PAD27_DS1_M           0x01000000
+#define AM_REG_GPIO_ALTPADCFGG_PAD27_DS1(n)          (((uint32_t)(n) << 24) & 0x01000000)
+
+// Pad 26 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGG_PAD26_SR_S            20
+#define AM_REG_GPIO_ALTPADCFGG_PAD26_SR_M            0x00100000
+#define AM_REG_GPIO_ALTPADCFGG_PAD26_SR(n)           (((uint32_t)(n) << 20) & 0x00100000)
+#define AM_REG_GPIO_ALTPADCFGG_PAD26_SR_SR_EN        0x00100000
+
+// Pad 26 high order drive strength selection.  Used in conjunction with
+// PAD26STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGG_PAD26_DS1_S           16
+#define AM_REG_GPIO_ALTPADCFGG_PAD26_DS1_M           0x00010000
+#define AM_REG_GPIO_ALTPADCFGG_PAD26_DS1(n)          (((uint32_t)(n) << 16) & 0x00010000)
+
+// Pad 25 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGG_PAD25_SR_S            12
+#define AM_REG_GPIO_ALTPADCFGG_PAD25_SR_M            0x00001000
+#define AM_REG_GPIO_ALTPADCFGG_PAD25_SR(n)           (((uint32_t)(n) << 12) & 0x00001000)
+#define AM_REG_GPIO_ALTPADCFGG_PAD25_SR_SR_EN        0x00001000
+
+// Pad 25 high order drive strength selection.  Used in conjunction with
+// PAD25STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGG_PAD25_DS1_S           8
+#define AM_REG_GPIO_ALTPADCFGG_PAD25_DS1_M           0x00000100
+#define AM_REG_GPIO_ALTPADCFGG_PAD25_DS1(n)          (((uint32_t)(n) << 8) & 0x00000100)
+
+// Pad 24 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGG_PAD24_SR_S            4
+#define AM_REG_GPIO_ALTPADCFGG_PAD24_SR_M            0x00000010
+#define AM_REG_GPIO_ALTPADCFGG_PAD24_SR(n)           (((uint32_t)(n) << 4) & 0x00000010)
+#define AM_REG_GPIO_ALTPADCFGG_PAD24_SR_SR_EN        0x00000010
+
+// Pad 24 high order drive strength selection.  Used in conjunction with
+// PAD24STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGG_PAD24_DS1_S           0
+#define AM_REG_GPIO_ALTPADCFGG_PAD24_DS1_M           0x00000001
+#define AM_REG_GPIO_ALTPADCFGG_PAD24_DS1(n)          (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// GPIO_ALTPADCFGH - Alternate Pad Configuration reg7 (Pads 31,30,29,28)
+//
+//*****************************************************************************
+// Pad 31 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGH_PAD31_SR_S            28
+#define AM_REG_GPIO_ALTPADCFGH_PAD31_SR_M            0x10000000
+#define AM_REG_GPIO_ALTPADCFGH_PAD31_SR(n)           (((uint32_t)(n) << 28) & 0x10000000)
+#define AM_REG_GPIO_ALTPADCFGH_PAD31_SR_SR_EN        0x10000000
+
+// Pad 31 high order drive strength selection.  Used in conjunction with
+// PAD31STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGH_PAD31_DS1_S           24
+#define AM_REG_GPIO_ALTPADCFGH_PAD31_DS1_M           0x01000000
+#define AM_REG_GPIO_ALTPADCFGH_PAD31_DS1(n)          (((uint32_t)(n) << 24) & 0x01000000)
+
+// Pad 30 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGH_PAD30_SR_S            20
+#define AM_REG_GPIO_ALTPADCFGH_PAD30_SR_M            0x00100000
+#define AM_REG_GPIO_ALTPADCFGH_PAD30_SR(n)           (((uint32_t)(n) << 20) & 0x00100000)
+#define AM_REG_GPIO_ALTPADCFGH_PAD30_SR_SR_EN        0x00100000
+
+// Pad 30 high order drive strength selection.  Used in conjunction with
+// PAD30STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGH_PAD30_DS1_S           16
+#define AM_REG_GPIO_ALTPADCFGH_PAD30_DS1_M           0x00010000
+#define AM_REG_GPIO_ALTPADCFGH_PAD30_DS1(n)          (((uint32_t)(n) << 16) & 0x00010000)
+
+// Pad 29 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGH_PAD29_SR_S            12
+#define AM_REG_GPIO_ALTPADCFGH_PAD29_SR_M            0x00001000
+#define AM_REG_GPIO_ALTPADCFGH_PAD29_SR(n)           (((uint32_t)(n) << 12) & 0x00001000)
+#define AM_REG_GPIO_ALTPADCFGH_PAD29_SR_SR_EN        0x00001000
+
+// Pad 29 high order drive strength selection.  Used in conjunction with
+// PAD29STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGH_PAD29_DS1_S           8
+#define AM_REG_GPIO_ALTPADCFGH_PAD29_DS1_M           0x00000100
+#define AM_REG_GPIO_ALTPADCFGH_PAD29_DS1(n)          (((uint32_t)(n) << 8) & 0x00000100)
+
+// Pad 28 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGH_PAD28_SR_S            4
+#define AM_REG_GPIO_ALTPADCFGH_PAD28_SR_M            0x00000010
+#define AM_REG_GPIO_ALTPADCFGH_PAD28_SR(n)           (((uint32_t)(n) << 4) & 0x00000010)
+#define AM_REG_GPIO_ALTPADCFGH_PAD28_SR_SR_EN        0x00000010
+
+// Pad 28 high order drive strength selection.  Used in conjunction with
+// PAD28STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGH_PAD28_DS1_S           0
+#define AM_REG_GPIO_ALTPADCFGH_PAD28_DS1_M           0x00000001
+#define AM_REG_GPIO_ALTPADCFGH_PAD28_DS1(n)          (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// GPIO_ALTPADCFGI - Alternate Pad Configuration reg8 (Pads 35,34,33,32)
+//
+//*****************************************************************************
+// Pad 35 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGI_PAD35_SR_S            28
+#define AM_REG_GPIO_ALTPADCFGI_PAD35_SR_M            0x10000000
+#define AM_REG_GPIO_ALTPADCFGI_PAD35_SR(n)           (((uint32_t)(n) << 28) & 0x10000000)
+#define AM_REG_GPIO_ALTPADCFGI_PAD35_SR_SR_EN        0x10000000
+
+// Pad 35 high order drive strength selection.  Used in conjunction with
+// PAD35STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGI_PAD35_DS1_S           24
+#define AM_REG_GPIO_ALTPADCFGI_PAD35_DS1_M           0x01000000
+#define AM_REG_GPIO_ALTPADCFGI_PAD35_DS1(n)          (((uint32_t)(n) << 24) & 0x01000000)
+
+// Pad 34 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGI_PAD34_SR_S            20
+#define AM_REG_GPIO_ALTPADCFGI_PAD34_SR_M            0x00100000
+#define AM_REG_GPIO_ALTPADCFGI_PAD34_SR(n)           (((uint32_t)(n) << 20) & 0x00100000)
+#define AM_REG_GPIO_ALTPADCFGI_PAD34_SR_SR_EN        0x00100000
+
+// Pad 34 high order drive strength selection.  Used in conjunction with
+// PAD34STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGI_PAD34_DS1_S           16
+#define AM_REG_GPIO_ALTPADCFGI_PAD34_DS1_M           0x00010000
+#define AM_REG_GPIO_ALTPADCFGI_PAD34_DS1(n)          (((uint32_t)(n) << 16) & 0x00010000)
+
+// Pad 33 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGI_PAD33_SR_S            12
+#define AM_REG_GPIO_ALTPADCFGI_PAD33_SR_M            0x00001000
+#define AM_REG_GPIO_ALTPADCFGI_PAD33_SR(n)           (((uint32_t)(n) << 12) & 0x00001000)
+#define AM_REG_GPIO_ALTPADCFGI_PAD33_SR_SR_EN        0x00001000
+
+// Pad 33 high order drive strength selection.  Used in conjunction with
+// PAD33STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGI_PAD33_DS1_S           8
+#define AM_REG_GPIO_ALTPADCFGI_PAD33_DS1_M           0x00000100
+#define AM_REG_GPIO_ALTPADCFGI_PAD33_DS1(n)          (((uint32_t)(n) << 8) & 0x00000100)
+
+// Pad 32 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGI_PAD32_SR_S            4
+#define AM_REG_GPIO_ALTPADCFGI_PAD32_SR_M            0x00000010
+#define AM_REG_GPIO_ALTPADCFGI_PAD32_SR(n)           (((uint32_t)(n) << 4) & 0x00000010)
+#define AM_REG_GPIO_ALTPADCFGI_PAD32_SR_SR_EN        0x00000010
+
+// Pad 32 high order drive strength selection.  Used in conjunction with
+// PAD32STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGI_PAD32_DS1_S           0
+#define AM_REG_GPIO_ALTPADCFGI_PAD32_DS1_M           0x00000001
+#define AM_REG_GPIO_ALTPADCFGI_PAD32_DS1(n)          (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// GPIO_ALTPADCFGJ - Alternate Pad Configuration reg9 (Pads 39,38,37,36)
+//
+//*****************************************************************************
+// Pad 39 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGJ_PAD39_SR_S            28
+#define AM_REG_GPIO_ALTPADCFGJ_PAD39_SR_M            0x10000000
+#define AM_REG_GPIO_ALTPADCFGJ_PAD39_SR(n)           (((uint32_t)(n) << 28) & 0x10000000)
+#define AM_REG_GPIO_ALTPADCFGJ_PAD39_SR_SR_EN        0x10000000
+
+// Pad 39 high order drive strength selection.  Used in conjunction with
+// PAD39STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGJ_PAD39_DS1_S           24
+#define AM_REG_GPIO_ALTPADCFGJ_PAD39_DS1_M           0x01000000
+#define AM_REG_GPIO_ALTPADCFGJ_PAD39_DS1(n)          (((uint32_t)(n) << 24) & 0x01000000)
+
+// Pad 38 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGJ_PAD38_SR_S            20
+#define AM_REG_GPIO_ALTPADCFGJ_PAD38_SR_M            0x00100000
+#define AM_REG_GPIO_ALTPADCFGJ_PAD38_SR(n)           (((uint32_t)(n) << 20) & 0x00100000)
+#define AM_REG_GPIO_ALTPADCFGJ_PAD38_SR_SR_EN        0x00100000
+
+// Pad 38 high order drive strength selection.  Used in conjunction with
+// PAD38STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGJ_PAD38_DS1_S           16
+#define AM_REG_GPIO_ALTPADCFGJ_PAD38_DS1_M           0x00010000
+#define AM_REG_GPIO_ALTPADCFGJ_PAD38_DS1(n)          (((uint32_t)(n) << 16) & 0x00010000)
+
+// Pad 37 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGJ_PAD37_SR_S            12
+#define AM_REG_GPIO_ALTPADCFGJ_PAD37_SR_M            0x00001000
+#define AM_REG_GPIO_ALTPADCFGJ_PAD37_SR(n)           (((uint32_t)(n) << 12) & 0x00001000)
+#define AM_REG_GPIO_ALTPADCFGJ_PAD37_SR_SR_EN        0x00001000
+
+// Pad 37 high order drive strength selection.  Used in conjunction with
+// PAD37STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGJ_PAD37_DS1_S           8
+#define AM_REG_GPIO_ALTPADCFGJ_PAD37_DS1_M           0x00000100
+#define AM_REG_GPIO_ALTPADCFGJ_PAD37_DS1(n)          (((uint32_t)(n) << 8) & 0x00000100)
+
+// Pad 36 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGJ_PAD36_SR_S            4
+#define AM_REG_GPIO_ALTPADCFGJ_PAD36_SR_M            0x00000010
+#define AM_REG_GPIO_ALTPADCFGJ_PAD36_SR(n)           (((uint32_t)(n) << 4) & 0x00000010)
+#define AM_REG_GPIO_ALTPADCFGJ_PAD36_SR_SR_EN        0x00000010
+
+// Pad 36 high order drive strength selection.  Used in conjunction with
+// PAD36STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGJ_PAD36_DS1_S           0
+#define AM_REG_GPIO_ALTPADCFGJ_PAD36_DS1_M           0x00000001
+#define AM_REG_GPIO_ALTPADCFGJ_PAD36_DS1(n)          (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// GPIO_ALTPADCFGK - Alternate Pad Configuration reg10 (Pads 43,42,41,40)
+//
+//*****************************************************************************
+// Pad 43 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGK_PAD43_SR_S            28
+#define AM_REG_GPIO_ALTPADCFGK_PAD43_SR_M            0x10000000
+#define AM_REG_GPIO_ALTPADCFGK_PAD43_SR(n)           (((uint32_t)(n) << 28) & 0x10000000)
+#define AM_REG_GPIO_ALTPADCFGK_PAD43_SR_SR_EN        0x10000000
+
+// Pad 43 high order drive strength selection.  Used in conjunction with
+// PAD43STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGK_PAD43_DS1_S           24
+#define AM_REG_GPIO_ALTPADCFGK_PAD43_DS1_M           0x01000000
+#define AM_REG_GPIO_ALTPADCFGK_PAD43_DS1(n)          (((uint32_t)(n) << 24) & 0x01000000)
+
+// Pad 42 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGK_PAD42_SR_S            20
+#define AM_REG_GPIO_ALTPADCFGK_PAD42_SR_M            0x00100000
+#define AM_REG_GPIO_ALTPADCFGK_PAD42_SR(n)           (((uint32_t)(n) << 20) & 0x00100000)
+#define AM_REG_GPIO_ALTPADCFGK_PAD42_SR_SR_EN        0x00100000
+
+// Pad 42 high order drive strength selection.  Used in conjunction with
+// PAD42STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGK_PAD42_DS1_S           16
+#define AM_REG_GPIO_ALTPADCFGK_PAD42_DS1_M           0x00010000
+#define AM_REG_GPIO_ALTPADCFGK_PAD42_DS1(n)          (((uint32_t)(n) << 16) & 0x00010000)
+
+// Pad 41 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGK_PAD41_SR_S            12
+#define AM_REG_GPIO_ALTPADCFGK_PAD41_SR_M            0x00001000
+#define AM_REG_GPIO_ALTPADCFGK_PAD41_SR(n)           (((uint32_t)(n) << 12) & 0x00001000)
+#define AM_REG_GPIO_ALTPADCFGK_PAD41_SR_SR_EN        0x00001000
+
+// Pad 41 high order drive strength selection.  Used in conjunction with
+// PAD41STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGK_PAD41_DS1_S           8
+#define AM_REG_GPIO_ALTPADCFGK_PAD41_DS1_M           0x00000100
+#define AM_REG_GPIO_ALTPADCFGK_PAD41_DS1(n)          (((uint32_t)(n) << 8) & 0x00000100)
+
+// Pad 40 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGK_PAD40_SR_S            4
+#define AM_REG_GPIO_ALTPADCFGK_PAD40_SR_M            0x00000010
+#define AM_REG_GPIO_ALTPADCFGK_PAD40_SR(n)           (((uint32_t)(n) << 4) & 0x00000010)
+#define AM_REG_GPIO_ALTPADCFGK_PAD40_SR_SR_EN        0x00000010
+
+// Pad 40 high order drive strength selection.  Used in conjunction with
+// PAD40STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGK_PAD40_DS1_S           0
+#define AM_REG_GPIO_ALTPADCFGK_PAD40_DS1_M           0x00000001
+#define AM_REG_GPIO_ALTPADCFGK_PAD40_DS1(n)          (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// GPIO_ALTPADCFGL - Alternate Pad Configuration reg11 (Pads 47,46,45,44)
+//
+//*****************************************************************************
+// Pad 47 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGL_PAD47_SR_S            28
+#define AM_REG_GPIO_ALTPADCFGL_PAD47_SR_M            0x10000000
+#define AM_REG_GPIO_ALTPADCFGL_PAD47_SR(n)           (((uint32_t)(n) << 28) & 0x10000000)
+#define AM_REG_GPIO_ALTPADCFGL_PAD47_SR_SR_EN        0x10000000
+
+// Pad 47 high order drive strength selection.  Used in conjunction with
+// PAD47STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGL_PAD47_DS1_S           24
+#define AM_REG_GPIO_ALTPADCFGL_PAD47_DS1_M           0x01000000
+#define AM_REG_GPIO_ALTPADCFGL_PAD47_DS1(n)          (((uint32_t)(n) << 24) & 0x01000000)
+
+// Pad 46 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGL_PAD46_SR_S            20
+#define AM_REG_GPIO_ALTPADCFGL_PAD46_SR_M            0x00100000
+#define AM_REG_GPIO_ALTPADCFGL_PAD46_SR(n)           (((uint32_t)(n) << 20) & 0x00100000)
+#define AM_REG_GPIO_ALTPADCFGL_PAD46_SR_SR_EN        0x00100000
+
+// Pad 46 high order drive strength selection.  Used in conjunction with
+// PAD46STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGL_PAD46_DS1_S           16
+#define AM_REG_GPIO_ALTPADCFGL_PAD46_DS1_M           0x00010000
+#define AM_REG_GPIO_ALTPADCFGL_PAD46_DS1(n)          (((uint32_t)(n) << 16) & 0x00010000)
+
+// Pad 45 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGL_PAD45_SR_S            12
+#define AM_REG_GPIO_ALTPADCFGL_PAD45_SR_M            0x00001000
+#define AM_REG_GPIO_ALTPADCFGL_PAD45_SR(n)           (((uint32_t)(n) << 12) & 0x00001000)
+#define AM_REG_GPIO_ALTPADCFGL_PAD45_SR_SR_EN        0x00001000
+
+// Pad 45 high order drive strength selection.  Used in conjunction with
+// PAD45STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGL_PAD45_DS1_S           8
+#define AM_REG_GPIO_ALTPADCFGL_PAD45_DS1_M           0x00000100
+#define AM_REG_GPIO_ALTPADCFGL_PAD45_DS1(n)          (((uint32_t)(n) << 8) & 0x00000100)
+
+// Pad 44 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGL_PAD44_SR_S            4
+#define AM_REG_GPIO_ALTPADCFGL_PAD44_SR_M            0x00000010
+#define AM_REG_GPIO_ALTPADCFGL_PAD44_SR(n)           (((uint32_t)(n) << 4) & 0x00000010)
+#define AM_REG_GPIO_ALTPADCFGL_PAD44_SR_SR_EN        0x00000010
+
+// Pad 44 high order drive strength selection.  Used in conjunction with
+// PAD44STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGL_PAD44_DS1_S           0
+#define AM_REG_GPIO_ALTPADCFGL_PAD44_DS1_M           0x00000001
+#define AM_REG_GPIO_ALTPADCFGL_PAD44_DS1(n)          (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// GPIO_ALTPADCFGM - Alternate Pad Configuration reg12 (Pads 49,48)
+//
+//*****************************************************************************
+// Pad 49 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGM_PAD49_SR_S            12
+#define AM_REG_GPIO_ALTPADCFGM_PAD49_SR_M            0x00001000
+#define AM_REG_GPIO_ALTPADCFGM_PAD49_SR(n)           (((uint32_t)(n) << 12) & 0x00001000)
+#define AM_REG_GPIO_ALTPADCFGM_PAD49_SR_SR_EN        0x00001000
+
+// Pad 49 high order drive strength selection.  Used in conjunction with
+// PAD49STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGM_PAD49_DS1_S           8
+#define AM_REG_GPIO_ALTPADCFGM_PAD49_DS1_M           0x00000100
+#define AM_REG_GPIO_ALTPADCFGM_PAD49_DS1(n)          (((uint32_t)(n) << 8) & 0x00000100)
+
+// Pad 48 slew rate selection.
+#define AM_REG_GPIO_ALTPADCFGM_PAD48_SR_S            4
+#define AM_REG_GPIO_ALTPADCFGM_PAD48_SR_M            0x00000010
+#define AM_REG_GPIO_ALTPADCFGM_PAD48_SR(n)           (((uint32_t)(n) << 4) & 0x00000010)
+#define AM_REG_GPIO_ALTPADCFGM_PAD48_SR_SR_EN        0x00000010
+
+// Pad 48 high order drive strength selection.  Used in conjunction with
+// PAD48STRNG field to set the pad drive strength.
+#define AM_REG_GPIO_ALTPADCFGM_PAD48_DS1_S           0
+#define AM_REG_GPIO_ALTPADCFGM_PAD48_DS1_M           0x00000001
+#define AM_REG_GPIO_ALTPADCFGM_PAD48_DS1(n)          (((uint32_t)(n) << 0) & 0x00000001)
+
+#endif // AM_REG_GPIO_H
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_iomstr.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_iomstr.h
new file mode 100644
index 000000000..4d45e8131
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_iomstr.h
@@ -0,0 +1,586 @@
+//*****************************************************************************
+//
+//! @file am_reg_iomstr.h
+//!
+//! @brief Register macros for the IOMSTR module
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_REG_IOMSTR_H
+#define AM_REG_IOMSTR_H
+
+//*****************************************************************************
+//
+// Instance finder. (6 instance(s) available)
+//
+//*****************************************************************************
+#define AM_REG_IOMSTR_NUM_MODULES                    6
+#define AM_REG_IOMSTRn(n) \
+    (REG_IOMSTR_BASEADDR + 0x00001000 * n)
+
+//*****************************************************************************
+//
+// Register offsets.
+//
+//*****************************************************************************
+#define AM_REG_IOMSTR_FIFO_O                         0x00000000
+#define AM_REG_IOMSTR_FIFOPTR_O                      0x00000100
+#define AM_REG_IOMSTR_TLNGTH_O                       0x00000104
+#define AM_REG_IOMSTR_FIFOTHR_O                      0x00000108
+#define AM_REG_IOMSTR_CLKCFG_O                       0x0000010C
+#define AM_REG_IOMSTR_CMD_O                          0x00000110
+#define AM_REG_IOMSTR_CMDRPT_O                       0x00000114
+#define AM_REG_IOMSTR_STATUS_O                       0x00000118
+#define AM_REG_IOMSTR_CFG_O                          0x0000011C
+#define AM_REG_IOMSTR_INTEN_O                        0x00000200
+#define AM_REG_IOMSTR_INTSTAT_O                      0x00000204
+#define AM_REG_IOMSTR_INTCLR_O                       0x00000208
+#define AM_REG_IOMSTR_INTSET_O                       0x0000020C
+
+//*****************************************************************************
+//
+// IOMSTR_INTEN - IO Master Interrupts: Enable
+//
+//*****************************************************************************
+// This is the arbitration loss interrupt. This error occurs if another master
+// collides with an IO Master transfer. Generally, the IOM started an operation
+// but found SDA already low.
+#define AM_REG_IOMSTR_INTEN_ARB_S                    10
+#define AM_REG_IOMSTR_INTEN_ARB_M                    0x00000400
+#define AM_REG_IOMSTR_INTEN_ARB(n)                   (((uint32_t)(n) << 10) & 0x00000400)
+
+// This is the STOP command interrupt. A STOP bit was detected by the IOM.
+#define AM_REG_IOMSTR_INTEN_STOP_S                   9
+#define AM_REG_IOMSTR_INTEN_STOP_M                   0x00000200
+#define AM_REG_IOMSTR_INTEN_STOP(n)                  (((uint32_t)(n) << 9) & 0x00000200)
+
+// This is the START command interrupt. A START from another master was
+// detected. Software must wait for a STOP before proceeding.
+#define AM_REG_IOMSTR_INTEN_START_S                  8
+#define AM_REG_IOMSTR_INTEN_START_M                  0x00000100
+#define AM_REG_IOMSTR_INTEN_START(n)                 (((uint32_t)(n) << 8) & 0x00000100)
+
+// This is the illegal command interrupt. Software attempted to issue a CMD
+// while another CMD was already in progress. Or an attempt was made to issue a
+// non-zero-length write CMD with an empty FIFO.
+#define AM_REG_IOMSTR_INTEN_ICMD_S                   7
+#define AM_REG_IOMSTR_INTEN_ICMD_M                   0x00000080
+#define AM_REG_IOMSTR_INTEN_ICMD(n)                  (((uint32_t)(n) << 7) & 0x00000080)
+
+// This is the illegal FIFO access interrupt. An attempt was made to read the
+// FIFO during a write CMD. Or an attempt was made to write the FIFO on a read
+// CMD.
+#define AM_REG_IOMSTR_INTEN_IACC_S                   6
+#define AM_REG_IOMSTR_INTEN_IACC_M                   0x00000040
+#define AM_REG_IOMSTR_INTEN_IACC(n)                  (((uint32_t)(n) << 6) & 0x00000040)
+
+// This is the WTLEN interrupt.
+#define AM_REG_IOMSTR_INTEN_WTLEN_S                  5
+#define AM_REG_IOMSTR_INTEN_WTLEN_M                  0x00000020
+#define AM_REG_IOMSTR_INTEN_WTLEN(n)                 (((uint32_t)(n) << 5) & 0x00000020)
+
+// This is the I2C NAK interrupt. The expected ACK from the slave was not
+// received by the IOM.
+#define AM_REG_IOMSTR_INTEN_NAK_S                    4
+#define AM_REG_IOMSTR_INTEN_NAK_M                    0x00000010
+#define AM_REG_IOMSTR_INTEN_NAK(n)                   (((uint32_t)(n) << 4) & 0x00000010)
+
+// This is the Write FIFO Overflow interrupt. An attempt was made to write the
+// FIFO while it was full (i.e. while FIFOSIZ > 124).
+#define AM_REG_IOMSTR_INTEN_FOVFL_S                  3
+#define AM_REG_IOMSTR_INTEN_FOVFL_M                  0x00000008
+#define AM_REG_IOMSTR_INTEN_FOVFL(n)                 (((uint32_t)(n) << 3) & 0x00000008)
+
+// This is the Read FIFO Underflow interrupt. An attempt was made to read FIFO
+// when empty (i.e. while FIFOSIZ less than 4).
+#define AM_REG_IOMSTR_INTEN_FUNDFL_S                 2
+#define AM_REG_IOMSTR_INTEN_FUNDFL_M                 0x00000004
+#define AM_REG_IOMSTR_INTEN_FUNDFL(n)                (((uint32_t)(n) << 2) & 0x00000004)
+
+// This is the FIFO Threshold interrupt.
+#define AM_REG_IOMSTR_INTEN_THR_S                    1
+#define AM_REG_IOMSTR_INTEN_THR_M                    0x00000002
+#define AM_REG_IOMSTR_INTEN_THR(n)                   (((uint32_t)(n) << 1) & 0x00000002)
+
+// This is the Command Complete interrupt.
+#define AM_REG_IOMSTR_INTEN_CMDCMP_S                 0
+#define AM_REG_IOMSTR_INTEN_CMDCMP_M                 0x00000001
+#define AM_REG_IOMSTR_INTEN_CMDCMP(n)                (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// IOMSTR_INTSTAT - IO Master Interrupts: Status
+//
+//*****************************************************************************
+// This is the arbitration loss interrupt. This error occurs if another master
+// collides with an IO Master transfer. Generally, the IOM started an operation
+// but found SDA already low.
+#define AM_REG_IOMSTR_INTSTAT_ARB_S                  10
+#define AM_REG_IOMSTR_INTSTAT_ARB_M                  0x00000400
+#define AM_REG_IOMSTR_INTSTAT_ARB(n)                 (((uint32_t)(n) << 10) & 0x00000400)
+
+// This is the STOP command interrupt. A STOP bit was detected by the IOM.
+#define AM_REG_IOMSTR_INTSTAT_STOP_S                 9
+#define AM_REG_IOMSTR_INTSTAT_STOP_M                 0x00000200
+#define AM_REG_IOMSTR_INTSTAT_STOP(n)                (((uint32_t)(n) << 9) & 0x00000200)
+
+// This is the START command interrupt. A START from another master was
+// detected. Software must wait for a STOP before proceeding.
+#define AM_REG_IOMSTR_INTSTAT_START_S                8
+#define AM_REG_IOMSTR_INTSTAT_START_M                0x00000100
+#define AM_REG_IOMSTR_INTSTAT_START(n)               (((uint32_t)(n) << 8) & 0x00000100)
+
+// This is the illegal command interrupt. Software attempted to issue a CMD
+// while another CMD was already in progress. Or an attempt was made to issue a
+// non-zero-length write CMD with an empty FIFO.
+#define AM_REG_IOMSTR_INTSTAT_ICMD_S                 7
+#define AM_REG_IOMSTR_INTSTAT_ICMD_M                 0x00000080
+#define AM_REG_IOMSTR_INTSTAT_ICMD(n)                (((uint32_t)(n) << 7) & 0x00000080)
+
+// This is the illegal FIFO access interrupt. An attempt was made to read the
+// FIFO during a write CMD. Or an attempt was made to write the FIFO on a read
+// CMD.
+#define AM_REG_IOMSTR_INTSTAT_IACC_S                 6
+#define AM_REG_IOMSTR_INTSTAT_IACC_M                 0x00000040
+#define AM_REG_IOMSTR_INTSTAT_IACC(n)                (((uint32_t)(n) << 6) & 0x00000040)
+
+// This is the WTLEN interrupt.
+#define AM_REG_IOMSTR_INTSTAT_WTLEN_S                5
+#define AM_REG_IOMSTR_INTSTAT_WTLEN_M                0x00000020
+#define AM_REG_IOMSTR_INTSTAT_WTLEN(n)               (((uint32_t)(n) << 5) & 0x00000020)
+
+// This is the I2C NAK interrupt. The expected ACK from the slave was not
+// received by the IOM.
+#define AM_REG_IOMSTR_INTSTAT_NAK_S                  4
+#define AM_REG_IOMSTR_INTSTAT_NAK_M                  0x00000010
+#define AM_REG_IOMSTR_INTSTAT_NAK(n)                 (((uint32_t)(n) << 4) & 0x00000010)
+
+// This is the Write FIFO Overflow interrupt. An attempt was made to write the
+// FIFO while it was full (i.e. while FIFOSIZ > 124).
+#define AM_REG_IOMSTR_INTSTAT_FOVFL_S                3
+#define AM_REG_IOMSTR_INTSTAT_FOVFL_M                0x00000008
+#define AM_REG_IOMSTR_INTSTAT_FOVFL(n)               (((uint32_t)(n) << 3) & 0x00000008)
+
+// This is the Read FIFO Underflow interrupt. An attempt was made to read FIFO
+// when empty (i.e. while FIFOSIZ less than 4).
+#define AM_REG_IOMSTR_INTSTAT_FUNDFL_S               2
+#define AM_REG_IOMSTR_INTSTAT_FUNDFL_M               0x00000004
+#define AM_REG_IOMSTR_INTSTAT_FUNDFL(n)              (((uint32_t)(n) << 2) & 0x00000004)
+
+// This is the FIFO Threshold interrupt.
+#define AM_REG_IOMSTR_INTSTAT_THR_S                  1
+#define AM_REG_IOMSTR_INTSTAT_THR_M                  0x00000002
+#define AM_REG_IOMSTR_INTSTAT_THR(n)                 (((uint32_t)(n) << 1) & 0x00000002)
+
+// This is the Command Complete interrupt.
+#define AM_REG_IOMSTR_INTSTAT_CMDCMP_S               0
+#define AM_REG_IOMSTR_INTSTAT_CMDCMP_M               0x00000001
+#define AM_REG_IOMSTR_INTSTAT_CMDCMP(n)              (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// IOMSTR_INTCLR - IO Master Interrupts: Clear
+//
+//*****************************************************************************
+// This is the arbitration loss interrupt. This error occurs if another master
+// collides with an IO Master transfer. Generally, the IOM started an operation
+// but found SDA already low.
+#define AM_REG_IOMSTR_INTCLR_ARB_S                   10
+#define AM_REG_IOMSTR_INTCLR_ARB_M                   0x00000400
+#define AM_REG_IOMSTR_INTCLR_ARB(n)                  (((uint32_t)(n) << 10) & 0x00000400)
+
+// This is the STOP command interrupt. A STOP bit was detected by the IOM.
+#define AM_REG_IOMSTR_INTCLR_STOP_S                  9
+#define AM_REG_IOMSTR_INTCLR_STOP_M                  0x00000200
+#define AM_REG_IOMSTR_INTCLR_STOP(n)                 (((uint32_t)(n) << 9) & 0x00000200)
+
+// This is the START command interrupt. A START from another master was
+// detected. Software must wait for a STOP before proceeding.
+#define AM_REG_IOMSTR_INTCLR_START_S                 8
+#define AM_REG_IOMSTR_INTCLR_START_M                 0x00000100
+#define AM_REG_IOMSTR_INTCLR_START(n)                (((uint32_t)(n) << 8) & 0x00000100)
+
+// This is the illegal command interrupt. Software attempted to issue a CMD
+// while another CMD was already in progress. Or an attempt was made to issue a
+// non-zero-length write CMD with an empty FIFO.
+#define AM_REG_IOMSTR_INTCLR_ICMD_S                  7
+#define AM_REG_IOMSTR_INTCLR_ICMD_M                  0x00000080
+#define AM_REG_IOMSTR_INTCLR_ICMD(n)                 (((uint32_t)(n) << 7) & 0x00000080)
+
+// This is the illegal FIFO access interrupt. An attempt was made to read the
+// FIFO during a write CMD. Or an attempt was made to write the FIFO on a read
+// CMD.
+#define AM_REG_IOMSTR_INTCLR_IACC_S                  6
+#define AM_REG_IOMSTR_INTCLR_IACC_M                  0x00000040
+#define AM_REG_IOMSTR_INTCLR_IACC(n)                 (((uint32_t)(n) << 6) & 0x00000040)
+
+// This is the WTLEN interrupt.
+#define AM_REG_IOMSTR_INTCLR_WTLEN_S                 5
+#define AM_REG_IOMSTR_INTCLR_WTLEN_M                 0x00000020
+#define AM_REG_IOMSTR_INTCLR_WTLEN(n)                (((uint32_t)(n) << 5) & 0x00000020)
+
+// This is the I2C NAK interrupt. The expected ACK from the slave was not
+// received by the IOM.
+#define AM_REG_IOMSTR_INTCLR_NAK_S                   4
+#define AM_REG_IOMSTR_INTCLR_NAK_M                   0x00000010
+#define AM_REG_IOMSTR_INTCLR_NAK(n)                  (((uint32_t)(n) << 4) & 0x00000010)
+
+// This is the Write FIFO Overflow interrupt. An attempt was made to write the
+// FIFO while it was full (i.e. while FIFOSIZ > 124).
+#define AM_REG_IOMSTR_INTCLR_FOVFL_S                 3
+#define AM_REG_IOMSTR_INTCLR_FOVFL_M                 0x00000008
+#define AM_REG_IOMSTR_INTCLR_FOVFL(n)                (((uint32_t)(n) << 3) & 0x00000008)
+
+// This is the Read FIFO Underflow interrupt. An attempt was made to read FIFO
+// when empty (i.e. while FIFOSIZ less than 4).
+#define AM_REG_IOMSTR_INTCLR_FUNDFL_S                2
+#define AM_REG_IOMSTR_INTCLR_FUNDFL_M                0x00000004
+#define AM_REG_IOMSTR_INTCLR_FUNDFL(n)               (((uint32_t)(n) << 2) & 0x00000004)
+
+// This is the FIFO Threshold interrupt.
+#define AM_REG_IOMSTR_INTCLR_THR_S                   1
+#define AM_REG_IOMSTR_INTCLR_THR_M                   0x00000002
+#define AM_REG_IOMSTR_INTCLR_THR(n)                  (((uint32_t)(n) << 1) & 0x00000002)
+
+// This is the Command Complete interrupt.
+#define AM_REG_IOMSTR_INTCLR_CMDCMP_S                0
+#define AM_REG_IOMSTR_INTCLR_CMDCMP_M                0x00000001
+#define AM_REG_IOMSTR_INTCLR_CMDCMP(n)               (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// IOMSTR_INTSET - IO Master Interrupts: Set
+//
+//*****************************************************************************
+// This is the arbitration loss interrupt. This error occurs if another master
+// collides with an IO Master transfer. Generally, the IOM started an operation
+// but found SDA already low.
+#define AM_REG_IOMSTR_INTSET_ARB_S                   10
+#define AM_REG_IOMSTR_INTSET_ARB_M                   0x00000400
+#define AM_REG_IOMSTR_INTSET_ARB(n)                  (((uint32_t)(n) << 10) & 0x00000400)
+
+// This is the STOP command interrupt. A STOP bit was detected by the IOM.
+#define AM_REG_IOMSTR_INTSET_STOP_S                  9
+#define AM_REG_IOMSTR_INTSET_STOP_M                  0x00000200
+#define AM_REG_IOMSTR_INTSET_STOP(n)                 (((uint32_t)(n) << 9) & 0x00000200)
+
+// This is the START command interrupt. A START from another master was
+// detected. Software must wait for a STOP before proceeding.
+#define AM_REG_IOMSTR_INTSET_START_S                 8
+#define AM_REG_IOMSTR_INTSET_START_M                 0x00000100
+#define AM_REG_IOMSTR_INTSET_START(n)                (((uint32_t)(n) << 8) & 0x00000100)
+
+// This is the illegal command interrupt. Software attempted to issue a CMD
+// while another CMD was already in progress. Or an attempt was made to issue a
+// non-zero-length write CMD with an empty FIFO.
+#define AM_REG_IOMSTR_INTSET_ICMD_S                  7
+#define AM_REG_IOMSTR_INTSET_ICMD_M                  0x00000080
+#define AM_REG_IOMSTR_INTSET_ICMD(n)                 (((uint32_t)(n) << 7) & 0x00000080)
+
+// This is the illegal FIFO access interrupt. An attempt was made to read the
+// FIFO during a write CMD. Or an attempt was made to write the FIFO on a read
+// CMD.
+#define AM_REG_IOMSTR_INTSET_IACC_S                  6
+#define AM_REG_IOMSTR_INTSET_IACC_M                  0x00000040
+#define AM_REG_IOMSTR_INTSET_IACC(n)                 (((uint32_t)(n) << 6) & 0x00000040)
+
+// This is the WTLEN interrupt.
+#define AM_REG_IOMSTR_INTSET_WTLEN_S                 5
+#define AM_REG_IOMSTR_INTSET_WTLEN_M                 0x00000020
+#define AM_REG_IOMSTR_INTSET_WTLEN(n)                (((uint32_t)(n) << 5) & 0x00000020)
+
+// This is the I2C NAK interrupt. The expected ACK from the slave was not
+// received by the IOM.
+#define AM_REG_IOMSTR_INTSET_NAK_S                   4
+#define AM_REG_IOMSTR_INTSET_NAK_M                   0x00000010
+#define AM_REG_IOMSTR_INTSET_NAK(n)                  (((uint32_t)(n) << 4) & 0x00000010)
+
+// This is the Write FIFO Overflow interrupt. An attempt was made to write the
+// FIFO while it was full (i.e. while FIFOSIZ > 124).
+#define AM_REG_IOMSTR_INTSET_FOVFL_S                 3
+#define AM_REG_IOMSTR_INTSET_FOVFL_M                 0x00000008
+#define AM_REG_IOMSTR_INTSET_FOVFL(n)                (((uint32_t)(n) << 3) & 0x00000008)
+
+// This is the Read FIFO Underflow interrupt. An attempt was made to read FIFO
+// when empty (i.e. while FIFOSIZ less than 4).
+#define AM_REG_IOMSTR_INTSET_FUNDFL_S                2
+#define AM_REG_IOMSTR_INTSET_FUNDFL_M                0x00000004
+#define AM_REG_IOMSTR_INTSET_FUNDFL(n)               (((uint32_t)(n) << 2) & 0x00000004)
+
+// This is the FIFO Threshold interrupt.
+#define AM_REG_IOMSTR_INTSET_THR_S                   1
+#define AM_REG_IOMSTR_INTSET_THR_M                   0x00000002
+#define AM_REG_IOMSTR_INTSET_THR(n)                  (((uint32_t)(n) << 1) & 0x00000002)
+
+// This is the Command Complete interrupt.
+#define AM_REG_IOMSTR_INTSET_CMDCMP_S                0
+#define AM_REG_IOMSTR_INTSET_CMDCMP_M                0x00000001
+#define AM_REG_IOMSTR_INTSET_CMDCMP(n)               (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// IOMSTR_FIFO - FIFO Access Port
+//
+//*****************************************************************************
+// FIFO access port.
+#define AM_REG_IOMSTR_FIFO_FIFO_S                    0
+#define AM_REG_IOMSTR_FIFO_FIFO_M                    0xFFFFFFFF
+#define AM_REG_IOMSTR_FIFO_FIFO(n)                   (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// IOMSTR_FIFOPTR - Current FIFO Pointers
+//
+//*****************************************************************************
+// The number of bytes remaining in the FIFO (i.e. 128-FIFOSIZ if FULLDUP = 0 or
+// 64-FIFOSIZ if FULLDUP = 1)).
+#define AM_REG_IOMSTR_FIFOPTR_FIFOREM_S              16
+#define AM_REG_IOMSTR_FIFOPTR_FIFOREM_M              0x00FF0000
+#define AM_REG_IOMSTR_FIFOPTR_FIFOREM(n)             (((uint32_t)(n) << 16) & 0x00FF0000)
+
+// The number of bytes currently in the FIFO.
+#define AM_REG_IOMSTR_FIFOPTR_FIFOSIZ_S              0
+#define AM_REG_IOMSTR_FIFOPTR_FIFOSIZ_M              0x000000FF
+#define AM_REG_IOMSTR_FIFOPTR_FIFOSIZ(n)             (((uint32_t)(n) << 0) & 0x000000FF)
+
+//*****************************************************************************
+//
+// IOMSTR_TLNGTH - Transfer Length
+//
+//*****************************************************************************
+// Remaining transfer length.
+#define AM_REG_IOMSTR_TLNGTH_TLNGTH_S                0
+#define AM_REG_IOMSTR_TLNGTH_TLNGTH_M                0x00000FFF
+#define AM_REG_IOMSTR_TLNGTH_TLNGTH(n)               (((uint32_t)(n) << 0) & 0x00000FFF)
+
+//*****************************************************************************
+//
+// IOMSTR_FIFOTHR - FIFO Threshold Configuration
+//
+//*****************************************************************************
+// FIFO write threshold.
+#define AM_REG_IOMSTR_FIFOTHR_FIFOWTHR_S             8
+#define AM_REG_IOMSTR_FIFOTHR_FIFOWTHR_M             0x00007F00
+#define AM_REG_IOMSTR_FIFOTHR_FIFOWTHR(n)            (((uint32_t)(n) << 8) & 0x00007F00)
+
+// FIFO read threshold.
+#define AM_REG_IOMSTR_FIFOTHR_FIFORTHR_S             0
+#define AM_REG_IOMSTR_FIFOTHR_FIFORTHR_M             0x0000007F
+#define AM_REG_IOMSTR_FIFOTHR_FIFORTHR(n)            (((uint32_t)(n) << 0) & 0x0000007F)
+
+//*****************************************************************************
+//
+// IOMSTR_CLKCFG - I/O Clock Configuration
+//
+//*****************************************************************************
+// Clock total count minus 1.
+#define AM_REG_IOMSTR_CLKCFG_TOTPER_S                24
+#define AM_REG_IOMSTR_CLKCFG_TOTPER_M                0xFF000000
+#define AM_REG_IOMSTR_CLKCFG_TOTPER(n)               (((uint32_t)(n) << 24) & 0xFF000000)
+
+// Clock low count minus 1.
+#define AM_REG_IOMSTR_CLKCFG_LOWPER_S                16
+#define AM_REG_IOMSTR_CLKCFG_LOWPER_M                0x00FF0000
+#define AM_REG_IOMSTR_CLKCFG_LOWPER(n)               (((uint32_t)(n) << 16) & 0x00FF0000)
+
+// Enable clock division by TOTPER.
+#define AM_REG_IOMSTR_CLKCFG_DIVEN_S                 12
+#define AM_REG_IOMSTR_CLKCFG_DIVEN_M                 0x00001000
+#define AM_REG_IOMSTR_CLKCFG_DIVEN(n)                (((uint32_t)(n) << 12) & 0x00001000)
+#define AM_REG_IOMSTR_CLKCFG_DIVEN_DIS               0x00000000
+#define AM_REG_IOMSTR_CLKCFG_DIVEN_EN                0x00001000
+
+// Enable divide by 3.
+#define AM_REG_IOMSTR_CLKCFG_DIV3_S                  11
+#define AM_REG_IOMSTR_CLKCFG_DIV3_M                  0x00000800
+#define AM_REG_IOMSTR_CLKCFG_DIV3(n)                 (((uint32_t)(n) << 11) & 0x00000800)
+#define AM_REG_IOMSTR_CLKCFG_DIV3_DIS                0x00000000
+#define AM_REG_IOMSTR_CLKCFG_DIV3_EN                 0x00000800
+
+// Select the input clock frequency.
+#define AM_REG_IOMSTR_CLKCFG_FSEL_S                  8
+#define AM_REG_IOMSTR_CLKCFG_FSEL_M                  0x00000700
+#define AM_REG_IOMSTR_CLKCFG_FSEL(n)                 (((uint32_t)(n) << 8) & 0x00000700)
+#define AM_REG_IOMSTR_CLKCFG_FSEL_MIN_PWR            0x00000000
+#define AM_REG_IOMSTR_CLKCFG_FSEL_HFRC               0x00000100
+#define AM_REG_IOMSTR_CLKCFG_FSEL_HFRC_DIV2          0x00000200
+#define AM_REG_IOMSTR_CLKCFG_FSEL_HFRC_DIV4          0x00000300
+#define AM_REG_IOMSTR_CLKCFG_FSEL_HFRC_DIV8          0x00000400
+#define AM_REG_IOMSTR_CLKCFG_FSEL_HFRC_DIV16         0x00000500
+#define AM_REG_IOMSTR_CLKCFG_FSEL_HFRC_DIV32         0x00000600
+#define AM_REG_IOMSTR_CLKCFG_FSEL_HFRC_DIV64         0x00000700
+
+//*****************************************************************************
+//
+// IOMSTR_CMD - Command Register
+//
+//*****************************************************************************
+// This register holds the I/O Command
+#define AM_REG_IOMSTR_CMD_CMD_S                      0
+#define AM_REG_IOMSTR_CMD_CMD_M                      0xFFFFFFFF
+#define AM_REG_IOMSTR_CMD_CMD(n)                     (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// IOMSTR_CMDRPT - Command Repeat Register
+//
+//*****************************************************************************
+// These bits hold the Command repeat count.
+#define AM_REG_IOMSTR_CMDRPT_CMDRPT_S                0
+#define AM_REG_IOMSTR_CMDRPT_CMDRPT_M                0x0000001F
+#define AM_REG_IOMSTR_CMDRPT_CMDRPT(n)               (((uint32_t)(n) << 0) & 0x0000001F)
+
+//*****************************************************************************
+//
+// IOMSTR_STATUS - Status Register
+//
+//*****************************************************************************
+// This bit indicates if the I/O state machine is IDLE.
+#define AM_REG_IOMSTR_STATUS_IDLEST_S                2
+#define AM_REG_IOMSTR_STATUS_IDLEST_M                0x00000004
+#define AM_REG_IOMSTR_STATUS_IDLEST(n)               (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_IOMSTR_STATUS_IDLEST_IDLE             0x00000004
+
+// This bit indicates if the I/O Command is active.
+#define AM_REG_IOMSTR_STATUS_CMDACT_S                1
+#define AM_REG_IOMSTR_STATUS_CMDACT_M                0x00000002
+#define AM_REG_IOMSTR_STATUS_CMDACT(n)               (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_IOMSTR_STATUS_CMDACT_ACTIVE           0x00000002
+
+// This bit indicates if an error interrupt has occurred.
+#define AM_REG_IOMSTR_STATUS_ERR_S                   0
+#define AM_REG_IOMSTR_STATUS_ERR_M                   0x00000001
+#define AM_REG_IOMSTR_STATUS_ERR(n)                  (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_IOMSTR_STATUS_ERR_ERROR               0x00000001
+
+//*****************************************************************************
+//
+// IOMSTR_CFG - I/O Master Configuration
+//
+//*****************************************************************************
+// This bit enables the IO Master.
+#define AM_REG_IOMSTR_CFG_IFCEN_S                    31
+#define AM_REG_IOMSTR_CFG_IFCEN_M                    0x80000000
+#define AM_REG_IOMSTR_CFG_IFCEN(n)                   (((uint32_t)(n) << 31) & 0x80000000)
+#define AM_REG_IOMSTR_CFG_IFCEN_DIS                  0x00000000
+#define AM_REG_IOMSTR_CFG_IFCEN_EN                   0x80000000
+
+// This bit selects the read flow control signal polarity.
+#define AM_REG_IOMSTR_CFG_RDFCPOL_S                  14
+#define AM_REG_IOMSTR_CFG_RDFCPOL_M                  0x00004000
+#define AM_REG_IOMSTR_CFG_RDFCPOL(n)                 (((uint32_t)(n) << 14) & 0x00004000)
+#define AM_REG_IOMSTR_CFG_RDFCPOL_HIGH               0x00000000
+#define AM_REG_IOMSTR_CFG_RDFCPOL_LOW                0x00004000
+
+// This bit selects the write flow control signal polarity.
+#define AM_REG_IOMSTR_CFG_WTFCPOL_S                  13
+#define AM_REG_IOMSTR_CFG_WTFCPOL_M                  0x00002000
+#define AM_REG_IOMSTR_CFG_WTFCPOL(n)                 (((uint32_t)(n) << 13) & 0x00002000)
+#define AM_REG_IOMSTR_CFG_WTFCPOL_HIGH               0x00000000
+#define AM_REG_IOMSTR_CFG_WTFCPOL_LOW                0x00002000
+
+// This bit selects the write mode flow control signal.
+#define AM_REG_IOMSTR_CFG_WTFCIRQ_S                  12
+#define AM_REG_IOMSTR_CFG_WTFCIRQ_M                  0x00001000
+#define AM_REG_IOMSTR_CFG_WTFCIRQ(n)                 (((uint32_t)(n) << 12) & 0x00001000)
+#define AM_REG_IOMSTR_CFG_WTFCIRQ_MISO               0x00000000
+#define AM_REG_IOMSTR_CFG_WTFCIRQ_IRQ                0x00001000
+
+// This bit must be left at the default value of 0.
+#define AM_REG_IOMSTR_CFG_FCDEL_S                    11
+#define AM_REG_IOMSTR_CFG_FCDEL_M                    0x00000800
+#define AM_REG_IOMSTR_CFG_FCDEL(n)                   (((uint32_t)(n) << 11) & 0x00000800)
+
+// This bit invewrts MOSI when flow control is enabled.
+#define AM_REG_IOMSTR_CFG_MOSIINV_S                  10
+#define AM_REG_IOMSTR_CFG_MOSIINV_M                  0x00000400
+#define AM_REG_IOMSTR_CFG_MOSIINV(n)                 (((uint32_t)(n) << 10) & 0x00000400)
+#define AM_REG_IOMSTR_CFG_MOSIINV_NORMAL             0x00000000
+#define AM_REG_IOMSTR_CFG_MOSIINV_INVERT             0x00000400
+
+// This bit enables read mode flow control.
+#define AM_REG_IOMSTR_CFG_RDFC_S                     9
+#define AM_REG_IOMSTR_CFG_RDFC_M                     0x00000200
+#define AM_REG_IOMSTR_CFG_RDFC(n)                    (((uint32_t)(n) << 9) & 0x00000200)
+#define AM_REG_IOMSTR_CFG_RDFC_DIS                   0x00000000
+#define AM_REG_IOMSTR_CFG_RDFC_EN                    0x00000200
+
+// This bit enables write mode flow control.
+#define AM_REG_IOMSTR_CFG_WTFC_S                     8
+#define AM_REG_IOMSTR_CFG_WTFC_M                     0x00000100
+#define AM_REG_IOMSTR_CFG_WTFC(n)                    (((uint32_t)(n) << 8) & 0x00000100)
+#define AM_REG_IOMSTR_CFG_WTFC_DIS                   0x00000000
+#define AM_REG_IOMSTR_CFG_WTFC_EN                    0x00000100
+
+// This bit selects the preread timing.
+#define AM_REG_IOMSTR_CFG_STARTRD_S                  4
+#define AM_REG_IOMSTR_CFG_STARTRD_M                  0x00000030
+#define AM_REG_IOMSTR_CFG_STARTRD(n)                 (((uint32_t)(n) << 4) & 0x00000030)
+#define AM_REG_IOMSTR_CFG_STARTRD_PRERD0             0x00000000
+#define AM_REG_IOMSTR_CFG_STARTRD_PRERD1             0x00000010
+#define AM_REG_IOMSTR_CFG_STARTRD_PRERD2             0x00000020
+#define AM_REG_IOMSTR_CFG_STARTRD_PRERD3             0x00000030
+
+// This bit selects full duplex mode.
+#define AM_REG_IOMSTR_CFG_FULLDUP_S                  3
+#define AM_REG_IOMSTR_CFG_FULLDUP_M                  0x00000008
+#define AM_REG_IOMSTR_CFG_FULLDUP(n)                 (((uint32_t)(n) << 3) & 0x00000008)
+#define AM_REG_IOMSTR_CFG_FULLDUP_NORMAL             0x00000000
+#define AM_REG_IOMSTR_CFG_FULLDUP_FULLDUP            0x00000008
+
+// This bit selects SPI phase.
+#define AM_REG_IOMSTR_CFG_SPHA_S                     2
+#define AM_REG_IOMSTR_CFG_SPHA_M                     0x00000004
+#define AM_REG_IOMSTR_CFG_SPHA(n)                    (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_IOMSTR_CFG_SPHA_SAMPLE_LEADING_EDGE   0x00000000
+#define AM_REG_IOMSTR_CFG_SPHA_SAMPLE_TRAILING_EDGE  0x00000004
+
+// This bit selects SPI polarity.
+#define AM_REG_IOMSTR_CFG_SPOL_S                     1
+#define AM_REG_IOMSTR_CFG_SPOL_M                     0x00000002
+#define AM_REG_IOMSTR_CFG_SPOL(n)                    (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_IOMSTR_CFG_SPOL_CLK_BASE_0            0x00000000
+#define AM_REG_IOMSTR_CFG_SPOL_CLK_BASE_1            0x00000002
+
+// This bit selects the I/O interface.
+#define AM_REG_IOMSTR_CFG_IFCSEL_S                   0
+#define AM_REG_IOMSTR_CFG_IFCSEL_M                   0x00000001
+#define AM_REG_IOMSTR_CFG_IFCSEL(n)                  (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_IOMSTR_CFG_IFCSEL_I2C                 0x00000000
+#define AM_REG_IOMSTR_CFG_IFCSEL_SPI                 0x00000001
+
+#endif // AM_REG_IOMSTR_H
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_ioslave.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_ioslave.h
new file mode 100644
index 000000000..83b557cad
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_ioslave.h
@@ -0,0 +1,513 @@
+//*****************************************************************************
+//
+//! @file am_reg_ioslave.h
+//!
+//! @brief Register macros for the IOSLAVE module
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_REG_IOSLAVE_H
+#define AM_REG_IOSLAVE_H
+
+//*****************************************************************************
+//
+// Instance finder. (1 instance(s) available)
+//
+//*****************************************************************************
+#define AM_REG_IOSLAVE_NUM_MODULES                   1
+#define AM_REG_IOSLAVEn(n) \
+    (REG_IOSLAVE_BASEADDR + 0x00000000 * n)
+
+//*****************************************************************************
+//
+// Register offsets.
+//
+//*****************************************************************************
+#define AM_REG_IOSLAVE_FIFOPTR_O                     0x00000100
+#define AM_REG_IOSLAVE_FIFOCFG_O                     0x00000104
+#define AM_REG_IOSLAVE_FIFOTHR_O                     0x00000108
+#define AM_REG_IOSLAVE_FUPD_O                        0x0000010C
+#define AM_REG_IOSLAVE_FIFOCTR_O                     0x00000110
+#define AM_REG_IOSLAVE_FIFOINC_O                     0x00000114
+#define AM_REG_IOSLAVE_CFG_O                         0x00000118
+#define AM_REG_IOSLAVE_PRENC_O                       0x0000011C
+#define AM_REG_IOSLAVE_IOINTCTL_O                    0x00000120
+#define AM_REG_IOSLAVE_GENADD_O                      0x00000124
+#define AM_REG_IOSLAVE_INTEN_O                       0x00000200
+#define AM_REG_IOSLAVE_INTSTAT_O                     0x00000204
+#define AM_REG_IOSLAVE_INTCLR_O                      0x00000208
+#define AM_REG_IOSLAVE_INTSET_O                      0x0000020C
+#define AM_REG_IOSLAVE_REGACCINTEN_O                 0x00000210
+#define AM_REG_IOSLAVE_REGACCINTSTAT_O               0x00000214
+#define AM_REG_IOSLAVE_REGACCINTCLR_O                0x00000218
+#define AM_REG_IOSLAVE_REGACCINTSET_O                0x0000021C
+
+//*****************************************************************************
+//
+// IOSLAVE_INTEN - IO Slave Interrupts: Enable
+//
+//*****************************************************************************
+// Transfer complete interrupt, write to register space.
+#define AM_REG_IOSLAVE_INTEN_XCMPWR_S                9
+#define AM_REG_IOSLAVE_INTEN_XCMPWR_M                0x00000200
+#define AM_REG_IOSLAVE_INTEN_XCMPWR(n)               (((uint32_t)(n) << 9) & 0x00000200)
+
+// Transfer complete interrupt, write to FIFO space.
+#define AM_REG_IOSLAVE_INTEN_XCMPWF_S                8
+#define AM_REG_IOSLAVE_INTEN_XCMPWF_M                0x00000100
+#define AM_REG_IOSLAVE_INTEN_XCMPWF(n)               (((uint32_t)(n) << 8) & 0x00000100)
+
+// Transfer complete interrupt, read from register space.
+#define AM_REG_IOSLAVE_INTEN_XCMPRR_S                7
+#define AM_REG_IOSLAVE_INTEN_XCMPRR_M                0x00000080
+#define AM_REG_IOSLAVE_INTEN_XCMPRR(n)               (((uint32_t)(n) << 7) & 0x00000080)
+
+// Transfer complete interrupt, read from FIFO space.
+#define AM_REG_IOSLAVE_INTEN_XCMPRF_S                6
+#define AM_REG_IOSLAVE_INTEN_XCMPRF_M                0x00000040
+#define AM_REG_IOSLAVE_INTEN_XCMPRF(n)               (((uint32_t)(n) << 6) & 0x00000040)
+
+// I2C Interrupt Write interrupt.
+#define AM_REG_IOSLAVE_INTEN_IOINTW_S                5
+#define AM_REG_IOSLAVE_INTEN_IOINTW_M                0x00000020
+#define AM_REG_IOSLAVE_INTEN_IOINTW(n)               (((uint32_t)(n) << 5) & 0x00000020)
+
+// I2C General Address interrupt.
+#define AM_REG_IOSLAVE_INTEN_GENAD_S                 4
+#define AM_REG_IOSLAVE_INTEN_GENAD_M                 0x00000010
+#define AM_REG_IOSLAVE_INTEN_GENAD(n)                (((uint32_t)(n) << 4) & 0x00000010)
+
+// FIFO Read Error interrupt.
+#define AM_REG_IOSLAVE_INTEN_FRDERR_S                3
+#define AM_REG_IOSLAVE_INTEN_FRDERR_M                0x00000008
+#define AM_REG_IOSLAVE_INTEN_FRDERR(n)               (((uint32_t)(n) << 3) & 0x00000008)
+
+// FIFO Underflow interrupt.
+#define AM_REG_IOSLAVE_INTEN_FUNDFL_S                2
+#define AM_REG_IOSLAVE_INTEN_FUNDFL_M                0x00000004
+#define AM_REG_IOSLAVE_INTEN_FUNDFL(n)               (((uint32_t)(n) << 2) & 0x00000004)
+
+// FIFO Overflow interrupt.
+#define AM_REG_IOSLAVE_INTEN_FOVFL_S                 1
+#define AM_REG_IOSLAVE_INTEN_FOVFL_M                 0x00000002
+#define AM_REG_IOSLAVE_INTEN_FOVFL(n)                (((uint32_t)(n) << 1) & 0x00000002)
+
+// FIFO Size interrupt.
+#define AM_REG_IOSLAVE_INTEN_FSIZE_S                 0
+#define AM_REG_IOSLAVE_INTEN_FSIZE_M                 0x00000001
+#define AM_REG_IOSLAVE_INTEN_FSIZE(n)                (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// IOSLAVE_INTSTAT - IO Slave Interrupts: Status
+//
+//*****************************************************************************
+// Transfer complete interrupt, write to register space.
+#define AM_REG_IOSLAVE_INTSTAT_XCMPWR_S              9
+#define AM_REG_IOSLAVE_INTSTAT_XCMPWR_M              0x00000200
+#define AM_REG_IOSLAVE_INTSTAT_XCMPWR(n)             (((uint32_t)(n) << 9) & 0x00000200)
+
+// Transfer complete interrupt, write to FIFO space.
+#define AM_REG_IOSLAVE_INTSTAT_XCMPWF_S              8
+#define AM_REG_IOSLAVE_INTSTAT_XCMPWF_M              0x00000100
+#define AM_REG_IOSLAVE_INTSTAT_XCMPWF(n)             (((uint32_t)(n) << 8) & 0x00000100)
+
+// Transfer complete interrupt, read from register space.
+#define AM_REG_IOSLAVE_INTSTAT_XCMPRR_S              7
+#define AM_REG_IOSLAVE_INTSTAT_XCMPRR_M              0x00000080
+#define AM_REG_IOSLAVE_INTSTAT_XCMPRR(n)             (((uint32_t)(n) << 7) & 0x00000080)
+
+// Transfer complete interrupt, read from FIFO space.
+#define AM_REG_IOSLAVE_INTSTAT_XCMPRF_S              6
+#define AM_REG_IOSLAVE_INTSTAT_XCMPRF_M              0x00000040
+#define AM_REG_IOSLAVE_INTSTAT_XCMPRF(n)             (((uint32_t)(n) << 6) & 0x00000040)
+
+// I2C Interrupt Write interrupt.
+#define AM_REG_IOSLAVE_INTSTAT_IOINTW_S              5
+#define AM_REG_IOSLAVE_INTSTAT_IOINTW_M              0x00000020
+#define AM_REG_IOSLAVE_INTSTAT_IOINTW(n)             (((uint32_t)(n) << 5) & 0x00000020)
+
+// I2C General Address interrupt.
+#define AM_REG_IOSLAVE_INTSTAT_GENAD_S               4
+#define AM_REG_IOSLAVE_INTSTAT_GENAD_M               0x00000010
+#define AM_REG_IOSLAVE_INTSTAT_GENAD(n)              (((uint32_t)(n) << 4) & 0x00000010)
+
+// FIFO Read Error interrupt.
+#define AM_REG_IOSLAVE_INTSTAT_FRDERR_S              3
+#define AM_REG_IOSLAVE_INTSTAT_FRDERR_M              0x00000008
+#define AM_REG_IOSLAVE_INTSTAT_FRDERR(n)             (((uint32_t)(n) << 3) & 0x00000008)
+
+// FIFO Underflow interrupt.
+#define AM_REG_IOSLAVE_INTSTAT_FUNDFL_S              2
+#define AM_REG_IOSLAVE_INTSTAT_FUNDFL_M              0x00000004
+#define AM_REG_IOSLAVE_INTSTAT_FUNDFL(n)             (((uint32_t)(n) << 2) & 0x00000004)
+
+// FIFO Overflow interrupt.
+#define AM_REG_IOSLAVE_INTSTAT_FOVFL_S               1
+#define AM_REG_IOSLAVE_INTSTAT_FOVFL_M               0x00000002
+#define AM_REG_IOSLAVE_INTSTAT_FOVFL(n)              (((uint32_t)(n) << 1) & 0x00000002)
+
+// FIFO Size interrupt.
+#define AM_REG_IOSLAVE_INTSTAT_FSIZE_S               0
+#define AM_REG_IOSLAVE_INTSTAT_FSIZE_M               0x00000001
+#define AM_REG_IOSLAVE_INTSTAT_FSIZE(n)              (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// IOSLAVE_INTCLR - IO Slave Interrupts: Clear
+//
+//*****************************************************************************
+// Transfer complete interrupt, write to register space.
+#define AM_REG_IOSLAVE_INTCLR_XCMPWR_S               9
+#define AM_REG_IOSLAVE_INTCLR_XCMPWR_M               0x00000200
+#define AM_REG_IOSLAVE_INTCLR_XCMPWR(n)              (((uint32_t)(n) << 9) & 0x00000200)
+
+// Transfer complete interrupt, write to FIFO space.
+#define AM_REG_IOSLAVE_INTCLR_XCMPWF_S               8
+#define AM_REG_IOSLAVE_INTCLR_XCMPWF_M               0x00000100
+#define AM_REG_IOSLAVE_INTCLR_XCMPWF(n)              (((uint32_t)(n) << 8) & 0x00000100)
+
+// Transfer complete interrupt, read from register space.
+#define AM_REG_IOSLAVE_INTCLR_XCMPRR_S               7
+#define AM_REG_IOSLAVE_INTCLR_XCMPRR_M               0x00000080
+#define AM_REG_IOSLAVE_INTCLR_XCMPRR(n)              (((uint32_t)(n) << 7) & 0x00000080)
+
+// Transfer complete interrupt, read from FIFO space.
+#define AM_REG_IOSLAVE_INTCLR_XCMPRF_S               6
+#define AM_REG_IOSLAVE_INTCLR_XCMPRF_M               0x00000040
+#define AM_REG_IOSLAVE_INTCLR_XCMPRF(n)              (((uint32_t)(n) << 6) & 0x00000040)
+
+// I2C Interrupt Write interrupt.
+#define AM_REG_IOSLAVE_INTCLR_IOINTW_S               5
+#define AM_REG_IOSLAVE_INTCLR_IOINTW_M               0x00000020
+#define AM_REG_IOSLAVE_INTCLR_IOINTW(n)              (((uint32_t)(n) << 5) & 0x00000020)
+
+// I2C General Address interrupt.
+#define AM_REG_IOSLAVE_INTCLR_GENAD_S                4
+#define AM_REG_IOSLAVE_INTCLR_GENAD_M                0x00000010
+#define AM_REG_IOSLAVE_INTCLR_GENAD(n)               (((uint32_t)(n) << 4) & 0x00000010)
+
+// FIFO Read Error interrupt.
+#define AM_REG_IOSLAVE_INTCLR_FRDERR_S               3
+#define AM_REG_IOSLAVE_INTCLR_FRDERR_M               0x00000008
+#define AM_REG_IOSLAVE_INTCLR_FRDERR(n)              (((uint32_t)(n) << 3) & 0x00000008)
+
+// FIFO Underflow interrupt.
+#define AM_REG_IOSLAVE_INTCLR_FUNDFL_S               2
+#define AM_REG_IOSLAVE_INTCLR_FUNDFL_M               0x00000004
+#define AM_REG_IOSLAVE_INTCLR_FUNDFL(n)              (((uint32_t)(n) << 2) & 0x00000004)
+
+// FIFO Overflow interrupt.
+#define AM_REG_IOSLAVE_INTCLR_FOVFL_S                1
+#define AM_REG_IOSLAVE_INTCLR_FOVFL_M                0x00000002
+#define AM_REG_IOSLAVE_INTCLR_FOVFL(n)               (((uint32_t)(n) << 1) & 0x00000002)
+
+// FIFO Size interrupt.
+#define AM_REG_IOSLAVE_INTCLR_FSIZE_S                0
+#define AM_REG_IOSLAVE_INTCLR_FSIZE_M                0x00000001
+#define AM_REG_IOSLAVE_INTCLR_FSIZE(n)               (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// IOSLAVE_INTSET - IO Slave Interrupts: Set
+//
+//*****************************************************************************
+// Transfer complete interrupt, write to register space.
+#define AM_REG_IOSLAVE_INTSET_XCMPWR_S               9
+#define AM_REG_IOSLAVE_INTSET_XCMPWR_M               0x00000200
+#define AM_REG_IOSLAVE_INTSET_XCMPWR(n)              (((uint32_t)(n) << 9) & 0x00000200)
+
+// Transfer complete interrupt, write to FIFO space.
+#define AM_REG_IOSLAVE_INTSET_XCMPWF_S               8
+#define AM_REG_IOSLAVE_INTSET_XCMPWF_M               0x00000100
+#define AM_REG_IOSLAVE_INTSET_XCMPWF(n)              (((uint32_t)(n) << 8) & 0x00000100)
+
+// Transfer complete interrupt, read from register space.
+#define AM_REG_IOSLAVE_INTSET_XCMPRR_S               7
+#define AM_REG_IOSLAVE_INTSET_XCMPRR_M               0x00000080
+#define AM_REG_IOSLAVE_INTSET_XCMPRR(n)              (((uint32_t)(n) << 7) & 0x00000080)
+
+// Transfer complete interrupt, read from FIFO space.
+#define AM_REG_IOSLAVE_INTSET_XCMPRF_S               6
+#define AM_REG_IOSLAVE_INTSET_XCMPRF_M               0x00000040
+#define AM_REG_IOSLAVE_INTSET_XCMPRF(n)              (((uint32_t)(n) << 6) & 0x00000040)
+
+// I2C Interrupt Write interrupt.
+#define AM_REG_IOSLAVE_INTSET_IOINTW_S               5
+#define AM_REG_IOSLAVE_INTSET_IOINTW_M               0x00000020
+#define AM_REG_IOSLAVE_INTSET_IOINTW(n)              (((uint32_t)(n) << 5) & 0x00000020)
+
+// I2C General Address interrupt.
+#define AM_REG_IOSLAVE_INTSET_GENAD_S                4
+#define AM_REG_IOSLAVE_INTSET_GENAD_M                0x00000010
+#define AM_REG_IOSLAVE_INTSET_GENAD(n)               (((uint32_t)(n) << 4) & 0x00000010)
+
+// FIFO Read Error interrupt.
+#define AM_REG_IOSLAVE_INTSET_FRDERR_S               3
+#define AM_REG_IOSLAVE_INTSET_FRDERR_M               0x00000008
+#define AM_REG_IOSLAVE_INTSET_FRDERR(n)              (((uint32_t)(n) << 3) & 0x00000008)
+
+// FIFO Underflow interrupt.
+#define AM_REG_IOSLAVE_INTSET_FUNDFL_S               2
+#define AM_REG_IOSLAVE_INTSET_FUNDFL_M               0x00000004
+#define AM_REG_IOSLAVE_INTSET_FUNDFL(n)              (((uint32_t)(n) << 2) & 0x00000004)
+
+// FIFO Overflow interrupt.
+#define AM_REG_IOSLAVE_INTSET_FOVFL_S                1
+#define AM_REG_IOSLAVE_INTSET_FOVFL_M                0x00000002
+#define AM_REG_IOSLAVE_INTSET_FOVFL(n)               (((uint32_t)(n) << 1) & 0x00000002)
+
+// FIFO Size interrupt.
+#define AM_REG_IOSLAVE_INTSET_FSIZE_S                0
+#define AM_REG_IOSLAVE_INTSET_FSIZE_M                0x00000001
+#define AM_REG_IOSLAVE_INTSET_FSIZE(n)               (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// IOSLAVE_REGACCINTEN - Register Access Interrupts: Enable
+//
+//*****************************************************************************
+// Register access interrupts.
+#define AM_REG_IOSLAVE_REGACCINTEN_REGACC_S          0
+#define AM_REG_IOSLAVE_REGACCINTEN_REGACC_M          0xFFFFFFFF
+#define AM_REG_IOSLAVE_REGACCINTEN_REGACC(n)         (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// IOSLAVE_REGACCINTSTAT - Register Access Interrupts: Status
+//
+//*****************************************************************************
+// Register access interrupts.
+#define AM_REG_IOSLAVE_REGACCINTSTAT_REGACC_S        0
+#define AM_REG_IOSLAVE_REGACCINTSTAT_REGACC_M        0xFFFFFFFF
+#define AM_REG_IOSLAVE_REGACCINTSTAT_REGACC(n)       (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// IOSLAVE_REGACCINTCLR - Register Access Interrupts: Clear
+//
+//*****************************************************************************
+// Register access interrupts.
+#define AM_REG_IOSLAVE_REGACCINTCLR_REGACC_S         0
+#define AM_REG_IOSLAVE_REGACCINTCLR_REGACC_M         0xFFFFFFFF
+#define AM_REG_IOSLAVE_REGACCINTCLR_REGACC(n)        (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// IOSLAVE_REGACCINTSET - Register Access Interrupts: Set
+//
+//*****************************************************************************
+// Register access interrupts.
+#define AM_REG_IOSLAVE_REGACCINTSET_REGACC_S         0
+#define AM_REG_IOSLAVE_REGACCINTSET_REGACC_M         0xFFFFFFFF
+#define AM_REG_IOSLAVE_REGACCINTSET_REGACC(n)        (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// IOSLAVE_FIFOPTR - Current FIFO Pointer
+//
+//*****************************************************************************
+// The number of bytes currently in the hardware FIFO.
+#define AM_REG_IOSLAVE_FIFOPTR_FIFOSIZ_S             8
+#define AM_REG_IOSLAVE_FIFOPTR_FIFOSIZ_M             0x0000FF00
+#define AM_REG_IOSLAVE_FIFOPTR_FIFOSIZ(n)            (((uint32_t)(n) << 8) & 0x0000FF00)
+
+// Current FIFO pointer.
+#define AM_REG_IOSLAVE_FIFOPTR_FIFOPTR_S             0
+#define AM_REG_IOSLAVE_FIFOPTR_FIFOPTR_M             0x000000FF
+#define AM_REG_IOSLAVE_FIFOPTR_FIFOPTR(n)            (((uint32_t)(n) << 0) & 0x000000FF)
+
+//*****************************************************************************
+//
+// IOSLAVE_FIFOCFG - FIFO Configuration
+//
+//*****************************************************************************
+// Defines the read-only area.  The IO Slave read-only area is situated in LRAM
+// at (ROBASE*8) to (FIFOOBASE*8-1)
+#define AM_REG_IOSLAVE_FIFOCFG_ROBASE_S              24
+#define AM_REG_IOSLAVE_FIFOCFG_ROBASE_M              0x3F000000
+#define AM_REG_IOSLAVE_FIFOCFG_ROBASE(n)             (((uint32_t)(n) << 24) & 0x3F000000)
+
+// These bits hold the maximum FIFO address in 8 byte segments.  It is also the
+// beginning of the RAM area of the LRAM.  Note that no RAM area is configured
+// if FIFOMAX is set to 0x1F.
+#define AM_REG_IOSLAVE_FIFOCFG_FIFOMAX_S             8
+#define AM_REG_IOSLAVE_FIFOCFG_FIFOMAX_M             0x00003F00
+#define AM_REG_IOSLAVE_FIFOCFG_FIFOMAX(n)            (((uint32_t)(n) << 8) & 0x00003F00)
+
+// These bits hold the base address of the I/O FIFO in 8 byte segments. The IO
+// Slave FIFO is situated in LRAM at (FIFOBASE*8) to (FIFOMAX*8-1).
+#define AM_REG_IOSLAVE_FIFOCFG_FIFOBASE_S            0
+#define AM_REG_IOSLAVE_FIFOCFG_FIFOBASE_M            0x0000001F
+#define AM_REG_IOSLAVE_FIFOCFG_FIFOBASE(n)           (((uint32_t)(n) << 0) & 0x0000001F)
+
+//*****************************************************************************
+//
+// IOSLAVE_FIFOTHR - FIFO Threshold Configuration
+//
+//*****************************************************************************
+// FIFO size interrupt threshold.
+#define AM_REG_IOSLAVE_FIFOTHR_FIFOTHR_S             0
+#define AM_REG_IOSLAVE_FIFOTHR_FIFOTHR_M             0x000000FF
+#define AM_REG_IOSLAVE_FIFOTHR_FIFOTHR(n)            (((uint32_t)(n) << 0) & 0x000000FF)
+
+//*****************************************************************************
+//
+// IOSLAVE_FUPD - FIFO Update Status
+//
+//*****************************************************************************
+// This bitfield indicates an IO read is active.
+#define AM_REG_IOSLAVE_FUPD_IOREAD_S                 1
+#define AM_REG_IOSLAVE_FUPD_IOREAD_M                 0x00000002
+#define AM_REG_IOSLAVE_FUPD_IOREAD(n)                (((uint32_t)(n) << 1) & 0x00000002)
+
+// This bit indicates that a FIFO update is underway.
+#define AM_REG_IOSLAVE_FUPD_FIFOUPD_S                0
+#define AM_REG_IOSLAVE_FUPD_FIFOUPD_M                0x00000001
+#define AM_REG_IOSLAVE_FUPD_FIFOUPD(n)               (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// IOSLAVE_FIFOCTR - Overall FIFO Counter
+//
+//*****************************************************************************
+// Virtual FIFO byte count
+#define AM_REG_IOSLAVE_FIFOCTR_FIFOCTR_S             0
+#define AM_REG_IOSLAVE_FIFOCTR_FIFOCTR_M             0x000003FF
+#define AM_REG_IOSLAVE_FIFOCTR_FIFOCTR(n)            (((uint32_t)(n) << 0) & 0x000003FF)
+
+//*****************************************************************************
+//
+// IOSLAVE_FIFOINC - Overall FIFO Counter Increment
+//
+//*****************************************************************************
+// Increment the Overall FIFO Counter by this value on a write
+#define AM_REG_IOSLAVE_FIFOINC_FIFOINC_S             0
+#define AM_REG_IOSLAVE_FIFOINC_FIFOINC_M             0x000003FF
+#define AM_REG_IOSLAVE_FIFOINC_FIFOINC(n)            (((uint32_t)(n) << 0) & 0x000003FF)
+
+//*****************************************************************************
+//
+// IOSLAVE_CFG - I/O Slave Configuration
+//
+//*****************************************************************************
+// IOSLAVE interface enable.
+#define AM_REG_IOSLAVE_CFG_IFCEN_S                   31
+#define AM_REG_IOSLAVE_CFG_IFCEN_M                   0x80000000
+#define AM_REG_IOSLAVE_CFG_IFCEN(n)                  (((uint32_t)(n) << 31) & 0x80000000)
+#define AM_REG_IOSLAVE_CFG_IFCEN_DIS                 0x00000000
+#define AM_REG_IOSLAVE_CFG_IFCEN_EN                  0x80000000
+
+// 7-bit or 10-bit I2C device address.
+#define AM_REG_IOSLAVE_CFG_I2CADDR_S                 8
+#define AM_REG_IOSLAVE_CFG_I2CADDR_M                 0x000FFF00
+#define AM_REG_IOSLAVE_CFG_I2CADDR(n)                (((uint32_t)(n) << 8) & 0x000FFF00)
+
+// This bit holds the cycle to initiate an I/O RAM read.
+#define AM_REG_IOSLAVE_CFG_STARTRD_S                 4
+#define AM_REG_IOSLAVE_CFG_STARTRD_M                 0x00000010
+#define AM_REG_IOSLAVE_CFG_STARTRD(n)                (((uint32_t)(n) << 4) & 0x00000010)
+#define AM_REG_IOSLAVE_CFG_STARTRD_LATE              0x00000000
+#define AM_REG_IOSLAVE_CFG_STARTRD_EARLY             0x00000010
+
+// This bit selects the transfer bit ordering.
+#define AM_REG_IOSLAVE_CFG_LSB_S                     2
+#define AM_REG_IOSLAVE_CFG_LSB_M                     0x00000004
+#define AM_REG_IOSLAVE_CFG_LSB(n)                    (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_IOSLAVE_CFG_LSB_MSB_FIRST             0x00000000
+#define AM_REG_IOSLAVE_CFG_LSB_LSB_FIRST             0x00000004
+
+// This bit selects SPI polarity.
+#define AM_REG_IOSLAVE_CFG_SPOL_S                    1
+#define AM_REG_IOSLAVE_CFG_SPOL_M                    0x00000002
+#define AM_REG_IOSLAVE_CFG_SPOL(n)                   (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_IOSLAVE_CFG_SPOL_SPI_MODES_0_3        0x00000000
+#define AM_REG_IOSLAVE_CFG_SPOL_SPI_MODES_1_2        0x00000002
+
+// This bit selects the I/O interface.
+#define AM_REG_IOSLAVE_CFG_IFCSEL_S                  0
+#define AM_REG_IOSLAVE_CFG_IFCSEL_M                  0x00000001
+#define AM_REG_IOSLAVE_CFG_IFCSEL(n)                 (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_IOSLAVE_CFG_IFCSEL_I2C                0x00000000
+#define AM_REG_IOSLAVE_CFG_IFCSEL_SPI                0x00000001
+
+//*****************************************************************************
+//
+// IOSLAVE_PRENC - I/O Slave Interrupt Priority Encode
+//
+//*****************************************************************************
+// These bits hold the priority encode of the REGACC interrupts.
+#define AM_REG_IOSLAVE_PRENC_PRENC_S                 0
+#define AM_REG_IOSLAVE_PRENC_PRENC_M                 0x0000001F
+#define AM_REG_IOSLAVE_PRENC_PRENC(n)                (((uint32_t)(n) << 0) & 0x0000001F)
+
+//*****************************************************************************
+//
+// IOSLAVE_IOINTCTL - I/O Interrupt Control
+//
+//*****************************************************************************
+// These bits set the IOINT interrupts when written with a 1.
+#define AM_REG_IOSLAVE_IOINTCTL_IOINTSET_S           24
+#define AM_REG_IOSLAVE_IOINTCTL_IOINTSET_M           0xFF000000
+#define AM_REG_IOSLAVE_IOINTCTL_IOINTSET(n)          (((uint32_t)(n) << 24) & 0xFF000000)
+
+// This bit clears all of the IOINT interrupts when written with a 1.
+#define AM_REG_IOSLAVE_IOINTCTL_IOINTCLR_S           16
+#define AM_REG_IOSLAVE_IOINTCTL_IOINTCLR_M           0x00010000
+#define AM_REG_IOSLAVE_IOINTCTL_IOINTCLR(n)          (((uint32_t)(n) << 16) & 0x00010000)
+
+// These bits read the IOINT interrupts.
+#define AM_REG_IOSLAVE_IOINTCTL_IOINT_S              8
+#define AM_REG_IOSLAVE_IOINTCTL_IOINT_M              0x0000FF00
+#define AM_REG_IOSLAVE_IOINTCTL_IOINT(n)             (((uint32_t)(n) << 8) & 0x0000FF00)
+
+// These read-only bits indicate whether the IOINT interrupts are enabled.
+#define AM_REG_IOSLAVE_IOINTCTL_IOINTEN_S            0
+#define AM_REG_IOSLAVE_IOINTCTL_IOINTEN_M            0x000000FF
+#define AM_REG_IOSLAVE_IOINTCTL_IOINTEN(n)           (((uint32_t)(n) << 0) & 0x000000FF)
+
+//*****************************************************************************
+//
+// IOSLAVE_GENADD - General Address Data
+//
+//*****************************************************************************
+// The data supplied on the last General Address reference.
+#define AM_REG_IOSLAVE_GENADD_GADATA_S               0
+#define AM_REG_IOSLAVE_GENADD_GADATA_M               0x000000FF
+#define AM_REG_IOSLAVE_GENADD_GADATA(n)              (((uint32_t)(n) << 0) & 0x000000FF)
+
+#endif // AM_REG_IOSLAVE_H
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_itm.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_itm.h
new file mode 100644
index 000000000..f67d57b83
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_itm.h
@@ -0,0 +1,656 @@
+//*****************************************************************************
+//
+//! @file am_reg_itm.h
+//!
+//! @brief Register macros for the ITM module
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_REG_ITM_H
+#define AM_REG_ITM_H
+
+//*****************************************************************************
+//
+// Instance finder. (1 instance(s) available)
+//
+//*****************************************************************************
+#define AM_REG_ITM_NUM_MODULES                       1
+#define AM_REG_ITMn(n) \
+    (REG_ITM_BASEADDR + 0x00000000 * n)
+
+//*****************************************************************************
+//
+// Register offsets.
+//
+//*****************************************************************************
+#define AM_REG_ITM_STIM0_O                           0xE0000000
+#define AM_REG_ITM_STIM1_O                           0xE0000004
+#define AM_REG_ITM_STIM2_O                           0xE0000008
+#define AM_REG_ITM_STIM3_O                           0xE000000C
+#define AM_REG_ITM_STIM4_O                           0xE0000010
+#define AM_REG_ITM_STIM5_O                           0xE0000014
+#define AM_REG_ITM_STIM6_O                           0xE0000018
+#define AM_REG_ITM_STIM7_O                           0xE000001C
+#define AM_REG_ITM_STIM8_O                           0xE0000020
+#define AM_REG_ITM_STIM9_O                           0xE0000024
+#define AM_REG_ITM_STIM10_O                          0xE0000028
+#define AM_REG_ITM_STIM11_O                          0xE000002C
+#define AM_REG_ITM_STIM12_O                          0xE0000030
+#define AM_REG_ITM_STIM13_O                          0xE0000034
+#define AM_REG_ITM_STIM14_O                          0xE0000038
+#define AM_REG_ITM_STIM15_O                          0xE000003C
+#define AM_REG_ITM_STIM16_O                          0xE0000040
+#define AM_REG_ITM_STIM17_O                          0xE0000044
+#define AM_REG_ITM_STIM18_O                          0xE0000048
+#define AM_REG_ITM_STIM19_O                          0xE000004C
+#define AM_REG_ITM_STIM20_O                          0xE0000050
+#define AM_REG_ITM_STIM21_O                          0xE0000054
+#define AM_REG_ITM_STIM22_O                          0xE0000058
+#define AM_REG_ITM_STIM23_O                          0xE000005C
+#define AM_REG_ITM_STIM24_O                          0xE0000060
+#define AM_REG_ITM_STIM25_O                          0xE0000064
+#define AM_REG_ITM_STIM26_O                          0xE0000068
+#define AM_REG_ITM_STIM27_O                          0xE000006C
+#define AM_REG_ITM_STIM28_O                          0xE0000070
+#define AM_REG_ITM_STIM29_O                          0xE0000074
+#define AM_REG_ITM_STIM30_O                          0xE0000078
+#define AM_REG_ITM_STIM31_O                          0xE000007C
+#define AM_REG_ITM_TER_O                             0xE0000E00
+#define AM_REG_ITM_TPR_O                             0xE0000E40
+#define AM_REG_ITM_TCR_O                             0xE0000E80
+#define AM_REG_ITM_LOCKSREG_O                        0xE0000FB4
+#define AM_REG_ITM_PID4_O                            0xE0000FD0
+#define AM_REG_ITM_PID5_O                            0xE0000FD4
+#define AM_REG_ITM_PID6_O                            0xE0000FD8
+#define AM_REG_ITM_PID7_O                            0xE0000FDC
+#define AM_REG_ITM_PID0_O                            0xE0000FE0
+#define AM_REG_ITM_PID1_O                            0xE0000FE4
+#define AM_REG_ITM_PID2_O                            0xE0000FE8
+#define AM_REG_ITM_PID3_O                            0xE0000FEC
+#define AM_REG_ITM_CID0_O                            0xE0000FF0
+#define AM_REG_ITM_CID1_O                            0xE0000FF4
+#define AM_REG_ITM_CID2_O                            0xE0000FF8
+#define AM_REG_ITM_CID3_O                            0xE0000FFC
+#define AM_REG_ITM_LOCKAREG_O                        0xE0000FB0
+
+//*****************************************************************************
+//
+// Key values.
+//
+//*****************************************************************************
+#define AM_REG_ITM_LOCKAREG_KEYVAL                   0xC5ACCE55
+
+//*****************************************************************************
+//
+// ITM_STIM0 - Stimulus Port Register 0
+//
+//*****************************************************************************
+// Stimulus Port Register 0.
+#define AM_REG_ITM_STIM0_STIM0_S                     0
+#define AM_REG_ITM_STIM0_STIM0_M                     0xFFFFFFFF
+#define AM_REG_ITM_STIM0_STIM0(n)                    (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_STIM1 - Stimulus Port Register 1
+//
+//*****************************************************************************
+// Stimulus Port Register 1.
+#define AM_REG_ITM_STIM1_STIM1_S                     0
+#define AM_REG_ITM_STIM1_STIM1_M                     0xFFFFFFFF
+#define AM_REG_ITM_STIM1_STIM1(n)                    (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_STIM2 - Stimulus Port Register 2
+//
+//*****************************************************************************
+// Stimulus Port Register 2.
+#define AM_REG_ITM_STIM2_STIM2_S                     0
+#define AM_REG_ITM_STIM2_STIM2_M                     0xFFFFFFFF
+#define AM_REG_ITM_STIM2_STIM2(n)                    (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_STIM3 - Stimulus Port Register 3
+//
+//*****************************************************************************
+// Stimulus Port Register 3.
+#define AM_REG_ITM_STIM3_STIM3_S                     0
+#define AM_REG_ITM_STIM3_STIM3_M                     0xFFFFFFFF
+#define AM_REG_ITM_STIM3_STIM3(n)                    (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_STIM4 - Stimulus Port Register 4
+//
+//*****************************************************************************
+// Stimulus Port Register 4.
+#define AM_REG_ITM_STIM4_STIM4_S                     0
+#define AM_REG_ITM_STIM4_STIM4_M                     0xFFFFFFFF
+#define AM_REG_ITM_STIM4_STIM4(n)                    (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_STIM5 - Stimulus Port Register 5
+//
+//*****************************************************************************
+// Stimulus Port Register 5.
+#define AM_REG_ITM_STIM5_STIM5_S                     0
+#define AM_REG_ITM_STIM5_STIM5_M                     0xFFFFFFFF
+#define AM_REG_ITM_STIM5_STIM5(n)                    (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_STIM6 - Stimulus Port Register 6
+//
+//*****************************************************************************
+// Stimulus Port Register 6.
+#define AM_REG_ITM_STIM6_STIM6_S                     0
+#define AM_REG_ITM_STIM6_STIM6_M                     0xFFFFFFFF
+#define AM_REG_ITM_STIM6_STIM6(n)                    (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_STIM7 - Stimulus Port Register 7
+//
+//*****************************************************************************
+// Stimulus Port Register 7.
+#define AM_REG_ITM_STIM7_STIM7_S                     0
+#define AM_REG_ITM_STIM7_STIM7_M                     0xFFFFFFFF
+#define AM_REG_ITM_STIM7_STIM7(n)                    (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_STIM8 - Stimulus Port Register 8
+//
+//*****************************************************************************
+// Stimulus Port Register 8.
+#define AM_REG_ITM_STIM8_STIM8_S                     0
+#define AM_REG_ITM_STIM8_STIM8_M                     0xFFFFFFFF
+#define AM_REG_ITM_STIM8_STIM8(n)                    (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_STIM9 - Stimulus Port Register 9
+//
+//*****************************************************************************
+// Stimulus Port Register 9.
+#define AM_REG_ITM_STIM9_STIM9_S                     0
+#define AM_REG_ITM_STIM9_STIM9_M                     0xFFFFFFFF
+#define AM_REG_ITM_STIM9_STIM9(n)                    (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_STIM10 - Stimulus Port Register 10
+//
+//*****************************************************************************
+// Stimulus Port Register 10.
+#define AM_REG_ITM_STIM10_STIM10_S                   0
+#define AM_REG_ITM_STIM10_STIM10_M                   0xFFFFFFFF
+#define AM_REG_ITM_STIM10_STIM10(n)                  (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_STIM11 - Stimulus Port Register 11
+//
+//*****************************************************************************
+// Stimulus Port Register 11.
+#define AM_REG_ITM_STIM11_STIM11_S                   0
+#define AM_REG_ITM_STIM11_STIM11_M                   0xFFFFFFFF
+#define AM_REG_ITM_STIM11_STIM11(n)                  (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_STIM12 - Stimulus Port Register 12
+//
+//*****************************************************************************
+// Stimulus Port Register 12.
+#define AM_REG_ITM_STIM12_STIM12_S                   0
+#define AM_REG_ITM_STIM12_STIM12_M                   0xFFFFFFFF
+#define AM_REG_ITM_STIM12_STIM12(n)                  (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_STIM13 - Stimulus Port Register 13
+//
+//*****************************************************************************
+// Stimulus Port Register 13.
+#define AM_REG_ITM_STIM13_STIM13_S                   0
+#define AM_REG_ITM_STIM13_STIM13_M                   0xFFFFFFFF
+#define AM_REG_ITM_STIM13_STIM13(n)                  (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_STIM14 - Stimulus Port Register 14
+//
+//*****************************************************************************
+// Stimulus Port Register 14.
+#define AM_REG_ITM_STIM14_STIM14_S                   0
+#define AM_REG_ITM_STIM14_STIM14_M                   0xFFFFFFFF
+#define AM_REG_ITM_STIM14_STIM14(n)                  (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_STIM15 - Stimulus Port Register 15
+//
+//*****************************************************************************
+// Stimulus Port Register 15.
+#define AM_REG_ITM_STIM15_STIM15_S                   0
+#define AM_REG_ITM_STIM15_STIM15_M                   0xFFFFFFFF
+#define AM_REG_ITM_STIM15_STIM15(n)                  (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_STIM16 - Stimulus Port Register 16
+//
+//*****************************************************************************
+// Stimulus Port Register 16.
+#define AM_REG_ITM_STIM16_STIM16_S                   0
+#define AM_REG_ITM_STIM16_STIM16_M                   0xFFFFFFFF
+#define AM_REG_ITM_STIM16_STIM16(n)                  (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_STIM17 - Stimulus Port Register 17
+//
+//*****************************************************************************
+// Stimulus Port Register 17.
+#define AM_REG_ITM_STIM17_STIM17_S                   0
+#define AM_REG_ITM_STIM17_STIM17_M                   0xFFFFFFFF
+#define AM_REG_ITM_STIM17_STIM17(n)                  (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_STIM18 - Stimulus Port Register 18
+//
+//*****************************************************************************
+// Stimulus Port Register 18.
+#define AM_REG_ITM_STIM18_STIM18_S                   0
+#define AM_REG_ITM_STIM18_STIM18_M                   0xFFFFFFFF
+#define AM_REG_ITM_STIM18_STIM18(n)                  (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_STIM19 - Stimulus Port Register 19
+//
+//*****************************************************************************
+// Stimulus Port Register 19.
+#define AM_REG_ITM_STIM19_STIM19_S                   0
+#define AM_REG_ITM_STIM19_STIM19_M                   0xFFFFFFFF
+#define AM_REG_ITM_STIM19_STIM19(n)                  (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_STIM20 - Stimulus Port Register 20
+//
+//*****************************************************************************
+// Stimulus Port Register 20.
+#define AM_REG_ITM_STIM20_STIM20_S                   0
+#define AM_REG_ITM_STIM20_STIM20_M                   0xFFFFFFFF
+#define AM_REG_ITM_STIM20_STIM20(n)                  (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_STIM21 - Stimulus Port Register 21
+//
+//*****************************************************************************
+// Stimulus Port Register 21.
+#define AM_REG_ITM_STIM21_STIM21_S                   0
+#define AM_REG_ITM_STIM21_STIM21_M                   0xFFFFFFFF
+#define AM_REG_ITM_STIM21_STIM21(n)                  (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_STIM22 - Stimulus Port Register 22
+//
+//*****************************************************************************
+// Stimulus Port Register 22.
+#define AM_REG_ITM_STIM22_STIM22_S                   0
+#define AM_REG_ITM_STIM22_STIM22_M                   0xFFFFFFFF
+#define AM_REG_ITM_STIM22_STIM22(n)                  (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_STIM23 - Stimulus Port Register 23
+//
+//*****************************************************************************
+// Stimulus Port Register 23.
+#define AM_REG_ITM_STIM23_STIM23_S                   0
+#define AM_REG_ITM_STIM23_STIM23_M                   0xFFFFFFFF
+#define AM_REG_ITM_STIM23_STIM23(n)                  (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_STIM24 - Stimulus Port Register 24
+//
+//*****************************************************************************
+// Stimulus Port Register 24.
+#define AM_REG_ITM_STIM24_STIM24_S                   0
+#define AM_REG_ITM_STIM24_STIM24_M                   0xFFFFFFFF
+#define AM_REG_ITM_STIM24_STIM24(n)                  (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_STIM25 - Stimulus Port Register 25
+//
+//*****************************************************************************
+// Stimulus Port Register 25.
+#define AM_REG_ITM_STIM25_STIM25_S                   0
+#define AM_REG_ITM_STIM25_STIM25_M                   0xFFFFFFFF
+#define AM_REG_ITM_STIM25_STIM25(n)                  (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_STIM26 - Stimulus Port Register 26
+//
+//*****************************************************************************
+// Stimulus Port Register 26.
+#define AM_REG_ITM_STIM26_STIM26_S                   0
+#define AM_REG_ITM_STIM26_STIM26_M                   0xFFFFFFFF
+#define AM_REG_ITM_STIM26_STIM26(n)                  (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_STIM27 - Stimulus Port Register 27
+//
+//*****************************************************************************
+// Stimulus Port Register 27.
+#define AM_REG_ITM_STIM27_STIM27_S                   0
+#define AM_REG_ITM_STIM27_STIM27_M                   0xFFFFFFFF
+#define AM_REG_ITM_STIM27_STIM27(n)                  (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_STIM28 - Stimulus Port Register 28
+//
+//*****************************************************************************
+// Stimulus Port Register 28.
+#define AM_REG_ITM_STIM28_STIM28_S                   0
+#define AM_REG_ITM_STIM28_STIM28_M                   0xFFFFFFFF
+#define AM_REG_ITM_STIM28_STIM28(n)                  (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_STIM29 - Stimulus Port Register 29
+//
+//*****************************************************************************
+// Stimulus Port Register 29.
+#define AM_REG_ITM_STIM29_STIM29_S                   0
+#define AM_REG_ITM_STIM29_STIM29_M                   0xFFFFFFFF
+#define AM_REG_ITM_STIM29_STIM29(n)                  (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_STIM30 - Stimulus Port Register 30
+//
+//*****************************************************************************
+// Stimulus Port Register 30.
+#define AM_REG_ITM_STIM30_STIM30_S                   0
+#define AM_REG_ITM_STIM30_STIM30_M                   0xFFFFFFFF
+#define AM_REG_ITM_STIM30_STIM30(n)                  (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_STIM31 - Stimulus Port Register 31
+//
+//*****************************************************************************
+// Stimulus Port Register 31.
+#define AM_REG_ITM_STIM31_STIM31_S                   0
+#define AM_REG_ITM_STIM31_STIM31_M                   0xFFFFFFFF
+#define AM_REG_ITM_STIM31_STIM31(n)                  (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_TER - Trace Enable Register.
+//
+//*****************************************************************************
+// Bit mask to enable tracing on ITM stimulus ports. One bit per stimulus port..
+#define AM_REG_ITM_TER_STIMENA_S                     0
+#define AM_REG_ITM_TER_STIMENA_M                     0xFFFFFFFF
+#define AM_REG_ITM_TER_STIMENA(n)                    (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_TPR - Trace Privilege Register.
+//
+//*****************************************************************************
+// Bit mask to enable tracing on ITM stimulus ports. bit[0] = stimulus
+// ports[7:0], bit[1] = stimulus ports[15:8], bit[2] = stimulus ports[23:16],
+// bit[3] = stimulus ports[31:24].
+#define AM_REG_ITM_TPR_PRIVMASK_S                    0
+#define AM_REG_ITM_TPR_PRIVMASK_M                    0x0000000F
+#define AM_REG_ITM_TPR_PRIVMASK(n)                   (((uint32_t)(n) << 0) & 0x0000000F)
+
+//*****************************************************************************
+//
+// ITM_TCR - Trace Control Register.
+//
+//*****************************************************************************
+// Set when ITM events present and being drained.
+#define AM_REG_ITM_TCR_BUSY_S                        23
+#define AM_REG_ITM_TCR_BUSY_M                        0x00800000
+#define AM_REG_ITM_TCR_BUSY(n)                       (((uint32_t)(n) << 23) & 0x00800000)
+
+// ATB ID for CoreSight system.
+#define AM_REG_ITM_TCR_ATB_ID_S                      16
+#define AM_REG_ITM_TCR_ATB_ID_M                      0x007F0000
+#define AM_REG_ITM_TCR_ATB_ID(n)                     (((uint32_t)(n) << 16) & 0x007F0000)
+
+// Global Timestamp Frequency.
+#define AM_REG_ITM_TCR_TS_FREQ_S                     10
+#define AM_REG_ITM_TCR_TS_FREQ_M                     0x00000C00
+#define AM_REG_ITM_TCR_TS_FREQ(n)                    (((uint32_t)(n) << 10) & 0x00000C00)
+
+// Timestamp prescaler: 0b00 = no prescaling 0b01 = divide by 4 0b10 = divide by
+// 16 0b11 = divide by 64.
+#define AM_REG_ITM_TCR_TS_PRESCALE_S                 8
+#define AM_REG_ITM_TCR_TS_PRESCALE_M                 0x00000300
+#define AM_REG_ITM_TCR_TS_PRESCALE(n)                (((uint32_t)(n) << 8) & 0x00000300)
+
+// Enable SWV behavior ? count on TPIUEMIT and TPIUBAUD.
+#define AM_REG_ITM_TCR_SWV_ENABLE_S                  4
+#define AM_REG_ITM_TCR_SWV_ENABLE_M                  0x00000010
+#define AM_REG_ITM_TCR_SWV_ENABLE(n)                 (((uint32_t)(n) << 4) & 0x00000010)
+
+// Enables the DWT stimulus.
+#define AM_REG_ITM_TCR_DWT_ENABLE_S                  3
+#define AM_REG_ITM_TCR_DWT_ENABLE_M                  0x00000008
+#define AM_REG_ITM_TCR_DWT_ENABLE(n)                 (((uint32_t)(n) << 3) & 0x00000008)
+
+// Enables sync packets for TPIU.
+#define AM_REG_ITM_TCR_SYNC_ENABLE_S                 2
+#define AM_REG_ITM_TCR_SYNC_ENABLE_M                 0x00000004
+#define AM_REG_ITM_TCR_SYNC_ENABLE(n)                (((uint32_t)(n) << 2) & 0x00000004)
+
+// Enables differential timestamps. Differential timestamps are emitted when a
+// packet is written to the FIFO with a non-zero timestamp counter, and when the
+// timestamp counter overflows. Timestamps are emitted during idle times after a
+// fixed number of cycles. This provides a time reference for packets and inter-
+// packet gaps.
+#define AM_REG_ITM_TCR_TS_ENABLE_S                   1
+#define AM_REG_ITM_TCR_TS_ENABLE_M                   0x00000002
+#define AM_REG_ITM_TCR_TS_ENABLE(n)                  (((uint32_t)(n) << 1) & 0x00000002)
+
+// Enable ITM. This is the master enable, and must be set before ITM Stimulus
+// and Trace Enable registers can be written.
+#define AM_REG_ITM_TCR_ITM_ENABLE_S                  0
+#define AM_REG_ITM_TCR_ITM_ENABLE_M                  0x00000001
+#define AM_REG_ITM_TCR_ITM_ENABLE(n)                 (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// ITM_LOCKSREG - Lock Status Register
+//
+//*****************************************************************************
+// You cannot implement 8-bit lock accesses.
+#define AM_REG_ITM_LOCKSREG_BYTEACC_S                2
+#define AM_REG_ITM_LOCKSREG_BYTEACC_M                0x00000004
+#define AM_REG_ITM_LOCKSREG_BYTEACC(n)               (((uint32_t)(n) << 2) & 0x00000004)
+
+// Write access to component is blocked. All writes are ignored, reads are
+// permitted.
+#define AM_REG_ITM_LOCKSREG_ACCESS_S                 1
+#define AM_REG_ITM_LOCKSREG_ACCESS_M                 0x00000002
+#define AM_REG_ITM_LOCKSREG_ACCESS(n)                (((uint32_t)(n) << 1) & 0x00000002)
+
+// Indicates that a lock mechanism exists for this component.
+#define AM_REG_ITM_LOCKSREG_PRESENT_S                0
+#define AM_REG_ITM_LOCKSREG_PRESENT_M                0x00000001
+#define AM_REG_ITM_LOCKSREG_PRESENT(n)               (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// ITM_PID4 - Peripheral Identification Register 4
+//
+//*****************************************************************************
+// Peripheral Identification 4.
+#define AM_REG_ITM_PID4_PID4_S                       0
+#define AM_REG_ITM_PID4_PID4_M                       0xFFFFFFFF
+#define AM_REG_ITM_PID4_PID4(n)                      (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_PID5 - Peripheral Identification Register 5
+//
+//*****************************************************************************
+// Peripheral Identification 5.
+#define AM_REG_ITM_PID5_PID5_S                       0
+#define AM_REG_ITM_PID5_PID5_M                       0xFFFFFFFF
+#define AM_REG_ITM_PID5_PID5(n)                      (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_PID6 - Peripheral Identification Register 6
+//
+//*****************************************************************************
+// Peripheral Identification 6.
+#define AM_REG_ITM_PID6_PID6_S                       0
+#define AM_REG_ITM_PID6_PID6_M                       0xFFFFFFFF
+#define AM_REG_ITM_PID6_PID6(n)                      (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_PID7 - Peripheral Identification Register 7
+//
+//*****************************************************************************
+// Peripheral Identification 7.
+#define AM_REG_ITM_PID7_PID7_S                       0
+#define AM_REG_ITM_PID7_PID7_M                       0xFFFFFFFF
+#define AM_REG_ITM_PID7_PID7(n)                      (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_PID0 - Peripheral Identification Register 0
+//
+//*****************************************************************************
+// Peripheral Identification 0.
+#define AM_REG_ITM_PID0_PID0_S                       0
+#define AM_REG_ITM_PID0_PID0_M                       0xFFFFFFFF
+#define AM_REG_ITM_PID0_PID0(n)                      (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_PID1 - Peripheral Identification Register 1
+//
+//*****************************************************************************
+// Peripheral Identification 1.
+#define AM_REG_ITM_PID1_PID1_S                       0
+#define AM_REG_ITM_PID1_PID1_M                       0xFFFFFFFF
+#define AM_REG_ITM_PID1_PID1(n)                      (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_PID2 - Peripheral Identification Register 2
+//
+//*****************************************************************************
+// Peripheral Identification 2.
+#define AM_REG_ITM_PID2_PID2_S                       0
+#define AM_REG_ITM_PID2_PID2_M                       0xFFFFFFFF
+#define AM_REG_ITM_PID2_PID2(n)                      (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_PID3 - Peripheral Identification Register 3
+//
+//*****************************************************************************
+// Peripheral Identification 3.
+#define AM_REG_ITM_PID3_PID3_S                       0
+#define AM_REG_ITM_PID3_PID3_M                       0xFFFFFFFF
+#define AM_REG_ITM_PID3_PID3(n)                      (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_CID0 - Component Identification Register 1
+//
+//*****************************************************************************
+// Component Identification 1.
+#define AM_REG_ITM_CID0_CID0_S                       0
+#define AM_REG_ITM_CID0_CID0_M                       0xFFFFFFFF
+#define AM_REG_ITM_CID0_CID0(n)                      (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_CID1 - Component Identification Register 1
+//
+//*****************************************************************************
+// Component Identification 1.
+#define AM_REG_ITM_CID1_CID1_S                       0
+#define AM_REG_ITM_CID1_CID1_M                       0xFFFFFFFF
+#define AM_REG_ITM_CID1_CID1(n)                      (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_CID2 - Component Identification Register 2
+//
+//*****************************************************************************
+// Component Identification 2.
+#define AM_REG_ITM_CID2_CID2_S                       0
+#define AM_REG_ITM_CID2_CID2_M                       0xFFFFFFFF
+#define AM_REG_ITM_CID2_CID2(n)                      (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// ITM_CID3 - Component Identification Register 3
+//
+//*****************************************************************************
+// Component Identification 3.
+#define AM_REG_ITM_CID3_CID3_S                       0
+#define AM_REG_ITM_CID3_CID3_M                       0xFFFFFFFF
+#define AM_REG_ITM_CID3_CID3(n)                      (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+#endif // AM_REG_ITM_H
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_jedec.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_jedec.h
new file mode 100644
index 000000000..4fd79837f
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_jedec.h
@@ -0,0 +1,214 @@
+//*****************************************************************************
+//
+//! @file am_reg_jedec.h
+//!
+//! @brief Register macros for the JEDEC module
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_REG_JEDEC_H
+#define AM_REG_JEDEC_H
+
+//*****************************************************************************
+//
+// Instance finder. (1 instance(s) available)
+//
+//*****************************************************************************
+#define AM_REG_JEDEC_NUM_MODULES                     1
+#define AM_REG_JEDECn(n) \
+    (REG_JEDEC_BASEADDR + 0x00000000 * n)
+
+//*****************************************************************************
+//
+// Register offsets.
+//
+//*****************************************************************************
+#define AM_REG_JEDEC_PID4_O                          0xF0000FD0
+#define AM_REG_JEDEC_PID5_O                          0xF0000FD4
+#define AM_REG_JEDEC_PID6_O                          0xF0000FD8
+#define AM_REG_JEDEC_PID7_O                          0xF0000FDC
+#define AM_REG_JEDEC_PID0_O                          0xF0000FE0
+#define AM_REG_JEDEC_PID1_O                          0xF0000FE4
+#define AM_REG_JEDEC_PID2_O                          0xF0000FE8
+#define AM_REG_JEDEC_PID3_O                          0xF0000FEC
+#define AM_REG_JEDEC_CID0_O                          0xF0000FF0
+#define AM_REG_JEDEC_CID1_O                          0xF0000FF4
+#define AM_REG_JEDEC_CID2_O                          0xF0000FF8
+#define AM_REG_JEDEC_CID3_O                          0xF0000FFC
+
+//*****************************************************************************
+//
+// JEDEC_PID4 - JEP Continuation Register
+//
+//*****************************************************************************
+// Contains the JEP Continuation bits.
+#define AM_REG_JEDEC_PID4_JEPCONT_S                  0
+#define AM_REG_JEDEC_PID4_JEPCONT_M                  0x0000000F
+#define AM_REG_JEDEC_PID4_JEPCONT(n)                 (((uint32_t)(n) << 0) & 0x0000000F)
+
+//*****************************************************************************
+//
+// JEDEC_PID5 - JEP reserved Register
+//
+//*****************************************************************************
+// Contains the value of 0x00000000.
+#define AM_REG_JEDEC_PID5_VALUE_S                    0
+#define AM_REG_JEDEC_PID5_VALUE_M                    0xFFFFFFFF
+#define AM_REG_JEDEC_PID5_VALUE(n)                   (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// JEDEC_PID6 - JEP reserved Register
+//
+//*****************************************************************************
+// Contains the value of 0x00000000.
+#define AM_REG_JEDEC_PID6_VALUE_S                    0
+#define AM_REG_JEDEC_PID6_VALUE_M                    0xFFFFFFFF
+#define AM_REG_JEDEC_PID6_VALUE(n)                   (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// JEDEC_PID7 - JEP reserved Register
+//
+//*****************************************************************************
+// Contains the value of 0x00000000.
+#define AM_REG_JEDEC_PID7_VALUE_S                    0
+#define AM_REG_JEDEC_PID7_VALUE_M                    0xFFFFFFFF
+#define AM_REG_JEDEC_PID7_VALUE(n)                   (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// JEDEC_PID0 - Ambiq Partnum low byte
+//
+//*****************************************************************************
+// Contains the low 8 bits of the Ambiq Micro device part number.
+#define AM_REG_JEDEC_PID0_PNL8_S                     0
+#define AM_REG_JEDEC_PID0_PNL8_M                     0x000000FF
+#define AM_REG_JEDEC_PID0_PNL8(n)                    (((uint32_t)(n) << 0) & 0x000000FF)
+
+//*****************************************************************************
+//
+// JEDEC_PID1 - Ambiq part number high-nibble, JEPID low-nibble.
+//
+//*****************************************************************************
+// Contains the low 4 bits of the Ambiq Micro JEDEC JEP-106 ID. The full JEPID
+// is therefore 0x9B.
+#define AM_REG_JEDEC_PID1_JEPIDL_S                   4
+#define AM_REG_JEDEC_PID1_JEPIDL_M                   0x000000F0
+#define AM_REG_JEDEC_PID1_JEPIDL(n)                  (((uint32_t)(n) << 4) & 0x000000F0)
+
+// Contains the high 4 bits of the Ambiq Micro device part number.
+#define AM_REG_JEDEC_PID1_PNH4_S                     0
+#define AM_REG_JEDEC_PID1_PNH4_M                     0x0000000F
+#define AM_REG_JEDEC_PID1_PNH4(n)                    (((uint32_t)(n) << 0) & 0x0000000F)
+
+//*****************************************************************************
+//
+// JEDEC_PID2 - Ambiq chip revision low-nibble, JEPID high-nibble
+//
+//*****************************************************************************
+// Contains the high 4 bits of the Ambiq Micro CHIPREV (see also
+// MCUCTRL.CHIPREV). Note that this field will change with each revision of the
+// chip.
+#define AM_REG_JEDEC_PID2_CHIPREVH4_S                4
+#define AM_REG_JEDEC_PID2_CHIPREVH4_M                0x000000F0
+#define AM_REG_JEDEC_PID2_CHIPREVH4(n)               (((uint32_t)(n) << 4) & 0x000000F0)
+
+// Contains the high 3 bits of the Ambiq Micro JEPID. Note that bit3 of this
+// field is hard-coded to 1. The full JEPID is therefore 0x9B.
+#define AM_REG_JEDEC_PID2_JEPIDH_S                   0
+#define AM_REG_JEDEC_PID2_JEPIDH_M                   0x0000000F
+#define AM_REG_JEDEC_PID2_JEPIDH(n)                  (((uint32_t)(n) << 0) & 0x0000000F)
+
+//*****************************************************************************
+//
+// JEDEC_PID3 - Ambiq chip revision high-nibble.
+//
+//*****************************************************************************
+// Contains the low 4 bits of the Ambiq Micro CHIPREV (see also
+// MCUCTRL.CHIPREV). Note that this field will change with each revision of the
+// chip.
+#define AM_REG_JEDEC_PID3_CHIPREVL4_S                4
+#define AM_REG_JEDEC_PID3_CHIPREVL4_M                0x000000F0
+#define AM_REG_JEDEC_PID3_CHIPREVL4(n)               (((uint32_t)(n) << 4) & 0x000000F0)
+
+// This field is hard-coded to 0x0.
+#define AM_REG_JEDEC_PID3_ZERO_S                     0
+#define AM_REG_JEDEC_PID3_ZERO_M                     0x0000000F
+#define AM_REG_JEDEC_PID3_ZERO(n)                    (((uint32_t)(n) << 0) & 0x0000000F)
+
+//*****************************************************************************
+//
+// JEDEC_CID0 - Coresight ROM Table.
+//
+//*****************************************************************************
+// Coresight ROM Table, CID0.
+#define AM_REG_JEDEC_CID0_CID_S                      0
+#define AM_REG_JEDEC_CID0_CID_M                      0x000000FF
+#define AM_REG_JEDEC_CID0_CID(n)                     (((uint32_t)(n) << 0) & 0x000000FF)
+
+//*****************************************************************************
+//
+// JEDEC_CID1 - Coresight ROM Table.
+//
+//*****************************************************************************
+// Coresight ROM Table, CID1.
+#define AM_REG_JEDEC_CID1_CID_S                      0
+#define AM_REG_JEDEC_CID1_CID_M                      0x000000FF
+#define AM_REG_JEDEC_CID1_CID(n)                     (((uint32_t)(n) << 0) & 0x000000FF)
+
+//*****************************************************************************
+//
+// JEDEC_CID2 - Coresight ROM Table.
+//
+//*****************************************************************************
+// Coresight ROM Table, CID2.
+#define AM_REG_JEDEC_CID2_CID_S                      0
+#define AM_REG_JEDEC_CID2_CID_M                      0x000000FF
+#define AM_REG_JEDEC_CID2_CID(n)                     (((uint32_t)(n) << 0) & 0x000000FF)
+
+//*****************************************************************************
+//
+// JEDEC_CID3 - Coresight ROM Table.
+//
+//*****************************************************************************
+// Coresight ROM Table, CID3.
+#define AM_REG_JEDEC_CID3_CID_S                      0
+#define AM_REG_JEDEC_CID3_CID_M                      0x000000FF
+#define AM_REG_JEDEC_CID3_CID(n)                     (((uint32_t)(n) << 0) & 0x000000FF)
+
+#endif // AM_REG_JEDEC_H
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_macros.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_macros.h
new file mode 100644
index 000000000..d7d3f5bd1
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_macros.h
@@ -0,0 +1,312 @@
+//*****************************************************************************
+//
+//! @file am_reg_macros.h
+//!
+//! @brief Helper macros for using hardware registers.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#ifndef AM_REG_MACROS_H
+#define AM_REG_MACROS_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+//*****************************************************************************
+//
+// Include the inline assembly macros.
+//
+//*****************************************************************************
+#include "am_reg_macros_asm.h"
+
+//*****************************************************************************
+//
+// High-level Helper Macros.
+//
+// Usage:
+//
+// For direct 32-bit access to a register, use AM_REGVAL:
+//      AM_REGVAL(REG_VCOMP_BASEADDR + AM_VCOMP_VCMPCFG_O) |= 0xDEADBEEF;
+//
+// The AM_REG macro can also be used as a shorthand version of AM_REGVAL:
+//      AM_REG(VCOMP, VCMPCFG) |= 0xDEADBEEF;
+//
+// The AM_REGn macro is used for accessing registers of peripherals with
+// multiple instances, such as IOMSTR.
+//      AM_REGn(IOMSTR, 1, CLKCFG) |= 0xDEADBEEF;
+//
+// To write to a specific bitfield within a register, use AM_BFW or AM_BFWn:
+//      AM_BFW(CTIMER, 0, CTCTRL0, TMRB0FN, 0x3);
+//
+// To read a field, use AM_BFR or AM_BFRn:
+//      ui32Timer0Fn = AM_BFR((CTIMER, 0, CTCTRL0, TMRB0FN);
+//
+// Note:
+//
+// AM_REGn, AM_BFW and AM_BFR are concatenation-based, which means that
+// standalone macro definitions should not be used for the 'module', 'reg', and
+// 'field' arguments.All macro names in the various peripheral header files are
+// written in one of the following forms:
+//      - AM_REG_##module_reg_O
+//      - AM_REG_##module_reg_field_S
+//      - AM_REG_##module_reg_field_M
+//
+// The "module", "reg" and "field" fragments may be used as valid arguments to
+// the AM_REGn, AM_BFW, and AM_BFR macros, all of which are able to perform the
+// necessary concatenation operations to reconstruct the full macros and look
+// up the appropriate base address for the instance number given. For
+// peripherals with only one instance, use instance number 0.
+//
+// The AM_REGVAL macro does not perform any concatenation operations, so the
+// complete macro name (including any suffix) must be specified.
+//
+//*****************************************************************************
+#define AM_REGVAL(x)               (*((volatile uint32_t *)(x)))
+#define AM_REGVAL_FLOAT(x)         (*((volatile float *)(x)))
+
+//*****************************************************************************
+//
+// Register access macros for single-instance modules
+// AM_REG  - Write a register of a module.
+// AM_BFW  - Write a value to a bitfield of a register.
+// AM_BFWe - Use a defined enum value to write a value to a bitfield.
+// AM_BFR  - Read a bitfield value from a register.
+// AM_BFM  - Read and mask a bitfield, but leave the value in its bit position.
+//           (Useful for comparing with enums.)
+//
+//*****************************************************************************
+#define AM_REG(module, reg)                                                   \
+    AM_REGn(module, 0, reg)
+
+#define AM_BFW(module, reg, field, value)                                     \
+    AM_BFWn(module, 0, reg, field, value)
+
+#define AM_BFWe(module, reg, field, enumval)                                  \
+    AM_BFWen(module, 0, reg, field, enumval)
+
+#define AM_BFR(module, reg, field)                                            \
+    AM_BFRn(module, 0, reg, field)
+
+#define AM_BFM(module, reg, field)                                            \
+    AM_BFMn(module, 0, reg, field)
+
+#define AM_BFV(module, reg, field, value)                                     \
+    (((uint32_t)(value) << AM_REG_##module##_##reg##_##field##_S) &           \
+     AM_REG_##module##_##reg##_##field##_M)
+
+#define AM_BFX(module, reg, field, value)                                     \
+    (((uint32_t)(value) & AM_REG_##module##_##reg##_##field##_M) >>           \
+     AM_REG_##module##_##reg##_##field##_S)
+
+
+//*****************************************************************************
+//
+// Register access macros for multi-instance modules
+// AM_REGn - Write a register of a multiple instance module.
+// AM_BFWn - Write a value to a bitfield of a register in a multiple instance.
+// AM_BFWen - Use a defined enum value to write a value to a bitfield of a
+//            register in a multiple instance.
+// AM_BFRn - Read a bitfield value from a register in a multiple instance.
+// AM_BFMn - Read a bitfield, but leave the value in its bitfield position.
+// AM_BFMn - Read and mask a bitfield, but leave the value in its bit position.
+//           (Useful for comparing with enums.)
+//
+//*****************************************************************************
+#define AM_REGn(module, instance, reg)                                        \
+    AM_REGVAL(AM_REG_##module##n(instance) + AM_REG_##module##_##reg##_O)
+
+#define AM_BFWn(module, instance, reg, field, value)                          \
+    AM_REGn(module, instance, reg) =                                          \
+        (AM_BFV(module, reg, field, value) |                                  \
+         (AM_REGn(module, instance, reg) &                                    \
+          (~AM_REG_##module##_##reg##_##field##_M)))
+
+#define AM_BFWen(module, instance, reg, field, enumval)                       \
+    AM_REGn(module, instance, reg) =                                          \
+        (AM_REG_##module##_##reg##_##field##_##enumval |                      \
+         (AM_REGn(module, instance, reg) &                                    \
+          (~AM_REG_##module##_##reg##_##field##_M)))
+
+#define AM_BFRn(module, instance, reg, field)                                 \
+    AM_BFX(module, reg, field, AM_REGn(module, instance, reg))
+
+#define AM_BFMn(module, instance, reg, field)                                 \
+    (AM_REGn(module, instance, reg) & AM_REG_##module##_##reg##_##field##_M)
+
+//*****************************************************************************
+//
+// "Atomic" register access macros - use when a read-modify-write is required.
+//
+// These macros will be slower than the normal macros, but they will also
+// guarantee threadsafe hardware access.
+//
+// These macros require a nesting-friendly critical section implementation. If
+// you are using the HAL, you can use the default definitions below. If not,
+// you will need to supply your own.
+//
+// Atomic register access macros usage:
+// AM_REGa      - Write a register of a single instance module. Provide operator
+//                (&,|,etc) to perform that operation on the reg using value, or
+//                no operator to simply write the value atomically.
+// AM_REGa_SET  - Set bits in a single instance module according to the mask.
+// AM_REGa_CLR  - Clear bits in a single instance module according to the mask.
+// AM_REGna     - Multiple module version of AM_REGa.
+// AM_REGna_SET - Multiple instance version of AM_REGa_SET.
+// AM_REGna_CLR - Multiple instance version of AM_REGa_CLR.
+// AM_BFWa   - Write a value to a register bitfield.
+// AM_BFWae  - Use a defined enum value to write a value to a bitfield.
+// AM_BFWan  - Write a value to a bitfield of a register in a multiple instance.
+// AM_BFWaen - Use a defined enum value to write a value to a bitfield of a
+//             register in a multiple instance.
+//
+//*****************************************************************************
+#ifndef AM_CRITICAL_BEGIN
+#define AM_CRITICAL_BEGIN   uint32_t ui32Primask = am_hal_interrupt_master_disable()
+#define AM_CRITICAL_END     am_hal_interrupt_master_set(ui32Primask)
+#endif
+
+#define AM_REGan(module, instance, reg, operator, value)                    \
+    AM_CRITICAL_BEGIN_ASM                                                   \
+    AM_REGn(module, instance, reg) operator##= (value);                     \
+    AM_CRITICAL_END_ASM
+
+#define AM_REGan_SET(module, instance, reg, mask)                           \
+    AM_CRITICAL_BEGIN_ASM                                                   \
+    AM_REGn(module, instance, reg) |= (mask);                               \
+    AM_CRITICAL_END_ASM
+
+#define AM_REGan_CLR(module, instance, reg, mask)                           \
+    AM_CRITICAL_BEGIN_ASM                                                   \
+    AM_REGn(module, instance, reg) &= (~mask);                              \
+    AM_CRITICAL_END_ASM
+
+#define AM_REGa(module, reg, operator, value)                               \
+    AM_REGan(module, 0, reg, operator, value)
+
+#define AM_REGa_CLR(module, reg, mask)                                      \
+    AM_REGan_CLR(module, 0, reg, mask)
+
+#define AM_REGa_SET(module, reg, mask)                                      \
+    AM_REGan_SET(module, 0, reg, mask)
+
+#define AM_BFWa(module, reg, field, value)                                  \
+    AM_CRITICAL_BEGIN_ASM                                                   \
+    AM_BFW(module, reg, field, value);                                      \
+    AM_CRITICAL_END_ASM
+
+#define AM_BFWae(module, reg, field, enumval)                               \
+    AM_CRITICAL_BEGIN_ASM                                                   \
+    AM_BFWe(module, reg, field, enumval);                                   \
+    AM_CRITICAL_END_ASM
+
+#define AM_BFWan(module, instance, reg, field, value)                       \
+    AM_CRITICAL_BEGIN_ASM                                                   \
+    AM_BFWn(module, instance, reg, field, enumval);                         \
+    AM_CRITICAL_END_ASM
+
+#define AM_BFWaen(module, instance, reg, field, enumval)                    \
+    AM_CRITICAL_BEGIN_ASM                                                   \
+    AM_BFWen(module, instance reg, field, enumval);                         \
+    AM_CRITICAL_END_ASM
+
+//*****************************************************************************
+//
+// Other helper Macros.
+//
+// Note: These macros make use of macro concatenation, so the '_S' or '_M'
+// suffix on a register bitfield macro should not be supplied by the user.
+// The macro will apply each suffix as needed.
+//
+//*****************************************************************************
+
+//
+// AM_ENUMX extracts a register bitfield enumeration to the bit 0 position,
+//  which makes it possible to use enums directly with existing macros such
+//  as AM_BFR() or AM_BFW().
+// Brief overview: bitfield enumerations are pre-shifted such that the defined
+//  value lines up with the bitfield.  This is convenient for many operations,
+//  but not so when using AM_BFR() to read the value of a register bitfield
+//  as AM_BFR() shifts the bitfield value to the bit 0 position.
+// Note that this type of bitfield extraction is Cortex efficient via the
+//  UBFX (unsigned bit field extract) instruction.
+//
+// Alternately, AM_BFM() can also be used.  AM_BFM() reads a register and masks
+//  the bitfield value (without shifting), thereby allowing  direct comparison
+//  with a defined enum.
+//
+// Examples:
+//  if  ( AM_BFR(CLKGEN, CCTRL, CORESEL) ==
+//        AM_ENUMX(CLKGEN, CCTRL, CORESEL, HFRC) )
+//
+//  or alternatively:
+//  if  ( AM_BFM(CLKGEN, CCTRL, CORESEL) == AM_REG_CLKGEN_CCTRL_CORESEL_HFRC )
+//
+#define AM_ENUMX(module, reg, field, enumname)                              \
+    ((AM_REG_##module##_##reg##_##field##_##enumname) >>                    \
+     (AM_REG_##module##_##reg##_##field##_S))
+
+//
+// AM_WRITE_SM performs a shift/mask operation to prepare the value 'x' to be
+// written to the register field 'field'.
+//
+// For example:
+// AM_REGVAL(ui32Base + AM_VCOMP_VCMP_CFG_O) |=
+//     AM_WRITE_SM(AM_VCOMP_VCMP_CFG_LVLSEL, ui32Value);
+//
+#define AM_WRITE_SM(field, x)      (((x) << field##_S) & field##_M)
+
+//
+// AM_READ_SM performs a shift/mask operation to make it easier to interpret
+// the value of a given bitfield. This is essentially the reverse of the
+// AM_WRITE_SM operation. In most cases, you will want to use the shorter
+// AM_BFR macro instead of this one.
+//
+// For example:
+// ui32Value = AM_READ_SM(AM_VCOMP_VCMP_CFG_NSEL,
+//                        AM_REGVAL(ui32Base + AM_VCOMP_VCMP_CFG_O));
+//
+#define AM_READ_SM(field, x)       (((x) & field##_M) >> field##_S)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_REG_MACROS_H
+
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_macros_asm.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_macros_asm.h
new file mode 100644
index 000000000..aee4fa76b
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_macros_asm.h
@@ -0,0 +1,162 @@
+//*****************************************************************************
+//
+//! @file am_reg_macros_asm.h
+//!
+//! @brief Inline assembly macros. Initially for critical section handling in
+//! protecting hardware registers.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#ifndef AM_REG_MACROS_ASM_H
+#define AM_REG_MACROS_ASM_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+//*****************************************************************************
+//
+// Critical section assembly macros
+//
+// These macros implement critical section protection using inline assembly
+// for various compilers.  They are intended to be used in other register
+// macros or directly in sections of code.
+//
+// Important usage note: These macros create a local scope and therefore MUST
+// be used in pairs.
+//
+//*****************************************************************************
+
+#if defined(__GNUC_STDC_INLINE__)
+//
+// GCC macros.
+//
+#define AM_CRITICAL_BEGIN_ASM                                               \
+    if ( 1 )                                                                \
+    {                                                                       \
+        volatile uint32_t ui32Primask_04172010;                             \
+        __asm("    mrs %0, PRIMASK" : "=r"(ui32Primask_04172010));          \
+        __asm("    cpsid i");
+
+#define AM_CRITICAL_END_ASM                                                 \
+        __asm("    msr PRIMASK, %0" : : "r"(ui32Primask_04172010));         \
+    }
+
+#elif defined(__ARMCC_VERSION)
+//
+// ARM/Keil macros.
+//
+#define AM_CRITICAL_BEGIN_ASM                                               \
+    if ( 1 )                                                                \
+    {                                                                       \
+        volatile uint32_t ui32Primask_04172010;                             \
+        __asm                                                               \
+        {                                                                   \
+            mrs     ui32Primask_04172010, PRIMASK;                          \
+            cpsid   i;                                                      \
+        }
+
+#define AM_CRITICAL_END_ASM                                                 \
+        __asm                                                               \
+        {                                                                   \
+            msr     PRIMASK, ui32Primask_04172010;                          \
+        }                                                                   \
+    }
+
+#elif defined(__IAR_SYSTEMS_ICC__)
+//
+// IAR macros.
+//
+#define AM_CRITICAL_BEGIN_ASM                                               \
+    if ( 1 )                                                                \
+    {                                                                       \
+        volatile uint32_t ui32Primask_04172010;                             \
+        __asm("    mrs %0, PRIMASK" : "=r"(ui32Primask_04172010));          \
+        __asm("    cpsid i");
+
+#define AM_CRITICAL_END_ASM                                                 \
+        __asm("    msr PRIMASK, %0" : : "r"(ui32Primask_04172010));         \
+    }
+#endif
+
+
+//*****************************************************************************
+//
+// A collection of some common inline assembly instructions / intrinsics.
+//
+//*****************************************************************************
+//
+// AM_ASM_BKPT(n)
+//
+#if     defined(__ARMCC_VERSION)
+#define     AM_ASM_BKPT(n)  __breakpoint(n)
+#elif   defined(__IAR_SYSTEMS_ICC__)
+#define     AM_ASM_BKPT(n)  asm("    bkpt "#n);
+#else
+#define     AM_ASM_BKPT(n)  __asm("    bkpt "#n);
+#endif
+
+//
+// AM_ASM_WFI
+//
+#if     defined(__ARMCC_VERSION)
+#define     AM_ASM_WFI      __wfi();
+#elif   defined(__IAR_SYSTEMS_ICC__)
+#define     AM_ASM_WFI      asm("    wfi");
+#else
+#define     AM_ASM_WFI      __asm("    wfi");
+#endif
+
+//
+// AM_ASM_NOP
+//
+#if     defined(__ARMCC_VERSION)
+#define     AM_ASM_NOP      __nop();
+#elif   defined(__IAR_SYSTEMS_ICC__)
+#define     AM_ASM_NOP      asm("    nop");
+#else
+#define     AM_ASM_NOP      __asm("    nop");
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_REG_MACROS_ASM_H
+
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_mcuctrl.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_mcuctrl.h
new file mode 100644
index 000000000..1b80643f8
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_mcuctrl.h
@@ -0,0 +1,635 @@
+//*****************************************************************************
+//
+//! @file am_reg_mcuctrl.h
+//!
+//! @brief Register macros for the MCUCTRL module
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_REG_MCUCTRL_H
+#define AM_REG_MCUCTRL_H
+
+//*****************************************************************************
+//
+// Instance finder. (1 instance(s) available)
+//
+//*****************************************************************************
+#define AM_REG_MCUCTRL_NUM_MODULES                   1
+#define AM_REG_MCUCTRLn(n) \
+    (REG_MCUCTRL_BASEADDR + 0x00000000 * n)
+
+//*****************************************************************************
+//
+// Register offsets.
+//
+//*****************************************************************************
+#define AM_REG_MCUCTRL_CHIP_INFO_O                   0x00000000
+#define AM_REG_MCUCTRL_CHIPID0_O                     0x00000004
+#define AM_REG_MCUCTRL_CHIPID1_O                     0x00000008
+#define AM_REG_MCUCTRL_CHIPREV_O                     0x0000000C
+#define AM_REG_MCUCTRL_VENDORID_O                    0x00000010
+#define AM_REG_MCUCTRL_DEBUGGER_O                    0x00000014
+#define AM_REG_MCUCTRL_BUCK_O                        0x00000060
+#define AM_REG_MCUCTRL_BUCK3_O                       0x00000068
+#define AM_REG_MCUCTRL_LDOREG1_O                     0x00000080
+#define AM_REG_MCUCTRL_LDOREG3_O                     0x00000088
+#define AM_REG_MCUCTRL_BODPORCTRL_O                  0x00000100
+#define AM_REG_MCUCTRL_ADCPWRDLY_O                   0x00000104
+#define AM_REG_MCUCTRL_ADCCAL_O                      0x0000010C
+#define AM_REG_MCUCTRL_ADCBATTLOAD_O                 0x00000110
+#define AM_REG_MCUCTRL_BUCKTRIM_O                    0x00000114
+#define AM_REG_MCUCTRL_EXTCLKSEL_O                   0x00000160
+#define AM_REG_MCUCTRL_BOOTLOADERLOW_O               0x000001A0
+#define AM_REG_MCUCTRL_SHADOWVALID_O                 0x000001A4
+#define AM_REG_MCUCTRL_ICODEFAULTADDR_O              0x000001C0
+#define AM_REG_MCUCTRL_DCODEFAULTADDR_O              0x000001C4
+#define AM_REG_MCUCTRL_SYSFAULTADDR_O                0x000001C8
+#define AM_REG_MCUCTRL_FAULTSTATUS_O                 0x000001CC
+#define AM_REG_MCUCTRL_FAULTCAPTUREEN_O              0x000001D0
+#define AM_REG_MCUCTRL_DBGR1_O                       0x00000200
+#define AM_REG_MCUCTRL_DBGR2_O                       0x00000204
+#define AM_REG_MCUCTRL_PMUENABLE_O                   0x00000220
+#define AM_REG_MCUCTRL_TPIUCTRL_O                    0x00000250
+#define AM_REG_MCUCTRL_KEXTCLKSEL_O                  0x00000348
+
+//*****************************************************************************
+//
+// Key values.
+//
+//*****************************************************************************
+#define AM_REG_MCUCTRL_KEXTCLKSEL_KEYVAL             0x00000053
+
+//*****************************************************************************
+//
+// MCUCTRL_CHIP_INFO - Chip Information Register
+//
+//*****************************************************************************
+// BCD part number.
+#define AM_REG_MCUCTRL_CHIP_INFO_PARTNUM_S           0
+#define AM_REG_MCUCTRL_CHIP_INFO_PARTNUM_M           0xFFFFFFFF
+#define AM_REG_MCUCTRL_CHIP_INFO_PARTNUM(n)          (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+#define AM_REG_MCUCTRL_CHIP_INFO_PARTNUM_APOLLO2     0x03000000
+#define AM_REG_MCUCTRL_CHIP_INFO_PARTNUM_APOLLO      0x01000000
+#define AM_REG_MCUCTRL_CHIP_INFO_PARTNUM_PN_M        0xFF000000
+
+//*****************************************************************************
+//
+// MCUCTRL_CHIPID0 - Unique Chip ID 0
+//
+//*****************************************************************************
+// Unique chip ID 0.
+#define AM_REG_MCUCTRL_CHIPID0_VALUE_S               0
+#define AM_REG_MCUCTRL_CHIPID0_VALUE_M               0xFFFFFFFF
+#define AM_REG_MCUCTRL_CHIPID0_VALUE(n)              (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+#define AM_REG_MCUCTRL_CHIPID0_VALUE_APOLLO2         0x00000000
+
+//*****************************************************************************
+//
+// MCUCTRL_CHIPID1 - Unique Chip ID 1
+//
+//*****************************************************************************
+// Unique chip ID 1.
+#define AM_REG_MCUCTRL_CHIPID1_VALUE_S               0
+#define AM_REG_MCUCTRL_CHIPID1_VALUE_M               0xFFFFFFFF
+#define AM_REG_MCUCTRL_CHIPID1_VALUE(n)              (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+#define AM_REG_MCUCTRL_CHIPID1_VALUE_APOLLO2         0x00000000
+
+//*****************************************************************************
+//
+// MCUCTRL_CHIPREV - Chip Revision
+//
+//*****************************************************************************
+// Major Revision ID.
+#define AM_REG_MCUCTRL_CHIPREV_REVMAJ_S              4
+#define AM_REG_MCUCTRL_CHIPREV_REVMAJ_M              0x000000F0
+#define AM_REG_MCUCTRL_CHIPREV_REVMAJ(n)             (((uint32_t)(n) << 4) & 0x000000F0)
+#define AM_REG_MCUCTRL_CHIPREV_REVMAJ_B              0x00000020
+#define AM_REG_MCUCTRL_CHIPREV_REVMAJ_A              0x00000010
+
+// Minor Revision ID.
+#define AM_REG_MCUCTRL_CHIPREV_REVMIN_S              0
+#define AM_REG_MCUCTRL_CHIPREV_REVMIN_M              0x0000000F
+#define AM_REG_MCUCTRL_CHIPREV_REVMIN(n)             (((uint32_t)(n) << 0) & 0x0000000F)
+#define AM_REG_MCUCTRL_CHIPREV_REVMIN_REV0           0x00000001
+
+//*****************************************************************************
+//
+// MCUCTRL_VENDORID - Unique Vendor ID
+//
+//*****************************************************************************
+// Unique Vendor ID
+#define AM_REG_MCUCTRL_VENDORID_VALUE_S              0
+#define AM_REG_MCUCTRL_VENDORID_VALUE_M              0xFFFFFFFF
+#define AM_REG_MCUCTRL_VENDORID_VALUE(n)             (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+#define AM_REG_MCUCTRL_VENDORID_VALUE_AMBIQ          0x414D4251
+
+//*****************************************************************************
+//
+// MCUCTRL_DEBUGGER - Debugger Access Control
+//
+//*****************************************************************************
+// Lockout of debugger (SWD).
+#define AM_REG_MCUCTRL_DEBUGGER_LOCKOUT_S            0
+#define AM_REG_MCUCTRL_DEBUGGER_LOCKOUT_M            0x00000001
+#define AM_REG_MCUCTRL_DEBUGGER_LOCKOUT(n)           (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// MCUCTRL_BUCK - Analog Buck Control
+//
+//*****************************************************************************
+// Reset control override for Mem Buck; 0=enabled, 1=reset; Value is propagated
+// only when the BUCKSWE bit is active, otherwise contrl is from the power
+// control module.
+#define AM_REG_MCUCTRL_BUCK_MEMBUCKRST_S             7
+#define AM_REG_MCUCTRL_BUCK_MEMBUCKRST_M             0x00000080
+#define AM_REG_MCUCTRL_BUCK_MEMBUCKRST(n)            (((uint32_t)(n) << 7) & 0x00000080)
+
+// Reset control override for Core Buck; 0=enabled, 1=reset; Value is propagated
+// only when the BUCKSWE bit is active, otherwise control is from the power
+// control module.
+#define AM_REG_MCUCTRL_BUCK_COREBUCKRST_S            6
+#define AM_REG_MCUCTRL_BUCK_COREBUCKRST_M            0x00000040
+#define AM_REG_MCUCTRL_BUCK_COREBUCKRST(n)           (((uint32_t)(n) << 6) & 0x00000040)
+
+// Not used.  Additional control of buck is available in the power control
+// module
+#define AM_REG_MCUCTRL_BUCK_BYPBUCKMEM_S             5
+#define AM_REG_MCUCTRL_BUCK_BYPBUCKMEM_M             0x00000020
+#define AM_REG_MCUCTRL_BUCK_BYPBUCKMEM(n)            (((uint32_t)(n) << 5) & 0x00000020)
+
+// Memory buck power down override. 1=Powered Down; 0=Enabled; Value is
+// propagated only when the BUCKSWE bit is active, otherwise control is from the
+// power control module.
+#define AM_REG_MCUCTRL_BUCK_MEMBUCKPWD_S             4
+#define AM_REG_MCUCTRL_BUCK_MEMBUCKPWD_M             0x00000010
+#define AM_REG_MCUCTRL_BUCK_MEMBUCKPWD(n)            (((uint32_t)(n) << 4) & 0x00000010)
+#define AM_REG_MCUCTRL_BUCK_MEMBUCKPWD_EN            0x00000000
+
+// HFRC clkgen bit 0 override. When set, this will override to 0 bit 0 of the
+// hfrc_freq_clkgen internal bus (see internal Shelby-1473)
+#define AM_REG_MCUCTRL_BUCK_SLEEPBUCKANA_S           3
+#define AM_REG_MCUCTRL_BUCK_SLEEPBUCKANA_M           0x00000008
+#define AM_REG_MCUCTRL_BUCK_SLEEPBUCKANA(n)          (((uint32_t)(n) << 3) & 0x00000008)
+
+// Core buck power down override. 1=Powered Down; 0=Enabled; Value is propagated
+// only when the BUCKSWE bit is active, otherwise control is from the power
+// control module.
+#define AM_REG_MCUCTRL_BUCK_COREBUCKPWD_S            2
+#define AM_REG_MCUCTRL_BUCK_COREBUCKPWD_M            0x00000004
+#define AM_REG_MCUCTRL_BUCK_COREBUCKPWD(n)           (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_MCUCTRL_BUCK_COREBUCKPWD_EN           0x00000000
+
+// Not used.  Additional control of buck is available in the power control
+// module
+#define AM_REG_MCUCTRL_BUCK_BYPBUCKCORE_S            1
+#define AM_REG_MCUCTRL_BUCK_BYPBUCKCORE_M            0x00000002
+#define AM_REG_MCUCTRL_BUCK_BYPBUCKCORE(n)           (((uint32_t)(n) << 1) & 0x00000002)
+
+// Buck Register Software Override Enable.  This will enable the override values
+// for MEMBUCKPWD, COREBUCKPWD, COREBUCKRST, MEMBUCKRST, all to be propagated to
+// the control logic, instead of the normal power control module signal.  Note -
+// Must take care to have correct value for ALL the register bits when this SWE
+// is enabled.
+#define AM_REG_MCUCTRL_BUCK_BUCKSWE_S                0
+#define AM_REG_MCUCTRL_BUCK_BUCKSWE_M                0x00000001
+#define AM_REG_MCUCTRL_BUCK_BUCKSWE(n)               (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_MCUCTRL_BUCK_BUCKSWE_OVERRIDE_DIS     0x00000000
+#define AM_REG_MCUCTRL_BUCK_BUCKSWE_OVERRIDE_EN      0x00000001
+
+//*****************************************************************************
+//
+// MCUCTRL_BUCK3 - Buck control reg 3
+//
+//*****************************************************************************
+// MEM Buck low TON trim value
+#define AM_REG_MCUCTRL_BUCK3_MEMBUCKLOTON_S          18
+#define AM_REG_MCUCTRL_BUCK3_MEMBUCKLOTON_M          0x003C0000
+#define AM_REG_MCUCTRL_BUCK3_MEMBUCKLOTON(n)         (((uint32_t)(n) << 18) & 0x003C0000)
+
+// MEM Buck burst enable 0=disable, 0=disabled, 1=enable.
+#define AM_REG_MCUCTRL_BUCK3_MEMBUCKBURSTEN_S        17
+#define AM_REG_MCUCTRL_BUCK3_MEMBUCKBURSTEN_M        0x00020000
+#define AM_REG_MCUCTRL_BUCK3_MEMBUCKBURSTEN(n)       (((uint32_t)(n) << 17) & 0x00020000)
+
+// Memory buck zero crossing trim value
+#define AM_REG_MCUCTRL_BUCK3_MEMBUCKZXTRIM_S         13
+#define AM_REG_MCUCTRL_BUCK3_MEMBUCKZXTRIM_M         0x0001E000
+#define AM_REG_MCUCTRL_BUCK3_MEMBUCKZXTRIM(n)        (((uint32_t)(n) << 13) & 0x0001E000)
+
+// Hysterisis trim for mem buck
+#define AM_REG_MCUCTRL_BUCK3_MEMBUCKHYSTTRIM_S       11
+#define AM_REG_MCUCTRL_BUCK3_MEMBUCKHYSTTRIM_M       0x00001800
+#define AM_REG_MCUCTRL_BUCK3_MEMBUCKHYSTTRIM(n)      (((uint32_t)(n) << 11) & 0x00001800)
+
+// Core Buck low TON trim value
+#define AM_REG_MCUCTRL_BUCK3_COREBUCKLOTON_S         7
+#define AM_REG_MCUCTRL_BUCK3_COREBUCKLOTON_M         0x00000780
+#define AM_REG_MCUCTRL_BUCK3_COREBUCKLOTON(n)        (((uint32_t)(n) << 7) & 0x00000780)
+
+// Core Buck burst enable. 0=disabled, 1=enabled
+#define AM_REG_MCUCTRL_BUCK3_COREBUCKBURSTEN_S       6
+#define AM_REG_MCUCTRL_BUCK3_COREBUCKBURSTEN_M       0x00000040
+#define AM_REG_MCUCTRL_BUCK3_COREBUCKBURSTEN(n)      (((uint32_t)(n) << 6) & 0x00000040)
+
+// Core buck  zero crossing trim value
+#define AM_REG_MCUCTRL_BUCK3_COREBUCKZXTRIM_S        2
+#define AM_REG_MCUCTRL_BUCK3_COREBUCKZXTRIM_M        0x0000003C
+#define AM_REG_MCUCTRL_BUCK3_COREBUCKZXTRIM(n)       (((uint32_t)(n) << 2) & 0x0000003C)
+
+// Hysterisis trim for core buck
+#define AM_REG_MCUCTRL_BUCK3_COREBUCKHYSTTRIM_S      0
+#define AM_REG_MCUCTRL_BUCK3_COREBUCKHYSTTRIM_M      0x00000003
+#define AM_REG_MCUCTRL_BUCK3_COREBUCKHYSTTRIM(n)     (((uint32_t)(n) << 0) & 0x00000003)
+
+//*****************************************************************************
+//
+// MCUCTRL_LDOREG1 - Analog LDO Reg 1
+//
+//*****************************************************************************
+// CORE LDO IBIAS Trim
+#define AM_REG_MCUCTRL_LDOREG1_CORELDOIBSTRM_S       20
+#define AM_REG_MCUCTRL_LDOREG1_CORELDOIBSTRM_M       0x00100000
+#define AM_REG_MCUCTRL_LDOREG1_CORELDOIBSTRM(n)      (((uint32_t)(n) << 20) & 0x00100000)
+
+// CORE LDO Low Power Trim
+#define AM_REG_MCUCTRL_LDOREG1_CORELDOLPTRIM_S       14
+#define AM_REG_MCUCTRL_LDOREG1_CORELDOLPTRIM_M       0x000FC000
+#define AM_REG_MCUCTRL_LDOREG1_CORELDOLPTRIM(n)      (((uint32_t)(n) << 14) & 0x000FC000)
+
+// CORE LDO tempco trim (R3).
+#define AM_REG_MCUCTRL_LDOREG1_TRIMCORELDOR3_S       10
+#define AM_REG_MCUCTRL_LDOREG1_TRIMCORELDOR3_M       0x00003C00
+#define AM_REG_MCUCTRL_LDOREG1_TRIMCORELDOR3(n)      (((uint32_t)(n) << 10) & 0x00003C00)
+
+// CORE LDO Active mode ouput trim (R1).
+#define AM_REG_MCUCTRL_LDOREG1_TRIMCORELDOR1_S       0
+#define AM_REG_MCUCTRL_LDOREG1_TRIMCORELDOR1_M       0x000003FF
+#define AM_REG_MCUCTRL_LDOREG1_TRIMCORELDOR1(n)      (((uint32_t)(n) << 0) & 0x000003FF)
+
+//*****************************************************************************
+//
+// MCUCTRL_LDOREG3 - LDO Control Register 3
+//
+//*****************************************************************************
+// MEM LDO active mode trim (R1).
+#define AM_REG_MCUCTRL_LDOREG3_TRIMMEMLDOR1_S        12
+#define AM_REG_MCUCTRL_LDOREG3_TRIMMEMLDOR1_M        0x0003F000
+#define AM_REG_MCUCTRL_LDOREG3_TRIMMEMLDOR1(n)       (((uint32_t)(n) << 12) & 0x0003F000)
+
+// MEM LDO TRIM for low power mode with ADC active
+#define AM_REG_MCUCTRL_LDOREG3_MEMLDOLPALTTRIM_S     6
+#define AM_REG_MCUCTRL_LDOREG3_MEMLDOLPALTTRIM_M     0x00000FC0
+#define AM_REG_MCUCTRL_LDOREG3_MEMLDOLPALTTRIM(n)    (((uint32_t)(n) << 6) & 0x00000FC0)
+
+// MEM LDO TRIM for low power mode with ADC inactive
+#define AM_REG_MCUCTRL_LDOREG3_MEMLDOLPTRIM_S        0
+#define AM_REG_MCUCTRL_LDOREG3_MEMLDOLPTRIM_M        0x0000003F
+#define AM_REG_MCUCTRL_LDOREG3_MEMLDOLPTRIM(n)       (((uint32_t)(n) << 0) & 0x0000003F)
+
+//*****************************************************************************
+//
+// MCUCTRL_BODPORCTRL - BOD and PDR control Register
+//
+//*****************************************************************************
+// BOD External Reference Select.
+#define AM_REG_MCUCTRL_BODPORCTRL_BODEXTREFSEL_S     3
+#define AM_REG_MCUCTRL_BODPORCTRL_BODEXTREFSEL_M     0x00000008
+#define AM_REG_MCUCTRL_BODPORCTRL_BODEXTREFSEL(n)    (((uint32_t)(n) << 3) & 0x00000008)
+#define AM_REG_MCUCTRL_BODPORCTRL_BODEXTREFSEL_SELECT 0x00000008
+
+// PDR External Reference Select.
+#define AM_REG_MCUCTRL_BODPORCTRL_PDREXTREFSEL_S     2
+#define AM_REG_MCUCTRL_BODPORCTRL_PDREXTREFSEL_M     0x00000004
+#define AM_REG_MCUCTRL_BODPORCTRL_PDREXTREFSEL(n)    (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_MCUCTRL_BODPORCTRL_PDREXTREFSEL_SELECT 0x00000004
+
+// BOD Power Down.
+#define AM_REG_MCUCTRL_BODPORCTRL_PWDBOD_S           1
+#define AM_REG_MCUCTRL_BODPORCTRL_PWDBOD_M           0x00000002
+#define AM_REG_MCUCTRL_BODPORCTRL_PWDBOD(n)          (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_MCUCTRL_BODPORCTRL_PWDBOD_PWR_DN      0x00000002
+
+// PDR Power Down.
+#define AM_REG_MCUCTRL_BODPORCTRL_PWDPDR_S           0
+#define AM_REG_MCUCTRL_BODPORCTRL_PWDPDR_M           0x00000001
+#define AM_REG_MCUCTRL_BODPORCTRL_PWDPDR(n)          (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_MCUCTRL_BODPORCTRL_PWDPDR_PWR_DN      0x00000001
+
+//*****************************************************************************
+//
+// MCUCTRL_ADCPWRDLY - ADC Power Up Delay Control
+//
+//*****************************************************************************
+// ADC Reference Keeper enable delay in 16 ADC CLK increments for ADC_CLKSEL =
+// 0x1, 8 ADC CLOCK increments for ADC_CLKSEL = 0x2.
+#define AM_REG_MCUCTRL_ADCPWRDLY_ADCPWR1_S           8
+#define AM_REG_MCUCTRL_ADCPWRDLY_ADCPWR1_M           0x0000FF00
+#define AM_REG_MCUCTRL_ADCPWRDLY_ADCPWR1(n)          (((uint32_t)(n) << 8) & 0x0000FF00)
+
+// ADC Reference Buffer Power Enable delay in 64 ADC CLK increments for
+// ADC_CLKSEL = 0x1, 32 ADC CLOCK increments for ADC_CLKSEL = 0x2.
+#define AM_REG_MCUCTRL_ADCPWRDLY_ADCPWR0_S           0
+#define AM_REG_MCUCTRL_ADCPWRDLY_ADCPWR0_M           0x000000FF
+#define AM_REG_MCUCTRL_ADCPWRDLY_ADCPWR0(n)          (((uint32_t)(n) << 0) & 0x000000FF)
+
+//*****************************************************************************
+//
+// MCUCTRL_ADCCAL - ADC Calibration Control
+//
+//*****************************************************************************
+// Status for ADC Calibration
+#define AM_REG_MCUCTRL_ADCCAL_ADCCALIBRATED_S        1
+#define AM_REG_MCUCTRL_ADCCAL_ADCCALIBRATED_M        0x00000002
+#define AM_REG_MCUCTRL_ADCCAL_ADCCALIBRATED(n)       (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_MCUCTRL_ADCCAL_ADCCALIBRATED_FALSE    0x00000000
+#define AM_REG_MCUCTRL_ADCCAL_ADCCALIBRATED_TRUE     0x00000002
+
+// Run ADC Calibration on initial power up sequence
+#define AM_REG_MCUCTRL_ADCCAL_CALONPWRUP_S           0
+#define AM_REG_MCUCTRL_ADCCAL_CALONPWRUP_M           0x00000001
+#define AM_REG_MCUCTRL_ADCCAL_CALONPWRUP(n)          (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_MCUCTRL_ADCCAL_CALONPWRUP_DIS         0x00000000
+#define AM_REG_MCUCTRL_ADCCAL_CALONPWRUP_EN          0x00000001
+
+//*****************************************************************************
+//
+// MCUCTRL_ADCBATTLOAD - ADC Battery Load Enable
+//
+//*****************************************************************************
+// Enable the ADC battery load resistor
+#define AM_REG_MCUCTRL_ADCBATTLOAD_BATTLOAD_S        0
+#define AM_REG_MCUCTRL_ADCBATTLOAD_BATTLOAD_M        0x00000001
+#define AM_REG_MCUCTRL_ADCBATTLOAD_BATTLOAD(n)       (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_MCUCTRL_ADCBATTLOAD_BATTLOAD_DIS      0x00000000
+#define AM_REG_MCUCTRL_ADCBATTLOAD_BATTLOAD_EN       0x00000001
+
+//*****************************************************************************
+//
+// MCUCTRL_BUCKTRIM - Trim settings for Core and Mem buck modules
+//
+//*****************************************************************************
+// RESERVED.
+#define AM_REG_MCUCTRL_BUCKTRIM_RSVD2_S              24
+#define AM_REG_MCUCTRL_BUCKTRIM_RSVD2_M              0x3F000000
+#define AM_REG_MCUCTRL_BUCKTRIM_RSVD2(n)             (((uint32_t)(n) << 24) & 0x3F000000)
+
+// Core Buck voltage output trim bits[9:6]. Concatenate with field COREBUCKR1_LO
+// for the full trim value.
+#define AM_REG_MCUCTRL_BUCKTRIM_COREBUCKR1_HI_S      16
+#define AM_REG_MCUCTRL_BUCKTRIM_COREBUCKR1_HI_M      0x000F0000
+#define AM_REG_MCUCTRL_BUCKTRIM_COREBUCKR1_HI(n)     (((uint32_t)(n) << 16) & 0x000F0000)
+
+// Core Buck voltage output trim bits[5:0], Concatenate with field COREBUCKR1_HI
+// for the full trim value.
+#define AM_REG_MCUCTRL_BUCKTRIM_COREBUCKR1_LO_S      8
+#define AM_REG_MCUCTRL_BUCKTRIM_COREBUCKR1_LO_M      0x00003F00
+#define AM_REG_MCUCTRL_BUCKTRIM_COREBUCKR1_LO(n)     (((uint32_t)(n) << 8) & 0x00003F00)
+
+// Trim values for BUCK regulator.
+#define AM_REG_MCUCTRL_BUCKTRIM_MEMBUCKR1_S          0
+#define AM_REG_MCUCTRL_BUCKTRIM_MEMBUCKR1_M          0x0000003F
+#define AM_REG_MCUCTRL_BUCKTRIM_MEMBUCKR1(n)         (((uint32_t)(n) << 0) & 0x0000003F)
+
+//*****************************************************************************
+//
+// MCUCTRL_EXTCLKSEL - Source selection of LFRC, HFRC and XTAL clock sources
+//
+//*****************************************************************************
+// HFRC External Clock Source Select.
+#define AM_REG_MCUCTRL_EXTCLKSEL_EXT_HF_S            2
+#define AM_REG_MCUCTRL_EXTCLKSEL_EXT_HF_M            0x00000004
+#define AM_REG_MCUCTRL_EXTCLKSEL_EXT_HF(n)           (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_MCUCTRL_EXTCLKSEL_EXT_HF_INT          0x00000000
+#define AM_REG_MCUCTRL_EXTCLKSEL_EXT_HF_EXT          0x00000004
+
+// LFRC External Clock Source Select.
+#define AM_REG_MCUCTRL_EXTCLKSEL_EXT_LF_S            1
+#define AM_REG_MCUCTRL_EXTCLKSEL_EXT_LF_M            0x00000002
+#define AM_REG_MCUCTRL_EXTCLKSEL_EXT_LF(n)           (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_MCUCTRL_EXTCLKSEL_EXT_LF_INT          0x00000000
+#define AM_REG_MCUCTRL_EXTCLKSEL_EXT_LF_EXT          0x00000002
+
+// XTAL External Clock Source Select.
+#define AM_REG_MCUCTRL_EXTCLKSEL_EXT_XT_S            0
+#define AM_REG_MCUCTRL_EXTCLKSEL_EXT_XT_M            0x00000001
+#define AM_REG_MCUCTRL_EXTCLKSEL_EXT_XT(n)           (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_MCUCTRL_EXTCLKSEL_EXT_XT_INT          0x00000000
+#define AM_REG_MCUCTRL_EXTCLKSEL_EXT_XT_EXT          0x00000001
+
+//*****************************************************************************
+//
+// MCUCTRL_BOOTLOADERLOW - Determines whether the bootloader code is visible at
+// address 0x00000000
+//
+//*****************************************************************************
+// Determines whether the bootloader code is visible at address 0x00000000 or
+// not.
+#define AM_REG_MCUCTRL_BOOTLOADERLOW_VALUE_S         0
+#define AM_REG_MCUCTRL_BOOTLOADERLOW_VALUE_M         0x00000001
+#define AM_REG_MCUCTRL_BOOTLOADERLOW_VALUE(n)        (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_MCUCTRL_BOOTLOADERLOW_VALUE_ADDR0     0x00000001
+
+//*****************************************************************************
+//
+// MCUCTRL_SHADOWVALID - Register to indicate whether the shadow registers have
+// been successfully loaded from the Flash Information Space.
+//
+//*****************************************************************************
+// Indicates whether the bootloader should sleep or deep sleep if no image
+// loaded.
+#define AM_REG_MCUCTRL_SHADOWVALID_BL_DSLEEP_S       1
+#define AM_REG_MCUCTRL_SHADOWVALID_BL_DSLEEP_M       0x00000002
+#define AM_REG_MCUCTRL_SHADOWVALID_BL_DSLEEP(n)      (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_MCUCTRL_SHADOWVALID_BL_DSLEEP_DEEPSLEEP 0x00000002
+
+// Indicates whether the shadow registers contain valid data from the Flash
+// Information Space.
+#define AM_REG_MCUCTRL_SHADOWVALID_VALID_S           0
+#define AM_REG_MCUCTRL_SHADOWVALID_VALID_M           0x00000001
+#define AM_REG_MCUCTRL_SHADOWVALID_VALID(n)          (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_MCUCTRL_SHADOWVALID_VALID_VALID       0x00000001
+
+//*****************************************************************************
+//
+// MCUCTRL_ICODEFAULTADDR - ICODE bus address which was present when a bus fault
+// occurred.
+//
+//*****************************************************************************
+// The ICODE bus address observed when a Bus Fault occurred. Once an address is
+// captured in this field, it is held until the corresponding Fault Observed bit
+// is cleared in the FAULTSTATUS register.
+#define AM_REG_MCUCTRL_ICODEFAULTADDR_ADDR_S         0
+#define AM_REG_MCUCTRL_ICODEFAULTADDR_ADDR_M         0xFFFFFFFF
+#define AM_REG_MCUCTRL_ICODEFAULTADDR_ADDR(n)        (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// MCUCTRL_DCODEFAULTADDR - DCODE bus address which was present when a bus fault
+// occurred.
+//
+//*****************************************************************************
+// The DCODE bus address observed when a Bus Fault occurred. Once an address is
+// captured in this field, it is held until the corresponding Fault Observed bit
+// is cleared in the FAULTSTATUS register.
+#define AM_REG_MCUCTRL_DCODEFAULTADDR_ADDR_S         0
+#define AM_REG_MCUCTRL_DCODEFAULTADDR_ADDR_M         0xFFFFFFFF
+#define AM_REG_MCUCTRL_DCODEFAULTADDR_ADDR(n)        (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// MCUCTRL_SYSFAULTADDR - System bus address which was present when a bus fault
+// occurred.
+//
+//*****************************************************************************
+// SYS bus address observed when a Bus Fault occurred. Once an address is
+// captured in this field, it is held until the corresponding Fault Observed bit
+// is cleared in the FAULTSTATUS register.
+#define AM_REG_MCUCTRL_SYSFAULTADDR_ADDR_S           0
+#define AM_REG_MCUCTRL_SYSFAULTADDR_ADDR_M           0xFFFFFFFF
+#define AM_REG_MCUCTRL_SYSFAULTADDR_ADDR(n)          (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// MCUCTRL_FAULTSTATUS - Reflects the status of the bus decoders' fault
+// detection. Any write to this register will clear all of the status bits
+// within the register.
+//
+//*****************************************************************************
+// SYS Bus Decoder Fault Detected bit. When set, a fault has been detected, and
+// the SYSFAULTADDR register will contain the bus address which generated the
+// fault.
+#define AM_REG_MCUCTRL_FAULTSTATUS_SYS_S             2
+#define AM_REG_MCUCTRL_FAULTSTATUS_SYS_M             0x00000004
+#define AM_REG_MCUCTRL_FAULTSTATUS_SYS(n)            (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_MCUCTRL_FAULTSTATUS_SYS_NOFAULT       0x00000000
+#define AM_REG_MCUCTRL_FAULTSTATUS_SYS_FAULT         0x00000004
+
+// DCODE Bus Decoder Fault Detected bit. When set, a fault has been detected,
+// and the DCODEFAULTADDR register will contain the bus address which generated
+// the fault.
+#define AM_REG_MCUCTRL_FAULTSTATUS_DCODE_S           1
+#define AM_REG_MCUCTRL_FAULTSTATUS_DCODE_M           0x00000002
+#define AM_REG_MCUCTRL_FAULTSTATUS_DCODE(n)          (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_MCUCTRL_FAULTSTATUS_DCODE_NOFAULT     0x00000000
+#define AM_REG_MCUCTRL_FAULTSTATUS_DCODE_FAULT       0x00000002
+
+// The ICODE Bus Decoder Fault Detected bit. When set, a fault has been
+// detected, and the ICODEFAULTADDR register will contain the bus address which
+// generated the fault.
+#define AM_REG_MCUCTRL_FAULTSTATUS_ICODE_S           0
+#define AM_REG_MCUCTRL_FAULTSTATUS_ICODE_M           0x00000001
+#define AM_REG_MCUCTRL_FAULTSTATUS_ICODE(n)          (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_MCUCTRL_FAULTSTATUS_ICODE_NOFAULT     0x00000000
+#define AM_REG_MCUCTRL_FAULTSTATUS_ICODE_FAULT       0x00000001
+
+//*****************************************************************************
+//
+// MCUCTRL_FAULTCAPTUREEN - Enable the fault capture registers
+//
+//*****************************************************************************
+// Fault Capture Enable field. When set, the Fault Capture monitors are enabled
+// and addresses which generate a hard fault are captured into the FAULTADDR
+// registers.
+#define AM_REG_MCUCTRL_FAULTCAPTUREEN_ENABLE_S       0
+#define AM_REG_MCUCTRL_FAULTCAPTUREEN_ENABLE_M       0x00000001
+#define AM_REG_MCUCTRL_FAULTCAPTUREEN_ENABLE(n)      (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_MCUCTRL_FAULTCAPTUREEN_ENABLE_DIS     0x00000000
+#define AM_REG_MCUCTRL_FAULTCAPTUREEN_ENABLE_EN      0x00000001
+
+//*****************************************************************************
+//
+// MCUCTRL_DBGR1 - Read-only debug register 1
+//
+//*****************************************************************************
+// Read-only register for communication validation
+#define AM_REG_MCUCTRL_DBGR1_ONETO8_S                0
+#define AM_REG_MCUCTRL_DBGR1_ONETO8_M                0xFFFFFFFF
+#define AM_REG_MCUCTRL_DBGR1_ONETO8(n)               (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// MCUCTRL_DBGR2 - Read-only debug register 2
+//
+//*****************************************************************************
+// Read-only register for communication validation
+#define AM_REG_MCUCTRL_DBGR2_COOLCODE_S              0
+#define AM_REG_MCUCTRL_DBGR2_COOLCODE_M              0xFFFFFFFF
+#define AM_REG_MCUCTRL_DBGR2_COOLCODE(n)             (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// MCUCTRL_PMUENABLE - Control bit to enable/disable the PMU
+//
+//*****************************************************************************
+// PMU Enable Control bit. When set, the MCU's PMU will place the MCU into the
+// lowest power consuming Deep Sleep mode upon execution of a WFI instruction
+// (dependent on the setting of the SLEEPDEEP bit in the ARM SCR register). When
+// cleared, regardless of the requested sleep mode, the PMU will not enter the
+// lowest power Deep Sleep mode, instead entering the Sleep mode.
+#define AM_REG_MCUCTRL_PMUENABLE_ENABLE_S            0
+#define AM_REG_MCUCTRL_PMUENABLE_ENABLE_M            0x00000001
+#define AM_REG_MCUCTRL_PMUENABLE_ENABLE(n)           (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_MCUCTRL_PMUENABLE_ENABLE_DIS          0x00000000
+#define AM_REG_MCUCTRL_PMUENABLE_ENABLE_EN           0x00000001
+
+//*****************************************************************************
+//
+// MCUCTRL_TPIUCTRL - TPIU Control Register. Determines the clock enable and
+// frequency for the M4's TPIU interface.
+//
+//*****************************************************************************
+// This field selects the frequency of the ARM M4 TPIU port.
+#define AM_REG_MCUCTRL_TPIUCTRL_CLKSEL_S             8
+#define AM_REG_MCUCTRL_TPIUCTRL_CLKSEL_M             0x00000700
+#define AM_REG_MCUCTRL_TPIUCTRL_CLKSEL(n)            (((uint32_t)(n) << 8) & 0x00000700)
+#define AM_REG_MCUCTRL_TPIUCTRL_CLKSEL_LOW_PWR       0x00000000
+#define AM_REG_MCUCTRL_TPIUCTRL_CLKSEL_0MHz          0x00000000
+#define AM_REG_MCUCTRL_TPIUCTRL_CLKSEL_HFRC_DIV_2    0x00000100
+#define AM_REG_MCUCTRL_TPIUCTRL_CLKSEL_HFRC_DIV_8    0x00000200
+#define AM_REG_MCUCTRL_TPIUCTRL_CLKSEL_HFRC_DIV_16   0x00000300
+#define AM_REG_MCUCTRL_TPIUCTRL_CLKSEL_HFRC_DIV_32   0x00000400
+
+// TPIU Enable field. When set, the ARM M4 TPIU is enabled and data can be
+// streamed out of the MCU's SWO port using the ARM ITM and TPIU modules.
+#define AM_REG_MCUCTRL_TPIUCTRL_ENABLE_S             0
+#define AM_REG_MCUCTRL_TPIUCTRL_ENABLE_M             0x00000001
+#define AM_REG_MCUCTRL_TPIUCTRL_ENABLE(n)            (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_MCUCTRL_TPIUCTRL_ENABLE_DIS           0x00000000
+#define AM_REG_MCUCTRL_TPIUCTRL_ENABLE_EN            0x00000001
+
+#endif // AM_REG_MCUCTRL_H
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_nvic.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_nvic.h
new file mode 100644
index 000000000..d10bbc485
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_nvic.h
@@ -0,0 +1,324 @@
+//*****************************************************************************
+//
+//! @file am_reg_nvic.h
+//!
+//! @brief Register macros for the NVIC module
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_REG_NVIC_H
+#define AM_REG_NVIC_H
+
+//*****************************************************************************
+//
+// Instance finder. (1 instance(s) available)
+//
+//*****************************************************************************
+#define AM_REG_NVIC_NUM_MODULES                      1
+#define AM_REG_NVICn(n) \
+    (REG_NVIC_BASEADDR + 0x00000000 * n)
+
+//*****************************************************************************
+//
+// Register offsets.
+//
+//*****************************************************************************
+#define AM_REG_NVIC_ISER0_O                          0xE000E100
+#define AM_REG_NVIC_ICER0_O                          0xE000E180
+#define AM_REG_NVIC_ISPR0_O                          0xE000E200
+#define AM_REG_NVIC_ICPR0_O                          0xE000E280
+#define AM_REG_NVIC_IABR0_O                          0xE000E300
+#define AM_REG_NVIC_IPR0_O                           0xE000E400
+#define AM_REG_NVIC_IPR1_O                           0xE000E404
+#define AM_REG_NVIC_IPR2_O                           0xE000E408
+#define AM_REG_NVIC_IPR3_O                           0xE000E40C
+#define AM_REG_NVIC_IPR4_O                           0xE000E410
+#define AM_REG_NVIC_IPR5_O                           0xE000E414
+#define AM_REG_NVIC_IPR6_O                           0xE000E418
+#define AM_REG_NVIC_IPR7_O                           0xE000E41C
+
+//*****************************************************************************
+//
+// NVIC_ISER0 - Interrupt Set-Enable Register 0
+//
+//*****************************************************************************
+// NVIC_ISERn[31:0] are the set-enable bits for interrupts 31 through 0.
+#define AM_REG_NVIC_ISER0_BITS_S                     0
+#define AM_REG_NVIC_ISER0_BITS_M                     0xFFFFFFFF
+#define AM_REG_NVIC_ISER0_BITS(n)                    (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// NVIC_ICER0 - Interrupt Clear-Enable Register 0
+//
+//*****************************************************************************
+// NVIC_ISERn[31:0] are the clear-enable bits for interrupts 31 through 0.
+#define AM_REG_NVIC_ICER0_BITS_S                     0
+#define AM_REG_NVIC_ICER0_BITS_M                     0xFFFFFFFF
+#define AM_REG_NVIC_ICER0_BITS(n)                    (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// NVIC_ISPR0 - Interrupt Set-Pending Register 0
+//
+//*****************************************************************************
+// NVIC_ISERn[31:0] are the set-pending bits for interrupts 31 through 0.
+#define AM_REG_NVIC_ISPR0_BITS_S                     0
+#define AM_REG_NVIC_ISPR0_BITS_M                     0xFFFFFFFF
+#define AM_REG_NVIC_ISPR0_BITS(n)                    (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// NVIC_ICPR0 - Interrupt Clear-Pending Register 0
+//
+//*****************************************************************************
+// NVIC_ISERn[31:0] are the clear-pending bits for interrupts 31 through 0.
+#define AM_REG_NVIC_ICPR0_BITS_S                     0
+#define AM_REG_NVIC_ICPR0_BITS_M                     0xFFFFFFFF
+#define AM_REG_NVIC_ICPR0_BITS(n)                    (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// NVIC_IABR0 - Interrupt Active Bit Register 0
+//
+//*****************************************************************************
+// NVIC_ISERn[31:0] are the interrupt active bits for interrupts 31 through 0.
+#define AM_REG_NVIC_IABR0_BITS_S                     0
+#define AM_REG_NVIC_IABR0_BITS_M                     0xFFFFFFFF
+#define AM_REG_NVIC_IABR0_BITS(n)                    (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// NVIC_IPR0 - Interrupt Priority Register 0
+//
+//*****************************************************************************
+// Priority assignment for interrupt vector 3.
+#define AM_REG_NVIC_IPR0_PRI_N3_S                    24
+#define AM_REG_NVIC_IPR0_PRI_N3_M                    0xFF000000
+#define AM_REG_NVIC_IPR0_PRI_N3(n)                   (((uint32_t)(n) << 24) & 0xFF000000)
+
+// Priority assignment for interrupt vector 2.
+#define AM_REG_NVIC_IPR0_PRI_N2_S                    16
+#define AM_REG_NVIC_IPR0_PRI_N2_M                    0x00FF0000
+#define AM_REG_NVIC_IPR0_PRI_N2(n)                   (((uint32_t)(n) << 16) & 0x00FF0000)
+
+// Priority assignment for interrupt vector 1.
+#define AM_REG_NVIC_IPR0_PRI_N1_S                    8
+#define AM_REG_NVIC_IPR0_PRI_N1_M                    0x0000FF00
+#define AM_REG_NVIC_IPR0_PRI_N1(n)                   (((uint32_t)(n) << 8) & 0x0000FF00)
+
+// Priority assignment for interrupt vector 0.
+#define AM_REG_NVIC_IPR0_PRI_N0_S                    0
+#define AM_REG_NVIC_IPR0_PRI_N0_M                    0x000000FF
+#define AM_REG_NVIC_IPR0_PRI_N0(n)                   (((uint32_t)(n) << 0) & 0x000000FF)
+
+//*****************************************************************************
+//
+// NVIC_IPR1 - Interrupt Priority Register 1
+//
+//*****************************************************************************
+// Priority assignment for interrupt vector 7.
+#define AM_REG_NVIC_IPR1_PRI_N3_S                    24
+#define AM_REG_NVIC_IPR1_PRI_N3_M                    0xFF000000
+#define AM_REG_NVIC_IPR1_PRI_N3(n)                   (((uint32_t)(n) << 24) & 0xFF000000)
+
+// Priority assignment for interrupt vector 6.
+#define AM_REG_NVIC_IPR1_PRI_N2_S                    16
+#define AM_REG_NVIC_IPR1_PRI_N2_M                    0x00FF0000
+#define AM_REG_NVIC_IPR1_PRI_N2(n)                   (((uint32_t)(n) << 16) & 0x00FF0000)
+
+// Priority assignment for interrupt vector 5.
+#define AM_REG_NVIC_IPR1_PRI_N1_S                    8
+#define AM_REG_NVIC_IPR1_PRI_N1_M                    0x0000FF00
+#define AM_REG_NVIC_IPR1_PRI_N1(n)                   (((uint32_t)(n) << 8) & 0x0000FF00)
+
+// Priority assignment for interrupt vector 4.
+#define AM_REG_NVIC_IPR1_PRI_N0_S                    0
+#define AM_REG_NVIC_IPR1_PRI_N0_M                    0x000000FF
+#define AM_REG_NVIC_IPR1_PRI_N0(n)                   (((uint32_t)(n) << 0) & 0x000000FF)
+
+//*****************************************************************************
+//
+// NVIC_IPR2 - Interrupt Priority Register 2
+//
+//*****************************************************************************
+// Priority assignment for interrupt vector 11.
+#define AM_REG_NVIC_IPR2_PRI_N3_S                    24
+#define AM_REG_NVIC_IPR2_PRI_N3_M                    0xFF000000
+#define AM_REG_NVIC_IPR2_PRI_N3(n)                   (((uint32_t)(n) << 24) & 0xFF000000)
+
+// Priority assignment for interrupt vector 10.
+#define AM_REG_NVIC_IPR2_PRI_N2_S                    16
+#define AM_REG_NVIC_IPR2_PRI_N2_M                    0x00FF0000
+#define AM_REG_NVIC_IPR2_PRI_N2(n)                   (((uint32_t)(n) << 16) & 0x00FF0000)
+
+// Priority assignment for interrupt vector 9.
+#define AM_REG_NVIC_IPR2_PRI_N1_S                    8
+#define AM_REG_NVIC_IPR2_PRI_N1_M                    0x0000FF00
+#define AM_REG_NVIC_IPR2_PRI_N1(n)                   (((uint32_t)(n) << 8) & 0x0000FF00)
+
+// Priority assignment for interrupt vector 8.
+#define AM_REG_NVIC_IPR2_PRI_N0_S                    0
+#define AM_REG_NVIC_IPR2_PRI_N0_M                    0x000000FF
+#define AM_REG_NVIC_IPR2_PRI_N0(n)                   (((uint32_t)(n) << 0) & 0x000000FF)
+
+//*****************************************************************************
+//
+// NVIC_IPR3 - Interrupt Priority Register 3
+//
+//*****************************************************************************
+// Priority assignment for interrupt vector 15.
+#define AM_REG_NVIC_IPR3_PRI_N3_S                    24
+#define AM_REG_NVIC_IPR3_PRI_N3_M                    0xFF000000
+#define AM_REG_NVIC_IPR3_PRI_N3(n)                   (((uint32_t)(n) << 24) & 0xFF000000)
+
+// Priority assignment for interrupt vector 14.
+#define AM_REG_NVIC_IPR3_PRI_N2_S                    16
+#define AM_REG_NVIC_IPR3_PRI_N2_M                    0x00FF0000
+#define AM_REG_NVIC_IPR3_PRI_N2(n)                   (((uint32_t)(n) << 16) & 0x00FF0000)
+
+// Priority assignment for interrupt vector 13.
+#define AM_REG_NVIC_IPR3_PRI_N1_S                    8
+#define AM_REG_NVIC_IPR3_PRI_N1_M                    0x0000FF00
+#define AM_REG_NVIC_IPR3_PRI_N1(n)                   (((uint32_t)(n) << 8) & 0x0000FF00)
+
+// Priority assignment for interrupt vector 12.
+#define AM_REG_NVIC_IPR3_PRI_N0_S                    0
+#define AM_REG_NVIC_IPR3_PRI_N0_M                    0x000000FF
+#define AM_REG_NVIC_IPR3_PRI_N0(n)                   (((uint32_t)(n) << 0) & 0x000000FF)
+
+//*****************************************************************************
+//
+// NVIC_IPR4 - Interrupt Priority Register 4
+//
+//*****************************************************************************
+// Priority assignment for interrupt vector 19.
+#define AM_REG_NVIC_IPR4_PRI_N3_S                    24
+#define AM_REG_NVIC_IPR4_PRI_N3_M                    0xFF000000
+#define AM_REG_NVIC_IPR4_PRI_N3(n)                   (((uint32_t)(n) << 24) & 0xFF000000)
+
+// Priority assignment for interrupt vector 18.
+#define AM_REG_NVIC_IPR4_PRI_N2_S                    16
+#define AM_REG_NVIC_IPR4_PRI_N2_M                    0x00FF0000
+#define AM_REG_NVIC_IPR4_PRI_N2(n)                   (((uint32_t)(n) << 16) & 0x00FF0000)
+
+// Priority assignment for interrupt vector 17.
+#define AM_REG_NVIC_IPR4_PRI_N1_S                    8
+#define AM_REG_NVIC_IPR4_PRI_N1_M                    0x0000FF00
+#define AM_REG_NVIC_IPR4_PRI_N1(n)                   (((uint32_t)(n) << 8) & 0x0000FF00)
+
+// Priority assignment for interrupt vector 16.
+#define AM_REG_NVIC_IPR4_PRI_N0_S                    0
+#define AM_REG_NVIC_IPR4_PRI_N0_M                    0x000000FF
+#define AM_REG_NVIC_IPR4_PRI_N0(n)                   (((uint32_t)(n) << 0) & 0x000000FF)
+
+//*****************************************************************************
+//
+// NVIC_IPR5 - Interrupt Priority Register 5
+//
+//*****************************************************************************
+// Priority assignment for interrupt vector 23.
+#define AM_REG_NVIC_IPR5_PRI_N3_S                    24
+#define AM_REG_NVIC_IPR5_PRI_N3_M                    0xFF000000
+#define AM_REG_NVIC_IPR5_PRI_N3(n)                   (((uint32_t)(n) << 24) & 0xFF000000)
+
+// Priority assignment for interrupt vector 22.
+#define AM_REG_NVIC_IPR5_PRI_N2_S                    16
+#define AM_REG_NVIC_IPR5_PRI_N2_M                    0x00FF0000
+#define AM_REG_NVIC_IPR5_PRI_N2(n)                   (((uint32_t)(n) << 16) & 0x00FF0000)
+
+// Priority assignment for interrupt vector 21.
+#define AM_REG_NVIC_IPR5_PRI_N1_S                    8
+#define AM_REG_NVIC_IPR5_PRI_N1_M                    0x0000FF00
+#define AM_REG_NVIC_IPR5_PRI_N1(n)                   (((uint32_t)(n) << 8) & 0x0000FF00)
+
+// Priority assignment for interrupt vector 20.
+#define AM_REG_NVIC_IPR5_PRI_N0_S                    0
+#define AM_REG_NVIC_IPR5_PRI_N0_M                    0x000000FF
+#define AM_REG_NVIC_IPR5_PRI_N0(n)                   (((uint32_t)(n) << 0) & 0x000000FF)
+
+//*****************************************************************************
+//
+// NVIC_IPR6 - Interrupt Priority Register 6
+//
+//*****************************************************************************
+// Priority assignment for interrupt vector 27.
+#define AM_REG_NVIC_IPR6_PRI_N3_S                    24
+#define AM_REG_NVIC_IPR6_PRI_N3_M                    0xFF000000
+#define AM_REG_NVIC_IPR6_PRI_N3(n)                   (((uint32_t)(n) << 24) & 0xFF000000)
+
+// Priority assignment for interrupt vector 26.
+#define AM_REG_NVIC_IPR6_PRI_N2_S                    16
+#define AM_REG_NVIC_IPR6_PRI_N2_M                    0x00FF0000
+#define AM_REG_NVIC_IPR6_PRI_N2(n)                   (((uint32_t)(n) << 16) & 0x00FF0000)
+
+// Priority assignment for interrupt vector 25.
+#define AM_REG_NVIC_IPR6_PRI_N1_S                    8
+#define AM_REG_NVIC_IPR6_PRI_N1_M                    0x0000FF00
+#define AM_REG_NVIC_IPR6_PRI_N1(n)                   (((uint32_t)(n) << 8) & 0x0000FF00)
+
+// Priority assignment for interrupt vector 24.
+#define AM_REG_NVIC_IPR6_PRI_N0_S                    0
+#define AM_REG_NVIC_IPR6_PRI_N0_M                    0x000000FF
+#define AM_REG_NVIC_IPR6_PRI_N0(n)                   (((uint32_t)(n) << 0) & 0x000000FF)
+
+//*****************************************************************************
+//
+// NVIC_IPR7 - Interrupt Priority Register 7
+//
+//*****************************************************************************
+// Priority assignment for interrupt vector 31.
+#define AM_REG_NVIC_IPR7_PRI_N3_S                    24
+#define AM_REG_NVIC_IPR7_PRI_N3_M                    0xFF000000
+#define AM_REG_NVIC_IPR7_PRI_N3(n)                   (((uint32_t)(n) << 24) & 0xFF000000)
+
+// Priority assignment for interrupt vector 30.
+#define AM_REG_NVIC_IPR7_PRI_N2_S                    16
+#define AM_REG_NVIC_IPR7_PRI_N2_M                    0x00FF0000
+#define AM_REG_NVIC_IPR7_PRI_N2(n)                   (((uint32_t)(n) << 16) & 0x00FF0000)
+
+// Priority assignment for interrupt vector 29.
+#define AM_REG_NVIC_IPR7_PRI_N1_S                    8
+#define AM_REG_NVIC_IPR7_PRI_N1_M                    0x0000FF00
+#define AM_REG_NVIC_IPR7_PRI_N1(n)                   (((uint32_t)(n) << 8) & 0x0000FF00)
+
+// Priority assignment for interrupt vector 28.
+#define AM_REG_NVIC_IPR7_PRI_N0_S                    0
+#define AM_REG_NVIC_IPR7_PRI_N0_M                    0x000000FF
+#define AM_REG_NVIC_IPR7_PRI_N0(n)                   (((uint32_t)(n) << 0) & 0x000000FF)
+
+#endif // AM_REG_NVIC_H
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_pdm.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_pdm.h
new file mode 100644
index 000000000..13ed42568
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_pdm.h
@@ -0,0 +1,373 @@
+//*****************************************************************************
+//
+//! @file am_reg_pdm.h
+//!
+//! @brief Register macros for the PDM module
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_REG_PDM_H
+#define AM_REG_PDM_H
+
+//*****************************************************************************
+//
+// Instance finder. (1 instance(s) available)
+//
+//*****************************************************************************
+#define AM_REG_PDM_NUM_MODULES                       1
+#define AM_REG_PDMn(n) \
+    (REG_PDM_BASEADDR + 0x00000000 * n)
+
+//*****************************************************************************
+//
+// Register offsets.
+//
+//*****************************************************************************
+#define AM_REG_PDM_PCFG_O                            0x00000000
+#define AM_REG_PDM_VCFG_O                            0x00000004
+#define AM_REG_PDM_FR_O                              0x00000008
+#define AM_REG_PDM_FRD_O                             0x0000000C
+#define AM_REG_PDM_FLUSH_O                           0x00000010
+#define AM_REG_PDM_FTHR_O                            0x00000014
+#define AM_REG_PDM_INTEN_O                           0x00000200
+#define AM_REG_PDM_INTSTAT_O                         0x00000204
+#define AM_REG_PDM_INTCLR_O                          0x00000208
+#define AM_REG_PDM_INTSET_O                          0x0000020C
+
+//*****************************************************************************
+//
+// PDM_INTEN - IO Master Interrupts: Enable
+//
+//*****************************************************************************
+// This is the FIFO underflow interrupt.
+#define AM_REG_PDM_INTEN_UNDFL_S                     2
+#define AM_REG_PDM_INTEN_UNDFL_M                     0x00000004
+#define AM_REG_PDM_INTEN_UNDFL(n)                    (((uint32_t)(n) << 2) & 0x00000004)
+
+// This is the FIFO overflow interrupt.
+#define AM_REG_PDM_INTEN_OVF_S                       1
+#define AM_REG_PDM_INTEN_OVF_M                       0x00000002
+#define AM_REG_PDM_INTEN_OVF(n)                      (((uint32_t)(n) << 1) & 0x00000002)
+
+// This is the FIFO threshold interrupt.
+#define AM_REG_PDM_INTEN_THR_S                       0
+#define AM_REG_PDM_INTEN_THR_M                       0x00000001
+#define AM_REG_PDM_INTEN_THR(n)                      (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// PDM_INTSTAT - IO Master Interrupts: Status
+//
+//*****************************************************************************
+// This is the FIFO underflow interrupt.
+#define AM_REG_PDM_INTSTAT_UNDFL_S                   2
+#define AM_REG_PDM_INTSTAT_UNDFL_M                   0x00000004
+#define AM_REG_PDM_INTSTAT_UNDFL(n)                  (((uint32_t)(n) << 2) & 0x00000004)
+
+// This is the FIFO overflow interrupt.
+#define AM_REG_PDM_INTSTAT_OVF_S                     1
+#define AM_REG_PDM_INTSTAT_OVF_M                     0x00000002
+#define AM_REG_PDM_INTSTAT_OVF(n)                    (((uint32_t)(n) << 1) & 0x00000002)
+
+// This is the FIFO threshold interrupt.
+#define AM_REG_PDM_INTSTAT_THR_S                     0
+#define AM_REG_PDM_INTSTAT_THR_M                     0x00000001
+#define AM_REG_PDM_INTSTAT_THR(n)                    (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// PDM_INTCLR - IO Master Interrupts: Clear
+//
+//*****************************************************************************
+// This is the FIFO underflow interrupt.
+#define AM_REG_PDM_INTCLR_UNDFL_S                    2
+#define AM_REG_PDM_INTCLR_UNDFL_M                    0x00000004
+#define AM_REG_PDM_INTCLR_UNDFL(n)                   (((uint32_t)(n) << 2) & 0x00000004)
+
+// This is the FIFO overflow interrupt.
+#define AM_REG_PDM_INTCLR_OVF_S                      1
+#define AM_REG_PDM_INTCLR_OVF_M                      0x00000002
+#define AM_REG_PDM_INTCLR_OVF(n)                     (((uint32_t)(n) << 1) & 0x00000002)
+
+// This is the FIFO threshold interrupt.
+#define AM_REG_PDM_INTCLR_THR_S                      0
+#define AM_REG_PDM_INTCLR_THR_M                      0x00000001
+#define AM_REG_PDM_INTCLR_THR(n)                     (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// PDM_INTSET - IO Master Interrupts: Set
+//
+//*****************************************************************************
+// This is the FIFO underflow interrupt.
+#define AM_REG_PDM_INTSET_UNDFL_S                    2
+#define AM_REG_PDM_INTSET_UNDFL_M                    0x00000004
+#define AM_REG_PDM_INTSET_UNDFL(n)                   (((uint32_t)(n) << 2) & 0x00000004)
+
+// This is the FIFO overflow interrupt.
+#define AM_REG_PDM_INTSET_OVF_S                      1
+#define AM_REG_PDM_INTSET_OVF_M                      0x00000002
+#define AM_REG_PDM_INTSET_OVF(n)                     (((uint32_t)(n) << 1) & 0x00000002)
+
+// This is the FIFO threshold interrupt.
+#define AM_REG_PDM_INTSET_THR_S                      0
+#define AM_REG_PDM_INTSET_THR_M                      0x00000001
+#define AM_REG_PDM_INTSET_THR(n)                     (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// PDM_PCFG - PDM Configuration Register
+//
+//*****************************************************************************
+// Left/right channel swap.
+#define AM_REG_PDM_PCFG_LRSWAP_S                     31
+#define AM_REG_PDM_PCFG_LRSWAP_M                     0x80000000
+#define AM_REG_PDM_PCFG_LRSWAP(n)                    (((uint32_t)(n) << 31) & 0x80000000)
+#define AM_REG_PDM_PCFG_LRSWAP_EN                    0x80000000
+#define AM_REG_PDM_PCFG_LRSWAP_NOSWAP                0x00000000
+
+// Right channel PGA gain.
+#define AM_REG_PDM_PCFG_PGARIGHT_S                   27
+#define AM_REG_PDM_PCFG_PGARIGHT_M                   0x78000000
+#define AM_REG_PDM_PCFG_PGARIGHT(n)                  (((uint32_t)(n) << 27) & 0x78000000)
+#define AM_REG_PDM_PCFG_PGARIGHT_M15DB               0x78000000
+#define AM_REG_PDM_PCFG_PGARIGHT_M300DB              0x70000000
+#define AM_REG_PDM_PCFG_PGARIGHT_M45DB               0x68000000
+#define AM_REG_PDM_PCFG_PGARIGHT_M60DB               0x60000000
+#define AM_REG_PDM_PCFG_PGARIGHT_M75DB               0x58000000
+#define AM_REG_PDM_PCFG_PGARIGHT_M90DB               0x50000000
+#define AM_REG_PDM_PCFG_PGARIGHT_M105DB              0x48000000
+#define AM_REG_PDM_PCFG_PGARIGHT_M120DB              0x40000000
+#define AM_REG_PDM_PCFG_PGARIGHT_P105DB              0x38000000
+#define AM_REG_PDM_PCFG_PGARIGHT_P90DB               0x30000000
+#define AM_REG_PDM_PCFG_PGARIGHT_P75DB               0x28000000
+#define AM_REG_PDM_PCFG_PGARIGHT_P60DB               0x20000000
+#define AM_REG_PDM_PCFG_PGARIGHT_P45DB               0x18000000
+#define AM_REG_PDM_PCFG_PGARIGHT_P30DB               0x10000000
+#define AM_REG_PDM_PCFG_PGARIGHT_P15DB               0x08000000
+#define AM_REG_PDM_PCFG_PGARIGHT_0DB                 0x00000000
+
+// Left channel PGA gain.
+#define AM_REG_PDM_PCFG_PGALEFT_S                    23
+#define AM_REG_PDM_PCFG_PGALEFT_M                    0x07800000
+#define AM_REG_PDM_PCFG_PGALEFT(n)                   (((uint32_t)(n) << 23) & 0x07800000)
+#define AM_REG_PDM_PCFG_PGALEFT_M15DB                0x07800000
+#define AM_REG_PDM_PCFG_PGALEFT_M300DB               0x07000000
+#define AM_REG_PDM_PCFG_PGALEFT_M45DB                0x06800000
+#define AM_REG_PDM_PCFG_PGALEFT_M60DB                0x06000000
+#define AM_REG_PDM_PCFG_PGALEFT_M75DB                0x05800000
+#define AM_REG_PDM_PCFG_PGALEFT_M90DB                0x05000000
+#define AM_REG_PDM_PCFG_PGALEFT_M105DB               0x04800000
+#define AM_REG_PDM_PCFG_PGALEFT_M120DB               0x04000000
+#define AM_REG_PDM_PCFG_PGALEFT_P105DB               0x03800000
+#define AM_REG_PDM_PCFG_PGALEFT_P90DB                0x03000000
+#define AM_REG_PDM_PCFG_PGALEFT_P75DB                0x02800000
+#define AM_REG_PDM_PCFG_PGALEFT_P60DB                0x02000000
+#define AM_REG_PDM_PCFG_PGALEFT_P45DB                0x01800000
+#define AM_REG_PDM_PCFG_PGALEFT_P30DB                0x01000000
+#define AM_REG_PDM_PCFG_PGALEFT_P15DB                0x00800000
+#define AM_REG_PDM_PCFG_PGALEFT_0DB                  0x00000000
+
+// PDM_CLK frequency divisor.
+#define AM_REG_PDM_PCFG_MCLKDIV_S                    17
+#define AM_REG_PDM_PCFG_MCLKDIV_M                    0x00060000
+#define AM_REG_PDM_PCFG_MCLKDIV(n)                   (((uint32_t)(n) << 17) & 0x00060000)
+#define AM_REG_PDM_PCFG_MCLKDIV_MCKDIV4              0x00060000
+#define AM_REG_PDM_PCFG_MCLKDIV_MCKDIV3              0x00040000
+#define AM_REG_PDM_PCFG_MCLKDIV_MCKDIV2              0x00020000
+#define AM_REG_PDM_PCFG_MCLKDIV_MCKDIV1              0x00000000
+
+// SINC decimation rate.
+#define AM_REG_PDM_PCFG_SINCRATE_S                   10
+#define AM_REG_PDM_PCFG_SINCRATE_M                   0x0001FC00
+#define AM_REG_PDM_PCFG_SINCRATE(n)                  (((uint32_t)(n) << 10) & 0x0001FC00)
+
+// High pass filter control.
+#define AM_REG_PDM_PCFG_ADCHPD_S                     9
+#define AM_REG_PDM_PCFG_ADCHPD_M                     0x00000200
+#define AM_REG_PDM_PCFG_ADCHPD(n)                    (((uint32_t)(n) << 9) & 0x00000200)
+#define AM_REG_PDM_PCFG_ADCHPD_EN                    0x00000200
+#define AM_REG_PDM_PCFG_ADCHPD_DIS                   0x00000000
+
+// High pass filter coefficients.
+#define AM_REG_PDM_PCFG_HPCUTOFF_S                   5
+#define AM_REG_PDM_PCFG_HPCUTOFF_M                   0x000001E0
+#define AM_REG_PDM_PCFG_HPCUTOFF(n)                  (((uint32_t)(n) << 5) & 0x000001E0)
+
+// Number of clocks during gain-setting changes.
+#define AM_REG_PDM_PCFG_CYCLES_S                     2
+#define AM_REG_PDM_PCFG_CYCLES_M                     0x0000001C
+#define AM_REG_PDM_PCFG_CYCLES(n)                    (((uint32_t)(n) << 2) & 0x0000001C)
+
+// Soft mute control.
+#define AM_REG_PDM_PCFG_SOFTMUTE_S                   1
+#define AM_REG_PDM_PCFG_SOFTMUTE_M                   0x00000002
+#define AM_REG_PDM_PCFG_SOFTMUTE(n)                  (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_PDM_PCFG_SOFTMUTE_EN                  0x00000002
+#define AM_REG_PDM_PCFG_SOFTMUTE_DIS                 0x00000000
+
+// Data Streaming Control.
+#define AM_REG_PDM_PCFG_PDMCORE_S                    0
+#define AM_REG_PDM_PCFG_PDMCORE_M                    0x00000001
+#define AM_REG_PDM_PCFG_PDMCORE(n)                   (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_PDM_PCFG_PDMCORE_EN                   0x00000001
+#define AM_REG_PDM_PCFG_PDMCORE_DIS                  0x00000000
+
+//*****************************************************************************
+//
+// PDM_VCFG - Voice Configuration Register
+//
+//*****************************************************************************
+// Enable the IO clock.
+#define AM_REG_PDM_VCFG_IOCLKEN_S                    31
+#define AM_REG_PDM_VCFG_IOCLKEN_M                    0x80000000
+#define AM_REG_PDM_VCFG_IOCLKEN(n)                   (((uint32_t)(n) << 31) & 0x80000000)
+#define AM_REG_PDM_VCFG_IOCLKEN_DIS                  0x00000000
+#define AM_REG_PDM_VCFG_IOCLKEN_EN                   0x80000000
+
+// Reset the IP core.
+#define AM_REG_PDM_VCFG_RSTB_S                       30
+#define AM_REG_PDM_VCFG_RSTB_M                       0x40000000
+#define AM_REG_PDM_VCFG_RSTB(n)                      (((uint32_t)(n) << 30) & 0x40000000)
+#define AM_REG_PDM_VCFG_RSTB_RESET                   0x00000000
+#define AM_REG_PDM_VCFG_RSTB_NORM                    0x40000000
+
+// Select the PDM input clock.
+#define AM_REG_PDM_VCFG_PDMCLKSEL_S                  27
+#define AM_REG_PDM_VCFG_PDMCLKSEL_M                  0x38000000
+#define AM_REG_PDM_VCFG_PDMCLKSEL(n)                 (((uint32_t)(n) << 27) & 0x38000000)
+#define AM_REG_PDM_VCFG_PDMCLKSEL_DISABLE            0x00000000
+#define AM_REG_PDM_VCFG_PDMCLKSEL_12MHz              0x08000000
+#define AM_REG_PDM_VCFG_PDMCLKSEL_6MHz               0x10000000
+#define AM_REG_PDM_VCFG_PDMCLKSEL_3MHz               0x18000000
+#define AM_REG_PDM_VCFG_PDMCLKSEL_1_5MHz             0x20000000
+#define AM_REG_PDM_VCFG_PDMCLKSEL_750KHz             0x28000000
+#define AM_REG_PDM_VCFG_PDMCLKSEL_375KHz             0x30000000
+#define AM_REG_PDM_VCFG_PDMCLKSEL_187KHz             0x38000000
+
+// Enable the serial clock.
+#define AM_REG_PDM_VCFG_PDMCLK_S                     26
+#define AM_REG_PDM_VCFG_PDMCLK_M                     0x04000000
+#define AM_REG_PDM_VCFG_PDMCLK(n)                    (((uint32_t)(n) << 26) & 0x04000000)
+#define AM_REG_PDM_VCFG_PDMCLK_DIS                   0x00000000
+#define AM_REG_PDM_VCFG_PDMCLK_EN                    0x04000000
+
+// I2S interface enable.
+#define AM_REG_PDM_VCFG_I2SMODE_S                    20
+#define AM_REG_PDM_VCFG_I2SMODE_M                    0x00100000
+#define AM_REG_PDM_VCFG_I2SMODE(n)                   (((uint32_t)(n) << 20) & 0x00100000)
+#define AM_REG_PDM_VCFG_I2SMODE_DIS                  0x00000000
+#define AM_REG_PDM_VCFG_I2SMODE_EN                   0x00100000
+
+// I2S BCLK input inversion.
+#define AM_REG_PDM_VCFG_BCLKINV_S                    19
+#define AM_REG_PDM_VCFG_BCLKINV_M                    0x00080000
+#define AM_REG_PDM_VCFG_BCLKINV(n)                   (((uint32_t)(n) << 19) & 0x00080000)
+#define AM_REG_PDM_VCFG_BCLKINV_INV                  0x00000000
+#define AM_REG_PDM_VCFG_BCLKINV_NORM                 0x00080000
+
+// PDM clock sampling delay.
+#define AM_REG_PDM_VCFG_DMICKDEL_S                   17
+#define AM_REG_PDM_VCFG_DMICKDEL_M                   0x00020000
+#define AM_REG_PDM_VCFG_DMICKDEL(n)                  (((uint32_t)(n) << 17) & 0x00020000)
+#define AM_REG_PDM_VCFG_DMICKDEL_0CYC                0x00000000
+#define AM_REG_PDM_VCFG_DMICKDEL_1CYC                0x00020000
+
+// Select PDM input clock source.
+#define AM_REG_PDM_VCFG_SELAP_S                      16
+#define AM_REG_PDM_VCFG_SELAP_M                      0x00010000
+#define AM_REG_PDM_VCFG_SELAP(n)                     (((uint32_t)(n) << 16) & 0x00010000)
+#define AM_REG_PDM_VCFG_SELAP_I2S                    0x00010000
+#define AM_REG_PDM_VCFG_SELAP_INTERNAL               0x00000000
+
+// PCM data packing enable.
+#define AM_REG_PDM_VCFG_PCMPACK_S                    8
+#define AM_REG_PDM_VCFG_PCMPACK_M                    0x00000100
+#define AM_REG_PDM_VCFG_PCMPACK(n)                   (((uint32_t)(n) << 8) & 0x00000100)
+#define AM_REG_PDM_VCFG_PCMPACK_DIS                  0x00000000
+#define AM_REG_PDM_VCFG_PCMPACK_EN                   0x00000100
+
+// Set PCM channels.
+#define AM_REG_PDM_VCFG_CHSET_S                      3
+#define AM_REG_PDM_VCFG_CHSET_M                      0x00000018
+#define AM_REG_PDM_VCFG_CHSET(n)                     (((uint32_t)(n) << 3) & 0x00000018)
+#define AM_REG_PDM_VCFG_CHSET_DIS                    0x00000000
+#define AM_REG_PDM_VCFG_CHSET_LEFT                   0x00000008
+#define AM_REG_PDM_VCFG_CHSET_RIGHT                  0x00000010
+#define AM_REG_PDM_VCFG_CHSET_STEREO                 0x00000018
+
+//*****************************************************************************
+//
+// PDM_FR - Voice Status Register
+//
+//*****************************************************************************
+// Valid 32-bit entries currently in the FIFO.
+#define AM_REG_PDM_FR_FIFOCNT_S                      0
+#define AM_REG_PDM_FR_FIFOCNT_M                      0x000001FF
+#define AM_REG_PDM_FR_FIFOCNT(n)                     (((uint32_t)(n) << 0) & 0x000001FF)
+
+//*****************************************************************************
+//
+// PDM_FRD - FIFO Read
+//
+//*****************************************************************************
+// FIFO read data.
+#define AM_REG_PDM_FRD_FIFOREAD_S                    0
+#define AM_REG_PDM_FRD_FIFOREAD_M                    0xFFFFFFFF
+#define AM_REG_PDM_FRD_FIFOREAD(n)                   (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// PDM_FLUSH - FIFO Flush
+//
+//*****************************************************************************
+// FIFO FLUSH.
+#define AM_REG_PDM_FLUSH_FIFOFLUSH_S                 0
+#define AM_REG_PDM_FLUSH_FIFOFLUSH_M                 0x00000001
+#define AM_REG_PDM_FLUSH_FIFOFLUSH(n)                (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// PDM_FTHR - FIFO Threshold
+//
+//*****************************************************************************
+// FIFO interrupt threshold.
+#define AM_REG_PDM_FTHR_FIFOTHR_S                    0
+#define AM_REG_PDM_FTHR_FIFOTHR_M                    0x000000FF
+#define AM_REG_PDM_FTHR_FIFOTHR(n)                   (((uint32_t)(n) << 0) & 0x000000FF)
+
+#endif // AM_REG_PDM_H
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_pwrctrl.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_pwrctrl.h
new file mode 100644
index 000000000..520e45d3d
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_pwrctrl.h
@@ -0,0 +1,484 @@
+//*****************************************************************************
+//
+//! @file am_reg_pwrctrl.h
+//!
+//! @brief Register macros for the PWRCTRL module
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_REG_PWRCTRL_H
+#define AM_REG_PWRCTRL_H
+
+//*****************************************************************************
+//
+// Instance finder. (1 instance(s) available)
+//
+//*****************************************************************************
+#define AM_REG_PWRCTRL_NUM_MODULES                   1
+#define AM_REG_PWRCTRLn(n) \
+    (REG_PWRCTRL_BASEADDR + 0x00000000 * n)
+
+//*****************************************************************************
+//
+// Register offsets.
+//
+//*****************************************************************************
+#define AM_REG_PWRCTRL_SUPPLYSRC_O                   0x00000000
+#define AM_REG_PWRCTRL_POWERSTATUS_O                 0x00000004
+#define AM_REG_PWRCTRL_DEVICEEN_O                    0x00000008
+#define AM_REG_PWRCTRL_SRAMPWDINSLEEP_O              0x0000000C
+#define AM_REG_PWRCTRL_MEMEN_O                       0x00000010
+#define AM_REG_PWRCTRL_PWRONSTATUS_O                 0x00000014
+#define AM_REG_PWRCTRL_SRAMCTRL_O                    0x00000018
+#define AM_REG_PWRCTRL_ADCSTATUS_O                   0x0000001C
+#define AM_REG_PWRCTRL_MISCOPT_O                     0x00000020
+
+//*****************************************************************************
+//
+// PWRCTRL_SUPPLYSRC - Memory and Core Voltage Supply Source Select Register
+//
+//*****************************************************************************
+// Switches the CORE DOMAIN from BUCK mode (if enabled) to LDO when CPU is in
+// DEEP SLEEP. If all the devices are off then this does not matter and LDO (low
+// power mode) is used
+#define AM_REG_PWRCTRL_SUPPLYSRC_SWITCH_LDO_IN_SLEEP_S 2
+#define AM_REG_PWRCTRL_SUPPLYSRC_SWITCH_LDO_IN_SLEEP_M 0x00000004
+#define AM_REG_PWRCTRL_SUPPLYSRC_SWITCH_LDO_IN_SLEEP(n) (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_PWRCTRL_SUPPLYSRC_SWITCH_LDO_IN_SLEEP_EN 0x00000004
+
+// Enables and Selects the Core Buck as the supply for the low-voltage power
+// domain.
+#define AM_REG_PWRCTRL_SUPPLYSRC_COREBUCKEN_S        1
+#define AM_REG_PWRCTRL_SUPPLYSRC_COREBUCKEN_M        0x00000002
+#define AM_REG_PWRCTRL_SUPPLYSRC_COREBUCKEN(n)       (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_PWRCTRL_SUPPLYSRC_COREBUCKEN_EN       0x00000002
+
+// Enables and select the Memory Buck as the supply for the Flash and SRAM power
+// domain.
+#define AM_REG_PWRCTRL_SUPPLYSRC_MEMBUCKEN_S         0
+#define AM_REG_PWRCTRL_SUPPLYSRC_MEMBUCKEN_M         0x00000001
+#define AM_REG_PWRCTRL_SUPPLYSRC_MEMBUCKEN(n)        (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_PWRCTRL_SUPPLYSRC_MEMBUCKEN_EN        0x00000001
+
+//*****************************************************************************
+//
+// PWRCTRL_POWERSTATUS - Power Status Register for MCU supplies and peripherals
+//
+//*****************************************************************************
+// Indicates whether the Core low-voltage domain is supplied from the LDO or the
+// Buck.
+#define AM_REG_PWRCTRL_POWERSTATUS_COREBUCKON_S      1
+#define AM_REG_PWRCTRL_POWERSTATUS_COREBUCKON_M      0x00000002
+#define AM_REG_PWRCTRL_POWERSTATUS_COREBUCKON(n)     (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_PWRCTRL_POWERSTATUS_COREBUCKON_LDO    0x00000000
+#define AM_REG_PWRCTRL_POWERSTATUS_COREBUCKON_BUCK   0x00000002
+
+// Indicate whether the Memory power domain is supplied from the LDO or the
+// Buck.
+#define AM_REG_PWRCTRL_POWERSTATUS_MEMBUCKON_S       0
+#define AM_REG_PWRCTRL_POWERSTATUS_MEMBUCKON_M       0x00000001
+#define AM_REG_PWRCTRL_POWERSTATUS_MEMBUCKON(n)      (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_PWRCTRL_POWERSTATUS_MEMBUCKON_LDO     0x00000000
+#define AM_REG_PWRCTRL_POWERSTATUS_MEMBUCKON_BUCK    0x00000001
+
+//*****************************************************************************
+//
+// PWRCTRL_DEVICEEN - DEVICE ENABLES for SHELBY
+//
+//*****************************************************************************
+// Enable PDM Digital Block
+#define AM_REG_PWRCTRL_DEVICEEN_PDM_S                10
+#define AM_REG_PWRCTRL_DEVICEEN_PDM_M                0x00000400
+#define AM_REG_PWRCTRL_DEVICEEN_PDM(n)               (((uint32_t)(n) << 10) & 0x00000400)
+#define AM_REG_PWRCTRL_DEVICEEN_PDM_EN               0x00000400
+#define AM_REG_PWRCTRL_DEVICEEN_PDM_DIS              0x00000000
+
+// Enable ADC Digital Block
+#define AM_REG_PWRCTRL_DEVICEEN_ADC_S                9
+#define AM_REG_PWRCTRL_DEVICEEN_ADC_M                0x00000200
+#define AM_REG_PWRCTRL_DEVICEEN_ADC(n)               (((uint32_t)(n) << 9) & 0x00000200)
+#define AM_REG_PWRCTRL_DEVICEEN_ADC_EN               0x00000200
+#define AM_REG_PWRCTRL_DEVICEEN_ADC_DIS              0x00000000
+
+// Enable UART 1
+#define AM_REG_PWRCTRL_DEVICEEN_UART1_S              8
+#define AM_REG_PWRCTRL_DEVICEEN_UART1_M              0x00000100
+#define AM_REG_PWRCTRL_DEVICEEN_UART1(n)             (((uint32_t)(n) << 8) & 0x00000100)
+#define AM_REG_PWRCTRL_DEVICEEN_UART1_EN             0x00000100
+#define AM_REG_PWRCTRL_DEVICEEN_UART1_DIS            0x00000000
+
+// Enable UART 0
+#define AM_REG_PWRCTRL_DEVICEEN_UART0_S              7
+#define AM_REG_PWRCTRL_DEVICEEN_UART0_M              0x00000080
+#define AM_REG_PWRCTRL_DEVICEEN_UART0(n)             (((uint32_t)(n) << 7) & 0x00000080)
+#define AM_REG_PWRCTRL_DEVICEEN_UART0_EN             0x00000080
+#define AM_REG_PWRCTRL_DEVICEEN_UART0_DIS            0x00000000
+
+// Enable IO MASTER 5
+#define AM_REG_PWRCTRL_DEVICEEN_IO_MASTER5_S         6
+#define AM_REG_PWRCTRL_DEVICEEN_IO_MASTER5_M         0x00000040
+#define AM_REG_PWRCTRL_DEVICEEN_IO_MASTER5(n)        (((uint32_t)(n) << 6) & 0x00000040)
+#define AM_REG_PWRCTRL_DEVICEEN_IO_MASTER5_EN        0x00000040
+#define AM_REG_PWRCTRL_DEVICEEN_IO_MASTER5_DIS       0x00000000
+
+// Enable IO MASTER 4
+#define AM_REG_PWRCTRL_DEVICEEN_IO_MASTER4_S         5
+#define AM_REG_PWRCTRL_DEVICEEN_IO_MASTER4_M         0x00000020
+#define AM_REG_PWRCTRL_DEVICEEN_IO_MASTER4(n)        (((uint32_t)(n) << 5) & 0x00000020)
+#define AM_REG_PWRCTRL_DEVICEEN_IO_MASTER4_EN        0x00000020
+#define AM_REG_PWRCTRL_DEVICEEN_IO_MASTER4_DIS       0x00000000
+
+// Enable IO MASTER 3
+#define AM_REG_PWRCTRL_DEVICEEN_IO_MASTER3_S         4
+#define AM_REG_PWRCTRL_DEVICEEN_IO_MASTER3_M         0x00000010
+#define AM_REG_PWRCTRL_DEVICEEN_IO_MASTER3(n)        (((uint32_t)(n) << 4) & 0x00000010)
+#define AM_REG_PWRCTRL_DEVICEEN_IO_MASTER3_EN        0x00000010
+#define AM_REG_PWRCTRL_DEVICEEN_IO_MASTER3_DIS       0x00000000
+
+// Enable IO MASTER 2
+#define AM_REG_PWRCTRL_DEVICEEN_IO_MASTER2_S         3
+#define AM_REG_PWRCTRL_DEVICEEN_IO_MASTER2_M         0x00000008
+#define AM_REG_PWRCTRL_DEVICEEN_IO_MASTER2(n)        (((uint32_t)(n) << 3) & 0x00000008)
+#define AM_REG_PWRCTRL_DEVICEEN_IO_MASTER2_EN        0x00000008
+#define AM_REG_PWRCTRL_DEVICEEN_IO_MASTER2_DIS       0x00000000
+
+// Enable IO MASTER 1
+#define AM_REG_PWRCTRL_DEVICEEN_IO_MASTER1_S         2
+#define AM_REG_PWRCTRL_DEVICEEN_IO_MASTER1_M         0x00000004
+#define AM_REG_PWRCTRL_DEVICEEN_IO_MASTER1(n)        (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_PWRCTRL_DEVICEEN_IO_MASTER1_EN        0x00000004
+#define AM_REG_PWRCTRL_DEVICEEN_IO_MASTER1_DIS       0x00000000
+
+// Enable IO MASTER 0
+#define AM_REG_PWRCTRL_DEVICEEN_IO_MASTER0_S         1
+#define AM_REG_PWRCTRL_DEVICEEN_IO_MASTER0_M         0x00000002
+#define AM_REG_PWRCTRL_DEVICEEN_IO_MASTER0(n)        (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_PWRCTRL_DEVICEEN_IO_MASTER0_EN        0x00000002
+#define AM_REG_PWRCTRL_DEVICEEN_IO_MASTER0_DIS       0x00000000
+
+// Enable IO SLAVE
+#define AM_REG_PWRCTRL_DEVICEEN_IO_SLAVE_S           0
+#define AM_REG_PWRCTRL_DEVICEEN_IO_SLAVE_M           0x00000001
+#define AM_REG_PWRCTRL_DEVICEEN_IO_SLAVE(n)          (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_PWRCTRL_DEVICEEN_IO_SLAVE_EN          0x00000001
+#define AM_REG_PWRCTRL_DEVICEEN_IO_SLAVE_DIS         0x00000000
+
+//*****************************************************************************
+//
+// PWRCTRL_SRAMPWDINSLEEP - Powerdown an SRAM Banks in Deep Sleep mode
+//
+//*****************************************************************************
+// Enable CACHE BANKS to power down in deep sleep
+#define AM_REG_PWRCTRL_SRAMPWDINSLEEP_CACHE_PWD_SLP_S 31
+#define AM_REG_PWRCTRL_SRAMPWDINSLEEP_CACHE_PWD_SLP_M 0x80000000
+#define AM_REG_PWRCTRL_SRAMPWDINSLEEP_CACHE_PWD_SLP(n) (((uint32_t)(n) << 31) & 0x80000000)
+#define AM_REG_PWRCTRL_SRAMPWDINSLEEP_CACHE_PWD_SLP_EN 0x80000000
+#define AM_REG_PWRCTRL_SRAMPWDINSLEEP_CACHE_PWD_SLP_DIS 0x00000000
+
+// Selects which SRAM banks are powered down in deep sleep mode, causing the
+// contents of the bank to be lost.
+#define AM_REG_PWRCTRL_SRAMPWDINSLEEP_SRAMSLEEPPOWERDOWN_S 0
+#define AM_REG_PWRCTRL_SRAMPWDINSLEEP_SRAMSLEEPPOWERDOWN_M 0x000007FF
+#define AM_REG_PWRCTRL_SRAMPWDINSLEEP_SRAMSLEEPPOWERDOWN(n) (((uint32_t)(n) << 0) & 0x000007FF)
+#define AM_REG_PWRCTRL_SRAMPWDINSLEEP_SRAMSLEEPPOWERDOWN_NONE 0x00000000
+#define AM_REG_PWRCTRL_SRAMPWDINSLEEP_SRAMSLEEPPOWERDOWN_GROUP0_SRAM0 0x00000001
+#define AM_REG_PWRCTRL_SRAMPWDINSLEEP_SRAMSLEEPPOWERDOWN_GROUP0_SRAM1 0x00000002
+#define AM_REG_PWRCTRL_SRAMPWDINSLEEP_SRAMSLEEPPOWERDOWN_GROUP0_SRAM2 0x00000004
+#define AM_REG_PWRCTRL_SRAMPWDINSLEEP_SRAMSLEEPPOWERDOWN_GROUP0_SRAM3 0x00000008
+#define AM_REG_PWRCTRL_SRAMPWDINSLEEP_SRAMSLEEPPOWERDOWN_GROUP1 0x00000010
+#define AM_REG_PWRCTRL_SRAMPWDINSLEEP_SRAMSLEEPPOWERDOWN_GROUP2 0x00000020
+#define AM_REG_PWRCTRL_SRAMPWDINSLEEP_SRAMSLEEPPOWERDOWN_GROUP3 0x00000040
+#define AM_REG_PWRCTRL_SRAMPWDINSLEEP_SRAMSLEEPPOWERDOWN_GROUP4 0x00000080
+#define AM_REG_PWRCTRL_SRAMPWDINSLEEP_SRAMSLEEPPOWERDOWN_GROUP5 0x00000100
+#define AM_REG_PWRCTRL_SRAMPWDINSLEEP_SRAMSLEEPPOWERDOWN_GROUP6 0x00000200
+#define AM_REG_PWRCTRL_SRAMPWDINSLEEP_SRAMSLEEPPOWERDOWN_GROUP7 0x00000400
+#define AM_REG_PWRCTRL_SRAMPWDINSLEEP_SRAMSLEEPPOWERDOWN_SRAM8K 0x00000001
+#define AM_REG_PWRCTRL_SRAMPWDINSLEEP_SRAMSLEEPPOWERDOWN_SRAM16K 0x00000003
+#define AM_REG_PWRCTRL_SRAMPWDINSLEEP_SRAMSLEEPPOWERDOWN_SRAM32K 0x0000000F
+#define AM_REG_PWRCTRL_SRAMPWDINSLEEP_SRAMSLEEPPOWERDOWN_SRAM64K 0x0000001F
+#define AM_REG_PWRCTRL_SRAMPWDINSLEEP_SRAMSLEEPPOWERDOWN_SRAM128K 0x0000007F
+#define AM_REG_PWRCTRL_SRAMPWDINSLEEP_SRAMSLEEPPOWERDOWN_ALLBUTLOWER8K 0x000007FE
+#define AM_REG_PWRCTRL_SRAMPWDINSLEEP_SRAMSLEEPPOWERDOWN_ALLBUTLOWER16K 0x000007FC
+#define AM_REG_PWRCTRL_SRAMPWDINSLEEP_SRAMSLEEPPOWERDOWN_ALLBUTLOWER24K 0x000007F8
+#define AM_REG_PWRCTRL_SRAMPWDINSLEEP_SRAMSLEEPPOWERDOWN_ALLBUTLOWER32K 0x000007F0
+#define AM_REG_PWRCTRL_SRAMPWDINSLEEP_SRAMSLEEPPOWERDOWN_ALLBUTLOWER64K 0x000007E0
+#define AM_REG_PWRCTRL_SRAMPWDINSLEEP_SRAMSLEEPPOWERDOWN_ALLBUTLOWER128K 0x00000780
+#define AM_REG_PWRCTRL_SRAMPWDINSLEEP_SRAMSLEEPPOWERDOWN_ALL 0x000007FF
+
+//*****************************************************************************
+//
+// PWRCTRL_MEMEN - Disables individual banks of the MEMORY array
+//
+//*****************************************************************************
+// Enable CACHE BANK 2
+#define AM_REG_PWRCTRL_MEMEN_CACHEB2_S               31
+#define AM_REG_PWRCTRL_MEMEN_CACHEB2_M               0x80000000
+#define AM_REG_PWRCTRL_MEMEN_CACHEB2(n)              (((uint32_t)(n) << 31) & 0x80000000)
+#define AM_REG_PWRCTRL_MEMEN_CACHEB2_EN              0x80000000
+#define AM_REG_PWRCTRL_MEMEN_CACHEB2_DIS             0x00000000
+
+// Enable CACHE BANK 0
+#define AM_REG_PWRCTRL_MEMEN_CACHEB0_S               29
+#define AM_REG_PWRCTRL_MEMEN_CACHEB0_M               0x20000000
+#define AM_REG_PWRCTRL_MEMEN_CACHEB0(n)              (((uint32_t)(n) << 29) & 0x20000000)
+#define AM_REG_PWRCTRL_MEMEN_CACHEB0_EN              0x20000000
+#define AM_REG_PWRCTRL_MEMEN_CACHEB0_DIS             0x00000000
+
+// Enable FLASH1
+#define AM_REG_PWRCTRL_MEMEN_FLASH1_S                12
+#define AM_REG_PWRCTRL_MEMEN_FLASH1_M                0x00001000
+#define AM_REG_PWRCTRL_MEMEN_FLASH1(n)               (((uint32_t)(n) << 12) & 0x00001000)
+#define AM_REG_PWRCTRL_MEMEN_FLASH1_EN               0x00001000
+#define AM_REG_PWRCTRL_MEMEN_FLASH1_DIS              0x00000000
+
+// Enable FLASH 0
+#define AM_REG_PWRCTRL_MEMEN_FLASH0_S                11
+#define AM_REG_PWRCTRL_MEMEN_FLASH0_M                0x00000800
+#define AM_REG_PWRCTRL_MEMEN_FLASH0(n)               (((uint32_t)(n) << 11) & 0x00000800)
+#define AM_REG_PWRCTRL_MEMEN_FLASH0_EN               0x00000800
+#define AM_REG_PWRCTRL_MEMEN_FLASH0_DIS              0x00000000
+
+// Enables power for selected SRAM banks (else an access to its address space to
+// generate a Hard Fault).
+#define AM_REG_PWRCTRL_MEMEN_SRAMEN_S                0
+#define AM_REG_PWRCTRL_MEMEN_SRAMEN_M                0x000007FF
+#define AM_REG_PWRCTRL_MEMEN_SRAMEN(n)               (((uint32_t)(n) << 0) & 0x000007FF)
+#define AM_REG_PWRCTRL_MEMEN_SRAMEN_NONE             0x00000000
+#define AM_REG_PWRCTRL_MEMEN_SRAMEN_GROUP0_SRAM0     0x00000001
+#define AM_REG_PWRCTRL_MEMEN_SRAMEN_GROUP0_SRAM1     0x00000002
+#define AM_REG_PWRCTRL_MEMEN_SRAMEN_GROUP0_SRAM2     0x00000004
+#define AM_REG_PWRCTRL_MEMEN_SRAMEN_GROUP0_SRAM3     0x00000008
+#define AM_REG_PWRCTRL_MEMEN_SRAMEN_GROUP1           0x00000010
+#define AM_REG_PWRCTRL_MEMEN_SRAMEN_GROUP2           0x00000020
+#define AM_REG_PWRCTRL_MEMEN_SRAMEN_GROUP3           0x00000040
+#define AM_REG_PWRCTRL_MEMEN_SRAMEN_GROUP4           0x00000080
+#define AM_REG_PWRCTRL_MEMEN_SRAMEN_GROUP5           0x00000100
+#define AM_REG_PWRCTRL_MEMEN_SRAMEN_GROUP6           0x00000200
+#define AM_REG_PWRCTRL_MEMEN_SRAMEN_GROUP7           0x00000400
+#define AM_REG_PWRCTRL_MEMEN_SRAMEN_SRAM8K           0x00000001
+#define AM_REG_PWRCTRL_MEMEN_SRAMEN_SRAM16K          0x00000003
+#define AM_REG_PWRCTRL_MEMEN_SRAMEN_SRAM32K          0x0000000F
+#define AM_REG_PWRCTRL_MEMEN_SRAMEN_SRAM64K          0x0000001F
+#define AM_REG_PWRCTRL_MEMEN_SRAMEN_SRAM128K         0x0000007F
+#define AM_REG_PWRCTRL_MEMEN_SRAMEN_SRAM256K         0x000007FF
+#define AM_REG_PWRCTRL_MEMEN_SRAMEN_ALL              0x000007FF
+
+//*****************************************************************************
+//
+// PWRCTRL_PWRONSTATUS - POWER ON Status
+//
+//*****************************************************************************
+// This bit is 1 if power is supplied to CACHE BANK 2
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_CACHEB2_S      21
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_CACHEB2_M      0x00200000
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_CACHEB2(n)     (((uint32_t)(n) << 21) & 0x00200000)
+
+// This bit is 1 if power is supplied to CACHE BANK 0
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_CACHEB0_S      19
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_CACHEB0_M      0x00080000
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_CACHEB0(n)     (((uint32_t)(n) << 19) & 0x00080000)
+
+// This bit is 1 if power is supplied to SRAM domain PD_GRP7
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP7_SRAM_S    18
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP7_SRAM_M    0x00040000
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP7_SRAM(n)   (((uint32_t)(n) << 18) & 0x00040000)
+
+// This bit is 1 if power is supplied to SRAM domain PD_GRP6
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP6_SRAM_S    17
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP6_SRAM_M    0x00020000
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP6_SRAM(n)   (((uint32_t)(n) << 17) & 0x00020000)
+
+// This bit is 1 if power is supplied to SRAM domain PD_GRP5
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP5_SRAM_S    16
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP5_SRAM_M    0x00010000
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP5_SRAM(n)   (((uint32_t)(n) << 16) & 0x00010000)
+
+// This bit is 1 if power is supplied to SRAM domain PD_GRP4
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP4_SRAM_S    15
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP4_SRAM_M    0x00008000
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP4_SRAM(n)   (((uint32_t)(n) << 15) & 0x00008000)
+
+// This bit is 1 if power is supplied to SRAM domain PD_GRP3
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP3_SRAM_S    14
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP3_SRAM_M    0x00004000
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP3_SRAM(n)   (((uint32_t)(n) << 14) & 0x00004000)
+
+// This bit is 1 if power is supplied to SRAM domain PD_GRP2
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP2_SRAM_S    13
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP2_SRAM_M    0x00002000
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP2_SRAM(n)   (((uint32_t)(n) << 13) & 0x00002000)
+
+// This bit is 1 if power is supplied to SRAM domain PD_GRP1
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP1_SRAM_S    12
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP1_SRAM_M    0x00001000
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP1_SRAM(n)   (((uint32_t)(n) << 12) & 0x00001000)
+
+// This bit is 1 if power is supplied to SRAM domain PD_SRAM0_3
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM3_S   11
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM3_M   0x00000800
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM3(n)  (((uint32_t)(n) << 11) & 0x00000800)
+
+// This bit is 1 if power is supplied to SRAM domain PD_SRAM0_2
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM2_S   10
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM2_M   0x00000400
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM2(n)  (((uint32_t)(n) << 10) & 0x00000400)
+
+// This bit is 1 if power is supplied to SRAM domain SRAM0_1
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM1_S   9
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM1_M   0x00000200
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM1(n)  (((uint32_t)(n) << 9) & 0x00000200)
+
+// This bit is 1 if power is supplied to SRAM domain SRAM0_0
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM0_S   8
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM0_M   0x00000100
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_GRP0_SRAM0(n)  (((uint32_t)(n) << 8) & 0x00000100)
+
+// This bit is 1 if power is supplied to domain PD_ADC
+#define AM_REG_PWRCTRL_PWRONSTATUS_PDADC_S           7
+#define AM_REG_PWRCTRL_PWRONSTATUS_PDADC_M           0x00000080
+#define AM_REG_PWRCTRL_PWRONSTATUS_PDADC(n)          (((uint32_t)(n) << 7) & 0x00000080)
+
+// This bit is 1 if power is supplied to domain PD_FLAM1
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_FLAM1_S        6
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_FLAM1_M        0x00000040
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_FLAM1(n)       (((uint32_t)(n) << 6) & 0x00000040)
+
+// This bit is 1 if power is supplied to domain PD_FLAM0
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_FLAM0_S        5
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_FLAM0_M        0x00000020
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_FLAM0(n)       (((uint32_t)(n) << 5) & 0x00000020)
+
+// This bit is 1 if power is supplied to domain PD_PDM
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_PDM_S          4
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_PDM_M          0x00000010
+#define AM_REG_PWRCTRL_PWRONSTATUS_PD_PDM(n)         (((uint32_t)(n) << 4) & 0x00000010)
+
+// This bit is 1 if power is supplied to power domain C, which supplies IOM3-5.
+#define AM_REG_PWRCTRL_PWRONSTATUS_PDC_S             3
+#define AM_REG_PWRCTRL_PWRONSTATUS_PDC_M             0x00000008
+#define AM_REG_PWRCTRL_PWRONSTATUS_PDC(n)            (((uint32_t)(n) << 3) & 0x00000008)
+
+// This bit is 1 if power is supplied to power domain B, which supplies IOM0-2.
+#define AM_REG_PWRCTRL_PWRONSTATUS_PDB_S             2
+#define AM_REG_PWRCTRL_PWRONSTATUS_PDB_M             0x00000004
+#define AM_REG_PWRCTRL_PWRONSTATUS_PDB(n)            (((uint32_t)(n) << 2) & 0x00000004)
+
+// This bit is 1 if power is supplied to power domain A, which supplies IOS and
+// UART0,1.
+#define AM_REG_PWRCTRL_PWRONSTATUS_PDA_S             1
+#define AM_REG_PWRCTRL_PWRONSTATUS_PDA_M             0x00000002
+#define AM_REG_PWRCTRL_PWRONSTATUS_PDA(n)            (((uint32_t)(n) << 1) & 0x00000002)
+
+//*****************************************************************************
+//
+// PWRCTRL_SRAMCTRL - SRAM Control register
+//
+//*****************************************************************************
+// Enables top-level clock gating in the SRAM block.  This bit should be enabled
+// for lowest power operation.
+#define AM_REG_PWRCTRL_SRAMCTRL_SRAM_MASTER_CLKGATE_S 2
+#define AM_REG_PWRCTRL_SRAMCTRL_SRAM_MASTER_CLKGATE_M 0x00000004
+#define AM_REG_PWRCTRL_SRAMCTRL_SRAM_MASTER_CLKGATE(n) (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_PWRCTRL_SRAMCTRL_SRAM_MASTER_CLKGATE_EN 0x00000004
+#define AM_REG_PWRCTRL_SRAMCTRL_SRAM_MASTER_CLKGATE_DIS 0x00000000
+
+// Enables individual per-RAM clock gating in the SRAM block.  This bit should
+// be enabled for lowest power operation.
+#define AM_REG_PWRCTRL_SRAMCTRL_SRAM_CLKGATE_S       1
+#define AM_REG_PWRCTRL_SRAMCTRL_SRAM_CLKGATE_M       0x00000002
+#define AM_REG_PWRCTRL_SRAMCTRL_SRAM_CLKGATE(n)      (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_PWRCTRL_SRAMCTRL_SRAM_CLKGATE_EN      0x00000002
+#define AM_REG_PWRCTRL_SRAMCTRL_SRAM_CLKGATE_DIS     0x00000000
+
+// Enable LS (light sleep) of cache RAMs.  When this bit is set, the RAMS will
+// be put into light sleep mode while inactive.  NOTE:  if the SRAM is actively
+// used, this may have an adverse affect on power since entering/exiting LS mode
+// may consume more power than would be saved.
+#define AM_REG_PWRCTRL_SRAMCTRL_SRAM_LIGHT_SLEEP_S   0
+#define AM_REG_PWRCTRL_SRAMCTRL_SRAM_LIGHT_SLEEP_M   0x00000001
+#define AM_REG_PWRCTRL_SRAMCTRL_SRAM_LIGHT_SLEEP(n)  (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_PWRCTRL_SRAMCTRL_SRAM_LIGHT_SLEEP_EN  0x00000001
+#define AM_REG_PWRCTRL_SRAMCTRL_SRAM_LIGHT_SLEEP_DIS 0x00000000
+
+//*****************************************************************************
+//
+// PWRCTRL_ADCSTATUS - Power Status Register for ADC Block
+//
+//*****************************************************************************
+// This bit indicates that the ADC REFBUF is powered down
+#define AM_REG_PWRCTRL_ADCSTATUS_ADC_REFBUF_PWD_S    5
+#define AM_REG_PWRCTRL_ADCSTATUS_ADC_REFBUF_PWD_M    0x00000020
+#define AM_REG_PWRCTRL_ADCSTATUS_ADC_REFBUF_PWD(n)   (((uint32_t)(n) << 5) & 0x00000020)
+
+// This bit indicates that the ADC REFKEEP is powered down
+#define AM_REG_PWRCTRL_ADCSTATUS_ADC_REFKEEP_PWD_S   4
+#define AM_REG_PWRCTRL_ADCSTATUS_ADC_REFKEEP_PWD_M   0x00000010
+#define AM_REG_PWRCTRL_ADCSTATUS_ADC_REFKEEP_PWD(n)  (((uint32_t)(n) << 4) & 0x00000010)
+
+// This bit indicates that the ADC VBAT resistor divider is powered down
+#define AM_REG_PWRCTRL_ADCSTATUS_ADC_VBAT_PWD_S      3
+#define AM_REG_PWRCTRL_ADCSTATUS_ADC_VBAT_PWD_M      0x00000008
+#define AM_REG_PWRCTRL_ADCSTATUS_ADC_VBAT_PWD(n)     (((uint32_t)(n) << 3) & 0x00000008)
+
+// This bit indicates that the ADC temperature sensor input buffer is powered
+// down
+#define AM_REG_PWRCTRL_ADCSTATUS_ADC_VPTAT_PWD_S     2
+#define AM_REG_PWRCTRL_ADCSTATUS_ADC_VPTAT_PWD_M     0x00000004
+#define AM_REG_PWRCTRL_ADCSTATUS_ADC_VPTAT_PWD(n)    (((uint32_t)(n) << 2) & 0x00000004)
+
+// This bit indicates that the ADC Band Gap is powered down
+#define AM_REG_PWRCTRL_ADCSTATUS_ADC_BGT_PWD_S       1
+#define AM_REG_PWRCTRL_ADCSTATUS_ADC_BGT_PWD_M       0x00000002
+#define AM_REG_PWRCTRL_ADCSTATUS_ADC_BGT_PWD(n)      (((uint32_t)(n) << 1) & 0x00000002)
+
+// This bit indicates that the ADC is powered down
+#define AM_REG_PWRCTRL_ADCSTATUS_ADC_PWD_S           0
+#define AM_REG_PWRCTRL_ADCSTATUS_ADC_PWD_M           0x00000001
+#define AM_REG_PWRCTRL_ADCSTATUS_ADC_PWD(n)          (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// PWRCTRL_MISCOPT - Power Optimization Control Bits
+//
+//*****************************************************************************
+// Setting this bit will enable the MEM LDO to be in LPMODE during deep sleep
+// even when the ctimers or stimers are running
+#define AM_REG_PWRCTRL_MISCOPT_DIS_LDOLPMODE_TIMERS_S 2
+#define AM_REG_PWRCTRL_MISCOPT_DIS_LDOLPMODE_TIMERS_M 0x00000004
+#define AM_REG_PWRCTRL_MISCOPT_DIS_LDOLPMODE_TIMERS(n) (((uint32_t)(n) << 2) & 0x00000004)
+
+#endif // AM_REG_PWRCTRL_H
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_rstgen.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_rstgen.h
new file mode 100644
index 000000000..5a5ee556b
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_rstgen.h
@@ -0,0 +1,210 @@
+//*****************************************************************************
+//
+//! @file am_reg_rstgen.h
+//!
+//! @brief Register macros for the RSTGEN module
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_REG_RSTGEN_H
+#define AM_REG_RSTGEN_H
+
+//*****************************************************************************
+//
+// Instance finder. (1 instance(s) available)
+//
+//*****************************************************************************
+#define AM_REG_RSTGEN_NUM_MODULES                    1
+#define AM_REG_RSTGENn(n) \
+    (REG_RSTGEN_BASEADDR + 0x00000000 * n)
+
+//*****************************************************************************
+//
+// Register offsets.
+//
+//*****************************************************************************
+#define AM_REG_RSTGEN_CFG_O                          0x00000000
+#define AM_REG_RSTGEN_SWPOI_O                        0x00000004
+#define AM_REG_RSTGEN_SWPOR_O                        0x00000008
+#define AM_REG_RSTGEN_STAT_O                         0x0000000C
+#define AM_REG_RSTGEN_CLRSTAT_O                      0x00000010
+#define AM_REG_RSTGEN_TPIU_RST_O                     0x00000014
+#define AM_REG_RSTGEN_INTEN_O                        0x00000200
+#define AM_REG_RSTGEN_INTSTAT_O                      0x00000204
+#define AM_REG_RSTGEN_INTCLR_O                       0x00000208
+#define AM_REG_RSTGEN_INTSET_O                       0x0000020C
+
+//*****************************************************************************
+//
+// RSTGEN_INTEN - Reset Interrupt register: Enable
+//
+//*****************************************************************************
+// Enables an interrupt that triggers when VCC is below BODH level.
+#define AM_REG_RSTGEN_INTEN_BODH_S                   0
+#define AM_REG_RSTGEN_INTEN_BODH_M                   0x00000001
+#define AM_REG_RSTGEN_INTEN_BODH(n)                  (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// RSTGEN_INTSTAT - Reset Interrupt register: Status
+//
+//*****************************************************************************
+// Enables an interrupt that triggers when VCC is below BODH level.
+#define AM_REG_RSTGEN_INTSTAT_BODH_S                 0
+#define AM_REG_RSTGEN_INTSTAT_BODH_M                 0x00000001
+#define AM_REG_RSTGEN_INTSTAT_BODH(n)                (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// RSTGEN_INTCLR - Reset Interrupt register: Clear
+//
+//*****************************************************************************
+// Enables an interrupt that triggers when VCC is below BODH level.
+#define AM_REG_RSTGEN_INTCLR_BODH_S                  0
+#define AM_REG_RSTGEN_INTCLR_BODH_M                  0x00000001
+#define AM_REG_RSTGEN_INTCLR_BODH(n)                 (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// RSTGEN_INTSET - Reset Interrupt register: Set
+//
+//*****************************************************************************
+// Enables an interrupt that triggers when VCC is below BODH level.
+#define AM_REG_RSTGEN_INTSET_BODH_S                  0
+#define AM_REG_RSTGEN_INTSET_BODH_M                  0x00000001
+#define AM_REG_RSTGEN_INTSET_BODH(n)                 (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// RSTGEN_CFG - Configuration Register
+//
+//*****************************************************************************
+// Watchdog Timer Reset Enable.  NOTE: The WDT module must also be configured
+// for WDT reset.
+#define AM_REG_RSTGEN_CFG_WDREN_S                    1
+#define AM_REG_RSTGEN_CFG_WDREN_M                    0x00000002
+#define AM_REG_RSTGEN_CFG_WDREN(n)                   (((uint32_t)(n) << 1) & 0x00000002)
+
+// Brown out high (2.1v) reset enable.
+#define AM_REG_RSTGEN_CFG_BODHREN_S                  0
+#define AM_REG_RSTGEN_CFG_BODHREN_M                  0x00000001
+#define AM_REG_RSTGEN_CFG_BODHREN(n)                 (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// RSTGEN_SWPOI - Software POI Reset
+//
+//*****************************************************************************
+// 0x1B generates a software POI reset.
+#define AM_REG_RSTGEN_SWPOI_SWPOIKEY_S               0
+#define AM_REG_RSTGEN_SWPOI_SWPOIKEY_M               0x000000FF
+#define AM_REG_RSTGEN_SWPOI_SWPOIKEY(n)              (((uint32_t)(n) << 0) & 0x000000FF)
+#define AM_REG_RSTGEN_SWPOI_SWPOIKEY_KEYVALUE        0x0000001B
+
+//*****************************************************************************
+//
+// RSTGEN_SWPOR - Software POR Reset
+//
+//*****************************************************************************
+// 0xD4 generates a software POR reset.
+#define AM_REG_RSTGEN_SWPOR_SWPORKEY_S               0
+#define AM_REG_RSTGEN_SWPOR_SWPORKEY_M               0x000000FF
+#define AM_REG_RSTGEN_SWPOR_SWPORKEY(n)              (((uint32_t)(n) << 0) & 0x000000FF)
+#define AM_REG_RSTGEN_SWPOR_SWPORKEY_KEYVALUE        0x000000D4
+
+//*****************************************************************************
+//
+// RSTGEN_STAT - Status Register
+//
+//*****************************************************************************
+// Reset was initiated by a Watchdog Timer Reset.
+#define AM_REG_RSTGEN_STAT_WDRSTAT_S                 6
+#define AM_REG_RSTGEN_STAT_WDRSTAT_M                 0x00000040
+#define AM_REG_RSTGEN_STAT_WDRSTAT(n)                (((uint32_t)(n) << 6) & 0x00000040)
+
+// Reset was a initiated by Debugger Reset.
+#define AM_REG_RSTGEN_STAT_DBGRSTAT_S                5
+#define AM_REG_RSTGEN_STAT_DBGRSTAT_M                0x00000020
+#define AM_REG_RSTGEN_STAT_DBGRSTAT(n)               (((uint32_t)(n) << 5) & 0x00000020)
+
+// Reset was a initiated by Software POI Reset.
+#define AM_REG_RSTGEN_STAT_POIRSTAT_S                4
+#define AM_REG_RSTGEN_STAT_POIRSTAT_M                0x00000010
+#define AM_REG_RSTGEN_STAT_POIRSTAT(n)               (((uint32_t)(n) << 4) & 0x00000010)
+
+// Reset was a initiated by SW POR or AIRCR Reset.
+#define AM_REG_RSTGEN_STAT_SWRSTAT_S                 3
+#define AM_REG_RSTGEN_STAT_SWRSTAT_M                 0x00000008
+#define AM_REG_RSTGEN_STAT_SWRSTAT(n)                (((uint32_t)(n) << 3) & 0x00000008)
+
+// Reset was initiated by a Brown-Out Reset.
+#define AM_REG_RSTGEN_STAT_BORSTAT_S                 2
+#define AM_REG_RSTGEN_STAT_BORSTAT_M                 0x00000004
+#define AM_REG_RSTGEN_STAT_BORSTAT(n)                (((uint32_t)(n) << 2) & 0x00000004)
+
+// Reset was initiated by a Power-On Reset.
+#define AM_REG_RSTGEN_STAT_PORSTAT_S                 1
+#define AM_REG_RSTGEN_STAT_PORSTAT_M                 0x00000002
+#define AM_REG_RSTGEN_STAT_PORSTAT(n)                (((uint32_t)(n) << 1) & 0x00000002)
+
+// Reset was initiated by an External Reset.
+#define AM_REG_RSTGEN_STAT_EXRSTAT_S                 0
+#define AM_REG_RSTGEN_STAT_EXRSTAT_M                 0x00000001
+#define AM_REG_RSTGEN_STAT_EXRSTAT(n)                (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// RSTGEN_CLRSTAT - Clear the status register
+//
+//*****************************************************************************
+// Writing a 1 to this bit clears all bits in the RST_STAT.
+#define AM_REG_RSTGEN_CLRSTAT_CLRSTAT_S              0
+#define AM_REG_RSTGEN_CLRSTAT_CLRSTAT_M              0x00000001
+#define AM_REG_RSTGEN_CLRSTAT_CLRSTAT(n)             (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// RSTGEN_TPIU_RST - TPIU reset
+//
+//*****************************************************************************
+// Static reset for the TPIU. Write to '1' to assert reset to TPIU. Write to '0'
+// to clear the reset.
+#define AM_REG_RSTGEN_TPIU_RST_TPIURST_S             0
+#define AM_REG_RSTGEN_TPIU_RST_TPIURST_M             0x00000001
+#define AM_REG_RSTGEN_TPIU_RST_TPIURST(n)            (((uint32_t)(n) << 0) & 0x00000001)
+
+#endif // AM_REG_RSTGEN_H
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_rtc.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_rtc.h
new file mode 100644
index 000000000..b8ce01f03
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_rtc.h
@@ -0,0 +1,325 @@
+//*****************************************************************************
+//
+//! @file am_reg_rtc.h
+//!
+//! @brief Register macros for the RTC module
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_REG_RTC_H
+#define AM_REG_RTC_H
+
+//*****************************************************************************
+//
+// Instance finder. (1 instance(s) available)
+//
+//*****************************************************************************
+#define AM_REG_RTC_NUM_MODULES                       1
+#define AM_REG_RTCn(n) \
+    (REG_RTC_BASEADDR + 0x00000000 * n)
+
+//*****************************************************************************
+//
+// Register offsets.
+//
+//*****************************************************************************
+#define AM_REG_RTC_CTRLOW_O                          0x00000040
+#define AM_REG_RTC_CTRUP_O                           0x00000044
+#define AM_REG_RTC_ALMLOW_O                          0x00000048
+#define AM_REG_RTC_ALMUP_O                           0x0000004C
+#define AM_REG_RTC_RTCCTL_O                          0x00000050
+#define AM_REG_RTC_INTEN_O                           0x00000100
+#define AM_REG_RTC_INTSTAT_O                         0x00000104
+#define AM_REG_RTC_INTCLR_O                          0x00000108
+#define AM_REG_RTC_INTSET_O                          0x0000010C
+
+//*****************************************************************************
+//
+// RTC_INTEN - RTC Interrupt Register: Enable
+//
+//*****************************************************************************
+// RTC Alarm interrupt
+#define AM_REG_RTC_INTEN_ALM_S                       3
+#define AM_REG_RTC_INTEN_ALM_M                       0x00000008
+#define AM_REG_RTC_INTEN_ALM(n)                      (((uint32_t)(n) << 3) & 0x00000008)
+
+// XT Oscillator Fail interrupt
+#define AM_REG_RTC_INTEN_OF_S                        2
+#define AM_REG_RTC_INTEN_OF_M                        0x00000004
+#define AM_REG_RTC_INTEN_OF(n)                       (((uint32_t)(n) << 2) & 0x00000004)
+
+// Autocalibration Complete interrupt
+#define AM_REG_RTC_INTEN_ACC_S                       1
+#define AM_REG_RTC_INTEN_ACC_M                       0x00000002
+#define AM_REG_RTC_INTEN_ACC(n)                      (((uint32_t)(n) << 1) & 0x00000002)
+
+// Autocalibration Fail interrupt
+#define AM_REG_RTC_INTEN_ACF_S                       0
+#define AM_REG_RTC_INTEN_ACF_M                       0x00000001
+#define AM_REG_RTC_INTEN_ACF(n)                      (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// RTC_INTSTAT - RTC Interrupt Register: Status
+//
+//*****************************************************************************
+// RTC Alarm interrupt
+#define AM_REG_RTC_INTSTAT_ALM_S                     3
+#define AM_REG_RTC_INTSTAT_ALM_M                     0x00000008
+#define AM_REG_RTC_INTSTAT_ALM(n)                    (((uint32_t)(n) << 3) & 0x00000008)
+
+// XT Oscillator Fail interrupt
+#define AM_REG_RTC_INTSTAT_OF_S                      2
+#define AM_REG_RTC_INTSTAT_OF_M                      0x00000004
+#define AM_REG_RTC_INTSTAT_OF(n)                     (((uint32_t)(n) << 2) & 0x00000004)
+
+// Autocalibration Complete interrupt
+#define AM_REG_RTC_INTSTAT_ACC_S                     1
+#define AM_REG_RTC_INTSTAT_ACC_M                     0x00000002
+#define AM_REG_RTC_INTSTAT_ACC(n)                    (((uint32_t)(n) << 1) & 0x00000002)
+
+// Autocalibration Fail interrupt
+#define AM_REG_RTC_INTSTAT_ACF_S                     0
+#define AM_REG_RTC_INTSTAT_ACF_M                     0x00000001
+#define AM_REG_RTC_INTSTAT_ACF(n)                    (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// RTC_INTCLR - RTC Interrupt Register: Clear
+//
+//*****************************************************************************
+// RTC Alarm interrupt
+#define AM_REG_RTC_INTCLR_ALM_S                      3
+#define AM_REG_RTC_INTCLR_ALM_M                      0x00000008
+#define AM_REG_RTC_INTCLR_ALM(n)                     (((uint32_t)(n) << 3) & 0x00000008)
+
+// XT Oscillator Fail interrupt
+#define AM_REG_RTC_INTCLR_OF_S                       2
+#define AM_REG_RTC_INTCLR_OF_M                       0x00000004
+#define AM_REG_RTC_INTCLR_OF(n)                      (((uint32_t)(n) << 2) & 0x00000004)
+
+// Autocalibration Complete interrupt
+#define AM_REG_RTC_INTCLR_ACC_S                      1
+#define AM_REG_RTC_INTCLR_ACC_M                      0x00000002
+#define AM_REG_RTC_INTCLR_ACC(n)                     (((uint32_t)(n) << 1) & 0x00000002)
+
+// Autocalibration Fail interrupt
+#define AM_REG_RTC_INTCLR_ACF_S                      0
+#define AM_REG_RTC_INTCLR_ACF_M                      0x00000001
+#define AM_REG_RTC_INTCLR_ACF(n)                     (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// RTC_INTSET - RTC Interrupt Register: Set
+//
+//*****************************************************************************
+// RTC Alarm interrupt
+#define AM_REG_RTC_INTSET_ALM_S                      3
+#define AM_REG_RTC_INTSET_ALM_M                      0x00000008
+#define AM_REG_RTC_INTSET_ALM(n)                     (((uint32_t)(n) << 3) & 0x00000008)
+
+// XT Oscillator Fail interrupt
+#define AM_REG_RTC_INTSET_OF_S                       2
+#define AM_REG_RTC_INTSET_OF_M                       0x00000004
+#define AM_REG_RTC_INTSET_OF(n)                      (((uint32_t)(n) << 2) & 0x00000004)
+
+// Autocalibration Complete interrupt
+#define AM_REG_RTC_INTSET_ACC_S                      1
+#define AM_REG_RTC_INTSET_ACC_M                      0x00000002
+#define AM_REG_RTC_INTSET_ACC(n)                     (((uint32_t)(n) << 1) & 0x00000002)
+
+// Autocalibration Fail interrupt
+#define AM_REG_RTC_INTSET_ACF_S                      0
+#define AM_REG_RTC_INTSET_ACF_M                      0x00000001
+#define AM_REG_RTC_INTSET_ACF(n)                     (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// RTC_CTRLOW - RTC Counters Lower
+//
+//*****************************************************************************
+// Hours Counter
+#define AM_REG_RTC_CTRLOW_CTRHR_S                    24
+#define AM_REG_RTC_CTRLOW_CTRHR_M                    0x3F000000
+#define AM_REG_RTC_CTRLOW_CTRHR(n)                   (((uint32_t)(n) << 24) & 0x3F000000)
+
+// Minutes Counter
+#define AM_REG_RTC_CTRLOW_CTRMIN_S                   16
+#define AM_REG_RTC_CTRLOW_CTRMIN_M                   0x007F0000
+#define AM_REG_RTC_CTRLOW_CTRMIN(n)                  (((uint32_t)(n) << 16) & 0x007F0000)
+
+// Seconds Counter
+#define AM_REG_RTC_CTRLOW_CTRSEC_S                   8
+#define AM_REG_RTC_CTRLOW_CTRSEC_M                   0x00007F00
+#define AM_REG_RTC_CTRLOW_CTRSEC(n)                  (((uint32_t)(n) << 8) & 0x00007F00)
+
+// 100ths of a second Counter
+#define AM_REG_RTC_CTRLOW_CTR100_S                   0
+#define AM_REG_RTC_CTRLOW_CTR100_M                   0x000000FF
+#define AM_REG_RTC_CTRLOW_CTR100(n)                  (((uint32_t)(n) << 0) & 0x000000FF)
+
+//*****************************************************************************
+//
+// RTC_CTRUP - RTC Counters Upper
+//
+//*****************************************************************************
+// Counter read error status
+#define AM_REG_RTC_CTRUP_CTERR_S                     31
+#define AM_REG_RTC_CTRUP_CTERR_M                     0x80000000
+#define AM_REG_RTC_CTRUP_CTERR(n)                    (((uint32_t)(n) << 31) & 0x80000000)
+#define AM_REG_RTC_CTRUP_CTERR_NOERR                 0x00000000
+#define AM_REG_RTC_CTRUP_CTERR_RDERR                 0x80000000
+
+// Century enable
+#define AM_REG_RTC_CTRUP_CEB_S                       28
+#define AM_REG_RTC_CTRUP_CEB_M                       0x10000000
+#define AM_REG_RTC_CTRUP_CEB(n)                      (((uint32_t)(n) << 28) & 0x10000000)
+#define AM_REG_RTC_CTRUP_CEB_DIS                     0x00000000
+#define AM_REG_RTC_CTRUP_CEB_EN                      0x10000000
+
+// Century
+#define AM_REG_RTC_CTRUP_CB_S                        27
+#define AM_REG_RTC_CTRUP_CB_M                        0x08000000
+#define AM_REG_RTC_CTRUP_CB(n)                       (((uint32_t)(n) << 27) & 0x08000000)
+#define AM_REG_RTC_CTRUP_CB_2000                     0x00000000
+#define AM_REG_RTC_CTRUP_CB_1900_2100                0x08000000
+
+// Weekdays Counter
+#define AM_REG_RTC_CTRUP_CTRWKDY_S                   24
+#define AM_REG_RTC_CTRUP_CTRWKDY_M                   0x07000000
+#define AM_REG_RTC_CTRUP_CTRWKDY(n)                  (((uint32_t)(n) << 24) & 0x07000000)
+
+// Years Counter
+#define AM_REG_RTC_CTRUP_CTRYR_S                     16
+#define AM_REG_RTC_CTRUP_CTRYR_M                     0x00FF0000
+#define AM_REG_RTC_CTRUP_CTRYR(n)                    (((uint32_t)(n) << 16) & 0x00FF0000)
+
+// Months Counter
+#define AM_REG_RTC_CTRUP_CTRMO_S                     8
+#define AM_REG_RTC_CTRUP_CTRMO_M                     0x00001F00
+#define AM_REG_RTC_CTRUP_CTRMO(n)                    (((uint32_t)(n) << 8) & 0x00001F00)
+
+// Date Counter
+#define AM_REG_RTC_CTRUP_CTRDATE_S                   0
+#define AM_REG_RTC_CTRUP_CTRDATE_M                   0x0000003F
+#define AM_REG_RTC_CTRUP_CTRDATE(n)                  (((uint32_t)(n) << 0) & 0x0000003F)
+
+//*****************************************************************************
+//
+// RTC_ALMLOW - RTC Alarms Lower
+//
+//*****************************************************************************
+// Hours Alarm
+#define AM_REG_RTC_ALMLOW_ALMHR_S                    24
+#define AM_REG_RTC_ALMLOW_ALMHR_M                    0x3F000000
+#define AM_REG_RTC_ALMLOW_ALMHR(n)                   (((uint32_t)(n) << 24) & 0x3F000000)
+
+// Minutes Alarm
+#define AM_REG_RTC_ALMLOW_ALMMIN_S                   16
+#define AM_REG_RTC_ALMLOW_ALMMIN_M                   0x007F0000
+#define AM_REG_RTC_ALMLOW_ALMMIN(n)                  (((uint32_t)(n) << 16) & 0x007F0000)
+
+// Seconds Alarm
+#define AM_REG_RTC_ALMLOW_ALMSEC_S                   8
+#define AM_REG_RTC_ALMLOW_ALMSEC_M                   0x00007F00
+#define AM_REG_RTC_ALMLOW_ALMSEC(n)                  (((uint32_t)(n) << 8) & 0x00007F00)
+
+// 100ths of a second Alarm
+#define AM_REG_RTC_ALMLOW_ALM100_S                   0
+#define AM_REG_RTC_ALMLOW_ALM100_M                   0x000000FF
+#define AM_REG_RTC_ALMLOW_ALM100(n)                  (((uint32_t)(n) << 0) & 0x000000FF)
+
+//*****************************************************************************
+//
+// RTC_ALMUP - RTC Alarms Upper
+//
+//*****************************************************************************
+// Weekdays Alarm
+#define AM_REG_RTC_ALMUP_ALMWKDY_S                   16
+#define AM_REG_RTC_ALMUP_ALMWKDY_M                   0x00070000
+#define AM_REG_RTC_ALMUP_ALMWKDY(n)                  (((uint32_t)(n) << 16) & 0x00070000)
+
+// Months Alarm
+#define AM_REG_RTC_ALMUP_ALMMO_S                     8
+#define AM_REG_RTC_ALMUP_ALMMO_M                     0x00001F00
+#define AM_REG_RTC_ALMUP_ALMMO(n)                    (((uint32_t)(n) << 8) & 0x00001F00)
+
+// Date Alarm
+#define AM_REG_RTC_ALMUP_ALMDATE_S                   0
+#define AM_REG_RTC_ALMUP_ALMDATE_M                   0x0000003F
+#define AM_REG_RTC_ALMUP_ALMDATE(n)                  (((uint32_t)(n) << 0) & 0x0000003F)
+
+//*****************************************************************************
+//
+// RTC_RTCCTL - RTC Control Register
+//
+//*****************************************************************************
+// Hours Counter mode
+#define AM_REG_RTC_RTCCTL_HR1224_S                   5
+#define AM_REG_RTC_RTCCTL_HR1224_M                   0x00000020
+#define AM_REG_RTC_RTCCTL_HR1224(n)                  (((uint32_t)(n) << 5) & 0x00000020)
+#define AM_REG_RTC_RTCCTL_HR1224_24HR                0x00000000
+#define AM_REG_RTC_RTCCTL_HR1224_12HR                0x00000020
+
+// RTC input clock control
+#define AM_REG_RTC_RTCCTL_RSTOP_S                    4
+#define AM_REG_RTC_RTCCTL_RSTOP_M                    0x00000010
+#define AM_REG_RTC_RTCCTL_RSTOP(n)                   (((uint32_t)(n) << 4) & 0x00000010)
+#define AM_REG_RTC_RTCCTL_RSTOP_RUN                  0x00000000
+#define AM_REG_RTC_RTCCTL_RSTOP_STOP                 0x00000010
+
+// Alarm repeat interval
+#define AM_REG_RTC_RTCCTL_RPT_S                      1
+#define AM_REG_RTC_RTCCTL_RPT_M                      0x0000000E
+#define AM_REG_RTC_RTCCTL_RPT(n)                     (((uint32_t)(n) << 1) & 0x0000000E)
+#define AM_REG_RTC_RTCCTL_RPT_DIS                    0x00000000
+#define AM_REG_RTC_RTCCTL_RPT_YEAR                   0x00000002
+#define AM_REG_RTC_RTCCTL_RPT_MONTH                  0x00000004
+#define AM_REG_RTC_RTCCTL_RPT_WEEK                   0x00000006
+#define AM_REG_RTC_RTCCTL_RPT_DAY                    0x00000008
+#define AM_REG_RTC_RTCCTL_RPT_HR                     0x0000000A
+#define AM_REG_RTC_RTCCTL_RPT_MIN                    0x0000000C
+#define AM_REG_RTC_RTCCTL_RPT_SEC                    0x0000000E
+
+// Counter write control
+#define AM_REG_RTC_RTCCTL_WRTC_S                     0
+#define AM_REG_RTC_RTCCTL_WRTC_M                     0x00000001
+#define AM_REG_RTC_RTCCTL_WRTC(n)                    (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_RTC_RTCCTL_WRTC_DIS                   0x00000000
+#define AM_REG_RTC_RTCCTL_WRTC_EN                    0x00000001
+
+#endif // AM_REG_RTC_H
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_sysctrl.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_sysctrl.h
new file mode 100644
index 000000000..2d9f251e2
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_sysctrl.h
@@ -0,0 +1,652 @@
+//*****************************************************************************
+//
+//! @file am_reg_sysctrl.h
+//!
+//! @brief Register macros for the SYSCTRL module
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_REG_SYSCTRL_H
+#define AM_REG_SYSCTRL_H
+
+//*****************************************************************************
+//
+// Instance finder. (1 instance(s) available)
+//
+//*****************************************************************************
+#define AM_REG_SYSCTRL_NUM_MODULES                   1
+#define AM_REG_SYSCTRLn(n) \
+    (REG_SYSCTRL_BASEADDR + 0x00000000 * n)
+
+//*****************************************************************************
+//
+// Register offsets.
+//
+//*****************************************************************************
+#define AM_REG_SYSCTRL_ICSR_O                        0xE000ED04
+#define AM_REG_SYSCTRL_VTOR_O                        0xE000ED08
+#define AM_REG_SYSCTRL_AIRCR_O                       0xE000ED0C
+#define AM_REG_SYSCTRL_SCR_O                         0xE000ED10
+#define AM_REG_SYSCTRL_CCR_O                         0xE000ED14
+#define AM_REG_SYSCTRL_SHPR1_O                       0xE000ED18
+#define AM_REG_SYSCTRL_SHPR2_O                       0xE000ED1C
+#define AM_REG_SYSCTRL_SHPR3_O                       0xE000ED20
+#define AM_REG_SYSCTRL_SHCSR_O                       0xE000ED24
+#define AM_REG_SYSCTRL_CFSR_O                        0xE000ED28
+#define AM_REG_SYSCTRL_HFSR_O                        0xE000ED2C
+#define AM_REG_SYSCTRL_MMFAR_O                       0xE000ED34
+#define AM_REG_SYSCTRL_BFAR_O                        0xE000ED38
+#define AM_REG_SYSCTRL_CPACR_O                       0xE000ED88
+#define AM_REG_SYSCTRL_DEMCR_O                       0xE000EDFC
+#define AM_REG_SYSCTRL_STIR_O                        0xE000EF00
+#define AM_REG_SYSCTRL_FPCCR_O                       0xE000EF34
+#define AM_REG_SYSCTRL_FPCAR_O                       0xE000EF38
+#define AM_REG_SYSCTRL_FPDSCR_O                      0xE000EF3C
+
+//*****************************************************************************
+//
+// SYSCTRL_ICSR - Interrupt Control and State Register
+//
+//*****************************************************************************
+// Pend an NMI exception.
+#define AM_REG_SYSCTRL_ICSR_NMIPENDSET_S             31
+#define AM_REG_SYSCTRL_ICSR_NMIPENDSET_M             0x80000000
+#define AM_REG_SYSCTRL_ICSR_NMIPENDSET(n)            (((uint32_t)(n) << 31) & 0x80000000)
+
+// Set the PendSV interrupt as pending.
+#define AM_REG_SYSCTRL_ICSR_PENDSVSET_S              28
+#define AM_REG_SYSCTRL_ICSR_PENDSVSET_M              0x10000000
+#define AM_REG_SYSCTRL_ICSR_PENDSVSET(n)             (((uint32_t)(n) << 28) & 0x10000000)
+
+// Remove the pending status of the PendSV exception.
+#define AM_REG_SYSCTRL_ICSR_PENDSVCLR_S              27
+#define AM_REG_SYSCTRL_ICSR_PENDSVCLR_M              0x08000000
+#define AM_REG_SYSCTRL_ICSR_PENDSVCLR(n)             (((uint32_t)(n) << 27) & 0x08000000)
+
+// Set the SysTick exception as pending.
+#define AM_REG_SYSCTRL_ICSR_PENDSTSET_S              26
+#define AM_REG_SYSCTRL_ICSR_PENDSTSET_M              0x04000000
+#define AM_REG_SYSCTRL_ICSR_PENDSTSET(n)             (((uint32_t)(n) << 26) & 0x04000000)
+
+// Remove the pending status of the SysTick exception.
+#define AM_REG_SYSCTRL_ICSR_PENDSTCLR_S              25
+#define AM_REG_SYSCTRL_ICSR_PENDSTCLR_M              0x02000000
+#define AM_REG_SYSCTRL_ICSR_PENDSTCLR(n)             (((uint32_t)(n) << 25) & 0x02000000)
+
+// Indicates whether a pending exception will be serviced on exit from debug
+// halt state.
+#define AM_REG_SYSCTRL_ICSR_ISRPREEMPT_S             23
+#define AM_REG_SYSCTRL_ICSR_ISRPREEMPT_M             0x00800000
+#define AM_REG_SYSCTRL_ICSR_ISRPREEMPT(n)            (((uint32_t)(n) << 23) & 0x00800000)
+
+// Indicates whether an external interrupt, generated by the NVIC, is pending.
+#define AM_REG_SYSCTRL_ICSR_ISRPENDING_S             22
+#define AM_REG_SYSCTRL_ICSR_ISRPENDING_M             0x00400000
+#define AM_REG_SYSCTRL_ICSR_ISRPENDING(n)            (((uint32_t)(n) << 22) & 0x00400000)
+
+// The exception number of the highest priority pending exception.
+#define AM_REG_SYSCTRL_ICSR_VECTPENDING_S            12
+#define AM_REG_SYSCTRL_ICSR_VECTPENDING_M            0x001FF000
+#define AM_REG_SYSCTRL_ICSR_VECTPENDING(n)           (((uint32_t)(n) << 12) & 0x001FF000)
+
+// Indicates whether there is an active exception other than the exception shown
+// by IPSR.
+#define AM_REG_SYSCTRL_ICSR_RETTOBASE_S              11
+#define AM_REG_SYSCTRL_ICSR_RETTOBASE_M              0x00000800
+#define AM_REG_SYSCTRL_ICSR_RETTOBASE(n)             (((uint32_t)(n) << 11) & 0x00000800)
+
+// The exception number of the current executing exception.
+#define AM_REG_SYSCTRL_ICSR_VECTACTIVE_S             0
+#define AM_REG_SYSCTRL_ICSR_VECTACTIVE_M             0x000001FF
+#define AM_REG_SYSCTRL_ICSR_VECTACTIVE(n)            (((uint32_t)(n) << 0) & 0x000001FF)
+
+//*****************************************************************************
+//
+// SYSCTRL_VTOR - Vector Table Offset Register.
+//
+//*****************************************************************************
+// Vector table base address.
+#define AM_REG_SYSCTRL_VTOR_VALUE_S                  0
+#define AM_REG_SYSCTRL_VTOR_VALUE_M                  0xFFFFFFFF
+#define AM_REG_SYSCTRL_VTOR_VALUE(n)                 (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// SYSCTRL_AIRCR - Application Interrupt and Reset Control Register.
+//
+//*****************************************************************************
+// Register writes must write 0x5FA to this field, otherwise the write is
+// ignored.
+#define AM_REG_SYSCTRL_AIRCR_VECTKEY_S               16
+#define AM_REG_SYSCTRL_AIRCR_VECTKEY_M               0xFFFF0000
+#define AM_REG_SYSCTRL_AIRCR_VECTKEY(n)              (((uint32_t)(n) << 16) & 0xFFFF0000)
+
+// Indicates endianness of memory architecture. (Little = 0, Big = 1)
+#define AM_REG_SYSCTRL_AIRCR_ENDIANNESS_S            15
+#define AM_REG_SYSCTRL_AIRCR_ENDIANNESS_M            0x00008000
+#define AM_REG_SYSCTRL_AIRCR_ENDIANNESS(n)           (((uint32_t)(n) << 15) & 0x00008000)
+
+// Priority grouping, indicates the binary point position.
+#define AM_REG_SYSCTRL_AIRCR_PRIGROUP_S              8
+#define AM_REG_SYSCTRL_AIRCR_PRIGROUP_M              0x00000700
+#define AM_REG_SYSCTRL_AIRCR_PRIGROUP(n)             (((uint32_t)(n) << 8) & 0x00000700)
+
+// Writing a 1 to this bit reqests a local reset.
+#define AM_REG_SYSCTRL_AIRCR_SYSRESETREQ_S           2
+#define AM_REG_SYSCTRL_AIRCR_SYSRESETREQ_M           0x00000004
+#define AM_REG_SYSCTRL_AIRCR_SYSRESETREQ(n)          (((uint32_t)(n) << 2) & 0x00000004)
+
+// Writing a 1 to this bit clears all active state information for fixed and
+// configurable exceptions.
+#define AM_REG_SYSCTRL_AIRCR_VECTCLRACTIVE_S         1
+#define AM_REG_SYSCTRL_AIRCR_VECTCLRACTIVE_M         0x00000002
+#define AM_REG_SYSCTRL_AIRCR_VECTCLRACTIVE(n)        (((uint32_t)(n) << 1) & 0x00000002)
+
+// Writing a 1 to this bit causes a local system reset.
+#define AM_REG_SYSCTRL_AIRCR_VECTRESET_S             0
+#define AM_REG_SYSCTRL_AIRCR_VECTRESET_M             0x00000001
+#define AM_REG_SYSCTRL_AIRCR_VECTRESET(n)            (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// SYSCTRL_SCR - System Control Register.
+//
+//*****************************************************************************
+// Determines whether a pending interrupt is a wakeup event.
+#define AM_REG_SYSCTRL_SCR_SEVONPEND_S               4
+#define AM_REG_SYSCTRL_SCR_SEVONPEND_M               0x00000010
+#define AM_REG_SYSCTRL_SCR_SEVONPEND(n)              (((uint32_t)(n) << 4) & 0x00000010)
+
+// Determines whether the sleep mode should be regular or deep sleep
+#define AM_REG_SYSCTRL_SCR_SLEEPDEEP_S               2
+#define AM_REG_SYSCTRL_SCR_SLEEPDEEP_M               0x00000004
+#define AM_REG_SYSCTRL_SCR_SLEEPDEEP(n)              (((uint32_t)(n) << 2) & 0x00000004)
+
+// Determines whether the processor shoudl automatically sleep when an ISR
+// returns to the base-level.
+#define AM_REG_SYSCTRL_SCR_SLEEPONEXIT_S             1
+#define AM_REG_SYSCTRL_SCR_SLEEPONEXIT_M             0x00000002
+#define AM_REG_SYSCTRL_SCR_SLEEPONEXIT(n)            (((uint32_t)(n) << 1) & 0x00000002)
+
+//*****************************************************************************
+//
+// SYSCTRL_CCR - Configuration and Control Register.
+//
+//*****************************************************************************
+// Set to force 8-byte alignment for the stack pointer.
+#define AM_REG_SYSCTRL_CCR_STKALIGN_S                9
+#define AM_REG_SYSCTRL_CCR_STKALIGN_M                0x00000200
+#define AM_REG_SYSCTRL_CCR_STKALIGN(n)               (((uint32_t)(n) << 9) & 0x00000200)
+
+// Set to ignore precise data access faults during hard fault handlers.
+#define AM_REG_SYSCTRL_CCR_BFHFNMIGN_S               8
+#define AM_REG_SYSCTRL_CCR_BFHFNMIGN_M               0x00000100
+#define AM_REG_SYSCTRL_CCR_BFHFNMIGN(n)              (((uint32_t)(n) << 8) & 0x00000100)
+
+// Set to enable trapping on divide-by-zero.
+#define AM_REG_SYSCTRL_CCR_DIV0TRP_S                 4
+#define AM_REG_SYSCTRL_CCR_DIV0TRP_M                 0x00000010
+#define AM_REG_SYSCTRL_CCR_DIV0TRP(n)                (((uint32_t)(n) << 4) & 0x00000010)
+
+// Set to enable trapping of unaligned word or halfword accesses.
+#define AM_REG_SYSCTRL_CCR_UNALIGNTRP_S              3
+#define AM_REG_SYSCTRL_CCR_UNALIGNTRP_M              0x00000008
+#define AM_REG_SYSCTRL_CCR_UNALIGNTRP(n)             (((uint32_t)(n) << 3) & 0x00000008)
+
+// Set to allow unpriveleged software to access the STIR
+#define AM_REG_SYSCTRL_CCR_USERSETMPEND_S            1
+#define AM_REG_SYSCTRL_CCR_USERSETMPEND_M            0x00000002
+#define AM_REG_SYSCTRL_CCR_USERSETMPEND(n)           (((uint32_t)(n) << 1) & 0x00000002)
+
+// Set to enable the processor to enter Thread mode at an execution priority
+// other than base level.
+#define AM_REG_SYSCTRL_CCR_NONBASETHRDENA_S          0
+#define AM_REG_SYSCTRL_CCR_NONBASETHRDENA_M          0x00000001
+#define AM_REG_SYSCTRL_CCR_NONBASETHRDENA(n)         (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// SYSCTRL_SHPR1 - System Handler Priority Register 1.
+//
+//*****************************************************************************
+// Reserved for priority of system handler 7.
+#define AM_REG_SYSCTRL_SHPR1_PRI_7_S                 24
+#define AM_REG_SYSCTRL_SHPR1_PRI_7_M                 0xFF000000
+#define AM_REG_SYSCTRL_SHPR1_PRI_7(n)                (((uint32_t)(n) << 24) & 0xFF000000)
+
+// Priority of system handler 6, UsageFault.
+#define AM_REG_SYSCTRL_SHPR1_PRI_6_S                 16
+#define AM_REG_SYSCTRL_SHPR1_PRI_6_M                 0x00FF0000
+#define AM_REG_SYSCTRL_SHPR1_PRI_6(n)                (((uint32_t)(n) << 16) & 0x00FF0000)
+
+// Priority of system handler 5, BusFault.
+#define AM_REG_SYSCTRL_SHPR1_PRI_5_S                 8
+#define AM_REG_SYSCTRL_SHPR1_PRI_5_M                 0x0000FF00
+#define AM_REG_SYSCTRL_SHPR1_PRI_5(n)                (((uint32_t)(n) << 8) & 0x0000FF00)
+
+// Priority of system handler 4, MemManage.
+#define AM_REG_SYSCTRL_SHPR1_PRI_4_S                 0
+#define AM_REG_SYSCTRL_SHPR1_PRI_4_M                 0x000000FF
+#define AM_REG_SYSCTRL_SHPR1_PRI_4(n)                (((uint32_t)(n) << 0) & 0x000000FF)
+
+//*****************************************************************************
+//
+// SYSCTRL_SHPR2 - System Handler Priority Register 2.
+//
+//*****************************************************************************
+// Priority of system handler 11, SVCall.
+#define AM_REG_SYSCTRL_SHPR2_PRI_11_S                24
+#define AM_REG_SYSCTRL_SHPR2_PRI_11_M                0xFF000000
+#define AM_REG_SYSCTRL_SHPR2_PRI_11(n)               (((uint32_t)(n) << 24) & 0xFF000000)
+
+// Reserved for priority of system handler 10.
+#define AM_REG_SYSCTRL_SHPR2_PRI_10_S                16
+#define AM_REG_SYSCTRL_SHPR2_PRI_10_M                0x00FF0000
+#define AM_REG_SYSCTRL_SHPR2_PRI_10(n)               (((uint32_t)(n) << 16) & 0x00FF0000)
+
+// Reserved for priority of system handler 9.
+#define AM_REG_SYSCTRL_SHPR2_PRI_9_S                 8
+#define AM_REG_SYSCTRL_SHPR2_PRI_9_M                 0x0000FF00
+#define AM_REG_SYSCTRL_SHPR2_PRI_9(n)                (((uint32_t)(n) << 8) & 0x0000FF00)
+
+// Reserved for priority of system handler 8.
+#define AM_REG_SYSCTRL_SHPR2_PRI_8_S                 0
+#define AM_REG_SYSCTRL_SHPR2_PRI_8_M                 0x000000FF
+#define AM_REG_SYSCTRL_SHPR2_PRI_8(n)                (((uint32_t)(n) << 0) & 0x000000FF)
+
+//*****************************************************************************
+//
+// SYSCTRL_SHPR3 - System Handler Priority Register 3.
+//
+//*****************************************************************************
+// Priority of system handler 15, SysTick.
+#define AM_REG_SYSCTRL_SHPR3_PRI_15_S                24
+#define AM_REG_SYSCTRL_SHPR3_PRI_15_M                0xFF000000
+#define AM_REG_SYSCTRL_SHPR3_PRI_15(n)               (((uint32_t)(n) << 24) & 0xFF000000)
+
+// Priority of system handler 14, PendSV.
+#define AM_REG_SYSCTRL_SHPR3_PRI_14_S                16
+#define AM_REG_SYSCTRL_SHPR3_PRI_14_M                0x00FF0000
+#define AM_REG_SYSCTRL_SHPR3_PRI_14(n)               (((uint32_t)(n) << 16) & 0x00FF0000)
+
+// Reserved for priority of system handler 13.
+#define AM_REG_SYSCTRL_SHPR3_PRI_13_S                8
+#define AM_REG_SYSCTRL_SHPR3_PRI_13_M                0x0000FF00
+#define AM_REG_SYSCTRL_SHPR3_PRI_13(n)               (((uint32_t)(n) << 8) & 0x0000FF00)
+
+// Priority of system handler 12, DebugMonitor.
+#define AM_REG_SYSCTRL_SHPR3_PRI_12_S                0
+#define AM_REG_SYSCTRL_SHPR3_PRI_12_M                0x000000FF
+#define AM_REG_SYSCTRL_SHPR3_PRI_12(n)               (((uint32_t)(n) << 0) & 0x000000FF)
+
+//*****************************************************************************
+//
+// SYSCTRL_SHCSR - System Handler Control and State Register.
+//
+//*****************************************************************************
+// Set to enable UsageFault.
+#define AM_REG_SYSCTRL_SHCSR_USAGEFAULTENA_S         18
+#define AM_REG_SYSCTRL_SHCSR_USAGEFAULTENA_M         0x00040000
+#define AM_REG_SYSCTRL_SHCSR_USAGEFAULTENA(n)        (((uint32_t)(n) << 18) & 0x00040000)
+
+// Set to enable BusFault.
+#define AM_REG_SYSCTRL_SHCSR_BUSFAULTENA_S           17
+#define AM_REG_SYSCTRL_SHCSR_BUSFAULTENA_M           0x00020000
+#define AM_REG_SYSCTRL_SHCSR_BUSFAULTENA(n)          (((uint32_t)(n) << 17) & 0x00020000)
+
+// Set to enable MemManageFault.
+#define AM_REG_SYSCTRL_SHCSR_MEMFAULTENA_S           16
+#define AM_REG_SYSCTRL_SHCSR_MEMFAULTENA_M           0x00010000
+#define AM_REG_SYSCTRL_SHCSR_MEMFAULTENA(n)          (((uint32_t)(n) << 16) & 0x00010000)
+
+// Set to pend the SVCall exception.
+#define AM_REG_SYSCTRL_SHCSR_SVCALLPENDED_S          15
+#define AM_REG_SYSCTRL_SHCSR_SVCALLPENDED_M          0x00008000
+#define AM_REG_SYSCTRL_SHCSR_SVCALLPENDED(n)         (((uint32_t)(n) << 15) & 0x00008000)
+
+// Set to pend the BusFault exception.
+#define AM_REG_SYSCTRL_SHCSR_BUSFAULTPENDED_S        14
+#define AM_REG_SYSCTRL_SHCSR_BUSFAULTPENDED_M        0x00004000
+#define AM_REG_SYSCTRL_SHCSR_BUSFAULTPENDED(n)       (((uint32_t)(n) << 14) & 0x00004000)
+
+// Set to pend the MemManageFault exception.
+#define AM_REG_SYSCTRL_SHCSR_MEMFAULTPENDED_S        13
+#define AM_REG_SYSCTRL_SHCSR_MEMFAULTPENDED_M        0x00002000
+#define AM_REG_SYSCTRL_SHCSR_MEMFAULTPENDED(n)       (((uint32_t)(n) << 13) & 0x00002000)
+
+// Set to pend the UsageFault exception.
+#define AM_REG_SYSCTRL_SHCSR_USGFAULTPENDED_S        12
+#define AM_REG_SYSCTRL_SHCSR_USGFAULTPENDED_M        0x00001000
+#define AM_REG_SYSCTRL_SHCSR_USGFAULTPENDED(n)       (((uint32_t)(n) << 12) & 0x00001000)
+
+// Set when SysTick is active.
+#define AM_REG_SYSCTRL_SHCSR_SYSTICKACT_S            11
+#define AM_REG_SYSCTRL_SHCSR_SYSTICKACT_M            0x00000800
+#define AM_REG_SYSCTRL_SHCSR_SYSTICKACT(n)           (((uint32_t)(n) << 11) & 0x00000800)
+
+// Set when PendSV is active.
+#define AM_REG_SYSCTRL_SHCSR_PENDSVACT_S             10
+#define AM_REG_SYSCTRL_SHCSR_PENDSVACT_M             0x00000400
+#define AM_REG_SYSCTRL_SHCSR_PENDSVACT(n)            (((uint32_t)(n) << 10) & 0x00000400)
+
+// Set when Monitor is active.
+#define AM_REG_SYSCTRL_SHCSR_MONITORACT_S            8
+#define AM_REG_SYSCTRL_SHCSR_MONITORACT_M            0x00000100
+#define AM_REG_SYSCTRL_SHCSR_MONITORACT(n)           (((uint32_t)(n) << 8) & 0x00000100)
+
+// Set when SVCall is active.
+#define AM_REG_SYSCTRL_SHCSR_SVCALLACT_S             7
+#define AM_REG_SYSCTRL_SHCSR_SVCALLACT_M             0x00000080
+#define AM_REG_SYSCTRL_SHCSR_SVCALLACT(n)            (((uint32_t)(n) << 7) & 0x00000080)
+
+// Set when UsageFault is active.
+#define AM_REG_SYSCTRL_SHCSR_USGFAULTACT_S           3
+#define AM_REG_SYSCTRL_SHCSR_USGFAULTACT_M           0x00000008
+#define AM_REG_SYSCTRL_SHCSR_USGFAULTACT(n)          (((uint32_t)(n) << 3) & 0x00000008)
+
+// Set when BusFault is active.
+#define AM_REG_SYSCTRL_SHCSR_BUSFAULTACT_S           1
+#define AM_REG_SYSCTRL_SHCSR_BUSFAULTACT_M           0x00000002
+#define AM_REG_SYSCTRL_SHCSR_BUSFAULTACT(n)          (((uint32_t)(n) << 1) & 0x00000002)
+
+// Set when MemManageFault is active.
+#define AM_REG_SYSCTRL_SHCSR_MEMFAULTACT_S           0
+#define AM_REG_SYSCTRL_SHCSR_MEMFAULTACT_M           0x00000001
+#define AM_REG_SYSCTRL_SHCSR_MEMFAULTACT(n)          (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// SYSCTRL_CFSR - Configurable Fault Status Register.
+//
+//*****************************************************************************
+// Divide by zero error has occurred.
+#define AM_REG_SYSCTRL_CFSR_DIVBYZERO_S              25
+#define AM_REG_SYSCTRL_CFSR_DIVBYZERO_M              0x02000000
+#define AM_REG_SYSCTRL_CFSR_DIVBYZERO(n)             (((uint32_t)(n) << 25) & 0x02000000)
+
+// Unaligned access error has occurred.
+#define AM_REG_SYSCTRL_CFSR_UNALIGNED_S              24
+#define AM_REG_SYSCTRL_CFSR_UNALIGNED_M              0x01000000
+#define AM_REG_SYSCTRL_CFSR_UNALIGNED(n)             (((uint32_t)(n) << 24) & 0x01000000)
+
+// A coprocessor access error has occurred.
+#define AM_REG_SYSCTRL_CFSR_NOCP_S                   19
+#define AM_REG_SYSCTRL_CFSR_NOCP_M                   0x00080000
+#define AM_REG_SYSCTRL_CFSR_NOCP(n)                  (((uint32_t)(n) << 19) & 0x00080000)
+
+// An integrity check error has occurred on EXC_RETURN.
+#define AM_REG_SYSCTRL_CFSR_INVPC_S                  18
+#define AM_REG_SYSCTRL_CFSR_INVPC_M                  0x00040000
+#define AM_REG_SYSCTRL_CFSR_INVPC(n)                 (((uint32_t)(n) << 18) & 0x00040000)
+
+// Instruction executed with invalid EPSR.T or EPSR.IT field.
+#define AM_REG_SYSCTRL_CFSR_INVSTATE_S               17
+#define AM_REG_SYSCTRL_CFSR_INVSTATE_M               0x00020000
+#define AM_REG_SYSCTRL_CFSR_INVSTATE(n)              (((uint32_t)(n) << 17) & 0x00020000)
+
+// Processor attempted to execute an undefined instruction.
+#define AM_REG_SYSCTRL_CFSR_UNDEFINSTR_S             16
+#define AM_REG_SYSCTRL_CFSR_UNDEFINSTR_M             0x00010000
+#define AM_REG_SYSCTRL_CFSR_UNDEFINSTR(n)            (((uint32_t)(n) << 16) & 0x00010000)
+
+// BFAR has valid contents.
+#define AM_REG_SYSCTRL_CFSR_BFARVALID_S              15
+#define AM_REG_SYSCTRL_CFSR_BFARVALID_M              0x00008000
+#define AM_REG_SYSCTRL_CFSR_BFARVALID(n)             (((uint32_t)(n) << 15) & 0x00008000)
+
+// A bus fault occurred during FP lazy state preservation.
+#define AM_REG_SYSCTRL_CFSR_LSPERR_S                 13
+#define AM_REG_SYSCTRL_CFSR_LSPERR_M                 0x00002000
+#define AM_REG_SYSCTRL_CFSR_LSPERR(n)                (((uint32_t)(n) << 13) & 0x00002000)
+
+// A derived bus fault has occurred on exception entry.
+#define AM_REG_SYSCTRL_CFSR_STKERR_S                 12
+#define AM_REG_SYSCTRL_CFSR_STKERR_M                 0x00001000
+#define AM_REG_SYSCTRL_CFSR_STKERR(n)                (((uint32_t)(n) << 12) & 0x00001000)
+
+// A derived bus fault has occurred on exception return.
+#define AM_REG_SYSCTRL_CFSR_UNSTKERR_S               11
+#define AM_REG_SYSCTRL_CFSR_UNSTKERR_M               0x00000800
+#define AM_REG_SYSCTRL_CFSR_UNSTKERR(n)              (((uint32_t)(n) << 11) & 0x00000800)
+
+// Imprecise data access error has occurred.
+#define AM_REG_SYSCTRL_CFSR_IMPRECISERR_S            10
+#define AM_REG_SYSCTRL_CFSR_IMPRECISERR_M            0x00000400
+#define AM_REG_SYSCTRL_CFSR_IMPRECISERR(n)           (((uint32_t)(n) << 10) & 0x00000400)
+
+// A precise data access has occurrred. The faulting address is in BFAR.
+#define AM_REG_SYSCTRL_CFSR_PRECISERR_S              9
+#define AM_REG_SYSCTRL_CFSR_PRECISERR_M              0x00000200
+#define AM_REG_SYSCTRL_CFSR_PRECISERR(n)             (((uint32_t)(n) << 9) & 0x00000200)
+
+// A bus fault on an instruction prefetch has occurred.
+#define AM_REG_SYSCTRL_CFSR_IBUSERR_S                8
+#define AM_REG_SYSCTRL_CFSR_IBUSERR_M                0x00000100
+#define AM_REG_SYSCTRL_CFSR_IBUSERR(n)               (((uint32_t)(n) << 8) & 0x00000100)
+
+// MMAR has valid contents.
+#define AM_REG_SYSCTRL_CFSR_MMARVALID_S              7
+#define AM_REG_SYSCTRL_CFSR_MMARVALID_M              0x00000080
+#define AM_REG_SYSCTRL_CFSR_MMARVALID(n)             (((uint32_t)(n) << 7) & 0x00000080)
+
+// MemManage fault occurred during FP lazy state preservation.
+#define AM_REG_SYSCTRL_CFSR_MLSPERR_S                5
+#define AM_REG_SYSCTRL_CFSR_MLSPERR_M                0x00000020
+#define AM_REG_SYSCTRL_CFSR_MLSPERR(n)               (((uint32_t)(n) << 5) & 0x00000020)
+
+// Derived MemManage fault occurred on exception entry.
+#define AM_REG_SYSCTRL_CFSR_MSTKERR_S                4
+#define AM_REG_SYSCTRL_CFSR_MSTKERR_M                0x00000010
+#define AM_REG_SYSCTRL_CFSR_MSTKERR(n)               (((uint32_t)(n) << 4) & 0x00000010)
+
+// Derived MemManage fault occurred on exception return.
+#define AM_REG_SYSCTRL_CFSR_MUNSTKER_S               3
+#define AM_REG_SYSCTRL_CFSR_MUNSTKER_M               0x00000008
+#define AM_REG_SYSCTRL_CFSR_MUNSTKER(n)              (((uint32_t)(n) << 3) & 0x00000008)
+
+// Data access violation. Address is in MMAR.
+#define AM_REG_SYSCTRL_CFSR_DACCVIOL_S               1
+#define AM_REG_SYSCTRL_CFSR_DACCVIOL_M               0x00000002
+#define AM_REG_SYSCTRL_CFSR_DACCVIOL(n)              (((uint32_t)(n) << 1) & 0x00000002)
+
+// MPU or Execute Never default memory map access violation.
+#define AM_REG_SYSCTRL_CFSR_IACCVIOL_S               0
+#define AM_REG_SYSCTRL_CFSR_IACCVIOL_M               0x00000001
+#define AM_REG_SYSCTRL_CFSR_IACCVIOL(n)              (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// SYSCTRL_HFSR - Hard Fault Status Register.
+//
+//*****************************************************************************
+// Debug event has occurred.
+#define AM_REG_SYSCTRL_HFSR_DEBUGEVT_S               31
+#define AM_REG_SYSCTRL_HFSR_DEBUGEVT_M               0x80000000
+#define AM_REG_SYSCTRL_HFSR_DEBUGEVT(n)              (((uint32_t)(n) << 31) & 0x80000000)
+
+// Processor has elevated a configurable-priority fault to a HardFault.
+#define AM_REG_SYSCTRL_HFSR_FORCED_S                 30
+#define AM_REG_SYSCTRL_HFSR_FORCED_M                 0x40000000
+#define AM_REG_SYSCTRL_HFSR_FORCED(n)                (((uint32_t)(n) << 30) & 0x40000000)
+
+// Vector table read fault has occurred.
+#define AM_REG_SYSCTRL_HFSR_VECTTBL_S                1
+#define AM_REG_SYSCTRL_HFSR_VECTTBL_M                0x00000002
+#define AM_REG_SYSCTRL_HFSR_VECTTBL(n)               (((uint32_t)(n) << 1) & 0x00000002)
+
+//*****************************************************************************
+//
+// SYSCTRL_MMFAR - MemManage Fault Address Register.
+//
+//*****************************************************************************
+// Address of the memory location that caused an MMU fault.
+#define AM_REG_SYSCTRL_MMFAR_ADDRESS_S               0
+#define AM_REG_SYSCTRL_MMFAR_ADDRESS_M               0xFFFFFFFF
+#define AM_REG_SYSCTRL_MMFAR_ADDRESS(n)              (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// SYSCTRL_BFAR - Bus Fault Address Register.
+//
+//*****************************************************************************
+// Address of the memory location that caused an Bus fault.
+#define AM_REG_SYSCTRL_BFAR_ADDRESS_S                0
+#define AM_REG_SYSCTRL_BFAR_ADDRESS_M                0xFFFFFFFF
+#define AM_REG_SYSCTRL_BFAR_ADDRESS(n)               (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// SYSCTRL_CPACR - Coprocessor Access Control Register.
+//
+//*****************************************************************************
+// Access priveleges for the Floating point unit. Must always match CP10.
+#define AM_REG_SYSCTRL_CPACR_CP11_S                  22
+#define AM_REG_SYSCTRL_CPACR_CP11_M                  0x00C00000
+#define AM_REG_SYSCTRL_CPACR_CP11(n)                 (((uint32_t)(n) << 22) & 0x00C00000)
+
+// Access priveleges for the Floating point unit. Must always match CP11.
+#define AM_REG_SYSCTRL_CPACR_CP10_S                  20
+#define AM_REG_SYSCTRL_CPACR_CP10_M                  0x00300000
+#define AM_REG_SYSCTRL_CPACR_CP10(n)                 (((uint32_t)(n) << 20) & 0x00300000)
+
+//*****************************************************************************
+//
+// SYSCTRL_DEMCR - Debug Exception and Monitor Control Register
+//
+//*****************************************************************************
+// Global enable for all DWT and ITM features.
+#define AM_REG_SYSCTRL_DEMCR_TRCENA_S                24
+#define AM_REG_SYSCTRL_DEMCR_TRCENA_M                0x01000000
+#define AM_REG_SYSCTRL_DEMCR_TRCENA(n)               (((uint32_t)(n) << 24) & 0x01000000)
+
+//*****************************************************************************
+//
+// SYSCTRL_STIR - Software Triggered Interrupt Register
+//
+//*****************************************************************************
+// Vector number of the interrupt that should be triggered.
+#define AM_REG_SYSCTRL_STIR_INTID_S                  0
+#define AM_REG_SYSCTRL_STIR_INTID_M                  0xFFFFFFFF
+#define AM_REG_SYSCTRL_STIR_INTID(n)                 (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// SYSCTRL_FPCCR - Floating-Point Context Control Register.
+//
+//*****************************************************************************
+// Set to enable automatic saving of FP registers on exception entry.
+#define AM_REG_SYSCTRL_FPCCR_ASPEN_S                 31
+#define AM_REG_SYSCTRL_FPCCR_ASPEN_M                 0x80000000
+#define AM_REG_SYSCTRL_FPCCR_ASPEN(n)                (((uint32_t)(n) << 31) & 0x80000000)
+
+// Set to enable lazy context saving of FP registers on exception entry.
+#define AM_REG_SYSCTRL_FPCCR_LSPEN_S                 30
+#define AM_REG_SYSCTRL_FPCCR_LSPEN_M                 0x40000000
+#define AM_REG_SYSCTRL_FPCCR_LSPEN(n)                (((uint32_t)(n) << 30) & 0x40000000)
+
+// Able to set DebugMonitor exception to pending on last FP stack allocation.
+#define AM_REG_SYSCTRL_FPCCR_MONRDY_S                8
+#define AM_REG_SYSCTRL_FPCCR_MONRDY_M                0x00000100
+#define AM_REG_SYSCTRL_FPCCR_MONRDY(n)               (((uint32_t)(n) << 8) & 0x00000100)
+
+// Able to set BusFault exception to pending on last FP stack allocation.
+#define AM_REG_SYSCTRL_FPCCR_BFRDY_S                 6
+#define AM_REG_SYSCTRL_FPCCR_BFRDY_M                 0x00000040
+#define AM_REG_SYSCTRL_FPCCR_BFRDY(n)                (((uint32_t)(n) << 6) & 0x00000040)
+
+// Able to set MemManage exception to pending on last FP stack allocation.
+#define AM_REG_SYSCTRL_FPCCR_MMRDY_S                 5
+#define AM_REG_SYSCTRL_FPCCR_MMRDY_M                 0x00000020
+#define AM_REG_SYSCTRL_FPCCR_MMRDY(n)                (((uint32_t)(n) << 5) & 0x00000020)
+
+// Able to set HardFault exception to pending on last FP stack allocation.
+#define AM_REG_SYSCTRL_FPCCR_HFRDY_S                 4
+#define AM_REG_SYSCTRL_FPCCR_HFRDY_M                 0x00000010
+#define AM_REG_SYSCTRL_FPCCR_HFRDY(n)                (((uint32_t)(n) << 4) & 0x00000010)
+
+// Running from Thread mode on last FP stack allocation.
+#define AM_REG_SYSCTRL_FPCCR_THREAD_S                3
+#define AM_REG_SYSCTRL_FPCCR_THREAD_M                0x00000008
+#define AM_REG_SYSCTRL_FPCCR_THREAD(n)               (((uint32_t)(n) << 3) & 0x00000008)
+
+// Running from unprivileged mode on last FP stack allocation.
+#define AM_REG_SYSCTRL_FPCCR_USER_S                  1
+#define AM_REG_SYSCTRL_FPCCR_USER_M                  0x00000002
+#define AM_REG_SYSCTRL_FPCCR_USER(n)                 (((uint32_t)(n) << 1) & 0x00000002)
+
+// Lazy state preservation is active.
+#define AM_REG_SYSCTRL_FPCCR_LSPACT_S                0
+#define AM_REG_SYSCTRL_FPCCR_LSPACT_M                0x00000001
+#define AM_REG_SYSCTRL_FPCCR_LSPACT(n)               (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// SYSCTRL_FPCAR - Floating-Point Context Address Register.
+//
+//*****************************************************************************
+// Address of the unpopulated floating-point register space allocated on the
+// exception stack frame.
+#define AM_REG_SYSCTRL_FPCAR_ADDRESS_S               0
+#define AM_REG_SYSCTRL_FPCAR_ADDRESS_M               0xFFFFFFFF
+#define AM_REG_SYSCTRL_FPCAR_ADDRESS(n)              (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+
+//*****************************************************************************
+//
+// SYSCTRL_FPDSCR - Floating-Point Default Status Control Register.
+//
+//*****************************************************************************
+// Default value for FPSCR.AHP.
+#define AM_REG_SYSCTRL_FPDSCR_AHP_S                  26
+#define AM_REG_SYSCTRL_FPDSCR_AHP_M                  0x04000000
+#define AM_REG_SYSCTRL_FPDSCR_AHP(n)                 (((uint32_t)(n) << 26) & 0x04000000)
+
+// Default value for FPSCR.DN.
+#define AM_REG_SYSCTRL_FPDSCR_DN_S                   25
+#define AM_REG_SYSCTRL_FPDSCR_DN_M                   0x02000000
+#define AM_REG_SYSCTRL_FPDSCR_DN(n)                  (((uint32_t)(n) << 25) & 0x02000000)
+
+// Default value for FPSCR.FZ.
+#define AM_REG_SYSCTRL_FPDSCR_FZ_S                   24
+#define AM_REG_SYSCTRL_FPDSCR_FZ_M                   0x01000000
+#define AM_REG_SYSCTRL_FPDSCR_FZ(n)                  (((uint32_t)(n) << 24) & 0x01000000)
+
+// Default value for FPSCR.RMode.
+#define AM_REG_SYSCTRL_FPDSCR_RMODE_S                22
+#define AM_REG_SYSCTRL_FPDSCR_RMODE_M                0x00C00000
+#define AM_REG_SYSCTRL_FPDSCR_RMODE(n)               (((uint32_t)(n) << 22) & 0x00C00000)
+
+#endif // AM_REG_SYSCTRL_H
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_systick.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_systick.h
new file mode 100644
index 000000000..72deea872
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_systick.h
@@ -0,0 +1,136 @@
+//*****************************************************************************
+//
+//! @file am_reg_systick.h
+//!
+//! @brief Register macros for the SYSTICK module
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_REG_SYSTICK_H
+#define AM_REG_SYSTICK_H
+
+//*****************************************************************************
+//
+// Instance finder. (1 instance(s) available)
+//
+//*****************************************************************************
+#define AM_REG_SYSTICK_NUM_MODULES                   1
+#define AM_REG_SYSTICKn(n) \
+    (REG_SYSTICK_BASEADDR + 0x00000000 * n)
+
+//*****************************************************************************
+//
+// Register offsets.
+//
+//*****************************************************************************
+#define AM_REG_SYSTICK_SYSTCSR_O                     0xE000E010
+#define AM_REG_SYSTICK_SYSTRVR_O                     0xE000E014
+#define AM_REG_SYSTICK_SYSTCVR_O                     0xE000E018
+#define AM_REG_SYSTICK_SYSTCALIB_O                   0xE000E01C
+
+//*****************************************************************************
+//
+// SYSTICK_SYSTCSR - SysTick Control and Status Register.
+//
+//*****************************************************************************
+// Returns 1 if timer counted to 0 since last time this was read.
+#define AM_REG_SYSTICK_SYSTCSR_COUNTFLAG_S           16
+#define AM_REG_SYSTICK_SYSTCSR_COUNTFLAG_M           0x00010000
+#define AM_REG_SYSTICK_SYSTCSR_COUNTFLAG(n)          (((uint32_t)(n) << 16) & 0x00010000)
+
+// Enables SysTick exception request. Software can use COUNTFLAG to determine if
+// SysTick has ever counted to zero. 0 = counting down to zero does not assert
+// the SysTick exception request; 1 = counting down to zero asserts the SysTick
+// exception request.
+#define AM_REG_SYSTICK_SYSTCSR_TICKINT_S             1
+#define AM_REG_SYSTICK_SYSTCSR_TICKINT_M             0x00000002
+#define AM_REG_SYSTICK_SYSTCSR_TICKINT(n)            (((uint32_t)(n) << 1) & 0x00000002)
+
+// Enables the counter. 0 = counter disabled; 1 = counter enabled.
+#define AM_REG_SYSTICK_SYSTCSR_ENABLE_S              0
+#define AM_REG_SYSTICK_SYSTCSR_ENABLE_M              0x00000001
+#define AM_REG_SYSTICK_SYSTCSR_ENABLE(n)             (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// SYSTICK_SYSTRVR - SysTick Reload Value Register.
+//
+//*****************************************************************************
+// Value to load into the SYSTCVR register when the counter is enabled and when
+// it reaches 0.
+#define AM_REG_SYSTICK_SYSTRVR_RELOAD_S              0
+#define AM_REG_SYSTICK_SYSTRVR_RELOAD_M              0x00FFFFFF
+#define AM_REG_SYSTICK_SYSTRVR_RELOAD(n)             (((uint32_t)(n) << 0) & 0x00FFFFFF)
+
+//*****************************************************************************
+//
+// SYSTICK_SYSTCVR - SysTick Current Value Register.
+//
+//*****************************************************************************
+// Reads return the current value of the SysTick counter. A write of any value
+// clears the field to 0, and also clears the SYSTCSR COUNTFLAG bit to 0.
+#define AM_REG_SYSTICK_SYSTCVR_CURRENT_S             0
+#define AM_REG_SYSTICK_SYSTCVR_CURRENT_M             0x00FFFFFF
+#define AM_REG_SYSTICK_SYSTCVR_CURRENT(n)            (((uint32_t)(n) << 0) & 0x00FFFFFF)
+
+//*****************************************************************************
+//
+// SYSTICK_SYSTCALIB - SysTick Calibration Value Register.
+//
+//*****************************************************************************
+// Indicates whether the device provides a reference clock to the processor. 0 =
+// reference clock provided; 1 = no reference clock provided. If your device
+// does not provide a reference clock, the SYST_CSR.CLKSOURCE bit reads-as-one
+// and ignores writes.
+#define AM_REG_SYSTICK_SYSTCALIB_NOREF_S             31
+#define AM_REG_SYSTICK_SYSTCALIB_NOREF_M             0x80000000
+#define AM_REG_SYSTICK_SYSTCALIB_NOREF(n)            (((uint32_t)(n) << 31) & 0x80000000)
+
+// Indicates whether the TENMS value is exact. 0 = TENMS value is exact; 1 =
+// TENMS value is inexact, or not given. An inexact TENMS value can affect the
+// suitability of SysTick as a software real time clock.
+#define AM_REG_SYSTICK_SYSTCALIB_SKEW_S              30
+#define AM_REG_SYSTICK_SYSTCALIB_SKEW_M              0x40000000
+#define AM_REG_SYSTICK_SYSTCALIB_SKEW(n)             (((uint32_t)(n) << 30) & 0x40000000)
+
+// Reload value for 10ms (100Hz) timing, subject to system clock skew errors. If
+// the value reads as zero, the calibration value is not known.
+#define AM_REG_SYSTICK_SYSTCALIB_TENMS_S             0
+#define AM_REG_SYSTICK_SYSTCALIB_TENMS_M             0x00FFFFFF
+#define AM_REG_SYSTICK_SYSTCALIB_TENMS(n)            (((uint32_t)(n) << 0) & 0x00FFFFFF)
+
+#endif // AM_REG_SYSTICK_H
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_tpiu.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_tpiu.h
new file mode 100644
index 000000000..1c8bad5a9
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_tpiu.h
@@ -0,0 +1,163 @@
+//*****************************************************************************
+//
+//! @file am_reg_tpiu.h
+//!
+//! @brief Register macros for the TPIU module
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_REG_TPIU_H
+#define AM_REG_TPIU_H
+
+//*****************************************************************************
+//
+// Instance finder. (1 instance(s) available)
+//
+//*****************************************************************************
+#define AM_REG_TPIU_NUM_MODULES                      1
+#define AM_REG_TPIUn(n) \
+    (REG_TPIU_BASEADDR + 0x00000000 * n)
+
+//*****************************************************************************
+//
+// Register offsets.
+//
+//*****************************************************************************
+#define AM_REG_TPIU_SSPSR_O                          0xE0040000
+#define AM_REG_TPIU_CSPSR_O                          0xE0040004
+#define AM_REG_TPIU_ACPR_O                           0xE0040010
+#define AM_REG_TPIU_SPPR_O                           0xE00400F0
+#define AM_REG_TPIU_FFCR_O                           0xE0040304
+#define AM_REG_TPIU_ITCTRL_O                         0xE0040F00
+#define AM_REG_TPIU_TYPE_O                           0xE0040FC8
+
+//*****************************************************************************
+//
+// TPIU_SSPSR - Supported Parallel Port Sizes.
+//
+//*****************************************************************************
+// Parallel Port Width 1 supported
+#define AM_REG_TPIU_SSPSR_SWIDTH0_S                  0
+#define AM_REG_TPIU_SSPSR_SWIDTH0_M                  0x00000001
+#define AM_REG_TPIU_SSPSR_SWIDTH0(n)                 (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// TPIU_CSPSR - Current Parallel Port Size.
+//
+//*****************************************************************************
+// One-hot representation of the current port width.
+#define AM_REG_TPIU_CSPSR_CWIDTH_S                   0
+#define AM_REG_TPIU_CSPSR_CWIDTH_M                   0xFFFFFFFF
+#define AM_REG_TPIU_CSPSR_CWIDTH(n)                  (((uint32_t)(n) << 0) & 0xFFFFFFFF)
+#define AM_REG_TPIU_CSPSR_CWIDTH_1BIT                0x00000001
+
+//*****************************************************************************
+//
+// TPIU_ACPR - Asynchronous Clock Prescaler.
+//
+//*****************************************************************************
+// Prescaler value for the baudrate of SWO.
+#define AM_REG_TPIU_ACPR_SWOSCALER_S                 0
+#define AM_REG_TPIU_ACPR_SWOSCALER_M                 0x0000FFFF
+#define AM_REG_TPIU_ACPR_SWOSCALER(n)                (((uint32_t)(n) << 0) & 0x0000FFFF)
+#define AM_REG_TPIU_ACPR_SWOSCALER_115200            0x00000033
+
+//*****************************************************************************
+//
+// TPIU_SPPR - Selected Pin Protocol.
+//
+//*****************************************************************************
+// Selects the protocol used for trace output.
+#define AM_REG_TPIU_SPPR_TXMODE_S                    0
+#define AM_REG_TPIU_SPPR_TXMODE_M                    0x00000003
+#define AM_REG_TPIU_SPPR_TXMODE(n)                   (((uint32_t)(n) << 0) & 0x00000003)
+#define AM_REG_TPIU_SPPR_TXMODE_PARALLEL             0x00000000
+#define AM_REG_TPIU_SPPR_TXMODE_MANCHESTER           0x00000001
+#define AM_REG_TPIU_SPPR_TXMODE_NRZ                  0x00000002
+#define AM_REG_TPIU_SPPR_TXMODE_UART                 0x00000002
+
+//*****************************************************************************
+//
+// TPIU_FFCR - Formatter and Flush Control Register.
+//
+//*****************************************************************************
+// Enable continuous formatting.
+#define AM_REG_TPIU_FFCR_ENFCONT_S                   1
+#define AM_REG_TPIU_FFCR_ENFCONT_M                   0x00000002
+#define AM_REG_TPIU_FFCR_ENFCONT(n)                  (((uint32_t)(n) << 1) & 0x00000002)
+
+//*****************************************************************************
+//
+// TPIU_ITCTRL - Specifies normal or integration mode for the TPIU.
+//
+//*****************************************************************************
+// Specifies the current mode for the TPIU.
+#define AM_REG_TPIU_ITCTRL_MODE_S                    0
+#define AM_REG_TPIU_ITCTRL_MODE_M                    0x00000003
+#define AM_REG_TPIU_ITCTRL_MODE(n)                   (((uint32_t)(n) << 0) & 0x00000003)
+#define AM_REG_TPIU_ITCTRL_MODE_NORMAL               0x00000000
+#define AM_REG_TPIU_ITCTRL_MODE_TEST                 0x00000001
+#define AM_REG_TPIU_ITCTRL_MODE_DATA_TEST            0x00000002
+
+//*****************************************************************************
+//
+// TPIU_TYPE - TPIU Type.
+//
+//*****************************************************************************
+// 1 Indicates UART/NRZ support.
+#define AM_REG_TPIU_TYPE_NRZVALID_S                  11
+#define AM_REG_TPIU_TYPE_NRZVALID_M                  0x00000800
+#define AM_REG_TPIU_TYPE_NRZVALID(n)                 (((uint32_t)(n) << 11) & 0x00000800)
+
+// 1 Indicates Manchester support.
+#define AM_REG_TPIU_TYPE_MANCVALID_S                 10
+#define AM_REG_TPIU_TYPE_MANCVALID_M                 0x00000400
+#define AM_REG_TPIU_TYPE_MANCVALID(n)                (((uint32_t)(n) << 10) & 0x00000400)
+
+// 0 Indicates Parallel Trace support.
+#define AM_REG_TPIU_TYPE_PTINVALID_S                 9
+#define AM_REG_TPIU_TYPE_PTINVALID_M                 0x00000200
+#define AM_REG_TPIU_TYPE_PTINVALID(n)                (((uint32_t)(n) << 9) & 0x00000200)
+
+// FIFO Size reported as a power of two. For instance, 0x3 indicates a FIFO size
+// of 8 bytes.
+#define AM_REG_TPIU_TYPE_FIFOSZ_S                    6
+#define AM_REG_TPIU_TYPE_FIFOSZ_M                    0x000001C0
+#define AM_REG_TPIU_TYPE_FIFOSZ(n)                   (((uint32_t)(n) << 6) & 0x000001C0)
+
+#endif // AM_REG_TPIU_H
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_uart.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_uart.h
new file mode 100644
index 000000000..15e6ef68d
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_uart.h
@@ -0,0 +1,611 @@
+//*****************************************************************************
+//
+//! @file am_reg_uart.h
+//!
+//! @brief Register macros for the UART module
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_REG_UART_H
+#define AM_REG_UART_H
+
+//*****************************************************************************
+//
+// Instance finder. (2 instance(s) available)
+//
+//*****************************************************************************
+#define AM_REG_UART_NUM_MODULES                      2
+#define AM_REG_UARTn(n) \
+    (REG_UART_BASEADDR + 0x00001000 * n)
+
+//*****************************************************************************
+//
+// Register offsets.
+//
+//*****************************************************************************
+#define AM_REG_UART_DR_O                             0x00000000
+#define AM_REG_UART_RSR_O                            0x00000004
+#define AM_REG_UART_FR_O                             0x00000018
+#define AM_REG_UART_ILPR_O                           0x00000020
+#define AM_REG_UART_IBRD_O                           0x00000024
+#define AM_REG_UART_FBRD_O                           0x00000028
+#define AM_REG_UART_LCRH_O                           0x0000002C
+#define AM_REG_UART_CR_O                             0x00000030
+#define AM_REG_UART_IFLS_O                           0x00000034
+#define AM_REG_UART_IER_O                            0x00000038
+#define AM_REG_UART_IES_O                            0x0000003C
+#define AM_REG_UART_MIS_O                            0x00000040
+#define AM_REG_UART_IEC_O                            0x00000044
+
+//*****************************************************************************
+//
+// UART_DR - UART Data Register
+//
+//*****************************************************************************
+// This is the overrun error indicator.
+#define AM_REG_UART_DR_OEDATA_S                      11
+#define AM_REG_UART_DR_OEDATA_M                      0x00000800
+#define AM_REG_UART_DR_OEDATA(n)                     (((uint32_t)(n) << 11) & 0x00000800)
+#define AM_REG_UART_DR_OEDATA_NOERR                  0x00000000
+#define AM_REG_UART_DR_OEDATA_ERR                    0x00000800
+
+// This is the break error indicator.
+#define AM_REG_UART_DR_BEDATA_S                      10
+#define AM_REG_UART_DR_BEDATA_M                      0x00000400
+#define AM_REG_UART_DR_BEDATA(n)                     (((uint32_t)(n) << 10) & 0x00000400)
+#define AM_REG_UART_DR_BEDATA_NOERR                  0x00000000
+#define AM_REG_UART_DR_BEDATA_ERR                    0x00000400
+
+// This is the parity error indicator.
+#define AM_REG_UART_DR_PEDATA_S                      9
+#define AM_REG_UART_DR_PEDATA_M                      0x00000200
+#define AM_REG_UART_DR_PEDATA(n)                     (((uint32_t)(n) << 9) & 0x00000200)
+#define AM_REG_UART_DR_PEDATA_NOERR                  0x00000000
+#define AM_REG_UART_DR_PEDATA_ERR                    0x00000200
+
+// This is the framing error indicator.
+#define AM_REG_UART_DR_FEDATA_S                      8
+#define AM_REG_UART_DR_FEDATA_M                      0x00000100
+#define AM_REG_UART_DR_FEDATA(n)                     (((uint32_t)(n) << 8) & 0x00000100)
+#define AM_REG_UART_DR_FEDATA_NOERR                  0x00000000
+#define AM_REG_UART_DR_FEDATA_ERR                    0x00000100
+
+// This is the UART data port.
+#define AM_REG_UART_DR_DATA_S                        0
+#define AM_REG_UART_DR_DATA_M                        0x000000FF
+#define AM_REG_UART_DR_DATA(n)                       (((uint32_t)(n) << 0) & 0x000000FF)
+
+//*****************************************************************************
+//
+// UART_RSR - UART Status Register
+//
+//*****************************************************************************
+// This is the overrun error indicator.
+#define AM_REG_UART_RSR_OESTAT_S                     3
+#define AM_REG_UART_RSR_OESTAT_M                     0x00000008
+#define AM_REG_UART_RSR_OESTAT(n)                    (((uint32_t)(n) << 3) & 0x00000008)
+#define AM_REG_UART_RSR_OESTAT_NOERR                 0x00000000
+#define AM_REG_UART_RSR_OESTAT_ERR                   0x00000008
+
+// This is the break error indicator.
+#define AM_REG_UART_RSR_BESTAT_S                     2
+#define AM_REG_UART_RSR_BESTAT_M                     0x00000004
+#define AM_REG_UART_RSR_BESTAT(n)                    (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_UART_RSR_BESTAT_NOERR                 0x00000000
+#define AM_REG_UART_RSR_BESTAT_ERR                   0x00000004
+
+// This is the parity error indicator.
+#define AM_REG_UART_RSR_PESTAT_S                     1
+#define AM_REG_UART_RSR_PESTAT_M                     0x00000002
+#define AM_REG_UART_RSR_PESTAT(n)                    (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_UART_RSR_PESTAT_NOERR                 0x00000000
+#define AM_REG_UART_RSR_PESTAT_ERR                   0x00000002
+
+// This is the framing error indicator.
+#define AM_REG_UART_RSR_FESTAT_S                     0
+#define AM_REG_UART_RSR_FESTAT_M                     0x00000001
+#define AM_REG_UART_RSR_FESTAT(n)                    (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_UART_RSR_FESTAT_NOERR                 0x00000000
+#define AM_REG_UART_RSR_FESTAT_ERR                   0x00000001
+
+//*****************************************************************************
+//
+// UART_FR - Flag Register
+//
+//*****************************************************************************
+// This bit holds the transmit BUSY indicator.
+#define AM_REG_UART_FR_TXBUSY_S                      8
+#define AM_REG_UART_FR_TXBUSY_M                      0x00000100
+#define AM_REG_UART_FR_TXBUSY(n)                     (((uint32_t)(n) << 8) & 0x00000100)
+
+// This bit holds the transmit FIFO empty indicator.
+#define AM_REG_UART_FR_TXFE_S                        7
+#define AM_REG_UART_FR_TXFE_M                        0x00000080
+#define AM_REG_UART_FR_TXFE(n)                       (((uint32_t)(n) << 7) & 0x00000080)
+#define AM_REG_UART_FR_TXFE_XMTFIFO_EMPTY            0x00000080
+
+// This bit holds the receive FIFO full indicator.
+#define AM_REG_UART_FR_RXFF_S                        6
+#define AM_REG_UART_FR_RXFF_M                        0x00000040
+#define AM_REG_UART_FR_RXFF(n)                       (((uint32_t)(n) << 6) & 0x00000040)
+#define AM_REG_UART_FR_RXFF_RCVFIFO_FULL             0x00000040
+
+// This bit holds the transmit FIFO full indicator.
+#define AM_REG_UART_FR_TXFF_S                        5
+#define AM_REG_UART_FR_TXFF_M                        0x00000020
+#define AM_REG_UART_FR_TXFF(n)                       (((uint32_t)(n) << 5) & 0x00000020)
+#define AM_REG_UART_FR_TXFF_XMTFIFO_FULL             0x00000020
+
+// This bit holds the receive FIFO empty indicator.
+#define AM_REG_UART_FR_RXFE_S                        4
+#define AM_REG_UART_FR_RXFE_M                        0x00000010
+#define AM_REG_UART_FR_RXFE(n)                       (((uint32_t)(n) << 4) & 0x00000010)
+#define AM_REG_UART_FR_RXFE_RCVFIFO_EMPTY            0x00000010
+
+// This bit holds the busy indicator.
+#define AM_REG_UART_FR_BUSY_S                        3
+#define AM_REG_UART_FR_BUSY_M                        0x00000008
+#define AM_REG_UART_FR_BUSY(n)                       (((uint32_t)(n) << 3) & 0x00000008)
+#define AM_REG_UART_FR_BUSY_BUSY                     0x00000008
+
+// This bit holds the data carrier detect indicator.
+#define AM_REG_UART_FR_DCD_S                         2
+#define AM_REG_UART_FR_DCD_M                         0x00000004
+#define AM_REG_UART_FR_DCD(n)                        (((uint32_t)(n) << 2) & 0x00000004)
+#define AM_REG_UART_FR_DCD_DETECTED                  0x00000004
+
+// This bit holds the data set ready indicator.
+#define AM_REG_UART_FR_DSR_S                         1
+#define AM_REG_UART_FR_DSR_M                         0x00000002
+#define AM_REG_UART_FR_DSR(n)                        (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_UART_FR_DSR_READY                     0x00000002
+
+// This bit holds the clear to send indicator.
+#define AM_REG_UART_FR_CTS_S                         0
+#define AM_REG_UART_FR_CTS_M                         0x00000001
+#define AM_REG_UART_FR_CTS(n)                        (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_UART_FR_CTS_CLEARTOSEND               0x00000001
+
+//*****************************************************************************
+//
+// UART_ILPR - IrDA Counter
+//
+//*****************************************************************************
+// These bits hold the IrDA counter divisor.
+#define AM_REG_UART_ILPR_ILPDVSR_S                   0
+#define AM_REG_UART_ILPR_ILPDVSR_M                   0x000000FF
+#define AM_REG_UART_ILPR_ILPDVSR(n)                  (((uint32_t)(n) << 0) & 0x000000FF)
+
+//*****************************************************************************
+//
+// UART_IBRD - Integer Baud Rate Divisor
+//
+//*****************************************************************************
+// These bits hold the baud integer divisor.
+#define AM_REG_UART_IBRD_DIVINT_S                    0
+#define AM_REG_UART_IBRD_DIVINT_M                    0x0000FFFF
+#define AM_REG_UART_IBRD_DIVINT(n)                   (((uint32_t)(n) << 0) & 0x0000FFFF)
+
+//*****************************************************************************
+//
+// UART_FBRD - Fractional Baud Rate Divisor
+//
+//*****************************************************************************
+// These bits hold the baud fractional divisor.
+#define AM_REG_UART_FBRD_DIVFRAC_S                   0
+#define AM_REG_UART_FBRD_DIVFRAC_M                   0x0000003F
+#define AM_REG_UART_FBRD_DIVFRAC(n)                  (((uint32_t)(n) << 0) & 0x0000003F)
+
+//*****************************************************************************
+//
+// UART_LCRH - Line Control High
+//
+//*****************************************************************************
+// This bit holds the stick parity select.
+#define AM_REG_UART_LCRH_SPS_S                       7
+#define AM_REG_UART_LCRH_SPS_M                       0x00000080
+#define AM_REG_UART_LCRH_SPS(n)                      (((uint32_t)(n) << 7) & 0x00000080)
+
+// These bits hold the write length.
+#define AM_REG_UART_LCRH_WLEN_S                      5
+#define AM_REG_UART_LCRH_WLEN_M                      0x00000060
+#define AM_REG_UART_LCRH_WLEN(n)                     (((uint32_t)(n) << 5) & 0x00000060)
+
+// This bit holds the FIFO enable.
+#define AM_REG_UART_LCRH_FEN_S                       4
+#define AM_REG_UART_LCRH_FEN_M                       0x00000010
+#define AM_REG_UART_LCRH_FEN(n)                      (((uint32_t)(n) << 4) & 0x00000010)
+
+// This bit holds the two stop bits select.
+#define AM_REG_UART_LCRH_STP2_S                      3
+#define AM_REG_UART_LCRH_STP2_M                      0x00000008
+#define AM_REG_UART_LCRH_STP2(n)                     (((uint32_t)(n) << 3) & 0x00000008)
+
+// This bit holds the even parity select.
+#define AM_REG_UART_LCRH_EPS_S                       2
+#define AM_REG_UART_LCRH_EPS_M                       0x00000004
+#define AM_REG_UART_LCRH_EPS(n)                      (((uint32_t)(n) << 2) & 0x00000004)
+
+// This bit holds the parity enable.
+#define AM_REG_UART_LCRH_PEN_S                       1
+#define AM_REG_UART_LCRH_PEN_M                       0x00000002
+#define AM_REG_UART_LCRH_PEN(n)                      (((uint32_t)(n) << 1) & 0x00000002)
+
+// This bit holds the break set.
+#define AM_REG_UART_LCRH_BRK_S                       0
+#define AM_REG_UART_LCRH_BRK_M                       0x00000001
+#define AM_REG_UART_LCRH_BRK(n)                      (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// UART_CR - Control Register
+//
+//*****************************************************************************
+// This bit enables CTS hardware flow control.
+#define AM_REG_UART_CR_CTSEN_S                       15
+#define AM_REG_UART_CR_CTSEN_M                       0x00008000
+#define AM_REG_UART_CR_CTSEN(n)                      (((uint32_t)(n) << 15) & 0x00008000)
+
+// This bit enables RTS hardware flow control.
+#define AM_REG_UART_CR_RTSEN_S                       14
+#define AM_REG_UART_CR_RTSEN_M                       0x00004000
+#define AM_REG_UART_CR_RTSEN(n)                      (((uint32_t)(n) << 14) & 0x00004000)
+
+// This bit holds modem Out2.
+#define AM_REG_UART_CR_OUT2_S                        13
+#define AM_REG_UART_CR_OUT2_M                        0x00002000
+#define AM_REG_UART_CR_OUT2(n)                       (((uint32_t)(n) << 13) & 0x00002000)
+
+// This bit holds modem Out1.
+#define AM_REG_UART_CR_OUT1_S                        12
+#define AM_REG_UART_CR_OUT1_M                        0x00001000
+#define AM_REG_UART_CR_OUT1(n)                       (((uint32_t)(n) << 12) & 0x00001000)
+
+// This bit enables request to send.
+#define AM_REG_UART_CR_RTS_S                         11
+#define AM_REG_UART_CR_RTS_M                         0x00000800
+#define AM_REG_UART_CR_RTS(n)                        (((uint32_t)(n) << 11) & 0x00000800)
+
+// This bit enables data transmit ready.
+#define AM_REG_UART_CR_DTR_S                         10
+#define AM_REG_UART_CR_DTR_M                         0x00000400
+#define AM_REG_UART_CR_DTR(n)                        (((uint32_t)(n) << 10) & 0x00000400)
+
+// This bit is the receive enable.
+#define AM_REG_UART_CR_RXE_S                         9
+#define AM_REG_UART_CR_RXE_M                         0x00000200
+#define AM_REG_UART_CR_RXE(n)                        (((uint32_t)(n) << 9) & 0x00000200)
+
+// This bit is the transmit enable.
+#define AM_REG_UART_CR_TXE_S                         8
+#define AM_REG_UART_CR_TXE_M                         0x00000100
+#define AM_REG_UART_CR_TXE(n)                        (((uint32_t)(n) << 8) & 0x00000100)
+
+// This bit is the loopback enable.
+#define AM_REG_UART_CR_LBE_S                         7
+#define AM_REG_UART_CR_LBE_M                         0x00000080
+#define AM_REG_UART_CR_LBE(n)                        (((uint32_t)(n) << 7) & 0x00000080)
+
+// This bitfield is the UART clock select.
+#define AM_REG_UART_CR_CLKSEL_S                      4
+#define AM_REG_UART_CR_CLKSEL_M                      0x00000070
+#define AM_REG_UART_CR_CLKSEL(n)                     (((uint32_t)(n) << 4) & 0x00000070)
+#define AM_REG_UART_CR_CLKSEL_NOCLK                  0x00000000
+#define AM_REG_UART_CR_CLKSEL_24MHZ                  0x00000010
+#define AM_REG_UART_CR_CLKSEL_12MHZ                  0x00000020
+#define AM_REG_UART_CR_CLKSEL_6MHZ                   0x00000030
+#define AM_REG_UART_CR_CLKSEL_3MHZ                   0x00000040
+#define AM_REG_UART_CR_CLKSEL_RSVD5                  0x00000050
+#define AM_REG_UART_CR_CLKSEL_RSVD6                  0x00000060
+#define AM_REG_UART_CR_CLKSEL_RSVD7                  0x00000070
+
+// This bit is the UART clock enable.
+#define AM_REG_UART_CR_CLKEN_S                       3
+#define AM_REG_UART_CR_CLKEN_M                       0x00000008
+#define AM_REG_UART_CR_CLKEN(n)                      (((uint32_t)(n) << 3) & 0x00000008)
+
+// This bit is the SIR low power select.
+#define AM_REG_UART_CR_SIRLP_S                       2
+#define AM_REG_UART_CR_SIRLP_M                       0x00000004
+#define AM_REG_UART_CR_SIRLP(n)                      (((uint32_t)(n) << 2) & 0x00000004)
+
+// This bit is the SIR ENDEC enable.
+#define AM_REG_UART_CR_SIREN_S                       1
+#define AM_REG_UART_CR_SIREN_M                       0x00000002
+#define AM_REG_UART_CR_SIREN(n)                      (((uint32_t)(n) << 1) & 0x00000002)
+
+// This bit is the UART enable.
+#define AM_REG_UART_CR_UARTEN_S                      0
+#define AM_REG_UART_CR_UARTEN_M                      0x00000001
+#define AM_REG_UART_CR_UARTEN(n)                     (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// UART_IFLS - FIFO Interrupt Level Select
+//
+//*****************************************************************************
+// These bits hold the receive FIFO interrupt level.
+#define AM_REG_UART_IFLS_RXIFLSEL_S                  3
+#define AM_REG_UART_IFLS_RXIFLSEL_M                  0x00000038
+#define AM_REG_UART_IFLS_RXIFLSEL(n)                 (((uint32_t)(n) << 3) & 0x00000038)
+
+// These bits hold the transmit FIFO interrupt level.
+#define AM_REG_UART_IFLS_TXIFLSEL_S                  0
+#define AM_REG_UART_IFLS_TXIFLSEL_M                  0x00000007
+#define AM_REG_UART_IFLS_TXIFLSEL(n)                 (((uint32_t)(n) << 0) & 0x00000007)
+
+//*****************************************************************************
+//
+// UART_IER - Interrupt Enable
+//
+//*****************************************************************************
+// This bit holds the overflow interrupt enable.
+#define AM_REG_UART_IER_OEIM_S                       10
+#define AM_REG_UART_IER_OEIM_M                       0x00000400
+#define AM_REG_UART_IER_OEIM(n)                      (((uint32_t)(n) << 10) & 0x00000400)
+
+// This bit holds the break error interrupt enable.
+#define AM_REG_UART_IER_BEIM_S                       9
+#define AM_REG_UART_IER_BEIM_M                       0x00000200
+#define AM_REG_UART_IER_BEIM(n)                      (((uint32_t)(n) << 9) & 0x00000200)
+
+// This bit holds the parity error interrupt enable.
+#define AM_REG_UART_IER_PEIM_S                       8
+#define AM_REG_UART_IER_PEIM_M                       0x00000100
+#define AM_REG_UART_IER_PEIM(n)                      (((uint32_t)(n) << 8) & 0x00000100)
+
+// This bit holds the framing error interrupt enable.
+#define AM_REG_UART_IER_FEIM_S                       7
+#define AM_REG_UART_IER_FEIM_M                       0x00000080
+#define AM_REG_UART_IER_FEIM(n)                      (((uint32_t)(n) << 7) & 0x00000080)
+
+// This bit holds the receive timeout interrupt enable.
+#define AM_REG_UART_IER_RTIM_S                       6
+#define AM_REG_UART_IER_RTIM_M                       0x00000040
+#define AM_REG_UART_IER_RTIM(n)                      (((uint32_t)(n) << 6) & 0x00000040)
+
+// This bit holds the transmit interrupt enable.
+#define AM_REG_UART_IER_TXIM_S                       5
+#define AM_REG_UART_IER_TXIM_M                       0x00000020
+#define AM_REG_UART_IER_TXIM(n)                      (((uint32_t)(n) << 5) & 0x00000020)
+
+// This bit holds the receive interrupt enable.
+#define AM_REG_UART_IER_RXIM_S                       4
+#define AM_REG_UART_IER_RXIM_M                       0x00000010
+#define AM_REG_UART_IER_RXIM(n)                      (((uint32_t)(n) << 4) & 0x00000010)
+
+// This bit holds the modem DSR interrupt enable.
+#define AM_REG_UART_IER_DSRMIM_S                     3
+#define AM_REG_UART_IER_DSRMIM_M                     0x00000008
+#define AM_REG_UART_IER_DSRMIM(n)                    (((uint32_t)(n) << 3) & 0x00000008)
+
+// This bit holds the modem DCD interrupt enable.
+#define AM_REG_UART_IER_DCDMIM_S                     2
+#define AM_REG_UART_IER_DCDMIM_M                     0x00000004
+#define AM_REG_UART_IER_DCDMIM(n)                    (((uint32_t)(n) << 2) & 0x00000004)
+
+// This bit holds the modem CTS interrupt enable.
+#define AM_REG_UART_IER_CTSMIM_S                     1
+#define AM_REG_UART_IER_CTSMIM_M                     0x00000002
+#define AM_REG_UART_IER_CTSMIM(n)                    (((uint32_t)(n) << 1) & 0x00000002)
+
+// This bit holds the modem TXCMP interrupt enable.
+#define AM_REG_UART_IER_TXCMPMIM_S                   0
+#define AM_REG_UART_IER_TXCMPMIM_M                   0x00000001
+#define AM_REG_UART_IER_TXCMPMIM(n)                  (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// UART_IES - Interrupt Status
+//
+//*****************************************************************************
+// This bit holds the overflow interrupt status.
+#define AM_REG_UART_IES_OERIS_S                      10
+#define AM_REG_UART_IES_OERIS_M                      0x00000400
+#define AM_REG_UART_IES_OERIS(n)                     (((uint32_t)(n) << 10) & 0x00000400)
+
+// This bit holds the break error interrupt status.
+#define AM_REG_UART_IES_BERIS_S                      9
+#define AM_REG_UART_IES_BERIS_M                      0x00000200
+#define AM_REG_UART_IES_BERIS(n)                     (((uint32_t)(n) << 9) & 0x00000200)
+
+// This bit holds the parity error interrupt status.
+#define AM_REG_UART_IES_PERIS_S                      8
+#define AM_REG_UART_IES_PERIS_M                      0x00000100
+#define AM_REG_UART_IES_PERIS(n)                     (((uint32_t)(n) << 8) & 0x00000100)
+
+// This bit holds the framing error interrupt status.
+#define AM_REG_UART_IES_FERIS_S                      7
+#define AM_REG_UART_IES_FERIS_M                      0x00000080
+#define AM_REG_UART_IES_FERIS(n)                     (((uint32_t)(n) << 7) & 0x00000080)
+
+// This bit holds the receive timeout interrupt status.
+#define AM_REG_UART_IES_RTRIS_S                      6
+#define AM_REG_UART_IES_RTRIS_M                      0x00000040
+#define AM_REG_UART_IES_RTRIS(n)                     (((uint32_t)(n) << 6) & 0x00000040)
+
+// This bit holds the transmit interrupt status.
+#define AM_REG_UART_IES_TXRIS_S                      5
+#define AM_REG_UART_IES_TXRIS_M                      0x00000020
+#define AM_REG_UART_IES_TXRIS(n)                     (((uint32_t)(n) << 5) & 0x00000020)
+
+// This bit holds the receive interrupt status.
+#define AM_REG_UART_IES_RXRIS_S                      4
+#define AM_REG_UART_IES_RXRIS_M                      0x00000010
+#define AM_REG_UART_IES_RXRIS(n)                     (((uint32_t)(n) << 4) & 0x00000010)
+
+// This bit holds the modem DSR interrupt status.
+#define AM_REG_UART_IES_DSRMRIS_S                    3
+#define AM_REG_UART_IES_DSRMRIS_M                    0x00000008
+#define AM_REG_UART_IES_DSRMRIS(n)                   (((uint32_t)(n) << 3) & 0x00000008)
+
+// This bit holds the modem DCD interrupt status.
+#define AM_REG_UART_IES_DCDMRIS_S                    2
+#define AM_REG_UART_IES_DCDMRIS_M                    0x00000004
+#define AM_REG_UART_IES_DCDMRIS(n)                   (((uint32_t)(n) << 2) & 0x00000004)
+
+// This bit holds the modem CTS interrupt status.
+#define AM_REG_UART_IES_CTSMRIS_S                    1
+#define AM_REG_UART_IES_CTSMRIS_M                    0x00000002
+#define AM_REG_UART_IES_CTSMRIS(n)                   (((uint32_t)(n) << 1) & 0x00000002)
+
+// This bit holds the modem TXCMP interrupt status.
+#define AM_REG_UART_IES_TXCMPMRIS_S                  0
+#define AM_REG_UART_IES_TXCMPMRIS_M                  0x00000001
+#define AM_REG_UART_IES_TXCMPMRIS(n)                 (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// UART_MIS - Masked Interrupt Status
+//
+//*****************************************************************************
+// This bit holds the overflow interrupt status masked.
+#define AM_REG_UART_MIS_OEMIS_S                      10
+#define AM_REG_UART_MIS_OEMIS_M                      0x00000400
+#define AM_REG_UART_MIS_OEMIS(n)                     (((uint32_t)(n) << 10) & 0x00000400)
+
+// This bit holds the break error interrupt status masked.
+#define AM_REG_UART_MIS_BEMIS_S                      9
+#define AM_REG_UART_MIS_BEMIS_M                      0x00000200
+#define AM_REG_UART_MIS_BEMIS(n)                     (((uint32_t)(n) << 9) & 0x00000200)
+
+// This bit holds the parity error interrupt status masked.
+#define AM_REG_UART_MIS_PEMIS_S                      8
+#define AM_REG_UART_MIS_PEMIS_M                      0x00000100
+#define AM_REG_UART_MIS_PEMIS(n)                     (((uint32_t)(n) << 8) & 0x00000100)
+
+// This bit holds the framing error interrupt status masked.
+#define AM_REG_UART_MIS_FEMIS_S                      7
+#define AM_REG_UART_MIS_FEMIS_M                      0x00000080
+#define AM_REG_UART_MIS_FEMIS(n)                     (((uint32_t)(n) << 7) & 0x00000080)
+
+// This bit holds the receive timeout interrupt status masked.
+#define AM_REG_UART_MIS_RTMIS_S                      6
+#define AM_REG_UART_MIS_RTMIS_M                      0x00000040
+#define AM_REG_UART_MIS_RTMIS(n)                     (((uint32_t)(n) << 6) & 0x00000040)
+
+// This bit holds the transmit interrupt status masked.
+#define AM_REG_UART_MIS_TXMIS_S                      5
+#define AM_REG_UART_MIS_TXMIS_M                      0x00000020
+#define AM_REG_UART_MIS_TXMIS(n)                     (((uint32_t)(n) << 5) & 0x00000020)
+
+// This bit holds the receive interrupt status masked.
+#define AM_REG_UART_MIS_RXMIS_S                      4
+#define AM_REG_UART_MIS_RXMIS_M                      0x00000010
+#define AM_REG_UART_MIS_RXMIS(n)                     (((uint32_t)(n) << 4) & 0x00000010)
+
+// This bit holds the modem DSR interrupt status masked.
+#define AM_REG_UART_MIS_DSRMMIS_S                    3
+#define AM_REG_UART_MIS_DSRMMIS_M                    0x00000008
+#define AM_REG_UART_MIS_DSRMMIS(n)                   (((uint32_t)(n) << 3) & 0x00000008)
+
+// This bit holds the modem DCD interrupt status masked.
+#define AM_REG_UART_MIS_DCDMMIS_S                    2
+#define AM_REG_UART_MIS_DCDMMIS_M                    0x00000004
+#define AM_REG_UART_MIS_DCDMMIS(n)                   (((uint32_t)(n) << 2) & 0x00000004)
+
+// This bit holds the modem CTS interrupt status masked.
+#define AM_REG_UART_MIS_CTSMMIS_S                    1
+#define AM_REG_UART_MIS_CTSMMIS_M                    0x00000002
+#define AM_REG_UART_MIS_CTSMMIS(n)                   (((uint32_t)(n) << 1) & 0x00000002)
+
+// This bit holds the modem TXCMP interrupt status masked.
+#define AM_REG_UART_MIS_TXCMPMMIS_S                  0
+#define AM_REG_UART_MIS_TXCMPMMIS_M                  0x00000001
+#define AM_REG_UART_MIS_TXCMPMMIS(n)                 (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// UART_IEC - Interrupt Clear
+//
+//*****************************************************************************
+// This bit holds the overflow interrupt clear.
+#define AM_REG_UART_IEC_OEIC_S                       10
+#define AM_REG_UART_IEC_OEIC_M                       0x00000400
+#define AM_REG_UART_IEC_OEIC(n)                      (((uint32_t)(n) << 10) & 0x00000400)
+
+// This bit holds the break error interrupt clear.
+#define AM_REG_UART_IEC_BEIC_S                       9
+#define AM_REG_UART_IEC_BEIC_M                       0x00000200
+#define AM_REG_UART_IEC_BEIC(n)                      (((uint32_t)(n) << 9) & 0x00000200)
+
+// This bit holds the parity error interrupt clear.
+#define AM_REG_UART_IEC_PEIC_S                       8
+#define AM_REG_UART_IEC_PEIC_M                       0x00000100
+#define AM_REG_UART_IEC_PEIC(n)                      (((uint32_t)(n) << 8) & 0x00000100)
+
+// This bit holds the framing error interrupt clear.
+#define AM_REG_UART_IEC_FEIC_S                       7
+#define AM_REG_UART_IEC_FEIC_M                       0x00000080
+#define AM_REG_UART_IEC_FEIC(n)                      (((uint32_t)(n) << 7) & 0x00000080)
+
+// This bit holds the receive timeout interrupt clear.
+#define AM_REG_UART_IEC_RTIC_S                       6
+#define AM_REG_UART_IEC_RTIC_M                       0x00000040
+#define AM_REG_UART_IEC_RTIC(n)                      (((uint32_t)(n) << 6) & 0x00000040)
+
+// This bit holds the transmit interrupt clear.
+#define AM_REG_UART_IEC_TXIC_S                       5
+#define AM_REG_UART_IEC_TXIC_M                       0x00000020
+#define AM_REG_UART_IEC_TXIC(n)                      (((uint32_t)(n) << 5) & 0x00000020)
+
+// This bit holds the receive interrupt clear.
+#define AM_REG_UART_IEC_RXIC_S                       4
+#define AM_REG_UART_IEC_RXIC_M                       0x00000010
+#define AM_REG_UART_IEC_RXIC(n)                      (((uint32_t)(n) << 4) & 0x00000010)
+
+// This bit holds the modem DSR interrupt clear.
+#define AM_REG_UART_IEC_DSRMIC_S                     3
+#define AM_REG_UART_IEC_DSRMIC_M                     0x00000008
+#define AM_REG_UART_IEC_DSRMIC(n)                    (((uint32_t)(n) << 3) & 0x00000008)
+
+// This bit holds the modem DCD interrupt clear.
+#define AM_REG_UART_IEC_DCDMIC_S                     2
+#define AM_REG_UART_IEC_DCDMIC_M                     0x00000004
+#define AM_REG_UART_IEC_DCDMIC(n)                    (((uint32_t)(n) << 2) & 0x00000004)
+
+// This bit holds the modem CTS interrupt clear.
+#define AM_REG_UART_IEC_CTSMIC_S                     1
+#define AM_REG_UART_IEC_CTSMIC_M                     0x00000002
+#define AM_REG_UART_IEC_CTSMIC(n)                    (((uint32_t)(n) << 1) & 0x00000002)
+
+// This bit holds the modem TXCMP interrupt clear.
+#define AM_REG_UART_IEC_TXCMPMIC_S                   0
+#define AM_REG_UART_IEC_TXCMPMIC_M                   0x00000001
+#define AM_REG_UART_IEC_TXCMPMIC(n)                  (((uint32_t)(n) << 0) & 0x00000001)
+
+#endif // AM_REG_UART_H
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_vcomp.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_vcomp.h
new file mode 100644
index 000000000..e99970d0e
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_vcomp.h
@@ -0,0 +1,199 @@
+//*****************************************************************************
+//
+//! @file am_reg_vcomp.h
+//!
+//! @brief Register macros for the VCOMP module
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_REG_VCOMP_H
+#define AM_REG_VCOMP_H
+
+//*****************************************************************************
+//
+// Instance finder. (1 instance(s) available)
+//
+//*****************************************************************************
+#define AM_REG_VCOMP_NUM_MODULES                     1
+#define AM_REG_VCOMPn(n) \
+    (REG_VCOMP_BASEADDR + 0x00000000 * n)
+
+//*****************************************************************************
+//
+// Register offsets.
+//
+//*****************************************************************************
+#define AM_REG_VCOMP_CFG_O                           0x00000000
+#define AM_REG_VCOMP_STAT_O                          0x00000004
+#define AM_REG_VCOMP_PWDKEY_O                        0x00000008
+#define AM_REG_VCOMP_INTEN_O                         0x00000200
+#define AM_REG_VCOMP_INTSTAT_O                       0x00000204
+#define AM_REG_VCOMP_INTCLR_O                        0x00000208
+#define AM_REG_VCOMP_INTSET_O                        0x0000020C
+
+//*****************************************************************************
+//
+// Key values.
+//
+//*****************************************************************************
+#define AM_REG_VCOMP_PWDKEY_KEYVAL                   0x00000037
+
+//*****************************************************************************
+//
+// VCOMP_INTEN - Voltage Comparator Interrupt registers: Enable
+//
+//*****************************************************************************
+// This bit is the vcompout high interrupt.
+#define AM_REG_VCOMP_INTEN_OUTHI_S                   1
+#define AM_REG_VCOMP_INTEN_OUTHI_M                   0x00000002
+#define AM_REG_VCOMP_INTEN_OUTHI(n)                  (((uint32_t)(n) << 1) & 0x00000002)
+
+// This bit is the vcompout low interrupt.
+#define AM_REG_VCOMP_INTEN_OUTLOW_S                  0
+#define AM_REG_VCOMP_INTEN_OUTLOW_M                  0x00000001
+#define AM_REG_VCOMP_INTEN_OUTLOW(n)                 (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// VCOMP_INTSTAT - Voltage Comparator Interrupt registers: Status
+//
+//*****************************************************************************
+// This bit is the vcompout high interrupt.
+#define AM_REG_VCOMP_INTSTAT_OUTHI_S                 1
+#define AM_REG_VCOMP_INTSTAT_OUTHI_M                 0x00000002
+#define AM_REG_VCOMP_INTSTAT_OUTHI(n)                (((uint32_t)(n) << 1) & 0x00000002)
+
+// This bit is the vcompout low interrupt.
+#define AM_REG_VCOMP_INTSTAT_OUTLOW_S                0
+#define AM_REG_VCOMP_INTSTAT_OUTLOW_M                0x00000001
+#define AM_REG_VCOMP_INTSTAT_OUTLOW(n)               (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// VCOMP_INTCLR - Voltage Comparator Interrupt registers: Clear
+//
+//*****************************************************************************
+// This bit is the vcompout high interrupt.
+#define AM_REG_VCOMP_INTCLR_OUTHI_S                  1
+#define AM_REG_VCOMP_INTCLR_OUTHI_M                  0x00000002
+#define AM_REG_VCOMP_INTCLR_OUTHI(n)                 (((uint32_t)(n) << 1) & 0x00000002)
+
+// This bit is the vcompout low interrupt.
+#define AM_REG_VCOMP_INTCLR_OUTLOW_S                 0
+#define AM_REG_VCOMP_INTCLR_OUTLOW_M                 0x00000001
+#define AM_REG_VCOMP_INTCLR_OUTLOW(n)                (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// VCOMP_INTSET - Voltage Comparator Interrupt registers: Set
+//
+//*****************************************************************************
+// This bit is the vcompout high interrupt.
+#define AM_REG_VCOMP_INTSET_OUTHI_S                  1
+#define AM_REG_VCOMP_INTSET_OUTHI_M                  0x00000002
+#define AM_REG_VCOMP_INTSET_OUTHI(n)                 (((uint32_t)(n) << 1) & 0x00000002)
+
+// This bit is the vcompout low interrupt.
+#define AM_REG_VCOMP_INTSET_OUTLOW_S                 0
+#define AM_REG_VCOMP_INTSET_OUTLOW_M                 0x00000001
+#define AM_REG_VCOMP_INTSET_OUTLOW(n)                (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// VCOMP_CFG - Configuration Register
+//
+//*****************************************************************************
+// When the reference input NSEL is set to NSEL_DAC, this bitfield selects the
+// voltage level for the negative input to the comparator.
+#define AM_REG_VCOMP_CFG_LVLSEL_S                    16
+#define AM_REG_VCOMP_CFG_LVLSEL_M                    0x000F0000
+#define AM_REG_VCOMP_CFG_LVLSEL(n)                   (((uint32_t)(n) << 16) & 0x000F0000)
+#define AM_REG_VCOMP_CFG_LVLSEL_0P58V                0x00000000
+#define AM_REG_VCOMP_CFG_LVLSEL_0P77V                0x00010000
+#define AM_REG_VCOMP_CFG_LVLSEL_0P97V                0x00020000
+#define AM_REG_VCOMP_CFG_LVLSEL_1P16V                0x00030000
+#define AM_REG_VCOMP_CFG_LVLSEL_1P35V                0x00040000
+#define AM_REG_VCOMP_CFG_LVLSEL_1P55V                0x00050000
+#define AM_REG_VCOMP_CFG_LVLSEL_1P74V                0x00060000
+#define AM_REG_VCOMP_CFG_LVLSEL_1P93V                0x00070000
+#define AM_REG_VCOMP_CFG_LVLSEL_2P13V                0x00080000
+#define AM_REG_VCOMP_CFG_LVLSEL_2P32V                0x00090000
+#define AM_REG_VCOMP_CFG_LVLSEL_2P51V                0x000A0000
+#define AM_REG_VCOMP_CFG_LVLSEL_2P71V                0x000B0000
+#define AM_REG_VCOMP_CFG_LVLSEL_2P90V                0x000C0000
+#define AM_REG_VCOMP_CFG_LVLSEL_3P09V                0x000D0000
+#define AM_REG_VCOMP_CFG_LVLSEL_3P29V                0x000E0000
+#define AM_REG_VCOMP_CFG_LVLSEL_3P48V                0x000F0000
+
+// This bitfield selects the negative input to the comparator.
+#define AM_REG_VCOMP_CFG_NSEL_S                      8
+#define AM_REG_VCOMP_CFG_NSEL_M                      0x00000300
+#define AM_REG_VCOMP_CFG_NSEL(n)                     (((uint32_t)(n) << 8) & 0x00000300)
+#define AM_REG_VCOMP_CFG_NSEL_VREFEXT1               0x00000000
+#define AM_REG_VCOMP_CFG_NSEL_VREFEXT2               0x00000100
+#define AM_REG_VCOMP_CFG_NSEL_VREFEXT3               0x00000200
+#define AM_REG_VCOMP_CFG_NSEL_DAC                    0x00000300
+
+// This bitfield selects the positive input to the comparator.
+#define AM_REG_VCOMP_CFG_PSEL_S                      0
+#define AM_REG_VCOMP_CFG_PSEL_M                      0x00000003
+#define AM_REG_VCOMP_CFG_PSEL(n)                     (((uint32_t)(n) << 0) & 0x00000003)
+#define AM_REG_VCOMP_CFG_PSEL_VDDADJ                 0x00000000
+#define AM_REG_VCOMP_CFG_PSEL_VTEMP                  0x00000001
+#define AM_REG_VCOMP_CFG_PSEL_VEXT1                  0x00000002
+#define AM_REG_VCOMP_CFG_PSEL_VEXT2                  0x00000003
+
+//*****************************************************************************
+//
+// VCOMP_STAT - Status Register
+//
+//*****************************************************************************
+// This bit indicates the power down state of the voltage comparator.
+#define AM_REG_VCOMP_STAT_PWDSTAT_S                  1
+#define AM_REG_VCOMP_STAT_PWDSTAT_M                  0x00000002
+#define AM_REG_VCOMP_STAT_PWDSTAT(n)                 (((uint32_t)(n) << 1) & 0x00000002)
+#define AM_REG_VCOMP_STAT_PWDSTAT_POWERED_DOWN       0x00000002
+
+// This bit is 1 if the positive input of the comparator is greater than the
+// negative input.
+#define AM_REG_VCOMP_STAT_CMPOUT_S                   0
+#define AM_REG_VCOMP_STAT_CMPOUT_M                   0x00000001
+#define AM_REG_VCOMP_STAT_CMPOUT(n)                  (((uint32_t)(n) << 0) & 0x00000001)
+#define AM_REG_VCOMP_STAT_CMPOUT_VOUT_LOW            0x00000000
+#define AM_REG_VCOMP_STAT_CMPOUT_VOUT_HIGH           0x00000001
+
+#endif // AM_REG_VCOMP_H
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_wdt.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_wdt.h
new file mode 100644
index 000000000..742a8e635
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/mcu/apollo2/regs/am_reg_wdt.h
@@ -0,0 +1,188 @@
+//*****************************************************************************
+//
+//! @file am_reg_wdt.h
+//!
+//! @brief Register macros for the WDT module
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_REG_WDT_H
+#define AM_REG_WDT_H
+
+//*****************************************************************************
+//
+// Instance finder. (1 instance(s) available)
+//
+//*****************************************************************************
+#define AM_REG_WDT_NUM_MODULES                       1
+#define AM_REG_WDTn(n) \
+    (REG_WDT_BASEADDR + 0x00000000 * n)
+
+//*****************************************************************************
+//
+// Register offsets.
+//
+//*****************************************************************************
+#define AM_REG_WDT_CFG_O                             0x00000000
+#define AM_REG_WDT_RSTRT_O                           0x00000004
+#define AM_REG_WDT_LOCK_O                            0x00000008
+#define AM_REG_WDT_COUNT_O                           0x0000000C
+#define AM_REG_WDT_INTEN_O                           0x00000200
+#define AM_REG_WDT_INTSTAT_O                         0x00000204
+#define AM_REG_WDT_INTCLR_O                          0x00000208
+#define AM_REG_WDT_INTSET_O                          0x0000020C
+
+//*****************************************************************************
+//
+// WDT_INTEN - WDT Interrupt register: Enable
+//
+//*****************************************************************************
+// Watchdog Timer Interrupt.
+#define AM_REG_WDT_INTEN_WDT_S                       0
+#define AM_REG_WDT_INTEN_WDT_M                       0x00000001
+#define AM_REG_WDT_INTEN_WDT(n)                      (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// WDT_INTSTAT - WDT Interrupt register: Status
+//
+//*****************************************************************************
+// Watchdog Timer Interrupt.
+#define AM_REG_WDT_INTSTAT_WDT_S                     0
+#define AM_REG_WDT_INTSTAT_WDT_M                     0x00000001
+#define AM_REG_WDT_INTSTAT_WDT(n)                    (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// WDT_INTCLR - WDT Interrupt register: Clear
+//
+//*****************************************************************************
+// Watchdog Timer Interrupt.
+#define AM_REG_WDT_INTCLR_WDT_S                      0
+#define AM_REG_WDT_INTCLR_WDT_M                      0x00000001
+#define AM_REG_WDT_INTCLR_WDT(n)                     (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// WDT_INTSET - WDT Interrupt register: Set
+//
+//*****************************************************************************
+// Watchdog Timer Interrupt.
+#define AM_REG_WDT_INTSET_WDT_S                      0
+#define AM_REG_WDT_INTSET_WDT_M                      0x00000001
+#define AM_REG_WDT_INTSET_WDT(n)                     (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// WDT_CFG - Configuration Register
+//
+//*****************************************************************************
+// Select the frequency for the WDT.  All values not enumerated below are
+// undefined.
+#define AM_REG_WDT_CFG_CLKSEL_S                      24
+#define AM_REG_WDT_CFG_CLKSEL_M                      0x07000000
+#define AM_REG_WDT_CFG_CLKSEL(n)                     (((uint32_t)(n) << 24) & 0x07000000)
+#define AM_REG_WDT_CFG_CLKSEL_OFF                    0x00000000
+#define AM_REG_WDT_CFG_CLKSEL_128HZ                  0x01000000
+#define AM_REG_WDT_CFG_CLKSEL_16HZ                   0x02000000
+#define AM_REG_WDT_CFG_CLKSEL_1HZ                    0x03000000
+#define AM_REG_WDT_CFG_CLKSEL_1_16HZ                 0x04000000
+
+// This bitfield is the compare value for counter bits 7:0 to generate a
+// watchdog interrupt.
+#define AM_REG_WDT_CFG_INTVAL_S                      16
+#define AM_REG_WDT_CFG_INTVAL_M                      0x00FF0000
+#define AM_REG_WDT_CFG_INTVAL(n)                     (((uint32_t)(n) << 16) & 0x00FF0000)
+
+// This bitfield is the compare value for counter bits 7:0 to generate a
+// watchdog reset.
+#define AM_REG_WDT_CFG_RESVAL_S                      8
+#define AM_REG_WDT_CFG_RESVAL_M                      0x0000FF00
+#define AM_REG_WDT_CFG_RESVAL(n)                     (((uint32_t)(n) << 8) & 0x0000FF00)
+
+// This bitfield enables the WDT reset.
+#define AM_REG_WDT_CFG_RESEN_S                       2
+#define AM_REG_WDT_CFG_RESEN_M                       0x00000004
+#define AM_REG_WDT_CFG_RESEN(n)                      (((uint32_t)(n) << 2) & 0x00000004)
+
+// This bitfield enables the WDT interrupt. Note : This bit must be set before
+// the interrupt status bit will reflect a watchdog timer expiration.  The IER
+// interrupt register must also be enabled for a WDT interrupt to be sent to the
+// NVIC.
+#define AM_REG_WDT_CFG_INTEN_S                       1
+#define AM_REG_WDT_CFG_INTEN_M                       0x00000002
+#define AM_REG_WDT_CFG_INTEN(n)                      (((uint32_t)(n) << 1) & 0x00000002)
+
+// This bitfield enables the WDT.
+#define AM_REG_WDT_CFG_WDTEN_S                       0
+#define AM_REG_WDT_CFG_WDTEN_M                       0x00000001
+#define AM_REG_WDT_CFG_WDTEN(n)                      (((uint32_t)(n) << 0) & 0x00000001)
+
+//*****************************************************************************
+//
+// WDT_RSTRT - Restart the watchdog timer
+//
+//*****************************************************************************
+// Writing 0xB2 to WDTRSTRT restarts the watchdog timer.
+#define AM_REG_WDT_RSTRT_RSTRT_S                     0
+#define AM_REG_WDT_RSTRT_RSTRT_M                     0x000000FF
+#define AM_REG_WDT_RSTRT_RSTRT(n)                    (((uint32_t)(n) << 0) & 0x000000FF)
+#define AM_REG_WDT_RSTRT_RSTRT_KEYVALUE              0x000000B2
+
+//*****************************************************************************
+//
+// WDT_LOCK - Locks the WDT
+//
+//*****************************************************************************
+// Writing 0x3A locks the watchdog timer. Once locked, the WDTCFG reg cannot be
+// written and WDTEN is set.
+#define AM_REG_WDT_LOCK_LOCK_S                       0
+#define AM_REG_WDT_LOCK_LOCK_M                       0x000000FF
+#define AM_REG_WDT_LOCK_LOCK(n)                      (((uint32_t)(n) << 0) & 0x000000FF)
+#define AM_REG_WDT_LOCK_LOCK_KEYVALUE                0x0000003A
+
+//*****************************************************************************
+//
+// WDT_COUNT - Current Counter Value for WDT
+//
+//*****************************************************************************
+// Read-Only current value of the WDT counter
+#define AM_REG_WDT_COUNT_COUNT_S                     0
+#define AM_REG_WDT_COUNT_COUNT_M                     0x000000FF
+#define AM_REG_WDT_COUNT_COUNT(n)                    (((uint32_t)(n) << 0) & 0x000000FF)
+
+#endif // AM_REG_WDT_H
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util.h
new file mode 100644
index 000000000..63c0c5be0
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util.h
@@ -0,0 +1,75 @@
+//*****************************************************************************
+//
+//! @file am_util.h
+//!
+//! @brief Top Include for all of the utilities
+//!
+//! This file provides all the includes necessary to use the utilities.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_UTIL_H
+#define AM_UTIL_H
+
+//*****************************************************************************
+//
+// C99
+//
+//*****************************************************************************
+#include <stdint.h>
+#include <stdbool.h>
+
+//*****************************************************************************
+//
+// Utilities
+//
+//*****************************************************************************
+#include "am_util_cmdline.h"
+#include "am_util_delay.h"
+#include "am_util_debug.h"
+#include "am_util_id.h"
+#include "am_util_math.h"
+#include "am_util_plot.h"
+#include "am_util_ring_buffer.h"
+#include "am_util_stdio.h"
+#include "am_util_stopwatch.h"
+#include "am_util_string.h"
+#include "am_util_tap_detect.h"
+#include "am_util_time.h"
+#include "am_util_stxetx.h"
+
+#endif  // AM_UTIL_H
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_cmdline.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_cmdline.c
new file mode 100644
index 000000000..66f05a6d9
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_cmdline.c
@@ -0,0 +1,457 @@
+//*****************************************************************************
+//
+//! @file am_util_cmdline.c
+//!
+//! @brief Functions to implement a simple command line interface.
+//!
+//! Functions supporting a command-line interface.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "am_util_cmdline.h"
+#include "am_util_string.h"
+
+//*****************************************************************************
+//
+// Macro definitions
+//
+//*****************************************************************************
+//
+// Note - the UART Instance should actually be specified by the BSP.
+//
+#define CMDLINE_UART_INST                   0
+
+#define MAX_CMDLINE_ARGS                    10
+
+//*****************************************************************************
+//
+// Interface parameter structure
+//
+//*****************************************************************************
+am_util_cmdline_interface_t *g_psInterface;
+
+//*****************************************************************************
+//
+// Character parsing state information.
+//
+//*****************************************************************************
+uint32_t g_ui32BufferIndex = 0;
+bool g_bQuoted = 0;
+bool g_bEscaped = 0;
+bool g_bPromptNeeded = 0;
+
+//*****************************************************************************
+//
+// Command execution data.
+//
+//*****************************************************************************
+char *g_ppcArgs[MAX_CMDLINE_ARGS];
+uint32_t g_ui32Argc = 0;
+
+//*****************************************************************************
+//
+//! @brief Initialize the command line.
+//!
+//! @param psInterface is a pointer to an interface structure defining key
+//! characteristics about the command line interface.
+//!
+//! This function may be used to initialize a command prompt for user
+//! interaction. Please see the documentation on am_util_cmdline_interface_t
+//! for more details on command line configuration.
+//!
+//! @note This function must be the first cmdline function to be called in the
+//! final application.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_util_cmdline_init(am_util_cmdline_interface_t *psInterface)
+{
+    g_psInterface = psInterface;
+    g_bQuoted = false;
+    g_bEscaped = false;
+    g_bPromptNeeded = true;
+    g_ui32BufferIndex = 0;
+    g_ppcArgs[0] = psInterface->psCommandData;
+    g_ui32Argc = 0;
+}
+
+//*****************************************************************************
+//
+// Parses characters as they come in through the interface. If the return value
+// is true, there is a command to execute.
+//
+//*****************************************************************************
+bool
+parse_char(char cChar)
+{
+    //
+    // Check the state variables to figure out the correct interpretation of
+    // this character.
+    //
+    if ( cChar == 0x7F || cChar == 0x08 || cChar == '\f' )
+    {
+        //
+        // First, if the character was a backspace or delete, clear out
+        // everything and return.
+        //
+        g_bQuoted = false;
+        g_bEscaped = false;
+        g_ui32BufferIndex = 0;
+        g_psInterface->psCommandData[0] = 0;
+        g_ppcArgs[0] = g_psInterface->psCommandData;
+        g_ui32Argc = 0;
+    }
+    else if ( g_bEscaped )
+    {
+        //
+        // If we're currently in an 'escape' sequence, print whatever character
+        // comes next, no matter what.
+        //
+        g_psInterface->psCommandData[g_ui32BufferIndex] = cChar;
+        g_ui32BufferIndex++;
+        g_bEscaped = false;
+    }
+    else if ( g_bQuoted )
+    {
+        //
+        // If we're in a quoted context, look out for end quotes, and
+        // backslashes. Everything else is handled as-is.
+        //
+        if ( cChar == '"' )
+        {
+            g_bQuoted = false;
+        }
+        else if ( cChar == '\\' )
+        {
+            g_bEscaped = true;
+        }
+        else
+        {
+            g_psInterface->psCommandData[g_ui32BufferIndex] = cChar;
+            g_ui32BufferIndex++;
+        }
+    }
+    else
+    {
+        //
+        // If we're not in any special context, all characters retain their
+        // special meanings.
+        //
+        if ( cChar == '"' )
+        {
+            g_bQuoted = true;
+        }
+        else if ( cChar == '\\' )
+        {
+            g_bEscaped = true;
+        }
+        else if ( cChar == ' ' )
+        {
+            //
+            // Spaces delimit arguments, so we need to replace them with NULL
+            // terminators.
+            //
+            g_psInterface->psCommandData[g_ui32BufferIndex] = 0;
+            g_ui32BufferIndex++;
+
+            //
+            // Also adjust the argument lists as appropriate
+            //
+            g_ui32Argc++;
+            g_ppcArgs[g_ui32Argc] = g_psInterface->psCommandData + g_ui32BufferIndex;
+        }
+        else if ( cChar == '\n' || cChar == '\r' )
+        {
+            //
+            // New lines delimit entire commands, so we need to replace them
+            // with NULL terminators.
+            //
+            g_psInterface->psCommandData[g_ui32BufferIndex] = 0;
+            g_ui32BufferIndex++;
+
+            //
+            // Also adjust the argument lists as appropriate.
+            //
+            g_ui32Argc++;
+
+            return true;
+        }
+        else
+        {
+            //
+            // If none of the other cases caught this character, it should just
+            // be copied into the command buffer as is.
+            //
+            g_psInterface->psCommandData[g_ui32BufferIndex] = cChar;
+            g_ui32BufferIndex++;
+        }
+    }
+
+    //
+    // Make sure we're not about to overflow the command buffer. If we are,
+    // just end the function here, and report "true" in hopes that the command
+    // can be identified.
+    //
+    if ( g_ui32BufferIndex > g_psInterface->ui32CommandDataLen )
+    {
+        return true;
+    }
+
+    //
+    // Also make sure to check the maximum number of arguments to make sure
+    // this buffer doesn't overflow either.
+    //
+    if ( g_ui32Argc >= MAX_CMDLINE_ARGS )
+    {
+        return true;
+    }
+
+    //
+    // If we haven't returned by this point, this character can be assumed not
+    // to be the last character of a command.
+    //
+    return false;
+}
+
+//*****************************************************************************
+//
+// Simple function for printing the prompt string.
+//
+//*****************************************************************************
+void
+print_prompt(void)
+{
+    char *pcChar;
+
+    pcChar = g_psInterface->pcPromptString;
+
+    while ( *pcChar )
+    {
+        g_psInterface->pfnPutChar(CMDLINE_UART_INST, *pcChar);
+        pcChar++;
+    }
+}
+
+//*****************************************************************************
+//
+// Echoes characters back to the user interface as they are received. Certain
+// characters are handled differently.
+//
+//*****************************************************************************
+void
+echo_char(char cChar)
+{
+    //
+    // If there isn't an output function, just return.
+    //
+    if ( !g_psInterface->pfnPutChar )
+    {
+        return;
+    }
+
+    switch(cChar)
+    {
+        case '\r':
+        case '\n':
+            g_psInterface->pfnPutChar(CMDLINE_UART_INST, '\r');
+            g_psInterface->pfnPutChar(CMDLINE_UART_INST, '\n');
+        break;
+
+        case 0x7F:
+        case 0x08:
+            //
+            // Erase the line.
+            //
+            g_psInterface->pfnPutChar(CMDLINE_UART_INST, '\033');
+            g_psInterface->pfnPutChar(CMDLINE_UART_INST, '[');
+            g_psInterface->pfnPutChar(CMDLINE_UART_INST, '2');
+            g_psInterface->pfnPutChar(CMDLINE_UART_INST, 'K');
+            g_psInterface->pfnPutChar(CMDLINE_UART_INST, '\r');
+
+            //
+            // Print the prompt.
+            //
+            print_prompt();
+        break;
+
+        case '\033':
+            g_psInterface->pfnPutChar(CMDLINE_UART_INST, '\\');
+            g_psInterface->pfnPutChar(CMDLINE_UART_INST, 'e');
+        break;
+
+        case '\f':
+            g_psInterface->pfnPutChar(CMDLINE_UART_INST, '\f');
+
+            //
+            // Print the prompt.
+            //
+            print_prompt();
+        break;
+
+        default:
+            g_psInterface->pfnPutChar(CMDLINE_UART_INST, cChar);
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Execute a command by name.
+//!
+//! @param args is an array of strings that make up the arguments of the
+//! command.
+//!
+//! @param argc is the number of argument strings contained in args
+//!
+//! This function performs a lookup in the command table to find a function
+//! whose command string matches the value of args[0]. If it finds a match, it
+//! will run the function, passing along args and argc as its arguments. When
+//! the inner function returns, the return code will be passed back up to the
+//! caller.
+//!
+//! @return Returns the same value as the command function that was called, or
+//! a -1 if the command could not be found.
+//
+//*****************************************************************************
+uint32_t
+am_util_cmdline_run_command(char **args, uint32_t argc)
+{
+    am_util_cmdline_command_t *psCommands;
+    uint32_t ui32Index, ui32NumCommands, ui32CommandDataLen;
+    char *pcCommand;
+
+    //
+    // Grab a few important parameters from the global structure.
+    //
+    psCommands = g_psInterface->psCommandList;
+    ui32NumCommands = g_psInterface->ui32NumCommands;
+    ui32CommandDataLen = g_psInterface->ui32CommandDataLen;
+
+    //
+    // Loop over the commands in the global table.
+    //
+    for ( ui32Index = 0; ui32Index < ui32NumCommands; ui32Index++ )
+    {
+        //
+        // Check the command name against the first argument.
+        //
+        pcCommand = psCommands[ui32Index].pcCommand;
+
+        if ( !am_util_string_strncmp(pcCommand, args[0], ui32CommandDataLen) )
+        {
+            //
+            // If the command matches the argument, run the command and return.
+            //
+            return psCommands[ui32Index].pfnCommand(args, argc);
+        }
+    }
+
+    //
+    // Return a negative one to indicate that there was no command found.
+    //
+    return 0xffffffff;
+}
+
+//*****************************************************************************
+//
+//! @brief Look for and process any incoming commands.
+//!
+//! This function should be called periodically to check for commands on the
+//! user interface. Each call will read characters from the interface until it
+//! either completes an entire command, or the provided pfnGetChar() function
+//! returns an error. Echoing characters back to the user interface will be
+//! handled by this function unless the pfnPutChar() function was not provided.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_util_cmdline_process_commands(void)
+{
+  char cChar = {0};
+
+    //
+    // If we need to print a prompt, do it now.
+    //
+    if ( g_bPromptNeeded )
+    {
+        print_prompt();
+        g_bPromptNeeded = false;
+    }
+
+    //
+    // As long as there are characters to get, keep reading them.
+    //
+    while ( g_psInterface->pfnGetChar(&cChar) == 0 )
+    {
+        //
+        // Echo the character back to the interface.
+        //
+        echo_char(cChar);
+
+        //
+        // Run the parser to see if this char completed a command.
+        //
+        if ( parse_char(cChar) )
+        {
+            //
+            // If a command is ready to go, run it now. This function call will
+            // return the return code of the command function that it calls. This
+            // may be used in later implementations for error-checking and
+            // error-reporting.
+            //
+            am_util_cmdline_run_command(g_ppcArgs, g_ui32Argc);
+
+            //
+            // Reset the state variables to prepare for the next command.
+            //
+            g_bQuoted = false;
+            g_bEscaped = false;
+            g_bPromptNeeded = true;
+            g_ui32BufferIndex = 0;
+            g_psInterface->psCommandData[0] = 0;
+            g_ppcArgs[0] = g_psInterface->psCommandData;
+            g_ui32Argc = 0;
+
+            return;
+        }
+    }
+}
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_cmdline.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_cmdline.h
new file mode 100644
index 000000000..2ad1c6dd5
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_cmdline.h
@@ -0,0 +1,145 @@
+//*****************************************************************************
+//
+//! @file am_util_cmdline.h
+//!
+//! @brief Functions to implement a simple command line interface.
+//!
+//! Functions supporting a command-line interface.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_UTIL_CMDLINE_H
+#define AM_UTIL_CMDLINE_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+//*****************************************************************************
+//
+// Macro definitions
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Standard Command Function Pointer Type
+//
+//*****************************************************************************
+typedef uint32_t (*am_util_cmdline_func_t)(char **args, uint32_t argc);
+
+//*****************************************************************************
+//
+// Command Structure.
+//
+//*****************************************************************************
+typedef struct
+{
+    char *pcCommand;
+    am_util_cmdline_func_t pfnCommand;
+    char *pcHelpString;
+}
+am_util_cmdline_command_t;
+
+//*****************************************************************************
+//
+// Stucture defining how the cmdline utility may transmit or receive
+// characters.
+//
+//*****************************************************************************
+typedef struct
+{
+    //
+    // Function used to grab input characters.
+    //
+    uint32_t (*pfnGetChar)(char *pcChar);
+
+    //
+    // Function used to echo characters back to the output.
+    //
+    void (*pfnPutChar)(uint32_t ui32Module, char pcChar);
+
+    //
+    // List of supported commands, along with their associated function
+    // pointers and help strings.
+    //
+    am_util_cmdline_command_t *psCommandList;
+
+    //
+    // Number of supported commands. Usually just:
+    // sizeof(psCommandList) / sizeof(am_util_cmdline_command_t)
+    //
+    uint32_t ui32NumCommands;
+
+    //
+    // Buffer space to use for incoming commands.
+    //
+    char *psCommandData;
+
+    //
+    // Size of command buffer. Usually just: sizeof(psCommandData)
+    //
+    uint32_t ui32CommandDataLen;
+
+    //
+    // Prompt String
+    //
+    char *pcPromptString;
+}
+am_util_cmdline_interface_t;
+
+//*****************************************************************************
+//
+// External variable definitions
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// External function definitions
+//
+//*****************************************************************************
+extern void am_util_cmdline_process_commands(void);
+extern void am_util_cmdline_init(am_util_cmdline_interface_t *psInterface);
+extern uint32_t am_util_cmdline_run_command(char **args, uint32_t argc);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_UTIL_CMDLINE_H
+
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_debug.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_debug.c
new file mode 100644
index 000000000..95a51ad2a
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_debug.c
@@ -0,0 +1,48 @@
+//*****************************************************************************
+// 
+//! @file am_util_debug.c
+//!
+//! @brief Useful functions for debugging.
+//!
+//! These functions and macros were created to assist with debugging. They are
+//! intended to be as unintrusive as possible and designed to be removed from
+//! the compilation of a project when they are no longer needed.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#include "am_util_debug.h"
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_debug.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_debug.h
new file mode 100644
index 000000000..ec0af8bc6
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_debug.h
@@ -0,0 +1,111 @@
+//*****************************************************************************
+//
+//! @file am_util_debug.h
+//!
+//! @brief Useful functions for debugging.
+//!
+//! These functions and macros were created to assist with debugging. They are
+//! intended to be as unintrusive as possible and designed to be removed from
+//! the compilation of a project when they are no longer needed.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_UTIL_DEBUG_H
+#define AM_UTIL_DEBUG_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+//*****************************************************************************
+//
+// Debug printf macros.
+//
+//*****************************************************************************
+#ifdef AM_DEBUG_PRINTF
+
+#define am_util_debug_printf_init(x)                                          \
+    am_util_stdio_printf_init(x);
+
+#define am_util_debug_printf(...)                                             \
+    am_util_stdio_printf(__VA_ARGS__);
+
+#else
+
+#define am_util_debug_printf_init(...)
+#define am_util_debug_printf(...)
+
+#endif // AM_DEBUG_PRINTF
+
+//*****************************************************************************
+//
+// Debug trace macros.
+//
+//*****************************************************************************
+#ifdef AM_DEBUG_TRACE
+
+#define am_util_debug_trace_init(PinNumber)                                   \
+    do                                                                        \
+    {                                                                         \
+        am_hal_gpio_out_bit_clear(PinNumber);                                 \
+        am_hal_gpio_pin_config(PinNumber, AM_HAL_GPIO_OUTPUT);                \
+    }                                                                         \
+    while(0)
+
+
+#define am_util_debug_trace_start(PinNumber)                                  \
+    am_hal_gpio_out_bit_set(PinNumber)
+
+#define am_util_debug_trace_end(PinNumber)                                    \
+    am_hal_gpio_out_bit_clear(PinNumber)
+
+#else
+
+#define am_util_debug_trace_init(PinNumber)
+#define am_util_debug_trace_start(PinNumber)
+#define am_util_debug_trace_end(PinNumber)
+
+#endif // AM_DEBUG_TRACE
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_UTIL_DEBUG_H
+
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_delay.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_delay.c
new file mode 100644
index 000000000..9dd352d5e
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_delay.c
@@ -0,0 +1,120 @@
+//*****************************************************************************
+//
+//! @file am_util_delay.c
+//!
+//! @brief A few useful delay functions.
+//!
+//! Functions for fixed delays.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#include <stdint.h>
+#include <stdbool.h>
+#include "hal/am_hal_clkgen.h"
+#include "hal/am_hal_flash.h"
+#include "am_util_delay.h"
+
+//*****************************************************************************
+//
+//! @brief Delays for a desired amount of loops.
+//!
+//! @param ui32CycleLoops - Desired number of cycle loops to delay for.
+//!
+//! This function will delay for a number of cycle loops.
+//!
+//! @note - the number of cycles each loops takes to execute is approximately 3.
+//! Therefore the actual number of cycles executed will be ~3x ui32CycleLoops.
+//!
+//! For example, a ui32CycleLoops value of 100 will delay for 300 cycles.
+//!
+//! @returns None
+//
+//*****************************************************************************
+void
+am_util_delay_cycles(uint32_t ui32Iterations)
+{
+    //
+    // Call the BOOTROM cycle delay function
+    //
+    am_hal_flash_delay(ui32Iterations);
+}
+
+//*****************************************************************************
+//
+//! @brief Delays for a desired amount of milliseconds.
+//!
+//! @param ui32MilliSeconds - number of milliseconds to delay for.
+//!
+//! This function will delay for a number of milliseconds.
+//!
+//! @returns None
+//
+//*****************************************************************************
+void
+am_util_delay_ms(uint32_t ui32MilliSeconds)
+{
+    uint32_t ui32Loops = ui32MilliSeconds *
+                          (am_hal_clkgen_sysclk_get() / 3000);
+
+    //
+    // Call the BOOTROM cycle delay function
+    //
+    am_hal_flash_delay(ui32Loops);
+}
+
+//*****************************************************************************
+//
+//! @brief Delays for a desired amount of microseconds.
+//!
+//! @param ui32MicroSeconds - number of microseconds to delay for.
+//!
+//! This function will delay for a number of microseconds.
+//!
+//! @returns None
+//
+//*****************************************************************************
+void
+am_util_delay_us(uint32_t ui32MicroSeconds)
+{
+    uint32_t ui32Loops = ui32MicroSeconds *
+                          (am_hal_clkgen_sysclk_get() / 3000000);
+
+    //
+    // Call the BOOTROM cycle delay function
+    //
+    am_hal_flash_delay(ui32Loops);
+}
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_delay.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_delay.h
new file mode 100644
index 000000000..3f550eac8
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_delay.h
@@ -0,0 +1,65 @@
+//*****************************************************************************
+//
+//! @file am_util_delay.h
+//!
+//! @brief A few useful delay functions
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_UTIL_DELAY_H
+#define AM_UTIL_DELAY_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+//*****************************************************************************
+//
+// External function definitions
+//
+//*****************************************************************************
+extern void am_util_delay_cycles(uint32_t ui32Iterations);
+extern void am_util_delay_ms(uint32_t ui32MilliSeconds);
+extern void am_util_delay_us(uint32_t ui32MicroSeconds);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_UTIL_DELAY_H
+
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_faultisr.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_faultisr.c
new file mode 100644
index 000000000..3970041bd
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_faultisr.c
@@ -0,0 +1,398 @@
+//*****************************************************************************
+//
+//! @file am_util_faultisr.c
+//!
+//! @brief An extended hard-fault handler.
+//
+// This module is intended to be completely portable with no HAL or BSP
+// dependencies.
+//
+// Further, it is intended to be compiler/platform independent enabling it to
+// run on GCC, Keil, IAR, etc.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#include <stdint.h>
+#include "am_mcu_apollo.h"
+
+//*****************************************************************************
+//
+// Macros
+//
+//*****************************************************************************
+
+//
+// Macros used by am_util_faultisr_collect_data().
+//
+#define AM_REG_SYSCTRL_CFSR_O                        0xE000ED28
+#define AM_REG_SYSCTRL_BFAR_O                        0xE000ED38
+#define AM_REGVAL(x)               (*((volatile uint32_t *)(x)))
+
+//*****************************************************************************
+//
+// Data structures
+//
+//*****************************************************************************
+
+//
+// Define a structure for local storage in am_util_faultisr_collect_data().
+// Set structure alignment to 1 byte to minimize storage requirements.
+//
+#pragma pack(1)
+typedef struct
+{
+    //
+    // Stacked registers
+    //
+    volatile uint32_t u32R0;
+    volatile uint32_t u32R1;
+    volatile uint32_t u32R2;
+    volatile uint32_t u32R3;
+    volatile uint32_t u32R12;
+    volatile uint32_t u32LR;
+    volatile uint32_t u32PC;
+    volatile uint32_t u32PSR;
+
+    //
+    // Other data
+    //
+    volatile uint32_t u32FaultAddr;
+    volatile uint32_t u32BFAR;
+    volatile uint32_t u32CFSR;
+    volatile uint8_t  u8MMSR;
+    volatile uint8_t  u8BFSR;
+    volatile uint16_t u16UFSR;
+
+} am_fault_t;
+
+//
+// Restore the default structure alignment
+//
+#pragma pack()
+
+//*****************************************************************************
+//
+// Prototypes
+//
+//*****************************************************************************
+void am_util_faultisr_collect_data(uint32_t u32IsrSP);
+
+//
+// Prototype for printf, if used.
+//
+extern uint32_t am_util_stdio_printf(char *pui8Fmt, ...);
+
+//*****************************************************************************
+//
+// am_fault_isr() replaces the weak one defined in the startup code.  This
+// simple function captures SP (which is needed by getStackedReg) then calls
+// the function that actually decodes the hard fault data,
+// am_util_faultisr_collect_data().
+//
+//*****************************************************************************
+//*****************************************************************************
+//
+// getStackedReg() will retrieve a specified register value, as it was stacked
+// by the processor after the fault, from the stack.
+//
+// The registers are stacked in the following order:
+//  R0, R1, R2, R3, R12, LR, PC, PSR.
+// To get R0 from the stack, call getStackedReg(0), r1 is getStackedReg(1)...
+//
+//*****************************************************************************
+#if defined(__GNUC_STDC_INLINE__)
+uint32_t __attribute__((naked))
+am_fault_isr(void)
+{
+    __asm("    push    {r7,lr}");
+    __asm("    mov     r0, sp");
+    __asm("    adds    r0, #(2*4)");
+    __asm("    bl      am_util_faultisr_collect_data");
+    __asm("    pop     {r0,pc}");
+}
+
+uint32_t __attribute__((naked))
+getStackedReg(uint32_t regnum, uint32_t u32SP)
+{
+    __asm("    lsls    r0, r0, #2");
+    __asm("    adds    r0, r1");
+    __asm("    ldr     r0, [r0]");
+    __asm("    bx      lr");
+}
+#elif defined(__ARMCC_VERSION)
+__asm uint32_t
+am_fault_isr(void)
+{
+    import  am_util_faultisr_collect_data
+
+    push    {r7, lr}
+    mov     r0, sp
+    adds    r0, #(2*4)
+    bl      am_util_faultisr_collect_data
+    pop     {r0, pc}
+}
+
+__asm uint32_t
+getStackedReg(uint32_t regnum, uint32_t u32SP)
+{
+    lsls    r0, r0, #2
+    adds    r0, r0, r1
+    ldr     r0, [r0]
+    bx      lr
+}
+#elif defined(__IAR_SYSTEMS_ICC__)
+#pragma diag_suppress = Pe940   // Suppress IAR compiler warning about missing
+                                // return statement on a non-void function
+__stackless uint32_t
+am_fault_isr(void)
+{
+    __asm("     push    {r7,lr}");
+    __asm("     mov     r0, sp");
+    __asm("     adds    r0, #(2*4)");
+    __asm("     bl      am_util_faultisr_collect_data");
+    __asm("     pop     {r0,pc}");
+}
+
+__stackless uint32_t
+getStackedReg(uint32_t regnum, uint32_t u32SP)
+{
+    __asm("     lsls    r0, r0, #2");
+    __asm("     adds    r0, r0, r1");
+    __asm("     ldr     r0, [r0]");
+    __asm("     bx      lr");
+}
+#pragma diag_default = Pe940    // Restore IAR compiler warning
+#endif
+
+//*****************************************************************************
+//
+// am_util_faultisr_collect_data(uint32_t u32IsrSP);
+//
+// This function is intended to be called by am_fault_isr(), which is called
+// when the processor receives a hard fault interrupt.  This part of the
+// handler parses through the various fault codes and saves them into a data
+// structure so they can be readily examined by the user in the debugger.
+//
+// The input u32IsrSP is expected to be the value of the stack pointer when
+// am_fault_isr() was called.
+//
+//*****************************************************************************
+void
+am_util_faultisr_collect_data(uint32_t u32IsrSP)
+{
+    volatile am_fault_t sFaultData;
+    am_hal_mcuctrl_fault_t sHalFaultData = {0};
+    
+    uint32_t u32Mask = 0;
+
+    //
+    // Following is a brief overview of fault information provided by the M4.
+    // More details can be found in the Cortex M4 User Guide.
+    //
+    // CFSR (Configurable Fault Status Reg) contains MMSR, BFSR, and UFSR:
+    //   7:0    MMSR (MemManage)
+    //          [0] IACCVIOL    Instr fetch from a location that does not
+    //                          permit execution.
+    //          [1] DACCVIOL    Data access violation flag. MMAR contains
+    //                          address of the attempted access.
+    //          [2] Reserved
+    //          [3] MUNSTKERR   MemMange fault on unstacking for a return
+    //                          from exception.
+    //          [4] MSTKERR     MemMange fault on stacking for exception
+    //                          entry.
+    //          [5] MLSPERR     MemMange fault during FP lazy state
+    //                          preservation.
+    //          [6] Reserved
+    //          [7] MMARVALID   MemManage Fault Addr Reg (MMFAR) valid flag.
+    //  15:8    BusFault
+    //          [0] IBUSERR     If set, instruction bus error.
+    //          [1] PRECISERR   Data bus error. Stacked PC points to instr
+    //                          that caused the fault.
+    //          [2] IMPRECISERR Data bus error, but stacked return addr is not
+    //                          related to the instr that caused the error and
+    //                          BFAR is not valid.
+    //          [3] UNSTKERR    Bus fault on unstacking for a return from
+    //                          exception.
+    //          [4] STKERR      Bus fault on stacking for exception entry.
+    //          [5] LSPERR      Bus fault during FP lazy state preservation.
+    //          [6] Reserved
+    //          [7] BFARVALID   BFAR valid.
+    //  31:16   UFSR (UsageFault)
+    //          [0] UNDEFINSTR  Undefined instruction.
+    //          [1] INVSTATE    Invalid state.
+    //          [2] INVPC       Invalid PC load.
+    //          [3] NOCP        No coprocessor.
+    //        [7:4] Reserved
+    //          [8] UNALIGNED   Unaligned access.
+    //          [9] DIVBYZERO   Divide by zero.
+    //      [15:10] Reserved
+    //
+
+    //
+    // u32Mask is used for 2 things: 1) in the print loop, 2) as a spot to set
+    // a breakpoint at the end of the routine.  If the printing is not used,
+    // we'll get a compiler warning; so to avoid that warning, we'll use it
+    // in a dummy assignment here.
+    //
+    sFaultData.u32CFSR = u32Mask;       // Avoid compiler warning
+    sFaultData.u32CFSR = AM_REGVAL(AM_REG_SYSCTRL_CFSR_O);
+    sFaultData.u8MMSR  = (sFaultData.u32CFSR >> 0)  & 0xff;
+    sFaultData.u8BFSR  = (sFaultData.u32CFSR >> 8)  & 0xff;
+    sFaultData.u16UFSR = (sFaultData.u32CFSR >> 16) & 0xffff;
+
+    //
+    // The address of the location that caused the fault.  e.g. if accessing an
+    // invalid data location caused the fault, that address will appear here.
+    //
+    sFaultData.u32BFAR = AM_REGVAL(AM_REG_SYSCTRL_BFAR_O);
+
+    //
+    // The address of the instruction that caused the fault is the stacked PC
+    // if BFSR bit1 is set.
+    //
+    sFaultData.u32FaultAddr = (sFaultData.u8BFSR & 0x02) ? getStackedReg(6, u32IsrSP) : 0xffffffff;
+
+    //
+    // Get the stacked registers.
+    // Note - the address of the instruction that caused the fault is u32PC.
+    //
+    sFaultData.u32R0  = getStackedReg(0, u32IsrSP);
+    sFaultData.u32R1  = getStackedReg(1, u32IsrSP);
+    sFaultData.u32R2  = getStackedReg(2, u32IsrSP);
+    sFaultData.u32R3  = getStackedReg(3, u32IsrSP);
+    sFaultData.u32R12 = getStackedReg(4, u32IsrSP);
+    sFaultData.u32LR  = getStackedReg(5, u32IsrSP);
+    sFaultData.u32PC  = getStackedReg(6, u32IsrSP);
+    sFaultData.u32PSR = getStackedReg(7, u32IsrSP);
+
+    //
+    // Use the HAL MCUCTRL functions to read the fault data.
+    //
+    am_hal_mcuctrl_fault_status(&sHalFaultData);
+    
+
+#ifdef AM_UTIL_FAULTISR_PRINT
+    //
+    // If printf has previously been initialized in the application, we should
+    // be able to print out the fault information.
+    //
+    am_util_stdio_printf("Hard Fault stacked data:\n");
+    am_util_stdio_printf("    R0  = 0x%08X\n", sFaultData.u32R0);
+    am_util_stdio_printf("    R1  = 0x%08X\n", sFaultData.u32R1);
+    am_util_stdio_printf("    R2  = 0x%08X\n", sFaultData.u32R2);
+    am_util_stdio_printf("    R3  = 0x%08X\n", sFaultData.u32R3);
+    am_util_stdio_printf("    R12 = 0x%08X\n", sFaultData.u32R12);
+    am_util_stdio_printf("    LR  = 0x%08X\n", sFaultData.u32LR);
+    am_util_stdio_printf("    PC  = 0x%08X\n", sFaultData.u32PC);
+    am_util_stdio_printf("    PSR = 0x%08X\n", sFaultData.u32PSR);
+    am_util_stdio_printf("Other Hard Fault data:\n");
+    am_util_stdio_printf("    Fault address = 0x%08X\n", sFaultData.u32FaultAddr);
+    am_util_stdio_printf("    BFAR (Bus Fault Addr Reg) = 0x%08X\n", sFaultData.u32BFAR);
+    am_util_stdio_printf("    MMSR (Mem Mgmt Fault Status Reg) = 0x%02X\n", sFaultData.u8MMSR);
+    am_util_stdio_printf("    BFSR (Bus Fault Status Reg) = 0x%02X\n", sFaultData.u8BFSR);
+    am_util_stdio_printf("    UFSR (Usage Fault Status Reg) = 0x%04X\n", sFaultData.u16UFSR);
+
+    //
+    // Print out any bits set in the BFSR.
+    //
+    u32Mask = 0x80;
+    while (u32Mask)
+    {
+        switch (sFaultData.u8BFSR & u32Mask)
+        {
+            case 0x80:
+                am_util_stdio_printf("        BFSR bit7: BFARVALID\n");
+                break;
+            case 0x40:
+                am_util_stdio_printf("        BFSR bit6: RESERVED\n");
+                break;
+            case 0x20:
+                am_util_stdio_printf("        BFSR bit5: LSPERR\n");
+                break;
+            case 0x10:
+                am_util_stdio_printf("        BFSR bit4: STKERR\n");
+                break;
+            case 0x08:
+                am_util_stdio_printf("        BFSR bit3: UNSTKERR\n");
+                break;
+            case 0x04:
+                am_util_stdio_printf("        BFSR bit2: IMPRECISERR\n");
+                break;
+            case 0x02:
+                am_util_stdio_printf("        BFSR bit1: PRECISEERR\n");
+                break;
+            case 0x01:
+                am_util_stdio_printf("        BFSR bit0: IBUSERR\n");
+                break;
+            default:
+                break;
+        }
+        u32Mask >>= 1;
+    }
+    
+    //
+    // Print out any Apollo2 Internal fault information.
+    //
+    am_util_stdio_printf("Apollo2 Fault data:\n");
+    if (sHalFaultData.bICODE)
+    {
+      am_util_stdio_printf("   ICODE Fault Address: 0x%08X\n", sHalFaultData.ui32ICODE);
+    }
+    if (sHalFaultData.bDCODE)
+    {
+      am_util_stdio_printf("   DCODE Fault Address: 0x%08X\n", sHalFaultData.ui32DCODE);
+    }
+    if (sHalFaultData.bSYS)
+    {
+      am_util_stdio_printf("   SYS Fault Address: 0x%08X\n", sHalFaultData.ui32SYS);
+    }
+
+
+#endif
+
+    u32Mask = 0;
+
+    //
+    // Spin in an infinite loop.
+    // We need to spin here inside the function so that we have access to
+    // local data, i.e. sFaultData.
+    //
+    while(1)
+    {
+    }
+}
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_id.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_id.c
new file mode 100644
index 000000000..e7400f4a4
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_id.c
@@ -0,0 +1,165 @@
+//*****************************************************************************
+//
+//! @file am_util_id.c
+//!
+//! @brief Identification of the Ambiq Micro device.
+//!
+//! This module contains functions for run time identification of Ambiq Micro
+//! devices.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#include <stdint.h>
+#include <stdbool.h>
+#include "am_util_id.h"
+
+
+//*****************************************************************************
+//
+// Globals.
+//
+//*****************************************************************************
+//
+// Strings for use with pui8VendorName.
+//
+static const uint8_t g_DeviceNameApollo[]     = "Apollo";
+static const uint8_t g_DeviceNameApollo2[]    = "Apollo2";
+static const uint8_t g_ui8VendorNameAmbq[]    = "AMBQ";
+static const uint8_t g_ui8VendorNameUnknown[] = "????";
+static const uint8_t g_ui8DeviceNameUnknown[] = "Unknown device";
+
+//*****************************************************************************
+//
+//! @brief Device identification.
+//!
+//! @param psIDDevice - ptr to a device ID structure (am_util_id_t*) to be
+//! filled in by the function.
+//!
+//! This function provides additional information about the currently running
+//! Ambiq Micro MCU device.
+//!
+//! @returns The ui32Device value, which is a value corresponding to the
+//! device type.
+//
+//*****************************************************************************
+uint32_t
+am_util_id_device(am_util_id_t *psIDDevice)
+{
+    uint32_t ux, ui32PN;
+
+    //
+    // Go get all the device (hardware) info from the HAL
+    //
+    am_hal_mcuctrl_device_info_get(&psIDDevice->sMcuCtrlDevice);
+
+    //
+    // Device identification
+    //
+    ui32PN = psIDDevice->sMcuCtrlDevice.ui32ChipPN  &
+             AM_UTIL_MCUCTRL_CHIP_INFO_PARTNUM_PN_M;
+
+    if ( (psIDDevice->sMcuCtrlDevice.ui32JedecCID   == 0xB105100D)          &&
+         (psIDDevice->sMcuCtrlDevice.ui32JedecJEPID == 0x0000009B)          &&
+         ((psIDDevice->sMcuCtrlDevice.ui32JedecPN & 0xF00) != 0xE00) )
+    {
+        //
+        // It's Ambiq Micro, set up the VENDORID.
+        //
+        psIDDevice->pui8VendorName = g_ui8VendorNameAmbq;
+    }
+    else
+    {
+        //
+        // For now, set it as unknown vendor, but we may change it later.
+        //
+        psIDDevice->pui8VendorName = g_ui8VendorNameUnknown;
+    }
+
+    if ( psIDDevice->sMcuCtrlDevice.ui32VendorID ==
+         (('A' << 24) | ('M' << 16) | ('B' << 8) | ('Q' << 0)) )
+    {
+        //
+        // VENDORID is AMBQ, so set the string pointer.
+        //
+        psIDDevice->pui8VendorName = g_ui8VendorNameAmbq;
+    }
+
+    if ( ((psIDDevice->sMcuCtrlDevice.ui32JedecPN & 0x0F0) == 0x0E0)        &&
+         ( ui32PN == AM_UTIL_MCUCTRL_CHIP_INFO_PARTNUM_APOLLO ) )
+    {
+        psIDDevice->ui32Device = AM_UTIL_ID_APOLLO;
+        psIDDevice->pui8DeviceName = g_DeviceNameApollo;
+
+        //
+        // ui32ChipRev[7:4]: 0=n/a, 1=A, 2=B, ...
+        // ui32ChipRev[3:0]: 0=Rev0, 1=Rev1, ...
+        //
+        ux = ((psIDDevice->sMcuCtrlDevice.ui32ChipRev & 0xF0) >> 4);
+        psIDDevice->ui8ChipRevMaj  = (uint8_t)('A' - 1 + ux);
+        ux = ((psIDDevice->sMcuCtrlDevice.ui32ChipRev & 0x0F) >> 0);
+        psIDDevice->ui8ChipRevMin = (uint8_t)('0' + ux);
+
+        //
+        // Force the vendor name for Apollo, which did not support VENDORID.
+        //
+        psIDDevice->pui8VendorName = g_ui8VendorNameAmbq;
+    }
+    else if ( ((psIDDevice->sMcuCtrlDevice.ui32JedecPN & 0x0F0) == 0x0D0)   &&
+              ( ui32PN == AM_UTIL_MCUCTRL_CHIP_INFO_PARTNUM_APOLLO2 ) )
+    {
+        psIDDevice->ui32Device = AM_UTIL_ID_APOLLO2;
+        psIDDevice->pui8DeviceName = g_DeviceNameApollo2;
+
+        //
+        // ui32ChipRev[7:4]: 0=n/a, 1=A, 2=B, ...
+        // ui32ChipRev[3:0]: 0=Rev0, 1=Rev1, ...
+        //
+        ux = ((psIDDevice->sMcuCtrlDevice.ui32ChipRev & 0xF0) >> 4);
+        psIDDevice->ui8ChipRevMaj  = (uint8_t)('A' - 1 + ux);
+        ux = ((psIDDevice->sMcuCtrlDevice.ui32ChipRev & 0x0F) >> 0);
+        psIDDevice->ui8ChipRevMin = (uint8_t)('0' + ux);
+    }
+    else
+    {
+        psIDDevice->ui32Device = AM_UTIL_ID_UNKNOWN;
+        psIDDevice->pui8DeviceName = g_ui8DeviceNameUnknown;
+        psIDDevice->ui8ChipRevMaj = (uint8_t)'?';
+        psIDDevice->ui8ChipRevMin = (uint8_t)' ';
+    }
+
+    return psIDDevice->ui32Device;
+}
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_id.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_id.h
new file mode 100644
index 000000000..8682bae04
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_id.h
@@ -0,0 +1,124 @@
+//*****************************************************************************
+//
+//! @file am_util_id.h
+//!
+//! @brief Identification of the Ambiq Micro device.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_UTIL_ID_H
+#define AM_UTIL_ID_H
+
+#include "hal/am_hal_mcuctrl.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+//*****************************************************************************
+//
+//! ID structure
+//
+//*****************************************************************************
+typedef struct
+{
+    //
+    //! Contains the HAL hardware information about the device.
+    //
+    am_hal_mcuctrl_device_t sMcuCtrlDevice;
+
+    //
+    //! Device type (derived value, not a hardware value)
+    //
+    uint32_t ui32Device;
+
+    //
+    //! Vendor name from the MCUCTRL VENDORID register and stringized here.
+    //
+    const uint8_t *pui8VendorName;
+
+    //
+    //! Device name (derived value, not a hardware value)
+    //
+    const uint8_t *pui8DeviceName;
+
+    //
+    // Major chip revision (e.g. char 'A' or 'B')
+    //
+    uint8_t ui8ChipRevMaj;
+
+    //
+    // Minor chip revision (e.g. char '0', '1', ' ')
+    //
+    uint8_t ui8ChipRevMin;
+}
+am_util_id_t;
+
+//*****************************************************************************
+//
+// Macros for MCUCTRL CHIP_INFO field.
+// Note - these macros are derived from the Apollo2 auto-generated register
+// definitions.
+//
+//*****************************************************************************
+#define AM_UTIL_MCUCTRL_CHIP_INFO_PARTNUM_APOLLO2     0x03000000
+#define AM_UTIL_MCUCTRL_CHIP_INFO_PARTNUM_APOLLO      0x01000000
+#define AM_UTIL_MCUCTRL_CHIP_INFO_PARTNUM_PN_M        0xFF000000
+
+//*****************************************************************************
+//
+// Macros for silicon identification
+//
+//*****************************************************************************
+#define AM_UTIL_ID_UNKNOWN      0
+#define AM_UTIL_ID_APOLLO       1
+#define AM_UTIL_ID_APOLLO2      2
+
+//*****************************************************************************
+//
+// External function definitions
+//
+//*****************************************************************************
+extern uint32_t am_util_id_device(am_util_id_t *psIDDevice);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_UTIL_ID_H
+
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_math.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_math.c
new file mode 100644
index 000000000..a88d5968a
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_math.c
@@ -0,0 +1,84 @@
+//*****************************************************************************
+//
+//! @file am_util_math.c
+//!
+//! @brief A few useful math functions.
+//!
+//! Functions for performing some number manipulation.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#include <stdint.h>
+#include <stdbool.h>
+#include "am_util_math.h"
+
+//*****************************************************************************
+//
+//! @brief Converts a Binary Coded Decimal (BCD) byte to its Decimal form.
+//!
+//! @param ui8BCDByte is a BCD byte.
+//!
+//! This function is useful when working with RTC's as they tend to be in BCD 
+//! format.
+//!
+//! @returns the BCD byte converted to Decimal
+//
+//*****************************************************************************
+uint8_t
+am_util_math_bcd_to_dec(uint8_t ui8BCDByte)
+{
+  return (((ui8BCDByte & 0xF0) >> 4) * 10) + (ui8BCDByte & 0x0F);
+}
+
+//*****************************************************************************
+//
+//! @brief Converts a Decimal byte to its Binary Coded Decimal (BCD) form.
+//!
+//! @param ui8DecimalByte is a Decimal byte.
+//!
+//! This function is useful when working with RTC's as they tend to be in BCD 
+//! format.
+//!
+//! @returns the Decimal byte converted to BCD.
+//
+//*****************************************************************************
+uint8_t
+am_util_math_dec_to_bcd(uint8_t ui8DecimalByte)
+{
+  return (((ui8DecimalByte / 10) << 4) | (ui8DecimalByte % 10));
+}
+
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_math.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_math.h
new file mode 100644
index 000000000..53e1c2a95
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_math.h
@@ -0,0 +1,64 @@
+//*****************************************************************************
+//
+//! @file am_util_math.h
+//!
+//! @brief A few useful math functions
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_UTIL_MATH_H
+#define AM_UTIL_MATH_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+//*****************************************************************************
+//
+// External function definitions
+//
+//*****************************************************************************
+extern uint8_t am_util_math_dec_to_bcd(uint8_t ui8DecimalByte);
+extern uint8_t am_util_math_bcd_to_dec(uint8_t ui8BCDByte);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_UTIL_MATH_H
+
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_plot.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_plot.c
new file mode 100644
index 000000000..5b18e572a
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_plot.c
@@ -0,0 +1,172 @@
+//*****************************************************************************
+//
+//! @file am_util_plot.c
+//!
+//! @brief A few useful plot functions to be used with AM Flash.
+//!
+//! Functions for providing AM Flash with the correct data enabling real-time
+//! plotting.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#include <stdint.h>
+#include <stdbool.h>
+#include <stdarg.h>
+#include "hal/am_hal_itm.h"
+#include "am_util_stdio.h"
+#include "am_util_plot.h"
+
+//*****************************************************************************
+//
+// Globals
+//
+//*****************************************************************************
+// variable to keep track if we need to send a sync packet.
+uint32_t g_ui32Sync = 0;
+
+//*****************************************************************************
+//
+//! @brief Initializes the plot interface (ITM)
+//!
+//! This function initializes the ITM to allow for plotting.
+//!
+//! @returns None
+//
+//*****************************************************************************
+void
+am_util_plot_init(void)
+{
+    //
+    // Enable the ITM.
+    //
+    am_hal_itm_enable();
+
+    //
+    // Initialize the printf interface for ITM/SWO output
+    //
+    am_util_stdio_printf_init((am_util_stdio_print_char_t) am_hal_itm_print);
+}
+
+//*****************************************************************************
+//
+//! @brief Plots an integer using AM Flash as the viewer.
+//!
+//! @param ui32Trace - trace number.
+//! @param i32Value - value to plot.
+//!
+//! This function will plot a value to the desired trace. Valid values for
+//! ui32Trace are:
+//!
+//! AM_UTIL_PLOT_0
+//! AM_UTIL_PLOT_1
+//! AM_UTIL_PLOT_2
+//! AM_UTIL_PLOT_3
+//!
+//! @returns None
+//
+//*****************************************************************************
+void
+am_util_plot_int(uint32_t ui32Trace, int32_t i32Value)
+{
+    if (g_ui32Sync == 0)
+    {
+        //
+        // Send Sync.
+        //
+        am_hal_itm_sync_send();
+
+        //
+        // Reset sync count.
+        //
+        g_ui32Sync = AM_UTIL_PLOT_SYNC_SEND;
+    }
+    else
+    {
+        g_ui32Sync--;
+    }
+
+    //
+    // Write to the stimulus register.
+    //
+    am_hal_itm_stimulus_reg_word_write(ui32Trace, i32Value);
+}
+
+//*****************************************************************************
+//
+//! @brief Plots an byte using AM Flash as the veiwer.
+//!
+//! @param ui32Trace - trace number.
+//! @param ui8Value - byte value to plot.
+//!
+//! This function will plot a byte value to the desired trace. If your plot
+//! value fits into a byte, use this function as the ITM traffic can be reduced
+//! by a factor of 4 over am_util_plot_int().  Valid values for ui32Trace
+//! are:
+//!
+//! AM_UTIL_PLOT_0
+//! AM_UTIL_PLOT_1
+//! AM_UTIL_PLOT_2
+//! AM_UTIL_PLOT_3
+//!
+//! @returns None
+//
+//*****************************************************************************
+void
+am_util_plot_byte(uint32_t ui32Trace, uint8_t ui8Value)
+{
+    if (g_ui32Sync == 0)
+    {
+        //
+        // Send Sync.
+        //
+        am_hal_itm_sync_send();
+
+        //
+        // Reset sync count.
+        //
+        g_ui32Sync = AM_UTIL_PLOT_SYNC_SEND;
+    }
+    else
+    {
+        g_ui32Sync--;
+    }
+
+    //
+    // Write to the stimulus register.
+    //
+    am_hal_itm_stimulus_reg_byte_write(ui32Trace, ui8Value);
+}
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_plot.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_plot.h
new file mode 100644
index 000000000..8d04d489b
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_plot.h
@@ -0,0 +1,86 @@
+//*****************************************************************************
+//
+//! @file am_util_plot.h
+//!
+//! @brief A few useful plot functions to be used with AM Flash.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_UTIL_PLOT_H
+#define AM_UTIL_PLOT_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+//*****************************************************************************
+//
+//! @name Trace defines
+//! @brief Trace defines for valid plot traces
+//!
+//! These macros should be used to specify which trace to update for plotting.
+//! @{
+//
+//*****************************************************************************
+#define AM_UTIL_PLOT_0              24
+#define AM_UTIL_PLOT_1              25
+#define AM_UTIL_PLOT_2              26
+#define AM_UTIL_PLOT_3              27
+//! @}
+
+//
+// Define for the frequency of sync packets.
+//
+#define AM_UTIL_PLOT_SYNC_SEND      64
+
+//*****************************************************************************
+//
+// External function definitions
+//
+//*****************************************************************************
+extern void am_util_plot_init(void);
+extern void am_util_plot_int(uint32_t ui32Trace, int32_t i32Value);
+extern void am_util_plot_byte(uint32_t ui32Trace, uint8_t ui8Value);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_UTIL_PLOT_H
+
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_regdump.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_regdump.c
new file mode 100644
index 000000000..99c72e966
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_regdump.c
@@ -0,0 +1,828 @@
+//*****************************************************************************
+//
+//! @file am_util_regdump.c
+//!
+//! @brief Dump specified registers for debug purposes.
+//!
+//! This module contains functions for real time (debug) printing of registers
+//! from peripherals specified in a given bitmask.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "am_util_regdump.h"
+#include "am_util_stdio.h"
+
+
+//*****************************************************************************
+//
+// Register dump structure.
+//
+//*****************************************************************************
+typedef struct
+{
+    //
+    //! Set to 1 to operate this timer as a 32-bit timer instead of two 16-bit
+    //! timers.
+    //
+    uint32_t ui32Offset;
+
+    //
+    //! Configuration options for TIMERA
+    //
+    char *pi8RegName;
+    //uint8_t *puiRegName;
+}
+am_util_regdump_t;
+
+
+//*****************************************************************************
+//
+// Globals.
+//
+//*****************************************************************************
+static uint8_t g_ui8Fmt[64];
+
+am_util_regdump_t g_sRegdumpADC[] =
+{
+    {0x000, "CFG"},
+    {0x004, "STAT"},
+    {0x008, "SWT"},
+    {0x00C, "SL0CFG"},
+    {0x010, "SL1CFG"},
+    {0x014, "SL2CFG"},
+    {0x018, "SL3CFG"},
+    {0x01C, "SL4CFG"},
+    {0x020, "SL5CFG"},
+    {0x024, "SL6CFG"},
+    {0x028, "SL7CFG"},
+    {0x02C, "WULIM"},
+    {0x030, "WLLIM"},
+#if INCLUDE_REGS_WITH_SIDE_EFFECT
+    {0x038, "FIFO"},
+#endif // INCLUDE_REGS_WITH_SIDE_EFFECT
+    {0x200, "INTEN"},
+    {0x204, "INTSTAT"},
+    {0x208, "INTCLR"},
+    {0x20C, "INTSET"},
+    {0xFFFFFFFF, NULL}
+};
+
+am_util_regdump_t g_sRegdumpCACHECTRL[] =
+{
+    {0x000, "CACHECFG"},
+    {0x004, "FLASHCFG"},
+    {0x008, "CACHECTRL"},
+    {0x010, "NCR0START"},
+    {0x014, "NCR0END"},
+    {0x018, "NCR1START"},
+    {0x01C, "NCR1END"},
+    {0x030, "CACHEMODE"},
+    {0x040, "DMON0"},
+    {0x044, "DMON1"},
+    {0x048, "DMON2"},
+    {0x04C, "DMON3"},
+    {0x050, "IMON0"},
+    {0x054, "IMON1"},
+    {0x058, "IMON2"},
+    {0x05C, "IMON3"},
+    {0xFFFFFFFF, NULL}
+};
+
+am_util_regdump_t g_sRegdumpCLKGEN[] =
+{
+    {0x000, "CALXT"},
+    {0x004, "CALRC"},
+    {0x008, "ACALCTR"},
+    {0x00C, "OCTRL"},
+    {0x010, "CLKOUT"},
+    {0x014, "CLKKEY"},
+    {0x018, "CCTRL"},
+    {0x01C, "STATUS"},
+    {0x020, "HFADJ"},
+    {0x024, "HFVAL"},
+    {0x028, "CLOCKEN"},
+    {0x02C, "CLOCKEN2"},
+    {0x030, "CLOCKEN3"},
+    {0x034, "UARTEN"},
+    {0x100, "INTEN"},
+    {0x104, "INTSTAT"},
+    {0x108, "INTCLR"},
+    {0x10C, "INTSET"},
+    {0xFFFFFFFF, NULL}
+};
+
+am_util_regdump_t g_sRegdumpCTIMER[] =
+{
+    {0x000, "TMR0"},
+    {0x004, "CMPRA0"},
+    {0x008, "CMPRB0"},
+    {0x00C, "CTRL0"},
+    {0x010, "TMR1"},
+    {0x014, "CMPRA1"},
+    {0x018, "CMPRB1"},
+    {0x01C, "CTRL1"},
+    {0x020, "TMR2"},
+    {0x024, "CMPRA2"},
+    {0x028, "CMPRB2"},
+    {0x02C, "CTRL2"},
+    {0x030, "TMR3"},
+    {0x034, "CMPRA3"},
+    {0x038, "CMPRB3"},
+    {0x03C, "CTRL3"},
+    {0x100, "STCFG"},
+    {0x104, "STTMR"},
+    {0x108, "CAPTURE_CONTROL"},
+    {0x110, "SCMPR0"},
+    {0x114, "SCMPR1"},
+    {0x118, "SCMPR2"},
+    {0x11C, "SCMPR3"},
+    {0x120, "SCMPR4"},
+    {0x124, "SCMPR5"},
+    {0x128, "SCMPR6"},
+    {0x12C, "SCMPR7"},
+    {0x1E0, "SCAPT0"},
+    {0x1E4, "SCAPT1"},
+    {0x1E8, "SCAPT2"},
+    {0x1EC, "SCAPT3"},
+    {0x1F0, "SNVR0"},
+    {0x1F4, "SNVR1"},
+    {0x1F8, "SNVR2"},
+    {0x200, "INTEN"},
+    {0x204, "INTSTAT"},
+    {0x208, "INTCLR"},
+    {0x20C, "INTSET"},
+    {0x300, "STMINTEN"},
+    {0x304, "STMINTSTAT"},
+    {0x308, "STMINTCLR"},
+    {0x30C, "STMINTSET"},
+    {0xFFFFFFFF, NULL}
+};
+
+
+am_util_regdump_t g_sRegdumpGPIO[] =
+{
+    {0x000, "PADREGA"},
+    {0x004, "PADREGB"},
+    {0x008, "PADREGC"},
+    {0x00C, "PADREGD"},
+    {0x010, "PADREGE"},
+    {0x014, "PADREGF"},
+    {0x018, "PADREGG"},
+    {0x01C, "PADREGH"},
+    {0x020, "PADREGI"},
+    {0x024, "PADREGJ"},
+    {0x028, "PADREGK"},
+    {0x02C, "PADREGL"},
+    {0x030, "PADREGM"},
+    {0x040, "CFGA"},
+    {0x044, "CFGB"},
+    {0x048, "CFGC"},
+    {0x04C, "CFGD"},
+    {0x050, "CFGE"},
+    {0x054, "CFGF"},
+    {0x058, "CFGG"},
+    {0x060, "PADKEY"},
+    {0x080, "RDA"},
+    {0x084, "RDB"},
+    {0x088, "WTA"},
+    {0x08C, "WTB"},
+    {0x090, "WTSA"},
+    {0x094, "WTSB"},
+    {0x098, "WTCA"},
+    {0x09C, "WTCB"},
+    {0x0A0, "ENA"},
+    {0x0A4, "ENB"},
+    {0x0A8, "ENSA"},
+    {0x0Ac, "ENSB"},
+    {0x0B4, "ENCA"},
+    {0x0B8, "ENCB"},
+    {0x0BC, "STMRCAP"},
+    {0x0C0, "IOM0IRQ"},
+    {0x0C4, "IOM1IRQ"},
+    {0x0C8, "IOM2IRQ"},
+    {0x0CC, "IOM3IRQ"},
+    {0x0D0, "IOM4IRQ"},
+    {0x0D4, "IOM5IRQ"},
+    {0x0D8, "LOOPBACK"},
+    {0x0DC, "OBS"},
+    {0x0E0, "ALTPADCFGA"},
+    {0x0E4, "ALTPADCFGB"},
+    {0x0E8, "ALTPADCFGC"},
+    {0x0EC, "ALTPADCFGD"},
+    {0x0F0, "ALTPADCFGE"},
+    {0x0F4, "ALTPADCFGF"},
+    {0x0F8, "ALTPADCFGG"},
+    {0x0FC, "ALTPADCFGH"},
+    {0x100, "ALTPADCFGI"},
+    {0x104, "ALTPADCFGJ"},
+    {0x108, "ALTPADCFGK"},
+    {0x10C, "ALTPADCFGL"},
+    {0x110, "ALTPADCFGM"},
+    {0x200, "INT0EN"},
+    {0x204, "INT0STAT"},
+    {0x208, "INT0CLR"},
+    {0x20C, "INT0SET"},
+    {0x210, "INT1EN"},
+    {0x214, "INT1STAT"},
+    {0x218, "INT1CLR"},
+    {0x21C, "INT1SET"},
+    {0xFFFFFFFF, NULL}
+};
+
+am_util_regdump_t g_sRegdumpIOM[] =
+{
+#if INCLUDE_REGS_WITH_SIDE_EFFECT
+    {0x000, "FIFO"},
+#endif // INCLUDE_REGS_WITH_SIDE_EFFECT
+    {0x100, "FIFOPTR"},
+    {0x104, "TLNGTH"},
+    {0x108, "FIFOTHR"},
+    {0x10C, "CLKCFG"},
+    {0x110, "CMD"},
+    {0x114, "CMDRPT"},
+    {0x118, "STATUS"},
+    {0x11C, "CFG"},
+    {0x200, "INTEN"},
+    {0x204, "INTSTAT"},
+    {0x208, "INTCLR"},
+    {0x20C, "INTSET"},
+    {0xFFFFFFFF, NULL}
+};
+
+am_util_regdump_t g_sRegdumpIOS[] =
+{
+#if INCLUDE_REGS_WITH_SIDE_EFFECT
+    {0x000, "FIFO"},
+#endif // INCLUDE_REGS_WITH_SIDE_EFFECT
+    {0x100, "FIFOPTR"},
+    {0x104, "FIFOCFG"},
+    {0x108, "FIFOTHR"},
+    {0x10C, "FUPD"},
+    {0x110, "FIFOCTR"},
+    {0x114, "FIFOINC"},
+    {0x118, "CFG"},
+    {0x11C, "PRENC"},
+    {0x120, "INTCTLC"},
+    {0x124, "GENADD"},
+    {0x200, "INTEN"},
+    {0x204, "INTSTAT"},
+    {0x208, "INTCLR"},
+    {0x20C, "INTSET"},
+    {0x210, "REGACCINTEN"},
+    {0x214, "REGACCINTSTAT"},
+    {0x218, "REGACCINTCLR"},
+    {0x21C, "REGACCINTSET"},
+    {0xFFFFFFFF, NULL}
+};
+
+am_util_regdump_t g_sRegdumpPDM[] =
+{
+    {0x000, "PCFG"},
+    {0x004, "VCFG"},
+    {0x008, "FR"},
+#if INCLUDE_REGS_WITH_SIDE_EFFECT
+    {0x00C, "FRD"},
+#endif // INCLUDE_REGS_WITH_SIDE_EFFECT
+    {0x010, "FLUSH"},
+    {0x014, "FTHR"},
+    {0x200, "INTEN"},
+    {0x204, "INTSTAT"},
+    {0x208, "INTCLR"},
+    {0x20C, "INTSET"},
+    {0xFFFFFFFF, NULL}
+};
+
+am_util_regdump_t g_sRegdumpPWRCTRL[] =
+{
+    {0x000, "SUPPLYSRC"},
+    {0x004, "POWERSTATUS"},
+    {0x008, "DEVICEEN"},
+    {0x00C, "SRAMPWDINSLEEP"},
+    {0x010, "MEMEN"},
+    {0x014, "PWRONSTATUS"},
+    {0x018, "SRAMCTRL"},
+    {0x01C, "ADCSTATUS"},
+    {0x020, "MISCOPT"},
+    {0xFFFFFFFF, NULL}
+};
+
+am_util_regdump_t g_sRegdumpRSTGEN[] =
+{
+    {0x000, "CFG"},
+    {0x004, "SWPOI"},
+    {0x008, "SWPOR"},
+    {0x00C, "STAT"},
+    {0x010, "CLRSTAT"},
+    {0x014, "TPIURST"},
+    {0x200, "INTEN"},
+    {0x204, "INTSTAT"},
+    {0x208, "INTCLR"},
+    {0x20C, "INTSET"},
+    {0xFFFFFFFF, NULL}
+};
+
+am_util_regdump_t g_sRegdumpRTC[] =
+{
+    {0x040, "CTRLOW"},
+    {0x044, "CTRUP"},
+    {0x048, "ALMLOW"},
+    {0x04C, "ALMUP"},
+    {0x050, "RTCCTL"},
+    //
+    // The interrupt regs are actually duplicates of CLKGEN
+    //
+    {0x100, "INTEN"},
+    {0x104, "INTSTAT"},
+    {0x108, "INTCLR"},
+    {0x10C, "INTSET"},
+    {0xFFFFFFFF, NULL}
+};
+
+am_util_regdump_t g_sRegdumpUART[] =
+{
+#if INCLUDE_REGS_WITH_SIDE_EFFECT
+    {0x000, "DR (data)"},
+#endif // INCLUDE_REGS_WITH_SIDE_EFFECT
+    {0x004, "RSR (status)"},
+    {0x018, "FR (flag)"},
+    {0x020, "ILPR (IrDA Counter)"},
+    {0x024, "IBRD (Baud Div)"},
+    {0x028, "FBRD (Frac Baud Div)"},
+    {0x02C, "LCRH (Line Ctrl)"},
+    {0x030, "CR (Ctrl)"},
+    {0x034, "IFLS"},
+    {0x038, "IER"},
+    {0x03C, "IES"},
+    {0x040, "MIS"},
+    {0x044, "IEC"},
+    {0xFFFFFFFF, NULL}
+};
+
+am_util_regdump_t g_sRegdumpVCOMP[] =
+{
+    {0x000, "CFG"},
+    {0x004, "STAT"},
+    {0x008, "PWDKEY"},
+    {0x200, "INTEN"},
+    {0x204, "INTSTAT"},
+    {0x208, "INTCLR"},
+    {0x20C, "INTSET"},
+    {0xFFFFFFFF, NULL}
+};
+
+am_util_regdump_t g_sRegdumpWDT[] =
+{
+    {0x000, "CFG"},
+    {0x004, "RSTRT"},
+    {0x008, "LOCK"},
+    {0x00C, "COUNT"},
+    {0x200, "INTEN"},
+    {0x204, "INTSTAT"},
+    {0x208, "INTCLR"},
+    {0x20C, "INTSET"},
+    {0xFFFFFFFF, NULL}
+};
+
+am_util_regdump_t g_sRegdumpITM[] =
+{
+    {0xE0000000, "STIM0"},
+    {0xE0000004, "STIM1"},
+    {0xE0000008, "STIM2"},
+    {0xE000000C, "STIM3"},
+    {0xE0000010, "STIM4"},
+    {0xE0000014, "STIM5"},
+    {0xE0000018, "STIM6"},
+    {0xE000001C, "STIM7"},
+    {0xE0000020, "STIM8"},
+    {0xE0000024, "STIM9"},
+    {0xE0000028, "STIM10"},
+    {0xE000002C, "STIM11"},
+    {0xE0000030, "STIM12"},
+    {0xE0000034, "STIM13"},
+    {0xE0000038, "STIM14"},
+    {0xE000003C, "STIM15"},
+    {0xE0000040, "STIM16"},
+    {0xE0000044, "STIM17"},
+    {0xE0000048, "STIM18"},
+    {0xE000004C, "STIM19"},
+    {0xE0000050, "STIM20"},
+    {0xE0000054, "STIM21"},
+    {0xE0000058, "STIM22"},
+    {0xE000005C, "STIM23"},
+    {0xE0000060, "STIM24"},
+    {0xE0000064, "STIM25"},
+    {0xE0000068, "STIM26"},
+    {0xE000006C, "STIM27"},
+    {0xE0000070, "STIM28"},
+    {0xE0000074, "STIM29"},
+    {0xE0000078, "STIM30"},
+    {0xE000007C, "STIM31"},
+    {0xE0000E00, "TER"},
+    {0xE0000E40, "TPR"},
+    {0xE0000E80, "TCR"},
+    {0xE0000FB4, "LOCKSREG"},
+    {0xE0000FD0, "PID4"},
+    {0xE0000FD4, "PID5"},
+    {0xE0000FD8, "PID6"},
+    {0xE0000FDC, "PID7"},
+    {0xE0000FE0, "PID0"},
+    {0xE0000FE4, "PID1"},
+    {0xE0000FE8, "PID2"},
+    {0xE0000FEC, "PID3"},
+    {0xE0000FF0, "CID0"},
+    {0xE0000FF4, "CID1"},
+    {0xE0000FF8, "CID2"},
+    {0xE0000FFC, "CID3"},
+    {0xE0000FB0, "LOCKAREG"},
+    {0xFFFFFFFF, NULL}
+};
+
+am_util_regdump_t g_sRegdumpNVIC[] =
+{
+    {0xE000E100, "ISER0"},
+    {0xE000E180, "ICER0"},
+    {0xE000E200, "ISPR0"},
+    {0xE000E280, "ICPR0"},
+    {0xE000E300, "IABR0"},
+    {0xE000E400, "IPR0"},
+    {0xE000E404, "IPR1"},
+    {0xE000E408, "IPR2"},
+    {0xE000E40C, "IPR3"},
+    {0xE000E410, "IPR4"},
+    {0xE000E414, "IPR5"},
+    {0xE000E418, "IPR6"},
+    {0xE000E41C, "IPR7"},
+    {0xFFFFFFFF, NULL}
+};
+
+am_util_regdump_t g_sRegdumpSYSCTRL[] =
+{
+    {0xE000ED04, "ICSR"},
+    {0xE000ED08, "VTOR"},
+    {0xE000ED0C, "AIRCR"},
+    {0xE000ED10, "SCR"},
+    {0xE000ED14, "CCR"},
+    {0xE000ED18, "SHPR1"},
+    {0xE000ED1C, "SHPR2"},
+    {0xE000ED20, "SHPR3"},
+    {0xE000ED24, "SHCSR"},
+    {0xE000ED28, "CFSR"},
+    {0xE000ED2C, "HFSR"},
+    {0xE000ED34, "MMFAR"},
+    {0xE000ED38, "BFAR"},
+    {0xE000ED88, "CPACR"},
+    {0xE000EDFC, "DEMCR"},
+    {0xE000EF00, "STIR"},
+    {0xE000EF34, "FPCCR"},
+    {0xE000EF38, "FPCAR"},
+    {0xE000EF3C, "FPDSCR"},
+    {0xFFFFFFFF, NULL}
+};
+
+am_util_regdump_t g_sRegdumpSYSTICK[] =
+{
+    {0xE000E010, "SYSTCSR"},
+    {0xE000E014, "SYSTRVR"},
+    {0xE000E018, "SYSTCVR"},
+    {0xE000E01C, "SYSTCALIB"},
+    {0xFFFFFFFF, NULL}
+};
+
+am_util_regdump_t g_sRegdumpTPIU[] =
+{
+    {0xE0040000, "SSPSR"},
+    {0xE0040004, "CSPSR"},
+    {0xE0040010, "ACPR"},
+    {0xE00400F0, "SPPR"},
+    {0xE0040304, "FFCR"},
+    {0xE0040F00, "ITCTRL"},
+    {0xE0040FC8, "TYPE"},
+    {0xFFFFFFFF, NULL}
+};
+
+//*****************************************************************************
+//
+// Support functions.
+//
+//*****************************************************************************
+static void
+regdump_newline_print(uint32_t ui32Num)
+{
+    while ( ui32Num-- )
+    {
+        am_util_stdio_printf("\n");
+    }
+}
+
+
+static uint32_t
+regdump_strlen(char *pcStr)
+{
+    char *pcS;
+
+    //
+    // Loop through the string.
+    //
+    for ( pcS = pcStr; *pcS; ++pcS );
+
+    //
+    // Return the length.
+    //
+    return (pcS - pcStr);
+}
+
+static void
+block_print(am_util_regdump_t *psDump, uint32_t ui32BaseAddr)
+{
+    uint32_t ui32RegAddr;
+    uint32_t ux, ui32Len, ui32MaxLen;
+
+    //
+    // First, get the maximum register name length.
+    //
+    ui32MaxLen = ux = 0;
+    while ( psDump[ux].ui32Offset != 0xFFFFFFFF )
+    {
+        ui32Len = regdump_strlen(psDump[ux].pi8RegName);
+        if ( ui32Len > ui32MaxLen )
+        {
+            ui32MaxLen = ui32Len;
+        }
+        ux++;
+    }
+
+    //
+    // Create the format string
+    //
+    am_util_stdio_sprintf((char*)g_ui8Fmt, "  %%-%ds (0x%%08X) = 0x%%08X\n", ui32MaxLen + 1);
+//  am_util_stdio_printf("g_ui8Fmt: '%s'\n\n", (char*)g_ui8Fmt);
+
+    //
+    // Now, get the value of each register and print it.
+    //
+    ux = 0;
+    while ( psDump[ux].ui32Offset != 0xFFFFFFFF )
+    {
+        //
+        // Format string is of the form: "  %8s (0x%08X) = 0x%08X\n"
+        //
+        ui32RegAddr = ui32BaseAddr + psDump[ux].ui32Offset;
+        am_util_stdio_printf((char*)g_ui8Fmt, psDump[ux].pi8RegName, ui32RegAddr, AM_REGVAL(ui32RegAddr));
+        ux++;
+    }
+}
+
+//*****************************************************************************
+//
+// printDump() - Print the registers for a given block.
+//
+// ui32NumModules    = Number of modules in this block
+//                     e.g. AM_REG_xxx_NUM_MODULES.
+// ui32BlockBaseAddr = Base address of this block.
+// ui32ModuleOffset  = Offset, in bytes, between modules in the block
+//                     e.g. AM_REG_IOMSTRn(1) - AM_REG_IOMSTRn(0).
+// ui32ModuleMask    = Mask of the desired block modules to be printed.
+//                     Each lower bit indicates a module.
+// pui8BlockName     = Name of the block (e.g "IOM").
+// psDump            = ptr to regdump structure for this block.
+//
+//*****************************************************************************
+static void
+dump_reg(uint32_t ui32NumModules,
+         uint32_t ui32BlockBaseAddr,
+         uint32_t ui32ModuleOffset,
+         uint32_t ui32ModuleMask,
+         char *pui8BlockName,
+         am_util_regdump_t *psDump)
+{
+    uint32_t ui32Module;
+
+    am_util_stdio_printf("%s registers:\n", pui8BlockName);
+
+    ui32Module = 0;
+    while ( ui32Module < ui32NumModules )
+    {
+        if ( (ui32NumModules > 1)  &&
+             !(ui32ModuleMask & (1 << ui32Module)) )
+        {
+            ui32Module++;
+            continue;
+        }
+        else
+        {
+            if ( ui32NumModules > 1 )
+            {
+                am_util_stdio_printf(" %s Module %d\n", pui8BlockName, ui32Module);
+            }
+        }
+
+        block_print(psDump, ui32BlockBaseAddr + (ui32ModuleOffset * ui32Module));
+
+        ui32Module++;
+        regdump_newline_print(1);
+    }
+    regdump_newline_print(1);
+}
+
+
+//*****************************************************************************
+//
+//! @brief Register dumping for debug purposes.
+//!
+//! This function dumps register values to the print port for debug purposes.
+//!
+//! @param ui32PeriphMask = an OR of the mask values to be printed.  e.g.
+//! AM_UTIL_REGDUMP_IOM | AM_UTIL_REGDUMP_GPIO
+//!
+//! @param ui32ModuleMask = A mask representing the modules (for a multi-module
+//! block such as IOM) to be dumped.  Bit0 represents module 0, etc.
+//! This parameter is ignored for single-module blocks such as GPIO.
+//! Pre-defined macros can be used to generate this mask, e.g.
+//!     REGDUMP_MOD0 | REGDUMP_MOD1 | REGDUMP_MOD2
+//!     or equivalently
+//!     REGDUMP_MOD_MAS(0,2)
+//!
+//*****************************************************************************
+
+void
+am_util_regdump_print(uint32_t ui32PeriphMask, uint32_t ui32ModuleMask)
+{
+    if ( ui32PeriphMask & AM_UTIL_REGDUMP_ADC )
+    {
+        dump_reg(AM_REG_ADC_NUM_MODULES, AM_REG_ADCn(0),
+                 AM_REG_ADCn(1) - AM_REG_ADCn(0),
+                 ui32ModuleMask, "ADC", &g_sRegdumpADC[0]);
+    }
+
+    if ( ui32PeriphMask & AM_UTIL_REGDUMP_CLKGEN )
+    {
+        dump_reg(AM_REG_CLKGEN_NUM_MODULES, AM_REG_CLKGENn(0),
+                 AM_REG_CLKGENn(1) - AM_REG_CLKGENn(0),
+                 ui32ModuleMask, "CLKGEN", &g_sRegdumpCLKGEN[0]);
+    }
+
+    if ( ui32PeriphMask & AM_UTIL_REGDUMP_CTIMER )
+    {
+        dump_reg(AM_REG_CTIMER_NUM_MODULES, AM_REG_CTIMERn(0),
+                 AM_REG_CTIMERn(1) - AM_REG_CTIMERn(0),
+                 ui32ModuleMask, "CTIMER", &g_sRegdumpCTIMER[0]);
+    }
+
+    if ( ui32PeriphMask & AM_UTIL_REGDUMP_GPIO )
+    {
+        dump_reg(AM_REG_GPIO_NUM_MODULES, AM_REG_GPIOn(0),
+                 AM_REG_GPIOn(1) - AM_REG_GPIOn(0),
+                 ui32ModuleMask, "GPIO", &g_sRegdumpGPIO[0]);
+    }
+
+    if ( ui32PeriphMask & AM_UTIL_REGDUMP_IOM )
+    {
+        dump_reg(AM_REG_IOMSTR_NUM_MODULES, AM_REG_IOMSTRn(0),
+                 AM_REG_IOMSTRn(1) - AM_REG_IOMSTRn(0),
+                 ui32ModuleMask, "IOM", &g_sRegdumpIOM[0]);
+    }
+
+    if ( ui32PeriphMask & AM_UTIL_REGDUMP_IOS )
+    {
+        dump_reg(AM_REG_IOSLAVE_NUM_MODULES, AM_REG_IOSLAVEn(0),
+                 AM_REG_IOSLAVEn(1) - AM_REG_IOSLAVEn(0),
+                 ui32ModuleMask, "IOS", &g_sRegdumpIOS[0]);
+    }
+
+    if ( ui32PeriphMask & AM_UTIL_REGDUMP_RSTGEN )
+    {
+        dump_reg(AM_REG_RSTGEN_NUM_MODULES, AM_REG_RSTGENn(0),
+                 AM_REG_RSTGENn(1) - AM_REG_RSTGENn(0),
+                 ui32ModuleMask, "RSTGEN", &g_sRegdumpRSTGEN[0]);
+    }
+
+    if ( ui32PeriphMask & AM_UTIL_REGDUMP_RTC )
+    {
+        dump_reg(AM_REG_RTC_NUM_MODULES, AM_REG_RTCn(0),
+                 AM_REG_RTCn(1) - AM_REG_RTCn(0),
+                 ui32ModuleMask, "RTC", &g_sRegdumpRTC[0]);
+    }
+
+    if ( ui32PeriphMask & AM_UTIL_REGDUMP_UART )
+    {
+        dump_reg(AM_REG_UART_NUM_MODULES, AM_REG_UARTn(0),
+                 AM_REG_UARTn(1) - AM_REG_UARTn(0),
+                 ui32ModuleMask, "UART", &g_sRegdumpUART[0]);
+    }
+
+    if ( ui32PeriphMask & AM_UTIL_REGDUMP_VCOMP )
+    {
+        dump_reg(AM_REG_VCOMP_NUM_MODULES, AM_REG_VCOMPn(0),
+                 AM_REG_VCOMPn(1) - AM_REG_VCOMPn(0),
+                 ui32ModuleMask, "VCOMP", &g_sRegdumpVCOMP[0]);
+    }
+
+    if ( ui32PeriphMask & AM_UTIL_REGDUMP_WDT )
+    {
+        dump_reg(AM_REG_WDT_NUM_MODULES, AM_REG_WDTn(0),
+                 AM_REG_WDTn(1) - AM_REG_WDTn(0),
+                 ui32ModuleMask, "WDT", &g_sRegdumpWDT[0]);
+    }
+
+    if ( ui32PeriphMask & AM_UTIL_REGDUMP_ITM )
+    {
+        dump_reg(AM_REG_ITM_NUM_MODULES, AM_REG_ITMn(0),
+                 AM_REG_ITMn(1) - AM_REG_ITMn(0),
+                 ui32ModuleMask, "ITM", &g_sRegdumpITM[0]);
+    }
+
+    if ( ui32PeriphMask & AM_UTIL_REGDUMP_NVIC )
+    {
+        dump_reg(AM_REG_NVIC_NUM_MODULES, AM_REG_NVICn(0),
+                 AM_REG_NVICn(1) - AM_REG_NVICn(0),
+                 ui32ModuleMask, "NVIC", &g_sRegdumpNVIC[0]);
+    }
+
+    if ( ui32PeriphMask & AM_UTIL_REGDUMP_SYSCTRL )
+    {
+        dump_reg(AM_REG_SYSCTRL_NUM_MODULES, AM_REG_SYSCTRLn(0),
+                 AM_REG_SYSCTRLn(1) - AM_REG_SYSCTRLn(0),
+                 ui32ModuleMask, "SYSCTRL", &g_sRegdumpSYSCTRL[0]);
+    }
+
+    if ( ui32PeriphMask & AM_UTIL_REGDUMP_SYSTICK )
+    {
+        dump_reg(AM_REG_SYSTICK_NUM_MODULES, AM_REG_SYSTICKn(0),
+                 AM_REG_SYSTICKn(1) - AM_REG_SYSTICKn(0),
+                 ui32ModuleMask, "SYSTICK", &g_sRegdumpSYSTICK[0]);
+    }
+
+    if ( ui32PeriphMask & AM_UTIL_REGDUMP_TPIU )
+    {
+        dump_reg(AM_REG_TPIU_NUM_MODULES, AM_REG_TPIUn(0),
+                 AM_REG_TPIUn(1) - AM_REG_TPIUn(0),
+                 ui32ModuleMask, "TPIU", &g_sRegdumpTPIU[0]);
+    }
+
+#if AM_PART_APOLLO2
+    am_util_stdio_printf("Apollo2 specific registers:\n\n");
+
+    if ( ui32PeriphMask & AM_UTIL_REGDUMP_CACHE )
+    {
+        dump_reg(AM_REG_CACHECTRL_NUM_MODULES, AM_REG_CACHECTRLn(0),
+                 AM_REG_CACHECTRLn(1) - AM_REG_CACHECTRLn(0),
+                 ui32ModuleMask, "CACHE", &g_sRegdumpCACHECTRL[0]);
+    }
+
+    if ( ui32PeriphMask & AM_UTIL_REGDUMP_PDM )
+    {
+        dump_reg(AM_REG_PDM_NUM_MODULES, AM_REG_PDMn(0),
+                 AM_REG_PDMn(1) - AM_REG_PDMn(0),
+                 ui32ModuleMask, "PDM", &g_sRegdumpPDM[0]);
+    }
+
+    if ( ui32PeriphMask & AM_UTIL_REGDUMP_PWRCTRL )
+    {
+        dump_reg(AM_REG_PWRCTRL_NUM_MODULES, AM_REG_PWRCTRLn(0),
+                 AM_REG_PWRCTRLn(1) - AM_REG_PWRCTRLn(0),
+                 ui32ModuleMask, "PWRCTRL", &g_sRegdumpPWRCTRL[0]);
+    }
+#endif // AM_PART_APOLLO2
+
+
+
+
+
+} // am_util_regdump_print()
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_regdump.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_regdump.h
new file mode 100644
index 000000000..090595884
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_regdump.h
@@ -0,0 +1,172 @@
+//*****************************************************************************
+//
+//! @file am_util_regdump.h
+//!
+//! @brief Dump specified registers for debug purposes.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_UTIL_REGDUMP_H
+#define AM_UTIL_REGDUMP_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include "am_mcu_apollo.h"
+
+//
+// Apollo peripherals
+//
+#define AM_UTIL_REGDUMP_ADC             (1 << 0)
+#define AM_UTIL_REGDUMP_CLKGEN          (1 << 1)
+#define AM_UTIL_REGDUMP_CTIMER          (1 << 2)
+#define AM_UTIL_REGDUMP_GPIO            (1 << 3)
+#define AM_UTIL_REGDUMP_IOM             (1 << 4)
+#define AM_UTIL_REGDUMP_IOS             (1 << 5)
+#define AM_UTIL_REGDUMP_MCUCTRL         (1 << 6)
+#define AM_UTIL_REGDUMP_RSTGEN          (1 << 7)
+#define AM_UTIL_REGDUMP_RTC             (1 << 8)
+#define AM_UTIL_REGDUMP_UART            (1 << 9)
+#define AM_UTIL_REGDUMP_VCOMP           (1 << 10)
+#define AM_UTIL_REGDUMP_WDT             (1 << 11)
+
+//
+// Apollo2 new peripherals
+//
+#define AM_UTIL_REGDUMP_CACHE           (1 << 12)
+#define AM_UTIL_REGDUMP_PDM             (1 << 13)
+#define AM_UTIL_REGDUMP_PWRCTRL         (1 << 14)
+
+//
+// ARM Core blocks
+//
+#define AM_UTIL_REGDUMP_ITM             (1 << 25)
+#define AM_UTIL_REGDUMP_NVIC            (1 << 26)
+#define AM_UTIL_REGDUMP_SYSCTRL         (1 << 27)
+#define AM_UTIL_REGDUMP_SYSTICK         (1 << 28)
+#define AM_UTIL_REGDUMP_TPIU            (1 << 29)
+
+
+
+//*****************************************************************************
+//
+// Module mask definitions
+//
+//*****************************************************************************
+#define AM_UTIL_REGDUMP_APOLLO                  \
+        (   AM_UTIL_REGDUMP_ADC     |           \
+            AM_UTIL_REGDUMP_CLKGEN  |           \
+            AM_UTIL_REGDUMP_CTIMER  |           \
+            AM_UTIL_REGDUMP_GPIO    |           \
+            AM_UTIL_REGDUMP_IOM     |           \
+            AM_UTIL_REGDUMP_IOS     |           \
+            AM_UTIL_REGDUMP_MCUCTRL |           \
+            AM_UTIL_REGDUMP_RSTGEN  |           \
+            AM_UTIL_REGDUMP_RTC     |           \
+            AM_UTIL_REGDUMP_UART    |           \
+            AM_UTIL_REGDUMP_VCOMP   |           \
+            AM_UTIL_REGDUMP_WDT )
+
+#define AM_UTIL_REGDUMP_APOLLO2                 \
+        (   AM_UTIL_REGDUMP_CACHE   |           \
+            AM_UTIL_REGDUMP_PDM     |           \
+            AM_UTIL_REGDUMP_PWRCTRL )
+
+#define AM_UTIL_REGDUMP_CORE                    \
+        (   AM_UTIL_REGDUMP_ITM     |           \
+            AM_UTIL_REGDUMP_NVIC    |           \
+            AM_UTIL_REGDUMP_SYSCTRL |           \
+            AM_UTIL_REGDUMP_SYSTICK |           \
+            AM_UTIL_REGDUMP_TPIU )
+
+//
+// Get a register dump of ALL modules in a block.
+//
+#ifdef AM_PART_APOLLO
+#define AM_UTIL_REGDUMP_ALL                     \
+        (   AM_UTIL_REGDUMP_APOLLO  |           \
+            AM_UTIL_REGDUMP_CORE )
+#endif // PART_APOLLO
+
+#ifdef AM_PART_APOLLO2
+#define AM_UTIL_REGDUMP_ALL                     \
+        (   AM_UTIL_REGDUMP_APOLLO  |           \
+            AM_UTIL_REGDUMP_APOLLO2 |           \
+            AM_UTIL_REGDUMP_CORE )
+#endif // PART_APOLLO
+
+//
+// Get a register dump of ALL modules in a block.
+//
+#define AM_UTIL_REGDUMP_MOD_ALL             0xFFFFFFFF
+
+//
+// This macro determines a mask given the first and last modules desired. e.g.
+//  REGDUMP_MOD_MASK(2,4)       // Dump regs for modules 2, 3, and 4
+//
+#define REGDUMP_MOD_MASK(modfirst, modlast)     \
+        (((1 << (modlast - modfirst + 1)) - 1) << modfirst)
+
+//
+// These macros determine a single module.  e.g.
+//  REGDUMP_MOD2 | REGDUMP_MOD4    // Dump regs for modules 2 and 4 (skip 3)
+//
+#define REGDUMP_MOD(n)                  (1 << n)
+#define REGDUMP_MOD0                    (REGDUMP_MOD(0))
+#define REGDUMP_MOD1                    (REGDUMP_MOD(1))
+#define REGDUMP_MOD2                    (REGDUMP_MOD(2))
+#define REGDUMP_MOD3                    (REGDUMP_MOD(3))
+#define REGDUMP_MOD4                    (REGDUMP_MOD(4))
+#define REGDUMP_MOD5                    (REGDUMP_MOD(5))
+#define REGDUMP_MOD6                    (REGDUMP_MOD(6))
+#define REGDUMP_MOD7                    (REGDUMP_MOD(7))
+
+//*****************************************************************************
+//
+// External function definitions
+//
+//*****************************************************************************
+extern void am_util_regdump_print(uint32_t ui32PeriphMask, uint32_t ui32ModuleMask);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_UTIL_REGDUMP_H
+
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_ring_buffer.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_ring_buffer.c
new file mode 100644
index 000000000..d3742db4f
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_ring_buffer.c
@@ -0,0 +1,217 @@
+//*****************************************************************************
+//
+//! @file am_util_ring_buffer.c
+//!
+//! @brief Some helper functions for implementing and managing a ring buffer.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "am_util_ring_buffer.h"
+
+//*****************************************************************************
+//
+//! @brief Initializes a ring buffer structure.
+//!
+//! @param psBuffer is a pointer to the buffer structure to be initialized.
+//!
+//! @param pvArray is a pointer to the array that the new ringbuffer will use
+//! for storage space
+//!
+//! @param ui32Bytes is the total number of bytes that the ringbuffer will be
+//! allowed to use.
+//!
+//! This function should be called on a ring buffer structure before it is
+//! used. If this function is called on a ring buffer that is already being
+//! used, it will "erase" the buffer, effectively removing all of the buffer
+//! contents from the perspective of the other ring buffer access functions.
+//! The data will remain in memory, but it will be overwritten as the buffer is
+//! used.
+//!
+//! @note This operation is not inherently thread-safe, so the caller must make
+//! sure that it is appropriately guarded from interrupts and context switches.
+//!
+//! @return
+//
+//*****************************************************************************
+void
+am_util_ring_buffer_init(am_util_ring_buffer_t *psBuffer, void *pvArray,
+                         uint32_t ui32Bytes)
+{
+    psBuffer->ui32WriteIndex = 0;
+    psBuffer->ui32ReadIndex = 0;
+    psBuffer->ui32Length = 0;
+    psBuffer->ui32Capacity = ui32Bytes;
+    psBuffer->pui8Data = (uint8_t *)pvArray;
+}
+
+//*****************************************************************************
+//
+//! @brief Write a single byte to the ring buffer.
+//!
+//! @param psBuffer is the address of the ring buffer structure to be written.
+//! @param ui8Value is the byte to be added to the ring buffer.
+//!
+//! This function will write a single byte to the given ring buffer. Make sure
+//! that the ring buffer is not already full when calling this function. If the
+//! ring buffer is already full, this function will fail silently.
+//!
+//! @note This operation is not inherently thread-safe, so the caller must make
+//! sure that it is appropriately guarded from interrupts and context switches.
+//!
+//! @return True if the data was written to the buffer. False for insufficient
+//! space.
+//
+//*****************************************************************************
+bool
+am_util_ring_buffer_write(am_util_ring_buffer_t *psBuffer, void *pvSource,
+                          uint32_t ui32Bytes)
+{
+    uint32_t i;
+    uint8_t *pui8Source;
+
+    pui8Source = (uint8_t *) pvSource;
+
+    //
+    // Check to make sure that the buffer isn't already full
+    //
+    if ( am_util_ring_buffer_space_left(psBuffer) >= ui32Bytes )
+    {
+        //
+        // Loop over the bytes in the source array.
+        //
+        for ( i = 0; i < ui32Bytes; i++ )
+        {
+            //
+            // Write the value to the buffer.
+            //
+            psBuffer->pui8Data[psBuffer->ui32WriteIndex] = pui8Source[i];
+
+            //
+            // Advance the write index, making sure to wrap if necessary.
+            //
+            psBuffer->ui32WriteIndex = ((psBuffer->ui32WriteIndex + 1) %
+                                        psBuffer->ui32Capacity);
+        }
+
+        //
+        // Update the length value appropriately.
+        //
+        psBuffer->ui32Length += ui32Bytes;
+
+        //
+        // Report a success.
+        //
+        return true;
+    }
+    else
+    {
+        //
+        // The ring buffer can't fit the amount of data requested. Return a
+        // failure.
+        //
+        return false;
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Read a single byte from the ring buffer.
+//!
+//! @param psBuffer is the address of the ring buffer structure to be read.
+//!
+//! This function will write a single byte to the given ring buffer. Make sure
+//! that the ring buffer is not already empty. If the ring buffer is empty,
+//! this function will just return a NULL character.
+//!
+//! @note This operation is not inherently thread-safe, so the caller must make
+//! sure that it is appropriately guarded from interrupts and context switches.
+//!
+//! @return The byte read from the buffer, or a NULL if the buffer was empty.
+//
+//*****************************************************************************
+bool
+am_util_ring_buffer_read(am_util_ring_buffer_t *psBuffer, void *pvDest,
+                         uint32_t ui32Bytes)
+{
+    uint32_t i;
+    uint8_t *pui8Dest;
+
+    pui8Dest = (uint8_t *) pvDest;
+
+    //
+    // Check to make sure that the buffer isn't empty
+    //
+    if ( am_util_ring_buffer_data_left(psBuffer) >= ui32Bytes )
+    {
+        //
+        // Loop over the bytes in the destination array.
+        //
+        for ( i = 0; i < ui32Bytes; i++ )
+        {
+            //
+            // Grab the next value from the buffer.
+            //
+            pui8Dest[i] = psBuffer->pui8Data[psBuffer->ui32ReadIndex];
+
+            //
+            // Advance the read index, wrapping if needed.
+            //
+            psBuffer->ui32ReadIndex = ((psBuffer->ui32ReadIndex + 1) %
+                                       psBuffer->ui32Capacity);
+        }
+
+        //
+        // Adjust the length value to reflect the change.
+        //
+        psBuffer->ui32Length -= ui32Bytes;
+
+        //
+        // Report a success.
+        //
+        return true;
+    }
+    else
+    {
+        //
+        // If the buffer didn't have enough data, just return a zero.
+        //
+        return false;
+    }
+}
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_ring_buffer.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_ring_buffer.h
new file mode 100644
index 000000000..8857736f6
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_ring_buffer.h
@@ -0,0 +1,104 @@
+//*****************************************************************************
+//
+//! @file am_util_ring_buffer.h
+//!
+//! @brief Some helper functions for implementing and managing a ring buffer.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_UTIL_RING_BUFFER_H
+#define AM_UTIL_RING_BUFFER_H
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+//*****************************************************************************
+//
+// External variable definitions
+//
+//*****************************************************************************
+typedef struct
+{
+    volatile uint8_t *pui8Data;
+    volatile uint32_t ui32WriteIndex;
+    volatile uint32_t ui32ReadIndex;
+    volatile uint32_t ui32Length;
+    volatile uint32_t ui32Capacity;
+}
+am_util_ring_buffer_t;
+
+//*****************************************************************************
+//
+// Function-like macros.
+//
+//*****************************************************************************
+#define am_util_ring_buffer_empty(psBuffer)                                   \
+    ((psBuffer)->ui32Length == 0)
+
+#define am_util_ring_buffer_full(psBuffer)                                    \
+    ((psBuffer)->ui32Length == (psBuffer)->ui32Capacity)
+
+#define am_util_ring_buffer_space_left(psBuffer)                              \
+    ((psBuffer)->ui32Capacity - (psBuffer)->ui32Length)
+
+#define am_util_ring_buffer_data_left(psBuffer)                               \
+    ((psBuffer)->ui32Length)
+
+//*****************************************************************************
+//
+// External function definitions
+//
+//*****************************************************************************
+void am_util_ring_buffer_init(am_util_ring_buffer_t *psBuffer,
+                              void *pvArray, uint32_t ui32Bytes);
+
+bool am_util_ring_buffer_write(am_util_ring_buffer_t *psBuffer,
+                               void *pvSource, uint32_t ui32Bytes);
+
+bool am_util_ring_buffer_read(am_util_ring_buffer_t *psBuffer,
+                              void *pvDest, uint32_t ui32Bytes);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_UTIL_RING_BUFFER_H
+
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_stdio.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_stdio.c
new file mode 100644
index 000000000..78bc9c166
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_stdio.c
@@ -0,0 +1,1208 @@
+//*****************************************************************************
+//
+//! @file am_util_stdio.c
+//!
+//! @brief A few printf-style functions for use with Ambiq products
+//!
+//! Functions for performing printf-style operations without dynamic memory
+//! allocation.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <stdarg.h>
+#include "am_util_stdio.h"
+
+//*****************************************************************************
+//
+// Global Variables
+//
+//*****************************************************************************
+
+// function pointer for printf
+am_util_stdio_print_char_t g_pfnCharPrint;
+
+// buffer for printf
+static char g_prfbuf[AM_PRINTF_BUFSIZE];
+
+// Flag to do conversion of '\n' to '\n\r' in sprintf()
+static bool g_bTxtXlate = false;
+
+//*****************************************************************************
+//
+//! @brief Sets the interface for printf calls.
+//!
+//! @param pfnCharPrint - Function pointer to be used to print to interface
+//!
+//! This function initializes the global print function which is used for
+//! printf. This allows users to define their own printf interface and pass it
+//! in as a am_util_stdio_print_char_t type.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_util_stdio_printf_init(am_util_stdio_print_char_t pfnCharPrint)
+{
+    g_pfnCharPrint = pfnCharPrint;
+}
+
+//*****************************************************************************
+//
+//! @brief Converts strings to 32-bit unsigned integers.
+//!
+//! @param *str - Pointer to the string to convert
+//! @param **endptr - strtoul will set this to the char after the converted num
+//! @param base - Base of the number as written in the input string.
+//!
+//! This function was implemented in a way similar to the strtoul function
+//! found in the C standard library. It will attempt to extract a numerical
+//! value from the input string, and return it to the caller. Invalid input
+//! strings will return a value of zero.
+//!
+//! @return uint32_t representing the numerical value from the string.
+//
+//*****************************************************************************
+uint32_t
+am_util_stdio_strtoul(const char *str, char **endptr, int base)
+{
+    char *pos;
+    uint32_t ui32BaseVal;
+    uint32_t ui32RetVal;
+
+    //
+    // Prepare a pointer to start advancing through the string.
+    //
+    pos = (char *)str;
+
+    //
+    // Determine what base we are using. Default to '16', but change to other
+    // values as specified by the user. If the user didn't specify anything,
+    // try to guess the base value from looking at the first few characters of
+    // the input
+    //
+    ui32BaseVal = 16;
+
+    //
+    // Switch to octal for a leading zero
+    //
+    if (*pos == '0')
+    {
+        ui32BaseVal = 8;
+        pos++;
+
+        //
+        // Switch back to hex for a leading '0x'
+        //
+        if (*pos == 'x')
+        {
+            ui32BaseVal = 16;
+            pos++;
+        }
+    }
+
+    //
+    // No matter what, if the user specified a base value, use that as the real
+    // base value.
+    //
+    if (base)
+    {
+        ui32BaseVal = base;
+    }
+
+    //
+    // Start accumulating the converted integer value
+    //
+    ui32RetVal = 0;
+
+    //
+    // Loop through the digits, one character at a time. End the loop if the
+    // number is out of range
+    //
+    while ((*pos >= 'a' && *pos <= 'f' && ui32BaseVal == 16) ||
+           (*pos >= 'A' && *pos <= 'F' && ui32BaseVal == 16) ||
+           (*pos >= '0' && *pos <= '9'))
+    {
+        //
+        // Make sure to stop if we hit a NULL byte.
+        //
+        if (*pos == 0)
+        {
+            break;
+        }
+
+        //
+        // Multiply by the base value to move up one 'digit'
+        //
+        ui32RetVal *= ui32BaseVal;
+
+        //
+        // Add the value of the next character.
+        //
+        if (*pos >= '0' && *pos <= '9')
+        {
+            ui32RetVal += *pos - '0';
+        }
+        else if (*pos >= 'A' && *pos <= 'F')
+        {
+            ui32RetVal += (*pos - 'A') + 10;
+        }
+        else
+        {
+            ui32RetVal += (*pos - 'a') + 10;
+        }
+
+        //
+        // Grab the next character.
+        //
+        pos++;
+    }
+
+    //
+    // If we get here, hopefully it means that we have parsed a number
+    // correctly. The 'pos' pointer should already be pointing at the character
+    // right after the last valid number, so set the enptr appropriately, and
+    // return the calculated numerical value of the string.
+    //
+    if (endptr)
+    {
+        *endptr = pos;
+    }
+
+    return ui32RetVal;
+}
+
+//*****************************************************************************
+//
+//  Divide an unsigned 32-bit value by 10.
+//
+//  Note: Adapted from Ch10 of Hackers Delight (hackersdelight.org).
+//
+//*****************************************************************************
+static uint64_t
+divu64_10(uint64_t ui64Val)
+{
+    uint64_t q64, r64;
+    uint32_t q32, r32, ui32Val;
+
+    //
+    // If a 32-bit value, use the more optimal 32-bit routine.
+    //
+    if ( ui64Val >> 32 )
+    {
+        q64 = (ui64Val>>1) + (ui64Val>>2);
+        q64 += (q64 >> 4);
+        q64 += (q64 >> 8);
+        q64 += (q64 >> 16);
+        q64 += (q64 >> 32);
+        q64 >>= 3;
+        r64 = ui64Val - q64*10;
+        return q64 + ((r64 + 6) >> 4);
+    }
+    else
+    {
+        ui32Val = (uint32_t)(ui64Val & 0xffffffff);
+        q32 = (ui32Val>>1) + (ui32Val>>2);
+        q32 += (q32 >> 4);
+        q32 += (q32 >> 8);
+        q32 += (q32 >> 16);
+        q32 >>= 3;
+        r32 = ui32Val - q32*10;
+        return (uint64_t)(q32 + ((r32 + 6) >> 4));
+    }
+}
+
+//*****************************************************************************
+//
+// Return the number of decimal digits in an uint64_t.
+//
+// example: 10000 return 5, 123 returns 3.
+//
+//*****************************************************************************
+static int
+ndigits_in_u64(uint64_t ui64Val)
+{
+    int iNDigits = ui64Val ? 0 : 1;
+
+    while ( ui64Val )
+    {
+        //
+        // ui32Val /= 10;
+        //
+        ui64Val = divu64_10(ui64Val);
+        ++iNDigits;
+    }
+
+    return iNDigits;
+}
+
+//*****************************************************************************
+//
+// Return the number of decimal digits in a 64-bit integer.
+//
+// Note: Does not include the '-' sign.
+//
+// example: -3 returns 1, 3 returns 1, 15 returns 2, -15 returns 2, ...
+//
+//*****************************************************************************
+static int
+ndigits_in_i64(int64_t i64Val)
+{
+    if ( i64Val < 0 )
+    {
+        //
+        // Get absolute value
+        //
+        i64Val = -i64Val;
+    }
+
+    return ndigits_in_u64((uint64_t) i64Val);
+}
+
+//*****************************************************************************
+//
+// Return the number of hex digits in an uint64_t.
+//
+//*****************************************************************************
+static int
+ndigits_in_hex(uint64_t ui64Val)
+{
+    int iDigits = ui64Val ? 0 : 1;
+
+    while ( ui64Val )
+    {
+        ui64Val >>= 4;
+        ++iDigits;
+    }
+
+    return iDigits;
+}
+
+//*****************************************************************************
+//
+// Converts a string representing a decimal value to an int32_t.
+//
+// Returns the int32_t integer value.
+//
+// Note: If a count of the number of chars is desired, then provide
+// pui32CharCnt.
+//
+//*****************************************************************************
+static uint32_t
+decstr_to_int(const char *pcStr, uint32_t *pui32CharCnt)
+{
+    bool bNeg = false;
+    uint32_t ui32Val = 0, uCnt = 0;
+
+    if ( *pcStr == '-')
+    {
+        bNeg = true;
+        pcStr++;
+        uCnt++;
+    }
+
+    while ( *pcStr >= '0'  &&  *pcStr <= '9' )
+    {
+        ++uCnt;
+
+        //
+        // Multiply accumulated value by 10.
+        //
+        ui32Val *= 10;
+
+        //
+        // Add in the new low digit.
+        //
+        ui32Val += (*pcStr - '0');
+        pcStr++;
+    }
+
+    if ( pui32CharCnt )
+    {
+        *pui32CharCnt = uCnt;
+    }
+
+    return bNeg ? -ui32Val : ui32Val;
+}
+
+//*****************************************************************************
+//
+// Converts ui64Val to a string.
+// Note: pcBuf[] must be sized for a minimum of 21 characters.
+//
+// Returns the number of decimal digits in the string.
+//
+// NOTE: If pcBuf is NULL, will compute a return ui64Val only (no chars
+// written).
+//
+//*****************************************************************************
+static int
+uint64_to_str(uint64_t ui64Val, char *pcBuf)
+{
+    char tbuf[25];
+    int ix = 0, iNumDig = 0;
+    unsigned uMod;
+    uint64_t u64Tmp;
+
+    do
+    {
+        //
+        // Divide by 10
+        //
+        u64Tmp = divu64_10(ui64Val);
+
+        //
+        // Get modulus
+        //
+        uMod = ui64Val - (u64Tmp * 10);
+
+        tbuf[ix++] = uMod + '0';
+        ui64Val = u64Tmp;
+    } while ( ui64Val );
+
+    //
+    // Save the total number of digits
+    //
+    iNumDig = ix;
+
+    //
+    // Now, reverse the buffer when saving to the caller's buffer.
+    //
+    if ( pcBuf )
+    {
+        while ( ix-- )
+        {
+            *pcBuf++ = tbuf[ix];
+        }
+
+        //
+        // Terminate the caller's buffer
+        //
+        *pcBuf = 0x00;
+    }
+
+    return iNumDig;
+}
+
+//*****************************************************************************
+//
+// Converts ui64Val to a hex string.  Alpha chars are lower case.
+// Input:
+//  ui64Val = Value to be converted.
+//  pcBuf[] must be sized for a minimum of 17 characters.
+//
+// Returns the number of hex digits required for ui64Val (does not
+//  include the terminating NULL char in the string).
+//
+// NOTE: If pcBuf is NULL, will compute a return value only (no chars
+// written).
+//
+//*****************************************************************************
+static int
+uint64_to_hexstr(uint64_t ui64Val, char *pcBuf, bool bLower)
+{
+    int iNumDig, ix = 0;
+    char cCh, tbuf[20];
+
+    if ( ui64Val == 0 )
+    {
+        tbuf[ix++] = '0';   // Print a '0'
+    }
+
+    while ( ui64Val )
+    {
+        cCh = ui64Val & 0xf;
+
+        //
+        // Alpha character
+        //
+        if ( cCh > 9 )
+        {
+            cCh += bLower ? 0x27 : 0x7;
+        }
+
+        tbuf[ix++] = cCh + '0';
+        ui64Val >>= 4;
+    }
+
+    //
+    // Save the total number of digits
+    //
+    iNumDig = ix;
+
+    //
+    // Now, reverse the buffer when saving to the callers buffer.
+    //
+    if (pcBuf)
+    {
+        while (ix--)
+        {
+            *pcBuf++ = tbuf[ix];
+        }
+
+        //
+        // Terminate the caller's buffer
+        //
+        *pcBuf = 0;
+    }
+
+    return iNumDig;
+}
+
+//*****************************************************************************
+//
+// Return length of the given string.
+//
+//*****************************************************************************
+static uint32_t
+simple_strlen(char *pcBuf)
+{
+    uint32_t ui32RetVal = 0;
+    if ( !pcBuf )
+    {
+        return ui32RetVal;
+    }
+
+    while ( *pcBuf++ )
+    {
+        ui32RetVal++;
+    }
+    return ui32RetVal;
+}
+
+//*****************************************************************************
+//
+// Pad a string buffer with pad characters.
+//
+//*****************************************************************************
+static int32_t
+padbuffer(char *pcBuf, uint8_t cPadChar, int32_t i32NumChars)
+{
+    int32_t i32Cnt = 0;
+
+    if ( i32NumChars <= 0 )
+    {
+        return i32Cnt;
+    }
+
+    while ( i32NumChars-- )
+    {
+        if ( pcBuf )
+        {
+            *pcBuf++ = cPadChar;
+        }
+        i32Cnt++;
+    }
+
+    return i32Cnt;
+}
+
+//*****************************************************************************
+//
+//! @brief Text mode translates linefeed (\n) characters to carriage return/
+//! linefeed (CR/LF) combinations in printf() and sprintf() functions.
+//!
+//! @param bSetTextTranslationMode - true: Do LF to CR/LF translation.
+//! false: Don't do the text mode translation.
+//!
+//! This function causes the printf() and sprintf() functions to translate
+//! newline characters (\\n) into CR/LF (\\r\\n) combinations.
+//!
+//! @return Previous mode.
+//
+//*****************************************************************************
+bool
+am_util_stdio_textmode_set(bool bSetTextTranslationMode)
+{
+    bool bRet = g_bTxtXlate;
+
+    //
+    // true=cvt LF chars to CR/LF
+    //
+    g_bTxtXlate = bSetTextTranslationMode;
+
+    //
+    // return previous mode.
+    //
+    return bRet;
+}
+
+//*****************************************************************************
+//
+//! @brief Float to ASCII text.  A basic implementation for providing
+//!  support for %f.
+//!
+//! @param
+//!     fValue = Float value to be converted.
+//!     pcBuf  = Buffer to place string AND input of buffer size.
+//!     IMPORTANT: On entry, the first 32-bit word of pcBuf must
+//!                contain the size (in bytes) of the buffer!  The
+//!                recommended size is at least 16 bytes.
+//!
+//! This function performs a basic translation of a floating point single
+//! precision value to a string.
+//!
+//! @return Previous mode.
+//
+//*****************************************************************************
+#define AM_FTOA_ERR_VAL_TOO_SMALL   -1
+#define AM_FTOA_ERR_VAL_TOO_LARGE   -2
+#define AM_FTOA_ERR_BUFSIZE         -3
+
+typedef union
+{
+    int32_t I32;
+    float F;
+} i32fl_t;
+
+static int ftoa(float fValue, char *pcBuf, int iPrecision)
+{
+    i32fl_t unFloatValue;
+    int iExp2, iBufSize;
+    int32_t i32Mantissa, i32IntPart, i32FracPart;
+    char *pcBufInitial;
+
+    iBufSize = *(uint32_t*)pcBuf;
+    if (iBufSize < 4)
+    {
+        return AM_FTOA_ERR_BUFSIZE;
+    }
+
+    if (fValue == 0.0f)
+    {
+        // "0.0"
+        *(uint32_t*)pcBuf = 0x00 << 24 | ('0' << 16) | ('.' << 8) | ('0' << 0);
+        return 3;
+    }
+
+    pcBufInitial = pcBuf;
+
+    unFloatValue.F = fValue;
+
+    iExp2 = ((unFloatValue.I32 >> 23) & 0x000000FF) - 127;
+    i32Mantissa = (unFloatValue.I32 & 0x00FFFFFF) | 0x00800000;
+    i32FracPart = 0;
+    i32IntPart = 0;
+
+    if (iExp2 >= 31)
+    {
+        return AM_FTOA_ERR_VAL_TOO_LARGE;
+    }
+    else if (iExp2 < -23)
+    {
+        return AM_FTOA_ERR_VAL_TOO_SMALL;
+    }
+    else if (iExp2 >= 23)
+    {
+        i32IntPart = i32Mantissa << (iExp2 - 23);
+    }
+    else if (iExp2 >= 0)
+    {
+        i32IntPart = i32Mantissa >> (23 - iExp2);
+        i32FracPart = (i32Mantissa << (iExp2 + 1)) & 0x00FFFFFF;
+    }
+    else // if (iExp2 < 0)
+    {
+        i32FracPart = (i32Mantissa & 0x00FFFFFF) >> -(iExp2 + 1);
+    }
+
+    if (unFloatValue.I32 < 0)
+    {
+        *pcBuf++ = '-';
+    }
+
+    if (i32IntPart == 0)
+    {
+        *pcBuf++ = '0';
+    }
+    else
+    {
+        if (i32IntPart > 0)
+        {
+            uint64_to_str(i32IntPart, pcBuf);
+        }
+        else
+        {
+            *pcBuf++ = '-';
+            uint64_to_str(-i32IntPart, pcBuf);
+        }
+        while (*pcBuf)    // Get to end of new string
+        {
+            pcBuf++;
+        }
+    }
+
+    //
+    // Now, begin the fractional part
+    //
+    *pcBuf++ = '.';
+
+    if (i32FracPart == 0)
+    {
+        *pcBuf++ = '0';
+    }
+    else
+    {
+        int jx, iMax;
+
+        iMax = iBufSize - (pcBuf - pcBufInitial) - 1;
+        iMax = (iMax > iPrecision) ? iPrecision : iMax;
+
+        for (jx = 0; jx < iMax; jx++)
+        {
+            i32FracPart *= 10;
+            *pcBuf++ = (i32FracPart >> 24) + '0';
+            i32FracPart &= 0x00FFFFFF;
+        }
+
+        //
+        // Remove trailing zeros
+        //
+        --pcBuf;
+        while ((*pcBuf == '0')  &&  (*(pcBuf-1) != '.'))
+        {
+            --pcBuf;
+        }
+        ++pcBuf;
+    }
+
+    //
+    // Terminate the string and we're done
+    //
+    *pcBuf = 0x00;
+
+    return (pcBuf - pcBufInitial);
+} // ftoa()
+
+//******************************************************************************
+//
+//! @brief Format data into string. (va_list implementation)
+//!
+//! @param *pcBuf - Pointer to the buffer to store the string
+//! @param *pcFmt - Pointer to formatter string
+//!
+//! A lite version of vsprintf().
+//!      Currently handles the following specifiers:
+//!      %c
+//!      %s
+//!      %[0][width]d (also %i)
+//!      %[0][width]u
+//!      %[0][width]x
+//!      %[.precision]f
+//!
+//!     Note than any unrecognized or unhandled format specifier character is
+//!     simply printed.  For example, "%%" will print a '%' character.
+//!
+//! @return uint32_t representing the number of characters printed.
+//
+//******************************************************************************
+uint32_t
+am_util_stdio_vsprintf(char *pcBuf, const char *pcFmt, va_list pArgs)
+{
+    char *pcStr;
+    uint64_t ui64Val;
+    int64_t i64Val;
+    uint32_t ui32NumChars, ui32CharCnt = 0;
+    int iWidth, iVal, iPrecision;
+    uint8_t ui8CharSpecifier, ui8PadChar;
+    bool bLower, bLongLong, bNeg;
+    uint32_t ui32strlen = 0;
+
+    while ( *pcFmt != 0x0 )
+    {
+        iPrecision = 6;             // printf() default precision for %f is 6
+
+        if ( *pcFmt != '%' )
+        {
+            //
+            // Accumulate the string portion of the format specification.
+            //
+            if ( pcBuf )
+            {
+                // If '\n', convert to '\r\n'
+                if ( *pcFmt == '\n'  &&  g_bTxtXlate )
+                {
+                    *pcBuf++ = '\r';
+                    ++ui32CharCnt;
+                }
+                *pcBuf++ = *pcFmt;
+            }
+
+            ++pcFmt;
+            ++ui32CharCnt;
+            continue;
+        }
+
+        //
+        // Handle the specifier.
+        //
+        ++pcFmt;
+        bLower = bLongLong = false;
+
+        //
+        // Default to space as ui8PadChar
+        //
+        ui8PadChar = ' ';
+
+        if ( *pcFmt == '0' )
+        {
+            ui8PadChar = '0';
+            ++pcFmt;
+        }
+
+        //
+        // Width specifier
+        //
+        iWidth = decstr_to_int(pcFmt, &ui32NumChars);
+        pcFmt += ui32NumChars;
+
+        //
+        // For now, only support a negative width specifier for %s
+        //
+        if ( ( *pcFmt != 's' )  &&  ( iWidth < 0 ) )
+        {
+            iWidth = -iWidth;
+        }
+
+        //
+        // Check for precision specifier
+        //
+        if (*pcFmt == '.')
+        {
+            ++pcFmt;
+            iPrecision = decstr_to_int(pcFmt, &ui32NumChars);
+            pcFmt += ui32NumChars;
+        }
+
+        //
+        // Check for the long or long long length field sub-specifiers, 'l' or
+        // 'll', which must be a modifier for either 'd', 'i', 'u', 'x', or 'X'
+        // (or even 'o', which is not currently supported). Other sub-specifiers
+        // like 'hh','h', etc. are not currently handled.
+        // Note - 'l' is used in Coremark, a primary reason it's supported here.
+        //
+        if ( *pcFmt == 'l' )
+        {
+            pcFmt++;
+            if ( *pcFmt == 'l' )    // "ll" (long long)
+            {
+                pcFmt++;
+                bLongLong = true;
+            }
+        }
+
+        switch ( *pcFmt )
+        {
+            case 'c':
+                ui8CharSpecifier = va_arg(pArgs, uint32_t);
+
+                if ( pcBuf )
+                {
+                    *pcBuf++ = ui8CharSpecifier;
+                }
+
+                ++ui32CharCnt;
+                break;
+
+            case 's':
+                pcStr = va_arg(pArgs, char *);
+
+                //
+                // For %s, we support the width specifier. If iWidth is negative
+                // the string is left-aligned (padding on the right).  Otherwise
+                // the string is padded at the beginning with spaces.
+                //
+                ui32strlen = simple_strlen(pcStr);
+                if ( iWidth > 0 )
+                {
+                    // Pad the beginning of the string (right-aligned).
+                    if ( ui32strlen < iWidth )
+                    {
+                        // String needs some padding.
+                        iWidth -= ui32strlen;
+                        iWidth = padbuffer(pcBuf, ui8PadChar, iWidth);
+                        pcBuf += pcBuf ? iWidth : 0;
+                        ui32CharCnt += iWidth;
+                        iWidth = 0;
+                    }
+                }
+
+                while (*pcStr != 0x0)
+                {
+                    if ( pcBuf )
+                    {
+                        *pcBuf++ = *pcStr;
+                    }
+
+                    ++pcStr;
+                    ++ui32CharCnt;
+                }
+
+                if ( iWidth )
+                {
+                    iWidth = -iWidth;
+
+                    // Pad the end of the string (left-aligned).
+                    if ( ui32strlen < iWidth )
+                    {
+                        // String needs some padding.
+                        iWidth -= ui32strlen;
+                        iWidth = padbuffer(pcBuf, ui8PadChar, iWidth);
+                        pcBuf += pcBuf ? iWidth : 0;
+                        ui32CharCnt += iWidth;
+                        iWidth = 0;
+                    }
+                }
+                break;
+
+            case 'x':
+                bLower = true;
+            case 'X':
+                ui64Val = bLongLong ? va_arg(pArgs, uint64_t) :
+                                      va_arg(pArgs, uint32_t);
+
+                if ( iWidth )
+                {
+                    //
+                    // Compute # of leading chars
+                    //
+                    iWidth -= ndigits_in_hex(ui64Val);
+
+                    iWidth = padbuffer(pcBuf, ui8PadChar, iWidth);
+                    pcBuf += pcBuf ? iWidth : 0;
+                    ui32CharCnt += iWidth;
+                    iWidth = 0;
+                }
+
+                iVal = uint64_to_hexstr(ui64Val, pcBuf, bLower);
+
+                if ( pcBuf )
+                {
+                    pcBuf += iVal;
+                }
+
+                ui32CharCnt += iVal;
+                break;
+
+            case 'u':
+                ui64Val = bLongLong ? va_arg(pArgs, uint64_t) :
+                                      va_arg(pArgs, uint32_t);
+
+                if ( iWidth )
+                {
+                    //
+                    // We need to pad the beginning of the value.
+                    // Compute # of leading chars
+                    //
+                    iWidth -= ndigits_in_u64(ui64Val);
+
+                    iWidth = padbuffer(pcBuf, ui8PadChar, iWidth);
+                    pcBuf += pcBuf ? iWidth : 0;
+                    ui32CharCnt += iWidth;
+                    iWidth = 0;
+                }
+
+                iVal = uint64_to_str(ui64Val, pcBuf);
+
+                if ( pcBuf )
+                {
+                    pcBuf += iVal;
+                }
+
+                ui32CharCnt += iVal;
+                break;
+
+            case 'd':
+            case 'i':
+                //
+                // Output for a negative number, for example, -5:
+                //   %d:-5
+                //  %5d:   -5
+                // %05d:-0005
+                //
+                i64Val = bLongLong ? va_arg(pArgs, int64_t) :
+                                     va_arg(pArgs, int32_t);
+
+                //
+                // Get absolute value
+                //
+                if ( i64Val < 0 )
+                {
+                    ui64Val = -i64Val;          // Get absolute value
+                    bNeg = true;
+                }
+                else
+                {
+                    ui64Val = i64Val;
+                    bNeg = false;
+                }
+
+                if ( iWidth )
+                {
+                    //
+                    // We need to pad the beginning of the value.
+                    // Compute # of leading chars
+                    //
+                    iWidth -= ndigits_in_i64(ui64Val);
+
+                    if ( bNeg )
+                    {
+                        --iWidth;
+
+                        //
+                        // Allow for the negative sign
+                        //
+                        if ( ui8PadChar == '0' )
+                        {
+                            //
+                            // Print the neg sign BEFORE the leading zeros
+                            //
+                            if ( pcBuf )
+                            {
+                                *pcBuf++ = '-';
+                            }
+
+                            ++ui32CharCnt;
+                        }
+                    }
+
+                    iWidth = padbuffer(pcBuf, ui8PadChar, iWidth);
+                    pcBuf += pcBuf ? iWidth : 0;
+                    ui32CharCnt += iWidth;
+                    iWidth = 0;
+
+                    if ( bNeg  &&  (ui8PadChar == ' ') )
+                    {
+                        //
+                        // Print the neg sign AFTER the leading blanks
+                        //
+                        if ( pcBuf )
+                        {
+                            *pcBuf++ = '-';
+                        }
+
+                        ++ui32CharCnt;
+                    }
+                }
+                else
+                {
+                    if ( bNeg )
+                    {
+                        if ( pcBuf )
+                        {
+                            *pcBuf++ = '-';
+                        }
+                        ++ui32CharCnt;
+                    }
+                }
+
+                iVal = uint64_to_str(ui64Val, pcBuf);
+
+                if ( pcBuf )
+                {
+                    pcBuf += iVal;
+                }
+
+                ui32CharCnt += iVal;
+                break;
+
+
+            case 'f':
+            case 'F':
+                if ( pcBuf )
+                {
+                    float fValue = va_arg(pArgs, double);
+
+                    //
+                    // pcBuf is an input (size of buffer) and also an output of ftoa()
+                    //
+                    *(uint32_t*)pcBuf = 20;
+
+                    iVal = ftoa(fValue, pcBuf, iPrecision);
+                    if ( iVal < 0 )
+                    {
+                        uint32_t u32PrntErrVal;
+                        if ( iVal == AM_FTOA_ERR_VAL_TOO_SMALL )
+                        {
+                            u32PrntErrVal = (0x00 << 24) | ('0' << 16) |
+                                            ('.' << 8)   | ('0' << 0);  // "0.0"
+                        }
+                        else if ( iVal == AM_FTOA_ERR_VAL_TOO_LARGE )
+                        {
+                            u32PrntErrVal = (0x00 << 24) | ('#' << 16) |
+                                            ('.' << 8)   | ('#' << 0);  // "#.#"
+                        }
+                        else
+                        {
+                            u32PrntErrVal = (0x00 << 24) | ('?' << 16) |
+                                            ('.' << 8)   | ('?' << 0);  // "?.?"
+                        }
+                        *(uint32_t*)pcBuf = u32PrntErrVal;
+                        iVal = 3;
+                    }
+                    ui32CharCnt += iVal;
+                    pcBuf += iVal;
+                }
+                break;
+
+            //
+            // Invalid specifier character
+            // For non-handled specifiers, we'll just print the character.
+            // e.g. this will allow the normal printing of a '%' using
+            // "%%".
+            //
+            default:
+                if ( pcBuf )
+                {
+                    *pcBuf++ = *pcFmt;
+                }
+
+                ++ui32CharCnt;
+                break;
+
+        } // switch()
+
+        //
+        // Bump the format specification to the next character
+        //
+        ++pcFmt;
+
+    } // while ()
+
+    //
+    // Terminate the string
+    //
+    if ( pcBuf )
+    {
+        *pcBuf = 0x0;
+    }
+
+    return (ui32CharCnt);
+}
+
+//******************************************************************************
+//
+//! @brief Format data into string.
+//!
+//! @param *pcBuf - Pointer to the buffer to store the string
+//! @param *pcFmt - Pointer to formater string
+//!
+//! A lite version of vsprintf().
+//!      Currently handles the following specifiers:
+//!      %c
+//!      %s
+//!      %[0][width]d (also %i)
+//!      %[0][width]u
+//!      %[0][width]x
+//!
+//!     Note than any unrecognized or unhandled format specifier character is
+//!     simply printed.  For example, "%%" will print a '%' character.
+//!
+//! @return uint32_t representing the number of characters printed.
+//
+//******************************************************************************
+uint32_t
+am_util_stdio_sprintf(char *pcBuf, const char *pcFmt, ...)
+{
+    uint32_t ui32CharCnt;
+
+    va_list pArgs;
+    va_start(pArgs, pcFmt);
+    ui32CharCnt = am_util_stdio_vsprintf(pcBuf, pcFmt, pArgs);
+    va_end(pArgs);
+
+    return ui32CharCnt;
+}
+
+//*****************************************************************************
+//
+//! @brief A lite version of printf()
+//!
+//! @param *pcFmt - Pointer to formatter string
+//!
+//!  See am_util_stdio_sprintf() for more details.
+//!
+//! @return uint32_t representing the number of characters printed.
+//
+// *****************************************************************************
+uint32_t
+am_util_stdio_printf(const char *pcFmt, ...)
+{
+    uint32_t ui32NumChars;
+
+    //
+    // Convert to the desired string.
+    //
+    va_list pArgs;
+    va_start(pArgs, pcFmt);
+    ui32NumChars = am_util_stdio_vsprintf(g_prfbuf, pcFmt, pArgs);
+    va_end(pArgs);
+
+    //
+    // This is where we print the buffer to the configured interface.
+    //
+    g_pfnCharPrint(g_prfbuf);
+
+    //
+    // return the number of characters printed.
+    //
+    return ui32NumChars;
+}
+
+//*****************************************************************************
+//
+//! @brief Clear the terminal screen
+//!
+//! This function clears a standard terminal screen.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_util_stdio_terminal_clear(void)
+{
+    //
+    // Escape codes to clear a terminal screen and put the cursor in the top
+    // left corner.
+    // We'll first print a number of spaces, which helps get the ITM in sync
+    // with AM Flash, especially after a reset event or a system clock
+    // frequency change.
+    //
+    am_util_stdio_printf("\n>>>>>>> ");
+}
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_stdio.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_stdio.h
new file mode 100644
index 000000000..7aa97aeea
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_stdio.h
@@ -0,0 +1,84 @@
+//*****************************************************************************
+//
+//! @file am_util_stdio.h
+//!
+//! @brief A few printf-style functions for use with Ambiq products
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_UTIL_STDIO_H
+#define AM_UTIL_STDIO_H
+
+/* get va_list from compiler. */
+#include <stdarg.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+//*****************************************************************************
+//
+// Macro definitions
+//
+//*****************************************************************************
+
+// buffer size for printf
+#ifndef AM_PRINTF_BUFSIZE
+#define AM_PRINTF_BUFSIZE              256
+#endif
+
+typedef void (*am_util_stdio_print_char_t)(char *pcStr);
+
+//*****************************************************************************
+//
+// External function definitions
+//
+//*****************************************************************************
+extern void am_util_stdio_printf_init(am_util_stdio_print_char_t pfnCharPrint);
+extern uint32_t am_util_stdio_strtoul(const char *str, char **endptr, int base);
+extern bool am_util_stdio_textmode_set(bool bSetTextTranslationMode);
+extern uint32_t am_util_stdio_vsprintf(char *pcBuf, const char *pcFmt, va_list pArgs);
+extern uint32_t am_util_stdio_sprintf(char *pui8Buf, const char *pui8Fmt, ...);
+extern uint32_t am_util_stdio_printf(const char *pui8Fmt, ...);
+extern void am_util_stdio_terminal_clear(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_UTIL_STDIO_H
+
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_stopwatch.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_stopwatch.c
new file mode 100644
index 000000000..7444bbf8c
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_stopwatch.c
@@ -0,0 +1,471 @@
+//*****************************************************************************
+//
+//! @file am_util_stopwatch.c
+//!
+//! @brief Provides functionality to measure elapsed time.
+//!
+//! Functions for measuring elapsed time. These can be useful for providing
+//! 'ticks' where needed.
+//!
+//! @note These functions require a RTC to function properly. Therefore, if any
+//! RTC configuring takes place after calling am_util_stopwatch_start() the
+//! resulting elapsed time will be incorrect unless you first call
+//! am_util_stopwatch_restart()
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#include <stdint.h>
+#include <stdbool.h>
+#include <stdarg.h>
+#include "hal/am_hal_rtc.h"
+#include "am_util_stopwatch.h"
+
+//*****************************************************************************
+//
+// Format time based on resolution.
+//
+//*****************************************************************************
+static uint32_t
+time_format(uint64_t ui64TimeMS, uint32_t ui32Resolution)
+{
+    switch (ui32Resolution)
+    {
+        case AM_UTIL_STOPWATCH_MS:
+            return ui64TimeMS;
+        case AM_UTIL_STOPWATCH_SECOND:
+            return ui64TimeMS / 1000;
+        case AM_UTIL_STOPWATCH_MINUTE:
+            return ui64TimeMS / 60000;
+        case AM_UTIL_STOPWATCH_HOUR:
+            return ui64TimeMS / 3600000;
+        case AM_UTIL_STOPWATCH_DAY:
+            return ui64TimeMS / 86400000;
+        case AM_UTIL_STOPWATCH_MONTH:
+             return ui64TimeMS / (uint64_t) 2592000000;
+        case AM_UTIL_STOPWATCH_YEAR:
+             return ui64TimeMS / (uint64_t) 31536000000;
+        default:
+            return ui64TimeMS;
+    }
+}
+
+//*****************************************************************************
+//
+// Return the absolute time in milliseconds from a RTC structure.
+//
+//*****************************************************************************
+static uint64_t
+elapsed_time_ms(am_hal_rtc_time_t *psStartTime, am_hal_rtc_time_t *psStopTime)
+{
+    int64_t i64DeltaYear = 0;
+    int64_t i64DelataMonth = 0;
+    int64_t i64DeltaDay = 0;
+    int64_t i64DelatHour = 0;
+    int64_t i64DeltaMinute = 0;
+    int64_t i64DeltaSecond = 0;
+    int64_t i64DeltaHundredths = 0;
+    uint64_t ui64DeltaTotal = 0;
+
+    i64DeltaYear = (psStopTime->ui32Year - psStartTime->ui32Year) * (uint64_t) 31536000000;
+    i64DelataMonth = (psStopTime->ui32Month - psStartTime->ui32Month) * (uint64_t) 2592000000;
+    i64DeltaDay = (psStopTime->ui32DayOfMonth - psStartTime->ui32DayOfMonth) * (uint64_t) 86400000;
+    i64DelatHour = (psStopTime->ui32Hour - psStartTime->ui32Hour) * (uint64_t) 3600000;
+    i64DeltaMinute = (psStopTime->ui32Minute - psStartTime->ui32Minute) * (uint64_t) 60000;
+    i64DeltaSecond = (psStopTime->ui32Second - psStartTime->ui32Second) * (uint64_t) 1000;
+    i64DeltaHundredths = (psStopTime->ui32Hundredths - psStartTime->ui32Hundredths) * (uint64_t) 10;
+
+    ui64DeltaTotal = (i64DeltaYear + i64DelataMonth + i64DeltaDay + i64DelatHour +
+                      i64DeltaMinute + i64DeltaSecond + i64DeltaHundredths);
+
+    return ui64DeltaTotal;
+}
+
+//*****************************************************************************
+//
+//! @brief Start the stopwatch.
+//!
+//! @param *pStopwatch - the pointer to the am_util_stopwatch_t structure.
+//!
+//! This function records the current time from the RTC and sets the start time.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_util_stopwatch_init(am_util_stopwatch_t *pStopwatch)
+{
+    //
+    // Initialize everything.
+    //
+    pStopwatch->ui64ElapsedTime = 0;
+    pStopwatch->ui64PausedTime = 0;
+    pStopwatch->bStarted = false;
+    pStopwatch->bPaused = false;
+}
+
+//*****************************************************************************
+//
+//! @brief Start the stopwatch.
+//!
+//! @param *pStopwatch - the pointer to the am_util_stopwatch_t structure.
+//!
+//! This function records the current time from the RTC and sets the start time.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_util_stopwatch_start(am_util_stopwatch_t *pStopwatch)
+{
+    am_hal_rtc_time_t rtc_time;
+
+    //
+    // If the start time is clear, read the RTC time to get a reference starting
+    // time.
+    if (pStopwatch->bPaused == false && pStopwatch->bStarted == false)
+    {
+        //
+        // Clear the timer which gets the current time as well.
+        //
+        am_util_stopwatch_clear(pStopwatch);
+    }
+
+    //
+    // We were paused.
+    // Now we need to figure out how long we were paused for.
+    //
+    else if (pStopwatch->bPaused == true && pStopwatch->bStarted == true)
+    {
+        //
+        // Get the RTC time.
+        //
+        while(am_hal_rtc_time_get(&rtc_time));
+
+        //
+        // Add the time we spent paused to the time we already spent paused.
+        //
+        pStopwatch->ui64PausedTime += elapsed_time_ms(&pStopwatch->sPauseTime, &rtc_time);
+    }
+
+    //
+    // Set started to true.
+    //
+    pStopwatch->bStarted = true;
+
+    //
+    // Set paused to false.
+    //
+    pStopwatch->bPaused = false;
+}
+
+//*****************************************************************************
+//
+//! @brief Stop the stopwatch.
+//!
+//! @param *pStopwatch - the pointer to the am_util_stopwatch_t structure.
+//!
+//! This function stops the stop watch and anytime am_util_stopwatch_elapsed_get()
+//! is called it will return the same elapsed time until am_util_stopwatch_start()
+//! is called again.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_util_stopwatch_stop(am_util_stopwatch_t *pStopwatch)
+{
+    //
+    // Save the current time so we know how long we've been paused for.
+    //
+    while(am_hal_rtc_time_get(&pStopwatch->sPauseTime));
+
+    //
+    // Set the state to paused.
+    //
+    pStopwatch->bPaused = true;
+}
+
+//*****************************************************************************
+//
+//! @brief Clears the stopwatch.
+//!
+//! @param *pStopwatch - the pointer to the am_util_stopwatch_t structure.
+//!
+//! This function clears the start time on the stop watch. If the stop watch is
+//! running, it will continue to count the elapsed time from the new start time.
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_util_stopwatch_clear(am_util_stopwatch_t *pStopwatch)
+{
+    //
+    // Read the RTC and save in pStopwatch->sStartTime.
+    //
+    while(am_hal_rtc_time_get(&pStopwatch->sStartTime));
+
+    //
+    // Reset the paused time.
+    //
+    pStopwatch->ui64PausedTime = 0;
+
+    //
+    // Reset the elapsed time.
+    //
+    pStopwatch->ui64ElapsedTime = 0;
+}
+
+//*****************************************************************************
+//
+//! @brief Restart the stopwatch.
+//!
+//! This function restarts the stopwatch.
+//!
+//! @param *pStopwatch - the pointer to the am_util_stopwatch_t structure.
+//!
+//! If the stopwatch was previously stopped this is functionally equivalent
+//! calling am_util_stopwatch_clear() followed by am_util_stopwatch_start().
+//!
+//! If the stopwatch was previously started this is functionally equivalent to
+//! am_util_stopwatch_clear().
+//!
+//! @return None.
+//
+//*****************************************************************************
+void
+am_util_stopwatch_restart(am_util_stopwatch_t *pStopwatch)
+{
+    //
+    // Clear the stopwatch.
+    //
+    am_util_stopwatch_clear(pStopwatch);
+
+    //
+    // Start the stopwatch.
+    //
+    am_util_stopwatch_start(pStopwatch);
+}
+
+//*****************************************************************************
+//
+//! @brief Get the elapsed time from the stopwatch.
+//!
+//! @param *pStopwatch - the pointer to the am_util_stopwatch_t structure.
+//! @param ui32Resolution - the desired resolution to return the elapsed time in.
+//!
+//! This function returns the elapsed time in the desired resolution as requested
+//! from ui32Resolution.
+//!
+//! Valid values for ui32Resolution:
+//!     AM_UTIL_STOPWATCH_MS
+//!     AM_UTIL_STOPWATCH_SEC
+//!     AM_UTIL_STOPWATCH_MIN
+//!     AM_UTIL_STOPWATCH_HOUR
+//!     AM_UTIL_STOPWATCH_DAY
+//!     AM_UTIL_STOPWATCH_MONTH
+//!     AM_UTIL_STOPWATCH_YEAR
+//!
+//! @return Elapsed Time in ui32Resolution.
+//
+//*****************************************************************************
+uint64_t
+am_util_stopwatch_elapsed_get(am_util_stopwatch_t *pStopwatch, uint32_t ui32Resolution)
+{
+    am_hal_rtc_time_t rtc_time;
+
+    //
+    // Stop watch is not paused and is running.
+    // Figure out elapsed time.
+    //
+    if (pStopwatch->bPaused == false && pStopwatch->bStarted == true)
+    {
+        //
+        // Get the RTC time.
+        //
+        while(am_hal_rtc_time_get(&rtc_time));
+
+        pStopwatch->ui64ElapsedTime = elapsed_time_ms(&pStopwatch->sStartTime, &rtc_time) -
+                                pStopwatch->ui64PausedTime;
+    }
+
+    //
+    // Return the elapsed time.
+    //
+    return time_format(pStopwatch->ui64ElapsedTime, ui32Resolution);
+}
+
+//*****************************************************************************
+//
+//! @brief Get and format the elapsed time from the stopwatch.
+//!
+//! @param *pStopwatch - the pointer to the am_util_stopwatch_t structure.
+//! @param *pTime - the pointer to the am_util_stopwatch_elapsed_t structure.
+//!
+//! This function returns the fills in the am_util_stopwatch_elapsed_t structure
+//! with "human readable" elapsed time.
+//!
+//! @return None.
+//
+//*****************************************************************************
+ void
+ am_util_stopwatch_elapsed_get_formatted(am_util_stopwatch_t *pStopwatch,
+                                         am_util_stopwatch_elapsed_t *psTime)
+ {
+    uint64_t ui64MS;
+
+    //
+    // Get the elapsed time in MS.
+    //
+    ui64MS = am_util_stopwatch_elapsed_get(pStopwatch, AM_UTIL_STOPWATCH_MS);
+
+    //
+    // Zero out the structure.
+    //
+    psTime->ui32Year = 0;
+    psTime->ui32Month = 0;
+    psTime->ui32Day = 0;
+    psTime->ui32Hour = 0;
+    psTime->ui32Minute = 0;
+    psTime->ui32Second = 0;
+    psTime->ui32MS = 0;
+
+    //
+    // Years.
+    //
+    if (ui64MS >= 31536000000)
+    {
+        //
+        // Fill in the structure.
+        //
+        psTime->ui32Year = (ui64MS / 31536000000);
+
+        //
+        // Subtract from ui64MS.
+        //
+        ui64MS -= (psTime->ui32Year * 31536000000);
+    }
+
+    //
+    // Months.
+    //
+    if (ui64MS >= 2592000000)
+    {
+        //
+        // Fill in the structure.
+        //
+        psTime->ui32Month = (ui64MS / 2592000000);
+
+        //
+        // Subtract from ui64MS.
+        //
+        ui64MS -= (psTime->ui32Month * 2592000000);
+    }
+
+    //
+    // Days.
+    //
+    if (ui64MS >= 86400000)
+    {
+        //
+        // Fill in the structure.
+        //
+        psTime->ui32Day = (ui64MS / 86400000);
+
+        //
+        // Subtract from ui64MS.
+        //
+        ui64MS -= (psTime->ui32Day * 86400000);
+    }
+
+    //
+    // Hours.
+    //
+    if (ui64MS >= 3600000)
+    {
+        //
+        // Fill in the structure.
+        //
+        psTime->ui32Hour = (ui64MS / 3600000);
+
+        //
+        // Subtract from ui64MS.
+        //
+        ui64MS -= (psTime->ui32Hour * 3600000);
+    }
+
+    //
+    // Minutes.
+    //
+    if (ui64MS >= 60000)
+    {
+        //
+        // Fill in the structure.
+        //
+        psTime->ui32Minute = (ui64MS / 60000);
+
+        //
+        // Subtract from ui64MS.
+        //
+        ui64MS -= (psTime->ui32Minute * 60000);
+    }
+
+    //
+    // Seconds.
+    //
+    if (ui64MS >= 1000)
+    {
+        //
+        // Fill in the structure.
+        //
+        psTime->ui32Second = (ui64MS / 1000);
+
+        //
+        // Subtract from ui64MS.
+        //
+        ui64MS -= (psTime->ui32Second * 1000);
+    }
+
+    //
+    // Milliseconds.
+    //
+
+    //
+    // Fill in the structure.
+    //
+    psTime->ui32MS = ui64MS;
+ }
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_stopwatch.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_stopwatch.h
new file mode 100644
index 000000000..e8950e8d3
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_stopwatch.h
@@ -0,0 +1,122 @@
+//*****************************************************************************
+//
+//! @file am_util_stopwatch.h
+//!
+//! @brief Provides functionality to measure elapsed time.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_UTIL_STOPWATCH_H
+#define AM_UTIL_STOPWATCH_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include "hal/am_hal_rtc.h"
+
+//*****************************************************************************
+//
+// A data structure for holding the formatted time.
+//
+//*****************************************************************************
+typedef struct am_util_stopwatch_elapsed_t
+{
+    uint32_t ui32MS;
+    uint32_t ui32Second;
+    uint32_t ui32Minute;
+    uint32_t ui32Hour;
+    uint32_t ui32Day;
+    uint32_t ui32Month;
+    uint32_t ui32Year;
+} am_util_stopwatch_elapsed_t;
+
+//*****************************************************************************
+//
+// A data structure for tracking the stopwatch state.
+//
+//*****************************************************************************
+typedef struct am_util_stopwatch_t
+{
+    uint64_t ui64ElapsedTime;          // Total elapsed time in ms.
+    uint64_t ui64PausedTime;           // Total paused time in ms.
+    bool bStarted;                     // Stopwatch started state.
+    bool bPaused;                      // Stopwatch paused state.
+    am_hal_rtc_time_t sStartTime;      // Start time to determine elapsed time.
+    am_hal_rtc_time_t sPauseTime;      // Pause time to determine elapsed time.
+} am_util_stopwatch_t;
+
+//*****************************************************************************
+//
+//! @name Resolution for Elapsed Time
+//! @brief Defines to pass to am_util_stopwatch_elapsed_get()
+//!
+//! These macros should be used to specify what resolution to return the
+//! elapsed time in.
+//! @{
+//
+//*****************************************************************************
+#define AM_UTIL_STOPWATCH_MS            0x0
+#define AM_UTIL_STOPWATCH_SECOND        0x1
+#define AM_UTIL_STOPWATCH_MINUTE        0x2
+#define AM_UTIL_STOPWATCH_HOUR          0x4
+#define AM_UTIL_STOPWATCH_DAY           0x8
+#define AM_UTIL_STOPWATCH_MONTH         0x10
+#define AM_UTIL_STOPWATCH_YEAR          0x20
+//! @}
+
+//*****************************************************************************
+//
+// External function definitions
+//
+//*****************************************************************************
+extern void am_util_stopwatch_init(am_util_stopwatch_t *pStopwatch);
+extern void am_util_stopwatch_start(am_util_stopwatch_t *pStopwatch);
+extern void am_util_stopwatch_stop(am_util_stopwatch_t *pStopwatch);
+extern void am_util_stopwatch_restart(am_util_stopwatch_t *pStopwatch);
+extern void am_util_stopwatch_clear(am_util_stopwatch_t *pStopwatch);
+extern uint64_t am_util_stopwatch_elapsed_get(am_util_stopwatch_t *pStopwatch,
+                                                       uint32_t ui32Resolution);
+extern void am_util_stopwatch_elapsed_get_formatted(am_util_stopwatch_t *pStopwatch,
+                                                    am_util_stopwatch_elapsed_t *pTime);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_UTIL_STOPWATCH_H
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_string.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_string.c
new file mode 100644
index 000000000..39304f6f3
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_string.c
@@ -0,0 +1,574 @@
+//*****************************************************************************
+//
+//! @file am_util_string.c
+//!
+//! @brief A subset of the functions provided in the C standard string library.
+//!
+//! The functions here are reimplementation of some of the standard "string"
+//! functions.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "am_util_string.h"
+
+
+//*****************************************************************************
+//
+//! @brief Table for quick lookup of character attributes.
+//
+//*****************************************************************************
+#if MINIMIZE_CATTR_TABLE
+#define CATTR_TBL_SIZE  128
+#else
+#define CATTR_TBL_SIZE  256
+#endif
+
+const uint8_t am_cattr[CATTR_TBL_SIZE] =
+{
+    AM_CATTR_NONE,                                                          /* 0x00 */
+    AM_CATTR_NONE,                                                          /* 0x01 */
+    AM_CATTR_NONE,                                                          /* 0x02 */
+    AM_CATTR_NONE,                                                          /* 0x03 */
+    AM_CATTR_NONE,                                                          /* 0x04 */
+    AM_CATTR_NONE,                                                          /* 0x05 */
+    AM_CATTR_NONE,                                                          /* 0x06 */
+    AM_CATTR_NONE,                                                          /* 0x07 */
+    AM_CATTR_NONE,                                                          /* 0x08 */
+    AM_CATTR_WHSPACE,                                                       /* 0x09 */
+    AM_CATTR_WHSPACE,                                                       /* 0x0A */
+    AM_CATTR_WHSPACE,                                                       /* 0x0B */
+    AM_CATTR_WHSPACE,                                                       /* 0x0C */
+    AM_CATTR_WHSPACE,                                                       /* 0x0D */
+    AM_CATTR_NONE,                                                          /* 0x0E */
+    AM_CATTR_NONE,                                                          /* 0x0F */
+    AM_CATTR_NONE,                                                          /* 0x00 */
+    AM_CATTR_NONE,                                                          /* 0x11 */
+    AM_CATTR_NONE,                                                          /* 0x12 */
+    AM_CATTR_NONE,                                                          /* 0x13 */
+    AM_CATTR_NONE,                                                          /* 0x14 */
+    AM_CATTR_NONE,                                                          /* 0x15 */
+    AM_CATTR_NONE,                                                          /* 0x16 */
+    AM_CATTR_NONE,                                                          /* 0x17 */
+    AM_CATTR_NONE,                                                          /* 0x18 */
+    AM_CATTR_NONE,                                                          /* 0x19 */
+    AM_CATTR_NONE,                                                          /* 0x1A */
+    AM_CATTR_NONE,                                                          /* 0x1B */
+    AM_CATTR_NONE,                                                          /* 0x1C */
+    AM_CATTR_NONE,                                                          /* 0x1D */
+    AM_CATTR_NONE,                                                          /* 0x1E */
+    AM_CATTR_NONE,                                                          /* 0x1F */
+    AM_CATTR_WHSPACE,                                                       /* 0x20, space */
+    AM_CATTR_FILENM83,                                                      /* 0x21, ! */
+    AM_CATTR_NONE,                                                          /* 0x22, " */
+    AM_CATTR_FILENM83,                                                      /* 0x23, # */
+    AM_CATTR_FILENM83,                                                      /* 0x24, $ */
+    AM_CATTR_FILENM83,                                                      /* 0x25, % */
+    AM_CATTR_FILENM83,                                                      /* 0x26, & */
+    AM_CATTR_FILENM83,                                                      /* 0x27, ' */
+    AM_CATTR_FILENM83,                                                      /* 0x28, ( */
+    AM_CATTR_FILENM83,                                                      /* 0x29, ) */
+    AM_CATTR_NONE,                                                          /* 0x2A, * */
+    AM_CATTR_NONE,                                                          /* 0x2B, + */
+    AM_CATTR_NONE,                                                          /* 0x2C, , */
+    AM_CATTR_FILENM83,                                                      /* 0x2D, - */
+    AM_CATTR_FILENM83,                                                      /* 0x2E, . */
+    AM_CATTR_NONE,                                                          /* 0x2F, / */
+    AM_CATTR_DIGIT | AM_CATTR_XDIGIT | AM_CATTR_FILENM83,                   /* 0x30, 0 */
+    AM_CATTR_DIGIT | AM_CATTR_XDIGIT | AM_CATTR_FILENM83,                   /* 0x31, 1 */
+    AM_CATTR_DIGIT | AM_CATTR_XDIGIT | AM_CATTR_FILENM83,                   /* 0x32, 2 */
+    AM_CATTR_DIGIT | AM_CATTR_XDIGIT | AM_CATTR_FILENM83,                   /* 0x33, 3 */
+    AM_CATTR_DIGIT | AM_CATTR_XDIGIT | AM_CATTR_FILENM83,                   /* 0x34, 4 */
+    AM_CATTR_DIGIT | AM_CATTR_XDIGIT | AM_CATTR_FILENM83,                   /* 0x35, 5 */
+    AM_CATTR_DIGIT | AM_CATTR_XDIGIT | AM_CATTR_FILENM83,                   /* 0x36, 6 */
+    AM_CATTR_DIGIT | AM_CATTR_XDIGIT | AM_CATTR_FILENM83,                   /* 0x37, 7 */
+    AM_CATTR_DIGIT | AM_CATTR_XDIGIT | AM_CATTR_FILENM83,                   /* 0x38, 8 */
+    AM_CATTR_DIGIT | AM_CATTR_XDIGIT | AM_CATTR_FILENM83,                   /* 0x39, 9 */
+    AM_CATTR_NONE,                                                          /* 0x3A, : */
+    AM_CATTR_NONE,                                                          /* 0x3B, ; */
+    AM_CATTR_NONE,                                                          /* 0x3C, < */
+    AM_CATTR_NONE,                                                          /* 0x3D, = */
+    AM_CATTR_NONE,                                                          /* 0x3E, > */
+    AM_CATTR_NONE,                                                          /* 0x3F, ? */
+    AM_CATTR_FILENM83,                                                      /* 0x40, @ */
+    AM_CATTR_ALPHA | AM_CATTR_UPPER | AM_CATTR_XDIGIT | AM_CATTR_FILENM83,  /* 0x41, A */
+    AM_CATTR_ALPHA | AM_CATTR_UPPER | AM_CATTR_XDIGIT | AM_CATTR_FILENM83,  /* 0x42, B */
+    AM_CATTR_ALPHA | AM_CATTR_UPPER | AM_CATTR_XDIGIT | AM_CATTR_FILENM83,  /* 0x43, C */
+    AM_CATTR_ALPHA | AM_CATTR_UPPER | AM_CATTR_XDIGIT | AM_CATTR_FILENM83,  /* 0x44, D */
+    AM_CATTR_ALPHA | AM_CATTR_UPPER | AM_CATTR_XDIGIT | AM_CATTR_FILENM83,  /* 0x45, E */
+    AM_CATTR_ALPHA | AM_CATTR_UPPER | AM_CATTR_XDIGIT | AM_CATTR_FILENM83,  /* 0x46, F */
+    AM_CATTR_ALPHA | AM_CATTR_UPPER | AM_CATTR_FILENM83,                    /* 0x47, G */
+    AM_CATTR_ALPHA | AM_CATTR_UPPER | AM_CATTR_FILENM83,                    /* 0x48, H */
+    AM_CATTR_ALPHA | AM_CATTR_UPPER | AM_CATTR_FILENM83,                    /* 0x49, I */
+    AM_CATTR_ALPHA | AM_CATTR_UPPER | AM_CATTR_FILENM83,                    /* 0x4A, J */
+    AM_CATTR_ALPHA | AM_CATTR_UPPER | AM_CATTR_FILENM83,                    /* 0x4B, K */
+    AM_CATTR_ALPHA | AM_CATTR_UPPER | AM_CATTR_FILENM83,                    /* 0x4C, L */
+    AM_CATTR_ALPHA | AM_CATTR_UPPER | AM_CATTR_FILENM83,                    /* 0x4D, M */
+    AM_CATTR_ALPHA | AM_CATTR_UPPER | AM_CATTR_FILENM83,                    /* 0x4E, N */
+    AM_CATTR_ALPHA | AM_CATTR_UPPER | AM_CATTR_FILENM83,                    /* 0x4F, O */
+    AM_CATTR_ALPHA | AM_CATTR_UPPER | AM_CATTR_FILENM83,                    /* 0x50, P */
+    AM_CATTR_ALPHA | AM_CATTR_UPPER | AM_CATTR_FILENM83,                    /* 0x51, Q */
+    AM_CATTR_ALPHA | AM_CATTR_UPPER | AM_CATTR_FILENM83,                    /* 0x52, R */
+    AM_CATTR_ALPHA | AM_CATTR_UPPER | AM_CATTR_FILENM83,                    /* 0x53, S */
+    AM_CATTR_ALPHA | AM_CATTR_UPPER | AM_CATTR_FILENM83,                    /* 0x54, T */
+    AM_CATTR_ALPHA | AM_CATTR_UPPER | AM_CATTR_FILENM83,                    /* 0x55, U */
+    AM_CATTR_ALPHA | AM_CATTR_UPPER | AM_CATTR_FILENM83,                    /* 0x56, V */
+    AM_CATTR_ALPHA | AM_CATTR_UPPER | AM_CATTR_FILENM83,                    /* 0x57, W */
+    AM_CATTR_ALPHA | AM_CATTR_UPPER | AM_CATTR_FILENM83,                    /* 0x58, X */
+    AM_CATTR_ALPHA | AM_CATTR_UPPER | AM_CATTR_FILENM83,                    /* 0x59, Y */
+    AM_CATTR_ALPHA | AM_CATTR_UPPER | AM_CATTR_FILENM83,                    /* 0x5A, Z */
+    AM_CATTR_NONE,                                                          /* 0x5B, [ */
+    AM_CATTR_NONE,                                                          /* 0x5C, \ */
+    AM_CATTR_NONE,                                                          /* 0x5D, ] */
+    AM_CATTR_FILENM83,                                                      /* 0x5E, ^ */
+    AM_CATTR_FILENM83,                                                      /* 0x5F, _ */
+    AM_CATTR_FILENM83,                                                      /* 0x60, ` */
+    AM_CATTR_ALPHA | AM_CATTR_LOWER | AM_CATTR_XDIGIT | AM_CATTR_FILENM83,  /* 0x61, a */
+    AM_CATTR_ALPHA | AM_CATTR_LOWER | AM_CATTR_XDIGIT | AM_CATTR_FILENM83,  /* 0x62, b */
+    AM_CATTR_ALPHA | AM_CATTR_LOWER | AM_CATTR_XDIGIT | AM_CATTR_FILENM83,  /* 0x63, c */
+    AM_CATTR_ALPHA | AM_CATTR_LOWER | AM_CATTR_XDIGIT | AM_CATTR_FILENM83,  /* 0x64, d */
+    AM_CATTR_ALPHA | AM_CATTR_LOWER | AM_CATTR_XDIGIT | AM_CATTR_FILENM83,  /* 0x65, e */
+    AM_CATTR_ALPHA | AM_CATTR_LOWER | AM_CATTR_XDIGIT | AM_CATTR_FILENM83,  /* 0x66, f */
+    AM_CATTR_ALPHA | AM_CATTR_LOWER | AM_CATTR_FILENM83,                    /* 0x67, g */
+    AM_CATTR_ALPHA | AM_CATTR_LOWER | AM_CATTR_FILENM83,                    /* 0x68, h */
+    AM_CATTR_ALPHA | AM_CATTR_LOWER | AM_CATTR_FILENM83,                    /* 0x69, i */
+    AM_CATTR_ALPHA | AM_CATTR_LOWER | AM_CATTR_FILENM83,                    /* 0x6A, j */
+    AM_CATTR_ALPHA | AM_CATTR_LOWER | AM_CATTR_FILENM83,                    /* 0x6B, k */
+    AM_CATTR_ALPHA | AM_CATTR_LOWER | AM_CATTR_FILENM83,                    /* 0x6C, l */
+    AM_CATTR_ALPHA | AM_CATTR_LOWER | AM_CATTR_FILENM83,                    /* 0x6D, m */
+    AM_CATTR_ALPHA | AM_CATTR_LOWER | AM_CATTR_FILENM83,                    /* 0x6E, n */
+    AM_CATTR_ALPHA | AM_CATTR_LOWER | AM_CATTR_FILENM83,                    /* 0x6F, o */
+    AM_CATTR_ALPHA | AM_CATTR_LOWER | AM_CATTR_FILENM83,                    /* 0x70, p */
+    AM_CATTR_ALPHA | AM_CATTR_LOWER | AM_CATTR_FILENM83,                    /* 0x71, q */
+    AM_CATTR_ALPHA | AM_CATTR_LOWER | AM_CATTR_FILENM83,                    /* 0x72, r */
+    AM_CATTR_ALPHA | AM_CATTR_LOWER | AM_CATTR_FILENM83,                    /* 0x73, s */
+    AM_CATTR_ALPHA | AM_CATTR_LOWER | AM_CATTR_FILENM83,                    /* 0x74, t */
+    AM_CATTR_ALPHA | AM_CATTR_LOWER | AM_CATTR_FILENM83,                    /* 0x75, u */
+    AM_CATTR_ALPHA | AM_CATTR_LOWER | AM_CATTR_FILENM83,                    /* 0x76, v */
+    AM_CATTR_ALPHA | AM_CATTR_LOWER | AM_CATTR_FILENM83,                    /* 0x77, w */
+    AM_CATTR_ALPHA | AM_CATTR_LOWER | AM_CATTR_FILENM83,                    /* 0x78, x */
+    AM_CATTR_ALPHA | AM_CATTR_LOWER | AM_CATTR_FILENM83,                    /* 0x79, y */
+    AM_CATTR_ALPHA | AM_CATTR_LOWER | AM_CATTR_FILENM83,                    /* 0x7A, z */
+    AM_CATTR_FILENM83,                                                      /* 0x7B, { */
+    AM_CATTR_NONE,                                                          /* 0x7C, | */
+    AM_CATTR_FILENM83,                                                      /* 0x7D, } */
+    AM_CATTR_FILENM83,                                                      /* 0x7E, ~ */
+    AM_CATTR_NONE                                                           /* 0x7F, delete */
+
+    //
+    // All bit7 chars are AM_CATTR_NONE.
+    //
+};
+
+//*****************************************************************************
+//
+//! @brief Character "is" functions
+//!
+//! This family of functions tests a given integer value in order to determine
+//!  whether the integer satisfies the test condition.
+//! These functions are generally based on the C99 standard functions.
+//!
+//! By default all of the "is" functions are implemented as macros. To implement
+//!  as functions rather than macros, use a global compiler command line (-D)
+//!  option to define AM_UTIL_STRING_CTYPE_DISABLE_MACROS.
+//!
+//! Standard functions currently implemented include:
+//!  isalnum(), isalpha(), islower(), isupper(), isdigit(), isxdigit(),
+//!  isspace().
+//!
+//! Standard functions not currently implemented include:
+//!  iscntrl(), isgraph(), isprint(), ispunct(), isblank() (new for C99).
+//!
+//! Non-standard functions currently implemented include:
+//!  isfilenm83().
+//!
+//! @return Each function returns a nonzero value if the integer satisfies
+//!  the test condition and 0 if it does not.
+//
+//*****************************************************************************
+
+#ifdef AM_UTIL_STRING_CTYPE_DISABLE_MACROS
+int
+am_util_string_isalnum(int c)
+{
+#if MINIMIZE_CATTR_TABLE
+    return (c & 0xffffff80) ? 0 : (am_cattr[c] & (AM_CATTR_ALPHA | AM_CATTR_DIGIT)) ? 1 : 0;
+#else
+    return (am_cattr[c & 0xff] & (AM_CATTR_ALPHA | AM_CATTR_DIGIT)) ? 1 : 0;
+#endif
+}
+
+int
+am_util_string_isalpha(int c)
+{
+#if MINIMIZE_CATTR_TABLE
+    return (c & 0xffffff80) ? 0 : (am_cattr[c] & AM_CATTR_ALPHA) ? 1 : 0;
+#else
+    return (am_cattr[c & 0xff] & AM_CATTR_ALPHA) ? 1 : 0;
+#endif
+}
+
+int
+am_util_string_isdigit(int c)
+{
+#if MINIMIZE_CATTR_TABLE
+    return (c & 0xffffff80) ? 0 : (am_cattr[c] & AM_CATTR_DIGIT) ? 1 : 0;
+#else
+    return (am_cattr[c & 0xff] & AM_CATTR_DIGIT) ? 1 : 0;
+#endif
+}
+
+int am_util_string_islower(int c)
+{
+#if MINIMIZE_CATTR_TABLE
+    return (c & 0xffffff80) ? 0 : (am_cattr[c] & AM_CATTR_LOWER) ? 1 : 0;
+#else
+    return (am_cattr[c & 0xff] & AM_CATTR_LOWER) ? 1 : 0;
+#endif
+}
+
+int
+am_util_string_isspace(int c)
+{
+#if MINIMIZE_CATTR_TABLE
+    return (c & 0xffffff80) ? 0 : (am_cattr[c] & AM_CATTR_WHSPACE) ? 1 : 0;
+#else
+    return (am_cattr[c & 0xff] & AM_CATTR_WHSPACE) ? 1 : 0;
+#endif
+}
+
+int
+am_util_string_isupper(int c)
+{
+#if MINIMIZE_CATTR_TABLE
+    return (c & 0xffffff80) ? 0 : (am_cattr[c] & AM_CATTR_UPPER) ? 1 : 0;
+#else
+    return (am_cattr[c & 0xff] & AM_CATTR_UPPER) ? 1 : 0;
+#endif
+}
+
+int
+am_util_string_isxdigit(int c)
+{
+#if MINIMIZE_CATTR_TABLE
+    return (c & 0xffffff80) ? 0 : (am_cattr[c] & AM_CATTR_XDIGIT) ? 1 : 0;
+#else
+    return (am_cattr[c & 0xff] & AM_CATTR_XDIGIT) ? 1 : 0;
+#endif
+}
+
+int am_util_string_tolower(int c)
+{
+#if MINIMIZE_CATTR_TABLE
+    return (am_cattr[c & 0x7f] & AM_CATTR_UPPER) ? c | 0x20 : c;
+#else
+    return (am_cattr[c & 0xff] & AM_CATTR_UPPER) ? c | 0x20 : c;
+#endif
+}
+
+int am_util_string_toupper(int c)
+{
+#if MINIMIZE_CATTR_TABLE
+    return (am_cattr[c & 0x7f] & AM_CATTR_LOWER) ? c & ~0x20 : c;
+#else
+    return (am_cattr[c & 0xff] & AM_CATTR_LOWER) ? c & ~0x20 : c;
+#endif
+}
+
+
+//
+// Non-standard "is" Functions
+//
+int
+am_util_string_isfilenm83(int c)
+{
+#if MINIMIZE_CATTR_TABLE
+    return (c & 0xffffff80) ? 0 : (am_cattr[c] & AM_CATTR_FILENM83) ? 1 : 0;
+#else
+    return (am_cattr[c & 0xff] & AM_CATTR_FILENM83) ? 1 : 0;
+#endif
+}
+#endif // AM_UTIL_STRING_CTYPE_DISABLE_MACROS
+
+
+//*****************************************************************************
+//
+//! @brief Compare two strings.
+//!
+//! @param str1 is the first string to compare.
+//! @param str2 is the second string to compare
+//!
+//! This function steps through a pair of strings, character by character, to
+//! determine if the strings contain the same characters. If the strings match,
+//! this function will return a zero. If str1 is alphabetically earlier than
+//! str2, the return value will be negative. Otherwise, the return value will
+//! be positive.
+//!
+//! @return 0 for a perfect match, negative value if str1<str2, positive value
+//!  if str1>str2.
+//
+//*****************************************************************************
+int32_t
+am_util_string_strcmp(const char *str1, const char *str2)
+{
+    return am_util_string_strncmp(str1, str2, 0xffffffff);
+}
+
+//*****************************************************************************
+//
+//! @brief Compare two strings with a specified count.
+//!
+//! @param str1 is the first string to compare.
+//! @param str2 is the second string to compare
+//! @param num is the maximum number of characters to compare.
+//!
+//! This function steps through a pair of strings, character by character, to
+//! determine if the strings contain the same characters. If the strings match,
+//! this function will return a zero. If str1 is alphabetically earlier than
+//! str2, the return value will be negative. Otherwise, the return value will
+//! be positive.
+//!
+//! @return 0 for a perfect match, negative value if str1<str2, positive value
+//!  if str1>str2.
+//
+//*****************************************************************************
+int32_t
+am_util_string_strncmp(const char *str1, const char *str2, uint32_t num)
+{
+    while ( *str1 && *str2 && num )
+    {
+        if ( *str1 != *str2 )
+        {
+            return *str1 - *str2;
+        }
+
+        str1++;
+        str2++;
+        num--;
+    }
+
+    //
+    // Since we made it here, the strings must be equal to n characters.
+    //
+    return 0;
+}
+
+//*****************************************************************************
+//
+//! @brief Compare two strings with a specified count and without regard to
+//! letter case in the strings.
+//!
+//! @param str1 is the first string to compare.
+//! @param str2 is the second string to compare
+//! @param num is the maximum number of characters to compare.
+//!
+//! This function steps through a pair of strings, character by character, to
+//! determine if the strings contain the same characters. If the strings match,
+//! this function will return a zero. If str1 is alphabetically earlier than
+//! str2, the return value will be negative. Otherwise, the return value will
+//! be positive.
+//!
+//! @return 0 for a perfect match, negative value if str1<str2, positive value
+//!  if str1>str2.
+//
+//*****************************************************************************
+int32_t
+am_util_string_strnicmp(const char *str1, const char *str2, int num)
+{
+    uint8_t cChar1, cChar2;
+
+    while ( *str1 && *str2 && num )
+    {
+        cChar1 = *str1;
+        cChar2 = *str2;
+
+        cChar1 |= ( am_cattr[cChar1] & AM_CATTR_UPPER ) ? 0x20 : 0x00;
+        cChar2 |= ( am_cattr[cChar2] & AM_CATTR_UPPER ) ? 0x20 : 0x00;
+
+        if ( cChar1 != cChar2 )
+        {
+            return cChar1 - cChar2;
+        }
+
+        str1++;
+        str2++;
+        num--;
+    }
+
+    //
+    // Since we made it here, the strings must be equal to n characters.
+    //
+    return 0;
+}
+
+//*****************************************************************************
+//
+//! @brief Compare two strings with case-insensitivity.
+//!
+//! @param str1 is the first string to compare.
+//! @param str2 is the second string to compare
+//!
+//! This function compares each character in the 2 strings, converting all
+//! alpha characters to lower-case to make the comparison.
+//!
+//! To illustrate a possible unexpected outcome due to comparing the strings
+//! as lower case, consider the example strings "AMBIQ_MICRO" and "AMBIQMICRO".
+//! For these strings, stricmp() will return a negative value (indicating the
+//! first as before the second), whereas strcmp() will return a positive value.
+//!
+//! @return 0 for a case-insensitive match, negative value if str1<str2,
+//!  positive value if str1>str2.
+//
+//*****************************************************************************
+int32_t
+am_util_string_stricmp(const char *str1, const char *str2)
+{
+    uint8_t cChar1, cChar2;
+
+    while ( *str1 && *str2 )
+    {
+        cChar1 = *str1++;
+        cChar2 = *str2++;
+
+        cChar1 |= ( am_cattr[cChar1] & AM_CATTR_UPPER ) ? 0x20 : 0x00;
+        cChar2 |= ( am_cattr[cChar2] & AM_CATTR_UPPER ) ? 0x20 : 0x00;
+
+        if ( cChar1 != cChar2 )
+        {
+            return cChar1 - cChar2;
+        }
+    }
+
+    return *str1 - *str2;
+}
+
+//*****************************************************************************
+//
+//! @brief Return the length of a string.
+//!
+//! @param pcStr pointer to the string.
+//!
+//! This function returns the length of the string at pcStr.
+//!
+//! @return length of the string pcStr.
+//
+//*****************************************************************************
+uint32_t
+am_util_string_strlen(const char *pcStr)
+{
+    const char *pcS;
+
+    //
+    // Loop through the string.
+    //
+    for (pcS = pcStr; *pcS; ++pcS);
+
+    //
+    // Return the length.
+    //
+    return(pcS - pcStr);
+}
+
+//*****************************************************************************
+//
+//! @brief Copies a string.
+//!
+//! @param pcDst pointer to the destination string.
+//! @param pcSrc pointer to the source string to be copied to pcDst.
+//!
+//! This function copies pcSrc to the location specified by pcDst.
+//!
+//! @return pcDst (the location of the destination string).
+//
+//*****************************************************************************
+char *
+am_util_string_strcpy(char *pcDst, const char *pcSrc)
+{
+    char *pcRet = pcDst;
+
+    //
+    // Blindly copy the string until we hit a terminating NULL char.
+    //
+    do
+    {
+        *pcDst++ = *pcSrc;
+    } while ( *pcSrc++ );
+
+    return pcRet;
+}
+
+//*****************************************************************************
+//
+//! @brief Copies a specified number of characters of a string.
+//!
+//! @param pcDst pointer to the destination string.
+//! @param pcSrc pointer to the source string to be copied to pcDst.
+//!
+//! This function copies uNum characters of pcSrc to the location specified
+//!  by pcDst.
+//! If uNum is less than the length of pcSrc, a NULL terminating character
+//!  is not appended to the copied string. Thus the resultant string will be
+//!  exactly uNum chars in length and not terminated.
+//! If uNum is greater than the length of pcSrc, then pcDst is padded with
+//!  NULL characters up to the uNum length.
+//! Behavior is undefined if the addresses ranges overlap.
+//!
+//! @return pcDst (the location of the destination string).
+//
+//*****************************************************************************
+char *
+am_util_string_strncpy(char *pcDst, const char *pcSrc, uint32_t uNum)
+{
+    char *pcRet = pcDst;
+
+    while (uNum > 0)
+    {
+        if ( *pcSrc )
+        {
+            *pcDst++ = *pcSrc++;
+        }
+        else
+        {
+            *pcDst++ = 0x00;
+        }
+        uNum--;
+    }
+
+    return pcRet;
+}
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_string.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_string.h
new file mode 100644
index 000000000..4c9d151d4
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_string.h
@@ -0,0 +1,157 @@
+//*****************************************************************************
+//
+//! @file am_util_string.h
+//!
+//! @brief A subset of the functions provided in the C standard string library.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_UTIL_STRING_H
+#define AM_UTIL_STRING_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+//*****************************************************************************
+//
+// Character attributes lookup table defines.
+//
+//*****************************************************************************
+#define AM_CATTR_NONE       0x00
+#define AM_CATTR_ALPHA      0x01
+#define AM_CATTR_LOWER      0x02
+#define AM_CATTR_UPPER      0x04
+#define AM_CATTR_DIGIT      0x08
+#define AM_CATTR_XDIGIT     0x10
+#define AM_CATTR_WHSPACE    0x20
+#define AM_CATTR_FILENM83   0x80
+
+//
+// Set MINIMIZE_CATTR_TABLE to 1 to configure for minimal CATTR table size,
+//  (256 instead of 512 bytes) but at a cost of slightly larger code size.
+//  However, setting this option also provides an additional level of checking
+//  of the argument; if the argument is not a uint8_t, the functions are
+//  guaranteed to return 0.
+//
+#define MINIMIZE_CATTR_TABLE    0
+
+
+//*****************************************************************************
+//
+// Globals
+//
+//*****************************************************************************
+extern const uint8_t am_cattr[];
+
+
+//*****************************************************************************
+//
+// External function definitions
+//
+//*****************************************************************************
+extern int32_t am_util_string_strcmp(const char *str1, const char *str2);
+extern int32_t am_util_string_stricmp(const char *str1, const char *str2);
+extern int32_t am_util_string_strncmp(const char *str1, const char *str2,
+                                      uint32_t num);
+extern int32_t am_util_string_strnicmp(const char *str1, const char *str2,
+                                      int num);
+extern uint32_t am_util_string_strlen(const char *pcStr);
+extern char *am_util_string_strcpy(char *pcDst, const char *pcSrc);
+extern char *am_util_string_strncpy(char *pcDst, const char *pcSrc, uint32_t uNum);
+
+
+//*****************************************************************************
+//
+// Character "is" macros and functions
+//
+//*****************************************************************************
+//
+// By default all of the "is" functions are implemented as macros.  To implement
+//  as functions rather than macros, use a global compiler command line (-D)
+//  option to define AM_UTIL_STRING_CTYPE_DISABLE_MACROS.
+//
+#ifdef AM_UTIL_STRING_CTYPE_DISABLE_MACROS
+extern int am_util_string_isalnum(int c);
+extern int am_util_string_isalpha(int c);
+extern int am_util_string_isdigit(int c);
+extern int am_util_string_islower(int c);
+extern int am_util_string_isspace(int c);
+extern int am_util_string_isupper(int c);
+extern int am_util_string_isxdigit(int c);
+extern int am_util_string_tolower(int c);
+extern int am_util_string_toupper(int c);
+
+// Non-standard "is" Functions
+extern int am_util_string_isfilenm83(int c);
+#else
+#if MINIMIZE_CATTR_TABLE
+#define am_util_string_isalnum(c)       ((c & 0xffffff80) ? 0 : (am_cattr[c] & (AM_CATTR_ALPHA | AM_CATTR_DIGIT)) ? 1 : 0)
+#define am_util_string_isalpha(c)       ((c & 0xffffff80) ? 0 : (am_cattr[c] & AM_CATTR_ALPHA) ? 1 : 0)
+#define am_util_string_isdigit(c)       ((c & 0xffffff80) ? 0 : (am_cattr[c] & AM_CATTR_DIGIT) ? 1 : 0)
+#define am_util_string_islower(c)       ((c & 0xffffff80) ? 0 : (am_cattr[c] & AM_CATTR_LOWER) ? 1 : 0)
+#define am_util_string_isspace(c)       ((c & 0xffffff80) ? 0 : (am_cattr[c] & AM_CATTR_WHSPACE) ? 1 : 0)
+#define am_util_string_isupper(c)       ((c & 0xffffff80) ? 0 : (am_cattr[c] & AM_CATTR_UPPER) ? 1 : 0)
+#define am_util_string_isxdigit(c)      ((c & 0xffffff80) ? 0 : (am_cattr[c] & AM_CATTR_XDIGIT) ? 1 : 0)
+#define am_util_string_tolower(c)       ((am_cattr[c & 0x7f] & AM_CATTR_UPPER) ? c | 0x20 : c)
+#define am_util_string_toupper(c)       ((am_cattr[c & 0x7f] & AM_CATTR_LOWER) ? c & ~0x20 : c)
+#else
+#define am_util_string_isalnum(c)       (am_cattr[c & 0xff] & (AM_CATTR_ALPHA | AM_CATTR_DIGIT))
+#define am_util_string_isalpha(c)       (am_cattr[c & 0xff] & AM_CATTR_ALPHA)
+#define am_util_string_isdigit(c)       (am_cattr[c & 0xff] & AM_CATTR_DIGIT)
+#define am_util_string_islower(c)       (am_cattr[c & 0xff] & AM_CATTR_LOWER)
+#define am_util_string_isspace(c)       (am_cattr[c & 0xff] & AM_CATTR_WHSPACE)
+#define am_util_string_isupper(c)       (am_cattr[c & 0xff] & AM_CATTR_UPPER)
+#define am_util_string_isxdigit(c)      (am_cattr[c & 0xff] & AM_CATTR_XDIGIT)
+#define am_util_string_tolower(c)       ((am_cattr[c & 0xff] & AM_CATTR_UPPER) ? c | 0x20 : c)
+#define am_util_string_toupper(c)       ((am_cattr[c & 0xff] & AM_CATTR_LOWER) ? c & ~0x20 : c)
+#endif // MINIMIZE_CATTR_TABLE
+
+//
+// Non-standard "is" Functions
+//
+#define am_util_string_isfilenm83(c)    (am_cattr[c & 0xff] & AM_CATTR_FILENM83)
+#endif // AM_UTIL_STRING_CTYPE_DISABLE_MACROS
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_UTIL_STRING_H
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_stxetx.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_stxetx.c
new file mode 100644
index 000000000..9dda73ec0
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_stxetx.c
@@ -0,0 +1,329 @@
+//*****************************************************************************
+//
+//! @file am_util_stxetx.c
+//!
+//! @brief Support for in channel packetization for UART and I/O Slave.
+//!
+//! Functions for providing packetization and depacketization for communication
+//! over UART or I/O Slave.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#include <stdint.h>
+#include <stdbool.h>
+#include <am_mcu_apollo.h>
+#include <am_util.h>
+
+#include "am_util_stxetx.h"
+
+//*****************************************************************************
+//
+// Globals
+//
+//*****************************************************************************
+g_am_util_stxetx_t g_am_util_stxetx;
+
+//
+// Define a UART instance number to use in the following macros that call
+// HAL UART functions.
+//
+#define UART_INSTANCE       0
+
+//
+// This macro defines how we transmit a byte from am_util_stxetx_tx().
+//
+#ifndef AM_UTIL_STXETX_TX_XMIT
+#define AM_UTIL_STXETX_TX_XMIT(BYTE)                                    \
+        (am_hal_uart_char_transmit_buffered(UART_INSTANCE, BYTE))
+#endif
+
+//
+// This macro defines how we wait for and receive a character.
+//
+#ifndef AM_UTIL_STXETX_RX_RCV
+#define AM_UTIL_STXETX_RX_RCV(PTR)                                      \
+        while ( (am_hal_uart_char_receive_buffered(UART_INSTANCE, (char *)PTR, 1) != 1) )
+#endif
+
+
+//*****************************************************************************
+//
+//! @brief Initialize the STXETX utility.
+//!
+//! @param rx_function - pointer to the rx packet cracker to be registered.
+//!
+//! This function initializes the STXETX protocol utilty and registers the
+//! function that will be used to crack open received packets.
+//!
+//! @returns None
+//
+//*****************************************************************************
+void
+am_util_stxetx_init( void (*rx_function)(int32_t MeasuredLength, uint8_t *pui8Payload))
+{
+    //
+    // Register the packet cracking call back function.
+    //
+    g_am_util_stxetx.rx_function = rx_function;
+
+    //
+    // Clear the early exit from wait4stx function.
+    //
+    g_am_util_stxetx.bwait4stx_early_exit = false;
+}
+
+//*****************************************************************************
+//
+//! @brief Formats and transmits an STXETX packetized version of the payload.
+//!
+//! @param bFirst - issue the STX as the first byte.
+//! @param bLast  - issue the ETX as the Last byte.
+//! @param ui32Length - number of payload bytes.
+//! @param ppui8Payload - pointer to pointer to buffer to be transmitted.
+//!
+//! This function will transmit the contents of the payload buffer.
+//!
+//! NOTE: There may be more bytes in the output buffer than came from the input
+//! buffer. Let N = length of pay load buffer, then the output byte string can
+//! be up to 2N long in some pathological cases.  If both first and last are
+//! true then the output can be up to 2N+2 bytes long.
+//!
+//! @returns Number of characters written to puiPayload.
+//
+//*****************************************************************************
+uint32_t
+am_util_stxetx_tx(bool bFirst, bool bLast, uint32_t ui32Length, uint8_t **ppui8Payload)
+{
+    int i;
+    int Length = ui32Length;
+    uint32_t ui32FinalLength = 0;
+
+
+    //
+    // Mark the start of a packet with an STX byte.
+    //
+    if ( bFirst )
+    {
+        AM_UTIL_STXETX_TX_XMIT(STXETX_STX);
+        ui32FinalLength ++;
+    }
+
+    //
+    // process the transmit Payload
+    //
+    for ( i = 0; i < Length; i++ )
+    {
+      if ( (**ppui8Payload == STXETX_STX)   ||
+           (**ppui8Payload == STXETX_ETX)   ||
+           (**ppui8Payload == STXETX_DLE) )
+      {
+          //
+          // Insert a DLE before one of the protocol bytes.
+          //
+          AM_UTIL_STXETX_TX_XMIT(STXETX_DLE);
+          ui32FinalLength ++;
+      }
+
+      //
+      // Pass the payload byte along to the output.
+      //
+      AM_UTIL_STXETX_TX_XMIT(**ppui8Payload);
+      *ppui8Payload += 1;
+
+      //
+      // Keep track of the number of bytes in the buffer.
+      //
+      ui32FinalLength ++;
+    }
+
+
+    //
+    // Mark the end of a packet with an ETX byte.
+    //
+    if ( bLast )
+    {
+        AM_UTIL_STXETX_TX_XMIT(STXETX_ETX);
+        ui32FinalLength ++;
+    }
+
+    return ui32FinalLength;
+}
+
+
+
+//*****************************************************************************
+//
+//! @brief Waits for STX marking start of packet.
+//!
+//!
+//! This function will recieve bytes from the input stream and wait for a valid
+//! STX marking the start of packet.
+//!
+//! The return code signals whether it found an STX or return do to an external,
+//! request to exit, e.g. from an ISR.
+//!
+//! @returns True for valid STX found, i.e. start of packet and false for any
+//!          other return cause.
+//
+//
+//*****************************************************************************
+bool
+am_util_stxetx_rx_wait4start(void)
+{
+  uint8_t ui8Current = {0};
+
+    //
+    // Wait for STX to begin a packet.
+    //
+    while (1)
+    {
+        AM_UTIL_STXETX_RX_RCV(&ui8Current);
+        am_util_stdio_printf(" 0X%2.2x", ui8Current);
+
+        //
+        // detect an STX in the open
+        //
+        if ( ui8Current == STXETX_STX )
+        {
+            return true;
+        }
+
+        //
+        // if we get a DLE in the stream then discard any potential next byte
+        // since it could be an invalid STX.
+        //
+        else if ( ui8Current == STXETX_DLE )
+        {
+            //
+            // discard anything after DLE until we start a packet.
+            //
+            AM_UTIL_STXETX_RX_RCV(&ui8Current);
+
+        }
+
+        //
+        // Check for an early exit request from an ISR or other task.
+        //
+        if ( g_am_util_stxetx.bwait4stx_early_exit )
+        {
+            //
+            // Early exit before valid STX has been detected.
+            //
+            return false;
+        }
+    }
+}
+
+//*****************************************************************************
+//
+//! @brief Receives and extracts an STXETX formated packet.
+//!
+//! @param pui8Payload - pointer to buffer to load from the UART.
+//!
+//! This function will recieve the contents of an STXETX demarcated packet from
+//! a buffer. Once the end of transmission byte (ETX) byte is received, it
+//! passes the extracted payload to the registered packet cracker function.
+//! If the registered function pointer is NULL, then it is up to the caller to
+//! do any further cracking of the packet.
+//!
+//! @returns The length of the received packet.
+//
+//*****************************************************************************
+int32_t
+am_util_stxetx_rx(uint32_t ui32MaxPayloadSize, uint8_t *pui8Payload)
+{
+  uint8_t ui8Current = {0};
+    uint32_t ui32MeasuredLength = 0;
+
+    //
+    // Now we are inside a packet, stay here until we get the whole packet.
+    //
+    while (1)
+    {
+        AM_UTIL_STXETX_RX_RCV(&ui8Current);
+        am_util_stdio_printf(" 0X%2.2x", ui8Current);
+
+        //
+        // Give up if we have too many characters.
+        //
+        if ( ui32MeasuredLength >= ui32MaxPayloadSize )
+        {
+            return -1;
+        }
+
+        //
+        // detect an ETX which will end the packet
+        //
+        if ( ui8Current == STXETX_ETX )
+        {
+            break;
+        }
+
+        //
+        // Handle data link escape (DLE)
+        //
+        else if ( ui8Current == STXETX_DLE )
+        {
+            //
+            // discard the DLE
+            //
+            AM_UTIL_STXETX_RX_RCV(&ui8Current);
+            am_util_stdio_printf(" DLE: 0X%2.2x", ui8Current);
+
+            //
+            // Count this one and push it to the output.
+            //
+            ui32MeasuredLength++;
+            *pui8Payload++ = ui8Current;
+        }
+        else
+        {
+            //
+            // Push this byte to the rx buffer and count it.
+            //
+            ui32MeasuredLength++;
+            *pui8Payload++ = ui8Current;
+        }
+    }
+
+    if ( g_am_util_stxetx.rx_function )
+    {
+        g_am_util_stxetx.rx_function(ui32MeasuredLength, pui8Payload);
+    }
+
+    return ui32MeasuredLength;
+}
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_stxetx.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_stxetx.h
new file mode 100644
index 000000000..536930d58
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_stxetx.h
@@ -0,0 +1,101 @@
+//*****************************************************************************
+//
+//! @file am_util_stxetx.h
+//!
+//! @brief A packetization protocol for use with UART or I/O Slave.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_UTIL_STXETX_H
+#define AM_UTIL_STXETX_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+//*****************************************************************************
+//
+//! @name STXETX byte code assignments.
+//! @brief Byte code defines for the three special codes: STX, ETX and DLE.
+//!
+//! These macros are used in the byte stream.
+//! @{
+//
+//*****************************************************************************
+#define STXETX_STX (0x9A)
+#define STXETX_ETX (0x9B)
+#define STXETX_DLE (0x99)
+//! @}
+
+
+//*****************************************************************************
+//
+//! @name STXETX global data structure definition.
+//! @brief Global data structure definitons for the STXETX UART protocol.
+//!
+//
+//*****************************************************************************
+typedef struct
+{
+    void (*rx_function)(int32_t, uint8_t *);
+    bool bwait4stx_early_exit;
+}g_am_util_stxetx_t;
+
+extern g_am_util_stxetx_t g_am_util_stxetx;
+
+
+//*****************************************************************************
+//
+// External function definitions
+//
+//*****************************************************************************
+extern void am_util_stxetx_init( void (*rx_function)(int32_t MeasuredLength, uint8_t *pui8Payload));
+extern uint32_t am_util_stxetx_tx(bool bFirst, bool bLast, uint32_t ui32Length, 
+                                  uint8_t **ppui8Payload);
+extern bool am_util_stxetx_rx_wait4start(void);
+extern int32_t am_util_stxetx_rx(uint32_t ui32MaxPayloadSize, 
+                                 uint8_t *pui8Payload);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_UTIL_STXETX_H
+
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_tap_detect.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_tap_detect.c
new file mode 100644
index 000000000..3f1b04a08
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_tap_detect.c
@@ -0,0 +1,252 @@
+//*****************************************************************************
+//
+//! @file am_util_tap_detect.c
+//!
+//! @brief Tap Gesture Detector
+//!
+//! These functions implement the tap detector utility
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <math.h>
+
+#include <am_util_tap_detect.h>
+
+#define USE_L2_NORM
+//#define DEBUG_TAP_DETECTOR
+
+//*****************************************************************************
+//
+//! @brief Initialize tap detector structure
+//!
+//! @param tap is a pointer to the tap detector structure
+//! @param dp_min_seconds minimum time to detect double (or triple) tap
+//! @param dp_max_seconds maximum time to detect double (or triple) tap
+//! @param srate is the sample rate at which the accel runs typically 400 or 200
+//! @param slope_thresh is the sensitivity setting for tap detection, typ 800
+//!
+//! This function initializes the tap detector structure and sets various
+//! settings, e.g. min/max times for classifying single, double or triple taps.
+//! In addition the structures tells the tap detector how long one sample is
+//! in time. Finally, it specifies the sensitiviy of tap detection by setting
+//! a minimimum slope threshold to signal tap detections.
+//!
+//! returns nothing
+//
+//*****************************************************************************
+void
+am_util_tap_detect_init(am_util_tap_detect_t * tap,
+                        float dp_min_seconds,
+                        float dp_max_seconds,
+                        float srate,
+                        float slope_thresh)
+{
+
+  tap->prev_accX = 0;
+  tap->prev_accY = 0;
+  tap->prev_accZ = 0;
+  tap->sample_count = 0;
+  tap->start_flag = true;
+#ifndef USE_L2_NORM
+  tap->SlopeThreshold = slope_thresh;
+#else
+  tap->SlopeThreshold = slope_thresh*slope_thresh;
+#endif
+  tap->previous_peak_location = -10000000;
+  tap->sample_rate = srate;
+  tap->previous_tap_was_dbl_tap = 0;
+  tap->peak_min_width_seconds = dp_min_seconds;
+  tap->group_peak_max_threshold_seconds = dp_max_seconds;
+  //convert to samples
+  tap->peak_min_width_samples = srate*tap->peak_min_width_seconds;
+  tap->group_peak_max_threshold = srate*tap->group_peak_max_threshold_seconds;
+  tap->max_mag = 0;
+
+}
+
+
+//*****************************************************************************
+//
+//! @brief Print the contents of the Tap Detector Structure
+//!
+//! @param tap is a pointer to the tap detector structure
+//!
+//! This function will print the contents of the tap detector structure if
+//! needed for debug.
+//!
+//! returns nothing
+//
+//*****************************************************************************
+#ifdef DEBUG_TAP_DETECTOR
+void
+am_util_tap_detect_print(am_util_tap_detect_t * tap)
+{
+    am_util_stdio_printf("Sampling Rate          = %d\n", (int)tap->sample_rate);
+    am_util_stdio_printf("SlopeThreshold         = %d\n", (int)tap->SlopeThreshold);
+    //am_util_stdio_printf("DoublePeak min seconds = %f\n",
+    //                     tap->double_peak_min_threshold_seconds);
+    //am_util_stdio_printf("DoublePeak max seconds = %f\n",
+    //                     tap->double_peak_max_threshold_seconds);
+    am_util_stdio_printf("DoublePeak min samples = %i\n",
+                         tap->double_peak_min_threshold);
+    am_util_stdio_printf("DoublePeak max samples = %i\n",
+                         tap->double_peak_max_threshold);
+    am_util_stdio_printf("Start Flag = %i\n", tap->start_flag);
+
+    // new stuff below
+    printf("Sampling Rate          = %f\n", tap->sample_rate);
+    printf("SlopeThreshold         = %f\n", tap->SlopeThreshold);
+    printf("DoublePeak min seconds = %f\n", tap->peak_min_width_seconds);
+    printf("DoublePeak max seconds = %f\n", tap->group_peak_max_threshold_seconds);
+    printf("DoublePeak min samples = %i\n", tap->peak_min_width_samples);
+    printf("DoublePeak max samples = %i\n", tap->group_peak_max_threshold);
+}
+
+#endif
+
+
+//*****************************************************************************
+//
+//! @brief Process One Sample (Triplet) Through the Tap Dector
+//!
+//! @param tap is a pointer to the tap detector structure
+//! @param accX Accelerometer X axis value of a triplet
+//! @param accY Accelerometer Y axis value of a triplet
+//! @param accZ Accelerometer Z axis value of a triplet
+//!
+//! This function utilizes the tap detector structure in conjunction with sample
+//! counting to establish all necessary timing.
+//!
+//! @return NO_TAP, TAP_OCCURED, TAP, DOUBLE, TRIPLE
+//
+//*****************************************************************************
+am_util_tap_detect_enum_t
+am_util_tap_detect_process_sample(am_util_tap_detect_t * tap,
+                                  short accX, short accY, short accZ)
+{
+
+    am_util_tap_detect_enum_t out = NO_TAP_DETECTED;
+    static int tap_occured = 0;
+
+    //initialize the first previous sample
+    if ( tap->start_flag )
+    {
+        tap->start_flag = false;
+        tap->prev_accX = accX;
+        tap->prev_accY = accY;
+        tap->prev_accZ = accZ;
+    }
+
+    //Feature Extract ----------------------------------------------------
+    //get the first derivative
+    float axx = accX - tap->prev_accX;
+    float ayy = accY - tap->prev_accY;
+    float azz = accZ - tap->prev_accZ;
+
+    //get the magnitude of the partial derivatives
+    //NOTE: do not need the sqrt!!! This is a lot of cycles!
+#ifndef USE_L2_NORM
+    float mag_sample = sqrt((axx*axx) + (ayy*ayy) + (azz*azz));
+#else
+    float mag_sample = ((axx*axx) + (ayy*ayy) + (azz*azz));
+#endif
+
+    //PEAK DETECTION **********************************************************
+    if ( mag_sample > tap->SlopeThreshold )
+    {
+
+        int distance = (tap->sample_count - tap->previous_peak_location);
+
+        //OK detect a standard tape
+        if ( distance > tap->peak_min_width_samples )   //should be min peak width
+        {
+            // returned only for first tap event, TAP, DOUBLE or TRIPLE over writes
+            out = TAP_OCCURED;
+            tap_occured++;
+        }
+
+        //record where this peak occured
+        tap->previous_peak_location = tap->sample_count;
+
+        //these are handy for debugging and tuning
+        if ( mag_sample > tap->max_mag )
+        {
+            tap->max_mag = mag_sample;
+        }
+        tap->dist = distance;
+    }
+
+    //GROUPING CLASSIFICATION OF SINGLE, DOUBLE, AND TRIPLE TAPS
+    //*******************************************************************************
+    //These are grouping cases where we report a single, double, or triple tap
+    // If a tap is within group_peak_max_threshold, than is forms a group of taps such as DOULBLE or TRIPLE
+    // otherwise the tap is just a single tap
+    int dist_classification = (tap->sample_count - tap->previous_peak_location);
+    if ( (tap_occured == 1) &&  (dist_classification > tap->group_peak_max_threshold) )
+    {
+        out = TAP_DETECTED;
+        tap_occured = 0;
+    }
+    if ( (tap_occured == 2) &&  (dist_classification > tap->group_peak_max_threshold) )
+    {
+        out = DOUBLE_TAP_DETECTED;
+        tap_occured = 0;
+    }
+    if ( tap_occured == 3 )
+    {
+        out = TRIPLE_TAP_DETECTED;
+        tap_occured = 0;
+    }
+
+    //*******************************************************************************
+
+    tap->mag = mag_sample;
+
+    //store for next sample --------------------------------------------------
+    tap->prev_accX = accX;
+    tap->prev_accY = accY;
+    tap->prev_accZ = accZ;
+
+    //sample_count keeps track of time!!!-------------------------------------
+    tap->sample_count++;
+
+    return out;
+}
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_tap_detect.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_tap_detect.h
new file mode 100644
index 000000000..bbc883c9c
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_tap_detect.h
@@ -0,0 +1,124 @@
+//*****************************************************************************
+//
+//! @file am_util_tap_detect.h
+//!
+//! @brief Tap Gesture Detector
+//!
+//! These functions implement the tap detector utility
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_UTIL_TAP_DETECT_H
+#define AM_UTIL_TAP_DETECT_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+//*****************************************************************************
+//
+// Enumerated return constants
+//
+//*****************************************************************************
+typedef enum
+{
+    NO_TAP_DETECTED = 0,
+    TAP_OCCURED,           // reports every tap
+    TAP_DETECTED,          // only if a single tap is not part of double/triple
+    DOUBLE_TAP_DETECTED,
+    TRIPLE_TAP_DETECTED
+}am_util_tap_detect_enum_t;
+
+
+//*****************************************************************************
+//
+// Tap Detector Data Structure
+//
+//*****************************************************************************
+typedef struct am_util_tap_detector
+{
+  float accX;
+  float accY;
+  float accZ;
+  float prev_accX;
+  float prev_accY;
+  float prev_accZ;
+  float SlopeThreshold;
+  int   previous_peak_location;
+  int   current_sample;
+  int   sample_count;
+  bool  start_flag;
+  float sample_rate;
+  //in terms of seconds
+  float  peak_min_width_seconds;
+  float  group_peak_max_threshold_seconds;
+  //in terms of samples
+  int  peak_min_width_samples;
+  int  group_peak_max_threshold;
+  //record the max peak found so you can adjust threshold in future
+  float max_mag;
+  float mag; //magnitude of the partial derivatives
+  int   dist;
+  //previous peak was double tap -> flag to sep[arate out double tap pairs
+  int previous_tap_was_dbl_tap;
+
+} am_util_tap_detect_t;
+
+//*****************************************************************************
+//
+// External function definitions
+//
+//*****************************************************************************
+void am_util_tap_detect_init(am_util_tap_detect_t * tap,
+                             float dp_min_seconds,
+                             float dp_max_seconds,
+                             float srate,
+                             float slope_thresh);
+void am_util_tap_detect_print(am_util_tap_detect_t * tap);
+am_util_tap_detect_enum_t am_util_tap_detect_process_sample
+                       (am_util_tap_detect_t * tap,
+                        short accX, short accY, short accZ);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_UTIL_TAP_DETECT_H
+
+
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_time.c b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_time.c
new file mode 100644
index 000000000..8ebbb82ac
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_time.c
@@ -0,0 +1,148 @@
+//*****************************************************************************
+//
+//! @file am_util_time.h
+//!
+//! @brief Functions useful for RTC, calendar, time, etc. computations.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#include <stdint.h>
+#include <stdbool.h>
+#include "am_util_time.h"
+
+//*****************************************************************************
+//
+//! @brief Compute the day of the week given the month, day, and year.
+//!
+//! @param iYear  - The year of the desired date (e.g. 2016).  The smallest
+//! allowed year is 2000.
+//! @param iMonth - The month of the desired date (1-12).
+//! @param iDay   - The day of the month of the desired date (1-31).
+//!
+//! This function is general in nature, but is designed to be used with the RTC.
+//!
+//! Note: This function is valid for the years 2000 - 2399 (it breaks at year
+//! 2400 because the year 2400 is NOT a leap year).
+//!
+//! @returns An index value indicating the day of the week.
+//! 0-6 indicate  Sun, Mon, Tue, Wed, Thu, Fri, Sat, respectively.
+//! 7   indicates that the given date is invalid (e.g. 2/29/2015).
+//
+//*****************************************************************************
+int
+am_util_time_computeDayofWeek(int iYear, int iMonth, int iDay)
+{
+    int iDayCnt, iCnt;
+
+    //
+    // 1/1/2000 was a Saturday, which we'll use as a base date.
+    // To get the day of the week of the given date, we'll compute the number
+    //  of days from 1/1/2000, then offset that from Saturday (6).
+    //
+
+    //
+    // Validate inputs.  Return 7 if any are out-of-bounds.
+    //
+    if ( (iMonth < 1) || (iMonth > 12) || (iYear < 2000) || (iYear >= 2400) || (iDay < 1) )
+    {
+        return 7;
+    }
+
+    if ( (iMonth == 2) && (iDay > 28) )
+    {
+        if ( (iDay > 29) || (iYear % 4) )
+        {
+            return 7;
+        }
+    }
+
+    //
+    // 0-base the month and date.
+    //
+    iMonth--;
+    iDay--;
+
+    //
+    // First we'll count the number of days up to the the specified
+    // month and date in the specified year.
+    //
+    iDayCnt = iDay;
+    iCnt = 0;
+    while ( iCnt < iMonth )
+    {
+        switch ( iCnt )
+        {
+            case 3:
+            case 5:
+            case 8:
+            case 10:
+                iDayCnt += 30;
+                break;
+            case 0:
+            case 2:
+            case 4:
+            case 6:
+            case 7:
+            case 9:
+            case 11:
+                iDayCnt += 31;
+                break;
+            case 1:
+                iDayCnt += (iYear % 4) ? 28 : 29;
+                break;
+        }
+        iCnt++;
+    }
+
+    //
+    // Now, add in the number of days in the intervening years between
+    // 2000 and the specified year.
+    //
+    iCnt = 2000;
+    while ( iCnt < iYear )
+    {
+        iDayCnt += (iCnt % 4) ? 365 : 366;
+        iCnt++;
+    }
+
+    //
+    // Offset the day count with the base day of the week.
+    // For Saturday, this is 6.
+    //
+    return (iDayCnt + 6) % 7;
+}
+
diff --git a/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_time.h b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_time.h
new file mode 100644
index 000000000..7efb0ee5d
--- /dev/null
+++ b/hw/mcu/ambiq/src/ext/AmbiqSuite/utils/am_util_time.h
@@ -0,0 +1,63 @@
+//*****************************************************************************
+//
+//! @file am_util_time.h
+//!
+//! @brief Functions useful for RTC, calendar, time, etc. computations.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Copyright (c) 2017, Ambiq Micro
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// 
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// 
+// 3. Neither the name of the copyright holder nor the names of its
+// contributors may be used to endorse or promote products derived from this
+// software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+// This is part of revision 1.2.8 of the AmbiqSuite Development Package.
+//
+//*****************************************************************************
+#ifndef AM_UTIL_TIME_H
+#define AM_UTIL_TIME_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+//*****************************************************************************
+//
+// External function definitions
+//
+//*****************************************************************************
+extern int am_util_time_computeDayofWeek(int iYear, int iMonth, int iDay);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // AM_UTIL_TIME_H
+
diff --git a/net/nimble/host/services/ans/src/ble_svc_ans.c b/net/nimble/host/services/ans/src/ble_svc_ans.c
index 2403c6dc8..507d79574 100644
--- a/net/nimble/host/services/ans/src/ble_svc_ans.c
+++ b/net/nimble/host/services/ans/src/ble_svc_ans.c
@@ -20,6 +20,12 @@
 #include <assert.h>
 #include <string.h>
 #include <math.h>
+
+/* Some ambiq SDK headers use `OVERFLOW` as an identifier.  This is a macro
+ * that is leaked by some versions of math.h.
+ */
+#undef OVERFLOW
+
 #include "sysinit/sysinit.h"
 #include "syscfg/syscfg.h"
 #include "host/ble_hs.h"
diff --git a/net/nimble/transport/emspi/include/transport/emspi/ble_hci_emspi.h b/net/nimble/transport/emspi/include/transport/emspi/ble_hci_emspi.h
new file mode 100644
index 000000000..738d9e6d5
--- /dev/null
+++ b/net/nimble/transport/emspi/include/transport/emspi/ble_hci_emspi.h
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef H_BLE_HCI_EMSPI_
+#define H_BLE_HCI_EMSPI_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void ble_hci_emspi_init(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/net/nimble/transport/emspi/pkg.yml b/net/nimble/transport/emspi/pkg.yml
new file mode 100644
index 000000000..a1f651172
--- /dev/null
+++ b/net/nimble/transport/emspi/pkg.yml
@@ -0,0 +1,36 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+pkg.name: net/nimble/transport/emspi
+pkg.description: "HCI transport using EM's HCI SPI protocol."
+pkg.author: "Apache Mynewt <de...@mynewt.apache.org>"
+pkg.homepage: "http://mynewt.apache.org/"
+pkg.keywords:
+    - ble
+    - bluetooth
+
+pkg.deps:
+    - net/nimble
+    - kernel/os
+
+pkg.apis:
+    - ble_transport
+
+pkg.init:
+    ble_hci_emspi_init: 100
diff --git a/net/nimble/transport/emspi/src/ble_hci_emspi.c b/net/nimble/transport/emspi/src/ble_hci_emspi.c
new file mode 100644
index 000000000..309d30c79
--- /dev/null
+++ b/net/nimble/transport/emspi/src/ble_hci_emspi.c
@@ -0,0 +1,935 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <assert.h>
+#include <string.h>
+#include <stdio.h>
+#include <errno.h>
+#include <stdint.h>
+#include "sysinit/sysinit.h"
+#include "syscfg/syscfg.h"
+#include "os/os_cputime.h"
+#include "bsp/bsp.h"
+#include "os/os.h"
+#include "mem/mem.h"
+#include "hal/hal_gpio.h"
+#include "hal/hal_spi.h"
+
+/* BLE */
+#include "nimble/ble.h"
+#include "nimble/nimble_opt.h"
+#include "nimble/hci_common.h"
+#include "nimble/ble_hci_trans.h"
+
+#include "transport/emspi/ble_hci_emspi.h"
+
+#include "am_mcu_apollo.h"
+
+/***
+ * NOTES:
+ * The emspi HCI transport doesn't use event buffer priorities.  All incoming
+ * and outgoing events use buffers from the same pool.
+ *
+ */
+
+#define BLE_HCI_EMSPI_PKT_EVT_COUNT         \
+    (MYNEWT_VAL(BLE_HCI_EVT_HI_BUF_COUNT) + \
+     MYNEWT_VAL(BLE_HCI_EVT_LO_BUF_COUNT))
+
+#define BLE_HCI_EMSPI_PKT_NONE          0x00
+#define BLE_HCI_EMSPI_PKT_CMD           0x01
+#define BLE_HCI_EMSPI_PKT_ACL           0x02
+#define BLE_HCI_EMSPI_PKT_EVT           0x04
+
+#define BLE_HCI_EMSPI_CTLR_STATUS_OK    0xc0
+#define BLE_HCI_EMSPI_OP_TX             0x42
+#define BLE_HCI_EMSPI_OP_RX             0x81
+
+/**
+ * A packet to be sent over the UART.  This can be a command, an event, or ACL
+ * data.
+ */
+struct ble_hci_emspi_pkt {
+    STAILQ_ENTRY(ble_hci_emspi_pkt) next;
+    void *data;
+    uint8_t type;
+};
+STAILQ_HEAD(, ble_hci_emspi_pkt) ble_hci_emspi_tx_q;
+
+static os_event_fn ble_hci_emspi_event_txrx;
+
+static struct os_event ble_hci_emspi_ev_txrx = {
+    .ev_cb = ble_hci_emspi_event_txrx,
+};
+
+static struct os_eventq ble_hci_emspi_evq;
+static struct os_task ble_hci_emspi_task;
+static os_stack_t ble_hci_emspi_stack[MYNEWT_VAL(BLE_HCI_EMSPI_STACK_SIZE)];
+
+static ble_hci_trans_rx_cmd_fn *ble_hci_emspi_rx_cmd_cb;
+static void *ble_hci_emspi_rx_cmd_arg;
+
+static ble_hci_trans_rx_acl_fn *ble_hci_emspi_rx_acl_cb;
+static void *ble_hci_emspi_rx_acl_arg;
+
+static struct os_mempool ble_hci_emspi_evt_hi_pool;
+static void *ble_hci_emspi_evt_hi_buf;
+static struct os_mempool ble_hci_emspi_evt_lo_pool;
+static void *ble_hci_emspi_evt_lo_buf;
+
+static struct os_mempool ble_hci_emspi_cmd_pool;
+static void *ble_hci_emspi_cmd_buf;
+
+static struct os_mempool ble_hci_emspi_pkt_pool;
+static void *ble_hci_emspi_pkt_buf;
+
+static struct os_mbuf_pool ble_hci_emspi_acl_mbuf_pool;
+static struct os_mempool ble_hci_emspi_acl_pool;
+static void *ble_hci_emspi_acl_buf;
+
+static void
+ble_hci_emspi_rdy_isr(void *arg)
+{
+    os_eventq_put(&ble_hci_emspi_evq, &ble_hci_emspi_ev_txrx);
+}
+
+static void
+ble_hci_emspi_initiate_write(void)
+{
+    hal_gpio_irq_disable(MYNEWT_VAL(BLE_HCI_EMSPI_RDY_PIN));
+
+    /* Assert slave select. */
+    hal_gpio_write(MYNEWT_VAL(BLE_HCI_EMSPI_SS_PIN), 0);
+
+    /* Wait for controller to indicate ready-to-receive. */
+    while (!hal_gpio_read(MYNEWT_VAL(BLE_HCI_EMSPI_RDY_PIN))) { }
+}
+
+static void
+ble_hci_emspi_terminate_write(void)
+{
+    const uint64_t rdy_mask =
+        AM_HAL_GPIO_BIT(MYNEWT_VAL(BLE_HCI_EMSPI_RDY_PIN));
+    os_sr_t sr;
+
+    am_hal_gpio_int_clear(rdy_mask);
+
+    /* Deassert slave select. */
+    hal_gpio_write(MYNEWT_VAL(BLE_HCI_EMSPI_SS_PIN), 1);
+
+    OS_ENTER_CRITICAL(sr);
+    hal_gpio_irq_enable(MYNEWT_VAL(BLE_HCI_EMSPI_RDY_PIN));
+
+    if (hal_gpio_read(MYNEWT_VAL(BLE_HCI_EMSPI_RDY_PIN))) {
+        am_hal_gpio_int_set(rdy_mask);
+    }
+
+    OS_EXIT_CRITICAL(sr);
+}
+
+static int
+ble_hci_emspi_write_hdr(uint8_t first_byte, uint8_t *out_buf_size)
+{
+    const uint8_t hdr[2] = { first_byte, 0x00 };
+    uint8_t rx[2];
+    int rc;
+
+    /* Send command header. */
+    rc = hal_spi_txrx(MYNEWT_VAL(BLE_HCI_EMSPI_SPI_NUM), (void *)hdr, rx, 2);
+    if (rc != 0) {
+        return rc;
+    }
+
+    /* Check for "OK" status. */
+    if (rx[0] != BLE_HCI_EMSPI_CTLR_STATUS_OK) {
+        return BLE_ERR_HW_FAIL;
+    }
+
+    *out_buf_size = rx[1];
+    return 0;
+}
+
+/**
+ * Transmits a chunk of bytes to the controller.
+ */
+static int
+ble_hci_emspi_tx_chunk(const uint8_t *data, int len, int *out_bytes_txed)
+{
+    uint8_t buf_size;
+    int rc;
+
+    ble_hci_emspi_initiate_write();
+
+    rc = ble_hci_emspi_write_hdr(BLE_HCI_EMSPI_OP_TX, &buf_size);
+    if (rc != 0) {
+        goto done;
+    }
+
+    if (buf_size == 0) {
+        *out_bytes_txed = 0;
+        rc = 0;
+        goto done;
+    }
+
+    if (buf_size < len) {
+        len = buf_size;
+    }
+    rc = hal_spi_txrx(MYNEWT_VAL(BLE_HCI_EMSPI_SPI_NUM), (void *)data, NULL,
+                      len);
+    if (rc != 0) {
+        goto done;
+    }
+    *out_bytes_txed = len;
+
+done:
+    ble_hci_emspi_terminate_write();
+    return rc;
+}
+
+/**
+ * Transmits a full command or ACL data packet to the controller.
+ */
+static int
+ble_hci_emspi_tx(const uint8_t *data, int len)
+{
+    int bytes_txed;
+    int rc;
+
+    while (len > 0) {
+        rc = ble_hci_emspi_tx_chunk(data, len, &bytes_txed);
+        if (rc != 0) {
+            goto done;
+        }
+
+        data += bytes_txed;
+        len -= bytes_txed;
+    }
+
+    rc = 0;
+
+done:
+    return rc;
+}
+
+/**
+ * Reads the specified number of bytes from the controller.
+ */
+static int
+ble_hci_emspi_rx(uint8_t *data, int max_len)
+{
+    uint8_t buf_size;
+    int rc;
+
+    ble_hci_emspi_initiate_write();
+
+    rc = ble_hci_emspi_write_hdr(BLE_HCI_EMSPI_OP_RX, &buf_size);
+    if (rc != 0) {
+        goto done;
+    }
+
+    if (buf_size > max_len) {
+        buf_size = max_len;
+    }
+
+    rc = hal_spi_txrx(MYNEWT_VAL(BLE_HCI_EMSPI_SPI_NUM), NULL, data, buf_size);
+    if (rc != 0) {
+        rc = BLE_ERR_HW_FAIL;
+        goto done;
+    }
+
+done:
+    ble_hci_emspi_terminate_write();
+    return rc;
+}
+
+/**
+ * Allocates a buffer (mbuf) for ACL operation.
+ *
+ * @return                      The allocated buffer on success;
+ *                              NULL on buffer exhaustion.
+ */
+static struct os_mbuf *
+ble_hci_trans_acl_buf_alloc(void)
+{
+    struct os_mbuf *m;
+
+    /*
+     * XXX: note that for host only there would be no need to allocate
+     * a user header. Address this later.
+     */
+    m = os_mbuf_get_pkthdr(&ble_hci_emspi_acl_mbuf_pool,
+                           sizeof(struct ble_mbuf_hdr));
+    return m;
+}
+
+/**
+ * Transmits an ACL data packet to the controller.  The caller relinquishes the
+ * specified mbuf, regardless of return status.
+ */
+static int
+ble_hci_emspi_acl_tx(struct os_mbuf *om)
+{
+    struct ble_hci_emspi_pkt *pkt;
+    os_sr_t sr;
+
+    /* If this packet is zero length, just free it */
+    if (OS_MBUF_PKTLEN(om) == 0) {
+        os_mbuf_free_chain(om);
+        return 0;
+    }
+
+    pkt = os_memblock_get(&ble_hci_emspi_pkt_pool);
+    if (pkt == NULL) {
+        os_mbuf_free_chain(om);
+        return BLE_ERR_MEM_CAPACITY;
+    }
+
+    pkt->type = BLE_HCI_EMSPI_PKT_ACL;
+    pkt->data = om;
+
+    OS_ENTER_CRITICAL(sr);
+    STAILQ_INSERT_TAIL(&ble_hci_emspi_tx_q, pkt, next);
+    OS_EXIT_CRITICAL(sr);
+
+    os_eventq_put(&ble_hci_emspi_evq, &ble_hci_emspi_ev_txrx);
+
+    return 0;
+}
+
+/**
+ * Transmits a command packet to the controller.  The caller relinquishes the
+ * specified buffer, regardless of return status.
+ */
+static int
+ble_hci_emspi_cmdevt_tx(uint8_t *cmd_buf, uint8_t pkt_type)
+{
+    struct ble_hci_emspi_pkt *pkt;
+    os_sr_t sr;
+
+    pkt = os_memblock_get(&ble_hci_emspi_pkt_pool);
+    if (pkt == NULL) {
+        ble_hci_trans_buf_free(cmd_buf);
+        return BLE_ERR_MEM_CAPACITY;
+    }
+
+    pkt->type = pkt_type;
+    pkt->data = cmd_buf;
+
+    OS_ENTER_CRITICAL(sr);
+    STAILQ_INSERT_TAIL(&ble_hci_emspi_tx_q, pkt, next);
+    OS_EXIT_CRITICAL(sr);
+
+    os_eventq_put(&ble_hci_emspi_evq, &ble_hci_emspi_ev_txrx);
+
+    return 0;
+}
+
+static int
+ble_hci_emspi_tx_flat(const uint8_t *data, int len)
+{
+    int rc;
+
+    rc = ble_hci_emspi_tx(data, len);
+    return rc;
+}
+
+static int
+ble_hci_emspi_tx_pkt_type(uint8_t pkt_type)
+{
+    return ble_hci_emspi_tx_flat(&pkt_type, 1);
+}
+
+static int
+ble_hci_emspi_tx_cmd(const uint8_t *data)
+{
+    int len;
+    int rc;
+
+    rc = ble_hci_emspi_tx_pkt_type(BLE_HCI_EMSPI_PKT_CMD);
+    if (rc != 0) {
+        return rc;
+    }
+
+    len = data[2] + BLE_HCI_CMD_HDR_LEN;
+    rc = ble_hci_emspi_tx_flat(data, len);
+    if (rc != 0) {
+        return rc;
+    }
+
+    return 0;
+}
+
+static int
+ble_hci_emspi_tx_acl(struct os_mbuf *om)
+{
+    struct os_mbuf *cur;
+    int rc;
+
+    rc = ble_hci_emspi_tx_pkt_type(BLE_HCI_EMSPI_PKT_ACL);
+    if (rc != 0) {
+        return rc;
+    }
+
+    cur = om;
+    while (cur != NULL) {
+        rc = ble_hci_emspi_tx(cur->om_data, cur->om_len);
+        if (rc != 0) {
+            break;
+        }
+
+        cur = SLIST_NEXT(cur, om_next);
+    }
+
+    return rc;
+}
+
+static struct ble_hci_emspi_pkt *
+ble_hci_emspi_pull_next_tx(void)
+{
+    struct ble_hci_emspi_pkt *pkt;
+    os_sr_t sr;
+
+    OS_ENTER_CRITICAL(sr);
+    pkt = STAILQ_FIRST(&ble_hci_emspi_tx_q);
+    if (pkt != NULL) {
+        STAILQ_REMOVE(&ble_hci_emspi_tx_q, pkt, ble_hci_emspi_pkt, next);
+    }
+    OS_EXIT_CRITICAL(sr);
+
+    return pkt;
+}
+
+static int
+ble_hci_emspi_tx_pkt(void)
+{
+    struct ble_hci_emspi_pkt *pkt;
+    int rc;
+
+    pkt = ble_hci_emspi_pull_next_tx();
+    if (pkt == NULL) {
+        return -1;
+    }
+
+    switch (pkt->type) {
+    case BLE_HCI_EMSPI_PKT_CMD:
+        rc = ble_hci_emspi_tx_cmd(pkt->data);
+        ble_hci_trans_buf_free(pkt->data);
+        break;
+
+    case BLE_HCI_EMSPI_PKT_ACL:
+        rc = ble_hci_emspi_tx_acl(pkt->data);
+        os_mbuf_free_chain(pkt->data);
+        break;
+
+    default:
+        rc = -1;
+        break;
+    }
+
+    os_memblock_put(&ble_hci_emspi_pkt_pool, pkt);
+
+    return rc;
+}
+
+static int
+ble_hci_emspi_rx_evt(void)
+{
+    uint8_t *data;
+    uint8_t len;
+    int rc;
+
+    /* XXX: we should not assert if host cannot allocate an event. Need
+     * to determine what to do here.
+     */
+    data = ble_hci_trans_buf_alloc(BLE_HCI_TRANS_BUF_EVT_HI);
+    assert(data != NULL);
+
+    rc = ble_hci_emspi_rx(data, BLE_HCI_EVENT_HDR_LEN);
+    if (rc != 0) {
+        goto err;
+    }
+
+    len = data[1];
+    if (len > 0) {
+        rc = ble_hci_emspi_rx(data + BLE_HCI_EVENT_HDR_LEN, len);
+        if (rc != 0) {
+            goto err;
+        }
+    }
+
+    assert(ble_hci_emspi_rx_cmd_cb != NULL);
+    ble_hci_emspi_rx_cmd_cb(data, ble_hci_emspi_rx_cmd_arg);
+    if (rc != 0) {
+        goto err;
+    }
+
+    return 0;
+
+err:
+    ble_hci_trans_buf_free(data);
+    return rc;
+}
+
+static int
+ble_hci_emspi_rx_acl(void)
+{
+    struct os_mbuf *om;
+    uint16_t len;
+    int rc;
+
+    /* XXX: we should not assert if host cannot allocate an mbuf. Need to
+     * determine what to do here.
+     */
+    om = ble_hci_trans_acl_buf_alloc();
+    assert(om != NULL);
+
+    rc = ble_hci_emspi_rx(om->om_data, BLE_HCI_DATA_HDR_SZ);
+    if (rc != 0) {
+        goto err;
+    }
+
+    len = get_le16(om->om_data + 2);
+    if (len > MYNEWT_VAL(BLE_ACL_BUF_SIZE)) {
+        /*
+         * Data portion cannot exceed data length of acl buffer. If it does
+         * this is considered to be a loss of sync.
+         */
+        rc = BLE_ERR_UNSPECIFIED;
+        goto err;
+    }
+
+    if (len > 0) {
+        rc = ble_hci_emspi_rx(om->om_data + BLE_HCI_DATA_HDR_SZ, len);
+        if (rc != 0) {
+            goto err;
+        }
+    }
+
+    OS_MBUF_PKTLEN(om) = BLE_HCI_DATA_HDR_SZ + len;
+    om->om_len = BLE_HCI_DATA_HDR_SZ + len;
+
+    assert(ble_hci_emspi_rx_cmd_cb != NULL);
+    rc = ble_hci_emspi_rx_acl_cb(om, ble_hci_emspi_rx_acl_arg);
+    if (rc != 0) {
+        goto err;
+    }
+
+    return 0;
+
+err:
+    os_mbuf_free_chain(om);
+    return rc;
+}
+
+/**
+ * @return                      The type of packet to follow success;
+ *                              -1 if there is no valid packet to receive.
+ */
+static int
+ble_hci_emspi_rx_pkt(void)
+{
+    uint8_t pkt_type;
+    int rc;
+
+    /* XXX: This is awkward; should read the full packet in "one go". */
+    rc = ble_hci_emspi_rx(&pkt_type, 1);
+    if (rc != 0) {
+        return rc;
+    }
+
+    switch (pkt_type) {
+    case BLE_HCI_EMSPI_PKT_EVT:
+        return ble_hci_emspi_rx_evt();
+
+    case BLE_HCI_EMSPI_PKT_ACL:
+        return ble_hci_emspi_rx_acl();
+
+    default:
+        /* XXX */
+        return -1;
+    }
+}
+
+static void
+ble_hci_emspi_set_rx_cbs(ble_hci_trans_rx_cmd_fn *cmd_cb,
+                        void *cmd_arg,
+                        ble_hci_trans_rx_acl_fn *acl_cb,
+                        void *acl_arg)
+{
+    ble_hci_emspi_rx_cmd_cb = cmd_cb;
+    ble_hci_emspi_rx_cmd_arg = cmd_arg;
+    ble_hci_emspi_rx_acl_cb = acl_cb;
+    ble_hci_emspi_rx_acl_arg = acl_arg;
+}
+
+static void
+ble_hci_emspi_free_pkt(uint8_t type, uint8_t *cmdevt, struct os_mbuf *acl)
+{
+    switch (type) {
+    case BLE_HCI_EMSPI_PKT_NONE:
+        break;
+
+    case BLE_HCI_EMSPI_PKT_CMD:
+    case BLE_HCI_EMSPI_PKT_EVT:
+        ble_hci_trans_buf_free(cmdevt);
+        break;
+
+    case BLE_HCI_EMSPI_PKT_ACL:
+        os_mbuf_free_chain(acl);
+        break;
+
+    default:
+        assert(0);
+        break;
+    }
+}
+
+/**
+ * Sends an HCI event from the controller to the host.
+ *
+ * @param cmd                   The HCI event to send.  This buffer must be
+ *                                  allocated via ble_hci_trans_buf_alloc().
+ *
+ * @return                      0 on success;
+ *                              A BLE_ERR_[...] error code on failure.
+ */
+int
+ble_hci_trans_ll_evt_tx(uint8_t *cmd)
+{
+    return BLE_ERR_UNSUPPORTED;
+}
+
+/**
+ * Sends ACL data from controller to host.
+ *
+ * @param om                    The ACL data packet to send.
+ *
+ * @return                      0 on success;
+ *                              A BLE_ERR_[...] error code on failure.
+ */
+int
+ble_hci_trans_ll_acl_tx(struct os_mbuf *om)
+{
+    return BLE_ERR_UNSUPPORTED;
+}
+
+/**
+ * Sends an HCI command from the host to the controller.
+ *
+ * @param cmd                   The HCI command to send.  This buffer must be
+ *                                  allocated via ble_hci_trans_buf_alloc().
+ *
+ * @return                      0 on success;
+ *                              A BLE_ERR_[...] error code on failure.
+ */
+int
+ble_hci_trans_hs_cmd_tx(uint8_t *cmd)
+{
+    int rc;
+
+    rc = ble_hci_emspi_cmdevt_tx(cmd, BLE_HCI_EMSPI_PKT_CMD);
+    return rc;
+}
+
+/**
+ * Sends ACL data from host to controller.
+ *
+ * @param om                    The ACL data packet to send.
+ *
+ * @return                      0 on success;
+ *                              A BLE_ERR_[...] error code on failure.
+ */
+int
+ble_hci_trans_hs_acl_tx(struct os_mbuf *om)
+{
+    int rc;
+
+    rc = ble_hci_emspi_acl_tx(om);
+    return rc;
+}
+
+/**
+ * Configures the HCI transport to call the specified callback upon receiving
+ * HCI packets from the controller.  This function should only be called by by
+ * host.
+ *
+ * @param cmd_cb                The callback to execute upon receiving an HCI
+ *                                  event.
+ * @param cmd_arg               Optional argument to pass to the command
+ *                                  callback.
+ * @param acl_cb                The callback to execute upon receiving ACL
+ *                                  data.
+ * @param acl_arg               Optional argument to pass to the ACL
+ *                                  callback.
+ */
+void
+ble_hci_trans_cfg_hs(ble_hci_trans_rx_cmd_fn *cmd_cb,
+                     void *cmd_arg,
+                     ble_hci_trans_rx_acl_fn *acl_cb,
+                     void *acl_arg)
+{
+    ble_hci_emspi_set_rx_cbs(cmd_cb, cmd_arg, acl_cb, acl_arg);
+}
+
+/**
+ * Configures the HCI transport to operate with a host.  The transport will
+ * execute specified callbacks upon receiving HCI packets from the controller.
+ *
+ * @param cmd_cb                The callback to execute upon receiving an HCI
+ *                                  event.
+ * @param cmd_arg               Optional argument to pass to the command
+ *                                  callback.
+ * @param acl_cb                The callback to execute upon receiving ACL
+ *                                  data.
+ * @param acl_arg               Optional argument to pass to the ACL
+ *                                  callback.
+ */
+void
+ble_hci_trans_cfg_ll(ble_hci_trans_rx_cmd_fn *cmd_cb,
+                     void *cmd_arg,
+                     ble_hci_trans_rx_acl_fn *acl_cb,
+                     void *acl_arg)
+{
+    /* XXX: Unimplemented. */
+    assert(0);
+}
+
+/**
+ * Allocates a flat buffer of the specified type.
+ *
+ * @param type                  The type of buffer to allocate; one of the
+ *                                  BLE_HCI_TRANS_BUF_[...] constants.
+ *
+ * @return                      The allocated buffer on success;
+ *                              NULL on buffer exhaustion.
+ */
+uint8_t *
+ble_hci_trans_buf_alloc(int type)
+{
+    uint8_t *buf;
+
+    switch (type) {
+    case BLE_HCI_TRANS_BUF_CMD:
+        buf = os_memblock_get(&ble_hci_emspi_cmd_pool);
+        break;
+    case BLE_HCI_TRANS_BUF_EVT_HI:
+        buf = os_memblock_get(&ble_hci_emspi_evt_hi_pool);
+        if (buf == NULL) {
+            /* If no high-priority event buffers remain, try to grab a
+             * low-priority one.
+             */
+            buf = os_memblock_get(&ble_hci_emspi_evt_lo_pool);
+        }
+        break;
+
+    case BLE_HCI_TRANS_BUF_EVT_LO:
+        buf = os_memblock_get(&ble_hci_emspi_evt_lo_pool);
+        break;
+
+    default:
+        assert(0);
+        buf = NULL;
+    }
+
+    return buf;
+}
+
+/**
+ * Frees the specified flat buffer.  The buffer must have been allocated via
+ * ble_hci_trans_buf_alloc().
+ *
+ * @param buf                   The buffer to free.
+ */
+void
+ble_hci_trans_buf_free(uint8_t *buf)
+{
+    int rc;
+
+    if (buf != NULL) {
+        if (os_memblock_from(&ble_hci_emspi_evt_hi_pool, buf)) {
+            rc = os_memblock_put(&ble_hci_emspi_evt_hi_pool, buf);
+            assert(rc == 0);
+        } else if (os_memblock_from(&ble_hci_emspi_evt_lo_pool, buf)) {
+            rc = os_memblock_put(&ble_hci_emspi_evt_lo_pool, buf);
+            assert(rc == 0);
+        } else {
+            assert(os_memblock_from(&ble_hci_emspi_cmd_pool, buf));
+            rc = os_memblock_put(&ble_hci_emspi_cmd_pool, buf);
+            assert(rc == 0);
+        }
+    }
+}
+
+/**
+ * Resets the HCI UART transport to a clean state.  Frees all buffers and
+ * reconfigures the UART.
+ *
+ * @return                      0 on success;
+ *                              A BLE_ERR_[...] error code on failure.
+ */
+int
+ble_hci_trans_reset(void)
+{
+    struct ble_hci_emspi_pkt *pkt;
+
+    hal_gpio_write(MYNEWT_VAL(BLE_HCI_EMSPI_RESET_PIN), 1);
+
+    while ((pkt = STAILQ_FIRST(&ble_hci_emspi_tx_q)) != NULL) {
+        STAILQ_REMOVE(&ble_hci_emspi_tx_q, pkt, ble_hci_emspi_pkt, next);
+        ble_hci_emspi_free_pkt(pkt->type, pkt->data, pkt->data);
+        os_memblock_put(&ble_hci_emspi_pkt_pool, pkt);
+    }
+
+    return 0;
+}
+
+static void
+ble_hci_emspi_event_txrx(struct os_event *ev)
+{
+    int rc;
+
+    rc = ble_hci_emspi_rx_pkt();
+
+    do {
+        rc = ble_hci_emspi_tx_pkt();
+    } while (rc == 0);
+}
+
+static void
+ble_hci_emspi_loop(void *unused)
+{
+    while (1) {
+        os_eventq_run(&ble_hci_emspi_evq);
+    }
+}
+
+static void
+ble_hci_emspi_init_hw(void)
+{
+    struct hal_spi_settings spi_cfg;
+    int rc;
+
+    rc = hal_gpio_init_out(MYNEWT_VAL(BLE_HCI_EMSPI_RESET_PIN), 0);
+    SYSINIT_PANIC_ASSERT(rc == 0);
+
+    rc = hal_gpio_init_out(MYNEWT_VAL(BLE_HCI_EMSPI_SS_PIN), 1);
+    SYSINIT_PANIC_ASSERT(rc == 0);
+
+    spi_cfg.data_order = HAL_SPI_MSB_FIRST;
+    spi_cfg.data_mode = HAL_SPI_MODE0;
+    spi_cfg.baudrate = MYNEWT_VAL(BLE_HCI_EMSPI_BAUD);
+    spi_cfg.word_size = HAL_SPI_WORD_SIZE_8BIT;
+
+    rc = hal_spi_config(MYNEWT_VAL(BLE_HCI_EMSPI_SPI_NUM), &spi_cfg);
+    SYSINIT_PANIC_ASSERT(rc == 0);
+
+    rc = hal_gpio_irq_init(MYNEWT_VAL(BLE_HCI_EMSPI_RDY_PIN),
+                           ble_hci_emspi_rdy_isr, NULL,
+                           HAL_GPIO_TRIG_RISING, HAL_GPIO_PULL_DOWN);
+    SYSINIT_PANIC_ASSERT(rc == 0);
+
+    rc = hal_spi_enable(MYNEWT_VAL(BLE_HCI_EMSPI_SPI_NUM));
+    assert(rc == 0);
+
+    hal_gpio_write(MYNEWT_VAL(BLE_HCI_EMSPI_RESET_PIN), 1);
+}
+
+/**
+ * Initializes the UART HCI transport module.
+ *
+ * @return                      0 on success;
+ *                              A BLE_ERR_[...] error code on failure.
+ */
+void
+ble_hci_emspi_init(void)
+{
+    int acl_block_size;
+    int rc;
+
+    /* Ensure this function only gets called by sysinit. */
+    SYSINIT_ASSERT_ACTIVE();
+
+    /*
+     * The MBUF payload size must accommodate the HCI data header size plus the
+     * maximum ACL data packet length. The ACL block size is the size of the
+     * mbufs we will allocate.
+     */
+    acl_block_size = MYNEWT_VAL(BLE_ACL_BUF_SIZE) +
+                     BLE_MBUF_MEMBLOCK_OVERHEAD +
+                     BLE_HCI_DATA_HDR_SZ;
+    acl_block_size = OS_ALIGN(acl_block_size, OS_ALIGNMENT);
+    rc = mem_malloc_mempool(&ble_hci_emspi_acl_pool,
+                            MYNEWT_VAL(BLE_ACL_BUF_COUNT),
+                            acl_block_size,
+                            "ble_hci_emspi_acl_pool",
+                            &ble_hci_emspi_acl_buf);
+    SYSINIT_PANIC_ASSERT(rc == 0);
+
+    rc = os_mbuf_pool_init(&ble_hci_emspi_acl_mbuf_pool,
+                           &ble_hci_emspi_acl_pool, acl_block_size,
+                           MYNEWT_VAL(BLE_ACL_BUF_COUNT));
+    SYSINIT_PANIC_ASSERT(rc == 0);
+
+    rc = mem_malloc_mempool(&ble_hci_emspi_cmd_pool,
+                            1,
+                            BLE_HCI_TRANS_CMD_SZ,
+                            "ble_hci_emspi_cmd_pool",
+                            &ble_hci_emspi_cmd_buf);
+    SYSINIT_PANIC_ASSERT(rc == 0);
+
+    rc = mem_malloc_mempool(&ble_hci_emspi_evt_hi_pool,
+                            MYNEWT_VAL(BLE_HCI_EVT_HI_BUF_COUNT),
+                            MYNEWT_VAL(BLE_HCI_EVT_BUF_SIZE),
+                            "ble_hci_emspi_evt_hi_pool",
+                            &ble_hci_emspi_evt_hi_buf);
+    SYSINIT_PANIC_ASSERT(rc == 0);
+
+    rc = mem_malloc_mempool(&ble_hci_emspi_evt_lo_pool,
+                            MYNEWT_VAL(BLE_HCI_EVT_LO_BUF_COUNT),
+                            MYNEWT_VAL(BLE_HCI_EVT_BUF_SIZE),
+                            "ble_hci_emspi_evt_lo_pool",
+                            &ble_hci_emspi_evt_lo_buf);
+    SYSINIT_PANIC_ASSERT(rc == 0);
+
+    /*
+     * Create memory pool of packet list nodes. NOTE: the number of these
+     * buffers should be, at least, the total number of event buffers (hi
+     * and lo), the number of command buffers (currently 1) and the total
+     * number of buffers that the controller could possibly hand to the host.
+     */
+    rc = mem_malloc_mempool(&ble_hci_emspi_pkt_pool,
+                            BLE_HCI_EMSPI_PKT_EVT_COUNT + 1 +
+                                MYNEWT_VAL(BLE_HCI_ACL_OUT_COUNT),
+                            sizeof (struct ble_hci_emspi_pkt),
+                            "ble_hci_emspi_pkt_pool",
+                            &ble_hci_emspi_pkt_buf);
+    SYSINIT_PANIC_ASSERT(rc == 0);
+
+    STAILQ_INIT(&ble_hci_emspi_tx_q);
+
+    ble_hci_emspi_init_hw();
+
+    /* Initialize the LL task */
+    os_eventq_init(&ble_hci_emspi_evq);
+    rc = os_task_init(&ble_hci_emspi_task, "ble_hci_emspi", ble_hci_emspi_loop,
+                      NULL, MYNEWT_VAL(BLE_HCI_EMSPI_PRIO), OS_WAIT_FOREVER,
+                      ble_hci_emspi_stack,
+                      MYNEWT_VAL(BLE_HCI_EMSPI_STACK_SIZE));
+    SYSINIT_PANIC_ASSERT(rc == 0);
+}
diff --git a/net/nimble/transport/emspi/syscfg.yml b/net/nimble/transport/emspi/syscfg.yml
new file mode 100644
index 000000000..c8c20980f
--- /dev/null
+++ b/net/nimble/transport/emspi/syscfg.yml
@@ -0,0 +1,92 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# Package: net/nimble/transport/ram
+
+syscfg.defs:
+    BLE_HCI_EMSPI:
+        description: 'Indicates that the emspi HCI transport is present.'
+        value: 1
+        restrictions:
+            # XXX: This package only builds with the apollo2 MCU.
+            # MCU-dependencies need to be removed.
+            - MCU_APOLLO2
+
+    BLE_HCI_EVT_HI_BUF_COUNT:
+        description: 'Number of high-priority event buffers.'
+        value:  2
+
+    BLE_HCI_EVT_LO_BUF_COUNT:
+        description: 'Number of low-priority event buffers.'
+        value:  8
+
+    BLE_HCI_EVT_BUF_SIZE:
+        description: 'Size of each event buffer, in bytes.'
+        value:  70
+
+    BLE_ACL_BUF_COUNT:
+        description: 'The number of ACL data buffers'
+        value: 4
+
+    BLE_ACL_BUF_SIZE:
+        description: >
+            This is the maximum size of the data portion of HCI ACL data
+            packets. It does not include the HCI data header (of 4 bytes).
+        value: 255
+
+    BLE_HCI_ACL_OUT_COUNT:
+        description: >
+            This count is used in creating a pool of elements used by the
+            code to enqueue various elements. In the case of the controller
+            only HCI, this number should be equal to the number of mbufs in
+            the msys pool. For host only, it is really dependent on the
+            number of ACL buffers that the controller tells the host it
+            has.
+        value: 12
+
+    BLE_HCI_EMSPI_SPI_NUM:
+        description: The index of the SPI device to use for HCI.
+        value: 5
+
+    BLE_HCI_EMSPI_BAUD:
+        description: The SPI baud rate.
+        value: 8000000
+
+    BLE_HCI_EMSPI_RESET_PIN:
+        description: The GPIO pin that resets the EM controller.
+        value: 42
+
+    BLE_HCI_EMSPI_SS_PIN:
+        description: The GPIO pin to use for SPI slave select.
+        value: 45
+
+    BLE_HCI_EMSPI_RDY_PIN:
+        description: >
+            The GPIO pin that the EM controller uses to indicate data ready.
+        value: 26
+
+    BLE_HCI_EMSPI_PRIO:
+        description: The priority of the emspi task.
+        value: 5
+
+    BLE_HCI_EMSPI_STACK_SIZE:
+        description: 'The size of the emspi task (units: 4-byte words).'
+        value: 256
+
+syscfg.vals.BLE_EXT_ADV:
+    BLE_HCI_EVT_BUF_SIZE: 274


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services