⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lenval.h

📁 Uboot源码,非常通用的bootloader.适用于各种平台的Linux系统引导.
💻 H
字号:
/* * (C) Copyright 2003 * Stefan Roese, esd gmbh germany, stefan.roese@esd-electronics.com * * See file CREDITS for list of people who contributed to this * project. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA *//*******************************************************//* file: lenval.h                                      *//* abstract:  This file contains a description of the  *//*            data structure "lenval".                 *//*******************************************************/#ifndef lenval_dot_h#define lenval_dot_h/* the lenVal structure is a byte oriented type used to store an *//* arbitrary length binary value. As an example, the hex value   *//* 0x0e3d is represented as a lenVal with len=2 (since 2 bytes   *//* and val[0]=0e and val[1]=3d.  val[2-MAX_LEN] are undefined    *//* maximum length (in bytes) of value to read in        *//* this needs to be at least 4, and longer than the     *//* length of the longest SDR instruction.  If there is, *//* only 1 device in the chain, MAX_LEN must be at least *//* ceil(27/8) == 4.  For 6 devices in a chain, MAX_LEN  *//* must be 5, for 14 devices MAX_LEN must be 6, for 20  *//* devices MAX_LEN must be 7, etc..                     *//* You can safely set MAX_LEN to a smaller number if you*//* know how many devices will be in your chain.         */#define MAX_LEN 7000typedef struct var_len_byte{	short len;   /* number of chars in this value */	unsigned char val[MAX_LEN+1];  /* bytes of data */} lenVal;/* return the long representation of a lenVal */extern long value(lenVal *x);/* set lenVal equal to value */extern void initLenVal(lenVal *x, long value);/* check if expected equals actual (taking the mask into account) */extern short EqualLenVal(lenVal *expected, lenVal *actual, lenVal *mask);/* add val1+val2 and put the result in resVal */extern void addVal(lenVal *resVal, lenVal *val1, lenVal *val2);/* return the (byte, bit) of lv (reading from left to right) */extern short RetBit(lenVal *lv, int byte, int bit);/* set the (byte, bit) of lv equal to val (e.g. SetBit("00000000",byte, 1)   equals "01000000" */extern void SetBit(lenVal *lv, int byte, int bit, short val);/* read from XSVF numBytes bytes of data into x */extern void  readVal(lenVal *x, short numBytes);#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -