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

📄 fvhmp3c.h

📁 Frank s MP3 Player Source Files
💻 H
字号:
/******************************************************************************
    
    Title:    Frank's MP3 C files project header file
    Author:   Frank Van Hooft
    Date:     21 Aug 2004
    
    This file contains definitions required for the MP3 player project. 
    It should be #include'd into only the C source files.
    
    Note that only definitions which are required by solely the C
    files are in this file.
                  
******************************************************************************/


/* Type definitions and related defines */
typedef unsigned char  u08;
typedef          char  s08;
typedef unsigned short u16;
typedef          short s16;
typedef u08            bool;
#define	u32	unsigned long int
#define MAX_U16  65535
#define MAX_S16  32767

/* typedef for a pointer to a function, of prototype: void FunctionName (void); */
typedef void (*functPtr)(void);


/* following are registers for the Two Wire Interface (IIC or I2C) interface */
#define		TWI_TWBR		(volatile u08*)0x70		/* TWI bit rate register */
#define		TWI_TWCR		(volatile u08*)0x74		/* TWI Control Register  */
#define		TWI_TWSR		(volatile u08*)0x71		/* TWI status register   */
#define		TWI_TWDR		(volatile u08*)0x73		/* TWI data register     */
#define		TWI_TWAR		(volatile u08*)0x72		/* TWI address register  */

/* following are return codes for TWI functions */
#define		TWI_write_OK			0				/* write function completed OK */
#define		TWI_write_start_fail	100				/* write function start condition failed */
#define 	TWI_write_0x86_fail		101				/* write function didn't gain sta013's attention */
#define		TWI_write_waddr_fail	102				/* write function unable to give sta013 an addr  */
#define		TWI_write_wdata_fail	103				/* write function unable to give sta013 data  */

/* The following are states for PlayControl (PC_St) */
#define 	PC_St_Idle				0				/* Idle state */
#define 	PC_St_Play				1				/* Play state */

/* And these are error codes for PlayControl */
#define		PC_error_unknownstate		160			/* state dispatcher found an unknown state */
#define		PC_error_FindNextCommand	161			/* Idle state found an unknown PC_Command command */
#define		PC_error_PlayCommand		162			/* Play state found an unknown PC_Command command */

/* Following are I/O port registers */
#define		AVR_PINA		(volatile u08*)0x39		/* Port A input pins register - PINA */
#define		AVR_DDRA		(volatile u08*)0x3A		/* Port A data direction register - DDRA */
#define		AVR_PORTA		(volatile u08*)0x3B		/* Port A data port - PORTA */
#define		AVR_PINB		(volatile u08*)0x36		/* Port B input pins register - PINB */
#define		AVR_DDRB		(volatile u08*)0x37		/* Port B data direction register - DDRB */
#define		AVR_PORTB		(volatile u08*)0x38		/* Port B data port - PORTB */
#define		AVR_PINC		(volatile u08*)0x33		/* Port C input pins register - PINC */
#define		AVR_DDRC		(volatile u08*)0x34		/* Port C data direction register - DDRC */
#define		AVR_PORTC		(volatile u08*)0x35		/* Port C data port - PORTC */
#define		AVR_PIND		(volatile u08*)0x30		/* Port D input pins register - PIND */
#define		AVR_DDRD		(volatile u08*)0x31		/* Port D data direction register - DDRD */
#define		AVR_PORTD		(volatile u08*)0x32		/* Port D data port - PORTD */
#define		AVR_PINE		(volatile u08*)0x21		/* Port E input pins register - PINE */
#define		AVR_DDRE		(volatile u08*)0x22		/* Port E data direction register - DDRE */
#define		AVR_PORTE		(volatile u08*)0x23		/* Port E data port - PORTE */
#define		AVR_PINF		(volatile u08*)0x20		/* Port F input pins register - PINF */
#define		AVR_DDRF		(volatile u08*)0x61		/* Port F data direction register - DDRF */
#define		AVR_PORTF		(volatile u08*)0x62		/* Port F data port - PORTF */
#define		AVR_PING		(volatile u08*)0x63		/* Port G input pins register - PING */
#define		AVR_DDRG		(volatile u08*)0x64		/* Port G data direction register - DDRG */
#define		AVR_PORTG		(volatile u08*)0x65		/* Port G data port - PORTG */

/* Following are SPI port registers */
#define		AVR_SPCR		(volatile u08*)0x2D		/* SPI control register */
#define		AVR_SPDR		(volatile u08*)0x2F		/* SPI data register */
#define		AVR_SPSR		(volatile u08*)0x2E		/* SPI status register */

/* Following are AVR EEPROM registers */
#define		AVR_EEARL		(volatile u08*)0x3e		/* EEPROM Address Register Low */
#define		AVR_EEARH		(volatile u08*)0x3f		/* EEPROM Address Register High */
#define		AVR_EEDR		(volatile u08*)0x3d		/* EEPROM Data Register */
#define		AVR_EECR		(volatile u08*)0x3c		/* EEPROM Control Register */

/* FastFind table constants. Note that each table entry is 6 bytes: a 2-byte file number followed */
/* by a 4-byte cluster number. All numbers are stored low-byte first. */
#define     NumFFEntries    50                      /* number of 6-byte table entries. Must be < 255 */

/* This is the EEPROM "memory map", ie eeprom byte allocations */
/* All addresses are "start addresses". Note many eeprom entries are more than 1 byte long. */
/* *** START OF EEPROM ADDRESS ALLOCATIONS *** */
#define     STattenuation   0x00                    /* STA013 output attenuation level */
#define		StoreNumFilesL	0x01					/* high byte of number of MP3 files */
#define		StoreNumFilesH	0x02					/* low byte of number of MP3 files */
#define     DIRcluster0     0x03
#define     DIRcluster1     0x04
#define     DIRcluster2     0x05
#define     DIRcluster3     0x06                    /* cluster # for start of current directory */
#define     FFTableStart    0x07                    /* start address of FastFind table */
#define     FFTableEnd      (FFTableStart+(NumFFEntries*6)-1)   /* end address of FastFind table */

