/*! \file connection_fsm.c
* Copyright © 2004-2010 Mindspeed Technologies, Inc.
* Mindspeed Confidential.
* All rights reserved.
*
* This file is a component of the Mindspeed® VAPI software ("VAPI") and is
* distributed under the Mindspeed Software License Agreement (the "Agreement").
* Before using this file, you must agree to be bound by the the terms and conditions of
* the Agreement.
*/
#include"ut.h"
#include"vapi.h"
#include"dmgr.h"
#include"vcore.h"
#include"msp.h"
#include "vcore_voip.h"
#include "appitf.h"
extern SToneGeneric astToneGeneric_g[];
/****************************************************************************
* VFSM_CreateConnection : The function does the following things -
***************************************************************************/
/*!
* - Implementation
* -# Obtain the VAPI request node from the the channel structure.
* -# Check the state of the request usReqState\n
* -# Check the input GTL message (response) for SUCCESS.\n
* -# Send the MSP message according to current state using
* VCORE_SendMSPReq
* -# Update the current state. \n
* -#. Following MSP messages will be sent\n
* -# SPU_FEATURES_CONTROL\n
* -# SUPVSR_CREATE_CHANNEL\n
* -# VCEOPT\n
* -# ECHO_CANCEL\n
* -# JBOPT\n
* -# DGAIN\n
* -# DTMFOPT\n
* -# VOPENA - is sent by default\n
* It depends on the field\n
* stVAPIConfig_g.pstVoIPChnlParams->stVopena.uVoiceOperation status\n
* in global structure for default params SVAPIConfig stVAPIConfig_g.\n
* If it is set to VOIP_VOPENA_MODE_DISABLE (0x00) then VOPENA is ignored and\n
* not issued, else (>= 0x01) VOPENA command is issued.\n
* -# When new channel is created using SUPVSR_CREATE_CHANNEL\n
* -# Initialize it using VCORE_InitChannel\n
* -# Add the request to the new channel and remove it from
* Supervisory channel\n
* -# Launch the pending request on Supvisory channel\n
* -# All of the rest of MSP request are sent on the new channel\n
* -# When request is completed give a calback or signal request
* completion semaphore\n
*
* - Assumptions:\n
* -# Default Parameter settings are done by APPITF\n.
*
*
* \return None
*
* \param pstChnl Firstly this will be a supervisory channel on which
* calls to this processing function will have newly
* created channel as this parameter.
* \param pstMsg Message (response) obtained from GTL. When it is called
* by APPITF this is passed as NULL.
*/
VSTATUS VFSM_CreateConnection(IN SChnl * pstChnl, IN SVapiReq * pstVapiReq, IN U16 Event, IN gtl_msg_t * pstMsg)
{
gtl_msg_t *pstMsgMulti;
VSTATUS Status;
SVoIPChnlParams *pstChnlParams = NULL;
SChnl *pstSupvChnl;
SVapiReq *pstChildVapiReq;
CONNID ConnId = pstChnl->ConnId;
UT_Log(VCORE, DEBUG, "VFSM_CreateConnection: Entering conn(%u) state(%u) \n", ConnId, pstVapiReq->usReqState);
pstSupvChnl = DMGR_GetChannel(pstChnl->pstDev, SUPV_CHANNEL);
/*Take action according to current state of request */
switch (pstVapiReq->usReqState)
{
case CREATE_CONNECTION_INIT:
/* Check if the multi cmd mode is enabled (only for CSME and POS); if not get out */
if ((pstChnl->pstDev->eItfType != ePCI_ITF) && (!pstChnl->pstDev->bMultiCmdEnabled))
{
Status = VAPI_ERR_MULTI_CMD_NOT_INITIALIZED;
goto finish;
}
/* This allocate a new request */
pstChildVapiReq = VCORE_AllocateRequest(sizeof(SChnl *));
if (!pstChildVapiReq)
{
Status = VAPI_ERR_CREATECONN_FAIL;
goto finish;
}
/* User Data for child request is comming from the parent request */
UT_MemCopy(pstChildVapiReq->pvUserData, pstVapiReq->pvUserData, sizeof(SChnl *));
pstVapiReq->usReqState = CREATE_CONNECTION_CONFIG;
/* initialise the Child request
The UserData is the channelID used by the VFSM_CreateChannel handler */
VCORE_SetChildRequest(pstChildVapiReq, /* Child Request */
pstVapiReq, /* Parent Request */
VFSM_CreateChannel, /* Child Request Handler */
CREATE_CHANNEL_INIT); /* Child Request handler state */
/* process request in the supervisor channel */
VCORE_ProcessRequest(pstSupvChnl, pstChildVapiReq);
break;
case CREATE_CONNECTION_CONFIG:
/* retrieve the child status */
Status = pstVapiReq->Status;
if (Status != SUCCESS)
goto finish;
/* The device channel now exists.
add the connection structure to the AVL tree
The channel ID has been added to the device array by VFSM_CreateChannel*/
Status = VCORE_AddConnection(pstChnl);
if (Status != SUCCESS)
{
Status = VAPI_ERR_NOMEM;
goto finish;
}
/* from here new requests can be posted to the connection */
UT_Log(VCORE, DEBUG, "VFSM_CreateConnection: Device channel(%u) created on dev(%u) conn(%u) pstChnl 0x%x\n",
pstChnl->usMSPChnlId, pstChnl->pstDev->DevId, ConnId, pstChnl);
/* Now initialize the channel */
pstVapiReq->usReqState = CREATE_CONNECTION_FINISHED;
switch (pstChnl->usConnType)
{
case eVOIP:
pstChnlParams = (SVoIPChnlParams *) pstChnl->pvChnlParams;;
pstMsgMulti = UT_Calloc(1, sizeof(gtl_msg_t));
if (pstMsgMulti == NULL)
{
Status = VAPI_ERR_NOMEM;
goto finish;
}
pstMsgMulti->fifo = UT_Calloc(1, pstSupvChnl->pstDev->MaxMsgSize); /* alloc the max fifo length */
if (pstMsgMulti->fifo == NULL)
{
UT_FreeMem(pstMsgMulti);
Status = VAPI_ERR_NOMEM;
goto finish;
}
/* init msg fields to defautl values*/
VCORE_InitMsg(pstMsgMulti, pstMsgMulti->fifo, pstSupvChnl->pstDev->MaxMsgSize);
/*Add VCEOPT with packet generation disabled */
Status = VDEV_SetVceopt(pstMsgMulti, &(pstChnlParams->stVoiceOpt));
if (Status != SUCCESS)
goto finish_err;
/*Add ECHO CANCELER depending on choseen option */
if ( (pstChnl->pstDev->usSpuFeatureMask & SPU_FEATURE_DFEC_MASK) == SPU_FEATURE_DFEC_MASK )
{
Status = VDEV_SetVoipDfeCancel(pstMsgMulti, &(pstChnlParams->stDfeCan));
}
else
{
Status = VDEV_SetVoipEchoCancel(pstMsgMulti, &(pstChnlParams->stEchoCan));
}
if (Status != SUCCESS)
goto finish_err;
/*Add Jitter buffer Option */
Status = VDEV_SetVoipJbopt(pstMsgMulti, &(pstChnlParams->stJbopt));
if (Status != SUCCESS)
goto finish_err;
/*Add DGAIN */
Status = VDEV_SetVoipDgain(pstMsgMulti, &(pstChnlParams->stDgain));
if (Status != SUCCESS)
goto finish_err;
/*Add Tone control */
Status = VDEV_SetToneCtrlOpt(pstMsgMulti, &(pstChnlParams->stToneCtrl));
if (Status != SUCCESS)
goto finish_err;
/*Add DTMFOPT */
Status = VDEV_SetVoipDtmfOpt(pstMsgMulti, &(pstChnlParams->stDtmfOpt));
if (Status != SUCCESS)
goto finish_err;
/*Add Tonerelay */
Status = VDEV_SetToneRelayOpt(pstMsgMulti, &(pstChnlParams->stToneRelay));
if (Status != SUCCESS)
goto finish_err;
/*Add VOPENA */
if (pstChnlParams->stVopena.mode == VOIP_VOPENA_MODE_ENABLE_RTP)
{
Status = VDEV_SetVoipVopena(pstMsgMulti, &(pstChnlParams->stVopena));
if (Status != SUCCESS)
goto finish_err;
}
pstVapiReq->pvExecData = pstMsgMulti; /* Save the multilist structure */
pstMsgMulti->channel = pstChnl->usMSPChnlId;
VCORE_SendMSPReq(pstChnl, pstMsgMulti);
break;
case eFOIP:
pstMsgMulti = UT_Calloc(1, sizeof(gtl_msg_t));
if (pstMsgMulti == NULL)
{
Status = VAPI_ERR_NOMEM;
goto finish;
}
pstMsgMulti->fifo = UT_Calloc(1, pstSupvChnl->pstDev->MaxMsgSize); /* alloc the max fifo length */
if (pstMsgMulti->fifo == NULL)
{
UT_FreeMem(pstMsgMulti);
Status = VAPI_ERR_NOMEM;
goto finish;
}
/* init msg fields to defautl values*/
VCORE_InitMsg(pstMsgMulti, pstMsgMulti->fifo, pstSupvChnl->pstDev->MaxMsgSize);
/* send the following commands */
/* Send FAXOPTS */
Statu
MindSpeed c300v2 开发,包括硬件与开发套件
需积分: 0 139 浏览量
更新于2023-07-30
收藏 799KB GZ 举报
MindSpeed c300v2 是一款针对通信和网络应用设计的高性能处理器,它在嵌入式系统领域中被广泛使用。这款处理器以其强大的处理能力、低功耗和灵活的架构而著称,适合用于构建复杂的通信设备和网络基础设施。在进行MindSpeed c300v2 的开发时,通常会涉及到以下几个关键知识点:
1. **处理器架构**:MindSpeed c300v2 采用多核架构,可能包含多个处理核心,每个核心可能支持多线程,以提高并发处理能力。了解其内部结构、核心数量、缓存层次以及指令集对于优化程序性能至关重要。
2. **硬件接口**:开发过程中,开发者需要熟悉处理器与外部硬件设备(如内存、I/O 接口、网络接口等)的交互方式,包括总线协议、中断处理机制、DMA(直接存储器访问)等。
3. **开发环境**:建立一个完整的开发环境是开发的第一步,这通常包括交叉编译工具链、调试器、操作系统支持(如Linux内核移植)、库文件和驱动程序。例如,使用特定版本的vapi(虚拟API)库文件(如vapi-2.16.0-candidate1)进行开发。
4. **软件开发套件(SDK)**:MindSpeed c300v2 开发套件通常包括驱动程序、示例代码、API文档和开发工具。这些资源帮助开发者理解和利用处理器的功能,快速搭建和测试应用程序。
5. **编程模型**:理解如何在多核处理器上有效地分配任务和数据,是实现高效并行计算的关键。这涉及线程管理、同步机制、内存一致性模型等方面的知识。
6. **性能优化**:针对MindSpeed c300v2 的特定特性和性能指标,开发者需要学习如何编写高效的代码,如利用SIMD(单指令多数据)指令、避免不必要的内存访问、优化循环结构等。
7. **调试技术**:在开发过程中,使用合适的调试工具和技巧来定位和解决错误至关重要。这可能包括GDB远程调试、日志分析和性能分析工具。
8. **网络协议栈**:由于MindSpeed c300v2 常用于网络设备,因此开发者需要熟悉TCP/IP协议栈,包括网络层、传输层和应用层协议,以及如何在处理器上实现这些协议。
9. **电源管理**:对于低功耗设计,了解如何通过动态电压频率调整(DVFS)和其他电源管理技术来控制处理器功耗是必要的。
10. **实时操作系统(RTOS)支持**:如果应用需要硬实时性,开发者还需要研究RTOS的选型和集成,如FreeRTOS或VxWorks,并了解如何配置调度策略以满足实时性需求。
MindSpeed c300v2 的开发涵盖了从硬件接口到软件优化的多个层面,要求开发者具备扎实的嵌入式系统知识、编程技能以及对通信协议和硬件平台的深入理解。通过使用提供的开发套件和vapi库,可以加速开发进程,实现高效的应用程序。
dudechao2000
- 粉丝: 0
- 资源: 1
最新资源
- 7.win10下的页表基址.mp4
- 8.通过页表基址修改页属性.mp4
- 若依WebSocket集成
- 2336100053_盛资涵_中国互联网络发展状况统计报告数据.pdf
- 得利捷固定式相机调试软件dl.code-1.9.2
- feagregraeharhrthtrjuyl7l87l78
- AM信号产生及检波电路(高频电子线路仿真作业)
- ISC全覆盖算法有障碍物情况
- Java毕设项目:基于spring+mybatis+maven+mysql实现的网上点餐系统分前后台【含源码+数据库+毕业论文】
- 3568开发资料用户手册
- asdgaggrgaeaaavrg
- vision-results.zip
- Spring Boot框架下的权限管理与工作流开发平台系统实现
- 基于卷积神经网络的MNIST手写数字识别
- 前端分析-2023071100789
- 软件开发汇报-中国海洋大学22届学生陈宇杰