drivers/unix/unix.c
changeset 391 7802a7d5584f
parent 384 83793fc7ce48
child 401 2c90876b9751
equal deleted inserted replaced
390:31dc4ec8710c 391:7802a7d5584f
    17 
    17 
    18 You should have received a copy of the GNU Lesser General Public
    18 You should have received a copy of the GNU Lesser General Public
    19 License along with this library; if not, write to the Free Software
    19 License along with this library; if not, write to the Free Software
    20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    21 */
    21 */
       
    22 #ifndef __KERNEL__
    22 #include <unistd.h>
    23 #include <unistd.h>
    23 #include <stdio.h>
    24 #include <stdio.h>
    24 #include <stdlib.h>
    25 #include <stdlib.h>
       
    26 #else
       
    27 #include <linux/module.h>
       
    28 #endif
    25 
    29 
    26 #ifndef NOT_USE_DYNAMIC_LOADING
    30 #ifndef NOT_USE_DYNAMIC_LOADING
    27 #define DLL_CALL(funcname) (* funcname##_driver)
    31 #define DLL_CALL(funcname) (* funcname##_driver)
    28 #define FCT_PTR_INIT =NULL
    32 #define FCT_PTR_INIT =NULL
    29 
    33 
   169 		EnterMutex();
   173 		EnterMutex();
   170 		d->canHandle = (CAN_PORT)&canports[i];
   174 		d->canHandle = (CAN_PORT)&canports[i];
   171 		LeaveMutex();
   175 		LeaveMutex();
   172 		return (CAN_PORT)&canports[i];
   176 		return (CAN_PORT)&canports[i];
   173 	}else{
   177 	}else{
   174         	fprintf(stderr,"CanOpen : Cannot open board {busname='%s',baudrate='%s'}\n",board->busname, board->baudrate);
   178         	MSG("CanOpen : Cannot open board {busname='%s',baudrate='%s'}\n",board->busname, board->baudrate);
   175 		return NULL;
   179 		return NULL;
   176 	}
   180 	}
   177 }
   181 }
   178 
   182 
   179 int canClose(CO_Data * d)
   183 int canClose(CO_Data * d)
   200 		//EnterMutex();
   204 		//EnterMutex();
   201 		return res; // OK
   205 		return res; // OK
   202 	}               
   206 	}               
   203 	return 1; // NOT OK
   207 	return 1; // NOT OK
   204 }
   208 }
       
   209 
       
   210 
       
   211 #ifdef __KERNEL__
       
   212 EXPORT_SYMBOL (canOpen);
       
   213 EXPORT_SYMBOL (canClose);
       
   214 EXPORT_SYMBOL (canSend);
       
   215 #endif