RDK中的Vps_printf()与Vps_rprintf()
来源:互联网 发布:c语言小爱心代码 编辑:程序博客网 时间:2024/05/22 16:41
=======================================================================================================
转载请注明原文地址:http://blog.csdn.net/crushonme/article/details/16105261
=======================================================================================================
最近在TI的e2e以及相关QQ群众讨论时很多同学在做DSP算法或者在使用中断时SYS/BIOS被异常挂起,最终分析下来的原因是因为在中断上下文中使用了Vps_printf()或者是在禁止中断后恢复中断前的期间内使用了Vps_printf(),即hwi_disable()和hwi_restore()的上下文中使用。
在TI提供的RDK(包括DVRRDK和IPNCRDK)中Ducati-M3和DSP中运行的实时操作系统为SYS/BIOS,在SYS/BIOS中输出到串口的打印API为System_printf()。提供的能输出到linux串口的API即为Vps_printf()和Vps_rprintf()。
下面我们来分析下Vps_printf()和Vps_rprintf的源代码和相关限制。
首先我们来看下两个API的实现代码:
int Vps_printf(char *format, ...){ int retVal; va_list vaArgPtr; char *buf = NULL; UInt32 cookie; cookie = Hwi_disable(); buf = &gRemoteDebug_serverObj.printBuf[0]; va_start(vaArgPtr, format); vsnprintf(buf, REMOTE_DEBUG_SERVER_PRINT_BUF_LEN, format, vaArgPtr); va_end(vaArgPtr); retVal = RemoteDebug_serverPutString(gRemoteDebug_serverObj.coreId, buf); Hwi_restore(cookie); if (BIOS_getThreadType() == BIOS_ThreadType_Task) { /* Printf should be called only from Task context as it does pend. * Calling from other context will cause exception */ System_printf(buf); } return (retVal);}
int Vps_rprintf(char *format, ...){ int retVal; va_list vaArgPtr; char *buf = NULL; UInt32 cookie; cookie = Hwi_disable(); buf = &gRemoteDebug_serverObj.printBuf[0]; va_start(vaArgPtr, format); vsnprintf(buf, REMOTE_DEBUG_SERVER_PRINT_BUF_LEN, format, vaArgPtr); va_end(vaArgPtr); retVal = RemoteDebug_serverPutString(gRemoteDebug_serverObj.coreId, buf); Hwi_restore(cookie); return (retVal);}由上面两端代码可以很明显的看出Vps_printf()和Vps_rprintf()的前半部分都是讲输出到共享内存中供A8侧打印线程输出,唯一的区别就是Vps_printf()会判断当前thread类型是否是Task,如果是Task则调用SYS/BIOS下的System_printf(),将数据输出到对应处理器的串口或者是Circular Buffer中。
在Vps_printf()中有下列注释:
/* Printf should be called only from Task context as it does pend. * Calling from other context will cause exception */即表示Vps_printf()只能被用于Task任务类型的thread,在其他类型的thread中会导致异常情况。(thread未翻译成线程,因为这里的thread和我们通常理解的线程有差异)
此外,需要注意的是在Vps_printf()和Vps_rprintf()的实现中均需要屏蔽硬件中断,因此不能用于硬件中断类型的thread。下面有个童鞋使用的错误的例子:
注:
1、在SYS/BIOS下线程可以分为以下几类,如下图所示:
2、SYS/BIOS下的System_printf()可以配制成两种模式,一种是输出到串口,另一种是将内容输出到SYS/BIOS下配置的静态circular buffer中。System_printf()的静态circular buffer配置及输出方式配置如下图所示:
相关文档:
1、SYS/BIOS wiki:http://processors.wiki.ti.com/index.php?title=Category:SYSBIOS
2、SYS/BIOS API: http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/sysbios/6_21_01_16/exports/docs/docs/cdoc/ti/sysbios/BIOS.html#.Thread.Type
3、e2e问答:http://e2e.ti.com/support/development_tools/code_composer_studio/f/81/t/43747.aspx
http://e2e.ti.com/support/embedded/bios/f/355/t/224754.aspx
- RDK中的Vps_printf()与Vps_rprintf()
- RDK中的Vps_printf()与Vps_rprintf()
- Vps_printf()和Vps_rprintf的源代码和相关限制
- RDK中HLOS与RTOS的区别
- Phoenix RDK的妙用
- DM816x RDK MultiCh_Demo MultiCh_createVcapVdis
- DM816x RDK MultiCh_Demo MultiCh_createVcapVdis
- DM816x RDK MultiCh_Demo MultiCh_createVcapVdis
- Comcast 力推 RDK
- RDK-B-CMAgent
- davinci 8127 rdk swosd rdk YUV格式分析1
- USB-SAMBA Service (RDK-B)
- Singularity RDK 2.0编译手记(r45126)
- DM8168 DVR RDK nand系统移植
- ipnc rdk 385板子修改ip地址
- Intel AMT RDK SDK SCS的概念介绍。
- zero copy architecture in RDK of TI 8168 EVM
- components and building system in RDK for TI 8168
- 糖画机利润分析
- actionBar兼容2.1及以上版本的做法
- mysql触发器的三个示例
- 【MFC】打开文件的流程
- java 测试选择排序法的排序用时
- RDK中的Vps_printf()与Vps_rprintf()
- Android Dialog详解
- [转]Twemproxy——针对MemCached与Redis的代理
- Nodejs在win7环境中安装及测试
- WE大会马化腾要告诉我们什么?
- 生成随机数 打印系统时间 方法
- 插入排序算法之直接排序和希尔排序,java简单实现
- hdu 2157 How many ways_ 矩阵快速幂
- 直接从 Google Play 下载 Android 应用最简单的方法