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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [uIP_Demo_IAR_ARM7/] [uip/] [memb.h] - Blame information for rev 583

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 583 jeremybenn
/**
2
 * \addtogroup exampleapps
3
 * @{
4
 */
5
 
6
/**
7
 * \file
8
 * Memory block allocation routines.
9
 * \author Adam Dunkels <adam@sics.se>
10
 *
11
 */
12
 
13
#ifndef __MEMB_H__
14
#define __MEMB_H__
15
 
16
/**
17
 * Declare a memory block.
18
 *
19
 * \param name The name of the memory block (later used with
20
 * memb_init(), memb_alloc() and memb_free()).
21
 *
22
 * \param size The size of each memory chunk, in bytes.
23
 *
24
 * \param num The total number of memory chunks in the block.
25
 *
26
 */
27
#define MEMB(name, size, num) \
28
        static char memb_mem[(size + 1) * num]; \
29
        static struct memb_blocks name = {size, num, memb_mem}
30
 
31
struct memb_blocks {
32
  unsigned short size;
33
  unsigned short num;
34
  char *mem;
35
};
36
 
37
void  memb_init(struct memb_blocks *m);
38
char *memb_alloc(struct memb_blocks *m);
39
char  memb_ref(struct memb_blocks *m, char *ptr);
40
char  memb_free(struct memb_blocks *m, char *ptr);
41
 
42
 
43
#endif /* __MEMB_H__ */

powered by: WebSVN 2.1.0

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