atmega_common/include/cpu.h File Reference

Common implementations and headers for ATmega family based micro-controllers. More...

Detailed Description

Common implementations and headers for ATmega family based micro-controllers.

Basic definitions for the ATmega common module

When ever you want to do something hardware related, that is accessing MCUs registers directly, just include this file. It will then make sure that the MCU specific headers are included.

Author
Stefan Pfeiffer stefa.nosp@m.n.pf.nosp@m.eiffe.nosp@m.r@fu.nosp@m.-berl.nosp@m.in.d.nosp@m.e
Hauke Petersen hauke.nosp@m..pet.nosp@m.ersen.nosp@m.@fu-.nosp@m.berli.nosp@m.n.de
Hinnerk van Bruinehsen h.v.b.nosp@m.ruin.nosp@m.ehsen.nosp@m.@fu-.nosp@m.berli.nosp@m.n.de
Kaspar Schleiser kaspa.nosp@m.r@sc.nosp@m.hleis.nosp@m.er.d.nosp@m.e
Josua Arndt jarnd.nosp@m.t@ia.nosp@m.s.rwt.nosp@m.h-aa.nosp@m.chen..nosp@m.de

Definition in file atmega_common/include/cpu.h.

#include <stdio.h>
#include <stdint.h>
#include <avr/interrupt.h>
#include "cpu_conf.h"
#include "sched.h"
#include "thread.h"
#include "irq.h"
+ Include dependency graph for atmega_common/include/cpu.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  {
  CPU_ATMEGA_CLK_SCALE_DIV1 = 0, CPU_ATMEGA_CLK_SCALE_DIV2 = 1, CPU_ATMEGA_CLK_SCALE_DIV4 = 2, CPU_ATMEGA_CLK_SCALE_DIV8 = 3,
  CPU_ATMEGA_CLK_SCALE_DIV16 = 4, CPU_ATMEGA_CLK_SCALE_DIV32 = 5, CPU_ATMEGA_CLK_SCALE_DIV64 = 6, CPU_ATMEGA_CLK_SCALE_DIV128 = 7,
  CPU_ATMEGA_CLK_SCALE_DIV256 = 8, CPU_ATMEGA_CLK_SCALE_DIV512 = 9
}
 ATmega system clock prescaler settings. More...
 

Functions

static void __enter_isr (void)
 Run this code on entering interrupt routines.
 
void thread_yield_isr (void)
 Exit ISR mode and yield with a return from interrupt. More...
 
static void __exit_isr (void)
 Run this code on exiting interrupt routines.
 
void cpu_init (void)
 Initialization of the CPU.
 
static void cpu_print_last_instruction (void)
 Print the last instruction's address.
 
static void atmega_set_prescaler (uint8_t clk_scale)
 Initializes system clock prescaler.
 
void atmega_stdio_init (void)
 Initializes avrlibc stdio.
 

Variables

volatile uint8_t __in_isr
 global in-ISR state variable
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

ATmega system clock prescaler settings.

Some CPUs may not support the highest prescaler settings

Definition at line 124 of file atmega_common/include/cpu.h.

Function Documentation

◆ thread_yield_isr()

void thread_yield_isr ( void  )

Exit ISR mode and yield with a return from interrupt.

Use at the end of ISRs in place of thread_yield_higher. If thread_yield is needed, use thread_yield followed by thread_yield_isr instead of thread_yield alone.