FreeCalypso > hg > freecalypso-sw
comparison gsm-fw/g23m-aci/gdd_dio/gdd_sys.c @ 775:eedbf248bac0
gsm-fw/g23m-aci subtree: initial import from LoCosto source
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sun, 12 Oct 2014 01:45:14 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
774:40a721fd9854 | 775:eedbf248bac0 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : | |
4 | Modul : | |
5 +----------------------------------------------------------------------------- | |
6 | Copyright 2004 Texas Instruments Berlin, AG | |
7 | All rights reserved. | |
8 | | |
9 | This file is confidential and a trade secret of Texas | |
10 | Instruments Berlin, AG | |
11 | The receipt of or possession of this file does not convey | |
12 | any rights to reproduce or disclose its contents or to | |
13 | manufacture, use, or sell anything it may describe, in | |
14 | whole, or in part, without the specific written consent of | |
15 | Texas Instruments Berlin, AG. | |
16 +----------------------------------------------------------------------------- | |
17 | Purpose : Implementation of the GDD system interface | |
18 +----------------------------------------------------------------------------- | |
19 */ | |
20 | |
21 #define GDD_SYS_C | |
22 | |
23 /*==== INCLUDES =============================================================*/ | |
24 | |
25 #include <string.h> | |
26 #include <stdlib.h> | |
27 #include <stddef.h> | |
28 #include "typedefs.h" | |
29 #include "pcm.h" | |
30 #include "vsi.h" | |
31 #include "custom.h" | |
32 #include "gsm.h" | |
33 | |
34 #include "gdd_dio.h" | |
35 | |
36 #include "gdd_sys.h" | |
37 | |
38 /*==== DEFINITIONS===========================================================*/ | |
39 | |
40 #ifdef GDD_DIO_USE_EXTERNAL_MEM_POOL | |
41 #define EXT_ALLOC(S) (void*)vsi_m_new(S,ExtGroupHandle FILE_LINE_MACRO) | |
42 #define EXT_FREE(P) vsi_m_free((T_VOID_STRUCT **)&P FILE_LINE_MACRO) | |
43 | |
44 /* Handle to external memory pool dediated to GDD_SYS */ | |
45 T_HANDLE ExtGroupHandle = 3; | |
46 | |
47 #endif /* GDD_DIO_USE_EXTERNAL_MEM_POOL */ | |
48 | |
49 | |
50 /*==== TYPES ================================================================*/ | |
51 | |
52 /*==== PROTOTYPES ===========================================================*/ | |
53 | |
54 /*==== GLOBAL VARS ==========================================================*/ | |
55 | |
56 /*==== LOCAL FUNCTIONS=======================================================*/ | |
57 | |
58 /*==== EXPORTED FUNCTIONS====================================================*/ | |
59 | |
60 void * gdd_sys_mem_malloc(int size) | |
61 { | |
62 void * p; | |
63 | |
64 TRACE_USER_CLASS_P1(TC_SYS_INTERFACE, "[GDD] gdd_sys_mem_malloc(size=%d)", size); | |
65 | |
66 #ifdef GDD_DIO_USE_EXTERNAL_MEM_POOL | |
67 p = EXT_ALLOC(size); | |
68 #else /* GDD_DIO_USE_EXTERNAL_MEM_POOL */ | |
69 p = M_ALLOC(size); | |
70 #endif /* GDD_DIO_USE_EXTERNAL_MEM_POOL */ | |
71 TRACE_USER_CLASS_P1(TC_SYS_INTERFACE, "[GDD] allocated buffer: 0x%4x", p); | |
72 | |
73 return p; | |
74 } | |
75 | |
76 void gdd_sys_mem_free(void * p) | |
77 { | |
78 TRACE_USER_CLASS_P1(TC_SYS_INTERFACE, "[GDD] gdd_sys_mem_free(p=0x%4x)", p); | |
79 | |
80 #ifdef GDD_DIO_USE_EXTERNAL_MEM_POOL | |
81 EXT_FREE(p); | |
82 #else /* GDD_DIO_USE_EXTERNAL_MEM_POOL */ | |
83 M_FREE(p); | |
84 #endif /* GDD_DIO_USE_EXTERNAL_MEM_POOL */ | |
85 } | |
86 | |
87 T_GDD_SEM gdd_sys_sem_open(char * name, unsigned short count) | |
88 { | |
89 TRACE_USER_CLASS_P2(TC_SYS_INTERFACE, "[GDD] gdd_sys_sem_open(name=%s, count=%d)", name, count); | |
90 | |
91 return vsi_s_open(VSI_CALLER name, count); | |
92 } | |
93 | |
94 int gdd_sys_sem_close(T_GDD_SEM sem) | |
95 { | |
96 TRACE_USER_CLASS_P1(TC_SYS_INTERFACE, "[GDD] gdd_sys_sem_close(sem=%d)", sem); | |
97 | |
98 return vsi_s_close(VSI_CALLER sem); | |
99 } | |
100 | |
101 int gdd_sys_sem_down(T_GDD_SEM sem) | |
102 { | |
103 TRACE_USER_CLASS_P1(TC_SYS_INTERFACE, "[GDD] gdd_sys_sem_down(sem=%d)", sem); | |
104 | |
105 return vsi_s_get(VSI_CALLER sem); | |
106 } | |
107 | |
108 int gdd_sys_sem_up(T_GDD_SEM sem) | |
109 { | |
110 TRACE_USER_CLASS_P1(TC_SYS_INTERFACE, "[GDD] gdd_sys_sem_up(sem=%d)", sem); | |
111 | |
112 return vsi_s_release(VSI_CALLER sem); | |
113 } | |
114 | |
115 int gdd_sys_sem_status(T_GDD_SEM sem, /*out*/ unsigned short * count) | |
116 { | |
117 TRACE_USER_CLASS_P1(TC_SYS_INTERFACE, "[GDD] gdd_sys_sem_status(sem=%d)", sem); | |
118 | |
119 return vsi_s_status(VSI_CALLER sem, count); | |
120 } |