CC1310 ddi r/w 为何搞这么复杂?
时间:12-23
整理:3721RD
点击:
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-enable bool bIrqEnabled = !CPUcpsid(); // Acquire semaphore for accessing ADI/DDI in AUX, perform access, release semaphore while (!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 enable if (bIrqEnabled) { CPUcpsie(); } }
为了方便有些有些操作只用字节或16位,操作灵活,也可以只用HWREG
DDI 有啥MASTER 又SLAVE 手册0提及,,,哎,也只能看API了解点