redpitaya source code : rp_GenFreq(rp_channel_t channel, float frequency)

Applications, development tools, FPGA, C, WEB
Post Reply
adamS
Posts: 12
Joined: Mon Jul 09, 2018 11:25 am

redpitaya source code : rp_GenFreq(rp_channel_t channel, float frequency)

Post by adamS » Sat Dec 15, 2018 8:05 am

Hi everyone,
I'm studying the redpitaya source code,
I have a question in rp_GenFreq->gen_setFrequency->gen_Synchronise->generate_Synchronise->cmn_SetBits((uint32_t *) generate, 0x00400040, 0xFFFFFFFF);
Here generate is the pointer point to a structure space related to the FPGA register.

Definition of cmn_SetBits :

Code: Select all

int cmn_SetBits(volatile uint32_t* field, uint32_t bits, uint32_t mask)
{
    VALIDATE_BITS(bits, mask);
    SET_BITS(*field, bits);
    return RP_OK;
}
VALIDATE_BITS(bits, mask) and SET_BITS(*field, bits) are macros defined as:

Code: Select all

#define VALIDATE_BITS(b,m) { \
        if (((b) & ~(m)) != 0) return RP_EOOR; \
}
#define SET_BITS(x,b) ((x) |= (b))
My question is:
For my understanding, "field" in cmn_SetBits is an address to a structure,
then what's the meaning of SET_BITS(*field, bits) => *field |= bits ?
What's the purpose of SET_BITS ?

I appreciate any help.
Adam

Post Reply
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie

Who is online

Users browsing this forum: No registered users and 10 guests