Commit 2f898837 authored by Federico Vaga's avatar Federico Vaga

rename: functions and variables

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 5db473e9
......@@ -27,8 +27,8 @@ void rt_memcpy(uint32_t *dest, uint32_t *src, size_t n)
/**
* it sets a structure coming from the host
*/
int rt_structure_setter(struct wrnc_proto_header *hin, void *pin,
struct wrnc_proto_header *hout, void *pout)
int rt_structure_setter(struct trtl_proto_header *hin, void *pin,
struct trtl_proto_header *hout, void *pout)
{
unsigned int offset = 0, index, size;
uint32_t *din = pin;
......@@ -60,7 +60,7 @@ int rt_structure_setter(struct wrnc_proto_header *hin, void *pin,
/* Return back new values. Host can compare with what it sent
to spot errors */
if (hin->flags & WRNC_PROTO_FLAG_SYNC)
if (hin->flags & TRTL_PROTO_FLAG_SYNC)
return rt_structure_getter(hin, pin, hout, pout);
return 0;
......@@ -70,8 +70,8 @@ int rt_structure_setter(struct wrnc_proto_header *hin, void *pin,
/**
* it copies a structure to the host
*/
int rt_structure_getter(struct wrnc_proto_header *hin, void *pin,
struct wrnc_proto_header *hout, void *pout)
int rt_structure_getter(struct trtl_proto_header *hin, void *pin,
struct trtl_proto_header *hout, void *pout)
{
unsigned int offset = 0, index, size;
uint32_t *din = pin;
......@@ -114,15 +114,15 @@ int rt_structure_getter(struct wrnc_proto_header *hin, void *pin,
* Get the version. It is a structure, but a special one, so it is not using
* the generic function
*/
int rt_version_getter(struct wrnc_proto_header *hin, void *pin,
struct wrnc_proto_header *hout, void *pout)
int rt_version_getter(struct trtl_proto_header *hin, void *pin,
struct trtl_proto_header *hout, void *pout)
{
uint32_t *dout = pout;
hout->msg_id = RT_ACTION_SEND_VERSION;
hout->len = sizeof(struct wrnc_rt_version) / 4;
hout->len = sizeof(struct trtl_rt_version) / 4;
rt_memcpy(dout, (uint32_t *)&_app->version,
sizeof(struct wrnc_rt_version));
sizeof(struct trtl_rt_version));
return 0;
}
......@@ -133,8 +133,8 @@ int rt_version_getter(struct wrnc_proto_header *hin, void *pin,
* to set a set of variable values.
* We use directly pointers and not an index
*/
int rt_variable_setter(struct wrnc_proto_header *hin, void *pin,
struct wrnc_proto_header *hout, void *pout)
int rt_variable_setter(struct trtl_proto_header *hin, void *pin,
struct trtl_proto_header *hout, void *pout)
{
struct rt_variable *var;
uint32_t *din = pin, *mem, val;
......@@ -168,7 +168,7 @@ int rt_variable_setter(struct wrnc_proto_header *hin, void *pin,
/* Return back new values. Host can compare with what it sent
to spot errors */
if (hin->flags & WRNC_PROTO_FLAG_SYNC)
if (hin->flags & TRTL_PROTO_FLAG_SYNC)
return rt_variable_getter(hin, pin, hout, pout);
return 0;
......@@ -179,8 +179,8 @@ int rt_variable_setter(struct wrnc_proto_header *hin, void *pin,
* This is a generic getter that an external system can invoke
* to get a set of variable values
*/
int rt_variable_getter(struct wrnc_proto_header *hin, void *pin,
struct wrnc_proto_header *hout, void *pout)
int rt_variable_getter(struct trtl_proto_header *hin, void *pin,
struct trtl_proto_header *hout, void *pout)
{
struct rt_variable *var;
uint32_t *dout = pout, *din = pin, *mem, val;
......@@ -224,8 +224,8 @@ int rt_variable_getter(struct wrnc_proto_header *hin, void *pin,
/**
* This is a default action that answer on ping messages
*/
int rt_recv_ping(struct wrnc_proto_header *hin, void *pin,
struct wrnc_proto_header *hout, void *pout)
int rt_recv_ping(struct trtl_proto_header *hin, void *pin,
struct trtl_proto_header *hout, void *pout)
{
rt_send_ack(hin, pin, hout, pout);
return 0;
......@@ -238,11 +238,11 @@ int rt_recv_ping(struct wrnc_proto_header *hin, void *pin,
* @param[in] msg input message for the action
* @return 0 on success. A negative value on error
*/
static inline int rt_action_run(struct wrnc_proto_header *hin, void *pin)
static inline int rt_action_run(struct trtl_proto_header *hin, void *pin)
{
action_t *action;
struct wrnc_msg out_buf;
struct wrnc_proto_header hout;
struct trtl_msg out_buf;
struct trtl_proto_header hout;
void *pout;
int err = 0;
......@@ -253,7 +253,7 @@ static inline int rt_action_run(struct wrnc_proto_header *hin, void *pin)
action = _app->actions[hin->msg_id];
if (!(hin->flags & WRNC_PROTO_FLAG_SYNC)) {
if (!(hin->flags & TRTL_PROTO_FLAG_SYNC)) {
/* Asynchronous message, then no output */
return action(hin, pin, NULL, NULL);
}
......@@ -269,7 +269,7 @@ static inline int rt_action_run(struct wrnc_proto_header *hin, void *pin)
/* Do not write directly the header on the buffer because it does not
work for fields size different than 32bit */
pout = rt_proto_payload_get((void *) out_buf.data);
rt_memcpy((uint32_t *)&hout, (uint32_t *)hin, sizeof(struct wrnc_proto_header));
rt_memcpy((uint32_t *)&hout, (uint32_t *)hin, sizeof(struct trtl_proto_header));
err = action(hin, pin, &hout, pout);
if (err)
......@@ -299,7 +299,7 @@ int rt_mq_action_dispatch(unsigned int mq_in)
#ifdef RTPERFORMANCE
uint32_t sec, cyc, sec_n, cyc_n;
#endif
struct wrnc_proto_header *header;
struct trtl_proto_header *header;
unsigned int mq_in_slot = _app->mq[mq_in].index;
unsigned int is_remote = _app->mq[mq_in].flags & RT_MQ_FLAGS_REMOTE;
uint32_t *msg;
......
......@@ -37,7 +37,7 @@ static inline void rt_print_data(uint32_t *d, unsigned int count)
delay(1000);
}
}
static inline void rt_print_header(struct wrnc_proto_header *h)
static inline void rt_print_header(struct trtl_proto_header *h)
{
pp_printf("header ----\n");
delay(1000);
......@@ -63,8 +63,8 @@ struct rt_variable {
uint32_t flags; /**< variable options */
};
typedef int (action_t)(struct wrnc_proto_header *hin, void *pin,
struct wrnc_proto_header *hout, void *pout);
typedef int (action_t)(struct trtl_proto_header *hin, void *pin,
struct trtl_proto_header *hout, void *pout);
/**
* Description of a RealTime structure that we want to export to user-space
......@@ -85,7 +85,7 @@ struct rt_mq {
*/
struct rt_application {
const char name[16];
const struct wrnc_rt_version version;
const struct trtl_rt_version version;
struct rt_mq *mq; /**< list of used MQ */
uint8_t n_mq; /**< number of available MQ */
......@@ -109,8 +109,8 @@ extern int rt_mq_action_dispatch(unsigned int mq_in);
* This is a helper that send back a simple ACK message. Keep it static inline
* to avoid a function call. We gain performance, we loose memory
*/
static inline void rt_send_ack(struct wrnc_proto_header *hin, void *pin,
struct wrnc_proto_header *hout, void *pout)
static inline void rt_send_ack(struct trtl_proto_header *hin, void *pin,
struct trtl_proto_header *hout, void *pout)
{
hout->msg_id = RT_ACTION_SEND_ACK;
hout->len = 0;
......@@ -120,8 +120,8 @@ static inline void rt_send_ack(struct wrnc_proto_header *hin, void *pin,
* This is a helper that send back a simple NACK message. Keep it static inline
* to avoid a function call. We gain performance, we loose memory
*/
static inline void rt_send_nack(struct wrnc_proto_header *hin, void *pin,
struct wrnc_proto_header *hout, void *pout)
static inline void rt_send_nack(struct trtl_proto_header *hin, void *pin,
struct trtl_proto_header *hout, void *pout)
{
hout->msg_id = RT_ACTION_SEND_NACK;
hout->len = 0;
......@@ -130,38 +130,38 @@ static inline void rt_send_nack(struct wrnc_proto_header *hin, void *pin,
extern void rt_get_time(uint32_t *seconds, uint32_t *cycles);
extern void rt_action_export(action_t **actions, unsigned int count);
extern int rt_variable_setter(struct wrnc_proto_header *hin, void *pin,
struct wrnc_proto_header *hout, void *pout);
extern int rt_variable_getter(struct wrnc_proto_header *hin, void *pin,
struct wrnc_proto_header *hout, void *pout);
extern int rt_structure_setter(struct wrnc_proto_header *hin, void *pin,
struct wrnc_proto_header *hout, void *pout);
extern int rt_structure_getter(struct wrnc_proto_header *hin, void *pin,
struct wrnc_proto_header *hout, void *pout);
extern int rt_recv_ping(struct wrnc_proto_header *hin, void *pin,
struct wrnc_proto_header *hout, void *pout);
extern int rt_version_getter(struct wrnc_proto_header *hin, void *pin,
struct wrnc_proto_header *hout, void *pout);
extern int rt_variable_setter(struct trtl_proto_header *hin, void *pin,
struct trtl_proto_header *hout, void *pout);
extern int rt_variable_getter(struct trtl_proto_header *hin, void *pin,
struct trtl_proto_header *hout, void *pout);
extern int rt_structure_setter(struct trtl_proto_header *hin, void *pin,
struct trtl_proto_header *hout, void *pout);
extern int rt_structure_getter(struct trtl_proto_header *hin, void *pin,
struct trtl_proto_header *hout, void *pout);
extern int rt_recv_ping(struct trtl_proto_header *hin, void *pin,
struct trtl_proto_header *hout, void *pout);
extern int rt_version_getter(struct trtl_proto_header *hin, void *pin,
struct trtl_proto_header *hout, void *pout);
/**
* It send the message associate to the given header
* @param[in] msg message to send
*/
static inline void rt_mq_msg_send(struct wrnc_msg *msg)
static inline void rt_mq_msg_send(struct trtl_msg *msg)
{
struct wrnc_proto_header *hdr;
struct trtl_proto_header *hdr;
hdr = rt_proto_header_get((void *)msg->data);
/* When we are not using sync messages, we use the global
sequence number */
if (!(hdr->flags & WRNC_PROTO_FLAG_SYNC))
if (!(hdr->flags & TRTL_PROTO_FLAG_SYNC))
hdr->seq = msg_seq++;
mq_send(!!(hdr->flags & WRNC_PROTO_FLAG_REMOTE),
mq_send(!!(hdr->flags & TRTL_PROTO_FLAG_REMOTE),
(hdr->slot_io & 0xF),
hdr->len + (sizeof(struct wrnc_proto_header) / 4));
hdr->len + (sizeof(struct trtl_proto_header) / 4));
}
#endif /* __LIBRT_H__ */
......@@ -21,7 +21,7 @@
#ifdef WRNODE_RT
enum wrnc_msg_direction {
enum trtl_msg_direction {
WRNC_MSG_DIR_SEND = 0,
WRNC_MSG_DIR_RECEIVE = 1
};
......@@ -29,12 +29,12 @@ enum wrnc_msg_direction {
/**
* White-Rabbit Node-Core message descriptor
*/
struct wrnc_msg {
struct trtl_msg {
uint32_t datalen; /**< payload length*/
volatile uint32_t *data; /**< payload */
uint32_t max_size; /**< maximum message size for chosen slot */
uint32_t offset; /**< serialization/deserialization offset */
enum wrnc_msg_direction direction; /**< serialization direction (used by wrnc_msg_x functions) */
enum trtl_msg_direction direction; /**< serialization direction (used by trtl_msg_x functions) */
int error; /** serialization error status */
int slot; /** concerned slot */
};
......@@ -44,10 +44,10 @@ struct wrnc_msg {
* It claims an output slot. This means that you get exclusive access to
* the slot.
*/
static inline struct wrnc_msg rt_mq_claim_out(struct wrnc_proto_header *h)
static inline struct trtl_msg rt_mq_claim_out(struct trtl_proto_header *h)
{
struct wrnc_msg b;
int remote = !!(h->flags & WRNC_PROTO_FLAG_REMOTE);
struct trtl_msg b;
int remote = !!(h->flags & TRTL_PROTO_FLAG_REMOTE);
int slot = h->slot_io & 0xF;
mq_claim(remote, slot);
......@@ -65,9 +65,9 @@ static inline struct wrnc_msg rt_mq_claim_out(struct wrnc_proto_header *h)
/**
* Obsolete. Use rt_mq_claim_out
*/
static inline struct wrnc_msg hmq_msg_claim_out(int slot, int max_size)
static inline struct trtl_msg hmq_msg_claim_out(int slot, int max_size)
{
struct wrnc_proto_header h = {
struct trtl_proto_header h = {
.slot_io = (slot & 0xF),
.len = max_size,
};
......@@ -79,9 +79,9 @@ static inline struct wrnc_msg hmq_msg_claim_out(int slot, int max_size)
* It claims an input slot. This mean that you get exclusive access to
* the slot
*/
static inline struct wrnc_msg rt_mq_claim_in(struct wrnc_proto_header *h)
static inline struct trtl_msg rt_mq_claim_in(struct trtl_proto_header *h)
{
struct wrnc_msg b;
struct trtl_msg b;
int slot = (h->slot_io >> 4) & 0xF;
b.data = mq_map_in_buffer(0, slot);
......@@ -97,9 +97,9 @@ static inline struct wrnc_msg rt_mq_claim_in(struct wrnc_proto_header *h)
/**
* Obsolete. Use rt_mq_claim_in
*/
static inline struct wrnc_msg hmq_msg_claim_in(int slot, int max_size)
static inline struct trtl_msg hmq_msg_claim_in(int slot, int max_size)
{
struct wrnc_proto_header h = {
struct trtl_proto_header h = {
.slot_io = (slot & 0xF) << 4,
.len = max_size,
};
......@@ -111,7 +111,7 @@ static inline struct wrnc_msg hmq_msg_claim_in(int slot, int max_size)
/**
* It enqueue the message in the slot, and it will be sent as soon as possible
*/
static inline void hmq_msg_send(struct wrnc_msg *buf)
static inline void hmq_msg_send(struct trtl_msg *buf)
{
mq_send(0, buf->slot, buf->datalen);
}
......
......@@ -16,7 +16,7 @@
* Description of a White-Rabbit Trigger-Distribution device
*/
struct demo_desc {
struct wrnc_dev *wrnc; /**< WRNC device associated */
struct trtl_dev *trtl; /**< WRNC device associated */
uint32_t dev_id; /**< fmc device id */
uint32_t app_id; /**< Application id */
uint32_t n_cpu; /**< Number of CPUs */
......
......@@ -22,14 +22,14 @@ const char *demo_errors[] = {
/**
* It returns a string messages corresponding to a given error code. If
* it is not a libwrtd error code, it will run wrnc_strerror()
* it is not a libwrtd error code, it will run trtl_strerror()
* @param[in] err error code
* @return a message error
*/
const char *demo_strerror(unsigned int err)
{
if (err < EDEMO_INVALID_ANSWER_ACK || err >= __EDEMO_MAX_ERROR_NUMBER)
return wrnc_strerror(err);
return trtl_strerror(err);
return demo_errors[err - EDEMO_INVALID_ANSWER_ACK];
}
......@@ -38,7 +38,7 @@ const char *demo_strerror(unsigned int err)
/**
* It initializes the DEMO library. It must be called before doing
* anything else.
* This library is based on the libwrnc, so internally, this function also
* This library is based on the libmockturtle, so internally, this function also
* run demo_init() in order to initialize the WRNC library.
* @return 0 on success, otherwise -1 and errno is appropriately set
*/
......@@ -46,7 +46,7 @@ int demo_init()
{
int err;
err = wrnc_init();
err = trtl_init();
if (err)
return err;
......@@ -61,7 +61,7 @@ int demo_init()
*/
void demo_exit()
{
wrnc_exit();
trtl_exit();
}
......@@ -79,8 +79,8 @@ struct demo_node *demo_open_by_fmc(uint32_t device_id)
if (!demo)
return NULL;
demo->wrnc = wrnc_open_by_fmc(device_id);
if (!demo->wrnc)
demo->trtl = trtl_open_by_fmc(device_id);
if (!demo->trtl)
goto out;
demo->dev_id = device_id;
......@@ -107,8 +107,8 @@ struct demo_node *demo_open_by_lun(int lun)
if (!demo)
return NULL;
demo->wrnc = wrnc_open_by_lun(lun);
if (!demo->wrnc)
demo->trtl = trtl_open_by_lun(lun);
if (!demo->trtl)
goto out;
demo->dev_id = lun;
......@@ -130,7 +130,7 @@ void demo_close(struct demo_node *dev)
{
struct demo_desc *demo = (struct demo_desc *)dev;
wrnc_close(demo->wrnc);
trtl_close(demo->trtl);
free(demo);
dev = NULL;
}
......@@ -142,24 +142,24 @@ void demo_close(struct demo_node *dev)
* @param[in] dev device token
* @return the WRNC token
*/
struct wrnc_dev *demo_get_wrnc_dev(struct demo_node *dev)
struct trtl_dev *demo_get_trtl_dev(struct demo_node *dev)
{
struct demo_desc *demo = (struct demo_desc *)dev;
return (struct wrnc_dev *)demo->wrnc;
return (struct trtl_dev *)demo->trtl;
}
int demo_lemo_dir_set(struct demo_node *dev, uint32_t value)
{
struct demo_desc *demo = (struct demo_desc *)dev;
uint32_t fields[] = {DEMO_VAR_LEMO_DIR, value};
struct wrnc_proto_header hdr = {
struct trtl_proto_header hdr = {
.slot_io = (DEMO_HMQ_IN << 4) |
(DEMO_HMQ_OUT & 0xF),
.len = 2,
};
return wrnc_rt_variable_set(demo->wrnc, &hdr, fields, 1);
return trtl_rt_variable_set(demo->trtl, &hdr, fields, 1);
}
int demo_lemo_set(struct demo_node *dev, uint32_t value)
......@@ -167,13 +167,13 @@ int demo_lemo_set(struct demo_node *dev, uint32_t value)
struct demo_desc *demo = (struct demo_desc *)dev;
uint32_t fields[] = {DEMO_VAR_LEMO_SET, value,
DEMO_VAR_LEMO_CLR, ~value};
struct wrnc_proto_header hdr = {
struct trtl_proto_header hdr = {
.slot_io = (DEMO_HMQ_IN << 4) |
(DEMO_HMQ_OUT & 0xF),
.len = 4,
};
return wrnc_rt_variable_set(demo->wrnc, &hdr, fields, 2);
return trtl_rt_variable_set(demo->trtl, &hdr, fields, 2);
}
......@@ -212,12 +212,12 @@ int demo_led_set(struct demo_node *dev, uint32_t value, enum demo_color color)
uint32_t real_value = demo_apply_color(value, color);
uint32_t fields[] = {DEMO_VAR_LED_SET, real_value,
DEMO_VAR_LED_CLR, ~real_value};
struct wrnc_proto_header hdr = {
struct trtl_proto_header hdr = {
.slot_io = (DEMO_HMQ_IN << 4) |
(DEMO_HMQ_OUT & 0xF),
.len = 6,
};
return wrnc_rt_variable_set(demo->wrnc, &hdr, fields, 2);
return trtl_rt_variable_set(demo->trtl, &hdr, fields, 2);
}
......@@ -230,15 +230,15 @@ int demo_status_get(struct demo_node *dev, struct demo_status *status)
uint32_t fields[] = {DEMO_VAR_LEMO_STA, 0,
DEMO_VAR_LED_STA, 0,
DEMO_VAR_LEMO_DIR, 0};
struct wrnc_proto_header hdr = {
struct trtl_proto_header hdr = {
.slot_io = (DEMO_HMQ_IN << 4) |
(DEMO_HMQ_OUT & 0xF),
.flags = WRNC_PROTO_FLAG_SYNC,
.flags = TRTL_PROTO_FLAG_SYNC,
.len = 6,
};
int err;
err = wrnc_rt_variable_get(demo->wrnc, &hdr, fields, 3);
err = trtl_rt_variable_get(demo->trtl, &hdr, fields, 3);
if (err)
return err;
......@@ -251,43 +251,43 @@ int demo_status_get(struct demo_node *dev, struct demo_status *status)
int demo_run_autodemo(struct demo_node *dev, uint32_t run){ return 0; }
int demo_version(struct demo_node *dev, struct wrnc_rt_version *version)
int demo_version(struct demo_node *dev, struct trtl_rt_version *version)
{
struct demo_desc *demo = (struct demo_desc *)dev;
return wrnc_rt_version_get(demo->wrnc, version,
return trtl_rt_version_get(demo->trtl, version,
DEMO_HMQ_IN, DEMO_HMQ_OUT);
}
int demo_test_struct_get(struct demo_node *dev, struct demo_structure *test)
{
struct demo_desc *demo = (struct demo_desc *)dev;
struct wrnc_structure_tlv tlv = {
struct trtl_structure_tlv tlv = {
.index = DEMO_STRUCT_TEST,
.size = sizeof(struct demo_structure),
.structure = test,
};
struct wrnc_proto_header hdr = {
struct trtl_proto_header hdr = {
.slot_io = (DEMO_HMQ_IN << 4) |
(DEMO_HMQ_OUT & 0xF),
.flags = WRNC_PROTO_FLAG_SYNC,
.flags = TRTL_PROTO_FLAG_SYNC,
};
return wrnc_rt_structure_get(demo->wrnc, &hdr, &tlv, 1);
return trtl_rt_structure_get(demo->trtl, &hdr, &tlv, 1);
}
int demo_test_struct_set(struct demo_node *dev, struct demo_structure *test)
{
struct demo_desc *demo = (struct demo_desc *)dev;
struct wrnc_structure_tlv tlv = {
struct trtl_structure_tlv tlv = {
.index = DEMO_STRUCT_TEST,
.size = sizeof(struct demo_structure),
.structure = test,
};
struct wrnc_proto_header hdr = {
struct trtl_proto_header hdr = {
.slot_io = (DEMO_HMQ_IN << 4) |
(DEMO_HMQ_OUT & 0xF),
};
return wrnc_rt_structure_set(demo->wrnc, &hdr, &tlv, 1);
return trtl_rt_structure_set(demo->trtl, &hdr, &tlv, 1);
}
......@@ -37,7 +37,7 @@ extern void demo_exit();
extern struct demo_node *demo_open_by_fmc(uint32_t device_id);
extern struct demo_node *demo_open_by_lun(int lun);
extern void demo_close(struct demo_node *dev);
extern struct wrnc_dev *demo_get_wrnc_dev(struct demo_node *dev);
extern struct trtl_dev *demo_get_trtl_dev(struct demo_node *dev);
extern int demo_led_set(struct demo_node *dev, uint32_t value,
enum demo_color color);
......@@ -45,7 +45,7 @@ extern int demo_lemo_set(struct demo_node *dev, uint32_t value);
extern int demo_lemo_dir_set(struct demo_node *dev, uint32_t value);
extern int demo_status_get(struct demo_node *dev, struct demo_status *status);
extern int demo_run_autodemo(struct demo_node *dev, uint32_t run);
extern int demo_version(struct demo_node *dev, struct wrnc_rt_version *version);
extern int demo_version(struct demo_node *dev, struct trtl_rt_version *version);
extern int demo_test_struct_set(struct demo_node *dev,
struct demo_structure *test);
extern int demo_test_struct_get(struct demo_node *dev,
......
......@@ -40,7 +40,7 @@ static void demo_print_status(struct demo_status *status)
fprintf(stdout, "\tautodemo\t%s\n", status->autodemo ? "run" : "stop");
}
static void demo_print_version(struct wrnc_rt_version *version)
static void demo_print_version(struct trtl_rt_version *version)
{
fprintf(stdout, "Version:\n");
fprintf(stdout, "\tFPGA: 0x%x\n", version->fpga_id);
......@@ -68,7 +68,7 @@ int main(int argc, char *argv[])
char c, c_color = 0, autodemo = 0;
int err = 0, show_status = 0, show_version = 0, structure = 0;
enum demo_color color = DEMO_RED;
struct wrnc_rt_version version;
struct trtl_rt_version version;
struct demo_structure test, test_rb;
while ((c = getopt (argc, argv, "hD:l:L:d:c:sa:vt")) != -1) {
......
......@@ -342,8 +342,8 @@ struct wrtd_in_channel_config {
public, set from the internal
calibration data of the TDC
driver. */
uint32_t flags; /**< Channel flags (enum wrnc_io_flags) */
uint32_t log_level; /**< Log level (enum wrnc_log_level) */
uint32_t flags; /**< Channel flags (enum trtl_io_flags) */
uint32_t log_level; /**< Log level (enum trtl_log_level) */
uint32_t mode; /**< Triggering mode (enum wrtd_triger_mode) */
};
......
......@@ -23,7 +23,7 @@
#include "rt-message.h"
#endif
static inline int _wrnc_msg_check_buffer( struct wrnc_msg *buf, int n_words )
static inline int _trtl_msg_check_buffer( struct trtl_msg *buf, int n_words )
{
#ifndef WRNODE_RT
if(buf->error)
......@@ -51,9 +51,9 @@ static inline int _wrnc_msg_check_buffer( struct wrnc_msg *buf, int n_words )
return 0;
}
static inline int wrnc_msg_int32 ( struct wrnc_msg *buf, int *value )
static inline int trtl_msg_int32 ( struct trtl_msg *buf, int *value )
{
if ( _wrnc_msg_check_buffer ( buf, 1 ) < 0 )
if ( _trtl_msg_check_buffer ( buf, 1 ) < 0 )
return -1;
if (buf->direction == WRNC_MSG_DIR_SEND)
......@@ -69,9 +69,9 @@ static inline int wrnc_msg_int32 ( struct wrnc_msg *buf, int *value )
}
static inline int wrnc_msg_int16 ( struct wrnc_msg *buf, int16_t *value )
static inline int trtl_msg_int16 ( struct trtl_msg *buf, int16_t *value )
{
if ( _wrnc_msg_check_buffer ( buf, 1 ) < 0 )
if ( _trtl_msg_check_buffer ( buf, 1 ) < 0 )
return -1;
if (buf->direction == WRNC_MSG_DIR_SEND)
......@@ -86,20 +86,20 @@ static inline int wrnc_msg_int16 ( struct wrnc_msg *buf, int16_t *value )
return 0;
}
static inline int wrnc_msg_uint32 ( struct wrnc_msg *buf, uint32_t *value )
static inline int trtl_msg_uint32 ( struct trtl_msg *buf, uint32_t *value )
{
return wrnc_msg_int32( buf, (int *) value);
return trtl_msg_int32( buf, (int *) value);
}
static inline int wrnc_msg_uint16 ( struct wrnc_msg *buf, uint16_t *value )
static inline int trtl_msg_uint16 ( struct trtl_msg *buf, uint16_t *value )
{
return wrnc_msg_int16( buf, (int16_t *) value);
return trtl_msg_int16( buf, (int16_t *) value);
}
static inline int wrnc_msg_header ( struct wrnc_msg *buf, uint32_t *id, uint32_t *seq_no )
static inline int trtl_msg_header ( struct trtl_msg *buf, uint32_t *id, uint32_t *seq_no )
{
if (_wrnc_msg_check_buffer ( buf, 2 ) < 0)
if (_trtl_msg_check_buffer ( buf, 2 ) < 0)
return -1;
if (buf->direction == WRNC_MSG_DIR_SEND)
......@@ -116,24 +116,24 @@ static inline int wrnc_msg_header ( struct wrnc_msg *buf, uint32_t *id, uint32_t
return 0;
}
static inline void wrnc_msg_skip ( struct wrnc_msg *buf, int n_words )
static inline void trtl_msg_skip ( struct trtl_msg *buf, int n_words )
{
_wrnc_msg_check_buffer ( buf, n_words );
_trtl_msg_check_buffer ( buf, n_words );
if (buf->direction == WRNC_MSG_DIR_SEND)
buf->datalen += n_words;
else
buf->offset += n_words;
}
static inline void wrnc_msg_seek ( struct wrnc_msg *buf, int pos )
static inline void trtl_msg_seek ( struct trtl_msg *buf, int pos )
{
buf->offset = pos;
buf->datalen = pos;
}
static inline int wrtd_msg_timestamp ( struct wrnc_msg *buf, struct wr_timestamp *ts )
static inline int wrtd_msg_timestamp ( struct trtl_msg *buf, struct wr_timestamp *ts )
{
if (_wrnc_msg_check_buffer ( buf, 4 ) < 0)
if (_trtl_msg_check_buffer ( buf, 4 ) < 0)
return -1;
if (buf->direction == WRNC_MSG_DIR_SEND)
......@@ -154,9 +154,9 @@ static inline int wrtd_msg_timestamp ( struct wrnc_msg *buf, struct wr_timestamp
return 0;
}
static inline int wrtd_msg_trig_id ( struct wrnc_msg *buf, struct wrtd_trig_id *id )
static inline int wrtd_msg_trig_id ( struct trtl_msg *buf, struct wrtd_trig_id *id )
{
if (_wrnc_msg_check_buffer ( buf, 3 ) < 0)
if (_trtl_msg_check_buffer ( buf, 3 ) < 0)
return -1;
if (buf->direction == WRNC_MSG_DIR_SEND)
......@@ -175,19 +175,19 @@ static inline int wrtd_msg_trig_id ( struct wrnc_msg *buf, struct wrtd_trig_id *
return 0;
}
static inline int wrtd_msg_trigger_entry ( struct wrnc_msg *buf, struct wrtd_trigger_entry *ent )
static inline int wrtd_msg_trigger_entry ( struct trtl_msg *buf, struct wrtd_trigger_entry *ent )
{
if (wrtd_msg_timestamp (buf, &ent->ts) < 0)
return -1;
if (wrtd_msg_trig_id (buf, &ent->id) < 0)
return -1;
return wrnc_msg_int32 (buf, (int *) &ent->seq);
return trtl_msg_int32 (buf, (int *) &ent->seq);
}
static inline struct wrnc_msg wrnc_msg_init(int max_size)
static inline struct trtl_msg trtl_msg_init(int max_size)
{
struct wrnc_msg b;
struct trtl_msg b;
b.direction = WRNC_MSG_DIR_SEND;
b.max_size = max_size;
......@@ -198,7 +198,7 @@ static inline struct wrnc_msg wrnc_msg_init(int max_size)
return b;
}
static inline int wrnc_msg_check_error (struct wrnc_msg *buf)
static inline int trtl_msg_check_error (struct trtl_msg *buf)
{
return buf->error;
}
......
......@@ -39,14 +39,14 @@ const char *wrtd_errors[] = {
/**
* It returns a string messages corresponding to a given error code. If
* it is not a libwrtd error code, it will run wrnc_strerror()
* it is not a libwrtd error code, it will run trtl_strerror()
* @param[in] err error code
* @return a message error
*/
const char *wrtd_strerror(int err)
{
if (err < EWRTD_INVALID_ANSWER_ACK || err >= __EWRTD_MAX_ERROR_NUMBER)
return wrnc_strerror(err);
return trtl_strerror(err);
return wrtd_errors[err - EWRTD_INVALID_ANSWER_ACK];
}
......@@ -57,15 +57,15 @@ const char *wrtd_strerror(int err)
* anything else. If you are going to load/unload WRTD devices, then
* you have to un-load (wrtd_exit()) e reload (wrtd_init()) the library.
*
* This library is based on the libwrnc, so internally, this function also
* run wrnc_init() in order to initialize the WRNC library.
* This library is based on the libmockturtle, so internally, this function also
* run trtl_init() in order to initialize the WRNC library.
* @return 0 on success, otherwise -1 and errno is appropriately set
*/
int wrtd_init()
{
int err;
err = wrnc_init();
err = trtl_init();
if (err)
return err;
......@@ -80,7 +80,7 @@ int wrtd_init()
*/
void wrtd_exit()
{
wrnc_exit();
trtl_exit();
}
......@@ -93,7 +93,7 @@ void wrtd_exit()
*/
int wrtd_version_is_valid(struct wrtd_node *dev)
{
struct wrnc_rt_version version;
struct trtl_rt_version version;
int err;
errno = 0;
......@@ -127,21 +127,21 @@ static struct wrtd_node *wrtd_open(uint32_t device_id, unsigned int is_lun)
return NULL;
if (is_lun)
wrtd->wrnc = wrnc_open_by_lun(device_id);
wrtd->trtl = trtl_open_by_lun(device_id);
else
wrtd->wrnc = wrnc_open_by_fmc(device_id);
if (!wrtd->wrnc)
wrtd->trtl = trtl_open_by_fmc(device_id);
if (!wrtd->trtl)
goto out;
wrtd->dev_id = device_id;
/* Logging interface is always in share mode */
err = wrnc_hmq_share_set(wrtd->wrnc, WRNC_HMQ_OUTCOMING,
err = trtl_hmq_share_set(wrtd->trtl, TRTL_HMQ_OUTCOMING,
WRTD_OUT_FD_LOGGING, 1);
if (err)
goto out;
err = wrnc_hmq_share_set(wrtd->wrnc, WRNC_HMQ_OUTCOMING,
err = trtl_hmq_share_set(wrtd->trtl, TRTL_HMQ_OUTCOMING,
WRTD_OUT_TDC_LOGGING, 1);
if (err)
goto out;
......@@ -187,7 +187,7 @@ void wrtd_close(struct wrtd_node *dev)
{
struct wrtd_desc *wrtd = (struct wrtd_desc *)dev;
wrnc_close(wrtd->wrnc);
trtl_close(wrtd->trtl);
free(wrtd);
dev = NULL;
}
......@@ -199,11 +199,11 @@ void wrtd_close(struct wrtd_node *dev)
* @param[in] dev device token
* @return the WRNC token
*/
struct wrnc_dev *wrtd_get_wrnc_dev(struct wrtd_node *dev)
struct trtl_dev *wrtd_get_trtl_dev(struct wrtd_node *dev)
{
struct wrtd_desc *wrtd = (struct wrtd_desc *)dev;
return (struct wrnc_dev *)wrtd->wrnc;
return (struct trtl_dev *)wrtd->trtl;
}
......@@ -217,16 +217,16 @@ int wrtd_cpu_restart(struct wrtd_node *dev)
struct wrtd_desc *wrtd = (struct wrtd_desc *)dev;
int err;
err = wrnc_cpu_disable(wrtd->wrnc,WRTD_CPU_TDC);
err = trtl_cpu_disable(wrtd->trtl,WRTD_CPU_TDC);
if (err)
return err;
err = wrnc_cpu_disable(wrtd->wrnc,WRTD_CPU_FD);
err = trtl_cpu_disable(wrtd->trtl,WRTD_CPU_FD);
if (err)
return err;
err = wrnc_cpu_enable(wrtd->wrnc,WRTD_CPU_TDC);
err = trtl_cpu_enable(wrtd->trtl,WRTD_CPU_TDC);
if (err)
return err;
return wrnc_cpu_enable(wrtd->wrnc,WRTD_CPU_FD);
return trtl_cpu_enable(wrtd->trtl,WRTD_CPU_FD);
}
/**
......@@ -246,26 +246,26 @@ int wrtd_load_application(struct wrtd_node *dev, char *rt_tdc,
errno = EWRTD_INVALID_BINARY;
return -1;
}
err = wrnc_cpu_reset_get(wrtd->wrnc, &reg_old);
err = trtl_cpu_reset_get(wrtd->trtl, &reg_old);
if (err)
return err;
/* Keep the CPUs in reset state */
err = wrnc_cpu_reset_set(wrtd->wrnc,
err = trtl_cpu_reset_set(wrtd->trtl,
(1 << WRTD_CPU_TDC) | (1 << WRTD_CPU_FD));
if (err)
return err;
/* Program CPUs application */
err = wrnc_cpu_load_application_file(wrtd->wrnc, WRTD_CPU_TDC, rt_tdc);
err = trtl_cpu_load_application_file(wrtd->trtl, WRTD_CPU_TDC, rt_tdc);
if (err)
return err;
err = wrnc_cpu_load_application_file(wrtd->wrnc, WRTD_CPU_FD, rt_fd);
err = trtl_cpu_load_application_file(wrtd->trtl, WRTD_CPU_FD, rt_fd);
if (err)
return err;
/* Re-enable the CPUs */
err = wrnc_cpu_reset_set(wrtd->wrnc, reg_old);
err = trtl_cpu_reset_set(wrtd->trtl, reg_old);
if (err)
return err;
......
This diff is collapsed.
......@@ -17,7 +17,7 @@
* @param[in] msg message to validate
* @return 0 if it is valid, -1 otherwise and errno is appropriately set
*/
int wrtd_validate_acknowledge(struct wrnc_msg *msg)
int wrtd_validate_acknowledge(struct trtl_msg *msg)
{
if (msg->datalen != 2 || msg->data[0] != WRTD_REP_ACK_ID) {
errno = EWRTD_INVALID_ANSWER_ACK;
......@@ -59,24 +59,24 @@ int wrtd_trig_id_cmp(struct wrtd_trig_id *id1, struct wrtd_trig_id *id2)
* Internal helper to send and receive synchronous messages to/from the WRNC
*/
int wrtd_send_and_receive_sync(struct wrtd_desc *wrtd,
struct wrnc_msg *msg,
struct trtl_msg *msg,
enum wrtd_core core)
{
/* Send the message and get answer */
struct wrnc_hmq *hmq;
struct trtl_hmq *hmq;
unsigned int hmq_send = core ? WRTD_IN_FD_CONTROL : WRTD_IN_TDC_CONTROL;
unsigned int hmq_recv = core ? WRTD_OUT_FD_CONTROL :
WRTD_OUT_TDC_CONTROL;
int err;
hmq = wrnc_hmq_open(wrtd->wrnc, hmq_send, WRNC_HMQ_INCOMING);
hmq = trtl_hmq_open(wrtd->trtl, hmq_send, TRTL_HMQ_INCOMING);
if (!hmq)
return -1;
err = wrnc_hmq_send_and_receive_sync(hmq, hmq_recv, msg,
err = trtl_hmq_send_and_receive_sync(hmq, hmq_recv, msg,
WRTD_DEFAULT_TIMEOUT);
wrnc_hmq_close(hmq);
trtl_hmq_close(hmq);
return err < 0 ? err : 0; /* ignore timeout */
}
......@@ -86,7 +86,7 @@ int wrtd_send_and_receive_sync(struct wrtd_desc *wrtd,
* with an ACK
*/
int wrtd_trivial_request(struct wrtd_node *dev,
struct wrnc_msg *request_msg,
struct trtl_msg *request_msg,
enum wrtd_core core)
{
struct wrtd_desc *wrtd = (struct wrtd_desc *)dev;
......
......@@ -23,7 +23,7 @@
* Description of a White-Rabbit Trigger-Distribution device
*/
struct wrtd_desc {
struct wrnc_dev *wrnc; /**< WRNC device associated */
struct trtl_dev *trtl; /**< WRNC device associated */
uint32_t dev_id; /**< fmc device id */
uint32_t app_id; /**< Application id */
uint32_t n_cpu; /**< Number of CPUs */
......@@ -33,13 +33,13 @@ struct wrtd_desc {
* @file libwrtd-interal.c
*/
void unbag_ts(uint32_t *buf, int offset, struct wr_timestamp *ts);
int wrtd_validate_acknowledge(struct wrnc_msg *msg);
int wrtd_validate_acknowledge(struct trtl_msg *msg);
int wrtd_trig_id_cmp(struct wrtd_trig_id *id1, struct wrtd_trig_id *id2);
extern int wrtd_trivial_request(struct wrtd_node *dev,
struct wrnc_msg *request_msg,
struct trtl_msg *request_msg,
enum wrtd_core core);
extern int wrtd_send_and_receive_sync(struct wrtd_desc *wrtd,
struct wrnc_msg *msg,
struct trtl_msg *msg,
enum wrtd_core core);
extern void wrtd_timestamp_endianess_fix(struct wr_timestamp *ts);
extern void wrtd_output_rule_endianess_fix(struct lrt_output_rule *rule);
......
......@@ -103,18 +103,18 @@ enum wrtd_log_level wrtd_strlogging_to_level(char *log)
* @param[in] core WRTD core to use
* @return a HMQ token on success, NULL on error and errno is set appropriately
*/
static struct wrnc_hmq *wrtd_log_open(struct wrtd_node *dev,
static struct trtl_hmq *wrtd_log_open(struct wrtd_node *dev,
int channel,
enum wrtd_core core)
{
struct wrtd_desc *wrtd = (struct wrtd_desc *)dev;
struct wrnc_msg_filter filter = {
.operation = WRNC_MSG_FILTER_EQ,
struct trtl_msg_filter filter = {
.operation = TRTL_MSG_FILTER_EQ,
.word_offset = 3, /* channel field */
.mask = 0xFFFF, /* entire field */
.value = channel, /* required channel */
};
struct wrnc_hmq *hmq = NULL;
struct trtl_hmq *hmq = NULL;
int err;
int n_chan = core ? FD_NUM_CHANNELS : TDC_NUM_CHANNELS;
unsigned int hmq_back_index = core ? WRTD_OUT_FD_LOGGING :
......@@ -125,7 +125,7 @@ static struct wrnc_hmq *wrtd_log_open(struct wrtd_node *dev,
return NULL;
}
hmq = wrnc_hmq_open(wrtd->wrnc, hmq_back_index, 0);
hmq = trtl_hmq_open(wrtd->trtl, hmq_back_index, 0);
if (!hmq)
return NULL;
......@@ -135,7 +135,7 @@ static struct wrnc_hmq *wrtd_log_open(struct wrtd_node *dev,
filter.word_offset = 6;
}
/* the user want to filter per channel */
err = wrnc_hmq_filter_add(hmq, &filter);
err = trtl_hmq_filter_add(hmq, &filter);
if (err)
goto out_close;
}
......@@ -143,7 +143,7 @@ static struct wrnc_hmq *wrtd_log_open(struct wrtd_node *dev,
return hmq;
out_close:
wrnc_hmq_close(hmq);
trtl_hmq_close(hmq);
return NULL;
}
......@@ -158,12 +158,12 @@ out_close:
* @return number of read messages on success (check errno if it returns less
* messages than expected), -1 on error and errno is set appropriately
*/
int wrtd_log_read(struct wrnc_hmq *hmq_log, struct wrtd_log_entry *log,
int wrtd_log_read(struct trtl_hmq *hmq_log, struct wrtd_log_entry *log,
int count, int poll_timeout)
{
struct wrnc_proto_header hdr;
struct trtl_proto_header hdr;
struct wrtd_log_entry *cur = log;
struct wrnc_msg *msg;
struct trtl_msg *msg;
struct pollfd p;
int remaining = count;
int n_read = 0, ret;
......@@ -182,13 +182,13 @@ int wrtd_log_read(struct wrnc_hmq *hmq_log, struct wrtd_log_entry *log,
if (ret <= 0 || !(p.revents & POLLIN))
break;
msg = wrnc_hmq_receive(hmq_log);
msg = trtl_hmq_receive(hmq_log);
if (!msg)
break;
if (hmq_log->index == WRTD_OUT_FD_LOGGING) {
/* Output */
wrnc_msg_header (msg, &id, &seq);
trtl_msg_header (msg, &id, &seq);
if (id != WRTD_REP_LOG_MESSAGE)
{
......@@ -197,23 +197,23 @@ int wrtd_log_read(struct wrnc_hmq *hmq_log, struct wrtd_log_entry *log,
break;
}
wrnc_msg_uint32 (msg, &cur->type);
wrnc_msg_int32 (msg, &cur->channel);
wrnc_msg_uint32 (msg, &cur->miss_reason);
trtl_msg_uint32 (msg, &cur->type);
trtl_msg_int32 (msg, &cur->channel);
trtl_msg_uint32 (msg, &cur->miss_reason);
wrtd_msg_trigger_entry(msg, &ent);
cur->ts = ent.ts;
cur->seq = ent.seq;
cur->id = ent.id;
if ( wrnc_msg_check_error(msg) ) {
if ( trtl_msg_check_error(msg) ) {
free(msg);
errno = EWRTD_INVALID_ANSWER_STATE;
break;
}
} else {
/* Input */
wrnc_message_unpack(msg, &hdr, cur);
trtl_message_unpack(msg, &hdr, cur);
if (hdr.msg_id != WRTD_IN_ACTION_LOG) {
free(msg);
errno = EWRTD_INVALID_ANSWER_STATE;
......@@ -235,9 +235,9 @@ int wrtd_log_read(struct wrnc_hmq *hmq_log, struct wrtd_log_entry *log,
* It closes the logging interface
* @param[in] hmq HMQ token to close
*/
void wrtd_log_close(struct wrnc_hmq *hmq)
void wrtd_log_close(struct trtl_hmq *hmq)
{
wrnc_hmq_close(hmq);
trtl_hmq_close(hmq);
}
......@@ -251,13 +251,13 @@ static int wrtd_log_level_set(struct wrtd_node *dev, unsigned int channel,
uint32_t log_level, enum wrtd_core core)
{
struct wrtd_desc *wrtd = (struct wrtd_desc *)dev;
struct wrnc_structure_tlv tlv;
struct wrnc_proto_header hdr;
struct trtl_structure_tlv tlv;
struct trtl_proto_header hdr;
struct wrtd_out_channel ochan;
struct wrtd_in_channel ichan;
int err;
hdr.flags = WRNC_PROTO_FLAG_SYNC;
hdr.flags = TRTL_PROTO_FLAG_SYNC;
if (core) {
if (channel >= FD_NUM_CHANNELS) {
errno = EWRTD_INVALID_CHANNEL;
......@@ -282,7 +282,7 @@ static int wrtd_log_level_set(struct wrtd_node *dev, unsigned int channel,
(WRTD_OUT_TDC_CONTROL & 0xF);
}
err = wrnc_rt_structure_get(wrtd->wrnc, &hdr, &tlv, 1);
err = trtl_rt_structure_get(wrtd->trtl, &hdr, &tlv, 1);
if (err)
return err;
......@@ -291,7 +291,7 @@ static int wrtd_log_level_set(struct wrtd_node *dev, unsigned int channel,
else
ichan.config.log_level = log_level;
return wrnc_rt_structure_set(wrtd->wrnc, &hdr, &tlv, 1);
return trtl_rt_structure_set(wrtd->trtl, &hdr, &tlv, 1);
}
......@@ -304,7 +304,7 @@ static int wrtd_log_level_set(struct wrtd_node *dev, unsigned int channel,
* specific one.
* @return a HMQ token on success, NULL on error and errno is set appropriately
*/
struct wrnc_hmq *wrtd_out_log_open(struct wrtd_node *dev, int output)
struct trtl_hmq *wrtd_out_log_open(struct wrtd_node *dev, int output)
{
return wrtd_log_open(dev, output, WRTD_CORE_OUT);
}
......@@ -357,7 +357,7 @@ int wrtd_out_log_level_get(struct wrtd_node *dev, unsigned int input,
* specific one.
* @return a HMQ token on success, NULL on error and errno is set appropriately
*/
struct wrnc_hmq *wrtd_in_log_open(struct wrtd_node *dev, int input)
struct trtl_hmq *wrtd_in_log_open(struct wrtd_node *dev, int input)
{
return wrtd_log_open(dev, input, WRTD_CORE_IN);
}
......
This diff is collapsed.
......@@ -163,7 +163,7 @@ extern void wrtd_exit();
extern struct wrtd_node *wrtd_open_by_fmc(uint32_t device_id);
extern struct wrtd_node *wrtd_open_by_lun(int lun);
extern void wrtd_close(struct wrtd_node *dev);
extern struct wrnc_dev *wrtd_get_wrnc_dev(struct wrtd_node *dev);
extern struct trtl_dev *wrtd_get_trtl_dev(struct wrtd_node *dev);
extern int wrtd_load_application(struct wrtd_node *dev, char *rt_tdc,
char *rt_fd);
extern int wrtd_white_rabbit_sync(struct wrtd_node *dev,
......@@ -197,10 +197,10 @@ extern void wrtd_sec_pico_to_ts(uint64_t sec, uint64_t pico,
extern const char *wrtd_strlogging(enum wrtd_log_level lvl);
enum wrtd_log_level wrtd_strlogging_to_level(char *log);
extern void wrtd_strlogging_full(char *buf, uint32_t log_level);
extern int wrtd_log_read(struct wrnc_hmq *hmq_log, struct wrtd_log_entry *log,
extern int wrtd_log_read(struct trtl_hmq *hmq_log, struct wrtd_log_entry *log,
int count, int poll_timeout);
extern void wrtd_log_close(struct wrnc_hmq *hmq);
extern struct wrnc_hmq *wrtd_in_log_open(struct wrtd_node *dev, int input);
extern void wrtd_log_close(struct trtl_hmq *hmq);
extern struct trtl_hmq *wrtd_in_log_open(struct wrtd_node *dev, int input);
extern int wrtd_in_log_level_set(struct wrtd_node *dev, unsigned int input,
uint32_t log_level);
extern int wrtd_in_log_level_get(struct wrtd_node *dev, unsigned int input,
......@@ -209,7 +209,7 @@ extern int wrtd_out_log_level_set(struct wrtd_node *dev, unsigned int output,
uint32_t log_level);
extern int wrtd_out_log_level_get(struct wrtd_node *dev, unsigned int input,
uint32_t *log_level);
extern struct wrnc_hmq *wrtd_out_log_open(struct wrtd_node *dev, int output);
extern struct trtl_hmq *wrtd_out_log_open(struct wrtd_node *dev, int output);
/**@}*/
......@@ -251,7 +251,7 @@ extern int wrtd_in_has_trigger(struct wrtd_node *dev, unsigned int input,
extern int wrtd_in_ping(struct wrtd_node *dev);
extern int wrtd_in_base_time(struct wrtd_node *dev, struct wr_timestamp *ts);
extern int wrtd_in_version(struct wrtd_node *dev,
struct wrnc_rt_version *version);
struct trtl_rt_version *version);
extern int wrtd_in_dead_time_get(struct wrtd_node *dev, unsigned int input,
uint64_t *dead_time_ps);
extern int wrtd_in_delay_get(struct wrtd_node *dev, unsigned int input,
......@@ -304,7 +304,7 @@ extern int wrtd_out_trig_enable(struct wrtd_node *dev,
extern int wrtd_out_ping(struct wrtd_node *dev);
extern int wrtd_out_base_time(struct wrtd_node *dev, struct wr_timestamp *ts);
extern int wrtd_out_version(struct wrtd_node *dev,
struct wrnc_rt_version *version);
struct trtl_rt_version *version);
extern int wrtd_out_trigger_mode_set(struct wrtd_node *dev,
unsigned int output,
enum wrtd_trigger_mode mode);
......
......@@ -195,7 +195,7 @@ static void ts_adjust_delay(struct wr_timestamp *ts, uint32_t cycles, uint32_t f
static void log_trigger(int type, int miss_reason, struct wrtd_out_channel *out,
struct wrtd_trigger_entry *ent)
{
struct wrnc_proto_header hdr = {
struct trtl_proto_header hdr = {
.rt_app_id = 0,
.msg_id = WRTD_OUT_ACTION_LOG,
.slot_io = WRTD_OUT_FD_LOGGING,
......@@ -205,7 +205,7 @@ static void log_trigger(int type, int miss_reason, struct wrtd_out_channel *out,
.trans = 0x0,
.time = 0x0,
};
struct wrnc_msg out_buf;
struct trtl_msg out_buf;
struct wrtd_log_entry *log;
if (!out && (type != WRTD_LOG_PROMISC || !promiscuous_mode ))
......@@ -676,8 +676,8 @@ struct wrtd_trigger_sw {
* It generate a software trigger accorging to the trigger entry coming
* from the user space.
*/
static int wrtd_out_trigger_sw(struct wrnc_proto_header *hin, void *pin,
struct wrnc_proto_header *hout, void *pout)
static int wrtd_out_trigger_sw(struct trtl_proto_header *hin, void *pin,
struct trtl_proto_header *hout, void *pout)
{
struct wrtd_trigger_sw *tsw = pin;
struct pulse_queue_entry *pq_ent;
......@@ -735,8 +735,8 @@ static int wrtd_out_hash_table_free(struct wrtd_trig_id *tid)
/**
* Insert trigger entry in the hash table
*/
static int wrtd_out_hash_table_insert(struct wrnc_proto_header *hin, void *pin,
struct wrnc_proto_header *hout, void *pout)
static int wrtd_out_hash_table_insert(struct trtl_proto_header *hin, void *pin,
struct trtl_proto_header *hout, void *pout)
{
uint32_t tidx = *(uint32_t *)pin;
int hidx;
......@@ -768,8 +768,8 @@ out:
/**
* Remove trigger entry from the hash table
*/
static int wrtd_out_hash_table_remove(struct wrnc_proto_header *hin, void *pin,
struct wrnc_proto_header *hout, void *pout)
static int wrtd_out_hash_table_remove(struct trtl_proto_header *hin, void *pin,
struct trtl_proto_header *hout, void *pout)
{
uint32_t tidx = *(uint32_t *)pin;
int hidx;
......@@ -798,8 +798,8 @@ static int wrtd_out_hash_table_remove(struct wrnc_proto_header *hin, void *pin,
/**
* It gets the trigger index for a given trigger ID
*/
static int wrtd_out_trigger_index(struct wrnc_proto_header *hin, void *pin,
struct wrnc_proto_header *hout, void *pout)
static int wrtd_out_trigger_index(struct trtl_proto_header *hin, void *pin,
struct trtl_proto_header *hout, void *pout)
{
struct wrtd_trig_id *id = pin;
uint32_t *index = pout;
......@@ -844,8 +844,8 @@ err:
/**
* It disable the given channel and clear its internal queue
*/
static int wrtd_out_disable(struct wrnc_proto_header *hin, void *pin,
struct wrnc_proto_header *hout, void *pout)
static int wrtd_out_disable(struct trtl_proto_header *hin, void *pin,
struct trtl_proto_header *hout, void *pout)
{
uint32_t ch = *((uint32_t *)pin);
......
......@@ -77,9 +77,9 @@ static int wrtd_in_trigger_log(int type, int miss_reason,
struct wrtd_in_channel *st,
struct wrtd_trigger_entry *ent)
{
struct wrnc_msg out_buf;
struct trtl_msg out_buf;
struct wrtd_log_entry *log;
struct wrnc_proto_header hdr = {
struct trtl_proto_header hdr = {
.rt_app_id = 0,
.msg_id = WRTD_IN_ACTION_LOG,
.slot_io = WRTD_OUT_TDC_LOGGING,
......@@ -257,8 +257,8 @@ static inline void do_input(void)
* delay, then this function will add it to the current time to compute
* the correct fire time.
*/
static int wrtd_in_trigger_sw(struct wrnc_proto_header *hin, void *pin,
struct wrnc_proto_header *hout, void *pout)
static int wrtd_in_trigger_sw(struct trtl_proto_header *hin, void *pin,
struct trtl_proto_header *hout, void *pout)
{
struct wrtd_trigger_entry ent;
struct wr_timestamp ts;
......
......@@ -125,7 +125,7 @@ int main(int argc, char *argv[])
uint32_t dev_id = 0;
char *tdc = NULL, *fd =NULL, c;
struct wrtd_node *wrtd;
struct wrnc_dev *wrnc;
struct trtl_dev *trtl;
int32_t offset;
atexit(wrtd_exit);
......@@ -157,14 +157,14 @@ int main(int argc, char *argv[])
}
if (!dev_id) {
fprintf(stderr, "Invalid wrnc device\n");
fprintf(stderr, "Invalid trtl device\n");
exit(1);
}
err = wrtd_init();
if (err) {
fprintf(stderr, "Cannot init White Rabbit Trigger Distribution lib: %s\n",
wrnc_strerror(errno));
trtl_strerror(errno));
exit(1);
}
......@@ -185,15 +185,15 @@ int main(int argc, char *argv[])
}
/* Get the WRNC token */
wrnc = wrtd_get_wrnc_dev(wrtd);
trtl = wrtd_get_trtl_dev(wrtd);
fprintf(stdout, "Reboot applications\n");
/* Start running application on TDC and FD CPUs */
err = wrnc_cpu_start(wrnc, 0);
err = trtl_cpu_start(trtl, 0);
if (err)
exit(1);
err = wrnc_cpu_start(wrnc, 1);
err = trtl_cpu_start(trtl, 1);
if (err)
exit(1);
......
......@@ -340,7 +340,7 @@ int main(int argc, char *argv[])
err = wrtd_init();
if (err) {
fprintf(stderr, "Cannot init White Rabbit Trigger Distribution lib: %s\n",
wrnc_strerror(errno));
trtl_strerror(errno));
exit(1);
}
......
......@@ -42,7 +42,7 @@ static void help()
static void *logging_thread(void *arg)
{
struct wrtd_log_th *th_data = arg;
struct wrnc_hmq *hlog;
struct trtl_hmq *hlog;
struct wrtd_log_entry log;
int i, count;
......@@ -168,7 +168,7 @@ int main(int argc, char *argv[])
err = wrtd_init();
if (err) {
fprintf(stderr, "Cannot init White Rabbit Node Core lib: %s\n",
wrnc_strerror(errno));
trtl_strerror(errno));
exit(1);
}
......
......@@ -606,7 +606,7 @@ int main(int argc, char *argv[])
err = wrtd_init();
if (err) {
fprintf(stderr, "Cannot init White Rabbit Node Core lib: %s\n",
wrnc_strerror(errno));
trtl_strerror(errno));
exit(1);
}
......
......@@ -31,7 +31,7 @@ static void print_time(struct wr_timestamp *t)
t->seconds, t->ticks, t->frac);
}
static void print_version(struct wrnc_rt_version *v)
static void print_version(struct trtl_rt_version *v)
{
fprintf(stdout, "\tRealTime Application Version:");
fprintf(stdout, "\tfpga_id\t\t%x\n",
......@@ -49,7 +49,7 @@ int main(int argc, char *argv[])
{
struct wrtd_node *wrtd;
uint32_t dev_id = 0, n = 1;
struct wrnc_rt_version vi, vo;
struct trtl_rt_version vi, vo;
uint64_t period = 0;
struct wr_timestamp tsi, tso;
int err, time = 0, version = 0;
......
......@@ -15,7 +15,7 @@
/**
* It describes the version running on the embedded CPU
*/
struct wrnc_rt_version {
struct trtl_rt_version {
uint32_t fpga_id; /**< FPGA identifier expected to run the RT app */
uint32_t rt_id; /**< RT application identifier */
uint32_t rt_version; /**< RT application version*/
......@@ -44,15 +44,15 @@ enum rt_action_standard {
/* Protocol Definition */
#define WRNC_PROTO_FLAG_REMOTE (1 << 0)
#define WRNC_PROTO_FLAG_SYNC (1 << 1)
#define WRNC_PROTO_FLAG_RPC (1 << 2)
#define WRNC_PROTO_FLAG_PERIODICAL (1 << 3)
#define TRTL_PROTO_FLAG_REMOTE (1 << 0)
#define TRTL_PROTO_FLAG_SYNC (1 << 1)
#define TRTL_PROTO_FLAG_RPC (1 << 2)
#define TRTL_PROTO_FLAG_PERIODICAL (1 << 3)
/**
* Protocol header definition
*/
struct wrnc_proto_header {
struct trtl_proto_header {
uint16_t rt_app_id; /**< Real-Time application unique identifier */
uint8_t msg_id; /**< Message identifier */
uint8_t slot_io; /**< Message Queue IO to use
......@@ -71,7 +71,7 @@ struct wrnc_proto_header {
*/
struct mturtle_packet {
/* offset 0x00 */
volatile struct wrnc_proto_header header; /**< packet header */
volatile struct trtl_proto_header header; /**< packet header */
/* offset 0x10 */
volatile uint32_t payload[]; /**< packet payload */
};
......@@ -92,9 +92,9 @@ static inline struct mturtle_packet *rt_proto_packet_get(void *buf)
* @param[in] raw_msg raw message
* @param[out] header the header from the message
*/
static inline struct wrnc_proto_header *rt_proto_header_get(void *raw_msg)
static inline struct trtl_proto_header *rt_proto_header_get(void *raw_msg)
{
return (struct wrnc_proto_header *) raw_msg;
return (struct trtl_proto_header *) raw_msg;
}
......@@ -104,9 +104,9 @@ static inline struct wrnc_proto_header *rt_proto_header_get(void *raw_msg)
* @param[out] header the header from the message
*/
static inline void rt_proto_header_set(void *raw_msg,
struct wrnc_proto_header *header)
struct trtl_proto_header *header)
{
memcpy(raw_msg, header, sizeof(struct wrnc_proto_header));
memcpy(raw_msg, header, sizeof(struct trtl_proto_header));
}
......@@ -117,7 +117,7 @@ static inline void rt_proto_header_set(void *raw_msg,
*/
static inline void *rt_proto_payload_get(void *raw_msg)
{
return ((char *)raw_msg + sizeof(struct wrnc_proto_header));
return ((char *)raw_msg + sizeof(struct trtl_proto_header));
}
......
......@@ -7,34 +7,34 @@
#define __TRTL_USER_H__
/** @file mock-turtle.h */
#define WRNC_MAX_CARRIER 20 /**< Maximum number of WRNC components on a
#define TRTL_MAX_CARRIER 20 /**< Maximum number of WRNC components on a
single computer*/
#define WRNC_MAX_CPU 8 /**< Maximum number of CPU core in a WRNC bitstream */
#define WRNC_MAX_HMQ_SLOT 32 /**< Maximum number of HMQ slots in a
#define TRTL_MAX_CPU 8 /**< Maximum number of CPU core in a WRNC bitstream */
#define TRTL_MAX_HMQ_SLOT 32 /**< Maximum number of HMQ slots in a
WRNC bitstream */
#define WRNC_MAX_PAYLOAD_SIZE 128
#define TRTL_MAX_PAYLOAD_SIZE 128
/**
* @enum wrnc_smem_modifier
* @enum trtl_smem_modifier
* Shared memory operation modifier. This is a list of operation modifier
* that you can use to access the shared memory.
*/
enum wrnc_smem_modifier {
WRNC_SMEM_DIRECT = 0, /**< direct read/write of the memory */
WRNC_SMEM_ADD, /**< on write, atomic ADD to memory content */
WRNC_SMEM_SUB, /**< on write, atomic SUB to memory content */
WRNC_SMEM_OR, /**< on write, atomic OR with memory content */
WRNC_SMEM_CLR_AND, /**< on write, atomic AND with complemented memory
enum trtl_smem_modifier {
TRTL_SMEM_DIRECT = 0, /**< direct read/write of the memory */
TRTL_SMEM_ADD, /**< on write, atomic ADD to memory content */
TRTL_SMEM_SUB, /**< on write, atomic SUB to memory content */
TRTL_SMEM_OR, /**< on write, atomic OR with memory content */
TRTL_SMEM_CLR_AND, /**< on write, atomic AND with complemented memory
content */
WRNC_SMEM_XOR, /**< on write, atomic XOR with memory content */
TRTL_SMEM_XOR, /**< on write, atomic XOR with memory content */
};
/**
* @enum wrnc_msg_direction
* @enum trtl_msg_direction
* Message direction on the Host Message Queue
*/
enum wrnc_msg_direction {
enum trtl_msg_direction {
WRNC_MSG_DIR_SEND = 0, /**< from Host to RealTime Application */
WRNC_MSG_DIR_RECEIVE = 1, /**< from RealTime application to Host */
};
......@@ -42,22 +42,22 @@ enum wrnc_msg_direction {
/**
* Messages descriptor
*/
struct wrnc_msg {
struct trtl_msg {
uint32_t datalen; /**< payload length*/
uint32_t data[WRNC_MAX_PAYLOAD_SIZE]; /**< payload, free content
uint32_t data[TRTL_MAX_PAYLOAD_SIZE]; /**< payload, free content
(no official protocol) */
uint32_t max_size; /**< maximum message size for chosen slot */
uint32_t offset; /**< serialization/deserialization offset */
enum wrnc_msg_direction direction; /**< serialization direction
(used by wrnc_msg_x functions) */
enum trtl_msg_direction direction; /**< serialization direction
(used by trtl_msg_x functions) */
int error; /** serialization error status */
};
/**
* Message descriptor used to send synchronous messages
*/
struct wrnc_msg_sync {
struct wrnc_msg *msg; /**< the message to send. It will be overwritten by
struct trtl_msg_sync {
struct trtl_msg *msg; /**< the message to send. It will be overwritten by
the synchronous answer */
uint16_t index_in; /**< where write the message */
uint16_t index_out; /**< where we expect the synchronous answer */
......@@ -65,20 +65,20 @@ struct wrnc_msg_sync {
};
/**
* @enum wrnc_msg_filter_operation_type
* @enum trtl_msg_filter_operation_type
* List of available filter's operations
*/
enum wrnc_msg_filter_operation_type {
WRNC_MSG_FILTER_AND,
WRNC_MSG_FILTER_OR,
WRNC_MSG_FILTER_NOT,
WRNC_MSG_FILTER_EQ,
enum trtl_msg_filter_operation_type {
TRTL_MSG_FILTER_AND,
TRTL_MSG_FILTER_OR,
TRTL_MSG_FILTER_NOT,
TRTL_MSG_FILTER_EQ,
};
/**
* It describe a filter to apply to messages
*/
struct wrnc_msg_filter {
struct trtl_msg_filter {
uint32_t operation; /**< kind of operation to perform */
uint32_t word_offset; /**< offset of the word to check */
uint32_t mask; /**< mask to apply before the operation */
......@@ -89,36 +89,36 @@ struct wrnc_msg_filter {
/**
* Descriptor of the IO operation on Shared Memory
*/
struct wrnc_smem_io {
struct trtl_smem_io {
uint32_t addr; /**< address to access */
uint32_t value; /**< value to write. After ioctl it will be overwritte
with the new value in the shared memory */
int is_input; /**< flag to determinte data direction */
enum wrnc_smem_modifier mod; /**< the kind of operation to do */
enum trtl_smem_modifier mod; /**< the kind of operation to do */
};
/**
* @enum wrnc_ioctl_commands
* @enum trtl_ioctl_commands
* Available ioctl() messages
*/
enum wrnc_ioctl_commands {
WRNC_MSG_SYNC, /**< send a synchronous message */
WRNC_SMEM_IO, /**< access to shared memory */
WRNC_MSG_FILTER_ADD, /**< add a message filter */
WRNC_MSG_FILTER_CLEAN, /**< remove all filters */
enum trtl_ioctl_commands {
TRTL_MSG_SYNC, /**< send a synchronous message */
TRTL_SMEM_IO, /**< access to shared memory */
TRTL_MSG_FILTER_ADD, /**< add a message filter */
TRTL_MSG_FILTER_CLEAN, /**< remove all filters */
};
#define WRNC_IOCTL_MAGIC 's'
#define WRNC_IOCTL_MSG_SYNC _IOWR(WRNC_IOCTL_MAGIC, WRNC_MSG_SYNC, \
struct wrnc_msg_sync)
#define WRNC_IOCTL_SMEM_IO _IOWR(WRNC_IOCTL_MAGIC, WRNC_SMEM_IO, \
struct wrnc_smem_io)
#define TRTL_IOCTL_MAGIC 's'
#define TRTL_IOCTL_MSG_SYNC _IOWR(TRTL_IOCTL_MAGIC, TRTL_MSG_SYNC, \
struct trtl_msg_sync)
#define TRTL_IOCTL_SMEM_IO _IOWR(TRTL_IOCTL_MAGIC, TRTL_SMEM_IO, \
struct trtl_smem_io)
#define WRNC_IOCTL_MSG_FILTER_ADD _IOW(WRNC_IOCTL_MAGIC, \
WRNC_MSG_FILTER_ADD, \
struct wrnc_msg_filter)
#define WRNC_IOCTL_MSG_FILTER_CLEAN _IOW(WRNC_IOCTL_MAGIC, \
WRNC_MSG_FILTER_CLEAN, \
struct wrnc_msg_filter)
#define TRTL_IOCTL_MSG_FILTER_ADD _IOW(TRTL_IOCTL_MAGIC, \
TRTL_MSG_FILTER_ADD, \
struct trtl_msg_filter)
#define TRTL_IOCTL_MSG_FILTER_CLEAN _IOW(TRTL_IOCTL_MAGIC, \
TRTL_MSG_FILTER_CLEAN, \
struct trtl_msg_filter)
#endif
This diff is collapsed.
This diff is collapsed.
......@@ -23,9 +23,9 @@ module_param_named(max_dbg_msg, dbg_max_msg, int, 0444);
MODULE_PARM_DESC(max_dbg_msg, "Maximum number of debug messages in driver queue.");
static int wrnc_dbg_open(struct inode *inode, struct file *file)
static int trtl_dbg_open(struct inode *inode, struct file *file)
{
struct wrnc_cpu *cpu;
struct trtl_cpu *cpu;
if (inode->i_private)
file->private_data = inode->i_private;
......@@ -45,9 +45,9 @@ static int wrnc_dbg_open(struct inode *inode, struct file *file)
return 0;
}
static int wrnc_dbg_close(struct inode *inode, struct file *file)
static int trtl_dbg_close(struct inode *inode, struct file *file)
{
struct wrnc_cpu *cpu = file->private_data;
struct trtl_cpu *cpu = file->private_data;
spin_lock(&cpu->lock);
kfree(cpu->cbuf.buf);
......@@ -57,10 +57,10 @@ static int wrnc_dbg_close(struct inode *inode, struct file *file)
return 0;
}
static ssize_t wrnc_dbg_read(struct file *f, char __user *buf,
static ssize_t trtl_dbg_read(struct file *f, char __user *buf,
size_t count, loff_t *offp)
{
struct wrnc_cpu *cpu = f->private_data;
struct trtl_cpu *cpu = f->private_data;
size_t lcount;
int i;
......@@ -95,9 +95,9 @@ static ssize_t wrnc_dbg_read(struct file *f, char __user *buf,
return lcount;
}
static unsigned int wrnc_dbg_poll(struct file *f, struct poll_table_struct *w)
static unsigned int trtl_dbg_poll(struct file *f, struct poll_table_struct *w)
{
struct wrnc_cpu *cpu = f->private_data;
struct trtl_cpu *cpu = f->private_data;
dev_dbg(&cpu->dev, "%s head=%d, tail=%d\n", __func__,
cpu->cbuf.head, cpu->cbuf.tail);
......@@ -106,38 +106,38 @@ static unsigned int wrnc_dbg_poll(struct file *f, struct poll_table_struct *w)
return 0;
}
const struct file_operations wrnc_cpu_dbg_fops = {
const struct file_operations trtl_cpu_dbg_fops = {
.owner = THIS_MODULE,
.open = wrnc_dbg_open,
.release = wrnc_dbg_close,
.read = wrnc_dbg_read,
.poll = wrnc_dbg_poll,
.open = trtl_dbg_open,
.release = trtl_dbg_close,
.read = trtl_dbg_read,
.poll = trtl_dbg_poll,
};
irqreturn_t wrnc_irq_handler_debug(int irq_core_base, void *arg)
irqreturn_t trtl_irq_handler_debug(int irq_core_base, void *arg)
{
struct fmc_device *fmc = arg;
struct wrnc_dev *wrnc = fmc_get_drvdata(fmc);
struct trtl_dev *trtl = fmc_get_drvdata(fmc);
struct circ_buf *cb;
uint32_t status;
char c;
int i;
status = fmc_readl(fmc, wrnc->base_csr + WRN_CPU_CSR_REG_DBG_POLL);
status = fmc_readl(fmc, trtl->base_csr + WRN_CPU_CSR_REG_DBG_POLL);
do_irq:
i = -1;
while (status && ++i < wrnc->n_cpu) {
while (status && ++i < trtl->n_cpu) {
if (!(status & 0x1)) {
status >>= 1;
continue;
}
/* Select the CPU to use */
spin_lock(&wrnc->cpu[i].lock);
fmc_writel(fmc, i, wrnc->base_csr + WRN_CPU_CSR_REG_CORE_SEL);
spin_lock(&trtl->cpu[i].lock);
fmc_writel(fmc, i, trtl->base_csr + WRN_CPU_CSR_REG_CORE_SEL);
c = fmc_readl(fmc,
wrnc->base_csr + WRN_CPU_CSR_REG_DBG_MSG);
cb = &wrnc->cpu[i].cbuf;
trtl->base_csr + WRN_CPU_CSR_REG_DBG_MSG);
cb = &trtl->cpu[i].cbuf;
if (cb->buf) {
/* We cans store the char */
pr_debug("%s:%d %d=%c\n", __func__, __LINE__, i, c);
......@@ -147,10 +147,10 @@ do_irq:
cb->tail = (cb->tail + 1) & (dbg_max_msg - 1);
}
}
spin_unlock(&wrnc->cpu[i].lock);
spin_unlock(&trtl->cpu[i].lock);
}
status = fmc_readl(fmc, wrnc->base_csr + WRN_CPU_CSR_REG_DBG_POLL);
status = fmc_readl(fmc, trtl->base_csr + WRN_CPU_CSR_REG_DBG_POLL);
if (status)
goto do_irq;
......
......@@ -11,33 +11,33 @@
#include "hw/mockturtle_queue.h"
#include "mockturtle.h"
#define WRNC_MAX_CPU_MINORS (WRNC_MAX_CPU * WRNC_MAX_CARRIER)
#define WRNC_MAX_HMQ_MINORS (WRNC_MAX_HMQ_SLOT * WRNC_MAX_CARRIER)
#define WRNC_MAX_MINORS (WRNC_MAX_CARRIER + WRNC_MAX_CPU_MINORS + WRNC_MAX_HMQ_MINORS)
#define TRTL_MAX_CPU_MINORS (TRTL_MAX_CPU * TRTL_MAX_CARRIER)
#define TRTL_MAX_HMQ_MINORS (TRTL_MAX_HMQ_SLOT * TRTL_MAX_CARRIER)
#define TRTL_MAX_MINORS (TRTL_MAX_CARRIER + TRTL_MAX_CPU_MINORS + TRTL_MAX_HMQ_MINORS)
#define WRNC_SMEM_MAX_SIZE 65536
#define TRTL_SMEM_MAX_SIZE 65536
#define to_wrnc_cpu(_dev) (container_of(_dev, struct wrnc_cpu, dev))
#define to_wrnc_dev(_dev) (container_of(_dev, struct wrnc_dev, dev))
#define to_fmc_dev(_wrnc) (container_of(_wrnc->dev.parent, struct fmc_device, dev))
#define to_wrnc_hmq(_dev) (container_of(_dev, struct wrnc_hmq, dev))
#define to_trtl_cpu(_dev) (container_of(_dev, struct trtl_cpu, dev))
#define to_trtl_dev(_dev) (container_of(_dev, struct trtl_dev, dev))
#define to_fmc_dev(_trtl) (container_of(_trtl->dev.parent, struct fmc_device, dev))
#define to_trtl_hmq(_dev) (container_of(_dev, struct trtl_hmq, dev))
#define WRNC_FLAG_HMQ_DIR (1 << 0) /**< 1 CPU input, 0 CPU output */
#define WRNC_FLAG_HMQ_SHR (1 << 1) /**< 1 shared, means that more than
#define TRTL_FLAG_HMQ_DIR (1 << 0) /**< 1 CPU input, 0 CPU output */
#define TRTL_FLAG_HMQ_SHR (1 << 1) /**< 1 shared, means that more than
1 CPU is using it */
#define WRNC_FLAG_HMQ_SHR_USR (1 << 2) /**< Shared by users */
#define WRNC_FLAG_HMQ_SYNC_WAIT (1 << 3) /**< wait sync answer */
#define WRNC_FLAG_HMQ_SYNC_READY (1 << 4) /**< sync answer is ready */
#define TRTL_FLAG_HMQ_SHR_USR (1 << 2) /**< Shared by users */
#define TRTL_FLAG_HMQ_SYNC_WAIT (1 << 3) /**< wait sync answer */
#define TRTL_FLAG_HMQ_SYNC_READY (1 << 4) /**< sync answer is ready */
static inline uint32_t wrnc_get_sequence(struct wrnc_msg *msg)
static inline uint32_t trtl_get_sequence(struct trtl_msg *msg)
{
return msg->data[1];
}
struct wrnc_msg_filter_element {
struct wrnc_msg_filter filter;
struct trtl_msg_filter_element {
struct trtl_msg_filter filter;
struct list_head list;
};
......@@ -45,18 +45,18 @@ struct wrnc_msg_filter_element {
/**
* Available type of devices
*/
enum wrnc_dev_type {
WRNC_DEV, /**< the whole WRNC component */
WRNC_CPU, /**< CPU core of the WRNC*/
WRNC_HMQ, /**< HMQ slot ot the WRNC */
enum trtl_dev_type {
TRTL_DEV, /**< the whole WRNC component */
TRTL_CPU, /**< CPU core of the WRNC*/
TRTL_HMQ, /**< HMQ slot ot the WRNC */
};
/**
* Message structure for the driver
*/
struct wrnc_msg_element {
struct trtl_msg_element {
struct list_head list; /**< to keep it in our local queue */
struct wrnc_msg *msg; /**< the real message */
struct trtl_msg *msg; /**< the real message */
};
......@@ -80,7 +80,7 @@ struct mturtle_hmq_buffer {
/**
* It describe the status of a HMQ slot
*/
struct wrnc_hmq {
struct trtl_hmq {
struct device dev;
int index; /**< instance number */
unsigned long flags; /**< describe the status of the HMQ slot from
......@@ -102,7 +102,7 @@ struct wrnc_hmq {
unsigned int waiting_seq; /**< sequence number to wait */
struct wrnc_msg sync_answer; /**< synchronous answer message */
struct trtl_msg sync_answer; /**< synchronous answer message */
unsigned int max_width; /**< maximum words number per single buffer */
unsigned int max_depth; /**< maximum buffer queue length (HW) */
......@@ -113,9 +113,9 @@ struct wrnc_hmq {
/**
* It describes the consumer of the output slot
*/
struct wrnc_hmq_user {
struct trtl_hmq_user {
struct list_head list; /**< to keep it in our local queue */
struct wrnc_hmq *hmq; /**< reference to opened HMQ */
struct trtl_hmq *hmq; /**< reference to opened HMQ */
struct spinlock lock; /**< to protect list read/write */
struct list_head list_filters; /**< list of filters to apply */
......@@ -129,31 +129,31 @@ struct wrnc_hmq_user {
/**
* It describes a single instance of a CPU of the WRNC
*/
struct wrnc_cpu {
struct trtl_cpu {
int index; /**< instance number */
struct device dev; /**< device representing a single CPU */
struct dentry *dbg_msg; /**< debug messages interface */
struct circ_buf cbuf; /**< debug circular buffer */
struct spinlock lock;
struct wrnc_hmq *hmq[WRNC_MAX_HMQ_SLOT]; /**< list of HMQ slots used by
struct trtl_hmq *hmq[TRTL_MAX_HMQ_SLOT]; /**< list of HMQ slots used by
this CPU */
};
/**
* It describes the generic instance of a WRNC
*/
struct wrnc_dev {
struct trtl_dev {
unsigned int app_id; /**< Application ID of the FPGA bitstream */
struct device dev;
unsigned int n_cpu; /**< number of CPU in the FPGA bitstream */
struct wrnc_cpu cpu[WRNC_MAX_CPU]; /**< CPU instances */
struct trtl_cpu cpu[TRTL_MAX_CPU]; /**< CPU instances */
unsigned int n_hmq_in; /**< number of input slots in the HMQ */
unsigned int n_hmq_out; /**< number of output slots in the HMQ */
struct wrnc_hmq hmq_in[MAX_MQUEUE_SLOTS]; /**< HMQ input instances */
struct wrnc_hmq hmq_out[MAX_MQUEUE_SLOTS]; /**< HMQ output instances */
struct trtl_hmq hmq_in[MAX_MQUEUE_SLOTS]; /**< HMQ input instances */
struct trtl_hmq hmq_out[MAX_MQUEUE_SLOTS]; /**< HMQ output instances */
uint32_t base_core; /**< base address of the WRNC component */
uint32_t base_csr; /**< base address of the Shared Control Register */
uint32_t base_hmq; /**< base address of the HMQ */
......@@ -162,7 +162,7 @@ struct wrnc_dev {
uint32_t base_smem; /**< base address of the Shared Memory */
uint32_t irq_mask; /**< IRQ mask in use */
enum wrnc_smem_modifier mod; /**< smem operation modifier */
enum trtl_smem_modifier mod; /**< smem operation modifier */
struct dentry *dbg_dir; /**< root debug directory */
......@@ -170,19 +170,19 @@ struct wrnc_dev {
};
/* Global data */
extern struct device *minors[WRNC_MAX_MINORS];
extern struct device *minors[TRTL_MAX_MINORS];
/* CPU data */
extern const struct file_operations wrnc_cpu_dbg_fops;
extern const struct file_operations wrnc_cpu_fops;
extern const struct attribute_group *wrnc_cpu_groups[];
extern void wrnc_cpu_enable_set(struct wrnc_dev *wrnc, uint8_t mask);
extern void wrnc_cpu_reset_set(struct wrnc_dev *wrnc, uint8_t mask);
extern const struct file_operations trtl_cpu_dbg_fops;
extern const struct file_operations trtl_cpu_fops;
extern const struct attribute_group *trtl_cpu_groups[];
extern void trtl_cpu_enable_set(struct trtl_dev *trtl, uint8_t mask);
extern void trtl_cpu_reset_set(struct trtl_dev *trtl, uint8_t mask);
extern int dbg_max_msg;
extern irqreturn_t wrnc_irq_handler_debug(int irq_core_base, void *arg);
extern irqreturn_t trtl_irq_handler_debug(int irq_core_base, void *arg);
/* HMQ */
extern int hmq_default_buf_size;
extern int hmq_shared;
extern const struct attribute_group *wrnc_hmq_groups[];
extern const struct file_operations wrnc_hmq_fops;
extern irqreturn_t wrnc_irq_handler(int irq_core_base, void *arg);
extern const struct attribute_group *trtl_hmq_groups[];
extern const struct file_operations trtl_hmq_fops;
extern irqreturn_t trtl_irq_handler(int irq_core_base, void *arg);
#endif
This diff is collapsed.
......@@ -12,11 +12,11 @@
/**
* Internal descriptor for a WRNC device
*/
struct wrnc_desc {
char name[WRNC_NAME_LEN]; /**< Name of the device */
char path[WRNC_PATH_LEN]; /**< path to device */
struct trtl_desc {
char name[TRTL_NAME_LEN]; /**< Name of the device */
char path[TRTL_PATH_LEN]; /**< path to device */
int fd_dev; /**< File Descriptor of the device */
int fd_cpu[WRNC_MAX_CPU]; /**< File Descriptor of the CPUs */
int fd_cpu[TRTL_MAX_CPU]; /**< File Descriptor of the CPUs */
};
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -14,17 +14,17 @@ int main(int argc, char *argv[])
uint32_t count;
int err;
err = wrnc_init();
err = trtl_init();
if (err) {
fprintf(stderr, "Cannot init White Rabbit Node Core lib: %s\n",
wrnc_strerror(errno));
trtl_strerror(errno));
exit(1);
}
count = wrnc_count();
count = trtl_count();
printf("%d\n", count);
wrnc_exit();
trtl_exit();
return 0;
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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 to comment