mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-11-25 12:46:41 +00:00
Compare commits
3 Commits
b727434391
...
80cc6ad187
Author | SHA1 | Date | |
---|---|---|---|
|
80cc6ad187 | ||
|
8cc2e0e906 | ||
|
832479c7fb |
@ -182,7 +182,8 @@ endif
|
||||
|
||||
include $(BUILDDEFS_PATH)/converters.mk
|
||||
|
||||
include $(BUILDDEFS_PATH)/mcu_selection.mk
|
||||
MCU_ORIG := $(MCU)
|
||||
include $(wildcard $(PLATFORM_PATH)/*/mcu_selection.mk)
|
||||
|
||||
# PLATFORM_KEY should be detected in info.json via key 'processor' (or rules.mk 'MCU')
|
||||
ifeq ($(PLATFORM_KEY),)
|
||||
|
@ -24,9 +24,13 @@
|
||||
# define ATOMIC_BLOCK _Static_assert(0, "ATOMIC_BLOCK not implemented")
|
||||
# define ATOMIC_BLOCK_RESTORESTATE _Static_assert(0, "ATOMIC_BLOCK_RESTORESTATE not implemented")
|
||||
# define ATOMIC_BLOCK_FORCEON _Static_assert(0, "ATOMIC_BLOCK_FORCEON not implemented")
|
||||
# define ATOMIC_FORCEON _Static_assert(0, "ATOMIC_FORCEON not implemented")
|
||||
# define ATOMIC_RESTORESTATE _Static_assert(0, "ATOMIC_RESTORESTATE not implemented")
|
||||
# endif
|
||||
#else /* do nothing atomic macro */
|
||||
# define ATOMIC_BLOCK for (uint8_t __ToDo = 1; __ToDo; __ToDo = 0)
|
||||
# define ATOMIC_BLOCK_RESTORESTATE ATOMIC_BLOCK
|
||||
# define ATOMIC_BLOCK_FORCEON ATOMIC_BLOCK
|
||||
# define ATOMIC_BLOCK(t) for (uint8_t __ToDo = 1; __ToDo; __ToDo = 0)
|
||||
# define ATOMIC_FORCEON
|
||||
# define ATOMIC_RESTORESTATE
|
||||
# define ATOMIC_BLOCK_RESTORESTATE ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
|
||||
# define ATOMIC_BLOCK_FORCEON ATOMIC_BLOCK(ATOMIC_FORCEON)
|
||||
#endif
|
||||
|
95
platforms/avr/mcu_selection.mk
Normal file
95
platforms/avr/mcu_selection.mk
Normal file
@ -0,0 +1,95 @@
|
||||
ifneq (,$(filter $(MCU),at90usb162 atmega16u2 atmega32u2 atmega16u4 atmega32u4 at90usb646 at90usb647 at90usb1286 at90usb1287))
|
||||
PROTOCOL = LUFA
|
||||
|
||||
# Processor frequency.
|
||||
# This will define a symbol, F_CPU, in all source code files equal to the
|
||||
# processor frequency in Hz. You can then use this symbol in your source code to
|
||||
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
|
||||
# automatically to create a 32-bit value in your source code.
|
||||
#
|
||||
# This will be an integer division of F_USB below, as it is sourced by
|
||||
# F_USB after it has run through any CPU prescalers. Note that this value
|
||||
# does not *change* the processor frequency - it should merely be updated to
|
||||
# reflect the processor speed set externally so that the code can use accurate
|
||||
# software delays.
|
||||
F_CPU ?= 16000000
|
||||
|
||||
# LUFA specific
|
||||
#
|
||||
# Target architecture (see library "Board Types" documentation).
|
||||
ARCH = AVR8
|
||||
|
||||
# Input clock frequency.
|
||||
# This will define a symbol, F_USB, in all source code files equal to the
|
||||
# input clock frequency (before any prescaling is performed) in Hz. This value may
|
||||
# differ from F_CPU if prescaling is used on the latter, and is required as the
|
||||
# raw input clock is fed directly to the PLL sections of the AVR for high speed
|
||||
# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
|
||||
# at the end, this will be done automatically to create a 32-bit value in your
|
||||
# source code.
|
||||
#
|
||||
# If no clock division is performed on the input clock inside the AVR (via the
|
||||
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
|
||||
F_USB ?= $(F_CPU)
|
||||
|
||||
# Interrupt driven control endpoint task
|
||||
ifeq (,$(filter $(NO_INTERRUPT_CONTROL_ENDPOINT),yes))
|
||||
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
||||
endif
|
||||
ifneq (,$(filter $(MCU),at90usb162 atmega16u2 atmega32u2))
|
||||
NO_I2C = yes
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq (,$(filter $(MCU),atmega32a))
|
||||
# MCU name for avrdude
|
||||
AVRDUDE_MCU = m32
|
||||
|
||||
PROTOCOL = VUSB
|
||||
|
||||
# Processor frequency.
|
||||
# This will define a symbol, F_CPU, in all source code files equal to the
|
||||
# processor frequency in Hz. You can then use this symbol in your source code to
|
||||
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
|
||||
# automatically to create a 32-bit value in your source code.
|
||||
F_CPU ?= 12000000
|
||||
endif
|
||||
|
||||
ifneq (,$(filter $(MCU),atmega328p))
|
||||
# MCU name for avrdude
|
||||
AVRDUDE_MCU = m328p
|
||||
|
||||
PROTOCOL = VUSB
|
||||
|
||||
# Processor frequency.
|
||||
# This will define a symbol, F_CPU, in all source code files equal to the
|
||||
# processor frequency in Hz. You can then use this symbol in your source code to
|
||||
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
|
||||
# automatically to create a 32-bit value in your source code.
|
||||
F_CPU ?= 16000000
|
||||
endif
|
||||
|
||||
ifneq (,$(filter $(MCU),atmega328))
|
||||
# MCU name for avrdude
|
||||
AVRDUDE_MCU = m328
|
||||
|
||||
PROTOCOL = VUSB
|
||||
|
||||
# Processor frequency.
|
||||
# This will define a symbol, F_CPU, in all source code files equal to the
|
||||
# processor frequency in Hz. You can then use this symbol in your source code to
|
||||
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
|
||||
# automatically to create a 32-bit value in your source code.
|
||||
F_CPU ?= 16000000
|
||||
endif
|
||||
|
||||
ifneq (,$(filter $(MCU),attiny85))
|
||||
PROTOCOL = VUSB
|
||||
|
||||
# Processor frequency.
|
||||
# This will define a symbol, F_CPU, in all source code files equal to the
|
||||
# processor frequency in Hz. You can then use this symbol in your source code to
|
||||
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
|
||||
# automatically to create a 32-bit value in your source code.
|
||||
F_CPU ?= 16500000
|
||||
endif
|
@ -30,8 +30,19 @@ static __inline__ void __interrupt_enable__(const uint8_t *__s) {
|
||||
(void)__s;
|
||||
}
|
||||
|
||||
#define ATOMIC_BLOCK(type) for (type, __ToDo = __interrupt_disable__(); __ToDo; __ToDo = 0)
|
||||
#define ATOMIC_FORCEON uint8_t sreg_save __attribute__((__cleanup__(__interrupt_enable__))) = 0
|
||||
static __inline__ syssts_t __interrupt_lock__(void) {
|
||||
return chSysGetStatusAndLockX();
|
||||
}
|
||||
|
||||
#define ATOMIC_BLOCK_RESTORESTATE _Static_assert(0, "ATOMIC_BLOCK_RESTORESTATE not implemented")
|
||||
static __inline__ void __interrupt_unlock__(const syssts_t *__s) {
|
||||
chSysRestoreStatusX(*__s);
|
||||
|
||||
__asm__ volatile("" ::: "memory");
|
||||
}
|
||||
|
||||
#define ATOMIC_BLOCK(type) for (type, __ToDo = 1; __ToDo; __ToDo = 0)
|
||||
#define ATOMIC_FORCEON uint8_t status_save __attribute__((__cleanup__(__interrupt_enable__))) = __interrupt_disable__()
|
||||
#define ATOMIC_RESTORESTATE syssts_t status_save __attribute__((__cleanup__(__interrupt_unlock__))) = __interrupt_lock__()
|
||||
|
||||
#define ATOMIC_BLOCK_RESTORESTATE ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
|
||||
#define ATOMIC_BLOCK_FORCEON ATOMIC_BLOCK(ATOMIC_FORCEON)
|
||||
|
@ -1,5 +1,3 @@
|
||||
MCU_ORIG := $(MCU)
|
||||
|
||||
ifneq ($(findstring MKL26Z64, $(MCU)),)
|
||||
# Cortex version
|
||||
MCU = cortex-m0plus
|
||||
@ -825,99 +823,3 @@ ifneq ($(findstring GD32VF103, $(MCU)),)
|
||||
|
||||
USE_FPU ?= no
|
||||
endif
|
||||
|
||||
ifneq (,$(filter $(MCU),at90usb162 atmega16u2 atmega32u2 atmega16u4 atmega32u4 at90usb646 at90usb647 at90usb1286 at90usb1287))
|
||||
PROTOCOL = LUFA
|
||||
|
||||
# Processor frequency.
|
||||
# This will define a symbol, F_CPU, in all source code files equal to the
|
||||
# processor frequency in Hz. You can then use this symbol in your source code to
|
||||
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
|
||||
# automatically to create a 32-bit value in your source code.
|
||||
#
|
||||
# This will be an integer division of F_USB below, as it is sourced by
|
||||
# F_USB after it has run through any CPU prescalers. Note that this value
|
||||
# does not *change* the processor frequency - it should merely be updated to
|
||||
# reflect the processor speed set externally so that the code can use accurate
|
||||
# software delays.
|
||||
F_CPU ?= 16000000
|
||||
|
||||
# LUFA specific
|
||||
#
|
||||
# Target architecture (see library "Board Types" documentation).
|
||||
ARCH = AVR8
|
||||
|
||||
# Input clock frequency.
|
||||
# This will define a symbol, F_USB, in all source code files equal to the
|
||||
# input clock frequency (before any prescaling is performed) in Hz. This value may
|
||||
# differ from F_CPU if prescaling is used on the latter, and is required as the
|
||||
# raw input clock is fed directly to the PLL sections of the AVR for high speed
|
||||
# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
|
||||
# at the end, this will be done automatically to create a 32-bit value in your
|
||||
# source code.
|
||||
#
|
||||
# If no clock division is performed on the input clock inside the AVR (via the
|
||||
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
|
||||
F_USB ?= $(F_CPU)
|
||||
|
||||
# Interrupt driven control endpoint task
|
||||
ifeq (,$(filter $(NO_INTERRUPT_CONTROL_ENDPOINT),yes))
|
||||
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
||||
endif
|
||||
ifneq (,$(filter $(MCU),at90usb162 atmega16u2 atmega32u2))
|
||||
NO_I2C = yes
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq (,$(filter $(MCU),atmega32a))
|
||||
# MCU name for avrdude
|
||||
AVRDUDE_MCU = m32
|
||||
|
||||
PROTOCOL = VUSB
|
||||
|
||||
# Processor frequency.
|
||||
# This will define a symbol, F_CPU, in all source code files equal to the
|
||||
# processor frequency in Hz. You can then use this symbol in your source code to
|
||||
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
|
||||
# automatically to create a 32-bit value in your source code.
|
||||
F_CPU ?= 12000000
|
||||
endif
|
||||
|
||||
ifneq (,$(filter $(MCU),atmega328p))
|
||||
# MCU name for avrdude
|
||||
AVRDUDE_MCU = m328p
|
||||
|
||||
PROTOCOL = VUSB
|
||||
|
||||
# Processor frequency.
|
||||
# This will define a symbol, F_CPU, in all source code files equal to the
|
||||
# processor frequency in Hz. You can then use this symbol in your source code to
|
||||
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
|
||||
# automatically to create a 32-bit value in your source code.
|
||||
F_CPU ?= 16000000
|
||||
endif
|
||||
|
||||
ifneq (,$(filter $(MCU),atmega328))
|
||||
# MCU name for avrdude
|
||||
AVRDUDE_MCU = m328
|
||||
|
||||
PROTOCOL = VUSB
|
||||
|
||||
# Processor frequency.
|
||||
# This will define a symbol, F_CPU, in all source code files equal to the
|
||||
# processor frequency in Hz. You can then use this symbol in your source code to
|
||||
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
|
||||
# automatically to create a 32-bit value in your source code.
|
||||
F_CPU ?= 16000000
|
||||
endif
|
||||
|
||||
ifneq (,$(filter $(MCU),attiny85))
|
||||
PROTOCOL = VUSB
|
||||
|
||||
# Processor frequency.
|
||||
# This will define a symbol, F_CPU, in all source code files equal to the
|
||||
# processor frequency in Hz. You can then use this symbol in your source code to
|
||||
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
|
||||
# automatically to create a 32-bit value in your source code.
|
||||
F_CPU ?= 16500000
|
||||
endif
|
@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <util/atomic.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "atomic_util.h"
|
||||
|
||||
#ifndef RBUF_SIZE
|
||||
# define RBUF_SIZE 32
|
||||
|
Loading…
Reference in New Issue
Block a user