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

📄 mp3_atj2180.c

📁 完全采用C编写的完整MP3解决方案源代码!
💻 C
📖 第 1 页 / 共 5 页
字号:
/*******************************************************************************
*                               (C) Ginwave Wireless Design
*
* RCSfile: Mp3_atj2180.c    
*
* Author: terry.yuan  
* Revision: 00.01       
* Date: 2004/12/8 15:50:27 
* Description:  Ginwave's mp3  linklayer  Driver about ATJ2180  chip
*
*******************************************************************************/


/*****   INCLUDE FILE     *****/
#include "common.h"
#include "scttypes.h"
#include "ms.h"

#include "mi.h"
//#include "Pmi_pdef.h"
#include "pmi_pptr.h"
#include "pmi_time.h"
#include <string.h>

#include "mk_inc.h"
#include "mp3_iic.h"
#include "regegold.h"
#include "Ms_clib.h"
#include "Pmi_opco.h"
#include "mp3_atj2180.h"
#include "regegold.h"
#include "pmi_ke16.h"

#include "mp3_interface.h"

#include "Lv24x.h"


// command &data is used to  enter work mode.


//link layer struct
typedef struct
{
       UCHAR   FRAME_LEN;
	UCHAR   FRAME_CMD;	
       UCHAR   FRAME_DATAS[5];
	UCHAR   FRAME_CHECK;
}FRAME_DOWNLINK;


typedef struct
{

       UCHAR   FRAME_LEN;
       UCHAR   FRAME_Dtype;       
	UCHAR   FRAME_CMD;	
       UCHAR   FRAME_DATAS[MP3_UPDATE_DATA_LENGH];
	UCHAR   FRAME_CHECK;

}FRAME_UPLINK;


const ATJ2180_MODE atj2180_mode[11] =
{
	/*ID_MAIN*/			{0x10	,0x11,  0x12},	
	/*ID_MUSIC*/		{0x20	,0x11,  0x12},	
	/*ID_VOICE*/		{0x30	,0x11,  0x12},	
	/*ID_RECORD*/		{0x40	,0x11,  0x12},	
	/*ID_TALK_RECORD*/ 	{0x41	,0x00,  0x12},	
	/*ID_RING*/			{0x50	,0x11,  0x12},	
	/*ID_PLAY_RING*/	{0x51	,0x00,  0x12},	
	/*ID_TALK*/	 		{0x60	,0x11,  0x12},	
	/*ID_UDISK*/		{0x70	,0x11,  0x12},
	/*ID_FM*/			{0x00	,0x11,  0x12},	
	/*ID_STANDBY*/		{0x80	,0x11,  0x12},
};

//general command & data is used in all modes.
//query working state in ATJ2180 

  
//set working state in ATJ2180 
//volume step set
typedef struct 					  	
{

	UCHAR    DATA_VOLUME[32]; 
       UCHAR    DATA_MAX_VALUME;
	UCHAR    DATA_MIN_VALUME;  
	UCHAR	CMD_VOLUME;
}ATJ2180_VOLUME;

static const ATJ2180_VOLUME atj2180_vol=
{
	{//32 steps volume
		0x00,0x01,0x02,0x03, 0x04,0x05,0x06, 0x07,
		0x08,0x09, 0x0a,0x0b,0x0c, 0x0d,0x0e,0x0f,
		0x10,0x11,0x12,0x13, 0x14,0x15,0x16, 0x17,
		0x18,0x19, 0x1a,0x1b,0x1c, 0x1d,0x1e,0x1f
	},

	{
		0x1f	//max
	},

	{
		0x00	//min
	},

	{
		0x04	//command of volume 
	}
};

typedef struct
{
	UCHAR    DATA_PLAYMODE[5];
	UCHAR    CMD_PLAYMODE;
	UCHAR    DATA_MIN;
	UCHAR    DATA_MAX;

}ATJ2180_PLAYMODE;
static const ATJ2180_PLAYMODE atj2180_playmode=
{
	{//5 play mode
		0x00, 0x01,0x02,0x03, 0x04,
	},
	{
		0x05//command of play mode 	
	},
	{
		0x00//MIN
	},
	{
		0x04//MAX
	}
};
//set play mode  in ATJ2180 
static struct 					  	
{
	UCHAR    DATA_LANGUAGE[3];
	UCHAR    CMD_LANGUAGE;
	UCHAR    DATA_MIN;
	UCHAR    DATA_MAX;

}const ATJ2180_LANGUAGE =
{
	{
		0x00, 0x01,0x02
	},
	{
		0x06
	},
	{
		0x00
	},
	{
		0x02
	}
};

