* dpdmai_open() - Open a control session for the specified object * @mc_io: Pointer to MC portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @dpdmai_id: DPDMAI unique ID * @token: Returned token; use in subsequent API calls * * This function can be used to open a control session for an * already created object; an object may have been declared in * the DPL or
| 25 | * Return: '0' on Success; Error code otherwise. |
| 26 | */ |
| 27 | int dpdmai_open(struct fsl_mc_io *mc_io, |
| 28 | uint32_t cmd_flags, |
| 29 | int dpdmai_id, |
| 30 | uint16_t *token) |
| 31 | { |
| 32 | struct dpdmai_cmd_open *cmd_params; |
| 33 | struct mc_command cmd = { 0 }; |
| 34 | int err; |
| 35 | |
| 36 | /* prepare command */ |
| 37 | cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_OPEN, |
| 38 | cmd_flags, |
| 39 | 0); |
| 40 | cmd_params = (struct dpdmai_cmd_open *)cmd.params; |
| 41 | cmd_params->dpdmai_id = cpu_to_le32(dpdmai_id); |
| 42 | |
| 43 | /* send command to mc*/ |
| 44 | err = mc_send_command(mc_io, &cmd); |
| 45 | if (err) |
| 46 | return err; |
| 47 | |
| 48 | /* retrieve response parameters */ |
| 49 | *token = mc_cmd_hdr_read_token(&cmd); |
| 50 | |
| 51 | return 0; |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * dpdmai_close() - Close the control session of the object |
no test coverage detected