CODEC__spi.c File Reference


Detailed Description

This module provides CODEC SPI access support.

REVISION

Definition in file CODEC__spi.c.

#include "../SYSTEM/sys_hardware.h"
#include "codec.h"

Include dependency graph for CODEC__spi.c:

Include dependency graph

Go to the source code of this file.

Functions

void CODEC__spiWrite (unsigned short cmd)
 Function writes commands to Codec chip.


Function Documentation

void CODEC__spiWrite unsigned short  cmd  ) 
 

Function writes commands to Codec chip.

Parameters:
cmd command sent to Codec chip.

Definition at line 35 of file CODEC__spi.c.

References SYS_delayMicrosecond().

Referenced by CODEC_gain(), CODEC_hpVolume(), CODEC_init(), CODEC_mute(), and CODEC_power().

00036 {
00037     unsigned short i;
00038     unsigned short iTmp;
00039 
00040     SPI_lock(SYS_FOREVER);
00041         
00042     // clear the clock.  All data is latched in on the rising edge.
00043     iTmp = SPI_CLK;      
00044     
00045     // clear tuner data line to set to input.
00046     //iTmp = TUNER_DAT; 
00047     
00048     // clear the CODEC enable to enable.    
00049     iTmp = CODEC_EN;
00050     SYS_delayMicrosecond(1);
00051     for (i = 0; i < 16; i++)
00052     {
00053         iTmp = SPI_CLK;                 
00054         
00055         if (cmd & 0x8000) SPI_DATA = 0x0;
00056         else iTmp = SPI_DATA;
00057         
00058         SYS_delayMicrosecond(1);
00059         SPI_CLK = 0x0;
00060         SYS_delayMicrosecond(1);
00061         cmd = cmd<<1;
00062     }
00063     
00064     // disable the EEPROM;
00065     //  asm (" ssbx XF");       
00066         
00067     // clear SPI clock 
00068     iTmp = SPI_CLK;         
00069         
00070     // clear the DATA line, set to input.
00071     iTmp = SPI_DATA;
00072         
00073     // clear the DATA line on the tuner to set to input
00074     //iTmp = TUNER_DAT;     
00075         
00076     // set codec enable to disable
00077     CODEC_EN = 0x0; 
00078         
00079     // put tuner in read mode.
00080     //iTmp = TUNER_WR;
00081     
00082     SPI_unlock();
00083 }

Here is the call graph for this function:


Generated on Wed Jan 19 01:12:48 2005 for neuros-firmware by  doxygen 1.3.9.1