Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/l4test enhancement #140

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions user/apps/l4test/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ user-apps-l4test-y = \
string.o \
ipc.o \
kip.o \
mem.o \
assert.o \
main.o \
60 changes: 59 additions & 1 deletion user/apps/l4test/ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void setup_ipc_threads(void *(*f1)(void *), void *(*f2)(void *),
}

/*
** IPC test with only untyped words
* IPC test with only untyped words
*/
__USER_TEXT
static void *simple_ipc_t1_l(void *arg)
Expand Down Expand Up @@ -172,6 +172,52 @@ static void *simple_ipc_t1_l(void *arg)
}

print_result("ReplyWait Message transfer", ipc_ok);

/* Send timeout */
L4_Set_MsgTag(L4_Niltag);
tag = L4_Send_Timeout(ipc_t2, L4_TimePeriod(1000 * 1000));
ipc_ok = true;

if (L4_IpcSucceeded(tag)) {
printf("SND: IPC send incorrectly succeeded\n");
ipc_ok = false;
} else {
if ((L4_ErrorCode() & 0x1) || ((L4_ErrorCode() >> 1) & 0x7) != 1) {
printf("SND: Incorrect error code: %s %s\n",
ipc_errorcode(L4_ErrorCode()),
ipc_errorphase(L4_ErrorCode()));
ipc_ok = false;
}
}
print_result("Send timeout", ipc_ok);
L4_Receive(ipc_t2);

/* Receive timeout */
tag = L4_Receive_Timeout(ipc_t2, L4_TimePeriod(1000 * 1000));
ipc_ok = true;

if (L4_IpcSucceeded(tag)) {
printf("RCV: IPC receive incorrectly succeeded\n");
ipc_ok = false;
} else {
if ((L4_ErrorCode() & 0x1) == 0 ||
((L4_ErrorCode() >> 1) & 0x7) != 1) {
printf ("RCV: Incorrect error code: %s %s\n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use consistent coding style.

ipc_errorcode (L4_ErrorCode ()),
ipc_errorphase (L4_ErrorCode ()));
ipc_ok = false;
}
}
print_result("Receive timeout", ipc_ok);
L4_Set_MsgTag(L4_Niltag);
L4_Send(ipc_t2);

/* Local destination Id */
tag = L4_Receive_Timeout(ipc_t2, L4_TimePeriod(5 * 1000 * 1000));
print_result("Local destination Id", L4_IpcSucceeded(tag));
L4_Set_MsgTag(L4_Niltag);
tag = L4_Send(ipc_t2);

/* From parameter (local) */
tag = L4_Wait(&from);
ipc_ok = true;
Expand Down Expand Up @@ -237,6 +283,18 @@ static void *simple_ipc_t2_l(void *arg)

}

/* Send timeout */
L4_Set_MsgTag(L4_Niltag);
L4_Send(ipc_t1);

/* Receive timeout */
L4_Receive(ipc_t1);

/* Local destination Id */
L4_Set_MsgTag(L4_Niltag);
L4_Send(L4_LocalIdOf(ipc_t1));
L4_Receive(ipc_t1);

// From parameter (local)
L4_Set_MsgTag(L4_Niltag);
L4_Send(ipc_t1);
Expand Down
2 changes: 2 additions & 0 deletions user/apps/l4test/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,10 @@ __USER_TEXT void all_tests(void)
{
extern void all_kip_tests(void);
extern void all_ipc_tests(void);
extern void all_mem_tests(void);

all_kip_tests();
all_mem_tests();
all_ipc_tests();
}

Expand Down
39 changes: 39 additions & 0 deletions user/apps/l4test/mem.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/* Copyright (c) 2002, 2003, 2007, 2010 Karlsruhe University.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should replace the copyright notice with F9 Microkernel project since it is ARM Cortex-M specific.

* All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/

#include <l4/types.h>
#include <l4/ipc.h>
#include <l4io.h>
#include <platform/cortex_m.h>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the <platform/cortex_m.h> required?


#include "arch.h"
#include "config.h"
#include "l4test.h"
#include "assert.h"

__USER_TEXT
static void page_touch(void)
{
volatile L4_Word_t *addr = (L4_Word_t *) get_new_page();
int n = 0;
int max = 1000;

printf("test: Welcome to memtest!\n");

while (max--) {
// *addr = 0x37ULL;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't leave the dead code.

addr += (PAGE_SIZE / sizeof(*addr));
n++;
}

print_result("Page touch", true);
}

__USER_TEXT
void all_mem_tests(void)
{
page_touch();
}