Commit b3cb2345 by Christian Kern

Merge branch 'development' of https://github.com/siemens/embb into development

parents a32ff6eb 99de4d1e
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#ifndef EMBB_DATAFLOW_INTERNAL_SELECT_H_ #ifndef EMBB_DATAFLOW_INTERNAL_SELECT_H_
#define EMBB_DATAFLOW_INTERNAL_SELECT_H_ #define EMBB_DATAFLOW_INTERNAL_SELECT_H_
#include <embb/dataflow/internal/action.h>
#include <embb/dataflow/internal/signal.h> #include <embb/dataflow/internal/signal.h>
#include <embb/dataflow/internal/node.h> #include <embb/dataflow/internal/node.h>
#include <embb/dataflow/internal/inputs.h> #include <embb/dataflow/internal/inputs.h>
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#ifndef EMBB_DATAFLOW_INTERNAL_SWITCH_H_ #ifndef EMBB_DATAFLOW_INTERNAL_SWITCH_H_
#define EMBB_DATAFLOW_INTERNAL_SWITCH_H_ #define EMBB_DATAFLOW_INTERNAL_SWITCH_H_
#include <embb/dataflow/internal/action.h>
#include <embb/dataflow/internal/signal.h> #include <embb/dataflow/internal/signal.h>
#include <embb/dataflow/internal/node.h> #include <embb/dataflow/internal/node.h>
#include <embb/dataflow/internal/inputs.h> #include <embb/dataflow/internal/inputs.h>
......
...@@ -42,7 +42,7 @@ void embb_mtapi_id_pool_initialize( ...@@ -42,7 +42,7 @@ void embb_mtapi_id_pool_initialize(
for (ii = 1; ii < capacity; ii++) { for (ii = 1; ii < capacity; ii++) {
that->id_buffer[ii] = ii; that->id_buffer[ii] = ii;
} }
that->ids_availabe = capacity - 1; that->ids_available = capacity - 1;
that->put_id_position = 0; that->put_id_position = 0;
that->get_id_position = 1; that->get_id_position = 1;
embb_mtapi_spinlock_initialize(&that->lock); embb_mtapi_spinlock_initialize(&that->lock);
...@@ -50,7 +50,7 @@ void embb_mtapi_id_pool_initialize( ...@@ -50,7 +50,7 @@ void embb_mtapi_id_pool_initialize(
void embb_mtapi_id_pool_finalize(embb_mtapi_id_pool_t * that) { void embb_mtapi_id_pool_finalize(embb_mtapi_id_pool_t * that) {
that->capacity = 0; that->capacity = 0;
that->ids_availabe = 0; that->ids_available = 0;
that->get_id_position = 0; that->get_id_position = 0;
that->put_id_position = 0; that->put_id_position = 0;
embb_mtapi_alloc_deallocate(that->id_buffer); embb_mtapi_alloc_deallocate(that->id_buffer);
...@@ -64,9 +64,9 @@ mtapi_uint_t embb_mtapi_id_pool_allocate(embb_mtapi_id_pool_t * that) { ...@@ -64,9 +64,9 @@ mtapi_uint_t embb_mtapi_id_pool_allocate(embb_mtapi_id_pool_t * that) {
assert(MTAPI_NULL != that); assert(MTAPI_NULL != that);
if (embb_mtapi_spinlock_acquire(&that->lock)) { if (embb_mtapi_spinlock_acquire(&that->lock)) {
if (0 < that->ids_availabe) { if (0 < that->ids_available) {
/* take away one id */ /* take away one id */
that->ids_availabe--; that->ids_available--;
/* acquire position to fetch id from */ /* acquire position to fetch id from */
mtapi_uint_t id_position = that->get_id_position; mtapi_uint_t id_position = that->get_id_position;
...@@ -93,7 +93,7 @@ void embb_mtapi_id_pool_deallocate( ...@@ -93,7 +93,7 @@ void embb_mtapi_id_pool_deallocate(
assert(MTAPI_NULL != that); assert(MTAPI_NULL != that);
if (embb_mtapi_spinlock_acquire(&that->lock)) { if (embb_mtapi_spinlock_acquire(&that->lock)) {
if (that->capacity > that->ids_availabe) { if (that->capacity > that->ids_available) {
/* acquire position to put id to */ /* acquire position to put id to */
mtapi_uint_t id_position = that->put_id_position; mtapi_uint_t id_position = that->put_id_position;
that->put_id_position++; that->put_id_position++;
...@@ -105,7 +105,7 @@ void embb_mtapi_id_pool_deallocate( ...@@ -105,7 +105,7 @@ void embb_mtapi_id_pool_deallocate(
that->id_buffer[id_position] = id; that->id_buffer[id_position] = id;
/* make it available */ /* make it available */
that->ids_availabe++; that->ids_available++;
} }
embb_mtapi_spinlock_release(&that->lock); embb_mtapi_spinlock_release(&that->lock);
} else { } else {
......
...@@ -48,7 +48,7 @@ extern "C" { ...@@ -48,7 +48,7 @@ extern "C" {
struct embb_mtapi_id_pool_struct { struct embb_mtapi_id_pool_struct {
mtapi_uint_t capacity; mtapi_uint_t capacity;
mtapi_uint_t *id_buffer; mtapi_uint_t *id_buffer;
mtapi_uint_t ids_availabe; mtapi_uint_t ids_available;
mtapi_uint_t get_id_position; mtapi_uint_t get_id_position;
mtapi_uint_t put_id_position; mtapi_uint_t put_id_position;
embb_mtapi_spinlock_t lock; embb_mtapi_spinlock_t lock;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment