aboutsummaryrefslogtreecommitdiffstats
path: root/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons
diff options
context:
space:
mode:
Diffstat (limited to 'demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons')
-rw-r--r--demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tscommon.h117
-rw-r--r--demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tsdaemonskels.c123
-rw-r--r--demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tsdaemonskels.h82
-rw-r--r--demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tsioblksskel.c287
-rw-r--r--demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tsioblksskel.h70
-rw-r--r--demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tssockskel.c303
-rw-r--r--demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tssockskel.h77
7 files changed, 0 insertions, 1059 deletions
diff --git a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tscommon.h b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tscommon.h
deleted file mode 100644
index bc1c3f5f8..000000000
--- a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tscommon.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio.
-
- This file is part of ChibiOS.
-
- ChibiOS is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- ChibiOS is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * @file tscommon.h
- * @brief Common, shared defines and macros between secure and non secure
- * environment.
- *
- */
-
-#ifndef TSCOMMON_H
-#define TSCOMMON_H
-
-#include "ch.h"
-#include "ccportab.h"
-
-/*===========================================================================*/
-/* Module constants. */
-/*===========================================================================*/
-#define SKEL_REQ_GETOP 1
-#define SKEL_REQ_CPYPRMS 2
-#define SKEL_REQ_PUTRES 3
-#define SKEL_REQ_READY 4
-
-/* Sockets stub defines.*/
-#define SOCK_OP_SOCKET 0
-#define SOCK_OP_CLOSE 1
-#define SOCK_OP_CONNECT 2
-#define SOCK_OP_RECV 3
-#define SOCK_OP_SEND 4
-#define SOCK_OP_SELECT 5
-#define SOCK_OP_BIND 6
-#define SOCK_OP_LISTEN 7
-
-/* Socket new op event.*/
-#define EVT_F_SOCK_NEW_OP 1
-
-/* Sockets stub service name.*/
-#define SOCKS_SVC_NAME "TsSocksStubService"
-
-/* IOBlocks stub defines.*/
-#define IOBLKS_OP_OPEN 0
-#define IOBLKS_OP_CLOSE 1
-#define IOBLKS_OP_READ 2
-#define IOBLKS_OP_WRITE 3
-#define IOBLKS_OP_FLUSH 4
-
-/* IOBlock new op event.*/
-#define EVT_F_IOBLK_NEW_OP 2
-
-/* IOBlock stub service name.*/
-#define IOBLKS_SVC_NAME "TsIOBlksStubService"
-
-/* Sector size.*/
-#define IOBLKS_SECT_SIZE 512U
-
-/* Remote Partition size, in sectors.*/
-#define IOBLKS_PART_SIZE 96256U
-
-/* Remote partition offset, in sectors.*/
-#define IOBLKS_PART_OFFS 952320U
-
-/*===========================================================================*/
-/* Module pre-compile time settings. */
-/*===========================================================================*/
-#define METHOD_MAX_PARAMS 6
-
-#define L_FD_SETSIZE 64
-
-/*===========================================================================*/
-/* Derived constants and error checks. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module data structures and types. */
-/*===========================================================================*/
-typedef struct skel_ctx skel_ctx_t;
-
-typedef struct skel_req {
- uint32_t req; /* getop, cpyprms, putres */
- uint32_t stub_op;
- uint32_t stub_op_code;
- uint32_t stub_op_result;
- uint32_t stub_op_p_sz[METHOD_MAX_PARAMS];
- uint32_t stub_op_p[METHOD_MAX_PARAMS];
- skel_ctx_t *scp; /* the skeleton context this req come from.*/
-} skel_req_t;
-
-/*===========================================================================*/
-/* Module macros. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* External declarations. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module inline functions. */
-/*===========================================================================*/
-
-#endif /* TSCOMMON_H */
diff --git a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tsdaemonskels.c b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tsdaemonskels.c
deleted file mode 100644
index fe1ee682f..000000000
--- a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tsdaemonskels.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-/**
- * @file tsdaemonskel.c
- * @brief Common skeletons daemon for trusted clients.
- *
- */
-
-#include "ch.h"
-#include "chobjfifos.h"
-#include "tsclient.h"
-#include "tsdaemonskels.h"
-#include <string.h>
-
-/*===========================================================================*/
-/* Module local definitions. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module exported variables. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module local types. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module local variables. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module local functions. */
-/*===========================================================================*/
-static inline msg_t invokeStubService(skel_req_t *skreqp) {
- msg_t r;
-
- chMtxLock(&skreqp->scp->stub_svc_mtx);
- r = tsInvokeServiceNoYield(skreqp->scp->stub_svc,
- (ts_params_area_t)skreqp, sizeof *skreqp);
- chDbgAssert(r != SMC_SVC_BUSY, "Unexpected SMC_SVC_BUSY");
- chMtxUnlock(&skreqp->scp->stub_svc_mtx);
- return r;
-}
-
-/*===========================================================================*/
-/* Module exported functions. */
-/*===========================================================================*/
-
-/**
- * @brief Invoke the stubs service in order to copy the 'in'
- * parameters in the non secure memory space.
- */
-void paramsInFromRemote(skel_req_t *skreqp) {
- skreqp->req = SKEL_REQ_CPYPRMS;
- (void) invokeStubService(skreqp);
-}
-
-/**
- * @brief Invoke the stubs service in order to copy the 'out'
- * parameters in the secure memory space and set the
- * remote call result.
- */
-void returnToRemote(skel_req_t *skreqp, uint32_t res) {
- skreqp->stub_op_result = res;
- skreqp->req = SKEL_REQ_PUTRES;
- (void) invokeStubService(skreqp);
- chFifoReturnObject(&skreqp->scp->skel_req_fifo, skreqp);
-}
-
-/**
- * @brief Dispatch a request to a skeleton worker thread.
- */
-THD_FUNCTION(TsSkelsDaemon, arg) {
- skel_ctx_t *skel_ctx = (skel_ctx_t *)arg;
- event_listener_t el;
- skel_req_t *skreqp;
- msg_t r;
-
- chEvtRegisterMaskWithFlags(&stubsEventSource, &el, ALL_EVENTS,
- skel_ctx->skel_eventflag);
- chMtxObjectInit(&skel_ctx->stub_svc_mtx);
- skel_ctx->stub_svc = (ts_service_t)tsInvokeServiceNoYield(TS_HND_DISCOVERY,
- (ts_params_area_t)skel_ctx->stub_svc_name,
- strlen(skel_ctx->stub_svc_name) + 1);
-
- /* Tell to stubs service that we are ready.*/
- skreqp = chFifoTakeObjectTimeout(&skel_ctx->skel_req_fifo, TIME_INFINITE);
- skreqp->req = SKEL_REQ_READY;
- skreqp->stub_op = skel_ctx->skel_eventflag;
- tsInvokeServiceNoYield(skel_ctx->stub_svc, (ts_params_area_t)skreqp,
- sizeof *skreqp);
- chFifoReturnObject(&skel_ctx->skel_req_fifo, skreqp);
-
- /* Start to receive ops from stubs.*/
- for (;/* ever */;) {
- chEvtWaitAny(ALL_EVENTS);
- (void)chEvtGetAndClearFlags(&el);
- while (true) {
- skreqp = chFifoTakeObjectTimeout(&skel_ctx->skel_req_fifo, TIME_INFINITE);
- skreqp->req = SKEL_REQ_GETOP;
- skreqp->scp = skel_ctx;
- r = invokeStubService(skreqp);
- if (r == SMC_SVC_NHND)
- break;
- chFifoSendObject(&skel_ctx->skel_req_fifo, skreqp);
- }
- chFifoReturnObject(&skel_ctx->skel_req_fifo, skreqp);
- }
-}
diff --git a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tsdaemonskels.h b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tsdaemonskels.h
deleted file mode 100644
index a8e342e4b..000000000
--- a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tsdaemonskels.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio.
-
- This file is part of ChibiOS.
-
- ChibiOS is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- ChibiOS is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * @file tsdaemonskels.h
- * @brief Common skeletons daemon macros and structures.
- *
- */
-
-#ifndef TSDAEMONSKELS_H
-#define TSDAEMONSKELS_H
-
-#include "ch.h"
-#include "ccportab.h"
-#include "tscommon.h"
-
-/*===========================================================================*/
-/* Module constants. */
-/*===========================================================================*/
-#define N_MAX_SKEL_REQS 4
-
-/*===========================================================================*/
-/* Module pre-compile time settings. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Derived constants and error checks. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module data structures and types. */
-/*===========================================================================*/
-
-typedef struct skel_ctx {
- objects_fifo_t skel_req_fifo;
- msg_t skel_req_msgs[N_MAX_SKEL_REQS];
- skel_req_t skel_reqs[N_MAX_SKEL_REQS];
- eventflags_t skel_eventflag;
- ts_service_t stub_svc;
- mutex_t stub_svc_mtx;
- const char *stub_svc_name;
-} skel_ctx_t;
-
-/*===========================================================================*/
-/* Module macros. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* External declarations. */
-/*===========================================================================*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
- void paramsInFromRemote(skel_req_t *skreqp);
- void returnToRemote(skel_req_t *skreqp, uint32_t res);
- THD_FUNCTION(TsSkelsDaemon, arg);
-#ifdef __cplusplus
-}
-#endif
-
-/*===========================================================================*/
-/* Module inline functions. */
-/*===========================================================================*/
-
-#endif /* TSDAEMONSKELS_H */
diff --git a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tsioblksskel.c b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tsioblksskel.c
deleted file mode 100644
index b27824501..000000000
--- a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tsioblksskel.c
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-/**
- * @file tsioblksskel.c
- * @brief IOBlocks skeleton daemon for trusted clients.
- *
- */
-
-#include "ch.h"
-#include "hal.h"
-#include "chobjfifos.h"
-#include "tsclient.h"
-#include "tsdaemonskels.h"
-#include "tsioblksskel.h"
-#include "dummyredconf.h"
-#include "rederrno.h"
-#include "redostypes.h"
-#include "redosserv.h"
-#include "sama_sdmmc_lld.h"
-#include "ch_sdmmc_device.h"
-#include "ch_sdmmc_cmds.h"
-#include "ch_sdmmc_sdio.h"
-#include "ch_sdmmc_sd.h"
-#include "ch_sdmmc_mmc.h"
-#include "ch_sdmmc_reledge.h"
-#include <string.h>
-
-/*===========================================================================*/
-/* Module local definitions. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module exported variables. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module local types. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module local variables. */
-/*===========================================================================*/
-static skel_ctx_t skel_ctx;
-
-/*===========================================================================*/
-/* Module local functions. */
-/*===========================================================================*/
-
-/**
- * @name IOBlocks API skeletons, in reliance edge fashion.
- * @{
- */
-
-/**
- * @brief int red_open(uint8_t bVolNum, int mode)
- */
-static void red_open(skel_req_t *skreqp) {
- REDSTATUS result = 0;
- uint32_t ulTries;
- eSDMMC_RC cs;
- SdmmcDriver *sdmmcp = NULL;
- uint8_t bVolNum;
- int mode;
-
- bVolNum = (uint8_t)skreqp->stub_op_p[0];
- mode = (int)skreqp->stub_op_p[1];
- if (!sdmmcGetInstance(bVolNum, &sdmmcp))
- result = -RED_EINVAL;
- else {
- for (ulTries = 0U; ulTries < 20U; ulTries++) {
- cs = sd_mmc_test_unit_ready(sdmmcp);
- if ((cs == SDMMC_OK) && (cs != SDMMC_BUSY)){
- break;
- }
- chThdSleepMilliseconds(5);
- }
-
- if (cs == SDMMC_OK) {
- if (mode != BDEV_O_RDONLY)
- if (sd_mmc_is_write_protected(sdmmcp))
- result = -RED_EROFS;
- } else
- result = -RED_EIO;
- }
-
- /* report the result and copy the 'out' parameters.*/
- returnToRemote(skreqp, result);
-}
-
-/**
- * @brief int red_close(uint8_t bVolNum)
- */
-static void red_close(skel_req_t *skreqp) {
- int result;
-
- result = 0;
-
- /* report the result.*/
- returnToRemote(skreqp, result);
-}
-
-
-/**
- * @brief int red_read(uint8_t bVolNum, uint32_t ulSectorStart, uint32_t ulSectorCount, void *pBuffer)
- */
-static void red_read(skel_req_t *skreqp) {
- REDSTATUS result = 0;
- uint8_t bVolNum;
- uint32_t ulSectorStart;
- uint32_t ulSectorCount;
- void *mem;
- size_t len;
-
- bVolNum = (uint8_t)skreqp->stub_op_p[0];
- ulSectorStart = (uint32_t)skreqp->stub_op_p[1] + IOBLKS_PART_OFFS;
- ulSectorCount = (uint32_t)skreqp->stub_op_p[2];
- len = ulSectorCount * IOBLKS_SECT_SIZE;
-
- /* Allocate the space for the receive buffer.*/
- mem = chHeapAlloc(NULL, len);
- if (NULL == mem) {
- result = -RED_ENOMEM;
- len = 0;
- } else {
- SdmmcDriver *sdmmcp = NULL;
- eSDMMC_RC cs;
-
- if (!sdmmcGetInstance(bVolNum, &sdmmcp)) {
- result = -RED_EINVAL;
- len = 0;
- } else {
- cs = SD_ReadBlocks(sdmmcp, ulSectorStart, mem, ulSectorCount);
- if(cs != SDMMC_OK) {
- result = -RED_EIO;
- len = 0;
- }
- }
- }
- skreqp->stub_op_p_sz[3] = len;
- skreqp->stub_op_p[3] = (uint32_t)mem;
-
- /* report the result and copy 'out' parameter mem.*/
- returnToRemote(skreqp, result);
- if (NULL != mem)
- chHeapFree(mem);
-}
-
-/**
- * @brief int red_write(uint8_t bVolNum, uint32_t ulSectorStart, uint32_t ulSectorCount, const void *pBuffer)
- */
-static void red_write(skel_req_t *skreqp) {
- REDSTATUS result = 0;
- uint8_t bVolNum;
- uint32_t ulSectorStart;
- uint32_t ulSectorCount;
- void *dataptr;
- size_t size;
-
- bVolNum = (uint8_t)skreqp->stub_op_p[0];
- ulSectorStart = (uint32_t)skreqp->stub_op_p[1] + IOBLKS_PART_OFFS;
- ulSectorCount = (uint32_t)skreqp->stub_op_p[2];
- size = ulSectorCount * IOBLKS_SECT_SIZE;
-
- /* Allocate the space for the send buffer.*/
- dataptr = chHeapAlloc(NULL, size);
- if (NULL == dataptr) {
- result = -RED_ENOMEM;
- } else {
- SdmmcDriver *sdmmcp = NULL;
- eSDMMC_RC cs;
-
- skreqp->stub_op_p[3] = (uint32_t)dataptr;
-
- /* call the stub service in order to copy the
- 'in' parameter dataptr.*/
- paramsInFromRemote(skreqp);
-
- if (!sdmmcGetInstance(bVolNum, &sdmmcp)) {
- result = -RED_EINVAL;
- } else {
- cs = SD_WriteBlocks(sdmmcp, ulSectorStart, dataptr, ulSectorCount);
- if (cs != SDMMC_OK)
- result = -RED_EIO;
- }
-
- chHeapFree(dataptr);
- }
-
- /* report the result.*/
- returnToRemote(skreqp, result);
-}
-
-/**
- * @brief red_flush(uint8_t bVolNum);
- */
-static void red_flush(skel_req_t *skreqp) {
- REDSTATUS result = 0;
- uint8_t bVolNum;
- eSDMMC_RC cs;
- SdmmcDriver *sdmmcp = NULL;
-
- bVolNum = (uint8_t)skreqp->stub_op_p[0];
- if (!sdmmcGetInstance(bVolNum, &sdmmcp))
- result = -RED_EINVAL;
- else {
- cs = sd_mmc_test_unit_ready(sdmmcp);
- if(cs != SDMMC_OK)
- result = -RED_EIO;
- }
-
- /* Report the result.*/
- returnToRemote(skreqp, result);
-}
-
-/**
- * @brief IOBlocks Daemon. Dispatch a request to the corresponding
- * local method.
- */
-static THD_FUNCTION(TsIOBlksSkelDaemon, arg) {
- objects_fifo_t *ofp = arg;
- skel_req_t *skreqp;
-
- for (;/* ever */;) {
- chFifoReceiveObjectTimeout(ofp, (void **)&skreqp,
- TIME_INFINITE);
- switch (skreqp->stub_op_code) {
- case IOBLKS_OP_OPEN:
- red_open(skreqp);
- break;
- case IOBLKS_OP_CLOSE:
- red_close(skreqp);
- break;
- case IOBLKS_OP_READ:
- red_read(skreqp);
- break;
- case IOBLKS_OP_WRITE:
- red_write(skreqp);
- break;
- case IOBLKS_OP_FLUSH:
- red_flush(skreqp);
- break;
- default:
- break;
- }
- }
-}
-
-/*===========================================================================*/
-/* Module exported functions. */
-/*===========================================================================*/
-
-/**
- * @brief Init the IOBlocks skeleton daemon objects and create the
- * corresponding threads.
- */
-void tsIOBlksSkelInit(void) {
- int i;
- skel_ctx_t *scp;
-
- scp = &skel_ctx;
- chFifoObjectInit(&scp->skel_req_fifo, sizeof (skel_req_t), N_MAX_SKEL_REQS,
- sizeof (uint8_t), scp->skel_reqs, scp->skel_req_msgs);
- scp->skel_eventflag = EVT_F_IOBLK_NEW_OP;
- scp->stub_svc_name = IOBLKS_SVC_NAME;
-
- for (i = 0; i < N_IOBLKSKEL_THD; ++i)
- chThdCreateFromHeap(NULL, 2048, "TsIOBlksSkelDaemonWrk", NORMALPRIO,
- TsIOBlksSkelDaemon, &scp->skel_req_fifo);
- chThdCreateFromHeap(NULL, 2048, "TsIOBlksSkelDaemon", NORMALPRIO,
- TsSkelsDaemon, scp);
-}
-
-/** @} */
diff --git a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tsioblksskel.h b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tsioblksskel.h
deleted file mode 100644
index cb91230e5..000000000
--- a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tsioblksskel.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio.
-
- This file is part of ChibiOS.
-
- ChibiOS is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- ChibiOS is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * @file tsioblksskel.h
- * @brief IOBlocks skeleton module macros and structures.
- *
- */
-
-#ifndef TSIOBLKSSKEL_H
-#define TSIOBLKSSKEL_H
-
-#include "ch.h"
-#include "ccportab.h"
-#include "tscommon.h"
-
-/*===========================================================================*/
-/* Module constants. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module pre-compile time settings. */
-/*===========================================================================*/
-#define N_IOBLKSKEL_THD 4
-
-/*===========================================================================*/
-/* Derived constants and error checks. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module data structures and types. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module macros. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* External declarations. */
-/*===========================================================================*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
- void tsIOBlksSkelInit(void);
-#ifdef __cplusplus
-}
-#endif
-
-/*===========================================================================*/
-/* Module inline functions. */
-/*===========================================================================*/
-
-#endif /* TSIOBLKSSKEL_H */
diff --git a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tssockskel.c b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tssockskel.c
deleted file mode 100644
index c3d6d3cac..000000000
--- a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tssockskel.c
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-/**
- * @file tssockskel.c
- * @brief Sockets skeleton daemon for trusted clients.
- *
- */
-
-#include "ch.h"
-#include "chobjfifos.h"
-#include "tsclient.h"
-#include "tsdaemonskels.h"
-#include "tssockskel.h"
-#include <string.h>
-
-/*===========================================================================*/
-/* Module local definitions. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module exported variables. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module local types. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module local variables. */
-/*===========================================================================*/
-static skel_ctx_t skel_ctx;
-
-/*===========================================================================*/
-/* Module local functions. */
-/*===========================================================================*/
-
-/**
- * @name Sockets API skeletons.
- * @{
- */
-
-/**
- * @brief int socket(int domain, int type, int protocol)
- */
-static void l_socket(skel_req_t *skreqp) {
- int result;
-
- /* call the api exposed by the TCP/IP stack.*/
- result = socket((int)skreqp->stub_op_p[0],
- (int)skreqp->stub_op_p[1],
- (int)skreqp->stub_op_p[2]);
-
- /* report the result and copy the 'out' parameters.*/
- returnToRemote(skreqp, result);
-}
-
-/**
- * @brief int connect(int s, const struct sockaddr *name, socklen_t namelen)
- */
-static void l_connect(skel_req_t *skreqp) {
- int s, result, socklen;
- struct sockaddr sockaddr;
-
- s = (int)skreqp->stub_op_p[0];
- skreqp->stub_op_p[1] = (uint32_t)&sockaddr;
- socklen = (int)skreqp->stub_op_p[2];
-
- /* Call the stub service in order to copy the 'in' parameter
- sockaddr.*/
- paramsInFromRemote(skreqp);
-
- /* Call the api exposed by the TCP/IP stack.*/
- result = connect(s, &sockaddr, socklen);
-
- /* Report the result.*/
- returnToRemote(skreqp, result);
-}
-
-/**
- * @brief int close(int s)
- */
-static void l_close(skel_req_t *skreqp) {
- int result;
-
- /* Call the api exposed by the TCP/IP stack.*/
- result = close((int)skreqp->stub_op_p[0]);
-
- /* report the result.*/
- returnToRemote(skreqp, result);
-}
-
-
-/**
- * @brief int recv(int s, void *mem, size_t len, int flags)
- */
-static void l_recv(skel_req_t *skreqp) {
- int result;
- void *mem;
- size_t len;
-
- len = skreqp->stub_op_p[2];
-
- /* Allocate the space for the receive buffer.*/
- mem = chHeapAlloc(NULL, len);
- if (NULL == mem) {
- result = ENOMEM;
- } else {
-
- /* call the api exposed by the TCP/IP stack.*/
- result = recv((int)skreqp->stub_op_p[0], mem, len,
- (int)skreqp->stub_op_p[3]);
- skreqp->stub_op_p_sz[1] = result;
- skreqp->stub_op_p[1] = (uint32_t)mem;
- }
-
- /* report the result and copy 'out' parameter mem.*/
- returnToRemote(skreqp, result);
- if (NULL != mem)
- chHeapFree(mem);
-}
-
-/**
- * @brief int send(int s, const void *dataptr, size_t size, int flags)
- */
-static void l_send(skel_req_t *skreqp) {
- int result;
- void *dataptr;
- size_t size;
-
- size = skreqp->stub_op_p[2];
-
- /* Allocate the space for the send buffer.*/
- dataptr = chHeapAlloc(NULL, size);
- if (NULL == dataptr) {
- result = ENOMEM;
- } else {
- skreqp->stub_op_p[1] = (uint32_t)dataptr;
-
- /* call the stub service in order to copy the
- 'in' parameter dataptr.*/
- paramsInFromRemote(skreqp);
-
- /* call the api exposed by the TCP/IP stack.*/
- result = send((int)skreqp->stub_op_p[0], dataptr, size,
- (int)skreqp->stub_op_p[3]);
- chHeapFree(dataptr);
- }
-
- /* report the result.*/
- returnToRemote(skreqp, result);
-}
-
-
-/**
- * @brief int select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset,
- * struct timeval *timeout)
- */
-static void l_select(skel_req_t *skreqp) {
- int result;
- int maxfdpl;
- fd_set readset, writeset, exceptset;
- struct timeval timeout;
-
- maxfdpl = skreqp->stub_op_p[0];
-
- skreqp->stub_op_p_sz[1] = sizeof (fd_set);
- skreqp->stub_op_p_sz[2] = sizeof (fd_set);
- skreqp->stub_op_p_sz[3] = sizeof (fd_set);
- skreqp->stub_op_p[1] = (uint32_t)&readset;
- skreqp->stub_op_p[2] = (uint32_t)&writeset;
- skreqp->stub_op_p[3] = (uint32_t)&exceptset;
- skreqp->stub_op_p[4] = (uint32_t)&timeout;
-
- /* call the stub service in order to copy the
- 'in' parameter readset, writeset, exceptset and timeout.*/
- paramsInFromRemote(skreqp);
-
- /* call the api exposed by the TCP/IP stack.*/
- result = select(maxfdpl, &readset, &writeset, &exceptset, &timeout);
-
- /* report the result and the parameters readset, writeset and exceptset.*/
- returnToRemote(skreqp, result);
-}
-
-/**
- * @brief bind(int s, const struct sockaddr *name, socklen_t namelen);
- */
-static void l_bind(skel_req_t *skreqp) {
- int s, result, socklen;
- struct sockaddr sockaddr;
-
- s = (int)skreqp->stub_op_p[0];
- skreqp->stub_op_p[1] = (uint32_t)&sockaddr;
- socklen = (int)skreqp->stub_op_p[2];
-
- /* Call the stub service in order to copy the 'in' parameter
- sockaddr.*/
- paramsInFromRemote(skreqp);
-
- /* Call the api exposed by the TCP/IP stack.*/
- result = bind(s, &sockaddr, socklen);
-
- /* Report the result.*/
- returnToRemote(skreqp, result);
-}
-
-/**
- * @brief listen(int s, int backlog);
- */
-static void l_listen(skel_req_t *skreqp) {
- int s, result, backlog;
-
- s = (int)skreqp->stub_op_p[0];
- backlog = (int)skreqp->stub_op_p[1];
-
- /* Call the api exposed by the TCP/IP stack.*/
- result = listen(s, backlog);
-
- /* Report the result.*/
- returnToRemote(skreqp, result);
-}
-
-/**
- * @brief Socket Daemon. Dispatch a request to a local method.
- */
-static THD_FUNCTION(TsSockSkelDaemon, arg) {
- objects_fifo_t *ofp = arg;
- skel_req_t *skreqp;
-
- for (;/* ever */;) {
- chFifoReceiveObjectTimeout(ofp, (void **)&skreqp,
- TIME_INFINITE);
- switch (skreqp->stub_op_code) {
- case SOCK_OP_SOCKET:
- l_socket(skreqp);
- break;
- case SOCK_OP_CONNECT:
- l_connect(skreqp);
- break;
- case SOCK_OP_CLOSE:
- l_close(skreqp);
- break;
- case SOCK_OP_RECV:
- l_recv(skreqp);
- break;
- case SOCK_OP_SEND:
- l_send(skreqp);
- break;
- case SOCK_OP_SELECT:
- l_select(skreqp);
- break;
- case SOCK_OP_BIND:
- l_bind(skreqp);
- break;
- case SOCK_OP_LISTEN:
- l_listen(skreqp);
- break;
- default:
- break;
- }
- }
-}
-
-/*===========================================================================*/
-/* Module exported functions. */
-/*===========================================================================*/
-
-/**
- * @brief Init the socket skeletons daemon objects and create the
- * corresponding threads.
- */
-void tsSocksSkelInit(void) {
- int i;
- skel_ctx_t *scp;
-
- scp = &skel_ctx;
- chFifoObjectInit(&scp->skel_req_fifo, sizeof (skel_req_t), N_MAX_SKEL_REQS,
- sizeof (uint8_t), scp->skel_reqs, scp->skel_req_msgs);
- scp->skel_eventflag = EVT_F_SOCK_NEW_OP;
- scp->stub_svc_name = SOCKS_SVC_NAME;
-
- for (i = 0; i < N_SOCKSKEL_THD; ++i)
- chThdCreateFromHeap(NULL, 2048, "TsSockSkelDaemonWrk", NORMALPRIO,
- TsSockSkelDaemon, &scp->skel_req_fifo);
- chThdCreateFromHeap(NULL, 2048, "TsSocksSkelDaemon", NORMALPRIO,
- TsSkelsDaemon, scp);
-}
-
-/** @} */
diff --git a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tssockskel.h b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tssockskel.h
deleted file mode 100644
index a251eba0f..000000000
--- a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-NSEC/daemons/tssockskel.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio.
-
- This file is part of ChibiOS.
-
- ChibiOS is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- ChibiOS is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * @file tssockskel.h
- * @brief Sockets skeleton module macros and structures.
- *
- */
-
-#ifndef TSSOCKSKEL_H
-#define TSSOCKSKEL_H
-
-#include "ch.h"
-#include "ccportab.h"
-#include "lwip/sockets.h"
-#include "tscommon.h"
-
-/*===========================================================================*/
-/* Module constants. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module pre-compile time settings. */
-/*===========================================================================*/
-#define N_SOCKSKEL_THD 4
-
-/*===========================================================================*/
-/* Derived constants and error checks. */
-/*===========================================================================*/
-#if (L_FD_SETSIZE) != (FD_SETSIZE)
-#error "Configuration error of L_FD_SETSIZE, it must be set to FD_SETSIZE "
-#define VALUE(x) #x
-#define VAR_NAME_VALUE(var) #var "=" VALUE(var)
-#pragma message(VAR_NAME_VALUE(FD_SETSIZE))
-#endif
-
-/*===========================================================================*/
-/* Module data structures and types. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* Module macros. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* External declarations. */
-/*===========================================================================*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
- void tsSocksSkelInit(void);
-#ifdef __cplusplus
-}
-#endif
-
-/*===========================================================================*/
-/* Module inline functions. */
-/*===========================================================================*/
-
-#endif /* TSSOCKSKEL_H */