/*********************************************************************
*
*             GUI_VNC_X_StartServer
*
* Function description
*   To start the server, the following steps are executed
*   - Make sure the TCP-IP stack is up and running
*   - Init the server context and attach it to the layer
*   - Start the thread (task) which runs the VNC server
* Notes:
*   (1) The first part of the code initializes the TCP/IP stack. In a typical
*       application, this is not required, since the stack should have already been
*       initialized some other place.
*       This could be done in a different module. (TCPIP_AssertInit() ?)
*/
int GUI_VNC_X_StartServer(int LayerIndex, int ServerIndex) {
  /* Make sure the TCP/IP stack is initialized.  (1) */
  if (xn_rtip_init() != 0) {
    OS_SendString("GUI_VNC_X_StartServer: Init failed\n");
    return 1;                    /* Error */
  }
  {
    int interface;
    xn_bind_cs(0);                                        /* append interface to device table */
    interface = xn_interface_open_config(CS89X0_DEVICE, 0, (IOADDRESS)0x20000300,5,0);   /* open interface */
    if (interface < 0) {
      OS_SendString("GUI_VNC_X_StartServer: Can not open interface\n");
      return 1;                                           /* Error */
    }
    xn_set_ip(interface, (PFBYTE)&_IPLocal[0], (PFBYTE)&_IPMask[0]);      /* set IP address of interface */
    HW_EnableEthernetIRQ();                               /* Enable ethernet IRQ. Make sure it is done after xn_interface_open_config() */  
  }

  /* Init VNC context and attach to layer (so context is updated if the display-layer-contents change */
  GUI_VNC_AttachToLayer(&_Context, LayerIndex);
  _Context.ServerIndex = ServerIndex;

  /* Create task for VNC Server */
  OS_CREATETASK(&_VNCServer_TCB, "VNC Server", _ServerTask, 50, _StackVNCServer);
  return 0;                                               /* O.k., server has been started */
}
示例#2
0
/****************************************************
 * Initialize socket for RTIP
 ****************************************************/
int SOCK_Init (void)
{
    int iface;
    byte tnet_localHost[4] = {192, 168, 1, 43};
    byte tnet_maskip[4] = {255, 255, 255, 0};

    PRINTF (("about to init xn_rtip\n"));
    /*   px_init ();   */
    if(xn_rtip_init()!=0)
    {
        PRINTF (("SOCK_Init: Error in xn_rtip_init\n"));
        return -1;
    }

    PRINTF (("about to open xn_interface config\n"));
    /* packard bell                                                               */
/*  iface = xn_interface_open_config (NE2000_DEVICE, MINOR_0, 0x220, 10, 0);      */
    /* IntelliStation                                                             */
/*  iface = xn_interface_open_config (I82559_DEVICE, MINOR_0, 0x78e0, 8, 0xf000); */
    /* Toshiba                                                                    */
    iface = xn_interface_open_config (CE3_PCMCIA_DEVICE, MINOR_0, 0x110, 10, 0);

    if(iface < 0)
    {
        PRINTF (("SOCK_Init: Interface Open Failed - returned %s\n",
            xn_geterror_string (xn_getlasterror ())));
        return -1;
    }

        PRINTF (("about to set ip\n"));
    if(xn_set_ip(iface, tnet_localHost, tnet_maskip))
    {
        PRINTF (("SOCK_Init: xn_set_ip error\n"));
        return -1;
    }

    rtsmb_srv_init (tnet_localHost, tnet_maskip, NULL, NULL);
    rtsmb_cli_init (tnet_localHost, tnet_maskip);

    return 0;
}