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
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