s5p4418 Android Linux内核 自定义IO访问方法


#include <asm/io.h>

typedef struct
{
	volatile unsigned int UARTDR;			///< 0x00	: Output Register
	volatile unsigned int UARTRSR;		///< 0x04	: Output Enable Register
	volatile unsigned int reserve[5];
	volatile unsigned int UARTFR;	///< 0x08	: Event Detect Mode Register
	volatile unsigned int UARTILPR;		///< 0x10	: Interrupt Enable Register
	volatile unsigned int UARTIBRD;			///< 0x14	: Event Detect Register
	volatile unsigned int UARTLCR_H;			///< 0x18	: PAD Status Register
	volatile unsigned int UARTCR;		///< 0x1C	: Pull Up Enable Register
	volatile unsigned int UARTIFLS;		///< 0x20	: Alternate Function Select Register
	volatile unsigned int UARTIMSC;    ///< 0x28   : Event Detect Mode extended Register
}NX_UART_RegisterSet;
#define Write_IO(Addr,Data) (*(volatile unsigned int*)Addr)=((unsigned int)Data)
#define UART_GPIO_BASEADDR              0xC00A0000//PHY_BASEADDR_GPIOB
#define UART_GPIO_NUM                   24
void uart_rts_cts_set()
{
    register unsigned int newvalue;
    //unsigned int addr;
    //addr = ioremap(WIFI_GPIO_BASEADDR, sizeof(NX_GPIO_RegisterSet));
    NX_UART_RegisterSet *uart_gpio = (NX_UART_RegisterSet *)ioremap(UART_GPIO_BASEADDR, sizeof(NX_UART_RegisterSet));
    /*pr_debug("wifi_gpio is:%x\n", wifi_gpio);
    pr_debug("GPIOxOUT is:%x\n", &wifi_gpio->GPIOxOUT);
    pr_debug("GPIOxOUTENB is:%x\n", &wifi_gpio->GPIOxOUTENB);
    pr_debug("val is:%x\n", val);*/
    newvalue = uart_gpio->UARTCR;

	newvalue &=		~(0xc0);
	newvalue |=		(unsigned int)0xc0 ;
	uart_gpio->UARTCR = newvalue;
	//pr_debug("GPIOxOUTENB is:%x\n", wifi_gpio->GPIOxOUTENB);
    //mdelay(10);
	//mdelay(10);
	//pr_debug("GPIOxOUT is:%x\n", wifi_gpio->GPIOxOUT);	
}


你可能感兴趣的:(linux内核)