Analysis of Functions of dispc_reg_in, dispc_reg_out, and dispc_reg_merge

Source: Internet
Author: User

U32 dispc_reg_in (u32 offset)

{

Return (inl (offset); // read four consecutive bytes from the port

}

This function reads the register value

U32 dispc_reg_out (u32 offset, u32 val)

{

Outl (val, offset); // write four consecutive bytes to the port

Return (val );

}

This function sets the value of all register bits.

U32 dispc_reg_merge (u32 offset, u32 val, u32 mask)

{

U32 addr = offset;

U32 new_val = (inl (addr )&~ Mask) | (val & mask );

Outl (new_val, addr );

Return (new_val );

}

This function sets the bit values specified by the register and keeps the values of other bit values unchanged. The specified bit is represented by a mask.

Mask: mask, that is, the mask of the bit to be set is set to 1, and the remaining is 0; www.2cto.com

Inl (addr )&~ Mask: the mask is reversed and the value in the register is used as the "and" operation. The result is that the bit to be set is 0, and other positions remain unchanged;

Val & mask: Set the position 0 or 1, and set the remaining values to 0;

Inl (addr )&~ Mask) | (val & mask: Set the original value and the set value as "or". You can set the bit to the corresponding value, while the other bit remains unchanged.

Related Article
Large-Scale Price Reduction
  • 59% Max. and 23% Avg.
  • Price Reduction for Core Products
  • Price Reduction in Multiple Regions
undefined. /
Connect with us on Discord
  • Secure, anonymous group chat without disturbance
  • Stay updated on campaigns, new products, and more
  • Support for all your questions
undefined. /
Free Tier
  • Start free from ECS to Big Data
  • Get Started in 3 Simple Steps
  • Try ECS t5 1C1G
undefined. /

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.