nios2.h: cleanup API

This header was pulled in verbatim from Altera HAL and had
some style and naming issues. The inline functions or macros
which read registers can now be used in expressions.

Change-Id: I7a463717051efd2f9dd36e8a84d357852fbf9215
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2016-06-07 11:38:09 -07:00 committed by Anas Nashif
commit 01724d319d
2 changed files with 72 additions and 87 deletions

View file

@ -50,8 +50,8 @@ static ALWAYS_INLINE unsigned int _arch_irq_lock(void)
{
unsigned int key;
NIOS2_READ_STATUS(key);
NIOS2_WRITE_STATUS(key & ~NIOS2_STATUS_PIE_MSK);
key = _nios2_creg_read(NIOS2_CR_STATUS);
_nios2_creg_write(NIOS2_CR_STATUS, key & ~NIOS2_STATUS_PIE_MSK);
return key;
}
@ -79,10 +79,10 @@ static ALWAYS_INLINE void _arch_irq_unlock(unsigned int key)
if (!(key & NIOS2_STATUS_PIE_MSK))
return;
NIOS2_READ_STATUS(status_reg);
NIOS2_WRITE_STATUS(status_reg | NIOS2_STATUS_PIE_MSK);
status_reg = _nios2_creg_read(NIOS2_CR_STATUS);
_nios2_creg_write(NIOS2_CR_STATUS, status_reg | NIOS2_STATUS_PIE_MSK);
#else
NIOS2_WRITE_STATUS(key);
_nios2_creg_write(NIOS2_CR_STATUS, key);
#endif
}