|
|
/*------------------------------------------------------------------------------
|
|
|
#-- This file is a part of the libuc, microcontroler library
|
|
|
#-- Copyright (C) 2011, Alexis Jeandet
|
|
|
#--
|
|
|
#-- This program is free software; you can redistribute it and/or modify
|
|
|
#-- it under the terms of the GNU General Public License as published by
|
|
|
#-- the Free Software Foundation; either version 3 of the License, or
|
|
|
#-- (at your option) any later version.
|
|
|
#--
|
|
|
#-- This program is distributed in the hope that it will be useful,
|
|
|
#-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
#-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
#-- GNU General Public License for more details.
|
|
|
#--
|
|
|
#-- You should have received a copy of the GNU General Public License
|
|
|
#-- along with this program; if not, write to the Free Software
|
|
|
#-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
#-------------------------------------------------------------------------------
|
|
|
#-- Author : Alexis Jeandet
|
|
|
#-- Mail : alexis.jeandet@member.fsf.org
|
|
|
#-------------------------------------------------------------------------------*/
|
|
|
#ifndef VS10XX_H
|
|
|
#define VS10XX_H
|
|
|
#include <uhandle.h>
|
|
|
#include <spi.h>
|
|
|
|
|
|
#define VSMODE 0
|
|
|
#define VSSTATUS 1
|
|
|
#define VSBASS 2
|
|
|
#define VSCLOCKF 3
|
|
|
#define VSDECODE_TIME 4
|
|
|
#define VSAUDATA 5
|
|
|
#define VSWRAM 6
|
|
|
#define VSWRAMADDR 7
|
|
|
#define VSHDAT0 8
|
|
|
#define VSHDAT1 9
|
|
|
#define VSAIADDR 0xA
|
|
|
#define VSVOL 0xB
|
|
|
#define VSAICTRL0 0xC
|
|
|
#define VSAICTRL1 0xD
|
|
|
#define VSAICTRL2 0xE
|
|
|
#define VSAICTRL3 0xF
|
|
|
|
|
|
typedef enum VS10XXVER_en
|
|
|
{
|
|
|
UNKNOWN,
|
|
|
VS1001,
|
|
|
VS1011,
|
|
|
VS1002,
|
|
|
VS1003,
|
|
|
VS1053,
|
|
|
VS1033,
|
|
|
VS1103
|
|
|
}VS10XXVER_en;
|
|
|
|
|
|
typedef struct vs10XXDev
|
|
|
{
|
|
|
spi_t SPIdev;
|
|
|
void (*setxCS)(char);
|
|
|
void (*setxRST)(char);
|
|
|
void (*setxDCS)(char);
|
|
|
int (*getDREQ)();
|
|
|
VS10XXVER_en VERSION;
|
|
|
}vs10XXDev;
|
|
|
|
|
|
|
|
|
void vs10XXopen(vs10XXDev* codec,spi_t dev, void (*setxCS)(char),void (*setxRST)(char),void (*setxDCS)(char),int (*getDREQ)());
|
|
|
void vs10XXsoftreset(vs10XXDev* dev);
|
|
|
int vs10XXcmdread(vs10XXDev* dev,char address);
|
|
|
void vs10XXcmdwrite(vs10XXDev* dev,char address,int value);
|
|
|
void vs10XXstream32bytes(vs10XXDev* dev,char* buffer);
|
|
|
void vs10XXsetCansel(vs10XXDev* dev);
|
|
|
int vs10XXcanselAccepted(vs10XXDev* dev);
|
|
|
void vs10XXsoftReset(vs10XXDev* dev);
|
|
|
//extern void vs10XXclearXCS();
|
|
|
//extern void vs10XXsetXCS();
|
|
|
//extern int vs10XXDREQ();
|
|
|
|
|
|
#endif //VS10XX_H
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|