This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to get cpu id?

Hi,

    Now,i have some question need your help,i'am using DM365 and DM368 to do DVR development.

    I want to through cpu id to distinguish between DM365 and DM368

    Who can tell me how to get the cpu id?

  • Thanks for your reply,

          Before my post, I have read these changes,but i couldn't understand how to use is.

          Can you paste some code to explain it.

          Call cpu_is_davinci_dm368() or cpu_is_davinci_dm365() can judge the cpu is DM365 or DM368?

     

    Best regards,

     

  • Please include mach/cputype.h and use cpu_is_davinci_xxxx macro. You can grep for cpu_is_davinci_dm365() macros in drivers folder.

    Thanks,

    Prakash

  • Ok, I can simple get cpu id in driver via cpu_is_davinci_dm365() macros.
    How can I get cpu id in user-space, parse /proc/cpuinfo is not very good way?
    Thank you.

  • Kirill Brilliantov said:
    parse /proc/cpuinfo is not very good way?

    It's not that hard:

    1. open file /proc/cpuinfo - if cannot, return fail

    2. read line-by-line

    eg.

    Processor       : ARM926EJ-S rev 5 (v5l)
    BogoMIPS        : 240.84
    Features        : swp half thumb fastmult edsp java
    CPU implementer : 0x41
    CPU architecture: 5TEJ
    CPU variant     : 0x0
    CPU part        : 0x926
    CPU revision    : 5

    3 for each line, check using strstr() whether required string is present from:

    CPU implementer
    CPU architecture
    CPU variant
    CPU part
    CPU revision

    or whichever are the values you require

    4 when you detect a string you want, parse it using sscanf(), eg

    match_length = -1;

    match_count = sscanf(linebuf, "CPU part        : 0x%x%n", &partnum, &match_length);

    // using %n match_length gets set ensures we have read all the field

    if (match_count == 1 && match_length > 0) {

    // found valid CPU part number ...

    }

  • Hello, Mike!

    Parse /proc/cpuinfo is not hard, it isn't reliable.

    I or who or other can edit MACHINE_START macro in kernel and result becomes not predictable.

    Or may be your can describe all line in /proc/cpuinfo for all processors, e.g. how to change Processor, CPU implementer, CPU variant, CPU part and CPU revision for DM355, DM365 and DM368?

  • Otherwise, read the ARM CPU id register:

    http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0395b/CIHCAGHH.html

    and the TMS320C64x CSR register - is there a way to do this from the ARM ?

    SInce there are two CPUs, there might be a case for saying that Linux should report the other (TMS) CPU as well - but it's not running Linux so I suppose not.