mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 02:43:15 +01:00
Boot files and tasks are now initialised together. Theads can ask for particular space and thread ids, if they're unused. This enables us to get predefined ids for known tasks such as the VFS task. Fixes to README Other minor fixes.
40 lines
709 B
C
40 lines
709 B
C
#ifndef __LIB_BIT_H__
|
|
#define __LIB_BIT_H__
|
|
|
|
unsigned int __clz(unsigned int bitvector);
|
|
int find_and_set_first_free_bit(u32 *word, unsigned int lastbit);
|
|
int check_and_clear_bit(u32 *word, int bit);
|
|
int check_and_set_bit(u32 *word, int bit);
|
|
|
|
|
|
/* Set */
|
|
static inline void setbit(unsigned int *w, unsigned int flags)
|
|
{
|
|
*w |= flags;
|
|
}
|
|
|
|
|
|
/* Clear */
|
|
static inline void clrbit(unsigned int *w, unsigned int flags)
|
|
{
|
|
*w &= ~flags;
|
|
}
|
|
|
|
/* Test */
|
|
static inline int tstbit(unsigned int *w, unsigned int flags)
|
|
{
|
|
return *w & flags;
|
|
}
|
|
|
|
/* Test and clear */
|
|
static inline int tstclr(unsigned int *w, unsigned int flags)
|
|
{
|
|
int res = tstbit(w, flags);
|
|
|
|
clrbit(w, flags);
|
|
|
|
return res;
|
|
}
|
|
|
|
#endif /* __LIB_BIT_H__ */
|