Esempio n. 1
0
void rt_sys_init (void) {
#else
void rt_sys_init (FUNCP first_task, U32 prio_stksz, void *stk) {
#endif
    /* Initialize system and start up task declared with "first_task". */
    U32 i;

    DBG_INIT();

    /* Initialize dynamic memory and task TCB pointers to NULL. */
    for (i = 0U; i < os_maxtaskrun; i++) {
        os_active_TCB[i] = NULL;
    }
    rt_init_box (mp_tcb, (U32)mp_tcb_size, sizeof(struct OS_TCB));
    rt_init_box (mp_stk, mp_stk_size, BOX_ALIGN_8 | (U16)(os_stackinfo));
    rt_init_box ((U32 *)m_tmr, (U32)mp_tmr_size, sizeof(struct OS_TMR));

    /* Set up TCB of idle demon */
    os_idle_TCB.task_id    = 255U;
    os_idle_TCB.priv_stack = 0U;
    rt_init_context (&os_idle_TCB, 0U, os_idle_demon);

    /* Set up ready list: initially empty */
    os_rdy.cb_type = HCB;
    os_rdy.p_lnk   = NULL;
    /* Set up delay list: initially empty */
    os_dly.cb_type = HCB;
    os_dly.p_dlnk  = NULL;
    os_dly.p_blnk  = NULL;
    os_dly.delta_time = 0U;

    /* Fix SP and system variables to assume idle task is running */
    /* Transform main program into idle task by assuming idle TCB */
#ifndef __CMSIS_RTOS
    rt_set_PSP (os_idle_TCB.tsk_stack+32U);
#endif
    os_tsk.run = &os_idle_TCB;
    os_tsk.run->state = RUNNING;

    /* Initialize ps queue */
    os_psq->first = 0U;
    os_psq->last  = 0U;
    os_psq->size  = os_fifo_size;

    rt_init_robin ();

#ifndef __CMSIS_RTOS
    /* Initialize SVC and PendSV */
    rt_svc_init ();

    /* Initialize and start system clock timer */
    os_tick_irqn = os_tick_init ();
    if (os_tick_irqn >= 0) {
        OS_X_INIT((U32)os_tick_irqn);
    }

    /* Start up first user task before entering the endless loop */
    rt_tsk_create (first_task, prio_stksz, stk, NULL);
#endif
}
Esempio n. 2
0
SANE_Status
sanei_udp_open(const char *host, int port, int *fdp)
{
	int status;
#ifdef HAVE_WINSOCK2_H
	WSADATA wsaData;
#endif

	DBG_INIT();
	DBG(1, "%s\n", __func__);

#ifdef HAVE_WINSOCK2_H
	status = WSAStartup(MAKEWORD(2, 2), &wsaData);
	if (status != 0)
	    return SANE_STATUS_INVAL;
#endif

	status = sanei_udp_socket(fdp, 0);
	if (status != SANE_STATUS_GOOD)
		return status;

	status = sanei_udp_connect(*fdp, host, port);
	if (status != SANE_STATUS_GOOD) {
		close(*fdp);
		return status;
	}

	return status;
}
Esempio n. 3
0
/* init rts8891 library */
static void
rts8891_low_init (void)
{
  DBG_INIT ();
  DBG (DBG_info, "RTS8891 low-level  functions, version %d.%d-%d\n",
       SANE_CURRENT_MAJOR, V_MINOR, RTS8891_BUILD);
}
Esempio n. 4
0
/* init rts88xx library */
void
sanei_rts88xx_lib_init (void)
{
  DBG_INIT ();
  DBG (DBG_info, "RTS88XX library, version %d.%d-%d\n", SANE_CURRENT_MAJOR, V_MINOR,
       RTS88XX_LIB_BUILD);
}
Esempio n. 5
0
/*--------------------------------------------------------------------------*/
SANE_Status
sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
{
  char dev_name[PATH_MAX];
  size_t len;
  FILE *fp = NULL;

  DBG_INIT ();
  DBG (2, "sane_init (authorize %s null)\n", (authorize) ? "!=" : "==");
  if (version_code)
    *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0);
/*  fp = sanei_config_open (AS6E_CONFIG_FILE);*/
  if (!fp)
    {
      return (attach ("as6edriver", 0));
    }

  while (fgets (dev_name, sizeof (dev_name), fp))
    {
      if (dev_name[0] == '#')	/* ignore line comments */
	continue;
      len = strlen (dev_name);
      if (dev_name[len - 1] == '\n')
	dev_name[--len] = '\0';
      if (!len)
	continue;		/* ignore empty lines */
/*      sanei_config_attach_matching_devices (dev_name, attach_one);*/
    }
  fclose (fp);
  return (SANE_STATUS_GOOD);
}
Esempio n. 6
0
/* Wait for PQI reset completion for the adapter*/
int pqisrc_wait_for_pqi_reset_completion(pqisrc_softstate_t *softs)
{
	int ret = PQI_STATUS_SUCCESS;
	pqi_reset_reg_t reset_reg;
	int pqi_reset_timeout = 0;
	uint64_t val = 0;
	uint32_t max_timeout = 0;

	val = PCI_MEM_GET64(softs, &softs->pqi_reg->pqi_dev_adminq_cap, PQI_ADMINQ_CAP);

	max_timeout = (val & 0xFFFF00000000) >> 32;

	DBG_INIT("max_timeout for PQI reset completion in 100 msec units = %u\n", max_timeout);

	while(1) {
		if (pqi_reset_timeout++ == max_timeout) {
			return PQI_STATUS_TIMEOUT; 
		}
		OS_SLEEP(PQI_RESET_POLL_INTERVAL);/* 100 msec */
		reset_reg.all_bits = PCI_MEM_GET32(softs,
			&softs->pqi_reg->dev_reset, PQI_DEV_RESET);
		if (reset_reg.bits.reset_action == PQI_RESET_ACTION_COMPLETED)
			break;
	}

	return ret;
}
Esempio n. 7
0
int pqisrc_force_sis(pqisrc_softstate_t *softs)
{
	int ret = PQI_STATUS_SUCCESS;

	if (SIS_IS_KERNEL_PANIC(softs)) {
		DBG_INIT("Controller FW is not runnning");
		return PQI_STATUS_FAILURE;
	}

	if (PQI_GET_CTRL_MODE(softs) == CTRL_SIS_MODE) {
		return ret;
	}

	if (SIS_IS_KERNEL_UP(softs)) {
		PQI_SAVE_CTRL_MODE(softs, CTRL_SIS_MODE);
		return ret;
	}
	/* Disable interrupts ? */
	sis_disable_interrupt(softs);

	/* reset pqi, this will delete queues */
	ret = pqi_reset(softs);
	if (ret) {
		return ret;
	}	
	/* Re enable SIS */
	ret = pqisrc_reenable_sis(softs);
	if (ret) {
		return ret;
	}

	PQI_SAVE_CTRL_MODE(softs, CTRL_SIS_MODE);

	return ret;	
}
Esempio n. 8
0
/** for init issues - here only for the debug output
 */
