MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mc_send_command

Function mc_send_command

dpdk/drivers/bus/fslmc/mc/mc_sys.c:55–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53}
54
55int mc_send_command(struct fsl_mc_io *mc_io, struct mc_command *cmd)
56{
57 enum mc_cmd_status status;
58 uint64_t response, start_time, total_time, time_to_wait;
59
60 if (!mc_io || !mc_io->regs)
61 return -EACCES;
62
63 /* --- Call lock function here in case portal is shared --- */
64 rte_spinlock_lock(&mc_portal_lock);
65
66 mc_write_command(mc_io->regs, cmd);
67
68 /* Wait for one second. rte_get_timer_hz() returns frequency of CPU */
69 time_to_wait = rte_get_timer_hz();
70 total_time = 0;
71 start_time = rte_get_timer_cycles();
72
73 /* Spin until status changes */
74 do {
75 response = ioread64(mc_io->regs);
76 status = mc_cmd_read_status((struct mc_command *)&response);
77 total_time = rte_get_timer_cycles() - start_time;
78 } while (status == MC_CMD_STATUS_READY && total_time <= time_to_wait);
79
80 if (status == MC_CMD_STATUS_READY) {
81 rte_spinlock_unlock(&mc_portal_lock);
82
83 return mc_status_to_error(MC_CMD_STATUS_TIMEOUT);
84 }
85
86 /* Read the response back into the command buffer */
87 mc_read_response(mc_io->regs, cmd);
88
89 /* --- Call unlock function here in case portal is shared --- */
90 rte_spinlock_unlock(&mc_portal_lock);
91
92 return mc_status_to_error(status);
93}

Callers 15

dpseci_openFunction · 0.85
dpseci_closeFunction · 0.85
dpseci_createFunction · 0.85
dpseci_destroyFunction · 0.85
dpseci_enableFunction · 0.85
dpseci_disableFunction · 0.85
dpseci_is_enabledFunction · 0.85
dpseci_resetFunction · 0.85
dpseci_get_attributesFunction · 0.85
dpseci_set_rx_queueFunction · 0.85
dpseci_get_rx_queueFunction · 0.85
dpseci_get_tx_queueFunction · 0.85

Calls 6

mc_write_commandFunction · 0.85
mc_cmd_read_statusFunction · 0.85
mc_status_to_errorFunction · 0.85
mc_read_responseFunction · 0.85
rte_spinlock_lockFunction · 0.50
rte_spinlock_unlockFunction · 0.50

Tested by

no test coverage detected