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

📄 yadl.h

📁 使用AVR单片机M162制做的MP3,这是整机的代码.可做参考.
💻 H
📖 第 1 页 / 共 2 页
字号:
  u32      sector_cluster_offset; /* add this offset value to all cluster values out of FAT */
  u32      free_cluster_count;    /* informational only */

  SECTOR   wasteland_start;       /* unused room AFTER last cluster, if any , else NULL */ 
  u16      wasteland_length ;     /* length of waste in sectors */ 

  /* songbase will always be consecutive on disk ! */
  SECTOR  songbase_start;         /* although a pointer here -> it is hardcoded to YADL_SEC_SONG_BASE) */
  u16     songbase_qty;           /* nr of songbase entries */

  u16     first_artist;           /* "pointer"/index into the songbase to the alphabetically sorted artist list */
  u16     first_title;            /* "pointer"/index into the songbase to the alphabetically sorted title list */

  /* FAT will always be consecutive on disk, right after songbase ! */
  SECTOR  fat_start;
  u32     fat_qty;                /* nr of fat ENTRIES, not sectors */

  /* playlist F_I_L_E */
  CLUSTER  playlist_start;        /* structured file (this is a "normal" file inside the FAT chain
                                     not necessarily consecutive contains playlist data 
                                     no list exists -> marked with YADL_FAT_INVALID */
  FLENGTH  playlist_file_length;  /* real filelength */
  u16      playlist_qty;          /* nr of playlists stored in that file - NULL indicates no playlist */
  
  u16      playlist_first;        /* if playlists are chained, this is the first to be played */
  
  /* misc system data */
  SECTOR  text_data;              /* if == NULL -> not supported yet */
  u16     text_qty;               /* nr of texts */
  u08     text_version_major;     /* start with 1.0 */
  u08     text_version_minor;

  CLUSTER snd_system;             /* if == NULL -> not supported yet */
  u16     snd_qty;                /* nr of system sounds */
  u08     snd_version_major;      /* start with 1.0 */
  u08     snd_version_minor;

/*************/
/* SECTION 4 */
/*************/
  SECTOR  option_00;            /* future use ... == NULL -> not used */
  SECTOR  option_01; 
  SECTOR  option_02;
  SECTOR  option_03;
  SECTOR  option_04;
  SECTOR  option_05;
  SECTOR  option_06;
  SECTOR  option_07;
  SECTOR  option_08;
  SECTOR  option_09;

/*************/
/* SECTION 5 */
/*************/
  u08      z_dummy01[228];
}YADL_ROOT_SECTOR;



/************************************************************************
**
** F A T
**
** starts at sector:   ROOT_SECTOR->fat_start
** nr of fat-entries:  ROOT_SECTOR->fat_qty 
**
**
** maximum disk size supported (2048 GB = 2 TB) 
** (only in conjunction with MAXTORS big drive technology - to be implemented later ;-)
**
** 2048 GB / 256 kb clusters --> gives a maximum of 0x800000 clusters (8388608d)
** -> upper byte in FAT values is free
** we code there the extra states
**
**
**
** adress calculation:
**
** to convert a cluster number into a sector address:
**
** shift left cluster number by 9
** add (u32) ROOT_SECTOR->sector_cluster_offset
**
*************************************************************************/

/* predefined FAT values */

#define YADL_FAT_INVALID  0xFFFFFFFF  /* dont change */ 
#define YADL_FAT_EMPTY    0xFE000000
#define YADL_FAT_FAULTY   0xFD000000
#define YADL_FAT_SYSTEM   0xFC000000

#define YADL_FAT_LAST     0xF0000000




/************************************************************************
**
** The S O N G B A S E  Structure
**
** note that there is a maximum of 0xFFFF songs inside a songbase,
** with array indices ranging from 0 to 0xFFFE
**
** so a songbase pointer of 0xFFFF is always guaranteed to be
** invalid / not set / not supported 
**
** songbase start is fixed, always at YADL_SEC_SONG_BASE 
** length is variable, nr of entries (not sectors!) is ROOT_SECTOR->songbase_qty
**
**
*************************************************************************/
#define YADL_LEN_ARTIST  44    /* ensure that sum of both is a multiple of 4 - to keep 80x86 happy*/
#define YADL_LEN_TITLE   44  

/* states needed inside yaPC */
#define YADL_STATE_EMPTY         0
#define YADL_STATE_TO_LOAD       2
#define YADL_STATE_LOADING       3
#define YADL_STATE_READY         0x10
#define YADL_STATE_NOT_LOADED    0x11

typedef struct
{
  u08      artist[YADL_LEN_ARTIST];
  u08      title[YADL_LEN_TITLE]; 
  
  CLUSTER  start;
  FLENGTH  length;              /* original filelength */
  u32      timestamp;           /* PC - Filetimestamp - not inserted yet*/

  u16      ref_ctr;             /* nr of playlists using that song */
  u16      play_time;           /* in seconds */

  u16      bitrate;             /* MP3 bitrate , if BIT 15 set == VBR  */
  u08      genre;               /* as stated in MP3 file - not filled or used yet ! */
  u08      state;               /* 0 slot free , 0x10 valid, (for PC only) 2 to be loaded / 3 loading */
  u16      next_artist;         /* pointer into songbase to (alphabetically) next title of this artist or new artist */
  u16      next_artist_grouped; /* pointer into songbase to (alphabetically) next artist in unique(grouped) list */
  u16      next_title;          /* pointer into songbase to (alphabetically) next song  */
  u16      start_offset;        /* leading Header part in MP3 file to be skipped */
  u08      z_dummy00[12];       /* not used yet */
}YADL_SONG_BASE_ENTRY;

/*************************************************************************
**
** OPTIONS inside bitrate field
**
**************************************************************************/

#define OPTION_BR_VBR     0x8000 /* this is a VBR file */ 
#define OPTION_BR_ID1_TAG 0x4000 /* this file has an MP3 tag at its end -> subtract 128 bytes from length for playback */

#define BITRATE_MASK 0x1FF       /* mask to extract "pure" bitrate */


/************************************************************************
**
** The P L A Y L I S T Structure
**
** all playlist functionality is placed in one file
**
** the startcluster and the number of embedded lists are stored in ROOT_SECTOR
** but the number of embedded playlists can be obtained from within the file itself 
** too by reading all playlists until the first list comes up with an empty name file
** empty =>  name[0] == 0
** 
** note that the playlist are stored here alphabetically
** 
** in case that there should be one day a sequence of playlists to be played
** (who knows) the playlists contain a pointer (index) to the next playlist to be played.
** note that there is a maximum of 0xFFFF playlists too so the index value of
** 0xffff has to be interpreted as "not set" or end of list
**
**
**
*************************************************************************/

#define YADL_LEN_PLAYLIST 32

typedef struct
{
  u08      name[YADL_LEN_PLAYLIST];

  u16      length_hours;        /* Length of playlist */
  u08      length_minutes;
  u08      length_seconds;
  
  FOFFSET  offset;              /* fileoffset of this list within the playlistfile */
  u16      entry_qty;           /* nr of entries in that particular list */
  u16      next_playlist;       /* -1 = STOP , else index of next list to be played */
  
  FOFFSET  system_sound_start;  /* corresponding relative FILE Offset in System Sound File */
  FLENGTH  system_sound_length; /* length of that file chunk inside the sys sound file */
  u08      z_dummy00[12];        /* not used yet */
}YADL_PLAY_LIST_ENTRY;


#endif

⌨️ 快捷键说明

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