<< Click to Display Table of Contents >> Assigning HSR's |
Selecting HSR(Host Service Request) values are key to making the function easy to use and easy to code. First a quick reminder of how the HSR bits work. There are 3 HSR bits which allow 7 HSR values and 0 for no HSR. The HSR bits are set by the host CPU and cleared but the eTPU. The host CPU can not clear a HSR bit once it has been set. The host CPU should only write a new value to the HSR register when the register is 0. If the host writes a value to the HSR register and it is not zero the 2 values will be ORed together, this is because the host can only set bits.
It is best to assign HSR in such as way as to try and minimize any potential problem from the CPU not waiting until the HSR register is zero. For example if you had a function that needs 3 HSR value you might assign them as:
•HSR1 - function A
•HSR2 - function B
•HSR3 - function C
If the host CPU issues a HSR1 and then issues an HSR2 before the eTPU services the channel, the eTPU will execute function C. This is because the CPU can only set bits (1 OR 2 = 3). It would be better to assign the HSRs like this:
•HSR1 - function A
•HSR2 - function B
•HSR4 - function C
Now if the CPU issues a HSR1 and HSR2 before the channel is serviced the eTPU will execute HSR3 which it knows is an error. In the same way it will know that for this function HSR5, HSR6 and HSR7 are also errors because they should never be requested. This is an error from the CPU because it should wait until the HSR is zero before updating it.
Normally the ORing of the HSR bit happen because of CPU error, however it can also be used override existing HSR requests. This can allow to eTPU to service the override condition quicker. Normally you would do something like:
1.Issue function A (HSR1) to channel
2.CPU detects error condition
3.Wait until channel has been services (HSR=0)
4.Issue error/override (HSR2) to channel
Using the ORing you could do something like:
1.Issue function A (HSR1) to channel
2.CPU detects error condition
3.Issue error/override (HSR7) to channel