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.