VDK中的器件驱动

VDK带有器件驱动,一般如在DM642中使用的微驱动之类的东西,就是省却了工程师对底层部件的控制源代码的书写,换言之,要熟悉使用这些API函数,还要熟悉21369的底层接口和部件,不能简单 的调用一下函数了事,况且,ADI没有像TI那样提供足够的技术资料,很多API的调用都是要靠自己去翻源码出来阅读,而且要不断的猜测函数的作用,不是很方便,在C6713的BIOS当中,我是不使用其硬件驱动的,只是直接在初始化的时候把全部的部件都初始化完了,然后在OS中开启中断,再在中断里面发消息。这样也能达到程序设计的目的,感觉没有必要太劳累去迁就公司提供的API函数。

 

 

2011-11-14

今天看资料发现原来sharc是没有器件的驱动库函数了,跟bf系列不大一样,其实要不要驱动库都无所谓,因为作为音频专用的芯片,本来就没有多少外设需要做设置的,

都很简单,随便做个寄存器配置就行了,

同时,有文章可以从侧面证明,在ISR中直接使用VDK_C_ISR_PostSemaphore();不需要开启器件驱动。

Calling C_ISR_PostSemaphore from a thread

I have a function that does a post on a semaphore and at times this same function might be called by a thread, to make this code easier I was just calling the C_ISR_PostSemaphore, so it is ISR safe.  Does this cause any issues calling C_ISR_PostSemaphore via a thread instead of PostSemaphore?

 

Also, one caveat is only one type of calling function is enabled at anyone time... ie a thread calls the function no ISR is configured... the user does something... then disables the thread and enables the ISR... etc...

 

For example

 

commonFoo()

{

...

VDK::C_ISR_PostSemaphore(semaphore)

}

 

 

void ISR()

{

commonFoo();

}

 

 

workerThread()

{

 

.... code

commonFoo()

}

 

 

 

The ISR functions are not designed to be called from kernel or thread levels. In theory there should not be a problem doing but it is not something that we recommend. Instead, I would suggest calling the right API from the commonFoo function like this


Blackfin

inline int IS_USER_ISR_LEVEL (){
        return (*pIPEND  & ~( (1<<EVT_IRPTEN_P) | (1<< EVT_IVG15_P) | (1 <<  EVT_IVG14_P))) ;
}
SHARC
#ifdef __2116x__
inline int IS_USER_ISR_LEVEL (){
        return (sysreg_read(sysreg_IMASKP) & (~(SFT2I|LPISUMI)) );
}

 

#else
inline int IS_USER_ISR_LEVEL (){
        return (sysreg_read(sysreg_IMASKP) & ~SFT2I ) ;
}

 


#endif

 

So you could have  something like

commonFoo()

{

if (IS_USER_ISR_LEVEL())  {
       VDK_C_ISR_PostSemaphore();
} else {
       VDK_PostSemaphore();
}
}
Of  course you can change this and make it suit your needs. We are assuming that the  reserved bits in IPEND are 0.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值