Durango Driver for SC1200 Geode

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Hi

I am developing a simple driver for the Geode. i am at a loss of what
is going wrong when I insmod the following module.

Any idess would be appreciated.


#define __KERNEL__   /*  We're part of the kernel */
#define MODULE       /* Not a permanent part, though */
#define _LOOSE_KERNEL_NAMES


/* #include <linux/modversions.h> */
#include "linux/kernel.h"
#include "linux/module.h"

#include "fcntl.h"
#include "signal.h"
#include "stdio.h"
#include "string.h"
#include "sys/mman.h"
#include "sys/stat.h"
#include "sys/types.h"
#include "unistd.h"
#include "durango.c"

/* Following pointers are defined in durango.c */

extern unsigned char *gfx_virt_regptr;
extern unsigned char *gfx_virt_fbptr;
extern unsigned char *gfx_virt_vidptr;
extern unsigned char *gfx_virt_vipptr;
extern unsigned char *gfx_virt_spptr;
extern unsigned char *gfx_virt_gpptr;

char message[100];

/***********************************************************************
Structures
***********************************************************************/


/**********************************************************************
Prototypes
**********************************************************************/

void QueryCpu(void);
int Initialise(void);

int init_module(void)
{
int returnval;

/* Remap SC1200 registers into kernel memory*/
Initialise();

/* Identify CPU */
/* QueryCpu();  */

/* Set Display Mode */

/***************************************
* THE FOLLOWING LINE CAUSES THE SYSTEM TO LOCK UP */
returnval = gfx_set_display_mode(640,480,16,60);
gfx_pattern_fill(10,10,100,100);

sprintf(message,"gfx_set_display_mode returned: [%X] \n",returnval);
printk(message);
return 0;

}

void cleanup_module(void)
{
printk("Goodbye\n");
}

void QueryCpu(void)
{
char szCPU[][10] = ;

unsigned char major, minor, cpu;
unsigned long cpuid;

printk("Probing CPU :");
cpuid = gfx_detect_cpu();

cpu   = (unsigned char) cpuid & 0xFF;
major = (unsigned char) ((cpuid & 0xFF00L) >> 8);
minor = (unsigned char) ((cpuid & 0xFF0000L) >> 16);

sprintf(message,"Probing CPU returned : %s, Rev Maj: %d, Min:
%d\n",szCPU[cpu], major, minor);
printk(message);
}

int Initialise(void)
{
unsigned long *pStart;
unsigned long pAlloc;


int mem_fd;

// Physical Address of SC1200 base registers
pStart = (unsigned long *)0x40000000;

pAlloc = __ioremap(0x40000000,10000000);
gfx_virt_regptr = (char *)(__ioremap(0x40000000,0x10000)); //64K
gfx_virt_fbptr  = (char *)(__ioremap(0x40800000,0x400000)); //4M
gfx_virt_vidptr = (char *)(__ioremap(0x40010000,0x1000)); //4K
gfx_virt_vipptr = (char *)(__ioremap(0x40015000,0x10000)); //4K
gfx_virt_spptr = gfx_virt_regptr;
gfx_virt_gpptr = gfx_virt_regptr;

/*
gfx_virt_regptr = (char*)pAlloc;
gfx_virt_fbptr  = (char*)(pAlloc + 0x800000L);
gfx_virt_vidptr = (char*)(pAlloc + 0x10000L);
gfx_virt_vipptr = (char*)(pAlloc + 0x15000L);
gfx_virt_spptr  = (char*)pAlloc;
gfx_virt_gpptr  = (char*)pAlloc;
*/

sprintf(message,"gfx_virt_regptr :[%X]\n",gfx_virt_regptr);
printk(message);
sprintf(message,"gfx_virt_fbptr :[%X]\n",gfx_virt_fbptr);
printk(message);
sprintf(message,"gfx_virt_vidptr :[%X]\n",gfx_virt_vidptr);
printk(message);
sprintf(message,"gfx_virt_vipptr :[%X]\n",gfx_virt_vipptr);
printk(message);
sprintf(message,"gfx_virt_spptr :[%X]\n",gfx_virt_spptr);
printk(message);
sprintf(message,"gfx_virt_gpptr :[%X]\n",gfx_virt_gpptr);
printk(message);

  return 0;
}


Site Timeline