Home | History | Annotate | Download | only in b_FDSDK
      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 btk_SDK_EM_H
     18 #define btk_SDK_EM_H
     19 
     20 #ifdef __cplusplus
     21 extern "C" {
     22 #endif
     23 
     24 /**
     25  *  Visual Sensing SDK
     26  *  SDK Context object
     27  */
     28 
     29 /* ---- includes ----------------------------------------------------------- */
     30 
     31 #include "Types.h"
     32 #include <sys/types.h>
     33 
     34 /* ---- related objects  --------------------------------------------------- */
     35 
     36 /** SDK context object */
     37 struct btk_SDK;
     38 
     39 /* ---- typedefs ----------------------------------------------------------- */
     40 
     41 /** handle for SDK context */
     42 typedef struct btk_SDK* btk_HSDK;
     43 
     44 /** malloc function pointer */
     45 typedef void* ( *btk_fpMalloc )( size_t sizeA );
     46 
     47 /** free function pointer */
     48 typedef void ( *btk_fpFree )( void* memPtrA );
     49 
     50 /** error handler function pointer */
     51 typedef void ( *btk_fpError )( btk_HSDK hsdkA );
     52 
     53 /** SDK creation parameters */
     54 typedef struct
     55 {
     56 	/** (optional) handler to error-handler function */
     57 	btk_fpError  fpError;
     58 
     59 	/** handler to malloc function */
     60 	btk_fpMalloc fpMalloc;
     61 
     62 	/** handler to free function */
     63 	btk_fpFree   fpFree;
     64 
     65 	/** pointer to preallocated exclusive (=persistent) memory (alternative to fpMalloc) */
     66 	void* pExMem;
     67 
     68 	/** size of external memory */
     69 	u32 sizeExMem;
     70 
     71 	/** pointer to preallocated shared memory (alternative to fpMalloc) */
     72 	void* pShMem;
     73 
     74 	/** size of external memory */
     75 	u32 sizeShMem;
     76 
     77 	/** pointer to 0-terminated license key string */
     78 	const char* licenseKey;
     79 
     80 	/** maximum image witdh used */
     81 	u32 maxImageWidth;
     82 
     83 	/** maximum image height used */
     84 	u32 maxImageHeight;
     85 
     86 } btk_SDKCreateParam;
     87 
     88 /* ---- constants ---------------------------------------------------------- */
     89 
     90 /* ---- functions ---------------------------------------------------------- */
     91 
     92 /** returns default SDK parameters */
     93 btk_DECLSPEC
     94 btk_SDKCreateParam btk_SDK_defaultParam( void );
     95 
     96 /** creates an SDK context using dynamic memory management */
     97 btk_DECLSPEC
     98 btk_Status btk_SDK_create( const btk_SDKCreateParam* pCreateParamA,
     99 						   btk_HSDK* hpsdkA );
    100 
    101 /** closes an SDK context */
    102 btk_DECLSPEC
    103 btk_Status btk_SDK_close( btk_HSDK hsdkA );
    104 
    105 /** returns last occurred error and removes it from the error stack */
    106 btk_DECLSPEC
    107 btk_Error btk_SDK_getError( btk_HSDK hsdkA,
    108 						    char* msgBufA,
    109 							u32 msgBufSizeA );
    110 
    111 /** returns amount of allocated exclusive memory in bytes */
    112 btk_DECLSPEC
    113 u32 btk_SDK_exAllocSize( btk_HSDK hsdkA );
    114 
    115 /** returns amount of allocated shared memory in bytes */
    116 btk_DECLSPEC
    117 u32 btk_SDK_shAllocSize( btk_HSDK hsdkA );
    118 
    119 /** returns total amount of allocated memory in bytes */
    120 btk_DECLSPEC
    121 u32 btk_SDK_allocSize( btk_HSDK hsdkA );
    122 
    123 #ifdef __cplusplus
    124 }
    125 #endif
    126 
    127 #endif /* btk_SDK_EM_H */
    128