dsmi_passthru_mcu
Prototype
int dsmi_passthru_mcu(int device_id, struct passthru_message_stru *passthru_message)
Description
Transfers host information to the MCU through a device. The information constructed on the host is transmitted to a device, and then forwarded to the MCU.
For the Ascend 310 AI Processor, this API supports only standard PCIe cards.
Parameters
Parameter |
Input/Output |
Description |
---|---|---|
device_id |
Input |
Device ID For the Ascend 310 AI Processor, the value range is 0–63. Obtain the actual device ID by calling dsmi_list_device. Each standard PCIe card has four devices, but only one device is connected to the MCU at a time. Call dsmi_get_mini2mcu_heartbeat_status in advance to obtain the ID of the device in connect state, and pass the device ID to the dsmi_passthru_mcu call. |
passthru_message |
Input |
The message structure is as follows: struct passthru_message_stru{ unsigned int src_len; /*The message length is up to 32 bytes.*/ unsigned int rw_flag; /*0 read ,1 write*/ struct dmp_message_stru src_message; struct dmp_message_stru dest_message; }; |
Returns
Type |
Description |
---|---|
int |
0 on success; else, failure |
Restrictions
Run the caller application as the root user. Otherwise, a permission error is returned.
Example
int ret = 0; struct passthru_message_stru assthru_message = {0}; assthru_message.rw_flag = 1; assthru_message.src_len = sizeof(struct dmp_message_stru); assthru_message.src_message.data.req.opcode = 0x08; ... ret = dsmi_passthru_mcu(0,&assthru_message); if(ret != 0) { //To-do: records logs. return ret; } ...