Thread: Reguarding a segment of code in the machine driver I am attempting to convert.

  1. #1
    Registered User
    Join Date
    Nov 2014
    Posts
    26

    Reguarding a segment of code in the machine driver I am attempting to convert.

    I am attempting to convert a machine driver for the wm8753 codec into a working driver for the wm8750 codec and there is a section of code which I am unfamiliar with and am not sure what it is doing. Could someone take a look and see if they can make sense of it and its implications?

    Code:
    unsigned int ssi_ptcr = 0;
        unsigned int dai_ptcr = 0;
        unsigned int ssi_pdcr = 0;
        unsigned int dai_pdcr = 0;
        /* iMX51 uses SSI1 or SSI2 via AUDMUX port dai_port for audio */
    
        /* reset port ssi_port & dai_port */
        __raw_writel(0, DAM_PTCR(ssi_port));
        __raw_writel(0, DAM_PTCR(dai_port));
        __raw_writel(0, DAM_PDCR(ssi_port));
        __raw_writel(0, DAM_PDCR(dai_port));
    
        /* set to synchronous */
        ssi_ptcr |= AUDMUX_PTCR_SYN;
        dai_ptcr |= AUDMUX_PTCR_SYN;
    
    #if WM8753_SSI_MASTER
        /* set Rx sources ssi_port <--> dai_port */
        ssi_pdcr |= AUDMUX_PDCR_RXDSEL(dai_port);
        dai_pdcr |= AUDMUX_PDCR_RXDSEL(ssi_port);
    
        /* set Tx frame direction and source  dai_port--> ssi_port output */
        ssi_ptcr |= AUDMUX_PTCR_TFSDIR;
        ssi_ptcr |= AUDMUX_PTCR_TFSSEL(AUDMUX_FROM_TXFS, dai_port);
    
        /* set Tx Clock direction and source dai_port--> ssi_port output */
        ssi_ptcr |= AUDMUX_PTCR_TCLKDIR;
        ssi_ptcr |= AUDMUX_PTCR_TCSEL(AUDMUX_FROM_TXFS, dai_port);
    #else
        /* set Rx sources ssi_port <--> dai_port */
        ssi_pdcr |= AUDMUX_PDCR_RXDSEL(dai_port);
        dai_pdcr |= AUDMUX_PDCR_RXDSEL(ssi_port);
    
        /* set Tx frame direction and source  ssi_port --> dai_port output */
        dai_ptcr |= AUDMUX_PTCR_TFSDIR;
        dai_ptcr |= AUDMUX_PTCR_TFSSEL(AUDMUX_FROM_TXFS, ssi_port);
    
        /* set Tx Clock direction and source ssi_port--> dai_port output */
        dai_ptcr |= AUDMUX_PTCR_TCLKDIR;
        dai_ptcr |= AUDMUX_PTCR_TCSEL(AUDMUX_FROM_TXFS, ssi_port);
    #endif
    I am not sure what Rx and Tx are. From what I understand there should be no machine specific code inside a machine driver so I dont understand why its here or if I need to replicate its functionality. Also, my C skills are somewhat lacking.

  2. #2
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Rx Receive
    Tx Transmit

    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 10-12-2018, 03:57 AM
  2. Replies: 2
    Last Post: 09-19-2012, 01:58 PM
  3. Replies: 2
    Last Post: 06-08-2012, 05:47 PM
  4. Convert assembly>machine code, machine code>assembly
    By wenxinleong in forum C Programming
    Replies: 12
    Last Post: 06-23-2011, 10:42 PM
  5. Replies: 4
    Last Post: 01-18-2008, 07:05 PM

Tags for this Thread