From 35e2697799d2635954e433141d4fe2a4fd2aa292 Mon Sep 17 00:00:00 2001 From: NĂ©lio Laranjeiro Date: Thu, 7 Jun 2012 16:39:46 +0200 Subject: cesar/hal/arch: add DEVICE_ID register bank, refs #3147 --- cesar/hal/arch/inc/regs_addr.h | 3 +++ cesar/hal/arch/platform.h | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 cesar/hal/arch/platform.h (limited to 'cesar') diff --git a/cesar/hal/arch/inc/regs_addr.h b/cesar/hal/arch/inc/regs_addr.h index d951903088..2c5f34f706 100644 --- a/cesar/hal/arch/inc/regs_addr.h +++ b/cesar/hal/arch/inc/regs_addr.h @@ -22,4 +22,7 @@ /* This one is not supposed to be changed after startup, drop volatile. */ #define ARCH_MARIA_RB_LEON_ADD_START ARCH_MARIA_RB_CONST_REG (0x120) +/* Maria 2 device ID (MSE500) */ +#define ARCH_MARIA_RB_DEVICE_ID ARCH_MARIA_RB_CONST_REG (0xC) + #endif /* regs_addr_h */ diff --git a/cesar/hal/arch/platform.h b/cesar/hal/arch/platform.h new file mode 100644 index 0000000000..9cbc82d7ca --- /dev/null +++ b/cesar/hal/arch/platform.h @@ -0,0 +1,41 @@ +#ifndef hal_arch_platform_h +#define hal_arch_platform_h +/* Cesar project {{{ + * + * Copyright (C) 2012 Spidcom + * + * <<>> + * + * }}} */ +/** + * \file hal/arch/platform.h + * \brief Platform specific functions. + * \ingroup hal_arch + */ +#include "hal/arch/inc/regs_addr.h" + +BEGIN_DECLS + +/** + * Return true if the platform is SPC300. + * \return true if spc300 + */ +extern inline bool +arch_is_spc300 (void) +{ + return !ARCH_MARIA_RB_DEVICE_ID; +} + +/** + * Return true if the platform is MSE500 + * \return true if mse500 + */ +extern inline bool +arch_is_mse500 (void) +{ + return ARCH_MARIA_RB_DEVICE_ID; +} + +END_DECLS + +#endif /* hal_arch_platform_h */ -- cgit v1.2.3