]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lwip.git/commitdiff
Base of FreeRTOS port for use with CTU IIG TMS570 project.
authorPavel Pisa <pisa@cmp.felk.cvut.cz>
Mon, 25 Jul 2016 18:40:03 +0000 (20:40 +0200)
committerPavel Pisa <pisa@cmp.felk.cvut.cz>
Wed, 27 Jul 2016 18:55:45 +0000 (20:55 +0200)
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
ports/os/freertos/arch/cc.h [new file with mode: 0644]
ports/os/freertos/arch/perf.h [new file with mode: 0644]
ports/os/freertos/arch/sys_arch.c [new file with mode: 0644]
ports/os/freertos/arch/sys_arch.h [new file with mode: 0644]

diff --git a/ports/os/freertos/arch/cc.h b/ports/os/freertos/arch/cc.h
new file mode 100644 (file)
index 0000000..c90bf75
--- /dev/null
@@ -0,0 +1,198 @@
+/*
+ * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
+ * All rights reserved.
+ *
+ * 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. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *
+ * This file is system adaptation of the lwIP TCP/IP stack
+ * by Adam Dunkels <adam@sics.se> for RTEMS system.
+ *
+ * Author: Premysl Houdek <houdepre@fel.cvut.cz>
+ * Mentor: Pavel Pisa <pisa@cmp.felk.cvut.cz>
+ * Industrial Informatics Group, FEE, Czech Technical University in Prague
+ *
+ */
+/*
+ * settings to adapt lwIP for compiler and machine architecture for FreeRTOS/CCS
+ * DETAILS: ./lwip/doc/sys_arch.txt
+ */
+#ifndef __CC_H__
+#define __CC_H__
+
+#include <stdio.h>
+#include <inttypes.h>
+
+#include <errno.h>
+
+#ifndef ENOBUFS
+#define ENOBUFS 1
+#endif
+#ifndef EWOULDBLOCK
+#define EWOULDBLOCK 1
+#endif
+#ifndef EHOSTUNREACH
+#define EHOSTUNREACH 1
+#endif
+#ifndef EADDRINUSE
+#define EADDRINUSE 1
+#endif
+#ifndef EALREADY
+#define EALREADY 1
+#endif
+#ifndef EISCONN
+#define EISCONN 1
+#endif
+#ifndef ENOTCONN
+#define ENOTCONN 1
+#endif
+#ifndef ECONNABORTED
+#define ECONNABORTED 1
+#endif
+#ifndef ECONNRESET
+#define ECONNRESET 1
+#endif
+#ifndef EOPNOTSUPP
+#define EOPNOTSUPP 1
+#endif
+#ifndef EOPNOTSUPP
+#define EOPNOTSUPP 1
+#endif
+#ifndef EOPNOTSUPP
+#define EOPNOTSUPP 1
+#endif
+#ifndef ENOPROTOOPT
+#define ENOPROTOOPT 1
+#endif
+
+
+/* This file must either include a system-local <errno.h> which defines
+   the standard *nix error codes, or it should #define LWIP_PROVIDE_ERRNO
+   to make lwip/arch.h define the codes which are used throughout. */
+#undef LWIP_PROVIDE_ERRNO
+
+#define printk(...) do {} while (0)
+
+#if 0
+/* type definitions */
+typedef uint8_t             u8_t;
+typedef int8_t              s8_t;
+typedef uint16_t            u16_t;
+typedef int16_t             s16_t;
+typedef uint32_t            u32_t;
+typedef int32_t             s32_t;
+typedef u32_t               mem_ptr_t;
+#endif
+
+#define BYTE_ORDER BIG_ENDIAN
+
+#if 0
+/* Define (sn)printf formatters for these lwIP types */
+#define U16_F PRIu16
+#define S16_F PRId16
+#define X16_F PRIx16
+#define U32_F PRIu32
+#define S32_F PRId32
+#define X32_F PRIx32
+#endif
+
+#if defined(__arm__) && defined(__ARMCC_VERSION)
+//
+// Setup PACKing macros for KEIL/RVMDK Tools
+//
+    #define PACK_STRUCT_BEGIN __packed
+    #define PACK_STRUCT_STRUCT
+    #define PACK_STRUCT_END
+    #define PACK_STRUCT_FIELD(x) x
+#elif defined (__IAR_SYSTEMS_ICC__)
+//
+// Setup PACKing macros for IAR Tools
+//
+    #define PACK_STRUCT_BEGIN
+    #define PACK_STRUCT_STRUCT
+    #define PACK_STRUCT_END
+    #define PACK_STRUCT_FIELD(x) x
+    #define PACK_STRUCT_USE_INCLUDES
+#elif defined (__TMS470__)
+    #define PACK_STRUCT_BEGIN
+    #define PACK_STRUCT_STRUCT
+    #define PACK_STRUCT_END
+    #define PACK_STRUCT_FIELD(x) x
+#else
+//
+// Setup PACKing macros for GCC Tools
+//
+    #define PACK_STRUCT_BEGIN
+    #define PACK_STRUCT_STRUCT __attribute__ ((__packed__))
+    #define PACK_STRUCT_END
+    #define PACK_STRUCT_FIELD(x) x
+#endif
+
+/*
+ *     1 - load byte by byte, construct 16 bits word and add: not efficient for most platforms
+ *     2 - load first byte if odd address, loop processing 16 bits words, add last byte.
+ *     3 - load first byte and word if not 4 byte aligned, loop processing 32 bits words, add last word/byte.
+ *
+ *     see inet_chksum.c
+ */
+#ifndef LWIP_CHKSUM_ALGORITHM
+#define LWIP_CHKSUM_ALGORITHM 2
+#endif
+
+/* this is used for 1) displaying statistics and 2) lwip debugging (set appropriate debugging level in lwipopts.h) */
+//#ifdef LWIP_DEBUG
+
+
+#define LWIP_PLATFORM_DIAG(expr)        printk expr
+
+//#else
+//#define LWIP_PLATFORM_DIAG(expr)
+//#endif
+
+//#define DEBUG
+#ifdef DEBUG
+
+/* for passing arguments to print function */
+#define CC_ASSERT(message, assertion) do { if (!(assertion)) \
+                                            LWIP_PLATFORM_DIAG(message); } while (0)
+
+//extern void __error__(char *pcFilename, unsigned long ulLine);
+#define LWIP_PLATFORM_ASSERT(expr)      printk((const char *)expr)
+/*
+{                                       \
+    if(!(expr))                         \
+    {                                   \
+        __error__(__FILE__, __LINE__);  \
+    }                                   \
+}
+*/
+#else
+#define LWIP_PLATFORM_ASSERT(expr)
+#define CC_ASSERT(message, assertion)
+#endif /* DEBUG */
+
+/* "lightweight" synchronization mechanisms */
+/* #define SYS_ARCH_DECL_PROTECT(x) */ /* declare a protection state variable */
+/* #define SYS_ARCH_PROTECT(x) */ /* enter protection mode */
+/* #define SYS_ARCH_UNPROTECT(x) */ /* leave protection mode */
+
+#endif /* __CC_H__ */
diff --git a/ports/os/freertos/arch/perf.h b/ports/os/freertos/arch/perf.h
new file mode 100644 (file)
index 0000000..1f799b3
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef _LWIP_ARCH_PERF_H_
+#define _LWIP_ARCH_PERF_H_
+
+//perf.h     - Architecture specific performance measurement.
+//Measurement calls made throughout lwip, these can be defined to nothing.
+
+#define PERF_START
+
+#define PERF_STOP(x)
+
+
+#endif /* _LWIP_ARCH_PERF_H_ */
diff --git a/ports/os/freertos/arch/sys_arch.c b/ports/os/freertos/arch/sys_arch.c
new file mode 100644 (file)
index 0000000..70a00f8
--- /dev/null
@@ -0,0 +1,277 @@
+/*
+ * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
+ * All rights reserved.
+ *
+ * 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. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *
+ * This file is system adaptation of the lwIP TCP/IP stack
+ * by Adam Dunkels <adam@sics.se> for FreeRTOS system.
+ *
+ * Author: Jan Dolezal <pm.jenik@gmail.com>
+ * Author: Pavel Pisa <pisa@cmp.felk.cvut.cz>
+ * Industrial Informatics Group, FEE, Czech Technical University in Prague
+ *
+ */
+/*
+ * mapping of lwIP system dependencies to FreeRTOS system services and types.
+ * DETAILS: ./lwip/doc/sys_arch.txt
+ */
+
+#include <stdint.h>
+#include "os/os.h"
+#include "types.h"
+#include "arch/sys_arch.h"
+#include "arch/cc.h"
+#include "sys_arch.h"
+#include "lwip/err.h"
+#include "lwip/tcpip.h"
+#include "lwipopts.h"
+
+#define SYS_SEM_MAX_CNT    1
+#define SYS_LWIP_MBOX_SIZE (sizeof(void *))
+
+u32_t
+sys_now()
+{
+  return (u32_t)xTaskGetTickCount();  /* this works on condition that portTICK_RATE_MS is 1 */
+}
+
+void
+sys_init(void)
+{
+  //  Is called to initialize the sys_arch layer.
+  return;
+}
+
+err_t
+sys_sem_new(sys_sem_t *sem, u8_t count)
+{
+ #if 0
+  sem->semaphore = xSemaphoreCreateBinary()
+                  if (sem->semaphore == PORT_SEM_INVALID)
+    return ERR_MEM;
+  if (count)
+    xSemaphoreGive(sem->semaphore);
+ #else
+  sem->semaphore = xSemaphoreCreateCounting(SYS_SEM_MAX_CNT, count);
+  if (sem->semaphore == PORT_SEM_INVALID)
+    return ERR_MEM;
+ #endif
+  return ERR_OK;
+}
+
+
+void
+sys_sem_free(sys_sem_t *sem)
+{
+  vSemaphoreDelete(sem->semaphore);
+  sem->semaphore = PORT_SEM_INVALID;
+}
+
+void
+sys_sem_signal(sys_sem_t *sem)
+{
+  xSemaphoreGive(sem->semaphore);
+}
+
+void
+sys_sem_signal_from_ISR(sys_sem_t *sem)
+{
+  xSemaphoreGiveFromISR(sem->semaphore, NULL);
+}
+
+u32_t
+sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout)
+{
+  portTickType start_time = xTaskGetTickCount();
+  portTickType wake_time;
+
+  if (timeout == 0) {
+    while (xSemaphoreTake(sem->semaphore, portMAX_DELAY) == pdFALSE) ;
+  } else {
+    portTickType ticks;
+    ticks = (timeout + portTICK_RATE_MS - 1) / portTICK_RATE_MS;
+    if (ticks == 0)
+      ticks = 1;
+    if (xSemaphoreTake(sem->semaphore, portMAX_DELAY) == pdFALSE)
+      return SYS_ARCH_TIMEOUT;
+  }
+
+  wake_time = xTaskGetTickCount();
+
+  return (wake_time - start_time) * portTICK_RATE_MS;
+}
+
+int
+sys_sem_valid(sys_sem_t *sem)
+{
+  return sem->semaphore == PORT_SEM_INVALID ? 0 : 1;
+}
+
+void
+sys_sem_set_invalid(sys_sem_t *sem)
+{
+  sem->semaphore = PORT_SEM_INVALID;
+}
+
+err_t
+sys_mbox_new(sys_mbox_t *mbox, int size)
+{
+  mbox->mailbox = xQueueCreate(size, SYS_LWIP_MBOX_SIZE);
+  if (mbox->mailbox == PORT_MBOX_INVALID)
+    return ERR_MEM;
+  return ERR_OK;
+}
+
+void
+sys_mbox_free(sys_mbox_t *mbox)
+{
+  vQueueDelete(mbox->mailbox);
+  mbox->mailbox = PORT_MBOX_INVALID;
+}
+
+void
+sys_mbox_post(sys_mbox_t *mbox, void *msg)
+{
+  while (xQueueSendToBack(mbox->mailbox, &msg, portMAX_DELAY) == errQUEUE_FULL) ;
+}
+
+err_t
+sys_mbox_trypost(sys_mbox_t *mbox, void *msg)
+{
+  if (xQueueSendToBack(mbox->mailbox, &msg, 0) == errQUEUE_FULL)
+    return ERR_MEM;
+  return ERR_OK;
+}
+
+u32_t
+sys_arch_mbox_fetch(sys_mbox_t *mbox, void **msg, u32_t timeout)
+{
+  portTickType start_time = xTaskGetTickCount();
+  portTickType wake_time;
+
+  if (timeout == 0) {
+    while (xQueueReceive(mbox->mailbox, msg, portMAX_DELAY) == pdFALSE) ;
+  } else {
+    portTickType ticks;
+    ticks = (timeout + portTICK_RATE_MS - 1) / portTICK_RATE_MS;
+    if (ticks == 0)
+      ticks = 1;
+    if (xQueueReceive(mbox->mailbox, msg, timeout / portTICK_RATE_MS) == pdFALSE)
+      return SYS_ARCH_TIMEOUT;
+  }
+  wake_time = xTaskGetTickCount();
+
+  return (wake_time - start_time) * portTICK_RATE_MS;
+}
+
+u32_t
+sys_arch_mbox_tryfetch(sys_mbox_t *mbox, void **msg)
+{
+  if (xQueueReceive(mbox->mailbox, msg, 0) == pdFALSE)
+    return SYS_MBOX_EMPTY;
+  return 0; /* we waited 0ms */
+}
+
+int
+sys_mbox_valid(sys_mbox_t *mbox)
+{
+  return mbox->mailbox == PORT_MBOX_INVALID ? 0 : 1;
+}
+
+void
+sys_mbox_set_invalid(sys_mbox_t *mbox)
+{
+  mbox->mailbox = PORT_MBOX_INVALID;
+}
+
+sys_thread_t
+sys_thread_new(const char *name, lwip_thread_fn function, void *arg, int stack_size, int prio)
+{
+  xTaskHandle task_handle;
+
+  if (xTaskCreate(function, FREERTOS_TASK_NAME(name), (unsigned short)stack_size,
+                 arg, prio, &task_handle) != pdPASS)
+    return NULL;  /* lwIP doesn't specify, how should be informed that thread creation failed */
+  return task_handle;
+}
+
+err_t
+sys_mutex_new(sys_mutex_t *mutex)
+{
+  mutex->mutex = xSemaphoreCreateMutex();
+  if (mutex->mutex == NULL)
+    return ERR_MEM;
+  return ERR_OK;
+}
+
+/** Lock a mutex
+ * @param mutex the mutex to lock */
+void
+sys_mutex_lock(sys_mutex_t *mutex)
+{
+  while (xSemaphoreTake(mutex->mutex, portMAX_DELAY) == pdFALSE) ;
+}
+
+/** Unlock a mutex
+ * @param mutex the mutex to unlock */
+void
+sys_mutex_unlock(sys_mutex_t *mutex)
+{
+  xSemaphoreGive(mutex->mutex);
+}
+
+/** Delete a mutex
+ * @param mutex the mutex to delete */
+void
+sys_mutex_free(sys_mutex_t *mutex)
+{
+  vSemaphoreDelete(mutex->mutex);
+  mutex->mutex = PORT_MUTEX_INVALID;
+}
+
+void
+sys_arch_delay(unsigned int timeout)
+{
+  portTickType ticks = (timeout + portTICK_RATE_MS - 1) / portTICK_RATE_MS;
+
+  if (ticks == 0)
+    ticks = 1;
+  vTaskDelay(ticks);
+}
+
+/** Ticks/jiffies since power up. */
+u32_t
+sys_jiffies(void)
+{
+  return (u32_t)xTaskGetTickCount();
+}
+
+
+/* Runtime setup of the interrupt vector, dummy for now, has to be done in HalCoGen */
+int
+sys_request_irq(unsigned int irqnum, sys_irq_handler_t handler,
+               unsigned long flags, const char *name, void *context)
+{
+  return 0;
+}
diff --git a/ports/os/freertos/arch/sys_arch.h b/ports/os/freertos/arch/sys_arch.h
new file mode 100644 (file)
index 0000000..d66220f
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
+ * All rights reserved.
+ *
+ * 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. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *
+ * This file is system adaptation of the lwIP TCP/IP stack
+ * by Adam Dunkels <adam@sics.se> for FreeRTOS system.
+ *
+ * Author: Jan Dolezal <pm.jenik@gmail.com>
+ * Author: Pavel Pisa <pisa@cmp.felk.cvut.cz>
+ * Industrial Informatics Group, FEE, Czech Technical University in Prague
+ *
+ */
+/*
+ * mapping of lwIP system dependencies to FreeRTOS system services and types.
+ * DETAILS: ./lwip/doc/sys_arch.txt
+ */
+#ifndef __ARCH_SYS_ARCH_H__
+#define __ARCH_SYS_ARCH_H__
+
+#include "os/os.h"
+#include "arch/eth_lwip_default.h"
+
+/* Typedefs for the various port-specific types. */
+#if defined(NO_SYS) && NO_SYS
+  #error "FreeRTOS SYS_ARCH cannot be compiled in NO_SYS variant"
+#endif
+
+#define sys_arch_printk(...) do {} while (0)
+
+typedef unsigned int sys_prot_t;
+
+/* The values for an unallocated entities. */
+#define PORT_SEM_INVALID        NULL
+#define PORT_MBOX_INVALID       NULL
+#define PORT_THREAD_INVALID     NULL
+#define PORT_MUTEX_INVALID      NULL
+
+typedef struct {
+  xQueueHandle mailbox;
+} port_mailbox_t;
+
+typedef struct {
+  xSemaphoreHandle semaphore;
+} port_sem_t;
+
+typedef struct {
+  xSemaphoreHandle mutex;
+} port_mutex_t;
+
+typedef port_mailbox_t sys_mbox_t;
+typedef port_sem_t sys_sem_t;
+typedef port_mutex_t sys_mutex_t;
+typedef xTaskHandle sys_thread_t;
+
+void
+sys_arch_delay(unsigned int x);
+void
+sys_sem_signal_from_ISR(sys_sem_t *sem);
+
+typedef void sys_irqreturn_t;
+#define SYS_IRQ_NONE       ((void)0)
+#define SYS_IRQ_HANDLED    ((void)1)
+#define SYS_IRQ_RETVAL(x)  (IRQ_HANDLED)
+typedef sys_irqreturn_t sys_irq_handler_t(void);
+#define SYS_IRQ_HANDLER_FNC(M_fnc_name)        \
+  sys_irqreturn_t M_fnc_name(void)
+#define sys_irq_handler_get_context() (NULL)
+
+int
+sys_request_irq(unsigned int irqnum, sys_irq_handler_t handler,
+               unsigned long flags, const char *name, void *context);
+
+#define sys_arch_mask_interrupt_source vim_mask_clr
+
+#define sys_arch_unmask_interrupt_source vim_mask_set
+
+/*
+ * ARM Optimizing C/C++ Compiler v15.12.0.LTS User's Guide
+ * 6.8.1 CPSR Register and Interrupt Intrinsics
+ */
+static inline sys_prot_t
+sys_arch_protect(void)
+{
+  return _disable_IRQ();
+}
+
+static inline void
+sys_arch_unprotect(sys_prot_t pval)
+{
+  _restore_interrupts(pval);
+}
+
+static inline void
+sys_arch_data_sync_barier(void)
+{
+  asm ( " dsb " );
+}
+
+#endif /* __ARCH_SYS_ARCH_H__ */