标签:mode getch clu ring com cts ini http imp
一般这种手册,寄存器一大堆,看的头大。
#include "stdafx.h" #include <stdio.h> #include <string.h> #include <math.h> #include<stdlib.h> #include <dos.h> #include <conio.h> /** * Default value for a register. We use an array of structs rather * than a simple array as many modern devices have very sparse * register maps. * * @reg: Register address. * @def: Register default value. */ struct reg_default { unsigned int reg; unsigned int def; }; #define ENDMARKER { 0xffff, 0xffffffff} #define DEV_ADDR (0x2D) struct reg_default IC_Codec_init_table[] = { { 0x013C,0x000A000C}, { 0x0114,0x00000008 }, { 0x0164,0x0000000D }, { 0x0168,0x0000000D}, { 0x016C,0x0000000D }, { 0x0170,0x0000000D }, { 0x0134,0x0000001F }, { 0x0210,0x0000001F }, { 0x0104,0x00000001 }, { 0x0204,0x00000001 }, { 0x0450,0x03F00120 }, { 0x0454,0x003C0014 }, { 0x0458,0x00C80780 }, { 0x045C,0x000C0008 }, { 0x0460,0x001A0438 }, { 0x0464,0x00000001 }, { 0x04A0,0x00448006 }, { 0x04A0,0x00048006 }, { 0x0504,0x00000004 }, { 0x0480,0x03020100 }, { 0x0484,0x08050704 }, { 0x0488,0x0F0E0A09 }, { 0x048C,0x100D0C0B }, { 0x0490,0x12111716 }, { 0x0494,0x1B151413 }, { 0x0498,0x061A1918 }, { 0x049C,0x00000263}, ENDMARKER }; static int i2c_write( int dev_addr, int reg_addr, int reg_value) { printf("i2c write reg \n"); return 0; } int main() { int i = 0; while (IC_Codec_init_table[i].reg != 0xffff) { i2c_write(DEV_ADDR, IC_Codec_init_table[i].reg, IC_Codec_init_table[i].def); i++; } getchar(); return 0; }
标签:mode getch clu ring com cts ini http imp
原文地址:https://www.cnblogs.com/nowroot/p/12815038.html