samples: move ipm samples subsystem folder
Change-Id: I5737e037111f2a5eff5f824bcb72e963b1af22e5 Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
eaffffd963
commit
131cfa2043
|
@ -1,4 +0,0 @@
|
|||
BOARD ?= arduino_101_sss
|
||||
CONF_FILE = prj.conf
|
||||
|
||||
include ${ZEPHYR_BASE}/Makefile.inc
|
|
@ -1,7 +0,0 @@
|
|||
CONFIG_STDOUT_CONSOLE=y
|
||||
CONFIG_PRINTK=y
|
||||
CONFIG_IPM=y
|
||||
CONFIG_IPM_QUARK_SE=y
|
||||
CONFIG_IPM_CONSOLE_SENDER=y
|
||||
CONFIG_CONSOLE=y
|
||||
CONFIG_SERIAL=n
|
|
@ -1,5 +0,0 @@
|
|||
ccflags-y += ${PROJECTINCLUDE} \
|
||||
-I$(ZEPHYR_BASE)/include/drivers \
|
||||
-I$(ZEPHYR_BASE)/drivers -I$(ZEPHYR_BASE)/arch/arc
|
||||
|
||||
obj-y = hello.o
|
|
@ -1,87 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2012-2014 Wind River Systems, Inc.
|
||||
* Copyright (c) 2016 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#include <zephyr.h>
|
||||
|
||||
#include <ipm.h>
|
||||
#include <ipm/ipm_quark_se.h>
|
||||
#include <device.h>
|
||||
#include <init.h>
|
||||
#include <misc/printk.h>
|
||||
#include <string.h>
|
||||
|
||||
QUARK_SE_IPM_DEFINE(ping_ipm, 0, QUARK_SE_IPM_INBOUND);
|
||||
QUARK_SE_IPM_DEFINE(message_ipm0, 1, QUARK_SE_IPM_INBOUND);
|
||||
QUARK_SE_IPM_DEFINE(message_ipm1, 2, QUARK_SE_IPM_INBOUND);
|
||||
QUARK_SE_IPM_DEFINE(message_ipm2, 3, QUARK_SE_IPM_INBOUND);
|
||||
|
||||
/* specify delay between greetings (in ms); compute equivalent in ticks */
|
||||
|
||||
#define SLEEPTIME 1100
|
||||
|
||||
#define STACKSIZE 2000
|
||||
|
||||
uint8_t counters[3];
|
||||
|
||||
void ping_ipm_callback(void *context, uint32_t id, volatile void *data)
|
||||
{
|
||||
printk("counters: %d %d %d\n", counters[0], counters[1], counters[2]);
|
||||
}
|
||||
|
||||
static const char dat1[] = "abcdefghijklmno";
|
||||
static const char dat2[] = "pqrstuvwxyz0123";
|
||||
|
||||
|
||||
void message_ipm_callback(void *context, uint32_t id, volatile void *data)
|
||||
{
|
||||
uint8_t *counter = (uint8_t *)context;
|
||||
char *datac = (char *)data;
|
||||
const char *expected;
|
||||
|
||||
if (*counter != id) {
|
||||
printk("expected %d got %d\n", *counter, id);
|
||||
}
|
||||
|
||||
if (id & 0x1) {
|
||||
expected = dat2;
|
||||
} else {
|
||||
expected = dat1;
|
||||
}
|
||||
|
||||
if (strcmp(expected, datac)) {
|
||||
printk("unexpected data payload\n");
|
||||
}
|
||||
(*counter)++;
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
struct device *ipm;
|
||||
|
||||
ipm = device_get_binding("ping_ipm");
|
||||
ipm_register_callback(ipm, ping_ipm_callback, NULL);
|
||||
ipm_set_enabled(ipm, 1);
|
||||
|
||||
ipm = device_get_binding("message_ipm0");
|
||||
ipm_register_callback(ipm, message_ipm_callback, &counters[0]);
|
||||
ipm_set_enabled(ipm, 1);
|
||||
|
||||
ipm = device_get_binding("message_ipm1");
|
||||
ipm_register_callback(ipm, message_ipm_callback, &counters[1]);
|
||||
ipm_set_enabled(ipm, 1);
|
||||
|
||||
ipm = device_get_binding("message_ipm2");
|
||||
ipm_register_callback(ipm, message_ipm_callback, &counters[2]);
|
||||
ipm_set_enabled(ipm, 1);
|
||||
|
||||
|
||||
while (1) {
|
||||
/* say "hello" */
|
||||
printk("Hello from ARC!\n");
|
||||
|
||||
k_sleep(SLEEPTIME);
|
||||
}
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
[test]
|
||||
build_only = true
|
||||
tags = samples ipm
|
||||
filter = CONFIG_SOC_QUARK_SE_C1000_SS
|
|
@ -1,4 +0,0 @@
|
|||
BOARD ?= arduino_101
|
||||
CONF_FILE = prj.conf
|
||||
|
||||
include ${ZEPHYR_BASE}/Makefile.inc
|
|
@ -1,8 +0,0 @@
|
|||
CONFIG_PRINTK=y
|
||||
CONFIG_ARC_INIT=y
|
||||
CONFIG_IPM=y
|
||||
CONFIG_IPM_QUARK_SE=y
|
||||
CONFIG_IPM_QUARK_SE_MASTER=y
|
||||
CONFIG_IPM_CONSOLE_RECEIVER=y
|
||||
CONFIG_TIMESLICE_SIZE=1
|
||||
CONFIG_MAIN_STACK_SIZE=2048
|
|
@ -1,5 +0,0 @@
|
|||
ccflags-y += ${PROJECTINCLUDE}
|
||||
ccflags-y +=-I$(ZEPHYR_BASE)/include/drivers
|
||||
ccflags-y +=-I$(ZEPHYR_BASE)/drivers -I$(ZEPHYR_BASE)/arch/x86
|
||||
|
||||
obj-y = hello.o
|
|
@ -1,145 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2012-2014 Wind River Systems, Inc.
|
||||
* Copyright (c) 2016 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <misc/printk.h>
|
||||
#include <zephyr.h>
|
||||
#include <ipm.h>
|
||||
#include <ipm/ipm_quark_se.h>
|
||||
|
||||
QUARK_SE_IPM_DEFINE(ping_ipm, 0, QUARK_SE_IPM_OUTBOUND);
|
||||
QUARK_SE_IPM_DEFINE(message_ipm0, 1, QUARK_SE_IPM_OUTBOUND);
|
||||
QUARK_SE_IPM_DEFINE(message_ipm1, 2, QUARK_SE_IPM_OUTBOUND);
|
||||
QUARK_SE_IPM_DEFINE(message_ipm2, 3, QUARK_SE_IPM_OUTBOUND);
|
||||
|
||||
/* specify delay between greetings (in ms); compute equivalent in ticks */
|
||||
|
||||
#define SLEEPTIME 1000
|
||||
#define SCSS_REGISTER_BASE 0xB0800000
|
||||
#define SCSS_SS_STS 0x0604
|
||||
|
||||
#define PING_TIME 1000
|
||||
#define STACKSIZE 2000
|
||||
|
||||
#define MSG_FIBER_PRI 6
|
||||
#define MAIN_FIBER_PRI 2
|
||||
#define PING_FIBER_PRI 4
|
||||
#define TASK_PRIO 7
|
||||
|
||||
char thread_stacks[2][STACKSIZE];
|
||||
|
||||
uint32_t scss_reg(uint32_t offset)
|
||||
{
|
||||
volatile uint32_t *ret = (volatile uint32_t *)(SCSS_REGISTER_BASE +
|
||||
offset);
|
||||
|
||||
return *ret;
|
||||
}
|
||||
|
||||
static const char dat1[] = "abcdefghijklmno";
|
||||
static const char dat2[] = "pqrstuvwxyz0123";
|
||||
|
||||
|
||||
void message_source(struct device *ipm)
|
||||
{
|
||||
uint8_t counter = 0;
|
||||
|
||||
printk("sending messages for IPM device %p\n", ipm);
|
||||
|
||||
while (1) {
|
||||
ipm_send(ipm, 1, counter++, dat1, 16);
|
||||
ipm_send(ipm, 1, counter++, dat2, 16);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void message_source_task_0(void)
|
||||
{
|
||||
message_source(device_get_binding("message_ipm0"));
|
||||
}
|
||||
|
||||
void message_source_task_1(void)
|
||||
{
|
||||
message_source(device_get_binding("message_ipm1"));
|
||||
}
|
||||
|
||||
void message_source_task_2(void)
|
||||
{
|
||||
message_source(device_get_binding("message_ipm2"));
|
||||
}
|
||||
|
||||
void ping_source_thread(void *arg1, void *arg2, void *arg3)
|
||||
{
|
||||
ARG_UNUSED(arg1);
|
||||
ARG_UNUSED(arg2);
|
||||
ARG_UNUSED(arg3);
|
||||
|
||||
struct device *ipm = device_get_binding("ping_ipm");
|
||||
|
||||
while (1) {
|
||||
k_sleep(PING_TIME);
|
||||
printk("pinging sensor subsystem (ARC) for counter status\n");
|
||||
ipm_send(ipm, 1, 0, NULL, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void main_thread(void *arg1, void *arg2, void *arg3)
|
||||
{
|
||||
ARG_UNUSED(arg1);
|
||||
ARG_UNUSED(arg2);
|
||||
ARG_UNUSED(arg3);
|
||||
int ctr = 0;
|
||||
uint32_t ss_sts;
|
||||
|
||||
while (1) {
|
||||
/* say "hello" */
|
||||
printk("Hello from application processor (x86)! (%d) ", ctr++);
|
||||
|
||||
ss_sts = scss_reg(SCSS_SS_STS);
|
||||
switch (ss_sts) {
|
||||
case 0x4000:
|
||||
printk("Sensor Subsystem (ARC) is halted");
|
||||
break;
|
||||
case 0x0400:
|
||||
printk("Sensor Subsystem (ARC) is sleeping");
|
||||
break;
|
||||
case 0:
|
||||
printk("Sensor Subsystem (ARC) is running");
|
||||
break;
|
||||
default:
|
||||
printk("Sensor Subsystem (ARC) status: %x", ss_sts);
|
||||
break;
|
||||
}
|
||||
|
||||
printk(", mailbox status: %x mask %x\n", scss_reg(0xac0),
|
||||
scss_reg(0x4a0));
|
||||
|
||||
/* wait a while, then let other task have a turn */
|
||||
k_sleep(SLEEPTIME);
|
||||
}
|
||||
}
|
||||
|
||||
K_THREAD_DEFINE(MSG_TASK0, STACKSIZE, message_source_task_0, NULL, NULL, NULL,
|
||||
TASK_PRIO, 0, K_NO_WAIT);
|
||||
|
||||
K_THREAD_DEFINE(MSG_TASK1, STACKSIZE, message_source_task_1, NULL, NULL, NULL,
|
||||
TASK_PRIO, 0, K_NO_WAIT);
|
||||
|
||||
K_THREAD_DEFINE(MSG_TASK2, STACKSIZE, message_source_task_2, NULL, NULL, NULL,
|
||||
TASK_PRIO, 0, K_NO_WAIT);
|
||||
|
||||
void main(void)
|
||||
{
|
||||
printk("===== app started ========\n");
|
||||
|
||||
k_thread_spawn(&thread_stacks[0][0], STACKSIZE, main_thread,
|
||||
0, 0, 0, K_PRIO_COOP(MAIN_FIBER_PRI), 0, 0);
|
||||
|
||||
k_thread_spawn(&thread_stacks[1][0], STACKSIZE, ping_source_thread,
|
||||
0, 0, 0, K_PRIO_COOP(PING_FIBER_PRI), 0, 0);
|
||||
|
||||
}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
[test]
|
||||
build_only = true
|
||||
tags = samples ipm
|
||||
filter = CONFIG_SOC_QUARK_SE_C1000
|
|
@ -1,35 +0,0 @@
|
|||
# @testcase dynamic defaults=none
|
||||
# @targets bsp_models:x86\+arc
|
||||
#
|
||||
# @build [ bsp == "x86" ] \
|
||||
# make -j -C %(srcdir)s/ipm_demo_lmt CONFIG_KERNEL_BIN_NAME=zephyr \
|
||||
# BOARD=%(board)s O=outdir-%(tchash)s-%(bsp_model)s-%(board)s
|
||||
# @build [ bsp == "arc" ] \
|
||||
# make -j -C %(srcdir)s/ipm_demo_arc CONFIG_KERNEL_BIN_NAME=zephyr \
|
||||
# BOARD=%(board)s O=outdir-%(tchash)s-%(bsp_model)s-%(board)s
|
||||
#
|
||||
# @clean rm -rf %(srcdir)s/ipm_demo_*/outdir-%(tchash)s-%(bsp_model)s-*
|
||||
#
|
||||
# @images [ bsp == "x86" ] \
|
||||
# kernel-%(bsp)s:%(srcdir)s/ipm_demo_lmt/outdir-%(tchash)s-%(bsp_model)s-%(board)s/%(kernelname)s
|
||||
#
|
||||
# @images [ bsp == "arc" ] \
|
||||
# kernel-%(bsp)s:%(srcdir)s/ipm_demo_arc/outdir-%(tchash)s-%(bsp_model)s-%(board)s/%(kernelname)s
|
||||
#
|
||||
#
|
||||
# Maybe we should switch to: Arduino has a hard time recovering some
|
||||
# times, so we power cycle it instead of resetting
|
||||
# @eval [ target == "arduino101" ] target-power-cycle one-shot wait=5
|
||||
# @eval [ target != "arduino101" ] target-reset one-shot
|
||||
#
|
||||
# ^eval [ bsp == 'arc' ] console-rx ::fail "unexpected data payload"
|
||||
# ^eval [ bsp == 'arc' ] console-rx ::fail "expected [0-9]+ got [0-9]+"
|
||||
# @eval [ bsp == 'arc' ] console-rx :15 counters: [0-9]+ [0-9]+ [0-9]+
|
||||
# @eval [ bsp == 'arc' ] console-rx :15 Hello from ARC
|
||||
|
||||
# @eval [ bsp == 'x86' ] console-rx :15 Hello from lakemont!
|
||||
# @eval [ bsp == 'x86' ] console-rx :15 === app started ===
|
||||
# @eval [ bsp == 'x86' ] console-rx :15 pinging arc for counter status
|
||||
# @eval [ bsp == 'x86' ] console-rx :15 ARC (is (halted|sleeping|running)|status:)
|
||||
# @eval [ bsp == 'x86' ] console-rx :15 mailbox status: [0-9a-f]+ mask [0-9a-f]+
|
||||
# @eval [ bsp == 'x86' ] console-rx :15 sending messages for IPM device
|
Loading…
Reference in a new issue