Commit b41a6dbc authored by Federico Vaga's avatar Federico Vaga

wrtd:rt:out: implement disable command

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>


NOTE
This commit has been created by `git subtree` on the Mock Turtle repository
on tag mock-turtle-2.0

This commit will not compile
parent db46651d
......@@ -110,6 +110,7 @@ enum wrtd_out_actions {
WRTD_OUT_ACTION_TRIG_ADD,
WRTD_OUT_ACTION_TRIG_DEL,
WRTD_OUT_ACTION_LOG,
WRTD_OUT_ACTION_DISABLE,
};
enum wrtd_in_variables_indexes {
......
......@@ -145,6 +145,37 @@ static int wrtd_out_trigger_remove(struct wrtd_desc *wrtd, uint32_t tid)
}
static int wrtd_out_rt_disable(struct wrtd_desc *wrtd, unsigned int output)
{
struct wrnc_proto_header hdr = {
.msg_id = WRTD_OUT_ACTION_DISABLE,
.slot_io = (WRTD_IN_FD_CONTROL << 4) |
(WRTD_OUT_FD_CONTROL & 0xF),
.flags = WRNC_PROTO_FLAG_SYNC,
.len = 1,
};
struct wrnc_msg msg;
uint32_t *data;
int err;
memset(&msg, 0, sizeof(struct wrnc_msg));
data = &msg.data[sizeof(struct wrnc_proto_header) / 4];
data[0] = output;
wrnc_message_header_set(&msg, &hdr);
msg.datalen = sizeof(struct wrnc_proto_header) / 4 + hdr.len;
err = wrtd_out_send_and_receive_sync(wrtd, &msg);
if (err)
return -1;
wrnc_message_header_get(&msg, &hdr);
if (hdr.msg_id != RT_ACTION_SEND_ACK) {
errno = EWRTD_INVALID_ANSWER_ACK;
return -1;
}
return 0;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* * * * * * * * * * PROTOTYPEs IMPLEMENTATION * * * * * * * * * */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
......@@ -260,8 +291,10 @@ int wrtd_out_enable(struct wrtd_node *dev, unsigned int output,
chan.config.flags &= ~(WRTD_ENABLED | WRTD_ARMED |
WRTD_TRIGGERED | WRTD_LAST_VALID);
chan.config.state = OUT_ST_IDLE;
/* run pulse_queue_init ( &out->queue ); on RT side */
/* set variable fd_ch_writel(out, FD_DCR_MODE, FD_REG_DCR); */
err = wrtd_out_rt_disable(wrtd, output);
if (err)
return -1;
}
return wrnc_rt_structure_set(wrtd->wrnc, &hdr, &tlv, 1);
......
......@@ -787,6 +787,19 @@ err:
}
static int wrtd_out_disable(struct wrnc_proto_header *hin, void *pin,
struct wrnc_proto_header *hout, void *pout)
{
uint32_t ch = *((uint32_t *)pin);
pulse_queue_init(&wrtd_out_channels[ch].priv.queue);
fd_ch_writel(&wrtd_out_channels[ch], FD_DCR_MODE, FD_REG_DCR);
rt_send_ack(hin, pin, hout, pout);
return 0;
}
/**
* Data structures to export to host system. Initialized dynamically in
* the function init()
......@@ -823,6 +836,7 @@ static action_t *wrtd_out_actions[] = {
[WRTD_OUT_ACTION_TRIG_IDX] = wrtd_out_trigger_index,
[WRTD_OUT_ACTION_TRIG_ADD] = wrtd_out_hash_table_insert,
[WRTD_OUT_ACTION_TRIG_DEL] = wrtd_out_hash_table_remove,
[WRTD_OUT_ACTION_DISABLE] = wrtd_out_disable,
};
enum rt_slot_name {
......
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