Development of PCI board driver in XPC environment
조회 수: 2(최근 30일)
My purpose is to implement PCI1706's board driver in XPC environment.
According to an article on the Baidu library that introduced the PCI card driver (https://wenku.baidu.com/view/f625485dbe23482fb5da4c01.html), the driver can be realized by c-mex S-function.
Main steps: 1. write the c-mex S-function; 2. mex the c-mex S-function and get the mexw32 file; 3. invoke the mexw32 file according to S-function module in simulink environment.
XPC has provided rl32getpciinfo rl32einpb rl32outpb functions to get PCI board information, write/read registers.
But I found some problems when realizing the driver function.
That is, the codes realizing the driver or calling the xpc functions are wrapped by "#ifndef matlab_mex_file #end if", so it won't actually excute if the S-function is built by "mex". I used the "printf" in the codes wrapped by "ifndef matlab_mex_file" and it didn't output anything, which validates that the codes realizing the driver or calling the xpc functions didn't excute.
If I deleted the "ifndef matlab_mex_file", there will be errors.
So how to realize the PCI board driver in XPC environment?
The codes are as the attach file.