aboutsummaryrefslogtreecommitdiff
path: root/src/cpu
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2021-12-24 15:21:54 -0800
committerChristian Cunningham <cc@localhost>2021-12-24 15:21:54 -0800
commit3a366988a0077474075d8f33ad76514d2fa0c5d6 (patch)
tree7aa293e59bee8308825e029069d395c628d230cd /src/cpu
parentd44bf5acb015edaeacc022f423bae4743b868f53 (diff)
Standardized Formatting
Diffstat (limited to 'src/cpu')
-rw-r--r--src/cpu/atomic/swap.h6
-rw-r--r--src/cpu/irq.c9
-rw-r--r--src/cpu/irq.h12
3 files changed, 16 insertions, 11 deletions
diff --git a/src/cpu/atomic/swap.h b/src/cpu/atomic/swap.h
index 374dd97..3584d4e 100644
--- a/src/cpu/atomic/swap.h
+++ b/src/cpu/atomic/swap.h
@@ -8,7 +8,8 @@
/// https://www.cs.uic.edu/~jbell/CourseNotes/OperatingSystems/3_Processes.html
/// https://developer.arm.com/documentation/dht0008/a/arm-synchronization-primitives/practical-uses/implementing-a-semaphore?lang=en
-static inline void atm_lock(unsigned long pid, unsigned long* addr) {
+static inline void atm_lock(unsigned long pid, unsigned long* addr)
+{
unsigned long tmp, current_lock_value;
asm volatile(
"1: ldrex %0, [%3]\n"
@@ -23,7 +24,8 @@ static inline void atm_lock(unsigned long pid, unsigned long* addr) {
: "cc");
}
-static inline void atm_release(unsigned long* addr) {
+static inline void atm_release(unsigned long* addr)
+{
unsigned long cleared = NULL_PID;
asm volatile(
" dmb\n"
diff --git a/src/cpu/irq.c b/src/cpu/irq.c
index f2b326e..1654828 100644
--- a/src/cpu/irq.c
+++ b/src/cpu/irq.c
@@ -8,10 +8,9 @@
extern unsigned long cmdidx;
extern char cmd[2048];
-extern void disable_irq(void);
-extern void enable_irq(void);
-void c_irq_handler(void) {
+void c_irq_handler(void)
+{
disableirq();
unsigned long source = load32(CORE0_IRQ_SOURCE);
if (source & (1 << 8)) {
@@ -56,12 +55,12 @@ void c_irq_handler(void) {
} else if (data == 0x6C) {
cmd[off] = (char) data;
off += 1;
- lock_mutex(&exe_cnt_m, SCHED_PID);
+ lock_mutex(&exe_cnt_m, SYS_PID);
// Release Case
} else if (data == 0x72) {
cmd[off] = (char) data;
off += 1;
- release_mutex(&exe_cnt_m, SCHED_PID);
+ release_mutex(&exe_cnt_m, SYS_PID);
// Else output
} else {
cmd[off] = (char) data;
diff --git a/src/cpu/irq.h b/src/cpu/irq.h
index 971d0b9..3b8f085 100644
--- a/src/cpu/irq.h
+++ b/src/cpu/irq.h
@@ -1,16 +1,20 @@
#ifndef CPU_IRQ_H
#define CPU_IRQ_H
-static inline void enableirq() {
+static inline void enableirq(void)
+{
asm volatile("cpsie i");
}
-static inline void disableirq() {
+static inline void disableirq(void)
+{
asm volatile("cpsid i");
}
-static inline void enablefiq() {
+static inline void enablefiq(void)
+{
asm volatile("cpsie f");
}
-static inline void disablefiq() {
+static inline void disablefiq(void)
+{
asm volatile("cpsid f");
}