DDI 一些允许操作的REG 都是32位编址的,我看一下,DDI接口操作 API都搞得挺复杂。。。这是为何?
还有分 8位 16位 32位操作,,,手册上没有说明,,
__STATIC_INLINE void AuxAdiDdiSafeWrite(uint32_t nAddr, uint32_t nData, uint32_t nSize) {// Disable interrupts and remember whether to re-enablebool bIrqEnabled = !CPUcpsid();// Acquire semaphore for accessing ADI/DDI in AUX, perform access, release semaphorewhile (!HWREG(AUX_SMPH_BASE + AUX_SMPH_O_SMPH0));switch (nSize) {case 1:HWREGB(nAddr) = (uint8_t)nData; break;case 2:HWREGH(nAddr) = (uint16_t)nData; break;case 4: default:HWREG(nAddr) = nData; break;}HWREG(AUX_SMPH_BASE + AUX_SMPH_O_SMPH0) = 1;// Restore interrupt enableif (bIrqEnabled) {CPUcpsie();} }
Butterfly:
为了方便有些有些操作只用字节或16位,操作灵活,也可以只用HWREG
WH HUANG:
回复 Butterfly:
DDI 有啥MASTER 又SLAVE 手册0提及,,,哎,也只能看API了解点