#!/bin/sh
#
# Install klm_u-dma-buf: u-dma-buf is a Linux device driver that allocates 
# contiguous memory blocks in the kernel space as DMA buffers and 
# makes them available from the user space. 
# It is intended that these memory blocks are used as DMA buffers when a user 
# application implements device driver in user space using UIO (User space I/O).


#import common helpers
. /etc/init.d/mod_ins/module-load-functions

boot_debug "Executing S07install-u-dma-buf"

case $1 in
    start)
        card_index=$(get_cmdline_card_index)
        if [ "$card_index" == 27066 ] ; then
        boot_debug "Loading klm_u-dma-buf ....."
        insmod -f /lib/modules/klm_u-dma-buf.o udmabuf0=1048576
        fi
        if [ "$card_index" == 27067 ] ; then
            boot_debug "Loading klm_u-dma-buf ....."
            insmod -f /lib/modules/klm_u-dma-buf.o udmabuf0=1048576
        fi
    ;;

    stop)
        boot_debug "Stopping klm_u-dma-buf"
        rmmod klm_u-dma-buf
    ;;
esac

