L
learnfpga
I am trying to write a simple code for bit maniipulation and to start
with wrote a little code to read the port A of a microcontroller
MPC8xx. Its running on VxWorks. Anyways thats probably irrelevant. Can
anyone please point out mistake in the code.?
#include <stdio.h>
#include <iostream.h>
#include "arch/ppc/vxPpcLib.h"
unsigned long ppc_base_addr = vxImmrGet(); //Get the base address
#define PADAT *(volatile unsigned long *)(ppc_base_addr+0x956) //0x956
is address of port A
#define BIT(x) (1 << (x))
unsigned long read()
{
unsigned long i = 0x80000000;
PADAT = i;
unsigned long temp = *(unsigned long *)(PADAT);
return(temp);
}
Thanks for any suggestions.
PS- I can probably ask the Q in VxWorks or Embedded group but I think
its my C++ that a problem....
with wrote a little code to read the port A of a microcontroller
MPC8xx. Its running on VxWorks. Anyways thats probably irrelevant. Can
anyone please point out mistake in the code.?
#include <stdio.h>
#include <iostream.h>
#include "arch/ppc/vxPpcLib.h"
unsigned long ppc_base_addr = vxImmrGet(); //Get the base address
#define PADAT *(volatile unsigned long *)(ppc_base_addr+0x956) //0x956
is address of port A
#define BIT(x) (1 << (x))
unsigned long read()
{
unsigned long i = 0x80000000;
PADAT = i;
unsigned long temp = *(unsigned long *)(PADAT);
return(temp);
}
Thanks for any suggestions.
PS- I can probably ask the Q in VxWorks or Embedded group but I think
its my C++ that a problem....