Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] Re: FYI: Now on Mac OS X



Hi,

Manfred Petz wrote:
On Tue, 8 Jul 2003, Johannes Stezenbach wrote:

[snip]
|
| AFAIK Holger and Daniel started porting the dvb-core part and the frontend
| drivers of the dvb-kernel CVS to Mac OS X for use with the DVB-T USB
| thingy (no PCI-card drivers). I don't know the status of this porting
| effort, but Holger should know.

Interresting! Is there any information available on this? Any early source
code? Do you have any plans to backport the changes of the OS X port to the
official DVB driver? I'm asking this, because I'm currently playing with the
1.0.0-pre3 version to provide a FreeBSD port of the DVB driver, which we need
because our devices run FreeBSD, not Linux.
basically the work in CVS is an abstraction layer for the Linux API. Since there are too many cards supported right now we decided that it's probably a better idea to fake the small subset of the Linux kernel API we need for BSD/MacOS systems instead of porting the drivers from scratch. Right now the CVS is a bit out of date, I spent some time to get it up-to-date but did not yet finished this.

The build-template directory contains a set of fake include files with sample decalarations of the functions you need to provide for non-Linux systems. When you provided an OS abstraction layer like this and when wer did this properly for all required subsystems (USB+PCI are still to be done - ) all supported PCI cards, frontends and USB adaptors should work out of the box. To get an idea how it's supposed to work try this:

[first check out the dvb-kernel source tree from CVS]
$ cvs -d :pserver:anonymous@linuxtv.org:/cvs/linuxtv co dvb-kernel
$ cd dvb-kernel/

[now check out the source from some weeks ago before everything became worse;]
$ cvs -q up -dPD"03/25/2003"

[build the symbolic link structure]
$ cd build-template/
$ ./getlinks
$ make 2>&1 | tee /tmp/out

now you built the source without linux dependencies. The dvb-core.o module contains the functions references you have to implement for a new platform:

$ nm dvb-core.o | grep " U "
U add_timer
U copy_from_user
U copy_to_user
U current
U ddelay
U del_timer
U devfs_mk_dir
U devfs_register
U devfs_unregister
U down
U down_interruptible
U free
U init_MUTEX
U init_timer
U init_waitqueue_head
U interruptible_sleep_on_timeout
U jiffies
U kernel_thread
U kernel_thread_setup
U malloc
U memcpy
U memset
U poll_wait
U printf
U schedule_timeout
U sema_init
U snprintf
U strcmp
U up
U vfree
U vmalloc
U wake_up
U wake_up_interruptible

As you see most of these functions have pretty similiar semantics on BSD-alike systems and MacOSX, they should be pretty straightforward.

While you compiled the code you also got the warnings for unimplemented macros, let's take a closer look on them:

$ cat /tmp/out | grep warning | grep -v unused \
| grep -v "not used" | sort | uniq

asm/semaphore.h:7:2: warning: #warning implement DECLARE_MUTEX() macro!!
asm/system.h:8:2: warning: #warning implement mb() -- memory barrier!!
linux/devfs_fs_kernel.h:10:2: warning: #warning setup umode_t enums S_IFCHR, S_IRUSR and S_IWUSR!!
linux/module.h:23:2: warning: #warning implement module_init()/module_exit() so that your modules get initialized!!
linux/module.h:8:2: warning: #warning implement try_module_get() and module_put() if you use dynamically loadable modules!!
linux/sched.h:11:2: warning: #warning adjust jiffies according to your architecture!!
linux/sched.h:19:2: warning: #warning implement wait_event_interruptible() macro!!
linux/sched.h:23:2: warning: #warning adjust TASK_INTERRUPTIBLE definition!!
linux/sched.h:26:2: warning: #warning implement set_current_state() macro!!
linux/sched.h:32:2: warning: #warning implement signal_pending()!!
linux/spinlock.h:11:2: warning: #warning adjust spin_lock_init() according to your OS!!
linux/spinlock.h:14:2: warning: #warning implement spin_lock()!!
linux/spinlock.h:17:2: warning: #warning implement spin_unlock()!!
linux/spinlock.h:20:2: warning: #warning implement spin_lock_irq()!!
linux/spinlock.h:23:2: warning: #warning implement spin_unlock_irq()!!
linux/spinlock.h:26:2: warning: #warning implement spin_lock_irqsave()!!
linux/spinlock.h:29:2: warning: #warning implement spin_unlock_irqrestore()!!

Unfortunally there are some constructs that can't easily get faked which were carefully removed for portability but reintroduced last months, namely:

#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,61)
/* do something */
#else
/* do something else */
#endif

We'll have to spend some time to remove this code again in the main trunk.

Holger



--
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe linux-dvb" as subject.



Home | Main Index | Thread Index