diff options
author | Justin Sobota | 2015-05-07 17:18:54 -0500 |
---|---|---|
committer | Justin Sobota | 2015-05-07 17:18:54 -0500 |
commit | 65de08e305d5c297e644d2b3529f5cb81ddf8940 (patch) | |
tree | bd52f8e1ae40c062f573ff3ae9dbcf7bcca018ae | |
parent | 34b0934c0a0a5d0a4d9a2cbfae8268bff023b6a2 (diff) | |
download | mpm-transport-65de08e305d5c297e644d2b3529f5cb81ddf8940.tar.gz mpm-transport-65de08e305d5c297e644d2b3529f5cb81ddf8940.tar.xz mpm-transport-65de08e305d5c297e644d2b3529f5cb81ddf8940.zip |
mpm_transport_qmss: Fixed infrastructure dma allocation logic. Was causing failure when sending to DSP version of TransportQmss
-rw-r--r-- | src/transport/qmss/mpm_transport_qmss.c | 49 | ||||
-rw-r--r-- | src/transport/qmss/mpm_transport_qmss.h | 4 | ||||
-rw-r--r-- | src/transport/qmss/mpm_transport_qmss_interface.c | 94 | ||||
-rw-r--r-- | src/transport/qmss/mpm_transport_qmss_interface.h | 5 |
4 files changed, 103 insertions, 49 deletions
diff --git a/src/transport/qmss/mpm_transport_qmss.c b/src/transport/qmss/mpm_transport_qmss.c index fd382d7..13fd382 100644 --- a/src/transport/qmss/mpm_transport_qmss.c +++ b/src/transport/qmss/mpm_transport_qmss.c | |||
@@ -202,8 +202,6 @@ int mpm_transport_qmss_open(mpm_transport_cfg_t *sp, mpm_transport_open_t *ocfg) | |||
202 | { | 202 | { |
203 | mpm_transport_qmss_t *td = (mpm_transport_qmss_t *) sp->td; | 203 | mpm_transport_qmss_t *td = (mpm_transport_qmss_t *) sp->td; |
204 | uint8_t isAllocated; | 204 | uint8_t isAllocated; |
205 | Cppi_TxChInitCfg txChCfg; | ||
206 | Cppi_RxChInitCfg rxChCfg; | ||
207 | Cppi_RxFlowCfg rxFlowCfg; | 205 | Cppi_RxFlowCfg rxFlowCfg; |
208 | Qmss_Queue queInfo; | 206 | Qmss_Queue queInfo; |
209 | 207 | ||
@@ -215,34 +213,11 @@ int mpm_transport_qmss_open(mpm_transport_cfg_t *sp, mpm_transport_open_t *ocfg) | |||
215 | 213 | ||
216 | mpm_printf(2, "mpm_transport_qmss_open(): opened qpend %d\n", td->rxqHnd); | 214 | mpm_printf(2, "mpm_transport_qmss_open(): opened qpend %d\n", td->rxqHnd); |
217 | 215 | ||
218 | /* Set up Tx Channel parameters */ | 216 | if (mpm_transport_qmss_open_infra_triplet(td->cppiHnd, &(td->txChHnd), |
219 | memset ((void *) &txChCfg, 0, sizeof (Cppi_TxChInitCfg)); | 217 | &(td->rxChHnd), &(td->txqHnd)) < 0) |
220 | |||
221 | txChCfg.channelNum = CPPI_PARAM_NOT_SPECIFIED; | ||
222 | txChCfg.priority = 0; | ||
223 | txChCfg.filterEPIB = 0; | ||
224 | txChCfg.filterPS = 0; | ||
225 | txChCfg.aifMonoMode = 0; | ||
226 | txChCfg.txEnable = Cppi_ChState_CHANNEL_DISABLE; | ||
227 | |||
228 | /* Open Tx Channel (specific number doesn't matter) */ | ||
229 | td->txChHnd = (Cppi_ChHnd) Cppi_txChannelOpen (td->cppiHnd, &txChCfg, &isAllocated); | ||
230 | if (td->txChHnd == NULL) | ||
231 | { | ||
232 | mpm_printf(1, "mpm_transport_qmss_open(): Error opening Tx channel\n"); | ||
233 | return -1; | ||
234 | } | ||
235 | |||
236 | /* Set up Rx Channel parameters */ | ||
237 | memset ((void *) &rxChCfg, 0, sizeof (Cppi_RxChInitCfg)); | ||
238 | rxChCfg.channelNum = CPPI_PARAM_NOT_SPECIFIED; | ||
239 | rxChCfg.rxEnable = Cppi_ChState_CHANNEL_DISABLE; | ||
240 | |||
241 | /* Open Rx Channel (specific number doesn't matter) */ | ||
242 | td->rxChHnd = (Cppi_ChHnd) Cppi_rxChannelOpen (td->cppiHnd, &rxChCfg, &isAllocated); | ||
243 | if (td->rxChHnd == NULL) | ||
244 | { | 218 | { |
245 | mpm_printf(1, "mpm_transport_qmss_open(): Error opening Rx channel\n"); | 219 | mpm_printf(1, "mpm_transport_qmss_open(): " |
220 | "Error when allocating the QMSS infrastructure triplet\n"); | ||
246 | return -1; | 221 | return -1; |
247 | } | 222 | } |
248 | 223 | ||
@@ -330,11 +305,14 @@ void mpm_transport_qmss_close(mpm_transport_cfg_t *sp) | |||
330 | Cppi_close(td->cppiHnd); | 305 | Cppi_close(td->cppiHnd); |
331 | 306 | ||
332 | mpm_printf(2,"mpm_transport_qmss_close(): Exit queue count for td->txFqHnd: %d\n",Qmss_getQueueEntryCount(td->txFqHnd)); | 307 | mpm_printf(2,"mpm_transport_qmss_close(): Exit queue count for td->txFqHnd: %d\n",Qmss_getQueueEntryCount(td->txFqHnd)); |
308 | mpm_printf(2,"mpm_transport_qmss_close(): Exit queue count for td->txqHnd: %d\n",Qmss_getQueueEntryCount(td->txqHnd)); | ||
333 | mpm_printf(2,"mpm_transport_qmss_close(): Exit queue count for td->rxFqHnd: %d\n",Qmss_getQueueEntryCount(td->rxFqHnd)); | 309 | mpm_printf(2,"mpm_transport_qmss_close(): Exit queue count for td->rxFqHnd: %d\n",Qmss_getQueueEntryCount(td->rxFqHnd)); |
334 | mpm_printf(2,"mpm_transport_qmss_close(): Exit queue count for td->rxqHnd: %d\n",Qmss_getQueueEntryCount(td->rxqHnd)); | 310 | mpm_printf(2,"mpm_transport_qmss_close(): Exit queue count for td->rxqHnd: %d\n",Qmss_getQueueEntryCount(td->rxqHnd)); |
335 | Qmss_queueEmpty(td->txFqHnd); | 311 | Qmss_queueEmpty(td->txFqHnd); |
312 | Qmss_queueEmpty(td->txqHnd); | ||
336 | Qmss_queueEmpty(td->rxFqHnd); | 313 | Qmss_queueEmpty(td->rxFqHnd); |
337 | Qmss_queueClose(td->txFqHnd); | 314 | Qmss_queueClose(td->txFqHnd); |
315 | Qmss_queueClose(td->txqHnd); | ||
338 | Qmss_queueClose(td->rxFqHnd); | 316 | Qmss_queueClose(td->rxFqHnd); |
339 | Qmss_queueClose(td->rxqHnd); | 317 | Qmss_queueClose(td->rxqHnd); |
340 | 318 | ||
@@ -363,7 +341,6 @@ int mpm_transport_qmss_packet_send(mpm_transport_cfg_t *sp, char **buf, int *len | |||
363 | int ret = 0; | 341 | int ret = 0; |
364 | uint32_t buffLen; | 342 | uint32_t buffLen; |
365 | uint8_t *tempBuf; | 343 | uint8_t *tempBuf; |
366 | Qmss_QueueHnd txQueHnd; | ||
367 | Cppi_DescTag tag; | 344 | Cppi_DescTag tag; |
368 | packet_send_buffer_opt bufferOption; | 345 | packet_send_buffer_opt bufferOption; |
369 | 346 | ||
@@ -414,13 +391,6 @@ int mpm_transport_qmss_packet_send(mpm_transport_cfg_t *sp, char **buf, int *len | |||
414 | Cppi_setData(Cppi_DescType_HOST, desc, (uint8_t *) (*buf), *len); | 391 | Cppi_setData(Cppi_DescType_HOST, desc, (uint8_t *) (*buf), *len); |
415 | } | 392 | } |
416 | 393 | ||
417 | /* Opens transmit queue. This is the infrastructure queue associated with the txChannel */ | ||
418 | if ((txQueHnd = mpm_transport_qmss_get_infra_handle(flow_id)) < 0) | ||
419 | { | ||
420 | mpm_printf(1, "mpm_transport_qmss_packet_send(): error opening infrastructure queue\n"); | ||
421 | return -1; | ||
422 | } | ||
423 | |||
424 | /* Set tag information - this selects the flow */ | 394 | /* Set tag information - this selects the flow */ |
425 | tag.destTagLo = 0; | 395 | tag.destTagLo = 0; |
426 | tag.destTagHi = 0; | 396 | tag.destTagHi = 0; |
@@ -432,10 +402,7 @@ int mpm_transport_qmss_packet_send(mpm_transport_cfg_t *sp, char **buf, int *len | |||
432 | /* Set packet length */ | 402 | /* Set packet length */ |
433 | Cppi_setPacketLen (Cppi_DescType_HOST, desc, td->txBufSize); | 403 | Cppi_setPacketLen (Cppi_DescType_HOST, desc, td->txBufSize); |
434 | 404 | ||
435 | Qmss_queuePushDescSize (txQueHnd, (uint32_t *) desc, td->txDescSize); | 405 | Qmss_queuePushDescSize (td->txqHnd, (uint32_t *) desc, td->txDescSize); |
436 | |||
437 | /* Close the infrastructure queue */ | ||
438 | Qmss_queueClose(txQueHnd); | ||
439 | 406 | ||
440 | /* Return information to user if necessary */ | 407 | /* Return information to user if necessary */ |
441 | if ( (bufferOption == packet_send_MEMCPY_BUFFER) || (bufferOption == packet_send_BUFFER_DEFAULT)) { | 408 | if ( (bufferOption == packet_send_MEMCPY_BUFFER) || (bufferOption == packet_send_BUFFER_DEFAULT)) { |
diff --git a/src/transport/qmss/mpm_transport_qmss.h b/src/transport/qmss/mpm_transport_qmss.h index 1d477d9..77d4321 100644 --- a/src/transport/qmss/mpm_transport_qmss.h +++ b/src/transport/qmss/mpm_transport_qmss.h | |||
@@ -61,6 +61,10 @@ typedef struct mpm_transport_qmss_tag { | |||
61 | Descriptors are used for sending */ | 61 | Descriptors are used for sending */ |
62 | Qmss_QueueHnd txFqHnd; | 62 | Qmss_QueueHnd txFqHnd; |
63 | 63 | ||
64 | /* Transmit handle, to send descriptors to remote | ||
65 | flows */ | ||
66 | Qmss_QueueHnd txqHnd; | ||
67 | |||
64 | /* Name for the RX free queue handle | 68 | /* Name for the RX free queue handle |
65 | To be requested from RM */ | 69 | To be requested from RM */ |
66 | char rxFqName[MPM_MAX_NAME_LENGTH]; | 70 | char rxFqName[MPM_MAX_NAME_LENGTH]; |
diff --git a/src/transport/qmss/mpm_transport_qmss_interface.c b/src/transport/qmss/mpm_transport_qmss_interface.c index a43b0c5..36e6a85 100644 --- a/src/transport/qmss/mpm_transport_qmss_interface.c +++ b/src/transport/qmss/mpm_transport_qmss_interface.c | |||
@@ -320,12 +320,6 @@ int mpm_transport_open_cppi_qmss_cpdma(Cppi_Handle *cHnd, uint8_t cppiWriteFifoD | |||
320 | return 0; | 320 | return 0; |
321 | } | 321 | } |
322 | 322 | ||
323 | Qmss_QueueHnd mpm_transport_qmss_get_infra_handle(uint32_t id) | ||
324 | { | ||
325 | uint8_t isAllocated; | ||
326 | return Qmss_queueOpen (Qmss_QueueType_INFRASTRUCTURE_QUEUE, QMSS_INFRASTRUCTURE_QUEUE_BASE + id, &isAllocated); | ||
327 | } | ||
328 | |||
329 | int mpm_transport_qmss_open_qpend_and_fd(const char *basename, Qmss_QueueHnd *rxQueueHnd) | 323 | int mpm_transport_qmss_open_qpend_and_fd(const char *basename, Qmss_QueueHnd *rxQueueHnd) |
330 | { | 324 | { |
331 | struct dirent *entry = 0; | 325 | struct dirent *entry = 0; |
@@ -403,4 +397,90 @@ close_n_exit: | |||
403 | } | 397 | } |
404 | 398 | ||
405 | return ret_val; | 399 | return ret_val; |
406 | } \ No newline at end of file | 400 | } |
401 | |||
402 | /* CPPI TX ch, RX ch, and infrastructure queue form a triplet that must | ||
403 | * be allocated together based on the same value */ | ||
404 | int mpm_transport_qmss_open_infra_triplet(Cppi_Handle cppiHnd, | ||
405 | Cppi_ChHnd *pTxChHnd, | ||
406 | Cppi_ChHnd *pRxChHnd, | ||
407 | Qmss_QueueHnd *pTxQHnd) | ||
408 | { | ||
409 | Qmss_QueueHnd tmpTxQ; | ||
410 | Cppi_ChHnd tmpTxCh; | ||
411 | Cppi_ChHnd tmpRxCh; | ||
412 | Cppi_TxChInitCfg txChCfg; | ||
413 | Cppi_RxChInitCfg rxChCfg; | ||
414 | Qmss_QueueHnd *invTrip = NULL; | ||
415 | int invIdx; | ||
416 | uint32_t isAllocated; | ||
417 | int foundTriplet; | ||
418 | int i; | ||
419 | int ret_val = -1; | ||
420 | |||
421 | /* Init array where invalid triplets are stored. Invalid triplets will be | ||
422 | * freed once a valid triplet is found */ | ||
423 | invTrip = (Qmss_QueueHnd *)malloc(QMSS_MAX_INFRASTRUCTURE_QUEUE * | ||
424 | sizeof(Qmss_QueueHnd)); | ||
425 | memset(invTrip, 0, QMSS_MAX_INFRASTRUCTURE_QUEUE * sizeof(Qmss_QueueHnd)); | ||
426 | invIdx = 0; | ||
427 | |||
428 | foundTriplet = 0; | ||
429 | while(!foundTriplet) { | ||
430 | /* Open the Tx infrastructure queue. Should be offset from infrastructure | ||
431 | * queue base using the CPPI tx channel number */ | ||
432 | tmpTxQ = Qmss_queueOpen(Qmss_QueueType_INFRASTRUCTURE_QUEUE, | ||
433 | QMSS_PARAM_NOT_SPECIFIED, | ||
434 | (uint8_t *)&isAllocated); | ||
435 | if (tmpTxQ < 0) { | ||
436 | goto triplet_error; | ||
437 | } | ||
438 | |||
439 | memset((void *)&txChCfg, 0, sizeof(txChCfg)); | ||
440 | txChCfg.channelNum = Qmss_getQIDFromHandle(tmpTxQ) - | ||
441 | QMSS_INFRASTRUCTURE_QUEUE_BASE; | ||
442 | txChCfg.priority = 0; | ||
443 | txChCfg.filterEPIB = 0; | ||
444 | txChCfg.filterPS = 0; | ||
445 | txChCfg.aifMonoMode = 0; | ||
446 | txChCfg.txEnable = Cppi_ChState_CHANNEL_DISABLE; | ||
447 | tmpTxCh = (uint32_t *)Cppi_txChannelOpen(cppiHnd, &txChCfg, | ||
448 | (uint8_t *)&isAllocated); | ||
449 | if (tmpTxCh == NULL) { | ||
450 | invTrip[invIdx++] = tmpTxQ; | ||
451 | /* Try to get next triplet */ | ||
452 | continue; | ||
453 | } | ||
454 | |||
455 | memset((void *)&rxChCfg, 0, sizeof(rxChCfg)); | ||
456 | rxChCfg.channelNum = Qmss_getQIDFromHandle(tmpTxQ) - | ||
457 | QMSS_INFRASTRUCTURE_QUEUE_BASE; | ||
458 | rxChCfg.rxEnable = Cppi_ChState_CHANNEL_DISABLE; | ||
459 | tmpRxCh = (uint32_t *)Cppi_rxChannelOpen(cppiHnd, &rxChCfg, | ||
460 | (uint8_t *)&isAllocated); | ||
461 | if (tmpRxCh == NULL) { | ||
462 | Cppi_channelClose(tmpTxCh); | ||
463 | invTrip[invIdx++] = tmpTxQ; | ||
464 | /* Try to get next triplet */ | ||
465 | continue; | ||
466 | } | ||
467 | /* Found a triplet if got here */ | ||
468 | foundTriplet = 1; | ||
469 | } | ||
470 | |||
471 | /* Save triplet */ | ||
472 | *pTxQHnd = tmpTxQ; | ||
473 | *pTxChHnd = tmpTxCh; | ||
474 | *pRxChHnd = tmpRxCh; | ||
475 | |||
476 | ret_val = 0; | ||
477 | |||
478 | triplet_error: | ||
479 | /* Free unused triplets */ | ||
480 | for (i = 0; i < invIdx; i++) { | ||
481 | Qmss_queueClose(invTrip[i]); | ||
482 | } | ||
483 | free(invTrip); | ||
484 | |||
485 | return(ret_val); | ||
486 | } | ||
diff --git a/src/transport/qmss/mpm_transport_qmss_interface.h b/src/transport/qmss/mpm_transport_qmss_interface.h index eaf00a2..bd5dba1 100644 --- a/src/transport/qmss/mpm_transport_qmss_interface.h +++ b/src/transport/qmss/mpm_transport_qmss_interface.h | |||
@@ -119,7 +119,10 @@ typedef struct mpm_transport_qmss_mem_region_info_tag { | |||
119 | int mpm_transport_open_cppi_qmss_cpdma(Cppi_Handle *cHnd, uint8_t cppiWriteFifoDepth, uint16_t cppiTimeoutCount); | 119 | int mpm_transport_open_cppi_qmss_cpdma(Cppi_Handle *cHnd, uint8_t cppiWriteFifoDepth, uint16_t cppiTimeoutCount); |
120 | int32_t mpm_transport_init_qm(mpm_transport_cfg_t *sp, int maxDescNum); | 120 | int32_t mpm_transport_init_qm(mpm_transport_cfg_t *sp, int maxDescNum); |
121 | int32_t mpm_transport_init_cppi(mpm_transport_cfg_t *sp); | 121 | int32_t mpm_transport_init_cppi(mpm_transport_cfg_t *sp); |
122 | Qmss_QueueHnd mpm_transport_qmss_get_infra_handle(uint32_t id); | ||
123 | int mpm_transport_qmss_open_qpend_and_fd(const char *basename, Qmss_QueueHnd *rxQueueHnd); | 122 | int mpm_transport_qmss_open_qpend_and_fd(const char *basename, Qmss_QueueHnd *rxQueueHnd); |
123 | int mpm_transport_qmss_open_infra_triplet(Cppi_Handle cppiHnd, | ||
124 | Cppi_ChHnd *pTxChHnd, | ||
125 | Cppi_ChHnd *pRxChHnd, | ||
126 | Qmss_QueueHnd *pTxQHnd); | ||
124 | 127 | ||
125 | #endif \ No newline at end of file | 128 | #endif \ No newline at end of file |