]>
Commit | Line | Data |
---|---|---|
7227b671 ORL |
1 | /* |
2 | * gs.c | |
3 | * | |
4 | * DSP-BIOS Bridge driver support functions for TI OMAP processors. | |
5 | * | |
6 | * General storage memory allocator services. | |
7 | * | |
8 | * Copyright (C) 2005-2006 Texas Instruments, Inc. | |
9 | * | |
10 | * This package is free software; you can redistribute it and/or modify | |
11 | * it under the terms of the GNU General Public License version 2 as | |
12 | * published by the Free Software Foundation. | |
13 | * | |
14 | * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | |
15 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | |
16 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
17 | */ | |
18 | ||
2094f12d | 19 | #include <linux/types.h> |
7227b671 | 20 | /* ----------------------------------- DSP/BIOS Bridge */ |
7227b671 | 21 | #include <dspbridge/dbdefs.h> |
7227b671 ORL |
22 | |
23 | /* ----------------------------------- This */ | |
24 | #include <dspbridge/gs.h> | |
25 | ||
26 | #include <linux/slab.h> | |
27 | ||
28 | /* ----------------------------------- Globals */ | |
29 | static u32 cumsize; | |
30 | ||
31 | /* | |
32 | * ======== gs_alloc ======== | |
33 | * purpose: | |
34 | * Allocates memory of the specified size. | |
35 | */ | |
36 | void *gs_alloc(u32 size) | |
37 | { | |
38 | void *p; | |
39 | ||
40 | p = kzalloc(size, GFP_KERNEL); | |
41 | if (p == NULL) | |
42 | return NULL; | |
43 | cumsize += size; | |
44 | return p; | |
45 | } | |
46 | ||
47 | /* | |
48 | * ======== gs_exit ======== | |
49 | * purpose: | |
50 | * Discontinue the usage of the GS module. | |
51 | */ | |
52 | void gs_exit(void) | |
53 | { | |
54 | /* Do nothing */ | |
55 | } | |
56 | ||
57 | /* | |
58 | * ======== gs_free ======== | |
59 | * purpose: | |
60 | * Frees the memory. | |
61 | */ | |
62 | void gs_free(void *ptr) | |
63 | { | |
64 | kfree(ptr); | |
65 | /* ack! no size info */ | |
66 | /* cumsize -= size; */ | |
67 | } | |
68 | ||
69 | /* | |
70 | * ======== gs_frees ======== | |
71 | * purpose: | |
72 | * Frees the memory. | |
73 | */ | |
74 | void gs_frees(void *ptr, u32 size) | |
75 | { | |
76 | kfree(ptr); | |
77 | cumsize -= size; | |
78 | } | |
79 | ||
80 | /* | |
81 | * ======== gs_init ======== | |
82 | * purpose: | |
83 | * Initializes the GS module. | |
84 | */ | |
85 | void gs_init(void) | |
86 | { | |
87 | /* Do nothing */ | |
88 | } |