1
0
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:
benpicco 2020-07-22 16:59:47 +02:00 committed by GitHub
commit dc21084ab5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 4 deletions

View File

@ -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)
{
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)
{
assert(type < 32);
entry->event_mask &= ~(1 << type);
entry->event_mask &= ~(1UL << type);
}
/**

View File

@ -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)
{
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;
m->sender_pid = in_irq ? KERNEL_PID_ISR : sched_active_pid;

View File

@ -123,7 +123,14 @@ int main(void)
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;
}