Remove Parallella platform and examples
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 17 Sep 2020 00:05:49 +0000 (20:05 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 17 Sep 2020 00:05:49 +0000 (20:05 -0400)
It's very hard to test and to integrate in a CI.

Also, the Epiphany repositories are not updated since 3-4 years [1].

[1]: https://github.com/adapteva

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
doc/examples/parallella/Makefile [deleted file]
doc/examples/parallella/README.md [deleted file]
doc/examples/parallella/config.yaml [deleted file]
doc/examples/parallella/parallella.c [deleted file]
platforms/parallella/README.md [deleted file]
platforms/parallella/barectf-platform-parallella-common.h [deleted file]
platforms/parallella/barectf-platform-parallella-config.h [deleted file]
platforms/parallella/barectf-platform-parallella.c [deleted file]
platforms/parallella/barectf-platform-parallella.h [deleted file]
platforms/parallella/consumer/Makefile [deleted file]
platforms/parallella/consumer/consumer.c [deleted file]

diff --git a/doc/examples/parallella/Makefile b/doc/examples/parallella/Makefile
deleted file mode 100644 (file)
index 98eb259..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2015 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-CROSS_COMPILE ?= e-
-
-BARECTF ?= barectf
-RM = rm -rf
-MKDIR = mkdir
-CC=$(CROSS_COMPILE)gcc
-LD=$(CC)
-OBJCOPY=$(CROSS_COMPILE)objcopy
-
-ESDK=$(EPIPHANY_HOME)
-ELDF=$(ESDK)/bsps/current/fast.ldf
-PLATFORM_DIR = ../../../platforms/parallella
-CFLAGS = -O2 -Wall -pedantic -I$(PLATFORM_DIR) -I.
-LDFLAGS = -T $(ELDF) -le-lib
-
-TARGET = parallella
-OBJS = $(TARGET).o barectf.o barectf-platform-parallella.o
-
-.PHONY: all view clean
-
-all: $(TARGET).srec
-
-ctf:
-       $(MKDIR) ctf
-
-$(TARGET): $(OBJS)
-       $(LD) -o $@ $^ $(LDFLAGS)
-
-$(TARGET).srec: $(TARGET)
-       $(OBJCOPY) --srec-forceS3 --output-target srec $< $@
-
-ctf/metadata barectf-bitfield.h barectf.h barectf.c: config.yaml ctf
-       barectf $< -m ctf
-
-barectf.o: barectf.c barectf.h barectf-bitfield.h
-       $(CC) $(CFLAGS) -ansi -c $<
-
-barectf-platform-parallella.o: $(PLATFORM_DIR)/barectf-platform-parallella.c
-       $(CC) $(CFLAGS) -c $<
-
-$(TARGET).o: $(TARGET).c barectf.h barectf-bitfield.h
-       $(CC) $(CFLAGS) -c $<
-
-clean:
-       $(RM) $(TARGET) $(TARGET).srec $(OBJS) ctf
-       $(RM) barectf.h barectf-bitfield.h barectf.c
diff --git a/doc/examples/parallella/README.md b/doc/examples/parallella/README.md
deleted file mode 100644 (file)
index adfe3ce..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-# Parallella example
-
-This example shows how to use the barectf
-[Parallella platform](../../../platforms/parallella).
-
-
-## Building
-
-Make sure you have the latest version of barectf installed.
-
-Build this example:
-
-    make
-
-
-## Running
-
-Make sure the consumer application is running first
-(see the Parallella platform's
-[`README.md`](../../../platforms/parallella/README.md) file):
-
-    e-reset
-    ./consumer /path/to/the/ctf/directory/here
-
-Load and start this example on all 16 cores:
-
-    e-loader -s parallella.srec 0 0 4 4
-
-When you've had enough, kill the consumer with `SIGINT` (Ctrl+C) and
-reset the platform with `e-reset` to stop the Epiphany cores.
-
-The complete CTF trace is written to the `ctf` directory.
diff --git a/doc/examples/parallella/config.yaml b/doc/examples/parallella/config.yaml
deleted file mode 100644 (file)
index dcec076..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2015-2016 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-version: '2.1'
-metadata:
-  $include:
-    - stdint.yaml
-    - stdfloat.yaml
-    - stdmisc.yaml
-    - lttng-ust-log-levels.yaml
-  type-aliases:
-    uint6:
-      $inherit: bit-packed-uint8
-      size: 6
-    clock_int:
-      $inherit: uint64
-      property-mappings:
-        - type: clock
-          name: default
-          property: value
-    state:
-      class: enum
-      value-type: uint8
-      members:
-        - NEW
-        - TERMINATED
-        - READY
-        - RUNNING
-        - WAITING
-  clocks:
-    default:
-      freq: 1000000000
-      offset:
-        seconds: 1434580186
-      $return-ctype: uint64_t
-  trace:
-    $include: trace-basic.yaml
-    byte-order: le
-  streams:
-    default:
-      packet-context-type:
-        class: struct
-        fields:
-          timestamp_begin: clock_int
-          timestamp_end: clock_int
-          packet_size: uint32
-          content_size: uint32
-          events_discarded: uint32
-          row: uint6
-          col: uint6
-      event-header-type:
-        class: struct
-        fields:
-          timestamp: clock_int
-          id: uint16
-      events:
-        bit_packed_integers:
-          payload-type:
-            class: struct
-            min-align: 8
-            fields:
-              uint1:
-                $inherit: uint8
-                size: 1
-                align: 1
-              int1:
-                $inherit: int8
-                size: 1
-                align: 1
-              uint2:
-                $inherit: uint8
-                size: 2
-                align: 1
-              int3:
-                $inherit: int8
-                size: 3
-                align: 1
-              uint4:
-                $inherit: uint8
-                size: 4
-                align: 1
-              int5:
-                $inherit: int8
-                size: 5
-                align: 1
-        string_and_float:
-          payload-type:
-            class: struct
-            fields:
-              the_string: string
-              the_float: float
diff --git a/doc/examples/parallella/parallella.c b/doc/examples/parallella/parallella.c
deleted file mode 100644 (file)
index a267311..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2015 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <e_lib.h>
-
-#include "barectf.h"
-#include "barectf-platform-parallella.h"
-
-#define WAND_BIT       (1 << 3)
-
-static void __attribute__((interrupt)) wand_trace_isr(int signum)
-{
-       (void) signum;
-}
-
-static void sync(void)
-{
-       uint32_t irq_state;
-
-       /* enable WAND interrupt */
-       e_irq_global_mask(E_FALSE);
-       e_irq_attach(WAND_BIT, wand_trace_isr);
-       e_irq_mask(WAND_BIT, E_FALSE);
-
-       /* WAND + IDLE */
-       __asm__ __volatile__("wand");
-       __asm__ __volatile__("idle");
-
-       /* acknowledge interrupt */
-       irq_state = e_reg_read(E_REG_STATUS);
-       irq_state &= ~WAND_BIT;
-       e_reg_write(E_REG_STATUS, irq_state);
-}
-
-int main(void)
-{
-       struct barectf_default_ctx *barectf_ctx;
-       static const char *strings[] = {
-               "calories",
-               "fat",
-               "carbohydrate",
-               "protein",
-       };
-       uint8_t at = 0;
-
-       /* initialize tracing platform */
-       if (tracing_init()) {
-               /* init. error: do not trace */
-               return 1;
-       }
-
-       barectf_ctx = tracing_get_barectf_ctx();
-
-       /* synchronize all cores */
-       sync();
-
-       /* reset tracing clock value */
-       tracing_reset_clock();
-
-       /* trace */
-       for (;;) {
-               int8_t b = (int8_t) at;
-               size_t wait_count;
-
-               barectf_default_trace_bit_packed_integers(barectf_ctx,
-                       at, -b, at * 2, -b * 2, at * 3, -b * 3);
-
-               for (wait_count = 0; wait_count < 1000; ++wait_count) {
-                       __asm__ __volatile__("nop");
-               }
-
-               barectf_default_trace_string_and_float(barectf_ctx,
-                       strings[at & 3], 0.1234 * (float) at);
-               at++;
-
-#ifdef LOW_THROUGHPUT
-               for (wait_count = 0; wait_count < 25000000; ++wait_count) {
-                       __asm__ __volatile__("nop");
-               }
-#endif /* LOW_THROUGHPUT */
-       }
-
-       /* never executed here, but this is where this would normally go */
-       tracing_fini();
-
-       return 0;
-}
diff --git a/platforms/parallella/README.md b/platforms/parallella/README.md
deleted file mode 100644 (file)
index 49a92f3..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-# barectf Parallella platform
-
-This platform targets the [Parallella](http://parallella.org/) system.
-
-This platform implements a ring buffer of packets in shared memory
-between the Epiphany cores and the ARM host. A consumer application
-on the host side is responsible for consuming the packets produced by
-the Epiphany cores and for writing them to the file system.
-
-
-## Requirements
-
-  * Possessing a Parallella board
-  * ESDK 2015.1
-  * barectf prefix: `barectf_`
-  * A single stream named `default`
-  * One clock named `default`, returning `uint64_t`, and having a
-    frequency of 1000000000 Hz
-
-The `default` stream must have in its packet context two unsigned
-integers with a size of at least 6 bits named `row` and `col` which will
-hold the row and column numbers of the Epiphany core producing this
-packet.
-
-Example of packet context:
-
-```yaml
-class: struct
-fields:
-  timestamp_begin: clock_int
-  timestamp_end: clock_int
-  packet_size: uint32
-  content_size: uint32
-  events_discarded: uint32
-  row: uint6
-  col: uint6
-```
-
-
-## Files
-
-  * `barectf-platform-parallella.h`: include this in your application
-     running on Epiphany cores
-  * `barectf-platform-parallella-config.h`: platform parameters
-  * `barectf-platform-parallella-common.h`: definitions, data
-    structures, and functions shared by the platform and the consumer
-    application
-  * `barectf-platform-parallella.c`: link your application with this
-  * `consumer/consumer.c`: consumer application
-  * `consumer/Makefile`: consumer application Makefile
-
-## Using
-
-### Platform API
-
-See [`barectf-platform-parallella.h`](barectf-platform-parallella.h).
-
-
-### Consumer application
-
-#### Building
-
-Do:
-
-    make
-
-in the [`consumer`](consumer) directory to build the consumer
-application.
-
-The optional `CROSS_COMPILE` environment variable specifies a
-cross-compiling toolchain prefix.
-
-
-#### Running
-
-Accepted arguments are:
-
-  * `-v`: enable verbose mode
-  * Unnamed argument: output directory of stream files (default: `ctf`)
-
-Example:
-
-    ./consumer -v /path/to/my-trace
-
-The output directory should also contain the `metadata` file produced
-by the `barectf` command-line tool to form a complete CTF trace.
-
-Start the consumer application _before_ starting the Epiphany cores
-running the platform and your application. To make sure your Epiphany
-application is not running, use the `e-reset` command.
-
-Stop the consumer application by killing it with the `SIGINT` signal
-(Ctrl+C). Stop the consumer application _before_ resetting the
-platform with `e-reset` (once the Epiphany application is started).
-When killed with `SIGINT`, the consumer application will finish writing
-any incomplete packet, then quit.
diff --git a/platforms/parallella/barectf-platform-parallella-common.h b/platforms/parallella/barectf-platform-parallella-common.h
deleted file mode 100644 (file)
index b88bc9b..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-#ifndef _BARECTF_PLATFORM_PARALLELLA_COMMON_H
-#define _BARECTF_PLATFORM_PARALLELLA_COMMON_H
-
-/*
- * barectf Parallella platform
- *
- * Copyright (c) 2015 EfficiOS Inc. and Linux Foundation
- * Copyright (c) 2015 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "barectf-platform-parallella-config.h"
-
-struct ringbuf {
-       uint32_t consumer_index;
-       uint32_t producer_index;
-       uint8_t packets[RINGBUF_SZ][PACKET_SZ];
-
-#ifdef DEBUG
-       char error_buf[256];
-#endif
-};
-
-#define CORES_COUNT            (CORES_ROWS * CORES_COLS)
-#define SMEM_SZ                        (sizeof(struct ringbuf) * CORES_COUNT)
-
-static inline unsigned int rowcol2index(unsigned int row, unsigned int col)
-{
-       return row * CORES_COLS + col;
-}
-
-static inline volatile struct ringbuf *get_ringbuf(void *base,
-       unsigned int row, unsigned int col)
-{
-       unsigned int index = rowcol2index(row, col);
-       volatile struct ringbuf *ringbufs = (struct ringbuf *) base;
-
-       return &ringbufs[index];
-}
-
-#endif /* _BARECTF_PLATFORM_PARALLELLA_COMMON_H */
diff --git a/platforms/parallella/barectf-platform-parallella-config.h b/platforms/parallella/barectf-platform-parallella-config.h
deleted file mode 100644 (file)
index 02a3580..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-#ifndef _BARECTF_PLATFORM_PARALLELLA_CONFIG_H
-#define _BARECTF_PLATFORM_PARALLELLA_CONFIG_H
-
-/*
- * barectf Parallella platform
- *
- * Copyright (c) 2015 EfficiOS Inc. and Linux Foundation
- * Copyright (c) 2015 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-/* barectf Parallella platform parameters */
-
-/* cores/row (4 for the Parallella) */
-#define CORES_ROWS             4
-
-/* cores/row (4 for the Parallella) */
-#define CORES_COLS             4
-
-/* packet size (must be a power of two) */
-#ifndef PACKET_SZ
-#define PACKET_SZ              256
-#endif
-
-/* ring buffer size (at least 2) */
-#ifndef RINGBUF_SZ
-#define RINGBUF_SZ             4
-#endif
-
-/* shared memory region name */
-#ifndef SMEM_NAME
-#define SMEM_NAME              "barectf-tracing"
-#endif
-
-/* backend check timeout (cycles) */
-#ifndef BACKEND_CHECK_TIMEOUT
-#define BACKEND_CHECK_TIMEOUT  (10000000ULL)
-#endif
-
-/* consumer poll delay (µs) */
-#ifndef CONSUMER_POLL_DELAY
-#define CONSUMER_POLL_DELAY    (5000)
-#endif
-
-#endif /* _BARECTF_PLATFORM_PARALLELLA_CONFIG_H */
diff --git a/platforms/parallella/barectf-platform-parallella.c b/platforms/parallella/barectf-platform-parallella.c
deleted file mode 100644 (file)
index 3512925..0000000
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * barectf Parallella platform
- *
- * Copyright (c) 2015 EfficiOS Inc. and Linux Foundation
- * Copyright (c) 2015 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include <stdint.h>
-#include <stdio.h>
-#include <string.h>
-#include <e_lib.h>
-
-#include "barectf-platform-parallella-common.h"
-#include "barectf-platform-parallella.h"
-#include "barectf.h"
-
-static struct tracing_ctx {
-       struct barectf_default_ctx barectf_ctx;
-       volatile struct ringbuf *ringbuf;
-       uint64_t last_backend_check;
-       uint64_t clock_high;
-       e_memseg_t smem;
-
-       /*
-        * Use a producer index's shadow in local memory to avoid
-        * reading the old value of the producer index in shared memory
-        * after having incremented it.
-        *
-        * NEVER read or write the producer index or its shadow
-        * directly: always use get_prod_index() and incr_prod_index().
-        */
-       uint32_t producer_index_shadow;
-
-       unsigned int row, col;
-       uint8_t local_packet[PACKET_SZ];
-       uint8_t initialized;
-       uint8_t backend_wait_period;
-} g_tracing_ctx;
-
-struct barectf_default_ctx *tracing_get_barectf_ctx(void)
-{
-       return &g_tracing_ctx.barectf_ctx;
-}
-
-static inline void incr_prod_index(struct tracing_ctx *tracing_ctx)
-{
-       tracing_ctx->producer_index_shadow++;
-       tracing_ctx->ringbuf->producer_index =
-               tracing_ctx->producer_index_shadow;
-}
-
-static inline uint32_t get_prod_index(struct tracing_ctx *tracing_ctx)
-{
-       return tracing_ctx->producer_index_shadow;
-}
-
-static uint64_t get_clock(void* data)
-{
-       struct tracing_ctx *tracing_ctx = data;
-
-       uint64_t low = (uint64_t)
-               ((uint32_t) (E_CTIMER_MAX - e_ctimer_get(E_CTIMER_1)));
-
-       return tracing_ctx->clock_high | low;
-}
-
-static int is_backend_full(void *data)
-{
-       struct tracing_ctx *tracing_ctx = data;
-       int check_shared = 0;
-       int full;
-
-       /* are we in a back-end checking waiting period? */
-       if (tracing_ctx->backend_wait_period) {
-               /* yes: check if we may check in shared memory now */
-               uint64_t cur_clock = get_clock(data);
-
-               if (cur_clock - tracing_ctx->last_backend_check >=
-                               BACKEND_CHECK_TIMEOUT) {
-                       /* check in shared memory */
-                       check_shared = 1;
-                       tracing_ctx->last_backend_check = cur_clock;
-               }
-       } else {
-               /* no: check in shared memory */
-               check_shared = 1;
-       }
-
-       if (check_shared) {
-               full = (get_prod_index(tracing_ctx) -
-                       tracing_ctx->ringbuf->consumer_index) == RINGBUF_SZ;
-               tracing_ctx->backend_wait_period = full;
-
-               if (full) {
-                       tracing_ctx->last_backend_check = get_clock(data);
-               }
-       } else {
-               /* no shared memory checking: always considered full */
-               full = 1;
-       }
-
-       return full;
-}
-
-static void open_packet(void *data)
-{
-       struct tracing_ctx *tracing_ctx = data;
-
-       barectf_default_open_packet(&tracing_ctx->barectf_ctx,
-               tracing_ctx->row, tracing_ctx->col);
-}
-
-static void close_packet(void *data)
-{
-       struct tracing_ctx *tracing_ctx = data;
-       void *dst;
-       unsigned int index;
-
-       /* close packet now */
-       barectf_default_close_packet(&tracing_ctx->barectf_ctx);
-
-       /*
-        * We know for sure that there is space in the back-end (ring
-        * buffer) for this packet, so "upload" it to shared memory now.
-        */
-       index = get_prod_index(tracing_ctx) & (RINGBUF_SZ - 1);
-       dst = (void *) &(tracing_ctx->ringbuf->packets[index][0]);
-       memcpy(dst, tracing_ctx->local_packet, PACKET_SZ);
-
-       /* update producer index after copy */
-       incr_prod_index(tracing_ctx);
-}
-
-static struct barectf_platform_callbacks cbs = {
-       .default_clock_get_value = get_clock,
-       .is_backend_full = is_backend_full,
-       .open_packet = open_packet,
-       .close_packet = close_packet,
-};
-
-static void __attribute__((interrupt)) timer1_trace_isr()
-{
-       /* CTIMER1 reaches 0: reset to max value and start */
-       g_tracing_ctx.clock_high += (1ULL << 32);
-       e_ctimer_set(E_CTIMER_1, E_CTIMER_MAX);
-       e_ctimer_start(E_CTIMER_1, E_CTIMER_CLK);
-       return;
-}
-
-static void init_clock(void)
-{
-       /* stop and reset CTIMER1 */
-       e_ctimer_stop(E_CTIMER_1);
-       e_ctimer_set(E_CTIMER_1, E_CTIMER_MAX);
-       g_tracing_ctx.clock_high = 0;
-
-       /* enable CTIMER1 interrupt */
-       e_irq_global_mask(E_FALSE);
-       e_irq_attach(E_TIMER1_INT, timer1_trace_isr);
-       e_irq_mask(E_TIMER1_INT, E_FALSE);
-}
-
-static void stop_clock(void)
-{
-       e_ctimer_stop(E_CTIMER_1);
-       e_irq_mask(E_TIMER1_INT, E_TRUE);
-}
-
-void tracing_reset_clock(void)
-{
-       e_ctimer_set(E_CTIMER_1, E_CTIMER_MAX);
-       g_tracing_ctx.clock_high = 0;
-       g_tracing_ctx.backend_wait_period = 0;
-       g_tracing_ctx.last_backend_check = 0;
-       e_ctimer_start(E_CTIMER_1, E_CTIMER_CLK);
-}
-
-int tracing_init(void)
-{
-       e_coreid_t coreid;
-
-       if (g_tracing_ctx.initialized) {
-               /* already initialized */
-               return 0;
-       }
-
-       barectf_init(&g_tracing_ctx.barectf_ctx,
-               g_tracing_ctx.local_packet, PACKET_SZ, cbs, &g_tracing_ctx);
-
-       /* zero local packet */
-       memset(g_tracing_ctx.local_packet, 0, PACKET_SZ);
-
-       /* attach to shared memory */
-       if (e_shm_attach(&g_tracing_ctx.smem, SMEM_NAME) != E_OK) {
-               return -1;
-       }
-
-       /* get core's row and column */
-       coreid = e_get_coreid();
-       e_coords_from_coreid(coreid, &g_tracing_ctx.row, &g_tracing_ctx.col);
-
-       /* get core's ring buffer */
-       g_tracing_ctx.ringbuf =
-               get_ringbuf((void *) g_tracing_ctx.smem.ephy_base,
-                       g_tracing_ctx.row, g_tracing_ctx.col);
-
-       /* initialize tracing clock */
-       init_clock();
-
-       /* start tracing clock */
-       tracing_reset_clock();
-
-       /* open first packet */
-       open_packet(&g_tracing_ctx);
-
-       /* acknowledge initialization */
-       g_tracing_ctx.initialized = 1;
-
-       return 0;
-}
-
-void tracing_fini(void)
-{
-       if (!g_tracing_ctx.initialized) {
-               /* not initialized yet */
-               return;
-       }
-
-       /* close last packet if open and not empty */
-       if (barectf_packet_is_open(&g_tracing_ctx.barectf_ctx) &&
-                       !barectf_packet_is_empty(&g_tracing_ctx.barectf_ctx)) {
-               close_packet(&g_tracing_ctx);
-       }
-
-       /* stop CTIMER1 */
-       stop_clock();
-}
diff --git a/platforms/parallella/barectf-platform-parallella.h b/platforms/parallella/barectf-platform-parallella.h
deleted file mode 100644 (file)
index 3a3ce37..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-#ifndef _BARECTF_PLATFORM_PARALLELLA_H
-#define _BARECTF_PLATFORM_PARALLELLA_H
-
-/*
- * barectf Parallella platform
- *
- * Copyright (c) 2015 EfficiOS Inc. and Linux Foundation
- * Copyright (c) 2015 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "barectf.h"
-
-/**
- * Initializes the platform.
- */
-int tracing_init(void);
-
-/**
- * Returns the barectf context to be used with tracing functions.
- */
-struct barectf_default_ctx *tracing_get_barectf_ctx(void);
-
-/**
- * Resets the tracing clock to an absolute 0.
- *
- * This should be used immediately after a synchronization operation
- * on all executed Epiphany cores.
- */
-void tracing_reset_clock(void);
-
-/**
- * Finalizes the platform.
- */
-void tracing_fini(void);
-
-#endif /* _BARECTF_PLATFORM_PARALLELLA_H */
diff --git a/platforms/parallella/consumer/Makefile b/platforms/parallella/consumer/Makefile
deleted file mode 100644 (file)
index 873f5d5..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2015 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-RM = rm -f
-CC = $(CROSS_COMPILE)gcc
-LD = $(CC)
-
-ESDK=$(EPIPHANY_HOME)
-
-CFLAGS = -O2 -std=c99 -I.. -I"$(ESDK)/tools/host/include"
-LDFLAGS = -L"$(ESDK)/tools/host/lib" -le-hal
-
-TARGET = consumer
-OBJS = $(TARGET).o
-
-.PHONY: all clean
-
-all: $(TARGET)
-
-$(TARGET): $(OBJS)
-       $(LD) -o $@ $^ $(LDFLAGS)
-
-$(TARGET).o: $(TARGET).c
-       $(CC) $(CFLAGS) -c $<
-
-clean:
-       $(RM) $(TARGET) $(OBJS)
diff --git a/platforms/parallella/consumer/consumer.c b/platforms/parallella/consumer/consumer.c
deleted file mode 100644 (file)
index 6227284..0000000
+++ /dev/null
@@ -1,401 +0,0 @@
-/*
- * barectf Parallella platform: consumer application
- *
- * Copyright (c) 2015 EfficiOS Inc. and Linux Foundation
- * Copyright (c) 2015 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#define _BSD_SOURCE
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdint.h>
-#include <assert.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <time.h>
-#include <errno.h>
-#include <e-hal.h>
-
-#include "barectf-platform-parallella-common.h"
-
-#define mb()           __asm__ __volatile__("dmb" : : : "memory")
-
-struct ctx {
-       e_mem_t ringbufs_smem;
-       int stream_fds[CORES_COUNT];
-       const char *trace_dir;
-       int verbose;
-};
-
-static volatile int quit = 0;
-
-static void sig_handler(int signo)
-{
-       if (signo == SIGINT) {
-               quit = 1;
-               fprintf(stderr, "\nGot SIGINT: quitting\n");
-       }
-}
-
-static int try_consume_core_packet(struct ctx *ctx, unsigned int row,
-       unsigned int col)
-{
-       int stream_fd;
-       size_t remaining;
-       uint32_t producer_index;
-       uint32_t consumer_index;
-       uint32_t cons_packet_index;
-       volatile uint8_t *packet_src;
-       unsigned int index = rowcol2index(row, col);
-       volatile struct ringbuf *ringbuf =
-               get_ringbuf(ctx->ringbufs_smem.base, row, col);
-
-#ifdef DEBUG
-       if (ringbuf->error_buf[0]) {
-               printf("[%u, %u] %s\n", row, col, ringbuf->error_buf);
-       }
-#endif /* DEBUG */
-
-       consumer_index = ringbuf->consumer_index;
-       producer_index = ringbuf->producer_index;
-
-       if (producer_index <= consumer_index) {
-               return 0;
-       }
-
-       /* order producer index reading before packet reading */
-       mb();
-
-       /* index of first full packet within ring buffer */
-       cons_packet_index = consumer_index & (RINGBUF_SZ - 1);
-
-       /* full packet data */
-       packet_src = ringbuf->packets[cons_packet_index];
-
-       /* append packet to stream file */
-       remaining = PACKET_SZ;
-
-       if (ctx->verbose) {
-               printf("Consuming one packet from ring buffer of core (%u, %u):\n",
-                       row, col);
-               printf("  Producer index:        %u\n", producer_index);
-               printf("  Consumer index:        %u\n", consumer_index);
-               printf("  Consumer packet index: %u\n", cons_packet_index);
-       }
-
-       stream_fd = ctx->stream_fds[index];
-
-       for (;;) {
-               ssize_t write_ret;
-
-               write_ret = write(stream_fd,
-                       (uint8_t *) packet_src + (PACKET_SZ - remaining),
-                       remaining);
-               assert(write_ret != 0);
-
-               if (write_ret > 0) {
-                       remaining -= write_ret;
-               } else if (write_ret == -1) {
-                       if (errno != EINTR) {
-                               /* other error */
-                               fprintf(stderr, "Error: failed to write packet of core (%u, %u):\n",
-                                       row, col);
-                               perror("write");
-                               return -1;
-                       }
-               }
-
-               if (remaining == 0) {
-                       break;
-               }
-       }
-
-       /* order packet reading before consumer index increment */
-       mb();
-
-       /* packet is consumed: update consumer index now */
-       ringbuf->consumer_index = consumer_index + 1;
-
-       return 0;
-}
-
-static int consume(struct ctx *ctx)
-{
-       int row, col, ret;
-
-       if (ctx->verbose) {
-               printf("Starting consumer\n");
-       }
-
-       for (;;) {
-               if (quit) {
-                       return 0;
-               }
-
-               for (row = 0; row < CORES_ROWS; ++row) {
-                       for (col = 0; col < CORES_COLS; ++col) {
-                               if (quit) {
-                                       return 0;
-                               }
-
-                               ret = try_consume_core_packet(ctx, row, col);
-
-                               if (ret) {
-                                       return ret;
-                               }
-                       }
-               }
-
-               /* busy-wait before the next check */
-               if (usleep(CONSUMER_POLL_DELAY) == -1) {
-                       if (errno != EINTR) {
-                               return -1;
-                       }
-               }
-       }
-}
-
-static void zero_ringbufs(struct ctx *ctx)
-{
-       memset(ctx->ringbufs_smem.base, 0, SMEM_SZ);
-}
-
-static void close_stream_fds(struct ctx *ctx)
-{
-       int i;
-
-       for (i = 0; i < CORES_COUNT; ++i) {
-               if (ctx->stream_fds[i] >= 0) {
-                       int fd = ctx->stream_fds[i];
-
-                       if (close(fd) == -1) {
-                               fprintf(stderr,
-                                       "Warning: could not close FD %d:\n",
-                                       fd);
-                               perror("close");
-                       }
-
-                       ctx->stream_fds[i] = -1;
-               }
-       }
-}
-
-static int open_stream_fd(struct ctx *ctx, unsigned int row, unsigned int col)
-{
-       char filename[128];
-       unsigned int index = rowcol2index(row, col);
-
-       sprintf(filename, "%s/stream-%u-%u", ctx->trace_dir,
-               row, col);
-       ctx->stream_fds[index] =
-               open(filename, O_CREAT | O_WRONLY, 0644);
-
-       if (ctx->stream_fds[index] == -1) {
-               fprintf(stderr, "Error: could not open \"%s\" for writing\n",
-                       filename);
-               close_stream_fds(ctx);
-               return -1;
-       }
-
-       return 0;
-}
-
-static int open_stream_fds(struct ctx *ctx)
-{
-       unsigned int row, col;
-
-       for (row = 0; row < CORES_ROWS; ++row) {
-               for (col = 0; col < CORES_COLS; ++col) {
-                       int ret = open_stream_fd(ctx, row, col);
-
-                       if (ret) {
-                               return ret;
-                       }
-               }
-       }
-
-       return 0;
-}
-
-static void init_stream_fds(struct ctx *ctx)
-{
-       unsigned int row, col;
-
-       for (row = 0; row < CORES_ROWS; ++row) {
-               for (col = 0; col < CORES_COLS; ++col) {
-                       ctx->stream_fds[rowcol2index(row, col)] = -1;
-               }
-       }
-}
-
-static int init(struct ctx *ctx)
-{
-       int ret = 0;
-
-       e_set_host_verbosity(H_D0);
-
-       if (ctx->verbose) {
-               printf("Initializing HAL\n");
-       }
-
-       if (e_init(NULL) != E_OK) {
-               fprintf(stderr, "Error: Epiphany HAL initialization failed\n");
-               ret = -1;
-               goto error;
-       }
-
-       if (ctx->verbose) {
-               printf("HAL initialized\n");
-               printf("Allocating %u bytes of shared memory in region \"%s\"\n",
-                       SMEM_SZ, SMEM_NAME);
-       }
-
-       ret = e_shm_alloc(&ctx->ringbufs_smem, SMEM_NAME, SMEM_SZ) != E_OK;
-
-       if (ret != E_OK) {
-               if (ctx->verbose) {
-                       printf("Allocation failed; attaching to shared memory region \"%s\"\n",
-                               SMEM_NAME);
-               }
-
-               ret = e_shm_attach(&ctx->ringbufs_smem, SMEM_NAME);
-       }
-
-       if (ret != E_OK) {
-               fprintf(stderr, "Error: failed to attach to shared memory: %s\n",
-                       strerror(errno));
-               ret = -1;
-               goto error_finalize;
-       }
-
-       zero_ringbufs(ctx);
-
-       if (ctx->verbose) {
-               printf("Creating CTF stream files in \"%s\"\n", ctx->trace_dir);
-       }
-
-       init_stream_fds(ctx);
-
-       if (open_stream_fds(ctx)) {
-               fprintf(stderr, "Error: failed to create CTF stream files\n");
-               ret = -1;
-               goto error_finalize;
-       }
-
-       return 0;
-
-error_finalize:
-       if (ctx->ringbufs_smem.base) {
-               e_shm_release(SMEM_NAME);
-       }
-
-       e_finalize();
-
-error:
-       return ret;
-}
-
-static void fini(struct ctx *ctx)
-{
-       if (ctx->verbose) {
-               printf("Closing CTF stream files\n");
-       }
-
-       close_stream_fds(ctx);
-
-       if (ctx->verbose) {
-               printf("Releasing shared memory region \"%s\"\n", SMEM_NAME);
-       }
-
-       e_shm_release(SMEM_NAME);
-
-       if (ctx->verbose) {
-               printf("Finalizing HAL\n");
-       }
-
-       e_finalize();
-}
-
-static int parse_arguments(int argc, char *argv[], struct ctx *ctx)
-{
-       int i;
-
-       if (argc > 3) {
-               fprintf(stderr,
-                       "Error: the only accepted arguments are -v and a trace directory path\n");
-               return -1;
-       }
-
-       for (i = 1; i < argc; ++i) {
-               const char *arg = argv[i];
-
-               if (strcmp(arg, "-v") == 0) {
-                       ctx->verbose = 1;
-               } else {
-                       ctx->trace_dir = arg;
-               }
-       }
-
-       if (!ctx->trace_dir) {
-               ctx->trace_dir = "ctf";
-       }
-
-       return 0;
-}
-
-int main(int argc, char *argv[])
-{
-       int ret = 0;
-       struct ctx ctx;
-
-       if (signal(SIGINT, sig_handler) == SIG_ERR) {
-               fprintf(stderr, "Error: failed to register SIGINT handler\n");
-               ret = 1;
-               goto end;
-       }
-
-       memset(&ctx, 0, sizeof(ctx));
-
-       if (parse_arguments(argc, argv, &ctx)) {
-               ret = 1;
-               goto end;
-       }
-
-       if (init(&ctx)) {
-               ret = 1;
-               goto end;
-       }
-
-       if (consume(&ctx)) {
-               ret = 1;
-               goto end_fini;
-       }
-
-end_fini:
-       fini(&ctx);
-
-end:
-       return ret;
-}
This page took 0.040007 seconds and 4 git commands to generate.