Thread: Attempting to upgrade audio hardware. Creating new/modified machine driver.

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

    Attempting to upgrade audio hardware. Creating new/modified machine driver.

    Hey there, so I am not an experienced C programmer just to get that out of the way. However, I am attempting to both learn C and the Linux ASoC system. I am working on replacing some old hardware (codec) with a new one. Specifically, I am attempting to write/adapt a new machine driver for the WM8750 audio codec based off of the existing machine driver that I have for the WM8753 audio codec (deprecated).

    I have a few questions:

    1) The following define:

    Code:
    #define WM8753_SSI MASTER        1
    What does the 1 mean after the initial deceleration?

    2)
    Code:
    #if WM8753_SSI_MASTER
        dai_format |= SND_SOC_DAIFMT_CBM_CFM;
    Bit-wise OR operation I think it is equivalent to:
    dai_format = dai_format | SND_SOC_DAIFMT_CBM_CFM
    is that right?

    3)
    Code:
    ssi_mode->sync_mode = 1;
    Equivalent to: (*xxi_mode).sync_mode = 1... where xxi = ssi (wont let me type what I want to... keeps replacing it with ..........)

    I believe, this means: assign the member sync_mode that ssi_mode points to and set its value to 1?

    4) :

    Code:
    channels == 1 ? 0xfffffffe : 0xfffffffc,
    I believe this means: if channels == 1 then 0xfffffffe else 0xfffffffc

    5) :

    Code:
    .name = "WM8753"
    -What does it mean when a variable has a . in front of it?

    6) :
    Code:
    plat = priv->pdev->dev.platform_data;
    plat = (*priv).(*pdev).(*dev.platform_data)??? -not sure what's happening here.


    Well that is plenty for now I would say. Hey if anyone wants to help me with the project I can post the old machine driver and the codecs, just let me know!

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    36,629
    > What does the 1 mean after the initial deceleration?
    It means that wherever the pre-processor sees WM8753_SSI_MASTER, it will substitute the value 1

    > dai_format = dai_format | SND_SOC_DAIFMT_CBM_CFM
    > is that right?
    Yes.

    > I believe, this means: assign the member sync_mode that ssi_mode points to and set its value to 1?
    Yes,
    (*ptr).member is the same as ptr->member.

    > I believe this means: if channels == 1 then 0xfffffffe else 0xfffffffc
    Yes it does.

    > -What does it mean when a variable has a . in front of it?
    It means assign that member within the structure.
    Historically, member assignment is in declaration order, so
    Code:
    struct foo {
        int a;
        int b;
    } = { 0, 1 };
    Which is a bit fragile if you want to add more members to the structure.

    Whereas
    Code:
    struct foo {
        int a;
        int b;
    } = { .a = 0, .b = 1 };
    Will always do the right thing even if the structure changes to say
    Code:
    struct foo {
        int x;
        int a;
        int y;
        int b;
    } = { .a = 0, .b = 1 };

    > plat = priv->pdev->dev.platform_data;
    > -not sure what's happening here.
    Well it's as above.
    priv is a pointer pointing to a structure which contains a member called pdev, which is itself a pointer to a dev.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Writing a linux hardware driver
    By nexusone in forum Linux Programming
    Replies: 1
    Last Post: 08-12-2008, 07:33 PM
  2. virtual audio driver
    By hellboi64 in forum Windows Programming
    Replies: 2
    Last Post: 09-10-2004, 05:21 PM
  3. hardware driver
    By ober in forum C Programming
    Replies: 5
    Last Post: 03-09-2004, 12:28 PM
  4. Hardware driver
    By ober in forum C Programming
    Replies: 5
    Last Post: 11-19-2003, 08:18 AM
  5. Diving into hardware device driver in Windows
    By AsAdi in forum Windows Programming
    Replies: 1
    Last Post: 02-01-2003, 03:30 AM

Tags for this Thread