📄 main.txt
字号:
;;;693 printf_P(("\r\noffset : %d "),LrcStructHead.offset);
;;;694 printf_P((" total = %ld; "),LrcStruct_p->time);
;;;695 #endif
;;;696
;;;697 /* recalculate the time, use offset */
;;;698 if(LrcStructHead.sign)
;;;699 {
;;;700 if(LrcStruct_p->time<LrcStructHead.offset)LrcStruct_p->time = 0;
;;;701 else LrcStruct_p->time -= LrcStructHead.offset;
;;;702 }
;;;703 else LrcStruct_p->time += LrcStructHead.offset;
;;;704
;;;705 #if DEBUG
;;;706 printf_P(("after calculate total = %ld; \r\n"),LrcStruct_p->time);
;;;707 #endif
;;;708
;;;709 /* node operation, pointer to next node, and set address */
;;;710 LrcStruct_p->eeaddr = lrcaddr;
;;;711 temp = buffer[j];
;;;712 LrcStruct_p = LrcStruct_p->next;
;;;713
;;;714
;;;715 if(temp == '['); /* if two tag share one lyric, just jump and next loop it will process it */
;;;716 else /* this is a sigle time tag */
;;;717 {
;;;718 while(1)
;;;719 {
;;;720 temp = buffer[j++];
;;;721
;;;722 #if DEBUG
;;;723 uart0_putc(temp);
;;;724 #endif
;;;725
;;;726 /*************************************************************/
;;;727 if(sector == totalsect && j == leftbytes + 1) goto end; /* file end */
;;;728
;;;729 if(j == 512) /* need to read next sector */
;;;730 {
;;;731 if(part == (SectorsPerClust - 1)) /* if need to read next cluster */
;;;732 {
;;;733 //p=FAT_NextCluster_NEW(p);//读下一簇数据 //read next cluster
;;;734 p=FAT_NextCluster(p);
;;;735 if(p == 0x0fffffff || p == 0x0ffffff8 || (FAT32_Enable == 0 && p == 0xffff))//如果无后续簇则结束, //no more cluster
;;;736 {
;;;737 #if DEBUG
;;;738 printf_P(("No next cluster or read next cluster error\r\n"));
;;;739 #endif
;;;740 goto end;
;;;741 }
;;;742 part = 0; /* clear the part count */
;;;743 if(FAT_LoadPartCluster(p,part,buffer))
;;;744 {
;;;745 #if DEBUG
;;;746 printf_P(("ERROR: Faild to load a sector\r\n"));
;;;747 #endif
;;;748 free(buffer);
;;;749 return 1;
;;;750 }
;;;751 }
;;;752 else /* else just read the next part of the cluster */
;;;753 {
;;;754 part ++; /* part ++ */
;;;755 if(FAT_LoadPartCluster(p,part,buffer))
;;;756 {
;;;757 #if DEBUG
;;;758 printf_P(("ERROR: Faild to load a sector\r\n"));
;;;759 #endif
;;;760 free(buffer);
;;;761 return 1;
;;;762 }
;;;763 }
;;;764 sector ++; /* sector count +=1 */
;;;765 j = 0; /* loop value clear to 0*/
;;;766 }
;;;767 /****************************************************************/
;;;768
;;;769 if(temp == 0x0d || temp == 0x0a) /* one lyric end, when meet next line*/
;;;770 {
;;;771 //if(lrcaddr<MAXLRCDATSIZE) /* if lrcdatbuf is not full */
;;;772 //{
;;;773 lrcdatbuf[lrcaddr++] ='\0';
;;;774 //}
;;;775 //else /* otherwise use the eeprom */
;;;776 // eeprom_write_byte(lrcaddr++ - MAXLRCDATSIZE,'\0');
;;;777 break;
;;;778 }
;;;779 else /* else normal data */
;;;780 {
;;;781
;;;782 //else
;;;783 //{
;;;784 //if(lrcaddr<MAXLRCDATSIZE) /* use ram */
;;;785 //{
;;;786 lrcdatbuf[lrcaddr++] = temp;
;;;787 //}
;;;788 //else /* use epprom */
;;;789 // eeprom_write_byte(lrcaddr++ - MAXLRCDATSIZE,temp);
;;;790 //}
;;;791 }
;;;792 if(lrcaddr == MAXLRCDATSIZE) /* if ram buffer run out, show some messages */
;;;793 {
;;;794 //printf_P(("\r\n\r\nInternal RAM is not enough, some data will be stored at EEPROM!"));
;;;795 //printf_P(("\r\nThis may take little longer time. U know 8.4ms/Byte, pls wait!......"));
;;;796 printf_P(("\r\n\r\nWow! The lyric is so long, Buffer is run out, sorry!\r\n"));
;;;797 goto end;
;;;798 }
;;;799 }
;;;800 }
;;;801 }
;;;802 }
;;;803 }
;;;804 else j++; /**/
;;;805 }
;;;806 sector ++; /**/
;;;807 }
;;;808 p=FAT_NextCluster(p);
;;;809 //p=FAT_NextCluster_NEW(p);//读下一簇数据 //read next cluster
;;;810 if(p == 0x0fffffff || p == 0x0ffffff8 || (FAT32_Enable == 0 && p == 0xffff))//如果无后续簇则结束, //no more cluster
;;;811 {
;;;812 #if DEBUG
;;;813 printf_P(("No next cluster or read next cluster error\r\n"));
;;;814 #endif
;;;815 break;
;;;816 }
;;;817 }
;;;818
;;;819 end:
;;;820 /* in case that some lyc file don not have empty line at the last */
;;;821 // if(lrcaddr<MAXLRCDATSIZE)
;;;822 // {
;;;823 lrcdatbuf[lrcaddr++] = '\0';
;;;824 // }
;;;825 // else
;;;826 // eeprom_write_byte(lrcaddr++ - MAXLRCDATSIZE,'\0');
;;;827
;;;828 /* end the node */
;;;829 LrcStruct_p = LrcStruct_p - 1;
;;;830 LrcStruct_p->next = 0;
;;;831
;;;832 /* free the buffer */
;;;833 free(buffer);
;;;834
;;;835 /* below is a debug message */
;;;836 /************************************************************/
;;;837 #if DEBUG
;;;838 printf_P(("\r\nLyric data stored completed!"));
;;;839
;;;840 printf_P(("\r\nThe data stored in RAM & EEPROM:\r\n"));
;;;841 for(j=0;j<lrcaddr;j++)
;;;842 {
;;;843 //if(j<MAXLRCDATSIZE)uart0_putc(lrcdatbuf[j]);
;;;844 uart0_putc(lrcdatbuf[j]);
;;;845 //else uart0_putc(eeprom_read_byte(j - MAXLRCDATSIZE));
;;;846 }
;;;847
;;;848 printf_P(("\r\nNo sorted data is : \r\n"));
;;;849 LrcStruct_p = LrcStructHead.header;
;;;850 while(1)
;;;851 {
;;;852 lrcaddr = LrcStruct_p->eeaddr;
;;;853 while(1)
;;;854 {
;;;855 temp = lrcdatbuf[lrcaddr++];
;;;856 //if(lrcaddr<MAXLRCDATSIZE)temp = lrcdatbuf[lrcaddr++];
;;;857 //else temp = eeprom_read_byte(lrcaddr++ - MAXLRCDATSIZE);
;;;858 if(temp == 0)break;
;;;859 uart0_putc(temp);
;;;860 }
;;;861 printf_P(("\r\n"));
;;;862 if(LrcStruct_p->next == 0)break;
;;;863 LrcStruct_p = LrcStruct_p->next;
;;;864 }
;;;865 #endif
;;;866
;;;867 #if DEBUG
;;;868 printf_P(("\r\nSort begining ......"));
;;;869 #endif
;;;870
;;;871 #if DEBUG
;;;872 temp = 0;
;;;873 LrcStruct_p = LrcStructHead.header;
;;;874 while(1)
;;;875 {
;;;876 temp++;
;;;877 if(LrcStruct_p->next == 0)break;
;;;878 LrcStruct_p = LrcStruct_p->next;
;;;879 }
;;;880 printf_P(("\r\ntotal %s time tags"),temp);
;;;881 #endif
;;;882 /***************************************************************/
;;;883
;;;884 /* tag sort */
;;;885 LrcStruct_p_header = LrcStruct_p = LrcStructHead.header;
;;;886 while(1)
;;;887 {
;;;888 LrcStruct_p_header = LrcStruct_p;
;;;889 LrcStruct_p = LrcStruct_p->next;
;;;890 if(LrcStruct_p == 0)break;
;;;891 if(LrcStruct_p_header->time > LrcStruct_p->time)
;;;892 {
;;;893 LrcStruct_p_temp = LrcStructHead.header;
;;;894 j = 0;
;;;895 while(1)
;;;896 {
;;;897 j++;
;;;898 if(LrcStruct_p_temp->time < LrcStruct_p->time) /* do not need to insert node */
;;;899 {
;;;900 LrcStruct_p_up = LrcStruct_p_temp;
;;;901 LrcStruct_p_temp = LrcStruct_p_temp->next;
;;;902 LrcStruct_p_down = LrcStruct_p_temp->next;
;;;903 }
;;;904 else /* need insert */
;;;905 {
;;;906
;;;907 #if DEBUG
;;;908 printf_P(("\r\nLrcStruct_p_up->time = %ld"),LrcStruct_p_up->time);
;;;909 printf_P(("\r\nLrcStruct_p_temp->time = %ld"),LrcStruct_p_temp->time);
;;;910 printf_P(("\r\nLrcStruct_p_down->time = %ld"),LrcStruct_p_down->time);
;;;911 printf_P(("\r\nLrcStruct_p->time = %ld \r\n"),LrcStruct_p->time);
;;;912 #endif
;;;913
;;;914 if(j == 1) /* if the first need to replace */
;;;915 {
;;;916 LrcStructHead.header = LrcStruct_p;
;;;917 LrcStruct_p_header->next = LrcStruct_p ->next;
;;;918 LrcStruct_p ->next = LrcStruct_p_header;
;;;919 LrcStruct_p = LrcStruct_p_header;
;;;920 }
;;;921 else /* other normal condition */
;;;922 {
;;;923 LrcStruct_p_header->next = LrcStruct_p->next;
;;;924 LrcStruct_p_up->next = LrcStruct_p;
;;;925 LrcStruct_p->next = LrcStruct_p_temp;
;;;926 LrcStruct_p = LrcStruct_p_header;
;;;927
;;;928 #if DEBUG
;;;929 printf_P(("\r\nLrcStruct_p->time = %ld \r\n\r\n"),LrcStruct_p->time);
;;;930 #endif
;;;931 }
;;;932 break;
;;;933 }
;;;934 }
;;;935 }
;;;936 }
;;;937 printf_P(("\r\n\r\nAnalyze complete!\r\n\r\nCode written by Bozai - 章其波"));
;;;938 printf_P(("\r\n*****************************************************\r\n"));
;;;939
;;;940 /* debug message, show sorted data */
;;;941 #if DEBUG
;;;942 printf_P(("\r\nSort completed!"));
;;;943 printf_P(("\r\nData after sort is : \r\n"));
;;;944 printf_P(("\r\n\r\nLrc Data:\r\n\r\n"));
;;;945 LrcStruct_p = LrcStructHead.header;
;;;946 while(1)
;;;947 {
;;;948 lrcaddr = LrcStruct_p->eeaddr;
;;;949 while(1)
;;;950 {
;;;951 temp = lrcdatbuf[lrcaddr++];
;;;952 //if(lrcaddr<MAXLRCDATSIZE)temp = lrcdatbuf[lrcaddr++];
;;;953 //else temp = eeprom_read_byte(lrcaddr++ - MAXLRCDATSIZE);
;;;954 if(temp == 0)break;
;;;955 uart0_putc(temp);
;;;956 }
;;;957 printf_P(("\r\n"));
;;;958 if(LrcStruct_p->next == 0)break;
;;;959 LrcStruct_p = LrcStruct_p->next;
;;;960 }
;;;961 #endif
;;;962
;;;963 }
;;;964 else lrc = 0;
000194 15c64000 STRBNE r4,[r6,#0] ; lrc
000198 1a000230 BNE |L1.2656|
00019c e28f0fa6 ADR r0,|L1.1084|
0001a0 ebfffffe BL __1printf
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -