亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? lpc21isp.c

?? LPC2000系列化的ISP下載源程序
?? C
?? 第 1 頁 / 共 5 頁
字號:
            }            Pos++;            RecordLength   = Ascii2Hex(FileContent[Pos++]);            RecordLength <<= 4;            RecordLength  |= Ascii2Hex(FileContent[Pos++]);            DebugPrintf( 4, "RecordLength = %02X\n", RecordLength);            RecordAddress   = Ascii2Hex(FileContent[Pos++]);            RecordAddress <<= 4;            RecordAddress  |= Ascii2Hex(FileContent[Pos++]);            RecordAddress <<= 4;            RecordAddress  |= Ascii2Hex(FileContent[Pos++]);            RecordAddress <<= 4;            RecordAddress  |= Ascii2Hex(FileContent[Pos++]);            DebugPrintf( 4, "RecordAddress = %04X\n", RecordAddress);            RealAddress = RealAddress - (RealAddress & 0xffff) + RecordAddress;            DebugPrintf( 4, "RealAddress = %08lX\n", RealAddress);            RecordType      = Ascii2Hex(FileContent[Pos++]);            RecordType    <<= 4;            RecordType     |= Ascii2Hex(FileContent[Pos++]);            DebugPrintf( 4, "RecordType = %02X\n", RecordType);            if(RecordType == 0x00)          // 00 - Data record            {                    // Memory for binary file big enough ?                while(RealAddress + RecordLength > BinaryMemSize)                {                    BinaryMemSize <<= 1;                    IspEnvironment->BinaryContent = realloc(IspEnvironment->BinaryContent, BinaryMemSize);                }                    // We need to know, what the highest address is,                    // how many bytes / sectors we must flash                if(RealAddress + RecordLength > IspEnvironment->BinaryLength)                {                    IspEnvironment->BinaryLength = RealAddress + RecordLength;                    DebugPrintf( 3, "Image size now: %ld\n", IspEnvironment->BinaryLength);                }                for(i = 0; i < RecordLength; i++)                {                    Hexvalue        = Ascii2Hex(FileContent[Pos++]);                    Hexvalue      <<= 4;                    Hexvalue       |= Ascii2Hex(FileContent[Pos++]);                    IspEnvironment->BinaryContent[RealAddress + i] = Hexvalue;                }            }            else if(RecordType == 0x01)     // 01 - End of file record            {                break;            }            else if(RecordType == 0x02)     // 02 - Extended segment address record            {                for(i = 0; i < RecordLength * 2; i++)   // double amount of nibbles                {                    RealAddress <<= 4;                    if(i == 0)                    {                        RealAddress  = Ascii2Hex(FileContent[Pos++]);                    }                    else                    {                        RealAddress |= Ascii2Hex(FileContent[Pos++]);                    }                }                RealAddress <<= 4;            }            else if(RecordType == 0x03)     // 03 - Start segment address record            {                for(i = 0; i < RecordLength * 2; i++)   // double amount of nibbles                {                    RealAddress <<= 4;                    if(i == 0)                    {                        RealAddress  = Ascii2Hex(FileContent[Pos++]);                    }                    else                    {                        RealAddress |= Ascii2Hex(FileContent[Pos++]);                    }                }                RealAddress <<= 8;            }            else if(RecordType == 0x04)     // 04 - Extended linear address record, used by IAR            {                DebugPrintf( 1, "RecordType %02X not yet implemented - ignore ?\n", RecordType);                // exit(1);            }            else if(RecordType == 0x05)     // 05 - Start linear address record            {                DebugPrintf( 1, "RecordType %02X not yet implemented\n", RecordType);                exit(1);            }            while(FileContent[Pos++] != 0x0a)      // Search till line end            {            }        }        DebugPrintf( 2, "File %s converted to binary format...\n", IspEnvironment->input_file);            // When debugging is switched on, output result of conversion to file debugout.bin        if(debug_level >= 4)        {            int fdout;            fdout = open("debugout.bin", O_RDWR | O_BINARY | O_CREAT | O_TRUNC, 0777);            write(fdout, IspEnvironment->BinaryContent, IspEnvironment->BinaryLength);            close(fdout);        }    }    else    {        memcpy(IspEnvironment->BinaryContent, FileContent, FileLength);        IspEnvironment->BinaryLength = FileLength;    }    DebugPrintf( 2, "Image size : %ld\n", IspEnvironment->BinaryLength);        // check length to flash for correct alignment, can happen with broken ld-scripts    if (IspEnvironment->BinaryLength % 4 != 0)    {        unsigned long NewBinaryLength = ((IspEnvironment->BinaryLength + 3)/4) * 4;        DebugPrintf( 2, "Warning:  data not aligned to 32 bits, padded (length was %lX, now %lX)\n", IspEnvironment->BinaryLength, NewBinaryLength);        IspEnvironment->BinaryLength = NewBinaryLength;    }}#define ANALOG_DEVICES_SYNC_CHAR        ((BINARY)0x08)#define ANALOG_DEVICES_SYNC_RESPONSE    ("ADuC")#define ANALOG_DEVICES_SYNC_SIZE        (strlen( ANALOG_DEVICES_SYNC_RESPONSE))typedef struct {    BINARY product_id[15];    BINARY version[3];    BINARY reserved[4];    BINARY terminator[2];    } AD_SYNC_RESPONSE;/***************************** AnalogDevicesSync ************************//**  Attempt to synchronize with an Analog Device ARM micro.  Sends abackspace and reads back the microcontrollers response.  Performsmultiple retries. Exits the program on error, returns to caller in thecase of success.*/static void AnalogDevicesSync(ISP_ENVIRONMENT *IspEnvironment){    BINARY sync;                        /* Holds sync command.          */    AD_SYNC_RESPONSE response;          /* Response from micro.         */    int sync_attempts;                  /* Number of retries.           */        /*  Make sure we don't read garbage later instead of the        */        /* response we expect from the micro.                           */    ClearSerialPortBuffers(IspEnvironment);    DebugPrintf( 2, "Synchronizing\n"); /* Progress report.             */    sync = ANALOG_DEVICES_SYNC_CHAR;    /* Build up sync command.       */        /*  Perform the actual sync attempt.  First send the sync       */        /* character, the attempt to read back the response.  For the   */        /* AD ARM micro this is a fixed length block.  If response is   */        /* received attempt to validate it by comparing the first       */        /* characters to those expected.  If the received block does    */        /* not validate or is incomplete empty the serial buffer and    */        /* retry.                                                       */    for(sync_attempts = 0; sync_attempts < 5; sync_attempts++)    {        SendComPortBlock( IspEnvironment, &sync, 1);        if( ReceiveComPortBlockComplete( IspEnvironment, &response, sizeof( response),            500) == 0)        {            if( memcmp( response.product_id, ANALOG_DEVICES_SYNC_RESPONSE,                ANALOG_DEVICES_SYNC_SIZE) == 0)            {                return;            }            else            {                DumpString( 3, &response, sizeof(response),                    "Unexpected response to sync attempt ");            }        }        else        {            DebugPrintf( 3, "No (or incomplete) answer on sync attempt\n");        }        ClearSerialPortBuffers(IspEnvironment);    }    DebugPrintf( 1, "No (or unacceptable) answer on sync attempt\n");    exit(4);}typedef struct {    char start1;    char start2;    BINARY bytes;    char cmd;    BINARY address_h;    BINARY address_u;    BINARY address_m;    BINARY address_l;    BINARY data[251];    } AD_PACKET;/***************************** AnalogDevicesFormPacket ******************//**  Create an Analog Devices communication packet from the constituentelements.\param [in] cmd The command being sent, one of 'E' for erase, 'W' forwrite, 'V' for verify or 'R' for run..\param [in] no_bytes the number of data bytes to send with the command inthe packet.\param [in] address the address to apply the command to.\param [in] data the data to send with the packet, may be null if no_bytesis zero.\param[out] packet that will be filled.*/static void AnalogDevicesFormPacket( ISP_ENVIRONMENT *IspEnvironment,                                     char cmd, int no_bytes, unsigned int address,                                     const void *data, AD_PACKET *packet){    BINARY checksum;    const BINARY *data_in;    int i;    (void)IspEnvironment; /* never used in this function */        /*  Some sanity checking on the arguments.  These should only   */        /* fail if there is a bug in the caller.                        */        /*  Check 1) that the number of data bytes is in an acceptable  */        /* range, 2) that we have a non-null pointer if data is being   */        /* put in the packet and 3) that we have a non-null pointer to  */        /* the packet to be filled. We just exit with an error message  */        /* if any of these tests fail.                                  */    if( (no_bytes < 0) || (no_bytes > 250))    {        DebugPrintf( 1,            "The number of bytes (%d) passed to FormPacket is invalid.\n",            no_bytes);        exit( -1);    }    if( (data == 0) && (no_bytes != 0))    {        DebugPrintf( 1,            "A null pointer to data paased to FormPacket when data was expected.\n");        exit( -1);    }    if( packet == 0)    {        DebugPrintf( 1,            "A null packet pointer was passed to FormPacket.\n");        exit( -1);    }    checksum = 0;               /*  Checksum starts at zero.            */    data_in = data;             /*  Pointer pun so we can walk through  */                                /* the data.                            */    packet->start1 = 0x7;       /*  The start of the packet is constant.*/    packet->start2 = 0xE;        /*  Fill in the rest of the packet and calculate the checksum   */        /* as we go.                                                    */        /* The number of bytes is the number of data bytes + the        */        /* address bytes + the command byte.                            */    packet->bytes = no_bytes + 5;    checksum += packet->bytes;        /*  The command for the packet being sent.  No error checking   */        /* done on this.                                                */    packet->cmd = cmd;    checksum += cmd;        /*  Now break up the address and place in the proper packet     */        /* locations.                                                   */    packet->address_l = address & 0xFF;    packet->address_m = (address >> 8) & 0xFF;    packet->address_u = (address >> 16) & 0xFF;    packet->address_h = (address >> 24) & 0xFF;    checksum += packet->address_l;    checksum += packet->address_m;    checksum += packet->address_u;    checksum += packet->address_h;        /*  Copy the data bytes into the packet.  We could use memcpy   */        /* but we have to calculate the checksum anyway.                */    for( i = 0; i < no_bytes; i++)    {        packet->data[i] = data_in[i];        checksum += data_in[i];    }        /*  Finally, add the checksum to the end of the packet.         */    packet->data[i] = -checksum;}#define ANALOG_DEVICES_ACK      0x6#define ANALOG_DEVICES_NAK      0x7/***************************** AnalogDevicesSendPacket ******************//**  Send a previously form Analog Devices communication.  Retry acouple of times if needed but fail by exiting the program if no ACK isforthcoming.\param [in] packet the packet to send.*/static void AnalogDevicesSendPacket( ISP_ENVIRONMENT *IspEnvironment,                                     const AD_PACKET * packet){    BINARY response;    int retry = 0;    do {        retry++;                /*  Make sure we don't read garbage later instead of    */                /* the response we expect from the micro.               */        ClearSerialPortBuffers(IspEnvironment);                /*  Send the packet, the size is the number of data     */                /* bytes in the packet plus 3 bytes worth of header     */                /* plus checksum.                                       */        SendComPortBlock( IspEnvironment, packet, packet->bytes + 4);                /*  Receive the response and check, return to caller    */                /* if successful.                                       */        if( ReceiveComPortBlockComplete( IspEnvironment, &response, 1, 500) == 0)        {            if( response == ANALOG_DEVICES_ACK)            {                DebugPrintf( 3, "Packet Sent\n");                return;            }            if( response != ANALOG_DEVICES_NAK)            {                DebugPrintf( 3, "Unexpected response to packet (%x)\n", (int)response);            }            DebugPrintf( 2, "*");        }    } while( retry < 3);    DebugPrintf( 1, "Send packet failed\n");    exit( -1);}/***************************** AnalogDevicesErase ***********************/

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久不卡影院| 欧美综合在线视频| 精品对白一区国产伦| 九九在线精品视频| 精品免费日韩av| 国内成人精品2018免费看| 26uuu亚洲婷婷狠狠天堂| 黄色日韩网站视频| 中日韩免费视频中文字幕| 成人一区二区三区视频| 亚洲精品免费在线观看| 欧美日韩精品一区视频| 毛片一区二区三区| 欧美国产精品专区| 色94色欧美sute亚洲13| 天天综合网天天综合色| 精品国一区二区三区| 成人激情免费网站| 亚洲一区二区三区在线播放| 制服丝袜亚洲播放| 国产精品亚洲а∨天堂免在线| 国产精品嫩草99a| 欧美在线观看视频一区二区 | 午夜久久久久久久久久一区二区| 欧美区在线观看| 精品午夜一区二区三区在线观看| 久久精品人人爽人人爽| 日本电影欧美片| 激情文学综合丁香| 一区二区三区视频在线观看| 日韩欧美一级二级| 91色综合久久久久婷婷| 日韩和欧美一区二区三区| 国产免费久久精品| 欧美日韩国产综合草草| 国产精品69久久久久水密桃| 亚洲观看高清完整版在线观看| 精品久久久久久综合日本欧美| 91亚洲精品久久久蜜桃网站| 青青草97国产精品免费观看| 中文字幕欧美一| 日韩欧美一区中文| 欧美视频中文字幕| 成人在线视频一区| 精品影视av免费| 亚洲444eee在线观看| 国产精品人人做人人爽人人添| 在线播放国产精品二区一二区四区 | 亚洲成人在线观看视频| 久久久亚洲精品石原莉奈| 欧美性大战久久久久久久| 成人综合婷婷国产精品久久| 麻豆精品视频在线| 亚洲一级电影视频| 中文字幕av一区二区三区| 欧美大片在线观看一区| 欧美精品三级在线观看| 在线观看91精品国产入口| 99麻豆久久久国产精品免费| 国产一区 二区 三区一级| 日韩va亚洲va欧美va久久| 一区二区不卡在线播放| 亚洲欧美综合在线精品| 国产视频亚洲色图| 国产亚洲精品福利| 久久综合999| 日韩一区二区电影| 4438成人网| 欧美绝品在线观看成人午夜影视| 色综合久久精品| 99re6这里只有精品视频在线观看| 国产精品白丝jk黑袜喷水| 久久99精品久久久久久国产越南| 五月天亚洲精品| 婷婷国产在线综合| 日韩精品欧美精品| 喷白浆一区二区| 麻豆精品一二三| 精品亚洲国内自在自线福利| 久久99精品国产.久久久久久| 美女一区二区在线观看| 激情综合色综合久久综合| 国产一区二区成人久久免费影院| 九九视频精品免费| 国产99久久久国产精品| 国产精品小仙女| 91网站最新网址| 91成人看片片| 91精品免费观看| 日韩一级高清毛片| 亚洲欧美日韩国产成人精品影院| 国产精品国产自产拍高清av王其| 中文字幕乱码亚洲精品一区| 亚洲视频一区二区在线| 亚洲欧美怡红院| 亚洲国产精品视频| 秋霞午夜av一区二区三区| 国内外成人在线视频| 国产精品456| 97久久超碰国产精品| 91激情五月电影| 日韩一区二区电影网| 国产三级精品视频| 亚洲欧美日韩久久精品| 亚洲v精品v日韩v欧美v专区| 精品一区二区三区视频| 国产乱码精品一品二品| 91蜜桃免费观看视频| 欧美日韩你懂的| 精品国产乱码久久久久久老虎| 中文一区二区完整视频在线观看| 亚洲免费视频中文字幕| 日韩电影在线观看网站| 国产成人在线网站| 色偷偷一区二区三区| 欧美一区二区三区男人的天堂| 久久久亚洲国产美女国产盗摄 | 秋霞午夜鲁丝一区二区老狼| 国产麻豆精品在线| 欧美在线视频日韩| 久久久久久久久久久电影| 亚洲免费在线看| 蜜臀av亚洲一区中文字幕| 成人综合婷婷国产精品久久免费| 欧美午夜不卡视频| 国产三级欧美三级日产三级99 | 在线看不卡av| www亚洲一区| 亚洲精品菠萝久久久久久久| 免费在线欧美视频| 在线亚洲人成电影网站色www| 日韩欧美中文字幕精品| 一区二区三区**美女毛片| 九九国产精品视频| 欧美日韩免费一区二区三区视频| 国产拍揄自揄精品视频麻豆| 天天操天天干天天综合网| 成人黄色av电影| 久久亚洲一级片| 日韩精品国产精品| 91美女片黄在线观看91美女| 久久久久国产精品人| 日本视频在线一区| 欧美性猛片xxxx免费看久爱| 亚洲欧洲日韩av| 国产精品中文有码| 日韩欧美亚洲另类制服综合在线| 夜夜嗨av一区二区三区| 成人国产精品免费| 久久久久久久久97黄色工厂| 男人的j进女人的j一区| 欧洲国内综合视频| 亚洲男同性视频| www.性欧美| 国产免费久久精品| 国产成人av一区二区三区在线观看| 91精品婷婷国产综合久久 | 欧美日本一区二区三区四区| 一区在线播放视频| 成人精品一区二区三区四区| 久久久精品免费免费| 国模套图日韩精品一区二区 | 国产麻豆精品久久一二三| 日韩欧美一级精品久久| 日本欧美一区二区三区乱码| 在线不卡a资源高清| 日韩精品一级中文字幕精品视频免费观看 | 亚洲成人动漫一区| 欧美综合色免费| 一区二区激情视频| 欧美影视一区二区三区| 亚洲国产精品久久一线不卡| 欧美在线不卡一区| 亚洲成人一区在线| 欧美久久高跟鞋激| 日韩精品一级二级| 日韩欧美一级二级三级| 免费观看30秒视频久久| 久久综合视频网| 国产精品一区二区黑丝| 国产日韩av一区| 99热精品国产| 一区二区三区影院| 欧美日韩mp4| 精品一区二区三区视频| 国产日产欧美一区二区视频| 不卡的看片网站| 亚洲柠檬福利资源导航| 欧美色精品天天在线观看视频| 亚洲国产美女搞黄色| 538在线一区二区精品国产| 黄一区二区三区| 国产精品久久久久久久久动漫| 91丨九色丨尤物| 亚洲va欧美va国产va天堂影院| 日韩视频一区二区| 成人深夜视频在线观看| 亚洲靠逼com| 欧美tickling挠脚心丨vk| 丁香激情综合五月|