IPMUX1IPMUX2IPMUX3: opl_minte_test.c源文件

RTL96xx (RTL9607,...)

opl_minte_test.c

浏览该文件的文档。
00001 
00014 #include <stdlib.h>
00015 #include <fcntl.h>
00016 #include <unistd.h>
00017 #include "../include/opl_typedef.h"
00021 /*--------------------------Macro definition------------------------- */
00022 #define OPL_MINTE_DEVICE  "/dev/opl_minte"
00023 
00024 
00030 /*--------------------------type definition------------------------- */
00031 
00032 
00033 
00034 
00035 
00041 /*-----------------global varible/function declaration--------------- */
00042 
00043 
00044 
00050 /*-------------------local  function declaration---------------------- */
00051 
00053 int opl_minte_fd;
00054 
00055 
00056 
00057 
00064 /*--------------local  variable declaration and definition------------- */
00065 
00066 int opl_minte_init(int *initialized);
00067 void opl_minte_main(int argc,char **argv);
00068 int opl_minte_exit(int *initialized);
00069 
00076 /*------------------global variable and function exported-------------- */
00077 
00078 
00079 
00080 
00081 
00089 /*----------------------local  function definition--------------------- */
00090 
00101 int opl_minte_init(int *initialized)
00102 {
00103   opl_minte_fd = open(OPL_MINTE_DEVICE,O_RDWR|O_SYNC);
00104   if(opl_minte_fd<0){
00105     printf("open the %s device failed\n",OPL_MINTE_DEVICE);
00106     return -1;
00107   }
00108   *initialized = 1;
00109   return 0;
00110 }
00111 
00120 int opl_minte_exit(int *initialized)
00121 {
00122   int ret = 0;
00123   if(*initialized){
00124     ret = close(opl_minte_fd);
00125     *initialized = 0;
00126   }
00127   return ret;
00128 }
00129 
00139 void opl_minte_main(int argc,char **argv)
00140 {
00141   int len = 0;
00142   u32 irq_pending = 0;
00143   len = read(opl_minte_fd,&irq_pending,4);
00144   if(len == 4){
00145     printf("read the irq pending is correct. pending = 0x%x",irq_pending);
00146     return;
00147   }else{
00148     printf("read the irq pending error\n");
00149   }
00150 }
00162 int main(int argc,char **argv)
00163 {
00164   int initialized = 0;
00165   opl_minte_init(&initialized);
00166   if(initialized){
00167     opl_minte_main(argc,argv);
00168   }
00169   opl_minte_exit(&initialized);
00170   return 0;
00171 }

Generated at Mon Jul 30 16:43:48 2007 for IPMUX1IPMUX2IPMUX3 by  doxygen 1.3.9.1