Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Commit

Permalink
Merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
jvff committed Jan 9, 2018
2 parents baebec4 + 4336d5d commit f11bc4c
Show file tree
Hide file tree
Showing 38 changed files with 249 additions and 118 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ Make sure you have the following libraries installed, either by download
the binaries or executing the instructions below:

* libsodium-1.0.8 (https://github.com/jedisct1/libsodium/tree/1.0.8)
* zeromq-4.2.0 (https://github.com/lnls-dig/libzmq/tree/v4.2.0-pre)
* czmq-3.0.2 (https://github.com/zeromq/czmq/tree/v3.0.2)
* mlm-1.0 (https://github.com/lnls-dig/malamute/tree/v1.0)
* zeromq-4.2.2 (https://github.com/zeromq/libzmq/tree/v4.2.2)
* czmq-4.0.2 (https://github.com/zeromq/czmq/tree/v4.0.2)
* mlm-1.5.0 (https://github.com/lnls-dig/malamute/tree/v1.5.0)

## Optional libraries:

Expand All @@ -28,9 +28,9 @@ the binaries or executing the instructions below:
### Prerequisites Installation Instructions

git clone --branch=1.0.8 https://github.com/jedisct1/libsodium.git && \
git clone --branch=v4.2.0-pre https://github.com/lnls-dig/libzmq.git && \
git clone --branch=v3.0.2 https://github.com/zeromq/czmq.git && \
git clone --branch=v1.0 https://github.com/lnls-dig/malamute.git &&
git clone --branch=v4.2.2-pre https://github.com/lnls-dig/libzmq.git && \
git clone --branch=v4.0.2 https://github.com/zeromq/czmq.git && \
git clone --branch=v1.5.0 https://github.com/lnls-dig/malamute.git &&
for project in libsodium libzmq czmq malamute; do
cd $project
./autogen.sh
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
}
dependencies {
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.3"
classpath "org.ajoberstar:gradle-git:1.7.1"
classpath "org.ajoberstar:gradle-git:1.7.2"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,16 @@ public class DefaultDistributionVariant extends DefaultDistribution

private void addDetectedDependencySpecification(Map specification,
ProjectModelResolver resolver) {
def projectPath = specification.get("project")
def projectPath = specification.get("project")

if (projectPath != null && projectPath != project.path) {
addDetectedExternalDependencySpecification(projectPath,
specification, resolver)
}
}

private void addDetectedExternalDependencySpecification(String projectPath,
Map specification, ProjectModelResolver resolver) {
def libraryName = specification.get("library")
def linkageType = specification.get("linkage")
def projectModel = resolver.resolveProjectModel(projectPath)
Expand All @@ -169,10 +178,7 @@ public class DefaultDistributionVariant extends DefaultDistribution
def version = project?.version.toString()

if (distribution != null) {
def dependency = new Dependency(projectPath, version, projectModel,
distribution)

dependencies.add(dependency)
dependencies.add(new Dependency(projectPath, version, distribution))
} else if (linkageType != "api")
includeFilesFromProjectLibraryDependency(libraryName, projectModel)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
package br.lnls.dig.gradle.nativedistribution.model.internal

import org.gradle.api.distribution.Distribution
import org.gradle.model.internal.registry.ModelRegistry

class Dependency implements Serializable {
Distribution distribution
ModelRegistry projectModel
String projectPath
String projectVersion

Dependency(String projectPath, String projectVersion,
ModelRegistry projectModel, Distribution distribution) {
Distribution distribution) {
this.projectPath = projectPath
this.projectVersion = projectVersion
this.projectModel = projectModel
this.distribution = distribution
}

Expand Down
2 changes: 1 addition & 1 deletion ci_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ if [ -z "$GRADLE" ]; then
build-wrapper-linux-x86-64 --out-dir bw-output ./compile.sh -b $BOARD -a "${APP}" -e $EXAMPLES -l $SYSTEM_INTEGRATION -x "${HALCS_OPTS[*]}"
else
export ${CONFIG_FLAGS[@]}
./gradlew $GRADLE -Prelease.stage=ci_release
./gradlew $GRADLE
fi

# Get CCache statistics
Expand Down
3 changes: 0 additions & 3 deletions core/common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
apply plugin: 'org.ajoberstar.grgit'
apply plugin: 'org.ajoberstar.release-opinion'

model {
components {
common(NativeLibrarySpec) {
Expand Down
4 changes: 4 additions & 0 deletions core/common/include/sm_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ smio_err_e smio_register_sm (smio_t *self, uint32_t smio_id, uint64_t base,
/* Send MGMT message */
smio_err_e smio_send_mgmt_msg (smio_t *self, uint32_t dest_smio_id,
uint32_t dest_smio_inst, char *msg);
/* Get SDB info from specified VID/DID */
smio_err_e smio_get_sdb_info (smio_t *self, uint32_t smio_id,
uint32_t smio_inst, uint64_t vid, uint32_t did,
sdbutils_info_t *sdbutils_info);

smio_err_e smio_init_exp_ops (smio_t *self, disp_op_t** smio_exp_ops,
const disp_table_func_fp *func_fps);
Expand Down
128 changes: 98 additions & 30 deletions core/dev_io/src/dev_io/c/dev_io_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,18 @@ static devio_err_e _devio_engine_handle_socket (devio_t *devio, void *sock,
zloop_reader_fn handler);
static int _devio_handle_pipe_backend (zloop_t *loop, zsock_t *reader, void *args);

/* Utilities */
static zactor_t *_devio_get_pipe_from_smio_id (devio_t *self, uint32_t smio_id,
uint32_t inst_id);

/* PIPE methods */
static devio_err_e _devio_register_sm_raw (devio_t *self, uint32_t smio_id, uint64_t base,
uint32_t inst_id, bool auto_inst_id);
static devio_err_e _devio_send_smio_mgmt_msg_raw (devio_t *self, uint32_t smio_id,
uint64_t base, uint32_t inst_id, uint32_t dest_smio_id, uint32_t dest_inst_id,
char *msg);
static devio_err_e _devio_send_sdb_info_raw (devio_t *self, uint32_t smio_id,
uint32_t inst_id, uint64_t vid, uint32_t did);
static devio_err_e _devio_register_sm_by_id_raw (devio_t *self, uint32_t smio_id);
static devio_err_e _devio_register_all_sm_raw (devio_t *self);
static devio_err_e _devio_unregister_sm_raw (devio_t *self, const char *smio_key);
Expand Down Expand Up @@ -596,6 +603,8 @@ static int _devio_handle_pipe_mgmt (zloop_t *loop, zsock_t *reader, void *args)
uint32_t inst_id;
uint32_t dest_smio_id;
uint32_t dest_inst_id;
uint64_t vid;
uint32_t did;
char *msg = NULL;

/* This command expects the following or less (depending on command) */
Expand All @@ -606,9 +615,11 @@ static int _devio_handle_pipe_mgmt (zloop_t *loop, zsock_t *reader, void *args)
* Arg4: (uint32_t) dest_smio_id
* Arg5: (uint32_t) dest_inst_id
* Arg6: (string) message
* Arg7: (uint64_t) vendor_id
* Arg8: (uint32_t) device_id
* */
int zerr = zsock_recv (reader, "s48444s", &command, &smio_id, &base, &inst_id,
&dest_smio_id, &dest_inst_id, &msg);
int zerr = zsock_recv (reader, "s48444s84", &command, &smio_id, &base, &inst_id,
&dest_smio_id, &dest_inst_id, &msg, &vid, &did);
if (zerr == -1) {
return 0; /* Malformed message */
}
Expand All @@ -622,10 +633,14 @@ static int _devio_handle_pipe_mgmt (zloop_t *loop, zsock_t *reader, void *args)
_devio_send_smio_mgmt_msg_raw (devio, smio_id, base, inst_id, dest_smio_id,
dest_inst_id, msg);
}
else if (streq (command, "$SDB_DEVICE_INFO")) {
/* Get specific SDB info */
_devio_send_sdb_info_raw (devio, smio_id, inst_id, vid, did);
}
else {
/* Invalid message received. Discard message and continue normally */
DBE_DEBUG (DBG_SM_IO | DBG_LVL_WARN, "[dev_io_core:_devio_handle_pipe_mgmt] PIPE "
"received an invalid command\n");
"received an invalid command: %s\n", command);
}

free (command);
Expand Down Expand Up @@ -821,14 +836,37 @@ static int _devio_handle_pipe_backend (zloop_t *loop, zsock_t *reader, void *arg
/********************** PIPE methods ************************/
/************************************************************/

/* Register a specific sm_io module to this device */
static devio_err_e _devio_register_sm_by_id_raw (devio_t *self, uint32_t smio_id)
static zactor_t *_devio_get_pipe_from_smio_id (devio_t *self, uint32_t smio_id,
uint32_t inst_id)
{
uint64_t base = sdbfs_find_id(self->sdbfs, LNLS_VENDOR_ID, smio_id);
zactor_t **smio_actor_p = NULL;
zactor_t *smio_actor = NULL;

/* Register the sm_io module using the retrieved base address, and
* automatically assign an instance id to it */
return _devio_register_sm_raw(self, smio_id, base, 0, true);
/* Search for specified PIPE by using the smio_id and inst_id */
const volatile smio_mod_dispatch_t *smio_mod_handler = _devio_search_sm_by_id (self,
smio_id);
ASSERT_TEST (smio_mod_handler != NULL, "Could not find specified SMIO "
"from SMIO ID", err_search_smio);

/* Get key to search in hash */
char *smio_key = _devio_gen_smio_key (self, smio_mod_handler, inst_id);
ASSERT_ALLOC (smio_key, err_key_alloc);

DBE_DEBUG (DBG_SM_IO | DBG_LVL_ERR,
"_devio_get_pipe_from_smio_id: smio_key %s\n", smio_key);

/* Finally, do the lookup */
smio_actor_p = (zactor_t **) zhashx_lookup (self->sm_io_h, smio_key);
ASSERT_TEST (smio_actor_p != NULL, "Could not find SMIO PIPE from SMIO ID",
err_inv_key);

smio_actor = *smio_actor_p;

err_inv_key:
free (smio_key);
err_key_alloc:
err_search_smio:
return smio_actor;
}

static devio_err_e _devio_send_smio_mgmt_msg_raw (devio_t *self, uint32_t smio_id,
Expand All @@ -838,37 +876,67 @@ static devio_err_e _devio_send_smio_mgmt_msg_raw (devio_t *self, uint32_t smio_i
assert (self);
devio_err_e err = DEVIO_SUCCESS;

/* Search for specified PIPE by using the dest_smio_id and dest_inst_id */
const volatile smio_mod_dispatch_t *smio_mod_handler = _devio_search_sm_by_id (self,
dest_smio_id);
ASSERT_TEST (smio_mod_handler != NULL, "Could not find specified SMIO "
"for sending MGMT message", err_search_smio, DEVIO_ERR_NO_SMIO_ID);

/* Get key to search in hash */
char *dest_smio_key = _devio_gen_smio_key (self, smio_mod_handler,
dest_inst_id);
ASSERT_ALLOC (dest_smio_key, err_key_alloc);

/* Finally, do the lookup */
zactor_t **dest_smio_actor = (zactor_t **) zhashx_lookup (self->sm_io_h, dest_smio_key);
ASSERT_TEST (dest_smio_actor != NULL,
"Could not find destination SMIO PIPE for sending MGMT message",
err_inv_key);
zactor_t *dest_smio_actor = _devio_get_pipe_from_smio_id (self, dest_smio_id, dest_inst_id);
ASSERT_TEST(dest_smio_actor != NULL, "Could not get actor to send MGMT message",
err_get_smio_actor, DEVIO_ERR_INV_SOCKET /* TODO: improve error handling? */);

/* Send message */
int zerr = zsock_send (*dest_smio_actor, "s48444s", "$MGMT_MSG_SMIO", smio_id,
int zerr = zsock_send (dest_smio_actor, "s48444s", "$MGMT_MSG_SMIO", smio_id,
base, inst_id, dest_smio_id, dest_inst_id, msg);
ASSERT_TEST(zerr == 0, "Could not send MGMT message", err_send_mgmt_msg,
DEVIO_ERR_INV_SOCKET /* TODO: improve error handling? */);

err_send_mgmt_msg:
err_inv_key:
free (dest_smio_key);
err_key_alloc:
err_search_smio:
err_get_smio_actor:
return err;
}

static devio_err_e _devio_send_sdb_info_raw (devio_t *self, uint32_t smio_id,
uint32_t inst_id, uint64_t vid, uint32_t did)
{
assert (self);
devio_err_e err = DEVIO_SUCCESS;

zactor_t *dest_smio_actor = _devio_get_pipe_from_smio_id (self, smio_id, inst_id);
ASSERT_TEST(dest_smio_actor != NULL, "Could not get actor to send SDB info",
err_get_smio_actor, DEVIO_ERR_INV_SOCKET /* TODO: improve error handling? */);

/* Get SDB info */
struct sdb_device* sdb_device = sdbutils_get_sdb_device (self->sdbfs, vid,
did, inst_id);
ASSERT_TEST(sdb_device != NULL, "Could not get SDB device", err_sdb_device,
DEVIO_ERR_INV_SOCKET /* TODO: improve error handling? */);

DBE_DEBUG (DBG_SM_IO | DBG_LVL_ERR,
"_devio_send_sdb_info_raw: sending message to actor with:\n"
"sdb_device->abi_class = %02X, sdb_device->abi_ver_major = %01X,"
"sdb_device->abi_ver_minor = %01X, sdb_device->bus_specific = %04X\n",
sdb_device->abi_class, sdb_device->abi_ver_major,
sdb_device->abi_ver_minor, sdb_device->bus_specific);

/* Send message */
int zerr = zsock_send (dest_smio_actor, "s2114", "$SDB_DEVICE_INFO",
sdb_device->abi_class, sdb_device->abi_ver_major,
sdb_device->abi_ver_minor, sdb_device->bus_specific);
ASSERT_TEST(zerr == 0, "Could not send SDB device info message", err_send_sdb_info_msg,
DEVIO_ERR_INV_SOCKET /* TODO: improve error handling? */);

err_send_sdb_info_msg:
err_sdb_device:
err_get_smio_actor:
return err;
}

/* Register a specific sm_io module to this device */
static devio_err_e _devio_register_sm_by_id_raw (devio_t *self, uint32_t smio_id)
{
uint64_t base = sdbfs_find_id(self->sdbfs, LNLS_VENDOR_ID, smio_id);

/* Register the sm_io module using the retrieved base address, and
* automatically assign an instance id to it */
return _devio_register_sm_raw(self, smio_id, base, 0, true);
}

devio_err_e devio_register_sm_by_id (void *pipe, uint32_t smio_id)
{
assert (pipe);
Expand Down
10 changes: 0 additions & 10 deletions core/revision/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import org.ajoberstar.gradle.git.release.opinion.Strategies

import br.lnls.dig.gradle.updatesemvermacrostask.UpdateSemVerMacrosTask

apply plugin: 'org.ajoberstar.grgit'
Expand Down Expand Up @@ -30,14 +28,6 @@ model {
}
}

release {
versionStrategy Strategies.FINAL.copyWith(
name: 'ci_release',
stages: ['ci_release'] as SortedSet,
allowDirtyRepo: true
)
}

task updateVersionMacros(type: UpdateSemVerMacrosTask) {
macroPrefix 'HALCS_VERSION_'
file project.file('include/revision.h')
Expand Down
2 changes: 1 addition & 1 deletion core/revision/include/revision.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/* HALCS version macros for compile-time API detection */

#define HALCS_VERSION_MAJOR 1
#define HALCS_VERSION_MINOR 0
#define HALCS_VERSION_MINOR 2
#define HALCS_VERSION_PATCH 0

#define HALCS_MAKE_VERSION(major, minor, patch) \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ smio_err_e fmc_active_clk_config_defaults (char *broker_endp, char *service,
client_err = halcs_set_rst_isla216p (config_client, service, FMC_ACTIVE_CLK_DFLT_RST_ISLA216P);
ASSERT_TEST(client_err == HALCS_CLIENT_SUCCESS, "Could not reset FMC250M_4CH",
err_param_set, SMIO_ERR_CONFIG_DFLT);
client_err = halcs_set_rst_swap (config_client, service, FMC_ACTIVE_CLK_DFLT_RST_ISLA216P);
client_err = halcs_set_rst_swap (config_client, service, FMC_ACTIVE_CLK_DFLT_RST_SWAP);
ASSERT_TEST(client_err == HALCS_CLIENT_SUCCESS, "Could not reset SWAP",
err_param_set, SMIO_ERR_CONFIG_DFLT);

Expand Down
34 changes: 34 additions & 0 deletions core/sm_io/src/sm_io/c/sm_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,40 @@ smio_err_e smio_send_mgmt_msg (smio_t *self, uint32_t dest_smio_id,
return err;
}

smio_err_e smio_get_sdb_info (smio_t *self, uint32_t smio_id,
uint32_t smio_inst, uint64_t vid, uint32_t did,
sdbutils_info_t *sdbutils_info)
{
assert (self);
smio_err_e err = SMIO_SUCCESS;

/* Cancel zloop on pipe_mgmt, as we will receive the message in the following
* receive in a blocking call */
zloop_reader_end (self->loop, self->pipe_mgmt);

int zerr = zsock_send (self->pipe_mgmt, "s48444s84", "$SDB_DEVICE_INFO",
smio_id, self->base, smio_inst, 0x0, 0x0,
"", vid, did);
ASSERT_TEST(zerr == 0, "Could not send SDB_DEVICE_INFO message", err_send_sdb_info_msg,
SMIO_ERR_REGISTER_SM);

/* Wait for reply. Note here we expect the reply over the same socket,
* event though the receiving channel was registered in a zloop engine.
* The zloop reader was canceled before and will be reinserted in the engine
* in after receving the message */
char command[50];
zerr = zsock_recv (self->pipe_mgmt, "s2114", command, &sdbutils_info->abi_class,
&sdbutils_info->abi_ver_major, &sdbutils_info->abi_ver_minor, &sdbutils_info->bus_specific);
ASSERT_TEST(zerr == 0, "Could not receive SDB_DEVICE_INFO message", err_recv_sdb_info_msg,
SMIO_ERR_REGISTER_SM);

err_recv_sdb_info_msg:
err_send_sdb_info_msg:
/* Re-register pipe_mgmt in zloop */
_smio_engine_handle_socket (self, self->pipe_mgmt, _smio_handle_pipe_mgmt);
return err;
}

/************************************************************/
/***************** Dispatch table callbacks *****************/
/************************************************************/
Expand Down
Loading

0 comments on commit f11bc4c

Please sign in to comment.