yu.dong | c33b307 | 2024-08-21 23:14:49 -0700 | [diff] [blame^] | 1 | /***************************************************************************** |
| 2 | * Copyright Statement: |
| 3 | * -------------------- |
| 4 | * This software is protected by Copyright and the information contained |
| 5 | * herein is confidential. The software may not be copied and the information |
| 6 | * contained herein may not be used or disclosed except with the written |
| 7 | * permission of MediaTek Inc. (C) 2005 |
| 8 | * |
| 9 | * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES |
| 10 | * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") |
| 11 | * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON |
| 12 | * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, |
| 13 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF |
| 14 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. |
| 15 | * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE |
| 16 | * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR |
| 17 | * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH |
| 18 | * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO |
| 19 | * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S |
| 20 | * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. |
| 21 | * |
| 22 | * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE |
| 23 | * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, |
| 24 | * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, |
| 25 | * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO |
| 26 | * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. |
| 27 | * |
| 28 | * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE |
| 29 | * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF |
| 30 | * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND |
| 31 | * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER |
| 32 | * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC). |
| 33 | * |
| 34 | *****************************************************************************/ |
| 35 | |
| 36 | /***************************************************************************** |
| 37 | * |
| 38 | * Filename: |
| 39 | * --------- |
| 40 | * bitop_funcs.h |
| 41 | * |
| 42 | * Project: |
| 43 | * -------- |
| 44 | * Maui_Software |
| 45 | * |
| 46 | * Description: |
| 47 | * ------------ |
| 48 | * Functions for putting and getting bit fields into |
| 49 | * byte arrays. |
| 50 | * |
| 51 | * Author: |
| 52 | * ------- |
| 53 | * ------- |
| 54 | * |
| 55 | *============================================================================ |
| 56 | * HISTORY |
| 57 | * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 58 | *------------------------------------------------------------------------------ |
| 59 | * removed! |
| 60 | * removed! |
| 61 | * removed! |
| 62 | * |
| 63 | * removed! |
| 64 | * removed! |
| 65 | * removed! |
| 66 | * |
| 67 | * removed! |
| 68 | * removed! |
| 69 | * removed! |
| 70 | * |
| 71 | * removed! |
| 72 | * removed! |
| 73 | * removed! |
| 74 | * |
| 75 | * removed! |
| 76 | * removed! |
| 77 | * removed! |
| 78 | * removed! |
| 79 | * removed! |
| 80 | * removed! |
| 81 | * removed! |
| 82 | * removed! |
| 83 | * removed! |
| 84 | * removed! |
| 85 | *------------------------------------------------------------------------------ |
| 86 | * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 87 | *============================================================================ |
| 88 | ****************************************************************************/ |
| 89 | |
| 90 | /********************************************************************* |
| 91 | (C) _____ (year of first publication) Sasken communication |
| 92 | Technologies Limited, All rights reserved. |
| 93 | * This file provides a template for .c files. This space |
| 94 | * should be used to describe the file contents |
| 95 | * Component-specific prefix : xxxx |
| 96 | *********************************************************************/ |
| 97 | |
| 98 | #ifndef _BITOP_FUNCS_H |
| 99 | #define _BITOP_FUNCS_H |
| 100 | /*RHR*/ |
| 101 | #include "kal_general_types.h" |
| 102 | /*RHR*/ |
| 103 | /*************************************************************************** |
| 104 | * Exported Function Prototypes |
| 105 | ***************************************************************************/ |
| 106 | extern unsigned int mask(unsigned int width); |
| 107 | |
| 108 | extern unsigned int get_bits_1_8( |
| 109 | kal_uint8 *addr, |
| 110 | unsigned int offset, |
| 111 | unsigned int width |
| 112 | ); |
| 113 | |
| 114 | extern unsigned int get_bits_9_16( |
| 115 | kal_uint8 *addr, |
| 116 | unsigned int offset, |
| 117 | unsigned int width |
| 118 | ); |
| 119 | |
| 120 | extern unsigned int get_bits_17_24( |
| 121 | kal_uint8 *addr, |
| 122 | unsigned int offset, |
| 123 | unsigned int width |
| 124 | ); |
| 125 | |
| 126 | extern unsigned int get_bits_25_32( |
| 127 | kal_uint8 *addr, |
| 128 | unsigned int offset, |
| 129 | unsigned int width |
| 130 | ); |
| 131 | |
| 132 | |
| 133 | extern unsigned int get_bits( |
| 134 | kal_uint8 *addr, |
| 135 | unsigned int offset, |
| 136 | unsigned int width |
| 137 | ); |
| 138 | |
| 139 | |
| 140 | extern void put_bits_1_8( |
| 141 | kal_uint8 *addr, |
| 142 | unsigned int offset, |
| 143 | unsigned int width, |
| 144 | unsigned int put_val |
| 145 | ); |
| 146 | |
| 147 | |
| 148 | extern void put_bits_9_16( |
| 149 | kal_uint8 *addr, |
| 150 | unsigned int offset, |
| 151 | unsigned int width, |
| 152 | unsigned int put_val |
| 153 | ); |
| 154 | |
| 155 | |
| 156 | extern void put_bits_17_24( |
| 157 | kal_uint8 *addr, |
| 158 | unsigned int offset, |
| 159 | unsigned int width, |
| 160 | unsigned int put_val |
| 161 | ); |
| 162 | |
| 163 | extern void put_bits_25_32( |
| 164 | kal_uint8 *addr, |
| 165 | unsigned int offset, |
| 166 | unsigned int width, |
| 167 | unsigned int put_val |
| 168 | ); |
| 169 | |
| 170 | |
| 171 | extern void put_bits( |
| 172 | kal_uint8 *addr, |
| 173 | unsigned int offset, |
| 174 | unsigned int width, |
| 175 | unsigned int put_val |
| 176 | ); |
| 177 | |
| 178 | /* constants for shift directions */ |
| 179 | #define SHIFT_LEFT 1 |
| 180 | #define SHIFT_RIGHT 2 |
| 181 | |
| 182 | /* Length of a static buffer */ |
| 183 | #define SHIFT_BUFFER_LEN 255 |
| 184 | |
| 185 | void copy_bits16(const kal_uint8 *pzSrc, |
| 186 | kal_uint16 u16SrcIndex, |
| 187 | kal_uint8 *pzDst, |
| 188 | kal_uint16 *pu16DstIndex, |
| 189 | kal_uint16 u16NumBits); |
| 190 | |
| 191 | kal_uint16 shift_bits16(kal_uint8 *pzSrc, |
| 192 | kal_uint8 *pzDest, |
| 193 | kal_uint16 u16SizeInBytes, |
| 194 | kal_uint16 u16ShiftBits, |
| 195 | kal_uint16 u16Direction); |
| 196 | |
| 197 | /*************************************************************************** |
| 198 | * Declarations Of Exported Globals |
| 199 | ***************************************************************************/ |
| 200 | |
| 201 | #endif /* _BITOP_FUNCS_H */ |
| 202 | |