1 diff -urN linux-2.6.19.2.orig/drivers/fox-vhdl/foxbone/foxbone.c linux-2.6.19.2/drivers/fox-vhdl/foxbone/foxbone.c
2 --- linux-2.6.19.2.orig/drivers/fox-vhdl/foxbone/foxbone.c 1970-01-01 01:00:00.000000000 +0100
3 +++ linux-2.6.19.2/drivers/fox-vhdl/foxbone/foxbone.c 2007-06-17 02:46:15.000000000 +0200
7 + Linux Kernel Driver for FoxBone on FOX VHDL Board
8 + (based on FoxBone protocol interface specifications rel 0.7)
9 + For more info see: http://www.acmesystems.it/?id=120
10 + Author: John Crispin
11 + Copyright (C) 2006 Phrozen (http://www.phrozen.biz)
13 + This is free software; you can redistribute it and/or modify
14 + it under the terms of the GNU General Public License as published by
15 + the Free Software Foundation; either version 2 of the License, or
16 + (at your option) any later version.
18 + This example is distributed in the hope that it will be useful,
19 + but WITHOUT ANY WARRANTY; without even the implied warranty of
20 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 + GNU General Public License for more details.
23 + To have a copy of the GNU General Public License write to the Free Software
24 + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 +#include <linux/module.h>
28 +#include <linux/init.h>
29 +#include <linux/module.h>
30 +#include <linux/errno.h>
31 +#include <linux/ioport.h>
32 +#include <linux/version.h>
33 +#include <linux/init.h>
34 +#include <asm/uaccess.h>
36 +#include <linux/vmalloc.h>
37 +#include <linux/ioport.h>
38 +#include <linux/init.h>
39 +#include <linux/genhd.h>
40 +#include <linux/spinlock.h>
41 +#include <linux/autoconf.h>
42 +#include <linux/interrupt.h>
43 +#include <asm/etraxgpio.h>
44 +#include <asm/arch/svinto.h>
46 +#include <asm/system.h>
48 +#include <asm/arch/io_interface_mux.h>
52 +#include "foxbone_userspace.h"
55 +#define Fox_line_Read (1<<1)
56 +#define Fox_line_WriteData (1<<2)
57 +#define Fox_line_Reset (1<<3)
58 +#define Fox_line_WriteAddress (1<<4)
60 +#define FOX_CLEAR_LINES (~(0x00FFFF00 | Fox_line_Read | Fox_line_WriteAddress | Fox_line_WriteData))
62 +#define DEV_NAME "foxbone"
65 +spinlock_t foxbone_lock_var = SPIN_LOCK_UNLOCKED;
66 +unsigned long foxbone_irq_flags;
67 +// is the userspce device enables ?
68 +unsigned char foxbone_userspace_is_open = 0;
70 +// are we processing interrupts ? (during fpga_flash the ints are not allowed to be handles
71 +unsigned char foxbone_allow_int;
73 +// the shadow of which ints are enabled
74 +unsigned int foxbone_shadow_int_high = 0;
75 +unsigned int foxbone_shadow_int_low = 0;
77 +// the following four variables get filled when the foxbone driver is started
78 +// they hold the release and the the application words
79 +unsigned int FOXBONE_release = 0;
80 +unsigned int FOXBONE_application1 = 0;
81 +unsigned int FOXBONE_application2 = 0;
82 +unsigned int FOXBONE_application3 = 0;
86 +FOXINT_CALLBACK foxint_callbacks[32];
88 +unsigned int foxbone_read(unsigned int add);
89 +void foxbone_write(unsigned int add, unsigned int data);
91 +static irqreturn_t foxbone_pa_interrupt(int irq, void *dev_id, struct pt_regs *regs);
93 +unsigned int foxbone_interrupt_enabled = 0;
97 +void FOX_delay(unsigned int d){
100 + for(i = 0; i < 32000; i++){
108 +void foxbone_lock(void){
109 + spin_lock_irqsave(&foxbone_lock_var, foxbone_irq_flags);
113 +void foxbone_unlock(void){
114 + spin_unlock_irqrestore(&foxbone_lock_var, foxbone_irq_flags);
118 +int foxbone_register_interrupt(unsigned char irq, FOXINT_CALLBACK callback){
120 + printk("foxbone: trying to register invalid interrupt\n");
123 + if(!foxbone_interrupt_enabled){
124 + foxbone_interrupt_enabled = 1;
125 + printk("foxbone: starting interrupt system\n");
127 + if ((err = request_irq(PA_IRQ_NBR, foxbone_pa_interrupt, SA_INTERRUPT | SA_SHIRQ, "foxbone", 123))){
128 + printk("foxbone: request_irq failed: Error %d\n",err);
131 + printk("foxbone: request_irq success -> irq: %ld\n",PA_IRQ_NBR);
132 + *R_IRQ_MASK1_SET = IO_STATE(R_IRQ_MASK1_SET, pa0, set);
135 + printk("foxbone: new int %d registered\n", irq);
136 + foxint_callbacks[irq] = callback;
138 + foxbone_shadow_int_high |= (1<<irq);
139 + foxbone_write(0x08, foxbone_shadow_int_high);
141 + foxbone_shadow_int_high |= (1<<15);
142 + foxbone_write(0x08, foxbone_shadow_int_high);
143 + foxbone_shadow_int_low |= (1<<(irq-16));
144 + foxbone_write(0x09, foxbone_shadow_int_low);
150 +void foxbone_unregister_interrupt(unsigned char irq){
152 + printk("foxbone: trying to unregister invalid interrupt\n");
155 + printk("foxbone: interrupt %d unregistered\n", irq);
157 + foxbone_shadow_int_high &= ~(1<<irq);
158 + foxbone_write(0x08, foxbone_shadow_int_high);
160 + foxbone_shadow_int_low &= ~(1<<(irq-16));
161 + foxbone_write(0x09, foxbone_shadow_int_low);
163 + if(!foxbone_shadow_int_low){
164 + foxbone_shadow_int_high &= ~(1<<15);
165 + foxbone_write(0x08, foxbone_shadow_int_high);
171 +#define DBG_INT(x) x
176 +// this is the bottom half of our interrupt handler
177 +static void foxbone_handle_interrupt(void){
178 + if(foxbone_allow_int){
180 + unsigned int irq_high, irq_low, i;
181 + DBG_INT(printk("Int handler");)
182 + if(*R_PORT_PA_DATA & (1)){
183 + irq_high = foxbone_read(0x08);
184 + DBG_INT(printk("Got high_int %d\n", irq_high);)
185 + for(i = 0; i < 15; i++){
186 + if(irq_high & (1<<i)){
187 + DBG_INT(printk("Go high_int %d\n",i);)
188 + if(foxint_callbacks[i]){
189 + foxint_callbacks[i](i);
193 + if(irq_high & (0x8000)){
194 + irq_low = foxbone_read(0x09);
195 + DBG_INT(printk("Got low_int %d\n", irq_low);)
196 + for(i = 0; i < 16; i++){
197 + if(irq_low & (1<<i)){
198 + DBG_INT(printk("Go low_int %d\n", i);)
199 + if(foxint_callbacks[i+16]){
200 + foxint_callbacks[i+16](i+16);
211 +// this is the top half of our interrupt handler
212 +static void tasklet_foxbone_int(unsigned long data);
213 +DECLARE_TASKLET(tl_foxint_descr, tasklet_foxbone_int, 0L);
214 +static void tasklet_foxbone_int(unsigned long data){
216 + DBG_INT(printk("got an int\n");)
217 + foxbone_handle_interrupt();
223 +foxbone_pa_interrupt(int irq, void *dev_id, struct pt_regs *regs)
227 + /* Find what PA interrupts are active */
228 + tmp = (*R_IRQ_READ1);
229 +// printk("_____%ud",*R_IRQ_READ1);
230 + /* Find those that we have enabled */
231 +// tmp &= (1 << R_IRQ_MASK1_SET__pa0__BITNR);
234 + // *R_IRQ_MASK1_CLR = tmp;
235 + //(1 << R_IRQ_MASK1_SET__pa0__BITNR);
237 + tasklet_schedule(&tl_foxint_descr);
238 + // *R_IRQ_MASK1_SET = IO_STATE(R_IRQ_MASK1_SET, pa0, set);
240 + return IRQ_RETVAL(1);
244 +static void foxbone_bus_in(void){
245 + // turn all the iog8-15 pins into outputs
246 + genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG,g8_15dir);
247 + *R_GEN_CONFIG = genconfig_shadow;
249 + // turn all the iog16-23 pins into outputs
250 + genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG,g16_23dir);
251 + *R_GEN_CONFIG = genconfig_shadow;
254 +static void foxbone_bus_out(void){
255 + // turn all the iog8-15 pins into outputs
256 + genconfig_shadow |= IO_MASK(R_GEN_CONFIG,g8_15dir);
257 + *R_GEN_CONFIG = genconfig_shadow;
259 + // turn all the iog16-23 pins into outputs
260 + genconfig_shadow |= IO_MASK(R_GEN_CONFIG,g16_23dir);
261 + *R_GEN_CONFIG = genconfig_shadow;
264 +void foxbone_reset(unsigned char reset){
266 + *R_PORT_G_DATA = port_g_data_shadow |= Fox_line_Reset;
268 + *R_PORT_G_DATA = port_g_data_shadow &= ~Fox_line_Reset;
272 +static void foxbone_setadd(unsigned long address){
273 + *R_PORT_G_DATA = port_g_data_shadow &= FOX_CLEAR_LINES;
275 + *R_PORT_G_DATA = port_g_data_shadow |= (address << 8)| Fox_line_WriteAddress;
277 + *R_PORT_G_DATA = port_g_data_shadow &= ~Fox_line_WriteAddress;
281 +static unsigned int foxbone_read_data(unsigned char next){
283 + *R_PORT_G_DATA = port_g_data_shadow &= FOX_CLEAR_LINES;
287 + *R_PORT_G_DATA = port_g_data_shadow |= Fox_line_Read;
289 + // do the reading now
290 + data = *R_PORT_G_DATA;
291 + data = *R_PORT_G_DATA;
293 + // now return the Fox_line_ReadData to low state to idle the bus from the FPGA side
294 + *R_PORT_G_DATA = port_g_data_shadow &= ~Fox_line_Read;
296 + return ((unsigned int)((data&0x00FFFF00)>>8));
300 +static unsigned int foxbone_write_data(unsigned int data, unsigned char next) {
301 + // clear all address/data/control bits
302 + *R_PORT_G_DATA = port_g_data_shadow &= FOX_CLEAR_LINES;
304 + *R_PORT_G_DATA = port_g_data_shadow |= (data << 8)| Fox_line_WriteData;
305 + *R_PORT_G_DATA = port_g_data_shadow &= ~Fox_line_WriteData;
310 +void foxbone_write(unsigned int add, unsigned int data){
311 + foxbone_setadd(add);
312 + foxbone_write_data(data, 0);
315 +unsigned int foxbone_read(unsigned int add){
316 + foxbone_setadd(add);
317 + return foxbone_read_data(0);
320 +void foxbone_write_next(unsigned data){
321 + foxbone_write_data(data, 1);
324 +unsigned int foxbone_read_next(void){
325 + return foxbone_read_data(1);
328 +void foxbone_bulk_write(unsigned int *data, unsigned int length, unsigned int add){
330 + foxbone_write(add, *data);
331 + unsigned long def_val = (port_g_data_shadow & 0xff0000ff) | Fox_line_WriteData;
332 + for(i = 1; i < length; i++){
333 + *R_PORT_G_DATA = port_g_data_shadow = def_val | data[i]<<8;
334 + *R_PORT_G_DATA = port_g_data_shadow &= ~Fox_line_WriteData;
338 +void foxbone_bulk_read(unsigned int *data, unsigned int length, unsigned int add){
339 + //printk("Get data from %d %d\n", add, length);
341 + for(i = 0; i < length; i++){
343 + data[i] = foxbone_read(add);
345 + data[i] = foxbone_read_next();
351 +void foxbone_initialise_bus(void){
352 + memset(foxint_callbacks, 0, sizeof(FOXINT_CALLBACK)*32);
354 + // clear all address/data/control bits
355 + *R_PORT_G_DATA = port_g_data_shadow &= FOX_CLEAR_LINES;
358 + for(i = 0; i < 32000; i++){
366 + FOXBONE_release = foxbone_read(0x04);
367 + FOXBONE_application1 = foxbone_read(0x05);
368 + FOXBONE_application2 = foxbone_read(0x06);
369 + FOXBONE_application3 = foxbone_read(0x07);
370 + printk("foxbone : release = 0x%04x\n", FOXBONE_release);
371 + printk("foxbone : application word 1 = 0x%04x\n", FOXBONE_application1);
372 + printk("foxbone : application word 2 = 0x%04x\n", FOXBONE_application2);
373 + printk("foxbone : application word 3 = 0x%04x\n", FOXBONE_application3);
379 +static ssize_t foxbone_userspace_write(struct file * file, const char * buffer, size_t count, loff_t *offset){
380 + if(count > (64 * 1024)){
381 + printk("foxbone: trying to bulk write too much data\n");
384 + unsigned int *bulk_data = (unsigned int) kmalloc(count, GFP_KERNEL);
386 + copy_from_user((char*) bulk_data, buffer, count);
388 + foxbone_bulk_write(&bulk_data[2], bulk_data[1], bulk_data[0]);
395 +static ssize_t foxbone_userspace_read(struct file *file, char *buffer, size_t count, loff_t *offset){
396 + if(count > (64 * 1024)){
397 + printk("foxbone: trying to bulk read too much data\n");
401 + // find out which register we want to read
402 + unsigned int bulk_data_info[2];
403 + copy_from_user((char*) bulk_data_info, buffer, 8);
406 + unsigned int *bulk_data = (unsigned int)kmalloc(count, GFP_KERNEL);
408 + foxbone_bulk_read(&bulk_data[0], bulk_data_info[1], bulk_data_info[0]);
410 + copy_to_user((char*)buffer, (char*)bulk_data, count);
417 +// the app has send us some control data
418 +static int foxbone_userspace_ioctl(struct inode * inode, struct file * file, unsigned int cmd, unsigned long arg){
420 + FOXBONE_WRITE fb_write;
422 + case IOCTL_FOXBONE_INIT_BUS:
423 + foxbone_initialise_bus();
426 + case IOCTL_FOXBONE_WRITE_REG:
427 + copy_from_user((FOXBONE_WRITE*)&fb_write, (FOXBONE_WRITE*)arg, sizeof(fb_write));
428 + foxbone_write(fb_write.reg, fb_write.data);
431 + case IOCTL_FOXBONE_READ_REG:
432 + retval = foxbone_read(arg);
435 + case IOCTL_FOXBONE_WRITE_NEXT:
436 + copy_from_user((FOXBONE_WRITE*)&fb_write, (FOXBONE_WRITE*)arg, sizeof(fb_write));
437 + foxbone_write_next(fb_write.data);
440 + case IOCTL_FOXBONE_READ_NEXT:
441 + retval = foxbone_read_next();
444 + case IOCTL_FOXBONE_INTERRUPTS:
445 + foxbone_allow_int = arg;
449 + printk("foxbone_userspace : unknown ioctl\n");
457 +static int foxbone_userspace_open(struct inode *inode, struct file *file){
458 + // Which minor device is the user trying to access ?
459 + unsigned int dev_minor = MINOR(inode->i_rdev);
461 + // we only supprt minor 0 at the moment
462 + if(dev_minor != 0){
463 + printk("foxbone_userspace : trying to access unknown minor device -> %d\n", dev_minor);
467 + // check if another app is currently using the device
468 + if(foxbone_userspace_is_open) {
469 + printk("foxbone_userspace : Device with minor ID %d already in use\n", dev_minor);
477 +// gets called when an app closes the device
478 +static int foxbone_userspace_close(struct inode * inode, struct file * file){
480 + foxbone_userspace_is_open = 0;
485 +// so the kernel knows which functions to access for a given operation
486 +struct file_operations foxbone_userspace_fops = {
487 + ioctl: foxbone_userspace_ioctl,
488 + write: foxbone_userspace_write,
489 + read: foxbone_userspace_read,
490 + open: foxbone_userspace_open,
491 + release: foxbone_userspace_close
495 +// module gets loaded into kernel / char dev is registered
496 +static int foxbone_userspace_init(void){
497 + // flame the kprintk
498 + printk("foxbone_userspace : FOX-VHDL userspace access module\n");
500 + // register the character device
501 + if(register_chrdev(DEV_MAJOR, DEV_NAME, &foxbone_userspace_fops)) {
502 + printk( "fpga_mod.ko : Error whilst opening %s (%d)\n", DEV_NAME, DEV_MAJOR);
506 + foxbone_userspace_is_open = 0;
507 + printk("foxbone_userspace : Device %s registered for major ID %d\n", DEV_NAME, DEV_MAJOR);
512 +// we are done so shut everything down
513 +static void foxbone_userspace_exit(void){
514 + // tell the kernel that the device is not needed anymore
515 + unregister_chrdev(DEV_MAJOR, DEV_NAME);
520 +static int __init foxbone_init(void){
521 + printk("foxbone : FOX-VHDL FOXBONE access module started\n");
522 + foxbone_initialise_bus();
523 + foxbone_allow_int = 1;
524 + foxbone_userspace_init();
529 +static void __exit foxbone_exit(void){
530 + printk( "foxbone : Cleanup\n" );
531 + foxbone_userspace_exit();
534 +module_init (foxbone_init);
535 +module_exit (foxbone_exit);
538 diff -urN linux-2.6.19.2.orig/drivers/fox-vhdl/foxbone/foxbone.h linux-2.6.19.2/drivers/fox-vhdl/foxbone/foxbone.h
539 --- linux-2.6.19.2.orig/drivers/fox-vhdl/foxbone/foxbone.h 1970-01-01 01:00:00.000000000 +0100
540 +++ linux-2.6.19.2/drivers/fox-vhdl/foxbone/foxbone.h 2007-06-17 02:46:15.000000000 +0200
542 +// prototypes for foxbone compliant modules
544 +typedef void (*FOXINT_CALLBACK) (unsigned int);
546 +extern unsigned int FOXBONE_release;
547 +extern unsigned int FOXBONE_application1;
548 +extern unsigned int FOXBONE_application2;
549 +extern unsigned int FOXBONE_application3;
551 +void foxbone_write(unsigned int add, unsigned int data);
553 +unsigned int foxbone_read(unsigned int add);
555 +void foxbone_write_next(unsigned data);
557 +unsigned int foxbone_read_next(void);
559 +void foxbone_initialise_bus(void);
560 +void foxbone_unregister_interrupt(unsigned char irq);
561 +int foxbone_register_interrupt(unsigned char irq, FOXINT_CALLBACK callback);
562 +void foxbone_reset(unsigned char reset);
563 diff -urN linux-2.6.19.2.orig/drivers/fox-vhdl/foxbone/foxbone_syscalls.c linux-2.6.19.2/drivers/fox-vhdl/foxbone/foxbone_syscalls.c
564 --- linux-2.6.19.2.orig/drivers/fox-vhdl/foxbone/foxbone_syscalls.c 1970-01-01 01:00:00.000000000 +0100
565 +++ linux-2.6.19.2/drivers/fox-vhdl/foxbone/foxbone_syscalls.c 2007-06-17 02:46:15.000000000 +0200
569 + Linux Kernel syscalls for FoxBone on FOX VHDL Board
570 + (based on FoxBone protocol interface specifications rel 0.7)
571 + For more info see: http://www.acmesystems.it/?id=120
572 + Author: John Crispin
573 + Copyright (C) 2006 Phrozen (http://www.phrozen.biz)
575 + This is free software; you can redistribute it and/or modify
576 + it under the terms of the GNU General Public License as published by
577 + the Free Software Foundation; either version 2 of the License, or
578 + (at your option) any later version.
580 + This example is distributed in the hope that it will be useful,
581 + but WITHOUT ANY WARRANTY; without even the implied warranty of
582 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
583 + GNU General Public License for more details.
585 + To have a copy of the GNU General Public License write to the Free Software
586 + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
590 +#include <linux/kernel.h>
591 +#include <asm/uaccess.h>
592 +#include <linux/foxbone_syscalls.h>
593 +#include "foxbone.h"
595 +asmlinkage unsigned short int sys_foxboneread(unsigned short int reg){
596 + return foxbone_read(reg);
599 +asmlinkage void sys_foxbonewrite(unsigned short int reg, unsigned short int value){
600 + foxbone_write(reg, value);
603 +asmlinkage void sys_foxbonebulkread(unsigned short int reg, unsigned short int *value, unsigned int length){
605 + unsigned int *buffer = kmalloc(length * 2, GFP_KERNEL);
606 + *buffer = foxbone_read(reg);
607 + for(i = 1; i < length; i++){
608 + buffer[i] = foxbone_read_next();
610 + copy_to_user(value, buffer, length * 2);
615 +asmlinkage void sys_foxbonebulkwrite(unsigned short int reg, unsigned short int *value, unsigned int length){
617 + unsigned int *buffer = kmalloc(length * 2, GFP_KERNEL);
618 + copy_from_user(buffer, value, length * 2);
619 + foxbone_write(reg, *buffer);
620 + for(i = 1; i < length; i++){
621 + foxbone_write_next(buffer[i]);
628 + interrupt handling from userspace
631 +typedef struct _FOX_INT {
632 + unsigned char enabled;
633 + unsigned char count;
634 + unsigned char wakeup;
635 + wait_queue_head_t wait_queue;
639 +FOX_INT syscall_interrupts[32];
642 +void foxbone_interrupt_callback(unsigned int interrupt){
643 + //printk("GOT INT %d\n", irq_no);
644 + if(syscall_interrupts[interrupt].enabled){
645 + syscall_interrupts[interrupt].count ++;
646 + if(syscall_interrupts[interrupt].wakeup){
647 + wake_up_interruptible(&syscall_interrupts[interrupt].wait_queue);
653 +asmlinkage void sys_foxboneintreg(unsigned long int interrupt, unsigned char state){
654 + if(interrupt > 31){
658 + foxbone_register_interrupt(interrupt, foxbone_interrupt_callback);
659 + syscall_interrupts[interrupt].enabled = 1;
660 + syscall_interrupts[interrupt].count = 0;
661 + init_waitqueue_head(&syscall_interrupts[interrupt].wait_queue);
663 + foxbone_unregister_interrupt(interrupt);
664 + syscall_interrupts[interrupt].enabled = 0;
669 +asmlinkage unsigned int sys_foxboneintcheck( unsigned long int interrupt){
670 + unsigned int retval = 0xffff;
671 + if(interrupt > 31){
674 + if(syscall_interrupts[interrupt].enabled){
675 + retval = syscall_interrupts[interrupt].count;
676 + syscall_interrupts[interrupt].count = 0;
682 +asmlinkage unsigned int sys_foxboneintwait(unsigned long int interrupt, unsigned char timeout){
683 + unsigned int retval = 0xffff;
684 + if(interrupt > 31){
687 + if(syscall_interrupts[interrupt].enabled){
688 + syscall_interrupts[interrupt].wakeup = 1;
689 + syscall_interrupts[interrupt].count = 0;
690 + interruptible_sleep_on_timeout(&syscall_interrupts[interrupt].wait_queue, timeout*HZ);
691 + if(syscall_interrupts[interrupt].count != 0){
692 + retval = syscall_interrupts[interrupt].count;
694 + syscall_interrupts[interrupt].count = 0;
695 + syscall_interrupts[interrupt].wakeup = 0;
701 +asmlinkage void sys_foxbonereset(unsigned short int reg){
704 + for(i = 0; i < 32000; i++){
711 +static int __init foxbone_syscall_init(void){
712 + memset(syscall_interrupts, 0, sizeof(FOX_INT) * 32);
717 +static void __exit foxbone_syscall_exit(void){
720 +module_init (foxbone_syscall_init);
721 +module_exit (foxbone_syscall_exit);
722 diff -urN linux-2.6.19.2.orig/drivers/fox-vhdl/foxbone/foxbone_userspace.h linux-2.6.19.2/drivers/fox-vhdl/foxbone/foxbone_userspace.h
723 --- linux-2.6.19.2.orig/drivers/fox-vhdl/foxbone/foxbone_userspace.h 1970-01-01 01:00:00.000000000 +0100
724 +++ linux-2.6.19.2/drivers/fox-vhdl/foxbone/foxbone_userspace.h 2007-06-17 02:46:15.000000000 +0200
726 +// These are the ioctls for accessing /dev/foxbone
728 +#define IOCTL_FOXBONE_INIT_BUS 0x3341
729 +#define IOCTL_FOXBONE_WRITE_REG 0x3342
730 +#define IOCTL_FOXBONE_READ_REG 0x3343
731 +#define IOCTL_FOXBONE_WRITE_NEXT 0x3344
732 +#define IOCTL_FOXBONE_READ_NEXT 0x3345
733 +#define IOCTL_FOXBONE_INTERRUPTS 0x3346
735 +// the data structure used to write a register
736 +typedef struct _FOXBONE_WRITE {
743 diff -urN linux-2.6.19.2.orig/drivers/fox-vhdl/foxbone/Makefile linux-2.6.19.2/drivers/fox-vhdl/foxbone/Makefile
744 --- linux-2.6.19.2.orig/drivers/fox-vhdl/foxbone/Makefile 1970-01-01 01:00:00.000000000 +0100
745 +++ linux-2.6.19.2/drivers/fox-vhdl/foxbone/Makefile 2007-06-17 02:46:15.000000000 +0200
747 +obj-$(CONFIG_FOXBONE) += foxbone.o
748 +obj-$(CONFIG_FOXBONE) += foxbone_syscalls.o
749 diff -urN linux-2.6.19.2.orig/drivers/fox-vhdl/fox_event/foxbone.h linux-2.6.19.2/drivers/fox-vhdl/fox_event/foxbone.h
750 --- linux-2.6.19.2.orig/drivers/fox-vhdl/fox_event/foxbone.h 1970-01-01 01:00:00.000000000 +0100
751 +++ linux-2.6.19.2/drivers/fox-vhdl/fox_event/foxbone.h 2007-06-17 02:46:15.000000000 +0200
753 +// prototypes for foxbone compliant modules
755 +extern unsigned int FOXBONE_release;
756 +extern unsigned int FOXBONE_application1;
757 +extern unsigned int FOXBONE_application2;
758 +extern unsigned int FOXBONE_application3;
760 +void foxbone_write(unsigned int add, unsigned int data);
762 +unsigned int foxbone_read(unsigned int add);
764 +void foxbone_write_next(unsigned data);
766 +unsigned int foxbone_read_next(void);
768 +void foxbone_initialise_bus(void);
769 diff -urN linux-2.6.19.2.orig/drivers/fox-vhdl/fox_event/fox_event.c linux-2.6.19.2/drivers/fox-vhdl/fox_event/fox_event.c
770 --- linux-2.6.19.2.orig/drivers/fox-vhdl/fox_event/fox_event.c 1970-01-01 01:00:00.000000000 +0100
771 +++ linux-2.6.19.2/drivers/fox-vhdl/fox_event/fox_event.c 2007-06-17 02:46:15.000000000 +0200
775 + Linux Kernel Driver for FoxBone EventCounter on FOX VHDL Board
776 + (based on FoxBone protocol interface specifications rel 0.7)
777 + For more info see: http://www.acmesystems.it/?id=120
778 + Author: John Crispin
779 + Copyright (C) 2006 Phrozen (http://www.phrozen.biz)
781 + This is free software; you can redistribute it and/or modify
782 + it under the terms of the GNU General Public License as published by
783 + the Free Software Foundation; either version 2 of the License, or
784 + (at your option) any later version.
786 + This example is distributed in the hope that it will be useful,
787 + but WITHOUT ANY WARRANTY; without even the implied warranty of
788 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
789 + GNU General Public License for more details.
791 + To have a copy of the GNU General Public License write to the Free Software
792 + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
795 +#include <linux/module.h>
796 +#include <linux/init.h>
797 +#include <linux/module.h>
798 +#include <linux/errno.h>
799 +#include <linux/ioport.h>
800 +#include <linux/version.h>
801 +#include <linux/init.h>
802 +#include <asm/uaccess.h>
804 +#include <linux/vmalloc.h>
805 +#include <linux/ioport.h>
806 +#include <linux/init.h>
807 +#include <linux/genhd.h>
809 +#define DEV_NAME "event"
810 +#define DEV_MAJOR 193
812 +#include "foxbone.h"
814 +unsigned char foxevent_is_open = 0;
817 +#define IOCTL_FOXBONE_EVENT_SET_ALARM 0x4745
818 +#define IOCTL_FOXBONE_EVENT_GET_COUNT 0x4746
819 +#define IOCTL_FOXBONE_EVENT_GET_ALARM 0x4747
820 +#define IOCTL_FOXBONE_EVENT_RESET_ALARM 0x4748
822 +// the app has send us some control data
823 +static int module_ioctl(struct inode * inode, struct file * file, unsigned int cmd, unsigned long arg){
824 + //copy_to_user((char*)arg, (char*)&audio_data, sizeof(AUDIO_DATA));
825 + //copy_from_user((char*)&mp3_beep, (char*)arg, sizeof(MP3_BEEP));
827 + unsigned int current_io = 0;
829 + case IOCTL_FOXBONE_EVENT_SET_ALARM:
830 + foxbone_write(0x0040, 0);
831 + foxbone_write(0x0041, arg);
832 + foxbone_write(0x0040, 3);
835 + case IOCTL_FOXBONE_EVENT_GET_COUNT:
836 + retval = foxbone_read(0x0042);
839 + case IOCTL_FOXBONE_EVENT_GET_ALARM:
840 + retval = foxbone_read(0x0043);
843 + case IOCTL_FOXBONE_EVENT_RESET_ALARM:
844 + current_io = foxbone_read(0x0040);
845 + current_io &= ~(1<<1);
846 + foxbone_write(0x0040, 0);
847 + current_io |= (1<<1);
848 + foxbone_write(0x0040, 0);
852 + printk("fox_event: unknown ioctl\n");
861 +static int module_open(struct inode *inode, struct file *file){
862 + // Which minor device is the user trying to access ?
863 + unsigned int dev_minor = MINOR(inode->i_rdev);
865 + // we only supprt minor 0 at the moment
866 + if(dev_minor != 0){
867 + printk("fox_event: trying to access unknown minor device -> %d\n", dev_minor);
871 + // check if another app is currently using the device
872 + if(foxevent_is_open) {
873 + printk("fox_event: Device with minor ID %d already in use\n", dev_minor);
878 + printk("fox_event: Minor %d has been opened\n", dev_minor);
883 +// gets called when an app closes the device
884 +static int module_close(struct inode * inode, struct file * file){
885 + // Which minor device is the user trying to access ?
886 + unsigned int dev_minor = MINOR(inode->i_rdev);
888 + // remember that the device has been closed
889 + foxevent_is_open = 0;
893 + printk("fox_event: Minor %d has been closed\n", dev_minor);
898 +// so the kernel knows which functions to access for a given operation
899 +struct file_operations foxevent_module_fops = {
900 + ioctl: module_ioctl,
902 + release: module_close
906 +// module gets loaded into kernel / char dev is registered
907 +static int __init mod_init(void){
908 + // flame the kprintk
909 + printk("fox_event: FOX-VHDL FPGA io module\n");
910 + //printk("fox_event: Made by K. John '2B|!2B' Crispin (john@phrozen.org)\n");
911 + //printk("fox_event: Starting ...\n");
913 + // register the character device
914 + if(register_chrdev(DEV_MAJOR, DEV_NAME, &foxevent_module_fops)) {
915 + printk( "fox_event: Error whilst opening %s (%d)\n", DEV_NAME, DEV_MAJOR);
920 + // remember that the driver has been opened
921 + foxevent_is_open = 0;
922 + printk("fox_event: Device %s registered for major ID %d\n", DEV_NAME, DEV_MAJOR);
927 +// we are done so shut everything down
928 +static void __exit mod_exit(void){
929 + printk( "fox_event: Cleanup\n" );
930 + // tell the kernel that the device is not needed anymore
931 + unregister_chrdev(DEV_MAJOR, DEV_NAME);
935 +module_init (mod_init);
936 +module_exit (mod_exit);
943 diff -urN linux-2.6.19.2.orig/drivers/fox-vhdl/fox_event/Makefile linux-2.6.19.2/drivers/fox-vhdl/fox_event/Makefile
944 --- linux-2.6.19.2.orig/drivers/fox-vhdl/fox_event/Makefile 1970-01-01 01:00:00.000000000 +0100
945 +++ linux-2.6.19.2/drivers/fox-vhdl/fox_event/Makefile 2007-06-17 02:46:15.000000000 +0200
947 +obj-$(CONFIG_FOXBONE_EVENT) += fox_event.o
948 diff -urN linux-2.6.19.2.orig/drivers/fox-vhdl/fox_fpga_flash/Makefile linux-2.6.19.2/drivers/fox-vhdl/fox_fpga_flash/Makefile
949 --- linux-2.6.19.2.orig/drivers/fox-vhdl/fox_fpga_flash/Makefile 1970-01-01 01:00:00.000000000 +0100
950 +++ linux-2.6.19.2/drivers/fox-vhdl/fox_fpga_flash/Makefile 2007-06-17 02:46:15.000000000 +0200
952 +obj-$(CONFIG_FOX_FPGA) += dpa3palg.oo dpalg.oo dpjtag2.oo dpjtag.oo dpuncomp.oo dpuser.oo fpga_module.oo
954 diff -urN linux-2.6.19.2.orig/drivers/fox-vhdl/fox_fpga_flash/MakefileORI linux-2.6.19.2/drivers/fox-vhdl/fox_fpga_flash/MakefileORI
955 --- linux-2.6.19.2.orig/drivers/fox-vhdl/fox_fpga_flash/MakefileORI 1970-01-01 01:00:00.000000000 +0100
956 +++ linux-2.6.19.2/drivers/fox-vhdl/fox_fpga_flash/MakefileORI 2007-06-17 02:46:15.000000000 +0200
958 +obj-$(CONFIG_FOX_FPGA) += dpa3palg.o dpalg.o dpjtag2.o dpjtag.o dpuncomp.o dpuser.o fpga_module.o
959 diff -urN linux-2.6.19.2.orig/drivers/fox-vhdl/fox_io/foxbone.h linux-2.6.19.2/drivers/fox-vhdl/fox_io/foxbone.h
960 --- linux-2.6.19.2.orig/drivers/fox-vhdl/fox_io/foxbone.h 1970-01-01 01:00:00.000000000 +0100
961 +++ linux-2.6.19.2/drivers/fox-vhdl/fox_io/foxbone.h 2007-06-17 02:46:15.000000000 +0200
963 +// prototypes for foxbone compliant modules
965 +extern unsigned int FOXBONE_release;
966 +extern unsigned int FOXBONE_application1;
967 +extern unsigned int FOXBONE_application2;
968 +extern unsigned int FOXBONE_application3;
970 +void foxbone_write(unsigned int add, unsigned int data);
972 +unsigned int foxbone_read(unsigned int add);
974 +void foxbone_write_next(unsigned data);
976 +unsigned int foxbone_read_next(void);
978 +void foxbone_initialise_bus(void);
979 diff -urN linux-2.6.19.2.orig/drivers/fox-vhdl/fox_io/fox_io.c linux-2.6.19.2/drivers/fox-vhdl/fox_io/fox_io.c
980 --- linux-2.6.19.2.orig/drivers/fox-vhdl/fox_io/fox_io.c 1970-01-01 01:00:00.000000000 +0100
981 +++ linux-2.6.19.2/drivers/fox-vhdl/fox_io/fox_io.c 2007-06-17 02:46:15.000000000 +0200
985 + Linux Kernel Driver for FoxBone I/O on FOX VHDL Board
986 + (based on FoxBone protocol interface specifications rel 0.7)
987 + For more info see: http://www.acmesystems.it/?id=120
988 + Author: John Crispin
989 + Copyright (C) 2006 Phrozen (http://www.phrozen.biz)
991 + This is free software; you can redistribute it and/or modify
992 + it under the terms of the GNU General Public License as published by
993 + the Free Software Foundation; either version 2 of the License, or
994 + (at your option) any later version.
996 + This example is distributed in the hope that it will be useful,
997 + but WITHOUT ANY WARRANTY; without even the implied warranty of
998 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
999 + GNU General Public License for more details.
1001 + To have a copy of the GNU General Public License write to the Free Software
1002 + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1005 +#include <linux/module.h>
1006 +#include <linux/init.h>
1007 +#include <linux/module.h>
1008 +#include <linux/errno.h>
1009 +#include <linux/ioport.h>
1010 +#include <linux/version.h>
1011 +#include <linux/init.h>
1012 +#include <asm/uaccess.h>
1013 +#include <asm/io.h>
1014 +#include <linux/vmalloc.h>
1015 +#include <linux/ioport.h>
1016 +#include <linux/init.h>
1017 +#include <linux/genhd.h>
1019 +#define DEV_NAME "foxio"
1020 +#define DEV_MAJOR 190
1022 +#include "foxbone.h"
1024 +unsigned char foxio_is_open = 0;
1027 +#define IOCTL_FOXBONE_IO_SET 0x4545
1028 +#define IOCTL_FOXBONE_IO_CLR 0x4546
1029 +#define IOCTL_FOXBONE_IO_GET 0x4547
1031 +// the app has send us some control data
1032 +static int module_ioctl(struct inode * inode, struct file * file, unsigned int cmd, unsigned long arg){
1033 + //copy_to_user((char*)arg, (char*)&audio_data, sizeof(AUDIO_DATA));
1034 + //copy_from_user((char*)&mp3_beep, (char*)arg, sizeof(MP3_BEEP));
1036 + unsigned int current_io = 0;
1038 + case IOCTL_FOXBONE_IO_SET:
1039 + current_io = foxbone_read(0x0014);
1040 + current_io |= (1<<arg);
1041 + foxbone_write(0x0014, current_io);
1044 + case IOCTL_FOXBONE_IO_CLR:
1045 + current_io = foxbone_read(0x0014);
1046 + current_io &= ~(1<<arg);
1047 + foxbone_write(0x0014, current_io);
1050 + case IOCTL_FOXBONE_IO_GET:
1051 + retval = foxbone_read(0x0015);
1056 + printk("fox_io: unknown ioctl\n");
1065 +static int module_open(struct inode *inode, struct file *file){
1066 + // Which minor device is the user trying to access ?
1067 + unsigned int dev_minor = MINOR(inode->i_rdev);
1069 + // we only supprt minor 0 at the moment
1070 + if(dev_minor != 0){
1071 + printk("fox_io: trying to access unknown minor device -> %d\n", dev_minor);
1075 + // check if another app is currently using the device
1076 + if(foxio_is_open) {
1077 + printk("fox_io: Device with minor ID %d already in use\n", dev_minor);
1082 + printk("fox_io: Minor %d has been opened\n", dev_minor);
1087 +// gets called when an app closes the device
1088 +static int module_close(struct inode * inode, struct file * file){
1089 + // Which minor device is the user trying to access ?
1090 + unsigned int dev_minor = MINOR(inode->i_rdev);
1092 + // remember that the device has been closed
1093 + foxio_is_open = 0;
1097 + printk("fox_io: Minor %d has been closed\n", dev_minor);
1102 +// so the kernel knows which functions to access for a given operation
1103 +struct file_operations foxio_module_fops = {
1104 + ioctl: module_ioctl,
1105 + open: module_open,
1106 + release: module_close
1110 +// module gets loaded into kernel / char dev is registered
1111 +static int __init mod_init(void){
1112 + // flame the kprintk
1113 + printk("fox_io: FOX-VHDL FPGA io module\n");
1114 + //printk("fox_io: Made by K. John '2B|!2B' Crispin (john@phrozen.org)\n");
1115 + //printk("fox_io: Starting ...\n");
1117 + // register the character device
1118 + if(register_chrdev(DEV_MAJOR, DEV_NAME, &foxio_module_fops)) {
1119 + printk( "fox_io: Error whilst opening %s (%d)\n", DEV_NAME, DEV_MAJOR);
1120 + return( -ENODEV );
1124 + // remember that the driver has been opened
1125 + foxio_is_open = 0;
1126 + printk("fox_io: Device %s registered for major ID %d\n", DEV_NAME, DEV_MAJOR);
1131 +// we are done so shut everything down
1132 +static void __exit mod_exit(void){
1133 + printk( "fox_io: Cleanup\n" );
1134 + // tell the kernel that the device is not needed anymore
1135 + unregister_chrdev(DEV_MAJOR, DEV_NAME);
1139 +module_init (mod_init);
1140 +module_exit (mod_exit);
1147 diff -urN linux-2.6.19.2.orig/drivers/fox-vhdl/fox_io/Makefile linux-2.6.19.2/drivers/fox-vhdl/fox_io/Makefile
1148 --- linux-2.6.19.2.orig/drivers/fox-vhdl/fox_io/Makefile 1970-01-01 01:00:00.000000000 +0100
1149 +++ linux-2.6.19.2/drivers/fox-vhdl/fox_io/Makefile 2007-06-17 02:46:15.000000000 +0200
1151 +obj-$(CONFIG_FOXBONE_IO) += fox_io.o
1152 diff -urN linux-2.6.19.2.orig/drivers/fox-vhdl/fox_loopback/foxbone.h linux-2.6.19.2/drivers/fox-vhdl/fox_loopback/foxbone.h
1153 --- linux-2.6.19.2.orig/drivers/fox-vhdl/fox_loopback/foxbone.h 1970-01-01 01:00:00.000000000 +0100
1154 +++ linux-2.6.19.2/drivers/fox-vhdl/fox_loopback/foxbone.h 2007-06-17 02:46:15.000000000 +0200
1156 +// prototypes for foxbone compliant modules
1158 +extern unsigned int FOXBONE_release;
1159 +extern unsigned int FOXBONE_application1;
1160 +extern unsigned int FOXBONE_application2;
1161 +extern unsigned int FOXBONE_application3;
1163 +void foxbone_write(unsigned int add, unsigned int data);
1165 +unsigned int foxbone_read(unsigned int add);
1167 +void foxbone_write_next(unsigned data);
1169 +unsigned int foxbone_read_next(void);
1171 +void foxbone_initialise_bus(void);
1172 diff -urN linux-2.6.19.2.orig/drivers/fox-vhdl/fox_loopback/fox_loopback.c linux-2.6.19.2/drivers/fox-vhdl/fox_loopback/fox_loopback.c
1173 --- linux-2.6.19.2.orig/drivers/fox-vhdl/fox_loopback/fox_loopback.c 1970-01-01 01:00:00.000000000 +0100
1174 +++ linux-2.6.19.2/drivers/fox-vhdl/fox_loopback/fox_loopback.c 2007-06-17 02:46:15.000000000 +0200
1178 + Linux Kernel Driver for FoxBone Loopback Register on FOX VHDL Board
1179 + (based on FoxBone protocol interface specifications rel 0.7)
1180 + For more info see: http://www.acmesystems.it/?id=120
1181 + Author: John Crispin
1182 + Copyright (C) 2006 Phrozen (http://www.phrozen.biz)
1184 + This is free software; you can redistribute it and/or modify
1185 + it under the terms of the GNU General Public License as published by
1186 + the Free Software Foundation; either version 2 of the License, or
1187 + (at your option) any later version.
1189 + This example is distributed in the hope that it will be useful,
1190 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1191 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1192 + GNU General Public License for more details.
1194 + To have a copy of the GNU General Public License write to the Free Software
1195 + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1198 +#include <linux/module.h>
1199 +#include <linux/init.h>
1200 +#include <linux/module.h>
1201 +#include <linux/errno.h>
1202 +#include <linux/ioport.h>
1203 +#include <linux/version.h>
1204 +#include <linux/init.h>
1205 +#include <asm/uaccess.h>
1206 +#include <asm/io.h>
1207 +#include <linux/vmalloc.h>
1208 +#include <linux/ioport.h>
1209 +#include <linux/init.h>
1210 +#include <linux/genhd.h>
1212 +#define DEV_NAME "loopback"
1213 +#define DEV_MAJOR 192
1215 +#include "foxbone.h"
1217 +unsigned char foxloopback_is_open = 0;
1220 +#define IOCTL_FOXBONE_LOOPBACK_SET 0x4045
1221 +#define IOCTL_FOXBONE_LOOPBACK_GET 0x4046
1223 +// the app has send us some control data
1224 +static int module_ioctl(struct inode * inode, struct file * file, unsigned int cmd, unsigned long arg){
1225 + //copy_to_user((char*)arg, (char*)&audio_data, sizeof(AUDIO_DATA));
1226 + //copy_from_user((char*)&mp3_beep, (char*)arg, sizeof(MP3_BEEP));
1228 + unsigned int current_io = 0;
1230 + case IOCTL_FOXBONE_LOOPBACK_SET:
1231 + foxbone_write(0x0013, arg);
1234 + case IOCTL_FOXBONE_LOOPBACK_GET:
1235 + retval = foxbone_read(0x0013);
1239 + printk("fox_loopback: unknown ioctl\n");
1248 +static int module_open(struct inode *inode, struct file *file){
1249 + // Which minor device is the user trying to access ?
1250 + unsigned int dev_minor = MINOR(inode->i_rdev);
1252 + // we only supprt minor 0 at the moment
1253 + if(dev_minor != 0){
1254 + printk("fox_loopback: trying to access unknown minor device -> %d\n", dev_minor);
1258 + // check if another app is currently using the device
1259 + if(foxloopback_is_open) {
1260 + printk("fox_loopback: Device with minor ID %d already in use\n", dev_minor);
1265 + printk("fox_loopback: Minor %d has been opened\n", dev_minor);
1270 +// gets called when an app closes the device
1271 +static int module_close(struct inode * inode, struct file * file){
1272 + // Which minor device is the user trying to access ?
1273 + unsigned int dev_minor = MINOR(inode->i_rdev);
1275 + // remember that the device has been closed
1276 + foxloopback_is_open = 0;
1280 + printk("fox_loopback: Minor %d has been closed\n", dev_minor);
1285 +// so the kernel knows which functions to access for a given operation
1286 +struct file_operations foxloopback_module_fops = {
1287 + ioctl: module_ioctl,
1288 + open: module_open,
1289 + release: module_close
1293 +// module gets loaded into kernel / char dev is registered
1294 +static int __init mod_init(void){
1295 + // flame the kprintk
1296 + printk("fox_loopback: FOX-VHDL FPGA io module\n");
1297 + //printk("fox_loopback: Made by K. John '2B|!2B' Crispin (john@phrozen.org)\n");
1298 + //printk("fox_loopback: Starting ...\n");
1300 + // register the character device
1301 + if(register_chrdev(DEV_MAJOR, DEV_NAME, &foxloopback_module_fops)) {
1302 + printk( "fox_loopback: Error whilst opening %s (%d)\n", DEV_NAME, DEV_MAJOR);
1303 + return( -ENODEV );
1307 + // remember that the driver has been opened
1308 + foxloopback_is_open = 0;
1309 + printk("fox_loopback: Device %s registered for major ID %d\n", DEV_NAME, DEV_MAJOR);
1314 +// we are done so shut everything down
1315 +static void __exit mod_exit(void){
1316 + printk( "fox_loopback: Cleanup\n" );
1317 + // tell the kernel that the device is not needed anymore
1318 + unregister_chrdev(DEV_MAJOR, DEV_NAME);
1322 +module_init (mod_init);
1323 +module_exit (mod_exit);
1330 diff -urN linux-2.6.19.2.orig/drivers/fox-vhdl/fox_loopback/Makefile linux-2.6.19.2/drivers/fox-vhdl/fox_loopback/Makefile
1331 --- linux-2.6.19.2.orig/drivers/fox-vhdl/fox_loopback/Makefile 1970-01-01 01:00:00.000000000 +0100
1332 +++ linux-2.6.19.2/drivers/fox-vhdl/fox_loopback/Makefile 2007-06-17 02:46:15.000000000 +0200
1334 +obj-$(CONFIG_FOXBONE_LOOPBACK) += fox_loopback.o
1335 diff -urN linux-2.6.19.2.orig/drivers/fox-vhdl/fox_multiply/foxbone.h linux-2.6.19.2/drivers/fox-vhdl/fox_multiply/foxbone.h
1336 --- linux-2.6.19.2.orig/drivers/fox-vhdl/fox_multiply/foxbone.h 1970-01-01 01:00:00.000000000 +0100
1337 +++ linux-2.6.19.2/drivers/fox-vhdl/fox_multiply/foxbone.h 2007-06-17 02:46:15.000000000 +0200
1339 +// prototypes for foxbone compliant modules
1341 +extern unsigned int FOXBONE_release;
1342 +extern unsigned int FOXBONE_application1;
1343 +extern unsigned int FOXBONE_application2;
1344 +extern unsigned int FOXBONE_application3;
1346 +void foxbone_write(unsigned int add, unsigned int data);
1348 +unsigned int foxbone_read(unsigned int add);
1350 +void foxbone_write_next(unsigned data);
1352 +unsigned int foxbone_read_next(void);
1354 +void foxbone_initialise_bus(void);
1355 diff -urN linux-2.6.19.2.orig/drivers/fox-vhdl/fox_multiply/fox_multiply.c linux-2.6.19.2/drivers/fox-vhdl/fox_multiply/fox_multiply.c
1356 --- linux-2.6.19.2.orig/drivers/fox-vhdl/fox_multiply/fox_multiply.c 1970-01-01 01:00:00.000000000 +0100
1357 +++ linux-2.6.19.2/drivers/fox-vhdl/fox_multiply/fox_multiply.c 2007-06-17 02:46:15.000000000 +0200
1361 + Linux Kernel Driver for FoxBone 32x32 fast multiplier on FOX VHDL Board
1362 + (based on FoxBone protocol interface specifications rel 0.7)
1363 + For more info see: http://www.acmesystems.it/?id=120
1364 + Author: John Crispin
1365 + Copyright (C) 2006 Phrozen (http://www.phrozen.biz)
1367 + This is free software; you can redistribute it and/or modify
1368 + it under the terms of the GNU General Public License as published by
1369 + the Free Software Foundation; either version 2 of the License, or
1370 + (at your option) any later version.
1372 + This example is distributed in the hope that it will be useful,
1373 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1374 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1375 + GNU General Public License for more details.
1377 + To have a copy of the GNU General Public License write to the Free Software
1378 + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1382 +#include <linux/module.h>
1383 +#include <linux/init.h>
1384 +#include <linux/module.h>
1385 +#include <linux/errno.h>
1386 +#include <linux/ioport.h>
1387 +#include <linux/version.h>
1388 +#include <linux/init.h>
1389 +#include <asm/uaccess.h>
1390 +#include <asm/io.h>
1391 +#include <linux/vmalloc.h>
1392 +#include <linux/ioport.h>
1393 +#include <linux/init.h>
1394 +#include <linux/genhd.h>
1396 +#define DEV_NAME "multiply"
1397 +#define DEV_MAJOR 194
1399 +#include "foxbone.h"
1401 +unsigned char foxmultiply_is_open = 0;
1404 +#define IOCTL_FOXBONE_MUTIPLY 0x4945
1406 +// the app has send us some control data
1407 +static int module_ioctl(struct inode * inode, struct file * file, unsigned int cmd, unsigned long arg){
1411 + case IOCTL_FOXBONE_MUTIPLY:
1412 + copy_from_user((char*)&data[0], (char*)arg, sizeof(long) * 3);
1413 + data[2] = jiffies;
1414 + printk("%ld, %ld\n", data[0], data[1]);
1415 + //for(i = 0; i < 1024*1024; i++){
1416 + foxbone_write(0x0021, (data[0]>>16)&0xffff);
1417 + foxbone_write(0x0020, data[0]&0xffff);
1418 + foxbone_write(0x0023, (data[1]>>16)&0xffff);
1419 + foxbone_write(0x0022, data[1]&0xffff);
1420 + data[0] = foxbone_read(0x0025);
1421 + data[0] = (data[0] << 16) + foxbone_read(0x0024);
1422 + data[1] = foxbone_read(0x0027);
1423 + data[1] = (data[1] << 16) + foxbone_read(0x0026);
1424 + /*printk("%4x\n", foxbone_read(0x0020));
1425 + printk("%4x\n", foxbone_read(0x0021));
1426 + printk("%4x\n", foxbone_read(0x0022));
1427 + printk("%4x\n", foxbone_read(0x0023));
1429 + printk("%4x\n", foxbone_read(0x0024));
1430 + printk("%4x\n", foxbone_read(0x0025));
1431 + printk("%4x\n", foxbone_read(0x0026));
1432 + printk("%4x\n", foxbone_read(0x0027));
1435 + data[2] = jiffies - data[2];
1436 + copy_to_user((char*)arg, (char*)&data[0], sizeof(unsigned long) * 3);
1440 + printk("fox_multiply: unknown ioctl\n");
1449 +static int module_open(struct inode *inode, struct file *file){
1450 + // Which minor device is the user trying to access ?
1451 + unsigned int dev_minor = MINOR(inode->i_rdev);
1453 + // we only supprt minor 0 at the moment
1454 + if(dev_minor != 0){
1455 + printk("fox_multiply: trying to access unknown minor device -> %d\n", dev_minor);
1459 + // check if another app is currently using the device
1460 + if(foxmultiply_is_open) {
1461 + printk("fox_multiply: Device with minor ID %d already in use\n", dev_minor);
1466 + //printk("fox_multiply: Minor %d has been opened\n", dev_minor);
1471 +// gets called when an app closes the device
1472 +static int module_close(struct inode * inode, struct file * file){
1473 + // Which minor device is the user trying to access ?
1474 + // unsigned int dev_minor = MINOR(inode->i_rdev);
1476 + // remember that the device has been closed
1477 + foxmultiply_is_open = 0;
1481 + //printk("fox_multiply: Minor %d has been closed\n", dev_minor);
1486 +// so the kernel knows which functions to access for a given operation
1487 +struct file_operations foxmultiply_module_fops = {
1488 + ioctl: module_ioctl,
1489 + open: module_open,
1490 + release: module_close
1494 +// module gets loaded into kernel / char dev is registered
1495 +static int __init mod_init(void){
1496 + // flame the kprintk
1497 + printk("fox_multiply: FOX-VHDL FPGA multiplier module\n");
1498 + //printk("fox_multiply: Made by K. John '2B|!2B' Crispin (john@phrozen.org)\n");
1499 + //printk("fox_multiply: Starting ...\n");
1501 + // register the character device
1502 + if(register_chrdev(DEV_MAJOR, DEV_NAME, &foxmultiply_module_fops)) {
1503 + printk( "fox_multiply: Error whilst opening %s (%d)\n", DEV_NAME, DEV_MAJOR);
1504 + return( -ENODEV );
1508 + // remember that the driver has been opened
1509 + foxmultiply_is_open = 0;
1510 + printk("fox_multiply: Device %s registered for major ID %d\n", DEV_NAME, DEV_MAJOR);
1515 +// we are done so shut everything down
1516 +static void __exit mod_exit(void){
1517 + printk( "fox_multiply: Cleanup\n" );
1518 + // tell the kernel that the device is not needed anymore
1519 + unregister_chrdev(DEV_MAJOR, DEV_NAME);
1523 +module_init (mod_init);
1524 +module_exit (mod_exit);
1531 diff -urN linux-2.6.19.2.orig/drivers/fox-vhdl/fox_multiply/Makefile linux-2.6.19.2/drivers/fox-vhdl/fox_multiply/Makefile
1532 --- linux-2.6.19.2.orig/drivers/fox-vhdl/fox_multiply/Makefile 1970-01-01 01:00:00.000000000 +0100
1533 +++ linux-2.6.19.2/drivers/fox-vhdl/fox_multiply/Makefile 2007-06-17 02:46:15.000000000 +0200
1535 +obj-$(CONFIG_FOXBONE_MULTIPLY) += fox_multiply.o
1536 diff -urN linux-2.6.19.2.orig/drivers/fox-vhdl/fox_pwm/foxbone.h linux-2.6.19.2/drivers/fox-vhdl/fox_pwm/foxbone.h
1537 --- linux-2.6.19.2.orig/drivers/fox-vhdl/fox_pwm/foxbone.h 1970-01-01 01:00:00.000000000 +0100
1538 +++ linux-2.6.19.2/drivers/fox-vhdl/fox_pwm/foxbone.h 2007-06-17 02:46:15.000000000 +0200
1540 +// prototypes for foxbone compliant modules
1542 +extern unsigned int FOXBONE_release;
1543 +extern unsigned int FOXBONE_application1;
1544 +extern unsigned int FOXBONE_application2;
1545 +extern unsigned int FOXBONE_application3;
1547 +void foxbone_write(unsigned int add, unsigned int data);
1549 +unsigned int foxbone_read(unsigned int add);
1551 +void foxbone_write_next(unsigned data);
1553 +unsigned int foxbone_read_next(void);
1555 +void foxbone_initialise_bus(void);
1556 diff -urN linux-2.6.19.2.orig/drivers/fox-vhdl/fox_pwm/fox_pwm.c linux-2.6.19.2/drivers/fox-vhdl/fox_pwm/fox_pwm.c
1557 --- linux-2.6.19.2.orig/drivers/fox-vhdl/fox_pwm/fox_pwm.c 1970-01-01 01:00:00.000000000 +0100
1558 +++ linux-2.6.19.2/drivers/fox-vhdl/fox_pwm/fox_pwm.c 2007-06-17 02:46:15.000000000 +0200
1562 + Linux Kernel Driver for FoxBone 16 channel PWM generator on FOX VHDL Board
1563 + (based on FoxBone protocol interface specifications rel 0.7)
1564 + For more info see: http://www.acmesystems.it/?id=120
1565 + Author: John Crispin
1566 + Copyright (C) 2006 Phrozen (http://www.phrozen.biz)
1568 + This is free software; you can redistribute it and/or modify
1569 + it under the terms of the GNU General Public License as published by
1570 + the Free Software Foundation; either version 2 of the License, or
1571 + (at your option) any later version.
1573 + This example is distributed in the hope that it will be useful,
1574 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1575 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1576 + GNU General Public License for more details.
1578 + To have a copy of the GNU General Public License write to the Free Software
1579 + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1583 +#include <linux/module.h>
1584 +#include <linux/init.h>
1585 +#include <linux/module.h>
1586 +#include <linux/errno.h>
1587 +#include <linux/ioport.h>
1588 +#include <linux/version.h>
1589 +#include <linux/init.h>
1590 +#include <asm/uaccess.h>
1591 +#include <asm/io.h>
1592 +#include <linux/vmalloc.h>
1593 +#include <linux/ioport.h>
1594 +#include <linux/init.h>
1595 +#include <linux/genhd.h>
1597 +#define DEV_NAME "pwm"
1598 +#define DEV_MAJOR 15
1600 +#include "foxbone.h"
1602 +unsigned char foxpwm_is_open = 0;
1605 +#define IOCTL_PWM_ENABLE 0x2310
1606 +#define IOCTL_PWM_DISABLE 0x2311
1607 +#define IOCTL_PWM_CHANNEL_BASE 0x2320
1608 +#define IOCTL_PWM_CHANNEL0 0x2320
1609 +#define IOCTL_PWM_CHANNEL1 0x2321
1610 +#define IOCTL_PWM_CHANNEL2 0x2322
1611 +#define IOCTL_PWM_CHANNEL3 0x2323
1612 +#define IOCTL_PWM_CHANNEL4 0x2324
1613 +#define IOCTL_PWM_CHANNEL5 0x2325
1614 +#define IOCTL_PWM_CHANNEL6 0x2326
1615 +#define IOCTL_PWM_CHANNEL7 0x2327
1616 +#define IOCTL_PWM_CHANNEL8 0x2328
1617 +#define IOCTL_PWM_CHANNEL9 0x2329
1618 +#define IOCTL_PWM_CHANNELA 0x232a
1619 +#define IOCTL_PWM_CHANNELB 0x232b
1620 +#define IOCTL_PWM_CHANNELC 0x232c
1621 +#define IOCTL_PWM_CHANNELD 0x232d
1622 +#define IOCTL_PWM_CHANNELE 0x232e
1623 +#define IOCTL_PWM_CHANNELF 0x232f
1626 +// the app has send us some control data
1627 +static int module_ioctl(struct inode * inode, struct file * file, unsigned int cmd, unsigned long arg){
1628 + //copy_to_user((char*)arg, (char*)&audio_data, sizeof(AUDIO_DATA));
1629 + //copy_from_user((char*)&mp3_beep, (char*)arg, sizeof(MP3_BEEP));
1631 + unsigned int current_pwm;
1632 + if((cmd >= IOCTL_PWM_CHANNEL0) && (cmd <= IOCTL_PWM_CHANNELF)){
1633 + foxbone_write(0x0050 + (cmd - IOCTL_PWM_CHANNEL_BASE), arg);
1636 + case IOCTL_PWM_ENABLE:
1637 + current_pwm = foxbone_read(0x0060);
1638 + current_pwm |= (1<<arg);
1639 + foxbone_write(0x0060, current_pwm);
1642 + case IOCTL_PWM_DISABLE:
1643 + current_pwm = foxbone_read(0x0060);
1644 + current_pwm &= ~(1<<arg);
1645 + foxbone_write(0x0060, current_pwm);
1649 + printk("fox_pwm: unknown ioctl\n");
1658 +static int module_open(struct inode *inode, struct file *file){
1659 + // Which minor device is the user trying to access ?
1660 + unsigned int dev_minor = MINOR(inode->i_rdev);
1662 + // we only supprt minor 0 at the moment
1663 + if(dev_minor != 0){
1664 + printk("fox_pwm: trying to access unknown minor device -> %d\n", dev_minor);
1668 + // check if another app is currently using the device
1669 + if(foxpwm_is_open) {
1670 + printk("fox_pwm: Device with minor ID %d already in use\n", dev_minor);
1675 + printk("fox_pwm: Minor %d has been opened\n", dev_minor);
1680 +// gets called when an app closes the device
1681 +static int module_close(struct inode * inode, struct file * file){
1682 + // Which minor device is the user trying to access ?
1683 + unsigned int dev_minor = MINOR(inode->i_rdev);
1685 + // remember that the device has been closed
1686 + foxpwm_is_open = 0;
1690 + printk("fox_pwm: Minor %d has been closed\n", dev_minor);
1695 +// so the kernel knows which functions to access for a given operation
1696 +struct file_operations foxpwm_module_fops = {
1697 + ioctl: module_ioctl,
1698 + open: module_open,
1699 + release: module_close
1703 +// module gets loaded into kernel / char dev is registered
1704 +static int __init mod_init(void){
1705 + // flame the kprintk
1706 + printk("fox_pwm: FOX-VHDL FPGA PWM module\n");
1707 + //printk("fox_pwm: Made by K. John '2B|!2B' Crispin (john@phrozen.org)\n");
1708 + //printk("fox_pwm: Starting ...\n");
1710 + // register the character device
1711 + if(register_chrdev(DEV_MAJOR, DEV_NAME, &foxpwm_module_fops)) {
1712 + printk( "fox_pwm: Error whilst opening %s (%d)\n", DEV_NAME, DEV_MAJOR);
1713 + return( -ENODEV );
1717 + // remember that the driver has been opened
1718 + foxpwm_is_open = 0;
1719 + printk("fox_pwm: Device %s registered for major ID %d\n", DEV_NAME, DEV_MAJOR);
1724 +// we are done so shut everything down
1725 +static void __exit mod_exit(void){
1726 + printk( "fox_pwm: Cleanup\n" );
1727 + // tell the kernel that the device is not needed anymore
1728 + unregister_chrdev(DEV_MAJOR, DEV_NAME);
1732 +module_init (mod_init);
1733 +module_exit (mod_exit);
1740 diff -urN linux-2.6.19.2.orig/drivers/fox-vhdl/fox_pwm/Makefile linux-2.6.19.2/drivers/fox-vhdl/fox_pwm/Makefile
1741 --- linux-2.6.19.2.orig/drivers/fox-vhdl/fox_pwm/Makefile 1970-01-01 01:00:00.000000000 +0100
1742 +++ linux-2.6.19.2/drivers/fox-vhdl/fox_pwm/Makefile 2007-06-17 02:46:15.000000000 +0200
1744 +obj-$(CONFIG_FOXBONE_PWM) += fox_pwm.o
1745 diff -urN linux-2.6.19.2.orig/drivers/fox-vhdl/fox_timebase/foxbone.h linux-2.6.19.2/drivers/fox-vhdl/fox_timebase/foxbone.h
1746 --- linux-2.6.19.2.orig/drivers/fox-vhdl/fox_timebase/foxbone.h 1970-01-01 01:00:00.000000000 +0100
1747 +++ linux-2.6.19.2/drivers/fox-vhdl/fox_timebase/foxbone.h 2007-06-17 02:46:15.000000000 +0200
1749 +// prototypes for foxbone compliant modules
1751 +extern unsigned int FOXBONE_release;
1752 +extern unsigned int FOXBONE_application1;
1753 +extern unsigned int FOXBONE_application2;
1754 +extern unsigned int FOXBONE_application3;
1756 +void foxbone_write(unsigned int add, unsigned int data);
1758 +unsigned int foxbone_read(unsigned int add);
1760 +void foxbone_write_next(unsigned data);
1762 +unsigned int foxbone_read_next(void);
1764 +void foxbone_initialise_bus(void);
1765 diff -urN linux-2.6.19.2.orig/drivers/fox-vhdl/fox_timebase/fox_timebase.c linux-2.6.19.2/drivers/fox-vhdl/fox_timebase/fox_timebase.c
1766 --- linux-2.6.19.2.orig/drivers/fox-vhdl/fox_timebase/fox_timebase.c 1970-01-01 01:00:00.000000000 +0100
1767 +++ linux-2.6.19.2/drivers/fox-vhdl/fox_timebase/fox_timebase.c 2007-06-17 02:46:15.000000000 +0200
1771 + Linux Kernel Driver for FoxBone TimeBase on FOX VHDL Board
1772 + (based on FoxBone protocol interface specifications rel 0.7)
1773 + For more info see: http://www.acmesystems.it/?id=120
1774 + Author: John Crispin
1775 + Copyright (C) 2006 Phrozen (http://www.phrozen.biz)
1777 + This is free software; you can redistribute it and/or modify
1778 + it under the terms of the GNU General Public License as published by
1779 + the Free Software Foundation; either version 2 of the License, or
1780 + (at your option) any later version.
1782 + This example is distributed in the hope that it will be useful,
1783 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1784 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1785 + GNU General Public License for more details.
1787 + To have a copy of the GNU General Public License write to the Free Software
1788 + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1792 +#include <linux/module.h>
1793 +#include <linux/init.h>
1794 +#include <linux/module.h>
1795 +#include <linux/errno.h>
1796 +#include <linux/ioport.h>
1797 +#include <linux/version.h>
1798 +#include <linux/init.h>
1799 +#include <asm/uaccess.h>
1800 +#include <asm/io.h>
1801 +#include <linux/vmalloc.h>
1802 +#include <linux/ioport.h>
1803 +#include <linux/init.h>
1804 +#include <linux/genhd.h>
1806 +#define DEV_NAME "timebase"
1807 +#define DEV_MAJOR 191
1809 +#include "foxbone.h"
1811 +unsigned char foxtimebase_is_open = 0;
1814 +#define IOCTL_FOXBONE_TIMEBASE_ENABLE 0x4645
1815 +#define IOCTL_FOXBONE_TIMEBASE_DISABLE 0x4646
1816 +#define IOCTL_FOXBONE_TIMEBASE_SETLO 0x4647
1817 +#define IOCTL_FOXBONE_TIMEBASE_SETHI 0x4648
1819 +// the app has send us some control data
1820 +static int module_ioctl(struct inode * inode, struct file * file, unsigned int cmd, unsigned long arg){
1821 + //copy_to_user((char*)arg, (char*)&audio_data, sizeof(AUDIO_DATA));
1822 + //copy_from_user((char*)&mp3_beep, (char*)arg, sizeof(MP3_BEEP));
1825 + case IOCTL_FOXBONE_TIMEBASE_ENABLE:
1826 + foxbone_write(0x0100, 0x01);
1829 + case IOCTL_FOXBONE_TIMEBASE_DISABLE:
1830 + foxbone_write(0x0100, 0x00);
1833 + case IOCTL_FOXBONE_TIMEBASE_SETLO:
1834 + foxbone_write(0x0100, 0x00);
1835 + foxbone_write(0x0102, arg);
1836 + foxbone_write(0x0100, 0x01);
1839 + case IOCTL_FOXBONE_TIMEBASE_SETHI:
1840 + foxbone_write(0x0100, 0x00);
1841 + foxbone_write(0x0103, arg);
1842 + foxbone_write(0x0100, 0x01);
1846 + printk("fox_timebase: unknown ioctl\n");
1855 +static int module_open(struct inode *inode, struct file *file){
1856 + // Which minor device is the user trying to access ?
1857 + unsigned int dev_minor = MINOR(inode->i_rdev);
1859 + // we only supprt minor 0 at the moment
1860 + if(dev_minor != 0){
1861 + printk("fox_timebase: trying to access unknown minor device -> %d\n", dev_minor);
1865 + // check if another app is currently using the device
1866 + if(foxtimebase_is_open) {
1867 + printk("fox_timebase: Device with minor ID %d already in use\n", dev_minor);
1872 + printk("fox_timebase: Minor %d has been opened\n", dev_minor);
1877 +// gets called when an app closes the device
1878 +static int module_close(struct inode * inode, struct file * file){
1879 + // Which minor device is the user trying to access ?
1880 + unsigned int dev_minor = MINOR(inode->i_rdev);
1882 + // remember that the device has been closed
1883 + foxtimebase_is_open = 0;
1887 + printk("fox_timebase: Minor %d has been closed\n", dev_minor);
1892 +// so the kernel knows which functions to access for a given operation
1893 +struct file_operations foxtimebase_module_fops = {
1894 + ioctl: module_ioctl,
1895 + open: module_open,
1896 + release: module_close
1900 +// module gets loaded into kernel / char dev is registered
1901 +static int __init mod_init(void){
1902 + // flame the kprintk
1903 + printk("fox_timebase: FOX-VHDL FPGA timebase module\n");
1904 + //printk("fox_timebase: Made by K. John '2B|!2B' Crispin (john@phrozen.org)\n");
1905 + //printk("fox_timebase: Starting ...\n");
1907 + // register the character device
1908 + if(register_chrdev(DEV_MAJOR, DEV_NAME, &foxtimebase_module_fops)) {
1909 + printk( "fox_timebase: Error whilst opening %s (%d)\n", DEV_NAME, DEV_MAJOR);
1910 + return( -ENODEV );
1914 + // remember that the driver has been opened
1915 + foxtimebase_is_open = 0;
1916 + printk("fox_timebase: Device %s registered for major ID %d\n", DEV_NAME, DEV_MAJOR);
1921 +// we are done so shut everything down
1922 +static void __exit mod_exit(void){
1923 + printk( "fox_timebase: Cleanup\n" );
1924 + // tell the kernel that the device is not needed anymore
1925 + unregister_chrdev(DEV_MAJOR, DEV_NAME);
1929 +module_init (mod_init);
1930 +module_exit (mod_exit);
1937 diff -urN linux-2.6.19.2.orig/drivers/fox-vhdl/fox_timebase/Makefile linux-2.6.19.2/drivers/fox-vhdl/fox_timebase/Makefile
1938 --- linux-2.6.19.2.orig/drivers/fox-vhdl/fox_timebase/Makefile 1970-01-01 01:00:00.000000000 +0100
1939 +++ linux-2.6.19.2/drivers/fox-vhdl/fox_timebase/Makefile 2007-06-17 02:46:15.000000000 +0200
1941 +obj-$(CONFIG_FOXBONE_TIMEBASE) += fox_timebase.o
1942 diff -urN linux-2.6.19.2.orig/drivers/fox-vhdl/fox_vhdl_fb/fb.bak linux-2.6.19.2/drivers/fox-vhdl/fox_vhdl_fb/fb.bak
1943 --- linux-2.6.19.2.orig/drivers/fox-vhdl/fox_vhdl_fb/fb.bak 1970-01-01 01:00:00.000000000 +0100
1944 +++ linux-2.6.19.2/drivers/fox-vhdl/fox_vhdl_fb/fb.bak 2007-06-17 02:46:15.000000000 +0200
1946 +#include <linux/module.h>
1947 +#include <linux/kernel.h>
1948 +#include <linux/errno.h>
1949 +#include <linux/string.h>
1950 +#include <linux/mm.h>
1951 +#include <linux/tty.h>
1952 +#include <linux/slab.h>
1953 +#include <linux/vmalloc.h>
1954 +#include <linux/delay.h>
1955 +#include <linux/interrupt.h>
1956 +#include <linux/platform_device.h>
1958 +#include <asm/uaccess.h>
1959 +#include <linux/fb.h>
1960 +#include <linux/init.h>
1962 +#include "foxbone.h"
1974 +void FOXVHDL_delay(int ms) {
1978 + for (a=0;a<ms;a++) {
1979 + for (i=0;i<35;i++) {
1990 +|| FOXVHDL CTL functions
1995 +static unsigned char FOXVHDL_current_bank = 0xff;
1997 +static unsigned char blitting = 1;
1999 +static unsigned char refreshrate = 6;
2003 +unsigned int FOXVHDL_translate_BGR(unsigned char blue, unsigned char green, unsigned char red) {
2004 + // translate the three color passed in a single 16 bit color word
2005 + unsigned int result = ((blue>>3)<<11) | ((green>>2)<<5) | (red>>3);
2012 +// wait until the videostate pin has the wanted value
2013 +void FOXVHDL_wait_videostate(unsigned char wait_state){
2014 +/* unsigned char vid_state = 0;
2015 + unsigned int max_error = 0xffff;
2016 + //printk("Start wait\n");
2018 + vid_state = FOXVHDL_get_bit_B(Fox_line_VideoState);
2020 + } while((vid_state != wait_state)&&(max_error > 10));
2022 + DBG(if(max_error < 11){printk("Stop wait\n");};)
2026 +// choose the bank that we want to display
2027 +// OG5 == 0 --> Bank0
2028 +// OG5 == 1 --> Bank1
2029 +void FOXVHDL_set_bank(unsigned char bank){
2030 + DBG(printk("%d, %d\n",FOXVHDL_current_bank, bank);)
2031 + if(FOXVHDL_current_bank == bank){
2035 + DBG(printk("FOXVHDL_set_bank\n");)
2037 + FOXVHDL_current_bank = bank;
2038 + foxbone_write(0x7001, FOXVHDL_current_bank);
2045 +void FOXVHDL_swap_bank(void){
2046 + FOXVHDL_set_bank((FOXVHDL_current_bank)?(0):(1));
2050 +// initialise the I/O pins
2051 +void FOXVHDL_init(void){
2052 + DBG(printk("FOXVHDL_init\n");)
2054 + FOXVHDL_current_bank = 0;
2056 + FOXVHDL_set_bank(1);
2062 +|| FOXVHDL IMAGE FUNCTIONS
2065 +#define Fox_line_WriteData (1<<2)
2067 +void FOXVHDL_blit(unsigned short int *image){
2069 + unsigned int fb_ctl_reg;
2072 + // reset the address pointer
2073 + fb_ctl_reg = foxbone_read(0x7001);
2074 + fb_ctl_reg |= (1<<4);
2075 + foxbone_write(0x7001, fb_ctl_reg);
2076 + fb_ctl_reg &= ~(1<<4);
2077 + foxbone_write(0x7001, fb_ctl_reg);
2079 + foxbone_write(0x7000, image[0]);
2080 + genconfig_shadow |= IO_MASK(R_GEN_CONFIG,g8_15dir);
2081 + *R_GEN_CONFIG = genconfig_shadow;
2082 + genconfig_shadow |= IO_MASK(R_GEN_CONFIG,g16_23dir);
2083 + *R_GEN_CONFIG = genconfig_shadow;
2085 + for(i = 1; i < 640 * 400; i++){
2087 + *R_PORT_G_DATA = port_g_data_shadow =
2088 + (port_g_data_shadow & 0xff0000ff) | image[i]<<8;
2089 + *R_PORT_G_DATA = port_g_data_shadow |= Fox_line_WriteData;
2090 + *R_PORT_G_DATA = port_g_data_shadow &= ~Fox_line_WriteData;
2092 + for(i = 0; i <6144; i++){
2093 + foxbone_write_next(0);
2095 + FOXVHDL_swap_bank();
2105 +||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2106 +||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2107 +||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2109 +|| FRAMEBUFFER CODE
2111 +||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2112 +||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2113 +||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2120 +#define VIDEOMEMSIZE (640 * 400 * 2) //512K
2122 +static void *videomemory;
2123 +static u_long videomemorysize = VIDEOMEMSIZE;
2125 +static unsigned char fb_started = 0;
2127 +static struct fb_var_screeninfo foxfb_default __initdata = {
2130 + .xres_virtual = 640,
2131 + .yres_virtual = 400,
2132 + .bits_per_pixel = 16,
2133 + .red = { 0, 5, 0 },
2134 + .green = { 5, 6, 0 },
2135 + .blue = { 11, 5, 0 },
2136 + .activate = FB_ACTIVATE_NOW,
2139 + .vmode = FB_VMODE_NONINTERLACED,
2142 +static struct fb_fix_screeninfo foxfb_fix __initdata = {
2143 + .id = "FOX-VHDL FB",
2144 + .type = FB_TYPE_PACKED_PIXELS,
2145 + .visual = FB_VISUAL_TRUECOLOR,
2149 + .accel = FB_ACCEL_NONE,
2152 +static int foxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info);
2153 +static int foxfb_set_par(struct fb_info *info);
2154 +static int foxfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, struct fb_info *info);
2155 +static int foxfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info);
2156 +static int foxfb_mmap(struct fb_info *info, struct file *file, struct vm_area_struct *vma);
2157 +static void foxfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect);
2158 +static void foxfb_copyarea(struct fb_info *info, const struct fb_copyarea *area);
2159 +static void foxfb_imageblit(struct fb_info *info, const struct fb_image *image);
2161 +static int foxfb_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
2163 +static struct fb_ops foxfb_ops = {
2164 + .fb_check_var = foxfb_check_var,
2165 + .fb_set_par = foxfb_set_par,
2166 + .fb_setcolreg = foxfb_setcolreg,
2168 + .fb_pan_display = foxfb_pan_display,
2169 + .fb_fillrect = foxfb_fillrect, //cfb_fillrect,
2170 + .fb_copyarea = foxfb_copyarea, //cfb_copyarea,
2171 + .fb_imageblit = foxfb_imageblit,//cfb_imageblit,
2172 + .fb_mmap = foxfb_mmap,
2173 + .fb_ioctl = foxfb_ioctl,
2176 +// this function is defined in fbmem.c
2177 +extern int fb_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
2179 +// this should be a free one
2180 +#define FOX_FBIOGET_SCREEN 0x4642
2181 +#define FOX_FBBLIT 0x4643
2182 +#define FOX_FB_RATE 0x4645
2183 +#define FOX_FB_TFT 0x4646
2184 +static int foxfb_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg){
2185 + void __user *argp = (void __user *)arg;
2186 + unsigned int fb_ctl_reg;
2188 + // this assumes that arg points to a VIDEOMEMSIZE area of memory in user space
2189 + case FOX_FBIOGET_SCREEN:
2190 + if(copy_to_user(argp, videomemory, VIDEOMEMSIZE)){
2196 + fb_ctl_reg = foxbone_read(0x7001);
2198 + printk("Enable FB\n");
2199 + fb_ctl_reg &= ~(1<<1);
2201 + printk("Disable FB\n");
2202 + fb_ctl_reg |= (1<<1);
2205 + foxbone_write(0x7001, fb_ctl_reg);
2208 + if((arg > 9) || (arg < 1)){
2209 + printk("fb0 : Illegal refreshrate\n");
2212 + refreshrate = arg;
2213 + printk("fb0 : new refreshrate\n");
2216 + fb_ctl_reg = foxbone_read(0x7001);
2218 + printk("Enable TFT\n");
2219 + fb_ctl_reg |= (1<<3);
2221 + printk("Disable TFT\n");
2222 + fb_ctl_reg &= ~(1<<3);
2224 + foxbone_write(0x7001, fb_ctl_reg);
2227 + return fb_ioctl(inode, file, cmd, arg);
2232 +// TODO add our own optimized code here
2233 +static void foxfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect){
2234 + cfb_fillrect(info, rect);
2238 +// TODO add our own optimized code here
2239 +static void foxfb_copyarea(struct fb_info *info, const struct fb_copyarea *area){
2240 + cfb_copyarea(info, area);
2243 +// TODO add our own optimized code here
2244 +static void foxfb_imageblit(struct fb_info *info, const struct fb_image *image){
2245 + cfb_imageblit(info, image);
2250 + * Internal routines
2253 +static u_long get_line_length(int xres_virtual, int bpp)
2257 + length = xres_virtual * bpp;
2258 + length = (length + 31) & ~31;
2264 + * Setting the video mode has been split into two parts.
2265 + * First part, xxxfb_check_var, must not write anything
2266 + * to hardware, it should only verify and adjust var.
2267 + * This means it doesn't alter par but it does use hardware
2268 + * data from it to check this var.
2271 +static int foxfb_check_var(struct fb_var_screeninfo *var,
2272 + struct fb_info *info)
2274 + u_long line_length;
2276 + if (var->vmode & FB_VMODE_CONUPDATE) {
2277 + var->vmode |= FB_VMODE_YWRAP;
2278 + var->xoffset = info->var.xoffset;
2279 + var->yoffset = info->var.yoffset;
2285 + var->bits_per_pixel = 16;
2287 + if (var->xres_virtual < var->xoffset + var->xres)
2288 + var->xres_virtual = var->xoffset + var->xres;
2289 + if (var->yres_virtual < var->yoffset + var->yres)
2290 + var->yres_virtual = var->yoffset + var->yres;
2292 + line_length = get_line_length(var->xres_virtual, var->bits_per_pixel);
2293 + if (line_length * var->yres_virtual > videomemorysize)
2296 + var->red.offset = 0;
2297 + var->red.length = 5;
2298 + var->green.offset = 5;
2299 + var->green.length = 6;
2300 + var->blue.offset = 11;
2301 + var->blue.length = 5;
2302 + var->transp.offset = 0;
2303 + var->transp.length = 0;
2304 + var->red.msb_right = 0;
2305 + var->green.msb_right = 0;
2306 + var->blue.msb_right = 0;
2307 + var->transp.msb_right = 0;
2314 +/* This routine actually sets the video mode. It's in here where we
2315 + * the hardware state info->par and fix which can be affected by the
2316 + * change in par. For this driver it doesn't do much.
2318 +static int foxfb_set_par(struct fb_info *info){
2319 + info->fix.line_length = get_line_length(info->var.xres_virtual, info->var.bits_per_pixel);
2324 + * Set a single color register. The values supplied are already
2325 + * rounded down to the hardware's capabilities (according to the
2326 + * entries in the var structure). Return != 0 for invalid regno.
2330 +static int foxfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, struct fb_info *info){
2331 + if (regno >= 256) /* no. of hw registers */
2334 + /* grayscale works only partially under directcolor */
2335 + if (info->var.grayscale) {
2336 + /* grayscale = 0.30*R + 0.59*G + 0.11*B */
2337 + red = green = blue =
2338 + (red * 77 + green * 151 + blue * 28) >> 8;
2342 + * var->{color}.offset contains start of bitfield
2343 + * var->{color}.length contains length of bitfield
2344 + * {hardwarespecific} contains width of RAMDAC
2345 + * cmap[X] is programmed to (X << red.offset) | (X << green.offset) | (X << blue.offset)
2346 + * RAMDAC[X] is programmed to (red, green, blue)
2349 + * uses offset = 0 && length = RAMDAC register width.
2350 + * var->{color}.offset is 0
2351 + * var->{color}.length contains widht of DAC
2352 + * cmap is not used
2353 + * RAMDAC[X] is programmed to (red, green, blue)
2355 + * does not use DAC. Usually 3 are present.
2356 + * var->{color}.offset contains start of bitfield
2357 + * var->{color}.length contains length of bitfield
2358 + * cmap is programmed to (red << red.offset) | (green << green.offset) |
2359 + * (blue << blue.offset) | (transp << transp.offset)
2360 + * RAMDAC does not exist
2362 +#define CNVT_TOHW(val,width) ((((val)<<(width))+0x7FFF-(val))>>16)
2363 + switch (info->fix.visual) {
2364 + case FB_VISUAL_TRUECOLOR:
2365 + case FB_VISUAL_PSEUDOCOLOR:
2366 + red = CNVT_TOHW(red, info->var.red.length);
2367 + green = CNVT_TOHW(green, info->var.green.length);
2368 + blue = CNVT_TOHW(blue, info->var.blue.length);
2369 + transp = CNVT_TOHW(transp, info->var.transp.length);
2371 + case FB_VISUAL_DIRECTCOLOR:
2372 + red = CNVT_TOHW(red, 8); /* expect 8 bit DAC */
2373 + green = CNVT_TOHW(green, 8);
2374 + blue = CNVT_TOHW(blue, 8);
2375 + /* hey, there is bug in transp handling... */
2376 + transp = CNVT_TOHW(transp, 8);
2380 + /* Truecolor has hardware independent palette */
2381 + if (info->fix.visual == FB_VISUAL_TRUECOLOR) {
2387 + v = (red << info->var.red.offset) |
2388 + (green << info->var.green.offset) |
2389 + (blue << info->var.blue.offset) |
2390 + (transp << info->var.transp.offset);
2391 + switch (info->var.bits_per_pixel) {
2395 + ((u32 *) (info->pseudo_palette))[regno] = v;
2399 + ((u32 *) (info->pseudo_palette))[regno] = v;
2408 + * Pan or Wrap the Display
2410 + * This call looks only at xoffset, yoffset and the FB_VMODE_YWRAP flag
2413 +static int foxfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info){
2414 + if (var->vmode & FB_VMODE_YWRAP) {
2415 + if (var->yoffset < 0
2416 + || var->yoffset >= info->var.yres_virtual
2420 + if (var->xoffset + var->xres > info->var.xres_virtual ||
2421 + var->yoffset + var->yres > info->var.yres_virtual)
2424 + info->var.xoffset = var->xoffset;
2425 + info->var.yoffset = var->yoffset;
2426 + if (var->vmode & FB_VMODE_YWRAP)
2427 + info->var.vmode |= FB_VMODE_YWRAP;
2429 + info->var.vmode &= ~FB_VMODE_YWRAP;
2434 + * Most drivers don't need their own mmap function
2437 +static int foxfb_mmap(struct fb_info *info, struct file *file, struct vm_area_struct *vma){
2438 + unsigned long page, pos;
2439 + unsigned long start = vma->vm_start;
2440 + unsigned long size = vma->vm_end-vma->vm_start;
2441 + printk("mmap : %ld %ld\n", size, info->fix.smem_len);
2442 + //if (size > info->fix.smem_len){
2443 + // return -EINVAL;
2445 + printk("MMAP2\n");
2446 + pos = (unsigned long) info->screen_base;
2447 + while (size > 0) {
2448 + page = page_to_pfn(vmalloc_to_page((void *)pos));
2449 + if (remap_pfn_range(vma, start, page, PAGE_SIZE, PAGE_SHARED))
2451 + start += PAGE_SIZE;
2453 + if (size > PAGE_SIZE)
2454 + size -= PAGE_SIZE;
2466 +struct timer_list foxfb_timer;
2469 +// the prototype for the callback
2470 +static void foxfb_timer_callback(unsigned long ptr);
2473 +// setup the mmc timer
2474 +static void foxfb_timer_setup(void){
2475 + init_timer(&foxfb_timer);
2476 + foxfb_timer.function = foxfb_timer_callback;
2477 + foxfb_timer.data = 0;
2478 + foxfb_timer.expires = jiffies + ( HZ / refreshrate);
2479 + add_timer(&foxfb_timer);
2483 +// the timer callback function that detects if the card status has changed
2484 +static void foxfb_timer_callback(unsigned long ptr){
2485 + del_timer(&foxfb_timer);
2486 + FOXVHDL_blit(videomemory);
2487 + foxfb_timer_setup();
2491 +static void foxfb_platform_release(struct device *device){
2492 + // This is called when the reference count goes to zero.
2496 +static int __init foxfb_probe(struct platform_device *dev){
2497 + struct fb_info *info;
2498 + int retval = -ENOMEM;
2500 + if (!(videomemory = vmalloc(videomemorysize)))
2503 + memset(videomemory, 0, videomemorysize);
2505 + info = framebuffer_alloc(sizeof(u32) * 256, &dev->dev);
2509 + info->screen_base = (char*)videomemory;
2510 + info->fbops = &foxfb_ops;
2511 + info->fix.smem_len = videomemorysize;
2512 + retval = fb_find_mode(&info->var, info, NULL,
2513 + NULL, 0, NULL, 8);
2515 + if (!retval || (retval == 4))
2516 + info->var = foxfb_default;
2518 + info->fix = foxfb_fix;
2519 + info->pseudo_palette = info->par;
2521 + info->flags = FBINFO_FLAG_DEFAULT;
2523 + retval = fb_alloc_cmap(&info->cmap, 256, 0);
2527 + retval = register_framebuffer(info);
2530 + platform_set_drvdata(dev, info);
2533 + "fb%d: FOX-VHDL frame buffer device, using %ldK of video memory\n",
2534 + info->node, videomemorysize >> 10);
2537 + //FOXVHDL_blit(videomemory);
2538 + foxfb_timer_setup();
2541 + fb_dealloc_cmap(&info->cmap);
2543 + framebuffer_release(info);
2545 + vfree(videomemory);
2549 +static int foxfb_remove(struct platform_device *dev)
2551 + struct fb_info *info = platform_get_drvdata(dev);
2554 + unregister_framebuffer(info);
2555 + vfree(videomemory);
2556 + framebuffer_release(info);
2561 +static struct platform_driver foxfb_driver = {
2562 + .probe = foxfb_probe,
2563 + .remove = foxfb_remove,
2569 +static struct platform_device foxfb_device = {
2573 + .release = foxfb_platform_release,
2577 +static int __init foxfb_init(void)
2581 + printk(KERN_INFO "fb: Initialising framebuffer\n");
2585 + ret = platform_driver_register(&foxfb_driver);
2588 + ret = platform_device_register(&foxfb_device);
2590 + platform_driver_unregister(&foxfb_driver);
2596 +static void __exit foxfb_exit(void)
2598 + platform_device_unregister(&foxfb_device);
2599 + platform_driver_unregister(&foxfb_driver);
2602 +module_exit(foxfb_exit);
2603 +module_init(foxfb_init);
2604 +MODULE_LICENSE("GPL");
2605 +MODULE_AUTHOR("K. John '2B|!2B' Crispin");
2606 +MODULE_DESCRIPTION("FOX-VHDL Framebuffer Driver");
2607 diff -urN linux-2.6.19.2.orig/drivers/fox-vhdl/fox_vhdl_fb/foxbone.h linux-2.6.19.2/drivers/fox-vhdl/fox_vhdl_fb/foxbone.h
2608 --- linux-2.6.19.2.orig/drivers/fox-vhdl/fox_vhdl_fb/foxbone.h 1970-01-01 01:00:00.000000000 +0100
2609 +++ linux-2.6.19.2/drivers/fox-vhdl/fox_vhdl_fb/foxbone.h 2007-06-17 02:46:15.000000000 +0200
2611 +// prototypes for foxbone compliant modules
2613 +extern unsigned int FOXBONE_release;
2614 +extern unsigned int FOXBONE_application1;
2615 +extern unsigned int FOXBONE_application2;
2616 +extern unsigned int FOXBONE_application3;
2618 +void foxbone_write(unsigned int add, unsigned int data);
2620 +unsigned int foxbone_read(unsigned int add);
2622 +void foxbone_write_next(unsigned data);
2624 +unsigned int foxbone_read_next(void);
2626 +void foxbone_initialise_bus(void);
2628 +void foxbone_lock(void);
2630 +void foxbone_unlock(void);
2631 diff -urN linux-2.6.19.2.orig/drivers/fox-vhdl/fox_vhdl_fb/foxvhdlfb.c linux-2.6.19.2/drivers/fox-vhdl/fox_vhdl_fb/foxvhdlfb.c
2632 --- linux-2.6.19.2.orig/drivers/fox-vhdl/fox_vhdl_fb/foxvhdlfb.c 1970-01-01 01:00:00.000000000 +0100
2633 +++ linux-2.6.19.2/drivers/fox-vhdl/fox_vhdl_fb/foxvhdlfb.c 2007-06-17 02:46:15.000000000 +0200
2637 + Linux Kernel Driver for FoxBone FrameBuffer on FOX VHDL Board
2638 + (based on FoxBone protocol interface specifications rel 0.7)
2639 + For more info see: http://www.acmesystems.it/?id=120
2640 + Author: John Crispin
2641 + Copyright (C) 2006 Phrozen (http://www.phrozen.biz)
2643 + This is free software; you can redistribute it and/or modify
2644 + it under the terms of the GNU General Public License as published by
2645 + the Free Software Foundation; either version 2 of the License, or
2646 + (at your option) any later version.
2648 + This example is distributed in the hope that it will be useful,
2649 + but WITHOUT ANY WARRANTY; without even the implied warranty of
2650 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2651 + GNU General Public License for more details.
2653 + To have a copy of the GNU General Public License write to the Free Software
2654 + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2658 +#include <linux/module.h>
2659 +#include <linux/kernel.h>
2660 +#include <linux/errno.h>
2661 +#include <linux/string.h>
2662 +#include <linux/mm.h>
2663 +#include <linux/tty.h>
2664 +#include <linux/slab.h>
2665 +#include <linux/vmalloc.h>
2666 +#include <linux/delay.h>
2667 +#include <linux/interrupt.h>
2668 +#include <linux/platform_device.h>
2670 +#include <asm/uaccess.h>
2671 +#include <linux/fb.h>
2672 +#include <linux/init.h>
2674 +#include "foxbone.h"
2686 +|| FOXVHDL CTL functions
2691 +static unsigned char FOXVHDL_current_bank = 0xff;
2693 +static unsigned char blitting = 1;
2695 +static unsigned char refreshrate = 6;
2699 +unsigned int FOXVHDL_translate_BGR(unsigned char blue, unsigned char green, unsigned char red) {
2700 + // translate the three color passed in a single 16 bit color word
2701 + unsigned int result = ((blue>>3)<<11) | ((green>>2)<<5) | (red>>3);
2708 +// wait until the videostate pin has the wanted value
2709 +void FOXVHDL_wait_videostate(unsigned char wait_state){
2710 +/* unsigned char vid_state = 0;
2711 + unsigned int max_error = 0xffff;
2712 + //printk("Start wait\n");
2714 + vid_state = FOXVHDL_get_bit_B(Fox_line_VideoState);
2716 + } while((vid_state != wait_state)&&(max_error > 10));
2718 + DBG(if(max_error < 11){printk("Stop wait\n");};)
2722 +// choose the bank that we want to display
2723 +// OG5 == 0 --> Bank0
2724 +// OG5 == 1 --> Bank1
2725 +void FOXVHDL_set_bank(unsigned char bank){
2726 + DBG(printk("%d, %d\n",FOXVHDL_current_bank, bank);)
2727 + if(FOXVHDL_current_bank == bank){
2731 + DBG(printk("FOXVHDL_set_bank\n");)
2733 + FOXVHDL_current_bank = bank;
2734 + foxbone_write(0x7001, FOXVHDL_current_bank);
2741 +void FOXVHDL_swap_bank(void){
2742 + FOXVHDL_set_bank((FOXVHDL_current_bank)?(0):(1));
2746 +// initialise the I/O pins
2747 +void FOXVHDL_init(void){
2748 + DBG(printk("FOXVHDL_init\n");)
2750 + FOXVHDL_current_bank = 0;
2752 + FOXVHDL_set_bank(1);
2758 +|| FOXVHDL IMAGE FUNCTIONS
2761 +#define Fox_line_WriteData (1<<2)
2763 +// for performance reasons, we do not use the foxbone access functions here
2764 +// we rather use an optimised algorithm. blitting now only takes about 6 ms.
2765 +// meaning we can that effectivley achieve 17 frame. however the refresh rate by
2766 +// default is 4 fps
2769 +#define DBG_TIMER(x) x
2771 +#define DBG_TIMER(x)
2775 +#define DOUBLE_DATA_RATE
2778 +void FOXVHDL_blit(unsigned short int *image){
2780 + unsigned int fb_ctl_reg;
2784 + DBG_TIMER(unsigned long j = jiffies;)
2785 + // reset the address pointer
2786 + fb_ctl_reg = foxbone_read(0x7001);
2787 + fb_ctl_reg |= (1<<4);
2788 + foxbone_write(0x7001, fb_ctl_reg);
2789 + fb_ctl_reg &= ~(1<<4);
2790 + foxbone_write(0x7001, fb_ctl_reg);
2792 + foxbone_write(0x7000, image[0]);
2793 + genconfig_shadow |= IO_MASK(R_GEN_CONFIG,g8_15dir);
2794 + *R_GEN_CONFIG = genconfig_shadow;
2795 + genconfig_shadow |= IO_MASK(R_GEN_CONFIG,g16_23dir);
2796 + *R_GEN_CONFIG = genconfig_shadow;
2798 + *R_PORT_G_DATA = port_g_data_shadow = (port_g_data_shadow & 0xff0000ff);
2801 +#ifdef DOUBLE_DATA_RATE
2803 + unsigned long def_val = (port_g_data_shadow & 0xff0000ff);
2804 + for(i = 1; i < 640 * 400; i+=2){
2805 + *R_PORT_G_DATA = port_g_data_shadow = def_val | image[i]<<8 | Fox_line_WriteData;
2806 + *R_PORT_G_DATA = port_g_data_shadow = def_val | image[i+1]<<8;
2808 + *R_PORT_G_DATA = port_g_data_shadow &= ~Fox_line_WriteData;
2812 + unsigned long def_val = (port_g_data_shadow & 0xff0000ff) | Fox_line_WriteData;
2813 + for(i = 1; i < 640 * 400; i++){
2814 + *R_PORT_G_DATA = port_g_data_shadow = def_val | image[i]<<8;
2815 + *R_PORT_G_DATA = port_g_data_shadow &= ~Fox_line_WriteData;
2819 + FOXVHDL_swap_bank();
2820 + DBG_TIMER(printk("%ld\n", jiffies - j);)
2831 +||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2832 +||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2833 +||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2835 +|| FRAMEBUFFER CODE
2837 +||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2838 +||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2839 +||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2846 +#define VIDEOMEMSIZE (640 * 400 * 2) //512K
2848 +static void *videomemory;
2849 +static u_long videomemorysize = VIDEOMEMSIZE;
2851 +static unsigned char fb_started = 0;
2853 +static unsigned char fb_update = 0;
2855 +static unsigned char fb_mmap_enable = 0;
2857 +static struct fb_var_screeninfo foxfb_default __initdata = {
2860 + .xres_virtual = 640,
2861 + .yres_virtual = 400,
2862 + .bits_per_pixel = 16,
2863 + .red = { 0, 5, 0 },
2864 + .green = { 5, 6, 0 },
2865 + .blue = { 11, 5, 0 },
2866 + .activate = FB_ACTIVATE_NOW,
2869 + .vmode = FB_VMODE_NONINTERLACED,
2872 +static struct fb_fix_screeninfo foxfb_fix __initdata = {
2873 + .id = "FOX-VHDL FB",
2874 + .type = FB_TYPE_PACKED_PIXELS,
2875 + .visual = FB_VISUAL_TRUECOLOR,
2879 + .accel = FB_ACCEL_NONE,
2882 +static int foxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info);
2883 +static int foxfb_set_par(struct fb_info *info);
2884 +static int foxfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, struct fb_info *info);
2885 +static int foxfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info);
2886 +static int foxfb_mmap(struct fb_info *info, struct file *file, struct vm_area_struct *vma);
2887 +static void foxfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect);
2888 +static void foxfb_copyarea(struct fb_info *info, const struct fb_copyarea *area);
2889 +static void foxfb_imageblit(struct fb_info *info, const struct fb_image *image);
2891 +static int foxfb_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
2893 +static struct fb_ops foxfb_ops = {
2894 + .fb_check_var = foxfb_check_var,
2895 + .fb_set_par = foxfb_set_par,
2896 + .fb_setcolreg = foxfb_setcolreg,
2898 + .fb_pan_display = foxfb_pan_display,
2899 + .fb_fillrect = foxfb_fillrect, //cfb_fillrect,
2900 + .fb_copyarea = foxfb_copyarea, //cfb_copyarea,
2901 + .fb_imageblit = foxfb_imageblit,//cfb_imageblit,
2902 + .fb_mmap = foxfb_mmap,
2903 + .fb_ioctl = foxfb_ioctl,
2906 +// this function is defined in fbmem.c
2907 +extern int fb_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
2909 +// this should be a free one
2910 +#define FOX_FBIOGET_SCREEN 0x4642
2911 +#define FOX_FBBLIT 0x4643
2912 +#define FOX_FB_RATE 0x4645
2913 +#define FOX_FB_TFT 0x4646
2914 +static int foxfb_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg){
2915 + void __user *argp = (void __user *)arg;
2916 + unsigned int fb_ctl_reg;
2918 + // this assumes that arg points to a VIDEOMEMSIZE area of memory in user space
2919 + case FOX_FBIOGET_SCREEN:
2920 + if(copy_to_user(argp, videomemory, VIDEOMEMSIZE)){
2926 + fb_ctl_reg = foxbone_read(0x7001);
2928 + printk("Enable FB\n");
2929 + fb_ctl_reg &= ~(1<<1);
2931 + printk("Disable FB\n");
2932 + fb_ctl_reg |= (1<<1);
2935 + foxbone_write(0x7001, fb_ctl_reg);
2938 + if((arg > 9) || (arg < 1)){
2939 + printk("fb0 : Illegal refreshrate\n");
2942 + refreshrate = arg;
2943 + printk("fb0 : new refreshrate\n");
2946 + fb_ctl_reg = foxbone_read(0x7001);
2948 + printk("Enable TFT\n");
2949 + fb_ctl_reg |= (1<<3);
2951 + printk("Disable TFT\n");
2952 + fb_ctl_reg &= ~(1<<3);
2954 + foxbone_write(0x7001, fb_ctl_reg);
2957 + return fb_ioctl(inode, file, cmd, arg);
2962 +// TODO add our own optimized code here
2963 +static void foxfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect){
2964 + cfb_fillrect(info, rect);
2969 +// TODO add our own optimized code here
2970 +static void foxfb_copyarea(struct fb_info *info, const struct fb_copyarea *area){
2971 + cfb_copyarea(info, area);
2975 +// TODO add our own optimized code here
2976 +static void foxfb_imageblit(struct fb_info *info, const struct fb_image *image){
2977 + cfb_imageblit(info, image);
2983 + * Internal routines
2986 +static u_long get_line_length(int xres_virtual, int bpp)
2990 + length = xres_virtual * bpp;
2991 + length = (length + 31) & ~31;
2997 + * Setting the video mode has been split into two parts.
2998 + * First part, xxxfb_check_var, must not write anything
2999 + * to hardware, it should only verify and adjust var.
3000 + * This means it doesn't alter par but it does use hardware
3001 + * data from it to check this var.
3004 +static int foxfb_check_var(struct fb_var_screeninfo *var,
3005 + struct fb_info *info)
3007 + u_long line_length;
3009 + if (var->vmode & FB_VMODE_CONUPDATE) {
3010 + var->vmode |= FB_VMODE_YWRAP;
3011 + var->xoffset = info->var.xoffset;
3012 + var->yoffset = info->var.yoffset;
3018 + var->bits_per_pixel = 16;
3020 + if (var->xres_virtual < var->xoffset + var->xres)
3021 + var->xres_virtual = var->xoffset + var->xres;
3022 + if (var->yres_virtual < var->yoffset + var->yres)
3023 + var->yres_virtual = var->yoffset + var->yres;
3025 + line_length = get_line_length(var->xres_virtual, var->bits_per_pixel);
3026 + if (line_length * var->yres_virtual > videomemorysize)
3029 + var->red.offset = 0;
3030 + var->red.length = 5;
3031 + var->green.offset = 5;
3032 + var->green.length = 6;
3033 + var->blue.offset = 11;
3034 + var->blue.length = 5;
3035 + var->transp.offset = 0;
3036 + var->transp.length = 0;
3037 + var->red.msb_right = 0;
3038 + var->green.msb_right = 0;
3039 + var->blue.msb_right = 0;
3040 + var->transp.msb_right = 0;
3047 +/* This routine actually sets the video mode. It's in here where we
3048 + * the hardware state info->par and fix which can be affected by the
3049 + * change in par. For this driver it doesn't do much.
3051 +static int foxfb_set_par(struct fb_info *info){
3052 + info->fix.line_length = get_line_length(info->var.xres_virtual, info->var.bits_per_pixel);
3057 + * Set a single color register. The values supplied are already
3058 + * rounded down to the hardware's capabilities (according to the
3059 + * entries in the var structure). Return != 0 for invalid regno.
3063 +static int foxfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, struct fb_info *info){
3064 + if (regno >= 256) /* no. of hw registers */
3067 + /* grayscale works only partially under directcolor */
3068 + if (info->var.grayscale) {
3069 + /* grayscale = 0.30*R + 0.59*G + 0.11*B */
3070 + red = green = blue =
3071 + (red * 77 + green * 151 + blue * 28) >> 8;
3074 +#define CNVT_TOHW(val,width) ((((val)<<(width))+0x7FFF-(val))>>16)
3075 + switch (info->fix.visual) {
3076 + case FB_VISUAL_TRUECOLOR:
3077 + case FB_VISUAL_PSEUDOCOLOR:
3078 + red = CNVT_TOHW(red, info->var.red.length);
3079 + green = CNVT_TOHW(green, info->var.green.length);
3080 + blue = CNVT_TOHW(blue, info->var.blue.length);
3081 + transp = CNVT_TOHW(transp, info->var.transp.length);
3083 + case FB_VISUAL_DIRECTCOLOR:
3084 + red = CNVT_TOHW(red, 8); /* expect 8 bit DAC */
3085 + green = CNVT_TOHW(green, 8);
3086 + blue = CNVT_TOHW(blue, 8);
3087 + /* hey, there is bug in transp handling... */
3088 + transp = CNVT_TOHW(transp, 8);
3092 + /* Truecolor has hardware independent palette */
3093 + if (info->fix.visual == FB_VISUAL_TRUECOLOR) {
3099 + v = (red << info->var.red.offset) |
3100 + (green << info->var.green.offset) |
3101 + (blue << info->var.blue.offset) |
3102 + (transp << info->var.transp.offset);
3103 + switch (info->var.bits_per_pixel) {
3107 + ((u32 *) (info->pseudo_palette))[regno] = v;
3111 + ((u32 *) (info->pseudo_palette))[regno] = v;
3120 +static int foxfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info){
3121 + if (var->vmode & FB_VMODE_YWRAP) {
3122 + if (var->yoffset < 0
3123 + || var->yoffset >= info->var.yres_virtual
3127 + if (var->xoffset + var->xres > info->var.xres_virtual ||
3128 + var->yoffset + var->yres > info->var.yres_virtual)
3131 + info->var.xoffset = var->xoffset;
3132 + info->var.yoffset = var->yoffset;
3133 + if (var->vmode & FB_VMODE_YWRAP)
3134 + info->var.vmode |= FB_VMODE_YWRAP;
3136 + info->var.vmode &= ~FB_VMODE_YWRAP;
3141 +static int foxfb_mmap(struct fb_info *info, struct file *file, struct vm_area_struct *vma){
3142 + unsigned long page, pos;
3143 + unsigned long start = vma->vm_start;
3144 + unsigned long size = vma->vm_end-vma->vm_start;
3145 + fb_mmap_enable = 1;
3146 + printk("mmap : %ld %ld\n", size, (long)info->fix.smem_len);
3147 + //if (size > info->fix.smem_len){
3148 + // return -EINVAL;
3150 + pos = (unsigned long) info->screen_base;
3151 + while (size > 0) {
3152 + page = page_to_pfn(vmalloc_to_page((void *)pos));
3153 + if (remap_pfn_range(vma, start, page, PAGE_SIZE, PAGE_SHARED))
3155 + start += PAGE_SIZE;
3157 + if (size > PAGE_SIZE)
3158 + size -= PAGE_SIZE;
3167 +struct timer_list foxfb_timer;
3169 +// are we currently blitting ?
3170 +static unsigned char we_are_blitting = 0;
3172 +// the prototype for the callback
3173 +static void foxfb_timer_callback(unsigned long ptr);
3176 +static void tasklet_foxfb(unsigned long data);
3177 +DECLARE_TASKLET(tl_foxfb_descr, tasklet_foxfb, 0L);
3178 +static void tasklet_foxfb(unsigned long data){
3179 + if(fb_update || fb_mmap_enable ){
3180 + FOXVHDL_blit(videomemory);
3182 + DBG(printk("FBWAIT");)
3184 + we_are_blitting = 0;
3189 +// setup the fb timer
3190 +static void foxfb_timer_setup(void){
3191 + init_timer(&foxfb_timer);
3192 + foxfb_timer.function = foxfb_timer_callback;
3193 + foxfb_timer.data = 0;
3194 + foxfb_timer.expires = jiffies + ( HZ / refreshrate);
3195 + add_timer(&foxfb_timer);
3199 +// the timer callback function that detects if the card status has changed
3200 +static void foxfb_timer_callback(unsigned long ptr){
3201 + if((!we_are_blitting)){
3202 + we_are_blitting = 1;
3203 + del_timer(&foxfb_timer);
3204 + tasklet_schedule(&tl_foxfb_descr);
3205 + foxfb_timer_setup();
3210 +static void foxfb_platform_release(struct device *device){
3211 + // This is called when the reference count goes to zero.
3215 +static int __init foxfb_probe(struct platform_device *dev){
3216 + struct fb_info *info;
3217 + int retval = -ENOMEM;
3219 + if (!(videomemory = vmalloc(videomemorysize)))
3222 + memset(videomemory, 0, videomemorysize);
3224 + info = framebuffer_alloc(sizeof(u32) * 256, &dev->dev);
3228 + info->screen_base = (char*)videomemory;
3229 + info->fbops = &foxfb_ops;
3230 + info->fix.smem_len = videomemorysize;
3231 + retval = fb_find_mode(&info->var, info, NULL,
3232 + NULL, 0, NULL, 8);
3234 + if (!retval || (retval == 4))
3235 + info->var = foxfb_default;
3237 + info->fix = foxfb_fix;
3238 + info->pseudo_palette = info->par;
3240 + info->flags = FBINFO_FLAG_DEFAULT;
3241 + //info->cursor.mode &= ~CURSOR_BLINK;
3242 + retval = fb_alloc_cmap(&info->cmap, 256, 0);
3246 + retval = register_framebuffer(info);
3249 + platform_set_drvdata(dev, info);
3252 + "fb%d: FOX-VHDL frame buffer device, using %ldK of video memory\n",
3253 + info->node, videomemorysize >> 10);
3256 + //FOXVHDL_blit(videomemory);
3257 + foxfb_timer_setup();
3260 + fb_dealloc_cmap(&info->cmap);
3262 + framebuffer_release(info);
3264 + vfree(videomemory);
3268 +static int foxfb_remove(struct platform_device *dev)
3270 + struct fb_info *info = platform_get_drvdata(dev);
3273 + unregister_framebuffer(info);
3274 + vfree(videomemory);
3275 + framebuffer_release(info);
3280 +static struct platform_driver foxfb_driver = {
3281 + .probe = foxfb_probe,
3282 + .remove = foxfb_remove,
3288 +static struct platform_device foxfb_device = {
3292 + .release = foxfb_platform_release,
3296 +static int __init foxfb_init(void)
3300 + printk(KERN_INFO "fb: Initialising framebuffer\n");
3304 + ret = platform_driver_register(&foxfb_driver);
3307 + ret = platform_device_register(&foxfb_device);
3309 + platform_driver_unregister(&foxfb_driver);
3315 +static void __exit foxfb_exit(void)
3317 + platform_device_unregister(&foxfb_device);
3318 + platform_driver_unregister(&foxfb_driver);
3321 +module_exit(foxfb_exit);
3322 +module_init(foxfb_init);
3323 +MODULE_LICENSE("GPL");
3324 +MODULE_AUTHOR("K. John '2B|!2B' Crispin");
3325 +MODULE_DESCRIPTION("FOX-VHDL Framebuffer Driver");
3326 diff -urN linux-2.6.19.2.orig/drivers/fox-vhdl/fox_vhdl_fb/Makefile linux-2.6.19.2/drivers/fox-vhdl/fox_vhdl_fb/Makefile
3327 --- linux-2.6.19.2.orig/drivers/fox-vhdl/fox_vhdl_fb/Makefile 1970-01-01 01:00:00.000000000 +0100
3328 +++ linux-2.6.19.2/drivers/fox-vhdl/fox_vhdl_fb/Makefile 2007-06-17 02:46:15.000000000 +0200
3330 +# Makefile for fox_vhdl drivers
3331 +# 23.04.2006 <mailto:john@phrozen.org>
3333 +# the fox_vhdl_framebuffer driver
3334 +obj-$(CONFIG_FOX_VHDL_FB) += foxvhdlfb.o
3335 diff -urN linux-2.6.19.2.orig/drivers/fox-vhdl/Kconfig linux-2.6.19.2/drivers/fox-vhdl/Kconfig
3336 --- linux-2.6.19.2.orig/drivers/fox-vhdl/Kconfig 1970-01-01 01:00:00.000000000 +0100
3337 +++ linux-2.6.19.2/drivers/fox-vhdl/Kconfig 2007-06-17 02:46:15.000000000 +0200
3339 +menu "Acmesystems FPGA"
3342 + bool "Support for FOX-VHDL Board"
3346 + bool "FPGA flash module"
3347 + depends on FOX_VHDL
3349 + Adds the module needed to flash the fpga from the FOX
3352 + bool "Basic FOXBONE support"
3353 + depends on FOX_VHDL
3355 + Include this to get basic FOXBONE support
3358 + bool "Virtual terminal (needed for framebuffer)" if EMBEDDED
3360 + default y if !VIOCONS
3362 + If you say Y here, you will get support for terminal devices with
3363 + display and keyboard devices. These are called "virtual" because you
3364 + can run several virtual terminals (also called virtual consoles) on
3365 + one physical terminal. This is rather useful, for example one
3366 + virtual terminal can collect system messages and warnings, another
3367 + one can be used for a text-mode user session, and a third could run
3368 + an X session, all in parallel. Switching between virtual terminals
3369 + is done with certain key combinations, usually Alt-<function key>.
3371 + The setterm command ("man setterm") can be used to change the
3372 + properties (such as colors or beeping) of a virtual terminal. The
3373 + man page console_codes(4) ("man console_codes") contains the special
3374 + character sequences that can be used to change those properties
3375 + directly. The fonts used on virtual terminals can be changed with
3376 + the setfont ("man setfont") command and the key bindings are defined
3377 + with the loadkeys ("man loadkeys") command.
3379 + You need at least one virtual terminal device in order to make use
3380 + of your keyboard and monitor. Therefore, only people configuring an
3381 + embedded system would want to say N here in order to save some
3382 + memory; the only way to log into such a system is then via a serial
3383 + or network connection.
3385 + If unsure, say Y, or else you won't be able to do much with your new
3386 + shiny Linux system :-)
3393 + bool "Support for frame buffer devices"
3396 + The frame buffer device provides an abstraction for the graphics
3397 + hardware. It represents the frame buffer of some video hardware and
3398 + allows application software to access the graphics hardware through
3399 + a well-defined interface, so the software doesn't need to know
3400 + anything about the low-level (hardware register) stuff.
3402 + Frame buffer devices work identically across the different
3403 + architectures supported by Linux and make the implementation of
3404 + application programs easier and more portable; at this point, an X
3405 + server exists which uses the frame buffer device exclusively.
3406 + On several non-X86 architectures, the frame buffer device is the
3407 + only way to use the graphics hardware.
3409 + The device is accessed through special device nodes, usually located
3410 + in the /dev directory, i.e. /dev/fb*.
3412 + You need an utility program called fbset to make full use of frame
3413 + buffer devices. Please read <file:Documentation/fb/framebuffer.txt>
3414 + and the Framebuffer-HOWTO at
3415 + <http://www.tahallah.demon.co.uk/programming/prog.html> for more
3418 + Say Y here and to the driver for your graphics board below if you
3419 + are compiling a kernel for a non-x86 architecture.
3421 + If you are compiling for the x86 architecture, you can say Y if you
3422 + want to play with it, but it is not essential. Please note that
3423 + running graphical applications that directly touch the hardware
3424 + (e.g. an accelerated X server) and that are not frame buffer
3425 + device-aware may cause unexpected results. If unsure, say N.
3427 +config FB_CFB_FILLRECT
3432 + Include the cfb_fillrect function for generic software rectangle
3433 + filling. This is used by drivers that don't provide their own
3434 + (accelerated) version.
3436 +config FB_CFB_COPYAREA
3441 + Include the cfb_copyarea function for generic software area copying.
3442 + This is used by drivers that don't provide their own (accelerated)
3445 +config FB_CFB_IMAGEBLIT
3450 + Include the cfb_imageblit function for generic software image
3451 + blitting. This is used by drivers that don't provide their own
3452 + (accelerated) version.
3453 +config DUMMY_CONSOLE
3454 + bool "Dummy Console"
3456 + #PROM_CONSOLE!=y || VGA_CONSOLE!=y || SGI_NEWPORT_CONSOLE!=y
3459 +config FRAMEBUFFER_CONSOLE
3460 + bool "Framebuffer Console support"
3464 + Low-level framebuffer-based console driver.
3466 + bool "Bootup logo"
3467 + depends on FB || SGI_NEWPORT_CONSOLE
3469 + Enable and select frame buffer bootup logos.
3471 +config LOGO_LINUX_CLUT224
3472 + bool "Standard 224-color Linux logo"
3476 + bool "Select compiled-in fonts"
3477 + depends on FRAMEBUFFER_CONSOLE || STI_CONSOLE
3479 + Say Y here if you would like to use fonts other than the default
3480 + your frame buffer console usually use.
3482 + Note that the answer to this question won't directly affect the
3483 + kernel: saying N will just cause the configurator to skip all
3484 + the questions about foreign fonts.
3486 + If unsure, say N (the default choices are safe).
3489 + bool "VGA 8x8 font" if FONTS
3490 + depends on FRAMEBUFFER_CONSOLE || STI_CONSOLE
3491 + default y if !SPARC && !FONTS
3493 + This is the "high resolution" font for the VGA frame buffer (the one
3494 + provided by the text console 80x50 (and higher) modes).
3496 + Note that this is a poor quality font. The VGA 8x16 font is quite a
3497 + lot more readable.
3499 + Given the resolution provided by the frame buffer device, answer N
3503 + bool "VGA 8x16 font" if FONTS
3504 + depends on FRAMEBUFFER_CONSOLE || SGI_NEWPORT_CONSOLE=y || STI_CONSOLE || USB_SISUSBVGA_CON
3505 + default y if !SPARC && !FONTS
3507 + This is the "high resolution" font for the VGA frame buffer (the one
3508 + provided by the VGA text console 80x25 mode.
3514 + bool "FOX_VHDL Framebuffer"
3515 + depends on FOXBONE
3517 + select FB_CFB_FILLRECT
3518 + select FB_CFB_COPYAREA
3519 + select FB_CFB_IMAGEBLIT
3521 + select DUMMY_CONSOLE
3522 + select FRAMEBUFFER_CONSOLE
3525 + select LOGO_LINUX_CLUT224
3528 + bool "nano-X keyboard support"
3530 + depends on FOX_VHDL_FB
3532 + Enable the keyboard driver patches for nano-X
3537 + #source "drivers/video/console/Kconfig"
3541 +# source "drivers/video/logo/Kconfig"
3548 + bool "FOXBONE I/O pins"
3549 + depends on FOXBONE
3551 + Include this to get access to the I/O pins of the foxbone
3553 +config FOXBONE_TIMEBASE
3554 + bool "FOXBONE Timebase"
3555 + depends on FOXBONE
3557 + Include this to get access to the timebase part of the fpga
3560 + bool "FOXBONE MMC/SD module"
3561 + depends on FOXBONE
3563 + Include this to be able to access a mmc/sd card connected to J3 of the fox-vhdl board
3566 + bool "FOXBONE PWM module"
3567 + depends on FOXBONE
3569 + Include this to enable PWM support into the kernel
3571 +config FOXBONE_EVENT
3572 + bool "FOXBONE EVENT counter module"
3573 + depends on FOXBONE
3575 + Include this to enable foxbone event counter support
3577 +config FOXBONE_LOOPBACK
3578 + bool "FOXBONE Loopback module"
3579 + depends on FOXBONE
3581 + Include this to be able to load the loopback module, that you can base your own driver on
3583 +config FOXBONE_MULTIPLY
3584 + bool "FOXBONE Multiplier example"
3585 + depends on FOXBONE
3587 + Include this to use the 64 bit multiplier
3589 +menu "FOXBONE interrupt handlers"
3590 +config FOXBONE_SAMPLE_ISR
3591 + bool "FOXBONE example interrupt handlers"
3592 + depends on FOXBONE
3594 +config FOXBONE_INT14
3595 + bool "Int 14 - bit 0 of reg 0x13 set"
3596 + depends on FOXBONE_SAMPLE_ISR
3598 +config FOXBONE_INT31
3599 + bool "Int 31 - bit 1 of reg 0x13 set"
3600 + depends on FOXBONE_SAMPLE_ISR
3605 +config ETRAX_CMDLINE
3606 + string "Kernel command line"
3607 + default "root=/dev/mtdblock3 init=/linuxrc console=ttyS0"
3609 + use if no framebuffer is enabled console=ttyS0
3610 + use if framebuffer is enabled console=tty0
3613 diff -urN linux-2.6.19.2.orig/drivers/fox-vhdl/keyboard/Makefile linux-2.6.19.2/drivers/fox-vhdl/keyboard/Makefile
3614 --- linux-2.6.19.2.orig/drivers/fox-vhdl/keyboard/Makefile 1970-01-01 01:00:00.000000000 +0100
3615 +++ linux-2.6.19.2/drivers/fox-vhdl/keyboard/Makefile 2007-06-17 02:46:15.000000000 +0200
3617 +obj-$(CONFIG_NANOXKBD) += nanoxkbd.o
3618 diff -urN linux-2.6.19.2.orig/drivers/fox-vhdl/keyboard/nanoxkbd.c linux-2.6.19.2/drivers/fox-vhdl/keyboard/nanoxkbd.c
3619 --- linux-2.6.19.2.orig/drivers/fox-vhdl/keyboard/nanoxkbd.c 1970-01-01 01:00:00.000000000 +0100
3620 +++ linux-2.6.19.2/drivers/fox-vhdl/keyboard/nanoxkbd.c 2007-06-17 02:46:15.000000000 +0200
3624 + Linux Kernel Driver for Nanox Keyboard driver for FOX VHDL Board framebuffer
3625 + (based on FoxBone protocol interface specifications rel 0.7)
3626 + For more info see: http://www.acmesystems.it/?id=120
3627 + Author: John Crispin
3628 + Copyright (C) 2006 Phrozen (http://www.phrozen.biz)
3630 + This is free software; you can redistribute it and/or modify
3631 + it under the terms of the GNU General Public License as published by
3632 + the Free Software Foundation; either version 2 of the License, or
3633 + (at your option) any later version.
3635 + This example is distributed in the hope that it will be useful,
3636 + but WITHOUT ANY WARRANTY; without even the implied warranty of
3637 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3638 + GNU General Public License for more details.
3640 + To have a copy of the GNU General Public License write to the Free Software
3641 + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
3645 +#include <linux/module.h>
3646 +#include <linux/init.h>
3647 +#include <linux/module.h>
3648 +#include <linux/errno.h>
3649 +#include <linux/ioport.h>
3650 +#include <linux/version.h>
3651 +#include <linux/init.h>
3652 +#include <asm/uaccess.h>
3653 +#include <asm/io.h>
3654 +#include <linux/vmalloc.h>
3655 +#include <linux/ioport.h>
3656 +#include <linux/init.h>
3657 +#include <linux/genhd.h>
3659 +#define DEV_NAME "keyboard"
3660 +#define DEV_MAJOR 195
3663 +unsigned char nanoxkbd_is_open = 0;
3665 +#define MAX_KEYS 128
3666 +unsigned int keys[MAX_KEYS];
3667 +unsigned char keys_count = 0;
3668 +unsigned char keys_pos = 0;
3670 +#define IOCTL_NANOXKBD_GET 0x7878
3672 +unsigned char nanoxkbd_add(unsigned int keycode){
3673 + if(nanoxkbd_is_open){
3674 + if(keys_count < MAX_KEYS){
3675 + keys[(keys_pos + keys_count) % MAX_KEYS] = keycode;
3677 + printk("got key %d, %d, %d\n", keycode, keys_pos, keys_count);
3684 +// the app has send us some control data
3685 +static int module_ioctl(struct inode * inode, struct file * file, unsigned int cmd, unsigned long arg){
3686 + //copy_to_user((char*)arg, (char*)&audio_data, sizeof(AUDIO_DATA));
3687 + //copy_from_user((char*)&mp3_beep, (char*)arg, sizeof(MP3_BEEP));
3690 + case IOCTL_NANOXKBD_GET:
3691 + if(keys_count > 0){
3693 + copy_to_user((char*)arg, (char*)&keys[keys_pos], sizeof(unsigned int));
3695 + if(keys_pos >= MAX_KEYS){
3703 + printk("nanoxkbd: unknown ioctl\n");
3712 +static int module_open(struct inode *inode, struct file *file){
3713 + // Which minor device is the user trying to access ?
3714 + unsigned int dev_minor = MINOR(inode->i_rdev);
3716 + // we only supprt minor 0 at the moment
3717 + if(dev_minor != 0){
3718 + printk("nanoxkbd: trying to access unknown minor device -> %d\n", dev_minor);
3722 + // check if another app is currently using the device
3723 + if(nanoxkbd_is_open) {
3724 + printk("nanoxkbd: Device with minor ID %d already in use\n", dev_minor);
3727 + nanoxkbd_is_open = 1;
3730 + printk("nanoxkbd: Minor %d has been opened\n", dev_minor);
3735 +// gets called when an app closes the device
3736 +static int module_close(struct inode * inode, struct file * file){
3737 + // Which minor device is the user trying to access ?
3738 + unsigned int dev_minor = MINOR(inode->i_rdev);
3740 + // remember that the device has been closed
3741 + nanoxkbd_is_open = 0;
3745 + printk("nanoxkbd: Minor %d has been closed\n", dev_minor);
3750 +// so the kernel knows which functions to access for a given operation
3751 +struct file_operations nanoxkbd_module_fops = {
3752 + ioctl: module_ioctl,
3753 + open: module_open,
3754 + release: module_close
3758 +// module gets loaded into kernel / char dev is registered
3759 +static int __init mod_init(void){
3760 + // flame the kprintk
3761 + printk("nanoxkbd: FOX-VHDL FPGA io module\n");
3762 + //printk("nanoxkbd: Made by K. John '2B|!2B' Crispin (john@phrozen.org)\n");
3763 + //printk("nanoxkbd: Starting ...\n");
3765 + // register the character device
3766 + if(register_chrdev(DEV_MAJOR, DEV_NAME, &nanoxkbd_module_fops)) {
3767 + printk( "nanoxkbd: Error whilst opening %s (%d)\n", DEV_NAME, DEV_MAJOR);
3768 + return( -ENODEV );
3772 + // remember that the driver has been opened
3773 + nanoxkbd_is_open = 0;
3774 + printk("nanoxkbd: Device %s registered for major ID %d\n", DEV_NAME, DEV_MAJOR);
3779 +// we are done so shut everything down
3780 +static void __exit mod_exit(void){
3781 + printk( "nanoxkbd: Cleanup\n" );
3782 + // tell the kernel that the device is not needed anymore
3783 + unregister_chrdev(DEV_MAJOR, DEV_NAME);
3787 +module_init (mod_init);
3788 +module_exit (mod_exit);
3795 diff -urN linux-2.6.19.2.orig/drivers/fox-vhdl/Makefile linux-2.6.19.2/drivers/fox-vhdl/Makefile
3796 --- linux-2.6.19.2.orig/drivers/fox-vhdl/Makefile 1970-01-01 01:00:00.000000000 +0100
3797 +++ linux-2.6.19.2/drivers/fox-vhdl/Makefile 2007-06-17 02:46:15.000000000 +0200
3800 +# Makefile for the i2c core.
3802 +obj-$(CONFIG_FOXBONE) += foxbone/
3803 +obj-$(CONFIG_FOX_VHDL_FB) += fox_vhdl_fb/
3804 +obj-$(CONFIG_FOX_FPGA) += fox_fpga_flash/
3805 +obj-$(CONFIG_FOXBONE_PWM) += fox_pwm/
3806 +obj-$(CONFIG_FOXBONE_IO) += fox_io/
3807 +obj-$(CONFIG_FOXBONE_TIMEBASE) += fox_timebase/
3808 +obj-$(CONFIG_FOXBONE_LOOPBACK) += fox_loopback/
3809 +obj-$(CONFIG_FOXBONE_EVENT) += fox_event/
3810 +obj-$(CONFIG_FOXBONE_MULTIPLY) += fox_multiply/
3811 +obj-$(CONFIG_NANOXKBD) += keyboard/
3812 --- linux-2.6.19.2.orig/arch/cris/Kconfig 2007-06-16 23:58:14.000000000 +0200
3813 +++ linux-2.6.19.2/drivers/fox-vhdl/Kconfig 2007-06-17 02:46:15.000000000 +0200
3816 -# For a description of the syntax of this configuration file,
3817 -# see the Configure script.
3819 +menu "Acmesystems FPGA"
3821 -mainmenu "Linux/CRIS Kernel Configuration"
3827 -config RWSEM_GENERIC_SPINLOCK
3831 -config RWSEM_XCHGADD_ALGORITHM
3834 -config GENERIC_IOMAP
3838 -config GENERIC_FIND_NEXT_BIT
3842 -config GENERIC_HWEIGHT
3845 + bool "Support for FOX-VHDL Board"
3849 + bool "FPGA flash module"
3850 + depends on FOX_VHDL
3852 + Adds the module needed to flash the fpga from the FOX
3855 + bool "Basic FOXBONE support"
3856 + depends on FOX_VHDL
3858 + Include this to get basic FOXBONE support
3861 + bool "Virtual terminal (needed for framebuffer)" if EMBEDDED
3863 + default y if !VIOCONS
3865 + If you say Y here, you will get support for terminal devices with
3866 + display and keyboard devices. These are called "virtual" because you
3867 + can run several virtual terminals (also called virtual consoles) on
3868 + one physical terminal. This is rather useful, for example one
3869 + virtual terminal can collect system messages and warnings, another
3870 + one can be used for a text-mode user session, and a third could run
3871 + an X session, all in parallel. Switching between virtual terminals
3872 + is done with certain key combinations, usually Alt-<function key>.
3874 + The setterm command ("man setterm") can be used to change the
3875 + properties (such as colors or beeping) of a virtual terminal. The
3876 + man page console_codes(4) ("man console_codes") contains the special
3877 + character sequences that can be used to change those properties
3878 + directly. The fonts used on virtual terminals can be changed with
3879 + the setfont ("man setfont") command and the key bindings are defined
3880 + with the loadkeys ("man loadkeys") command.
3882 + You need at least one virtual terminal device in order to make use
3883 + of your keyboard and monitor. Therefore, only people configuring an
3884 + embedded system would want to say N here in order to save some
3885 + memory; the only way to log into such a system is then via a serial
3886 + or network connection.
3888 + If unsure, say Y, or else you won't be able to do much with your new
3889 + shiny Linux system :-)
3896 + bool "Support for frame buffer devices"
3899 + The frame buffer device provides an abstraction for the graphics
3900 + hardware. It represents the frame buffer of some video hardware and
3901 + allows application software to access the graphics hardware through
3902 + a well-defined interface, so the software doesn't need to know
3903 + anything about the low-level (hardware register) stuff.
3905 + Frame buffer devices work identically across the different
3906 + architectures supported by Linux and make the implementation of
3907 + application programs easier and more portable; at this point, an X
3908 + server exists which uses the frame buffer device exclusively.
3909 + On several non-X86 architectures, the frame buffer device is the
3910 + only way to use the graphics hardware.
3912 + The device is accessed through special device nodes, usually located
3913 + in the /dev directory, i.e. /dev/fb*.
3915 + You need an utility program called fbset to make full use of frame
3916 + buffer devices. Please read <file:Documentation/fb/framebuffer.txt>
3917 + and the Framebuffer-HOWTO at
3918 + <http://www.tahallah.demon.co.uk/programming/prog.html> for more
3921 + Say Y here and to the driver for your graphics board below if you
3922 + are compiling a kernel for a non-x86 architecture.
3924 + If you are compiling for the x86 architecture, you can say Y if you
3925 + want to play with it, but it is not essential. Please note that
3926 + running graphical applications that directly touch the hardware
3927 + (e.g. an accelerated X server) and that are not frame buffer
3928 + device-aware may cause unexpected results. If unsure, say N.
3930 +config FB_CFB_FILLRECT
3935 + Include the cfb_fillrect function for generic software rectangle
3936 + filling. This is used by drivers that don't provide their own
3937 + (accelerated) version.
3939 +config FB_CFB_COPYAREA
3944 + Include the cfb_copyarea function for generic software area copying.
3945 + This is used by drivers that don't provide their own (accelerated)
3948 +config FB_CFB_IMAGEBLIT
3953 + Include the cfb_imageblit function for generic software image
3954 + blitting. This is used by drivers that don't provide their own
3955 + (accelerated) version.
3956 +config DUMMY_CONSOLE
3957 + bool "Dummy Console"
3959 + #PROM_CONSOLE!=y || VGA_CONSOLE!=y || SGI_NEWPORT_CONSOLE!=y
3962 +config FRAMEBUFFER_CONSOLE
3963 + bool "Framebuffer Console support"
3967 + Low-level framebuffer-based console driver.
3969 + bool "Bootup logo"
3970 + depends on FB || SGI_NEWPORT_CONSOLE
3972 + Enable and select frame buffer bootup logos.
3974 +config LOGO_LINUX_CLUT224
3975 + bool "Standard 224-color Linux logo"
3979 -config GENERIC_CALIBRATE_DELAY
3991 -source "init/Kconfig"
3993 -menu "General setup"
3995 -source "fs/Kconfig.binfmt"
3997 -config GENERIC_HARDIRQS
4004 - SMP support. Always Say N.
4012 - bool "Multi-core scheduler support"
4016 - Multi-core scheduler support improves the CPU scheduler's decision
4017 - making when dealing with multi-core CPU chips at a cost of slightly
4018 - increased overhead in some places. If unsure say N here.
4020 -config ETRAX_CMDLINE
4021 - string "Kernel command line"
4022 - default "root=/dev/mtdblock3"
4024 - Pass additional commands to the kernel.
4026 -config ETRAX_WATCHDOG
4027 - bool "Enable ETRAX watchdog"
4029 - Enable the built-in watchdog timer support on ETRAX based embedded
4030 - network computers.
4032 -config ETRAX_WATCHDOG_NICE_DOGGY
4033 - bool "Disable watchdog during Oops printouts"
4034 - depends on ETRAX_WATCHDOG
4036 - By enabling this you make sure that the watchdog does not bite while
4037 - printing oopses. Recommended for development systems but not for
4038 - production releases.
4040 -config ETRAX_FAST_TIMER
4041 - bool "Enable ETRAX fast timer API"
4043 - This options enables the API to a fast timer implementation using
4044 - timer1 to get sub jiffie resolution timers (primarily one-shot
4046 - This is needed if CONFIG_ETRAX_SERIAL_FAST_TIMER is enabled.
4049 - bool "Enable reboot at out of memory"
4051 -source "kernel/Kconfig.preempt"
4052 -source "kernel/Kconfig.sched"
4056 + bool "Select compiled-in fonts"
4057 + depends on FRAMEBUFFER_CONSOLE || STI_CONSOLE
4059 + Say Y here if you would like to use fonts other than the default
4060 + your frame buffer console usually use.
4062 + Note that the answer to this question won't directly affect the
4063 + kernel: saying N will just cause the configurator to skip all
4064 + the questions about foreign fonts.
4066 + If unsure, say N (the default choices are safe).
4069 + bool "VGA 8x8 font" if FONTS
4070 + depends on FRAMEBUFFER_CONSOLE || STI_CONSOLE
4071 + default y if !SPARC && !FONTS
4073 + This is the "high resolution" font for the VGA frame buffer (the one
4074 + provided by the text console 80x50 (and higher) modes).
4076 + Note that this is a poor quality font. The VGA 8x16 font is quite a
4077 + lot more readable.
4079 + Given the resolution provided by the frame buffer device, answer N
4083 + bool "VGA 8x16 font" if FONTS
4084 + depends on FRAMEBUFFER_CONSOLE || SGI_NEWPORT_CONSOLE=y || STI_CONSOLE || USB_SISUSBVGA_CON
4085 + default y if !SPARC && !FONTS
4087 + This is the "high resolution" font for the VGA frame buffer (the one
4088 + provided by the VGA text console 80x25 mode.
4094 + bool "FOX_VHDL Framebuffer"
4095 + depends on FOXBONE
4097 + select FB_CFB_FILLRECT
4098 + select FB_CFB_COPYAREA
4099 + select FB_CFB_IMAGEBLIT
4101 + select DUMMY_CONSOLE
4102 + select FRAMEBUFFER_CONSOLE
4105 + select LOGO_LINUX_CLUT224
4108 + bool "nano-X keyboard support"
4110 + depends on FOX_VHDL_FB
4112 + Enable the keyboard driver patches for nano-X
4117 + #source "drivers/video/console/Kconfig"
4121 +# source "drivers/video/logo/Kconfig"
4126 -menu "Hardware setup"
4129 - prompt "Processor type"
4130 - default ETRAX100LX
4133 - bool "ETRAX-100LX-v1"
4135 + bool "FOXBONE I/O pins"
4136 + depends on FOXBONE
4138 - Support version 1 of the ETRAX 100LX.
4139 + Include this to get access to the I/O pins of the foxbone
4141 -config ETRAX100LX_V2
4142 - bool "ETRAX-100LX-v2"
4143 +config FOXBONE_TIMEBASE
4144 + bool "FOXBONE Timebase"
4145 + depends on FOXBONE
4147 - Support version 2 of the ETRAX 100LX.
4148 + Include this to get access to the timebase part of the fpga
4151 - bool "ETRAX-100LX-for-xsim-simulator"
4153 + bool "FOXBONE MMC/SD module"
4154 + depends on FOXBONE
4156 - Support the xsim ETRAX Simulator.
4157 + Include this to be able to access a mmc/sd card connected to J3 of the fox-vhdl board
4160 - bool "ETRAX-FS-V32"
4162 + bool "FOXBONE PWM module"
4163 + depends on FOXBONE
4166 + Include this to enable PWM support into the kernel
4169 - bool "ETRAX-FS-V32-Simulator"
4170 +config FOXBONE_EVENT
4171 + bool "FOXBONE EVENT counter module"
4172 + depends on FOXBONE
4174 - Support CRIS V32 VCS simualtor.
4175 + Include this to enable foxbone event counter support
4179 -config ETRAX_ARCH_V10
4181 - default y if ETRAX100LX || ETRAX100LX_V2
4182 - default n if !(ETRAX100LX || ETRAX100LX_V2)
4184 -config ETRAX_ARCH_V32
4186 - default y if ETRAXFS || ETRAXFS_SIM
4187 - default n if !(ETRAXFS || ETRAXFS_SIM)
4189 -config ETRAX_DRAM_SIZE
4190 - int "DRAM size (dec, in MB)"
4192 +config FOXBONE_LOOPBACK
4193 + bool "FOXBONE Loopback module"
4194 + depends on FOXBONE
4196 - Size of DRAM (decimal in MB) typically 2, 8 or 16.
4197 + Include this to be able to load the loopback module, that you can base your own driver on
4199 -config ETRAX_FLASH_BUSWIDTH
4200 - int "Buswidth of NOR flash in bytes"
4202 +config FOXBONE_MULTIPLY
4203 + bool "FOXBONE Multiplier example"
4204 + depends on FOXBONE
4206 - Width in bytes of the NOR Flash bus (1, 2 or 4). Is usually 2.
4207 + Include this to use the 64 bit multiplier
4209 -config ETRAX_NANDFLASH_BUSWIDTH
4210 - int "Buswidth of NAND flash in bytes"
4213 - Width in bytes of the NAND flash (1 or 2).
4214 +menu "FOXBONE interrupt handlers"
4215 +config FOXBONE_SAMPLE_ISR
4216 + bool "FOXBONE example interrupt handlers"
4217 + depends on FOXBONE
4219 +config FOXBONE_INT14
4220 + bool "Int 14 - bit 0 of reg 0x13 set"
4221 + depends on FOXBONE_SAMPLE_ISR
4223 -config ETRAX_FLASH1_SIZE
4224 - int "FLASH1 size (dec, in MB. 0 = Unknown)"
4226 +config FOXBONE_INT31
4227 + bool "Int 31 - bit 1 of reg 0x13 set"
4228 + depends on FOXBONE_SAMPLE_ISR
4230 -# arch/cris/arch is a symlink to correct arch (arch-v10 or arch-v32)
4231 -source arch/cris/arch/Kconfig
4236 -source "net/Kconfig"
4238 -# bring in ETRAX built-in drivers
4239 -menu "Drivers for built-in interfaces"
4240 -# arch/cris/arch is a symlink to correct arch (arch-v10 or arch-v32)
4241 -source arch/cris/arch/drivers/Kconfig
4243 +config ETRAX_CMDLINE
4244 + string "Kernel command line"
4245 + default "root=/dev/mtdblock3 init=/linuxrc console=ttyS0"
4247 + use if no framebuffer is enabled console=ttyS0
4248 + use if framebuffer is enabled console=tty0
4252 -source "drivers/base/Kconfig"
4254 -# standard linux drivers
4255 -source "drivers/mtd/Kconfig"
4257 -source "drivers/parport/Kconfig"
4259 -source "drivers/pnp/Kconfig"
4261 -source "drivers/block/Kconfig"
4263 -source "drivers/md/Kconfig"
4265 -source "drivers/ide/Kconfig"
4267 -source "drivers/scsi/Kconfig"
4269 -source "drivers/ieee1394/Kconfig"
4271 -source "drivers/message/i2o/Kconfig"
4273 -source "drivers/net/Kconfig"
4275 -source "drivers/isdn/Kconfig"
4277 -source "drivers/telephony/Kconfig"
4279 -source "drivers/cdrom/Kconfig"
4282 -# input before char - char/joystick depends on it. As does USB.
4284 -source "drivers/input/Kconfig"
4286 -source "drivers/char/Kconfig"
4288 -#source drivers/misc/Config.in
4289 -source "drivers/media/Kconfig"
4291 -source "fs/Kconfig"
4293 -source "sound/Kconfig"
4295 -source "drivers/pcmcia/Kconfig"
4297 -source "drivers/pci/Kconfig"
4299 -source "drivers/usb/Kconfig"
4301 -source "arch/cris/Kconfig.debug"
4303 -source "security/Kconfig"
4305 -source "crypto/Kconfig"
4307 -source "lib/Kconfig"
4308 --- linux-2.6.19.2.orig/arch/cris/Kconfig 2007-06-16 23:58:14.000000000 +0200
4309 +++ linux-2.6.19.2/drivers/fox-vhdl/Kconfig 2007-06-17 02:46:15.000000000 +0200
4312 -# For a description of the syntax of this configuration file,
4313 -# see the Configure script.
4315 +menu "Acmesystems FPGA"
4317 -mainmenu "Linux/CRIS Kernel Configuration"
4323 -config RWSEM_GENERIC_SPINLOCK
4327 -config RWSEM_XCHGADD_ALGORITHM
4330 -config GENERIC_IOMAP
4334 -config GENERIC_FIND_NEXT_BIT
4338 -config GENERIC_HWEIGHT
4341 + bool "Support for FOX-VHDL Board"
4345 + bool "FPGA flash module"
4346 + depends on FOX_VHDL
4348 + Adds the module needed to flash the fpga from the FOX
4351 + bool "Basic FOXBONE support"
4352 + depends on FOX_VHDL
4354 + Include this to get basic FOXBONE support
4357 + bool "Virtual terminal (needed for framebuffer)" if EMBEDDED
4359 + default y if !VIOCONS
4361 + If you say Y here, you will get support for terminal devices with
4362 + display and keyboard devices. These are called "virtual" because you
4363 + can run several virtual terminals (also called virtual consoles) on
4364 + one physical terminal. This is rather useful, for example one
4365 + virtual terminal can collect system messages and warnings, another
4366 + one can be used for a text-mode user session, and a third could run
4367 + an X session, all in parallel. Switching between virtual terminals
4368 + is done with certain key combinations, usually Alt-<function key>.
4370 + The setterm command ("man setterm") can be used to change the
4371 + properties (such as colors or beeping) of a virtual terminal. The
4372 + man page console_codes(4) ("man console_codes") contains the special
4373 + character sequences that can be used to change those properties
4374 + directly. The fonts used on virtual terminals can be changed with
4375 + the setfont ("man setfont") command and the key bindings are defined
4376 + with the loadkeys ("man loadkeys") command.
4378 + You need at least one virtual terminal device in order to make use
4379 + of your keyboard and monitor. Therefore, only people configuring an
4380 + embedded system would want to say N here in order to save some
4381 + memory; the only way to log into such a system is then via a serial
4382 + or network connection.
4384 + If unsure, say Y, or else you won't be able to do much with your new
4385 + shiny Linux system :-)
4392 + bool "Support for frame buffer devices"
4395 + The frame buffer device provides an abstraction for the graphics
4396 + hardware. It represents the frame buffer of some video hardware and
4397 + allows application software to access the graphics hardware through
4398 + a well-defined interface, so the software doesn't need to know
4399 + anything about the low-level (hardware register) stuff.
4401 + Frame buffer devices work identically across the different
4402 + architectures supported by Linux and make the implementation of
4403 + application programs easier and more portable; at this point, an X
4404 + server exists which uses the frame buffer device exclusively.
4405 + On several non-X86 architectures, the frame buffer device is the
4406 + only way to use the graphics hardware.
4408 + The device is accessed through special device nodes, usually located
4409 + in the /dev directory, i.e. /dev/fb*.
4411 + You need an utility program called fbset to make full use of frame
4412 + buffer devices. Please read <file:Documentation/fb/framebuffer.txt>
4413 + and the Framebuffer-HOWTO at
4414 + <http://www.tahallah.demon.co.uk/programming/prog.html> for more
4417 + Say Y here and to the driver for your graphics board below if you
4418 + are compiling a kernel for a non-x86 architecture.
4420 + If you are compiling for the x86 architecture, you can say Y if you
4421 + want to play with it, but it is not essential. Please note that
4422 + running graphical applications that directly touch the hardware
4423 + (e.g. an accelerated X server) and that are not frame buffer
4424 + device-aware may cause unexpected results. If unsure, say N.
4426 +config FB_CFB_FILLRECT
4431 + Include the cfb_fillrect function for generic software rectangle
4432 + filling. This is used by drivers that don't provide their own
4433 + (accelerated) version.
4435 +config FB_CFB_COPYAREA
4440 + Include the cfb_copyarea function for generic software area copying.
4441 + This is used by drivers that don't provide their own (accelerated)
4444 +config FB_CFB_IMAGEBLIT
4449 + Include the cfb_imageblit function for generic software image
4450 + blitting. This is used by drivers that don't provide their own
4451 + (accelerated) version.
4452 +config DUMMY_CONSOLE
4453 + bool "Dummy Console"
4455 + #PROM_CONSOLE!=y || VGA_CONSOLE!=y || SGI_NEWPORT_CONSOLE!=y
4458 +config FRAMEBUFFER_CONSOLE
4459 + bool "Framebuffer Console support"
4463 + Low-level framebuffer-based console driver.
4465 + bool "Bootup logo"
4466 + depends on FB || SGI_NEWPORT_CONSOLE
4468 + Enable and select frame buffer bootup logos.
4470 +config LOGO_LINUX_CLUT224
4471 + bool "Standard 224-color Linux logo"
4475 -config GENERIC_CALIBRATE_DELAY
4487 -source "init/Kconfig"
4489 -menu "General setup"
4491 -source "fs/Kconfig.binfmt"
4493 -config GENERIC_HARDIRQS
4500 - SMP support. Always Say N.
4508 - bool "Multi-core scheduler support"
4512 - Multi-core scheduler support improves the CPU scheduler's decision
4513 - making when dealing with multi-core CPU chips at a cost of slightly
4514 - increased overhead in some places. If unsure say N here.
4516 -config ETRAX_CMDLINE
4517 - string "Kernel command line"
4518 - default "root=/dev/mtdblock3"
4520 - Pass additional commands to the kernel.
4522 -config ETRAX_WATCHDOG
4523 - bool "Enable ETRAX watchdog"
4525 - Enable the built-in watchdog timer support on ETRAX based embedded
4526 - network computers.
4528 -config ETRAX_WATCHDOG_NICE_DOGGY
4529 - bool "Disable watchdog during Oops printouts"
4530 - depends on ETRAX_WATCHDOG
4532 - By enabling this you make sure that the watchdog does not bite while
4533 - printing oopses. Recommended for development systems but not for
4534 - production releases.
4536 -config ETRAX_FAST_TIMER
4537 - bool "Enable ETRAX fast timer API"
4539 - This options enables the API to a fast timer implementation using
4540 - timer1 to get sub jiffie resolution timers (primarily one-shot
4542 - This is needed if CONFIG_ETRAX_SERIAL_FAST_TIMER is enabled.
4545 - bool "Enable reboot at out of memory"
4547 -source "kernel/Kconfig.preempt"
4548 -source "kernel/Kconfig.sched"
4552 + bool "Select compiled-in fonts"
4553 + depends on FRAMEBUFFER_CONSOLE || STI_CONSOLE
4555 + Say Y here if you would like to use fonts other than the default
4556 + your frame buffer console usually use.
4558 + Note that the answer to this question won't directly affect the
4559 + kernel: saying N will just cause the configurator to skip all
4560 + the questions about foreign fonts.
4562 + If unsure, say N (the default choices are safe).
4565 + bool "VGA 8x8 font" if FONTS
4566 + depends on FRAMEBUFFER_CONSOLE || STI_CONSOLE
4567 + default y if !SPARC && !FONTS
4569 + This is the "high resolution" font for the VGA frame buffer (the one
4570 + provided by the text console 80x50 (and higher) modes).
4572 + Note that this is a poor quality font. The VGA 8x16 font is quite a
4573 + lot more readable.
4575 + Given the resolution provided by the frame buffer device, answer N
4579 + bool "VGA 8x16 font" if FONTS
4580 + depends on FRAMEBUFFER_CONSOLE || SGI_NEWPORT_CONSOLE=y || STI_CONSOLE || USB_SISUSBVGA_CON
4581 + default y if !SPARC && !FONTS
4583 + This is the "high resolution" font for the VGA frame buffer (the one
4584 + provided by the VGA text console 80x25 mode.
4590 + bool "FOX_VHDL Framebuffer"
4591 + depends on FOXBONE
4593 + select FB_CFB_FILLRECT
4594 + select FB_CFB_COPYAREA
4595 + select FB_CFB_IMAGEBLIT
4597 + select DUMMY_CONSOLE
4598 + select FRAMEBUFFER_CONSOLE
4601 + select LOGO_LINUX_CLUT224
4604 + bool "nano-X keyboard support"
4606 + depends on FOX_VHDL_FB
4608 + Enable the keyboard driver patches for nano-X
4613 + #source "drivers/video/console/Kconfig"
4617 +# source "drivers/video/logo/Kconfig"
4622 -menu "Hardware setup"
4625 - prompt "Processor type"
4626 - default ETRAX100LX
4629 - bool "ETRAX-100LX-v1"
4631 + bool "FOXBONE I/O pins"
4632 + depends on FOXBONE
4634 - Support version 1 of the ETRAX 100LX.
4635 + Include this to get access to the I/O pins of the foxbone
4637 -config ETRAX100LX_V2
4638 - bool "ETRAX-100LX-v2"
4639 +config FOXBONE_TIMEBASE
4640 + bool "FOXBONE Timebase"
4641 + depends on FOXBONE
4643 - Support version 2 of the ETRAX 100LX.
4644 + Include this to get access to the timebase part of the fpga
4647 - bool "ETRAX-100LX-for-xsim-simulator"
4649 + bool "FOXBONE MMC/SD module"
4650 + depends on FOXBONE
4652 - Support the xsim ETRAX Simulator.
4653 + Include this to be able to access a mmc/sd card connected to J3 of the fox-vhdl board
4656 - bool "ETRAX-FS-V32"
4658 + bool "FOXBONE PWM module"
4659 + depends on FOXBONE
4662 + Include this to enable PWM support into the kernel
4665 - bool "ETRAX-FS-V32-Simulator"
4666 +config FOXBONE_EVENT
4667 + bool "FOXBONE EVENT counter module"
4668 + depends on FOXBONE
4670 - Support CRIS V32 VCS simualtor.
4671 + Include this to enable foxbone event counter support
4675 -config ETRAX_ARCH_V10
4677 - default y if ETRAX100LX || ETRAX100LX_V2
4678 - default n if !(ETRAX100LX || ETRAX100LX_V2)
4680 -config ETRAX_ARCH_V32
4682 - default y if ETRAXFS || ETRAXFS_SIM
4683 - default n if !(ETRAXFS || ETRAXFS_SIM)
4685 -config ETRAX_DRAM_SIZE
4686 - int "DRAM size (dec, in MB)"
4688 +config FOXBONE_LOOPBACK
4689 + bool "FOXBONE Loopback module"
4690 + depends on FOXBONE
4692 - Size of DRAM (decimal in MB) typically 2, 8 or 16.
4693 + Include this to be able to load the loopback module, that you can base your own driver on
4695 -config ETRAX_FLASH_BUSWIDTH
4696 - int "Buswidth of NOR flash in bytes"
4698 +config FOXBONE_MULTIPLY
4699 + bool "FOXBONE Multiplier example"
4700 + depends on FOXBONE
4702 - Width in bytes of the NOR Flash bus (1, 2 or 4). Is usually 2.
4703 + Include this to use the 64 bit multiplier
4705 -config ETRAX_NANDFLASH_BUSWIDTH
4706 - int "Buswidth of NAND flash in bytes"
4709 - Width in bytes of the NAND flash (1 or 2).
4710 +menu "FOXBONE interrupt handlers"
4711 +config FOXBONE_SAMPLE_ISR
4712 + bool "FOXBONE example interrupt handlers"
4713 + depends on FOXBONE
4715 +config FOXBONE_INT14
4716 + bool "Int 14 - bit 0 of reg 0x13 set"
4717 + depends on FOXBONE_SAMPLE_ISR
4719 -config ETRAX_FLASH1_SIZE
4720 - int "FLASH1 size (dec, in MB. 0 = Unknown)"
4722 +config FOXBONE_INT31
4723 + bool "Int 31 - bit 1 of reg 0x13 set"
4724 + depends on FOXBONE_SAMPLE_ISR
4726 -# arch/cris/arch is a symlink to correct arch (arch-v10 or arch-v32)
4727 -source arch/cris/arch/Kconfig
4732 -source "net/Kconfig"
4734 -# bring in ETRAX built-in drivers
4735 -menu "Drivers for built-in interfaces"
4736 -# arch/cris/arch is a symlink to correct arch (arch-v10 or arch-v32)
4737 -source arch/cris/arch/drivers/Kconfig
4739 +config ETRAX_CMDLINE
4740 + string "Kernel command line"
4741 + default "root=/dev/mtdblock3 init=/linuxrc console=ttyS0"
4743 + use if no framebuffer is enabled console=ttyS0
4744 + use if framebuffer is enabled console=tty0
4748 -source "drivers/base/Kconfig"
4750 -# standard linux drivers
4751 -source "drivers/mtd/Kconfig"
4753 -source "drivers/parport/Kconfig"
4755 -source "drivers/pnp/Kconfig"
4757 -source "drivers/block/Kconfig"
4759 -source "drivers/md/Kconfig"
4761 -source "drivers/ide/Kconfig"
4763 -source "drivers/scsi/Kconfig"
4765 -source "drivers/ieee1394/Kconfig"
4767 -source "drivers/message/i2o/Kconfig"
4769 -source "drivers/net/Kconfig"
4771 -source "drivers/isdn/Kconfig"
4773 -source "drivers/telephony/Kconfig"
4775 -source "drivers/cdrom/Kconfig"
4778 -# input before char - char/joystick depends on it. As does USB.
4780 -source "drivers/input/Kconfig"
4782 -source "drivers/char/Kconfig"
4784 -#source drivers/misc/Config.in
4785 -source "drivers/media/Kconfig"
4787 -source "fs/Kconfig"
4789 -source "sound/Kconfig"
4791 -source "drivers/pcmcia/Kconfig"
4793 -source "drivers/pci/Kconfig"
4795 -source "drivers/usb/Kconfig"
4797 -source "arch/cris/Kconfig.debug"
4799 -source "security/Kconfig"
4801 -source "crypto/Kconfig"
4803 -source "lib/Kconfig"
4804 --- linux-2.6.19.2.orig/arch/cris/Kconfig 2007-06-16 23:58:14.000000000 +0200
4805 +++ linux-2.6.19.2/arch/cris/Kconfig 2007-06-17 02:52:11.000000000 +0200
4807 source "crypto/Kconfig"
4809 source "lib/Kconfig"
4811 +source "drivers/fox-vhdl/Kconfig"
4814 > obj-$(CONFIG_FOX_VHDL) += fox-vhdl/
4815 diff -urN linux-2.6.19.2.orig/include/linux/foxbone_syscalls.h linux-2.6.19.2/include/linux/foxbone_syscalls.h
4816 --- linux-2.6.19.2.orig/include/linux/foxbone_syscalls.h 1970-01-01 01:00:00.000000000 +0100
4817 +++ linux-2.6.19.2/include/linux/foxbone_syscalls.h 2007-06-17 03:31:39.000000000 +0200
4819 +#ifndef __LINUX_SYSCALL_FOXBONE
4820 +#define __LINUX_SYSCALL_FOXBONE
4821 +#include <linux/autoconf.h>
4822 +#include <linux/kernel.h>
4823 +#include <linux/errno.h>
4824 +#include <asm/unistd.h>
4827 +_syscall1(void, foxbonereset, unsigned short int, reg);
4828 +_syscall1(unsigned short int, foxboneread, unsigned short int, reg);
4829 +_syscall2(void, foxbonewrite, unsigned short int, reg, unsigned short int, value);
4830 +_syscall3(void, foxbonebulkread, unsigned short int, reg, unsigned short int *, value, unsigned int, length);
4831 +_syscall3(void, foxbonebulkwrite, unsigned short int, reg, unsigned short int *, value, unsigned int, length);
4832 +_syscall2(void, foxboneintreg, unsigned long int, interrupt, unsigned char, state);
4833 +_syscall1(unsigned int, foxboneintcheck, unsigned long int, interrupt);
4834 +_syscall2(unsigned int, foxboneintwait, unsigned long int, interrupt, unsigned char, timeout);