diff options
author | edolomb <none@example.com> | 2018-03-16 15:04:01 +0000 |
---|---|---|
committer | edolomb <none@example.com> | 2018-03-16 15:04:01 +0000 |
commit | 8e1851be0ef7d20563085907460f9bb77ed2ebba (patch) | |
tree | 65196448aa8c89452d4442caf78897d31dececc7 /demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC | |
parent | afdfd60b9735a916cf91fbd7a1a4b0895a88a0ba (diff) | |
download | ChibiOS-8e1851be0ef7d20563085907460f9bb77ed2ebba.tar.gz ChibiOS-8e1851be0ef7d20563085907460f9bb77ed2ebba.tar.bz2 ChibiOS-8e1851be0ef7d20563085907460f9bb77ed2ebba.zip |
- Updated demos
- Minor changes
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11778 110e8d01-0319-4d1e-a829-52ad28d1bb01
Diffstat (limited to 'demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC')
-rwxr-xr-x | demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/Makefile | 27 | ||||
-rwxr-xr-x | demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/main.c | 24 | ||||
-rw-r--r-- | demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/proxies/tssockstub.c | 4 |
3 files changed, 33 insertions, 22 deletions
diff --git a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/Makefile b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/Makefile index 2a1c0b958..b8e111ffa 100755 --- a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/Makefile +++ b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/Makefile @@ -108,9 +108,14 @@ endif # Define project name here
PROJECT = ch
+BUILDDIR := ./build
+DEPDIR := ./.dep
# Imported source files and paths
CHIBIOS = ../../..
+
+# Licensing files.
+include $(CHIBIOS)/os/license/license.mk
# Startup files.
include $(CHIBIOS)/os/common/startup/ARMCAx-TZ/compilers/GCC/mk/startup_sama5d2.mk
# HAL-OSAL files (optional).
@@ -125,28 +130,22 @@ include $(CHIBIOS)/os/common/ports/ARMCAx-TZ/compilers/GCC/mk/port_generic.mk include $(CHIBIOS)/test/lib/test.mk
include $(CHIBIOS)/test/rt/rt_test.mk
include $(CHIBIOS)/test/oslib/oslib_test.mk
+include $(CHIBIOS)/os/hal/lib/streams/streams.mk
# Define linker script file here
LDSCRIPT= $(STARTUPLD)/SAMA5D2ddr.ld
# C sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
-CSRC = $(STARTUPSRC) \
- $(KERNSRC) \
- $(PORTSRC) \
- $(OSALSRC) \
- $(HALSRC) \
- $(PLATFORMSRC) \
- $(BOARDSRC) \
+CSRC = $(ALLCSRC) \
$(TESTSRC) \
- $(CHIBIOS)/os/hal/lib/streams/chprintf.c \
tservices.c \
proxies/tssockstub.c \
main.c
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
-CPPSRC =
+CPPSRC = $(ALLCPPSRC)
# C sources to be compiled in ARM mode regardless of the global setting.
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
@@ -169,13 +168,11 @@ TCSRC = TCPPSRC =
# List ASM source files here
-ASMSRC =
-ASMXSRC = $(STARTUPASM) $(PORTASM) $(OSALASM)
+ASMSRC = $(ALLASMSRC)
+ASMXSRC = $(ALLXASMSRC)
-INCDIR = $(CHIBIOS)/os/license \
- $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \
- $(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \
- $(CHIBIOS)/os/hal/lib/streams $(CHIBIOS)/os/various
+INCDIR = $(ALLINC) $(TESTINC) \
+ $(CHIBIOS)/os/various
#
# Project, sources and paths
diff --git a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/main.c b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/main.c index e432e48c1..51200f054 100755 --- a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/main.c +++ b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/main.c @@ -24,17 +24,19 @@ #include <string.h>
#define SERVER_PORT_NUM 8080
-#define SERVER_IP_ADDRESS "192.136.23.21"
+#define SERVER_IP_ADDRESS "192.168.1.76"
void tcpexample(void) {
int socket_fd;
struct sockaddr_in ra;
int recv_data; char data_buffer[80];
+ struct fd_set rset;
+ struct timeval tm = {5, 0};
/*
- * Creates an TCP socket (SOCK_STREAM) with Internet Protocol Family
- * (PF_INET). Protocol family and Address family related. For example
+ * Creates an TCP socket, i.e. a SOCK_STREAM, with Internet Protocol Family,
+ * i.e. PF_INET. Protocol family and Address family are related. For example
* PF_INET Protocol Family and AF_INET family are coupled.
*/
socket_fd = socket(PF_INET, SOCK_STREAM, 0);
@@ -44,7 +46,9 @@ void tcpexample(void) { return;
}
- /* Connects to server ip-address. */
+ FD_ZERO(&rset);
+
+ /* Connects to server ip-address.*/
memset(&ra, 0, sizeof(struct sockaddr_in));
ra.sin_family = AF_INET;
ra.sin_addr.s_addr = inet_addr(SERVER_IP_ADDRESS);
@@ -57,11 +61,21 @@ void tcpexample(void) { close(socket_fd);
return;
}
- if (send(socket_fd, "Baba", sizeof "Baba", 0) < 0) {
+ if (send(socket_fd, "A' sfugliatella e o' babà.\r\n",
+ sizeof "A' sfugliatella e o' babà.\r\n", 0) < 0) {
chprintf((BaseSequentialStream *)&SD1, "send failed \n");
close(socket_fd);
return;
}
+ do {
+ FD_SET(socket_fd, &rset);
+ recv_data = select(socket_fd+1, &rset, 0, 0, &tm);
+ if (recv_data < 0) {
+ chprintf((BaseSequentialStream *)&SD1, "select failed \n");
+ close(socket_fd);
+ return;
+ }
+ } while (recv_data == 0);
recv_data = recv(socket_fd, data_buffer, sizeof data_buffer, 0);
if (recv_data < 0) {
chprintf((BaseSequentialStream *)&SD1, "recv failed \n");
diff --git a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/proxies/tssockstub.c b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/proxies/tssockstub.c index 53056a568..21cc9d28c 100644 --- a/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/proxies/tssockstub.c +++ b/demos/ATSAMA5D2/RT-SAMA5D2-XPLAINED-SEC/proxies/tssockstub.c @@ -87,7 +87,7 @@ static bool isOpValid(stub_op_t *op) * @details It activates the channel between the stubs service and
* the skels daemon running in the nsec world.
* To do it, it uses an event to signal the skels
- * daemon that a new op request is ready to be executed.
+ * daemons that a new op request is ready to be executed.
* The skels daemon will then, behind the scenes, gets the op calling,
* via smc, the stubs service. The skel executes it and then calls the
* stubs service again to post the result and to wake up the
@@ -151,7 +151,7 @@ THD_FUNCTION(TsStubsService, tsstate) { switch (skrp->req) {
case SKEL_REQ_GETOP:
- /* The nsec skel calls us to get a new op ready to be executed.*/
+ /* The nsec skeleton calls us to get a new op ready to be executed.*/
if (chFifoReceiveObjectTimeout(&ops_fifo, (void **)&op, TIME_IMMEDIATE) ==
MSG_TIMEOUT) {
r = SMC_SVC_NHND;
|