Čeština / English
Login

SVN Repository / Prohlížení

Aktuální adresář: FITkit / trunk / mcu / libfitkit /

flash.c

   1  /*******************************************************************************
   2  
   3     Copyright (C) 2009 Brno University of Technology,
   4                        Faculty of Information Technology
   5  
   6     LICENSE TERMS
   7  
   8     Redistribution and use in source and binary forms, with or without
   9     modification, are permitted provided that the following conditions
  10     are met:
  11     1. Redistributions of source code must retain the above copyright
  12        notice, this list of conditions and the following disclaimer.
  13     2. Redistributions in binary form must reproduce the above copyright
  14        notice, this list of conditions and the following disclaimer in
  15        the documentation and/or other materials provided with the
  16        distribution.
  17     3. All advertising materials mentioning features or use of this software
  18        or firmware must display the following acknowledgement:
  19  
  20          This product includes software developed by the University of
  21          Technology, Faculty of Information Technology, Brno and its
  22          contributors.
  23  
  24     4. Neither the name of the Company nor the names of its contributors
  25        may be used to endorse or promote products derived from this
  26        software without specific prior written permission.
  27  
  28     This software or firmware is provided ``as is'', and any express or implied
  29     warranties, including, but not limited to, the implied warranties of
  30     merchantability and fitness for a particular purpose are disclaimed.
  31     In no event shall the company or contributors be liable for any
  32     direct, indirect, incidental, special, exemplary, or consequential
  33     damages (including, but not limited to, procurement of substitute
  34     goods or services; loss of use, data, or profits; or business
  35     interruption) however caused and on any theory of liability, whether
  36     in contract, strict liability, or tort (including negligence or
  37     otherwise) arising in any way out of the use of this software, even
  38     if advised of the possibility of such damage.
  39  
  40     $Id$
  41  
  42     Popis:
  43       Nizko-urovnove fce pro praci z flash.
  44  *******************************************************************************/
  45  
  46  #include <string.h>
  47  #include "arch_specific.h"
  48  #include "fitkitlib.h"
  49  #include "define.h"
  50  #include "globfun.h"
  51  #include "uart.h"
  52  #include "flash_fpga.h"
  53  #include "spi.h"
  54  #include "flash.h"
  55  #include "timer_b.h"
  56  
  57  unsigned short CNT_PAGES = 1024;
  58  
  59  
  60  
  61  
  62  /**
  63   \brief Prevod z cisla stranky na adresu
  64   \return adresa zacatku stranky ve FLASH
  65   **/
  66  unsigned int FLASH_PageToAddr(unsigned short page) {
  67    return (unsigned int)page*PAGE_SIZE;
  68  }
  69  
  70  unsigned char flash_init_(void)
  71  {
  72    unsigned char ii, ipos;
  73    unsigned char status;
  74  
  75    // 100x se zkusim dotazat na stav FLASHky, pokud je vzdy negativni -> CHYBA
  76    // pokud je 10x za sebou positivni -> OK
  77    for (ii=0, ipos=0; ii<100; ii++) {
  78      WDG_reset();
  79  
  80      status = FLASH_ReadStatus();
  81  /*
  82      term_send_str("FLASH status:");
  83      term_send_hex(status);
  84      term_send_crlf();
  85  */
  86      ipos = ((status != 0xFF) && (status != 0x00) && (status & 0x80)) ? (ipos + 1) : 0;
  87      if (ipos == 10)
  88         return status;         // spravna inicializace
  89    }
  90    AdrBufferFlash = 0;
  91    CountPage = 0;
  92    return 0;             // spatna inicializace
  93  }
  94  
  95  /**
  96  
  97   \param show_info  - zda-li zobrazit informaci o nalezene pameti
  98   \return 0 - chyba, jinak status FLASH pameti
  99   **/
 100  unsigned char flash_init(char show_info)
 101  {
 102     unsigned char status;
 103  
 104     if (show_info)
 105     {
 106        term_send_str("Inicializace FLASH: ");
 107        status = flash_init_();
 108        if (status == 0) //chyba inicializace
 109        {
 110           term_send_str_crlf("chyba");
 111           return 0;
 112        }
 113  
 114        switch (status & 0x38)
 115        {
 116           case (0x18): term_send_str_crlf("AT45DB041D"); CNT_PAGES = 2048;break;
 117  
 118           case (0x10): term_send_str_crlf("AT45DB021B"); CNT_PAGES = 1024;break;
 119  
 120           default: term_send_str("neznamy typ ("); term_send_hex(status); term_send_str_crlf(")");
 121        }
 122  
 123        return status;
 124     } else {
 125        return flash_init_();
 126     }
 127  }
 128  
 129  /**
 130   \brief  Pocet dostupnych stranek FLASH pameti pro uzivatelska data
 131   */
 132  
 133  unsigned long FLASH_availablepages(void) {
 134    return CNT_PAGES - FLASH_USER_DATA_PAGE;
 135  }
 136  
 137  /**
 138  
 139   */
 140  
 141  unsigned long FLASH_blocks(void) {
 142    return CNT_PAGES / CNT_PAGES_IN_BLOCK;
 143  }
 144  
 145  
 146  /**
 147  
 148   */
 149  
 150  unsigned long FLASH_size(void) {
 151    return (unsigned long) CNT_PAGES * PAGE_SIZE;
 152  }
 153  
 154  /**
 155  
 156   \return Status flash
 157   */
 158  unsigned char FLASH_ReadStatus(void) {
 159    unsigned char chr;
 160  
 161    SPI_set_cs_FLASH(1);
 162    SPI_read_write(OPCODE_STATUS);
 163    chr = SPI_read_write(0);
 164    SPI_set_cs_FLASH(0);
 165  
 166    return (chr);
 167  }
 168  
 169  /**
 170  
 171  
 172  
 173   **/
 174  unsigned char FLASH_IsReady(void) {
 175    if ((FLASH_ReadStatus() & 0x80) == 0)  // test 'ready' bitu
 176       return (0);                            // flash je busy
 177    return (1);                          // flash je ready
 178  }
 179  
 180  /**
 181  
 182   */
 183  void FLASH_print_status(void) {
 184    unsigned char chr;
 185  
 186    term_send_str_crlf("FLASH INFO");
 187    term_send_str("  kapacita flash [kB]:   "); term_send_num((unsigned int)(FLASH_size() >> 10)); term_send_crlf();
 188    term_send_str("  velikost stranky [B]:  "); term_send_num(PAGE_SIZE); term_send_crlf();
 189    term_send_str("  velikost bufferu [B]:  "); term_send_num(BUFFER_SIZE); term_send_crlf();
 190    term_send_str("  pocet stranek:         "); term_send_num(CNT_PAGES); term_send_crlf();
 191    term_send_str("  pocet bloku:           "); term_send_num(FLASH_blocks()); term_send_crlf();
 192    term_send_str("  konfigurace FPGA [pg]: "); term_send_num(FPGA_BIN_PAGES);
 193    term_send_str(" ("); term_send_num(FLASH_FPGA_BIN_PAGE); term_send_str(" - "); term_send_num(FLASH_USER_DATA_PAGE-1); term_send_str_crlf(")");
 194    term_send_str("  uzivatelska data [pg]: "); term_send_num(CNT_PAGES - FLASH_USER_DATA_PAGE + 1);
 195    term_send_str(" ("); term_send_num(FLASH_USER_DATA_PAGE); term_send_str(" - "); term_send_num(CNT_PAGES-1); term_send_str_crlf(")");
 196    term_send_crlf();
 197  
 198    chr = FLASH_ReadStatus();
 199    term_send_str_crlf("STATUS REGISTR");
 200    term_send_str_crlf("  rdy cmp id id id x x x");term_send_str("   ");
 201    term_send_bool(chr & 0x80);term_send_str("   ");
 202    term_send_bool(chr & 0x40);term_send_str("   ");
 203    term_send_bool(chr & 0x20);term_send_str("  ");
 204    term_send_bool(chr & 0x10);term_send_str("  ");
 205    term_send_bool(chr & 0x08);term_send_str(" ");
 206    term_send_bool(chr & 0x04);term_send_str(" ");
 207    term_send_bool(chr & 0x02);term_send_str(" ");
 208    term_send_bool(chr & 0x01);term_send_str(" ");
 209    term_send_crlf();
 210  
 211  }
 212  
 213  /**
 214  
 215   \param buf - ukazatel na data
 216   \param bufsz - velikost dat
 217   **/
 218  void FLASH_WriteToBuffer(unsigned char *buf, unsigned long bufsz) {
 219    unsigned int SizeFreeBuf;
 220  
 221    // dokud mam co zapisovat
 222    while (bufsz > 0) {
 223  
 224      WDG_reset();
 225  
 226      FLASH_ReadMemoryBuffer(0, CountPage);
 227  
 228      SizeFreeBuf = BUFFER_SIZE - AdrBufferFlash;  // velikost voneho mista v bufferu flash
 229  
 230      if (bufsz >= SizeFreeBuf) {                  // vsechna data nelze zapsat najednou
 231                                                   // zapis dat do bufferu flash
 232        FLASH_WriteDataBuffer(0, buf, SizeFreeBuf, AdrBufferFlash);
 233        bufsz -= SizeFreeBuf;                      // uz zapisi o neco mene dat
 234        buf   += SizeFreeBuf;                      // posun na dalsi data
 235        FLASH_WriteBufferMemory(0, CountPage);     // zapis stranky ve flash bufferu do flash
 236        CountPage++;                               // budu zapisovat do dalsi stranky
 237        AdrBufferFlash = 0;                        // adresa v bufferu je nula
 238      }
 239      else {                                       // vsechna data lze zapsat najednou
 240                                                   // zapis dat do bufferu flash
 241        FLASH_WriteDataBuffer(0, buf, bufsz, AdrBufferFlash);
 242        AdrBufferFlash += bufsz;                   // posun offsetu v bufferu
 243        bufsz = 0;                                 // dale uz nezapisuji
 244        FLASH_WriteBufferMemory(0, CountPage);     // zapis stranky ve flash bufferu do flash
 245      }
 246    } /* while */
 247  }
 248  
 249  /**
 250  
 251   \param TypeBuffer - 0 nebo 1, TypeBuffer = 0, tak buffer = 1, jinak buffer = 2
 252   \param buf - ukazatel na data
 253   \param bufsz - velikost dat
 254   \param AdrBuffer - adresa v bufferu flash, od 0 do PAGE_SIZE-1
 255   **/
 256  void FLASH_WriteDataBuffer(unsigned char TypeBuffer, unsigned char *Buf,
 257                             unsigned int  Bufsz, unsigned int AdrBuffer) {
 258    unsigned int  ii;
 259  
 260    while (FLASH_IsReady() != 1) {
 261      WDG_reset();
 262    }
 263  
 264    SPI_set_cs_FLASH(1);
 265  
 266    if (TypeBuffer == 0)
 267      SPI_read_write(OPCODE_WRITE_BUF1);
 268    else
 269      SPI_read_write(OPCODE_WRITE_BUF2);
 270  
 271    SPI_read_write(0);
 272    SPI_read_write(AdrBuffer / 256);
 273    SPI_read_write(AdrBuffer % 256);
 274  
 275    WDG_reset();
 276  
 277    for (ii = 0; ii < Bufsz; ii++) {
 278      SPI_read_write(Buf[ii]);
 279    }
 280  
 281    WDG_reset();
 282  
 283    SPI_set_cs_FLASH(0);
 284  }
 285  
 286  /**
 287  
 288   \param TypeBuffer - 0 nebo 1, TypeBuffer = 0, tak buffer = 1, jinak buffer = 2
 289   \param buf - ukazatel na data
 290   \param bufsz - velikost dat
 291   \param AdrBuffer - adresa v bufferu ve Flash, od 0 do PAGE_SIZE-1
 292   **/
 293  void FLASH_ReadDataBuffer(unsigned char TypeBuffer, unsigned char *Buf,
 294                            unsigned int  Bufsz,      unsigned int AdrBuffer) {
 295    unsigned int ii;
 296  
 297    while (FLASH_IsReady() != 1) {
 298      WDG_reset();
 299    }
 300  
 301    SPI_set_cs_FLASH(1);
 302  
 303    if (TypeBuffer == 0)
 304      SPI_read_write(OPCODE_READ_BUF1);
 305    else
 306      SPI_read_write(OPCODE_READ_BUF2);
 307  
 308    SPI_read_write(0);
 309    SPI_read_write(AdrBuffer / 256);
 310    SPI_read_write(AdrBuffer % 256);
 311    SPI_read_write(0);
 312  
 313    for (ii=0; ii<Bufsz; ii++) {
 314  
 315      WDG_reset();
 316  
 317      Buf[ii] = SPI_read_write(0);
 318    }
 319  
 320    SPI_set_cs_FLASH(0);
 321  }
 322  
 323  void inline FLASH_ReadData_Initialize(unsigned int Page,  unsigned int AdrInPage) {
 324  
 325    while (FLASH_IsReady() != 1) {
 326      WDG_reset();
 327    }
 328  
 329    SPI_set_cs_FLASH(1);
 330    SPI_read_write(OPCODE_CONTINUOS_ARRAY_READ);
 331  
 332    SPI_read_write(Page >> 7);
 333    SPI_read_write(((Page << 1) & 0xFF) + (AdrInPage >> 8));
 334    SPI_read_write(AdrInPage & 0xFF);
 335  
 336    SPI_read_write(0);
 337    SPI_read_write(0);
 338    SPI_read_write(0);
 339    SPI_read_write(0);
 340  
 341  }
 342  
 343  void inline FLASH_ReadData_Finalize() {
 344    SPI_set_cs_FLASH(0);
 345  }
 346  
 347  /**
 348  
 349   \param Buf - ukazatel na data
 350   \param Bufsz - velikost dat
 351  
 352  
 353   **/
 354  void FLASH_ReadData(unsigned char *Buf, unsigned int Bufsz,
 355                      unsigned int Page,  unsigned int AdrInPage) {
 356    unsigned int ii;
 357  
 358    FLASH_ReadData_Initialize(Page, AdrInPage);
 359  
 360    for (ii = 0; ii < Bufsz; ii++) {
 361  
 362      WDG_reset();
 363  
 364      Buf[ii] = SPI_read_write(0);
 365    }
 366  
 367    FLASH_ReadData_Finalize();
 368  }
 369  
 370  
 371  /**
 372   \brief Test, zda-li je dana stranka prazdna (obsahuje same 0x00 nebo 0xFF)
 373  
 374   \return 0 - stranka obsahuje data, 1 stranka je prazdna
 375   **/
 376  char FLASH_isPageBlank(unsigned short page) {
 377    unsigned short ii;
 378    unsigned char ch, charFF = 1, char00 = 1;
 379  
 380    FLASH_ReadData_Initialize(page, 0);
 381    for (ii = 0; ii < PAGE_SIZE; ii++) {
 382      ch = SPI_read_write(0);
 383      if (ch != 0x00)
 384        char00 = 0;
 385      if (ch != 0xFF)
 386        charFF = 0;
 387  
 388      WDG_reset();
 389    }
 390    FLASH_ReadData_Finalize();
 391  
 392    return (charFF | char00);
 393  }
 394  
 395  /**
 396  
 397   \param buf - ukazatel na data
 398   \param bufsz - velikost dat
 399  
 400   **/
 401  void FLASH_ReadDataA(unsigned char *Buf, unsigned int Bufsz, long int Adr) {
 402    unsigned int Page, Offset;
 403    Page   = (Adr / PAGE_SIZE);
 404    Offset = (Adr % PAGE_SIZE);
 405  
 406    FLASH_ReadData(Buf, Bufsz, Page, Offset);
 407  }
 408  
 409  /**
 410  
 411   \param TypeBuffer: 0 nebo 1, TypeBuffer = 1, tak buffer = 1, jinak buffer = 2
 412  
 413   **/
 414  void FLASH_WriteBufferMemory(unsigned char TypeBuffer, unsigned int Page) {
 415  
 416    while (FLASH_IsReady() != 1) {
 417      WDG_reset();      // dokud je flash busy
 418    }
 419  
 420    SPI_set_cs_FLASH(1);                    // povoleni flash
 421  
 422    if (TypeBuffer == 0)          // zapis operacniho kodu
 423      SPI_read_write(OPCODE_BUF1_MEMORY_WERASE);
 424    else
 425      SPI_read_write(OPCODE_BUF2_MEMORY_WERASE);
 426  
 427    SPI_read_write(Page >> 7);
 428    SPI_read_write((Page << 1) & 0xFF);
 429    SPI_read_write(0);
 430  
 431    SPI_set_cs_FLASH(0);                    // dokonceni operace
 432  
 433    while (FLASH_IsReady() != 1) {
 434      WDG_reset();
 435    }
 436  }
 437  
 438  /**
 439  
 440   \param TypeBuffer: 0 nebo 1, TypeBuffer = 1, tak buffer = 1, jinak buffer = 2
 441  
 442   **/
 443  void FLASH_ReadMemoryBuffer(unsigned char TypeBuffer, unsigned int Page) {
 444  
 445    while (FLASH_IsReady() != 1) {
 446      WDG_reset();       // dokud je flash busy
 447    }
 448  
 449    SPI_set_cs_FLASH(1);
 450  
 451    if (TypeBuffer == 0)
 452      SPI_read_write(OPCODE_MEMORY_BUF1);
 453    else
 454      SPI_read_write(OPCODE_MEMORY_BUF2);
 455  
 456    SPI_read_write(Page >> 7);
 457    SPI_read_write((Page << 1) & 0xFF);
 458    SPI_read_write(0);
 459  
 460    SPI_set_cs_FLASH(0);
 461  }
 462  
 463  
 464  /**
 465  
 466  
 467  
 468   \return 0 - chyba
 469  
 470   **/
 471  char FLASH_ProgFPGA(unsigned long Adr, unsigned long Length) {
 472    unsigned long il;
 473    unsigned int Page, AdrInPage;
 474    unsigned char Dataf;
 475  
 476    Page      = (Adr / PAGE_SIZE);
 477    AdrInPage = (Adr % PAGE_SIZE);
 478  
 479    // cekam az je flash Ready
 480    while (FLASH_IsReady() != 1) {
 481          WDG_reset();
 482    }
 483  
 484    // nastaveni adresy ve FLASH a nastaveni FLASH pro cteni
 485    SPI_set_cs_FLASH(1);
 486    SPI_read_write(OPCODE_CONTINUOS_ARRAY_READ);
 487  
 488    SPI_read_write(Page >> 7);
 489    SPI_read_write(((Page << 1) & 0xFF) + (AdrInPage >> 8));
 490    SPI_read_write(AdrInPage & 0xFF);
 491    SPI_read_write(0);
 492    SPI_read_write(0);
 493    SPI_read_write(0);
 494    SPI_read_write(0);
 495  
 496    // nacteni jednoho bytu
 497    Dataf = SPI_read_write(0);
 498  
 499    // nastaveni FPGA pro prijem dat, PROG do 1, kontrola INIT a DONE
 500    if (FPGAConfig_initialize() == 0) {
 501      return (0);
 502    }
 503  
 504    // nacitani dat a tim padem i programovani FPGA
 505    for (il = 0; il < Length; il++) {
 506      // vyslani datoveho byte pres SPI do FPGA + nacteni dat
 507      Dataf = SPI_read_wait_write(Dataf);
 508  /*
 509  if (il < 32) {
 510  term_send_hex(Dataf);
 511  }
 512  */
 513  
 514      if ((il % 1024) == 0) {
 515        term_send_char('.');
 516  
 517        WDG_reset();
 518  
 519        if (FPGAConfig_INITn() == 0) {  // #INIT neni v 1
 520          term_send_str("[chybna konfigurace]"); //V prubehu programovani #INIT je v 0 - chybna programovaci data"
 521          return(0);
 522        }
 523  
 524      }
 525  
 526      if (FPGAConfig_DONE()) //nastaven signal DONE, FPGA je naprogramovano
 527         break;
 528  
 529    }
 530  
 531    SPI_read_write(0);
 532    SPI_set_cs_FLASH(0);
 533  
 534    // ukonceni programovani, kontrola INIT a DONE
 535    if (FPGAConfig_finalize() == 0) {
 536      return (0);
 537    }
 538  
 539    return (1);   // naprogramovano dobre
 540  }
 541  
 542  /**
 543  
 544   \param Adr - adresa
 545   \param uChar - znak
 546   **/
 547  void FLASH_WriteByte(unsigned long Adr, unsigned char uChar) {
 548    unsigned int Page, AdrInPage;
 549    Page      = (Adr / PAGE_SIZE);
 550    AdrInPage = (Adr % PAGE_SIZE);
 551  
 552    FLASH_ReadMemoryBuffer(0, Page);
 553    delay_ms(50);
 554    FLASH_WriteDataBuffer(0, &uChar, 1, AdrInPage);
 555    FLASH_WriteBufferMemory(0, Page);
 556    delay_ms(50);
 557  }
 558  
 559  /**
 560  
 561   \param Adr - adresa
 562   **/
 563  void FLASH_EraseByte(unsigned long Adr) {
 564    FLASH_WriteByte(Adr, ERS_CHAR);
 565  }
 566  
 567  /**
 568  
 569  
 570   **/
 571  void FLASH_ErasePage(unsigned int Page) {
 572  
 573    // cekam az je flash Ready
 574    while (FLASH_IsReady() != 1) {
 575      WDG_reset();
 576    }
 577  
 578    SPI_set_cs_FLASH(1);
 579    SPI_read_write(OPCODE_PAGE_ERASE);
 580  
 581    SPI_read_write(Page >> 7);
 582    SPI_read_write((Page << 1) & 0xFF);
 583    SPI_read_write(0);
 584    SPI_set_cs_FLASH(0);
 585  
 586  }
 587  
 588  /**
 589  
 590   \param block - blok flash
 591   **/
 592  void FLASH_EraseBlock(unsigned int block) {
 593  
 594    // cekam az je flash Ready
 595    while (FLASH_IsReady() != 1) {
 596      WDG_reset();
 597    }
 598  
 599    SPI_set_cs_FLASH(1);
 600  
 601    SPI_read_write(OPCODE_BLOCK_ERASE);
 602  
 603    SPI_read_write(block >> 4);
 604    SPI_read_write((block << 4) & 0xFF);
 605    SPI_read_write(0);
 606    SPI_set_cs_FLASH(0);
 607  
 608  }
 609  
 610  /**
 611  
 612  **/
 613  void FLASH_EraseAll(void) {
 614    unsigned long il;
 615  
 616    // mazu jednotlive bloky
 617    for (il = 0; il < FLASH_blocks(); il++) {
 618  
 619      WDG_reset();
 620  
 621      FLASH_EraseBlock(il);
 622      if ((il % 128) == 0)
 623        term_send_char('.');
 624    }
 625  }
 626  
 627  /**
 628  
 629  **/
 630  void FLASH_Dump_All(void) {
 631    long int il;
 632  
 633    for (il = 0; il < FLASH_blocks(); il++) {
 634  
 635      WDG_reset();
 636  
 637      FLASH_Dump_Block(il);
 638    }
 639  }
 640  
 641  /**
 642  
 643  
 644   **/
 645  void FLASH_Dump_Block(long int block) {
 646    long int il;
 647  
 648    for (il = 0; il < CNT_PAGES_IN_BLOCK; il++) {
 649  
 650      WDG_reset();
 651  
 652      FLASH_Dump_Page(il);
 653    }
 654  }
 655  
 656  /**
 657  
 658  
 659  **/
 660  void FLASH_Dump_Page(long int page) {
 661    FLASH_Dump_Adr(page*PAGE_SIZE, PAGE_SIZE);
 662  }
 663  
 664  /**
 665  
 666    \param adr - adresa (0..)
 667  
 668   **/
 669  void FLASH_Dump_Adr(long adr, long len) {
 670    long int      ik, jj;
 671    unsigned char row_len;               // delka radku vypisu je 8Bytu
 672    unsigned char buf[17];
 673  
 674    row_len = 8;                         // delka radku vypisu je 8Bytu
 675    if (adr > (long)FLASH_size()) {
 676      term_send_str("Zadana adesa je mimo rozsah.");
 677      return;
 678    }
 679  
 680    if (flash_init(0) == 0)
 681      return;
 682  
 683    term_send_str("Obsah flash pameti na adrese");
 684    term_send_num(adr);
 685    term_send_str(" (");
 686    term_send_hex(adr);
 687    term_send_str_crlf("):");
 688    term_send_str_crlf("          0  1  2  3  4  5  6  7");
 689  
 690    for (ik = 0; ik < len; ik+=row_len) {
 691      // Vypisi offset
 692      long2str(ik, (unsigned char *)&buf, 16);
 693      for (jj = 0; jj < (8 - strlen(buf)); jj++)
 694        term_send_char('0');
 695      term_send_str(buf);
 696  
 697      term_send_str(": ");
 698  
 699      // prectu blok dat
 700      FLASH_ReadDataA((unsigned char *)&buf, row_len, adr + ik);
 701  
 702      // vypisi hexa
 703      for (jj = 0; jj < row_len; jj++) {
 704  
 705        WDG_reset();
 706  
 707        if ((ik+jj) < len) {
 708          term_send_char_hex(buf[jj]);
 709          term_send_char(' ');
 710        }
 711        else
 712          term_send_char(' ');
 713      }
 714      term_send_str(" | ");
 715  
 716      // vypisi znaky
 717      for (jj=0; jj<row_len; jj++) {
 718  
 719        WDG_reset();
 720  
 721        if ((ik+jj) < len) {
 722          if ((buf[jj] >= 0x20) && (buf[jj] <= 127))
 723            term_send_char(buf[jj]);
 724          else
 725            term_send_char('.');
 726        }
 727      }
 728      term_send_crlf();
 729    }
 730  }
 731  
 732  
Zobrazeno: 731749x Naposledy: 29.11.2022 05:25:28