void
sanei_thread_init( void )
{
	DBG_INIT();

	memset( &td, 0, sizeof(ThreadDataDef));
	td.status = SANE_STATUS_GOOD;
}
Esempio n. 9
0
/**
 * sba_dump_ranges - debugging only - print ranges assigned to this IOA
 * @hpa: base address of the sba
 *
 * Print the MMIO and IO Port address ranges forwarded by an Astro/Ike/RIO
 * IO Adapter (aka Bus Converter).
 */
static void
sba_dump_ranges(void __iomem *hpa)
{
	DBG_INIT("SBA at 0x%p\n", hpa);
	DBG_INIT("IOS_DIST_BASE   : %Lx\n", READ_REG64(hpa+IOS_DIST_BASE));
	DBG_INIT("IOS_DIST_MASK   : %Lx\n", READ_REG64(hpa+IOS_DIST_MASK));
	DBG_INIT("IOS_DIST_ROUTE  : %Lx\n", READ_REG64(hpa+IOS_DIST_ROUTE));
	DBG_INIT("\n");
	DBG_INIT("IOS_DIRECT_BASE : %Lx\n", READ_REG64(hpa+IOS_DIRECT_BASE));
	DBG_INIT("IOS_DIRECT_MASK : %Lx\n", READ_REG64(hpa+IOS_DIRECT_MASK));
	DBG_INIT("IOS_DIRECT_ROUTE: %Lx\n", READ_REG64(hpa+IOS_DIRECT_ROUTE));
}
Esempio n. 10
0
/* 
   Find our devices
 */
