core: Fix/refactor function naming in core/incude/irq.h

This commit is contained in:
DipSwitch 2016-03-19 09:25:47 +01:00
parent 659faaffb1
commit 0bb4748a94
61 changed files with 342 additions and 342 deletions

View File

@ -47,7 +47,7 @@ void board_init(void)
DDRB |= (1 << DDB7);
PORTB &= ~(1 << 7);
enableIRQ();
irq_enable();
}
/**

View File

@ -566,7 +566,7 @@ int16_t SMB380_getTemperature(void)
{
int16_t t = 0;
unsigned long cpsr = disableIRQ();
unsigned long cpsr = irq_disable();
SMB380_Prepare();
SMB380_ssp_write(SMB380_TEMP, 0, SMB380_READ_REGISTER);
@ -574,7 +574,7 @@ int16_t SMB380_getTemperature(void)
t = (SMB380_ssp_read() & 0xFF);
t = (t >> 1) + SMB380_TEMP_OFFSET;
SMB380_Unprepare();
restoreIRQ(cpsr);
irq_restore(cpsr);
return t;
}
@ -588,7 +588,7 @@ void SMB380_getAcceleration(unsigned char axis, int16_t *pAbs, int16_t *pMg)
settings.range = SMB380_getRange();
}
unsigned long cpsr = disableIRQ();
unsigned long cpsr = irq_disable();
SMB380_Prepare();
switch (axis) {
@ -610,7 +610,7 @@ void SMB380_getAcceleration(unsigned char axis, int16_t *pAbs, int16_t *pMg)
ur = (SMB380_ssp_read() & SMB380_ACC_MSB_MASK) << 2;
ur |= (SMB380_ssp_read() & SMB380_ACC_LSB_MASK) >> 6;
SMB380_Unprepare();
restoreIRQ(cpsr);
irq_restore(cpsr);
if (pAbs != NULL) {
if (ur & BIT9) { //ur<0
@ -635,18 +635,18 @@ void SMB380_getAcceleration(unsigned char axis, int16_t *pAbs, int16_t *pMg)
unsigned char SMB380_getChipID(void)
{
unsigned char ur = 0;
unsigned long cpsr = disableIRQ();
unsigned long cpsr = irq_disable();
SMB380_Prepare();
SMB380_ssp_write(SMB380_CHIP_ID, 0, 0);
ur = (unsigned char)(SMB380_ssp_read() & SMB380_CHIP_ID_MASK);
restoreIRQ(cpsr);
irq_restore(cpsr);
return ur;
}
void SMB380_setWakeUpPause(unsigned char duration)
{
unsigned char utemp;
unsigned long cpsr = disableIRQ();
unsigned long cpsr = irq_disable();
SMB380_Prepare();
SMB380_ssp_write(SMB380_CONTROL4, 0, SMB380_READ_REGISTER);
utemp = SMB380_ssp_read();
@ -655,19 +655,19 @@ void SMB380_setWakeUpPause(unsigned char duration)
SMB380_ssp_write(SMB380_CONTROL4, utemp, SMB380_WRITE_REGISTER);
SMB380_ssp_read();
SMB380_Unprepare();
restoreIRQ(cpsr);
irq_restore(cpsr);
}
unsigned char SMB380_getWakeUpPause(void)
{
unsigned char up;
unsigned long cpsr = disableIRQ();
unsigned long cpsr = irq_disable();
SMB380_Prepare();
SMB380_ssp_write(SMB380_CONTROL4, 0, SMB380_READ_REGISTER);
up = (unsigned char)SMB380_ssp_read();
SMB380_Unprepare();
restoreIRQ(cpsr);
irq_restore(cpsr);
up &= SMB380_CONTROL4_WAKEUP_PAUSE_MASK;
up = up >> 1;
@ -683,7 +683,7 @@ void SMB380_setBandWidth(unsigned char bandWidth)
(bandWidth == SMB380_BAND_WIDTH_375HZ) ||
(bandWidth == SMB380_BAND_WIDTH_50HZ) ||
(bandWidth == SMB380_BAND_WIDTH_750HZ)) {
unsigned long cpsr = disableIRQ();
unsigned long cpsr = irq_disable();
SMB380_Prepare();
SMB380_ssp_write(SMB380_CONTROL3, 0, SMB380_READ_REGISTER);
unsigned char utemp = SMB380_ssp_read();
@ -692,14 +692,14 @@ void SMB380_setBandWidth(unsigned char bandWidth)
SMB380_ssp_write(SMB380_CONTROL3, utemp, SMB380_WRITE_REGISTER);
SMB380_ssp_read();
SMB380_Unprepare();
restoreIRQ(cpsr);
irq_restore(cpsr);
}
}
void SMB380_setRange(unsigned char range)
{
if (range != 0x3) {
unsigned long cpsr = disableIRQ();
unsigned long cpsr = irq_disable();
SMB380_Prepare();
SMB380_ssp_write(SMB380_CONTROL3, 0, SMB380_READ_REGISTER);
unsigned char utemp = (unsigned char)SMB380_ssp_read();
@ -708,7 +708,7 @@ void SMB380_setRange(unsigned char range)
SMB380_ssp_write(SMB380_CONTROL3, utemp, SMB380_WRITE_REGISTER);
SMB380_ssp_read();
SMB380_Unprepare();
restoreIRQ(cpsr);
irq_restore(cpsr);
settings.countRange = 0;
}
@ -717,12 +717,12 @@ void SMB380_setRange(unsigned char range)
unsigned char SMB380_getRange(void)
{
unsigned char ur;
unsigned long cpsr = disableIRQ();
unsigned long cpsr = irq_disable();
SMB380_Prepare();
SMB380_ssp_write(SMB380_CONTROL3, 0, SMB380_READ_REGISTER);
ur = (SMB380_ssp_read() & SMB380_CONTROL3_RANGE_MASK) >> 3;
SMB380_Unprepare();
restoreIRQ(cpsr);
irq_restore(cpsr);
switch (ur) {
case SMB380_RANGE_2G:
@ -742,12 +742,12 @@ unsigned char SMB380_getRange(void)
unsigned char SMB380_getBandWidth(void)
{
unsigned char uBand;
unsigned long cpsr = disableIRQ();
unsigned long cpsr = irq_disable();
SMB380_Prepare();
SMB380_ssp_write(SMB380_CONTROL3, 0, SMB380_READ_REGISTER);
uBand = SMB380_ssp_read() & SMB380_CONTROL3_BANDWITH_MASK;
SMB380_Unprepare();
restoreIRQ(cpsr);
irq_restore(cpsr);
return uBand;
}
@ -785,34 +785,34 @@ int16_t SMB380_getBandWidthAbs(void)
void SMB380_softReset(void)
{
unsigned long cpsr = disableIRQ();
unsigned long cpsr = irq_disable();
SMB380_Prepare();
SMB380_ssp_write(SMB380_CONTROL1, SMB380_CONTROL1_SOFT_RESET_MASK,
SMB380_WRITE_REGISTER);
SMB380_ssp_read();
SMB380_Unprepare();
restoreIRQ(cpsr);
irq_restore(cpsr);
}
void SMB380_setCustomerReg(unsigned char data)
{
unsigned long cpsr = disableIRQ();
unsigned long cpsr = irq_disable();
SMB380_Prepare();
SMB380_ssp_write(SMB380_CUST1, data, SMB380_WRITE_REGISTER);
SMB380_ssp_read();
SMB380_Unprepare();
restoreIRQ(cpsr);
irq_restore(cpsr);
}
unsigned char SMB380_getCustomerReg(void)
{
unsigned uReg = 0;
unsigned long cpsr = disableIRQ();
unsigned long cpsr = irq_disable();
SMB380_Prepare();
SMB380_ssp_write(SMB380_CUST1, 0, SMB380_READ_REGISTER);
uReg = (unsigned char)SMB380_ssp_read();
SMB380_Unprepare();
restoreIRQ(cpsr);
irq_restore(cpsr);
return uReg;
}
@ -820,7 +820,7 @@ unsigned char SMB380_getCustomerReg(void)
void SMB380_Selftest_1(void)
{
unsigned char uReg = 0;
unsigned long cpsr = disableIRQ();
unsigned long cpsr = irq_disable();
SMB380_Prepare();
SMB380_ssp_write(SMB380_LG_THRES, 6, SMB380_WRITE_REGISTER);
//SSP0Init();
@ -837,7 +837,7 @@ void SMB380_Selftest_1(void)
// SSP0Init();
SMB380_ssp_read();
SMB380_Unprepare();
restoreIRQ(cpsr);
irq_restore(cpsr);
}
void SMB380_ShowMemory(void)
@ -846,12 +846,12 @@ void SMB380_ShowMemory(void)
printf("SMB380 Speicher\n\r");
for (unsigned char regAd = 0x16; regAd > 0; regAd--) {
unsigned long cpsr = disableIRQ();
unsigned long cpsr = irq_disable();
SMB380_Prepare();
SMB380_ssp_write(regAd - 1, 0, SMB380_READ_REGISTER);
uint16_t uReg = SMB380_ssp_read();
SMB380_Unprepare();
restoreIRQ(cpsr);
irq_restore(cpsr);
printf("Register: = %X: 0x%X = ", regAd - 1, uReg);
for (int pos = 0; pos < 16; pos++) { //uReg != 0)
@ -874,20 +874,20 @@ void SMB380_ShowMemory(void)
void SMB380_setUpperLimit(void)
{
unsigned long cpsr = disableIRQ();
unsigned long cpsr = irq_disable();
SMB380_Prepare();
SMB380_ssp_write(SMB380_HG_THRES, 128, SMB380_WRITE_REGISTER); //1g
SMB380_ssp_read();
SMB380_ssp_write(SMB380_HG_DUR, 0, SMB380_WRITE_REGISTER);
SMB380_ssp_read();
SMB380_Unprepare();
restoreIRQ(cpsr);
irq_restore(cpsr);
}
void SMB380_enableUpperLimit(void)
{
unsigned short uReg;
unsigned long cpsr = disableIRQ();
unsigned long cpsr = irq_disable();
SMB380_Prepare();
SMB380_ssp_write(SMB380_CONTROL2, 0, SMB380_READ_REGISTER);
uReg = SMB380_ssp_read();
@ -895,13 +895,13 @@ void SMB380_enableUpperLimit(void)
SMB380_WRITE_REGISTER);
SMB380_ssp_read();
SMB380_Unprepare();
restoreIRQ(cpsr);
irq_restore(cpsr);
}
void SMB380_disableUpperLimit(void)
{
unsigned short uReg;
unsigned long cpsr = disableIRQ();
unsigned long cpsr = irq_disable();
SMB380_Prepare();
SMB380_ssp_write(SMB380_CONTROL2, 0, SMB380_READ_REGISTER);
uReg = SMB380_ssp_read();
@ -909,13 +909,13 @@ void SMB380_disableUpperLimit(void)
SMB380_WRITE_REGISTER);
SMB380_ssp_read();
SMB380_Unprepare();
restoreIRQ(cpsr);
irq_restore(cpsr);
}
void SMB380_enableLowerLimit(void)
{
unsigned short uReg;
unsigned long cpsr = disableIRQ();
unsigned long cpsr = irq_disable();
SMB380_Prepare();
SMB380_ssp_write(SMB380_CONTROL2, 0, SMB380_READ_REGISTER);
uReg = SMB380_ssp_read();
@ -923,13 +923,13 @@ void SMB380_enableLowerLimit(void)
SMB380_WRITE_REGISTER);
SMB380_ssp_read();
SMB380_Unprepare();
restoreIRQ(cpsr);
irq_restore(cpsr);
}
void SMB380_disableLowerLimit(void)
{
unsigned short uReg;
unsigned long cpsr = disableIRQ();
unsigned long cpsr = irq_disable();
SMB380_Prepare();
SMB380_ssp_write(SMB380_CONTROL2, 0, SMB380_READ_REGISTER);
uReg = SMB380_ssp_read();
@ -937,7 +937,7 @@ void SMB380_disableLowerLimit(void)
SMB380_WRITE_REGISTER);
SMB380_ssp_read();
SMB380_Unprepare();
restoreIRQ(cpsr);
irq_restore(cpsr);
}
/* @param gvaluefloat - value is in mg
@ -960,7 +960,7 @@ uint8_t SMB380_setAnyMotionLimit(uint16_t mg, uint16_t gvalueint)
return 0;
}
unsigned long cpsr = disableIRQ();
unsigned long cpsr = irq_disable();
SMB380_Prepare();
/* 0,3g = 300 / 15,6mg = 19 */
SMB380_ssp_write(SMB380_ANY_MOTION_THRES, threshold, SMB380_WRITE_REGISTER);
@ -969,14 +969,14 @@ uint8_t SMB380_setAnyMotionLimit(uint16_t mg, uint16_t gvalueint)
SMB380_ssp_write(SMB380_ANY_MOTION_DUR_HYST, 0, SMB380_READ_REGISTER);
SMB380_ssp_read();
SMB380_Unprepare();
restoreIRQ(cpsr);
irq_restore(cpsr);
return 1;
}
void SMB380_enableAnyMotionLimit(void)
{
unsigned short uReg;
unsigned long cpsr = disableIRQ();
unsigned long cpsr = irq_disable();
SMB380_Prepare();
SMB380_ssp_write(SMB380_CONTROL4, 0, SMB380_READ_REGISTER);
uReg = SMB380_ssp_read();
@ -989,13 +989,13 @@ void SMB380_enableAnyMotionLimit(void)
SMB380_WRITE_REGISTER);
SMB380_ssp_read();
SMB380_Unprepare();
restoreIRQ(cpsr);
irq_restore(cpsr);
}
void SMB380_disableAnyMotionLimit(void)
{
unsigned short uReg;
unsigned long cpsr = disableIRQ();
unsigned long cpsr = irq_disable();
SMB380_Prepare();
SMB380_ssp_write(SMB380_CONTROL2, 0, SMB380_READ_REGISTER);
uReg = SMB380_ssp_read();
@ -1010,13 +1010,13 @@ void SMB380_disableAnyMotionLimit(void)
SMB380_WRITE_REGISTER);
SMB380_ssp_read();
SMB380_Unprepare();
restoreIRQ(cpsr);
irq_restore(cpsr);
}
void SMB380_enableNewDataInt(void)
{
unsigned short uReg;
unsigned long cpsr = disableIRQ();
unsigned long cpsr = irq_disable();
/*
* prevent deep sleep, reason: 400 µs wake-up time is to long for 3kHz
* interrupts
@ -1032,13 +1032,13 @@ void SMB380_enableNewDataInt(void)
// measuring temperature dependent internal sample rate of SMB380
tickStart = xtimer_now();
tickCurrentSamples = 0;
restoreIRQ(cpsr);
irq_restore(cpsr);
}
void SMB380_disableNewDataInt(void)
{
unsigned short uReg;
unsigned long cpsr = disableIRQ();
unsigned long cpsr = irq_disable();
SMB380_Prepare();
SMB380_ssp_write(SMB380_CONTROL4, 0, SMB380_READ_REGISTER);
uReg = SMB380_ssp_read();
@ -1051,13 +1051,13 @@ void SMB380_disableNewDataInt(void)
* interrupts
*/
CLRBIT(lpm_prevent_sleep, LPM_PREVENT_SLEEP_ACCSENSOR);
restoreIRQ(cpsr);
irq_restore(cpsr);
}
void SMB380_resetInterruptFlags(void)
{
unsigned short uReg;
unsigned long cpsr = disableIRQ();
unsigned long cpsr = irq_disable();
SMB380_Prepare();
SMB380_ssp_write(SMB380_CONTROL1, 0, SMB380_READ_REGISTER);
uReg = SMB380_ssp_read();
@ -1065,13 +1065,13 @@ void SMB380_resetInterruptFlags(void)
SMB380_WRITE_REGISTER);
SMB380_ssp_read();
SMB380_Unprepare();
restoreIRQ(cpsr);
irq_restore(cpsr);
}
void SMB380_enableEEPROM(void)
{
unsigned short uReg;
unsigned long cpsr = disableIRQ();
unsigned long cpsr = irq_disable();
SMB380_Prepare();
SMB380_ssp_write(SMB380_CONTROL1, 0, SMB380_READ_REGISTER);
uReg = SMB380_ssp_read();
@ -1079,13 +1079,13 @@ void SMB380_enableEEPROM(void)
SMB380_WRITE_REGISTER);
SMB380_ssp_read();
SMB380_Unprepare();
restoreIRQ(cpsr);
irq_restore(cpsr);
}
void SMB380_disableEEPROM(void)
{
unsigned short uReg;
unsigned long cpsr = disableIRQ();
unsigned long cpsr = irq_disable();
SMB380_Prepare();
SMB380_ssp_write(SMB380_CONTROL1, 0, SMB380_READ_REGISTER);
uReg = SMB380_ssp_read();
@ -1093,7 +1093,7 @@ void SMB380_disableEEPROM(void)
SMB380_WRITE_REGISTER);
SMB380_ssp_read();
SMB380_Unprepare();
restoreIRQ(cpsr);
irq_restore(cpsr);
}
/*
@ -1107,7 +1107,7 @@ unsigned char SMB380_readOffset(uint16_t *offset)
}
unsigned short uReg;
unsigned long cpsr = disableIRQ();
unsigned long cpsr = irq_disable();
SMB380_Prepare();
SMB380_ssp_write(SMB380_OFFSET_LSB_GAIN_X, 0, SMB380_READ_REGISTER);
@ -1136,7 +1136,7 @@ unsigned char SMB380_readOffset(uint16_t *offset)
printf("Offset Z: %u \r\n", uReg);
SMB380_Unprepare();
restoreIRQ(cpsr);
irq_restore(cpsr);
return true;
}
@ -1144,7 +1144,7 @@ unsigned char SMB380_readOffset(uint16_t *offset)
unsigned char SMB380_readOffsetTemp(uint16_t *offset)
{
unsigned short uReg;
unsigned long cpsr = disableIRQ();
unsigned long cpsr = irq_disable();
SMB380_Prepare();
SMB380_ssp_write(SMB380_OFFSET_LSB_GAIN_T, 0, SMB380_READ_REGISTER);
@ -1157,7 +1157,7 @@ unsigned char SMB380_readOffsetTemp(uint16_t *offset)
printf("Offset T: %u ", uReg);
SMB380_Unprepare();
restoreIRQ(cpsr);
irq_restore(cpsr);
return true;
}
@ -1178,7 +1178,7 @@ void SMB380_writeOffset(uint16_t *offset, uint8_t EEPROM)
}
unsigned short uReg;
unsigned long cpsr = disableIRQ();
unsigned long cpsr = irq_disable();
SMB380_Prepare();
//x-Axis
@ -1229,7 +1229,7 @@ void SMB380_writeOffset(uint16_t *offset, uint8_t EEPROM)
xtimer_usleep(50000);
SMB380_Unprepare();
restoreIRQ(cpsr);
irq_restore(cpsr);
}
}
@ -1247,7 +1247,7 @@ void SMB380_writeOffsetTemp(uint16_t *offset, uint8_t EEPROM)
}
unsigned short uReg;
unsigned long cpsr = disableIRQ();
unsigned long cpsr = irq_disable();
SMB380_Prepare();
//T-Axis
@ -1267,7 +1267,7 @@ void SMB380_writeOffsetTemp(uint16_t *offset, uint8_t EEPROM)
xtimer_usleep(50000);
SMB380_Unprepare();
restoreIRQ(cpsr);
irq_restore(cpsr);
}
}
@ -1277,7 +1277,7 @@ unsigned char SMB380_readGain(uint16_t *gain)
return false;
}
unsigned long cpsr = disableIRQ();
unsigned long cpsr = irq_disable();
SMB380_Prepare();
//x-gain
@ -1291,7 +1291,7 @@ unsigned char SMB380_readGain(uint16_t *gain)
gain[2] = (SMB380_ssp_read() & SMB380_OFFSET_GAIN_MASK);
SMB380_Unprepare();
restoreIRQ(cpsr);
irq_restore(cpsr);
return true;
}
@ -1302,7 +1302,7 @@ unsigned char SMB380_readGainTemp(uint16_t *gain)
return false;
}
unsigned long cpsr = disableIRQ();
unsigned long cpsr = irq_disable();
SMB380_Prepare();
//T-gain
@ -1310,7 +1310,7 @@ unsigned char SMB380_readGainTemp(uint16_t *gain)
gain[0] = (SMB380_ssp_read() & SMB380_OFFSET_GAIN_MASK);
SMB380_Unprepare();
restoreIRQ(cpsr);
irq_restore(cpsr);
return true;
}

View File

@ -93,7 +93,7 @@ void cc430_cpu_init(void)
// Disable write-access to port mapping registers:
PMAPPWD = 0;
// Re-enable all interrupts
enableIRQ();
irq_enable();
}

View File

@ -103,10 +103,10 @@ static void msb_ports_init(void)
void msp430_set_cpu_speed(uint32_t speed)
{
disableIRQ();
irq_disable();
__msp430_cpu_speed = speed;
msp430_init_dco();
enableIRQ();
irq_enable();
}
/*---------------------------------------------------------------------------*/