//set GPIO in ATJ2180
static struct 					  	
{
        UCHAR   DATAbit_GPIO_SET[8];
        UCHAR   CMD_GPIO_SET;

}const ATJ2180_GPIO_SET =
{
	{
		0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80
	},
	{
		0x07
	}
};

//clear GPIO in ATJ2180
static struct 					  	
{
       UCHAR   DATAbit_GPIO_CLEAR[8];
	UCHAR   CMD_GPIO_CLEAR;	


} const ATJ2180_GPIO_CLEAR =
{
	{
		0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f
	},
	{
		0x08
	}
};

//read GPIO in ATJ2180
static struct 					  	
{
	UCHAR    CMD_GPIO_GET;	
} const ATJ2180_GPIO_GET =
{
	0x09
};


//set quick rapid play backwards and rapid play forwards
static struct 					  	
{
	UCHAR   RAPIDPLAY_BACKRWARDS[4];	
	UCHAR   RAPIDPLAY_STANDARD;
       UCHAR   RAPIDPLAY_FORWARDS[4];
	UCHAR   CMD_RAPIDPLAY;
	UCHAR    DATA_MIN;
	UCHAR    DATA_MAX;	

}const ATJ2180_set_DIRECTION =
{
	{
		0x00, 0x01,0x02,0x03 //rapid play backwards
	},
	{
		0x04                         //standard play
	},
	{
		0x05,0x06, 0x07,0x08//rapid play forwards
	},
	{
		0x0a                         //cmd 
	},
	{
		0x00
	},
	{
		0x08
	}
};

//delete the file 
static UCHAR Total_file_ID; 
static struct 					  	
{
	UCHAR    DATA_DELETE_FILE;    //varible value
	UCHAR    CMD_DELETE_FILE;	
}ATJ2180_DELETE_FILE =
{
	0x00,                                          //initial 0
	0x0b
};


//delete all files 
static struct 					  	
{
	UCHAR    CMD_DELETE_ALL_FILES;	
}const ATJ2180_DELETE_ALL_FILES =
{
	0x0c
};
//MUSIC COMMAND
static struct 					  	
{
       UCHAR    CMD_MUSIC_INF;
	UCHAR    CMD_MUSIC_BASIC_INF;	
	UCHAR    CMD_MUSIC_ID3;
	UCHAR    CMD_MUSIC_QUERY_TUNE;
	
       UCHAR    CMD_MUSIC_SET_SPECIAL_TUNE;
	UCHAR    CMD_MUSIC_PLAY_A_MUSIC;
	UCHAR    CMD_MUSIC_PLAY_BREAKPOINT;
	UCHAR    CMD_MUSIC_PAUSE_PLAY;
	UCHAR    CMD_MUSIC_STOP;	

} const ATJ2180_set_MUSIC  =
{
	0x31,
	0x32,
	0x33,
	0x34,
	0x35,
	0x36,
	0x37,
	0x38,
	0x39
};
//RING COMMAND
static struct 					  	
{
       UCHAR    CMD_RING_SUMMARY;
	UCHAR    CMD_RING_BASIC_INF;	
	UCHAR    CMD_RING_SET;
	UCHAR    CMD_RING_PLAY;
	
       UCHAR    CMD_RING_STOP;
	UCHAR    CMD_RING_CALL;

}const ATJ2180_set_RING  =
{
	0x61,
	0x62,
	0x63,
	0x64,
	0x65,
	0x66
};
//voice command
static struct 					  	
{
       UCHAR    CMD_VOICE_INF;
	UCHAR    CMD_VOICE_BASIC_INF;	
	UCHAR    CMD_VOICE_PLAY;
	UCHAR    CMD_VOICE_PLAY_INTERRUPT;
	
       UCHAR    CMD_VOICE_PLAY_PAUSE;
	UCHAR    CMD_VOICE_STOP;

}const ATJ2180_set_VOICE  =
{
	0x41,
	0x42,
	0x43,
	0x44,
	0x45,
	0x46
};

⌨️ 快捷键说明

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