I noticed that some of the driver functions like to read the register again during bit set or bit clear of any bit.
STATIC INLINE void Chip_SYSCTL_EnablePeriphWakeup(uint32_t periphmask)
{
LPC_SYSCTL->STARTERP1 = periphmask | (LPC_SYSCTL->STARTERP0 & ~SYSCTL_STARTERP0_RESERVED);
}
=> There is a bug here, should the code be?
STATIC INLINE void Chip_SYSCTL_EnablePeriphWakeup(uint32_t periphmask) { LPC_SYSCTL->STARTERP1 = periphmask | (LPC_SYSCTL->STARTERP1 & ~SYSCTL_STARTERP1_RESERVED); }
Can this be done like this?
STATIC INLINE void Chip_SYSCTL_EnablePeriphWakeup(uint32_t periphmask) { LPC_SYSCTL->STARTERP1 |= periphmask; }
Another example
#define WKT_CTRL_RESERVED (~7) #define WKT_CTRL_ALARMFLAG ((uint32_t) (1 << 1)) /*!< Wake-up or alarm timer flag */ STATIC INLINE void Chip_WKT_ClearIntStatus(LPC_WKT_T *pWKT) { pWKT->CTRL = WKT_CTRL_ALARMFLAG | (pWKT->CTRL & ~WKT_CTRL_RESERVED); }
Be changed to
STATIC INLINE void Chip_WKT_ClearIntStatus(LPC_WKT_T *pWKT) { pWKT->CTRL &= ~WKT_CTRL_ALARMFLAG; }
Hi HM Yoong,
Thank you for your interest in NXP Semiconductor products and the opportunity to serve you.
I was wondering if you can tell me the name of MCU and its correlated LPCopen library you use.
Have a great day,
TIC
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
I am using LPCXpresso824-MAX evaluation board.