/* EEPROM allocation continues. For IR remote control decoding sequences.  There's a bunch of 128-byte entries, */ 
/* one for each possible IR bit sequence (power, stop, play, etc.) Each one of those 128-byte sequences is a */
/* 1-byte length, followed by a 1-byte code to write into ButtonPress if its sequence is detected, */
/* followed by up to 63 words (16-bit words) of periods for its IR period sequence. The words are stored */
/* low-byte first. These records are generically known as the IR Period Sequences. */
/* If there's no sequence recorded then the first byte (length) in the 128-byte entry will be zero. */
/* If you want to add codes, always add them to the end of this list. */
#define     IRcode_Start    FFTableEnd+1            /* start address of first IR period sequence entry */
#define     IRcode_pwr      IRcode_Start            /* 128 bytes for remote control bit sequence: POWER */
#define     IRcode_play     IRcode_pwr+128          /* 128 bytes for remote control bit sequence: PLAY */
#define     IRcode_stop     IRcode_play+128         /* 128 bytes for remote control bit sequence: STOP */
#define     IRcode_mode     IRcode_stop+128         /* 128 bytes for remote control bit sequence: MODE (random on/off) */
#define     IRcode_next     IRcode_mode+128         /* 128 bytes for remote control bit sequence: NEXT */
#define     IRcode_back     IRcode_next+128         /* 128 bytes for remote control bit sequence: BACK */
/* *** END OF EEPROM ADDRESS ALLOCATIONS *** */

/* The following are used in conjunction with the IR EEPROM definitions above. If the IR EEPROM definitions */
/* are changed, then the following #define's must be changed as well. */
#define     IR_numcodes     6                       /* number of different IR codes we support */
/* The following helps us to offset away from IRcode_Start */
#define     IR_numpwr       0                       /* POWER period sequence is first in the EEPROM */
#define     IR_numplay      1
#define     IR_numstop      2
#define     IR_nummode      3
#define     IR_numnext      4
#define     IR_numback      5                       /* BACK IR period sequence is last in the EEPROM */


/* Following are AVR timer/counter 0 registers */
#define		AVR_TCCR0		(volatile u08*)0x53		/* Timer/Counter 0 Control Register */
#define     AVR_TCNT0       (volatile u08*)0x52     /* T/C 0 timer/counter register */

/* Following are AVR timer/counter 1 registers */
#define		AVR_TCCR1A		(volatile u08*)0x4f		/* Timer/Counter 1 Control Register A */
#define		AVR_TCCR1B		(volatile u08*)0x4e		/* Timer/Counter 1 Control Register B */
#define		AVR_TCNT1H		(volatile u08*)0x4d		/* Timer/Counter 1 high byte */
#define		AVR_TCNT1L		(volatile u08*)0x4c		/* Timer/Counter 1 low byte */
#define     AVR_OCR1AH      (volatile u08*)0x4b     /* T/C 1 output compare register A high byte */
#define     AVR_OCR1AL      (volatile u08*)0x4a     /* T/C 1 output compare register A low byte */

/* Following are AVR timer/counter 3 registers */
#define		AVR_TCCR3A		(volatile u08*)0x8b		/* Timer/Counter 3 Control Register A */
#define		AVR_TCCR3B		(volatile u08*)0x8a		/* Timer/Counter 3 Control Register B */
#define		AVR_TCNT3H		(volatile u08*)0x89		/* Timer/Counter 3 high byte */
#define		AVR_TCNT3L		(volatile u08*)0x88		/* Timer/Counter 3 low byte */
#define		AVR_ICR3H		(volatile u08*)0x81		/* Timer/Counter 3 input capture register high byte */
#define		AVR_ICR3L		(volatile u08*)0x80		/* Timer/Counter 3 input capture register low byte */

/* Following are the timer/counter interrupt related registers */
#define     AVR_TIMSK       (volatile u08*)0x57     /* timer interrupt mask register */
#define     AVR_ETIMSK      (volatile u08*)0x7d     /* extended timer interrupt mask register */
#define     AVR_ETIFR       (volatile u08*)0x7c     /* extended timer interrupt flags register */

/* Following are the stack pointer registers */
#define 	AVR_SPL			(volatile u08*)0x5d		
#define 	AVR_SPH			(volatile u08*)0x5e		/* stack pointer low & high bytes */

/* Following are UART registers */
#define		AVR_UDR0		(volatile u08*)0x2C	    /* UART 0 data register */

#define     AVR_EICRB       (volatile u08*)0x5a
#define     AVR_EIMSK       (volatile u08*)0x59

// The following used by InitRandomVariables to help determine a value for the StepSize global variable
#define		SPACING			30

// The following are pushbutton codes (characters sent by the LCD / pushbutton assembly
// If you change these, you MUST change contents of LCD_init() function as well.
#define     BUT_ONOFF       'A'
#define     BUT_MODE        'B'
#define     BUT_STOP        'C'
#define     BUT_PLAY        'D'
#define     BUT_REPEAT      'E'
#define     BUT_PREVIOUS    'F'
#define     BUT_NEXT_DN     'G'
#define     BUT_NEXT_UP     'g'
#define     BUT_UP          'H'
#define     BUT_LEFT        'I'
#define     BUT_RIGHT       'J'
#define     BUT_DOWN        'K'
#define     BUT_MENUSEL     'L'


⌨️ 快捷键说明

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