SANE_Status
sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
{
  char config_line[PATH_MAX];
  size_t len;
  FILE *fp;

  DBG_INIT ();

#if 0
  DBG_LEVEL = 10;
#endif

  DBG (2, "sane_init: version_code %s 0, authorize %s 0\n",
       version_code == 0 ? "=" : "!=", authorize == 0 ? "=" : "!=");
  DBG (1, "sane_init: SANE Canon630u backend version %d.%d.%d from %s\n",
       SANE_CURRENT_MAJOR, V_MINOR, BUILD, PACKAGE_STRING);

  if (version_code)
    *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD);

  sanei_usb_init ();

  fp = sanei_config_open (CANONUSB_CONFIG_FILE);
  if (!fp)
    {
      /* no config-file: try these */
      attach_scanner ("/dev/scanner", 0);
      attach_scanner ("/dev/usbscanner", 0);
      attach_scanner ("/dev/usb/scanner", 0);
      return SANE_STATUS_GOOD;
    }

  DBG (3, "reading configure file %s\n", CANONUSB_CONFIG_FILE);

  while (sanei_config_read (config_line, sizeof (config_line), fp))
    {
      if (config_line[0] == '#')
	continue;		/* ignore line comments */

      len = strlen (config_line);

      if (!len)
	continue;		/* ignore empty lines */

      DBG (4, "attach_matching_devices(%s)\n", config_line);
      sanei_usb_attach_matching_devices (config_line, attach_one);
    }

  DBG (4, "finished reading configure file\n");

  fclose (fp);

  return SANE_STATUS_GOOD;
}
Esempio n. 11
0
SANE_Status
sane_init (SANE_Int * version_code, SANE_Auth_Callback __sane_unused__ authorize)
{
  SANE_Status 	ret;
  SANE_Word	vendor_id, product_id;
  
  DBG_INIT();
  
  DBG (1, "SANE backed for HP ScanJet 4500C/4570C/5500C/5550C/5590/7650 %u.%u.%u\n",
       SANE_CURRENT_MAJOR, V_MINOR, BUILD);
  DBG (1, "(c) Ilia Sotnikov <*****@*****.**>\n");

  if (version_code)
    *version_code = SANE_VERSION_CODE(SANE_CURRENT_MAJOR, V_MINOR, BUILD);

  sanei_usb_init();

  sanei_usb_set_timeout (USB_TIMEOUT);

  scanners_list = NULL;

  ret = hp5590_vendor_product_id (SCANNER_HP4570, &vendor_id, &product_id);
  if (ret != SANE_STATUS_GOOD)
    return ret;

  ret = sanei_usb_find_devices (vendor_id, product_id, attach_hp4570);
  if (ret != SANE_STATUS_GOOD)
    return ret;

  ret = hp5590_vendor_product_id (SCANNER_HP5550, &vendor_id, &product_id);
  if (ret != SANE_STATUS_GOOD)
    return ret;

  ret = sanei_usb_find_devices (vendor_id, product_id, attach_hp5550);
  if (ret != SANE_STATUS_GOOD)
    return ret;

  ret = hp5590_vendor_product_id (SCANNER_HP5590, &vendor_id, &product_id);
  if (ret != SANE_STATUS_GOOD)
    return ret;

  ret = sanei_usb_find_devices (vendor_id, product_id, attach_hp5590);
  if (ret != SANE_STATUS_GOOD)
    return ret;

  ret = hp5590_vendor_product_id (SCANNER_HP7650, &vendor_id, &product_id);
  if (ret != SANE_STATUS_GOOD)
    return ret;

  ret = sanei_usb_find_devices (vendor_id, product_id, attach_hp7650);
  if (ret != SANE_STATUS_GOOD)
    return ret;

  return SANE_STATUS_GOOD;
}
Esempio n. 12
0
const char *
sanei_config_get_paths ()
{
#ifdef __BEOS__
  char result[PATH_MAX];
#endif
  void *mem;
  char *dlist;
  size_t len;

  if (!dir_list)
    {
      DBG_INIT();

      dlist = getenv ("SANE_CONFIG_DIR");
      if (dlist)
	dir_list = strdup (dlist);
#ifdef __BEOS__
      /* ~/config/settings/SANE takes precedence over /etc/sane.d/ */
      if (!dir_list)
	{
	  if (find_directory(B_USER_SETTINGS_DIRECTORY, 0, true, result, PATH_MAX) == B_OK)
	    {
	      strcat(result,"/SANE");
	      strcat(result,DIR_SEP); /* do append the default ones */
	      dir_list = strdup (result);
	    }
	}
#endif
      if (dir_list)
	{
	  len = strlen (dir_list);
	  if ((len > 0) && (dir_list[len - 1] == DIR_SEP[0]))
	    {
	      /* append default search directories: */
	      mem = malloc (len + sizeof (DEFAULT_DIRS));
	      memcpy (mem, dir_list, len);
	      memcpy ((char *) mem + len, DEFAULT_DIRS, sizeof (DEFAULT_DIRS));
	      free (dir_list);
	      dir_list = mem;
	    }
	}
      else
	{
	  /* Create a copy, since we might call free on it */
	  dir_list = strdup (DEFAULT_DIRS);
	}
    }
  DBG (5, "sanei_config_get_paths: using config directories  %s\n", dir_list);

  return dir_list;
}
Esempio n. 13
0
SANE_Status
sane_init (SANE_Int * version_code, SANE_Auth_Callback cb)
{
  DBG_INIT ();
  DBG (2, "sane_init: Xerox backend (build %d), version %s null, authorize %s null\n", BACKEND_BUILD,
       (version_code) ? "!=" : "==", (cb) ? "!=" : "==");

  if (version_code)
    *version_code = SANE_VERSION_CODE (V_MAJOR, V_MINOR, BACKEND_BUILD);

  sanei_usb_init ();
  return SANE_STATUS_GOOD;
}
Esempio n. 14
0
SANE_Status
sane_init (SANE_Int __sane_unused__ * version_code,
	   SANE_Auth_Callback __sane_unused__ authorize)
{
  DBG_INIT ();
  DBG (DBG_INFO, "This is panasonic kvs40xx driver\n");

  *version_code = SANE_VERSION_CODE (V_MAJOR, V_MINOR, 1);

  /* Initialize USB */
  sanei_usb_init ();

  return SANE_STATUS_GOOD;
}
Esempio n. 15
0
SANE_Status
sanei_udp_open_broadcast(int *fdp)
{
	int status;

	DBG_INIT();
	DBG(1, "%s\n", __func__);

	status = sanei_udp_socket(fdp, 1);
	if (status != SANE_STATUS_GOOD)
		return status;

	return status;
}
Esempio n. 16
0
SANE_Status
sane_init( SANE_Int *versionP, SANE_Auth_Callback authorize )
{
	FILE *fp;
	SANE_Status status;

	DBG_INIT();
	DBG(DCODE, "sane_init: version %s null, authorize %s null\n", (versionP) ? "!=" : "==", (authorize) ? "!=" : "==");

	if( versionP != NULL )
		*versionP = SANE_VERSION_CODE(SANE_CURRENT_MAJOR, V_MINOR, 0);

	status = SANE_STATUS_GOOD;
	if( (fp = sanei_config_open(ST400_CONFIG_FILE)) != NULL ) {
		char line[PATH_MAX], *str;
		size_t len, linenum;

		linenum = 0;
		DBG(DCODE, "sane_init: reading config file\n");
		while( sanei_config_read(line, sizeof(line), fp) ) {
			++linenum;
			str = line;
			if( str[0] == '#' )
				continue;	/* ignore comments */
			str = (char *)sanei_config_skip_whitespace(str);
			len = strlen(str);
			if( !len )
				continue;	/* ignore empty lines */
			if( strncmp(str, "option", 6) == 0 && isspace(str[6]) ) {
				DBG(DCODE, "sane_init: config line <%s>\n", line);
				status = st400_config_do_option(str+7, linenum);
			}
			else {
				DBG(DCODE, "sane_init: attaching device <%s>\n", line);
				sanei_config_attach_matching_devices(line, st400_attach_one);
			}
			if( status != SANE_STATUS_GOOD )
				break;
		}
		DBG(DCODE, "sane_init: closing config file\n");
		fclose(fp);
	}

	if( status == SANE_STATUS_GOOD && st400_devices == NULL ) {
		DBG(DCODE, "sane_init: attaching default device <%s>\n", ST400_DEFAULT_DEVICE);
		sanei_config_attach_matching_devices(ST400_DEFAULT_DEVICE, st400_attach_one);
	}

	return status;
}
Esempio n. 17
0
SANE_Status
sane_init (SANE_Int * version_code,
	   SANE_Auth_Callback __sane_unused__ authorize)
{

  if (version_code != NULL)
    *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD);

  DBG_INIT();

  sanei_usb_init ();

  return SANE_STATUS_GOOD;
}
Esempio n. 18
0
void main(void) {
    mcu_init();
    timer_init();
    DBG_INIT();
    DBG_C("");
    app_init();
    DBG_C("platform booted");
    while (TRUE) {
        ClrWdt();
        process_tick();
        mywi_tick();
        usart_tick();
    }
}
Esempio n. 19
0
/**
 * sba_dump_tlb - debugging only - print IOMMU operating parameters
 * @hpa: base address of the IOMMU
 *
 * Print the size/location of the IO MMU PDIR.
 */
