Ejemplo n.º 1
0
void blinkTask(void *parameters)
{
   //Endless loop
   while(1)
   {
      STM_EVAL_LEDOn(LED1);
      osDelayTask(100);
      STM_EVAL_LEDOff(LED1);
      osDelayTask(900);
   }
}
Ejemplo n.º 2
0
void blinkTask(void *parameters)
{
   //Endless loop
   while(1)
   {
      AVR32_GPIO.port[LED0_PORT].ovrc = 1 << LED0_POS;
      osDelayTask(100);
      AVR32_GPIO.port[LED0_PORT].ovrs = 1 << LED0_POS;
      osDelayTask(900);
   }
}
Ejemplo n.º 3
0
void blinkTask(void *parameters)
{
   //Endless loop
   while(1)
   {
      PIO_LED3->PIO_CODR = LED3;
      osDelayTask(100);
      PIO_LED3->PIO_SODR = LED3;
      osDelayTask(900);
   }
}
Ejemplo n.º 4
0
void blinkTask(void *parameters)
{
   //Endless loop
   while(1)
   {
      PORT_LED1->OMR = LED1_MASK;
      osDelayTask(100);
      PORT_LED1->OMR = (LED1_MASK << 16);
      osDelayTask(900);
   }
}
Ejemplo n.º 5
0
void blinkTask(void *parameters)
{
    //Endless loop
    while(1)
    {
        BSP_LED_On(LED1);
        osDelayTask(100);
        BSP_LED_Off(LED1);
        osDelayTask(900);
    }
}
Ejemplo n.º 6
0
void blinkTask(void *parameters)
{
   //Endless loop
   while(1)
   {
      GPIO_SetBits(LED1_GPIO, LED1_PIN);
      osDelayTask(100);
      GPIO_ResetBits(LED1_GPIO, LED1_PIN);
      osDelayTask(900);
   }
}
Ejemplo n.º 7
0
void blinkTask(void *param)
{
   //Endless loop
   while(1)
   {
      setLed(AT91B_LED1);
      osDelayTask(100);
      clearLed(AT91B_LED1);
      osDelayTask(900);
   }
}
Ejemplo n.º 8
0
void blinkTask(void *parameters)
{
   //Endless loop
   while(1)
   {
      LATDSET = LED1_MASK;
      osDelayTask(100);
      LATDCLR = LED1_MASK;
      osDelayTask(900);
   }
}
Ejemplo n.º 9
0
void blinkTask(void *parameters)
{
   //Endless loop
   while(1)
   {
      LPC_GPIO_PORT->CLR[LED2_PORT] = LED2_MASK;
      osDelayTask(100);
      LPC_GPIO_PORT->SET[LED2_PORT] = LED2_MASK;
      osDelayTask(900);
   }
}
Ejemplo n.º 10
0
void blinkTask(void *parameters)
{
   //Endless loop
   while(1)
   {
      MSS_GPIO_set_output(MSS_GPIO_0, 0);
      osDelayTask(100);
      MSS_GPIO_set_output(MSS_GPIO_0, 1);
      osDelayTask(900);
   }
}
Ejemplo n.º 11
0
void blinkTask(void *parameters)
{
   //Endless loop
   while(1)
   {
      GPIOPinWrite(GPIO_PORTC_BASE, GPIO_PIN_6, 0);
      osDelayTask(100);
      GPIOPinWrite(GPIO_PORTC_BASE, GPIO_PIN_6, GPIO_PIN_6);
      osDelayTask(900);
   }
}
Ejemplo n.º 12
0
void blinkTask(void *parameters)
{
   //Endless loop
   while(1)
   {
      GPIO_LED1->PCOR = LED1_MASK;
      osDelayTask(100);
      GPIO_LED1->PSOR = LED1_MASK;
      osDelayTask(900);
   }
}
Ejemplo n.º 13
0
void blinkTask(void *parameters)
{
    while(1)
    {
        //Blink LED1 and LED2
        AT91D_BASE_PIO_LED1->PIO_CODR = AT91B_LED1;
        AT91D_BASE_PIO_LED2->PIO_SODR = AT91B_LED2;
        osDelayTask(500);

        AT91D_BASE_PIO_LED1->PIO_SODR = AT91B_LED1;
        AT91D_BASE_PIO_LED2->PIO_CODR = AT91B_LED2;
        osDelayTask(500);
    }
}
Ejemplo n.º 14
0
void userTask(void *param)
{
   char_t buffer[40];

   //Point to the network interface
   NetInterface *interface = &netInterface[0];

   //Initialize LCD display
   lcdSetCursor(2, 0);
   printf("IPv4 Addr\r\n");
   lcdSetCursor(5, 0);
   printf("Press user button\r\nto run test\r\n");

   //Endless loop
   while(1)
   {
      //Display IPv4 host address
      lcdSetCursor(3, 0);
      printf("%-16s\r\n", ipv4AddrToString(interface->ipv4Config.addr, buffer));

      //User button pressed?
      if(!STM_EVAL_PBGetState(BUTTON_KEY))
      {
         //FTP client test routine
         ftpClientTest();

         //Wait for the user button to be released
         while(!STM_EVAL_PBGetState(BUTTON_KEY));
      }

      //Loop delay
      osDelayTask(100);
   }
}
Ejemplo n.º 15
0
void userTask(void *param)
{
   char_t buffer[40];

   //Point to the network interface
   NetInterface *interface = &netInterface[0];

   //Endless loop
   while(1)
   {
      //Display IPv4 host address
      lcdSetCursor(1, 0);
      printf("%-16s", ipv4AddrToString(interface->ipv4Config.addr, buffer));

      //SW1 pressed?
      if(!(MSS_GPIO_get_inputs() & (1 << MSS_GPIO_8)))
      {
         //FTP client test routine
         ftpClientTest();

         //Wait for SW1 to be released
         while(!(MSS_GPIO_get_inputs() & (1 << MSS_GPIO_8)));
      }

      //Loop delay
      osDelayTask(100);
   }
}
Ejemplo n.º 16
0
void userTask(void *param)
{
   char_t buffer[40];

   //Point to the network interface
   NetInterface *interface = &netInterface[0];

   //Initialize LCD display
   lcdSetCursor(2, 0);
   printf("IPv4 Addr");
   lcdSetCursor(5, 0);
   printf("Press user button\r\nto run test");

   //Endless loop
   while(1)
   {
#if (IPV4_SUPPORT == ENABLED)
      //Display IPv4 host address
      lcdSetCursor(3, 0);
      printf("%-16s", ipv4AddrToString(interface->ipv4Config.addr, buffer));
#endif

      //Loop delay
      osDelayTask(500);
   }
}
Ejemplo n.º 17
0
void userTask(void *param)
{
   char_t buffer[40];

   //Point to the network interface
   NetInterface *interface = &netInterface[0];

   //Initialize LCD display
   lcdSetCursor(2, 0);
   printf("IPv4 Addr\r\n");

   //Endless loop
   while(1)
   {
#if (IPV4_SUPPORT == ENABLED)
      //Display IPv4 host address
      lcdSetCursor(3, 0);
      printf("%-16s\r\n", ipv4AddrToString(interface->ipv4Config.addr, buffer));
#endif

      lcdSetCursor(5, 0);
      printf("button=%d\r\n", GPIO_ReadBit(GPIO5, GPIO_Pin_4));
      //Loop delay
      osDelayTask(100);
   }
}
Ejemplo n.º 18
0
void userTask(void *param)
{
   char_t buffer[40];

   //Point to the network interface
   NetInterface *interface = &netInterface[0];

   //Initialize LCD display
   lcdSetCursor(2, 0);
   printf("IPv4 Addr\r\n");
   lcdSetCursor(5, 0);
   printf("Press user button\r\nto run test\r\n");

   //Endless loop
   while(1)
   {
      //Display IPv4 host address
      lcdSetCursor(3, 0);
      printf("%-16s\r\n", ipv4AddrToString(interface->ipv4Config.addr, buffer));

      //Up button pressed?
      //if(!(PIO_BT_UP->PIO_PDSR & BT_UP))
      {
         //SSL client test routine
         sslClientTest();

         //Wait for the up button to be released
         //while(!(PIO_BT_UP->PIO_PDSR & BT_UP));
      }

      //Loop delay
      osDelayTask(5000);
   }
}
Ejemplo n.º 19
0
void userTask(void *param)
{
    //Endless loop
    while(1)
    {
        //FTP client test routine
        ftpClientTest();

        //Loop delay
        osDelayTask(10000);
    }
}
Ejemplo n.º 20
0
void userTask(void *param)
{
   //Initial delay
   osDelayTask(100);

   //Endless loop
   while(1)
   {
      //BUT1 button pressed?
      if(!(LPC_GPIO_PORT->PIN[SW2_PORT] & SW2_MASK))
      {
         //FTP client test routine
         ftpClientTest();

         //Wait for the button to be released
         while(!(LPC_GPIO_PORT->PIN[SW2_PORT] & SW2_MASK));
      }

      //Loop delay
      osDelayTask(100);
   }
}
Ejemplo n.º 21
0
void blinkTask(void *parameters)
{
   //Endless loop
   while(1)
   {
      LED4 = LED_ON;
      LED5 = LED_ON;
      LED8 = LED_ON;
      LED9 = LED_ON;
      LED12 = LED_ON;
      LED13 = LED_ON;
      osDelayTask(100);

      LED4 = LED_OFF;
      LED5 = LED_OFF;
      LED8 = LED_OFF;
      LED9 = LED_OFF;
      LED12 = LED_OFF;
      LED13 = LED_OFF;
      osDelayTask(900);
   }
}
Ejemplo n.º 22
0
void userTask(void *param)
{
   char_t buffer[40];

   //Point to the network interface
   NetInterface *interface = &netInterface[0];

   lcdSetCursor(2, 0);
   printf("IPv4 Address\r\n");
   lcdSetCursor(5, 0);
   printf("IPv6 Link-Local Address\r\n");
   lcdSetCursor(8, 0);
   printf("IPv6 Global Address\r\n");
   lcdSetCursor(11, 0);
   printf("Press SELECT button to run test\r\n");

   //Endless loop
   while(1)
   {
#if (IPV4_SUPPORT == ENABLED)
      //Display IPv4 host address
      lcdSetCursor(3, 0);
      printf("%-16s\r\n", ipv4AddrToString(interface->ipv4Config.addr, buffer));
#endif

#if (IPV6_SUPPORT == ENABLED)
      //Display IPv6 link-local address
      lcdSetCursor(6, 0);
      printf("%-40s\r\n", ipv6AddrToString(&interface->ipv6Config.linkLocalAddr, buffer));

      //Display IPv6 global address
      lcdSetCursor(9, 0);
      printf("%-40s\r\n", ipv6AddrToString(&interface->ipv6Config.globalAddr, buffer));
#endif

      //SELECT button pressed?
      if(!GPIOPinRead(GPIO_PORTP_BASE, GPIO_PIN_1))
      {
         //FTP client test routine
         ftpClientTest();

         //Wait for the SELECT button to be released
         while(!GPIOPinRead(GPIO_PORTP_BASE, GPIO_PIN_1));
      }

      //Loop delay
      osDelayTask(100);
   }
}
Ejemplo n.º 23
0
void userTask(void *param)
{
    char_t buffer[40];

    //Point to the network interface
    NetInterface *interface = &netInterface[0];

    //Initialize LCD display
    lcdSetCursor(2, 0);
    printf("IPv4 Addr\r\n");
    lcdSetCursor(5, 0);
    printf("IPv6 Link-Local Addr\r\n");
    lcdSetCursor(8, 0);
    printf("IPv6 Global Addr\r\n");

    //Endless loop
    while(1)
    {
#if (IPV4_SUPPORT == ENABLED)
        //Display IPv4 host address
        lcdSetCursor(3, 0);
        printf("%-16s\r\n", ipv4AddrToString(interface->ipv4Config.addr, buffer));
#endif

#if (IPV6_SUPPORT == ENABLED)
        //Display IPv6 link-local address
        lcdSetCursor(6, 0);
        printf("%-40s\r\n", ipv6AddrToString(&interface->ipv6Config.linkLocalAddr, buffer));

        //Display IPv6 global address
        lcdSetCursor(9, 0);
        printf("%-40s\r\n", ipv6AddrToString(&interface->ipv6Config.globalAddr, buffer));
#endif

        //User button pressed?
        if(BSP_PB_GetState(BUTTON_KEY))
        {
            //FTP client test routine
            ftpClientTest();

            //Wait for the user button to be released
            while(BSP_PB_GetState(BUTTON_KEY));
        }

        //Loop delay
        osDelayTask(100);
    }
}
Ejemplo n.º 24
0
void userTask(void *param)
{
   //Endless loop
   while(1)
   {
      //SW2 button pressed?
      if(!(GPIO_SW2->PDIR & SW2_MASK))
      {
         //FTP client test routine
         ftpClientTest();

         //Wait for the SW2 button to be released
         while(!(GPIO_SW2->PDIR & SW2_MASK));
      }

      //Loop delay
      osDelayTask(100);
   }
}
Ejemplo n.º 25
0
void userTask(void *param)
{
   //Endless loop
   while(1)
   {
      //WKUP button pressed?
      if(GPIO_ReadInputData(WKUP_GPIO) & WKUP_PIN)
      {
         //FTP client test routine
         ftpClientTest();

         //Wait for the WKUP button to be released
         while(GPIO_ReadInputData(WKUP_GPIO) & WKUP_PIN);
      }

      //Loop delay
      osDelayTask(100);
   }
}
Ejemplo n.º 26
0
void userTask(void *param)
{
   //Endless loop
   while(1)
   {
      //SW1 button pressed?
      if(!(PORTD & SW1_MASK))
      {
         //SMTP client test routine
         smtpClientTest();

         //Wait for the SW1 button to be released
         while(!(PORTD & SW1_MASK));
      }

      //Loop delay
      osDelayTask(100);
   }
}
Ejemplo n.º 27
0
void userTask(void *param)
{
   char_t buffer[40];

   //Point to the network interface
   NetInterface *interface = &netInterface[0];

   //Initialize LCD display
   lcdSetCursor(1, 0);
   printf("IPv4 Addr\r\n");
   lcdSetCursor(4, 0);
   printf("IPv6 Link-Local Addr\r\n");
   lcdSetCursor(7, 0);
   printf("IPv6 Global Addr\r\n");

   //Endless loop
   while(1)
   {
#if (IPV4_SUPPORT == ENABLED)
      //Display IPv4 host address
      lcdSetCursor(2, 0);
      printf("%-16s\r\n", ipv4AddrToString(interface->ipv4Config.addr, buffer));
#endif

#if (IPV6_SUPPORT == ENABLED)
      //Display IPv6 link-local address
      lcdSetCursor(5, 0);
      printf("%-40s\r\n", ipv6AddrToString(&interface->ipv6Config.linkLocalAddr, buffer));

      //Display IPv6 global address
      lcdSetCursor(8, 0);
      printf("%-40s\r\n", ipv6AddrToString(&interface->ipv6Config.globalAddr, buffer));
#endif

      //Start A/D conversion
      adcValue = (1023 - adcGetValue()) * 4;

      //Loop delay
      osDelayTask(500);
   }
}
Ejemplo n.º 28
0
void userTask(void *param)
{
   char_t buffer[40];

   //Point to the network interface
   NetInterface *interface = &netInterface[0];

   //Initialize LCD display
   lcdSetCursor(3, 0);
   printf("IPv4 Addr\r\n");
   lcdSetCursor(6, 0);
   printf("Press SW1 to\r\n");
   lcdSetCursor(7, 0);
   printf("run test\r\n");

   //Endless loop
   while(1)
   {
      //Display IPv4 host address
      lcdSetCursor(4, 0);
      printf("%-16s\r\n", ipv4AddrToString(interface->ipv4Config.addr, buffer));

      //SW1 button pressed?
      if(!SW1)
      {
         //FTP client test routine
         ftpClientTest();

         //Wait for SW1 button to be released
         while(!SW1);
      }

      //Loop delay
      osDelayTask(100);
   }
}
Ejemplo n.º 29
0
error_t nbnsResolve(NetInterface *interface, const char_t *name, IpAddr *ipAddr)
{
   error_t error;
   DnsCacheEntry *entry;

#if (NET_RTOS_SUPPORT == ENABLED)
   systime_t delay;

   //Debug message
   TRACE_INFO("Resolving host name %s (NBNS resolver)...\r\n", name);
#endif

   //Acquire exclusive access to the DNS cache
   osAcquireMutex(&dnsCacheMutex);

   //Search the DNS cache for the specified host name
   entry = dnsFindEntry(interface, name, HOST_TYPE_IPV4, HOST_NAME_RESOLVER_NBNS);

   //Check whether a matching entry has been found
   if(entry)
   {
      //Host name already resolved?
      if(entry->state == DNS_STATE_RESOLVED ||
         entry->state == DNS_STATE_PERMANENT)
      {
         //Return the corresponding IP address
         *ipAddr = entry->ipAddr;
         //Successful host name resolution
         error = NO_ERROR;
      }
      else
      {
         //Host name resolution is in progress...
         error = ERROR_IN_PROGRESS;
      }
   }
   else
   {
      //If no entry exists, then create a new one
      entry = dnsCreateEntry();

      //Record the host name whose IP address is unknown
      strcpy(entry->name, name);

      //Initialize DNS cache entry
      entry->type = HOST_TYPE_IPV4;
      entry->protocol = HOST_NAME_RESOLVER_NBNS;
      entry->interface = interface;

      //Initialize retransmission counter
      entry->retransmitCount = NBNS_CLIENT_MAX_RETRIES;
      //Send NBNS query
      error = nbnsSendQuery(entry);

      //NBNS message successfully sent?
      if(!error)
      {
         //Save the time at which the query message was sent
         entry->timestamp = osGetSystemTime();
         //Set timeout value
         entry->timeout = NBNS_CLIENT_INIT_TIMEOUT;
         entry->maxTimeout = NBNS_CLIENT_MAX_TIMEOUT;
         //Decrement retransmission counter
         entry->retransmitCount--;

         //Switch state
         entry->state = DNS_STATE_IN_PROGRESS;
         //Host name resolution is in progress
         error = ERROR_IN_PROGRESS;
      }
   }

   //Release exclusive access to the DNS cache
   osReleaseMutex(&dnsCacheMutex);

#if (NET_RTOS_SUPPORT == ENABLED)
   //Set default polling interval
   delay = DNS_CACHE_INIT_POLLING_INTERVAL;

   //Wait the host name resolution to complete
   while(error == ERROR_IN_PROGRESS)
   {
      //Wait until the next polling period
      osDelayTask(delay);

      //Acquire exclusive access to the DNS cache
      osAcquireMutex(&dnsCacheMutex);

      //Search the DNS cache for the specified host name
      entry = dnsFindEntry(interface, name, HOST_TYPE_IPV4, HOST_NAME_RESOLVER_NBNS);

      //Check whether a matching entry has been found
      if(entry)
      {
         //Host name successfully resolved?
         if(entry->state == DNS_STATE_RESOLVED)
         {
            //Return the corresponding IP address
            *ipAddr = entry->ipAddr;
            //Successful host name resolution
            error = NO_ERROR;
         }
      }
      else
      {
         //Host name resolution failed
         error = ERROR_FAILURE;
      }

      //Release exclusive access to the DNS cache
      osReleaseMutex(&dnsCacheMutex);

      //Backoff support for less aggressive polling
      delay = MIN(delay * 2, DNS_CACHE_MAX_POLLING_INTERVAL);
   }

   //Check status code
   if(error)
   {
      //Failed to resolve host name
      TRACE_INFO("Host name resolution failed!\r\n");
   }
   else
   {
      //Successful host name resolution
      TRACE_INFO("Host name resolved to %s...\r\n", ipAddrToString(ipAddr, NULL));
   }
#endif

   //Return status code
   return error;
}
Ejemplo n.º 30
0
error_t dnsResolve(NetInterface *interface,
   const char_t *name, HostType type, IpAddr *ipAddr)
{
   error_t error;
   systime_t delay;
   DnsCacheEntry *entry;

   //Debug message
   TRACE_INFO("Resolving host name %s (DNS resolver)...\r\n", name);

   //Acquire exclusive access to the DNS cache
   osAcquireMutex(&dnsCacheMutex);

   //Search the DNS cache for the specified host name
   entry = dnsFindEntry(interface, name, type, HOST_NAME_RESOLVER_DNS);

   //Check whether a matching entry has been found
   if(entry)
   {
      //Host name already resolved?
      if(entry->state == DNS_STATE_RESOLVED ||
         entry->state == DNS_STATE_PERMANENT)
      {
         //Return the corresponding IP address
         *ipAddr = entry->ipAddr;
         //Successful host name resolution
         error = NO_ERROR;
      }
      else
      {
         //Host name resolution is in progress...
         error = ERROR_IN_PROGRESS;
      }
   }
   else
   {
      //If no entry exists, then create a new one
      entry = dnsCreateEntry();

      //Record the host name whose IP address is unknown
      strcpy(entry->name, name);

      //Initialize DNS cache entry
      entry->type = type;
      entry->protocol = HOST_NAME_RESOLVER_DNS;
      entry->interface = interface;
      //Select primary DNS server
      entry->dnsServerNum = 0;
      //Get an ephemeral port number
      entry->port = udpGetDynamicPort();

      //An identifier is used by the DNS client to match replies
      //with corresponding requests
      entry->id = netGetRand();

      //Callback function to be called when a DNS response is received
      error = udpAttachRxCallback(interface, entry->port, dnsProcessResponse, NULL);

      //Check status code
      if(!error)
      {
         //Initialize retransmission counter
         entry->retransmitCount = DNS_CLIENT_MAX_RETRIES;
         //Send DNS query
         error = dnsSendQuery(entry);

         //DNS message successfully sent?
         if(!error)
         {
            //Save the time at which the query message was sent
            entry->timestamp = osGetSystemTime();
            //Set timeout value
            entry->timeout = DNS_CLIENT_INIT_TIMEOUT;
            entry->maxTimeout = DNS_CLIENT_MAX_TIMEOUT;
            //Decrement retransmission counter
            entry->retransmitCount--;

            //Switch state
            entry->state = DNS_STATE_IN_PROGRESS;
            //Host name resolution is in progress
            error = ERROR_IN_PROGRESS;
         }
         else
         {
            //Unregister callback function
            udpDetachRxCallback(interface, entry->port);
         }
      }
   }

   //Release exclusive access to the DNS cache
   osReleaseMutex(&dnsCacheMutex);

   //Set default polling interval
   delay = DNS_CACHE_INIT_POLLING_INTERVAL;

   //Wait the host name resolution to complete
   while(error == ERROR_IN_PROGRESS)
   {
      //Wait until the next polling period
      osDelayTask(delay);

      //Acquire exclusive access to the DNS cache
      osAcquireMutex(&dnsCacheMutex);

      //Search the DNS cache for the specified host name
      entry = dnsFindEntry(interface, name, type, HOST_NAME_RESOLVER_DNS);

      //Check whether a matching entry has been found
      if(entry)
      {
         //Host name successfully resolved?
         if(entry->state == DNS_STATE_RESOLVED)
         {
            //Return the corresponding IP address
            *ipAddr = entry->ipAddr;
            //Successful host name resolution
            error = NO_ERROR;
         }
      }
      else
      {
         //Host name resolution failed
         error = ERROR_FAILURE;
      }

      //Release exclusive access to the DNS cache
      osReleaseMutex(&dnsCacheMutex);

      //Backoff support for less aggressive polling
      delay = MIN(delay * 2, DNS_CACHE_MAX_POLLING_INTERVAL);
   }

   //Check status code
   if(error)
   {
      //Failed to resolve host name
      TRACE_INFO("Host name resolution failed!\r\n");
   }
   else
   {
      //Successful host name resolution
      TRACE_INFO("Host name resolved to %s...\r\n", ipAddrToString(ipAddr, NULL));
   }

   //Return status code
   return error;
}