Beispiel #1
0
/***********************************************************
 Function: reg_write_u8--write an UINT8 value to physical memory
 Input:    the  writed address and data
 return:   void
 see also: write_u32
 History:
 1.    2012.8.20   Creat
************************************************************/
void reg_write_u8(unsigned int pAddr, unsigned char value)
{
    void __iomem *virAddr = NULL;

    virAddr = REG_VIR_ADDR_MAP(pAddr);
    *(volatile unsigned char *)(virAddr)=value;
    REG_VIR_ADDR_UNMAP(virAddr);
}
/***********************************************************
 Function: reg_write_u16--write an UINT16 value to physical memory
 Input:    the  writed address and data
 return:   void
 see also: write_u8
 History:
 1.    2012.8.20   Creat
************************************************************/
void reg_write_u16(unsigned int pAddr, unsigned short value)
{
    unsigned int virAddr = 0;

    virAddr = REG_VIR_ADDR_MAP(pAddr);
    *(volatile unsigned short *)(virAddr)=value;
    REG_VIR_ADDR_UNMAP(virAddr);
}
Beispiel #3
0
/***********************************************************
 Function: reg_read_u8 --read an UINT8 value from physical memory
 Input:    the  read address
 return:   the value
 see also: read_u32
 History:
 1.    2012.8.20   Creat
************************************************************/
unsigned char reg_read_u8(unsigned int pAddr)
{
    unsigned char value = 0;
    void __iomem *virAddr = NULL;

    virAddr = REG_VIR_ADDR_MAP(pAddr);
    value = *(volatile unsigned char *)(virAddr);
    REG_VIR_ADDR_UNMAP(virAddr);

    return value;
}
/***********************************************************
 Function: reg_read_u16 --read an UINT16 value from physical memory
 Input:    the  read address
 return:   the value
 see also: read_u8
 History:
 1.    2012.8.20   Creat
************************************************************/
unsigned short reg_read_u16(unsigned int pAddr)
{
    unsigned short value = 0;
    unsigned int virAddr = 0;

    virAddr = REG_VIR_ADDR_MAP(pAddr);
    value = *(volatile unsigned short *)(virAddr);
    REG_VIR_ADDR_UNMAP(virAddr);

    return value;
}