Mark3 Realtime Kernel
kernelswi.cpp
Go to the documentation of this file.
1 /*===========================================================================
2  _____ _____ _____ _____
3  ___| _|__ __|_ |__ __|__ |__ __| __ |__ ______
4 | \ / | || \ || | || |/ / ||___ |
5 | \/ | || \ || \ || \ ||___ |
6 |__/\__/|__|_||__|\__\ __||__|\__\ __||__|\__\ __||______|
7  |_____| |_____| |_____| |_____|
8 
9 --[Mark3 Realtime Platform]--------------------------------------------------
10 
11 Copyright (c) 2012 - 2019 m0slevin, all rights reserved.
12 See license.txt for more information
13 ===========================================================================*/
22 #include "kerneltypes.h"
23 #include "kernelswi.h"
24 
25 #include <avr/io.h>
26 #include <avr/interrupt.h>
27 
28 namespace Mark3
29 {
30 //---------------------------------------------------------------------------
32 {
33  PORTB &= ~0x04; // Clear INT2
34  DDRB |= 0x04; // Set PortB, bit 2 (INT2) As Output
35  EICRA |= (1 << ISC20) | (1 << ISC21); // Rising edge on INT2
36 }
37 
38 //---------------------------------------------------------------------------
39 void KernelSWI::Start(void)
40 {
41  EIFR &= ~(1 << INTF2); // Clear any pending interrupts on INT2
42  EIMSK |= (1 << INT2); // Enable INT2 interrupt (as int32_t as I-bit is set)
43 }
44 
45 //---------------------------------------------------------------------------
47 {
48  // if(Thread_IsSchedulerEnabled())
49  {
50  PORTB &= ~0x04;
51  PORTB |= 0x04;
52  }
53 }
54 } // namespace Mark3
Basic data type primatives used throughout the OS.
static void Trigger(void)
Trigger Call the software interrupt.
Definition: kernelswi.cpp:46
Definition: atomic.cpp:23
Kernel Software interrupt declarations.
static void Start(void)
Start Enable ("Start") the software interrupt functionality.
Definition: kernelswi.cpp:39
static void Config(void)
Config Configure the software interrupt - must be called before any other software interrupt function...
Definition: kernelswi.cpp:31