mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
Merge pull request #14582 from benpicco/core/msg_bus-type
core/msg_bus: fix shift on 8-bit platforms
This commit is contained in:
commit
dc21084ab5
@ -146,7 +146,7 @@ msg_bus_entry_t *msg_bus_get_entry(msg_bus_t *bus);
|
|||||||
static inline void msg_bus_subscribe(msg_bus_entry_t *entry, uint8_t type)
|
static inline void msg_bus_subscribe(msg_bus_entry_t *entry, uint8_t type)
|
||||||
{
|
{
|
||||||
assert(type < 32);
|
assert(type < 32);
|
||||||
entry->event_mask |= (1 << type);
|
entry->event_mask |= (1UL << type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -160,7 +160,7 @@ static inline void msg_bus_subscribe(msg_bus_entry_t *entry, uint8_t type)
|
|||||||
static inline void msg_bus_unsubscribe(msg_bus_entry_t *entry, uint8_t type)
|
static inline void msg_bus_unsubscribe(msg_bus_entry_t *entry, uint8_t type)
|
||||||
{
|
{
|
||||||
assert(type < 32);
|
assert(type < 32);
|
||||||
entry->event_mask &= ~(1 << type);
|
entry->event_mask &= ~(1UL << type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -239,7 +239,7 @@ int msg_send_int(msg_t *m, kernel_pid_t target_pid)
|
|||||||
int msg_send_bus(msg_t *m, msg_bus_t *bus)
|
int msg_send_bus(msg_t *m, msg_bus_t *bus)
|
||||||
{
|
{
|
||||||
const bool in_irq = irq_is_in();
|
const bool in_irq = irq_is_in();
|
||||||
const uint32_t event_mask = (1 << (m->type & 0x1F));
|
const uint32_t event_mask = (1UL << (m->type & 0x1F));
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
m->sender_pid = in_irq ? KERNEL_PID_ISR : sched_active_pid;
|
m->sender_pid = in_irq ? KERNEL_PID_ISR : sched_active_pid;
|
||||||
|
@ -123,7 +123,14 @@ int main(void)
|
|||||||
printf("Posted event %d to %d threads\n", id, woken);
|
printf("Posted event %d to %d threads\n", id, woken);
|
||||||
}
|
}
|
||||||
|
|
||||||
puts("SUCCESS");
|
/* make sure all threads have terminated */
|
||||||
|
if (thread_getstatus(p1) != STATUS_NOT_FOUND ||
|
||||||
|
thread_getstatus(p2) != STATUS_NOT_FOUND ||
|
||||||
|
thread_getstatus(p3) != STATUS_NOT_FOUND ) {
|
||||||
|
puts("FAILED");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
puts("SUCCESS");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user