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

📄 wm8775_test.c

📁 sigma_designs的tuner驱动
💻 C
字号:
#include <stdio.h>#include <stdlib.h>#include <string.h>#define ALLOW_OS_CODE 1#include "rmdef/rmdef.h"#include "llad/include/gbus.h"#include "emhwlib_hal/include/emhwlib_registers.h"#include "emhwlib_hal/i2c/include/i2c_hal.h"#include "../helper/helper.h"#include "wm8775.h"#define APP_VERSION 	"wm8775-0.1"static void show_cmdline(char* argv){	printf("H - help\n");	return;}int main( int argc, char* argv[] ){	struct llad* 	pLLAD;	RMvoid* 	pGBus;	struct i2c	i2cConfig;		WM8775_CONFIG	wmConfig;	RMstatus s;	int argi = 1;			printf("\n");	printf("Sigma Designs ");       	printf(APP_VERSION);		printf(" (c) 2005\n");	printf("----------------------------------------------\n");	if( (s = mum_init( 0, &pLLAD, &pGBus)) != RM_OK )	{		printf("main !mum_init FAILED %d\ncheck your 86xx driver\n", s);		exit(s);	}		/* I'm only going to use 1 I2c bus, but you can have multiple linked to different tuners */		memset(&i2cConfig, 0, sizeof(struct i2c) );	i2cConfig.pGBus = pGBus;	i2cConfig.PioClock = 0;	i2cConfig.PioData = 1;	i2cConfig.RegBase = REG_BASE_system_block;	i2cConfig.DelayUs = 0x8010;  // for emi2c, this will use default, for i2c_hal, set to 10				// +10 for slow i2c bus			memset(&wmConfig, 0, sizeof(WM8775_CONFIG));	wmConfig.pI2Cal_Context = (I2CAL_CONTEXT *)&i2cConfig;	wmConfig.uI2CAddress = 0x34;			if( argc <= 1 )	{		show_cmdline(argv[0]);		goto main_exit;	}	else		{				while( argi < argc )		{			RMstatus s = RM_ERROR;			RMuint8 u8;			//RMuint32 addx;			printf("\nCommand Issued: ");			switch( argv[argi][0] )			{			default:			case 'H':				show_cmdline(argv[0]);				goto main_exit;				break;							case 'R':				printf("Reset\n");				s = wm8775_reset(&wmConfig);				break;							case 'D':				if(argv[argi][1] == '1')				{					printf("Power Down\n");					s = wm8775_powerDown(&wmConfig, 1);				}				else				{					printf("Power Up\n");					s = wm8775_powerDown(&wmConfig, 0);				}				break;						case 'C':				printf("Configuration\n");				switch( argv[argi][1] )				{				case '1':					printf("Slave Mode, 256fs");					if( (s = wm8775_mode(&wmConfig, 0, wm8775_adc_256fs, 0)) != RM_OK )						break;					printf("I2S, 24bit\n");					s = wm8775_audioInterface(&wmConfig, wm8775_if_i2s, 0, wm8775_wl_24bit, 0);					break;								case '2':				default:					printf("Configuration List\n");					break;				}				break;						case 'I':				printf("Input ");				u8 = atoi(argv[argi] + 1) & 0xFF;				printf("%d\n", u8);				s = wm8775_inputMuxControl(&wmConfig, u8, 0, 0, 0);				break;							case 'G':				printf("Gain L+R\n");				u8 = atoi(argv[argi] + 1) & 0xFF;				s = wm8775_gain(&wmConfig, u8, u8, 0, 0);				break;							} // end switch			argi++;			printf("Command status = %d,  RM_OK = %c\n\n", s, (s==RM_OK)?'y':'n');		} //end while	}	main_exit:	mum_exit(pGBus, pLLAD);	return 0;}

⌨️ 快捷键说明

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