aboutsummaryrefslogtreecommitdiffstats
path: root/src/sam3/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sam3/main.c')
-rw-r--r--src/sam3/main.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/sam3/main.c b/src/sam3/main.c
index 3908fddb..68949ce7 100644
--- a/src/sam3/main.c
+++ b/src/sam3/main.c
@@ -35,6 +35,26 @@ DECL_INIT(watchdog_init);
* misc functions
****************************************************************/
+// Check if a peripheral clock has been enabled
+int
+is_enabled_pclock(uint32_t id)
+{
+ if (id < 32)
+ return !!(PMC->PMC_PCSR0 & (1 << id));
+ else
+ return !!(PMC->PMC_PCSR1 & (1 << (id - 32)));
+}
+
+// Enable a peripheral clock
+void
+enable_pclock(uint32_t id)
+{
+ if (id < 32)
+ PMC->PMC_PCER0 = 1 << id;
+ else
+ PMC->PMC_PCER1 = 1 << (id - 32);
+}
+
void
command_reset(uint32_t *args)
{