Amit Pundir | d477f82 | 2020-02-07 22:26:08 +0530 | [diff] [blame] | 1 | #include <errno.h> |
| 2 | #include <string.h> |
| 3 | #include "qmi_rmtfs.h" |
| 4 | |
| 5 | struct qmi_elem_info rmtfs_qmi_result_ei[] = { |
| 6 | { |
| 7 | .data_type = QMI_UNSIGNED_2_BYTE, |
| 8 | .elem_len = 1, |
| 9 | .elem_size = sizeof(uint16_t), |
| 10 | .offset = offsetof(struct rmtfs_qmi_result, result), |
| 11 | }, |
| 12 | { |
| 13 | .data_type = QMI_UNSIGNED_2_BYTE, |
| 14 | .elem_len = 1, |
| 15 | .elem_size = sizeof(uint16_t), |
| 16 | .offset = offsetof(struct rmtfs_qmi_result, error), |
| 17 | }, |
| 18 | {} |
| 19 | }; |
| 20 | |
| 21 | struct qmi_elem_info rmtfs_iovec_entry_ei[] = { |
| 22 | { |
| 23 | .data_type = QMI_UNSIGNED_4_BYTE, |
| 24 | .elem_len = 1, |
| 25 | .elem_size = sizeof(uint32_t), |
| 26 | .offset = offsetof(struct rmtfs_iovec_entry, sector_addr), |
| 27 | }, |
| 28 | { |
| 29 | .data_type = QMI_UNSIGNED_4_BYTE, |
| 30 | .elem_len = 1, |
| 31 | .elem_size = sizeof(uint32_t), |
| 32 | .offset = offsetof(struct rmtfs_iovec_entry, phys_offset), |
| 33 | }, |
| 34 | { |
| 35 | .data_type = QMI_UNSIGNED_4_BYTE, |
| 36 | .elem_len = 1, |
| 37 | .elem_size = sizeof(uint32_t), |
| 38 | .offset = offsetof(struct rmtfs_iovec_entry, num_sector), |
| 39 | }, |
| 40 | {} |
| 41 | }; |
| 42 | |
| 43 | struct qmi_elem_info rmtfs_open_req_ei[] = { |
| 44 | { |
| 45 | .data_type = QMI_STRING, |
| 46 | .elem_len = 256, |
| 47 | .elem_size = sizeof(char), |
| 48 | .array_type = VAR_LEN_ARRAY, |
| 49 | .tlv_type = 1, |
| 50 | .offset = offsetof(struct rmtfs_open_req, path) |
| 51 | }, |
| 52 | {} |
| 53 | }; |
| 54 | |
| 55 | struct qmi_elem_info rmtfs_open_resp_ei[] = { |
| 56 | { |
| 57 | .data_type = QMI_STRUCT, |
| 58 | .elem_len = 1, |
| 59 | .elem_size = sizeof(struct rmtfs_qmi_result), |
| 60 | .tlv_type = 2, |
| 61 | .offset = offsetof(struct rmtfs_open_resp, result), |
| 62 | .ei_array = rmtfs_qmi_result_ei, |
| 63 | }, |
| 64 | { |
| 65 | .data_type = QMI_OPT_FLAG, |
| 66 | .elem_len = 1, |
| 67 | .elem_size = sizeof(bool), |
| 68 | .tlv_type = 16, |
| 69 | .offset = offsetof(struct rmtfs_open_resp, caller_id_valid), |
| 70 | }, |
| 71 | { |
| 72 | .data_type = QMI_UNSIGNED_4_BYTE, |
| 73 | .elem_len = 1, |
| 74 | .elem_size = sizeof(uint32_t), |
| 75 | .tlv_type = 16, |
| 76 | .offset = offsetof(struct rmtfs_open_resp, caller_id), |
| 77 | }, |
| 78 | {} |
| 79 | }; |
| 80 | |
| 81 | struct qmi_elem_info rmtfs_close_req_ei[] = { |
| 82 | { |
| 83 | .data_type = QMI_UNSIGNED_4_BYTE, |
| 84 | .elem_len = 1, |
| 85 | .elem_size = sizeof(uint32_t), |
| 86 | .tlv_type = 1, |
| 87 | .offset = offsetof(struct rmtfs_close_req, caller_id), |
| 88 | }, |
| 89 | {} |
| 90 | }; |
| 91 | |
| 92 | struct qmi_elem_info rmtfs_close_resp_ei[] = { |
| 93 | { |
| 94 | .data_type = QMI_STRUCT, |
| 95 | .elem_len = 1, |
| 96 | .elem_size = sizeof(struct rmtfs_qmi_result), |
| 97 | .tlv_type = 2, |
| 98 | .offset = offsetof(struct rmtfs_close_resp, result), |
| 99 | .ei_array = rmtfs_qmi_result_ei, |
| 100 | }, |
| 101 | {} |
| 102 | }; |
| 103 | |
| 104 | struct qmi_elem_info rmtfs_iovec_req_ei[] = { |
| 105 | { |
| 106 | .data_type = QMI_UNSIGNED_4_BYTE, |
| 107 | .elem_len = 1, |
| 108 | .elem_size = sizeof(uint32_t), |
| 109 | .tlv_type = 1, |
| 110 | .offset = offsetof(struct rmtfs_iovec_req, caller_id), |
| 111 | }, |
| 112 | { |
| 113 | .data_type = QMI_UNSIGNED_1_BYTE, |
| 114 | .elem_len = 1, |
| 115 | .elem_size = sizeof(uint8_t), |
| 116 | .tlv_type = 2, |
| 117 | .offset = offsetof(struct rmtfs_iovec_req, direction), |
| 118 | }, |
| 119 | { |
| 120 | .data_type = QMI_DATA_LEN, |
| 121 | .elem_len = 1, |
| 122 | .elem_size = sizeof(uint8_t), |
| 123 | .tlv_type = 3, |
| 124 | .offset = offsetof(struct rmtfs_iovec_req, iovec_len), |
| 125 | }, |
| 126 | { |
| 127 | .data_type = QMI_STRUCT, |
| 128 | .elem_len = 255, |
| 129 | .elem_size = sizeof(struct rmtfs_iovec_entry), |
| 130 | .array_type = VAR_LEN_ARRAY, |
| 131 | .tlv_type = 3, |
| 132 | .offset = offsetof(struct rmtfs_iovec_req, iovec), |
| 133 | .ei_array = rmtfs_iovec_entry_ei, |
| 134 | }, |
| 135 | { |
| 136 | .data_type = QMI_UNSIGNED_1_BYTE, |
| 137 | .elem_len = 1, |
| 138 | .elem_size = sizeof(uint8_t), |
| 139 | .tlv_type = 4, |
| 140 | .offset = offsetof(struct rmtfs_iovec_req, is_force_sync), |
| 141 | }, |
| 142 | {} |
| 143 | }; |
| 144 | |
| 145 | struct qmi_elem_info rmtfs_iovec_resp_ei[] = { |
| 146 | { |
| 147 | .data_type = QMI_STRUCT, |
| 148 | .elem_len = 1, |
| 149 | .elem_size = sizeof(struct rmtfs_qmi_result), |
| 150 | .tlv_type = 2, |
| 151 | .offset = offsetof(struct rmtfs_iovec_resp, result), |
| 152 | .ei_array = rmtfs_qmi_result_ei, |
| 153 | }, |
| 154 | {} |
| 155 | }; |
| 156 | |
| 157 | struct qmi_elem_info rmtfs_alloc_buf_req_ei[] = { |
| 158 | { |
| 159 | .data_type = QMI_UNSIGNED_4_BYTE, |
| 160 | .elem_len = 1, |
| 161 | .elem_size = sizeof(uint32_t), |
| 162 | .tlv_type = 1, |
| 163 | .offset = offsetof(struct rmtfs_alloc_buf_req, caller_id), |
| 164 | }, |
| 165 | { |
| 166 | .data_type = QMI_UNSIGNED_4_BYTE, |
| 167 | .elem_len = 1, |
| 168 | .elem_size = sizeof(uint32_t), |
| 169 | .tlv_type = 2, |
| 170 | .offset = offsetof(struct rmtfs_alloc_buf_req, buff_size), |
| 171 | }, |
| 172 | {} |
| 173 | }; |
| 174 | |
| 175 | struct qmi_elem_info rmtfs_alloc_buf_resp_ei[] = { |
| 176 | { |
| 177 | .data_type = QMI_STRUCT, |
| 178 | .elem_len = 1, |
| 179 | .elem_size = sizeof(struct rmtfs_qmi_result), |
| 180 | .tlv_type = 2, |
| 181 | .offset = offsetof(struct rmtfs_alloc_buf_resp, result), |
| 182 | .ei_array = rmtfs_qmi_result_ei, |
| 183 | }, |
| 184 | { |
| 185 | .data_type = QMI_OPT_FLAG, |
| 186 | .elem_len = 1, |
| 187 | .elem_size = sizeof(bool), |
| 188 | .tlv_type = 16, |
| 189 | .offset = offsetof(struct rmtfs_alloc_buf_resp, buff_address_valid), |
| 190 | }, |
| 191 | { |
| 192 | .data_type = QMI_UNSIGNED_8_BYTE, |
| 193 | .elem_len = 1, |
| 194 | .elem_size = sizeof(uint64_t), |
| 195 | .tlv_type = 16, |
| 196 | .offset = offsetof(struct rmtfs_alloc_buf_resp, buff_address), |
| 197 | }, |
| 198 | {} |
| 199 | }; |
| 200 | |
| 201 | struct qmi_elem_info rmtfs_dev_error_req_ei[] = { |
| 202 | { |
| 203 | .data_type = QMI_UNSIGNED_4_BYTE, |
| 204 | .elem_len = 1, |
| 205 | .elem_size = sizeof(uint32_t), |
| 206 | .tlv_type = 1, |
| 207 | .offset = offsetof(struct rmtfs_dev_error_req, caller_id), |
| 208 | }, |
| 209 | {} |
| 210 | }; |
| 211 | |
| 212 | struct qmi_elem_info rmtfs_dev_error_resp_ei[] = { |
| 213 | { |
| 214 | .data_type = QMI_STRUCT, |
| 215 | .elem_len = 1, |
| 216 | .elem_size = sizeof(struct rmtfs_qmi_result), |
| 217 | .tlv_type = 2, |
| 218 | .offset = offsetof(struct rmtfs_dev_error_resp, result), |
| 219 | .ei_array = rmtfs_qmi_result_ei, |
| 220 | }, |
| 221 | { |
| 222 | .data_type = QMI_OPT_FLAG, |
| 223 | .elem_len = 1, |
| 224 | .elem_size = sizeof(bool), |
| 225 | .tlv_type = 16, |
| 226 | .offset = offsetof(struct rmtfs_dev_error_resp, status_valid), |
| 227 | }, |
| 228 | { |
| 229 | .data_type = QMI_UNSIGNED_1_BYTE, |
| 230 | .elem_len = 1, |
| 231 | .elem_size = sizeof(uint8_t), |
| 232 | .tlv_type = 16, |
| 233 | .offset = offsetof(struct rmtfs_dev_error_resp, status), |
| 234 | }, |
| 235 | {} |
| 236 | }; |
| 237 | |
| 238 | struct qmi_elem_info rmtfs_force_sync_ei[] = { |
| 239 | { |
| 240 | .data_type = QMI_DATA_LEN, |
| 241 | .elem_len = 1, |
| 242 | .elem_size = sizeof(uint8_t), |
| 243 | .tlv_type = 1, |
| 244 | .offset = offsetof(struct rmtfs_force_sync, caller_id_len), |
| 245 | }, |
| 246 | { |
| 247 | .data_type = QMI_UNSIGNED_1_BYTE, |
| 248 | .elem_len = 10, |
| 249 | .elem_size = sizeof(uint32_t), |
| 250 | .array_type = VAR_LEN_ARRAY, |
| 251 | .tlv_type = 1, |
| 252 | .offset = offsetof(struct rmtfs_force_sync, caller_id), |
| 253 | }, |
| 254 | {} |
| 255 | }; |
| 256 | |