static void sba_dump_tlb(void __iomem *hpa)
{
	DBG_INIT("IO TLB at 0x%p\n", hpa);
	DBG_INIT("IOC_IBASE    : 0x%Lx\n", READ_REG64(hpa+IOC_IBASE));
	DBG_INIT("IOC_IMASK    : 0x%Lx\n", READ_REG64(hpa+IOC_IMASK));
	DBG_INIT("IOC_TCNFG    : 0x%Lx\n", READ_REG64(hpa+IOC_TCNFG));
	DBG_INIT("IOC_PDIR_BASE: 0x%Lx\n", READ_REG64(hpa+IOC_PDIR_BASE));
	DBG_INIT("\n");
}
Esempio n. 20
0
SANE_Status
sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
{
  char dev_name[PATH_MAX];
  size_t len;
  FILE *fp;

  authorize = authorize;		/* silence gcc */

  DBG_INIT ();

  if (version_code)
    *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0);

  fp = sanei_config_open (ABATON_CONFIG_FILE);
  if (!fp)
    {
      /* default to /dev/scanner instead of insisting on config file */
      attach ("/dev/scanner", 0, SANE_FALSE);
      return SANE_STATUS_GOOD;
    }

  while (sanei_config_read (dev_name, sizeof (dev_name), fp))
    {
      if (dev_name[0] == '#')	/* ignore line comments */
	continue;

      len = strlen (dev_name);

      if (!len)
	continue;		/* ignore empty lines */

      if (strncmp (dev_name, "option", 6) == 0
	  && isspace (dev_name[6]))
	{
	  const char *str = dev_name + 7;

	  while (isspace (*str))
	    ++str;

	  continue;
	}

      sanei_config_attach_matching_devices (dev_name, attach_one);
    }
  fclose (fp);
  return SANE_STATUS_GOOD;
}
Esempio n. 21
0
SANE_Status
sane_init (SANE_Int * version_code, SANE_Auth_Callback __sane_unused__ authorize)
{
  FILE *fp;
  char dev_name[PATH_MAX];
  size_t len;

  DBG_INIT ();

  DBG (DBG_sane_init, "sane_init\n");

  DBG (DBG_error, "This is sane-leo version %d.%d-%d\n", SANE_CURRENT_MAJOR,
       V_MINOR, BUILD);
  DBG (DBG_error, "(C) 2002 by Frank Zago\n");

  if (version_code)
    {
      *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD);
    }

  fp = sanei_config_open (LEO_CONFIG_FILE);
  if (!fp)
    {
      /* default to /dev/scanner instead of insisting on config file */
      attach_scanner ("/dev/scanner", 0);
      return SANE_STATUS_GOOD;
    }

  while (sanei_config_read (dev_name, sizeof (dev_name), fp))
    {
      if (dev_name[0] == '#')	/* ignore line comments */
	continue;
      len = strlen (dev_name);

      if (!len)
	continue;		/* ignore empty lines */

      sanei_config_attach_matching_devices (dev_name, attach_one);
    }

  fclose (fp);

  DBG (DBG_proc, "sane_init: leave\n");

  return SANE_STATUS_GOOD;
}
Esempio n. 22
0
int main() {
    DBG_INIT();
    DBG_SET_SPEED(115200);
    DBG_SET_NEWLINE("\r\n");

	INFO("Start the Nucleo Remote Update main process......");
	Thread pppSurfingTask(pppSurfing, NULL, osPriorityNormal, 1024 * 4);

	DigitalOut myled(LED1);
	while(1)
	{
		myled=!myled;
		Thread::wait(1000);  
	}

    return true;
}
Esempio n. 23
0
SANE_Status
sanei_tcp_open(const char *host, int port, int *fdp)
{
	int fd, err;
	struct sockaddr_in saddr;
	struct hostent *h;
#ifdef HAVE_WINSOCK2_H
	WSADATA wsaData;
#endif

	DBG_INIT();
	DBG(1, "%s: host = %s, port = %d\n", __FUNCTION__, host, port);

#ifdef HAVE_WINSOCK2_H
	err = WSAStartup(MAKEWORD(2, 2), &wsaData);
	if (err != 0)
	    return SANE_STATUS_INVAL;
#endif

	h = gethostbyname(host);

	if (h == NULL || h->h_addr_list[0] == NULL
	    || h->h_addrtype != AF_INET)
		return SANE_STATUS_INVAL;

	if ((fd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
		return SANE_STATUS_INVAL;

	memset(&saddr, 0x00, sizeof(struct sockaddr_in));

	saddr.sin_family = AF_INET;
	saddr.sin_port = htons(port);
	memcpy(&saddr.sin_addr, h->h_addr_list[0], h->h_length);

	if ((err =
	     connect(fd, (struct sockaddr *) &saddr,
		     sizeof(struct sockaddr_in))) != 0) {
		close(fd);
		return SANE_STATUS_INVAL;
	}

	*fdp = fd;

	return SANE_STATUS_GOOD;
}
Esempio n. 24
0
/* Second SIS command to the adapter GET_COMM_PREFERRED_SETTINGS */
int pqisrc_get_preferred_settings(pqisrc_softstate_t *softs)
{
	int ret = PQI_STATUS_SUCCESS;
	uint32_t mb[6] = {0};

	DBG_FUNC("IN\n");

	mb[0] = SIS_CMD_GET_COMM_PREFERRED_SETTINGS;
	ret = pqisrc_send_sis_cmd(softs, mb);
	if (!ret) {
		/* 31:16 maximum command size in KB */
		softs->pref_settings.max_cmd_size = mb[1] >> 16;
		/* 15:00: Maximum FIB size in bytes */
		softs->pref_settings.max_fib_size = mb[1] & 0x0000FFFF;
		DBG_INIT("cmd size = %x, fib size = %x\n",
			softs->pref_settings.max_cmd_size,
			softs->pref_settings.max_fib_size);
	}
Esempio n. 25
0
SANE_Status
sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
{
  char devnam[PATH_MAX] = "/dev/scanner";
  FILE *fp;

  authorize = authorize;		/* silence gcc */

  DBG_INIT ();
  DBG (11, ">> sane_init\n");

#if defined PACKAGE && defined VERSION
  DBG (2, "sane_init: " PACKAGE " " VERSION "\n");
#endif

  if (version_code)
    *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, 0);

  fp = sanei_config_open(RICOH_CONFIG_FILE);
  if (fp)
    {
      char line[PATH_MAX], *lp;
      size_t len;

      /* read config file */
      while (sanei_config_read (line, sizeof (line), fp))
        {
          if (line[0] == '#')           /* ignore line comments */
            continue;
          len = strlen (line);
  
          if (!len)
            continue;                   /* ignore empty lines */

	  /* skip white space: */
	  for (lp = line; isspace(*lp); ++lp);
          strcpy (devnam, lp);
        }
      fclose (fp);
    }
  sanei_config_attach_matching_devices (devnam, attach_one);
  DBG (11, "<< sane_init\n");
  return SANE_STATUS_GOOD;
}
Esempio n. 26
0
extern SANE_Status sane_hpaio_init(SANE_Int * pVersionCode, SANE_Auth_Callback authorize)
{
    int stat;

    DBG_INIT();
    InitDbus();

    DBG(8, "sane_hpaio_init(): %s %d\n", __FILE__, __LINE__);

    if( pVersionCode )
    {
       *pVersionCode = SANE_VERSION_CODE( 1, 0, 0 );
    }


    stat = orblite_init(pVersionCode, authorize);

    return stat;
}  /* sane_hpaio_init() */
Esempio n. 27
0
SANE_Status
sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
{
  char dev_name[PATH_MAX], *str;
  size_t len;
  FILE *fp;

  authorize = authorize;	/* stop gcc from complaining */
  DBG_INIT ();

  DBG (2, "SANE v4l backend version %d.%d build %d from %s\n", SANE_CURRENT_MAJOR,
       V_MINOR, BUILD, PACKAGE_STRING);

  if (version_code)
    *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD);

  fp = sanei_config_open (V4L_CONFIG_FILE);
  if (!fp)
    {
      DBG (2,
	   "sane_init: file `%s' not accessible (%s), trying /dev/video0\n",
	   V4L_CONFIG_FILE, strerror (errno));

      return attach ("/dev/video0", 0);
    }

  while (sanei_config_read (dev_name, sizeof (dev_name), fp))
    {
      if (dev_name[0] == '#')	/* ignore line comments */
	continue;
      len = strlen (dev_name);

      if (!len)
	continue;		/* ignore empty lines */

      /* Remove trailing space and trailing comments */
      for (str = dev_name; *str && !isspace (*str) && *str != '#'; ++str);
      attach (dev_name, 0);
    }
  fclose (fp);
  return SANE_STATUS_GOOD;
}
Esempio n. 28
0
/*
 * Called by SANE initially.
 * 
 * From the SANE spec:
 * This function must be called before any other SANE function can be
 * called. The behavior of a SANE backend is undefined if this
 * function is not called first. The version code of the backend is
 * returned in the value pointed to by version_code. If that pointer
 * is NULL, no version code is returned. Argument authorize is either
 * a pointer to a function that is invoked when the backend requires
 * authentication for a specific resource or NULL if the frontend does
 * not support authentication.
 */
SANE_Status
sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
{
    authorize = authorize;        /* get rid of compiler warning */
  
    DBG_INIT ();
    DBG (10, "sane_init: start\n");
  
    sanei_usb_init();
  
    if (version_code)
      *version_code = SANE_VERSION_CODE (SANE_CURRENT_MAJOR, V_MINOR, BUILD);
  
    DBG (5, "sane_init: cardscan backend %d.%d.%d, from %s\n",
      SANE_CURRENT_MAJOR, V_MINOR, BUILD, PACKAGE_STRING);
  
    DBG (10, "sane_init: finish\n");
  
    return SANE_STATUS_GOOD;
}
Esempio n. 29
0
/* First SIS command for the adapter to check PQI support */
int pqisrc_get_adapter_properties(pqisrc_softstate_t *softs,
				uint32_t *prop, uint32_t *ext_prop)
{
	int ret = PQI_STATUS_SUCCESS;
	uint32_t mb[6] = {0};

	DBG_FUNC("IN\n");

	mb[0] = SIS_CMD_GET_ADAPTER_PROPERTIES;
	ret = pqisrc_send_sis_cmd(softs, mb);
	if (!ret) {
		DBG_INIT("GET_PROPERTIES prop = %x, ext_prop = %x\n",
					mb[1], mb[4]);
		*prop = mb[1];
		*ext_prop = mb[4];
	}

	DBG_FUNC("OUT\n");
	return ret;
}
Esempio n. 30
0
int main() {
//	Thread wdFeedTask(wdFeed, NULL, osPriorityNormal, 256);

    DBG_INIT();
    DBG_SET_SPEED(115200);
    DBG_SET_NEWLINE("\r\n");

    INFO("Start the Nucleo Remote Update main process......");

    // Read and identify the stm32f4 board header id from eeprom
    {
        const int i2c_freq_hz = 400000;
        i2c.frequency(i2c_freq_hz);
        INFO("I2C: I2C Frequency: %d Hz\r\n", i2c_freq_hz);

        if (read_eeprom(&header) < 0) {
            INFO("Could not get board ID, the is the first identify the board?");
            if (write_eeprom(&header) < 0) {
                INFO("Initialization eeprom failure.");
                return -1;
            }
        }
    }

    Thread pppDialTask(pppDialing, NULL, osPriorityNormal, 1024 * 4);

    Thread pppSurfingTask(pppSurfing, NULL, osPriorityNormal, 1024 * 6);

    Thread userFirmwareSendTask(userFirmwareSend, NULL, osPriorityNormal, 1024 * 10);

    redial.put(&pppDialingSuccessFlag);

    DigitalOut mcuLed(LED1);
    while(1)
    {
        mcuLed = !mcuLed;
        Thread::wait(1000);
    }

    return 0;
}