예제 #1
0
파일: mscbbus.c 프로젝트: cjpl/midas
int mscbbus_puts(MSCBBUS_INFO * info, char *str)
{
   if (debug_flag) {
      FILE *f;

      f = fopen("mscbbus.log", "a");
      fprintf(f, "puts: %s\n", str);
      fclose(f);
   }

   mscb_write(info->fd, info->settings.address, 0, str, strlen(str));

   return strlen(str);
}
예제 #2
0
파일: mscbbus.c 프로젝트: cjpl/midas
int mscbbus_write(MSCBBUS_INFO * info, char *data, int size)
{
   int i;

   if (debug_flag) {
      FILE *f;

      f = fopen("mscbbus.log", "a");
      fprintf(f, "write: ");
      for (i = 0; (int) i < size; i++)
         fprintf(f, "%X ", data[i]);
      fprintf(f, "\n");
      fclose(f);
   }

   i = mscb_write(info->fd, info->settings.address, 0, data, size);

   return i;
}
예제 #3
0
파일: rpc.c 프로젝트: alcap-org/AlcapDAQ
int server_execute(int index, void *prpc_param[])
{
   int status;

   switch (index) {
   default:
      abort();
      break;

   case RPC_MSCB_INIT:
      status = mscb_init(CSTRING(0), CINT(1), CINT(2));
      break;

   case RPC_MSCB_EXIT:
      status = mscb_exit(CINT(0));
      break;

   case RPC_MSCB_REBOOT:
      status = mscb_reboot(CINT(0), CINT(1));
      break;

   case RPC_MSCB_RESET:
      status = mscb_reset(CINT(0));
      break;

   case RPC_MSCB_PING:
      status = mscb_ping(CINT(0), CINT(1));
      break;

   case RPC_MSCB_INFO:
      status = mscb_info(CINT(0), CINT(1), CARRAY(2));
      break;

   case RPC_MSCB_INFO_VARIABLE:
      status = mscb_info_variable(CINT(0), CINT(1), CINT(2), CARRAY(3));
      break;

   case RPC_MSCB_SET_ADDR:
      status = mscb_set_addr(CINT(0), CINT(1), CINT(2), CINT(3));
      break;

   case RPC_MSCB_SET_NAME:
      status = mscb_set_name(CINT(0), CINT(1), CSTRING(2));
      break;

   case RPC_MSCB_WRITE_GROUP:
      status = mscb_write_group(CINT(0), CINT(1), CBYTE(2), CARRAY(3), CINT(4));
      break;

   case RPC_MSCB_WRITE:
      status = mscb_write(CINT(0), CINT(1), CBYTE(2), CARRAY(3), CINT(4));
      break;

   case RPC_MSCB_FLASH:
      status = mscb_flash(CINT(0), CINT(1));
      break;

   case RPC_MSCB_UPLOAD:
      status = mscb_upload(CINT(0), CINT(1), CARRAY(2), CINT(3), CINT(4));
      break;

   case RPC_MSCB_READ:
      status = mscb_read(CINT(0), CINT(1), CBYTE(2), CARRAY(3), CPINT(4));
      break;

   case RPC_MSCB_READ_RANGE:
      status = mscb_read_range(CINT(0), CINT(1), CBYTE(2), CBYTE(3), CARRAY(4), CPINT(5));
      break;

   case RPC_MSCB_ECHO:
      status = mscb_echo(CINT(0), CINT(1), CBYTE(2), CPBYTE(3));
      break;

   case RPC_MSCB_USER:
      status = mscb_user(CINT(0), CINT(1), CARRAY(2), CINT(3), CARRAY(4), CPINT(5));
      break;

   case RPC_MSCB_ADDR:
      status = mscb_addr(CINT(0), CINT(1), CINT(2), CINT(3), CINT(4));
      break;
   }

   return status;
}