control NCS3

This forum is for users of Microchip MPUs and who are interested in using Linux OS.

Moderator: nferre

Nurofen
Contact:
Posts: 3
Joined: Wed Oct 26, 2005 2:48 pm

control NCS3

Wed Oct 26, 2005 3:30 pm

I have the LCD, it in address 0x4000 0000 (NCS3). LCD is slower, then bus. I have mapped the mem (0xFFFF F000), and trying to write in register SMC2 AT91C_SMC2_CSR 0xFFFFFF70 (0xFFFF FF73 because NCS3).

In manual written in initialization, that value of 0xFFFF FF73 is 0x2000.
Perhaps Linux changes this to 0x0?
And I try to write there 0xFF: 7-th bit Wait State Enable, and 0..6 bits - longest Wait State.

When I read register equal 0x77.

int fd, i;
unsigned long readval, writeval;
char *map_base, *map_base_t;

if((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1) { /* open file mem */
printf("File dev.mem ne ojpen\n");
exit(-1);
}
map_base = mmap(0, 0xFFF, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0xFFFFF000);
if(map_base == (void *) -1){
printf ("gpio: Error mapping memory (mmap)\n");
close(fd);
exit(-1);
}
map_base_t = (char *)map_base + 0xF73;
readval = * ((unsigned short *) map_base_t);
printf("First reading value ncs3: %x, from addr: map_base_t = %x\n", readval,map_base_t);


* ((unsigned short *) (map_base_t-4)) |= 0xF3;
* ((unsigned short *) map_base_t) |= 0xF3;
* ((unsigned short *) (map_base_t+4)) |= 0xF3;

readval = * ((unsigned short *) map_base_t);
printf("Second reading value ncs3: %x, from addr: map_base_t = %x\n", readval,map_base_t);

/* Unmap previously mapped page */
if(munmap(map_base, 0xFFF) == -1){
printf("Error unmapping memory register_base\n");
close(fd);
exit(-1);
}


Where I'm not right?
Nurofen
Contact:
Posts: 3
Joined: Wed Oct 26, 2005 2:48 pm

Thu Oct 27, 2005 5:00 pm

Tnx to all.
I understand, how&where I'm not right :D
chuchiano
Contact:
Location: Spain
Posts: 4
Joined: Tue Apr 04, 2006 12:17 pm

Tue Apr 10, 2007 6:27 pm

Could you tell us where the problem is?
I am writing a driver for a Cimax chip, and I am using
mmap to map the device, but I am not able to
read the anything....
chuchiano
Contact:
Location: Spain
Posts: 4
Joined: Tue Apr 04, 2006 12:17 pm

Tue Apr 10, 2007 6:27 pm

Could you tell us where the problem is?
I am writing a driver for a Cimax chip, and I am using
mmap to map the device, but I am not able to
read the anything....

Return to “LINUX”

Who is online

Users browsing this forum: Majestic-12 [Bot] and 1 guest