ghoola
Member level 2
- Joined
- Aug 7, 2013
- Messages
- 43
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 6
- Location
- india
- Activity points
- 352
what are those error saying please help me?
the main code is
../FAT/FAT.c:427: warning: passing argument 1 of '__eewr_byte_m8' makes pointer from integer without a cast
../FAT/FAT.c:428: warning: passing argument 1 of '__eewr_byte_m8' makes pointer from integer without a cast
../FAT/FAT.c:429: warning: passing argument 1 of '__eewr_byte_m8' makes pointer from integer without a cast
../FAT/FAT.c:430: warning: passing argument 1 of '__eewr_byte_m8' makes pointer from integer without a cast
../FAT/FAT.c: In function 'GetFolderCluster':
../FAT/FAT.c:436: warning: passing argument 1 of '__eerd_byte_m8' makes pointer from integer without a cast
../FAT/FAT.c:438: warning: passing argument 1 of '__eerd_byte_m8' makes pointer from integer without a cast
../FAT/FAT.c:440: warning: passing argument 1 of '__eerd_byte_m8' makes pointer from integer without a cast
../FAT/FAT.c:442: warning: passing argument 1 of '__eerd_byte_m8' makes pointer from integer without a cast
../FAT/FAT.c: In function 'SearchInit':
../FAT/FAT.c:586: warning: control reaches end of non-void function
the main code is
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 #include<avr/io.h> #include"MMC_SD/MMC_SD.h" //head files #include"FAT/FAT.h" #include"VS1003B/VS1003B.h" #include<avr/pgmspace.h> #define uint8 unsigned char #define uint16 unsigned int #define uint32 unsigned long #if FIX_DIRECTORY #define PATH (unsigned char *)("\\music") #endif //It's the path where the file placed //Change it if you want to placed it to anoter foler //The path should not have blanks, and each foler name's length should less than 8 with no extention //diagnose and state indicate leds //at start up this two led indicate error //at normal they indicate the state of the MODE #define LED1_CON() DDRC|=_BV(PC5) #define LED1_ON() PORTC|=_BV(PC5) #define LED1_OFF() PORTC&=~_BV(PC5) #define LED2_CON() DDRB|=_BV(PB1) #define LED2_ON() PORTB|=_BV(PB1) #define LED2_OFF() PORTB&=~_BV(PB1) //keys #define STOP _BV(PD2) #define MODE _BV(PD3) #define NEXT _BV(PD7) #define UP _BV(PD4) #define DOWN _BV(PD6) #define PREV _BV(PD5) #define MP3 1 #define WMA 2 #define MID 3 //mode #define REPET_ALL 0 #define REPET_ONE 1 #define RANDOM 2 extern uint16 SectorsPerClust;//ÿ´ØÉÈÇøÊý extern uint16 FirstDataSector;//µÚÒ»¸öÊý¾ÝÉÈÇøÊý //struct of file information extern uint8 FAT32_Enable; struct FileInfoStruct FileInfo;//ÎļþÐÅÏ¢ struct direntry MusicInfo; //Òª²¥·ÅµÄmp3ÎļþÐÅÏ¢ //the mp3 file item whichi will be played uint16 totalsongs; //×ܵÄÒôÀÖÎļþÊýÄ¿ //total songs in the root directery on the SD card uint8 type; //ÎļþÀàÐÍ //file type uint8 track[128]; //stroe the information of songs (bit set indicate songs has been played) void ClearTrackInfo() //cleare the array track[128] { uint8 i; for(i=0;i<128;i++)track[i] = 0; } uint8 SetTrack(uint16 songs)//set the track bit, return 1 means the song has been played { uint8 byte_offset; uint8 bit_offset; songs--; byte_offset = songs/8; bit_offset = songs%8; if(track[byte_offset] & (1<<bit_offset))return 1; else { track[byte_offset] |= 1<<bit_offset; return 0; } } void Delay(uint16 n)//ÑÓʱ { while(n--)asm("nop"); } //Timer initialization offer seed of the srandom() void Timer1_Initial() { TCNT1H=0x00; TCNT1L=0x00; TCCR1B=0x01;//system clock; ICR1H=0xff; ICR1L=0xff; } void PlayMusic()//²¥·ÅÒôÀÖº¯Êý£¬Ò»µ©Ö´Ðв»»áÍ˳ö { uint16 keylen; //ÓÃÓÚ¼ü´¦Àí //for key processing uint16 count; //Êý¾Ý¼ÆÊý //data counting uint8 i; //Ñ*»·±äÁ¿ //loop variable uint16 j; //Ñ*»·±äÁ¿ //loop variable uint32 p; //´Øָʾֵ //cluster uint32 totalsect; //ÎļþÓµÓеÄÉÈÇøÊý //cotain the total sector number of a file uint16 leftbytes; //Ê£Óà×Ö½Ú //cotain the left bytes number of a file //the last cluster usually not fully occupied by the file uint8 *buffer; //»º³å //buffer uint32 sector; //ÉÈÇø //recor the current sector to judge the end sector uint8 flag; //²¥·Å/ÔÝÍ£±êÖ¾ //flag of pause uint16 vol=DefaultVolume;//³õʼÒôÁ¿£¬Ó¦Óëvs1003º¯ÊýÀïµÄ³õʼÒôÁ¿Ïàͬ //default volume uint16 songs=1; //ĬÈϷŵÚÒ»Ê׸è //play the fist songs by default uint8 mode=DEFAULT_MODE;//µ¥ÇúÖظ´ //repet all by default uint16 songs_cnt = 0; //how many songs have been played if(totalsongs==0)return;//Èç¹ûûÓиèÇúÔòÒì³£Í˳ö //if no music file return uint32 rand_val; Timer1_Initial();//Æô¶¯¶¨Ê±Æ÷£¬ÓÃÓÚ²úÉúËæ»úº¯ÊýµÄÖÖ×Ó //initialize the timer ClearTrackInfo(); next://ÏÂÒ»Ê׸èµÄÆðʼµØ·½ //label for "goto" if(mode==RANDOM)//Ëæ»ú²¥·Å¸èÇú //if the mode is shuffle the songs { songs_cnt++; if(songs_cnt == totalsongs && totalsongs<1025) { ClearTrackInfo(); songs_cnt = 0; } rand_val = TCNT1; Delay((random() && 0x00ff)); rand_val <<= 16; rand_val += TCNT1; srandom(rand_val); if(totalsongs>1024) { songs = (uint16)(((random()/214749)*(uint32)totalsongs)/10000)+1;//Ëæ»ú²úÉú¸èÇúÐòºÅ //create random song number } while(totalsongs<1025) { songs = (uint16)(((random()/214749)*(uint32)totalsongs)/10000)+1;//Ëæ»ú²úÉú¸èÇúÐòºÅ //create random song number if(SetTrack(songs) == 0)break; } } count=0;//Çå»ùÊý //clear count flag=1; while(count<2048 && (type != MID))//recommand 2048 zeros honoring DREQ befor soft reset { //ÓÃÓÚ´ÓwmaÌø³öµ½ÏÂÒ»Ê׸裬ºÍÒ»Ê׸è½áÊøÌî³äÊý¾Ý//midi¸ñʽ²»ÐèÒª if((VS1003B_PIN & _BV(VS1003B_DREQ))!=0) { for(j=0;j<32;j++) { VS1003B_WriteDAT(0x00);//Ìî³ä0 //fill 0 count++; } if(count == 2047)break; } } VS1003B_SoftReset();//soft reset //in case of playing wma files//Èí¼þ¸´Î» #if FIX_DIRECTORY Search(PATH,&MusicInfo,&songs,&type); //ÕÒµ½ÏàÓ¦µÄÎļþ //find the file #else Search(&MusicInfo,&songs,&type); //ÕÒµ½ÏàÓ¦µÄÎļþ //find the file #endif p = MusicInfo.deStartCluster+(((uint32)MusicInfo.deHighClust)<<16);//¶ÁÎļþÊ×´Ø //the first cluster of the file totalsect = MusicInfo.deFileSize/512; //¼ÆËãÉÈÇøÊý //calculate the total sectors leftbytes = MusicInfo.deFileSize%512; //¼ÆËãÊ£ÓàµÄ×Ö½ÚÊý //calculate the left bytes i=0; sector=0; while(1) { keylen=0; for(;i<SectorsPerClust;i++) //Ò»¸ö´Ø //a cluster { buffer=malloc(512); FAT_LoadPartCluster(p,i,buffer);//¶ÁÒ»¸öÉÈÇø //read a sector count=0; while(count<512) { if(flag==0){if(keylen){Delay(100);keylen--;}} else if(type == MID){if(keylen){Delay(100);keylen--;}} if((VS1003B_PIN & _BV(VS1003B_DREQ))!=0 && flag) //¸ù¾ÝÐèÒªËÍÊý¾Ý //send data honoring DREQ { for(j=0;j<32;j++) //ÿ´ÎËÍ32¸öÊý¾Ý //32 Bytes each time { VS1003B_WriteDAT(buffer[count]); count++; } if(keylen)keylen--; //ÓÃÓÚ¼ü´¦Àí //for key processing if(sector == totalsect && count >= leftbytes) //Èç¹ûÎļþÒѽáÊø //if this is the end of the file { if(type == MID)//waiting the midi file was decoded {//¶ÔÓÚmidÒôÀÖÒª½Ó×ÅËÍ2048¸öÁã count=0; while(count<2048)//recommand 2048 zeros honoring DREQ goto next songs { if((VS1003B_PIN & _BV(VS1003B_DREQ))!=0 ) { for(j=0;j<32;j++) { VS1003B_WriteDAT(0x00); count++; } if(count == 2047)break; } } } i=SectorsPerClust; break; }//Îļþ½áÊø //file ended if(count == 511){break;}//512×Ö½ÚËÍÍêÌø³ö //break if a sector was sent } if((PIND&STOP)==0 /*&& keylen==0*/)//²¥·ÅÔÝÍ£¼ü //key PLAY/PAUSE { Delay(100); if(!(PIND&STOP)) { while(!(PIND&STOP)); if(flag)flag=0; else flag=1; Delay(1000); } } else if(!(PIND&DOWN) && keylen==0) //ÒôÁ¿- //Volume down { Delay(100); if(!(PIND&DOWN)) { keylen=200; vol=vol+((uint16)(1<<8)+1); if(vol>=0xFEFE) vol=0xFEFE; else VS1003B_WriteCMD(0x0b,vol); } } else if(!(PIND&UP) && keylen==0) //ÒôÁ¿+ //Volume up { Delay(100); if(!(PIND&UP)) { keylen=200; vol=vol-((uint16)(1<<8)+1); if(vol<=0x0101) vol=0x0101; else VS1003B_WriteCMD(0x0b,vol); } } else if(!(PIND&NEXT)) //ÏÂÒ»Ê× next songs { Delay(0x7fff); if(!(PIND&NEXT)) { Delay(0x7fff); if(!(PIND&NEXT)) { while(!(PIND&NEXT)); songs++; if(songs > totalsongs)songs=1; { free(buffer); // Delay(0xffff); goto next; } } } } else if(!(PIND&PREV)) //ÉÏÒ»Ê× previous songs { Delay(0x7fff); if(!(PIND&PREV)) { Delay(0x7fff); if(!(PIND&PREV)) { while(!(PIND&PREV)); if(songs == 1)songs=totalsongs; else songs--; { free(buffer); // Delay(0xffff); goto next; } } } } else if((!(PIND&MODE)) && keylen==0) //ģʽ //mode key { Delay(100); if(!(PIND&MODE)) { keylen=0xffff; if(mode==REPET_ALL) { mode=REPET_ONE; LED1_ON(); LED2_OFF(); } else if(mode==REPET_ONE)//next mode is shuffle { mode=RANDOM; LED1_OFF(); LED2_ON(); srandom(((uint32)TCNT1)<<16);//²úÉúËæ»úÊýµÄÖÖ×Ó } else { mode=REPET_ALL; LED1_OFF(); LED2_OFF(); } } } } sector++; free(buffer); } i=0; p=FAT_NextCluster(p);//¶ÁÏÂÒ»´ØÊý¾Ý //read next cluster if(p == 0x0fffffff || p == 0x0ffffff8 || (FAT32_Enable == 0 && p == 0xffff))//Èç¹ûÎÞºóÐø´ØÔò½áÊø£¬ //no more cluster { if(mode==REPET_ALL)songs++; if(songs>totalsongs)songs=1; goto next; } } } //main function int main() { uint8 retry = 0; DDRD &= 0x03;//³õʼ»¯¶Ë¿Ú PORTD |= 0xfc; LED1_CON(); LED1_OFF(); LED2_CON(); LED2_OFF(); OSCCAL = 0x00;//×îСRCÕñµ´ÆµÂÊ //in order to operate some low speed card the initialization should run at lowest speed Delay(0xffff); MMC_SD_Init();//³õʼ»¯spi¿Ú //SPI initialize Delay(0xffff); if(VS1003B_Init()) { //LED1_ON();//ÅäÖÃVS1003 //config vs1003 while(1) { LED1_ON(); Delay(0xffff); LED1_OFF(); Delay(0xffff); } } Delay(0xffff);//Ìṩ×ã¹»µÄÑÓʱ //supply enough delay // Delay(0xffff); // Delay(0xffff); // Delay(0xffff); // Delay(0xffff); while(MMC_SD_Reset())//³õʼ»¯SD¿¨ //sd card initialize { retry++; if(retry>20) { // LED2_ON(); while(1) { LED2_ON(); Delay(0xffff); LED2_OFF(); Delay(0xffff); } } } OSCCAL = 0xff;//×î´óRCÕñµ´ÆµÂÊ //normal operation maximum the frequency Delay(0xffff); //wait for stable if(FAT_Init())//³õʼ»¯Îļþϵͳ Ö§³ÖFAT16ºÍFAT32 //initialize file system FAT16 and FAT32 are supported { // LED1_ON(); // LED2_ON(); // while(1); while(1) { LED1_ON();LED2_ON(); Delay(0xffff); LED1_OFF();LED2_OFF(); Delay(0xffff); } } #if FIX_DIRECTORY Search(PATH,&MusicInfo,&totalsongs,&type);//ËÑË÷¸ùĿϵĸèÇú ²»°üº¬×ÓĿ¼ #else SearchInit(); Search(&MusicInfo,&totalsongs,&type);//ËÑË÷¸ùĿϵĸèÇú #endif //Ò²¿ÉÒÔÖ¸¶¨Îļþ¼Ð ÈçSearch("\\new\\mp3",&MusicInfo,&totalsongs,&type); //´ú±íÔÚ¸ùĿ¼ÏµÄnewÎļþ¼ÐϵÄmp3ÎļþϵÄÒôÀÖÎļþ //search the songs in the root directery on the SD card //You can also specify the directery where the songs are placed //eg: Search("\\new\\mp3",&MusicInfo,&totalsongs,&type); // means search the file in the foler C:\new\mp3 PlayMusic();//²¥·Å¸èÇú //play songs while(1) { while(1) { LED1_ON();LED2_OFF(); Delay(0xffff); LED2_ON();LED1_OFF(); Delay(0xffff); } } return 0; }