SEED-DEC6713 understanding of emif_fmks (gblctl, nohold, disable)

Source: Internet
Author: User

Today I just got started with a piece of SEED-DEC6713, see emif_fmks (gblctl, nohold, disable) is very puzzled, I have never encountered this writing, so read the information to understand as follows.

The DSP Development Board comes with the following statements:

Emif_config myemif1_0 = {
0x30 |
Emif_fmks (gblctl, nohold, disable) |
Emif_fmks (gblctl, clk1en, disable) |
Emif_fmks (gblctl, clk2en, enable ),......}

Emif_fmks (gblctl, nohold, disable) is a predefined macro in csl_emifahal.h, as follows:
# Define emif_fmks (Reg, field, sym )\
_ Per_fmks (EMIF, # Reg, # field, # sym)

Here there are two symbols # And \, which need to be understood. For example:

1. "#" is a hyphen used in the macro definition.

# Define a (W, h) A _ ## W ## x ## H
A (720,576) is equivalent to a_720x576.

2. '\' is a program line break. As the name implies, note that there is no space behind '\', so it will become invalid and compilation will fail.

Therefore, the preceding statement can be equivalent to # define emif_fmks (Reg, field, sym) _ per_fmks (EMIF, # Reg, # field, # sym)

It seems like a bit of thinking here ...... Hey, let's continue:

The following statements can be found based on the TMS320C6000 chip support library API reference guide:

Field make symbolically <per> _ fmks
Macro <per> _ fmks (<Reg>, <field>, <sym>)
Arguments <Reg> Register name
<Field> Field name
<Sym> symbolic Field Value
Return Value uint32 in-place and masked-Field Value
Description This macro takes the symbolic field value then shifts it over and masks it
Form the in-place field value. It can be bit-wise or 'ed with other fmk or fmks
Macros to form a register value as an alternative to the RMK macro.
Example uint32 X;
X = dma_fmks (auxctl, chpri, highest)
| Dma_fmks (auxctl, auxpri, CPU );

We can understand the above Chinese characters as follows: According to define usage, the above statement is Operation _ per_fmks (,), that is:
_ Per_fmks (EMIF, Reg, field, sym) // emifa is the register to operate. Reg = gblctl, field = nohold, sym = Disable:
_ Per_fmks (EMIF, gblctl, nohold, disable)

This step-by-step push may be tedious to write as follows: emif_fmks (gblctl, nohold, disable)

Equivalent to: _ per_fmks (EMIF, gblctl, nohold, disable)

According to macro definition:

# DEFINE _ per_fmks (Per, Reg, field, sym )(\
(_ Per_fsym (## per, ## Reg, ## field, ## sym) <_ per_fshift (## per, ## Reg, ## field ))\
& _ Per_fmask (# per, # Reg, # field )\
)

It is equivalent to :( (_ per_fsym (EMIF, gblctl, nohold, disable) <_ per_fshift (EMIF, gblctl, nohold) & _ per_fmask (EMIF, gblctl, nohold ))

According to macro definition:

# DEFINE _ per_fshift (Per, Reg, field )\
_ ## Per ###### Reg ##### field ##_ shift

# DEFINE _ per_fmask (Per, Reg, field )\
_ ## Per ###### Reg ##### field ##_ mask

# DEFINE _ per_fsym (Per, Reg, field, sym )\
Per ##### Reg ##### field ##### sym

It is equivalent to :( (_ emif_gblctl_nohold_disable) <_ emif_gblctl_nohold_shift) & _ emif_gblctl_nohold_mask)

Okay: I finally encountered a problem ...... What does this mean?

Original

# DEFINE _ per_fshift (Per, Reg, field )\
_ ## Per ###### Reg ##### field ##_ shift
Suppose:
You set: _ emif_fshift (EMIF, gblctl, busreq)
That is: _ emif_gblctl_busreq_shift
Then a CSL header file contains a definition:
# DEFINE _ emif_gblctl_busreq_shift 0x0000000bu
Then let's talk about how EMIF, gblctl, and busreq come from. You need to read some ti documents-the document of the CSL support library.

We can see in the header file csl_emifhal.h.

# Define emif_gblctl_nohold_disable 0x00000000u

# DEFINE _ emif_gblctl_nohold_shift 0x00000007u

# DEFINE _ emif_gblctl_nohold_mask 0x00000080u

Eventually equivalent: (_ emif_gblctl_nohold_disable) <_ emif_gblctl_nohold_shift) & _ emif_gblctl_nohold_mask)

It is changed to 0x00000000u.

At this point, we fully understand that this is only a form of Ti writing, and eventually it is the same as what we normally use ......

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.