How to access PORT pins of 8248 processor from Linux application software?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How to access PORT pins of 8248 processor from Linux application software?

970 次查看
sundar
Contributor I

I want to toggle  Port pins at some regular intervals by a C codes it possible to implement that functionality using Linux API function memmap()?If so can anyone provide me code snippet?

Regrds,

 MuthuSundaresan

标记 (1)
0 项奖励
1 回复

386 次查看
ronco
NXP Employee
NXP Employee

Hi ,

 

You can write your own pin-toggling code in C without going through the Linux API.  Here's a simple example taken from an MPC860 project:

 

#define IMMR_REG        0xFF000000
#define PORT_B_REG      (IMMR_REG+0xAC4)

 

     *(unsigned int *)PORT_B_REG = data;

 

In this example, the value of data is written to the MPC860's Port-B register but you could also read the input pins in the same manner.  Input and output are determined by the DataDirection Register.  In this example I used this code:

 

  /* Set Port B for outputs */
 *(unsigned int *)PORT_B_DDR = 0xFFFF;

 

Adapting this code to the MPC8248 should not be difficult.  I hope this helps.

 

Regards,

Ron

0 项奖励