arch: introduce include convenience macro

This commit is contained in:
Felix Kopp 2020-11-30 22:08:01 +01:00
parent f229c2ae86
commit 0026db4583
No known key found for this signature in database
GPG key ID: C478BA0A85F75728
4 changed files with 43 additions and 17 deletions

View file

@ -0,0 +1,35 @@
/* SPDX-License-Identifier: BSD-3-Clause */
/* See the end of this file for copyright, licensing, and warranty information. */
#pragma once
#ifdef ARCH_AT91SAM3X8E
#define ARCH_INCLUDE(file) <arch/at91sam3x8e/file>
#else
#error "Unsupported architecture"
#endif
/*
* Copyright (c) 2020 Felix Kopp <sandtler@sandtler.club>
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* 3. Neither the name of the copyright holder nor the names of its contributors may be
* used to endorse or promote products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

View file

@ -3,6 +3,8 @@
#pragma once
#include <arch/arch_include.h>
/**
* Block the CPU by continuously checking the same expression in an
* infinite loop, until the condition is true. Useful for polling.
@ -38,13 +40,7 @@ int sys_init(void);
#define STACK_SIZE 2048U
#endif
#if defined(ARCH_ATMEGA328P)
#error "ATmega328p is not implemented (yet?)"
#elif defined(ARCH_AT91SAM3X8E)
#include <arch/at91sam3x8e/hardware.h>
#else
#error "Unsupported architecture"
#endif
#include ARCH_INCLUDE(hardware.h)
/*
* Copyright (c) 2020 Felix Kopp <sandtler@sandtler.club>

View file

@ -3,6 +3,7 @@
#pragma once
#include <arch/arch_include.h>
#include <arch/hardware.h>
#include <stdbool.h>
@ -27,11 +28,7 @@ int arch_sched_hwtimer_init(unsigned int freq);
*/
void arch_sched_process_init(struct process *process, void (*entry)(void));
#ifdef ARCH_AT91SAM3X8E
#include <arch/at91sam3x8e/sched.h>
#else
#error "Unsupported architecture"
#endif
#include ARCH_INCLUDE(sched.h)
/*
* Copyright (c) 2020 Felix Kopp <sandtler@sandtler.club>

View file

@ -3,16 +3,14 @@
#pragma once
#include <arch/arch_include.h>
#include <ardix/serial.h>
int arch_serial_init(struct serial_interface *interface);
void arch_serial_exit(struct serial_interface *interface);
#ifdef ARCH_AT91SAM3X8E
#include <arch/at91sam3x8e/serial.h>
#else
#error "Unsupported architecture"
#endif
#include ARCH_INCLUDE(serial.h)
/*
* Copyright (c) 2020 Felix Kopp <sandtler@sandtler.club>