• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2008 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef bbs_APH_ARR_EM_H
18 #define bbs_APH_ARR_EM_H
19 
20 /* ---- includes ----------------------------------------------------------- */
21 
22 #include "b_BasicEm/Context.h"
23 #include "b_BasicEm/MemSeg.h"
24 #include "b_BasicEm/APh.h"
25 
26 /* ---- related objects  --------------------------------------------------- */
27 
28 /* ---- typedefs ----------------------------------------------------------- */
29 
30 /* ---- constants ---------------------------------------------------------- */
31 
32 /* ---- object definition -------------------------------------------------- */
33 
34 /** abs phase array */
35 struct bbs_APhArr
36 {
37 
38 	/* ---- private data --------------------------------------------------- */
39 
40 	/** pointer to exclusive memory segment used for allocation */
41 	struct bbs_MemSeg* mspE;
42 
43 	/* ---- public data ---------------------------------------------------- */
44 
45 	/** pointer to array of bytes */
46 	struct bbs_APh* arrPtrE;
47 
48 	/** current size */
49 	uint32 sizeE;
50 
51 	/** allocated size */
52 	uint32 allocatedSizeE;
53 
54 };
55 
56 /* ---- associated objects ------------------------------------------------- */
57 
58 /* ---- external functions ------------------------------------------------- */
59 
60 /* ---- \ghd{ constructor/destructor } ------------------------------------- */
61 
62 /** initializes bbs_APhArr  */
63 void bbs_APhArr_init( struct bbs_Context* cpA,
64 					  struct bbs_APhArr* ptrA );
65 
66 /** frees bbs_APhArr  */
67 void bbs_APhArr_exit( struct bbs_Context* cpA,
68 					  struct bbs_APhArr* ptrA );
69 
70 /* ---- \ghd{ operators } -------------------------------------------------- */
71 
72 /** copy operator */
73 void bbs_APhArr_copy( struct bbs_Context* cpA,
74 					  struct bbs_APhArr* ptrA,
75 					  const struct bbs_APhArr* srcPtrA );
76 
77 /** equal operator */
78 flag bbs_APhArr_equal( struct bbs_Context* cpA,
79 					   const struct bbs_APhArr* ptrA,
80 					   const struct bbs_APhArr* srcPtrA );
81 
82 /* ---- \ghd{ query functions } -------------------------------------------- */
83 
84 /** calculates the amount of heap memory needed (16bit words) if created with given parameters */
85 uint32 bbs_APhArr_heapSize( struct bbs_Context* cpA,
86 						    const struct bbs_APhArr* ptrA,
87 							uint32 sizeA );
88 
89 /* ---- \ghd{ modify functions } ------------------------------------------- */
90 
91 /** creates bbs_APhArr object.
92   * This function must be called after initialization before usage of
93   * object.
94   */
95 void bbs_APhArr_create( struct bbs_Context* cpA,
96 					    struct bbs_APhArr* ptrA,
97 					    uint32 sizeA,
98 						struct bbs_MemSeg* mspA );
99 
100 /** sets array size */
101 void bbs_APhArr_size( struct bbs_Context* cpA,
102 					  struct bbs_APhArr* ptrA,
103 					  uint32 sizeA );
104 
105 /* ---- \ghd{ memory I/O } ------------------------------------------------- */
106 
107 /** size object needs when written to memory */
108 uint32 bbs_APhArr_memSize( struct bbs_Context* cpA,
109 						   const struct bbs_APhArr* ptrA );
110 
111 /** writes object to memory; returns number of bytes written */
112 uint32 bbs_APhArr_memWrite( struct bbs_Context* cpA,
113 						    const struct bbs_APhArr* ptrA,
114 							uint16* memPtrA );
115 
116 /** reads object from memory; returns number of bytes read */
117 uint32 bbs_APhArr_memRead( struct bbs_Context* cpA,
118 						   struct bbs_APhArr* ptrA,
119 						   const uint16* memPtrA,
120 						   struct bbs_MemSeg* mspA );
121 
122 /* ---- \ghd{ exec functions } --------------------------------------------- */
123 
124 #endif /* bbs_APH_ARR_EM_H */
125 
126