1. This forum section is a read-only archive which contains old newsgroup posts. If you wish to post a query, please do so in one of our main forum sections (here). This way you will get a faster, better response from the members on Motherboard Point.

.VAR message_struc[$msg.STRUC_SIZE];

Discussion in 'Embedded' started by Boki, Jun 26, 2006.

  1. Boki

    Boki Guest

    Hi All,

    New to DSP, or said MCU.

    I saw this code:

    .VAR message_struc[$msg.STRUC_SIZE];

    My understanding is:

    ..VAR ( like "int" in C )

    and then nothing more, could you please advice what is that?

    Best regards,
    Boki.
     
    Boki, Jun 26, 2006
    #1
    1. Advertisements

  2. On Mon, 26 Jun 2006, Boki wrote:

    "New to DSP, or said MCU.

    I saw this code:

    .VAR message_struc[$msg.STRUC_SIZE];

    My understanding is:

    ..VAR ( like "int" in C )

    and then nothing more, could you please advice what is that?"

    You did not say what kind of language or file it is in, but it seems to me
    to be related to a textual string (a message) or multitasking (message
    passing).
     
    Colin Paul Gloster, Jun 26, 2006
    #2
    1. Advertisements

  3. Boki

    Boki Guest

    Colin Paul Gloster 寫�:
    um ..... my wonder

    What does $ mean here,? Never see it in C.

    This code is in a .asm.

    and it includes some .h files.

    I feel that DSP is a RISC C ?

    It not the asm I learn when I in school..( mov xx,xxx ....etc)
    It very like C programming... but less commands..

    Best regards,
    Boki.
     
    Boki, Jun 26, 2006
    #3
  4. Boki

    Tom Lucas Guest

    Which language/device/compiler is this?
     
    Tom Lucas, Jun 26, 2006
    #4
  5. Looks like Analog Devices' assembler syntax.

    To Boki: does it look like this code:

    ..module/boot=0 sample_data;

    #include <filter.h>;

    ..include <main.h>;

    ..entry sample, init_sample;

    ..global sig_buf, back_buf;

    ..var/dm/circ sig_buf[NSAMPLES]; { filtered signal }
    ..var/dm/circ back_buf[NSAMPLES]; { background signal }


    {
    init_sample: Initialize registers for sampling.
    }
    init_sample: i2 = ^back_buf;
    l2 = %back_buf;
    i3 = ^sig_buf;
    l3 = %sig_buf;
    rts;


    {
    Sample: Sampling routine. Each sample of data is processed through an
    alpha-filter.
    }
    sample: ena sec_reg; { enable secondary registers }

    { read ADC and subtract backgound signal }
    ar = rx1; { read data from sport1 (adc) }
    ay0 = dm(i2,m1); { get background signal }
    ar = ar - ay0; { subtract background from signal }
    mx0 = ar; { signal to mx0 }

    { perform an alpha filter on the input signal, and }
    { store result }
    my0 = ALPHA; { load alpha }
    my1 = ONE_MIN_ALPHA; { load 1-alpha }
    mr = mx0 * my0 (ss), mx0 = dm(i3,m0); { sig. * alpha, get prev. sample }
    mr = mr + mx0 * my1(rnd); { * 1-alpha + prev result }
    dm(i3,m1) = mr1; { update signal }

    { output signal to DAC }
    ay0 = DATA_MASK; { load mask for cleared bits 0 and 1 }
    ar = mr1 and ay0; { apply mask }
    tx1 = ar; { diff. signal to sport1 (dac) }

    rti;


    ..endmod;
     
    Meindert Sprang, Jun 26, 2006
    #5
  6. Boki

    Boki Guest

    Tom Lucas 寫�:
    It was called Kalimba, a CSR ( a bluetooth chip company ) owned
    complier.

    Boki.
     
    Boki, Jun 27, 2006
    #6
  7. Boki

    Boki Guest

    Meindert Sprang 寫�:
    Hi,

    It seems is, but not quite so, here is one section of my code:
    (I have modified some keyword to Boki or else.)


    ..MODULE $M.Boki_out_copy_handler;
    .CODESEGMENT PM;
    .DATASEGMENT DM;

    $Boki_out_copy_handler:

    // push rLink onto stack
    $push_rLink_macro;

    r8 = &$BokiDouble_out_copy_struc;
    r7 = &$mono_out_copy_struc;
    // see if mono or BokiDouble connection, based on whether the right
    output port
    // is enabled
    r0 = $Boki_RIGHT_OUT_PORT;
    call $cbuffer.is_it_enabled;
    if Z r8 = r7;

    // Call the copy routine
    call $cbops.copy;

    // post another timer event
    r1 = &$Boki_out_timer_struc;
    r2 = TMR_PERIOD_Boki_COPY;
    r3 = &$Boki_out_copy_handler;
    call $timer.schedule_event_in_period;

    // pop rLink from stack
    jump $pop_rLink_and_rts;

    ..ENDMODULE;

    Best regards,
    Boki.
     
    Boki, Jun 27, 2006
    #7
  8. Boki

    Boki Guest

    Boki 寫�:
    Hi All,

    Find the description in docuemnt..

    A symbol may be declared as global by beginning its name with a dollar
    sign '$'

    Best regards,
    Boki.
     
    Boki, Jun 27, 2006
    #8
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.