TI C66x DSP硬件信号量 - 2

The semaphore module can be used as an arbiter to ensure mutual exclusivity when sharing resources over multiple cores in a multicore device. It provides up to 64 independent semaphores that can be acquired and released by the application.

Architecture

Each of the 64 semaphores is controlled by either reading from or writing to one of the three registers:SEM_DIRECT,SEM_INDIRECT, orSEM_QUERY. These three registers form a set and each semaphore is attached to one such set. The semaphore modulecan service requests using one of three methods: the direct request method, the indirect request method, or the combined request method. These three methods provide flexibility to the application to either implementa polling-based systemoran interrupt-based callback mechanismfor acquiring or locking a semaphore. None of the 64 semaphores on the module are mapped to any resource or module on the device. The application can choose to map any of the available semaphores to protect any resource. There is no support provided by the semaphore module to store the semaphore to resource mapping information. The mapping information must be maintained by the software application.

Software Reset Considerations:

The semaphore module can be reset through software by writing to the reset bit of theSEM_RST_RUNregister. On reset, all semaphores are in ‘FREE’ state and all the errors cleared.

Hardware Reset Considerations:

On reset, all semaphores are in ‘FREE’ state and all the errors cleared.

Interrupt Events and Requests:

The semaphore module can generate an interrupt to any of the cores on the device either to signal semaphore grant or an error. The module generates two sets of interrupts: semaphore grant (SEMINTn) and error (SEMERRn). Each set has the capability to interrupt any core (0-N) on the device. The SEMINTn interrupt is routed to the interrupt controller (INTC) of each core while the SEMERRn is routed to the respective chip interrupt controller (CIC[n]).

DMA Event Support:

All ‘N’ semaphore grant events (SEMINTn) can be used to trigger a DMA channel.The error events (SEMERRn) may be used to trigger DMA by using the TPCC interrupt controllers (CIC3) in conjunction with the CIC[n].

Releasing Semaphores:
Whenever a core is finished using a shared resource, it must free the associated semaphore so that other processes waiting to use it can get access. To release a semaphore and set its state to FREE, the application must write a ‘0x1’ to one of SEM_DIRECT, SEM_INDIRECT, or SEM_QUERY register corresponding to that semaphore.
Note—A semaphore can be released only by a process that is running on the core that is currently its owner; any other core trying to release the semaphore will generate an error.

 Querying Semaphore Status:                                                                                                                   
It is reasonable that the application would need to check the status of a semaphore without acquiring it. The semaphore module provides the ability to query of the semaphores.To query the status of a semaphore, the application needs to read theSEM_QUERY register ("Query Register (SEM_QUERYn)" on page 10 semaphore. The query returns information about whether the semaphore is free; if it is not free, the application returns the ID of the current owner.  
                                                                                                                                                       
Error Generation and Handling:                                                                                                                      
There are four types of errors the semaphore module can generate:                                                                                      
• Already Free Error: This error is generated when an attempt is made to free a semaphore that is already free.                                        
• Illegal Free Error: This error is generated when an attempt is made to free a semaphore by a core that is not the current owner.                     
• Already Own Error: This error is generated when a core attempts to acquire a semaphore that it already owns.                                         
• Already Requested Error: This error is generated when a core attempts to acquire a semaphore for which it already has a pending request in the queue.

When an error is generated by the module, the SEMERR register is updated with the error code semaphore number (0-63) and the ID (0-N) of the core that Refer to ‘‘Error Register (SEMERR)’’ on page 10-12 for a more detailed description.The SEMERR register can be cleared by writing a ‘0x1’ to the SEMERR_C
Note—The SEMERR register is influenced by the SEMERR interrupt state. To capture and register errors continuously besides clearing the SEMERR register,
the error is detected. Refer to the interrupt handling section for a description of the steps for resetting the interrupt ("Servicing SEMERRn" on page 9-2).

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值