Skip to content

Commit

Permalink
Merge branch 'master' of github.com:crossroadsfpga/enso
Browse files Browse the repository at this point in the history
  • Loading branch information
hsadok committed Feb 20, 2024
2 parents 9b3878e + ce19dfb commit b13851e
Show file tree
Hide file tree
Showing 11 changed files with 285 additions and 61 deletions.
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ authors:
- family-names: "Wang"
given-names: "Ren"
title: "Ensō"
version: 0.4.4
version: 0.4.5
license: BSD-3-Clause-Clear
# doi: 10.5281/zenodo.1234
date-released: 2023-04-23
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project('enso', 'c', 'cpp', version: '0.4.4', license: 'BSD-3-Clause',
project('enso', 'c', 'cpp', version: '0.4.5', license: 'BSD-3-Clause',
meson_version: '>=0.58.0',
default_options: [
'prefix=/usr/local',
Expand Down
50 changes: 46 additions & 4 deletions software/include/enso/consts.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,19 +135,61 @@ static constexpr std::string_view kIpcQueueToAppName = "enso_ipc_queue_to_app";
static constexpr std::string_view kIpcQueueFromAppName =
"enso_ipc_queue_from_app";

enum class MmioNotifType : uint64_t {
enum class NotifType : uint8_t {
kWrite = 0,
kRead = 1,
kTranslAddr = 2 // Used to translate physical address to virtual address in
// the software backend address space.
kTranslAddr = 2, // Used to translate physical address to virtual address in
// the software backend address space.
kAllocatePipe = 3,
kAllocateNotifBuf = 4,
kGetNbFallbackQueues = 5,
kSetRrStatus = 6,
kGetRrStatus = 7,
kFreeNotifBuf = 8,
kFreePipe = 9
};

struct MmioNotification {
MmioNotifType type;
NotifType type;
uint64_t address;
uint64_t value;
};

struct FallbackNotification {
NotifType type;
uint64_t nb_fallback_queues;
uint64_t result;
};

struct RoundRobinNotification {
NotifType type;
uint64_t round_robin;
uint64_t result;
};

struct NotifBufNotification {
NotifType type;
uint64_t notif_buf_id;
uint64_t result;
};

struct AllocatePipeNotification {
NotifType type;
uint64_t fallback;
uint64_t pipe_id;
};

struct FreePipeNotification {
NotifType type;
uint64_t pipe_id;
uint64_t result;
};

struct PipeNotification {
NotifType type;
uint64_t data[2];
};

} // namespace enso

#endif // SOFTWARE_INCLUDE_ENSO_CONSTS_H_
2 changes: 1 addition & 1 deletion software/include/enso/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public_enso_headers = files(
'internals.h',
'queue.h',
'pipe.h',
'socket.h',
'socket.h'
)

install_headers(public_enso_headers, subdir: 'enso')
28 changes: 26 additions & 2 deletions software/include/enso/pipe.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#ifndef SOFTWARE_INCLUDE_ENSO_PIPE_H_
#define SOFTWARE_INCLUDE_ENSO_PIPE_H_

#include <enso/consts.h>
#include <enso/helpers.h>
#include <enso/internals.h>

Expand Down Expand Up @@ -124,11 +125,18 @@ class Device {
* @brief Allocates a TX pipe.
*
* @param buf Buffer address to use for the pipe. It must be a pinned
* hugepage. If not specified, the buffer is allocated internally.
* @return A pointer to the pipe. May be null if the pipe cannot be created.
* hugepage. If not specified, the buffer is allocated
* internally.
* @return A pointer to the pipe. May be null if the pipe cannot be
* created.
*/
TxPipe* AllocateTxPipe(uint8_t* buf = nullptr) noexcept;

/**
* @brief Retrieves the number of fallback queues for this device.
*/
int GetNbFallbackQueues() noexcept;

/**
* @brief Allocates an RX/TX pipe.
*
Expand Down Expand Up @@ -277,6 +285,22 @@ class Device {
*/
int DisableRoundRobin();

/**
* @brief Gets the round robin status for the device.
*
* @return 0 if round robin is disabled, 1 if round robin is enabled, -1 on
* failure.
*/
int GetRoundRobinStatus() noexcept;

/**
* @brief Sends the given config notification to the device.
*
* @param config_notification The config notification.
* @return 0 on success, -1 on failure.
*/
int ApplyConfig(struct TxNotification* config_notification);

private:
struct TxPendingRequest {
uint32_t pipe_id;
Expand Down
1 change: 0 additions & 1 deletion software/include/enso/queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ class Queue {
struct alignas(kCacheLineSize) Element {
uint64_t signal;
T data;
uint8_t pad[kElementPadding];
};

static_assert(sizeof(Element) == kCacheLineSize,
Expand Down
10 changes: 9 additions & 1 deletion software/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ inc = include_directories('include')
subdir('include')
subdir('src')

enso_lib = library('enso', project_sources, install: true,
if dev_backend == 'intel_fpga'
library_name = 'enso'
elif dev_backend == 'software'
library_name = 'enso_sw'
else
error('Unknown backend')
endif

enso_lib = library(library_name, project_sources, install: true,
include_directories: [inc, backend_inc])
pkg_mod = import('pkgconfig')
pkg_mod.generate(enso_lib)
Expand Down
2 changes: 1 addition & 1 deletion software/src/backends/intel_fpga/dev_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class DevBackend {
*
* @return Return 0 on success. On error, -1 is returned and errno is set.
*/
int SetRrStatus(bool enable_rr) { return dev_->set_rr_status(enable_rr); }
int SetRrStatus(bool round_robin) { return dev_->set_rr_status(round_robin); }

/**
* @brief Gets the Round-Robin status.
Expand Down
Loading

0 comments on commit b13851e

Please sign in to comment.