comparison gsm-fw/ccd/bitfun.h @ 648:970d6199f2c5

gsm-fw/ccd/*.[ch]: initial import from the LoCosto source
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Thu, 04 Sep 2014 05:48:57 +0000
parents
children
comparison
equal deleted inserted replaced
647:a60b375014e3 648:970d6199f2c5
1 /*
2 +-----------------------------------------------------------------------------
3 | Project :
4 | Modul : bitfun.h
5 +-----------------------------------------------------------------------------
6 | Copyright 2002 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 : Condat Coder Decoder
18 | Prototypes of the elementary bit manipulation functions
19 +-----------------------------------------------------------------------------
20 */
21
22
23 #ifndef __BITFUN
24 #define __BITFUN
25
26
27 #ifndef __BITFUN_C__
28
29 EXTERN void bf_writePadBits (T_CCD_Globs *globs);
30 EXTERN void bf_writeVal (ULONG value, ULONG bSize, T_CCD_Globs *globs);
31 EXTERN ULONG bf_getBits (ULONG len, T_CCD_Globs *globs);
32 EXTERN void bf_writeBitStr_PER (USHORT len, T_CCD_Globs *globs);
33 EXTERN void bf_readBitStr_PER (USHORT len, T_CCD_Globs *globs);
34 EXTERN void bf_writeBits (ULONG len, T_CCD_Globs *globs);
35 EXTERN void bf_readBits (ULONG len, T_CCD_Globs *globs);
36 EXTERN void bf_writeBitChunk (ULONG len, T_CCD_Globs *globs);
37 EXTERN void bf_readBitChunk (ULONG len, T_CCD_Globs *globs);
38 EXTERN BOOL bf_readBit (T_CCD_Globs *globs);
39 EXTERN void bf_writeBit (BOOL Bit, T_CCD_Globs *globs);
40 EXTERN UBYTE bf_decodeByteNumber (const ULONG len, T_CCD_Globs *globs);
41 EXTERN ULONG bf_decodeShortNumber (const ULONG len, T_CCD_Globs *globs);
42 EXTERN ULONG bf_decodeLongNumber (UBYTE len, T_CCD_Globs *globs);
43 EXTERN void bf_codeShortNumber (UBYTE len, USHORT val, T_CCD_Globs *globs);
44 EXTERN void bf_codeByteNumber (UBYTE len, UBYTE val, T_CCD_Globs *globs);
45 EXTERN void bf_codeLongNumber (UBYTE len, ULONG val, T_CCD_Globs *globs);
46 EXTERN void bf_recodeShortNumber (USHORT pos, UBYTE len, USHORT val, T_CCD_Globs *globs);
47 EXTERN void bf_recodeByteNumber (USHORT pos, UBYTE len, UBYTE val, T_CCD_Globs *globs);
48 EXTERN void bf_recodeBit (USHORT pos, UBYTE Bit, T_CCD_Globs *globs);
49 EXTERN void bf_rShift8Bit (USHORT srcBitPos, USHORT bitLen, T_CCD_Globs *globs);
50
51 #endif /* __BITFUN_C__ */
52
53 /* a Macro for incrementing the position in the bitbuffer */
54 /* _bitpos, _bytepos and _byteoffs are recalculated */
55
56 #define bf_incBitpos(A, globs) globs->bitpos = (USHORT)(globs->bitpos+(A));\
57 globs->bytepos = (USHORT)(globs->bitpos >> 3);\
58 globs->byteoffs = (UBYTE)(globs->bitpos & 7)
59 #define bf_setBitpos(A, globs) globs->bitpos = (USHORT)(A);\
60 globs->bytepos = (USHORT)(globs->bitpos >> 3);\
61 globs->byteoffs = (UBYTE)(globs->bitpos & 7)
62
63 /*
64 * end of bitstream if we can not read almost 4 bits
65 */
66 #define bf_endOfBitstream(globs) (globs->bitpos >= globs->maxBitpos)
67
68 #endif