OpenCores
URL https://opencores.org/ocsvn/c0or1k/c0or1k/trunk

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [conts/] [posix/] [mm0/] [include/] [lib/] [idpool.h] - Blame information for rev 7

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
#ifndef __MM0_IDPOOL_H__
2
#define __MM0_IDPOOL_H__
3
 
4
#include <lib/bit.h>
5
#include <lib/spinlock.h>
6
#include <string.h>
7
#include INC_GLUE(memory.h)
8
 
9
struct id_pool {
10
        int nwords;
11
        int bitlimit;
12
        u32 bitmap[];
13
};
14
 
15
/* Copy one id pool to another by calculating its size */
16
static inline void id_pool_copy(struct id_pool *to, struct id_pool *from, int totalbits)
17
{
18
        int nwords = BITWISE_GETWORD(totalbits);
19
 
20
        memcpy(to, from, nwords * SZ_WORD + sizeof(struct id_pool));
21
}
22
 
23
struct id_pool *id_pool_new_init(int mapsize);
24
int id_new(struct id_pool *pool);
25
int id_del(struct id_pool *pool, int id);
26
int id_get(struct id_pool *pool, int id);
27
int id_is_empty(struct id_pool *pool);
28
int ids_new_contiguous(struct id_pool *pool, int numids);
29
int ids_del_contiguous(struct id_pool *pool, int first, int numids);
30
 
31
#endif /* __MM0_IDPOOL_H__ */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.