Commit caf1be06 authored by Tommy Olofsson's avatar Tommy Olofsson
Browse files

Merge branch vxworks into master.

parents a49c3d81 62dd9d1f
build/ *build/
doc/gen doc/gen
lib/ lib/
gen/ gen/
...@@ -10,3 +10,6 @@ tags ...@@ -10,3 +10,6 @@ tags
data.enc data.enc
sig.enc sig.enc
.*.swp .*.swp
*~
\#*
.\#*
...@@ -9,5 +9,9 @@ include(LibFindMacros) ...@@ -9,5 +9,9 @@ include(LibFindMacros)
find_path(CUNIT_INCLUDE_DIR NAMES CUnit/CUnit.h PATH_SUFFIXES cunit) find_path(CUNIT_INCLUDE_DIR NAMES CUnit/CUnit.h PATH_SUFFIXES cunit)
find_library(CUNIT_LIBRARY NAMES cunit libcunit cunitlib) find_library(CUNIT_LIBRARY NAMES cunit libcunit cunitlib)
set(CUNIT_PROCESS_INCLUDES CUNIT_INCLUDE_DIR)
set(CUNIT_PROCESS_LIBS CUNIT_LIBRARY)
libfind_process(CUNIT) libfind_process(CUNIT)
...@@ -7,10 +7,12 @@ ...@@ -7,10 +7,12 @@
include(LibFindMacros) include(LibFindMacros)
if(NOT $ENV{LABCOMM_ROOT_DIR} STREQUAL "") if(NOT LABCOMM_ROOT_DIR)
set(LABCOMM_ROOT_DIR $ENV{LABCOMM_ROOT_DIR} CACHE PATH "LabComm base directory location (optional, used for nonstandard installation paths)" FORCE) # No toolchain file used.
else() if("$ENV{LABCOMM}" STREQUAL "")
set(LABCOMM_ROOT_DIR "${Firefly_PROJECT_DIR}/../labcomm/lib/c/") message(FATAL_ERROR "Set env. variable LABCOMM to labcomm root.")
endif()
set(LABCOMM_ROOT_DIR $ENV{LABCOMM}/lib/c)
endif() endif()
# Header files to find # Header files to find
...@@ -28,4 +30,3 @@ set(LABCOMM_PROCESS_LIBS LABCOMM_LIBRARY) ...@@ -28,4 +30,3 @@ set(LABCOMM_PROCESS_LIBS LABCOMM_LIBRARY)
set(LABCOMM_FIND_REQUIRED true) set(LABCOMM_FIND_REQUIRED true)
libfind_process(LABCOMM) libfind_process(LABCOMM)
...@@ -173,6 +173,7 @@ typedef bool (* firefly_connection_error_f)(struct firefly_connection *conn, ...@@ -173,6 +173,7 @@ typedef bool (* firefly_connection_error_f)(struct firefly_connection *conn,
* opened. * opened.
* *
* @param conn The newly opened connection. * @param conn The newly opened connection.
* @param context A user specified context.
*/ */
typedef void (* firefly_connection_opened_f)(struct firefly_connection *conn); typedef void (* firefly_connection_opened_f)(struct firefly_connection *conn);
...@@ -211,6 +212,7 @@ struct firefly_connection_actions { ...@@ -211,6 +212,7 @@ struct firefly_connection_actions {
* offered to. * offered to.
* @param tc A struct containing the transport layer specific * @param tc A struct containing the transport layer specific
* functions and data. * functions and data.
* @param context An initial value of the connection context.
* *
* @return int Indicating error if any. * @return int Indicating error if any.
* @retval 0 if no error, negative error number otherwise. * @retval 0 if no error, negative error number otherwise.
...@@ -219,7 +221,8 @@ int firefly_connection_open( ...@@ -219,7 +221,8 @@ int firefly_connection_open(
struct firefly_connection_actions *actions, struct firefly_connection_actions *actions,
struct firefly_memory_funcs *memory_replacements, struct firefly_memory_funcs *memory_replacements,
struct firefly_event_queue *event_queue, struct firefly_event_queue *event_queue,
struct firefly_transport_connection *tc); struct firefly_transport_connection *tc,
void *context);
/** /**
* @brief Spawns an event that will close the connection specified by * @brief Spawns an event that will close the connection specified by
...@@ -340,4 +343,62 @@ void firefly_channel_restrict(struct firefly_channel *chan); ...@@ -340,4 +343,62 @@ void firefly_channel_restrict(struct firefly_channel *chan);
*/ */
void firefly_channel_unrestrict(struct firefly_channel *chan); void firefly_channel_unrestrict(struct firefly_channel *chan);
/* Stuff for predictable type registration. */
typedef void (*labcomm_handler_function)(void *value, void *context);
typedef int (*labcomm_decoder_register_function)(struct labcomm_decoder *d,
labcomm_handler_function f,
void *context);
typedef int (*labcomm_encoder_register_function)(struct labcomm_encoder *e);
struct firefly_channel_decoder_type {
labcomm_decoder_register_function register_func;
labcomm_handler_function handler;
void *context;
struct firefly_channel_decoder_type *next;
};
struct firefly_channel_encoder_type {
labcomm_encoder_register_function register_func;
struct firefly_channel_encoder_type *next;
};
struct firefly_channel_types {
struct firefly_channel_decoder_type *decoder_types;
struct firefly_channel_encoder_type *encoder_types;
};
#if 0
struct firefly_channel_types *firefly_channel_types_new(void);
void firefly_channel_types_free(struct firefly_channel_types *ct);
#endif
#define FIREFLY_CHANNEL_TYPES_INITIALIZER { NULL, NULL }
void firefly_channel_types_add_decoder_type(
struct firefly_channel_types *types,
labcomm_decoder_register_function register_func,
labcomm_handler_function handler,
void *context);
void firefly_channel_types_add_encoder_type(
struct firefly_channel_types *types,
labcomm_encoder_register_function register_func);
/**
* Used to open with automatic restriction after type registration.
*/
void firefly_channel_open_auto_restrict(struct firefly_connection *conn,
struct firefly_channel_types types);
/**
* Used in accept channel with automatic restriction after type registration.
* Use only in channel-accept-callback.
*/
void firefly_channel_set_types(struct firefly_channel *chan,
struct firefly_channel_types types);
#endif #endif
...@@ -21,7 +21,13 @@ ...@@ -21,7 +21,13 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h> #include <stdbool.h>
#ifdef LABCOMM_COMPAT
#include LABCOMM_COMPAT
#else
#include <stdint.h> #include <stdint.h>
#endif
/** /**
* @brief Defines the maximum number of events an event may depend on. * @brief Defines the maximum number of events an event may depend on.
......
#ifndef FIREFLY_EVENT_QUEUE_VX_H
#define FIREFLY_EVENT_QUEUE_VX_H
#include <utils/firefly_event_queue.h>
/**
* @brief Construct a new struct firefly_event_queue with with a context
* specific for this utility.
*
* @param pool_size The number of preallocated events.
* @return The newly contructed event queue.
*/
struct firefly_event_queue *firefly_event_queue_vx_new(size_t pool_size);
/**
* @brief Free the specified event queue and the posix specific context. Stop
* the event loop if it is running.
*
* @param eq The event queue to free
*/
void firefly_event_queue_vx_free(struct firefly_event_queue **eq);
/**
* @brief Start the event loop.
*
* @param eq The event queue to loop execute events from. It must have been
* constructed with firefly_event_queue_vx_new().
* @param attr The attributes to use when starting the event loop posix thread.
* If NULL the default is used.
* @return Integer indicating result.
* @retval 0 on success.
* @retval <0 on failure.
*/
int firefly_event_queue_vx_run(struct firefly_event_queue *eq);
/**
* @brief Stop the event loop. Will block untill the event loop is stopped.
*
* @param eq The event queue of the event loop to stop. It must have been
* constructed with firefly_event_queue_vx_new().
* @return Integer indicating result.
* @retval 0 on success.
* @retval <0 on failure.
*/
int firefly_event_queue_vx_stop(struct firefly_event_queue *eq);
int64_t firefly_event_queue_vx_add(struct firefly_event_queue *eq,
unsigned char prio, firefly_event_execute_f execute, void *context,
unsigned int nbr_deps, const int64_t *deps);
#endif
...@@ -15,6 +15,7 @@ sample struct { ...@@ -15,6 +15,7 @@ sample struct {
sample struct { sample struct {
int dest_chan_id; int dest_chan_id;
int source_chan_id; int source_chan_id;
boolean auto_restrict;
} channel_request; } channel_request;
sample struct { sample struct {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
## General {{{ ## General {{{
cmake_minimum_required (VERSION 2.8) cmake_minimum_required (VERSION 2.8)
project (Firefly) project (Firefly C)
if(NOT CMAKE_CROSSCOMPILING) if(NOT CMAKE_CROSSCOMPILING)
enable_testing() enable_testing()
endif(NOT CMAKE_CROSSCOMPILING) endif(NOT CMAKE_CROSSCOMPILING)
...@@ -61,27 +61,45 @@ link_directories(${LINK_DIRECTORIES} ${LABCOMM_LIBRARIES}) ...@@ -61,27 +61,45 @@ link_directories(${LINK_DIRECTORIES} ${LABCOMM_LIBRARIES})
## FLAGS {{{ ## FLAGS {{{
set(C_STD "-std=c99") set(C_STD "-std=c99")
set(ERR_FLAGS "-Wall -Wextra") set(ERR_FLAGS "-Wall -Wextra")
set(MACROS_DEF "-DDEBUG")
if(DEFINED $ENV{DEBUG})
set(MACROS_DEF "-DDEBUG -O0")
else()
set(MACROS_DEF "-DNDEBUG -O3")
endif()
if(CMAKE_CROSSCOMPILING) if(CMAKE_CROSSCOMPILING)
# CFLAGS when cross compiling to the ARM-card: if (VXWORKS_COMPILING)
set(CMAKE_C_FLAGS # CFLAGS when cross compiling to the ARM-card:
"${C_STD} " set(CMAKE_C_FLAGS
"${ERR_FLAGS} -Wfloat-equal -Werror-implicit-function-declaration " "${C_STD} "
"-mthumb -mcpu=cortex-m3 -T../ft-sense/src/adc_freertos_lwip/standalone.ld" "${ERR_FLAGS} "
"-ffunction-sections -fdata-sections " "${MACROS_DEF} "
"${MACROS_DEF} -DUART_BUFFERED -Dsprintf=usprintf " "-DLABCOMM_COMPAT=\\\"labcomm_compat_vxworks.h\\\" "
"-Dsnprintf=usnprintf -Dvsnprintf=uvsnprintf -Dprintf=uipprintf " )
"-DFIREFLY_MALLOC=pvPortMalloc -Dcalloc=pvPortCalloc -DFIREFLY_FREE=vPortFree " # Join the list stuff above to a single string:
"-DARM_CORTEXM3_CODESOURCERY -DLABCOMM_NO_STDIO " JOIN("${CMAKE_C_FLAGS}" CMAKE_C_FLAGS)
"-DLABCOMM_COMPAT=\\\"labcomm_compat_arm_cortexm3.h\\\" " else()
"-DGCC_ARMCM3=1" # CFLAGS when cross compiling to the ARM-card:
) set(CMAKE_C_FLAGS
# Join the list stuff above to a single string: "${C_STD} "
JOIN("${CMAKE_C_FLAGS}" CMAKE_C_FLAGS) "${ERR_FLAGS} -Wfloat-equal -Werror-implicit-function-declaration "
"-mthumb -mcpu=cortex-m3 -T../ft-sense/src/adc_freertos_lwip/standalone.ld"
"-ffunction-sections -fdata-sections "
"${MACROS_DEF} -DUART_BUFFERED -Dsprintf=usprintf "
"-Dsnprintf=usnprintf -Dvsnprintf=uvsnprintf -Dprintf=uipprintf "
"-DFIREFLY_MALLOC=pvPortMalloc -Dcalloc=pvPortCalloc -DFIREFLY_FREE=vPortFree "
"-DARM_CORTEXM3_CODESOURCERY -DLABCOMM_NO_STDIO "
"-DLABCOMM_COMPAT=\\\"labcomm_compat_arm_cortexm3.h\\\" "
"-DGCC_ARMCM3=1"
)
# Join the list stuff above to a single string:
JOIN("${CMAKE_C_FLAGS}" CMAKE_C_FLAGS)
endif()
else() else()
# CFLAGS when compiling normally: # CFLAGS when compiling normally:
set(CMAKE_C_FLAGS "${C_STD} ${ERR_FLAGS} ${MACROS_DEF} -g") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_STD} ${ERR_FLAGS} ${MACROS_DEF} -g")
endif(CMAKE_CROSSCOMPILING) endif(CMAKE_CROSSCOMPILING)
## }}} ## }}}
...@@ -117,6 +135,7 @@ add_library(gen-files ...@@ -117,6 +135,7 @@ add_library(gen-files
${Firefly_PROJECT_DIR}/gen/firefly_protocol.c ${Firefly_PROJECT_DIR}/gen/firefly_protocol.c
${Firefly_PROJECT_DIR}/gen/pingpong.c ${Firefly_PROJECT_DIR}/gen/pingpong.c
) )
# Tell CMake that the files above are generated at compile time, # Tell CMake that the files above are generated at compile time,
# otherwise CMake complains about missing files when generating # otherwise CMake complains about missing files when generating
# build files: # build files:
......
...@@ -18,6 +18,11 @@ set(DRIVERLIB_DIR ${FT_SENSE_DIR}/lib/driverlib) ...@@ -18,6 +18,11 @@ set(DRIVERLIB_DIR ${FT_SENSE_DIR}/lib/driverlib)
# according to CMake manual: # according to CMake manual:
set(CMAKE_SYSTEM_NAME Generic) set(CMAKE_SYSTEM_NAME Generic)
if("$ENV{LABOMM_ARM}" STREQUAL "")
message(FATAL_ERROR "Set env. variable LABCOMM_ARM to labcomm root.")
endif()
set(LABCOMM_ROOT_DIR $ENV{LABCOMM_ARM}/lib/c)
# Specify the cross compiler: # Specify the cross compiler:
set(CMAKE_C_COMPILER arm-none-eabi-gcc) set(CMAKE_C_COMPILER arm-none-eabi-gcc)
set(CROSS_COMPILER_ARM arm-none-eabi-gcc) set(CROSS_COMPILER_ARM arm-none-eabi-gcc)
......
# Set system name to Generic when compiling for embedded systems
# according to CMake manual:
set(CMAKE_SYSTEM_NAME Generic)
set(VXWORKS_COMPILING TRUE)
if("$ENV{LABCOMM_VX}" STREQUAL "")
message(FATAL_ERROR "Set env. variable LABCOMM_VX to labcomm root.")
endif()
set(LABCOMM_ROOT_DIR $ENV{LABCOMM_VX}/lib/c)
# Specify the cross compiler:
set(CMAKE_C_COMPILER i586-wrs-vxworks-gcc)
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLABCOMM_COMPAT=\\\"labcomm_compat_vxworks.h\\\" -DLABCOMM_NO_STDIO")
# Add additional includes
include_directories(
/opt/robot/include
/opt/robot/include/vxworks/5.5.1/
/opt/robot/include/vxworks/5.5.1/wrn/coreip/
)
...@@ -22,7 +22,8 @@ set_source_files_properties(${Firefly_PROJECT_DIR}/gen/firefly_protocol.c PROPER ...@@ -22,7 +22,8 @@ set_source_files_properties(${Firefly_PROJECT_DIR}/gen/firefly_protocol.c PROPER
add_library(firefly ${firefly_src_files}) add_library(firefly ${firefly_src_files})
# If not cross compiling, add firefly with error lib target: # If not cross compiling, add firefly with error lib target:
if (NOT CMAKE_CROSSCOMPILING) #if (NOT CMAKE_CROSSCOMPILING)
if (NOT ARM_COMPILING)
add_library(firefly-werr add_library(firefly-werr
${firefly_src_files} ${firefly_src_files}
${Firefly_SOURCE_DIR}/utils/firefly_errors.c ${Firefly_SOURCE_DIR}/utils/firefly_errors.c
...@@ -32,7 +33,8 @@ if (NOT CMAKE_CROSSCOMPILING) ...@@ -32,7 +33,8 @@ if (NOT CMAKE_CROSSCOMPILING)
set(firefly_install_werr set(firefly_install_werr
firefly-werr firefly-werr
) )
endif (NOT CMAKE_CROSSCOMPILING) #endif (NOT CMAKE_CROSSCOMPILING)
endif (NOT ARM_COMPILING)
# Add libs to install target: # Add libs to install target:
install(TARGETS ${firefly_install_werr} firefly install(TARGETS ${firefly_install_werr} firefly
......
...@@ -14,6 +14,15 @@ ...@@ -14,6 +14,15 @@
#include "utils/firefly_event_queue_private.h" #include "utils/firefly_event_queue_private.h"
#include "utils/cppmacros.h" #include "utils/cppmacros.h"
/*
* FIREFLY_PROTO_ACK_*: Used to use the existing ack-functionality
* working with protocol types as well. This may or may not be the
* right way to do this...
*
* Must be negative.
*/
#define FIREFLY_PROTO_ACK_RESTRICT_ACK -1
/* /*
* Used by reg_proto_sigs() below to "short circuit" the connection during * Used by reg_proto_sigs() below to "short circuit" the connection during
* the initial registration of protocol types. * the initial registration of protocol types.
...@@ -40,9 +49,12 @@ void reg_proto_sigs(struct labcomm_encoder *enc, ...@@ -40,9 +49,12 @@ void reg_proto_sigs(struct labcomm_encoder *enc,
struct labcomm_decoder *dec, struct labcomm_decoder *dec,
struct firefly_connection *conn) struct firefly_connection *conn)
{ {
struct firefly_transport_connection *orig_transport = conn->transport; struct firefly_transport_connection *orig_transport;
orig_transport = conn->transport;
conn->transport = &sig_transport; conn->transport = &sig_transport;
init_firefly_protocol__signatures();
labcomm_decoder_register_firefly_protocol_data_sample(dec, labcomm_decoder_register_firefly_protocol_data_sample(dec,
handle_data_sample, conn); handle_data_sample, conn);
...@@ -67,7 +79,6 @@ void reg_proto_sigs(struct labcomm_encoder *enc, ...@@ -67,7 +79,6 @@ void reg_proto_sigs(struct labcomm_encoder *enc,
labcomm_decoder_register_firefly_protocol_channel_restrict_ack( labcomm_decoder_register_firefly_protocol_channel_restrict_ack(
dec, handle_channel_restrict_ack, conn); dec, handle_channel_restrict_ack, conn);
labcomm_encoder_register_firefly_protocol_data_sample(enc); labcomm_encoder_register_firefly_protocol_data_sample(enc);
labcomm_encoder_register_firefly_protocol_channel_request(enc); labcomm_encoder_register_firefly_protocol_channel_request(enc);
labcomm_encoder_register_firefly_protocol_channel_response(enc); labcomm_encoder_register_firefly_protocol_channel_response(enc);
...@@ -80,14 +91,14 @@ void reg_proto_sigs(struct labcomm_encoder *enc, ...@@ -80,14 +91,14 @@ void reg_proto_sigs(struct labcomm_encoder *enc,
conn->transport = orig_transport; conn->transport = orig_transport;
} }
void firefly_unknown_dest(struct firefly_connection *conn, static void firefly_unknown_dest(struct firefly_connection *conn,
int src_id, int dest_id) int src_id, int dest_id, const char *action)
{ {
UNUSED_VAR(conn); UNUSED_VAR(conn);
firefly_protocol_channel_close chan_close; firefly_protocol_channel_close chan_close;
firefly_error(FIREFLY_ERROR_PROTO_STATE, 1, firefly_error(FIREFLY_ERROR_PROTO_STATE, 2,
"Received open channel on non-existing channel"); "Received %s on a non-existent channel", action);
chan_close.dest_chan_id = src_id; chan_close.dest_chan_id = src_id;
chan_close.source_chan_id = dest_id; chan_close.source_chan_id = dest_id;
...@@ -122,6 +133,7 @@ int firefly_channel_open_event(void *event_arg) ...@@ -122,6 +133,7 @@ int firefly_channel_open_event(void *event_arg)
chan_req.source_chan_id = chan->local_id; chan_req.source_chan_id = chan->local_id;
chan_req.dest_chan_id = chan->remote_id; chan_req.dest_chan_id = chan->remote_id;
chan_req.auto_restrict = false;
labcomm_encoder_ioctl(conn->transport_encoder, labcomm_encoder_ioctl(conn->transport_encoder,
FIREFLY_LABCOMM_IOCTL_TRANS_SET_IMPORTANT_ID, FIREFLY_LABCOMM_IOCTL_TRANS_SET_IMPORTANT_ID,
...@@ -145,6 +157,65 @@ void firefly_channel_open(struct firefly_connection *conn) ...@@ -145,6 +157,65 @@ void firefly_channel_open(struct firefly_connection *conn)
firefly_error(FIREFLY_ERROR_ALLOC, 1, "Could not add event."); firefly_error(FIREFLY_ERROR_ALLOC, 1, "Could not add event.");
} }
int firefly_channel_open_auto_restrict_event(void *event_arg)
{
struct firefly_event_chan_open_auto_restrict *arg;
struct firefly_channel_types types;
struct firefly_connection *conn;
struct firefly_channel *chan;
firefly_protocol_channel_request chan_req;
arg = event_arg;
conn = arg->connection;
types = arg->types;
if (conn->open != FIREFLY_CONNECTION_OPEN) {
firefly_channel_raise(NULL, conn, FIREFLY_ERROR_CONN_STATE,
"Can't open new channel on closed connection.\n");
return -1;
}
chan = firefly_channel_new(conn);
if (!chan) {
firefly_error(FIREFLY_ERROR_ALLOC, 1,
"Could not allocate channel.\n");
return -1;
}
chan->auto_restrict = true;
add_channel_to_connection(chan, conn);
chan_req.source_chan_id = chan->local_id;
chan_req.dest_chan_id = chan->remote_id;
chan_req.auto_restrict = true;
firefly_channel_set_types(chan, types);
labcomm_encoder_ioctl(conn->transport_encoder,
FIREFLY_LABCOMM_IOCTL_TRANS_SET_IMPORTANT_ID,
&chan->important_id);
labcomm_encode_firefly_protocol_channel_request(conn->transport_encoder,
&chan_req);
FIREFLY_FREE(event_arg);
return 0;
}
void firefly_channel_open_auto_restrict(struct firefly_connection *conn,
struct firefly_channel_types types)
{
int64_t ret;
struct firefly_event_chan_open_auto_restrict *ev;
ev = FIREFLY_MALLOC(sizeof(*ev));
if (ev) {
ev->connection = conn;
ev->types = types;
ret = conn->event_queue->offer_event_cb(conn->event_queue,
FIREFLY_PRIORITY_HIGH,
firefly_channel_open_auto_restrict_event,
ev, 0, NULL);
if (ret < 0)
firefly_error(FIREFLY_ERROR_ALLOC, 1, "Could not add event.");
} else {
firefly_error(FIREFLY_ERROR_ALLOC, 1, "Could not add event.");
}
}
static int64_t create_channel_closed_event(struct firefly_channel *chan, static int64_t create_channel_closed_event(struct firefly_channel *chan,
unsigned int nbr_deps, const int64_t *deps) unsigned int nbr_deps, const int64_t *deps)
{ {
...@@ -266,6 +337,7 @@ int handle_channel_request_event(void *event_arg) ...@@ -266,6 +337,7 @@ int handle_channel_request_event(void *event_arg)
firefly_protocol_channel_response res; firefly_protocol_channel_response res;
chan->remote_id = fecrr->chan_req.source_chan_id; chan->remote_id = fecrr->chan_req.source_chan_id;
chan->auto_restrict = fecrr->chan_req.auto_restrict;
add_channel_to_connection(chan, conn); add_channel_to_connection(chan, conn);
res.dest_chan_id = chan->remote_id; res.dest_chan_id = chan->remote_id;
...@@ -277,6 +349,7 @@ int handle_channel_request_event(void *event_arg) ...@@ -277,6 +349,7 @@ int handle_channel_request_event(void *event_arg)
res.source_chan_id = CHANNEL_ID_NOT_SET; res.source_chan_id = CHANNEL_ID_NOT_SET;
firefly_channel_free(remove_channel_from_connection(chan, conn)); firefly_channel_free(remove_channel_from_connection(chan, conn));
} else { } else {
/* TODO: Decoder registrations. */
labcomm_encoder_ioctl(fecrr->conn->transport_encoder, labcomm_encoder_ioctl(fecrr->conn->transport_encoder,
FIREFLY_LABCOMM_IOCTL_TRANS_SET_IMPORTANT_ID, FIREFLY_LABCOMM_IOCTL_TRANS_SET_IMPORTANT_ID,
&chan->important_id); &chan->important_id);
...@@ -325,6 +398,7 @@ static void firefly_channel_send_channel_ack( ...@@ -325,6 +398,7 @@ static void firefly_channel_send_channel_ack(
int dest_chan_id) int dest_chan_id)
{ {
firefly_protocol_channel_ack ack; firefly_protocol_channel_ack ack;
if (chan != NULL) { if (chan != NULL) {
ack.ack = true; ack.ack = true;
ack.source_chan_id = chan->local_id; ack.source_chan_id = chan->local_id;
...@@ -349,7 +423,7 @@ int handle_channel_response_event(void *event_arg) ...@@ -349,7 +423,7 @@ int handle_channel_response_event(void *event_arg)
if (chan == NULL) { if (chan == NULL) {
firefly_unknown_dest(fecrr->conn, fecrr->chan_res.source_chan_id, firefly_unknown_dest(fecrr->conn, fecrr->chan_res.source_chan_id,
fecrr->chan_res.dest_chan_id); fecrr->chan_res.dest_chan_id, "channel_response");
} else if (fecrr->chan_res.ack) { } else if (fecrr->chan_res.ack) {
if (chan->remote_id == CHANNEL_ID_NOT_SET) { if (chan->remote_id == CHANNEL_ID_NOT_SET) {
chan->remote_id = fecrr->chan_res.source_chan_id; chan->remote_id = fecrr->chan_res.source_chan_id;
...@@ -406,10 +480,10 @@ int handle_channel_ack_event(void *event_arg) ...@@ -406,10 +480,10 @@ int handle_channel_ack_event(void *event_arg)