PACKET_BufHandle_t RPC_PACKET_AllocateBufferEx(PACKET_InterfaceType_t interfaceType, UInt32 requiredSize, UInt8 channel, UInt32 waitTime) { int index = -1; IPC_Buffer bufHandle = 0; //Determine the pool index for the interface if( interfaceType == INTERFACE_PACKET) { index = 0;//All channels use the same buffer pool } else { for(index=0; index < MAX_CHANNELS; index++) { if(ipcBufList[interfaceType].pkt_size[index] >= requiredSize) break; } if(index >= MAX_CHANNELS) { _DBG_(RPC_TRACE("RPC_PACKET_AllocateBuffer itype=%d invalid channel %d\r\n",interfaceType, index)); return NULL; } } //Create the pool om demand if(ipcInfoList[interfaceType].ipc_buf_pool[index] == 0) RPC_CreateBufferPool(interfaceType, index); if(interfaceType == INTERFACE_PACKET && DETAIL_DATA_LOG_ENABLED) _DBG_(RPC_TRACE_DATA_DETAIL("RPC_PACKET_AllocateBuffer(%c) PKT BEFORE %d\r\n",(gRpcProcType == RPC_COMMS)?'C':'A',requiredSize)); if(waitTime == PKT_ALLOC_NOWAIT) bufHandle = IPC_AllocateBuffer(ipcInfoList[interfaceType].ipc_buf_pool[index]); else bufHandle = IPC_AllocateBufferWait(ipcInfoList[interfaceType].ipc_buf_pool[index], waitTime); if(interfaceType == INTERFACE_PACKET && DETAIL_DATA_LOG_ENABLED) _DBG_(RPC_TRACE_DATA_DETAIL("RPC_PACKET_AllocateBuffer(%c) PKT AFTER %d\r\n",(gRpcProcType == RPC_COMMS)?'C':'A',requiredSize)); if(0 == bufHandle) { _DBG_(RPC_TRACE("RPC_PACKET_AllocateBuffer failed %d, %d, %d\r\n", interfaceType, requiredSize, index)); } if(bufHandle) IPC_BufferSetDataSize(bufHandle, requiredSize); return (PACKET_BufHandle_t)bufHandle; }
int brcm_ipc_aud_control_send(const void * const buff, UInt32 len) { IPC_Buffer buffer; buffer = IPC_AllocateBuffer(brcm_ApAudioPool); if (buffer) { if (0 == (IPC_BufferSetDataSize(buffer, len))) { return 1; } memcpy(IPC_BufferDataPointer(buffer), buff, len); IPC_SendBuffer(buffer, IPC_PRIORITY_DEFAULT); } else { pr_info(__AUD"IPC_AudioControlSend: Pool Empty\n"); return 1; } return 0; }
void RPC_PACKET_SetBufferLength(PACKET_BufHandle_t dataBufHandle, UInt32 bufferSize) { IPC_BufferSetDataSize((IPC_Buffer) dataBufHandle, bufferSize); }