View File

@ -27,7 +27,7 @@
static bool qemu_shutdown(void)
{
unsigned old_state = disableIRQ();
unsigned old_state = irq_disable();
DEBUG("SHUTTING DOWN.\n");
@ -35,7 +35,7 @@ static bool qemu_shutdown(void)
/* Works for qemu and bochs. */
outw(0xB004, 0x2000);
restoreIRQ(old_state);
irq_restore(old_state);
return false;
}

View File

@ -63,10 +63,10 @@ static void msb_ports_init(void)
void msp430_set_cpu_speed(uint32_t speed)
{
disableIRQ();
irq_disable();
__msp430_cpu_speed = speed;
msp430_init_dco();
enableIRQ();
irq_enable();
}
/*---------------------------------------------------------------------------*/

View File

@ -31,15 +31,15 @@
int atomic_cas(atomic_int_t *var, int old, int now)
{
unsigned int mask = disableIRQ();
unsigned int mask = irq_disable();
if (ATOMIC_VALUE(*var) != old) {
restoreIRQ(mask);
irq_restore(mask);
return 0;
}
ATOMIC_VALUE(*var) = now;
restoreIRQ(mask);
irq_restore(mask);
return 1;
}

View File

@ -53,11 +53,11 @@ typedef uint64_t I8;
#define TEMPLATE_ATOMIC_FETCH_OP_N(opname, op, n, prefixop) \
I##n __atomic_fetch_##opname##_##n (volatile void *ptr, I##n val, int memmodel) \
{ \
unsigned int mask = disableIRQ(); \
unsigned int mask = irq_disable(); \
(void)memmodel; \
I##n tmp = *((I##n*)ptr); \
*((I##n*)ptr) = prefixop(tmp op val); \
restoreIRQ(mask); \
irq_restore(mask); \
return tmp; \
}

View File

@ -37,10 +37,10 @@
* @{
*/
#ifdef COREIF_NG
#define enableIRQ irq_arch_enable
#define disableIRQ irq_arch_disable
#define restoreIRQ irq_arch_restore
#define inISR irq_arch_in
#define irq_enable irq_arch_enable
#define irq_disable irq_arch_disable
#define irq_restore irq_arch_restore
#define irq_is_in irq_arch_in
#endif
/** @} */

View File

@ -33,22 +33,22 @@
*
* @return Previous value of status register. The return value should not
* interpreted as a boolean value. The actual value is only
* significant for restoreIRQ().
* significant for irq_restore().
*
* @see restoreIRQ
* @see irq_restore
*/
unsigned disableIRQ(void);
unsigned irq_disable(void);
/**
* @brief This function clears the IRQ disable bit in the status register
*
* @return Previous value of status register. The return value should not
* interpreted as a boolean value. The actual value is only
* significant for restoreIRQ().
* significant for irq_restore().
*
* @see restoreIRQ
* @see irq_restore
*/
unsigned enableIRQ(void);
unsigned irq_enable(void);
/**
* @brief This function restores the IRQ disable bit in the status register
@ -56,16 +56,16 @@ unsigned enableIRQ(void);
*
* @param[in] state state to restore
*
* @see enableIRQ
* @see disableIRQ
* @see irq_enable
* @see irq_disable
*/
void restoreIRQ(unsigned state);
void irq_restore(unsigned state);
/**
* @brief Check whether called from interrupt service routine
* @return true, if in interrupt service routine, false if not
*/
int inISR(void);
int irq_is_in(void);
#ifdef __cplusplus
}

View File

@ -125,7 +125,7 @@ void sched_set_status(thread_t *process, unsigned int status);
* @details Either yield if other_prio is higher than the current priority,
* or if the current thread is not on the runqueue.
*
* Depending on whether the current execution is in an ISR (inISR()),
* Depending on whether the current execution is in an ISR (irq_is_in()),
* thread_yield_higher() is called or @ref sched_context_switch_request is set,
* respectively.
*

View File

@ -87,7 +87,7 @@ static char idle_stack[THREAD_STACKSIZE_IDLE];
void kernel_init(void)
{
(void) disableIRQ();
(void) irq_disable();
thread_create(idle_stack, sizeof(idle_stack),
THREAD_PRIORITY_IDLE,

View File

@ -53,24 +53,24 @@ static int queue_msg(thread_t *target, const msg_t *m)
int msg_send(msg_t *m, kernel_pid_t target_pid)
{
if (inISR()) {
if (irq_is_in()) {
return msg_send_int(m, target_pid);
}
if (sched_active_pid == target_pid) {
return msg_send_to_self(m);
}
return _msg_send(m, target_pid, true, disableIRQ());
return _msg_send(m, target_pid, true, irq_disable());
}
int msg_try_send(msg_t *m, kernel_pid_t target_pid)
{
if (inISR()) {
if (irq_is_in()) {
return msg_send_int(m, target_pid);
}
if (sched_active_pid == target_pid) {
return msg_send_to_self(m);
}
return _msg_send(m, target_pid, false, disableIRQ());
return _msg_send(m, target_pid, false, irq_disable());
}
static int _msg_send(msg_t *m, kernel_pid_t target_pid, bool block, unsigned state)
@ -87,7 +87,7 @@ static int _msg_send(msg_t *m, kernel_pid_t target_pid, bool block, unsigned sta
if (target == NULL) {
DEBUG("msg_send(): target thread does not exist\n");
restoreIRQ(state);
irq_restore(state);
return -1;
}
@ -104,7 +104,7 @@ static int _msg_send(msg_t *m, kernel_pid_t target_pid, bool block, unsigned sta
DEBUG("msg_send() %s:%i: Target %" PRIkernel_pid
" has a msg_queue. Queueing message.\n", RIOT_FILE_RELATIVE,
__LINE__, target_pid);
restoreIRQ(state);
irq_restore(state);
if (sched_active_thread->status == STATUS_REPLY_BLOCKED) {
thread_yield_higher();
}
@ -114,7 +114,7 @@ static int _msg_send(msg_t *m, kernel_pid_t target_pid, bool block, unsigned sta
if (!block) {
DEBUG("msg_send: %" PRIkernel_pid ": Receiver not waiting, block=%u\n",
sched_active_thread->pid, block);
restoreIRQ(state);
irq_restore(state);
return 0;
}
@ -145,7 +145,7 @@ static int _msg_send(msg_t *m, kernel_pid_t target_pid, bool block, unsigned sta
DEBUG("msg_send: %" PRIkernel_pid ": Back from send block.\n",
sched_active_thread->pid);
restoreIRQ(state);
irq_restore(state);
thread_yield_higher();
}
else {
@ -157,7 +157,7 @@ static int _msg_send(msg_t *m, kernel_pid_t target_pid, bool block, unsigned sta
*target_message = *m;
sched_set_status(target, STATUS_PENDING);
restoreIRQ(state);
irq_restore(state);
thread_yield_higher();
}
@ -166,12 +166,12 @@ static int _msg_send(msg_t *m, kernel_pid_t target_pid, bool block, unsigned sta
int msg_send_to_self(msg_t *m)
{
unsigned state = disableIRQ();
unsigned state = irq_disable();
m->sender_pid = sched_active_pid;
int res = queue_msg((thread_t *) sched_active_thread, m);
restoreIRQ(state);
irq_restore(state);
return res;
}
@ -213,7 +213,7 @@ int msg_send_int(msg_t *m, kernel_pid_t target_pid)
int msg_send_receive(msg_t *m, msg_t *reply, kernel_pid_t target_pid)
{
assert(sched_active_pid != target_pid);
unsigned state = disableIRQ();
unsigned state = irq_disable();
thread_t *me = (thread_t*) sched_threads[sched_active_pid];
sched_set_status(me, STATUS_REPLY_BLOCKED);
me->wait_data = (void*) reply;
@ -224,7 +224,7 @@ int msg_send_receive(msg_t *m, msg_t *reply, kernel_pid_t target_pid)
int msg_reply(msg_t *m, msg_t *reply)
{
unsigned state = disableIRQ();
unsigned state = irq_disable();
thread_t *target = (thread_t*) sched_threads[m->sender_pid];
assert(target != NULL);
@ -232,7 +232,7 @@ int msg_reply(msg_t *m, msg_t *reply)
if (target->status != STATUS_REPLY_BLOCKED) {
DEBUG("msg_reply(): %" PRIkernel_pid ": Target \"%" PRIkernel_pid
"\" not waiting for reply.", sched_active_thread->pid, target->pid);
restoreIRQ(state);
irq_restore(state);
return -1;
}
@ -243,7 +243,7 @@ int msg_reply(msg_t *m, msg_t *reply)
*target_message = *reply;
sched_set_status(target, STATUS_PENDING);
uint16_t target_prio = target->priority;
restoreIRQ(state);
irq_restore(state);
sched_switch(target_prio);
return 1;
@ -278,7 +278,7 @@ int msg_receive(msg_t *m)
static int _msg_receive(msg_t *m, int block)
{
unsigned state = disableIRQ();
unsigned state = irq_disable();
DEBUG("_msg_receive: %" PRIkernel_pid ": _msg_receive.\n",
sched_active_thread->pid);
@ -292,7 +292,7 @@ static int _msg_receive(msg_t *m, int block)
/* no message, fail */
if ((!block) && ((!me->msg_waiters.first) && (queue_index == -1))) {
restoreIRQ(state);
irq_restore(state);
return -1;
}
@ -316,13 +316,13 @@ static int _msg_receive(msg_t *m, int block)
sched_active_thread->pid);
sched_set_status(me, STATUS_RECEIVE_BLOCKED);
restoreIRQ(state);
irq_restore(state);
thread_yield_higher();
/* sender copied message */
}
else {
restoreIRQ(state);
irq_restore(state);
}
return 1;
@ -351,7 +351,7 @@ static int _msg_receive(msg_t *m, int block)
sender_prio = sender->priority;
}
restoreIRQ(state);
irq_restore(state);
if (sender_prio < THREAD_PRIORITY_IDLE) {
sched_switch(sender_prio);
}

View File

@ -53,13 +53,13 @@ void mutex_lock(struct mutex_t *mutex)
static void mutex_wait(struct mutex_t *mutex)
{
unsigned irqstate = disableIRQ();
unsigned irqstate = irq_disable();
DEBUG("%s: Mutex in use. %u\n", sched_active_thread->name, ATOMIC_VALUE(mutex->val));
if (atomic_set_to_one(&mutex->val)) {
/* somebody released the mutex. return. */
DEBUG("%s: mutex_wait early out. %u\n", sched_active_thread->name, ATOMIC_VALUE(mutex->val));
restoreIRQ(irqstate);
irq_restore(irqstate);
return;
}
@ -74,7 +74,7 @@ static void mutex_wait(struct mutex_t *mutex)
priority_queue_add(&(mutex->queue), &n);
restoreIRQ(irqstate);
irq_restore(irqstate);
thread_yield_higher();
@ -83,12 +83,12 @@ static void mutex_wait(struct mutex_t *mutex)
void mutex_unlock(struct mutex_t *mutex)
{
unsigned irqstate = disableIRQ();
unsigned irqstate = irq_disable();
DEBUG("mutex_unlock(): val: %u pid: %" PRIkernel_pid "\n", ATOMIC_VALUE(mutex->val), sched_active_pid);
if (ATOMIC_VALUE(mutex->val) == 0) {
/* the mutex was not locked */
restoreIRQ(irqstate);
irq_restore(irqstate);
return;
}
@ -96,7 +96,7 @@ void mutex_unlock(struct mutex_t *mutex)
if (!next) {
/* the mutex was locked and no thread was waiting for it */
ATOMIC_VALUE(mutex->val) = 0;
restoreIRQ(irqstate);
irq_restore(irqstate);
return;
}
@ -105,14 +105,14 @@ void mutex_unlock(struct mutex_t *mutex)
sched_set_status(process, STATUS_PENDING);
uint16_t process_priority = process->priority;
restoreIRQ(irqstate);
irq_restore(irqstate);
sched_switch(process_priority);
}
void mutex_unlock_and_sleep(struct mutex_t *mutex)
{
DEBUG("%s: unlocking mutex. val: %u pid: %" PRIkernel_pid ", and taking a nap\n", sched_active_thread->name, ATOMIC_VALUE(mutex->val), sched_active_pid);
unsigned irqstate = disableIRQ();
unsigned irqstate = irq_disable();
if (ATOMIC_VALUE(mutex->val) != 0) {
priority_queue_node_t *next = priority_queue_remove_head(&(mutex->queue));
@ -127,6 +127,6 @@ void mutex_unlock_and_sleep(struct mutex_t *mutex)
}
DEBUG("%s: going to sleep.\n", sched_active_thread->name);
sched_set_status((thread_t*) sched_active_thread, STATUS_SLEEPING);
restoreIRQ(irqstate);
irq_restore(irqstate);
thread_yield_higher();
}

View File

@ -69,7 +69,7 @@ NORETURN void core_panic(core_panic_t crash_code, const char *message)
#endif
}
/* disable watchdog and all possible sources of interrupts */
disableIRQ();
irq_disable();
panic_arch();
#ifndef DEVELHELP
/* DEVELHELP not set => reboot system */

View File

@ -163,7 +163,7 @@ void sched_switch(uint16_t other_prio)
active_thread->pid, current_prio, on_runqueue, other_prio);
if (!on_runqueue || (current_prio > other_prio)) {
if (inISR()) {
if (irq_is_in()) {
DEBUG("sched_switch: setting sched_context_switch_request.\n");
sched_context_switch_request = 1;
}
@ -181,7 +181,7 @@ NORETURN void sched_task_exit(void)
{
DEBUG("sched_task_exit: ending thread %" PRIkernel_pid "...\n", sched_active_thread->pid);
(void) disableIRQ();
(void) irq_disable();
sched_threads[sched_active_pid] = NULL;
sched_num_threads--;

View File

@ -53,13 +53,13 @@ const char *thread_getname(kernel_pid_t pid)
void thread_sleep(void)
{
if (inISR()) {
if (irq_is_in()) {
return;
}
unsigned state = disableIRQ();
unsigned state = irq_disable();
sched_set_status((thread_t *)sched_active_thread, STATUS_SLEEPING);
restoreIRQ(state);
irq_restore(state);
thread_yield_higher();
}
@ -67,7 +67,7 @@ int thread_wakeup(kernel_pid_t pid)
{
DEBUG("thread_wakeup: Trying to wakeup PID %" PRIkernel_pid "...\n", pid);
unsigned old_state = disableIRQ();
unsigned old_state = irq_disable();
thread_t *other_thread = (thread_t *) thread_get(pid);
@ -79,7 +79,7 @@ int thread_wakeup(kernel_pid_t pid)
sched_set_status(other_thread, STATUS_RUNNING);
restoreIRQ(old_state);
irq_restore(old_state);
sched_switch(other_thread->priority);
return 1;
@ -88,18 +88,18 @@ int thread_wakeup(kernel_pid_t pid)
DEBUG("thread_wakeup: Thread is not sleeping!\n");
}
restoreIRQ(old_state);
irq_restore(old_state);
return STATUS_NOT_FOUND;
}
void thread_yield(void)
{
unsigned old_state = disableIRQ();
unsigned old_state = irq_disable();
thread_t *me = (thread_t *)sched_active_thread;
if (me->status >= STATUS_ON_RUNQUEUE) {
clist_advance(&sched_runqueues[me->priority]);
}
restoreIRQ(old_state);
irq_restore(old_state);
thread_yield_higher();
}
@ -169,7 +169,7 @@ kernel_pid_t thread_create(char *stack, int stacksize, char priority, int flags,
}
#endif
unsigned state = disableIRQ();
unsigned state = irq_disable();
kernel_pid_t pid = KERNEL_PID_UNDEF;
for (kernel_pid_t i = KERNEL_PID_FIRST; i <= KERNEL_PID_LAST; ++i) {
@ -181,7 +181,7 @@ kernel_pid_t thread_create(char *stack, int stacksize, char priority, int flags,
if (pid == KERNEL_PID_UNDEF) {
DEBUG("thread_create(): too many threads!\n");
restoreIRQ(state);
irq_restore(state);
return -EOVERFLOW;
}
@ -224,13 +224,13 @@ kernel_pid_t thread_create(char *stack, int stacksize, char priority, int flags,
sched_set_status(cb, STATUS_PENDING);
if (!(flags & THREAD_CREATE_WOUT_YIELD)) {
restoreIRQ(state);
irq_restore(state);
sched_switch(priority);
return pid;
}
}
restoreIRQ(state);
irq_restore(state);
return pid;
}

View File

@ -18,7 +18,7 @@ static inline unsigned __get_cpsr(void)
return retval;
}
int inISR(void)
int irq_is_in(void)
{
int retval;
asm volatile(" mrs %0, cpsr" : "=r"(retval) : /* no inputs */);
@ -30,7 +30,7 @@ static inline void __set_cpsr(unsigned val)
asm volatile(" msr cpsr, %0" : /* no outputs */ : "r"(val));
}
unsigned disableIRQ(void)
unsigned irq_disable(void)
{
unsigned _cpsr;
@ -39,7 +39,7 @@ unsigned disableIRQ(void)
return _cpsr;
}
unsigned restoreIRQ(unsigned oldCPSR)
unsigned irq_restore(unsigned oldCPSR)
{
unsigned _cpsr;
@ -56,7 +56,7 @@ unsigned IRQenabled(void)
return (_cpsr & IRQ_MASK);
}
unsigned enableIRQ(void)
unsigned irq_enable(void)
{
unsigned _cpsr;

View File

@ -94,7 +94,7 @@ int timer_set(tim_t dev, int channel, unsigned int timeout)
int timer_set_absolute(tim_t dev, int channel, unsigned int value)
{
unsigned state = disableIRQ();
unsigned state = irq_disable();
switch (dev) {
#if TIMER_0_EN
@ -119,7 +119,7 @@ int timer_set_absolute(tim_t dev, int channel, unsigned int value)
break;
default:
restoreIRQ(state);
irq_restore(state);
return -1;
}
@ -147,7 +147,7 @@ int timer_set_absolute(tim_t dev, int channel, unsigned int value)
break;
default:
restoreIRQ(state);
irq_restore(state);
return -1;
}
@ -175,7 +175,7 @@ int timer_set_absolute(tim_t dev, int channel, unsigned int value)
break;
default:
restoreIRQ(state);
irq_restore(state);
return -1;
}
@ -184,13 +184,13 @@ int timer_set_absolute(tim_t dev, int channel, unsigned int value)
case TIMER_UNDEFINED:
default:
restoreIRQ(state);
irq_restore(state);
return -1;
}
/* enable interrupts for given timer */
timer_irq_enable(dev);
restoreIRQ(state);
irq_restore(state);
return 1;
}
@ -282,7 +282,7 @@ unsigned int timer_read(tim_t dev)
* Disabling interrupts globally because read from 16 Bit register can
* otherwise be messed up
*/
unsigned state = disableIRQ();
unsigned state = irq_disable();
switch (dev) {
#if TIMER_0_EN
@ -319,7 +319,7 @@ unsigned int timer_read(tim_t dev)
a = 0;
}
restoreIRQ(state);
irq_restore(state);
return a;
}

View File

@ -212,7 +212,7 @@ void thread_arch_start_threading(void)
void NORETURN __enter_thread_mode(void) __attribute__((naked));
void NORETURN __enter_thread_mode(void)
{
enableIRQ();
irq_enable();
__context_restore();
asm volatile("ret");
@ -224,9 +224,9 @@ void thread_arch_yield(void)
{
__context_save();
/* disableIRQ(); */ /* gets already disabled during __context_save() */
/* irq_disable(); */ /* gets already disabled during __context_save() */
sched_run();
enableIRQ();
irq_enable();
__context_restore();
asm volatile("ret");

View File

@ -72,7 +72,7 @@ uint16_t adc12_single_conversion(uint16_t ref, uint16_t sht, uint16_t channel)
ADC12CTL1 = ADC12SHP; /* Enable sample timer */
ADC12MCTL0 = ADC12SREF_1 + channel; /* ADC input channel */
ADC12IE = 0x001; /* ADC_IFG upon conv result-ADCMEMO */
enableIRQ();
irq_enable();
/* Wait 66us to allow internal reference to settle */
xtimer_usleep(66);

View File