17f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/*
27f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * Copyright (C) 2008 The Android Open Source Project
37f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project *
47f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * Licensed under the Apache License, Version 2.0 (the "License");
57f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * you may not use this file except in compliance with the License.
67f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * You may obtain a copy of the License at
77f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project *
87f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project *      http://www.apache.org/licenses/LICENSE-2.0
97f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project *
107f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * Unless required by applicable law or agreed to in writing, software
117f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * distributed under the License is distributed on an "AS IS" BASIS,
127f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
137f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * See the License for the specific language governing permissions and
147f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * limitations under the License.
157f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project */
167f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
177f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#ifndef bbs_INT16ARR_EM_H
187f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#define bbs_INT16ARR_EM_H
197f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
207f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- includes ----------------------------------------------------------- */
217f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
227f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#include "b_BasicEm/Context.h"
237f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#include "b_BasicEm/MemSeg.h"
247f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
257f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- related objects  --------------------------------------------------- */
267f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
277f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- typedefs ----------------------------------------------------------- */
287f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
297f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- constants ---------------------------------------------------------- */
307f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
317f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- object definition -------------------------------------------------- */
327f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
337f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** short array */
347f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectstruct bbs_Int16Arr
357f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{
367f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
377f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	/* ---- private data --------------------------------------------------- */
387f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
397f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	/** pointer to exclusive memory segment used for allocation */
407f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	struct bbs_MemSeg* mspE;
417f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
427f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	/* ---- public data ---------------------------------------------------- */
437f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
447f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	/** pointer to array of int16 */
457f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	int16* arrPtrE;
467f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
477f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	/** current size */
487f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	uint32 sizeE;
497f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
507f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	/** allocated size */
517f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	uint32 allocatedSizeE;
527f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
537f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project};
547f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
557f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- associated objects ------------------------------------------------- */
567f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
577f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- external functions ------------------------------------------------- */
587f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
597f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ constructor/destructor } ------------------------------------- */
607f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
617f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** initializes bbs_Int16Arr  */
627f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bbs_Int16Arr_init( struct bbs_Context* cpA,
637f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project					    struct bbs_Int16Arr* ptrA );
647f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
657f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** frees bbs_Int16Arr  */
667f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bbs_Int16Arr_exit( struct bbs_Context* cpA,
677f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project					    struct bbs_Int16Arr* ptrA );
687f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
697f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ operators } -------------------------------------------------- */
707f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
717f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** copy operator */
727f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bbs_Int16Arr_copy( struct bbs_Context* cpA,
737f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project					    struct bbs_Int16Arr* ptrA,
747f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project						const struct bbs_Int16Arr* srcPtrA );
757f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
767f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** equal operator */
777f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectflag bbs_Int16Arr_equal( struct bbs_Context* cpA,
787f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project						 const struct bbs_Int16Arr* ptrA,
797f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project						 const struct bbs_Int16Arr* srcPtrA );
807f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
817f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ query functions } -------------------------------------------- */
827f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
837f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** calculates the amount of heap memory needed (16bit words) if created with given parameters */
847f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectuint32 bbs_Int16Arr_heapSize( struct bbs_Context* cpA,
857f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project							  const struct bbs_Int16Arr* ptrA,
867f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project							  uint32 sizeA );
877f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
887f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ modify functions } ------------------------------------------- */
897f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
907f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** allocates memory for bbs_Int16Arr */
917f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bbs_Int16Arr_create( struct bbs_Context* cpA,
927f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project						  struct bbs_Int16Arr* ptrA,
937f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project						  uint32 sizeA,
947f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project						  struct bbs_MemSeg* mspA );
957f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
967f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** allocates memory for bbs_Int16Arr,
977f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	Allocation is done for allocPtrA with extra memory to allow for alignment,
987f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	aligned memory pointer is copied to ptrA.
997f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	alignBytes must be a power of 2.
1007f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project	bbs_Int16Arr_heapSize does not apply !
1017f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project*/
1027f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bbs_Int16Arr_createAligned( struct bbs_Context* cpA,
1037f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project								 struct bbs_Int16Arr* ptrA,
1047f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project								 uint32 sizeA,
1057f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project								 struct bbs_MemSeg* mspA,
1067f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project								 struct bbs_Int16Arr* allocPtrA,
1077f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project								 uint32 alignBytesA );
1087f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1097f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** sets array size */
1107f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bbs_Int16Arr_size( struct bbs_Context* cpA,
1117f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project					    struct bbs_Int16Arr* ptrA,
1127f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project						uint32 sizeA );
1137f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1147f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ memory I/O } ------------------------------------------------- */
1157f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1167f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** size object needs when written to memory */
1177f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectuint32 bbs_Int16Arr_memSize( struct bbs_Context* cpA,
1187f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project							 const struct bbs_Int16Arr* ptrA );
1197f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1207f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** writes object to memory; returns number of 16-bit words written */
1217f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectuint32 bbs_Int16Arr_memWrite( struct bbs_Context* cpA,
1227f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project							  const struct bbs_Int16Arr* ptrA,
1237f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project							  uint16* memPtrA );
1247f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1257f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** reads object from memory; returns number of 16-bit words read */
1267f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectuint32 bbs_Int16Arr_memRead( struct bbs_Context* cpA,
1277f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project							 struct bbs_Int16Arr* ptrA,
1287f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project							 const uint16* memPtrA,
1297f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project							 struct bbs_MemSeg* mspA );
1307f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1317f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ exec functions } --------------------------------------------- */
1327f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1337f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** fills array with a value */
1347f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bbs_Int16Arr_fill( struct bbs_Context* cpA,
1357f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project					    struct bbs_Int16Arr* ptrA,
1367f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project						int16 valA );
1377f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
1387f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#endif /* bbs_INT16ARR_EM_H */
1397f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project
140